diff --git "a/web/dist-embed/index.html" "b/web/dist-embed/index.html" --- "a/web/dist-embed/index.html" +++ "b/web/dist-embed/index.html" @@ -185,23 +185,23 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`

An error allowNegative: `+a+` `),a=!1),Object.assign(Object.assign({},e),{allowNegative:a})}function fu(e){e=du(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,n=e.allowNegative,r=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=kl);var a=e.onBlur;a===void 0&&(a=kl);var o=e.thousandSeparator,s=e.decimalScale,c=e.fixedDecimalScale,l=e.prefix;l===void 0&&(l=``);var u=e.defaultValue,d=e.value,f=e.valueIsNumericString,p=e.onValueChange,m=Ol(e,[`decimalSeparator`,`allowedDecimalSeparators`,`thousandsGroupStyle`,`suffix`,`allowNegative`,`allowLeadingZeros`,`onKeyDown`,`onBlur`,`thousandSeparator`,`decimalScale`,`fixedDecimalScale`,`prefix`,`defaultValue`,`value`,`valueIsNumericString`,`onValueChange`]),h=au(e),g=h.decimalSeparator,_=h.allowedDecimalSeparators,v=function(t){return iu(t,e)},y=function(t,n){return lu(t,n,e)},b=Ml(d)?u:d,x=f??cu(b,l,t);Ml(d)?Ml(u)||(x||=typeof u==`number`):x||=typeof d==`number`;var S=function(e){return Pl(e)?e:(typeof e==`number`&&(e=Ul(e)),x&&typeof s==`number`?Wl(e,s,!!c):e)},C=eu(S(d),S(u),!!x,v,y,p),w=C[0],T=w.numAsString,E=w.formattedValue,D=C[1];return Object.assign(Object.assign({},m),{value:E,valueIsNumericString:!1,isValidInputCharacter:function(e){return e===g||jl(e)},isCharacterSame:function(e){var t=e.currentValue,n=e.lastValue,r=e.formattedValue,i=e.currentValueIndex,a=e.formattedValueIndex,o=t[i],u=r[a],f=gu(n,t).to,p=function(e){return y(e).indexOf(`.`)+l.length};return d===0&&c&&s&&t[f.start]===g&&p(t)a?!1:i>=f.start&&i{mu=u(f()),(function(e){e.event=`event`,e.props=`prop`})(hu||={}),gu=Al(function(e,t){for(var n=0,r=0,i=e.length,a=t.length;e[n]===t[n]&&nn&&i-r>n;)r++;return{from:{start:n,end:i-r},to:{start:n,end:a-r}}}),_u=function(e,t){var n=Math.min(e.selectionStart,t);return{from:{start:n,end:e.selectionEnd},to:{start:n,end:t}}}})),yu=c({default:()=>Cu});function bu(){return Intl.NumberFormat()?.formatToParts(1.1)?.find(e=>e.type===`decimal`)?.value??`.`}function xu(){return bu()===`.`?`,`:`.`}var Su,Cu,wu=o((()=>{Su=u(f(),1),Dl(),vu(),Cu=e=>{let{value:t,onChange:n,disabled:r,highlight:i,validatedSelection:a,fixedDecimals:o,allowNegative:s,thousandSeparator:c,decimalSeparator:l}=e,u=Su.useRef();return Su.useLayoutEffect(()=>{if(a!==void 0){let e=typeof a==`number`?[a,null]:a;u.current?.setSelectionRange(e[0],e[1])}},[a]),Su.createElement(El,null,Su.createElement(pu,{autoFocus:!0,getInputRef:u,className:`gdg-input`,onFocus:e=>e.target.setSelectionRange(i?0:e.target.value.length,e.target.value.length),disabled:r===!0,decimalScale:o,allowNegative:s,thousandSeparator:c??xu(),decimalSeparator:l??bu(),value:Object.is(t,-0)?`-`:t??``,onValueChange:n}))}}));ot();var Tu=z.lazy(async()=>await Tc(()=>Promise.resolve().then(()=>(wu(),yu)),void 0,import.meta.url)),ree={getAccessibilityString:e=>e.data?.toString()??``,kind:R.Number,needsHover:!1,needsHoverPosition:!1,useLabel:!0,drawPrep:$r,draw:e=>ii(e,e.cell.displayData,e.cell.contentAlign),measure:(e,t,n)=>e.measureText(t.displayData).width+n.cellHorizontalPadding*2,onDelete:e=>({...e,data:void 0}),provideEditor:()=>e=>{let{isHighlighted:t,onChange:n,value:r,validatedSelection:i}=e;return z.createElement(z.Suspense,{fallback:null},z.createElement(Tu,{highlight:t,disabled:r.readonly===!0,value:r.data,fixedDecimals:r.fixedDecimals,allowNegative:r.allowNegative,thousandSeparator:r.thousandSeparator,decimalSeparator:r.decimalSeparator,validatedSelection:i,onChange:e=>n({...r,data:Number.isNaN(e.floatValue??0)?0:e.floatValue})}))},onPaste:(e,t,n)=>{let r=typeof n.rawValue==`number`?n.rawValue:Number.parseFloat(typeof n.rawValue==`string`?n.rawValue:e);if(!(Number.isNaN(r)||t.data===r))return{...t,data:r,displayData:n.formattedString??t.displayData}}};ot();var Eu={getAccessibilityString:()=>``,measure:()=>108,kind:R.Protected,needsHover:!1,needsHoverPosition:!1,draw:iee,onPaste:()=>void 0};function iee(e){let{ctx:t,theme:n,rect:r}=e,{x:i,y:a,height:o}=r;t.beginPath();let s=2.5,c=i+n.cellHorizontalPadding+s,l=a+o/2,u=Math.cos(Jt(30))*s,d=Math.sin(Jt(30))*s;for(let e=0;e<12;e++)t.moveTo(c,l-s),t.lineTo(c,l+s),t.moveTo(c+u,l-d),t.lineTo(c-u,l+d),t.moveTo(c-u,l-d),t.lineTo(c+u,l+d),c+=8;t.lineWidth=1.1,t.lineCap=`square`,t.strokeStyle=n.textLight,t.stroke()}ot();var Du={getAccessibilityString:e=>e.data?.toString()??``,kind:R.RowID,needsHover:!1,needsHoverPosition:!1,drawPrep:(e,t)=>$r(e,t,e.theme.textLight),draw:e=>ii(e,e.cell.data,e.cell.contentAlign),measure:(e,t,n)=>e.measureText(t.data).width+n.cellHorizontalPadding*2,provideEditor:()=>e=>{let{isHighlighted:t,onChange:n,value:r,validatedSelection:i}=e;return z.createElement(sr,{highlight:t,autoFocus:r.readonly!==!0,disabled:r.readonly!==!1,value:r.data,validatedSelection:i,onChange:e=>n({...r,data:e.target.value})})},onPaste:()=>void 0};ot(),gr();var aee={getAccessibilityString:e=>e.data?.toString()??``,kind:R.Text,needsHover:e=>e.hoverEffect===!0,needsHoverPosition:!1,drawPrep:$r,useLabel:!0,draw:e=>{let{cell:t,hoverAmount:n,hyperWrapping:r,ctx:i,rect:a,theme:o,overrideCursor:s}=e,{displayData:c,contentAlign:l,hoverEffect:u,allowWrapping:d}=t;if(u===!0&&n>0){i.textBaseline=`alphabetic`;let e=o.cellHorizontalPadding,t=o.cellVerticalPadding,r=Kr(c,i,o.baseFontFull,`alphabetic`),l=a.height-t,u=Math.min(l,r.actualBoundingBoxAscent*2.5);i.beginPath(),ai(i,a.x+e/2,a.y+(a.height-u)/2+1,r.width+e*3,u-1,o.roundingRadius??4),i.globalAlpha=n,i.fillStyle=ur(o.textDark,.1),i.fill(),i.globalAlpha=1,i.fillStyle=o.textDark,i.textBaseline=`middle`,s?.(`text`)}ii(e,c,l,d,r)},measure:(e,t,n)=>{let r=t.displayData.split(` `,t.allowWrapping===!0?void 0:1),i=0;for(let t of r)i=Math.max(i,e.measureText(t).width);return i+2*n.cellHorizontalPadding},onDelete:e=>({...e,data:``}),provideEditor:e=>({disablePadding:e.allowWrapping===!0,editor:t=>{let{isHighlighted:n,onChange:r,value:i,validatedSelection:a}=t;return z.createElement(sr,{style:e.allowWrapping===!0?{padding:`3px 8.5px`}:void 0,highlight:n,autoFocus:i.readonly!==!0,disabled:i.readonly===!0,altNewline:!0,value:i.data,validatedSelection:a,onChange:e=>r({...i,data:e.target.value})})}}),onPaste:(e,t,n)=>e===t.data?void 0:{...t,data:e,displayData:n.formattedString??t.displayData}};bt();var Ou=yt(`div`)({name:`UriOverlayEditorStyle`,class:`gdg-u1rrojo`,propsAsIs:!1}),oee=e=>{let{uri:t,onChange:n,forceEditMode:r,readonly:i,validatedSelection:a,preview:o}=e,[s,c]=z.useState(!i&&(t===``||r)),l=z.useCallback(()=>{c(!0)},[]);return s?z.createElement(sr,{validatedSelection:a,highlight:!0,autoFocus:!0,value:t,onChange:n}):z.createElement(Ou,null,z.createElement(`a`,{className:`gdg-link-area`,href:t,target:`_blank`,rel:`noopener noreferrer`},o),!i&&z.createElement(`div`,{className:`gdg-edit-icon`,onClick:l},z.createElement($t,null)),z.createElement(`textarea`,{className:`gdg-input`,autoFocus:!0}))};ot();function see(e,t,n,r){let i=n.cellHorizontalPadding,a=t.height/2-e.actualBoundingBoxAscent/2,o=e.width,s=e.actualBoundingBoxAscent;return r===`right`?i=t.width-o-n.cellHorizontalPadding:r===`center`&&(i=t.width/2-o/2),{x:i,y:a,width:o,height:s}}var cee=[bl,wl,Qc,nl,sl,fl,gl,yl,ree,Eu,Du,aee,{getAccessibilityString:e=>e.data?.toString()??``,kind:R.Uri,needsHover:e=>e.hoverEffect===!0,needsHoverPosition:!0,useLabel:!0,drawPrep:$r,draw:e=>{let{cell:t,theme:n,overrideCursor:r,hoverX:i,hoverY:a,rect:o,ctx:s}=e,c=t.displayData??t.data,l=t.hoverEffect===!0;if(r!==void 0&&l&&i!==void 0&&a!==void 0){let{x:l,y:u,width:d,height:f}=see(Kr(c,s,n.baseFontFull),o,n,t.contentAlign);if(i>=l-4&&i<=l-4+d+8&&a>=u-4&&a<=u-4+f+8){let i=Jr(s,n.baseFontFull);r(`pointer`);let a=u-i;s.beginPath(),s.moveTo(o.x+l,Math.floor(o.y+a+f+5)+.5),s.lineTo(o.x+l+d,Math.floor(o.y+a+f+5)+.5),s.strokeStyle=n.linkColor,s.stroke(),s.save(),s.fillStyle=e.cellFillColor,ii({...e,rect:{...o,x:o.x-1}},c,t.contentAlign),ii({...e,rect:{...o,x:o.x-2}},c,t.contentAlign),ii({...e,rect:{...o,x:o.x+1}},c,t.contentAlign),ii({...e,rect:{...o,x:o.x+2}},c,t.contentAlign),s.restore()}}s.fillStyle=l?n.linkColor:n.textDark,ii(e,c,t.contentAlign)},onClick:e=>{let{cell:t,bounds:n,posX:r,posY:i,theme:a}=e,o=t.displayData??t.data;if(t.hoverEffect!==!0||t.onClickUri===void 0)return;let s=qr(o,a.baseFontFull);if(s===void 0)return;let c=see(s,n,a,t.contentAlign);va({x:c.x-4,y:c.y-4,width:c.width+8,height:c.height+8},r,i)&&t.onClickUri(e)},measure:(e,t,n)=>e.measureText(t.displayData??t.data).width+n.cellHorizontalPadding*2,onDelete:e=>({...e,data:``}),provideEditor:e=>t=>{let{onChange:n,value:r,forceEditMode:i,validatedSelection:a}=t;return z.createElement(oee,{forceEditMode:r.readonly!==!0&&(i||e.hoverEffect===!0&&e.onClickUri!==void 0),uri:r.data,preview:r.displayData??r.data,validatedSelection:a,readonly:r.readonly===!0,onChange:e=>n({...r,data:e.target.value})})},onPaste:(e,t,n)=>e===t.data?void 0:{...t,data:e,displayData:n.formattedString??t.displayData}}],lee=u(s(((e,t)=>{var n=Ut(),r=te(),i=`Expected a function`;function a(e,t,a){var o=!0,s=!0;if(typeof e!=`function`)throw TypeError(i);return r(a)&&(o=`leading`in a?!!a.leading:o,s=`trailing`in a?!!a.trailing:s),n(e,t,{leading:o,maxWait:t,trailing:s})}t.exports=a}))(),1),ku=[],uee=class extends mi{imageLoaded=()=>void 0;loadedLocations=[];cache={};setCallback(e){this.imageLoaded=e}sendLoaded=(0,lee.default)(()=>{this.imageLoaded(new gi(this.loadedLocations)),this.loadedLocations=[]},20);clearOutOfWindow=()=>{let e=Object.keys(this.cache);for(let t of e){let e=this.cache[t],n=!1;for(let t=0;t{o||(o=!0,ku.length<12?ku.unshift(a):i||(a.src=``))}},c=new Promise(e=>a.addEventListener(`load`,()=>e(null)));requestAnimationFrame(async()=>{try{a.src=e,await c,await a.decode();let t=this.cache[r];if(t!==void 0&&!o){t.img=a;for(let e of t.cells)this.loadedLocations.push(pi(e));i=!0,this.sendLoaded()}}catch{s.cancel()}}),this.cache[r]=s}loadOrGetImage(e,t,n){let r=e,i=this.cache[r];if(i!==void 0){let e=ui(t,n);return i.cells.includes(e)||i.cells.push(e),i.img}else this.loadImage(e,t,n,r)}},dee=z.forwardRef((e,t)=>{let n=z.useMemo(()=>({...la,...e.headerIcons}),[e.headerIcons]),r=z.useMemo(()=>e.imageWindowLoader??new uee,[e.imageWindowLoader]);return z.createElement(Xc,{...e,renderers:cee,headerIcons:n,ref:t,imageWindowLoader:r})}),Au=[`all_time`,`today`,`yesterday`,`this_week`,`last_week`,`this_month`,`last_month`,`this_quarter`,`last_quarter`,`this_year`,`last_year`,`ytd`,`ytd_last_year`,`ltm`,`past_week`,`past_month`,`past_year`,`last_n_days`,`next_n_days`,`custom`],ju=new Set([`last_n_days`,`next_n_days`]),Mu={all_time:`all time`,today:`today`,yesterday:`yesterday`,this_week:`this week`,last_week:`last week`,this_month:`this month`,last_month:`last month`,this_quarter:`this quarter`,last_quarter:`last quarter`,this_year:`this year`,last_year:`last year`,ytd:`year to date`,ytd_last_year:`last year to date`,ltm:`the last 12 months`,past_week:`the past week`,past_month:`the past month`,past_year:`the past year`,last_n_days:`the last {n} days`,next_n_days:`the next {n} days`,custom:`a custom range`},Nu=[`today`,`yesterday`,`one_week_ago`,`one_month_ago`,`n_days_ago`,`exact`],fee=new Set([`today`,`yesterday`,`one_week_ago`,`one_month_ago`]),Pu={today:`today`,yesterday:`yesterday`,one_week_ago:`one week ago`,one_month_ago:`one month ago`,n_days_ago:`{n} days ago`,exact:`an exact date`};function Fu(e){let t=String(e??``).trim().slice(0,10);if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return null;let n=new Date(`${t}T00:00:00Z`);return Number.isNaN(n.getTime())?null:n}function Iu(e){return e.toISOString().slice(0,10)}function Lu(e,t){return new Date(e.getTime()+t*864e5)}function Ru(e){return[e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate()]}function zu(e,t,n){return new Date(Date.UTC(e,t-1,n))}function Bu(e){let[t,n]=Ru(e);return zu(t,n,1)}function Vu(e){let[t,n]=Ru(e);return n===12?zu(t,12,31):Lu(zu(t,n+1,1),-1)}function Hu(e){return(e.getUTCDay()+6)%7}function Uu(e){let[t,n]=Ru(e);return zu(t,3*Math.floor((n-1)/3)+1,1)}function pee(e,t){return new Date(Date.UTC(t===12?e+1:e,t===12?0:t,1)-864e5).getUTCDate()}function Wu(e,t){let[n,r,i]=Ru(e),a=n*12+(r-1)+t,o=Math.floor(a/12),s=a-o*12+1;return zu(o,s,Math.min(i,pee(o,s)))}function Gu(e){if(!e||typeof e!=`object`)return null;let t=e,n=t.kind;if(!Au.includes(n))return null;let r={kind:n};if(ju.has(n)){let e=Number(t.n);if(!Number.isInteger(e)||e<1||e>3650)return null;r.n=e}if(n===`custom`){let e=Fu(t.from),n=Fu(t.to);if(!e&&!n)return null;e&&n&&e>n&&([e,n]=[n,e]),e&&(r.from=Iu(e)),n&&(r.to=Iu(n))}return r}function Ku(e,t){let n=Gu(e);if(!n)return null;let r=Fu(t);if(!r)throw Error("resolveWindow() needs an explicit `today`");switch(n.kind){case`all_time`:return[null,null];case`today`:return[Iu(r),Iu(r)];case`yesterday`:{let e=Lu(r,-1);return[Iu(e),Iu(e)]}case`this_week`:{let e=Lu(r,-Hu(r));return[Iu(e),Iu(Lu(e,6))]}case`last_week`:{let e=Lu(r,-Hu(r)-7);return[Iu(e),Iu(Lu(e,6))]}case`this_month`:return[Iu(Bu(r)),Iu(Vu(r))];case`last_month`:{let e=Lu(Bu(r),-1);return[Iu(Bu(e)),Iu(e)]}case`this_quarter`:{let e=Uu(r),[t,n]=Ru(e);return[Iu(e),Iu(Vu(zu(t,n+2,1)))]}case`last_quarter`:{let e=Lu(Uu(r),-1);return[Iu(Uu(e)),Iu(e)]}case`this_year`:{let[e]=Ru(r);return[Iu(zu(e,1,1)),Iu(zu(e,12,31))]}case`last_year`:{let[e]=Ru(r);return[Iu(zu(e-1,1,1)),Iu(zu(e-1,12,31))]}case`ytd`:{let[e]=Ru(r);return[Iu(zu(e,1,1)),Iu(r)]}case`ytd_last_year`:{let[e]=Ru(r);return[Iu(zu(e-1,1,1)),Iu(Wu(r,-12))]}case`ltm`:return[Iu(Lu(r,-364)),Iu(r)];case`past_week`:return[Iu(Lu(r,-6)),Iu(r)];case`past_month`:return[Iu(Lu(Wu(r,-1),1)),Iu(r)];case`past_year`:return[Iu(Lu(Wu(r,-12),1)),Iu(r)];case`last_n_days`:return[Iu(Lu(r,-(n.n-1))),Iu(r)];case`next_n_days`:return[Iu(r),Iu(Lu(r,n.n-1))];case`custom`:return[n.from??null,n.to??null]}}function qu(e){let t=Gu(e);return t?Mu[t.kind].replace(`{n}`,String(t.n??``)):`an invalid range`}function Ju(e,t,n){let r=e||`exact`;if(!Nu.includes(r))return null;let i=Fu(n);if(!i)throw Error("resolveAnchor() needs an explicit `today`");switch(r){case`today`:return Iu(i);case`yesterday`:return Iu(Lu(i,-1));case`one_week_ago`:return Iu(Lu(i,-7));case`one_month_ago`:return Iu(Wu(i,-1));case`n_days_ago`:{let e=String(t??``).trim();if(!/^[0-9]+$/.test(e))return null;let n=Number(e);return n>3650?null:Iu(Lu(i,-n))}default:{let e=Fu(t);return e?Iu(e):null}}}var Yu=[`text`,`select`,`multiselect`,`user`,`int`,`currency`,`pct`,`date`,`checkbox`,`phone`,`email`,`url`,`rating`,`created_time`,`formula`,`automation`,`image`],mee=`rec:`,hee=new Set([`formula`,`created_time`,`automation`]);function Xu(e){return e===`select`||e===`user`||e===`multiselect`}function gee(e){let t=new Set,n=[];for(let r of e.split(` -`)){let e=r.trim();if(!e)continue;let i=e.toLowerCase();t.has(i)||(t.add(i),n.push(e))}return n.slice(0,50)}function Zu(e,t,n=120){let r=Math.max(1,Math.floor(n)),i=e=>e.trim().replace(/\s+/g,` `),a=(i(e)||`Untitled`).slice(0,r).trimEnd(),o=new Set(t.map(e=>i(e).toLocaleLowerCase()));if(!o.has(a.toLocaleLowerCase()))return a;for(let e=2;;e+=1){let t=` ${e}`,n=a.slice(0,Math.max(0,r-t.length)).trimEnd(),i=n?`${n}${t}`:String(e).slice(-r);if(!o.has(i.toLocaleLowerCase()))return i}}function _ee(e){return e.filter(e=>e.filterable!==!1)}function Qu(e){return Array.isArray(e.options)?e.options:[]}function vee(e){return typeof e.formula==`string`&&e.formula.trim()!==``?e.formula:void 0}function $u(e){let t=typeof e.max==`number`&&Number.isFinite(e.max)?Math.round(e.max):5;return Math.max(2,Math.min(10,t))}var yee=[`grid`,`chart`,`dashboard`,`list`,`calendar`,`kanban`,`map`,`timeseries`,`catalog`],bee={dashboard:`chart`};function xee(e){return bee[e]??e}var ed=[`week`,`month`,`quarter`,`year`],See=[`letter`,`a4`,`tabloid`],Cee=[`portrait`,`landscape`],wee=[`web`,`print`],Tee=[`cover`,`intro`,`section`,`gallery`],Eee=[2,3,4],Dee=2e3,Oee=/^#[0-9A-Fa-f]{6}$/,td=[`abs`,`pct`,`yoy`,`ytd`],kee=[`note`,`formula`],Aee=/^[A-Za-z0-9_ .+\-*/()[\]]*$/;function jee(e){let t=e.bucket===void 0||ed.includes(e.bucket),n=e.span,r;if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n.lastN;if(typeof e==`number`&&Number.isFinite(e)){let t=Math.round(e);t>=1&&t<=120&&(r={lastN:t})}}let i=e.span===void 0?r===void 0:!!r&&r.lastN===n?.lastN;if(t&&i)return e;let a={...e};return t||delete a.bucket,i||(r?a.span=r:delete a.span),a}function Mee(e,t){if(!e||typeof e!=`object`||Array.isArray(e))return null;let n=e,r=typeof n.id==`string`?n.id.slice(0,40):``;if(!r||typeof n.kind!=`string`||!Tee.includes(n.kind))return null;let i={id:r,kind:n.kind};for(let[e,t]of[[`title`,120],[`body`,Dee],[`imageCode`,60]]){let r=n[e];typeof r==`string`&&r&&(i[e]=r.slice(0,t))}if(Array.isArray(n.products)&&t>0){let e=[],r=new Set;for(let i of n.products){if(typeof i!=`string`||!i)continue;let n=i.slice(0,60);if(!r.has(n)&&(r.add(n),e.push(n),e.length>=t))break}e.length&&(i.products=e)}if(n.layout&&typeof n.layout==`object`&&!Array.isArray(n.layout)){let e=n.layout,t={};typeof e.cols==`number`&&Number.isInteger(e.cols)&&Eee.includes(e.cols)&&(t.cols=e.cols),e.showPack===!1&&(t.showPack=!1),e.showColor===!1&&(t.showColor=!1),e.showPrice===!0&&(t.showPrice=!0),(t.cols!==void 0||t.showPack!==void 0||t.showColor!==void 0||t.showPrice!==void 0)&&(i.layout=t)}return{page:i,spent:i.products?.length??0}}function Nee(e){if(!Array.isArray(e))return;let t=[];for(let n of e){if(t.length>=12)break;if(!n||typeof n!=`object`||Array.isArray(n))continue;let e=n,r=typeof e.id==`string`?e.id.slice(0,40):``;if(!r||typeof e.name!=`string`)continue;let i={id:r,name:e.name.slice(0,80),paper:See.includes(e.paper)?e.paper:`letter`,orientation:Cee.includes(e.orientation)?e.orientation:`portrait`,pages:[]};if(wee.includes(e.quality)&&(i.quality=e.quality),e.brand&&typeof e.brand==`object`&&!Array.isArray(e.brand)){let t=e.brand,n={};for(let e of[`primary`,`accent`])typeof t[e]==`string`&&Oee.test(t[e])&&(n[e]=t[e]);typeof t.company==`string`&&t.company&&(n.company=t.company.slice(0,80)),typeof t.logo==`string`&&t.logo&&(n.logo=t.logo.slice(0,60)),Object.keys(n).length&&(i.brand=n)}if(e.fields&&typeof e.fields==`object`&&!Array.isArray(e.fields)){let t=e.fields,n={};for(let e of[`name`,`pack`,`color`,`price`])typeof t[e]==`string`&&t[e]&&(n[e]=t[e]);Object.keys(n).length&&(i.fields=n)}let a=500;if(Array.isArray(e.pages))for(let t of e.pages){if(i.pages.length>=40)break;let e=Mee(t,a);e&&(a-=e.spent,i.pages.push(e.page))}t.push(i)}return t.length?t:void 0}function nd(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e;if(typeof t.mode!=`string`||!yee.includes(t.mode))return;let n={mode:xee(t.mode)};for(let e of[`dateField`,`stackField`,`titleField`,`colorField`,`sizeField`]){let r=t[e];typeof r==`string`&&r!==``&&(n[e]=r)}if(Array.isArray(t.charts)){let e=t.charts.filter(e=>!!e&&typeof e==`object`&&typeof e.id==`string`).map(jee);e.length&&(n.charts=e.slice(0,12))}if(t.kanbanClamp===!1&&(n.kanbanClamp=!1),(t.calendarMode===`records`||t.calendarMode===`summary`)&&(n.calendarMode=t.calendarMode),Array.isArray(t.calendarMetrics)){let e=[];for(let n of t.calendarMetrics){if(!n||typeof n!=`object`)continue;let t=n;typeof t.id!=`string`||!t.id||typeof t.field!=`string`||!t.field||typeof t.agg!=`string`||!t.agg||e.push({id:t.id,field:t.field,agg:t.agg})}e.length&&(n.calendarMetrics=e.slice(0,4))}if(ed.includes(t.tsBucket)&&(n.tsBucket=t.tsBucket),t.tsSpan&&typeof t.tsSpan==`object`&&!Array.isArray(t.tsSpan)){let e=t.tsSpan,r={};if(typeof e.from==`string`&&e.from&&(r.from=e.from),typeof e.to==`string`&&e.to&&(r.to=e.to),typeof e.lastN==`number`&&Number.isFinite(e.lastN)){let t=Math.round(e.lastN);t>=1&&t<=120&&(r.lastN=t)}(r.from||r.to||r.lastN!=null)&&(n.tsSpan=r)}if(Array.isArray(t.tsFields)){let e=t.tsFields.filter(e=>typeof e==`string`&&e!==``);e.length&&(n.tsFields=e.slice(0,12))}if(Array.isArray(t.tsDeltas)){let e=new Set,r=[];for(let n of t.tsDeltas)typeof n!=`string`||!td.includes(n)||e.has(n)||(e.add(n),r.push(n));r.length&&(n.tsDeltas=r.slice(0,td.length))}if(t.tsGridlines===!1&&(n.tsGridlines=!1),t.tsSparkline===!0&&(n.tsSparkline=!0),Array.isArray(t.tsRows)){let e=[],r=new Set;for(let n of t.tsRows){if(!n||typeof n!=`object`)continue;let t=n;if(typeof t.id!=`string`||!t.id||t.id.length>40||r.has(t.id)||typeof t.kind!=`string`||!kee.includes(t.kind)||typeof t.label!=`string`||t.label.length>120)continue;r.add(t.id);let i={id:t.id,kind:t.kind,label:t.label};i.kind===`formula`&&typeof t.expr==`string`&&t.expr.length<=200&&Aee.test(t.expr)&&(i.expr=t.expr),e.push(i)}e.length&&(n.tsRows=e.slice(0,12))}if(t.tsStyles&&typeof t.tsStyles==`object`&&!Array.isArray(t.tsStyles)){let e={},r=0;for(let[n,i]of Object.entries(t.tsStyles)){if(r>=200)break;if(!n||!i||typeof i!=`object`||Array.isArray(i))continue;let t=i,a={};t.bold===!0&&(a.bold=!0),t.line===!0&&(a.line=!0),!(!a.bold&&!a.line)&&(e[n]=a,r+=1)}r&&(n.tsStyles=e)}let r=Nee(t.catalogs);if(r&&(n.catalogs=r),!(n.mode===`grid`&&!n.dateField&&!n.stackField&&!n.titleField&&!n.colorField&&!n.sizeField&&!n.charts&&n.kanbanClamp===void 0&&!n.calendarMode&&!n.calendarMetrics&&!n.tsBucket&&!n.tsSpan&&!n.tsFields&&!n.tsDeltas&&n.tsGridlines===void 0&&n.tsSparkline===void 0&&!n.tsRows&&!n.tsStyles&&!n.catalogs))return n}function Pee(e){if(typeof e!=`number`||!Number.isFinite(e))return;let t=Math.round(e);if(!(t<=1))return Math.min(8,t)}function Fee(e,t){if(e.source!==`overlay`||hee.has(e.type))return!1;let n=e.permissions?.edit??`everyone`;return n===`everyone`?!0:t?t.isAdmin?!0:n===`creator`&&e.createdBy===t.name:!1}function rd(e){return e===`currency`||e===`int`||e===`pct`||e===`rating`||e===`formula`}function id(e){return e===`date`||e===`created_time`}function ad(e,t){return rd(e)?t===`asc`?`1 → 9`:`9 → 1`:id(e)?t===`asc`?`Oldest → Newest`:`Newest → Oldest`:t===`asc`?`A → Z`:`Z → A`}function Iee(e,t){return e.type===`status`||e.type===`select`||e.type===`multiselect`||e.type===`checkbox`||e.type===`text`&&e.source!==`overlay`&&e.key!==t}var Lee=[`topN`,`bottomN`,`inTopPct`,`inBottomPct`,`aboveAvg`,`belowAvg`,`inQuartile`,`inDecile`];function od(e){return Lee.includes(e)}var Ree=[`contains`,`doesNotContain`,`eq`,`neq`,`isEmpty`,`isNotEmpty`,`gt`,`gte`,`lt`,`lte`,`between`,`within`,`topN`,`bottomN`,`inTopPct`,`inBottomPct`,`aboveAvg`,`belowAvg`,`inQuartile`,`inDecile`],sd=new Set([`isEmpty`,`isNotEmpty`,`aboveAvg`,`belowAvg`]),cd=`__cohort__`;function zee(e){return!hd(e)&&e.colId===`__cohort__`}var Bee=[`anyOf`,`allOf`,`noneOf`],Vee={eq:`anyOf`,neq:`noneOf`};function ld(e){return Bee.includes(e)?e:Vee[e]??`anyOf`}function ud(e){let t=[];for(let n of String(e??``).split(`,`)){let e=n.trim();if(!(e===``||t.includes(e))&&(t.push(e),t.length>=20))break}return t}var dd=[`avg`,`median`,`p10`,`p25`,`p75`,`p90`],Hee={avg:`the average`,median:`the median`,p10:`the bottom 10%`,p25:`the bottom quartile`,p75:`the top quartile`,p90:`the top 10%`};function fd(e){return e&&e.kind!==`stat`?e.colId:void 0}function Uee(e){return e?e.kind===`stat`?dd.includes(e.stat):e.colId?e.kind===`measure`?Gu(e.window)!=null:e.kind===`field`:!1:!1}function pd(e){return e.colId===`__cohort__`?ud(e.value).length>0:sd.has(e.op)?!0:e.op===`within`?Gu(e.dateWindow)!=null:e.rhs?Uee(e.rhs):e.dateMode&&fee.has(e.dateMode)?!0:e.op===`between`?e.value!==``&&e.value2!=null&&e.value2!==``:e.value!==``}var Wee=[`gte`,`gt`,`lte`,`lt`,`eq`,`neq`],Gee=[`gte`,`gt`,`lte`,`lt`];function md(e){return!hd(e)&&e.window!=null}function hd(e){return e!=null&&Array.isArray(e.children)}function gd(e){return Array.isArray(e?.nodes)?e.nodes:[]}function _d(e){return e?.conj===`or`?`or`:`and`}var Kee=new Set([`all-customers`]),qee={key:`customer_data`,scope:`customer`,rowsPath:`customers`,noun:`customer`,nouns:`customers`,measures:!0},Jee={key:`product_data`,scope:`product`,rowsPath:`products`,noun:`product`,nouns:`products`,measures:!1},vd=new Map;function Yee(e){let t=vd.get(e);return t||(t={key:e,scope:e,rowsPath:`tables/${e}/rows`,noun:`record`,nouns:`records`,measures:!1},vd.set(e,t)),t}function yd(e){return e.startsWith(`ut_`)?Yee(e):e===`product`?Jee:qee}function bd(e){return Kee.has(e.id)}function xd(e){return e.config?.display?.mode??`grid`}function Sd(e){return e.kind===`system`||bd(e)?!1:!!e.locked}function Cd(e,t){return t?t.isAdmin?!0:!!e.createdBy&&e.createdBy===t.name:!1}var wd=[`personal`,`collaborative`,`users`],Xee={personal:`Personal`,collaborative:`Collaborative`,users:`Specific users`},Zee={personal:`Only you can change this view.`,collaborative:`Anyone who can see this table can change it.`,users:`Only the people you pick can change it.`};function Qee(e,t,n){let r=e&&typeof e==`object`&&!Array.isArray(e)?e:{},i=wd.includes(r.edit)?r.edit:t;if(i!==`users`)return{edit:i};let a=new Set,o=[];for(let e of(Array.isArray(r.users)?r.users:[]).slice(0,50)){let t=String(e??``).trim();!t||a.has(t.toLowerCase())||n&&!n.includes(t)||(a.add(t.toLowerCase()),o.push(t))}return o.length?{edit:`users`,users:o}:{edit:`personal`}}function $ee(e){return e.permissions?.edit??`collaborative`}function Td(e,t){let n=$ee(e);return n===`collaborative`||!e.createdBy?!0:t?t.isAdmin||e.createdBy&&e.createdBy===t.name?!0:n===`users`&&(e.permissions?.users??[]).includes(t.name):!1}var Ed=[`folder`,`star`,`flag`,`tag`,`bookmark`,`grid`,`chart`,`map`,`users`,`clock`,`heart`,`bolt`],Dd=[`neutral`,`blue`,`green`,`yellow`,`red`],Od=`folder`,kd=`neutral`;function ete(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e;if(!Ed.includes(t.shape))return;let n=t.shape,r=Dd.includes(t.tone)?t.tone:kd;if(!(n===`folder`&&r===`neutral`))return{shape:n,tone:r}}var Ad=5*1024*1024;function tte(e){return e?.windowed?`server-windowed`:`whole-book`}var jd=`/api/v1`,Md=`same-origin`,Nd=`aios:unauthorized`,Pd=`aios:data-error`,Fd=`aios:toast`,Id=`aios:derived-cells`,Ld=`aios:workspace-stale`,Rd=`aios:nav-minimize`,zd=`aios:rows-stale`;function Bd(e,t){typeof window>`u`||window.dispatchEvent(new CustomEvent(e,{detail:t}))}var nte=`streamlit:componentReady`,rte=`streamlit:render`,ite=`streamlit:setComponentValue`,ate=`streamlit:setFrameHeight`,Vd=`aios:grid-host-render`;function Hd(e,t){window.parent.postMessage({isStreamlitMessage:!0,type:e,...t},`*`)}function Ud(){return typeof window>`u`||window.parent===window?!1:new URLSearchParams(window.location.search).has(`streamlitUrl`)}function ote(){Ud()&&(window.addEventListener(`message`,e=>{let t=e.data;if(!t||t.type!==rte)return;window.__AIOS_STREAMLIT_ARGS__=t.args??{},window.dispatchEvent(new CustomEvent(Vd));let n=Number(t.args?.height??760);Hd(ate,{height:Number.isFinite(n)?n:760})}),Hd(nte,{apiVersion:1}))}function ste(){return window.__AIOS_STREAMLIT_ARGS__??null}function cte(e){return window.addEventListener(Vd,e),()=>window.removeEventListener(Vd,e)}var Wd=[],Gd=null;function lte(e){Gd=e}function Kd(e){return Ud()?(Wd.push(e),Wd.length>24&&Wd.shift(),Hd(ite,{value:{events:[...Wd]},dataType:`json`}),!0):Gd?Gd(e):!1}function qd(e){return`${e}:${typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}`}var Jd={"Content-Type":`application/json`};async function Yd(e){try{return await e.json()}catch{return null}}function Xd(e){return e===401?(Zd.clear(),Bd(Nd),!0):!1}var ute=5*6e4,Zd=new Map;function Qd(){Zd.clear()}async function dte(e){let t=Zd.get(e.rowsPath);if(t&&Date.now()-t.ate.pid===t);n&&Object.assign(n,e)}}return r.ok}catch{return!1}}async function ef(e,t=rf){try{let n=await fetch(`${jd}/grid/timeseries?scope=${encodeURIComponent(t)}`,{method:`POST`,credentials:Md,headers:Jd,body:JSON.stringify(e)});if(Xd(n.status)||!n.ok)return{payload:null,status:n.status};let r=await Yd(n);return!r||!Array.isArray(r.columns)||!Array.isArray(r.rows)?{payload:null,status:n.status}:{payload:r,status:n.status}}catch{return{payload:null,status:0}}}async function pte(e,t=rf){try{let n=await fetch(`${jd}/grid/calendar_metrics?scope=${encodeURIComponent(t)}`,{method:`POST`,credentials:Md,headers:Jd,body:JSON.stringify(e)});if(Xd(n.status)||!n.ok)return{payload:null,status:n.status};let r=await Yd(n);return!r||!r.values||typeof r.values!=`object`?{payload:null,status:n.status}:{payload:r,status:n.status}}catch{return{payload:null,status:0}}}var tf=[],nf=!1,rf=`customer`;function mte(e){rf=e}async function hte(){if(nf||tf.length===0)return;nf=!0;let e=tf;tf=[];let t=!1;try{let n=await fetch(`${jd}/grid/events`,{method:`POST`,credentials:Md,headers:Jd,body:JSON.stringify({events:e,scopeKey:rf})});Xd(n.status)||(n.ok?gte(await Yd(n)):t=!0)}catch{t=!0}finally{nf=!1,t?tf=[...e,...tf].slice(-24):tf.length&&hte()}}function gte(e){let t=e,n=t?.toast;typeof n==`string`&&n.trim()!==``&&Bd(Fd,n.trim()),t?.derived&&typeof t.derived==`object`&&!Array.isArray(t.derived)&&Bd(Id,t.derived);let r=Array.isArray(t?.results)?t.results:[];(t?.rerender===!0||r.some(e=>e?.rerender===!0))&&Bd(Ld)}function _te(e){return tf.push(e),tf.length>24&&tf.shift(),hte(),!0}function vte(){lte(_te)}function yte(e){return JSON.stringify([e.config?.filters??[],e.config?.filterConj===`or`?`or`:`and`])}function bte(e,t,n){let r=yte(e);return r===yte(t)||r===n?null:r}function af(e,t){for(let n of e??[]){if(hd(n)){af(n.children,t);continue}let e=n;md(n)&&e.id&&t.set(e.id,e)}}function xte(e,t,n,r){if(!t||n==null||r-n>12e4)return e;let i=e,a=t.config?t.config.display:void 0;if(t.config&&JSON.stringify(a??null)!==JSON.stringify(e.config?.display??null)){let t={...e.config};a===void 0?delete t.display:t.display=a,i={...e,config:t}}let o=t.config?t.config.cohortLock:void 0;if(t.config&&o!==i.config?.cohortLock){let e={...i.config};o===void 0?delete e.cohortLock:e.cohortLock=o,i={...i,config:e}}let s=t.config?t.config.filters:void 0;if(!Array.isArray(s)||s.length===0)return i;let c=new Map;if(af(s,c),c.size===0)return i;let l=new Map;af(e.config?e.config.filters:void 0,l);let u=!1;for(let[e,t]of c){if(!pd(t))continue;let n=l.get(e);if(!n||!pd(n)){u=!0;break}}return u?{...i,config:{...i.config,filters:s,filterConj:t.config.filterConj??e.config.filterConj}}:i}function of(e,t){let n=e=>{let n={};for(let[r,i]of Object.entries(e??{}))typeof i==`number`&&t-i<=12e4&&(n[r]=i);return n};return{edited:n(e?.edited),deleted:n(e?.deleted)}}function sf(e){if(Array.isArray(e))return e.map(sf);if(e&&typeof e==`object`){let t={};for(let n of Object.keys(e).sort()){let r=e[n];r!==void 0&&(t[n]=sf(r))}return t}return e}function Ste(e){let{createdBy:t,permissions:n,editRequestId:r,labelCorrectedFrom:i,labelCorrectionId:a,...o}=e;return JSON.stringify(sf(o))}function Cte(e,t,n,r,i){let a=e=>typeof e==`number`&&r-e<=12e4,o=new Map(t.map(e=>[e.key,e])),s=[];for(let t of e){let e=o.get(t.key);if(o.delete(t.key),!a(n?.deleted?.[t.key])){if(!e){s.push(t);continue}if(!i){s.push({...e,...t,note:t.note??e.note});continue}if(t.labelCorrectedFrom===e.label&&t.label!==e.label&&typeof t.labelCorrectionId==`string`&&t.labelCorrectionId===e.editRequestId){s.push(t);continue}if(a(n?.edited?.[t.key])&&Ste(e)!==Ste(t)){s.push({...e,...t.createdBy==null?{}:{createdBy:t.createdBy}});continue}s.push(t.note==null&&e.note!=null?{...t,note:e.note}:t)}}for(let e of o.values())if(e.custom&&!a(n?.deleted?.[e.key])){if(e.source===`overlay`){s.push(e);continue}(!i||a(n?.edited?.[e.key]))&&s.push(e)}return s}function wte(e,t){let n=e.filter(e=>!(e.pid===t.pid&&e.key===t.key));return n.push(t),n.slice(-64)}function Tte(e,t,n){let r=[],i={};for(let a of e){if(a==null||typeof a.pid!=`number`||typeof a.key!=`string`||typeof a.at!=`number`)continue;let e=t(a.pid),o=e?e[a.key]:void 0;String(o??``)!==String(a.value??``)&&(n-a.at>12e4||(r.push(a),i[a.pid]={...i[a.pid],[a.key]:a.value}))}return{keep:r,seeds:i}}function cf(){if(typeof window>`u`)return null;let e=window.__AIOS_GRID__;return e&&Array.isArray(e.rows)&&Array.isArray(e.fields)?e:null}function Ete(){let e=ste()?.payload;return e&&Array.isArray(e.rows)&&Array.isArray(e.fields)?e:null}function Dte(e,t){let n={...e,workspace:t};Array.isArray(t.measures)&&(n.measures=t.measures),t.measureSets&&typeof t.measureSets==`object`&&(n.measureSets=t.measureSets),t.viewer&&typeof t.viewer.name==`string`&&(n.viewer=t.viewer),Array.isArray(t.userOptions)&&(n.userOptions=t.userOptions);let r=t.derived;return r&&typeof r==`object`&&Object.keys(r).length>0&&(n.rows=e.rows.map(e=>{let t=r[String(e.pid)];return t?{...e,...t}:e})),n}function Ote(){return Ete()??cf()}var lf=Ud(),kte=cf()!==null;function Ate(e){return`aios-grid-cells:${e}`}function jte(e){try{let t=localStorage.getItem(Ate(e)),n=t?JSON.parse(t):null;return Array.isArray(n)?n:[]}catch{return[]}}function Mte(e,t){try{localStorage.setItem(Ate(e),JSON.stringify(t))}catch{}}function Nte(e){let t=e?.workspace?.storageKey;if(!e||!t)return{};let n=new Map(e.rows.map(e=>[e.pid,e])),{keep:r,seeds:i}=Tte(jte(t),e=>n.get(e),Date.now());return Mte(t,r),i}function Pte(e=`customer`){mte(e);let t=yd(e),[n,r]=(0,z.useState)(()=>Ote()),[i,a]=(0,z.useState)(()=>lf?Nte(Ote()):{}),o=(0,z.useRef)(n);o.current=n;let[s,c]=(0,z.useState)(0);(0,z.useEffect)(()=>{if(lf)return;let e=()=>c(e=>e+1);return window.addEventListener(zd,e),()=>window.removeEventListener(zd,e)},[]),(0,z.useEffect)(()=>{if(lf){let e=()=>{let e=Ete();if(!e)return;let t=Nte(e);Object.keys(t).length&&a(e=>{let n={...e};for(let[e,r]of Object.entries(t))n[Number(e)]={...r,...n[Number(e)]};return n}),r(e)};return e(),cte(e)}if(cf())return;let n=!1;async function i(){let[i,a]=await Promise.all([dte(t),$d(e)]);n||!i||r(a?Dte(i,a):i)}i();async function o(){let t=await $d(e);n||!t||r(e=>e&&Dte(e,t))}let s=e=>{let t=e.detail;!t||typeof t!=`object`||r(e=>{if(!e)return e;let n=!1,r=e.rows.map(e=>{let r=t[String(e.pid)];if(!r||typeof r!=`object`)return e;let i={};for(let[e,t]of Object.entries(r))(t===null||typeof t==`string`||typeof t==`number`)&&(i[e]=t);return Object.keys(i).length===0?e:(n=!0,{...e,...i})});return n?{...e,rows:r}:e})},c=()=>{o()};return typeof window<`u`&&(window.addEventListener(Ld,c),window.addEventListener(Id,s)),()=>{n=!0,typeof window<`u`&&(window.removeEventListener(Ld,c),window.removeEventListener(Id,s))}},[e,t,s]);let l=(0,z.useCallback)((e,n)=>{let r;if(a(t=>(r=t[e],{...t,[e]:{...t[e],...n}})),lf){let t=o.current?.workspace?.storageKey;if(t){let r=jte(t),i=Date.now();for(let[t,a]of Object.entries(n))r=wte(r,{pid:e,key:t,value:a??null,at:i});Mte(t,r)}Kd({id:qd(`overlay`),type:`overlay_patch`,pid:e,updates:n});return}kte||fte(t,e,n).then(t=>{t||(console.warn(`customer-grid: overlay PATCH failed for pid ${e}; rolling back`),a(t=>{let n={...t};return r===void 0?delete n[e]:n[e]=r,n}))})},[t]);return{fields:n?.fields??[],rawRows:n?.rows??[],payload:n,loading:n===null,overlayEdits:i,setOverlayEdits:a,patchOverlay:l}}var uf=`#202433`,df=`#6B7280`,ff=`#E6E9EF`,Fte=`#FFFFFF`,Ite=`#FAFBFC`,Lte=`#9DBFF2`,pf=`#EDF3FD`,Rte=`#F5D989`,mf=`#FBF4E0`,zte=`#F0A8A0`,Bte=`#FCEEEC`,Vte=`#A5D8B4`,hf=`#EBF6EF`,gf=`#F1EEFB`,Hte=`#6B57A8`,Ute=`#768FB6`,Wte=`#4F6079`,_f=`#7E6428`,vf=`#A3453C`,yf=`#35754E`,bf={accentColor:Ute,accentLight:pf,textDark:uf,textMedium:df,textLight:`#8B92A0`,textHeader:uf,bgCell:Fte,bgHeader:Ite,bgHeaderHovered:`#F1F3F6`,bgHeaderHasFocus:pf,borderColor:ff,horizontalBorderColor:ff,fgIconHeader:df,bgIconHeader:ff,fontFamily:`Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif`,baseFontStyle:`13px`,headerFontStyle:`600 13px`},Gte={growing:{bgBubble:hf,textBubble:yf},new:{bgBubble:pf,textBubble:Wte},declining:{bgBubble:mf,textBubble:_f},dormant:{bgBubble:ff,textBubble:uf},lost:{bgBubble:Bte,textBubble:vf},reactivated:{bgBubble:Vte,textBubble:uf}},Kte={growing:{bgCell:`rgba(165, 216, 180, 0.40)`},new:{bgCell:`rgba(157, 191, 242, 0.38)`},declining:{bgCell:`rgba(245, 217, 137, 0.42)`},dormant:{bgCell:`rgba(107, 114, 128, 0.13)`},lost:{bgCell:`rgba(240, 168, 160, 0.38)`},reactivated:{bgCell:`rgba(165, 216, 180, 0.72)`}},qte={growing:{bgCell:`rgba(165, 216, 180, 0.62)`},new:{bgCell:`rgba(157, 191, 242, 0.60)`},declining:{bgCell:`rgba(245, 217, 137, 0.64)`},dormant:{bgCell:`rgba(107, 114, 128, 0.22)`},lost:{bgCell:`rgba(240, 168, 160, 0.60)`},reactivated:{bgCell:`rgba(165, 216, 180, 0.92)`}},Jte={bgCell:`rgba(32, 36, 51, 0.06)`},Yte=Jte,Xte=Jte,xf=`700 13px`;function Sf(e,t){let n=parseInt(e.slice(1),16);return`rgba(${n>>16&255}, ${n>>8&255}, ${n&255}, ${t})`}var Zte={filter:{bgHeader:hf,bgHeaderHovered:hf,bgHeaderHasFocus:hf,bgCell:Sf(yf,.06),headerFontStyle:xf},sort:{bgHeader:mf,bgHeaderHovered:mf,bgHeaderHasFocus:mf,bgCell:Sf(_f,.06),headerFontStyle:xf},group:{bgHeader:gf,bgHeaderHovered:gf,bgHeaderHasFocus:gf,bgCell:Sf(Hte,.06),headerFontStyle:xf}},Qte=df,Cf=(e,t,n)=>`M${e-n} ${t}a${n} ${n} 0 1 0 ${n*2} 0a${n} ${n} 0 1 0 ${-n*2} 0`,$te=[{d:`M3.2 4.6h9.6v8.2H3.2z`},{d:`M3.2 7.2h9.6`},{d:`M5.8 3v3.2`},{d:`M10.2 3v3.2`}],wf={text:[{d:`M3 5h10M3 8h10M3 11h6`}],status:[{d:`M4 13V3.5h7.6L10.1 6l1.5 2.5H4`}],currency:[{d:`M8 2.8v10.4`},{d:`M10.6 5.4A2.6 2.6 0 0 0 8.2 4.2H7.4a2 2 0 0 0 0 4h1.2a2 2 0 0 1 0 4H7.8a2.6 2.6 0 0 1-2.4-1.4`}],int:[{d:`M6.2 3L4.8 13M11.2 3l-1.4 10M3.4 6.2h9.2M2.9 9.8h9.2`}],date:$te,pct:[{d:Cf(4.6,4.6,1.6)},{d:Cf(11.4,11.4,1.6)},{d:`M12.2 3.9L3.8 12.3`}],select:[{d:`M3.2 3.8h9.6v8.4H3.2z`},{d:`M6.2 7.2l1.8 1.8 1.8-1.8`}],user:[{d:Cf(8,6,2.4)},{d:`M3.6 13c0-2.4 2-3.8 4.4-3.8s4.4 1.4 4.4 3.8`}],multiselect:[{d:`M3 4.6h2.2v2.2H3zM3 9.2h2.2v2.2H3z`},{d:`M7.2 5.7h6M7.2 10.3h6`}],checkbox:[{d:`M3.4 3.4h9.2v9.2H3.4z`},{d:`M5.8 8.1l1.8 1.9 3.4-3.9`}],phone:[{d:`M5.1 3.2L7 5.1 5.6 7a7.2 7.2 0 0 0 3.4 3.4l1.9-1.4 1.9 1.9-1.5 1.6c-3 .5-8.3-4.8-7.8-7.8z`}],email:[{d:`M3 4.4h10v7.2H3z`},{d:`M3 4.9l5 3.9 5-3.9`}],url:[{d:`M7 5.4L8.4 4a2.6 2.6 0 0 1 3.7 3.7L10.7 9`},{d:`M9 10.6L7.6 12a2.6 2.6 0 0 1-3.7-3.7L5.3 7`},{d:`M6.2 9.8l3.6-3.6`}],rating:[{d:`M8 2.9l1.63 3.3 3.64.53-2.63 2.57.62 3.63L8 11.24 4.74 12.93l.62-3.63L2.73 6.73l3.64-.53z`,fill:!0}],created_time:[{d:Cf(8,8,5.2)},{d:`M8 4.9v3.4l2.3 1.4`}],formula:[{d:`M5.6 12.8V5.4a2 2 0 0 1 3.2-1.6`},{d:`M4.2 7.6h4.6`},{d:`M10.2 8.4l3 3.4M13.2 8.4l-3 3.4`}],automation:[{d:`M10.8 4.1A4.8 4.8 0 1 1 5.3 4.1`},{d:`M4.2 6L5.3 4.1 3.1 4.5`},{d:`M6.9 6.1L9.8 8 6.9 9.9z`,fill:!0}],image:[{d:`M2.6 3.4h10.8v9.2H2.6z`},{d:Cf(6,6.3,1.1)},{d:`M2.6 10.6L6.1 7.6l2.5 2.1 2.2-1.8 2.6 2.2`}]},Tf={grid:[{d:`M2.6 3.4h10.8v9.2H2.6z`},{d:`M2.6 6.5h10.8M2.6 9.5h10.8M6.4 3.4v9.2M10 3.4v9.2`}],list:[{d:`M3 4.6h1.4M6.4 4.6h6.6M3 8h1.4M6.4 8h6.6M3 11.4h1.4M6.4 11.4h6.6`}],chart:[{d:`M2.6 3.4h10.8v9.2H2.6z`},{d:`M5.4 10.6V7.2M8 10.6V5.4M10.6 10.6V8.6`}],dashboard:[{d:`M2.6 3.4h10.8v9.2H2.6z`},{d:`M5.4 10.6V7.2M8 10.6V5.4M10.6 10.6V8.6`}],calendar:$te,kanban:[{d:`M2.8 3.4h3.1v9.2H2.8zM6.5 3.4h3.1v6.2H6.5zM10.2 3.4h3.1v7.6h-3.1z`}],map:[{d:`M8 2.6a3.6 3.6 0 0 1 3.6 3.6c0 2.7-3.6 7.2-3.6 7.2S4.4 8.9 4.4 6.2A3.6 3.6 0 0 1 8 2.6z`},{d:Cf(8,6.1,1.3)}],timeseries:[{d:`M2.6 3.4h10.8v9.2H2.6z`},{d:`M2.6 6.6h10.8M6.2 3.4v9.2`},{d:`M7.2 10.8l2-2.4 1.6 1.2 1.8-2.6`}],catalog:[{d:`M2.4 4.2h4.6a1.6 1.6 0 0 1 1 .4l0 8a1.6 1.6 0 0 0-1-.4H2.4z`},{d:`M13.6 4.2H9a1.6 1.6 0 0 0-1 .4l0 8a1.6 1.6 0 0 1 1-.4h4.6z`},{d:`M3.9 6.4h2.3v2.8H3.9z`}]},ene={bar:[{d:`M3.2 12.8V7.4M6.4 12.8V4.2M9.6 12.8V8.8M12.8 12.8V5.8`}],line:[{d:`M2.6 11.2l3.2-3.4 2.6 2 4.9-5.2`},{d:Cf(5.8,7.8,.9)},{d:Cf(8.4,9.8,.9)}],area:[{d:`M2.6 12.4V9.2l3.2-3.2 2.6 2 4.9-4.6v9z`},{d:`M2.6 9.2l3.2-3.2 2.6 2 4.9-4.6`}],donut:[{d:Cf(8,8,5)},{d:Cf(8,8,2.1)}],kpi:[{d:`M2.6 3.8h10.8v8.4H2.6z`},{d:`M5.4 9.6V6.4l1.9 3.2V6.4M9.4 6.4v3.2h1.8`}],table:[{d:`M2.6 3.4h10.8v9.2H2.6z`},{d:`M2.6 6.2h10.8M7.2 6.2v6.4M2.6 9.4h10.8`}]},tne={bar:`blue`,line:`green`,area:`green`,donut:`yellow`,kpi:`neutral`,table:`neutral`},nne={folder:[{d:`M2.4 12.6V4.2a.6.6 0 0 1 .6-.6h3.2l1.5 1.7h5.3a.6.6 0 0 1 .6.6v6.7a.6.6 0 0 1-.6.6H3a.6.6 0 0 1-.6-.6z`}],star:[{d:`M8 2.9l1.63 3.3 3.64.53-2.63 2.57.62 3.63L8 11.24 4.74 12.93l.62-3.63L2.73 6.73l3.64-.53z`}],flag:[{d:`M4.2 13.4V2.9`},{d:`M4.2 3.4h7.6l-1.5 2.6 1.5 2.6H4.2z`}],tag:[{d:`M2.9 8.2V3.5a.6.6 0 0 1 .6-.6h4.7l5 5-5.3 5.3z`},{d:Cf(5.6,5.6,1)}],bookmark:[{d:`M4.4 2.9h7.2v10.4L8 10.7l-3.6 2.6z`}],grid:Tf.grid,chart:Tf.dashboard,map:Tf.map,users:wf.user,clock:wf.created_time,heart:[{d:`M8 13.1S2.7 9.8 2.7 6.4a2.9 2.9 0 0 1 5.3-1.6 2.9 2.9 0 0 1 5.3 1.6c0 3.4-5.3 6.7-5.3 6.7z`}],bolt:[{d:`M9.1 2.4L4.2 9.1h3.3l-.6 4.5 4.9-6.7H8.5z`}]},Ef={neutral:{fill:ff,stroke:df},blue:{fill:Lte,stroke:Ute},green:{fill:Vte,stroke:yf},yellow:{fill:Rte,stroke:_f},red:{fill:zte,stroke:vf}},Df={neutral:`Neutral`,blue:`Blue`,green:`Green`,yellow:`Yellow`,red:`Red`},Of={folder:`Folder`,star:`Star`,flag:`Flag`,tag:`Tag`,bookmark:`Bookmark`,grid:`Table`,chart:`Chart`,map:`Map`,users:`People`,clock:`Clock`,heart:`Heart`,bolt:`Priority`},kf={grid:`Grid`,chart:`Chart`,dashboard:`Chart`,list:`List`,calendar:`Calendar`,kanban:`Kanban`,map:`Map`,timeseries:`Time series`,catalog:`Catalog`},rne=[`grid`,`chart`,`calendar`,`kanban`,`timeseries`,`map`,`list`,`catalog`],ine={grid:`blue`,list:`blue`,chart:`green`,dashboard:`green`,calendar:`yellow`,kanban:`yellow`,map:`red`,timeseries:`green`,catalog:`neutral`},Af={text:`Single line text`,select:`Single select`,multiselect:`Multi select`,user:`Assignee`,int:`Number`,currency:`Currency`,pct:`Percent`,date:`Date`,checkbox:`Checkbox`,phone:`Phone number`,email:`Email`,url:`URL`,rating:`Rating`,created_time:`Created time`,formula:`Formula`,automation:`Automation`,image:`Image`,status:`Lifecycle status (Odoo)`};function ane(e,t){return e.fill?``:``}function one(e){return({fgColor:t})=>``+e.map(e=>ane(e,t)).join(``)+``}function sne(e){return`t_${e}`}var cne={...Object.fromEntries(Object.keys(wf).map(e=>[sne(e),one(wf[e])])),aiosInfo:()=>``};function lne(e,t,n){return e&&t>Math.max(0,n-16)?e:null}function une(e,t,n,r=8){let i=Math.min(n,280);return Math.round(Math.max(r,Math.min(e,t-r-i)))}var dne=`600 13px`;function fne(e,t,n,r,i){let a=t=>`${e} ${t} (${n})`,o=a(t);if(r==null||r<=0||i(o)<=r)return o;let s=r-i(a(``));return s<=0?o:a(gne(t,s,i))}function pne(e,t,n,r=4){if(n.length===0)return null;let i=[],a=e.x+e.width-t-r;for(let t of n){let n=a-t;if(n-e.x<68)return null;i.push({x:Math.round(n),y:Math.round(e.y+(e.height-t)/2),size:t}),a=n-6}return i}function mne(e,t){let n=[];return e&&n.push(16),t&&n.push(6),n}function hne(e,t,n=30){let r=pne({x:0,y:0,width:e,height:32},n,t===!0?[16]:t===!1?[]:t);return r?Math.max(0,r[r.length-1].x-32-6):null}function gne(e,t,n){if(t==null||!e||n(e)<=t)return e;let r=n(`…`);if(r>t)return e;let i=0,a=e.length;for(;it.x+t.width||at.y+t.height)?null:{x:i,y:a,size:n}}function vne(e){let{placement:t,target:n,panel:r,viewport:i}=e,a=i.left+8,o=i.left+i.width-8,s=i.top+8,c=i.top+i.height-8,l=Math.max(1,o-a),u=Math.min(r.width,l),d=r.height,f,p,m,h;if(t===`right-start`){let e=Math.max(0,o-(n.right+6)),t=Math.max(0,n.left-6-a),r=u<=e||e>=t;h=r?`right`:`left`;let i=r?n.right+6:n.left-6-u;f=Math.min(Math.max(i,a),Math.max(a,o-u)),m=Math.max(1,c-s),p=Math.min(Math.max(n.top,s),Math.max(s,c-Math.min(d,m)))}else{let e=Math.max(0,c-(n.bottom+6)),r=Math.max(0,n.top-6-s),i=d<=e||e>=r;h=i?`below`:`above`,m=Math.max(1,i?e:r);let l=t===`bottom-end`?n.right-u:n.left;f=Math.min(Math.max(l,a),o-u),p=i?Math.min(n.bottom+6,c-m):Math.max(s,n.top-6-Math.min(d,m))}return{left:Math.round(f),top:Math.round(p),maxWidth:Math.floor(l),maxHeight:Math.floor(m),side:h}}var yne=150,jf={base:void 0,bold:void 0};function bne(e,t=!1){let n=t?`bold`:`base`;if(jf[n]===void 0){let e=document.createElement(`canvas`).getContext(`2d`);e&&(e.font=`${(t?`700 13px`:bf.headerFontStyle)??`600 13px`} ${bf.fontFamily??`Inter, sans-serif`}`),jf[n]=e}let r=jf[n];return r?r.measureText(e).width:0}function xne(e){return!!(e.note||e.description)}function Sne(e,t){for(let n of e??[]){if(hd(n)){Sne(n.children,t);continue}pd(n)&&t.add(n.colId)}}function Cne(e){return e?Zte[e]:void 0}function wne(e){let t=new Map;e.groupBy&&t.set(e.groupBy,`group`);for(let n of e.sorts??[])t.set(n.colId,`sort`);let n=new Set;Sne(e.filters??[],n);for(let e of n)t.set(e,`filter`);return t}function Mf(e){return e.default!==!1||e.source===`overlay`}function Nf(e){let t=e.filter(Mf).map(e=>e.key),n=e.filter(e=>!Mf(e)).map(e=>e.key);return{filters:[],filterConj:`and`,sorts:[],groupBy:null,colorBy:null,rowHeightMode:`short`,order:[...t,...n],visible:t,widths:{},memberPids:[]}}function Tne(e,t){let n=new Set(t.map(e=>e.key)),r=e.filter((t,r)=>n.has(t)&&e.indexOf(t)===r);for(let e of t)r.includes(e.key)||r.push(e.key);let i=t.find(e=>e.pinned)?.key??t[0]?.key;return i&&r[0]!==i?[i,...r.filter(e=>e!==i)]:r}function Ene(e,t,n){let r=new Set(t.map(e=>e.key)),i=new Set(e.filter(e=>r.has(e)));if(i.size===0)for(let e of t)Mf(e)&&i.add(e.key);return n&&i.add(n),i}function Dne(e,t,n){let r=(0,z.useMemo)(()=>new Map(e.map(e=>[e.key,e])),[e]),i=(0,z.useMemo)(()=>e.find(e=>e.pinned)?.key??e[0]?.key??``,[e]),a=(0,z.useMemo)(()=>Tne(t.order,e),[t.order,e]),o=(0,z.useMemo)(()=>Ene(t.visible,e,i),[t.visible,e,i]),s=(0,z.useMemo)(()=>wne(t),[t.filters,t.sorts,t.groupBy]),c=(0,z.useMemo)(()=>a.filter(e=>o.has(e)).map(e=>{let n=r.get(e),i=t.widths[e]??yne,a=s.has(e),o=mne(xne(n),n.source===`overlay`);return{id:e,title:gne(n.label,hne(i,o),e=>bne(e,a)),width:i,hasMenu:!0,menuIcon:`dots`,icon:sne(n.type),themeOverride:Cne(s.get(e))}}),[a,o,t.widths,r,s]),l=(0,z.useCallback)((e,r)=>{e.id&&n({...t,widths:{...t.widths,[e.id]:Math.round(r)}})},[t,n]),u=(0,z.useCallback)((e,r)=>{if(e===0||r===0)return;let i=a.filter(e=>o.has(e));if(e<0||e>=i.length||r<0||r>=i.length)return;let s=i.slice(),[c]=s.splice(e,1);s.splice(r,0,c);let l=0,u=a.map(e=>o.has(e)?s[l++]:e);n({...t,order:u})},[t,n,a,o]),d=(0,z.useCallback)((e,t)=>e!==0&&t!==0,[]),f=(0,z.useCallback)((e,r)=>{if(!r&&e===i)return;let a=new Set(o);r?a.add(e):a.delete(e),n({...t,visible:[...a]})},[t,i,n,o]),p=(0,z.useCallback)((e,r,i)=>{let s=a.filter(t=>t!==e);if(i===`end`||!r)s.push(e);else{let t=Math.max(0,s.indexOf(r));s.splice(t+ +(i===`right`),0,e)}let c=new Set(o);c.add(e),n({...t,order:s,visible:[...c]})},[t,n,a,o]);return{visibleCols:c,fieldByKey:r,order:a,visible:o,widths:t.widths,lockedKey:i,onColumnResize:l,onColumnMoved:u,onColumnProposeMove:d,setColumnVisible:f,insertColumn:p}}function One(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:0}function kne(e,t){let n={};for(let r of t){if(r.agg!==`sum`)continue;let t=0;for(let n of e)t+=One(n[r.key]);let i=Math.round(t*100)/100;n[r.key]=r.type===`currency`?`$`+i.toLocaleString():i.toLocaleString()}return n}var Pf={sets:new Map,unanswerable:0};function Ane(e){return e===`currency`||e===`int`||e===`pct`||e===`rating`||e===`formula`}function Ff(e){return!hd(e)&&!md(e)&&od(e.op)}function If(e){for(let t of e??[]){if(hd(t)){if(If(t.children))return!0;continue}if(Ff(t))return!0}return!1}function Lf(e){let t=[];for(let n of e??[]){if(hd(n)){let e=Lf(n.children);e.length&&t.push({conj:n.conj,children:e});continue}Ff(n)||t.push(n)}return t}function Rf(e){let t=[];for(let n of e??[]){if(hd(n)){t.push(...Rf(n.children));continue}if(!Ff(n))continue;let e=n;pd(e)&&t.push(e)}return t}function jne(e,t,n){let r=[];for(let n of e){let e=n[t];if(e==null||e===``)continue;let i=typeof e==`number`?e:Number(e);Number.isFinite(i)&&r.push({pid:n.pid,v:i})}return r.sort((e,t)=>e.v===t.v?e.pid-t.pid:n===`asc`?e.v-t.v:t.v-e.v),r}function zf(e,t,n){let r=Number(e);if(!Number.isFinite(r))return null;let i=Math.trunc(r);return i!==r||in?null:i}function Mne(e,t,n){return Math.min(n,Math.floor(e*n/t)+1)}function Bf(e,t){return Math.min(e,Math.max(1,Math.ceil(e*t/100)))}function Nne(e,t,n){let r=Rf(e);if(!r.length)return Pf;let i=new Map,a=0,o=new Map,s=(e,n)=>{let r=`${n}:${e}`,i=o.get(r);return i||(i=jne(t,e,n),o.set(r,i)),i},c=e=>{i.set(e,new Set),a+=1};for(let e of r){let r=n.get(e.colId);if(!r||!Ane(r.type)){c(e);continue}let o=s(e.colId,`asc`);if(!o.length){i.set(e,new Set),t.length&&(a+=1);continue}let l=o.length,u=null;switch(e.op){case`topN`:{let t=zf(e.value,1,1e4);u=t==null?null:s(e.colId,`desc`).slice(0,t);break}case`bottomN`:{let t=zf(e.value,1,1e4);u=t==null?null:o.slice(0,t);break}case`inTopPct`:{let t=zf(e.value,1,100);u=t==null?null:s(e.colId,`desc`).slice(0,Bf(l,t));break}case`inBottomPct`:{let t=zf(e.value,1,100);u=t==null?null:o.slice(0,Bf(l,t));break}case`aboveAvg`:case`belowAvg`:{let t=o.reduce((e,t)=>e+t.v,0)/l;u=o.filter(n=>e.op===`aboveAvg`?n.v>t:n.vMne(r,l,t)===n);break}default:u=null}if(u==null){c(e);continue}i.set(e,new Set(u.map(e=>e.pid)))}return{sets:i,unanswerable:a}}function Vf(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:0}function Hf(e){return e===`currency`||e===`int`||e===`pct`||e===`rating`||e===`formula`}function Pne(e){return e===`date`||e===`created_time`}function Fne(e,t,n){for(let r of n){if(r.type!==`text`&&r.type!==`status`)continue;let n=t[r.key];if(n!=null&&String(n).toLowerCase().includes(e))return!0}return!1}function Uf(e){return e==null||e===``}function Ine(e,t,n,r){let i=n.get(e.colId);if(!i)return!0;let a=t[e.colId];if(e.op===`isEmpty`)return Uf(a);if(e.op===`isNotEmpty`)return!Uf(a);if(od(e.op))return!1;let o=e.rhs!=null,s=o?t[fd(e.rhs)??``]:void 0;if(Hf(i.type)){let t=Vf(a);if(o)return Wf(e.op,t,Vf(s));if(e.op===`between`){if(e.value===``||e.value2==null||e.value2===``)return!0;let n=Math.min(Vf(e.value),Vf(e.value2)),r=Math.max(Vf(e.value),Vf(e.value2));return t>=n&&t<=r}return e.value===``||Wf(e.op,t,Vf(e.value))}if(Pne(i.type)){let t=String(a??``).slice(0,10);if(e.op===`within`){if(!r)return!1;let n=Ku(e.dateWindow,r);if(!n||t===``)return!1;let[i,a]=n;return(i==null||t>=i)&&(a==null||t<=a)}if(o)return Gf(e.op,t,String(s??``).slice(0,10));if(e.op===`between`){if(e.value===``||e.value2==null||e.value2===``)return!0;let n=e.value=n&&t<=r}if(!Lne.has(e.op)||!e.dateMode&&e.value===``)return!0;let n=e.dateMode||`exact`;if(n!==`exact`&&!r)return!1;let i=Ju(n,e.value,r||`1970-01-01`);return i!=null&&Gf(e.op,t,i)}let c=String(a??``).toLowerCase();return o?Kf(e.op,c,String(s??``).toLowerCase()):e.value===``||Kf(e.op,c,e.value.toLowerCase())}var Lne=new Set([`eq`,`neq`,`lt`,`lte`,`gt`,`gte`]);function Wf(e,t,n){switch(e){case`gt`:return t>n;case`gte`:return t>=n;case`lt`:return tn;case`gte`:return t>=n;default:return!0}}function Kf(e,t,n){switch(e){case`contains`:return t.includes(n);case`doesNotContain`:return!t.includes(n);case`eq`:return t===n;case`neq`:return t!==n;default:return!0}}function qf(e,t,n,r){if(hd(e)){let i=!1,a=!0,o=!1;for(let s of e.children){let e=qf(s,t,n,r);e!==null&&(i=!0,a&&=e,o||=e)}return i?e.conj===`or`?o:a:null}if(zee(e)){if(!pd(e))return null;let n=ud(e.value).map(e=>r?.cohortSets?.[e]);if(n.some(e=>!e))return!1;let i=ld(e.op);if(i===`allOf`)return n.every(e=>e.has(t.pid));let a=n.some(e=>e.has(t.pid));return i===`noneOf`?!a:a}if(md(e)){if(!pd(e))return null;let n=e.id?r?.measureSets?.[e.id]:void 0;return n?n.has(t.pid):!1}if(!n.has(e.colId)||e.rhs&&!n.has(fd(e.rhs)??``)||!pd(e))return null;if(od(e.op)){let n=r?.rankSets?.get(e);return n?n.has(t.pid):!1}return Ree.includes(e.op)?Ine(e,t,n,r?.today):!1}function Jf(e,t){let n=0;for(let r of e??[]){if(hd(r)){n+=Jf(r.children,t);continue}!md(r)||!pd(r)||(!r.id||!t?.[r.id])&&(n+=1)}return n}function Yf(e){let t=[];for(let n of e??[]){if(hd(n)){t.push(...Yf(n.children));continue}!md(n)||!pd(n)||t.push(n.id||`(no-id)`)}return t}function Xf(e,t){let n=0;for(let r of e??[]){if(hd(r)){n+=Xf(r.children,t);continue}if(pd(r)){if(zee(r)){ud(r.value).some(e=>!t?.cohortSets?.[e])&&(n+=1);continue}md(r)||(r.op===`within`?(!t?.today||!Ku(r.dateWindow,t.today))&&(n+=1):r.dateMode&&(!t?.today||Ju(r.dateMode,r.value,t.today)==null)&&(n+=1))}}return n}function Zf(e,t,n,r,i){let a=qf({conj:t,children:e},n,r,i);return a===null||a}function Rne(e,t){return(n,r)=>{for(let i of e){let e=t.get(i.colId),a=e?Hf(e.type):!1,o=n[i.colId],s=r[i.colId],c=Uf(o),l=Uf(s);if(c!==l)return c?1:-1;if(c&&l)continue;let u=a?Vf(o)-Vf(s):String(o??``).localeCompare(String(s??``));if(u!==0)return i.dir===`asc`?u:-u}return 0}}function zne(e,t,n,r){let i=[],a=new Map,o=r.some(e=>e.key===t&&(e.multi||e.type===`multiselect`)),s=r.some(e=>e.key===t&&e.type===`checkbox`),c=e=>s?e===`1`?`Checked`:`Unchecked`:e===``?`(empty)`:e;for(let n of e){let e=n[t],r=e==null?``:String(e),s=o?r.split(`,`).map(e=>e.trim()).filter(e=>e!==``):[r];for(let e of s.length?s:[``]){let t=a.get(e);t||(t=[],a.set(e,t),i.push(e)),t.push(n)}}let l=[];for(let e of i){let t=a.get(e),i=n.has(e),o=kne(t,r);if(l.push({kind:`group-header`,groupKey:e,label:c(e),count:t.length,collapsed:i,aggs:o}),!i){for(let e of t)l.push({kind:`data`,record:e});l.push({kind:`group-footer`,groupKey:e,aggs:o})}}return l}function Qf(e){let{rawRows:t,fields:n,filters:r,search:i,sorts:a,groupBy:o,collapsed:s,memberPids:c=[],filterConj:l=`and`,serverWindowed:u=!1,measureSets:d,cohortSets:f,today:p,cohortLock:m}=e,h={measureSets:d,cohortSets:f,today:p},g=0,_=e=>{let t=e.map(e=>({kind:`data`,record:e})),n=new Map;return t.forEach((e,t)=>{e.kind===`data`&&n.set(e.record.pid,t)}),{visibleRows:t,pidToIndex:n,unresolvedRank:g}};if(u)return _(t);let v=new Map;for(let e of n)v.set(e.key,e);let y=t;if(m){let e=f?.[m];if(!e)return _([]);y=y.filter(t=>e.has(t.pid))}if(r.length){if(If(r)){let e=Lf(r),t=y,n=Nne(r,e.length?t.filter(t=>Zf(e,l,t,v,h)):t,v);h.rankSets=n.sets,g=n.unanswerable}else h.rankSets=Pf.sets;let e=new Set(c);y=y.filter(t=>e.has(t.pid)||Zf(r,l,t,v,h))}let b=i.trim().toLowerCase();if(b&&(y=y.filter(e=>Fne(b,e,n))),a.length&&(y=[...y].sort(Rne(a,v))),!o)return _(y);let x=zne(y,o,s,n),S=new Map;return x.forEach((e,t)=>{e.kind===`data`&&!S.has(e.record.pid)&&S.set(e.record.pid,t)}),{visibleRows:x,pidToIndex:S,unresolvedRank:g}}function Bne(e,t,n,r,i,a,o,s=[],c=`and`,l=!1,u,d,f,p){return(0,z.useMemo)(()=>Qf({rawRows:e,fields:t,filters:n,search:r,sorts:i,groupBy:a,collapsed:o,memberPids:s,filterConj:c,serverWindowed:l,measureSets:u,cohortSets:d,today:f,cohortLock:p}),[e,t,n,c,r,i,a,o,s,l,u,d,f,p])}var $f=`code`;function Vne(e){let t=new Map;for(let n of e){let e=n[$f];typeof e==`string`&&e&&!t.has(e)&&t.set(e,n)}return t}function Hne(e){for(let[t,n]of e)if(n.type===`image`)return t}function Une(e,t,n,r,i){let a=(e,t)=>{if(!t)return;let n=i.get(t);return n&&r(n,e[t])||void 0},o=Hne(i);return e.map(e=>{let r=t.get(e);return r?{code:e,known:!0,image:Wne(r,o)||e,name:a(r,n?.name),pack:a(r,n?.pack),color:a(r,n?.color),price:a(r,n?.price)}:{code:e,image:e,known:!1}})}function ep(e){let t={},n=(t,n)=>e.find(e=>e.key!==`code`&&(t.test(e.key)||t.test(e.label))&&(!n||n.includes(e.type)))?.key;t.name=n(/^(product|name|title|description)$/i)??e.find(e=>e.key!==`code`&&e.type===`text`)?.key,t.pack=n(/pack|case|carton|inner/i),t.color=n(/colou?r/i),t.price=n(/price|msrp|list/i,[`currency`,`int`,`pct`]);for(let e of[`name`,`pack`,`color`,`price`])t[e]||delete t[e];return t}function tp(e){return e.startsWith(`ed:`)?e.slice(3).trim().toLowerCase():null}function np(e,t){let n=tp(e);if(n!==null)return`${jd}/assets/editorial/${encodeURIComponent(n)}?q=${t}`;if(e.startsWith(`rec:`)){let n=e.slice(mee.length).trim();return`${jd}/assets/records/${encodeURIComponent(n)}?q=${t}`}return`${jd}/assets/products/${encodeURIComponent(e)}?q=${t}`}function Wne(e,t){if(!e)return``;if(t){let n=e[t];if(typeof n==`string`&&n.trim())return n.trim()}let n=e[$f];return typeof n==`string`?n.trim():``}var Gne=`${jd}/assets/products`,rp=`${jd}/assets/editorial`;async function Kne(){try{let e=await fetch(Gne,{credentials:`same-origin`});if(!e.ok)return null;let t=await e.json();return Array.isArray(t.codes)?new Set(t.codes.filter(e=>typeof e==`string`)):null}catch{return null}}async function ip(){try{let e=await fetch(rp,{credentials:`same-origin`});if(!e.ok)return null;let t=await e.json();return Array.isArray(t.slugs)?new Set(t.slugs.filter(e=>typeof e==`string`).map(e=>e.toLowerCase())):null}catch{return null}}async function qne(e,t){let n=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result??``)),r.onerror=()=>n(Error(`could not read the file`)),r.readAsDataURL(t)}),r=await fetch(rp,{method:`POST`,credentials:`same-origin`,headers:{"Content-Type":`application/json`},body:JSON.stringify({slug:e,data:n})}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(i.error?.message??`upload failed (${r.status})`);return i.slug??e}var Jne=2*1024*1024,Yne=`${jd}/assets/records`;async function Xne(e){if(e.size>2097152)throw Error(`Images cap at ${Jne/(1024*1024)} MB — that one is ${(e.size/(1024*1024)).toFixed(1)} MB.`);let t=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result??``)),r.onerror=()=>n(Error(`could not read the file`)),r.readAsDataURL(e)}),n=await fetch(Yne,{method:`POST`,credentials:`same-origin`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:t})}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error(r.error?.message??`upload failed (${n.status})`);if(!r.ref)throw Error(`the server accepted the image but named no reference`);return r.ref}function Zne(e){return e.replace(/\.[A-Za-z0-9]+$/,``).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,64)}var Qne={letter:{w:8.5,h:11,unit:`in`},a4:{w:210,h:297,unit:`mm`},tabloid:{w:11,h:17,unit:`in`}},$ne={letter:`Letter · 8.5 × 11"`,a4:`A4 · 210 × 297 mm`,tabloid:`Tabloid · 11 × 17"`};function ap(e,t){let n=Qne[e];return t===`landscape`?{w:n.h,h:n.w,unit:n.unit}:{...n}}function op(e,t){return`${Number.isInteger(e)?e:e.toFixed(2).replace(/0+$/,``)}${t}`}var sp={primary:`#16233A`,accent:`#C47B5A`,company:`Royal Imports`};function cp(e){return`${e}_${typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10)}`}var ere=()=>cp(`cat`),tre=()=>cp(`pg`),lp={cover:`Cover`,intro:`Introduction`,section:`Product section`,gallery:`Full-page image`};function up(e){let t={id:tre(),kind:e};return e===`cover`&&(t.title=`Collection`),e===`intro`&&(t.title=`About us`),e===`section`&&(t.title=`New section`),t}function nre(e,t){let n=ep(t),r={id:ere(),name:e,paper:`letter`,orientation:`portrait`,brand:{...sp},pages:[up(`cover`),up(`intro`),up(`section`)]};return Object.keys(n).length&&(r.fields=n),r}function dp(e){let t=0;for(let n of e.pages)t+=n.products?.length??0;return t}function rre(e){return Math.max(0,500-dp(e))}function ire(e,t,n){let r=rre(e),i=0,a=0,o=0;return{pages:e.pages.map(e=>{if(e.id!==t)return e;let s=new Set(e.products??[]),c=[...e.products??[]];for(let e of n){let t=e.slice(0,60);if(t){if(s.has(t)){a+=1;continue}if(i>=r){o+=1;continue}s.add(t),c.push(t),i+=1}}return c.length?{...e,products:c}:e}),added:i,skippedDuplicate:a,skippedCap:o}}function fp(e){let t=e.layout;return{cols:t?.cols??3,showPack:t?.showPack!==!1,showColor:t?.showColor!==!1,showPrice:t?.showPrice===!0}}var pp=[{bg:`#EDF3FD`,fg:`#4F6079`},{bg:`#EBF6EF`,fg:`#35754E`},{bg:`#FBF4E0`,fg:`#7E6428`},{bg:`#FCEEEC`,fg:`#A3453C`},{bg:`#F1EEFB`,fg:`#6B57A8`},{bg:`#EEF1F4`,fg:`#4B5563`}];function mp(e){if(!(typeof e!=`string`||!/^#[0-9a-f]{6}$/i.test(e.trim())))return e.trim().toUpperCase()}var hp=`#182230`,gp=[{id:`blue-tint`,hue:`blue`,strength:`tint`,bg:`#EDF3FD`,fg:`#4F6079`,label:`Light blue`},{id:`green-tint`,hue:`green`,strength:`tint`,bg:`#EBF6EF`,fg:`#35754E`,label:`Light green`},{id:`yellow-tint`,hue:`yellow`,strength:`tint`,bg:`#FBF4E0`,fg:`#7E6428`,label:`Light yellow`},{id:`red-tint`,hue:`red`,strength:`tint`,bg:`#FCEEEC`,fg:`#A3453C`,label:`Light red`},{id:`purple-tint`,hue:`purple`,strength:`tint`,bg:`#F1EEFB`,fg:`#6B57A8`,label:`Light purple`},{id:`blue-pastel`,hue:`blue`,strength:`pastel`,bg:`#9DBFF2`,fg:hp,label:`Blue`},{id:`green-pastel`,hue:`green`,strength:`pastel`,bg:`#A5D8B4`,fg:hp,label:`Green`},{id:`yellow-pastel`,hue:`yellow`,strength:`pastel`,bg:`#F5D989`,fg:hp,label:`Yellow`},{id:`red-pastel`,hue:`red`,strength:`pastel`,bg:`#F0A8A0`,fg:hp,label:`Red`},{id:`purple-pastel`,hue:`purple`,strength:`pastel`,bg:`#C3B3EE`,fg:hp,label:`Purple`}];function _p(e){let t=mp(e);if(!t)return;let n=yp(t,1),r=yp(t,3),i=yp(t,5),a=gp[0],o=1/0;for(let e of gp){let t=n-yp(e.bg,1),s=r-yp(e.bg,3),c=i-yp(e.bg,5),l=(n+yp(e.bg,1))/2,u=(2+l/256)*t*t+4*s*s+(2+(255-l)/256)*c*c;u>>0;return pp[t%pp.length]}function ore(e,t){let n=e.optionColors;if(!n)return;let r=mp(n[t]);if(r)return r;let i=t.trim().toLowerCase();for(let[e,t]of Object.entries(n))if(e.trim().toLowerCase()===i)return mp(t)}function yp(e,t){return Number.parseInt(e.slice(t,t+2),16)}function bp(e){let t=e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4};return .2126*t(yp(e,1))+.7152*t(yp(e,3))+.0722*t(yp(e,5))}function sre(e){let t=bp(mp(e)??`#FFFFFF`),n=bp(`#182230`),r=bp(`#FFFFFF`);return(t+.05)/(n+.05)>=(r+.05)/(t+.05)?`#182230`:`#FFFFFF`}function xp(e,t){if(!t||e.colorCodeOptions===!1)return;let n=ore(e,t);return n?are(n):vp(t)}function Sp(e){return vp(e).bg}function Cp(e){let t=e.split(`@`)[0].trim().split(/[\s._]+/).filter(Boolean);return t.length===0?`?`:t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[1][0]).toUpperCase()}function cre(e){return Math.max(14,Math.min(22,e-6))}function lre(e,t){return{data:{kind:`aios-user`,name:e,photo:t?.[e]},copyData:e}}function wp(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:0}function Tp(e){return typeof e==`string`&&e.trim()!==``&&!Number.isFinite(Number(e))}function Ep(e){return e==null||typeof e==`string`&&e.trim()===``}function Dp(e){return e===`1`||e===1||e===!0}function Op(e,t){if(t?.abbrev&&Math.abs(e)>=1e3){let t=Math.abs(e),[n,r]=t>=1e9?[1e9,`B`]:t>=1e6?[1e6,`M`]:[1e3,`k`];return(e/n).toFixed(1)+r}let n=t&&Number.isInteger(t.decimals)&&t.decimals>=0&&t.decimals<=4?t.decimals:null,r=t?.thousands!==!1;return n==null?r?e.toLocaleString():String(e):r?e.toLocaleString(void 0,{minimumFractionDigits:n,maximumFractionDigits:n}):e.toFixed(n)}function ure(e){let t=e.includes(` `)?e.replace(` `,`T`):e,n=/T\d{2}:\d{2}/.test(t)&&!/(?:[zZ]|[+-]\d{2}:?\d{2})$/.test(t)?t+`Z`:t,r=new Date(n);return Number.isNaN(r.getTime())?null:r}function kp(e,t){if(t==null||t===``)return``;let n=String(t),r=ure(n);if(!r)return n;let i=e.format,a=i?.time??e.type===`created_time`,o=i?.tz===`utc`?{timeZone:`UTC`}:void 0;return a?r.toLocaleString(void 0,o):r.toLocaleDateString(void 0,o)}var dre=[`ok`,`partial`,`error`,`blocked`,`queued`];function Ap(e){let t=String(e??``).split(`·`)[0].trim().toLowerCase();return dre.includes(t)?t:`none`}function jp(e){let t=String(e??``).split(`·`);return t.length>1?t.slice(1).join(`·`).trim():``}function fre(e){let t=Ap(e);return t===`none`?`Not run yet`:t[0].toUpperCase()+t.slice(1)}function Mp(e,t){switch(e.type){case`currency`:return t==null||t===``?``:`$`+Op(wp(t),e.format);case`formula`:return Ep(t)?``:Tp(t)?t:Op(wp(t),e.format);case`int`:return t==null||t===``?``:Op(wp(t),e.format);case`pct`:return t==null||t===``?``:wp(t).toFixed(1)+`%`;case`date`:case`created_time`:return kp(e,t);case`checkbox`:return Dp(t)?`Checked`:``;case`rating`:{let n=wp(t);return n>=1?`${Math.round(n)} of ${$u(e)}`:``}case`automation`:return String(t??``);case`multiselect`:return String(t??``).split(`,`).map(e=>e.trim()).filter(e=>e!==``).join(`, `);default:return String(t??``)}}ot();var pre={ok:{bgCell:hf,textDark:yf},partial:{bgCell:mf,textDark:_f},blocked:{bgCell:mf,textDark:_f},error:{bgCell:Bte,textDark:vf},queued:{bgCell:pf,textDark:Wte},none:void 0};function mre(e,t,n,r,i){e.beginPath();for(let i=0;i<10;i+=1){let a=Math.PI/5*i-Math.PI/2,o=i%2==0?r:r*.45,s=t+Math.cos(a)*o,c=n+Math.sin(a)*o;i===0?e.moveTo(s,c):e.lineTo(s,c)}e.closePath(),i?(e.fillStyle=`#A98A3E`,e.fill()):(e.strokeStyle=`rgba(118, 143, 182, 0.55)`,e.lineWidth=1,e.stroke())}var Np=new Map,Pp;function Fp(e){Pp=e}function hre(e){let t=Np.get(e);if(t!==void 0)return t;if(typeof Image>`u`)return Np.set(e,null),null;let n=new Image;return Np.set(e,n),n.onload=()=>Pp?.(),n.onerror=()=>{Np.set(e,null),Pp?.()},n.src=e,n}function gre(e,t,n,r,i,a,o){let s=a?hre(a):null;if(s&&s.complete&&s.naturalWidth>0){e.save(),e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.clip();let i=Math.max(r*2/s.naturalWidth,r*2/s.naturalHeight),a=s.naturalWidth*i,o=s.naturalHeight*i;e.drawImage(s,t-a/2,n-o/2,a,o),e.restore();return}let c=vp(i);e.save(),e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.fillStyle=c.bg,e.fill(),e.fillStyle=c.fg,e.font=`600 ${Math.round(r*.9)}px ${o}`,e.textAlign=`center`,e.textBaseline=`middle`,e.fillText(Cp(i),t,n+.5),e.restore()}var _re={kind:R.Custom,isMatch:e=>e.data?.kind===`aios-user`,draw:(e,t)=>{let{ctx:n,rect:r,theme:i}=e,{name:a,photo:o}=t.data;if(!a)return!0;let s=cre(r.height),c=r.x+i.cellHorizontalPadding+s/2,l=r.y+r.height/2;return c+s/2>r.x+r.width-i.cellHorizontalPadding||gre(n,c,l,s/2,a,o,i.fontFamily),!0}},Ip=new Map;function vre(e){let t=Ip.get(e);if(t!==void 0)return t;if(typeof Image>`u`)return Ip.set(e,null),null;let n=new Image;return Ip.set(e,n),n.onload=()=>Pp?.(),n.onerror=()=>{Ip.set(e,null),Pp?.()},n.src=e,n}var yre={kind:R.Custom,isMatch:e=>e.data?.kind===`aios-image`,draw:(e,t)=>{let{ctx:n,rect:r,theme:i}=e,{url:a}=t.data,o=i.cellHorizontalPadding,s=Math.max(0,Math.min(r.height-6,r.width-o*2));if(s<=2)return!0;let c=r.x+o,l=r.y+(r.height-s)/2,u=a?vre(a):null;n.save(),n.beginPath();let d=Math.min(3,s/2);if(n.moveTo(c+d,l),n.arcTo(c+s,l,c+s,l+s,d),n.arcTo(c+s,l+s,c,l+s,d),n.arcTo(c,l+s,c,l,d),n.arcTo(c,l,c+s,l,d),n.closePath(),u&&u.complete&&u.naturalWidth>0){n.clip();let e=Math.min(s/u.naturalWidth,s/u.naturalHeight),t=u.naturalWidth*e,r=u.naturalHeight*e;n.drawImage(u,c+(s-t)/2,l+(s-r)/2,t,r)}else n.fillStyle=pf,n.fill(),n.strokeStyle=`rgba(118, 143, 182, 0.45)`,n.lineWidth=1,n.stroke();return n.restore(),!0}},bre={kind:R.Custom,isMatch:e=>e.data?.kind===`aios-rating`,draw:(e,t)=>{let{ctx:n,rect:r,theme:i}=e,{value:a,max:o}=t.data,s=r.y+r.height/2,c=r.x+i.cellHorizontalPadding+13/2,l=r.x+r.width-i.cellHorizontalPadding;for(let e=0;el);e+=1)mre(n,c,s,13/2,ee.trim()).filter(e=>e!==``),r=n.length?xp(e,n[0]):void 0;return{kind:R.Bubble,data:n,allowOverlay:!1,themeOverride:r?{bgBubble:r.bg,textBubble:r.fg}:void 0}}default:return{kind:R.Text,data:String(t??``),displayData:String(t??``),...i}}}ot();var Lp={kind:R.Text,data:``,displayData:``,allowOverlay:!1},Sre=new Set;function Cre(e,t,n,r,i){let a=e.collapsed?`▶`:`▼`,o=e.count.toLocaleString(),s=`${a} ${e.label} (${o})`,c=i?fne(a,e.label,o,r,i):s;return{kind:R.Text,data:s,displayData:t===0?c:``,allowOverlay:!1,span:[0,Math.max(0,n-1)],themeOverride:{bgCell:`#eef0f3`,bgCellMedium:`#eef0f3`,textDark:`#33333d`,baseFontStyle:dne}}}var Rp=[`#1b1b22`,`#33333d`,`#4d4d59`,`#33333d`];function wre(e,t,n){let r=Math.max(22,Math.round((e??120)*.42));return{kind:R.Loading,allowOverlay:!1,skeletonWidth:r,skeletonWidthVariability:Math.min(20,Math.round(r*.35)),skeletonHeight:10,themeOverride:{textDark:Rp[(n+t)%Rp.length]},copyData:``}}function Tre(e,t){let n=t?e.aggs[t.key]:void 0;return{kind:R.Text,data:n??``,displayData:n??``,contentAlign:`right`,allowOverlay:!1,themeOverride:{bgCell:`#f6f7f9`,bgCellMedium:`#f6f7f9`,textDark:`#4a4a55`,baseFontStyle:`600 12px`}}}function Ere(e,t,n,r,i,a,o=0,s=null,c,l=Sre,u=0){return(0,z.useCallback)(([o,d])=>{let f=e[d];if(!f)return Lp;let p=t[o],m=p?n.get(p.id):void 0;if(f.kind===`group-header`)return Cre(f,o,t.length,s,c);if(f.kind===`group-footer`)return Tre(f,m);if(!m)return Lp;let h=r[f.record.pid]?.[m.key]??f.record[m.key];return(h==null||h===``)&&l.has(m.key)?wre(p?.width,d,u):xre(m,h,i(m),a)},[e,t,n,r,i,a,o,s,c,l,u])}ot();function Dre(e,t,n){let[r,i]=(0,z.useState)(new Set),[a,o]=(0,z.useState)(void 0),s=(0,z.useRef)(null);return(0,z.useEffect)(()=>{o(e=>{if(!e)return e;let n=s.current,r=n==null?void 0:t.get(n);if(r!==void 0)return r===e.cell[1]?e:{cell:[e.cell[0],r],range:{x:e.cell[0],y:r,width:1,height:1},rangeStack:[]}})},[e,t]),{gridSelection:(0,z.useMemo)(()=>{let i=at.empty();for(let e of r){let n=t.get(e);n!==void 0&&(i=i.add(n))}return{current:a&&a.cell[1]{o(t.current);let n=t.current?e[t.current.cell[1]]:void 0;s.current=n&&n.kind===`data`?n.record.pid:null;let r=new Set;for(let n of t.rows){let t=e[n];t&&t.kind===`data`&&r.add(t.record.pid)}i(r)},[e]),selectPids:(0,z.useCallback)((e,t)=>{i(n=>{let r=t===`add`?new Set(n):new Set;for(let t of e)r.add(t);return r})},[]),togglePid:(0,z.useCallback)(e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),setActiveCell:(0,z.useCallback)((t,n)=>{let r=e[n];s.current=r&&r.kind===`data`?r.record.pid:null,o({cell:[t,n],range:{x:t,y:n,width:1,height:1},rangeStack:[]})},[e]),clearSelection:(0,z.useCallback)(()=>{i(new Set),o(void 0),s.current=null},[])}}var zp=[{key:`filters`,label:`Filter conditions`,blurb:`Which records the view shows, and how the conditions combine.`},{key:`sorts`,label:`Sorts`,blurb:`The order records are listed in.`},{key:`groupBy`,label:`Groups`,blurb:`The field records are bucketed by.`},{key:`visible`,label:`Hidden fields`,blurb:`Which columns are shown.`},{key:`order`,label:`Field order`,blurb:`Left-to-right column order.`},{key:`rowHeightMode`,label:`Row height`,blurb:`Short, medium or tall rows.`}],Bp=zp.map(e=>e.key);function Ore(e){return typeof e==`string`&&Bp.includes(e)}function Vp(e){return JSON.parse(JSON.stringify(e))}function kre(e,t,n){let r={};if(!e)return r;let i=new Set;for(let e of t)Ore(e)&&i.add(e);if(i.size===0)return r;if(i.has(`filters`)&&(r.filters=Vp(Array.isArray(e.filters)?e.filters:[]),r.filterConj=e.filterConj),i.has(`sorts`)&&(r.sorts=Vp(Array.isArray(e.sorts)?e.sorts:[])),i.has(`groupBy`)&&(r.groupBy=e.groupBy??null),i.has(`visible`)){let t=Vp(Array.isArray(e.visible)?e.visible:[]);r.visible=n&&!t.includes(n)?[n,...t]:t}return i.has(`order`)&&(r.order=Vp(Array.isArray(e.order)?e.order:[])),i.has(`rowHeightMode`)&&e.rowHeightMode&&(r.rowHeightMode=e.rowHeightMode),r}var Are=s((e=>{var t=f(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),Hp=s(((e,t)=>{t.exports=Are()})),Up=g(),H=Hp(),Wp=(0,z.createContext)(null),Gp=[`[data-overlay-autofocus]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[href]`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function Kp({children:e}){let t=(0,z.useRef)([]),n=(0,z.useMemo)(()=>({register:e=>(t.current=[...t.current.filter(t=>t!==e),e],()=>{t.current=t.current.filter(t=>t!==e)}),isTop:e=>t.current.at(-1)===e}),[]);return(0,H.jsx)(Wp.Provider,{value:n,children:e})}function jre(e){if(`getBoundingClientRect`in e){let t=e.getBoundingClientRect();return{left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:t.width,height:t.height}}return e}function Mre(e,t){return e.left===t.left&&e.top===t.top&&e.maxWidth===t.maxWidth&&e.maxHeight===t.maxHeight&&e.visibility===t.visibility}function qp({panelRef:e,onDismiss:t,dismissOnOutside:n=!0,initialFocus:r=`first`,restoreFocus:i=!0,trapFocus:a=!1,outsideElements:o=[]}){let s=(0,z.useId)(),c=(0,z.useContext)(Wp),l=(0,z.useRef)(t),u=(0,z.useRef)(o);l.current=t,u.current=o,(0,z.useEffect)(()=>c?.register(s),[s,c]),(0,z.useEffect)(()=>{let t=t=>{if(!n||c&&!c.isTop(s))return;let r=t.target;!r||e.current?.contains(r)||u.current.some(e=>e?.contains(r))||(document.activeElement instanceof HTMLElement&&e.current?.contains(document.activeElement)&&document.activeElement.blur(),l.current())},r=t=>{if(c&&!c.isTop(s))return;if(t.key===`Escape`){t.preventDefault(),t.stopPropagation(),document.activeElement instanceof HTMLElement&&e.current?.contains(document.activeElement)&&document.activeElement.blur(),l.current();return}if(t.key!==`Tab`||!a)return;let n=Array.from(e.current?.querySelectorAll(Gp)??[]).filter(e=>e.getClientRects().length>0);if(!n.length){t.preventDefault(),e.current?.focus();return}let r=n[0],i=n.at(-1),o=document.activeElement;t.shiftKey&&(o===r||!e.current?.contains(o))?(t.preventDefault(),i.focus()):!t.shiftKey&&o===i&&(t.preventDefault(),r.focus())};return document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`keydown`,r,!0)}},[n,s,e,c,a]),(0,z.useLayoutEffect)(()=>{let t=document.activeElement instanceof HTMLElement?document.activeElement:null,n=window.requestAnimationFrame(()=>{if(r===`none`)return;let t=r===`first`?Gp:r;(e.current?.querySelector(t))?.focus({preventScroll:!0})});return()=>{window.cancelAnimationFrame(n),i&&t?.isConnected&&t.focus({preventScroll:!0})}},[r,e,i])}function Jp({children:e}){return(0,Up.createPortal)(e,document.body)}function Yp({anchor:e,className:t,children:n,onDismiss:r,placement:i=`bottom-start`,role:a,ariaLabel:o,id:s,initialFocus:c=`first`,restoreFocus:l=!0,dismissOnOutside:u=!0,onKeyDown:d,dataKind:f}){let p=(0,z.useRef)(null),[m,h]=(0,z.useState)({position:`fixed`,left:0,top:0,visibility:`hidden`}),g=`getBoundingClientRect`in e?e:null;qp({panelRef:p,onDismiss:r,dismissOnOutside:u,initialFocus:c,restoreFocus:l,outsideElements:[g]});let _=(0,z.useCallback)(()=>{let t=p.current;if(!t)return;let n=jre(e),r=window.visualViewport,a=r?.offsetLeft??0,o=r?.offsetTop??0,s=r?.width??window.innerWidth,c=r?.height??window.innerHeight,l=t.getBoundingClientRect(),u=vne({placement:i,target:n,panel:{width:Math.max(l.width,t.scrollWidth),height:Math.max(l.height,t.scrollHeight)},viewport:{left:a,top:o,width:s,height:c}}),d={position:`fixed`,left:u.left,top:u.top,maxWidth:u.maxWidth,maxHeight:u.maxHeight,visibility:`visible`};h(e=>Mre(e,d)?e:d)},[e,i]);return(0,z.useLayoutEffect)(()=>{_();let e=window.requestAnimationFrame(_),t=new ResizeObserver(_);return p.current&&t.observe(p.current),g&&t.observe(g),window.addEventListener(`resize`,_),window.addEventListener(`scroll`,_,!0),window.visualViewport?.addEventListener(`resize`,_),window.visualViewport?.addEventListener(`scroll`,_),()=>{window.cancelAnimationFrame(e),t.disconnect(),window.removeEventListener(`resize`,_),window.removeEventListener(`scroll`,_,!0),window.visualViewport?.removeEventListener(`resize`,_),window.visualViewport?.removeEventListener(`scroll`,_)}},[g,_]),(0,H.jsx)(Jp,{children:(0,H.jsx)(`div`,{ref:p,id:s,className:t,style:m,role:a,"aria-label":o,"data-overlay-kind":f,onKeyDown:d,children:n})})}function Xp({shapes:e}){return(0,H.jsx)(H.Fragment,{children:e.map((e,t)=>e.fill?(0,H.jsx)(`path`,{d:e.d,fill:`currentColor`},t):(0,H.jsx)(`path`,{d:e.d,fill:`none`,stroke:`currentColor`,strokeWidth:1.35,strokeLinecap:`round`,strokeLinejoin:`round`},t))})}function Zp({type:e,size:t=14,title:n}){return(0,H.jsxs)(`svg`,{className:`cg-type-icon`,width:t,height:t,viewBox:`0 0 16 16`,"aria-hidden":!n||void 0,role:n?`img`:void 0,"aria-label":n,children:[n&&(0,H.jsx)(`title`,{children:n}),(0,H.jsx)(Xp,{shapes:wf[e===`measure`?`currency`:e]})]})}function Qp({mode:e,size:t=14}){return(0,H.jsx)(`svg`,{className:`cg-mode-icon`,width:t,height:t,viewBox:`0 0 16 16`,"aria-hidden":!0,children:(0,H.jsx)(Xp,{shapes:Tf[e]})})}function $p({mode:e,tone:t,size:n=15}){let r=Ef[t];return(0,H.jsx)(`svg`,{className:`cg-mode-icon cg-tone-icon`,width:n,height:n,viewBox:`0 0 16 16`,"aria-hidden":!0,children:Tf[e].map((e,t)=>e.fill?(0,H.jsx)(`path`,{d:e.d,fill:r.stroke},t):(0,H.jsx)(`path`,{d:e.d,fill:`none`,stroke:r.stroke,strokeWidth:1.35,strokeLinecap:`round`,strokeLinejoin:`round`},t))})}function Nre({kind:e,size:t=15}){let n=Ef[tne[e]];return(0,H.jsx)(`svg`,{className:`cg-mode-icon cg-tone-icon`,width:t,height:t,viewBox:`0 0 16 16`,"aria-hidden":!0,children:ene[e].map((t,r)=>(0,H.jsx)(`path`,{d:t.d,fill:r===0&&(e===`area`||e===`donut`||e===`kpi`||e===`table`)?n.fill:`none`,stroke:n.stroke,strokeWidth:1.35,strokeLinecap:`round`,strokeLinejoin:`round`},r))})}var Pre={width:16,height:16,viewBox:`0 0 16 16`,fill:`none`},em={stroke:`currentColor`,strokeWidth:1.3,strokeLinecap:`round`,strokeLinejoin:`round`},Fre={duplicate:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`rect`,{x:`5.5`,y:`5.5`,width:`8`,height:`8`,rx:`1.5`,...em}),(0,H.jsx)(`path`,{d:`M10.5 2.5h-7a1 1 0 0 0-1 1v7`,...em})]}),insertLeft:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`line`,{x1:`3`,y1:`2.5`,x2:`3`,y2:`13.5`,...em}),(0,H.jsx)(`path`,{d:`M13.5 8H6.5M9.2 5.3 6.5 8l2.7 2.7`,...em})]}),insertRight:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`line`,{x1:`13`,y1:`2.5`,x2:`13`,y2:`13.5`,...em}),(0,H.jsx)(`path`,{d:`M2.5 8h7M6.8 5.3 9.5 8l-2.7 2.7`,...em})]}),addEnd:(0,H.jsx)(`path`,{d:`M8 3v10M3 8h10`,...em}),rename:(0,H.jsx)(`path`,{d:`m9.8 3.2 3 3L6.2 12.8l-3.6.6.6-3.6 6.6-6.6Z`,...em}),description:(0,H.jsx)(`path`,{d:`M3 4.5h10M3 8h10M3 11.5h6`,...em}),permissions:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`rect`,{x:`3.5`,y:`7`,width:`9`,height:`6`,rx:`1`,...em}),(0,H.jsx)(`path`,{d:`M5.5 7V5.2a2.5 2.5 0 0 1 5 0V7`,...em})]}),unlock:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`rect`,{x:`3.5`,y:`7`,width:`9`,height:`6`,rx:`1`,...em}),(0,H.jsx)(`path`,{d:`M5.5 7V5.2a2.5 2.5 0 0 1 5 0`,...em})]}),format:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{d:`M3 5h5.5M12.5 5H13M3 11h1M7 11h6`,...em}),(0,H.jsx)(`circle`,{cx:`10.5`,cy:`5`,r:`1.6`,...em}),(0,H.jsx)(`circle`,{cx:`4.9`,cy:`11`,r:`1.6`,...em})]}),swap:(0,H.jsx)(`path`,{d:`M3.5 6h9M10.2 3.7 12.5 6l-2.3 2.3M12.5 10.5h-9M5.8 8.2 3.5 10.5l2.3 2.3`,...em}),sortAsc:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{d:`M4.5 3v10M4.5 13l-2-2M4.5 13l2-2`,...em}),(0,H.jsx)(`path`,{d:`M8.5 4.5h2M8.5 8h3.5M8.5 11.5h5`,...em})]}),sortDesc:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{d:`M4.5 3v10M4.5 13l-2-2M4.5 13l2-2`,...em}),(0,H.jsx)(`path`,{d:`M8.5 4.5h5M8.5 8h3.5M8.5 11.5h2`,...em})]}),off:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`circle`,{cx:`8`,cy:`8`,r:`5.5`,...em}),(0,H.jsx)(`line`,{x1:`4.4`,y1:`11.6`,x2:`11.6`,y2:`4.4`,...em})]}),filter:(0,H.jsx)(`path`,{d:`M2.5 3.5h11L9.5 8.5v3.8L6.5 14V8.5L2.5 3.5Z`,...em}),group:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`line`,{x1:`2.5`,y1:`4`,x2:`13.5`,y2:`4`,...em}),(0,H.jsx)(`line`,{x1:`5.5`,y1:`8`,x2:`13.5`,y2:`8`,...em}),(0,H.jsx)(`line`,{x1:`5.5`,y1:`12`,x2:`13.5`,y2:`12`,...em})]}),pin:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{d:`M6 2.5h4l-.5 4L12 9v1H4V9l2.5-2.5L6 2.5Z`,...em}),(0,H.jsx)(`line`,{x1:`8`,y1:`10`,x2:`8`,y2:`13.5`,...em})]}),unpin:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{d:`M6 2.5h4l-.5 4L12 9v1H4V9l2.5-2.5L6 2.5Z`,...em}),(0,H.jsx)(`line`,{x1:`8`,y1:`10`,x2:`8`,y2:`13.5`,...em}),(0,H.jsx)(`line`,{x1:`3`,y1:`13`,x2:`13`,y2:`3`,...em})]}),hide:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{d:`M2.5 8s2-3.5 5.5-3.5S13.5 8 13.5 8s-2 3.5-5.5 3.5S2.5 8 2.5 8Z`,...em}),(0,H.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.5`,...em}),(0,H.jsx)(`line`,{x1:`3.5`,y1:`12.5`,x2:`12.5`,y2:`3.5`,...em})]}),trash:(0,H.jsx)(`path`,{d:`M3.5 4.5h9M6.5 4.5V3h3v1.5M5 4.5l.6 8.5h4.8l.6-8.5`,...em}),download:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{d:`M8 2.5v7M5.3 6.8 8 9.5l2.7-2.7`,...em}),(0,H.jsx)(`path`,{d:`M3 11v1.5a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V11`,...em})]}),cohortAdd:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{d:`M2.5 4h7M2.5 7.5h5M2.5 11h4`,...em}),(0,H.jsx)(`path`,{d:`M11.5 8.5v5M9 11h5`,...em})]})};function Ire({name:e}){return(0,H.jsx)(`svg`,{...Pre,"aria-hidden":!0,children:Fre[e]})}function tm({icon:e,text:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`cg-mi-ic`,"aria-hidden":!0,children:typeof e==`string`?(0,H.jsx)(Ire,{name:e}):e}),(0,H.jsx)(`span`,{className:`cg-mi-text`,children:t})]})}function nm({size:e=14}){return(0,H.jsxs)(`svg`,{className:`cg-eyeoff-icon`,width:e,height:e,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:[(0,H.jsx)(`path`,{d:`M2.5 8s2-3.5 5.5-3.5S13.5 8 13.5 8s-2 3.5-5.5 3.5S2.5 8 2.5 8Z`,stroke:`currentColor`,strokeWidth:1.4,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,H.jsx)(`path`,{d:`M9.6 8a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0Z`,stroke:`currentColor`,strokeWidth:1.4,strokeLinejoin:`round`}),(0,H.jsx)(`path`,{d:`M3.3 12.7 12.7 3.3`,stroke:`currentColor`,strokeWidth:1.4,strokeLinecap:`round`})]})}function rm({size:e=11}){return(0,H.jsxs)(`svg`,{className:`cg-lock-mark`,width:e,height:e,viewBox:`0 0 16 16`,"aria-hidden":!0,children:[(0,H.jsx)(`path`,{d:`M4.2 7.2h7.6v5.6H4.2z`,fill:`none`,stroke:`currentColor`,strokeWidth:1.35,strokeLinejoin:`round`}),(0,H.jsx)(`path`,{d:`M5.9 7.2V5.5a2.1 2.1 0 0 1 4.2 0v1.7`,fill:`none`,stroke:`currentColor`,strokeWidth:1.35,strokeLinecap:`round`})]})}function im({icon:e,size:t=14}){let n=e?.shape??`folder`,r=Ef[e?.tone??`neutral`];return(0,H.jsx)(`svg`,{className:`cg-folder-mark`,width:t,height:t,viewBox:`0 0 16 16`,"aria-hidden":!0,children:nne[n].map((e,t)=>(0,H.jsx)(`path`,{d:e.d,fill:`none`,stroke:r.stroke,strokeWidth:1.35,strokeLinecap:`round`,strokeLinejoin:`round`},t))})}function am({item:e}){return e.icon?(0,H.jsx)(H.Fragment,{children:e.icon}):e.type?(0,H.jsx)(Zp,{type:e.type,title:e.type===`measure`?`Metric`:Af[e.type]}):(0,H.jsx)(`span`,{className:`cg-fsel-nomark`,"aria-hidden":!0})}function Lre(){return(0,H.jsx)(`svg`,{className:`cg-fsel-caret`,width:`10`,height:`10`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M4 6l4 4 4-4`,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`})})}function Rre(){return(0,H.jsx)(`svg`,{className:`cg-type-check`,width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`m3.5 8.5 3 3 6-6.5`,stroke:`currentColor`,strokeWidth:1.6,strokeLinecap:`round`,strokeLinejoin:`round`})})}var om=8;function sm({fields:e,value:t,onChange:n,placeholder:r=`Choose a field…`,allow:i,ariaLabel:a,className:o,disabled:s,title:c,keepOpen:l,overlayAutofocus:u}){let[d,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)(``),h=(0,z.useRef)(null),g=(0,z.useRef)(null),_=(0,z.useMemo)(()=>i?e.filter(e=>e.type!=null&&i.includes(e.type)):e,[e,i]),v=t!=null,y=v?e.find(e=>e.key===t):void 0,b=p.trim().toLowerCase(),x=b?_.filter(e=>e.label.toLowerCase().includes(b)):_,S=()=>{f(!1),m(``)},C=e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`&&e.key!==`Home`&&e.key!==`End`)return;let t=Array.from(g.current?.querySelectorAll(`button.cg-type-row`)??[]).filter(e=>!e.disabled);if(!t.length)return;e.preventDefault();let n=t.indexOf(document.activeElement);if(e.key===`Home`)return t[0].focus();if(e.key===`End`)return t[t.length-1].focus();let r=e.key===`ArrowDown`?1:-1;t[n<0?r===1?0:t.length-1:(n+r+t.length)%t.length].focus()},w;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{ref:h,type:`button`,disabled:s,className:`cg-select cg-fsel`+(y?``:v&&t!==``?` is-missing`:` is-empty`)+(o?` ${o}`:``),"aria-label":a,"aria-haspopup":`listbox`,"aria-expanded":d,"data-overlay-autofocus":u?!0:void 0,onClick:()=>f(e=>!e),children:[y?(0,H.jsx)(am,{item:y}):(0,H.jsx)(`span`,{className:`cg-fsel-nomark`,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`cg-fsel-label`,children:y?.label??(v&&t!==``?t:r)}),(0,H.jsx)(Lre,{})]}),d&&h.current&&(0,H.jsx)(Yp,{anchor:h.current,className:`cg-pop cg-fsel-pop`,onDismiss:S,role:`dialog`,ariaLabel:a??c??`Choose a field`,initialFocus:_.length>=om?`.cg-fsel-search input`:`button.cg-type-row`,dataKind:`field-select`,children:(0,H.jsxs)(`div`,{className:`cg-fsel-body`,onKeyDown:C,children:[c&&(0,H.jsx)(`div`,{className:`cg-pop-title`,children:c}),_.length>=om&&(0,H.jsxs)(`div`,{className:`cg-type-search cg-fsel-search`,children:[(0,H.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:[(0,H.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.4`,stroke:`currentColor`,strokeWidth:`1.35`}),(0,H.jsx)(`path`,{d:`m10.4 10.4 3.1 3.1`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`})]}),(0,H.jsx)(`input`,{type:`text`,value:p,placeholder:`Find a field…`,"aria-label":`Find a field`,onChange:e=>m(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`cg-type-list`,role:`listbox`,ref:g,"aria-label":a??c??`Fields`,children:[x.map(e=>{let r=e.group&&e.group!==w?e.group:null;return w=e.group,(0,H.jsxs)(z.Fragment,{children:[r&&(0,H.jsx)(`div`,{className:`cg-fsel-group`,role:`presentation`,children:r}),(0,H.jsxs)(`button`,{type:`button`,role:`option`,disabled:e.disabled,"aria-selected":e.key===t,className:`cg-type-row`+(e.key===t?` is-on`:``),onClick:()=>{n(e.key),l?m(``):S()},children:[(0,H.jsx)(am,{item:e}),(0,H.jsxs)(`span`,{className:`cg-type-label`,children:[e.label,e.hint&&(0,H.jsx)(`span`,{className:`cg-fsel-hint`,children:e.hint})]}),e.key===t&&(0,H.jsx)(Rre,{})]})]},e.key)}),x.length===0&&(0,H.jsx)(`div`,{className:`cg-pop-note`,children:_.length===0?`No field to choose here.`:`No field matches.`})]})]})})]})}function cm(e,t){let n=e=>e.toLocaleString();if(!t?.windowed)return`${n(e)} ${e===1?`record`:`records`}`;let r=t.matched===1?`record`:`records`,i=t.matched=t.matched?`${n(t.matched)} ${r}${i}`:`showing ${n(t.shown)} of ${n(t.matched)} ${r}${i}`}function lm(e){if(!e?.partial)return null;let t=typeof e.loaded==`number`&&Number.isFinite(e.loaded)&&e.loaded>=0?Math.floor(e.loaded):0,n=typeof e.total==`number`&&Number.isFinite(e.total)&&e.total>0?Math.floor(e.total).toLocaleString():`…`;return`${t.toLocaleString()} of ${n}`}function zre(e,t){if(!t?.windowed)return cm(e,t);let n=e=>e.toLocaleString();return t.shown>=t.matched?`${n(t.matched)} ${t.matched===1?`record`:`records`}`:`showing ${n(t.shown)} of ${n(t.matched)}`}function um({window:e,onWindow:t,kinds:n=Au}){let r=e.kind;return(0,H.jsxs)(`span`,{className:`cg-cond-window`,children:[(0,H.jsx)(`select`,{className:`cg-select cg-cond-win-kind`,value:r,"aria-label":`Date window`,onChange:n=>{let r=n.target.value;ju.has(r)?t({kind:r,n:e.n??30}):t(r===`custom`?{kind:r,from:e.from??``,to:e.to??``}:{kind:r})},children:(n.includes(r)?n:[...n,r]).map(e=>(0,H.jsx)(`option`,{value:e,children:ju.has(e)?Mu[e].replace(`{n}`,`N`):Mu[e]},e))}),ju.has(r)&&(0,H.jsx)(`input`,{className:`cg-input cg-cond-win-n`,type:`number`,min:1,max:3650,"aria-label":`Number of days`,value:e.n??``,onChange:n=>t({...e,n:n.target.value===``?void 0:Number(n.target.value)})}),r===`custom`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`input`,{className:`cg-input cg-cond-win-date`,type:`date`,"aria-label":`Window start`,value:e.from??``,onChange:n=>t({...e,from:n.target.value})}),(0,H.jsx)(`span`,{className:`cg-cond-and`,children:`and`}),(0,H.jsx)(`input`,{className:`cg-input cg-cond-win-date`,type:`date`,"aria-label":`Window end`,value:e.to??``,onChange:n=>t({...e,to:n.target.value})})]})]})}var dm=rd,fm=id;function pm(e){return e===`checkbox`?[`isNotEmpty`,`isEmpty`]:dm(e)?[`gte`,`gt`,`lte`,`lt`,`eq`,`neq`,`between`,`isEmpty`,`isNotEmpty`]:fm(e)?[`eq`,`within`,`lt`,`gt`,`lte`,`gte`,`neq`,`isEmpty`,`isNotEmpty`]:e===`status`||e===`select`||e===`user`?[`eq`,`neq`,`isEmpty`,`isNotEmpty`]:[`contains`,`doesNotContain`,`eq`,`neq`,`isEmpty`,`isNotEmpty`]}var Bre={topN:`top N`,bottomN:`bottom N`,inTopPct:`top N%`,inBottomPct:`bottom N%`,aboveAvg:`above average`,belowAvg:`below average`,inQuartile:`in quartile`,inDecile:`in decile`};function Vre(e){switch(e){case`topN`:case`bottomN`:case`inTopPct`:case`inBottomPct`:case`inDecile`:return`10`;case`inQuartile`:return`4`;default:return``}}function mm(e){for(let t of e??[]){if(hd(t)){if(mm(t.children))return!0;continue}if(od(t.op)&&!md(t))return!0}return!1}function hm(e,t){if(od(e))return Bre[e]??e;if(t===`checkbox`){if(e===`isNotEmpty`)return`is checked`;if(e===`isEmpty`)return`is unchecked`}if(e===`isEmpty`)return`is empty`;if(e===`isNotEmpty`)return`is not empty`;if(fm(t))switch(e){case`eq`:return`is`;case`neq`:return`is not`;case`within`:return`is within`;case`lt`:return`is before`;case`lte`:return`is on or before`;case`gt`:return`is after`;case`gte`:return`is on or after`;case`between`:return`is between`}if(dm(t))switch(e){case`gte`:return`≥`;case`gt`:return`>`;case`lte`:return`≤`;case`lt`:return`<`;case`eq`:return`=`;case`neq`:return`≠`;case`between`:return`is between`;default:return e}if(t===`multiselect`)switch(e){case`contains`:return`has`;case`doesNotContain`:return`does not have`;case`eq`:return`is exactly`;case`neq`:return`is not exactly`;default:return e}switch(e){case`contains`:return`contains`;case`doesNotContain`:return`does not contain`;case`eq`:return`is`;case`neq`:return`is not`;default:return e}}function Hre(e,t){return t&&!e.includes(t)?[...e,t]:[...e]}function Ure(e){return e===`or`?`Any of the following are true…`:`All of the following are true…`}var gm=[...Wee],_m=[...Gee],vm=[...Bee];function Wre(e){switch(ld(e)){case`allOf`:return`is all of`;case`noneOf`:return`is none of`;default:return`is any of`}}var ym=`measure`,bm={kind:`ltm`},xm={kind:`past_month`},Gre=[`last_n_days`,`past_week`,`past_month`,`past_year`,`this_week`,`this_month`,`this_year`,`custom`];function Kre(e,t,n,r,i){let a=e.map(e=>({key:e.key,label:e.label,type:e.type})),o=new Set(a.map(e=>e.key));if(!t||o.has(t)||r.has(t)||t===`__cohort__`&&i)return a;let s=n.get(t);return a.push({key:t,label:s?s.label:t,type:s?.type}),a}var Sm=0;function Cm(){return Sm+=1,`r${Date.now().toString(36)}${Sm.toString(36)}`}function wm(e){let t=e[0];return t?{colId:t.key,op:pm(t.type)[0],value:``}:null}function Tm(e){let t=0;for(let n of e)t+=hd(n)?Tm(n.children):1;return t}function qre({rule:e,onPatch:t}){let n=e.dateMode??`exact`;return(0,H.jsxs)(`span`,{className:`cg-cond-anchor`,children:[(0,H.jsx)(`select`,{className:`cg-select cg-cond-anchor-mode`,value:n,"aria-label":`Date`,onChange:e=>{let n=e.target.value;t({dateMode:n,value:``})},children:Nu.map(e=>(0,H.jsx)(`option`,{value:e,children:e===`n_days_ago`?Pu[e].replace(`{n}`,`N`):Pu[e]},e))}),n===`n_days_ago`&&(0,H.jsx)(`input`,{className:`cg-input cg-cond-win-n`,type:`number`,min:0,max:3650,"aria-label":`Number of days ago`,value:e.value,onChange:e=>t({value:e.target.value})}),n===`exact`&&(0,H.jsx)(`input`,{className:`cg-input cg-cond-val`,type:`date`,"aria-label":`Date`,value:e.value,onChange:e=>t({value:e.target.value})})]})}function Jre({rule:e,options:t,isMeasure:n,onPatch:r}){let i=e.rhs,a=fd(i)??``;return(0,H.jsxs)(`span`,{className:`cg-cond-rhs`,children:[(0,H.jsx)(sm,{className:`cg-cond-field`,ariaLabel:`Compare with field`,placeholder:`Select a field…`,value:a||void 0,fields:t,onChange:e=>{r({rhs:n?{kind:`measure`,colId:e,window:i?.kind===`measure`&&i.window||bm}:{kind:`field`,colId:e}})}}),n&&a!==``&&(0,H.jsx)(um,{window:i?.kind===`measure`&&i.window||bm,onWindow:e=>r({rhs:{kind:`measure`,colId:a,window:e}})})]})}function Yre({rule:e,type:t,statusOptions:n,onValue:r,onValue2:i}){if(e.op===`between`){let n=t===`date`||t===`created_time`?`date`:`number`;return(0,H.jsxs)(`span`,{className:`cg-cond-between`,children:[(0,H.jsx)(`input`,{className:`cg-input cg-cond-val`,type:n,value:e.value,onChange:e=>r(e.target.value)}),(0,H.jsx)(`span`,{className:`cg-cond-and`,children:`and`}),(0,H.jsx)(`input`,{className:`cg-input cg-cond-val`,type:n,value:e.value2??``,onChange:e=>i(e.target.value)})]})}return t===`status`||t===`select`||t===`user`||t===`multiselect`?(0,H.jsxs)(`select`,{className:`cg-select cg-cond-val`,value:e.value,onChange:e=>r(e.target.value),children:[(0,H.jsx)(`option`,{value:``,children:`Select…`}),n.map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))]}):(0,H.jsx)(`input`,{className:`cg-input cg-cond-val`,type:t===`date`||t===`created_time`?`date`:dm(t)?`number`:`text`,placeholder:`Value`,value:e.value,onChange:e=>r(e.target.value)})}function Xre({rule:e,onValue:t}){let n=e.op===`inQuartile`?4:e.op===`inDecile`?10:0;if(n)return(0,H.jsx)(`select`,{className:`cg-select cg-cond-val`,value:e.value,"aria-label":e.op===`inQuartile`?`Quartile`:`Decile`,onChange:e=>t(e.target.value),children:Array.from({length:n},(e,t)=>String(t+1)).map(e=>(0,H.jsx)(`option`,{value:e,children:e===`1`?`${e} (lowest)`:e===String(n)?`${e} (highest)`:e},e))});let r=e.op===`inTopPct`||e.op===`inBottomPct`;return(0,H.jsx)(`input`,{className:`cg-input cg-cond-val`,type:`number`,min:1,max:r?100:1e4,step:1,placeholder:`10`,"aria-label":r?`Percent`:`How many`,value:e.value,onChange:e=>t(e.target.value)})}function Zre({rule:e,lists:t,onPatch:n}){let r=ud(e.value),i=new Map(t.map(e=>[e.id,e.name])),a=t.filter(e=>!r.includes(e.id)),o=a.length>0&&r.length<20,s=e=>n({value:e.join(`,`)});return(0,H.jsxs)(`span`,{className:`cg-cond-cohorts`,children:[r.map(e=>(0,H.jsxs)(`span`,{className:`cg-chip`+(i.has(e)?``:` cg-chip--gone`),children:[(0,H.jsx)(`span`,{className:`cg-chip-text`,children:i.get(e)??`(deleted list)`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-chip-x`,"aria-label":`Remove ${i.get(e)??e}`,onClick:()=>s(r.filter(t=>t!==e)),children:`×`})]},e)),(0,H.jsxs)(`select`,{className:`cg-select cg-cond-val cg-cond-cohort-add`,value:``,"aria-label":`Cohort`,disabled:!o,onChange:e=>e.target.value&&s([...r,e.target.value]),children:[(0,H.jsx)(`option`,{value:``,children:o?r.length?`Add a cohort…`:`Select a cohort…`:`all added`}),a.map(e=>(0,H.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})}function Qre({index:e,conj:t,onConj:n}){return e===0?(0,H.jsx)(`span`,{className:`cg-cond-prefix`,children:`Where`}):e===1?(0,H.jsxs)(`select`,{className:`cg-select cg-cond-conj`,value:t,"aria-label":`Combine conditions with`,onChange:e=>n(e.target.value),children:[(0,H.jsx)(`option`,{value:`and`,children:`and`}),(0,H.jsx)(`option`,{value:`or`,children:`or`})]}):(0,H.jsx)(`span`,{className:`cg-cond-prefix cg-cond-conj-echo`,children:t})}function Em({nodes:e,conj:t,depth:n,ctx:r,onNodes:i,onConj:a}){let[o,s]=(0,z.useState)(null),c=(t,n)=>i(e.map((e,r)=>r===t?n:e)),l=t=>i(e.filter((e,n)=>n!==t)),u=()=>{let t=wm(r.fields);t&&i([...e,t])},d=()=>{let t=wm(r.fields);t&&i([...e,{conj:`or`,children:[t]}])},f=n<3;return(0,H.jsxs)(H.Fragment,{children:[e.map((e,i)=>(0,H.jsxs)(`div`,{className:`cg-cond-line`,children:[(0,H.jsx)(Qre,{index:i,conj:t,onConj:a}),hd(e)?(0,H.jsx)(eie,{group:e,depth:n+1,ctx:r,onGroup:e=>c(i,e),onRemove:()=>l(i)}):(0,H.jsx)($re,{rule:e,ctx:r,onRule:e=>c(i,e),onRemove:()=>l(i)})]},i)),(0,H.jsxs)(`div`,{className:`cg-builder-add`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn`+(o===`condition`?` is-on`:``),onClick:()=>{s(`condition`),u()},children:`+ Add condition`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn`+(o===`group`?` is-on`:``),onClick:()=>{s(`group`),d()},disabled:!f,title:f?`Group conditions so they evaluate together`:`Condition groups can nest 3 levels deep`,children:`+ Add condition group`})]})]})}function $re({rule:e,ctx:t,onRule:n,onRemove:r}){let{fields:i,fieldByKey:a,measures:o,measureByKey:s,lists:c,choicesFor:l}=t,u=md(e),d=e.colId===cd,f=c.length>0,p=u?s.get(e.colId)?.type??`currency`:a.get(e.colId)?.type??`text`,m=t=>n({...e,...t}),h=t=>{if(t===`__cohort__`){n({colId:cd,op:vm[0],value:``});return}if(s.get(t)){n({id:e.id??Cm(),colId:t,op:gm[0],value:``,value2:void 0,window:e.window??bm});return}n({colId:t,op:pm(a.get(t)?.type??`text`)[0],value:``,value2:void 0})},g=t=>{if(d)return m({op:t});if(od(t))return n({...e,op:t,value:Vre(t),value2:void 0,rhs:void 0,dateWindow:void 0});if(sd.has(t))return n({...e,op:t,value:``,value2:void 0,rhs:void 0});if(t===`within`)return n({...e,op:t,value:``,value2:void 0,rhs:void 0,dateWindow:e.dateWindow??xm});if(e.op===`within`)return n({...e,op:t,dateWindow:void 0,value:``});m({op:t})},_=u?o.map(e=>({key:e.key,label:e.label,type:ym})):i.filter(t=>t.key!==e.colId&&(dm(p)?dm(t.type):t.type===p)).map(e=>({key:e.key,label:e.label,type:e.type})),v=!d&&e.op!==`within`&&!sd.has(e.op)&&!od(e.op)&&_.length>0&&(u||dm(p)||fm(p)),y=e.rhs?.kind===`stat`,b=e.rhs!=null&&!y,x=u?b||y?_m:gm:d?vm:pm(p),S=d?ld(e.op):e.op,C=Hre(!u&&!d&&dm(p)?[...x,...Lee]:x,S),w=C.filter(e=>!od(e)),T=C.filter(e=>od(e));return(0,H.jsxs)(`span`,{className:`cg-cond-row`+(u?` is-measure`:``)+(d?` is-cohort`:``)+(e.rhs==null?``:` has-rhs`),children:[(0,H.jsx)(sm,{className:`cg-cond-field`,ariaLabel:`Field`,value:e.colId,onChange:h,fields:[...Kre(i,e.colId,a,s,f),...o.map(e=>({key:e.key,label:e.label,type:ym})),...f?[{key:cd,label:`Cohort`,type:`multiselect`}]:[]]}),u&&(0,H.jsx)(um,{window:e.window??bm,onWindow:e=>m({window:e})}),(0,H.jsxs)(`select`,{className:`cg-select cg-cond-op`,value:S,"aria-label":`Condition`,onChange:e=>g(e.target.value),children:[w.map(e=>(0,H.jsx)(`option`,{value:e,children:d?Wre(e):hm(e,p)},e)),T.length>0&&(0,H.jsx)(`optgroup`,{label:`Ranked`,children:T.map(e=>(0,H.jsx)(`option`,{value:e,children:hm(e,p)},e))})]}),v&&(0,H.jsxs)(`select`,{className:`cg-select cg-cond-mode`,value:y?`stat`:b?`field`:`value`,"aria-label":`Compare against`,onChange:t=>{let n=t.target.value;if(n===`stat`)return m({rhs:{kind:`stat`,stat:`median`},value:``,value2:void 0,op:_m.includes(e.op)?e.op:_m[1]});if(n===`field`)return m({rhs:u?{kind:`measure`,colId:``,window:bm}:{kind:`field`,colId:``},value:``,value2:void 0});m({rhs:void 0,value:``})},children:[(0,H.jsx)(`option`,{value:`value`,children:`a value`}),(0,H.jsx)(`option`,{value:`field`,children:`another field`}),u&&(0,H.jsx)(`option`,{value:`stat`,children:`a statistic`})]}),sd.has(e.op)?(0,H.jsx)(`span`,{className:`cg-cond-val cg-cond-noval`,"aria-hidden":!0}):y?(0,H.jsx)(`select`,{className:`cg-select cg-cond-val cg-cond-stat`,value:e.rhs?.kind===`stat`?e.rhs.stat:`median`,"aria-label":`Statistic`,onChange:e=>m({rhs:{kind:`stat`,stat:e.target.value}}),children:dd.map(e=>(0,H.jsx)(`option`,{value:e,children:Hee[e]},e))}):b?(0,H.jsx)(Jre,{rule:e,options:_,isMeasure:u,onPatch:m}):d?(0,H.jsx)(Zre,{rule:e,lists:c,onPatch:m}):od(e.op)?(0,H.jsx)(Xre,{rule:e,onValue:e=>m({value:e})}):e.op===`within`?(0,H.jsx)(um,{window:e.dateWindow??xm,onWindow:e=>m({dateWindow:e}),kinds:Gre}):fm(p)?(0,H.jsx)(qre,{rule:e,onPatch:m}):(0,H.jsx)(Yre,{rule:e,type:p,statusOptions:l(e.colId),onValue:e=>m({value:e}),onValue2:e=>m({value2:e})}),(0,H.jsx)(`button`,{type:`button`,className:`cg-cond-x`,"aria-label":`Remove condition`,onClick:r,children:`×`})]})}function eie({group:e,depth:t,ctx:n,onGroup:r,onRemove:i}){return(0,H.jsxs)(`span`,{className:`cg-cond-group`,"data-depth":t,children:[(0,H.jsxs)(`span`,{className:`cg-cond-group-head`,children:[(0,H.jsx)(`span`,{className:`cg-cond-group-sum`,children:e.children.length?Ure(e.conj):`Add a condition to this group…`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-cond-x`,"aria-label":`Remove condition group`,onClick:i,children:`×`})]}),(0,H.jsx)(`span`,{className:`cg-cond-group-body`,children:(0,H.jsx)(Em,{nodes:e.children,conj:e.conj,depth:t,ctx:n,onNodes:t=>r({...e,children:t}),onConj:t=>r({...e,conj:t})})})]})}function Dm({fields:e,filters:t,onChange:n,cohorts:r=[],measures:i=[],userOptions:a,statusValues:o,cohortLock:s,footerExtra:c}){let l=gd(t),u=_d(t),d=(0,z.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.key,n);return t},[e]),f=(0,z.useMemo)(()=>_ee(e),[e]),p=(0,z.useMemo)(()=>{let e=new Map;for(let t of i)e.set(t.key,t);return e},[i]),m=(0,z.useCallback)(e=>{let t=o?.[e];if(t)return t;let n=d.get(e);return n?n.type===`user`?a??[]:Qu(n):[]},[o,d,a]),h=(0,z.useMemo)(()=>({fields:f,fieldByKey:d,measures:i,measureByKey:p,lists:r,choicesFor:m}),[f,d,i,p,r,m]);return(0,H.jsxs)(`div`,{className:`cg-pop-body cg-builder`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Filter`}),s&&(0,H.jsx)(`div`,{className:`cg-flt-lockchip`,children:s.name?`Customer list locked to ${s.name}`+(typeof s.count==`number`?` · ${s.count.toLocaleString()} ${s.count===1?`customer`:`customers`}`:``):`Customer list locked to a set you cannot see`}),l.length===0?(0,H.jsx)(`div`,{className:`cg-builder-empty`,children:`No conditions. Add one to narrow the list.`}):(0,H.jsx)(`div`,{className:`cg-builder-caption`,children:`In this view, show records`}),(0,H.jsx)(Em,{nodes:l,conj:u,depth:1,ctx:h,onNodes:e=>n({conj:u,nodes:e}),onConj:e=>n({conj:e,nodes:l})}),mm(l)&&(0,H.jsx)(`div`,{className:`cg-pop-note`,children:`Ranked among the records your other conditions keep — so “top 10” inside a filtered view means the top 10 of that view. Records with no value are not ranked at all. Quartiles and deciles are equal-size slices BY RANK, not by value.`}),(l.length>0||c)&&(0,H.jsxs)(`div`,{className:`cg-pop-footer cg-builder-footer`,children:[l.length>0&&(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>n({conj:u,nodes:[]}),children:`Clear all`}),c]})]})}function Om({fields:e,hidden:t,onToggle:n,onHideAll:r,onShowAll:i,lockedKey:a,onFieldOrder:o,deletableKeys:s,onDeleteField:c}){let[l,u]=(0,z.useState)(``),[d,f]=(0,z.useState)(null),[p,m]=(0,z.useState)(null),[h,g]=(0,z.useState)(null),_=l.trim().toLowerCase(),v=_?e.filter(e=>e.label.toLowerCase().includes(_)):e,y=!!o&&_===``,b=(t,n)=>{if(t===n||t===a||n===a)return null;let r=e.map(e=>e.key),i=r.indexOf(t),o=r.indexOf(n);if(i<0||o<0)return null;let s=r.slice();return s.splice(i,1),s.splice(o,0,t),s},x=(t,n)=>{if(!y)return;let r=e.map(e=>e.key),i=r[r.indexOf(t)+n];if(i===void 0)return;let a=b(t,i);a&&o(a)};return(0,H.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Hide fields`}),(0,H.jsx)(`input`,{type:`text`,className:`cg-input cg-fields-search`,placeholder:`Find a field…`,"aria-label":`Find a field`,value:l,onChange:e=>u(e.target.value)}),(0,H.jsxs)(`div`,{className:`cg-pop-list`,children:[v.map(e=>{let r=a!==void 0&&e.key===a,i=!t.has(e.key),l=!!c&&!!s?.has(e.key),u=d===e.key;return(0,H.jsxs)(`label`,{className:`cg-check-row`+(i?``:` is-off`)+(r?` is-locked`:``)+(p===e.key?` is-dragging`:``)+(h===e.key&&p!==null&&p!==e.key?` is-drop-target`:``),title:r?`Always visible`:void 0,onDragOver:y&&p&&p!==e.key?t=>{t.preventDefault(),t.dataTransfer.dropEffect=`move`,h!==e.key&&g(e.key)}:void 0,onDrop:y&&p?t=>{t.preventDefault(),t.stopPropagation();let n=b(p,e.key);m(null),g(null),n&&o(n)}:void 0,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-field-grip`,draggable:y&&!r,"aria-label":r?`${e.label} is always first`:y?`Reorder ${e.label} — drag, or use the arrow keys`:`Reorder ${e.label} (clear the search first)`,title:y&&!r?`Drag to reorder, or use the arrow keys`:r?`This column is always first`:`Clear the search to reorder`,onDragStart:t=>{t.dataTransfer.setData(`text/plain`,e.key),t.dataTransfer.effectAllowed=`move`,m(e.key)},onDragEnd:()=>{m(null),g(null)},onClick:e=>{e.preventDefault(),e.stopPropagation()},onKeyDown:t=>{t.key!==`ArrowUp`&&t.key!==`ArrowDown`||(t.preventDefault(),t.stopPropagation(),x(e.key,t.key===`ArrowUp`?-1:1))},children:(0,H.jsx)(`svg`,{width:`10`,height:`16`,viewBox:`0 0 10 16`,"aria-hidden":!0,focusable:`false`,children:[4,8,12].map(e=>[2.5,7.5].map(t=>(0,H.jsx)(`circle`,{cx:t,cy:e,r:`1.15`,fill:`currentColor`},`${t}-${e}`)))})}),(0,H.jsx)(`input`,{type:`checkbox`,checked:i,disabled:r,onChange:()=>n(e.key)}),(0,H.jsx)(Zp,{type:e.type,title:Af[e.type]}),(0,H.jsx)(`span`,{className:`cg-check-label`,children:e.label}),e.source===`odoo`&&!e.custom&&(0,H.jsx)(`span`,{className:`cg-preset-tag`,children:`Pre-set`}),e.scope===`cohort`&&(0,H.jsx)(`span`,{className:`cg-preset-tag cg-scope-tag`,children:`Cohort-only`}),r&&(0,H.jsx)(`span`,{className:`cg-lock-tag`,children:`Locked`}),l&&(0,H.jsx)(`button`,{type:`button`,className:`cg-check-del`+(u?` is-armed`:``),"aria-label":u?`Permanently delete ${e.label}?`:`Delete ${e.label}`,title:u?void 0:`Removes this field and its values on every row.`,onClick:t=>{if(t.preventDefault(),t.stopPropagation(),!u){f(e.key);return}f(null),c(e.key)},children:u?`Delete permanently?`:(0,H.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M3.5 4.5h9M6.5 4.5V3h3v1.5M5 4.5l.6 8.5h4.8l.6-8.5`,stroke:`currentColor`,strokeWidth:1.3,strokeLinecap:`round`,strokeLinejoin:`round`})})})]},e.key)}),v.length===0&&(0,H.jsx)(`div`,{className:`cg-builder-empty`,children:`No field matches your search.`})]}),(i||r)&&(0,H.jsxs)(`div`,{className:`cg-pop-footer cg-fields-footer`,children:[i&&(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:i,children:`Show all`}),r&&(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:r,children:`Hide all`})]})]})}var tie={stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`};function nie(){return(0,H.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M4 6l4 4 4-4`,...tie})})}function km({label:e,icon:t,active:n,tone:r,wide:i,measureWide:a,pairWide:o,forceOpenSignal:s,children:c}){let[l,u]=(0,z.useState)(!1),d=(0,z.useRef)(null),f=(0,z.useId)();return(0,z.useEffect)(()=>{s&&s>0&&u(!0)},[s]),(0,H.jsxs)(`div`,{className:`cg-pop-wrap`,children:[(0,H.jsxs)(`button`,{ref:d,type:`button`,className:`cg-tb-btn`+(r?` cg-tb-btn--${r}`:``)+(n||l?` is-active`:``),onClick:()=>u(e=>!e),"aria-expanded":l,"aria-haspopup":`dialog`,"aria-controls":l?f:void 0,title:e,"aria-label":e,children:[t,(0,H.jsx)(`span`,{className:`cg-tb-label`,children:e}),(0,H.jsx)(nie,{})]}),l&&d.current&&(0,H.jsx)(Yp,{anchor:d.current,className:`cg-pop`+(i?` cg-pop--wide`:``)+(a?` cg-pop--measures`:``)+(o?` cg-pop--pair`:``),onDismiss:()=>u(!1),role:`dialog`,ariaLabel:`${e} options`,id:f,dataKind:`toolbar-${e.split(` `)[0].toLowerCase()}`,children:c(()=>u(!1))})]})}var Am={width:14,height:14,viewBox:`0 0 16 16`,fill:`none`},jm={stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`};function rie(){return(0,H.jsxs)(`svg`,{...Am,"aria-hidden":!0,children:[(0,H.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`,...jm}),(0,H.jsx)(`line`,{x1:`6.5`,y1:`3`,x2:`6.5`,y2:`13`,...jm}),(0,H.jsx)(`line`,{x1:`10.5`,y1:`3`,x2:`10.5`,y2:`13`,...jm})]})}function Mm(){return(0,H.jsx)(`svg`,{...Am,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M2.5 4h11L9.5 9v3.5L6.5 14V9L2.5 4Z`,...jm})})}function Nm(){return(0,H.jsxs)(`svg`,{...Am,"aria-hidden":!0,children:[(0,H.jsx)(`path`,{d:`M5 3v10M5 13l-2-2M5 13l2-2`,...jm}),(0,H.jsx)(`path`,{d:`M11 13V3M11 3l-2 2M11 3l2 2`,...jm})]})}function iie(){return(0,H.jsx)(`svg`,{...Am,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M8 2s4.5 4.2 4.5 7a4.5 4.5 0 0 1-9 0C3.5 6.2 8 2 8 2Z`,...jm})})}function Pm(){return(0,H.jsxs)(`svg`,{...Am,"aria-hidden":!0,children:[(0,H.jsx)(`line`,{x1:`2.5`,y1:`5`,x2:`13.5`,y2:`5`,...jm}),(0,H.jsx)(`line`,{x1:`2.5`,y1:`8`,x2:`13.5`,y2:`8`,...jm}),(0,H.jsx)(`line`,{x1:`2.5`,y1:`11`,x2:`13.5`,y2:`11`,...jm})]})}function Fm(){return(0,H.jsxs)(`svg`,{...Am,"aria-hidden":!0,children:[(0,H.jsx)(`line`,{x1:`2.5`,y1:`4`,x2:`13.5`,y2:`4`,...jm}),(0,H.jsx)(`line`,{x1:`5.5`,y1:`8`,x2:`13.5`,y2:`8`,...jm}),(0,H.jsx)(`line`,{x1:`5.5`,y1:`12`,x2:`13.5`,y2:`12`,...jm})]})}function aie(){return(0,H.jsxs)(`svg`,{...Am,"aria-hidden":!0,children:[(0,H.jsx)(`rect`,{x:`3.5`,y:`7`,width:`9`,height:`6`,rx:`1.2`,...jm}),(0,H.jsx)(`path`,{d:`M5.75 7V5.25a2.25 2.25 0 0 1 4.5 0V7`,...jm})]})}function oie(){return(0,H.jsxs)(`svg`,{...Am,"aria-hidden":!0,children:[(0,H.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4`,...jm}),(0,H.jsx)(`line`,{x1:`10.2`,y1:`10.2`,x2:`13.5`,y2:`13.5`,...jm})]})}var sie={filters:(0,H.jsx)(Mm,{}),sorts:(0,H.jsx)(Nm,{}),groupBy:(0,H.jsx)(Fm,{}),visible:(0,H.jsx)(nm,{}),order:(0,H.jsx)(rie,{}),rowHeightMode:(0,H.jsx)(Pm,{})};function cie({views:e,lockedKey:t,onApply:n,onClose:r}){let[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(()=>new Set([`filters`])),c=e.find(e=>e.id===i),l=e=>s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,H.jsxs)(`div`,{className:`cg-pop-body cg-copycfg`,children:[(0,H.jsxs)(`div`,{className:`cg-copycfg-head`,children:[(0,H.jsx)(`span`,{children:`Copy configuration from`}),(0,H.jsx)(sm,{className:`cg-copycfg-source`,ariaLabel:`View to copy from`,placeholder:`Choose a view…`,value:i||void 0,onChange:a,fields:e.map(e=>({key:e.id,label:e.name,icon:(0,H.jsx)(Qp,{mode:xd(e)})}))}),(0,H.jsx)(`span`,{children:`to this view`})]}),(0,H.jsx)(`div`,{className:`cg-pop-note`,children:`Select what to copy. This view keeps everything else.`}),(0,H.jsx)(`div`,{className:`cg-pop-list`,children:zp.map(e=>(0,H.jsxs)(`label`,{className:`cg-check-row`,title:e.blurb,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:o.has(e.key),onChange:()=>l(e.key)}),(0,H.jsx)(`span`,{className:`cg-mi-ic`,"aria-hidden":!0,children:sie[e.key]}),(0,H.jsx)(`span`,{className:`cg-check-label`,children:e.label})]},e.key))}),(0,H.jsxs)(`div`,{className:`cg-pop-footer cg-copycfg-bulk`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>s(new Set(Bp)),children:`Select all`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>s(new Set),children:`Clear all`})]}),(0,H.jsxs)(`div`,{className:`cg-form-actions cg-copycfg-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!c||o.size===0,title:c?o.size===0?`Choose at least one thing to copy`:void 0:`Choose the view to copy from`,onClick:()=>{c&&(n(kre(c.config,o,t)),r())},children:`Copy configuration`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:r,children:`Cancel`})]})]})}function lie({views:e,lockedKey:t,onApply:n}){let[r,i]=(0,z.useState)(!1),a=(0,z.useRef)(null);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{ref:a,type:`button`,className:`cg-link-btn cg-copy-link`+(r?` is-on`:``),"aria-expanded":r,onClick:()=>i(e=>!e),children:`Copy from another view`}),r&&a.current&&(0,H.jsx)(Yp,{anchor:a.current,className:`cg-pop cg-copycfg-pop`,placement:`bottom-end`,onDismiss:()=>i(!1),role:`dialog`,ariaLabel:`Copy configuration from another view`,dataKind:`copy-config`,children:(0,H.jsx)(cie,{views:e,lockedKey:t,onApply:n,onClose:()=>i(!1)})})]})}function uie({fields:e,fieldByKey:t,sorts:n,onSorts:r}){let i=(e,t)=>r(n.map((n,r)=>r===e?{...n,...t}:n)),a=e=>r(n.filter((t,n)=>n!==e));return(0,H.jsxs)(`div`,{className:`cg-pop-body cg-builder`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Sort`}),n.length===0&&(0,H.jsx)(`div`,{className:`cg-builder-empty`,children:`No sorts. Add one to order the list.`}),n.map((n,r)=>{let o=t.get(n.colId)?.type??`text`;return(0,H.jsxs)(`div`,{className:`cg-cond-line`,children:[(0,H.jsx)(`span`,{className:`cg-cond-prefix`,children:r===0?`Sort by`:`then by`}),(0,H.jsxs)(`span`,{className:`cg-cond-row`,children:[(0,H.jsx)(sm,{className:`cg-cond-field`,ariaLabel:`Sort field`,value:n.colId,onChange:e=>i(r,{colId:e}),fields:e.map(e=>({key:e.key,label:e.label,type:e.type}))}),(0,H.jsxs)(`select`,{className:`cg-select cg-cond-op`,value:n.dir,"aria-label":`Sort direction`,onChange:e=>i(r,{dir:e.target.value}),children:[(0,H.jsx)(`option`,{value:`asc`,children:ad(o,`asc`)}),(0,H.jsx)(`option`,{value:`desc`,children:ad(o,`desc`)})]}),(0,H.jsx)(`button`,{type:`button`,className:`cg-cond-x`,"aria-label":`Remove sort`,onClick:()=>a(r),children:`×`})]})]},r)}),(0,H.jsxs)(`div`,{className:`cg-pop-footer cg-builder-footer`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>{let t=new Set(n.map(e=>e.colId)),i=e.find(e=>!t.has(e.key))??e[0];i&&r([...n,{colId:i.key,dir:`asc`}])},children:`+ Add another sort`}),n.length>0&&(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>r([]),children:`Clear`})]})]})}var die=[{mode:`short`,label:`Short`},{mode:`medium`,label:`Medium`},{mode:`tall`,label:`Tall`}];function fie({fields:e,visible:t,nouns:n=`customers`,lockedKey:r,onColumnVisible:i,onColumnsVisible:a,orderedFields:o,onFieldOrder:s,deletableKeys:c,onDeleteField:l,colorOn:u,onToggleColor:d,rowHeightMode:f,onRowHeightMode:p,filters:m,onFilters:h,filterConj:g,onFilterConj:_,sorts:v,onSorts:y,groupBy:b,onGroupBy:x,statusValues:S,measures:C=[],pendingMeasureCount:w=0,unresolvedCount:T=0,lists:E=[],cohortLock:D,copyViews:O,onCopyConfig:k,search:A,onSearch:j,recordCount:M,scopeCounts:N,pool:P,serverWindowed:F=!1,cohortAction:ee,filterSeed:I=null,modeControl:te}){let L=e.filter(e=>t.has(e.key)).length,ne=(0,z.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.key,n);return t},[e]),re=(0,z.useMemo)(()=>{let e=new Map;for(let t of C)e.set(t.key,t);return e},[C]),ie=o??e,ae=(0,z.useMemo)(()=>new Set(ie.filter(e=>!t.has(e.key)).map(e=>e.key)),[ie,t]),oe=(0,z.useMemo)(()=>({conj:g,nodes:m}),[g,m]),se=e=>{let t=gd(e),n=_d(e);t!==m&&h(t),n!==g&&_(n)},ce=!!D,le=!!k&&(O?.length??0)>0,ue=(0,z.useMemo)(()=>e.filter(e=>Iee(e,r)),[e,r]),de=(0,z.useRef)(0);(0,z.useEffect)(()=>{if(!I||I.n===de.current)return;if(de.current=I.n,I.measure){let e=re.get(I.measure.key);if(!e)return;h([...m,{id:Cm(),colId:e.key,op:gm[0],value:``,window:I.measure.window}]);return}let e=I.key?ne.get(I.key):void 0;!e||e.filterable===!1||h([...m,{colId:e.key,op:pm(e.type)[0],value:``}])},[I,ne,re,m,h]);let fe=(0,z.useMemo)(()=>Tm(m),[m]),pe=(0,z.useMemo)(()=>{let e=t=>t.some(t=>hd(t)?e(t.children):t.rhs!=null&&t.rhs.kind!==`stat`);return e(m)},[m]),me=fe?`Filter · ${fe}`:`Filter`,he=v.length?`Sort · ${v.length}`:`Sort`,ge=b?`Group: ${ne.get(b)?.label??`?`}`:`Group`;return(0,H.jsxs)(`div`,{className:`cg-toolbar`,children:[te,(0,H.jsx)(km,{label:`Hide fields`,icon:(0,H.jsx)(nm,{}),active:L(0,H.jsx)(Om,{fields:ie,hidden:ae,onToggle:e=>i(e,!t.has(e)),onShowAll:()=>a(e.map(e=>e.key)),onHideAll:()=>a([r]),lockedKey:r,onFieldOrder:s,deletableKeys:c,onDeleteField:l})}),(0,H.jsx)(km,{label:me,icon:(0,H.jsx)(Mm,{}),active:fe>0,tone:`filter`,wide:!0,measureWide:C.length>0,pairWide:pe,forceOpenSignal:I?.n,children:()=>(0,H.jsx)(Dm,{fields:e,measures:C,cohorts:E,filters:oe,onChange:se,statusValues:S,cohortLock:D,footerExtra:le?(0,H.jsx)(lie,{views:O,lockedKey:r,onApply:e=>k(e)}):void 0})}),(0,H.jsx)(km,{label:he,icon:(0,H.jsx)(Nm,{}),active:v.length>0,tone:`sort`,wide:!0,children:()=>(0,H.jsx)(uie,{fields:e,fieldByKey:ne,sorts:v,onSorts:y})}),(0,H.jsx)(km,{label:ge,icon:(0,H.jsx)(Fm,{}),active:b!==null,tone:`group`,children:()=>(0,H.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Group by`}),F?(0,H.jsx)(`div`,{className:`cg-pop-note`,children:`Not available on this table. It loads one page at a time, so a group would count only the rows currently fetched.`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`cg-group`,checked:b===null,onChange:()=>x(null)}),(0,H.jsx)(`span`,{children:`No grouping`})]}),ue.map(e=>(0,H.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`cg-group`,checked:b===e.key,onChange:()=>x(e.key)}),(0,H.jsx)(Zp,{type:e.type,title:Af[e.type]}),(0,H.jsx)(`span`,{children:e.label})]},e.key))]})]})}),(0,H.jsx)(`span`,{className:`cg-tb-divider`,"aria-hidden":!0}),(0,H.jsx)(km,{label:`Color`,icon:(0,H.jsx)(iie,{}),active:u,children:()=>(0,H.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Color`}),(0,H.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`cg-color`,checked:!u,onChange:()=>d(!1)}),(0,H.jsx)(`span`,{children:`No color`})]}),(0,H.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`cg-color`,checked:u,onChange:()=>d(!0)}),(0,H.jsx)(`span`,{children:`Color by status`})]})]})}),(0,H.jsx)(km,{label:`Rows`,icon:(0,H.jsx)(Pm,{}),active:f!==`short`,children:()=>(0,H.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Row height`}),die.map(e=>(0,H.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`cg-rowh`,checked:f===e.mode,onChange:()=>p(e.mode)}),(0,H.jsx)(`span`,{children:e.label})]},e.mode))]})}),ce&&(0,H.jsxs)(`span`,{className:`cg-tb-lock`,title:(D?.name?`Locked to ${D.name}. `:`Locked to a set of records you cannot see. `)+`Only the records locked into that view are shown. Filters and sort narrow WITHIN the lock; the lock itself is changed from the view menu in the rail.`,children:[(0,H.jsx)(aie,{}),(0,H.jsx)(`span`,{className:`cg-tb-label`,children:`Locked`})]}),(0,H.jsxs)(`div`,{className:`cg-search`,children:[(0,H.jsx)(`span`,{className:`cg-search-icon`,"aria-hidden":!0,children:(0,H.jsx)(oie,{})}),(0,H.jsx)(`input`,{type:`text`,className:`cg-search-input`,placeholder:`Search ${n}…`,value:A,onChange:e=>j(e.target.value)}),A&&(0,H.jsx)(`button`,{type:`button`,className:`cg-search-clear`,"aria-label":`Clear search`,onClick:()=>j(``),children:`×`})]}),ee,(0,H.jsx)(`span`,{className:`cg-tb-spacer`}),w>0&&(0,H.jsx)(`span`,{className:`cg-count cg-count-pending`,title:`${w} measure condition${w===1?``:`s`} still being calculated over the period you chose. Rows are hidden until the answer arrives rather than shown under a count that would be wrong.`,children:`Calculating…`}),T>0&&(0,H.jsx)(`span`,{className:`cg-count cg-count-pending`,title:`${T} condition${T===1?``:`s`} cannot be evaluated — a date that does not resolve, or a list this view refers to that no longer exists. Rows are hidden rather than shown under a count that would be wrong.`,children:`Filter unresolved`}),lm(P)==null?(0,H.jsxs)(`span`,{className:`cg-count`,title:cm(M,N),children:[(0,H.jsx)(`span`,{className:`cg-count-full`,children:cm(M,N)}),(0,H.jsx)(`span`,{className:`cg-count-compact`,children:zre(M,N)})]}):(0,H.jsxs)(`span`,{className:`cg-count cg-count-partial`,title:`Loading the rest of your ${n} in the background — you can browse, filter and sort what is already here.`,children:[(0,H.jsx)(`span`,{className:`lp-spin`,role:`status`,"aria-label":`Loading`}),lm(P)]})]})}function Im({on:e}){return(0,H.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 20 20`,"aria-hidden":!0,children:(0,H.jsx)(`polygon`,{points:`10,1.8 12.5,7.2 18.4,7.7 13.9,11.6 15.3,17.4 10,14.3 4.7,17.4 6.1,11.6 1.6,7.7 7.5,7.2`,fill:e?`#A98A3E`:`none`,stroke:e?`#A98A3E`:`rgba(118,143,182,0.55)`,strokeWidth:`1.2`,strokeLinejoin:`round`})})}function pie({value:e,max:t}){return(0,H.jsx)(`span`,{className:`cg-stars cg-stars--static`,"aria-label":`${e} of ${t}`,children:Array.from({length:t},(t,n)=>(0,H.jsx)(Im,{on:n=0?n.splice(r,1):n.push(t),_ie(n)}function Bm(e,t,n){let r=e.type===`user`?t??[]:Qu(e),i=r.map(e=>({value:e,label:e})),a=e.type===`multiselect`?zm(n):[Lm(n).trim()];for(let e of a)e===``||r.includes(e)||i.push({value:e,label:`${e} (no longer a choice)`,stale:!0});return i}function Vm(e){let t=Lm(e).trim();if(t===``)return``;let n=Number(t);return Number.isFinite(n)?String(n):``}function yie(e){let t=e.trim();if(t===``)return``;let n=Number(t);return Number.isFinite(n)?t:null}function Hm(e,t){let n=Math.round(Number(Lm(t)));return Number.isFinite(n)?Math.max(0,Math.min($u(e),n)):0}function bie(e,t,n){let r=Hm(e,t),i=Math.max(1,Math.min($u(e),Math.round(n)));return i===r?``:String(i)}function xie(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length?t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase():`?`}var Sie=new Set([`sum`,`count`]);function Cie(e){return Sie.has(e)}var Um=`month`;function Wm(e){let t=ed.includes(e.bucket??``)?e.bucket:Um,n=e.span??{},r;return r=typeof n.lastN==`number`&&Number.isFinite(n.lastN)?{lastN:Math.max(1,Math.min(120,Math.round(n.lastN)))}:n.from||n.to?{from:n.from,to:n.to}:{lastN:12},{pids:e.pids,bucket:t,span:r,fields:e.fields.slice(0,12)}}function Gm(e,t){return e==null||t==null||t===0||!Number.isFinite(e)||!Number.isFinite(t)?null:(e-t)/Math.abs(t)*100}function Km(e){return e.toLocaleString(void 0,{maximumFractionDigits:2})}function wie(e,t){return e==null?`—`:t?t(e):String(e)}function qm(e){return e==null?``:Km(e)}function Jm(e,t){return e==null?``:t?Ym(e):`${e>0?`+`:``}${Km(e)}`}function Ym(e){return e==null?`—`:`${e>0?`+`:``}${e.toFixed(1)}%`}function Tie(e){switch(e){case`not_a_measure_field`:return`not a measure — only measure fields have a time dimension`;case`unresolvable`:return`a composite measure has no single aggregate to bucket`;case`window_fixed`:return`its period is a fixed date range, so it cannot slide across buckets`;default:return e}}function Xm(e){if(!e)return{columns:[],rows:[],notes:[],pool:0,empty:!0};let t=e.columns??[],n=(e.rows??[]).map(e=>{let n=e.values??[],r=t.map((e,t)=>({value:n[t]??null,delta:Gm(n[t]??null,t>0?n[t-1]??null:null),partial:e.partial===!0})),i=Cie(e.agg)&&typeof e.total==`number`&&Number.isFinite(e.total)?e.total:void 0;return{field:e.field,label:e.label,agg:e.agg,cells:r,total:i,allUnanswered:r.length>0&&r.every(e=>e.value==null),window:e.window}}),r=[],i=e.meta??{pool:0};for(let e of i.dropped??[])r.push(`${e.field} is not shown — ${Tie(e.reason)}.`);for(let e of i.problems??[])r.push(e);let a=t.filter(e=>e.partial).length;a>0&&r.push(a===1?`The last column is a partial period — it is still filling.`:`${a} columns are partial periods — they are still filling.`);let o=n.filter(e=>e.allUnanswered).length;return o>0&&r.push(`${o} of ${n.length} metrics returned no values for this span (shown as "—").`),{columns:t,rows:n,notes:r,pool:i.pool??0,empty:n.length===0}}var Eie=new Set([`currency`,`int`,`pct`]),Die=/(^|_)days(_|$)/;function Oie(e){return e.agg===`sum`||e.agg===`count`?`sum`:e.agg===`avg`||e.type===`pct`||Die.test(e.key)?`avg`:`sum`}function Zm(e){return e.measure&&typeof e.measure==`object`?`server`:Eie.has(e.type)?`snapshot`:`refused`}function kie(e){return e.formula?`a formula column has no time dimension of its own`:`${e.type} is not a number, so it has nothing to plot over time`}function Aie(e,t,n,r){let i=Oie(e),a=0,o=0;for(let n of t){let t=n?.[e.key];if(t==null||t===``)continue;let r=typeof t==`number`?t:Number(t);Number.isFinite(r)&&(a+=r,o+=1)}let s=o===0?null:i===`avg`?a/o:a,c=n.map(e=>({value:s,delta:null,partial:e.partial===!0}));return{field:e.key,label:e.label,agg:`snapshot`,cells:c,total:void 0,allUnanswered:s==null,window:{kind:`snapshot`,label:r?`Snapshot · the current value as of ${r}, not per period`:`Snapshot · the current value, not per period`}}}function jie(e,t){return`${e.length===1?e[0]:`${e.length} rows`} ${e.length===1?`has`:`have`} no time dimension, so ${e.length===1?`it is`:`they are`} shown as the current value${t?` as of ${t}`:``} repeated across every period — a flat line here means "not measured over time", not "unchanged". No total and no comparison is offered for ${e.length===1?`it`:`them`}.`}function Mie(e){let t=[],n=0;for(;nt[n],i=e=>{let t=r();return t&&t.k===`op`&&t.v===e?(n+=1,!0):!1};function a(){let e=r();if(!e)return null;if(e.k===`num`)return n+=1,{t:`num`,v:e.v};if(e.k===`ref`)return n+=1,{t:`ref`,name:e.name};if(i(`(`)){let e=c();return!e||!i(`)`)?null:e}return null}function o(){if(i(`-`)){let e=o();return e?{t:`neg`,a:e}:null}return i(`+`)?o():a()}function s(){let e=o();if(!e)return null;for(;;){let t=r();if(!t||t.k!==`op`||t.v!==`*`&&t.v!==`/`)return e;n+=1;let i=o();if(!i)return null;e={t:`bin`,op:t.v,a:e,b:i}}}function c(){let e=s();if(!e)return null;for(;;){let t=r();if(!t||t.k!==`op`||t.v!==`+`&&t.v!==`-`)return e;n+=1;let i=s();if(!i)return null;e={t:`bin`,op:t.v,a:e,b:i}}}let l=c();return l&&n===t.length?l:null}function Pie(e,t){let n,r=e=>{switch(e.t){case`num`:return e.v;case`ref`:{let r=t(e.name);return r===void 0?(n??=`unknown_ref`,null):r}case`neg`:{let t=r(e.a);return t==null?null:-t}case`bin`:{let t=r(e.a),i=r(e.b);if(t==null||i==null)return null;if(e.op===`+`)return t+i;if(e.op===`-`)return t-i;if(e.op===`*`)return t*i;if(i===0)return n??=`div_zero`,null;let a=t/i;return Number.isFinite(a)?a:null}}},i=r(e);return n?{value:null,error:n}:{value:i}}function Fie(e,t){switch(t){case`syntax`:return`${e}: that formula could not be read — use + - * / ( ) with numbers and [row] references.`;case`unknown_ref`:return`${e}: a row it refers to is not on this sheet, so it is left blank rather than treated as zero.`;case`cycle`:return`${e}: it refers back to itself, so it has no value.`;case`div_zero`:return`${e}: divided by zero in at least one period — those cells are blank, not zero.`}}var Qm={week:52,month:12,quarter:4,year:1},$m={abs:`Change`,pct:`Change %`,yoy:`vs last year`,ytd:`YTD growth`};function Iie(e){return e!==`abs`}function eh(e,t,n){let r=e.cells.map(e=>e.value),i=Qm[n]??12,a=[];for(let n of t){let t=Iie(n),o,s;n===`abs`?s=r.map((e,t)=>t===0||e==null||r[t-1]==null?null:e-r[t-1]):n===`pct`?s=r.map((e,t)=>Gm(e,t>0?r[t-1]:null)):n===`yoy`||e.window?.kind===`ytd`?(s=r.map((e,t)=>Gm(e,t>=i?r[t-i]:null)),r.length<=i&&(o=`This span is shorter than a year, so there is no earlier period to compare against.`)):(s=r.map(()=>null),o=e.window==null?`Year-to-date growth needs the metric's own period, which this server did not report.`:`Year-to-date growth is only meaningful on a year-to-date metric — this one is "${e.window.label}".`),a.push({kind:n,label:$m[n],percent:t,values:s,refusal:o})}return a}function Lie(e,t){let n=Qm[t]??12,r={value:null,delta:null,partial:!1},i=e.cells.map((t,i)=>i>=n?e.cells[i-n]:r),a=e.cells.length<=n?`This span is shorter than a year, so there is no earlier period to compare against.`:void 0;return{label:`${e.label} (last year)`,cells:a?[]:i,back:n,refusal:a}}function th(e,t,n){if(!e)return{};let r=e[t],i=n?e[`${t}:${n}`]:void 0;return!r&&!i?{}:{...r,...i}}function Rie(e,t,n){let r=e.filter(e=>e!=null&&Number.isFinite(e));if(r.length<2)return[];let i=Math.min(...r),a=Math.max(...r)-i,o=e.length>1?t/(e.length-1):0,s=[],c=[];return e.forEach((e,t)=>{if(e==null||!Number.isFinite(e)){c.length>1&&s.push({points:c}),c=[];return}let r=a===0?n/2:n-(e-i)/a*n;c.push({x:t*o,y:r})}),c.length>1&&s.push({points:c}),s}function zie(e){return e.points.map(e=>`${Math.round(e.x*10)/10},${Math.round(e.y*10)/10}`).join(` `)}function nh(e){return e.trim().toLowerCase()}function Bie(e,t){let n=[...e.notes],r=t.deltas??[],i=(t.customRows??[]).filter(e=>e&&typeof e.id==`string`),a=new Map,o=new Map;e.rows.forEach((e,t)=>{a.has(e.field)||a.set(e.field,{kind:`metric`,index:t});let n=nh(e.label);n&&!o.has(n)&&o.set(n,{kind:`metric`,index:t})}),i.forEach((e,t)=>{if(e.kind!==`formula`)return;a.has(e.id)||a.set(e.id,{kind:`formula`,index:t});let n=nh(e.label);n&&!o.has(n)&&o.set(n,{kind:`formula`,index:t})});let s=i.map(e=>e.kind===`formula`?Nie(e.expr??``):null),c=new Map,l=new Map,u=(t,n)=>{let r=c.get(t);if(r)return r;let i=e.columns.length;if(n.has(t))return l.set(t,`cycle`),Array(i).fill(null);let d=s[t];if(!d){l.set(t,`syntax`);let e=Array(i).fill(null);return c.set(t,e),e}n.add(t);let f=[];for(let r=0;r{let i=a.get(t.trim())??o.get(nh(t));if(i)return i.kind===`metric`?e.rows[i.index]?.cells[r]?.value??null:u(i.index,n)[r]??null});i.error&&!l.has(t)&&l.set(t,i.error),f.push(i.value)}return n.delete(t),c.set(t,f),f},d=e.rows.map(e=>({id:e.field,kind:`metric`,label:e.label,sublabel:e.window?.label,agg:e.agg,cells:e.cells,total:e.total,deltas:e.agg===`snapshot`?[]:eh(e,r,t.bucket),allUnanswered:e.allUnanswered})),f=e.rows.filter(e=>e.agg===`snapshot`);f.length>0&&n.push(jie(f.map(e=>e.label),t.today)),i.forEach((i,a)=>{if(i.kind===`note`){d.push({id:i.id,kind:`note`,label:i.label,cells:e.columns.map(e=>({value:null,delta:null,partial:e.partial===!0})),deltas:[],allUnanswered:!1});return}let o=u(a,new Set),s=e.columns.map((e,t)=>({value:o[t]??null,delta:Gm(o[t]??null,t>0?o[t-1]??null:null),partial:e.partial===!0})),c=l.get(a);c&&n.push(Fie(i.label||i.id,c)),d.push({id:i.id,kind:`formula`,label:i.label,expr:i.expr,cells:s,deltas:eh({cells:s,window:void 0},r,t.bucket),allUnanswered:s.length>0&&s.every(e=>e.value==null)})});let p=new Set;for(let e of d)for(let t of e.deltas)t.refusal&&p.add(t.refusal);for(let e of p)n.push(e);return{columns:e.columns,rows:d,notes:n,pool:e.pool,empty:d.length===0}}function rh(e,t){let n=e.cells.map((e,n)=>({cell:e,col:t[n]})).filter(e=>e.col&&e.cell.value!=null).map(t=>({key:t.col.key,label:t.col.label,value:t.cell.value,n:1,seriesKey:e.field,seriesLabel:e.label}));return{points:n,xOrder:t.map(e=>e.key),seriesOrder:[e.field],omitted:0,omittedValue:0,omittedSeries:0,omittedSeriesValue:0,blanks:e.cells.filter(e=>e.value==null).length,missingY:0,rows:n.length,nonPositive:0,nonPositiveValue:0}}function Vie(e,t,n,r){let i=Lie(e,n),a=Math.max(1,Math.min(Math.round(r),t.length)),o=t.length-a,s=t.slice(o),c=`${e.field}::prior_year`,l=(e,t,n)=>s.map((t,n)=>({col:t,cell:e[o+n]})).filter(e=>e.cell&&e.cell.value!=null).map(e=>({key:e.col.key,label:e.col.label,value:e.cell.value,n:1,seriesKey:t,seriesLabel:n})),u=l(e.cells,e.field,e.label),d=i.refusal?[]:l(i.cells,c,i.label);return{points:[...u,...d],xOrder:s.map(e=>e.key),seriesOrder:i.refusal?[e.field]:[e.field,c],omitted:0,omittedValue:0,omittedSeries:0,omittedSeriesValue:0,blanks:e.cells.slice(o).filter(e=>e.value==null).length,missingY:0,rows:u.length,nonPositive:0,nonPositiveValue:0}}function ih(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function Hie(e){let t=[[`Metric`,...e.columns.map(e=>e.label),`Total`].map(ih).join(`,`)];for(let n of e.rows){t.push([ih(n.sublabel?`${n.label} (${n.sublabel})`:n.label),...n.cells.map(e=>ih(qm(e.value))),ih(qm(n.total??null))].join(`,`));for(let e of n.deltas)t.push([ih(`${n.label} — ${e.label}${e.percent?` (%)`:``}`),...e.values.map(t=>ih(Jm(t,e.percent))),``].join(`,`))}if(e.notes.length>0){t.push(``);for(let n of e.notes)t.push(ih(n))}return t.join(`\r +`)){let e=r.trim();if(!e)continue;let i=e.toLowerCase();t.has(i)||(t.add(i),n.push(e))}return n.slice(0,50)}function Zu(e,t,n=120){let r=Math.max(1,Math.floor(n)),i=e=>e.trim().replace(/\s+/g,` `),a=(i(e)||`Untitled`).slice(0,r).trimEnd(),o=new Set(t.map(e=>i(e).toLocaleLowerCase()));if(!o.has(a.toLocaleLowerCase()))return a;for(let e=2;;e+=1){let t=` ${e}`,n=a.slice(0,Math.max(0,r-t.length)).trimEnd(),i=n?`${n}${t}`:String(e).slice(-r);if(!o.has(i.toLocaleLowerCase()))return i}}function _ee(e){return e.filter(e=>e.filterable!==!1)}function Qu(e){return Array.isArray(e.options)?e.options:[]}function vee(e){return typeof e.formula==`string`&&e.formula.trim()!==``?e.formula:void 0}function $u(e){let t=typeof e.max==`number`&&Number.isFinite(e.max)?Math.round(e.max):5;return Math.max(2,Math.min(10,t))}var yee=[`grid`,`chart`,`dashboard`,`list`,`calendar`,`kanban`,`map`,`timeseries`,`catalog`],bee={dashboard:`chart`};function xee(e){return bee[e]??e}var ed=[`week`,`month`,`quarter`,`year`],See=[`letter`,`a4`,`tabloid`],Cee=[`portrait`,`landscape`],wee=[`web`,`print`],Tee=[`cover`,`intro`,`section`,`gallery`],Eee=[2,3,4],Dee=2e3,Oee=/^#[0-9A-Fa-f]{6}$/,td=[`abs`,`pct`,`yoy`,`ytd`],kee=[`note`,`formula`],Aee=/^[A-Za-z0-9_ .+\-*/()[\]]*$/;function jee(e){let t=e.bucket===void 0||ed.includes(e.bucket),n=e.span,r;if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n.lastN;if(typeof e==`number`&&Number.isFinite(e)){let t=Math.round(e);t>=1&&t<=120&&(r={lastN:t})}}let i=e.span===void 0?r===void 0:!!r&&r.lastN===n?.lastN;if(t&&i)return e;let a={...e};return t||delete a.bucket,i||(r?a.span=r:delete a.span),a}function Mee(e,t){if(!e||typeof e!=`object`||Array.isArray(e))return null;let n=e,r=typeof n.id==`string`?n.id.slice(0,40):``;if(!r||typeof n.kind!=`string`||!Tee.includes(n.kind))return null;let i={id:r,kind:n.kind};for(let[e,t]of[[`title`,120],[`body`,Dee],[`imageCode`,60]]){let r=n[e];typeof r==`string`&&r&&(i[e]=r.slice(0,t))}if(Array.isArray(n.products)&&t>0){let e=[],r=new Set;for(let i of n.products){if(typeof i!=`string`||!i)continue;let n=i.slice(0,60);if(!r.has(n)&&(r.add(n),e.push(n),e.length>=t))break}e.length&&(i.products=e)}if(n.layout&&typeof n.layout==`object`&&!Array.isArray(n.layout)){let e=n.layout,t={};typeof e.cols==`number`&&Number.isInteger(e.cols)&&Eee.includes(e.cols)&&(t.cols=e.cols),e.showPack===!1&&(t.showPack=!1),e.showColor===!1&&(t.showColor=!1),e.showPrice===!0&&(t.showPrice=!0),(t.cols!==void 0||t.showPack!==void 0||t.showColor!==void 0||t.showPrice!==void 0)&&(i.layout=t)}return{page:i,spent:i.products?.length??0}}function Nee(e){if(!Array.isArray(e))return;let t=[];for(let n of e){if(t.length>=12)break;if(!n||typeof n!=`object`||Array.isArray(n))continue;let e=n,r=typeof e.id==`string`?e.id.slice(0,40):``;if(!r||typeof e.name!=`string`)continue;let i={id:r,name:e.name.slice(0,80),paper:See.includes(e.paper)?e.paper:`letter`,orientation:Cee.includes(e.orientation)?e.orientation:`portrait`,pages:[]};if(wee.includes(e.quality)&&(i.quality=e.quality),e.brand&&typeof e.brand==`object`&&!Array.isArray(e.brand)){let t=e.brand,n={};for(let e of[`primary`,`accent`])typeof t[e]==`string`&&Oee.test(t[e])&&(n[e]=t[e]);typeof t.company==`string`&&t.company&&(n.company=t.company.slice(0,80)),typeof t.logo==`string`&&t.logo&&(n.logo=t.logo.slice(0,60)),Object.keys(n).length&&(i.brand=n)}if(e.fields&&typeof e.fields==`object`&&!Array.isArray(e.fields)){let t=e.fields,n={};for(let e of[`name`,`pack`,`color`,`price`])typeof t[e]==`string`&&t[e]&&(n[e]=t[e]);Object.keys(n).length&&(i.fields=n)}let a=500;if(Array.isArray(e.pages))for(let t of e.pages){if(i.pages.length>=40)break;let e=Mee(t,a);e&&(a-=e.spent,i.pages.push(e.page))}t.push(i)}return t.length?t:void 0}function nd(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e;if(typeof t.mode!=`string`||!yee.includes(t.mode))return;let n={mode:xee(t.mode)};for(let e of[`dateField`,`stackField`,`titleField`,`colorField`,`sizeField`]){let r=t[e];typeof r==`string`&&r!==``&&(n[e]=r)}if(Array.isArray(t.charts)){let e=t.charts.filter(e=>!!e&&typeof e==`object`&&typeof e.id==`string`).map(jee);e.length&&(n.charts=e.slice(0,12))}if(t.kanbanClamp===!1&&(n.kanbanClamp=!1),(t.calendarMode===`records`||t.calendarMode===`summary`)&&(n.calendarMode=t.calendarMode),Array.isArray(t.calendarMetrics)){let e=[];for(let n of t.calendarMetrics){if(!n||typeof n!=`object`)continue;let t=n;typeof t.id!=`string`||!t.id||typeof t.field!=`string`||!t.field||typeof t.agg!=`string`||!t.agg||e.push({id:t.id,field:t.field,agg:t.agg})}e.length&&(n.calendarMetrics=e.slice(0,4))}if(ed.includes(t.tsBucket)&&(n.tsBucket=t.tsBucket),t.tsSpan&&typeof t.tsSpan==`object`&&!Array.isArray(t.tsSpan)){let e=t.tsSpan,r={};if(typeof e.from==`string`&&e.from&&(r.from=e.from),typeof e.to==`string`&&e.to&&(r.to=e.to),typeof e.lastN==`number`&&Number.isFinite(e.lastN)){let t=Math.round(e.lastN);t>=1&&t<=120&&(r.lastN=t)}(r.from||r.to||r.lastN!=null)&&(n.tsSpan=r)}if(Array.isArray(t.tsFields)){let e=t.tsFields.filter(e=>typeof e==`string`&&e!==``);e.length&&(n.tsFields=e.slice(0,12))}if(Array.isArray(t.tsDeltas)){let e=new Set,r=[];for(let n of t.tsDeltas)typeof n!=`string`||!td.includes(n)||e.has(n)||(e.add(n),r.push(n));r.length&&(n.tsDeltas=r.slice(0,td.length))}if(t.tsGridlines===!1&&(n.tsGridlines=!1),t.tsSparkline===!0&&(n.tsSparkline=!0),Array.isArray(t.tsRows)){let e=[],r=new Set;for(let n of t.tsRows){if(!n||typeof n!=`object`)continue;let t=n;if(typeof t.id!=`string`||!t.id||t.id.length>40||r.has(t.id)||typeof t.kind!=`string`||!kee.includes(t.kind)||typeof t.label!=`string`||t.label.length>120)continue;r.add(t.id);let i={id:t.id,kind:t.kind,label:t.label};i.kind===`formula`&&typeof t.expr==`string`&&t.expr.length<=200&&Aee.test(t.expr)&&(i.expr=t.expr),e.push(i)}e.length&&(n.tsRows=e.slice(0,12))}if(t.tsStyles&&typeof t.tsStyles==`object`&&!Array.isArray(t.tsStyles)){let e={},r=0;for(let[n,i]of Object.entries(t.tsStyles)){if(r>=200)break;if(!n||!i||typeof i!=`object`||Array.isArray(i))continue;let t=i,a={};t.bold===!0&&(a.bold=!0),t.line===!0&&(a.line=!0),!(!a.bold&&!a.line)&&(e[n]=a,r+=1)}r&&(n.tsStyles=e)}let r=Nee(t.catalogs);if(r&&(n.catalogs=r),!(n.mode===`grid`&&!n.dateField&&!n.stackField&&!n.titleField&&!n.colorField&&!n.sizeField&&!n.charts&&n.kanbanClamp===void 0&&!n.calendarMode&&!n.calendarMetrics&&!n.tsBucket&&!n.tsSpan&&!n.tsFields&&!n.tsDeltas&&n.tsGridlines===void 0&&n.tsSparkline===void 0&&!n.tsRows&&!n.tsStyles&&!n.catalogs))return n}function Pee(e){if(typeof e!=`number`||!Number.isFinite(e))return;let t=Math.round(e);if(!(t<=1))return Math.min(8,t)}function Fee(e,t){if(e.source!==`overlay`||hee.has(e.type))return!1;let n=e.permissions?.edit??`everyone`;return n===`everyone`?!0:t?t.isAdmin?!0:n===`creator`&&e.createdBy===t.name:!1}function rd(e){return e===`currency`||e===`int`||e===`pct`||e===`rating`||e===`formula`}function id(e){return e===`date`||e===`created_time`}function ad(e,t){return rd(e)?t===`asc`?`1 → 9`:`9 → 1`:id(e)?t===`asc`?`Oldest → Newest`:`Newest → Oldest`:t===`asc`?`A → Z`:`Z → A`}function Iee(e,t){return e.type===`status`||e.type===`select`||e.type===`multiselect`||e.type===`checkbox`||e.type===`text`&&e.source!==`overlay`&&e.key!==t}var Lee=[`topN`,`bottomN`,`inTopPct`,`inBottomPct`,`aboveAvg`,`belowAvg`,`inQuartile`,`inDecile`];function od(e){return Lee.includes(e)}var Ree=[`contains`,`doesNotContain`,`eq`,`neq`,`isEmpty`,`isNotEmpty`,`gt`,`gte`,`lt`,`lte`,`between`,`within`,`topN`,`bottomN`,`inTopPct`,`inBottomPct`,`aboveAvg`,`belowAvg`,`inQuartile`,`inDecile`],sd=new Set([`isEmpty`,`isNotEmpty`,`aboveAvg`,`belowAvg`]),cd=`__cohort__`;function zee(e){return!hd(e)&&e.colId===`__cohort__`}var Bee=[`anyOf`,`allOf`,`noneOf`],Vee={eq:`anyOf`,neq:`noneOf`};function ld(e){return Bee.includes(e)?e:Vee[e]??`anyOf`}function ud(e){let t=[];for(let n of String(e??``).split(`,`)){let e=n.trim();if(!(e===``||t.includes(e))&&(t.push(e),t.length>=20))break}return t}var dd=[`avg`,`median`,`p10`,`p25`,`p75`,`p90`],Hee={avg:`the average`,median:`the median`,p10:`the bottom 10%`,p25:`the bottom quartile`,p75:`the top quartile`,p90:`the top 10%`};function fd(e){return e&&e.kind!==`stat`?e.colId:void 0}function Uee(e){return e?e.kind===`stat`?dd.includes(e.stat):e.colId?e.kind===`measure`?Gu(e.window)!=null:e.kind===`field`:!1:!1}function pd(e){return e.colId===`__cohort__`?ud(e.value).length>0:sd.has(e.op)?!0:e.op===`within`?Gu(e.dateWindow)!=null:e.rhs?Uee(e.rhs):e.dateMode&&fee.has(e.dateMode)?!0:e.op===`between`?e.value!==``&&e.value2!=null&&e.value2!==``:e.value!==``}var Wee=[`gte`,`gt`,`lte`,`lt`,`eq`,`neq`],Gee=[`gte`,`gt`,`lte`,`lt`];function md(e){return!hd(e)&&e.window!=null}function hd(e){return e!=null&&Array.isArray(e.children)}function gd(e){return Array.isArray(e?.nodes)?e.nodes:[]}function _d(e){return e?.conj===`or`?`or`:`and`}var Kee=new Set([`all-customers`]),qee={key:`customer_data`,scope:`customer`,rowsPath:`customers`,noun:`customer`,nouns:`customers`,measures:!0},Jee={key:`product_data`,scope:`product`,rowsPath:`products`,noun:`product`,nouns:`products`,measures:!1},vd=new Map;function Yee(e){let t=vd.get(e);return t||(t={key:e,scope:e,rowsPath:`tables/${e}/rows`,noun:`record`,nouns:`records`,measures:!1},vd.set(e,t)),t}function yd(e){return e.startsWith(`ut_`)?Yee(e):e===`product`?Jee:qee}function bd(e){return Kee.has(e.id)}function xd(e){return e.config?.display?.mode??`grid`}function Sd(e){return e.kind===`system`||bd(e)?!1:!!e.locked}function Cd(e,t){return t?t.isAdmin?!0:!!e.createdBy&&e.createdBy===t.name:!1}var wd=[`personal`,`collaborative`,`users`],Xee={personal:`Personal`,collaborative:`Collaborative`,users:`Specific users`},Zee={personal:`Only you can change this view.`,collaborative:`Anyone who can see this table can change it.`,users:`Only the people you pick can change it.`};function Qee(e,t,n){let r=e&&typeof e==`object`&&!Array.isArray(e)?e:{},i=wd.includes(r.edit)?r.edit:t;if(i!==`users`)return{edit:i};let a=new Set,o=[];for(let e of(Array.isArray(r.users)?r.users:[]).slice(0,50)){let t=String(e??``).trim();!t||a.has(t.toLowerCase())||n&&!n.includes(t)||(a.add(t.toLowerCase()),o.push(t))}return o.length?{edit:`users`,users:o}:{edit:`personal`}}function $ee(e){return e.permissions?.edit??`collaborative`}function Td(e,t){let n=$ee(e);return n===`collaborative`||!e.createdBy?!0:t?t.isAdmin||e.createdBy&&e.createdBy===t.name?!0:n===`users`&&(e.permissions?.users??[]).includes(t.name):!1}var Ed=[`folder`,`star`,`flag`,`tag`,`bookmark`,`grid`,`chart`,`map`,`users`,`clock`,`heart`,`bolt`],Dd=[`neutral`,`blue`,`green`,`yellow`,`red`],Od=`folder`,kd=`neutral`;function ete(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e;if(!Ed.includes(t.shape))return;let n=t.shape,r=Dd.includes(t.tone)?t.tone:kd;if(!(n===`folder`&&r===`neutral`))return{shape:n,tone:r}}var Ad=5*1024*1024;function tte(e){return e?.windowed?`server-windowed`:`whole-book`}var jd=`/api/v1`,Md=`same-origin`,Nd=`aios:unauthorized`,Pd=`aios:data-error`,Fd=`aios:toast`,Id=`aios:derived-cells`,Ld=`aios:workspace-stale`,Rd=`aios:nav-minimize`,zd=`aios:rows-stale`;function Bd(e,t){typeof window>`u`||window.dispatchEvent(new CustomEvent(e,{detail:t}))}var nte=`streamlit:componentReady`,rte=`streamlit:render`,ite=`streamlit:setComponentValue`,ate=`streamlit:setFrameHeight`,Vd=`aios:grid-host-render`;function Hd(e,t){window.parent.postMessage({isStreamlitMessage:!0,type:e,...t},`*`)}function Ud(){return typeof window>`u`||window.parent===window?!1:new URLSearchParams(window.location.search).has(`streamlitUrl`)}function ote(){Ud()&&(window.addEventListener(`message`,e=>{let t=e.data;if(!t||t.type!==rte)return;window.__AIOS_STREAMLIT_ARGS__=t.args??{},window.dispatchEvent(new CustomEvent(Vd));let n=Number(t.args?.height??760);Hd(ate,{height:Number.isFinite(n)?n:760})}),Hd(nte,{apiVersion:1}))}function ste(){return window.__AIOS_STREAMLIT_ARGS__??null}function cte(e){return window.addEventListener(Vd,e),()=>window.removeEventListener(Vd,e)}var Wd=[],Gd=null;function lte(e){Gd=e}function Kd(e){return Ud()?(Wd.push(e),Wd.length>24&&Wd.shift(),Hd(ite,{value:{events:[...Wd]},dataType:`json`}),!0):Gd?Gd(e):!1}function qd(e){return`${e}:${typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}`}var Jd={"Content-Type":`application/json`};async function Yd(e){try{return await e.json()}catch{return null}}function Xd(e){return e===401?(Zd.clear(),Bd(Nd),!0):!1}var ute=5*6e4,Zd=new Map;function Qd(){Zd.clear()}async function dte(e){let t=Zd.get(e.rowsPath);if(t&&Date.now()-t.ate.pid===t);n&&Object.assign(n,e)}}return r.ok}catch{return!1}}async function ef(e,t=rf){try{let n=await fetch(`${jd}/grid/timeseries?scope=${encodeURIComponent(t)}`,{method:`POST`,credentials:Md,headers:Jd,body:JSON.stringify(e)});if(Xd(n.status)||!n.ok)return{payload:null,status:n.status};let r=await Yd(n);return!r||!Array.isArray(r.columns)||!Array.isArray(r.rows)?{payload:null,status:n.status}:{payload:r,status:n.status}}catch{return{payload:null,status:0}}}async function pte(e,t=rf){try{let n=await fetch(`${jd}/grid/calendar_metrics?scope=${encodeURIComponent(t)}`,{method:`POST`,credentials:Md,headers:Jd,body:JSON.stringify(e)});if(Xd(n.status)||!n.ok)return{payload:null,status:n.status};let r=await Yd(n);return!r||!r.values||typeof r.values!=`object`?{payload:null,status:n.status}:{payload:r,status:n.status}}catch{return{payload:null,status:0}}}var tf=[],nf=!1,rf=`customer`;function mte(e){rf=e}async function hte(){if(nf||tf.length===0)return;nf=!0;let e=tf;tf=[];let t=!1;try{let n=await fetch(`${jd}/grid/events`,{method:`POST`,credentials:Md,headers:Jd,body:JSON.stringify({events:e,scopeKey:rf})});Xd(n.status)||(n.ok?gte(await Yd(n)):t=!0)}catch{t=!0}finally{nf=!1,t?tf=[...e,...tf].slice(-24):tf.length&&hte()}}function gte(e){let t=e,n=t?.toast;typeof n==`string`&&n.trim()!==``&&Bd(Fd,n.trim()),t?.derived&&typeof t.derived==`object`&&!Array.isArray(t.derived)&&Bd(Id,t.derived);let r=Array.isArray(t?.results)?t.results:[];(t?.rerender===!0||r.some(e=>e?.rerender===!0))&&Bd(Ld)}function _te(e){return tf.push(e),tf.length>24&&tf.shift(),hte(),!0}function vte(){lte(_te)}function yte(e){return JSON.stringify([e.config?.filters??[],e.config?.filterConj===`or`?`or`:`and`])}function bte(e,t,n){let r=yte(e);return r===yte(t)||r===n?null:r}function af(e,t){for(let n of e??[]){if(hd(n)){af(n.children,t);continue}let e=n;md(n)&&e.id&&t.set(e.id,e)}}function xte(e,t,n,r){if(!t||n==null||r-n>12e4)return e;let i=e,a=t.config?t.config.display:void 0;if(t.config&&JSON.stringify(a??null)!==JSON.stringify(e.config?.display??null)){let t={...e.config};a===void 0?delete t.display:t.display=a,i={...e,config:t}}let o=t.config?t.config.cohortLock:void 0;if(t.config&&o!==i.config?.cohortLock){let e={...i.config};o===void 0?delete e.cohortLock:e.cohortLock=o,i={...i,config:e}}let s=t.config?t.config.filters:void 0;if(!Array.isArray(s)||s.length===0)return i;let c=new Map;if(af(s,c),c.size===0)return i;let l=new Map;af(e.config?e.config.filters:void 0,l);let u=!1;for(let[e,t]of c){if(!pd(t))continue;let n=l.get(e);if(!n||!pd(n)){u=!0;break}}return u?{...i,config:{...i.config,filters:s,filterConj:t.config.filterConj??e.config.filterConj}}:i}function of(e,t){let n=e=>{let n={};for(let[r,i]of Object.entries(e??{}))typeof i==`number`&&t-i<=12e4&&(n[r]=i);return n};return{edited:n(e?.edited),deleted:n(e?.deleted)}}function sf(e){if(Array.isArray(e))return e.map(sf);if(e&&typeof e==`object`){let t={};for(let n of Object.keys(e).sort()){let r=e[n];r!==void 0&&(t[n]=sf(r))}return t}return e}function Ste(e){let{createdBy:t,permissions:n,editRequestId:r,labelCorrectedFrom:i,labelCorrectionId:a,...o}=e;return JSON.stringify(sf(o))}function Cte(e,t,n,r,i){let a=e=>typeof e==`number`&&r-e<=12e4,o=new Map(t.map(e=>[e.key,e])),s=[];for(let t of e){let e=o.get(t.key);if(o.delete(t.key),!a(n?.deleted?.[t.key])){if(!e){s.push(t);continue}if(!i){s.push({...e,...t,note:t.note??e.note});continue}if(t.labelCorrectedFrom===e.label&&t.label!==e.label&&typeof t.labelCorrectionId==`string`&&t.labelCorrectionId===e.editRequestId){s.push(t);continue}if(a(n?.edited?.[t.key])&&Ste(e)!==Ste(t)){s.push({...e,...t.createdBy==null?{}:{createdBy:t.createdBy}});continue}s.push(t.note==null&&e.note!=null?{...t,note:e.note}:t)}}for(let e of o.values())if(e.custom&&!a(n?.deleted?.[e.key])){if(e.source===`overlay`){s.push(e);continue}(!i||a(n?.edited?.[e.key]))&&s.push(e)}return s}function wte(e,t){let n=e.filter(e=>!(e.pid===t.pid&&e.key===t.key));return n.push(t),n.slice(-64)}function Tte(e,t,n){let r=[],i={};for(let a of e){if(a==null||typeof a.pid!=`number`||typeof a.key!=`string`||typeof a.at!=`number`)continue;let e=t(a.pid),o=e?e[a.key]:void 0;String(o??``)!==String(a.value??``)&&(n-a.at>12e4||(r.push(a),i[a.pid]={...i[a.pid],[a.key]:a.value}))}return{keep:r,seeds:i}}function cf(){if(typeof window>`u`)return null;let e=window.__AIOS_GRID__;return e&&Array.isArray(e.rows)&&Array.isArray(e.fields)?e:null}function Ete(){let e=ste()?.payload;return e&&Array.isArray(e.rows)&&Array.isArray(e.fields)?e:null}function Dte(e,t){let n={...e,workspace:t};Array.isArray(t.fields)&&t.fields.length>0&&JSON.stringify(t.fields)!==JSON.stringify(e.fields)&&(n.fields=t.fields),Array.isArray(t.measures)&&(n.measures=t.measures),t.measureSets&&typeof t.measureSets==`object`&&(n.measureSets=t.measureSets),t.viewer&&typeof t.viewer.name==`string`&&(n.viewer=t.viewer),Array.isArray(t.userOptions)&&(n.userOptions=t.userOptions);let r=t.derived;return r&&typeof r==`object`&&Object.keys(r).length>0&&(n.rows=e.rows.map(e=>{let t=r[String(e.pid)];return t?{...e,...t}:e})),n}function Ote(){return Ete()??cf()}var lf=Ud(),kte=cf()!==null;function Ate(e){return`aios-grid-cells:${e}`}function jte(e){try{let t=localStorage.getItem(Ate(e)),n=t?JSON.parse(t):null;return Array.isArray(n)?n:[]}catch{return[]}}function Mte(e,t){try{localStorage.setItem(Ate(e),JSON.stringify(t))}catch{}}function Nte(e){let t=e?.workspace?.storageKey;if(!e||!t)return{};let n=new Map(e.rows.map(e=>[e.pid,e])),{keep:r,seeds:i}=Tte(jte(t),e=>n.get(e),Date.now());return Mte(t,r),i}function Pte(e=`customer`){mte(e);let t=yd(e),[n,r]=(0,z.useState)(()=>Ote()),[i,a]=(0,z.useState)(()=>lf?Nte(Ote()):{}),o=(0,z.useRef)(n);o.current=n;let[s,c]=(0,z.useState)(0);(0,z.useEffect)(()=>{if(lf)return;let e=()=>c(e=>e+1);return window.addEventListener(zd,e),()=>window.removeEventListener(zd,e)},[]),(0,z.useEffect)(()=>{if(lf){let e=()=>{let e=Ete();if(!e)return;let t=Nte(e);Object.keys(t).length&&a(e=>{let n={...e};for(let[e,r]of Object.entries(t))n[Number(e)]={...r,...n[Number(e)]};return n}),r(e)};return e(),cte(e)}if(cf())return;let n=!1;async function i(){let[i,a]=await Promise.all([dte(t),$d(e)]);n||!i||r(a?Dte(i,a):i)}i();async function o(){let t=await $d(e);n||!t||r(e=>e&&Dte(e,t))}let s=e=>{let t=e.detail;!t||typeof t!=`object`||r(e=>{if(!e)return e;let n=!1,r=e.rows.map(e=>{let r=t[String(e.pid)];if(!r||typeof r!=`object`)return e;let i={};for(let[e,t]of Object.entries(r))(t===null||typeof t==`string`||typeof t==`number`)&&(i[e]=t);return Object.keys(i).length===0?e:(n=!0,{...e,...i})});return n?{...e,rows:r}:e})},c=()=>{o()};return typeof window<`u`&&(window.addEventListener(Ld,c),window.addEventListener(Id,s)),()=>{n=!0,typeof window<`u`&&(window.removeEventListener(Ld,c),window.removeEventListener(Id,s))}},[e,t,s]);let l=(0,z.useCallback)((e,n)=>{let r;if(a(t=>(r=t[e],{...t,[e]:{...t[e],...n}})),lf){let t=o.current?.workspace?.storageKey;if(t){let r=jte(t),i=Date.now();for(let[t,a]of Object.entries(n))r=wte(r,{pid:e,key:t,value:a??null,at:i});Mte(t,r)}Kd({id:qd(`overlay`),type:`overlay_patch`,pid:e,updates:n});return}kte||fte(t,e,n).then(t=>{t||(console.warn(`customer-grid: overlay PATCH failed for pid ${e}; rolling back`),a(t=>{let n={...t};return r===void 0?delete n[e]:n[e]=r,n}))})},[t]);return{fields:n?.fields??[],rawRows:n?.rows??[],payload:n,loading:n===null,overlayEdits:i,setOverlayEdits:a,patchOverlay:l}}var uf=`#202433`,df=`#6B7280`,ff=`#E6E9EF`,Fte=`#FFFFFF`,Ite=`#FAFBFC`,Lte=`#9DBFF2`,pf=`#EDF3FD`,Rte=`#F5D989`,mf=`#FBF4E0`,zte=`#F0A8A0`,Bte=`#FCEEEC`,Vte=`#A5D8B4`,hf=`#EBF6EF`,gf=`#F1EEFB`,Hte=`#6B57A8`,Ute=`#768FB6`,Wte=`#4F6079`,_f=`#7E6428`,vf=`#A3453C`,yf=`#35754E`,bf={accentColor:Ute,accentLight:pf,textDark:uf,textMedium:df,textLight:`#8B92A0`,textHeader:uf,bgCell:Fte,bgHeader:Ite,bgHeaderHovered:`#F1F3F6`,bgHeaderHasFocus:pf,borderColor:ff,horizontalBorderColor:ff,fgIconHeader:df,bgIconHeader:ff,fontFamily:`Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif`,baseFontStyle:`13px`,headerFontStyle:`600 13px`},Gte={growing:{bgBubble:hf,textBubble:yf},new:{bgBubble:pf,textBubble:Wte},declining:{bgBubble:mf,textBubble:_f},dormant:{bgBubble:ff,textBubble:uf},lost:{bgBubble:Bte,textBubble:vf},reactivated:{bgBubble:Vte,textBubble:uf}},Kte={growing:{bgCell:`rgba(165, 216, 180, 0.40)`},new:{bgCell:`rgba(157, 191, 242, 0.38)`},declining:{bgCell:`rgba(245, 217, 137, 0.42)`},dormant:{bgCell:`rgba(107, 114, 128, 0.13)`},lost:{bgCell:`rgba(240, 168, 160, 0.38)`},reactivated:{bgCell:`rgba(165, 216, 180, 0.72)`}},qte={growing:{bgCell:`rgba(165, 216, 180, 0.62)`},new:{bgCell:`rgba(157, 191, 242, 0.60)`},declining:{bgCell:`rgba(245, 217, 137, 0.64)`},dormant:{bgCell:`rgba(107, 114, 128, 0.22)`},lost:{bgCell:`rgba(240, 168, 160, 0.60)`},reactivated:{bgCell:`rgba(165, 216, 180, 0.92)`}},Jte={bgCell:`rgba(32, 36, 51, 0.06)`},Yte=Jte,Xte=Jte,xf=`700 13px`;function Sf(e,t){let n=parseInt(e.slice(1),16);return`rgba(${n>>16&255}, ${n>>8&255}, ${n&255}, ${t})`}var Zte={filter:{bgHeader:hf,bgHeaderHovered:hf,bgHeaderHasFocus:hf,bgCell:Sf(yf,.06),headerFontStyle:xf},sort:{bgHeader:mf,bgHeaderHovered:mf,bgHeaderHasFocus:mf,bgCell:Sf(_f,.06),headerFontStyle:xf},group:{bgHeader:gf,bgHeaderHovered:gf,bgHeaderHasFocus:gf,bgCell:Sf(Hte,.06),headerFontStyle:xf}},Qte=df,Cf=(e,t,n)=>`M${e-n} ${t}a${n} ${n} 0 1 0 ${n*2} 0a${n} ${n} 0 1 0 ${-n*2} 0`,$te=[{d:`M3.2 4.6h9.6v8.2H3.2z`},{d:`M3.2 7.2h9.6`},{d:`M5.8 3v3.2`},{d:`M10.2 3v3.2`}],wf={text:[{d:`M3 5h10M3 8h10M3 11h6`}],status:[{d:`M4 13V3.5h7.6L10.1 6l1.5 2.5H4`}],currency:[{d:`M8 2.8v10.4`},{d:`M10.6 5.4A2.6 2.6 0 0 0 8.2 4.2H7.4a2 2 0 0 0 0 4h1.2a2 2 0 0 1 0 4H7.8a2.6 2.6 0 0 1-2.4-1.4`}],int:[{d:`M6.2 3L4.8 13M11.2 3l-1.4 10M3.4 6.2h9.2M2.9 9.8h9.2`}],date:$te,pct:[{d:Cf(4.6,4.6,1.6)},{d:Cf(11.4,11.4,1.6)},{d:`M12.2 3.9L3.8 12.3`}],select:[{d:`M3.2 3.8h9.6v8.4H3.2z`},{d:`M6.2 7.2l1.8 1.8 1.8-1.8`}],user:[{d:Cf(8,6,2.4)},{d:`M3.6 13c0-2.4 2-3.8 4.4-3.8s4.4 1.4 4.4 3.8`}],multiselect:[{d:`M3 4.6h2.2v2.2H3zM3 9.2h2.2v2.2H3z`},{d:`M7.2 5.7h6M7.2 10.3h6`}],checkbox:[{d:`M3.4 3.4h9.2v9.2H3.4z`},{d:`M5.8 8.1l1.8 1.9 3.4-3.9`}],phone:[{d:`M5.1 3.2L7 5.1 5.6 7a7.2 7.2 0 0 0 3.4 3.4l1.9-1.4 1.9 1.9-1.5 1.6c-3 .5-8.3-4.8-7.8-7.8z`}],email:[{d:`M3 4.4h10v7.2H3z`},{d:`M3 4.9l5 3.9 5-3.9`}],url:[{d:`M7 5.4L8.4 4a2.6 2.6 0 0 1 3.7 3.7L10.7 9`},{d:`M9 10.6L7.6 12a2.6 2.6 0 0 1-3.7-3.7L5.3 7`},{d:`M6.2 9.8l3.6-3.6`}],rating:[{d:`M8 2.9l1.63 3.3 3.64.53-2.63 2.57.62 3.63L8 11.24 4.74 12.93l.62-3.63L2.73 6.73l3.64-.53z`,fill:!0}],created_time:[{d:Cf(8,8,5.2)},{d:`M8 4.9v3.4l2.3 1.4`}],formula:[{d:`M5.6 12.8V5.4a2 2 0 0 1 3.2-1.6`},{d:`M4.2 7.6h4.6`},{d:`M10.2 8.4l3 3.4M13.2 8.4l-3 3.4`}],automation:[{d:`M10.8 4.1A4.8 4.8 0 1 1 5.3 4.1`},{d:`M4.2 6L5.3 4.1 3.1 4.5`},{d:`M6.9 6.1L9.8 8 6.9 9.9z`,fill:!0}],image:[{d:`M2.6 3.4h10.8v9.2H2.6z`},{d:Cf(6,6.3,1.1)},{d:`M2.6 10.6L6.1 7.6l2.5 2.1 2.2-1.8 2.6 2.2`}]},Tf={grid:[{d:`M2.6 3.4h10.8v9.2H2.6z`},{d:`M2.6 6.5h10.8M2.6 9.5h10.8M6.4 3.4v9.2M10 3.4v9.2`}],list:[{d:`M3 4.6h1.4M6.4 4.6h6.6M3 8h1.4M6.4 8h6.6M3 11.4h1.4M6.4 11.4h6.6`}],chart:[{d:`M2.6 3.4h10.8v9.2H2.6z`},{d:`M5.4 10.6V7.2M8 10.6V5.4M10.6 10.6V8.6`}],dashboard:[{d:`M2.6 3.4h10.8v9.2H2.6z`},{d:`M5.4 10.6V7.2M8 10.6V5.4M10.6 10.6V8.6`}],calendar:$te,kanban:[{d:`M2.8 3.4h3.1v9.2H2.8zM6.5 3.4h3.1v6.2H6.5zM10.2 3.4h3.1v7.6h-3.1z`}],map:[{d:`M8 2.6a3.6 3.6 0 0 1 3.6 3.6c0 2.7-3.6 7.2-3.6 7.2S4.4 8.9 4.4 6.2A3.6 3.6 0 0 1 8 2.6z`},{d:Cf(8,6.1,1.3)}],timeseries:[{d:`M2.6 3.4h10.8v9.2H2.6z`},{d:`M2.6 6.6h10.8M6.2 3.4v9.2`},{d:`M7.2 10.8l2-2.4 1.6 1.2 1.8-2.6`}],catalog:[{d:`M2.4 4.2h4.6a1.6 1.6 0 0 1 1 .4l0 8a1.6 1.6 0 0 0-1-.4H2.4z`},{d:`M13.6 4.2H9a1.6 1.6 0 0 0-1 .4l0 8a1.6 1.6 0 0 1 1-.4h4.6z`},{d:`M3.9 6.4h2.3v2.8H3.9z`}]},ene={bar:[{d:`M3.2 12.8V7.4M6.4 12.8V4.2M9.6 12.8V8.8M12.8 12.8V5.8`}],line:[{d:`M2.6 11.2l3.2-3.4 2.6 2 4.9-5.2`},{d:Cf(5.8,7.8,.9)},{d:Cf(8.4,9.8,.9)}],area:[{d:`M2.6 12.4V9.2l3.2-3.2 2.6 2 4.9-4.6v9z`},{d:`M2.6 9.2l3.2-3.2 2.6 2 4.9-4.6`}],donut:[{d:Cf(8,8,5)},{d:Cf(8,8,2.1)}],kpi:[{d:`M2.6 3.8h10.8v8.4H2.6z`},{d:`M5.4 9.6V6.4l1.9 3.2V6.4M9.4 6.4v3.2h1.8`}],table:[{d:`M2.6 3.4h10.8v9.2H2.6z`},{d:`M2.6 6.2h10.8M7.2 6.2v6.4M2.6 9.4h10.8`}]},tne={bar:`blue`,line:`green`,area:`green`,donut:`yellow`,kpi:`neutral`,table:`neutral`},nne={folder:[{d:`M2.4 12.6V4.2a.6.6 0 0 1 .6-.6h3.2l1.5 1.7h5.3a.6.6 0 0 1 .6.6v6.7a.6.6 0 0 1-.6.6H3a.6.6 0 0 1-.6-.6z`}],star:[{d:`M8 2.9l1.63 3.3 3.64.53-2.63 2.57.62 3.63L8 11.24 4.74 12.93l.62-3.63L2.73 6.73l3.64-.53z`}],flag:[{d:`M4.2 13.4V2.9`},{d:`M4.2 3.4h7.6l-1.5 2.6 1.5 2.6H4.2z`}],tag:[{d:`M2.9 8.2V3.5a.6.6 0 0 1 .6-.6h4.7l5 5-5.3 5.3z`},{d:Cf(5.6,5.6,1)}],bookmark:[{d:`M4.4 2.9h7.2v10.4L8 10.7l-3.6 2.6z`}],grid:Tf.grid,chart:Tf.dashboard,map:Tf.map,users:wf.user,clock:wf.created_time,heart:[{d:`M8 13.1S2.7 9.8 2.7 6.4a2.9 2.9 0 0 1 5.3-1.6 2.9 2.9 0 0 1 5.3 1.6c0 3.4-5.3 6.7-5.3 6.7z`}],bolt:[{d:`M9.1 2.4L4.2 9.1h3.3l-.6 4.5 4.9-6.7H8.5z`}]},Ef={neutral:{fill:ff,stroke:df},blue:{fill:Lte,stroke:Ute},green:{fill:Vte,stroke:yf},yellow:{fill:Rte,stroke:_f},red:{fill:zte,stroke:vf}},Df={neutral:`Neutral`,blue:`Blue`,green:`Green`,yellow:`Yellow`,red:`Red`},Of={folder:`Folder`,star:`Star`,flag:`Flag`,tag:`Tag`,bookmark:`Bookmark`,grid:`Table`,chart:`Chart`,map:`Map`,users:`People`,clock:`Clock`,heart:`Heart`,bolt:`Priority`},kf={grid:`Grid`,chart:`Chart`,dashboard:`Chart`,list:`List`,calendar:`Calendar`,kanban:`Kanban`,map:`Map`,timeseries:`Time series`,catalog:`Catalog`},rne=[`grid`,`chart`,`calendar`,`kanban`,`timeseries`,`map`,`list`,`catalog`],ine={grid:`blue`,list:`blue`,chart:`green`,dashboard:`green`,calendar:`yellow`,kanban:`yellow`,map:`red`,timeseries:`green`,catalog:`neutral`},Af={text:`Single line text`,select:`Single select`,multiselect:`Multi select`,user:`Assignee`,int:`Number`,currency:`Currency`,pct:`Percent`,date:`Date`,checkbox:`Checkbox`,phone:`Phone number`,email:`Email`,url:`URL`,rating:`Rating`,created_time:`Created time`,formula:`Formula`,automation:`Automation`,image:`Image`,status:`Lifecycle status (Odoo)`};function ane(e,t){return e.fill?``:``}function one(e){return({fgColor:t})=>``+e.map(e=>ane(e,t)).join(``)+``}function sne(e){return`t_${e}`}var cne={...Object.fromEntries(Object.keys(wf).map(e=>[sne(e),one(wf[e])])),aiosInfo:()=>``};function lne(e,t,n){return e&&t>Math.max(0,n-16)?e:null}function une(e,t,n,r=8){let i=Math.min(n,280);return Math.round(Math.max(r,Math.min(e,t-r-i)))}var dne=`600 13px`;function fne(e,t,n,r,i){let a=t=>`${e} ${t} (${n})`,o=a(t);if(r==null||r<=0||i(o)<=r)return o;let s=r-i(a(``));return s<=0?o:a(gne(t,s,i))}function pne(e,t,n,r=4){if(n.length===0)return null;let i=[],a=e.x+e.width-t-r;for(let t of n){let n=a-t;if(n-e.x<68)return null;i.push({x:Math.round(n),y:Math.round(e.y+(e.height-t)/2),size:t}),a=n-6}return i}function mne(e,t){let n=[];return e&&n.push(16),t&&n.push(6),n}function hne(e,t,n=30){let r=pne({x:0,y:0,width:e,height:32},n,t===!0?[16]:t===!1?[]:t);return r?Math.max(0,r[r.length-1].x-32-6):null}function gne(e,t,n){if(t==null||!e||n(e)<=t)return e;let r=n(`…`);if(r>t)return e;let i=0,a=e.length;for(;it.x+t.width||at.y+t.height)?null:{x:i,y:a,size:n}}function vne(e){let{placement:t,target:n,panel:r,viewport:i}=e,a=i.left+8,o=i.left+i.width-8,s=i.top+8,c=i.top+i.height-8,l=Math.max(1,o-a),u=Math.min(r.width,l),d=r.height,f,p,m,h;if(t===`right-start`){let e=Math.max(0,o-(n.right+6)),t=Math.max(0,n.left-6-a),r=u<=e||e>=t;h=r?`right`:`left`;let i=r?n.right+6:n.left-6-u;f=Math.min(Math.max(i,a),Math.max(a,o-u)),m=Math.max(1,c-s),p=Math.min(Math.max(n.top,s),Math.max(s,c-Math.min(d,m)))}else{let e=Math.max(0,c-(n.bottom+6)),r=Math.max(0,n.top-6-s),i=d<=e||e>=r;h=i?`below`:`above`,m=Math.max(1,i?e:r);let l=t===`bottom-end`?n.right-u:n.left;f=Math.min(Math.max(l,a),o-u),p=i?Math.min(n.bottom+6,c-m):Math.max(s,n.top-6-Math.min(d,m))}return{left:Math.round(f),top:Math.round(p),maxWidth:Math.floor(l),maxHeight:Math.floor(m),side:h}}var yne=150,jf={base:void 0,bold:void 0};function bne(e,t=!1){let n=t?`bold`:`base`;if(jf[n]===void 0){let e=document.createElement(`canvas`).getContext(`2d`);e&&(e.font=`${(t?`700 13px`:bf.headerFontStyle)??`600 13px`} ${bf.fontFamily??`Inter, sans-serif`}`),jf[n]=e}let r=jf[n];return r?r.measureText(e).width:0}function xne(e){return!!(e.note||e.description)}function Sne(e,t){for(let n of e??[]){if(hd(n)){Sne(n.children,t);continue}pd(n)&&t.add(n.colId)}}function Cne(e){return e?Zte[e]:void 0}function wne(e){let t=new Map;e.groupBy&&t.set(e.groupBy,`group`);for(let n of e.sorts??[])t.set(n.colId,`sort`);let n=new Set;Sne(e.filters??[],n);for(let e of n)t.set(e,`filter`);return t}function Mf(e){return e.default!==!1||e.source===`overlay`}function Nf(e){let t=e.filter(Mf).map(e=>e.key),n=e.filter(e=>!Mf(e)).map(e=>e.key);return{filters:[],filterConj:`and`,sorts:[],groupBy:null,colorBy:null,rowHeightMode:`short`,order:[...t,...n],visible:t,widths:{},memberPids:[]}}function Tne(e,t){let n=new Set(t.map(e=>e.key)),r=e.filter((t,r)=>n.has(t)&&e.indexOf(t)===r);for(let e of t)r.includes(e.key)||r.push(e.key);let i=t.find(e=>e.pinned)?.key??t[0]?.key;return i&&r[0]!==i?[i,...r.filter(e=>e!==i)]:r}function Ene(e,t,n){let r=new Set(t.map(e=>e.key)),i=new Set(e.filter(e=>r.has(e)));if(i.size===0)for(let e of t)Mf(e)&&i.add(e.key);return n&&i.add(n),i}function Dne(e,t,n){let r=(0,z.useMemo)(()=>new Map(e.map(e=>[e.key,e])),[e]),i=(0,z.useMemo)(()=>e.find(e=>e.pinned)?.key??e[0]?.key??``,[e]),a=(0,z.useMemo)(()=>Tne(t.order,e),[t.order,e]),o=(0,z.useMemo)(()=>Ene(t.visible,e,i),[t.visible,e,i]),s=(0,z.useMemo)(()=>wne(t),[t.filters,t.sorts,t.groupBy]),c=(0,z.useMemo)(()=>a.filter(e=>o.has(e)).map(e=>{let n=r.get(e),i=t.widths[e]??yne,a=s.has(e),o=mne(xne(n),n.source===`overlay`);return{id:e,title:gne(n.label,hne(i,o),e=>bne(e,a)),width:i,hasMenu:!0,menuIcon:`dots`,icon:sne(n.type),themeOverride:Cne(s.get(e))}}),[a,o,t.widths,r,s]),l=(0,z.useCallback)((e,r)=>{e.id&&n({...t,widths:{...t.widths,[e.id]:Math.round(r)}})},[t,n]),u=(0,z.useCallback)((e,r)=>{if(e===0||r===0)return;let i=a.filter(e=>o.has(e));if(e<0||e>=i.length||r<0||r>=i.length)return;let s=i.slice(),[c]=s.splice(e,1);s.splice(r,0,c);let l=0,u=a.map(e=>o.has(e)?s[l++]:e);n({...t,order:u})},[t,n,a,o]),d=(0,z.useCallback)((e,t)=>e!==0&&t!==0,[]),f=(0,z.useCallback)((e,r)=>{if(!r&&e===i)return;let a=new Set(o);r?a.add(e):a.delete(e),n({...t,visible:[...a]})},[t,i,n,o]),p=(0,z.useCallback)((e,r,i)=>{let s=a.filter(t=>t!==e);if(i===`end`||!r)s.push(e);else{let t=Math.max(0,s.indexOf(r));s.splice(t+ +(i===`right`),0,e)}let c=new Set(o);c.add(e),n({...t,order:s,visible:[...c]})},[t,n,a,o]);return{visibleCols:c,fieldByKey:r,order:a,visible:o,widths:t.widths,lockedKey:i,onColumnResize:l,onColumnMoved:u,onColumnProposeMove:d,setColumnVisible:f,insertColumn:p}}function One(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:0}function kne(e,t){let n={};for(let r of t){if(r.agg!==`sum`)continue;let t=0;for(let n of e)t+=One(n[r.key]);let i=Math.round(t*100)/100;n[r.key]=r.type===`currency`?`$`+i.toLocaleString():i.toLocaleString()}return n}var Pf={sets:new Map,unanswerable:0};function Ane(e){return e===`currency`||e===`int`||e===`pct`||e===`rating`||e===`formula`}function Ff(e){return!hd(e)&&!md(e)&&od(e.op)}function If(e){for(let t of e??[]){if(hd(t)){if(If(t.children))return!0;continue}if(Ff(t))return!0}return!1}function Lf(e){let t=[];for(let n of e??[]){if(hd(n)){let e=Lf(n.children);e.length&&t.push({conj:n.conj,children:e});continue}Ff(n)||t.push(n)}return t}function Rf(e){let t=[];for(let n of e??[]){if(hd(n)){t.push(...Rf(n.children));continue}if(!Ff(n))continue;let e=n;pd(e)&&t.push(e)}return t}function jne(e,t,n){let r=[];for(let n of e){let e=n[t];if(e==null||e===``)continue;let i=typeof e==`number`?e:Number(e);Number.isFinite(i)&&r.push({pid:n.pid,v:i})}return r.sort((e,t)=>e.v===t.v?e.pid-t.pid:n===`asc`?e.v-t.v:t.v-e.v),r}function zf(e,t,n){let r=Number(e);if(!Number.isFinite(r))return null;let i=Math.trunc(r);return i!==r||in?null:i}function Mne(e,t,n){return Math.min(n,Math.floor(e*n/t)+1)}function Bf(e,t){return Math.min(e,Math.max(1,Math.ceil(e*t/100)))}function Nne(e,t,n){let r=Rf(e);if(!r.length)return Pf;let i=new Map,a=0,o=new Map,s=(e,n)=>{let r=`${n}:${e}`,i=o.get(r);return i||(i=jne(t,e,n),o.set(r,i)),i},c=e=>{i.set(e,new Set),a+=1};for(let e of r){let r=n.get(e.colId);if(!r||!Ane(r.type)){c(e);continue}let o=s(e.colId,`asc`);if(!o.length){i.set(e,new Set),t.length&&(a+=1);continue}let l=o.length,u=null;switch(e.op){case`topN`:{let t=zf(e.value,1,1e4);u=t==null?null:s(e.colId,`desc`).slice(0,t);break}case`bottomN`:{let t=zf(e.value,1,1e4);u=t==null?null:o.slice(0,t);break}case`inTopPct`:{let t=zf(e.value,1,100);u=t==null?null:s(e.colId,`desc`).slice(0,Bf(l,t));break}case`inBottomPct`:{let t=zf(e.value,1,100);u=t==null?null:o.slice(0,Bf(l,t));break}case`aboveAvg`:case`belowAvg`:{let t=o.reduce((e,t)=>e+t.v,0)/l;u=o.filter(n=>e.op===`aboveAvg`?n.v>t:n.vMne(r,l,t)===n);break}default:u=null}if(u==null){c(e);continue}i.set(e,new Set(u.map(e=>e.pid)))}return{sets:i,unanswerable:a}}function Vf(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:0}function Hf(e){return e===`currency`||e===`int`||e===`pct`||e===`rating`||e===`formula`}function Pne(e){return e===`date`||e===`created_time`}function Fne(e,t,n){for(let r of n){if(r.type!==`text`&&r.type!==`status`)continue;let n=t[r.key];if(n!=null&&String(n).toLowerCase().includes(e))return!0}return!1}function Uf(e){return e==null||e===``}function Ine(e,t,n,r){let i=n.get(e.colId);if(!i)return!0;let a=t[e.colId];if(e.op===`isEmpty`)return Uf(a);if(e.op===`isNotEmpty`)return!Uf(a);if(od(e.op))return!1;let o=e.rhs!=null,s=o?t[fd(e.rhs)??``]:void 0;if(Hf(i.type)){let t=Vf(a);if(o)return Wf(e.op,t,Vf(s));if(e.op===`between`){if(e.value===``||e.value2==null||e.value2===``)return!0;let n=Math.min(Vf(e.value),Vf(e.value2)),r=Math.max(Vf(e.value),Vf(e.value2));return t>=n&&t<=r}return e.value===``||Wf(e.op,t,Vf(e.value))}if(Pne(i.type)){let t=String(a??``).slice(0,10);if(e.op===`within`){if(!r)return!1;let n=Ku(e.dateWindow,r);if(!n||t===``)return!1;let[i,a]=n;return(i==null||t>=i)&&(a==null||t<=a)}if(o)return Gf(e.op,t,String(s??``).slice(0,10));if(e.op===`between`){if(e.value===``||e.value2==null||e.value2===``)return!0;let n=e.value=n&&t<=r}if(!Lne.has(e.op)||!e.dateMode&&e.value===``)return!0;let n=e.dateMode||`exact`;if(n!==`exact`&&!r)return!1;let i=Ju(n,e.value,r||`1970-01-01`);return i!=null&&Gf(e.op,t,i)}let c=String(a??``).toLowerCase();return o?Kf(e.op,c,String(s??``).toLowerCase()):e.value===``||Kf(e.op,c,e.value.toLowerCase())}var Lne=new Set([`eq`,`neq`,`lt`,`lte`,`gt`,`gte`]);function Wf(e,t,n){switch(e){case`gt`:return t>n;case`gte`:return t>=n;case`lt`:return tn;case`gte`:return t>=n;default:return!0}}function Kf(e,t,n){switch(e){case`contains`:return t.includes(n);case`doesNotContain`:return!t.includes(n);case`eq`:return t===n;case`neq`:return t!==n;default:return!0}}function qf(e,t,n,r){if(hd(e)){let i=!1,a=!0,o=!1;for(let s of e.children){let e=qf(s,t,n,r);e!==null&&(i=!0,a&&=e,o||=e)}return i?e.conj===`or`?o:a:null}if(zee(e)){if(!pd(e))return null;let n=ud(e.value).map(e=>r?.cohortSets?.[e]);if(n.some(e=>!e))return!1;let i=ld(e.op);if(i===`allOf`)return n.every(e=>e.has(t.pid));let a=n.some(e=>e.has(t.pid));return i===`noneOf`?!a:a}if(md(e)){if(!pd(e))return null;let n=e.id?r?.measureSets?.[e.id]:void 0;return n?n.has(t.pid):!1}if(!n.has(e.colId)||e.rhs&&!n.has(fd(e.rhs)??``)||!pd(e))return null;if(od(e.op)){let n=r?.rankSets?.get(e);return n?n.has(t.pid):!1}return Ree.includes(e.op)?Ine(e,t,n,r?.today):!1}function Jf(e,t){let n=0;for(let r of e??[]){if(hd(r)){n+=Jf(r.children,t);continue}!md(r)||!pd(r)||(!r.id||!t?.[r.id])&&(n+=1)}return n}function Yf(e){let t=[];for(let n of e??[]){if(hd(n)){t.push(...Yf(n.children));continue}!md(n)||!pd(n)||t.push(n.id||`(no-id)`)}return t}function Xf(e,t){let n=0;for(let r of e??[]){if(hd(r)){n+=Xf(r.children,t);continue}if(pd(r)){if(zee(r)){ud(r.value).some(e=>!t?.cohortSets?.[e])&&(n+=1);continue}md(r)||(r.op===`within`?(!t?.today||!Ku(r.dateWindow,t.today))&&(n+=1):r.dateMode&&(!t?.today||Ju(r.dateMode,r.value,t.today)==null)&&(n+=1))}}return n}function Zf(e,t,n,r,i){let a=qf({conj:t,children:e},n,r,i);return a===null||a}function Rne(e,t){return(n,r)=>{for(let i of e){let e=t.get(i.colId),a=e?Hf(e.type):!1,o=n[i.colId],s=r[i.colId],c=Uf(o),l=Uf(s);if(c!==l)return c?1:-1;if(c&&l)continue;let u=a?Vf(o)-Vf(s):String(o??``).localeCompare(String(s??``));if(u!==0)return i.dir===`asc`?u:-u}return 0}}function zne(e,t,n,r){let i=[],a=new Map,o=r.some(e=>e.key===t&&(e.multi||e.type===`multiselect`)),s=r.some(e=>e.key===t&&e.type===`checkbox`),c=e=>s?e===`1`?`Checked`:`Unchecked`:e===``?`(empty)`:e;for(let n of e){let e=n[t],r=e==null?``:String(e),s=o?r.split(`,`).map(e=>e.trim()).filter(e=>e!==``):[r];for(let e of s.length?s:[``]){let t=a.get(e);t||(t=[],a.set(e,t),i.push(e)),t.push(n)}}let l=[];for(let e of i){let t=a.get(e),i=n.has(e),o=kne(t,r);if(l.push({kind:`group-header`,groupKey:e,label:c(e),count:t.length,collapsed:i,aggs:o}),!i){for(let e of t)l.push({kind:`data`,record:e});l.push({kind:`group-footer`,groupKey:e,aggs:o})}}return l}function Qf(e){let{rawRows:t,fields:n,filters:r,search:i,sorts:a,groupBy:o,collapsed:s,memberPids:c=[],filterConj:l=`and`,serverWindowed:u=!1,measureSets:d,cohortSets:f,today:p,cohortLock:m}=e,h={measureSets:d,cohortSets:f,today:p},g=0,_=e=>{let t=e.map(e=>({kind:`data`,record:e})),n=new Map;return t.forEach((e,t)=>{e.kind===`data`&&n.set(e.record.pid,t)}),{visibleRows:t,pidToIndex:n,unresolvedRank:g}};if(u)return _(t);let v=new Map;for(let e of n)v.set(e.key,e);let y=t;if(m){let e=f?.[m];if(!e)return _([]);y=y.filter(t=>e.has(t.pid))}if(r.length){if(If(r)){let e=Lf(r),t=y,n=Nne(r,e.length?t.filter(t=>Zf(e,l,t,v,h)):t,v);h.rankSets=n.sets,g=n.unanswerable}else h.rankSets=Pf.sets;let e=new Set(c);y=y.filter(t=>e.has(t.pid)||Zf(r,l,t,v,h))}let b=i.trim().toLowerCase();if(b&&(y=y.filter(e=>Fne(b,e,n))),a.length&&(y=[...y].sort(Rne(a,v))),!o)return _(y);let x=zne(y,o,s,n),S=new Map;return x.forEach((e,t)=>{e.kind===`data`&&!S.has(e.record.pid)&&S.set(e.record.pid,t)}),{visibleRows:x,pidToIndex:S,unresolvedRank:g}}function Bne(e,t,n,r,i,a,o,s=[],c=`and`,l=!1,u,d,f,p){return(0,z.useMemo)(()=>Qf({rawRows:e,fields:t,filters:n,search:r,sorts:i,groupBy:a,collapsed:o,memberPids:s,filterConj:c,serverWindowed:l,measureSets:u,cohortSets:d,today:f,cohortLock:p}),[e,t,n,c,r,i,a,o,s,l,u,d,f,p])}var $f=`code`;function Vne(e){let t=new Map;for(let n of e){let e=n[$f];typeof e==`string`&&e&&!t.has(e)&&t.set(e,n)}return t}function Hne(e){for(let[t,n]of e)if(n.type===`image`)return t}function Une(e,t,n,r,i){let a=(e,t)=>{if(!t)return;let n=i.get(t);return n&&r(n,e[t])||void 0},o=Hne(i);return e.map(e=>{let r=t.get(e);return r?{code:e,known:!0,image:Wne(r,o)||e,name:a(r,n?.name),pack:a(r,n?.pack),color:a(r,n?.color),price:a(r,n?.price)}:{code:e,image:e,known:!1}})}function ep(e){let t={},n=(t,n)=>e.find(e=>e.key!==`code`&&(t.test(e.key)||t.test(e.label))&&(!n||n.includes(e.type)))?.key;t.name=n(/^(product|name|title|description)$/i)??e.find(e=>e.key!==`code`&&e.type===`text`)?.key,t.pack=n(/pack|case|carton|inner/i),t.color=n(/colou?r/i),t.price=n(/price|msrp|list/i,[`currency`,`int`,`pct`]);for(let e of[`name`,`pack`,`color`,`price`])t[e]||delete t[e];return t}function tp(e){return e.startsWith(`ed:`)?e.slice(3).trim().toLowerCase():null}function np(e,t){let n=tp(e);if(n!==null)return`${jd}/assets/editorial/${encodeURIComponent(n)}?q=${t}`;if(e.startsWith(`rec:`)){let n=e.slice(mee.length).trim();return`${jd}/assets/records/${encodeURIComponent(n)}?q=${t}`}return`${jd}/assets/products/${encodeURIComponent(e)}?q=${t}`}function Wne(e,t){if(!e)return``;if(t){let n=e[t];if(typeof n==`string`&&n.trim())return n.trim()}let n=e[$f];return typeof n==`string`?n.trim():``}var Gne=`${jd}/assets/products`,rp=`${jd}/assets/editorial`;async function Kne(){try{let e=await fetch(Gne,{credentials:`same-origin`});if(!e.ok)return null;let t=await e.json();return Array.isArray(t.codes)?new Set(t.codes.filter(e=>typeof e==`string`)):null}catch{return null}}async function ip(){try{let e=await fetch(rp,{credentials:`same-origin`});if(!e.ok)return null;let t=await e.json();return Array.isArray(t.slugs)?new Set(t.slugs.filter(e=>typeof e==`string`).map(e=>e.toLowerCase())):null}catch{return null}}async function qne(e,t){let n=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result??``)),r.onerror=()=>n(Error(`could not read the file`)),r.readAsDataURL(t)}),r=await fetch(rp,{method:`POST`,credentials:`same-origin`,headers:{"Content-Type":`application/json`},body:JSON.stringify({slug:e,data:n})}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(i.error?.message??`upload failed (${r.status})`);return i.slug??e}var Jne=2*1024*1024,Yne=`${jd}/assets/records`;async function Xne(e){if(e.size>2097152)throw Error(`Images cap at ${Jne/(1024*1024)} MB — that one is ${(e.size/(1024*1024)).toFixed(1)} MB.`);let t=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result??``)),r.onerror=()=>n(Error(`could not read the file`)),r.readAsDataURL(e)}),n=await fetch(Yne,{method:`POST`,credentials:`same-origin`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:t})}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error(r.error?.message??`upload failed (${n.status})`);if(!r.ref)throw Error(`the server accepted the image but named no reference`);return r.ref}function Zne(e){return e.replace(/\.[A-Za-z0-9]+$/,``).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,64)}var Qne={letter:{w:8.5,h:11,unit:`in`},a4:{w:210,h:297,unit:`mm`},tabloid:{w:11,h:17,unit:`in`}},$ne={letter:`Letter · 8.5 × 11"`,a4:`A4 · 210 × 297 mm`,tabloid:`Tabloid · 11 × 17"`};function ap(e,t){let n=Qne[e];return t===`landscape`?{w:n.h,h:n.w,unit:n.unit}:{...n}}function op(e,t){return`${Number.isInteger(e)?e:e.toFixed(2).replace(/0+$/,``)}${t}`}var sp={primary:`#16233A`,accent:`#C47B5A`,company:`Royal Imports`};function cp(e){return`${e}_${typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10)}`}var ere=()=>cp(`cat`),tre=()=>cp(`pg`),lp={cover:`Cover`,intro:`Introduction`,section:`Product section`,gallery:`Full-page image`};function up(e){let t={id:tre(),kind:e};return e===`cover`&&(t.title=`Collection`),e===`intro`&&(t.title=`About us`),e===`section`&&(t.title=`New section`),t}function nre(e,t){let n=ep(t),r={id:ere(),name:e,paper:`letter`,orientation:`portrait`,brand:{...sp},pages:[up(`cover`),up(`intro`),up(`section`)]};return Object.keys(n).length&&(r.fields=n),r}function dp(e){let t=0;for(let n of e.pages)t+=n.products?.length??0;return t}function rre(e){return Math.max(0,500-dp(e))}function ire(e,t,n){let r=rre(e),i=0,a=0,o=0;return{pages:e.pages.map(e=>{if(e.id!==t)return e;let s=new Set(e.products??[]),c=[...e.products??[]];for(let e of n){let t=e.slice(0,60);if(t){if(s.has(t)){a+=1;continue}if(i>=r){o+=1;continue}s.add(t),c.push(t),i+=1}}return c.length?{...e,products:c}:e}),added:i,skippedDuplicate:a,skippedCap:o}}function fp(e){let t=e.layout;return{cols:t?.cols??3,showPack:t?.showPack!==!1,showColor:t?.showColor!==!1,showPrice:t?.showPrice===!0}}var pp=[{bg:`#EDF3FD`,fg:`#4F6079`},{bg:`#EBF6EF`,fg:`#35754E`},{bg:`#FBF4E0`,fg:`#7E6428`},{bg:`#FCEEEC`,fg:`#A3453C`},{bg:`#F1EEFB`,fg:`#6B57A8`},{bg:`#EEF1F4`,fg:`#4B5563`}];function mp(e){if(!(typeof e!=`string`||!/^#[0-9a-f]{6}$/i.test(e.trim())))return e.trim().toUpperCase()}var hp=`#182230`,gp=[{id:`blue-tint`,hue:`blue`,strength:`tint`,bg:`#EDF3FD`,fg:`#4F6079`,label:`Light blue`},{id:`green-tint`,hue:`green`,strength:`tint`,bg:`#EBF6EF`,fg:`#35754E`,label:`Light green`},{id:`yellow-tint`,hue:`yellow`,strength:`tint`,bg:`#FBF4E0`,fg:`#7E6428`,label:`Light yellow`},{id:`red-tint`,hue:`red`,strength:`tint`,bg:`#FCEEEC`,fg:`#A3453C`,label:`Light red`},{id:`purple-tint`,hue:`purple`,strength:`tint`,bg:`#F1EEFB`,fg:`#6B57A8`,label:`Light purple`},{id:`blue-pastel`,hue:`blue`,strength:`pastel`,bg:`#9DBFF2`,fg:hp,label:`Blue`},{id:`green-pastel`,hue:`green`,strength:`pastel`,bg:`#A5D8B4`,fg:hp,label:`Green`},{id:`yellow-pastel`,hue:`yellow`,strength:`pastel`,bg:`#F5D989`,fg:hp,label:`Yellow`},{id:`red-pastel`,hue:`red`,strength:`pastel`,bg:`#F0A8A0`,fg:hp,label:`Red`},{id:`purple-pastel`,hue:`purple`,strength:`pastel`,bg:`#C3B3EE`,fg:hp,label:`Purple`}];function _p(e){let t=mp(e);if(!t)return;let n=yp(t,1),r=yp(t,3),i=yp(t,5),a=gp[0],o=1/0;for(let e of gp){let t=n-yp(e.bg,1),s=r-yp(e.bg,3),c=i-yp(e.bg,5),l=(n+yp(e.bg,1))/2,u=(2+l/256)*t*t+4*s*s+(2+(255-l)/256)*c*c;u>>0;return pp[t%pp.length]}function ore(e,t){let n=e.optionColors;if(!n)return;let r=mp(n[t]);if(r)return r;let i=t.trim().toLowerCase();for(let[e,t]of Object.entries(n))if(e.trim().toLowerCase()===i)return mp(t)}function yp(e,t){return Number.parseInt(e.slice(t,t+2),16)}function bp(e){let t=e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4};return .2126*t(yp(e,1))+.7152*t(yp(e,3))+.0722*t(yp(e,5))}function sre(e){let t=bp(mp(e)??`#FFFFFF`),n=bp(`#182230`),r=bp(`#FFFFFF`);return(t+.05)/(n+.05)>=(r+.05)/(t+.05)?`#182230`:`#FFFFFF`}function xp(e,t){if(!t||e.colorCodeOptions===!1)return;let n=ore(e,t);return n?are(n):vp(t)}function Sp(e){return vp(e).bg}function Cp(e){let t=e.split(`@`)[0].trim().split(/[\s._]+/).filter(Boolean);return t.length===0?`?`:t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[1][0]).toUpperCase()}function cre(e){return Math.max(14,Math.min(22,e-6))}function lre(e,t){return{data:{kind:`aios-user`,name:e,photo:t?.[e]},copyData:e}}function wp(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:0}function Tp(e){return typeof e==`string`&&e.trim()!==``&&!Number.isFinite(Number(e))}function Ep(e){return e==null||typeof e==`string`&&e.trim()===``}function Dp(e){return e===`1`||e===1||e===!0}function Op(e,t){if(t?.abbrev&&Math.abs(e)>=1e3){let t=Math.abs(e),[n,r]=t>=1e9?[1e9,`B`]:t>=1e6?[1e6,`M`]:[1e3,`k`];return(e/n).toFixed(1)+r}let n=t&&Number.isInteger(t.decimals)&&t.decimals>=0&&t.decimals<=4?t.decimals:null,r=t?.thousands!==!1;return n==null?r?e.toLocaleString():String(e):r?e.toLocaleString(void 0,{minimumFractionDigits:n,maximumFractionDigits:n}):e.toFixed(n)}function ure(e){let t=e.includes(` `)?e.replace(` `,`T`):e,n=/T\d{2}:\d{2}/.test(t)&&!/(?:[zZ]|[+-]\d{2}:?\d{2})$/.test(t)?t+`Z`:t,r=new Date(n);return Number.isNaN(r.getTime())?null:r}function kp(e,t){if(t==null||t===``)return``;let n=String(t),r=ure(n);if(!r)return n;let i=e.format,a=i?.time??e.type===`created_time`,o=i?.tz===`utc`?{timeZone:`UTC`}:void 0;return a?r.toLocaleString(void 0,o):r.toLocaleDateString(void 0,o)}var dre=[`ok`,`partial`,`error`,`blocked`,`queued`];function Ap(e){let t=String(e??``).split(`·`)[0].trim().toLowerCase();return dre.includes(t)?t:`none`}function jp(e){let t=String(e??``).split(`·`);return t.length>1?t.slice(1).join(`·`).trim():``}function fre(e){let t=Ap(e);return t===`none`?`Not run yet`:t[0].toUpperCase()+t.slice(1)}function Mp(e,t){switch(e.type){case`currency`:return t==null||t===``?``:`$`+Op(wp(t),e.format);case`formula`:return Ep(t)?``:Tp(t)?t:Op(wp(t),e.format);case`int`:return t==null||t===``?``:Op(wp(t),e.format);case`pct`:return t==null||t===``?``:wp(t).toFixed(1)+`%`;case`date`:case`created_time`:return kp(e,t);case`checkbox`:return Dp(t)?`Checked`:``;case`rating`:{let n=wp(t);return n>=1?`${Math.round(n)} of ${$u(e)}`:``}case`automation`:return String(t??``);case`multiselect`:return String(t??``).split(`,`).map(e=>e.trim()).filter(e=>e!==``).join(`, `);default:return String(t??``)}}ot();var pre={ok:{bgCell:hf,textDark:yf},partial:{bgCell:mf,textDark:_f},blocked:{bgCell:mf,textDark:_f},error:{bgCell:Bte,textDark:vf},queued:{bgCell:pf,textDark:Wte},none:void 0};function mre(e,t,n,r,i){e.beginPath();for(let i=0;i<10;i+=1){let a=Math.PI/5*i-Math.PI/2,o=i%2==0?r:r*.45,s=t+Math.cos(a)*o,c=n+Math.sin(a)*o;i===0?e.moveTo(s,c):e.lineTo(s,c)}e.closePath(),i?(e.fillStyle=`#A98A3E`,e.fill()):(e.strokeStyle=`rgba(118, 143, 182, 0.55)`,e.lineWidth=1,e.stroke())}var Np=new Map,Pp;function Fp(e){Pp=e}function hre(e){let t=Np.get(e);if(t!==void 0)return t;if(typeof Image>`u`)return Np.set(e,null),null;let n=new Image;return Np.set(e,n),n.onload=()=>Pp?.(),n.onerror=()=>{Np.set(e,null),Pp?.()},n.src=e,n}function gre(e,t,n,r,i,a,o){let s=a?hre(a):null;if(s&&s.complete&&s.naturalWidth>0){e.save(),e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.clip();let i=Math.max(r*2/s.naturalWidth,r*2/s.naturalHeight),a=s.naturalWidth*i,o=s.naturalHeight*i;e.drawImage(s,t-a/2,n-o/2,a,o),e.restore();return}let c=vp(i);e.save(),e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.fillStyle=c.bg,e.fill(),e.fillStyle=c.fg,e.font=`600 ${Math.round(r*.9)}px ${o}`,e.textAlign=`center`,e.textBaseline=`middle`,e.fillText(Cp(i),t,n+.5),e.restore()}var _re={kind:R.Custom,isMatch:e=>e.data?.kind===`aios-user`,draw:(e,t)=>{let{ctx:n,rect:r,theme:i}=e,{name:a,photo:o}=t.data;if(!a)return!0;let s=cre(r.height),c=r.x+i.cellHorizontalPadding+s/2,l=r.y+r.height/2;return c+s/2>r.x+r.width-i.cellHorizontalPadding||gre(n,c,l,s/2,a,o,i.fontFamily),!0}},Ip=new Map;function vre(e){let t=Ip.get(e);if(t!==void 0)return t;if(typeof Image>`u`)return Ip.set(e,null),null;let n=new Image;return Ip.set(e,n),n.onload=()=>Pp?.(),n.onerror=()=>{Ip.set(e,null),Pp?.()},n.src=e,n}var yre={kind:R.Custom,isMatch:e=>e.data?.kind===`aios-image`,draw:(e,t)=>{let{ctx:n,rect:r,theme:i}=e,{url:a}=t.data,o=i.cellHorizontalPadding,s=Math.max(0,Math.min(r.height-6,r.width-o*2));if(s<=2)return!0;let c=r.x+o,l=r.y+(r.height-s)/2,u=a?vre(a):null;n.save(),n.beginPath();let d=Math.min(3,s/2);if(n.moveTo(c+d,l),n.arcTo(c+s,l,c+s,l+s,d),n.arcTo(c+s,l+s,c,l+s,d),n.arcTo(c,l+s,c,l,d),n.arcTo(c,l,c+s,l,d),n.closePath(),u&&u.complete&&u.naturalWidth>0){n.clip();let e=Math.min(s/u.naturalWidth,s/u.naturalHeight),t=u.naturalWidth*e,r=u.naturalHeight*e;n.drawImage(u,c+(s-t)/2,l+(s-r)/2,t,r)}else n.fillStyle=pf,n.fill(),n.strokeStyle=`rgba(118, 143, 182, 0.45)`,n.lineWidth=1,n.stroke();return n.restore(),!0}},bre={kind:R.Custom,isMatch:e=>e.data?.kind===`aios-rating`,draw:(e,t)=>{let{ctx:n,rect:r,theme:i}=e,{value:a,max:o}=t.data,s=r.y+r.height/2,c=r.x+i.cellHorizontalPadding+13/2,l=r.x+r.width-i.cellHorizontalPadding;for(let e=0;el);e+=1)mre(n,c,s,13/2,ee.trim()).filter(e=>e!==``),r=n.length?xp(e,n[0]):void 0;return{kind:R.Bubble,data:n,allowOverlay:!1,themeOverride:r?{bgBubble:r.bg,textBubble:r.fg}:void 0}}default:return{kind:R.Text,data:String(t??``),displayData:String(t??``),...i}}}ot();var Lp={kind:R.Text,data:``,displayData:``,allowOverlay:!1},Sre=new Set;function Cre(e,t,n,r,i){let a=e.collapsed?`▶`:`▼`,o=e.count.toLocaleString(),s=`${a} ${e.label} (${o})`,c=i?fne(a,e.label,o,r,i):s;return{kind:R.Text,data:s,displayData:t===0?c:``,allowOverlay:!1,span:[0,Math.max(0,n-1)],themeOverride:{bgCell:`#eef0f3`,bgCellMedium:`#eef0f3`,textDark:`#33333d`,baseFontStyle:dne}}}var Rp=[`#1b1b22`,`#33333d`,`#4d4d59`,`#33333d`];function wre(e,t,n){let r=Math.max(22,Math.round((e??120)*.42));return{kind:R.Loading,allowOverlay:!1,skeletonWidth:r,skeletonWidthVariability:Math.min(20,Math.round(r*.35)),skeletonHeight:10,themeOverride:{textDark:Rp[(n+t)%Rp.length]},copyData:``}}function Tre(e,t){let n=t?e.aggs[t.key]:void 0;return{kind:R.Text,data:n??``,displayData:n??``,contentAlign:`right`,allowOverlay:!1,themeOverride:{bgCell:`#f6f7f9`,bgCellMedium:`#f6f7f9`,textDark:`#4a4a55`,baseFontStyle:`600 12px`}}}function Ere(e,t,n,r,i,a,o=0,s=null,c,l=Sre,u=0){return(0,z.useCallback)(([o,d])=>{let f=e[d];if(!f)return Lp;let p=t[o],m=p?n.get(p.id):void 0;if(f.kind===`group-header`)return Cre(f,o,t.length,s,c);if(f.kind===`group-footer`)return Tre(f,m);if(!m)return Lp;let h=r[f.record.pid]?.[m.key]??f.record[m.key];return(h==null||h===``)&&l.has(m.key)?wre(p?.width,d,u):xre(m,h,i(m),a)},[e,t,n,r,i,a,o,s,c,l,u])}ot();function Dre(e,t,n){let[r,i]=(0,z.useState)(new Set),[a,o]=(0,z.useState)(void 0),s=(0,z.useRef)(null);return(0,z.useEffect)(()=>{o(e=>{if(!e)return e;let n=s.current,r=n==null?void 0:t.get(n);if(r!==void 0)return r===e.cell[1]?e:{cell:[e.cell[0],r],range:{x:e.cell[0],y:r,width:1,height:1},rangeStack:[]}})},[e,t]),{gridSelection:(0,z.useMemo)(()=>{let i=at.empty();for(let e of r){let n=t.get(e);n!==void 0&&(i=i.add(n))}return{current:a&&a.cell[1]{o(t.current);let n=t.current?e[t.current.cell[1]]:void 0;s.current=n&&n.kind===`data`?n.record.pid:null;let r=new Set;for(let n of t.rows){let t=e[n];t&&t.kind===`data`&&r.add(t.record.pid)}i(r)},[e]),selectPids:(0,z.useCallback)((e,t)=>{i(n=>{let r=t===`add`?new Set(n):new Set;for(let t of e)r.add(t);return r})},[]),togglePid:(0,z.useCallback)(e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),setActiveCell:(0,z.useCallback)((t,n)=>{let r=e[n];s.current=r&&r.kind===`data`?r.record.pid:null,o({cell:[t,n],range:{x:t,y:n,width:1,height:1},rangeStack:[]})},[e]),clearSelection:(0,z.useCallback)(()=>{i(new Set),o(void 0),s.current=null},[])}}var zp=[{key:`filters`,label:`Filter conditions`,blurb:`Which records the view shows, and how the conditions combine.`},{key:`sorts`,label:`Sorts`,blurb:`The order records are listed in.`},{key:`groupBy`,label:`Groups`,blurb:`The field records are bucketed by.`},{key:`visible`,label:`Hidden fields`,blurb:`Which columns are shown.`},{key:`order`,label:`Field order`,blurb:`Left-to-right column order.`},{key:`rowHeightMode`,label:`Row height`,blurb:`Short, medium or tall rows.`}],Bp=zp.map(e=>e.key);function Ore(e){return typeof e==`string`&&Bp.includes(e)}function Vp(e){return JSON.parse(JSON.stringify(e))}function kre(e,t,n){let r={};if(!e)return r;let i=new Set;for(let e of t)Ore(e)&&i.add(e);if(i.size===0)return r;if(i.has(`filters`)&&(r.filters=Vp(Array.isArray(e.filters)?e.filters:[]),r.filterConj=e.filterConj),i.has(`sorts`)&&(r.sorts=Vp(Array.isArray(e.sorts)?e.sorts:[])),i.has(`groupBy`)&&(r.groupBy=e.groupBy??null),i.has(`visible`)){let t=Vp(Array.isArray(e.visible)?e.visible:[]);r.visible=n&&!t.includes(n)?[n,...t]:t}return i.has(`order`)&&(r.order=Vp(Array.isArray(e.order)?e.order:[])),i.has(`rowHeightMode`)&&e.rowHeightMode&&(r.rowHeightMode=e.rowHeightMode),r}var Are=s((e=>{var t=f(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),Hp=s(((e,t)=>{t.exports=Are()})),Up=g(),H=Hp(),Wp=(0,z.createContext)(null),Gp=[`[data-overlay-autofocus]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[href]`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function Kp({children:e}){let t=(0,z.useRef)([]),n=(0,z.useMemo)(()=>({register:e=>(t.current=[...t.current.filter(t=>t!==e),e],()=>{t.current=t.current.filter(t=>t!==e)}),isTop:e=>t.current.at(-1)===e}),[]);return(0,H.jsx)(Wp.Provider,{value:n,children:e})}var jre={left:0,top:0,right:0,bottom:0,width:0,height:0};function Mre(e){if(!e)return jre;if(`getBoundingClientRect`in e){let t=e.getBoundingClientRect();return{left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:t.width,height:t.height}}return e}function Nre(e,t){return e.left===t.left&&e.top===t.top&&e.maxWidth===t.maxWidth&&e.maxHeight===t.maxHeight&&e.visibility===t.visibility}function qp({panelRef:e,onDismiss:t,dismissOnOutside:n=!0,initialFocus:r=`first`,restoreFocus:i=!0,trapFocus:a=!1,outsideElements:o=[]}){let s=(0,z.useId)(),c=(0,z.useContext)(Wp),l=(0,z.useRef)(t),u=(0,z.useRef)(o);l.current=t,u.current=o,(0,z.useEffect)(()=>c?.register(s),[s,c]),(0,z.useEffect)(()=>{let t=t=>{if(!n||c&&!c.isTop(s))return;let r=t.target;!r||e.current?.contains(r)||u.current.some(e=>e?.contains(r))||(document.activeElement instanceof HTMLElement&&e.current?.contains(document.activeElement)&&document.activeElement.blur(),l.current())},r=t=>{if(c&&!c.isTop(s))return;if(t.key===`Escape`){t.preventDefault(),t.stopPropagation(),document.activeElement instanceof HTMLElement&&e.current?.contains(document.activeElement)&&document.activeElement.blur(),l.current();return}if(t.key!==`Tab`||!a)return;let n=Array.from(e.current?.querySelectorAll(Gp)??[]).filter(e=>e.getClientRects().length>0);if(!n.length){t.preventDefault(),e.current?.focus();return}let r=n[0],i=n.at(-1),o=document.activeElement;t.shiftKey&&(o===r||!e.current?.contains(o))?(t.preventDefault(),i.focus()):!t.shiftKey&&o===i&&(t.preventDefault(),r.focus())};return document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`keydown`,r,!0)}},[n,s,e,c,a]),(0,z.useLayoutEffect)(()=>{let t=document.activeElement instanceof HTMLElement?document.activeElement:null,n=window.requestAnimationFrame(()=>{if(r===`none`)return;let t=r===`first`?Gp:r;(e.current?.querySelector(t))?.focus({preventScroll:!0})});return()=>{window.cancelAnimationFrame(n),i&&t?.isConnected&&t.focus({preventScroll:!0})}},[r,e,i])}function Jp({children:e}){return(0,Up.createPortal)(e,document.body)}function Yp({anchor:e,className:t,children:n,onDismiss:r,placement:i=`bottom-start`,role:a,ariaLabel:o,id:s,initialFocus:c=`first`,restoreFocus:l=!0,dismissOnOutside:u=!0,onKeyDown:d,dataKind:f}){let p=(0,z.useRef)(null),[m,h]=(0,z.useState)({position:`fixed`,left:0,top:0,visibility:`hidden`}),g=e&&`getBoundingClientRect`in e?e:null;qp({panelRef:p,onDismiss:r,dismissOnOutside:u,initialFocus:c,restoreFocus:l,outsideElements:[g]});let _=(0,z.useCallback)(()=>{let t=p.current;if(!t)return;let n=Mre(e),r=window.visualViewport,a=r?.offsetLeft??0,o=r?.offsetTop??0,s=r?.width??window.innerWidth,c=r?.height??window.innerHeight,l=t.getBoundingClientRect(),u=vne({placement:i,target:n,panel:{width:Math.max(l.width,t.scrollWidth),height:Math.max(l.height,t.scrollHeight)},viewport:{left:a,top:o,width:s,height:c}}),d={position:`fixed`,left:u.left,top:u.top,maxWidth:u.maxWidth,maxHeight:u.maxHeight,visibility:`visible`};h(e=>Nre(e,d)?e:d)},[e,i]);return(0,z.useLayoutEffect)(()=>{_();let e=window.requestAnimationFrame(_),t=new ResizeObserver(_);return p.current&&t.observe(p.current),g&&t.observe(g),window.addEventListener(`resize`,_),window.addEventListener(`scroll`,_,!0),window.visualViewport?.addEventListener(`resize`,_),window.visualViewport?.addEventListener(`scroll`,_),()=>{window.cancelAnimationFrame(e),t.disconnect(),window.removeEventListener(`resize`,_),window.removeEventListener(`scroll`,_,!0),window.visualViewport?.removeEventListener(`resize`,_),window.visualViewport?.removeEventListener(`scroll`,_)}},[g,_]),(0,H.jsx)(Jp,{children:(0,H.jsx)(`div`,{ref:p,id:s,className:t,style:m,role:a,"aria-label":o,"data-overlay-kind":f,onKeyDown:d,children:n})})}function Xp({shapes:e}){return(0,H.jsx)(H.Fragment,{children:e.map((e,t)=>e.fill?(0,H.jsx)(`path`,{d:e.d,fill:`currentColor`},t):(0,H.jsx)(`path`,{d:e.d,fill:`none`,stroke:`currentColor`,strokeWidth:1.35,strokeLinecap:`round`,strokeLinejoin:`round`},t))})}function Zp({type:e,size:t=14,title:n}){return(0,H.jsxs)(`svg`,{className:`cg-type-icon`,width:t,height:t,viewBox:`0 0 16 16`,"aria-hidden":!n||void 0,role:n?`img`:void 0,"aria-label":n,children:[n&&(0,H.jsx)(`title`,{children:n}),(0,H.jsx)(Xp,{shapes:wf[e===`measure`?`currency`:e]})]})}function Qp({mode:e,size:t=14}){return(0,H.jsx)(`svg`,{className:`cg-mode-icon`,width:t,height:t,viewBox:`0 0 16 16`,"aria-hidden":!0,children:(0,H.jsx)(Xp,{shapes:Tf[e]})})}function $p({mode:e,tone:t,size:n=15}){let r=Ef[t];return(0,H.jsx)(`svg`,{className:`cg-mode-icon cg-tone-icon`,width:n,height:n,viewBox:`0 0 16 16`,"aria-hidden":!0,children:Tf[e].map((e,t)=>e.fill?(0,H.jsx)(`path`,{d:e.d,fill:r.stroke},t):(0,H.jsx)(`path`,{d:e.d,fill:`none`,stroke:r.stroke,strokeWidth:1.35,strokeLinecap:`round`,strokeLinejoin:`round`},t))})}function Pre({kind:e,size:t=15}){let n=Ef[tne[e]];return(0,H.jsx)(`svg`,{className:`cg-mode-icon cg-tone-icon`,width:t,height:t,viewBox:`0 0 16 16`,"aria-hidden":!0,children:ene[e].map((t,r)=>(0,H.jsx)(`path`,{d:t.d,fill:r===0&&(e===`area`||e===`donut`||e===`kpi`||e===`table`)?n.fill:`none`,stroke:n.stroke,strokeWidth:1.35,strokeLinecap:`round`,strokeLinejoin:`round`},r))})}var Fre={width:16,height:16,viewBox:`0 0 16 16`,fill:`none`},em={stroke:`currentColor`,strokeWidth:1.3,strokeLinecap:`round`,strokeLinejoin:`round`},Ire={duplicate:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`rect`,{x:`5.5`,y:`5.5`,width:`8`,height:`8`,rx:`1.5`,...em}),(0,H.jsx)(`path`,{d:`M10.5 2.5h-7a1 1 0 0 0-1 1v7`,...em})]}),insertLeft:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`line`,{x1:`3`,y1:`2.5`,x2:`3`,y2:`13.5`,...em}),(0,H.jsx)(`path`,{d:`M13.5 8H6.5M9.2 5.3 6.5 8l2.7 2.7`,...em})]}),insertRight:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`line`,{x1:`13`,y1:`2.5`,x2:`13`,y2:`13.5`,...em}),(0,H.jsx)(`path`,{d:`M2.5 8h7M6.8 5.3 9.5 8l-2.7 2.7`,...em})]}),addEnd:(0,H.jsx)(`path`,{d:`M8 3v10M3 8h10`,...em}),rename:(0,H.jsx)(`path`,{d:`m9.8 3.2 3 3L6.2 12.8l-3.6.6.6-3.6 6.6-6.6Z`,...em}),description:(0,H.jsx)(`path`,{d:`M3 4.5h10M3 8h10M3 11.5h6`,...em}),permissions:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`rect`,{x:`3.5`,y:`7`,width:`9`,height:`6`,rx:`1`,...em}),(0,H.jsx)(`path`,{d:`M5.5 7V5.2a2.5 2.5 0 0 1 5 0V7`,...em})]}),unlock:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`rect`,{x:`3.5`,y:`7`,width:`9`,height:`6`,rx:`1`,...em}),(0,H.jsx)(`path`,{d:`M5.5 7V5.2a2.5 2.5 0 0 1 5 0`,...em})]}),format:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{d:`M3 5h5.5M12.5 5H13M3 11h1M7 11h6`,...em}),(0,H.jsx)(`circle`,{cx:`10.5`,cy:`5`,r:`1.6`,...em}),(0,H.jsx)(`circle`,{cx:`4.9`,cy:`11`,r:`1.6`,...em})]}),swap:(0,H.jsx)(`path`,{d:`M3.5 6h9M10.2 3.7 12.5 6l-2.3 2.3M12.5 10.5h-9M5.8 8.2 3.5 10.5l2.3 2.3`,...em}),sortAsc:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{d:`M4.5 3v10M4.5 13l-2-2M4.5 13l2-2`,...em}),(0,H.jsx)(`path`,{d:`M8.5 4.5h2M8.5 8h3.5M8.5 11.5h5`,...em})]}),sortDesc:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{d:`M4.5 3v10M4.5 13l-2-2M4.5 13l2-2`,...em}),(0,H.jsx)(`path`,{d:`M8.5 4.5h5M8.5 8h3.5M8.5 11.5h2`,...em})]}),off:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`circle`,{cx:`8`,cy:`8`,r:`5.5`,...em}),(0,H.jsx)(`line`,{x1:`4.4`,y1:`11.6`,x2:`11.6`,y2:`4.4`,...em})]}),filter:(0,H.jsx)(`path`,{d:`M2.5 3.5h11L9.5 8.5v3.8L6.5 14V8.5L2.5 3.5Z`,...em}),group:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`line`,{x1:`2.5`,y1:`4`,x2:`13.5`,y2:`4`,...em}),(0,H.jsx)(`line`,{x1:`5.5`,y1:`8`,x2:`13.5`,y2:`8`,...em}),(0,H.jsx)(`line`,{x1:`5.5`,y1:`12`,x2:`13.5`,y2:`12`,...em})]}),pin:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{d:`M6 2.5h4l-.5 4L12 9v1H4V9l2.5-2.5L6 2.5Z`,...em}),(0,H.jsx)(`line`,{x1:`8`,y1:`10`,x2:`8`,y2:`13.5`,...em})]}),unpin:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{d:`M6 2.5h4l-.5 4L12 9v1H4V9l2.5-2.5L6 2.5Z`,...em}),(0,H.jsx)(`line`,{x1:`8`,y1:`10`,x2:`8`,y2:`13.5`,...em}),(0,H.jsx)(`line`,{x1:`3`,y1:`13`,x2:`13`,y2:`3`,...em})]}),hide:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{d:`M2.5 8s2-3.5 5.5-3.5S13.5 8 13.5 8s-2 3.5-5.5 3.5S2.5 8 2.5 8Z`,...em}),(0,H.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.5`,...em}),(0,H.jsx)(`line`,{x1:`3.5`,y1:`12.5`,x2:`12.5`,y2:`3.5`,...em})]}),trash:(0,H.jsx)(`path`,{d:`M3.5 4.5h9M6.5 4.5V3h3v1.5M5 4.5l.6 8.5h4.8l.6-8.5`,...em}),download:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{d:`M8 2.5v7M5.3 6.8 8 9.5l2.7-2.7`,...em}),(0,H.jsx)(`path`,{d:`M3 11v1.5a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V11`,...em})]}),cohortAdd:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{d:`M2.5 4h7M2.5 7.5h5M2.5 11h4`,...em}),(0,H.jsx)(`path`,{d:`M11.5 8.5v5M9 11h5`,...em})]})};function Lre({name:e}){return(0,H.jsx)(`svg`,{...Fre,"aria-hidden":!0,children:Ire[e]})}function tm({icon:e,text:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`cg-mi-ic`,"aria-hidden":!0,children:typeof e==`string`?(0,H.jsx)(Lre,{name:e}):e}),(0,H.jsx)(`span`,{className:`cg-mi-text`,children:t})]})}function nm({size:e=14}){return(0,H.jsxs)(`svg`,{className:`cg-eyeoff-icon`,width:e,height:e,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:[(0,H.jsx)(`path`,{d:`M2.5 8s2-3.5 5.5-3.5S13.5 8 13.5 8s-2 3.5-5.5 3.5S2.5 8 2.5 8Z`,stroke:`currentColor`,strokeWidth:1.4,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,H.jsx)(`path`,{d:`M9.6 8a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0Z`,stroke:`currentColor`,strokeWidth:1.4,strokeLinejoin:`round`}),(0,H.jsx)(`path`,{d:`M3.3 12.7 12.7 3.3`,stroke:`currentColor`,strokeWidth:1.4,strokeLinecap:`round`})]})}function rm({size:e=11}){return(0,H.jsxs)(`svg`,{className:`cg-lock-mark`,width:e,height:e,viewBox:`0 0 16 16`,"aria-hidden":!0,children:[(0,H.jsx)(`path`,{d:`M4.2 7.2h7.6v5.6H4.2z`,fill:`none`,stroke:`currentColor`,strokeWidth:1.35,strokeLinejoin:`round`}),(0,H.jsx)(`path`,{d:`M5.9 7.2V5.5a2.1 2.1 0 0 1 4.2 0v1.7`,fill:`none`,stroke:`currentColor`,strokeWidth:1.35,strokeLinecap:`round`})]})}function im({icon:e,size:t=14}){let n=e?.shape??`folder`,r=Ef[e?.tone??`neutral`];return(0,H.jsx)(`svg`,{className:`cg-folder-mark`,width:t,height:t,viewBox:`0 0 16 16`,"aria-hidden":!0,children:nne[n].map((e,t)=>(0,H.jsx)(`path`,{d:e.d,fill:`none`,stroke:r.stroke,strokeWidth:1.35,strokeLinecap:`round`,strokeLinejoin:`round`},t))})}function am({item:e}){return e.icon?(0,H.jsx)(H.Fragment,{children:e.icon}):e.type?(0,H.jsx)(Zp,{type:e.type,title:e.type===`measure`?`Metric`:Af[e.type]}):(0,H.jsx)(`span`,{className:`cg-fsel-nomark`,"aria-hidden":!0})}function Rre(){return(0,H.jsx)(`svg`,{className:`cg-fsel-caret`,width:`10`,height:`10`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M4 6l4 4 4-4`,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`})})}function zre(){return(0,H.jsx)(`svg`,{className:`cg-type-check`,width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`m3.5 8.5 3 3 6-6.5`,stroke:`currentColor`,strokeWidth:1.6,strokeLinecap:`round`,strokeLinejoin:`round`})})}var om=8;function sm({fields:e,value:t,onChange:n,placeholder:r=`Choose a field…`,allow:i,ariaLabel:a,className:o,disabled:s,title:c,keepOpen:l,overlayAutofocus:u}){let[d,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)(``),h=(0,z.useRef)(null),g=(0,z.useRef)(null),_=(0,z.useMemo)(()=>i?e.filter(e=>e.type!=null&&i.includes(e.type)):e,[e,i]),v=t!=null,y=v?e.find(e=>e.key===t):void 0,b=p.trim().toLowerCase(),x=b?_.filter(e=>e.label.toLowerCase().includes(b)):_,S=()=>{f(!1),m(``)},C=e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`&&e.key!==`Home`&&e.key!==`End`)return;let t=Array.from(g.current?.querySelectorAll(`button.cg-type-row`)??[]).filter(e=>!e.disabled);if(!t.length)return;e.preventDefault();let n=t.indexOf(document.activeElement);if(e.key===`Home`)return t[0].focus();if(e.key===`End`)return t[t.length-1].focus();let r=e.key===`ArrowDown`?1:-1;t[n<0?r===1?0:t.length-1:(n+r+t.length)%t.length].focus()},w;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{ref:h,type:`button`,disabled:s,className:`cg-select cg-fsel`+(y?``:v&&t!==``?` is-missing`:` is-empty`)+(o?` ${o}`:``),"aria-label":a,"aria-haspopup":`listbox`,"aria-expanded":d,"data-overlay-autofocus":u?!0:void 0,onClick:()=>f(e=>!e),children:[y?(0,H.jsx)(am,{item:y}):(0,H.jsx)(`span`,{className:`cg-fsel-nomark`,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`cg-fsel-label`,children:y?.label??(v&&t!==``?t:r)}),(0,H.jsx)(Rre,{})]}),d&&h.current&&(0,H.jsx)(Yp,{anchor:h.current,className:`cg-pop cg-fsel-pop`,onDismiss:S,role:`dialog`,ariaLabel:a??c??`Choose a field`,initialFocus:_.length>=om?`.cg-fsel-search input`:`button.cg-type-row`,dataKind:`field-select`,children:(0,H.jsxs)(`div`,{className:`cg-fsel-body`,onKeyDown:C,children:[c&&(0,H.jsx)(`div`,{className:`cg-pop-title`,children:c}),_.length>=om&&(0,H.jsxs)(`div`,{className:`cg-type-search cg-fsel-search`,children:[(0,H.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:[(0,H.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.4`,stroke:`currentColor`,strokeWidth:`1.35`}),(0,H.jsx)(`path`,{d:`m10.4 10.4 3.1 3.1`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`})]}),(0,H.jsx)(`input`,{type:`text`,value:p,placeholder:`Find a field…`,"aria-label":`Find a field`,onChange:e=>m(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`cg-type-list`,role:`listbox`,ref:g,"aria-label":a??c??`Fields`,children:[x.map(e=>{let r=e.group&&e.group!==w?e.group:null;return w=e.group,(0,H.jsxs)(z.Fragment,{children:[r&&(0,H.jsx)(`div`,{className:`cg-fsel-group`,role:`presentation`,children:r}),(0,H.jsxs)(`button`,{type:`button`,role:`option`,disabled:e.disabled,"aria-selected":e.key===t,className:`cg-type-row`+(e.key===t?` is-on`:``),onClick:()=>{n(e.key),l?m(``):S()},children:[(0,H.jsx)(am,{item:e}),(0,H.jsxs)(`span`,{className:`cg-type-label`,children:[e.label,e.hint&&(0,H.jsx)(`span`,{className:`cg-fsel-hint`,children:e.hint})]}),e.key===t&&(0,H.jsx)(zre,{})]})]},e.key)}),x.length===0&&(0,H.jsx)(`div`,{className:`cg-pop-note`,children:_.length===0?`No field to choose here.`:`No field matches.`})]})]})})]})}function cm(e,t){let n=e=>e.toLocaleString();if(!t?.windowed)return`${n(e)} ${e===1?`record`:`records`}`;let r=t.matched===1?`record`:`records`,i=t.matched=t.matched?`${n(t.matched)} ${r}${i}`:`showing ${n(t.shown)} of ${n(t.matched)} ${r}${i}`}function lm(e){if(!e?.partial)return null;let t=typeof e.loaded==`number`&&Number.isFinite(e.loaded)&&e.loaded>=0?Math.floor(e.loaded):0,n=typeof e.total==`number`&&Number.isFinite(e.total)&&e.total>0?Math.floor(e.total).toLocaleString():`…`;return`${t.toLocaleString()} of ${n}`}function Bre(e,t){if(!t?.windowed)return cm(e,t);let n=e=>e.toLocaleString();return t.shown>=t.matched?`${n(t.matched)} ${t.matched===1?`record`:`records`}`:`showing ${n(t.shown)} of ${n(t.matched)}`}function um({window:e,onWindow:t,kinds:n=Au}){let r=e.kind;return(0,H.jsxs)(`span`,{className:`cg-cond-window`,children:[(0,H.jsx)(`select`,{className:`cg-select cg-cond-win-kind`,value:r,"aria-label":`Date window`,onChange:n=>{let r=n.target.value;ju.has(r)?t({kind:r,n:e.n??30}):t(r===`custom`?{kind:r,from:e.from??``,to:e.to??``}:{kind:r})},children:(n.includes(r)?n:[...n,r]).map(e=>(0,H.jsx)(`option`,{value:e,children:ju.has(e)?Mu[e].replace(`{n}`,`N`):Mu[e]},e))}),ju.has(r)&&(0,H.jsx)(`input`,{className:`cg-input cg-cond-win-n`,type:`number`,min:1,max:3650,"aria-label":`Number of days`,value:e.n??``,onChange:n=>t({...e,n:n.target.value===``?void 0:Number(n.target.value)})}),r===`custom`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`input`,{className:`cg-input cg-cond-win-date`,type:`date`,"aria-label":`Window start`,value:e.from??``,onChange:n=>t({...e,from:n.target.value})}),(0,H.jsx)(`span`,{className:`cg-cond-and`,children:`and`}),(0,H.jsx)(`input`,{className:`cg-input cg-cond-win-date`,type:`date`,"aria-label":`Window end`,value:e.to??``,onChange:n=>t({...e,to:n.target.value})})]})]})}var dm=rd,fm=id;function pm(e){return e===`checkbox`?[`isNotEmpty`,`isEmpty`]:dm(e)?[`gte`,`gt`,`lte`,`lt`,`eq`,`neq`,`between`,`isEmpty`,`isNotEmpty`]:fm(e)?[`eq`,`within`,`lt`,`gt`,`lte`,`gte`,`neq`,`isEmpty`,`isNotEmpty`]:e===`status`||e===`select`||e===`user`?[`eq`,`neq`,`isEmpty`,`isNotEmpty`]:[`contains`,`doesNotContain`,`eq`,`neq`,`isEmpty`,`isNotEmpty`]}var Vre={topN:`top N`,bottomN:`bottom N`,inTopPct:`top N%`,inBottomPct:`bottom N%`,aboveAvg:`above average`,belowAvg:`below average`,inQuartile:`in quartile`,inDecile:`in decile`};function Hre(e){switch(e){case`topN`:case`bottomN`:case`inTopPct`:case`inBottomPct`:case`inDecile`:return`10`;case`inQuartile`:return`4`;default:return``}}function mm(e){for(let t of e??[]){if(hd(t)){if(mm(t.children))return!0;continue}if(od(t.op)&&!md(t))return!0}return!1}function hm(e,t){if(od(e))return Vre[e]??e;if(t===`checkbox`){if(e===`isNotEmpty`)return`is checked`;if(e===`isEmpty`)return`is unchecked`}if(e===`isEmpty`)return`is empty`;if(e===`isNotEmpty`)return`is not empty`;if(fm(t))switch(e){case`eq`:return`is`;case`neq`:return`is not`;case`within`:return`is within`;case`lt`:return`is before`;case`lte`:return`is on or before`;case`gt`:return`is after`;case`gte`:return`is on or after`;case`between`:return`is between`}if(dm(t))switch(e){case`gte`:return`≥`;case`gt`:return`>`;case`lte`:return`≤`;case`lt`:return`<`;case`eq`:return`=`;case`neq`:return`≠`;case`between`:return`is between`;default:return e}if(t===`multiselect`)switch(e){case`contains`:return`has`;case`doesNotContain`:return`does not have`;case`eq`:return`is exactly`;case`neq`:return`is not exactly`;default:return e}switch(e){case`contains`:return`contains`;case`doesNotContain`:return`does not contain`;case`eq`:return`is`;case`neq`:return`is not`;default:return e}}function Ure(e,t){return t&&!e.includes(t)?[...e,t]:[...e]}function Wre(e){return e===`or`?`Any of the following are true…`:`All of the following are true…`}var gm=[...Wee],_m=[...Gee],vm=[...Bee];function Gre(e){switch(ld(e)){case`allOf`:return`is all of`;case`noneOf`:return`is none of`;default:return`is any of`}}var ym=`measure`,bm={kind:`ltm`},xm={kind:`past_month`},Kre=[`last_n_days`,`past_week`,`past_month`,`past_year`,`this_week`,`this_month`,`this_year`,`custom`];function qre(e,t,n,r,i){let a=e.map(e=>({key:e.key,label:e.label,type:e.type})),o=new Set(a.map(e=>e.key));if(!t||o.has(t)||r.has(t)||t===`__cohort__`&&i)return a;let s=n.get(t);return a.push({key:t,label:s?s.label:t,type:s?.type}),a}var Sm=0;function Cm(){return Sm+=1,`r${Date.now().toString(36)}${Sm.toString(36)}`}function wm(e){let t=e[0];return t?{colId:t.key,op:pm(t.type)[0],value:``}:null}function Tm(e){let t=0;for(let n of e)t+=hd(n)?Tm(n.children):1;return t}function Jre({rule:e,onPatch:t}){let n=e.dateMode??`exact`;return(0,H.jsxs)(`span`,{className:`cg-cond-anchor`,children:[(0,H.jsx)(`select`,{className:`cg-select cg-cond-anchor-mode`,value:n,"aria-label":`Date`,onChange:e=>{let n=e.target.value;t({dateMode:n,value:``})},children:Nu.map(e=>(0,H.jsx)(`option`,{value:e,children:e===`n_days_ago`?Pu[e].replace(`{n}`,`N`):Pu[e]},e))}),n===`n_days_ago`&&(0,H.jsx)(`input`,{className:`cg-input cg-cond-win-n`,type:`number`,min:0,max:3650,"aria-label":`Number of days ago`,value:e.value,onChange:e=>t({value:e.target.value})}),n===`exact`&&(0,H.jsx)(`input`,{className:`cg-input cg-cond-val`,type:`date`,"aria-label":`Date`,value:e.value,onChange:e=>t({value:e.target.value})})]})}function Yre({rule:e,options:t,isMeasure:n,onPatch:r}){let i=e.rhs,a=fd(i)??``;return(0,H.jsxs)(`span`,{className:`cg-cond-rhs`,children:[(0,H.jsx)(sm,{className:`cg-cond-field`,ariaLabel:`Compare with field`,placeholder:`Select a field…`,value:a||void 0,fields:t,onChange:e=>{r({rhs:n?{kind:`measure`,colId:e,window:i?.kind===`measure`&&i.window||bm}:{kind:`field`,colId:e}})}}),n&&a!==``&&(0,H.jsx)(um,{window:i?.kind===`measure`&&i.window||bm,onWindow:e=>r({rhs:{kind:`measure`,colId:a,window:e}})})]})}function Xre({rule:e,type:t,statusOptions:n,onValue:r,onValue2:i}){if(e.op===`between`){let n=t===`date`||t===`created_time`?`date`:`number`;return(0,H.jsxs)(`span`,{className:`cg-cond-between`,children:[(0,H.jsx)(`input`,{className:`cg-input cg-cond-val`,type:n,value:e.value,onChange:e=>r(e.target.value)}),(0,H.jsx)(`span`,{className:`cg-cond-and`,children:`and`}),(0,H.jsx)(`input`,{className:`cg-input cg-cond-val`,type:n,value:e.value2??``,onChange:e=>i(e.target.value)})]})}return t===`status`||t===`select`||t===`user`||t===`multiselect`?(0,H.jsxs)(`select`,{className:`cg-select cg-cond-val`,value:e.value,onChange:e=>r(e.target.value),children:[(0,H.jsx)(`option`,{value:``,children:`Select…`}),n.map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))]}):(0,H.jsx)(`input`,{className:`cg-input cg-cond-val`,type:t===`date`||t===`created_time`?`date`:dm(t)?`number`:`text`,placeholder:`Value`,value:e.value,onChange:e=>r(e.target.value)})}function Zre({rule:e,onValue:t}){let n=e.op===`inQuartile`?4:e.op===`inDecile`?10:0;if(n)return(0,H.jsx)(`select`,{className:`cg-select cg-cond-val`,value:e.value,"aria-label":e.op===`inQuartile`?`Quartile`:`Decile`,onChange:e=>t(e.target.value),children:Array.from({length:n},(e,t)=>String(t+1)).map(e=>(0,H.jsx)(`option`,{value:e,children:e===`1`?`${e} (lowest)`:e===String(n)?`${e} (highest)`:e},e))});let r=e.op===`inTopPct`||e.op===`inBottomPct`;return(0,H.jsx)(`input`,{className:`cg-input cg-cond-val`,type:`number`,min:1,max:r?100:1e4,step:1,placeholder:`10`,"aria-label":r?`Percent`:`How many`,value:e.value,onChange:e=>t(e.target.value)})}function Qre({rule:e,lists:t,onPatch:n}){let r=ud(e.value),i=new Map(t.map(e=>[e.id,e.name])),a=t.filter(e=>!r.includes(e.id)),o=a.length>0&&r.length<20,s=e=>n({value:e.join(`,`)});return(0,H.jsxs)(`span`,{className:`cg-cond-cohorts`,children:[r.map(e=>(0,H.jsxs)(`span`,{className:`cg-chip`+(i.has(e)?``:` cg-chip--gone`),children:[(0,H.jsx)(`span`,{className:`cg-chip-text`,children:i.get(e)??`(deleted list)`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-chip-x`,"aria-label":`Remove ${i.get(e)??e}`,onClick:()=>s(r.filter(t=>t!==e)),children:`×`})]},e)),(0,H.jsxs)(`select`,{className:`cg-select cg-cond-val cg-cond-cohort-add`,value:``,"aria-label":`Cohort`,disabled:!o,onChange:e=>e.target.value&&s([...r,e.target.value]),children:[(0,H.jsx)(`option`,{value:``,children:o?r.length?`Add a cohort…`:`Select a cohort…`:`all added`}),a.map(e=>(0,H.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})}function $re({index:e,conj:t,onConj:n}){return e===0?(0,H.jsx)(`span`,{className:`cg-cond-prefix`,children:`Where`}):e===1?(0,H.jsxs)(`select`,{className:`cg-select cg-cond-conj`,value:t,"aria-label":`Combine conditions with`,onChange:e=>n(e.target.value),children:[(0,H.jsx)(`option`,{value:`and`,children:`and`}),(0,H.jsx)(`option`,{value:`or`,children:`or`})]}):(0,H.jsx)(`span`,{className:`cg-cond-prefix cg-cond-conj-echo`,children:t})}function Em({nodes:e,conj:t,depth:n,ctx:r,onNodes:i,onConj:a}){let[o,s]=(0,z.useState)(null),c=(t,n)=>i(e.map((e,r)=>r===t?n:e)),l=t=>i(e.filter((e,n)=>n!==t)),u=()=>{let t=wm(r.fields);t&&i([...e,t])},d=()=>{let t=wm(r.fields);t&&i([...e,{conj:`or`,children:[t]}])},f=n<3;return(0,H.jsxs)(H.Fragment,{children:[e.map((e,i)=>(0,H.jsxs)(`div`,{className:`cg-cond-line`,children:[(0,H.jsx)($re,{index:i,conj:t,onConj:a}),hd(e)?(0,H.jsx)(tie,{group:e,depth:n+1,ctx:r,onGroup:e=>c(i,e),onRemove:()=>l(i)}):(0,H.jsx)(eie,{rule:e,ctx:r,onRule:e=>c(i,e),onRemove:()=>l(i)})]},i)),(0,H.jsxs)(`div`,{className:`cg-builder-add`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn`+(o===`condition`?` is-on`:``),onClick:()=>{s(`condition`),u()},children:`+ Add condition`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn`+(o===`group`?` is-on`:``),onClick:()=>{s(`group`),d()},disabled:!f,title:f?`Group conditions so they evaluate together`:`Condition groups can nest 3 levels deep`,children:`+ Add condition group`})]})]})}function eie({rule:e,ctx:t,onRule:n,onRemove:r}){let{fields:i,fieldByKey:a,measures:o,measureByKey:s,lists:c,choicesFor:l}=t,u=md(e),d=e.colId===cd,f=c.length>0,p=u?s.get(e.colId)?.type??`currency`:a.get(e.colId)?.type??`text`,m=t=>n({...e,...t}),h=t=>{if(t===`__cohort__`){n({colId:cd,op:vm[0],value:``});return}if(s.get(t)){n({id:e.id??Cm(),colId:t,op:gm[0],value:``,value2:void 0,window:e.window??bm});return}n({colId:t,op:pm(a.get(t)?.type??`text`)[0],value:``,value2:void 0})},g=t=>{if(d)return m({op:t});if(od(t))return n({...e,op:t,value:Hre(t),value2:void 0,rhs:void 0,dateWindow:void 0});if(sd.has(t))return n({...e,op:t,value:``,value2:void 0,rhs:void 0});if(t===`within`)return n({...e,op:t,value:``,value2:void 0,rhs:void 0,dateWindow:e.dateWindow??xm});if(e.op===`within`)return n({...e,op:t,dateWindow:void 0,value:``});m({op:t})},_=u?o.map(e=>({key:e.key,label:e.label,type:ym})):i.filter(t=>t.key!==e.colId&&(dm(p)?dm(t.type):t.type===p)).map(e=>({key:e.key,label:e.label,type:e.type})),v=!d&&e.op!==`within`&&!sd.has(e.op)&&!od(e.op)&&_.length>0&&(u||dm(p)||fm(p)),y=e.rhs?.kind===`stat`,b=e.rhs!=null&&!y,x=u?b||y?_m:gm:d?vm:pm(p),S=d?ld(e.op):e.op,C=Ure(!u&&!d&&dm(p)?[...x,...Lee]:x,S),w=C.filter(e=>!od(e)),T=C.filter(e=>od(e));return(0,H.jsxs)(`span`,{className:`cg-cond-row`+(u?` is-measure`:``)+(d?` is-cohort`:``)+(e.rhs==null?``:` has-rhs`),children:[(0,H.jsx)(sm,{className:`cg-cond-field`,ariaLabel:`Field`,value:e.colId,onChange:h,fields:[...qre(i,e.colId,a,s,f),...o.map(e=>({key:e.key,label:e.label,type:ym})),...f?[{key:cd,label:`Cohort`,type:`multiselect`}]:[]]}),u&&(0,H.jsx)(um,{window:e.window??bm,onWindow:e=>m({window:e})}),(0,H.jsxs)(`select`,{className:`cg-select cg-cond-op`,value:S,"aria-label":`Condition`,onChange:e=>g(e.target.value),children:[w.map(e=>(0,H.jsx)(`option`,{value:e,children:d?Gre(e):hm(e,p)},e)),T.length>0&&(0,H.jsx)(`optgroup`,{label:`Ranked`,children:T.map(e=>(0,H.jsx)(`option`,{value:e,children:hm(e,p)},e))})]}),v&&(0,H.jsxs)(`select`,{className:`cg-select cg-cond-mode`,value:y?`stat`:b?`field`:`value`,"aria-label":`Compare against`,onChange:t=>{let n=t.target.value;if(n===`stat`)return m({rhs:{kind:`stat`,stat:`median`},value:``,value2:void 0,op:_m.includes(e.op)?e.op:_m[1]});if(n===`field`)return m({rhs:u?{kind:`measure`,colId:``,window:bm}:{kind:`field`,colId:``},value:``,value2:void 0});m({rhs:void 0,value:``})},children:[(0,H.jsx)(`option`,{value:`value`,children:`a value`}),(0,H.jsx)(`option`,{value:`field`,children:`another field`}),u&&(0,H.jsx)(`option`,{value:`stat`,children:`a statistic`})]}),sd.has(e.op)?(0,H.jsx)(`span`,{className:`cg-cond-val cg-cond-noval`,"aria-hidden":!0}):y?(0,H.jsx)(`select`,{className:`cg-select cg-cond-val cg-cond-stat`,value:e.rhs?.kind===`stat`?e.rhs.stat:`median`,"aria-label":`Statistic`,onChange:e=>m({rhs:{kind:`stat`,stat:e.target.value}}),children:dd.map(e=>(0,H.jsx)(`option`,{value:e,children:Hee[e]},e))}):b?(0,H.jsx)(Yre,{rule:e,options:_,isMeasure:u,onPatch:m}):d?(0,H.jsx)(Qre,{rule:e,lists:c,onPatch:m}):od(e.op)?(0,H.jsx)(Zre,{rule:e,onValue:e=>m({value:e})}):e.op===`within`?(0,H.jsx)(um,{window:e.dateWindow??xm,onWindow:e=>m({dateWindow:e}),kinds:Kre}):fm(p)?(0,H.jsx)(Jre,{rule:e,onPatch:m}):(0,H.jsx)(Xre,{rule:e,type:p,statusOptions:l(e.colId),onValue:e=>m({value:e}),onValue2:e=>m({value2:e})}),(0,H.jsx)(`button`,{type:`button`,className:`cg-cond-x`,"aria-label":`Remove condition`,onClick:r,children:`×`})]})}function tie({group:e,depth:t,ctx:n,onGroup:r,onRemove:i}){return(0,H.jsxs)(`span`,{className:`cg-cond-group`,"data-depth":t,children:[(0,H.jsxs)(`span`,{className:`cg-cond-group-head`,children:[(0,H.jsx)(`span`,{className:`cg-cond-group-sum`,children:e.children.length?Wre(e.conj):`Add a condition to this group…`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-cond-x`,"aria-label":`Remove condition group`,onClick:i,children:`×`})]}),(0,H.jsx)(`span`,{className:`cg-cond-group-body`,children:(0,H.jsx)(Em,{nodes:e.children,conj:e.conj,depth:t,ctx:n,onNodes:t=>r({...e,children:t}),onConj:t=>r({...e,conj:t})})})]})}function Dm({fields:e,filters:t,onChange:n,cohorts:r=[],measures:i=[],userOptions:a,statusValues:o,cohortLock:s,footerExtra:c}){let l=gd(t),u=_d(t),d=(0,z.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.key,n);return t},[e]),f=(0,z.useMemo)(()=>_ee(e),[e]),p=(0,z.useMemo)(()=>{let e=new Map;for(let t of i)e.set(t.key,t);return e},[i]),m=(0,z.useCallback)(e=>{let t=o?.[e];if(t)return t;let n=d.get(e);return n?n.type===`user`?a??[]:Qu(n):[]},[o,d,a]),h=(0,z.useMemo)(()=>({fields:f,fieldByKey:d,measures:i,measureByKey:p,lists:r,choicesFor:m}),[f,d,i,p,r,m]);return(0,H.jsxs)(`div`,{className:`cg-pop-body cg-builder`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Filter`}),s&&(0,H.jsx)(`div`,{className:`cg-flt-lockchip`,children:s.name?`Customer list locked to ${s.name}`+(typeof s.count==`number`?` · ${s.count.toLocaleString()} ${s.count===1?`customer`:`customers`}`:``):`Customer list locked to a set you cannot see`}),l.length===0?(0,H.jsx)(`div`,{className:`cg-builder-empty`,children:`No conditions. Add one to narrow the list.`}):(0,H.jsx)(`div`,{className:`cg-builder-caption`,children:`In this view, show records`}),(0,H.jsx)(Em,{nodes:l,conj:u,depth:1,ctx:h,onNodes:e=>n({conj:u,nodes:e}),onConj:e=>n({conj:e,nodes:l})}),mm(l)&&(0,H.jsx)(`div`,{className:`cg-pop-note`,children:`Ranked among the records your other conditions keep — so “top 10” inside a filtered view means the top 10 of that view. Records with no value are not ranked at all. Quartiles and deciles are equal-size slices BY RANK, not by value.`}),(l.length>0||c)&&(0,H.jsxs)(`div`,{className:`cg-pop-footer cg-builder-footer`,children:[l.length>0&&(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>n({conj:u,nodes:[]}),children:`Clear all`}),c]})]})}function Om({fields:e,hidden:t,onToggle:n,onHideAll:r,onShowAll:i,lockedKey:a,onFieldOrder:o,deletableKeys:s,onDeleteField:c}){let[l,u]=(0,z.useState)(``),[d,f]=(0,z.useState)(null),[p,m]=(0,z.useState)(null),[h,g]=(0,z.useState)(null),_=l.trim().toLowerCase(),v=_?e.filter(e=>e.label.toLowerCase().includes(_)):e,y=!!o&&_===``,b=(t,n)=>{if(t===n||t===a||n===a)return null;let r=e.map(e=>e.key),i=r.indexOf(t),o=r.indexOf(n);if(i<0||o<0)return null;let s=r.slice();return s.splice(i,1),s.splice(o,0,t),s},x=(t,n)=>{if(!y)return;let r=e.map(e=>e.key),i=r[r.indexOf(t)+n];if(i===void 0)return;let a=b(t,i);a&&o(a)};return(0,H.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Hide fields`}),(0,H.jsx)(`input`,{type:`text`,className:`cg-input cg-fields-search`,placeholder:`Find a field…`,"aria-label":`Find a field`,value:l,onChange:e=>u(e.target.value)}),(0,H.jsxs)(`div`,{className:`cg-pop-list`,children:[v.map(e=>{let r=a!==void 0&&e.key===a,i=!t.has(e.key),l=!!c&&!!s?.has(e.key),u=d===e.key;return(0,H.jsxs)(`label`,{className:`cg-check-row`+(i?``:` is-off`)+(r?` is-locked`:``)+(p===e.key?` is-dragging`:``)+(h===e.key&&p!==null&&p!==e.key?` is-drop-target`:``),title:r?`Always visible`:void 0,onDragOver:y&&p&&p!==e.key?t=>{t.preventDefault(),t.dataTransfer.dropEffect=`move`,h!==e.key&&g(e.key)}:void 0,onDrop:y&&p?t=>{t.preventDefault(),t.stopPropagation();let n=b(p,e.key);m(null),g(null),n&&o(n)}:void 0,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-field-grip`,draggable:y&&!r,"aria-label":r?`${e.label} is always first`:y?`Reorder ${e.label} — drag, or use the arrow keys`:`Reorder ${e.label} (clear the search first)`,title:y&&!r?`Drag to reorder, or use the arrow keys`:r?`This column is always first`:`Clear the search to reorder`,onDragStart:t=>{t.dataTransfer.setData(`text/plain`,e.key),t.dataTransfer.effectAllowed=`move`,m(e.key)},onDragEnd:()=>{m(null),g(null)},onClick:e=>{e.preventDefault(),e.stopPropagation()},onKeyDown:t=>{t.key!==`ArrowUp`&&t.key!==`ArrowDown`||(t.preventDefault(),t.stopPropagation(),x(e.key,t.key===`ArrowUp`?-1:1))},children:(0,H.jsx)(`svg`,{width:`10`,height:`16`,viewBox:`0 0 10 16`,"aria-hidden":!0,focusable:`false`,children:[4,8,12].map(e=>[2.5,7.5].map(t=>(0,H.jsx)(`circle`,{cx:t,cy:e,r:`1.15`,fill:`currentColor`},`${t}-${e}`)))})}),(0,H.jsx)(`input`,{type:`checkbox`,checked:i,disabled:r,onChange:()=>n(e.key)}),(0,H.jsx)(Zp,{type:e.type,title:Af[e.type]}),(0,H.jsx)(`span`,{className:`cg-check-label`,children:e.label}),e.source===`odoo`&&!e.custom&&(0,H.jsx)(`span`,{className:`cg-preset-tag`,children:`Pre-set`}),e.scope===`cohort`&&(0,H.jsx)(`span`,{className:`cg-preset-tag cg-scope-tag`,children:`Cohort-only`}),r&&(0,H.jsx)(`span`,{className:`cg-lock-tag`,children:`Locked`}),l&&(0,H.jsx)(`button`,{type:`button`,className:`cg-check-del`+(u?` is-armed`:``),"aria-label":u?`Permanently delete ${e.label}?`:`Delete ${e.label}`,title:u?void 0:`Removes this field and its values on every row.`,onClick:t=>{if(t.preventDefault(),t.stopPropagation(),!u){f(e.key);return}f(null),c(e.key)},children:u?`Delete permanently?`:(0,H.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M3.5 4.5h9M6.5 4.5V3h3v1.5M5 4.5l.6 8.5h4.8l.6-8.5`,stroke:`currentColor`,strokeWidth:1.3,strokeLinecap:`round`,strokeLinejoin:`round`})})})]},e.key)}),v.length===0&&(0,H.jsx)(`div`,{className:`cg-builder-empty`,children:`No field matches your search.`})]}),(i||r)&&(0,H.jsxs)(`div`,{className:`cg-pop-footer cg-fields-footer`,children:[i&&(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:i,children:`Show all`}),r&&(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:r,children:`Hide all`})]})]})}var nie={stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`};function rie(){return(0,H.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M4 6l4 4 4-4`,...nie})})}function km({label:e,icon:t,active:n,tone:r,wide:i,measureWide:a,pairWide:o,forceOpenSignal:s,children:c}){let[l,u]=(0,z.useState)(!1),d=(0,z.useRef)(null),f=(0,z.useId)();return(0,z.useEffect)(()=>{s&&s>0&&u(!0)},[s]),(0,H.jsxs)(`div`,{className:`cg-pop-wrap`,children:[(0,H.jsxs)(`button`,{ref:d,type:`button`,className:`cg-tb-btn`+(r?` cg-tb-btn--${r}`:``)+(n||l?` is-active`:``),onClick:()=>u(e=>!e),"aria-expanded":l,"aria-haspopup":`dialog`,"aria-controls":l?f:void 0,title:e,"aria-label":e,children:[t,(0,H.jsx)(`span`,{className:`cg-tb-label`,children:e}),(0,H.jsx)(rie,{})]}),l&&d.current&&(0,H.jsx)(Yp,{anchor:d.current,className:`cg-pop`+(i?` cg-pop--wide`:``)+(a?` cg-pop--measures`:``)+(o?` cg-pop--pair`:``),onDismiss:()=>u(!1),role:`dialog`,ariaLabel:`${e} options`,id:f,dataKind:`toolbar-${e.split(` `)[0].toLowerCase()}`,children:c(()=>u(!1))})]})}var Am={width:14,height:14,viewBox:`0 0 16 16`,fill:`none`},jm={stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`};function iie(){return(0,H.jsxs)(`svg`,{...Am,"aria-hidden":!0,children:[(0,H.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`,...jm}),(0,H.jsx)(`line`,{x1:`6.5`,y1:`3`,x2:`6.5`,y2:`13`,...jm}),(0,H.jsx)(`line`,{x1:`10.5`,y1:`3`,x2:`10.5`,y2:`13`,...jm})]})}function Mm(){return(0,H.jsx)(`svg`,{...Am,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M2.5 4h11L9.5 9v3.5L6.5 14V9L2.5 4Z`,...jm})})}function Nm(){return(0,H.jsxs)(`svg`,{...Am,"aria-hidden":!0,children:[(0,H.jsx)(`path`,{d:`M5 3v10M5 13l-2-2M5 13l2-2`,...jm}),(0,H.jsx)(`path`,{d:`M11 13V3M11 3l-2 2M11 3l2 2`,...jm})]})}function aie(){return(0,H.jsx)(`svg`,{...Am,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M8 2s4.5 4.2 4.5 7a4.5 4.5 0 0 1-9 0C3.5 6.2 8 2 8 2Z`,...jm})})}function Pm(){return(0,H.jsxs)(`svg`,{...Am,"aria-hidden":!0,children:[(0,H.jsx)(`line`,{x1:`2.5`,y1:`5`,x2:`13.5`,y2:`5`,...jm}),(0,H.jsx)(`line`,{x1:`2.5`,y1:`8`,x2:`13.5`,y2:`8`,...jm}),(0,H.jsx)(`line`,{x1:`2.5`,y1:`11`,x2:`13.5`,y2:`11`,...jm})]})}function Fm(){return(0,H.jsxs)(`svg`,{...Am,"aria-hidden":!0,children:[(0,H.jsx)(`line`,{x1:`2.5`,y1:`4`,x2:`13.5`,y2:`4`,...jm}),(0,H.jsx)(`line`,{x1:`5.5`,y1:`8`,x2:`13.5`,y2:`8`,...jm}),(0,H.jsx)(`line`,{x1:`5.5`,y1:`12`,x2:`13.5`,y2:`12`,...jm})]})}function oie(){return(0,H.jsxs)(`svg`,{...Am,"aria-hidden":!0,children:[(0,H.jsx)(`rect`,{x:`3.5`,y:`7`,width:`9`,height:`6`,rx:`1.2`,...jm}),(0,H.jsx)(`path`,{d:`M5.75 7V5.25a2.25 2.25 0 0 1 4.5 0V7`,...jm})]})}function sie(){return(0,H.jsxs)(`svg`,{...Am,"aria-hidden":!0,children:[(0,H.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4`,...jm}),(0,H.jsx)(`line`,{x1:`10.2`,y1:`10.2`,x2:`13.5`,y2:`13.5`,...jm})]})}var cie={filters:(0,H.jsx)(Mm,{}),sorts:(0,H.jsx)(Nm,{}),groupBy:(0,H.jsx)(Fm,{}),visible:(0,H.jsx)(nm,{}),order:(0,H.jsx)(iie,{}),rowHeightMode:(0,H.jsx)(Pm,{})};function lie({views:e,lockedKey:t,onApply:n,onClose:r}){let[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(()=>new Set([`filters`])),c=e.find(e=>e.id===i),l=e=>s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,H.jsxs)(`div`,{className:`cg-pop-body cg-copycfg`,children:[(0,H.jsxs)(`div`,{className:`cg-copycfg-head`,children:[(0,H.jsx)(`span`,{children:`Copy configuration from`}),(0,H.jsx)(sm,{className:`cg-copycfg-source`,ariaLabel:`View to copy from`,placeholder:`Choose a view…`,value:i||void 0,onChange:a,fields:e.map(e=>({key:e.id,label:e.name,icon:(0,H.jsx)(Qp,{mode:xd(e)})}))}),(0,H.jsx)(`span`,{children:`to this view`})]}),(0,H.jsx)(`div`,{className:`cg-pop-note`,children:`Select what to copy. This view keeps everything else.`}),(0,H.jsx)(`div`,{className:`cg-pop-list`,children:zp.map(e=>(0,H.jsxs)(`label`,{className:`cg-check-row`,title:e.blurb,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:o.has(e.key),onChange:()=>l(e.key)}),(0,H.jsx)(`span`,{className:`cg-mi-ic`,"aria-hidden":!0,children:cie[e.key]}),(0,H.jsx)(`span`,{className:`cg-check-label`,children:e.label})]},e.key))}),(0,H.jsxs)(`div`,{className:`cg-pop-footer cg-copycfg-bulk`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>s(new Set(Bp)),children:`Select all`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>s(new Set),children:`Clear all`})]}),(0,H.jsxs)(`div`,{className:`cg-form-actions cg-copycfg-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!c||o.size===0,title:c?o.size===0?`Choose at least one thing to copy`:void 0:`Choose the view to copy from`,onClick:()=>{c&&(n(kre(c.config,o,t)),r())},children:`Copy configuration`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:r,children:`Cancel`})]})]})}function uie({views:e,lockedKey:t,onApply:n}){let[r,i]=(0,z.useState)(!1),a=(0,z.useRef)(null);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{ref:a,type:`button`,className:`cg-link-btn cg-copy-link`+(r?` is-on`:``),"aria-expanded":r,onClick:()=>i(e=>!e),children:`Copy from another view`}),r&&a.current&&(0,H.jsx)(Yp,{anchor:a.current,className:`cg-pop cg-copycfg-pop`,placement:`bottom-end`,onDismiss:()=>i(!1),role:`dialog`,ariaLabel:`Copy configuration from another view`,dataKind:`copy-config`,children:(0,H.jsx)(lie,{views:e,lockedKey:t,onApply:n,onClose:()=>i(!1)})})]})}function die({fields:e,fieldByKey:t,sorts:n,onSorts:r}){let i=(e,t)=>r(n.map((n,r)=>r===e?{...n,...t}:n)),a=e=>r(n.filter((t,n)=>n!==e));return(0,H.jsxs)(`div`,{className:`cg-pop-body cg-builder`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Sort`}),n.length===0&&(0,H.jsx)(`div`,{className:`cg-builder-empty`,children:`No sorts. Add one to order the list.`}),n.map((n,r)=>{let o=t.get(n.colId)?.type??`text`;return(0,H.jsxs)(`div`,{className:`cg-cond-line`,children:[(0,H.jsx)(`span`,{className:`cg-cond-prefix`,children:r===0?`Sort by`:`then by`}),(0,H.jsxs)(`span`,{className:`cg-cond-row`,children:[(0,H.jsx)(sm,{className:`cg-cond-field`,ariaLabel:`Sort field`,value:n.colId,onChange:e=>i(r,{colId:e}),fields:e.map(e=>({key:e.key,label:e.label,type:e.type}))}),(0,H.jsxs)(`select`,{className:`cg-select cg-cond-op`,value:n.dir,"aria-label":`Sort direction`,onChange:e=>i(r,{dir:e.target.value}),children:[(0,H.jsx)(`option`,{value:`asc`,children:ad(o,`asc`)}),(0,H.jsx)(`option`,{value:`desc`,children:ad(o,`desc`)})]}),(0,H.jsx)(`button`,{type:`button`,className:`cg-cond-x`,"aria-label":`Remove sort`,onClick:()=>a(r),children:`×`})]})]},r)}),(0,H.jsxs)(`div`,{className:`cg-pop-footer cg-builder-footer`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>{let t=new Set(n.map(e=>e.colId)),i=e.find(e=>!t.has(e.key))??e[0];i&&r([...n,{colId:i.key,dir:`asc`}])},children:`+ Add another sort`}),n.length>0&&(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>r([]),children:`Clear`})]})]})}var fie=[{mode:`short`,label:`Short`},{mode:`medium`,label:`Medium`},{mode:`tall`,label:`Tall`}];function pie({fields:e,visible:t,nouns:n=`customers`,lockedKey:r,onColumnVisible:i,onColumnsVisible:a,orderedFields:o,onFieldOrder:s,deletableKeys:c,onDeleteField:l,colorOn:u,onToggleColor:d,rowHeightMode:f,onRowHeightMode:p,filters:m,onFilters:h,filterConj:g,onFilterConj:_,sorts:v,onSorts:y,groupBy:b,onGroupBy:x,statusValues:S,measures:C=[],pendingMeasureCount:w=0,unresolvedCount:T=0,lists:E=[],cohortLock:D,copyViews:O,onCopyConfig:k,search:A,onSearch:j,recordCount:M,scopeCounts:N,pool:P,serverWindowed:F=!1,cohortAction:ee,filterSeed:I=null,modeControl:te}){let L=e.filter(e=>t.has(e.key)).length,ne=(0,z.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.key,n);return t},[e]),re=(0,z.useMemo)(()=>{let e=new Map;for(let t of C)e.set(t.key,t);return e},[C]),ie=o??e,ae=(0,z.useMemo)(()=>new Set(ie.filter(e=>!t.has(e.key)).map(e=>e.key)),[ie,t]),oe=(0,z.useMemo)(()=>({conj:g,nodes:m}),[g,m]),se=e=>{let t=gd(e),n=_d(e);t!==m&&h(t),n!==g&&_(n)},ce=!!D,le=!!k&&(O?.length??0)>0,ue=(0,z.useMemo)(()=>e.filter(e=>Iee(e,r)),[e,r]),de=(0,z.useRef)(0);(0,z.useEffect)(()=>{if(!I||I.n===de.current)return;if(de.current=I.n,I.measure){let e=re.get(I.measure.key);if(!e)return;h([...m,{id:Cm(),colId:e.key,op:gm[0],value:``,window:I.measure.window}]);return}let e=I.key?ne.get(I.key):void 0;!e||e.filterable===!1||h([...m,{colId:e.key,op:pm(e.type)[0],value:``}])},[I,ne,re,m,h]);let fe=(0,z.useMemo)(()=>Tm(m),[m]),pe=(0,z.useMemo)(()=>{let e=t=>t.some(t=>hd(t)?e(t.children):t.rhs!=null&&t.rhs.kind!==`stat`);return e(m)},[m]),me=fe?`Filter · ${fe}`:`Filter`,he=v.length?`Sort · ${v.length}`:`Sort`,ge=b?`Group: ${ne.get(b)?.label??`?`}`:`Group`;return(0,H.jsxs)(`div`,{className:`cg-toolbar`,children:[te,(0,H.jsx)(km,{label:`Hide fields`,icon:(0,H.jsx)(nm,{}),active:L(0,H.jsx)(Om,{fields:ie,hidden:ae,onToggle:e=>i(e,!t.has(e)),onShowAll:()=>a(e.map(e=>e.key)),onHideAll:()=>a([r]),lockedKey:r,onFieldOrder:s,deletableKeys:c,onDeleteField:l})}),(0,H.jsx)(km,{label:me,icon:(0,H.jsx)(Mm,{}),active:fe>0,tone:`filter`,wide:!0,measureWide:C.length>0,pairWide:pe,forceOpenSignal:I?.n,children:()=>(0,H.jsx)(Dm,{fields:e,measures:C,cohorts:E,filters:oe,onChange:se,statusValues:S,cohortLock:D,footerExtra:le?(0,H.jsx)(uie,{views:O,lockedKey:r,onApply:e=>k(e)}):void 0})}),(0,H.jsx)(km,{label:he,icon:(0,H.jsx)(Nm,{}),active:v.length>0,tone:`sort`,wide:!0,children:()=>(0,H.jsx)(die,{fields:e,fieldByKey:ne,sorts:v,onSorts:y})}),(0,H.jsx)(km,{label:ge,icon:(0,H.jsx)(Fm,{}),active:b!==null,tone:`group`,children:()=>(0,H.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Group by`}),F?(0,H.jsx)(`div`,{className:`cg-pop-note`,children:`Not available on this table. It loads one page at a time, so a group would count only the rows currently fetched.`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`cg-group`,checked:b===null,onChange:()=>x(null)}),(0,H.jsx)(`span`,{children:`No grouping`})]}),ue.map(e=>(0,H.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`cg-group`,checked:b===e.key,onChange:()=>x(e.key)}),(0,H.jsx)(Zp,{type:e.type,title:Af[e.type]}),(0,H.jsx)(`span`,{children:e.label})]},e.key))]})]})}),(0,H.jsx)(`span`,{className:`cg-tb-divider`,"aria-hidden":!0}),(0,H.jsx)(km,{label:`Color`,icon:(0,H.jsx)(aie,{}),active:u,children:()=>(0,H.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Color`}),(0,H.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`cg-color`,checked:!u,onChange:()=>d(!1)}),(0,H.jsx)(`span`,{children:`No color`})]}),(0,H.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`cg-color`,checked:u,onChange:()=>d(!0)}),(0,H.jsx)(`span`,{children:`Color by status`})]})]})}),(0,H.jsx)(km,{label:`Rows`,icon:(0,H.jsx)(Pm,{}),active:f!==`short`,children:()=>(0,H.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Row height`}),fie.map(e=>(0,H.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`cg-rowh`,checked:f===e.mode,onChange:()=>p(e.mode)}),(0,H.jsx)(`span`,{children:e.label})]},e.mode))]})}),ce&&(0,H.jsxs)(`span`,{className:`cg-tb-lock`,title:(D?.name?`Locked to ${D.name}. `:`Locked to a set of records you cannot see. `)+`Only the records locked into that view are shown. Filters and sort narrow WITHIN the lock; the lock itself is changed from the view menu in the rail.`,children:[(0,H.jsx)(oie,{}),(0,H.jsx)(`span`,{className:`cg-tb-label`,children:`Locked`})]}),(0,H.jsxs)(`div`,{className:`cg-search`,children:[(0,H.jsx)(`span`,{className:`cg-search-icon`,"aria-hidden":!0,children:(0,H.jsx)(sie,{})}),(0,H.jsx)(`input`,{type:`text`,className:`cg-search-input`,placeholder:`Search ${n}…`,value:A,onChange:e=>j(e.target.value)}),A&&(0,H.jsx)(`button`,{type:`button`,className:`cg-search-clear`,"aria-label":`Clear search`,onClick:()=>j(``),children:`×`})]}),ee,(0,H.jsx)(`span`,{className:`cg-tb-spacer`}),w>0&&(0,H.jsx)(`span`,{className:`cg-count cg-count-pending`,title:`${w} measure condition${w===1?``:`s`} still being calculated over the period you chose. Rows are hidden until the answer arrives rather than shown under a count that would be wrong.`,children:`Calculating…`}),T>0&&(0,H.jsx)(`span`,{className:`cg-count cg-count-pending`,title:`${T} condition${T===1?``:`s`} cannot be evaluated — a date that does not resolve, or a list this view refers to that no longer exists. Rows are hidden rather than shown under a count that would be wrong.`,children:`Filter unresolved`}),lm(P)==null?(0,H.jsxs)(`span`,{className:`cg-count`,title:cm(M,N),children:[(0,H.jsx)(`span`,{className:`cg-count-full`,children:cm(M,N)}),(0,H.jsx)(`span`,{className:`cg-count-compact`,children:Bre(M,N)})]}):(0,H.jsxs)(`span`,{className:`cg-count cg-count-partial`,title:`Loading the rest of your ${n} in the background — you can browse, filter and sort what is already here.`,children:[(0,H.jsx)(`span`,{className:`lp-spin`,role:`status`,"aria-label":`Loading`}),lm(P)]})]})}function Im({on:e}){return(0,H.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 20 20`,"aria-hidden":!0,children:(0,H.jsx)(`polygon`,{points:`10,1.8 12.5,7.2 18.4,7.7 13.9,11.6 15.3,17.4 10,14.3 4.7,17.4 6.1,11.6 1.6,7.7 7.5,7.2`,fill:e?`#A98A3E`:`none`,stroke:e?`#A98A3E`:`rgba(118,143,182,0.55)`,strokeWidth:`1.2`,strokeLinejoin:`round`})})}function mie({value:e,max:t}){return(0,H.jsx)(`span`,{className:`cg-stars cg-stars--static`,"aria-label":`${e} of ${t}`,children:Array.from({length:t},(t,n)=>(0,H.jsx)(Im,{on:n=0?n.splice(r,1):n.push(t),vie(n)}function Bm(e,t,n){let r=e.type===`user`?t??[]:Qu(e),i=r.map(e=>({value:e,label:e})),a=e.type===`multiselect`?zm(n):[Lm(n).trim()];for(let e of a)e===``||r.includes(e)||i.push({value:e,label:`${e} (no longer a choice)`,stale:!0});return i}function Vm(e){let t=Lm(e).trim();if(t===``)return``;let n=Number(t);return Number.isFinite(n)?String(n):``}function bie(e){let t=e.trim();if(t===``)return``;let n=Number(t);return Number.isFinite(n)?t:null}function Hm(e,t){let n=Math.round(Number(Lm(t)));return Number.isFinite(n)?Math.max(0,Math.min($u(e),n)):0}function xie(e,t,n){let r=Hm(e,t),i=Math.max(1,Math.min($u(e),Math.round(n)));return i===r?``:String(i)}function Sie(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length?t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase():`?`}var Cie=new Set([`sum`,`count`]);function wie(e){return Cie.has(e)}var Um=`month`;function Wm(e){let t=ed.includes(e.bucket??``)?e.bucket:Um,n=e.span??{},r;return r=typeof n.lastN==`number`&&Number.isFinite(n.lastN)?{lastN:Math.max(1,Math.min(120,Math.round(n.lastN)))}:n.from||n.to?{from:n.from,to:n.to}:{lastN:12},{pids:e.pids,bucket:t,span:r,fields:e.fields.slice(0,12)}}function Gm(e,t){return e==null||t==null||t===0||!Number.isFinite(e)||!Number.isFinite(t)?null:(e-t)/Math.abs(t)*100}function Km(e){return e.toLocaleString(void 0,{maximumFractionDigits:2})}function Tie(e,t){return e==null?`—`:t?t(e):String(e)}function qm(e){return e==null?``:Km(e)}function Jm(e,t){return e==null?``:t?Ym(e):`${e>0?`+`:``}${Km(e)}`}function Ym(e){return e==null?`—`:`${e>0?`+`:``}${e.toFixed(1)}%`}function Eie(e){switch(e){case`not_a_measure_field`:return`not a measure — only measure fields have a time dimension`;case`unresolvable`:return`a composite measure has no single aggregate to bucket`;case`window_fixed`:return`its period is a fixed date range, so it cannot slide across buckets`;default:return e}}function Xm(e){if(!e)return{columns:[],rows:[],notes:[],pool:0,empty:!0};let t=e.columns??[],n=(e.rows??[]).map(e=>{let n=e.values??[],r=t.map((e,t)=>({value:n[t]??null,delta:Gm(n[t]??null,t>0?n[t-1]??null:null),partial:e.partial===!0})),i=wie(e.agg)&&typeof e.total==`number`&&Number.isFinite(e.total)?e.total:void 0;return{field:e.field,label:e.label,agg:e.agg,cells:r,total:i,allUnanswered:r.length>0&&r.every(e=>e.value==null),window:e.window}}),r=[],i=e.meta??{pool:0};for(let e of i.dropped??[])r.push(`${e.field} is not shown — ${Eie(e.reason)}.`);for(let e of i.problems??[])r.push(e);let a=t.filter(e=>e.partial).length;a>0&&r.push(a===1?`The last column is a partial period — it is still filling.`:`${a} columns are partial periods — they are still filling.`);let o=n.filter(e=>e.allUnanswered).length;return o>0&&r.push(`${o} of ${n.length} metrics returned no values for this span (shown as "—").`),{columns:t,rows:n,notes:r,pool:i.pool??0,empty:n.length===0}}var Die=new Set([`currency`,`int`,`pct`]),Oie=/(^|_)days(_|$)/;function kie(e){return e.agg===`sum`||e.agg===`count`?`sum`:e.agg===`avg`||e.type===`pct`||Oie.test(e.key)?`avg`:`sum`}function Zm(e){return e.measure&&typeof e.measure==`object`?`server`:Die.has(e.type)?`snapshot`:`refused`}function Aie(e){return e.formula?`a formula column has no time dimension of its own`:`${e.type} is not a number, so it has nothing to plot over time`}function jie(e,t,n,r){let i=kie(e),a=0,o=0;for(let n of t){let t=n?.[e.key];if(t==null||t===``)continue;let r=typeof t==`number`?t:Number(t);Number.isFinite(r)&&(a+=r,o+=1)}let s=o===0?null:i===`avg`?a/o:a,c=n.map(e=>({value:s,delta:null,partial:e.partial===!0}));return{field:e.key,label:e.label,agg:`snapshot`,cells:c,total:void 0,allUnanswered:s==null,window:{kind:`snapshot`,label:r?`Snapshot · the current value as of ${r}, not per period`:`Snapshot · the current value, not per period`}}}function Mie(e,t){return`${e.length===1?e[0]:`${e.length} rows`} ${e.length===1?`has`:`have`} no time dimension, so ${e.length===1?`it is`:`they are`} shown as the current value${t?` as of ${t}`:``} repeated across every period — a flat line here means "not measured over time", not "unchanged". No total and no comparison is offered for ${e.length===1?`it`:`them`}.`}function Nie(e){let t=[],n=0;for(;nt[n],i=e=>{let t=r();return t&&t.k===`op`&&t.v===e?(n+=1,!0):!1};function a(){let e=r();if(!e)return null;if(e.k===`num`)return n+=1,{t:`num`,v:e.v};if(e.k===`ref`)return n+=1,{t:`ref`,name:e.name};if(i(`(`)){let e=c();return!e||!i(`)`)?null:e}return null}function o(){if(i(`-`)){let e=o();return e?{t:`neg`,a:e}:null}return i(`+`)?o():a()}function s(){let e=o();if(!e)return null;for(;;){let t=r();if(!t||t.k!==`op`||t.v!==`*`&&t.v!==`/`)return e;n+=1;let i=o();if(!i)return null;e={t:`bin`,op:t.v,a:e,b:i}}}function c(){let e=s();if(!e)return null;for(;;){let t=r();if(!t||t.k!==`op`||t.v!==`+`&&t.v!==`-`)return e;n+=1;let i=s();if(!i)return null;e={t:`bin`,op:t.v,a:e,b:i}}}let l=c();return l&&n===t.length?l:null}function Fie(e,t){let n,r=e=>{switch(e.t){case`num`:return e.v;case`ref`:{let r=t(e.name);return r===void 0?(n??=`unknown_ref`,null):r}case`neg`:{let t=r(e.a);return t==null?null:-t}case`bin`:{let t=r(e.a),i=r(e.b);if(t==null||i==null)return null;if(e.op===`+`)return t+i;if(e.op===`-`)return t-i;if(e.op===`*`)return t*i;if(i===0)return n??=`div_zero`,null;let a=t/i;return Number.isFinite(a)?a:null}}},i=r(e);return n?{value:null,error:n}:{value:i}}function Iie(e,t){switch(t){case`syntax`:return`${e}: that formula could not be read — use + - * / ( ) with numbers and [row] references.`;case`unknown_ref`:return`${e}: a row it refers to is not on this sheet, so it is left blank rather than treated as zero.`;case`cycle`:return`${e}: it refers back to itself, so it has no value.`;case`div_zero`:return`${e}: divided by zero in at least one period — those cells are blank, not zero.`}}var Qm={week:52,month:12,quarter:4,year:1},$m={abs:`Change`,pct:`Change %`,yoy:`vs last year`,ytd:`YTD growth`};function Lie(e){return e!==`abs`}function eh(e,t,n){let r=e.cells.map(e=>e.value),i=Qm[n]??12,a=[];for(let n of t){let t=Lie(n),o,s;n===`abs`?s=r.map((e,t)=>t===0||e==null||r[t-1]==null?null:e-r[t-1]):n===`pct`?s=r.map((e,t)=>Gm(e,t>0?r[t-1]:null)):n===`yoy`||e.window?.kind===`ytd`?(s=r.map((e,t)=>Gm(e,t>=i?r[t-i]:null)),r.length<=i&&(o=`This span is shorter than a year, so there is no earlier period to compare against.`)):(s=r.map(()=>null),o=e.window==null?`Year-to-date growth needs the metric's own period, which this server did not report.`:`Year-to-date growth is only meaningful on a year-to-date metric — this one is "${e.window.label}".`),a.push({kind:n,label:$m[n],percent:t,values:s,refusal:o})}return a}function Rie(e,t){let n=Qm[t]??12,r={value:null,delta:null,partial:!1},i=e.cells.map((t,i)=>i>=n?e.cells[i-n]:r),a=e.cells.length<=n?`This span is shorter than a year, so there is no earlier period to compare against.`:void 0;return{label:`${e.label} (last year)`,cells:a?[]:i,back:n,refusal:a}}function th(e,t,n){if(!e)return{};let r=e[t],i=n?e[`${t}:${n}`]:void 0;return!r&&!i?{}:{...r,...i}}function zie(e,t,n){let r=e.filter(e=>e!=null&&Number.isFinite(e));if(r.length<2)return[];let i=Math.min(...r),a=Math.max(...r)-i,o=e.length>1?t/(e.length-1):0,s=[],c=[];return e.forEach((e,t)=>{if(e==null||!Number.isFinite(e)){c.length>1&&s.push({points:c}),c=[];return}let r=a===0?n/2:n-(e-i)/a*n;c.push({x:t*o,y:r})}),c.length>1&&s.push({points:c}),s}function Bie(e){return e.points.map(e=>`${Math.round(e.x*10)/10},${Math.round(e.y*10)/10}`).join(` `)}function nh(e){return e.trim().toLowerCase()}function Vie(e,t){let n=[...e.notes],r=t.deltas??[],i=(t.customRows??[]).filter(e=>e&&typeof e.id==`string`),a=new Map,o=new Map;e.rows.forEach((e,t)=>{a.has(e.field)||a.set(e.field,{kind:`metric`,index:t});let n=nh(e.label);n&&!o.has(n)&&o.set(n,{kind:`metric`,index:t})}),i.forEach((e,t)=>{if(e.kind!==`formula`)return;a.has(e.id)||a.set(e.id,{kind:`formula`,index:t});let n=nh(e.label);n&&!o.has(n)&&o.set(n,{kind:`formula`,index:t})});let s=i.map(e=>e.kind===`formula`?Pie(e.expr??``):null),c=new Map,l=new Map,u=(t,n)=>{let r=c.get(t);if(r)return r;let i=e.columns.length;if(n.has(t))return l.set(t,`cycle`),Array(i).fill(null);let d=s[t];if(!d){l.set(t,`syntax`);let e=Array(i).fill(null);return c.set(t,e),e}n.add(t);let f=[];for(let r=0;r{let i=a.get(t.trim())??o.get(nh(t));if(i)return i.kind===`metric`?e.rows[i.index]?.cells[r]?.value??null:u(i.index,n)[r]??null});i.error&&!l.has(t)&&l.set(t,i.error),f.push(i.value)}return n.delete(t),c.set(t,f),f},d=e.rows.map(e=>({id:e.field,kind:`metric`,label:e.label,sublabel:e.window?.label,agg:e.agg,cells:e.cells,total:e.total,deltas:e.agg===`snapshot`?[]:eh(e,r,t.bucket),allUnanswered:e.allUnanswered})),f=e.rows.filter(e=>e.agg===`snapshot`);f.length>0&&n.push(Mie(f.map(e=>e.label),t.today)),i.forEach((i,a)=>{if(i.kind===`note`){d.push({id:i.id,kind:`note`,label:i.label,cells:e.columns.map(e=>({value:null,delta:null,partial:e.partial===!0})),deltas:[],allUnanswered:!1});return}let o=u(a,new Set),s=e.columns.map((e,t)=>({value:o[t]??null,delta:Gm(o[t]??null,t>0?o[t-1]??null:null),partial:e.partial===!0})),c=l.get(a);c&&n.push(Iie(i.label||i.id,c)),d.push({id:i.id,kind:`formula`,label:i.label,expr:i.expr,cells:s,deltas:eh({cells:s,window:void 0},r,t.bucket),allUnanswered:s.length>0&&s.every(e=>e.value==null)})});let p=new Set;for(let e of d)for(let t of e.deltas)t.refusal&&p.add(t.refusal);for(let e of p)n.push(e);return{columns:e.columns,rows:d,notes:n,pool:e.pool,empty:d.length===0}}function rh(e,t){let n=e.cells.map((e,n)=>({cell:e,col:t[n]})).filter(e=>e.col&&e.cell.value!=null).map(t=>({key:t.col.key,label:t.col.label,value:t.cell.value,n:1,seriesKey:e.field,seriesLabel:e.label}));return{points:n,xOrder:t.map(e=>e.key),seriesOrder:[e.field],omitted:0,omittedValue:0,omittedSeries:0,omittedSeriesValue:0,blanks:e.cells.filter(e=>e.value==null).length,missingY:0,rows:n.length,nonPositive:0,nonPositiveValue:0}}function Hie(e,t,n,r){let i=Rie(e,n),a=Math.max(1,Math.min(Math.round(r),t.length)),o=t.length-a,s=t.slice(o),c=`${e.field}::prior_year`,l=(e,t,n)=>s.map((t,n)=>({col:t,cell:e[o+n]})).filter(e=>e.cell&&e.cell.value!=null).map(e=>({key:e.col.key,label:e.col.label,value:e.cell.value,n:1,seriesKey:t,seriesLabel:n})),u=l(e.cells,e.field,e.label),d=i.refusal?[]:l(i.cells,c,i.label);return{points:[...u,...d],xOrder:s.map(e=>e.key),seriesOrder:i.refusal?[e.field]:[e.field,c],omitted:0,omittedValue:0,omittedSeries:0,omittedSeriesValue:0,blanks:e.cells.slice(o).filter(e=>e.value==null).length,missingY:0,rows:u.length,nonPositive:0,nonPositiveValue:0}}function ih(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function Uie(e){let t=[[`Metric`,...e.columns.map(e=>e.label),`Total`].map(ih).join(`,`)];for(let n of e.rows){t.push([ih(n.sublabel?`${n.label} (${n.sublabel})`:n.label),...n.cells.map(e=>ih(qm(e.value))),ih(qm(n.total??null))].join(`,`));for(let e of n.deltas)t.push([ih(`${n.label} — ${e.label}${e.percent?` (%)`:``}`),...e.values.map(t=>ih(Jm(t,e.percent))),``].join(`,`))}if(e.notes.length>0){t.push(``);for(let n of e.notes)t.push(ih(n))}return t.join(`\r `)+`\r -`}function Uie(e){let t=(e,t)=>({key:e,label:t,type:`text`,source:`odoo`}),n=[t(`metric`,`Metric`),...e.columns.map(e=>t(`c_${e.key}`,e.partial?`${e.label} (partial)`:e.label)),t(`total`,`Total`)],r=[],i=(t,n,i)=>{let a={pid:r.length+1,metric:t,total:i};e.columns.forEach((e,t)=>{a[`c_${e.key}`]=n[t]??``}),r.push(a)};for(let t of e.rows){i(t.sublabel?`${t.label} (${t.sublabel})`:t.label,t.cells.map(e=>qm(e.value)),qm(t.total??null));for(let e of t.deltas)i(`${t.label} — ${e.label}${e.percent?` (%)`:``}`,e.values.map(t=>Jm(t,e.percent)),``)}if(e.notes.length>0){i(``,[],``);for(let t of e.notes)i(t,[],``)}return{fields:n,rows:r}}var Wie={brand:[`#1F4E78`,`#C8A24B`,`#6F96B8`,`#E0C979`,`#3E6F98`,`#A17C2D`],categorical:[`#2F6B9A`,`#C28A2C`,`#4C8A68`,`#8A5C9D`,`#C25B56`,`#4B8793`,`#8B704A`,`#6A78A8`,`#A45D7D`,`#708B3D`,`#B66B32`,`#52749C`],sequential:[`#E7F0F7`,`#C5D9E9`,`#9CBCD5`,`#719DBE`,`#477CA3`,`#1F4E78`],diverging:[`#2F6B9A`,`#7EA5C3`,`#D8E4ED`,`#F0E6C6`,`#D5B66A`,`#9B7222`]};function Gie(e){switch(e.axis?.y?.format){case`number`:return{format:`,.2~f`};case`currency`:return{format:`$,.0f`};case`percent`:return{labelExpr:`format(datum.value, ',.2~f') + '%'`};case`compact`:return{format:`~s`};default:return{}}}function Kie(e,t){let n=new Map(e.xOrder.map((e,t)=>[e,t])),r=new Map(e.seriesOrder.map((e,t)=>[e,t]));return e.points.map(e=>({xKey:e.key,xLabel:e.label,xIndex:n.get(e.key)??0,value:e.value,valueText:t(e.value),n:e.n,seriesKey:e.seriesKey,seriesLabel:e.seriesLabel,seriesIndex:r.get(e.seriesKey)??0}))}function qie(){return{font:`Inter, ui-sans-serif, system-ui, sans-serif`,view:{stroke:null},axis:{labelColor:`#536273`,labelFont:`Inter, ui-sans-serif, system-ui, sans-serif`,labelFontSize:10,labelLimit:110,titleColor:`#344355`,titleFont:`Inter, ui-sans-serif, system-ui, sans-serif`,titleFontSize:11,titleFontWeight:500,gridColor:`#E7EBEF`,domainColor:`#C9D1D9`,tickColor:`#C9D1D9`},legend:{labelColor:`#536273`,labelFont:`Inter, ui-sans-serif, system-ui, sans-serif`,labelFontSize:10,titleColor:`#344355`,titleFont:`Inter, ui-sans-serif, system-ui, sans-serif`,titleFontSize:10,symbolType:`circle`,orient:`bottom`,direction:`horizontal`}}}function Jie(e,t){return{$schema:`https://vega.github.io/schema/vega-lite/v6.json`,data:{values:t},width:`container`,height:`container`,autosize:{type:`fit`,contains:`padding`,resize:!0},padding:4,config:qie(),usermeta:{rendererBoundary:`aios-chart-spec-v1`,chartId:e.id}}}function ah(e){return[{field:`xLabel`,type:`nominal`,title:`Group`},...e?[{field:`seriesLabel`,type:`nominal`,title:`Series`}]:[],{field:`valueText`,type:`nominal`,title:`Value`},{field:`n`,type:`quantitative`,title:`Records`,format:`,`}]}function oh({spec:e,model:t,xTitle:n,yTitle:r,formatValue:i}){let a=Kie(t,i).filter(t=>e.kind!==`donut`||t.value>0),o=[...Wie[e.palette??`brand`]],s=t.seriesOrder.length>0,c=s?{field:`seriesLabel`,type:`nominal`,title:null,sort:{field:`seriesIndex`,op:`min`},scale:{range:o},legend:{columns:4}}:{value:o[0]},l={field:`xLabel`,type:`nominal`,title:n??null,sort:{field:`xIndex`,op:`min`,order:`ascending`},axis:{labelAngle:t.xOrder.length>7?-35:0,labelOverlap:`greedy`}},u={field:`value`,type:`quantitative`,title:r??null,axis:Gie(e)},d=Jie(e,a);if(e.kind===`kpi`)return{...d,mark:{type:`text`,align:`center`,baseline:`middle`,font:`Inter, ui-sans-serif, system-ui, sans-serif`,fontSize:32,fontWeight:600,color:`#172433`},encoding:{text:{field:`valueText`,type:`nominal`},tooltip:[{field:`valueText`,type:`nominal`,title:`Value`},{field:`n`,type:`quantitative`,title:`Records`,format:`,`}]}};if(e.kind===`donut`)return{...d,mark:{type:`arc`,innerRadius:44,outerRadius:76,cornerRadius:2,padAngle:.01},encoding:{theta:{field:`value`,type:`quantitative`,stack:!0},color:{field:`xLabel`,type:`nominal`,title:null,sort:{field:`xIndex`,op:`min`},scale:{range:o},legend:{orient:`right`,direction:`vertical`,labelLimit:110}},order:{field:`xIndex`,type:`quantitative`},tooltip:ah(!1)}};let f={x:l,y:{...u,stack:(e.kind===`bar`||e.kind===`area`)&&s?e.stacked?`zero`:null:void 0},color:c,tooltip:ah(s)};return s&&e.kind===`bar`&&!e.stacked&&(f.xOffset={field:`seriesLabel`,type:`nominal`,sort:{field:`seriesIndex`,op:`min`}}),(e.kind===`line`||e.kind===`area`)&&(f.order={field:`xIndex`,type:`quantitative`},s&&(f.detail={field:`seriesKey`,type:`nominal`})),{...d,mark:e.kind===`bar`?{type:`bar`,cornerRadiusTopLeft:2,cornerRadiusTopRight:2}:e.kind===`area`?{type:`area`,opacity:s?.68:.48,line:!0,point:!0}:{type:`line`,strokeWidth:2,point:{filled:!0,size:46}},encoding:f}}function sh(e,t={}){let n=JSON.stringify([1],void 0,t.indent===void 0?2:t.indent).slice(2,-3),r=n===``?1/0:t.maxLength===void 0?80:t.maxLength,{replacer:i}=t;return(function e(t,a,o){t&&typeof t.toJSON==`function`&&(t=t.toJSON());let s=JSON.stringify(t,i);if(s===void 0)return s;let c=r-a.length-o;if(s.length<=c){let e=s.replace(ch,(e,t)=>t||`${e} `);if(e.length<=c)return e}if(i!=null&&(t=JSON.parse(s),i=void 0),typeof t==`object`&&t){let r=a+n,i=[],o=0,s,c;if(Array.isArray(t)){s=`[`,c=`]`;let{length:n}=t;for(;o0)return[s,n+i.join(`,\n${r}`),c].join(`\n${a}`)}return s})(e,``,0)}var ch,Yie=o((()=>{ch=/("(?:[^\\"]|\\.)*")|[:,]/g}));function lh(e,t,n){return Object.assign(e,{fields:t||[],fname:n})}function uh(e){return e==null?null:e.fname}function dh(e){return e==null?null:e.fields}var fh=o((()=>{}));function ph(e){return e.length===1?mh(e[0]):hh(e)}var mh,hh,gh=o((()=>{mh=e=>function(t){return t[e]},hh=e=>{let t=e.length;return function(n){for(let r=0;r{}));function vh(e){let t=[],n=e.length,r=null,i=0,a=``,o,s,c;e+=``;function l(){t.push(a+e.substring(o,s)),a=``,o=s+1}for(o=s=0;so?l():o=s+1:c===`[`?(s>o&&l(),i=o=s+1):c===`]`&&(i||U(`Access path missing open bracket: `+e),i>0&&l(),i=0,o=s+1);return i&&U(`Access path missing closing bracket: `+e),r&&U(`Access path missing closing quote: `+e),s>o&&(s++,l()),t}var yh=o((()=>{_h()}));function bh(e,t,n){let r=vh(e),i=r.length===1?r[0]:e;return lh((n&&n.get||ph)(r),[i],t||i)}var xh=o((()=>{fh(),gh(),yh()})),Sh,Ch,wh,Th,Eh,Dh,Xie=o((()=>{fh(),xh(),Sh=bh(`id`),Ch=lh(e=>e,[],`identity`),wh=lh(()=>0,[],`zero`),Th=lh(()=>1,[],`one`),Eh=lh(()=>!0,[],`true`),Dh=lh(()=>!1,[],`false`)})),Oh,Zie=o((()=>{Oh=new Set([...Object.getOwnPropertyNames(Object.prototype).filter(e=>typeof Object.prototype[e]==`function`),`__proto__`])}));function Qie(e,t,n){let r=[t,...n];console[e](...r)}function kh(e,t,n=Qie){let r=e||0;return{level(e){return arguments.length?(r=+e,this):r},error(...e){return r>=1&&n(t||`error`,`ERROR`,e),this},warn(...e){return r>=2&&n(t||`warn`,`WARN`,e),this},info(...e){return r>=3&&n(t||`log`,`INFO`,e),this},debug(...e){return r>=4&&n(t||`log`,`DEBUG`,e),this}}}var $ie=o((()=>{})),W,Ah=o((()=>{W=Array.isArray}));function jh(e){return e===Object(e)}var Mh=o((()=>{}));function Nh(...e){return e.reduce((e,t)=>{for(let n in t)if(n===`signals`)e.signals=eae(e.signals,t.signals);else{let r=n===`legend`?{layout:1}:n===`style`||null;Ph(e,n,t[n],r)}return e},{})}function Ph(e,t,n,r){if(!Fh(t))return;let i=e,a,o;if(jh(n)&&!W(n)){let e=n;for(a in o=jh(i[t])?i[t]:i[t]={},e)r&&(r===!0||r[a])?Ph(o,a,e[a]):Fh(a)&&(o[a]=e[a])}else i[t]=n}function eae(e,t){if(e==null)return t;if(t==null)return e;let n={},r=[];function i(e){n[e.name]||(n[e.name]=1,r.push(e))}return t.forEach(i),e.forEach(i),r}var Fh,tae=o((()=>{Ah(),Mh(),Fh=e=>e!==`__proto__`&&e!==`constructor`&&e!==`prototype`}));function Ih(e){return e[e.length-1]}var Lh=o((()=>{}));function Rh(e){return e==null||e===``?null:+e}var nae=o((()=>{}));function rae(e){return e.length>0}function zh(e,t,n,r){rae(e)||U(`Domain array must not be empty`);let i=n(e[0]),a=n(Ih(e)),o=(a-i)*t;return[r(i-o),r(a-o)]}function iae(e,t){return zh(e,t,Xh,Zh)}function aae(e,t){let n=Math.sign(e[0]);return zh(e,t,Kh(n),Gh(n))}function oae(e,t,n){return zh(e,t,Yh(n),Yh(1/n))}function sae(e,t,n){return zh(e,t,qh(n),Jh(n))}function Bh(e,t,n,r,i){rae(e)||U(`Domain array must not be empty`);let a=r(e[0]),o=r(Ih(e)),s=t==null?(a+o)/2:r(t);return[i(s+(a-s)*n),i(s+(o-s)*n)]}function Vh(e,t,n){return Bh(e,t,n,Xh,Zh)}function Hh(e,t,n){let r=Math.sign(e[0]);return Bh(e,t,n,Kh(r),Gh(r))}function Uh(e,t,n,r){return Bh(e,t,n,Yh(r),Yh(1/r))}function Wh(e,t,n,r){return Bh(e,t,n,qh(r),Jh(r))}var Gh,Kh,qh,Jh,Yh,Xh,Zh,cae=o((()=>{_h(),Lh(),nae(),Gh=e=>t=>e*Math.exp(t),Kh=e=>t=>Math.log(e*t),qh=e=>t=>Math.sign(t)*Math.log1p(Math.abs(t/e)),Jh=e=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*e,Yh=e=>t=>t<0?-((-t)**+e):t**+e,Xh=e=>Rh(e)??0,Zh=e=>e}));function lae(e){return 1+~~(new Date(e).getMonth()/3)}function uae(e){return 1+~~(new Date(e).getUTCMonth()/3)}var dae=o((()=>{}));function Qh(e){return e==null?[]:W(e)?e:[e]}var $h=o((()=>{Ah()}));function fae(e,t,n){let r=e[0],i=e[1],a;return i=n-t?[t,n]:[r=Math.min(Math.max(r,t),n-a),r+a]}var pae=o((()=>{}));function eg(e){return typeof e==`function`}var tg=o((()=>{}));function ng(e,t,n){let r=n||{},i=Qh(t)||[],a=[],o=[],s={},c=r.comparator||hae;return Qh(e).forEach((e,t)=>{if(e==null)return;a.push(i[t]===mae?-1:1);let n=eg(e)?e:bh(e,void 0,r);o.push(n),(dh(n)||[]).forEach(e=>s[e]=1)}),o.length===0?null:lh(c(o,a),Object.keys(s))}var mae,rg,hae,gae,_ae,vae=o((()=>{fh(),$h(),xh(),tg(),mae=`descending`,rg=(e,t)=>{let n=e,r=t;return(nr||r==null)&&n!=null?1:(r=r instanceof Date?+r:r,n=n instanceof Date?+n:n)!==n&&r===r?-1:+(r!==r&&n===n)},hae=(e,t)=>e.length===1?gae(e[0],t[0]):_ae(e,t,e.length),gae=(e,t)=>function(n,r){return rg(e(n),e(r))*t},_ae=(e,t,n)=>(t.push(0),function(r,i){let a,o=0,s=-1;for(;o===0&&++se}var yae=o((()=>{tg()}));function ag(e,t){let n=null;return r=>{n&&clearTimeout(n),n=setTimeout(()=>(t(r),n=null),e)}}var bae=o((()=>{}));function og(e,...t){for(let n of t)for(let t in n)e[t]=n[t];return e}var xae=o((()=>{}));function sg(e,t){let n=0,r,i,a,o;if(e&&(r=e.length))if(t==null){for(i=e[n];no&&(o=i))}else{for(i=t(e[n]);no&&(o=i))}return[a,o]}var Sae=o((()=>{}));function Cae(e,t){let n=e.length,r=-1,i,a,o,s,c;if(t==null){for(;++r=s){o=c=s;break}if(r===n)return[-1,-1];for(i=a=r;++rs&&(o=s,i=r),c=s){o=c=s;break}if(r===n)return[-1,-1];for(i=a=r;++rs&&(o=s,i=r),c{}));function cg(e,t){return Object.hasOwn(e,t)}var lg=o((()=>{}));function ug(e){let t={},n;function r(e){return cg(t,e)&&t[e]!==dg}let i={size:0,empty:0,object:t,has:r,get(e){return r(e)?t[e]:void 0},set(e,n){return r(e)||(++i.size,t[e]===dg&&--i.empty),t[e]=n,this},delete(e){return r(e)&&(--i.size,++i.empty,t[e]=dg),this},clear(){i.size=i.empty=0,i.object=t={}},test(e){return arguments.length?(n=e,i):n},clean(){let e={},r=0;for(let i in t){let a=t[i];a!==dg&&(!n||!n(a))&&(e[i]=a,++r)}i.size=r,i.empty=0,i.object=t=e}};return e&&Object.keys(e).forEach(t=>{i.set(t,e[t])}),i}var dg,Tae=o((()=>{lg(),dg={}}));function Eae(e,t,n,r,i,a){if(!n&&n!==0)return a;let o=+n,s=e[0],c=Ih(e),l;if(c===void 0)return a;c{Lh()}));function fg(e,t,n){let r=e.prototype=Object.create(t.prototype);return Object.defineProperty(r,"constructor",{value:e,writable:!0,enumerable:!0,configurable:!0}),og(r,n)}var Oae=o((()=>{xae()}));function pg(e,t,n,r){let i=t[0],a=t[t.length-1],o;return i>a&&(o=i,i=a,a=o),n=n===void 0||n,r=r===void 0||r,(n?i<=e:i{}));function mg(e){return typeof e==`boolean`}var Aae=o((()=>{}));function hg(e){return Object.prototype.toString.call(e)===`[object Date]`}var jae=o((()=>{}));function Mae(e){return e!=null&&eg(e[Symbol.iterator])}var Nae=o((()=>{tg()}));function gg(e){return typeof e==`number`}var Pae=o((()=>{}));function _g(e){return Object.prototype.toString.call(e)===`[object RegExp]`}var Fae=o((()=>{}));function vg(e){return typeof e==`string`}var Iae=o((()=>{}));function yg(e,t,n){let r=e?t?Qh(e).map(e=>e.replace(/\\(.)/g,`$1`)):Qh(e):void 0,i=r?.length,a=n&&n.get||ph,o=e=>a(t?[e]:vh(e)),s;if(!i||!r)s=function(){return``};else if(i===1){let e=o(r[0]);s=function(t){return``+e(t)}}else{let e=r.map(o);s=function(t){let n=``+e[0](t),r=0;for(;++r{fh(),$h(),gh(),yh()}));function Rae(e,t){let n=e[0],r=Ih(e),i=+t;return r===void 0?n:i?i===1?r:n+i*(r-n):n}var zae=o((()=>{Lh()}));function Bae(e){e=+e||Vae;let t,n,r,i=()=>{t={},n={},r=0},a=(i,a)=>(++r>e&&(n=t,t={},r=1),t[i]=a);return i(),{clear:i,has:e=>cg(t,e)||cg(n,e),get:e=>cg(t,e)?t[e]:cg(n,e)?a(e,n[e]):void 0,set:(e,n)=>cg(t,e)?t[e]=n:a(e,n)}}var Vae,Hae=o((()=>{lg(),Vae=1e4}));function Uae(e){return e===Array||typeof e==`function`&&e.prototype&&ArrayBuffer.isView(e.prototype)}function Wae(e,t,n,r){let i=t.length,a=n.length;if(!a)return t;if(!i)return n;let o=t.constructor,s=r||(Uae(o)?new o(i+a):Array(i+a)),c=0,l=0,u=0;for(;c0?n[l++]:t[c++];for(;c{}));function bg(e,t){let n=``;for(;--t>=0;)n+=e;return n}var Kae=o((()=>{}));function qae(e,t,n,r){let i=n||` `,a=e+``,o=t-a.length;return o<=0?a:r===`left`?bg(i,o)+a:r===`center`?bg(i,~~(o/2))+a+bg(i,Math.ceil(o/2)):a+bg(i,o)}var Jae=o((()=>{Kae()}));function xg(e){return e&&Ih(e)-e[0]||0}var Yae=o((()=>{Lh()}));function G(e){return W(e)?`[${e.map(e=>e===null?`null`:G(e))}]`:jh(e)||vg(e)?JSON.stringify(e).replaceAll(`\u2028`,`\\u2028`).replaceAll(`\u2029`,`\\u2029`):e}var Xae=o((()=>{Ah(),Mh(),Iae()}));function Sg(e){return e==null||e===``?null:!e||e===`false`||e===`0`?!1:!!e}var Zae=o((()=>{}));function Cg(e,t){return t||=Qae,e==null||e===``?null:t(e)}var Qae,$ae=o((()=>{jae(),Pae(),Qae=e=>gg(e)||hg(e)?e:Date.parse(e)}));function wg(e){return e==null||e===``?null:e+``}var eoe=o((()=>{}));function Tg(e){let t={},n=e.length;for(let r=0;r{}));function noe(e,t,n,r){let i=r??`…`,a=e+``,o=a.length,s=Math.max(0,t-i.length);return o<=t?a:n===`left`?i+a.slice(o-s):n===`center`?a.slice(0,Math.ceil(s/2))+i+a.slice(o-~~(s/2)):a.slice(0,s)+i}var roe=o((()=>{}));function Eg(e,t,n){if(e)if(t){let r=e.length;for(let i=0;i{})),Dg=o((()=>{fh(),Xie(),Zie(),$ie(),tae(),cae(),dae(),$h(),pae(),vae(),yae(),bae(),_h(),xae(),Sae(),wae(),Tae(),xh(),Dae(),lg(),Oae(),kae(),Ah(),Aae(),jae(),tg(),Nae(),Pae(),Mh(),Fae(),Iae(),Lae(),zae(),Hae(),Gae(),Jae(),Lh(),Kae(),Yae(),yh(),Xae(),Zae(),$ae(),nae(),eoe(),toe(),roe(),ioe()}));function aoe(e){return Function(`d`,`return {`+e.map(function(e,t){return JSON.stringify(e)+`: d[`+t+`] || ""`}).join(`,`)+`}`)}function ooe(e,t){var n=aoe(e);return function(r,i){return t(n(r),i,e)}}function soe(e){var t=Object.create(null),n=[];return e.forEach(function(e){for(var r in e)r in t||n.push(t[r]=r)}),n}function Og(e,t){var n=e+``,r=n.length;return r9999?`+`+Og(e,6):Og(e,4)}function loe(e){var t=e.getUTCHours(),n=e.getUTCMinutes(),r=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?`Invalid Date`:coe(e.getUTCFullYear(),4)+`-`+Og(e.getUTCMonth()+1,2)+`-`+Og(e.getUTCDate(),2)+(i?`T`+Og(t,2)+`:`+Og(n,2)+`:`+Og(r,2)+`.`+Og(i,3)+`Z`:r?`T`+Og(t,2)+`:`+Og(n,2)+`:`+Og(r,2)+`Z`:n||t?`T`+Og(t,2)+`:`+Og(n,2)+`Z`:``)}function uoe(e){var t=RegExp(`["`+e+` -\r]`),n=e.charCodeAt(0);function r(e,t){var n,r,a=i(e,function(e,i){if(n)return n(e,i-1);r=e,n=t?ooe(e,t):aoe(e)});return a.columns=r||[],a}function i(e,t){var r=[],i=e.length,a=0,o=0,s,c=i<=0,l=!1;e.charCodeAt(i-1)===Mg&&--i,e.charCodeAt(i-1)===Ng&&--i;function u(){if(c)return Ag;if(l)return l=!1,kg;var t,r=a,o;if(e.charCodeAt(r)===jg){for(;a++=i?c=!0:(o=e.charCodeAt(a++))===Mg?l=!0:o===Ng&&(l=!0,e.charCodeAt(a)===Mg&&++a),e.slice(r+1,t-1).replace(/""/g,`"`)}for(;a({key:e,label:t,type:`text`,source:`odoo`}),n=[t(`metric`,`Metric`),...e.columns.map(e=>t(`c_${e.key}`,e.partial?`${e.label} (partial)`:e.label)),t(`total`,`Total`)],r=[],i=(t,n,i)=>{let a={pid:r.length+1,metric:t,total:i};e.columns.forEach((e,t)=>{a[`c_${e.key}`]=n[t]??``}),r.push(a)};for(let t of e.rows){i(t.sublabel?`${t.label} (${t.sublabel})`:t.label,t.cells.map(e=>qm(e.value)),qm(t.total??null));for(let e of t.deltas)i(`${t.label} — ${e.label}${e.percent?` (%)`:``}`,e.values.map(t=>Jm(t,e.percent)),``)}if(e.notes.length>0){i(``,[],``);for(let t of e.notes)i(t,[],``)}return{fields:n,rows:r}}var Gie={brand:[`#1F4E78`,`#C8A24B`,`#6F96B8`,`#E0C979`,`#3E6F98`,`#A17C2D`],categorical:[`#2F6B9A`,`#C28A2C`,`#4C8A68`,`#8A5C9D`,`#C25B56`,`#4B8793`,`#8B704A`,`#6A78A8`,`#A45D7D`,`#708B3D`,`#B66B32`,`#52749C`],sequential:[`#E7F0F7`,`#C5D9E9`,`#9CBCD5`,`#719DBE`,`#477CA3`,`#1F4E78`],diverging:[`#2F6B9A`,`#7EA5C3`,`#D8E4ED`,`#F0E6C6`,`#D5B66A`,`#9B7222`]};function Kie(e){switch(e.axis?.y?.format){case`number`:return{format:`,.2~f`};case`currency`:return{format:`$,.0f`};case`percent`:return{labelExpr:`format(datum.value, ',.2~f') + '%'`};case`compact`:return{format:`~s`};default:return{}}}function qie(e,t){let n=new Map(e.xOrder.map((e,t)=>[e,t])),r=new Map(e.seriesOrder.map((e,t)=>[e,t]));return e.points.map(e=>({xKey:e.key,xLabel:e.label,xIndex:n.get(e.key)??0,value:e.value,valueText:t(e.value),n:e.n,seriesKey:e.seriesKey,seriesLabel:e.seriesLabel,seriesIndex:r.get(e.seriesKey)??0}))}function Jie(){return{font:`Inter, ui-sans-serif, system-ui, sans-serif`,view:{stroke:null},axis:{labelColor:`#536273`,labelFont:`Inter, ui-sans-serif, system-ui, sans-serif`,labelFontSize:10,labelLimit:110,titleColor:`#344355`,titleFont:`Inter, ui-sans-serif, system-ui, sans-serif`,titleFontSize:11,titleFontWeight:500,gridColor:`#E7EBEF`,domainColor:`#C9D1D9`,tickColor:`#C9D1D9`},legend:{labelColor:`#536273`,labelFont:`Inter, ui-sans-serif, system-ui, sans-serif`,labelFontSize:10,titleColor:`#344355`,titleFont:`Inter, ui-sans-serif, system-ui, sans-serif`,titleFontSize:10,symbolType:`circle`,orient:`bottom`,direction:`horizontal`}}}function Yie(e,t){return{$schema:`https://vega.github.io/schema/vega-lite/v6.json`,data:{values:t},width:`container`,height:`container`,autosize:{type:`fit`,contains:`padding`,resize:!0},padding:4,config:Jie(),usermeta:{rendererBoundary:`aios-chart-spec-v1`,chartId:e.id}}}function ah(e){return[{field:`xLabel`,type:`nominal`,title:`Group`},...e?[{field:`seriesLabel`,type:`nominal`,title:`Series`}]:[],{field:`valueText`,type:`nominal`,title:`Value`},{field:`n`,type:`quantitative`,title:`Records`,format:`,`}]}function oh({spec:e,model:t,xTitle:n,yTitle:r,formatValue:i}){let a=qie(t,i).filter(t=>e.kind!==`donut`||t.value>0),o=[...Gie[e.palette??`brand`]],s=t.seriesOrder.length>0,c=s?{field:`seriesLabel`,type:`nominal`,title:null,sort:{field:`seriesIndex`,op:`min`},scale:{range:o},legend:{columns:4}}:{value:o[0]},l={field:`xLabel`,type:`nominal`,title:n??null,sort:{field:`xIndex`,op:`min`,order:`ascending`},axis:{labelAngle:t.xOrder.length>7?-35:0,labelOverlap:`greedy`}},u={field:`value`,type:`quantitative`,title:r??null,axis:Kie(e)},d=Yie(e,a);if(e.kind===`kpi`)return{...d,mark:{type:`text`,align:`center`,baseline:`middle`,font:`Inter, ui-sans-serif, system-ui, sans-serif`,fontSize:32,fontWeight:600,color:`#172433`},encoding:{text:{field:`valueText`,type:`nominal`},tooltip:[{field:`valueText`,type:`nominal`,title:`Value`},{field:`n`,type:`quantitative`,title:`Records`,format:`,`}]}};if(e.kind===`donut`)return{...d,mark:{type:`arc`,innerRadius:44,outerRadius:76,cornerRadius:2,padAngle:.01},encoding:{theta:{field:`value`,type:`quantitative`,stack:!0},color:{field:`xLabel`,type:`nominal`,title:null,sort:{field:`xIndex`,op:`min`},scale:{range:o},legend:{orient:`right`,direction:`vertical`,labelLimit:110}},order:{field:`xIndex`,type:`quantitative`},tooltip:ah(!1)}};let f={x:l,y:{...u,stack:(e.kind===`bar`||e.kind===`area`)&&s?e.stacked?`zero`:null:void 0},color:c,tooltip:ah(s)};return s&&e.kind===`bar`&&!e.stacked&&(f.xOffset={field:`seriesLabel`,type:`nominal`,sort:{field:`seriesIndex`,op:`min`}}),(e.kind===`line`||e.kind===`area`)&&(f.order={field:`xIndex`,type:`quantitative`},s&&(f.detail={field:`seriesKey`,type:`nominal`})),{...d,mark:e.kind===`bar`?{type:`bar`,cornerRadiusTopLeft:2,cornerRadiusTopRight:2}:e.kind===`area`?{type:`area`,opacity:s?.68:.48,line:!0,point:!0}:{type:`line`,strokeWidth:2,point:{filled:!0,size:46}},encoding:f}}function sh(e,t={}){let n=JSON.stringify([1],void 0,t.indent===void 0?2:t.indent).slice(2,-3),r=n===``?1/0:t.maxLength===void 0?80:t.maxLength,{replacer:i}=t;return(function e(t,a,o){t&&typeof t.toJSON==`function`&&(t=t.toJSON());let s=JSON.stringify(t,i);if(s===void 0)return s;let c=r-a.length-o;if(s.length<=c){let e=s.replace(ch,(e,t)=>t||`${e} `);if(e.length<=c)return e}if(i!=null&&(t=JSON.parse(s),i=void 0),typeof t==`object`&&t){let r=a+n,i=[],o=0,s,c;if(Array.isArray(t)){s=`[`,c=`]`;let{length:n}=t;for(;o0)return[s,n+i.join(`,\n${r}`),c].join(`\n${a}`)}return s})(e,``,0)}var ch,Xie=o((()=>{ch=/("(?:[^\\"]|\\.)*")|[:,]/g}));function lh(e,t,n){return Object.assign(e,{fields:t||[],fname:n})}function uh(e){return e==null?null:e.fname}function dh(e){return e==null?null:e.fields}var fh=o((()=>{}));function ph(e){return e.length===1?mh(e[0]):hh(e)}var mh,hh,gh=o((()=>{mh=e=>function(t){return t[e]},hh=e=>{let t=e.length;return function(n){for(let r=0;r{}));function vh(e){let t=[],n=e.length,r=null,i=0,a=``,o,s,c;e+=``;function l(){t.push(a+e.substring(o,s)),a=``,o=s+1}for(o=s=0;so?l():o=s+1:c===`[`?(s>o&&l(),i=o=s+1):c===`]`&&(i||U(`Access path missing open bracket: `+e),i>0&&l(),i=0,o=s+1);return i&&U(`Access path missing closing bracket: `+e),r&&U(`Access path missing closing quote: `+e),s>o&&(s++,l()),t}var yh=o((()=>{_h()}));function bh(e,t,n){let r=vh(e),i=r.length===1?r[0]:e;return lh((n&&n.get||ph)(r),[i],t||i)}var xh=o((()=>{fh(),gh(),yh()})),Sh,Ch,wh,Th,Eh,Dh,Zie=o((()=>{fh(),xh(),Sh=bh(`id`),Ch=lh(e=>e,[],`identity`),wh=lh(()=>0,[],`zero`),Th=lh(()=>1,[],`one`),Eh=lh(()=>!0,[],`true`),Dh=lh(()=>!1,[],`false`)})),Oh,Qie=o((()=>{Oh=new Set([...Object.getOwnPropertyNames(Object.prototype).filter(e=>typeof Object.prototype[e]==`function`),`__proto__`])}));function $ie(e,t,n){let r=[t,...n];console[e](...r)}function kh(e,t,n=$ie){let r=e||0;return{level(e){return arguments.length?(r=+e,this):r},error(...e){return r>=1&&n(t||`error`,`ERROR`,e),this},warn(...e){return r>=2&&n(t||`warn`,`WARN`,e),this},info(...e){return r>=3&&n(t||`log`,`INFO`,e),this},debug(...e){return r>=4&&n(t||`log`,`DEBUG`,e),this}}}var eae=o((()=>{})),W,Ah=o((()=>{W=Array.isArray}));function jh(e){return e===Object(e)}var Mh=o((()=>{}));function Nh(...e){return e.reduce((e,t)=>{for(let n in t)if(n===`signals`)e.signals=tae(e.signals,t.signals);else{let r=n===`legend`?{layout:1}:n===`style`||null;Ph(e,n,t[n],r)}return e},{})}function Ph(e,t,n,r){if(!Fh(t))return;let i=e,a,o;if(jh(n)&&!W(n)){let e=n;for(a in o=jh(i[t])?i[t]:i[t]={},e)r&&(r===!0||r[a])?Ph(o,a,e[a]):Fh(a)&&(o[a]=e[a])}else i[t]=n}function tae(e,t){if(e==null)return t;if(t==null)return e;let n={},r=[];function i(e){n[e.name]||(n[e.name]=1,r.push(e))}return t.forEach(i),e.forEach(i),r}var Fh,nae=o((()=>{Ah(),Mh(),Fh=e=>e!==`__proto__`&&e!==`constructor`&&e!==`prototype`}));function Ih(e){return e[e.length-1]}var Lh=o((()=>{}));function Rh(e){return e==null||e===``?null:+e}var rae=o((()=>{}));function iae(e){return e.length>0}function zh(e,t,n,r){iae(e)||U(`Domain array must not be empty`);let i=n(e[0]),a=n(Ih(e)),o=(a-i)*t;return[r(i-o),r(a-o)]}function aae(e,t){return zh(e,t,Xh,Zh)}function oae(e,t){let n=Math.sign(e[0]);return zh(e,t,Kh(n),Gh(n))}function sae(e,t,n){return zh(e,t,Yh(n),Yh(1/n))}function cae(e,t,n){return zh(e,t,qh(n),Jh(n))}function Bh(e,t,n,r,i){iae(e)||U(`Domain array must not be empty`);let a=r(e[0]),o=r(Ih(e)),s=t==null?(a+o)/2:r(t);return[i(s+(a-s)*n),i(s+(o-s)*n)]}function Vh(e,t,n){return Bh(e,t,n,Xh,Zh)}function Hh(e,t,n){let r=Math.sign(e[0]);return Bh(e,t,n,Kh(r),Gh(r))}function Uh(e,t,n,r){return Bh(e,t,n,Yh(r),Yh(1/r))}function Wh(e,t,n,r){return Bh(e,t,n,qh(r),Jh(r))}var Gh,Kh,qh,Jh,Yh,Xh,Zh,lae=o((()=>{_h(),Lh(),rae(),Gh=e=>t=>e*Math.exp(t),Kh=e=>t=>Math.log(e*t),qh=e=>t=>Math.sign(t)*Math.log1p(Math.abs(t/e)),Jh=e=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*e,Yh=e=>t=>t<0?-((-t)**+e):t**+e,Xh=e=>Rh(e)??0,Zh=e=>e}));function uae(e){return 1+~~(new Date(e).getMonth()/3)}function dae(e){return 1+~~(new Date(e).getUTCMonth()/3)}var fae=o((()=>{}));function Qh(e){return e==null?[]:W(e)?e:[e]}var $h=o((()=>{Ah()}));function pae(e,t,n){let r=e[0],i=e[1],a;return i=n-t?[t,n]:[r=Math.min(Math.max(r,t),n-a),r+a]}var mae=o((()=>{}));function eg(e){return typeof e==`function`}var tg=o((()=>{}));function ng(e,t,n){let r=n||{},i=Qh(t)||[],a=[],o=[],s={},c=r.comparator||gae;return Qh(e).forEach((e,t)=>{if(e==null)return;a.push(i[t]===hae?-1:1);let n=eg(e)?e:bh(e,void 0,r);o.push(n),(dh(n)||[]).forEach(e=>s[e]=1)}),o.length===0?null:lh(c(o,a),Object.keys(s))}var hae,rg,gae,_ae,vae,yae=o((()=>{fh(),$h(),xh(),tg(),hae=`descending`,rg=(e,t)=>{let n=e,r=t;return(nr||r==null)&&n!=null?1:(r=r instanceof Date?+r:r,n=n instanceof Date?+n:n)!==n&&r===r?-1:+(r!==r&&n===n)},gae=(e,t)=>e.length===1?_ae(e[0],t[0]):vae(e,t,e.length),_ae=(e,t)=>function(n,r){return rg(e(n),e(r))*t},vae=(e,t,n)=>(t.push(0),function(r,i){let a,o=0,s=-1;for(;o===0&&++se}var bae=o((()=>{tg()}));function ag(e,t){let n=null;return r=>{n&&clearTimeout(n),n=setTimeout(()=>(t(r),n=null),e)}}var xae=o((()=>{}));function og(e,...t){for(let n of t)for(let t in n)e[t]=n[t];return e}var Sae=o((()=>{}));function sg(e,t){let n=0,r,i,a,o;if(e&&(r=e.length))if(t==null){for(i=e[n];no&&(o=i))}else{for(i=t(e[n]);no&&(o=i))}return[a,o]}var Cae=o((()=>{}));function wae(e,t){let n=e.length,r=-1,i,a,o,s,c;if(t==null){for(;++r=s){o=c=s;break}if(r===n)return[-1,-1];for(i=a=r;++rs&&(o=s,i=r),c=s){o=c=s;break}if(r===n)return[-1,-1];for(i=a=r;++rs&&(o=s,i=r),c{}));function cg(e,t){return Object.hasOwn(e,t)}var lg=o((()=>{}));function ug(e){let t={},n;function r(e){return cg(t,e)&&t[e]!==dg}let i={size:0,empty:0,object:t,has:r,get(e){return r(e)?t[e]:void 0},set(e,n){return r(e)||(++i.size,t[e]===dg&&--i.empty),t[e]=n,this},delete(e){return r(e)&&(--i.size,++i.empty,t[e]=dg),this},clear(){i.size=i.empty=0,i.object=t={}},test(e){return arguments.length?(n=e,i):n},clean(){let e={},r=0;for(let i in t){let a=t[i];a!==dg&&(!n||!n(a))&&(e[i]=a,++r)}i.size=r,i.empty=0,i.object=t=e}};return e&&Object.keys(e).forEach(t=>{i.set(t,e[t])}),i}var dg,Eae=o((()=>{lg(),dg={}}));function Dae(e,t,n,r,i,a){if(!n&&n!==0)return a;let o=+n,s=e[0],c=Ih(e),l;if(c===void 0)return a;c{Lh()}));function fg(e,t,n){let r=e.prototype=Object.create(t.prototype);return Object.defineProperty(r,"constructor",{value:e,writable:!0,enumerable:!0,configurable:!0}),og(r,n)}var kae=o((()=>{Sae()}));function pg(e,t,n,r){let i=t[0],a=t[t.length-1],o;return i>a&&(o=i,i=a,a=o),n=n===void 0||n,r=r===void 0||r,(n?i<=e:i{}));function mg(e){return typeof e==`boolean`}var jae=o((()=>{}));function hg(e){return Object.prototype.toString.call(e)===`[object Date]`}var Mae=o((()=>{}));function Nae(e){return e!=null&&eg(e[Symbol.iterator])}var Pae=o((()=>{tg()}));function gg(e){return typeof e==`number`}var Fae=o((()=>{}));function _g(e){return Object.prototype.toString.call(e)===`[object RegExp]`}var Iae=o((()=>{}));function vg(e){return typeof e==`string`}var Lae=o((()=>{}));function yg(e,t,n){let r=e?t?Qh(e).map(e=>e.replace(/\\(.)/g,`$1`)):Qh(e):void 0,i=r?.length,a=n&&n.get||ph,o=e=>a(t?[e]:vh(e)),s;if(!i||!r)s=function(){return``};else if(i===1){let e=o(r[0]);s=function(t){return``+e(t)}}else{let e=r.map(o);s=function(t){let n=``+e[0](t),r=0;for(;++r{fh(),$h(),gh(),yh()}));function zae(e,t){let n=e[0],r=Ih(e),i=+t;return r===void 0?n:i?i===1?r:n+i*(r-n):n}var Bae=o((()=>{Lh()}));function Vae(e){e=+e||Hae;let t,n,r,i=()=>{t={},n={},r=0},a=(i,a)=>(++r>e&&(n=t,t={},r=1),t[i]=a);return i(),{clear:i,has:e=>cg(t,e)||cg(n,e),get:e=>cg(t,e)?t[e]:cg(n,e)?a(e,n[e]):void 0,set:(e,n)=>cg(t,e)?t[e]=n:a(e,n)}}var Hae,Uae=o((()=>{lg(),Hae=1e4}));function Wae(e){return e===Array||typeof e==`function`&&e.prototype&&ArrayBuffer.isView(e.prototype)}function Gae(e,t,n,r){let i=t.length,a=n.length;if(!a)return t;if(!i)return n;let o=t.constructor,s=r||(Wae(o)?new o(i+a):Array(i+a)),c=0,l=0,u=0;for(;c0?n[l++]:t[c++];for(;c{}));function bg(e,t){let n=``;for(;--t>=0;)n+=e;return n}var qae=o((()=>{}));function Jae(e,t,n,r){let i=n||` `,a=e+``,o=t-a.length;return o<=0?a:r===`left`?bg(i,o)+a:r===`center`?bg(i,~~(o/2))+a+bg(i,Math.ceil(o/2)):a+bg(i,o)}var Yae=o((()=>{qae()}));function xg(e){return e&&Ih(e)-e[0]||0}var Xae=o((()=>{Lh()}));function G(e){return W(e)?`[${e.map(e=>e===null?`null`:G(e))}]`:jh(e)||vg(e)?JSON.stringify(e).replaceAll(`\u2028`,`\\u2028`).replaceAll(`\u2029`,`\\u2029`):e}var Zae=o((()=>{Ah(),Mh(),Lae()}));function Sg(e){return e==null||e===``?null:!e||e===`false`||e===`0`?!1:!!e}var Qae=o((()=>{}));function Cg(e,t){return t||=$ae,e==null||e===``?null:t(e)}var $ae,eoe=o((()=>{Mae(),Fae(),$ae=e=>gg(e)||hg(e)?e:Date.parse(e)}));function wg(e){return e==null||e===``?null:e+``}var toe=o((()=>{}));function Tg(e){let t={},n=e.length;for(let r=0;r{}));function roe(e,t,n,r){let i=r??`…`,a=e+``,o=a.length,s=Math.max(0,t-i.length);return o<=t?a:n===`left`?i+a.slice(o-s):n===`center`?a.slice(0,Math.ceil(s/2))+i+a.slice(o-~~(s/2)):a.slice(0,s)+i}var ioe=o((()=>{}));function Eg(e,t,n){if(e)if(t){let r=e.length;for(let i=0;i{})),Dg=o((()=>{fh(),Zie(),Qie(),eae(),nae(),lae(),fae(),$h(),mae(),yae(),bae(),xae(),_h(),Sae(),Cae(),Tae(),Eae(),xh(),Oae(),lg(),kae(),Aae(),Ah(),jae(),Mae(),tg(),Pae(),Fae(),Mh(),Iae(),Lae(),Rae(),Bae(),Uae(),Kae(),Yae(),Lh(),qae(),Xae(),yh(),Zae(),Qae(),eoe(),rae(),toe(),noe(),ioe(),aoe()}));function ooe(e){return Function(`d`,`return {`+e.map(function(e,t){return JSON.stringify(e)+`: d[`+t+`] || ""`}).join(`,`)+`}`)}function soe(e,t){var n=ooe(e);return function(r,i){return t(n(r),i,e)}}function coe(e){var t=Object.create(null),n=[];return e.forEach(function(e){for(var r in e)r in t||n.push(t[r]=r)}),n}function Og(e,t){var n=e+``,r=n.length;return r9999?`+`+Og(e,6):Og(e,4)}function uoe(e){var t=e.getUTCHours(),n=e.getUTCMinutes(),r=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?`Invalid Date`:loe(e.getUTCFullYear(),4)+`-`+Og(e.getUTCMonth()+1,2)+`-`+Og(e.getUTCDate(),2)+(i?`T`+Og(t,2)+`:`+Og(n,2)+`:`+Og(r,2)+`.`+Og(i,3)+`Z`:r?`T`+Og(t,2)+`:`+Og(n,2)+`:`+Og(r,2)+`Z`:n||t?`T`+Og(t,2)+`:`+Og(n,2)+`Z`:``)}function doe(e){var t=RegExp(`["`+e+` +\r]`),n=e.charCodeAt(0);function r(e,t){var n,r,a=i(e,function(e,i){if(n)return n(e,i-1);r=e,n=t?soe(e,t):ooe(e)});return a.columns=r||[],a}function i(e,t){var r=[],i=e.length,a=0,o=0,s,c=i<=0,l=!1;e.charCodeAt(i-1)===Mg&&--i,e.charCodeAt(i-1)===Ng&&--i;function u(){if(c)return Ag;if(l)return l=!1,kg;var t,r=a,o;if(e.charCodeAt(r)===jg){for(;a++=i?c=!0:(o=e.charCodeAt(a++))===Mg?l=!0:o===Ng&&(l=!0,e.charCodeAt(a)===Mg&&++a),e.slice(r+1,t-1).replace(/""/g,`"`)}for(;a{kg={},Ag={},jg=34,Mg=10,Ng=13})),foe=o((()=>{doe()}));function poe(e){return e}var moe=o((()=>{}));function hoe(e){if(e==null)return poe;var t,n,r=e.scale[0],i=e.scale[1],a=e.translate[0],o=e.translate[1];return function(e,s){s||(t=n=0);var c=2,l=e.length,u=Array(l);for(u[0]=(t+=e[0])*r+a,u[1]=(n+=e[1])*i+o;c{moe()}));function _oe(e,t){for(var n,r=e.length,i=r-t;i<--r;)n=e[i],e[i++]=e[r],e[r]=n}var voe=o((()=>{}));function yoe(e,t){return typeof t==`string`&&(t=e.objects[t]),t.type===`GeometryCollection`?{type:`FeatureCollection`,features:t.geometries.map(function(t){return boe(e,t)})}:boe(e,t)}function boe(e,t){var n=t.id,r=t.bbox,i=t.properties==null?{}:t.properties,a=xoe(e,t);return n==null&&r==null?{type:`Feature`,properties:i,geometry:a}:r==null?{type:`Feature`,id:n,properties:i,geometry:a}:{type:`Feature`,id:n,bbox:r,properties:i,geometry:a}}function xoe(e,t){var n=hoe(e.transform),r=e.arcs;function i(e,t){t.length&&t.pop();for(var i=r[e<0?~e:e],a=0,o=i.length;a{voe(),goe()}));function Coe(e,t){var n={},r={},i={},a=[],o=-1;t.forEach(function(n,r){var i=e.arcs[n<0?~n:n],a;i.length<3&&!i[1][0]&&!i[1][1]&&(a=t[++o],t[o]=n,t[r]=a)}),t.forEach(function(e){var t=s(e),n=t[0],a=t[1],o,c;if(o=i[n])if(delete i[o.end],o.push(e),o.end=a,c=r[a]){delete r[c.start];var l=c===o?o:o.concat(c);r[l.start=o.start]=i[l.end=c.end]=l}else r[o.start]=i[o.end]=o;else if(o=r[a])if(delete r[o.start],o.unshift(e),o.start=n,c=i[n]){delete i[c.end];var u=c===o?o:c.concat(o);r[u.start=c.start]=i[u.end=o.end]=u}else r[o.start]=i[o.end]=o;else o=[e],r[o.start=n]=i[o.end=a]=o});function s(t){var n=e.arcs[t<0?~t:t],r=n[0],i;return e.transform?(i=[0,0],n.forEach(function(e){i[0]+=e[0],i[1]+=e[1]})):i=n[n.length-1],t<0?[i,r]:[r,i]}function c(e,t){for(var r in e){var i=e[r];delete t[i.start],delete i.start,delete i.end,i.forEach(function(e){n[e<0?~e:e]=1}),a.push(i)}}return c(i,r),c(r,i),t.forEach(function(e){n[e<0?~e:e]||a.push([e])}),a}var woe=o((()=>{}));function Toe(e){return xoe(e,Eoe.apply(this,arguments))}function Eoe(e,t,n){var r,i,a;if(arguments.length>1)r=Doe(e,t,n);else for(i=0,r=Array(a=e.arcs.length);i{Soe(),woe()})),koe=o((()=>{goe(),Soe(),Ooe(),woe(),moe()}));function Pg(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}var Fg=o((()=>{}));function Aoe(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}var joe=o((()=>{}));function Ig(e){let t,n,r;e.length===2?(t=e===Pg||e===Aoe?e:Moe,n=e,r=e):(t=Pg,n=(t,n)=>Pg(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i>>1;n(e[t],r)<0?i=t+1:a=t}while(i>>1;n(e[t],r)<=0?i=t+1:a=t}while(in&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function Moe(){return 0}var Noe=o((()=>{Fg(),joe()}));function Poe(e){return e===null?NaN:+e}function*Foe(e,t){if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(yield t);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var Ioe=o((()=>{})),Lg,Rg,zg,Loe=o((()=>{Fg(),Noe(),Ioe(),Lg=Ig(Pg),Rg=Lg.right,zg=Lg.left,Ig(Poe).center}));function Roe(e,t){let n=0,r,i=0,a=0;if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(r=t-i,i+=r/++n,a+=r*(t-i));else{let o=-1;for(let s of e)(s=t(s,++o,e))!=null&&(s=+s)>=s&&(r=s-i,i+=r/++n,a+=r*(s-i))}if(n>1)return a/(n-1)}var zoe=o((()=>{}));function Boe(e,t){let n=Roe(e,t);return n&&Math.sqrt(n)}var Voe=o((()=>{zoe()})),Bg,Hoe=o((()=>{Bg=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){let t=this._partials,n=0;for(let r=0;r0){for(a=e[--t];t>0&&(n=a,r=e[--t],a=n+r,i=r-(a-n),!i););t>0&&(i<0&&e[t-1]<0||i>0&&e[t-1]>0)&&(r=i*2,n=a+r,r==n-a&&(a=n))}return a}}}));function Vg({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function Uoe({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function Woe({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function Goe(e){return typeof e==`object`&&e?e.valueOf():e}var Hg,Ug,Wg=o((()=>{Hg=class extends Map{constructor(e,t=Goe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(Vg(this,e))}has(e){return super.has(Vg(this,e))}set(e,t){return super.set(Uoe(this,e),t)}delete(e){return super.delete(Woe(this,e))}},Ug=class extends Set{constructor(e,t=Goe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let t of e)this.add(t)}has(e){return super.has(Vg(this,e))}add(e){return super.add(Uoe(this,e))}delete(e){return super.delete(Woe(this,e))}}}));function Koe(e,t){return Array.from(t,t=>e[t])}var qoe=o((()=>{}));function Joe(e=Pg){if(e===Pg)return Yoe;if(typeof e!=`function`)throw TypeError(`compare is not a function`);return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function Yoe(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et))}var Xoe=o((()=>{Fg()}));function Gg(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=Zoe?10:a>=Qoe?5:a>=$oe?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/lt&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*lt&&--c),c0))return[];if(e===t)return[e];let r=t=i))return[];let s=a-i+1,c=Array(s);if(r)if(o<0)for(let e=0;e{Zoe=Math.sqrt(50),Qoe=Math.sqrt(10),$oe=Math.sqrt(2)}));function Yg(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n=i)&&(n=i)}return n}var tse=o((()=>{}));function Xg(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}var nse=o((()=>{}));function rse(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?Yoe:Joe(i);r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1),u=Math.max(n,Math.floor(t-o*c/a+l)),d=Math.min(r,Math.floor(t+(a-o)*c/a+l));rse(e,t,u,d,i)}let a=e[t],o=n,s=r;for(Zg(e,n,t),i(e[r],a)>0&&Zg(e,n,r);o0;)--s}i(e[n],a)===0?Zg(e,n,s):(++s,Zg(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function Zg(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}var ise=o((()=>{Xoe()}));function Qg(e,t,n){if(e=Float64Array.from(Foe(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return Xg(e);if(t>=1)return Yg(e);var r,i=(r-1)*t,a=Math.floor(i),o=Yg(rse(e,a).subarray(0,a+1));return o+(Xg(e.subarray(a+1))-o)*(i-a)}}function ase(e,t,n=Poe){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(+n(e[a+1],a+1,e)-o)*(i-a)}}var ose=o((()=>{tse(),nse(),ise(),Ioe()}));function sse(e,t){let n=0,r=0;if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(++n,r+=t);else{let i=-1;for(let a of e)(a=t(a,++i,e))!=null&&(a=+a)>=a&&(++n,r+=a)}if(n)return r/n}var cse=o((()=>{}));function lse(e,t){return Qg(e,.5,t)}var use=o((()=>{ose()}));function*dse(e){for(let t of e)yield*t}function fse(e){return Array.from(dse(e))}var pse=o((()=>{}));function $g(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r{}));function hse(e,t){let n=0;if(t===void 0)for(let t of e)(t=+t)&&(n+=t);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}var gse=o((()=>{}));function _se(e,...t){e=new Ug(e),t=t.map(vse);out:for(let n of e)for(let r of t)if(!r.has(n)){e.delete(n);continue out}return e}function vse(e){return e instanceof Ug?e:new Ug(e)}var yse=o((()=>{Wg()}));function bse(...e){let t=new Ug;for(let n of e)for(let e of n)t.add(e);return t}var xse=o((()=>{Wg()})),e_=o((()=>{Loe(),Fg(),Noe(),joe(),Voe(),Hoe(),Wg(),Xoe(),ese(),ose(),tse(),cse(),use(),pse(),nse(),qoe(),ise(),mse(),gse(),zoe(),yse(),xse()}));function Sse(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function t_(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}var n_=o((()=>{}));function r_(e){return e=t_(Math.abs(e)),e?e[1]:NaN}var i_=o((()=>{n_()}));function Cse(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}var wse=o((()=>{}));function Tse(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var Ese=o((()=>{}));function a_(e){if(!(t=s_.exec(e)))throw Error(`invalid format: `+e);var t;return new o_({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function o_(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}var s_,c_=o((()=>{s_=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i,a_.prototype=o_.prototype,o_.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type}}));function Dse(e){out:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Ose=o((()=>{}));function kse(e,t){var n=t_(e,t);if(!n)return l_=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(l_=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+t_(e,Math.max(0,t+a-1))[0]}var l_,u_=o((()=>{n_()}));function d_(e,t){var n=t_(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var Ase=o((()=>{n_()})),f_,jse=o((()=>{n_(),u_(),Ase(),f_={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:Sse,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>d_(e*100,t),r:d_,s:kse,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)}}));function p_(e){return e}var Mse=o((()=>{}));function m_(e){var t=e.grouping===void 0||e.thousands===void 0?p_:Cse(h_.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?p_:Tse(h_.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=a_(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):f_[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=f_[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=Dse(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&l_!==void 0?g_[8+l_/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++op||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(r_(t)/3)))*3,r=10**-n,i=l((e=a_(e),e.type=`f`,e),{suffix:g_[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var h_,g_,__=o((()=>{i_(),wse(),Ese(),c_(),Ose(),jse(),u_(),Mse(),h_=Array.prototype.map,g_=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`]}));function Nse(e){return v_=m_(e),y_=v_.format,b_=v_.formatPrefix,v_}var v_,y_,b_,Pse=o((()=>{__(),Nse({thousands:`,`,grouping:[3],currency:[`$`,``]})}));function x_(e){return Math.max(0,-r_(Math.abs(e)))}var Fse=o((()=>{i_()}));function S_(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(r_(t)/3)))*3-r_(Math.abs(e)))}var Ise=o((()=>{i_()}));function C_(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,r_(t)-r_(e))+1}var Lse=o((()=>{i_()})),w_=o((()=>{Pse(),__(),c_(),Fse(),Ise(),Lse()}));function T_(e,t,n,r){function i(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t(t(e=new Date(+e),n==null?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o=[];if(n=i.ceil(n),a=a==null?1:Math.floor(a),!(n0))return o;let s;do o.push(s=new Date(+n)),t(n,a),e(n);while(sT_(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(E_.setTime(+t),D_.setTime(+r),e(E_),e(D_),Math.floor(n(E_,D_))),i.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i)),i}var E_,D_,O_=o((()=>{E_=new Date,D_=new Date})),k_,A_=o((()=>{O_(),k_=T_(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e),k_.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?T_(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):k_),k_.range})),j_,M_,N_,P_,F_,I_,L_,R_=o((()=>{j_=1e3,M_=j_*60,N_=M_*60,P_=N_*24,F_=P_*7,I_=P_*30,L_=P_*365})),z_,B_=o((()=>{O_(),R_(),z_=T_(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*j_)},(e,t)=>(t-e)/j_,e=>e.getUTCSeconds()),z_.range})),V_,H_,U_=o((()=>{O_(),R_(),V_=T_(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*j_)},(e,t)=>{e.setTime(+e+t*M_)},(e,t)=>(t-e)/M_,e=>e.getMinutes()),V_.range,H_=T_(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*M_)},(e,t)=>(t-e)/M_,e=>e.getUTCMinutes()),H_.range})),W_,G_,K_=o((()=>{O_(),R_(),W_=T_(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*j_-e.getMinutes()*M_)},(e,t)=>{e.setTime(+e+t*N_)},(e,t)=>(t-e)/N_,e=>e.getHours()),W_.range,G_=T_(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*N_)},(e,t)=>(t-e)/N_,e=>e.getUTCHours()),G_.range})),q_,J_,Y_,X_=o((()=>{O_(),R_(),q_=T_(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*M_)/P_,e=>e.getDate()-1),q_.range,J_=T_(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/P_,e=>e.getUTCDate()-1),J_.range,Y_=T_(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/P_,e=>Math.floor(e/P_)),Y_.range}));function Z_(e){return T_(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*M_)/F_)}function Q_(e){return T_(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/F_)}var $_,ev,tv,nv,rv,iv,av,ov,sv,cv,lv,uv,dv,fv,pv=o((()=>{O_(),R_(),$_=Z_(0),ev=Z_(1),tv=Z_(2),nv=Z_(3),rv=Z_(4),iv=Z_(5),av=Z_(6),$_.range,ev.range,tv.range,nv.range,rv.range,iv.range,av.range,ov=Q_(0),sv=Q_(1),cv=Q_(2),lv=Q_(3),uv=Q_(4),dv=Q_(5),fv=Q_(6),ov.range,sv.range,cv.range,lv.range,uv.range,dv.range,fv.range})),mv,hv,gv=o((()=>{O_(),mv=T_(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth()),mv.range,hv=T_(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth()),hv.range})),_v,vv,yv=o((()=>{O_(),_v=T_(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear()),_v.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:T_(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),_v.range,vv=T_(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear()),vv.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:T_(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),vv.range}));function bv(e,t,n,r,i,a){let o=[[z_,1,j_],[z_,5,5*j_],[z_,15,15*j_],[z_,30,30*j_],[a,1,M_],[a,5,5*M_],[a,15,15*M_],[a,30,30*M_],[i,1,N_],[i,3,3*N_],[i,6,6*N_],[i,12,12*N_],[r,1,P_],[r,2,2*P_],[n,1,F_],[t,1,I_],[t,3,3*I_],[e,1,L_]];function s(e,t,n){let r=te).right(o,i);if(a===o.length)return e.every(Jg(t/L_,n/L_,r));if(a===0)return k_.every(Math.max(Jg(t,n,r),1));let[s,c]=o[i/o[a-1][2]{e_(),R_(),A_(),B_(),U_(),K_(),X_(),pv(),gv(),yv(),[xv,Sv]=bv(vv,hv,ov,Y_,G_,H_),[Cv,wv]=bv(_v,mv,$_,q_,W_,V_)})),Tv=o((()=>{O_(),A_(),B_(),U_(),K_(),X_(),pv(),gv(),yv(),Rse()}));function Ev(e){let t=Qh(e).slice(),n={};return t.length||U(`Missing time unit.`),t.forEach(e=>{cg(uy,e)?n[e]=1:U(`Invalid time unit: ${e}.`)}),(n.week||n.day?1:0)+(n.quarter||n.month||n.date?1:0)+ +!!n.dayofyear>1&&U(`Incompatible time units: ${e}`),t.sort((e,t)=>uy[e]-uy[t]),t}function Dv(e,t){let n=og({},dy,t),r=Ev(e),i=r.length,a=``,o=0,s,c;for(o=0;oo;--s)if(c=r.slice(o,s).join(`-`),n[c]!=null){a+=n[c],o=s;break}return a.trim()}function Ov(e){return fy.setFullYear(e),fy.setMonth(0),fy.setDate(1),fy.setHours(0,0,0,0),fy}function kv(e){return jv(new Date(e))}function Av(e){return Mv(new Date(e))}function jv(e){return q_.count(Ov(e.getFullYear())-1,e)}function Mv(e){return $_.count(Ov(e.getFullYear())-1,e)}function Nv(e){return Ov(e).getDay()}function zse(e,t,n,r,i,a,o){if(0<=e&&e<100){let s=new Date(-1,t,n,r,i,a,o);return s.setFullYear(e),s}return new Date(e,t,n,r,i,a,o)}function Pv(e){return Iv(new Date(e))}function Fv(e){return Lv(new Date(e))}function Iv(e){let t=Date.UTC(e.getUTCFullYear(),0,1);return J_.count(t-1,e)}function Lv(e){let t=Date.UTC(e.getUTCFullYear(),0,1);return ov.count(t-1,e)}function Rv(e){return fy.setTime(Date.UTC(e,0,1)),fy.getUTCDay()}function Bse(e,t,n,r,i,a,o){if(0<=e&&e<100){let e=new Date(Date.UTC(-1,t,n,r,i,a,o));return e.setUTCFullYear(n.y),e}return new Date(Date.UTC(e,t,n,r,i,a,o))}function zv(e,t,n,r,i){let a=t||1,o=Ih(e),s=(e,t,i)=>(i||=e,Vse(n[i],r[i],e===o&&a,t)),c=new Date,l=Tg(e),u=l.year?s($v):ig(2012),d=l.month?s(ty):l.quarter?s(ey):wh,f=l.week&&l.day?s(`day`,1,`weekday`):l.week?s(ny,1):l.day?s(`day`,1):l.date?s(ry,1):l.dayofyear?s(iy,1):Th,p=l.hours?s(ay):wh,m=l.minutes?s(oy):wh,h=l.seconds?s(sy):wh,g=l.milliseconds?s(cy):wh;return function(e){c.setTime(+e);let t=u(c);return i(t,d(c),f(c,t),p(c),m(c),h(c),g(c))}}function Vse(e,t,n,r){let i=n<=1?e:r?(t,i)=>r+n*Math.floor((e(t,i)-r)/n):(t,r)=>n*Math.floor(e(t,r)/n);return t?(e,n)=>t(i(e,n),n):i}function Bv(e,t,n){return t+e*7-(n+6)%7}function Vv(e,t){return zv(e,t||1,py,my,zse)}function Hv(e,t){return zv(e,t||1,hy,gy,Bse)}function Uv(e){return _y[e]}function Wv(e){return vy[e]}function Gv(e,t,n){return e?e.offset(t,n):void 0}function Kv(e,t,n){return Gv(Uv(e),t,n)}function qv(e,t,n){return Gv(Wv(e),t,n)}function Jv(e,t,n,r){return e?e.range(t,n,r):void 0}function Yv(e,t,n,r){return Jv(Uv(e),t,n,r)}function Xv(e,t,n,r){return Jv(Wv(e),t,n,r)}function Zv(e){let t=e.extent,n=e.maxbins||40,r=Math.abs(xg(t))/n,i=Ig(e=>e[2]).right(Py,r),a,o;return i===Py.length?(a=Ny,o=Jg(t[0]/Ty,t[1]/Ty,n)):i?(i=Py[r/Py[i-1][2]{let n=t(e),r=new Date(n);return Number.isNaN(+r)&&U(`Invalid date: ${n}`),r}),a=Ly.findIndex(e=>!e.aligned(i,r)),o=Ly.findIndex(e=>!e.skippable&&!e.aligned(i,r)),s=o>a+1?o:a,{units:c,step:l}=Ly[s-1];return{units:c,step:l}}var $v,ey,ty,ny,ry,iy,ay,oy,sy,cy,ly,uy,dy,fy,py,my,hy,gy,_y,vy,yy,by,xy,Sy,Cy,wy,Ty,Ey,Dy,Oy,ky,Ay,jy,My,Ny,Py,Fy,Iy,Ly,Ry=o((()=>{Dg(),Tv(),e_(),$v=`year`,ey=`quarter`,ty=`month`,ny=`week`,ry=`date`,iy=`dayofyear`,ay=`hours`,oy=`minutes`,sy=`seconds`,cy=`milliseconds`,ly=[$v,ey,ty,ny,ry,`day`,iy,ay,oy,sy,cy],uy=ly.reduce((e,t,n)=>(e[t]=1+n,e),{}),dy={[$v]:`%Y `,[ey]:`Q%q `,[ty]:`%b `,[ry]:`%d `,[ny]:`W%U `,day:`%a `,[iy]:`%j `,[ay]:`%H:00`,[oy]:`00:%M`,[sy]:`:%S`,[cy]:`.%L`,[`${$v}-${ty}`]:`%Y-%m `,[`${$v}-${ty}-${ry}`]:`%Y-%m-%d `,[`${ay}-${oy}`]:`%H:%M`},fy=new Date,py={[$v]:e=>e.getFullYear(),[ey]:e=>Math.floor(e.getMonth()/3),[ty]:e=>e.getMonth(),[ry]:e=>e.getDate(),[ay]:e=>e.getHours(),[oy]:e=>e.getMinutes(),[sy]:e=>e.getSeconds(),[cy]:e=>e.getMilliseconds(),[iy]:e=>jv(e),[ny]:e=>Mv(e),weekday:(e,t)=>Bv(Mv(e),e.getDay(),Nv(t)),day:(e,t)=>Bv(1,e.getDay(),Nv(t))},my={[ey]:e=>3*e,[ny]:(e,t)=>Bv(e,0,Nv(t))},hy={[$v]:e=>e.getUTCFullYear(),[ey]:e=>Math.floor(e.getUTCMonth()/3),[ty]:e=>e.getUTCMonth(),[ry]:e=>e.getUTCDate(),[ay]:e=>e.getUTCHours(),[oy]:e=>e.getUTCMinutes(),[sy]:e=>e.getUTCSeconds(),[cy]:e=>e.getUTCMilliseconds(),[iy]:e=>Iv(e),[ny]:e=>Lv(e),day:(e,t)=>Bv(1,e.getUTCDay(),Rv(t)),weekday:(e,t)=>Bv(Lv(e),e.getUTCDay(),Rv(t))},gy={[ey]:e=>3*e,[ny]:(e,t)=>Bv(e,0,Rv(t))},_y={[$v]:_v,[ey]:mv.every(3),[ty]:mv,[ny]:$_,[ry]:q_,day:q_,[iy]:q_,[ay]:W_,[oy]:V_,[sy]:z_,[cy]:k_},vy={[$v]:vv,[ey]:hv.every(3),[ty]:hv,[ny]:ov,[ry]:J_,day:J_,[iy]:J_,[ay]:G_,[oy]:H_,[sy]:z_,[cy]:k_},yy=1e3,by=yy*60,xy=by*60,Sy=xy*24,Cy=Sy*7,wy=Sy*30,Ty=Sy*365,Ey=[$v,ty,ry,ay,oy,sy,cy],Dy=Ey.slice(0,-1),Oy=Dy.slice(0,-1),ky=Oy.slice(0,-1),Ay=ky.slice(0,-1),jy=[$v,ny],My=[$v,ty],Ny=[$v],Py=[[Dy,1,yy],[Dy,5,5*yy],[Dy,15,15*yy],[Dy,30,30*yy],[Oy,1,by],[Oy,5,5*by],[Oy,15,15*by],[Oy,30,30*by],[ky,1,xy],[ky,3,3*xy],[ky,6,6*xy],[ky,12,12*xy],[Ay,1,Sy],[jy,1,Cy],[My,1,wy],[My,3,3*wy],[Ny,1,Ty]],Fy={[$v]:e=>e.getFullYear(),[ty]:e=>e.getMonth(),[ry]:e=>e.getDate(),day:e=>e.getDay(),[ay]:e=>e.getHours(),[oy]:e=>e.getMinutes(),[sy]:e=>e.getSeconds(),[cy]:e=>e.getMilliseconds()},Iy={[$v]:e=>e.getUTCFullYear(),[ty]:e=>e.getUTCMonth(),[ry]:e=>e.getUTCDate(),day:e=>e.getUTCDay(),[ay]:e=>e.getUTCHours(),[oy]:e=>e.getUTCMinutes(),[sy]:e=>e.getUTCSeconds(),[cy]:e=>e.getUTCMilliseconds()},Ly=[{units:[$v,ty,ry,ay,oy,sy,cy],step:1,aligned:()=>!0},{units:[$v,ty,ry,ay,oy,sy],step:1,aligned:(e,t)=>e.every(e=>t[cy](e)===0)},{units:[$v,ty,ry,ay,oy],step:1,aligned:(e,t)=>e.every(e=>t[sy](e)===0)},{units:[$v,ty,ry,ay,oy],step:5,aligned:(e,t)=>e.every(e=>t[oy](e)%5==0)},{units:[$v,ty,ry,ay,oy],step:10,aligned:(e,t)=>e.every(e=>t[oy](e)%10==0)},{units:[$v,ty,ry,ay],step:1,aligned:(e,t)=>e.every(e=>t[oy](e)===0)},{units:[$v,ty,ry],step:1,aligned:(e,t)=>e.every(e=>t[ay](e)===0)},{units:[$v,ny],step:1,skippable:!0,aligned:(e,t)=>new Set(e.map(e=>t.day(e))).size===1},{units:[$v,ty],step:1,aligned:(e,t)=>e.every(e=>t[ry](e)===1)},{units:[$v,ty],step:3,aligned:(e,t)=>e.every(e=>t[ty](e)%3==0)},{units:[$v],step:1,aligned:(e,t)=>e.every(e=>t[ty](e)===0)},{units:[$v],step:10,aligned:(e,t)=>e.every(e=>t[$v](e)%10==0)},{aligned:()=>!1}]}));function zy(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function By(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Vy(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function Hy(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,o=e.shortDays,s=e.months,c=e.shortMonths,l=Wy(i),u=Gy(i),d=Wy(a),f=Gy(a),p=Wy(o),m=Gy(o),h=Wy(s),g=Gy(s),_=Wy(c),v=Gy(c),y={a:N,A:P,b:F,B:ee,c:null,d:Xy,e:Xy,f:cce,g:vce,G:bce,H:ace,I:oce,j:sce,L:Zy,m:lce,M:uce,p:I,q:te,Q:rb,s:ib,S:dce,u:fce,U:pce,V:mce,w:hce,W:gce,x:null,X:null,y:_ce,Y:yce,Z:xce,"%":nb},b={a:L,A:ne,b:re,B:ie,c:null,d:$y,e:$y,f:Tce,g:Fce,G:Lce,H:Sce,I:Cce,j:wce,L:eb,m:Ece,M:Dce,p:ae,q:oe,Q:rb,s:ib,S:Oce,u:kce,U:Ace,V:jce,w:Mce,W:Nce,x:null,X:null,y:Pce,Y:Ice,Z:Rce,"%":nb},x={a:E,A:D,b:O,B:k,c:A,d:Jy,e:Jy,f:tce,g:qy,G:Ky,H:Yy,I:Yy,j:Zse,L:ece,m:Xse,M:Qse,p:T,q:Yse,Q:rce,s:ice,S:$se,u:Wse,U:Gse,V:Kse,w:Use,W:qse,x:j,X:M,y:qy,Y:Ky,Z:Jse,"%":nce};y.x=S(n,y),y.X=S(r,y),y.c=S(t,y),b.x=S(n,b),b.X=S(r,b),b.c=S(t,b);function S(e,t){return function(n){var r=[],i=-1,a=0,o=e.length,s,c,l;for(n instanceof Date||(n=new Date(+n));++i53)return null;`w`in r||(r.w=1),`Z`in r?(a=By(Vy(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?sv.ceil(a):sv(a),a=J_.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=zy(Vy(r.y,0,1)),o=a.getDay(),a=o>4||o===0?ev.ceil(a):ev(a),a=q_.offset(a,(r.V-1)*7),r.y=a.getFullYear(),r.m=a.getMonth(),r.d=a.getDate()+(r.w+6)%7)}else(`W`in r||`U`in r)&&(`w`in r||(r.w=`u`in r?r.u%7:+(`W`in r)),o=`Z`in r?By(Vy(r.y,0,1)).getUTCDay():zy(Vy(r.y,0,1)).getDay(),r.m=0,r.d=`W`in r?(r.w+6)%7+r.W*7-(o+5)%7:r.w+r.U*7-(o+6)%7);return`Z`in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,By(r)):zy(r)}}function w(e,t,n,r){for(var i=0,a=t.length,o=n.length,s,c;i=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=x[s in ab?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!=n.charCodeAt(r++))return-1}return r}function T(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1}function E(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function D(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1}function O(e,t,n){var r=_.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1}function k(e,t,n){var r=h.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1}function A(e,n,r){return w(e,t,n,r)}function j(e,t,r){return w(e,n,t,r)}function M(e,t,n){return w(e,r,t,n)}function N(e){return o[e.getDay()]}function P(e){return a[e.getDay()]}function F(e){return c[e.getMonth()]}function ee(e){return s[e.getMonth()]}function I(e){return i[+(e.getHours()>=12)]}function te(e){return 1+~~(e.getMonth()/3)}function L(e){return o[e.getUTCDay()]}function ne(e){return a[e.getUTCDay()]}function re(e){return c[e.getUTCMonth()]}function ie(e){return s[e.getUTCMonth()]}function ae(e){return i[+(e.getUTCHours()>=12)]}function oe(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=S(e+=``,y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+=``,b);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e+=``,!0);return t.toString=function(){return e},t}}}function Uy(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a[e.toLowerCase(),t]))}function Use(e,t,n){var r=ob.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Wse(e,t,n){var r=ob.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function Gse(e,t,n){var r=ob.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Kse(e,t,n){var r=ob.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function qse(e,t,n){var r=ob.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Ky(e,t,n){var r=ob.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function qy(e,t,n){var r=ob.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Jse(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||`00`)),n+r[0].length):-1}function Yse(e,t,n){var r=ob.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function Xse(e,t,n){var r=ob.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Jy(e,t,n){var r=ob.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Zse(e,t,n){var r=ob.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Yy(e,t,n){var r=ob.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Qse(e,t,n){var r=ob.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function $se(e,t,n){var r=ob.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function ece(e,t,n){var r=ob.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function tce(e,t,n){var r=ob.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function nce(e,t,n){var r=sb.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function rce(e,t,n){var r=ob.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function ice(e,t,n){var r=ob.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function Xy(e,t){return Uy(e.getDate(),t,2)}function ace(e,t){return Uy(e.getHours(),t,2)}function oce(e,t){return Uy(e.getHours()%12||12,t,2)}function sce(e,t){return Uy(1+q_.count(_v(e),e),t,3)}function Zy(e,t){return Uy(e.getMilliseconds(),t,3)}function cce(e,t){return Zy(e,t)+`000`}function lce(e,t){return Uy(e.getMonth()+1,t,2)}function uce(e,t){return Uy(e.getMinutes(),t,2)}function dce(e,t){return Uy(e.getSeconds(),t,2)}function fce(e){var t=e.getDay();return t===0?7:t}function pce(e,t){return Uy($_.count(_v(e)-1,e),t,2)}function Qy(e){var t=e.getDay();return t>=4||t===0?rv(e):rv.ceil(e)}function mce(e,t){return e=Qy(e),Uy(rv.count(_v(e),e)+(_v(e).getDay()===4),t,2)}function hce(e){return e.getDay()}function gce(e,t){return Uy(ev.count(_v(e)-1,e),t,2)}function _ce(e,t){return Uy(e.getFullYear()%100,t,2)}function vce(e,t){return e=Qy(e),Uy(e.getFullYear()%100,t,2)}function yce(e,t){return Uy(e.getFullYear()%1e4,t,4)}function bce(e,t){var n=e.getDay();return e=n>=4||n===0?rv(e):rv.ceil(e),Uy(e.getFullYear()%1e4,t,4)}function xce(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+Uy(t/60|0,`0`,2)+Uy(t%60,`0`,2)}function $y(e,t){return Uy(e.getUTCDate(),t,2)}function Sce(e,t){return Uy(e.getUTCHours(),t,2)}function Cce(e,t){return Uy(e.getUTCHours()%12||12,t,2)}function wce(e,t){return Uy(1+J_.count(vv(e),e),t,3)}function eb(e,t){return Uy(e.getUTCMilliseconds(),t,3)}function Tce(e,t){return eb(e,t)+`000`}function Ece(e,t){return Uy(e.getUTCMonth()+1,t,2)}function Dce(e,t){return Uy(e.getUTCMinutes(),t,2)}function Oce(e,t){return Uy(e.getUTCSeconds(),t,2)}function kce(e){var t=e.getUTCDay();return t===0?7:t}function Ace(e,t){return Uy(ov.count(vv(e)-1,e),t,2)}function tb(e){var t=e.getUTCDay();return t>=4||t===0?uv(e):uv.ceil(e)}function jce(e,t){return e=tb(e),Uy(uv.count(vv(e),e)+(vv(e).getUTCDay()===4),t,2)}function Mce(e){return e.getUTCDay()}function Nce(e,t){return Uy(sv.count(vv(e)-1,e),t,2)}function Pce(e,t){return Uy(e.getUTCFullYear()%100,t,2)}function Fce(e,t){return e=tb(e),Uy(e.getUTCFullYear()%100,t,2)}function Ice(e,t){return Uy(e.getUTCFullYear()%1e4,t,4)}function Lce(e,t){var n=e.getUTCDay();return e=n>=4||n===0?uv(e):uv.ceil(e),Uy(e.getUTCFullYear()%1e4,t,4)}function Rce(){return`+0000`}function nb(){return`%`}function rb(e){return+e}function ib(e){return Math.floor(e/1e3)}var ab,ob,sb,cb,lb=o((()=>{Tv(),ab={"-":``,_:` `,0:`0`},ob=/^\s*\d+/,sb=/^%/,cb=/[\\^$*+?|[\]().{}]/g}));function zce(e){return ub=Hy(e),db=ub.format,fb=ub.parse,pb=ub.utcFormat,mb=ub.utcParse,ub}var ub,db,fb,pb,mb,Bce=o((()=>{lb(),zce({dateTime:`%x, %X`,date:`%-m/%-d/%Y`,time:`%-I:%M:%S %p`,periods:[`AM`,`PM`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`]})})),hb=o((()=>{Bce(),lb()}));function gb(e){let t={};return n=>t[n]||(t[n]=e(n))}function Vce(e,t){return n=>{let r=e(n),i=r.indexOf(t);if(i<0)return r;let a=Hce(r,i),o=ai;)if(r[a]!==`0`){++a;break}return r.slice(0,a)+o}}function Hce(e,t){let n=e.lastIndexOf(`e`),r;if(n>0)return n;for(n=e.length;--n>t;)if(r=e.charCodeAt(n),r>=48&&r<=57)return n+1}function _b(e){let t=gb(e.format),n=e.formatPrefix;return{format:t,formatPrefix:n,formatFloat(e){let n=a_(e||`,`);if(n.precision==null){switch(n.precision=12,n.type){case`%`:n.precision-=2;break;case`e`:--n.precision;break}return Vce(t(n),t(`.1f`)(1)[1])}else return t(n)},formatSpan(e,r,i,a){a=a_(a??`,f`);let o=Jg(e,r,i),s=Math.max(Math.abs(e),Math.abs(r)),c;if(a.precision==null)switch(a.type){case`s`:return isNaN(c=S_(o,s))||(a.precision=c),n(a,s);case``:case`e`:case`g`:case`p`:case`r`:isNaN(c=C_(o,s))||(a.precision=c-(a.type===`e`));break;case`f`:case`%`:isNaN(c=x_(o))||(a.precision=c-(a.type===`%`)*2);break}return t(a)}}}function vb(){return Ob=_b({format:y_,formatPrefix:b_})}function yb(e){return _b(m_(e))}function bb(e){return arguments.length?Ob=yb(e):Ob}function xb(e,t,n){n||={},jh(n)||U(`Invalid time multi-format specifier: ${n}`);let r=t(sy),i=t(oy),a=t(ay),o=t(ry),s=t(ny),c=t(ty),l=t(ey),u=t($v),d=e(n.milliseconds||`.%L`),f=e(n.seconds||`:%S`),p=e(n.minutes||`%I:%M`),m=e(n.hours||`%I %p`),h=e(n.date||n.day||`%a %d`),g=e(n.week||`%b %d`),_=e(n.month||`%B`),v=e(n.quarter||`%B`),y=e(n.year||`%Y`);return e=>(r(e)vg(e)?t(e):xb(t,Uv,e),utcFormat:e=>vg(e)?n(e):xb(n,Wv,e),timeParse:gb(e.parse),utcParse:gb(e.utcParse)}}function Cb(){return kb=Sb({format:db,parse:fb,utcFormat:pb,utcParse:mb})}function wb(e){return Sb(Hy(e))}function Tb(e){return arguments.length?kb=wb(e):kb}function Eb(e,t){let n=e?yb(e):bb(),r=t?wb(t):Tb();return Ab(n,r)}function Db(e,t){let n=arguments.length;return n&&n!==2&&U(`defaultLocale expects either zero or two arguments.`),n?Ab(bb(e),Tb(t)):Ab(bb(),Tb())}function Uce(){return vb(),Cb(),Db()}var Ob,kb,Ab,jb=o((()=>{e_(),w_(),Ry(),Dg(),hb(),vb(),Cb(),Ab=(e,t)=>og({},e,t)}));function Wce(e){return t=>({options:t||{},sanitize:Kce,load:Gce,fileAccess:!1,file:qce(e),http:Yce})}async function Gce(e,t){let n=await this.sanitize(e,t),r=n.href;return n.localFile?this.file(r):this.http(r,t?.http)}async function Kce(e,t){t=og({},this.options,t);let n=this.fileAccess,r={href:null},i,a,o,s=Hb.test(e.replace(Ub,``));(e==null||typeof e!=`string`||!s)&&U(`Sanitize failure, invalid URI: `+G(e));let c=Vb.test(e);return(o=t.baseURL)&&!c&&(!e.startsWith(`/`)&&!o.endsWith(`/`)&&(e=`/`+e),e=o+e),a=(i=e.startsWith(Wb))||t.mode===`file`||t.mode!==`http`&&!c&&n,i?e=e.slice(7):e.startsWith(`//`)&&(t.defaultProtocol===`file`?(e=e.slice(2),a=!0):e=(t.defaultProtocol||`http`)+`:`+e),Object.defineProperty(r,"localFile",{value:!!a}),r.href=e,t.target&&(r.target=t.target+``),t.rel&&(r.rel=t.rel+``),t.context===`image`&&t.crossOrigin&&(r.crossOrigin=t.crossOrigin+``),r}function qce(e){return e?t=>new Promise((n,r)=>{e.readFile(t,(e,t)=>{e?r(e):n(t)})}):Jce}async function Jce(){U(`No file system access.`)}async function Yce(e,t){let n=og({},this.options.http,t),r=t&&t.response,i=await fetch(e,n);return i.ok?eg(i[r])?i[r]():i.text():U(i.status+``+i.statusText)}function Mb(e,t){if(!e||!e.length)return`unknown`;let n=e.length,r=Zb.length,i=Zb.map((e,t)=>t+1);for(let a=0,o=0,s,c;ae===0?t:e,0)-1]}function Nb(e,t){return t.reduce((t,n)=>(t[n]=Mb(e,n),t),{})}function Pb(e){let t=function(t,n){let r={delimiter:e};return Fb(t,n?og(n,r):r)};return t.responseType=`text`,t}function Fb(e,t){return t.header&&(e=t.header.map(G).join(t.delimiter)+` -`+e),uoe(t.delimiter).parse(e+``)}function Xce(e){return typeof Buffer==`function`&&eg(Buffer.isBuffer)?Buffer.isBuffer(e):!1}function Ib(e,t){let n=t&&t.property?bh(t.property):Ch;return jh(e)&&!Xce(e)?Zce(n(e),t):n(JSON.parse(e))}function Zce(e,t){return!W(e)&&Mae(e)&&(e=[...e]),t&&t.copy?JSON.parse(JSON.stringify(e)):e}function Lb(e,t){let n,r,i,a;return e=Ib(e,t),t&&t.feature?(n=yoe,i=t.feature):t&&t.mesh?(n=Toe,i=t.mesh,a=$b[t.filter]):U(`Missing TopoJSON feature or mesh parameter.`),r=(r=e.objects[i])?n(e,r,a):U(`Invalid TopoJSON object: `+i),r&&r.features||[r]}function Rb(e,t){return arguments.length>1?(ex[e]=t,this):cg(ex,e)?ex[e]:null}function zb(e){let t=Rb(e);return t&&t.responseType||`text`}function Bb(e,t,n,r){t||={};let i=Rb(t.type||`json`);return i||U(`Unknown data format type: `+t.type),e=i(e,t),t.parse&&Qce(e,t.parse,n,r),cg(e,`columns`)&&delete e.columns,e}function Qce(e,t,n,r){if(!e.length)return;let i=Tb();n||=i.timeParse,r||=i.utcParse;let a=e.columns||Object.keys(e[0]),o,s,c,l,u,d;t===`auto`&&(t=Nb(e,a)),a=Object.keys(t);let f=a.map(e=>{let i=t[e],a,o;if(i&&(i.startsWith(`date:`)||i.startsWith(`utc:`)))return a=i.split(/:(.+)?/,2),o=a[1],(o[0]===`'`&&o[o.length-1]===`'`||o[0]===`"`&&o[o.length-1]===`"`)&&(o=o.slice(1,-1)),(a[0]===`utc`?r:n)(o);if(!Xb[i])throw Error(`Illegal format pattern: `+e+`:`+i);return Xb[i]});for(c=0,u=e.length,d=a.length;c{Dg(),foe(),koe(),jb(),Vb=/^(data:|([A-Za-z]+:)?\/\/)/,Hb=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,Ub=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Wb=`file://`,Gb=e=>e!=null&&e===e,Kb=e=>e===`true`||e===`false`||e===!0||e===!1,qb=e=>!Number.isNaN(Date.parse(e)),Jb=e=>!Number.isNaN(+e)&&!(e instanceof Date),Yb=e=>Jb(e)&&Number.isInteger(+e),Xb={boolean:Sg,integer:Rh,number:Rh,date:Cg,string:wg,unknown:Ch},Zb=[Kb,Yb,Jb,qb],Qb=[`boolean`,`integer`,`number`,`date`],Fb.responseType=`text`,Ib.responseType=`json`,$b={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t},Lb.responseType=`json`,ex={dsv:Fb,csv:Pb(`,`),tsv:Pb(` `),json:Ib,topojson:Lb},tx=Wce(null)}));function rx(e){let t=e||Ch,n=[],r={};return n.add=e=>{let i=t(e);return r[i]||(r[i]=1,n.push(e)),n},n.remove=e=>{let i=t(e);if(r[i]){r[i]=0;let t=n.indexOf(e);t>=0&&n.splice(t,1)}return n},n}async function ix(e,t){try{await t(e)}catch(t){e.error(t)}}function ax(e){return!!(e&&ox(e))}function ox(e){return e[jx]}function sx(e,t){return e[jx]=t,e}function cx(e){let t=e===Object(e)?e:{data:e};return ox(t)?t:sx(t,Mx++)}function lx(e){return ux(e,cx({}))}function ux(e,t){for(let n in e)t[n]=e[n];return t}function dx(e,t){return sx(t,ox(e))}function fx(e,t){return e?t?(n,r)=>e(n,r)||ox(t(n))-ox(t(r)):(t,n)=>e(t,n)||ox(t)-ox(n):null}function px(e){return e&&e.constructor===mx}function mx(){let e=[],t=[],n=[],r=[],i=[],a=null,o=!1;return{constructor:mx,insert(t){let n=Qh(t),r=n.length;for(let t=0;t{m(e)&&(l[ox(e)]=-1)});for(d=0,f=e.length;d0&&(_(h,m,p.value),s.modifies(m));for(d=0,f=i.length;d{m(e)&&l[ox(e)]>0&&_(e,p.field,p.value)}),s.modifies(p.field);if(o)s.mod=t.length||r.length?c.filter(e=>l[ox(e)]>0):c.slice();else for(g in u)s.mod.push(u[g]);return(a||a==null&&(t.length||r.length))&&s.clean(!0),s}}}function hx(){Object.defineProperty(this,Nx,{writable:!0,value:{}})}function gx(e,t,n,r){this.id=++Px,this.value=e,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,t&&(this._update=t),n&&this.parameters(n,r)}function _x(e){return function(t){let n=this.flags;return arguments.length===0?!!(n&e):(this.flags=t?n|e:n&~e,this)}}function $ce(e,t,n,r){let i=1,a;return e instanceof gx?a=e:e&&e.prototype instanceof gx?a=new e:eg(e)?a=new gx(null,e):(i=0,a=new gx(e,t)),this.rank(a),i&&(r=n,n=t),n&&this.connect(a,a.parameters(n,r)),this.touch(a),a}function ele(e,t){let n=e.rank,r=t.length;for(let i=0;it=e);return n.requests=0,n.done=()=>{--n.requests===0&&(e._pending=null,t(e))},e._pending=n}function sle(e,t,n,r,i){return(e instanceof gx?lle:cle)(this,e,t,n,r,i),this}function cle(e,t,n,r,i,a){let o=og({},a,Bx),s,c;eg(n)||(n=ig(n)),r===void 0?s=t=>e.touch(n(t)):eg(r)?(c=new gx(null,r,i,!1),s=t=>{c.evaluate(t);let r=n(t),i=c.value;px(i)?e.pulse(r,i,a):e.update(r,i,o)}):s=t=>e.update(n(t),r,o),t.apply(s)}function lle(e,t,n,r,i,a){if(r===void 0)t.targets().add(n);else{let o=a||{},s=new gx(null,ule(n,r),i,!1);s.modified(o.force),s.rank=t.rank,t.targets().add(s),n&&(s.skip(!0),s.value=n.value,s.targets().add(n),e.connect(n,[s]))}}function ule(e,t){return t=eg(t)?t:ig(t),e?function(n,r){let i=t(n,r);return e.skip()||(e.skip(i!==this.value).value=i),i}:t}function dle(e){e.rank=++this._rank}function fle(e){let t=[e],n,r,i;for(;t.length;)if(this.rank(n=t.pop()),r=n._targets)for(i=r.length;--i>=0;)t.push(n=r[i]),n===e&&U(`Cycle detected in dataflow graph.`)}function bx(e,t,n){this.dataflow=e,this.stamp=t??-1,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function xx(e,t){let n=[];return Eg(e,t,e=>n.push(e)),n}function Sx(e,t){let n={};return e.visit(t,e=>{n[ox(e)]=1}),e=>n[ox(e)]?null:e}function Cx(e,t){return e?(n,r)=>e(n,r)&&t(n,r):t}function wx(e,t,n,r){let i=this,a=0;this.dataflow=e,this.stamp=t,this.fields=null,this.encode=r||null,this.pulses=n;for(let e of n)if(e.stamp===t){if(e.fields){let t=i.fields||={};for(let n in e.fields)t[n]=1}e.changed(i.ADD)&&(a|=i.ADD),e.changed(i.REM)&&(a|=i.REM),e.changed(i.MOD)&&(a|=i.MOD)}this.changes=a}async function ple(e,t,n){let r=this,i=[];if(r._pulse)return Tx(r);if(r._pending&&await r._pending,t&&await ix(r,t),!r._touched.length)return r.debug(`Dataflow invoked, but nothing to do.`),r;let a=++r._clock;r._pulse=new bx(r,a,e),r._touched.forEach(e=>r._enqueue(e,!0)),r._touched=rx(Sh);let o=0,s,c,l;try{for(;r._heap.size()>0;){if(s=r._heap.pop(),s.rank!==s.qrank){r._enqueue(s,!0);continue}c=s.run(r._getPulse(s,e)),c.then?c=await c:c.async&&(i.push(c.async),c=Vx),c!==Vx&&s._targets&&s._targets.forEach(e=>r._enqueue(e)),++o}}catch(e){r._heap.clear(),l=e}if(r._input={},r._pulse=null,r.debug(`Pulse ${a}: ${o} operators`),l&&(r._postrun=[],r.error(l)),r._postrun.length){let e=r._postrun.sort((e,t)=>t.priority-e.priority);r._postrun=[];for(let t=0;tr.runAsync(null,()=>{e.forEach(e=>{try{e(r)}catch(e){r.error(e)}})})),r}async function mle(e,t,n){for(;this._running;)await this._running;let r=()=>this._running=null;return(this._running=this.evaluate(e,t,n)).then(r,r),this._running}function hle(e,t,n){return this._pulse?Tx(this):(this.evaluate(e,t,n),this)}function gle(e,t,n){if(this._pulse||t)this._postrun.push({priority:n||0,callback:e});else try{e(this)}catch(e){this.error(e)}}function Tx(e){return e.error(`Dataflow already running. Use runAsync() to chain invocations.`),e}function _le(e,t){let n=e.stampe.pulse),t):this._input[e.id]||yle(this._pulse,n&&n.pulse)}function yle(e,t){return t&&t.stamp===e.stamp?t:(e=e.fork(),t&&t!==Vx&&(e.source=t.source),e)}function ble(e,t){let n=t||Qx;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this}function xle(e,t,n){let r=n||Qx;return(e.set(t)||r.force)&&this.touch(e,r),this}function Sle(e,t,n){this.touch(e,n||Qx);let r=new bx(this,this._clock+ +!this._pulse),i=e.pulse&&e.pulse.source||[];return r.target=e,this._input[e.id]=t.pulse(r,i),this}function Cle(e){let t=[];return{clear:()=>t=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),Ex(t,0,t.length-1,e)),pop:()=>{let n=t.pop(),r;return t.length?(r=t[0],t[0]=n,wle(t,0,e)):r=n,r}}}function Ex(e,t,n,r){let i,a,o=e[n];for(;n>t;){if(a=n-1>>1,i=e[a],r(o,i)<0){e[n]=i,n=a;continue}break}return e[n]=o}function wle(e,t,n){let r=t,i=e.length,a=e[t],o=(t<<1)+1,s;for(;o=0&&(o=s),e[t]=e[o],t=o,o=(t<<1)+1;return e[t]=a,Ex(e,r,t,n)}function Dx(){this.logger(kh()),this.logLevel(1),this._clock=0,this._rank=0,this._locale=Db();try{this._loader=tx()}catch{}this._touched=rx(Sh),this._input={},this._pulse=null,this._heap=Cle((e,t)=>e.qrank-t.qrank),this._postrun=[]}function Ox(e){return function(){return this._log[e].apply(this,arguments)}}function K(e,t){gx.call(this,e,null,t)}function kx(e){let t=Ax(e);return t&&t.Definition||null}function Ax(e){return e&&=e.toLowerCase(),cg($x,e)?$x[e]:null}var jx,Mx,Nx,Px,Fx,Ix,Lx,Rx,zx,Bx,Vx,Hx,Ux,Wx,Gx,Kx,qx,Jx,Yx,Xx,Zx,Qx,$x,eS=o((()=>{Dg(),nx(),jb(),jx=Symbol(`vega_id`),Mx=1,Nx=`_:mod:_`,hx.prototype={set(e,t,n,r){let i=this,a=i[e],o=i[Nx];return t!=null&&t>=0?(a[t]!==n||r)&&(a[t]=n,o[t+`:`+e]=-1,o[e]=-1):(a!==n||r)&&(i[e]=n,o[e]=W(n)?1+n.length:-1),i},modified(e,t){let n=this[Nx];if(!arguments.length){for(let e in n)if(n[e])return!0;return!1}else if(W(e)){for(let t=0;t=0?t+1{o instanceof gx?(o!==this&&(t&&o.targets().add(this),a.push(o)),i.push({op:o,name:e,index:n})):r.set(e,n,o)};for(o in e)if(s=e[o],o===Fx)Qh(s).forEach(e=>{e instanceof gx?e!==this&&(e.targets().add(this),a.push(e)):U(`Pulse parameters must be operator instances.`)}),this.source=s;else if(W(s))for(r.set(o,-1,Array(c=s.length)),l=0;l{let n=Date.now();return n-t>e?(t=n,1):0})},debounce(e){let t=yx();return this.targets().add(yx(null,null,ag(e,e=>{let n=e.dataflow;t.receive(e),n&&n.run&&n.run()}))),t},between(e,t){let n=!1;return e.targets().add(yx(null,null,()=>n=!0)),t.targets().add(yx(null,null,()=>n=!1)),this.filter(()=>n)},detach(){this._filter=Eh,this._targets=null}},Bx={skip:!0},Vx={},Hx=1,Ux=2,Wx=4,Gx=3,Kx=5,qx=7,Jx=8,Yx=16,Xx=32,Zx=64,bx.prototype={StopPropagation:Vx,ADD:Hx,REM:Ux,MOD:Wx,ADD_REM:Gx,ADD_MOD:Kx,ALL:qx,REFLOW:Jx,SOURCE:Yx,NO_SOURCE:Xx,NO_FIELDS:Zx,fork(e){return new bx(this.dataflow).init(this,e)},clone(){let e=this.fork(qx);return e.add=e.add.slice(),e.rem=e.rem.slice(),e.mod=e.mod.slice(),e.source&&=e.source.slice(),e.materialize(23)},addAll(){let e=this;return!e.source||e.add===e.rem||!e.rem.length&&e.source.length===e.add.length?e:(e=new bx(this.dataflow).init(this),e.add=e.source,e.rem=[],e)},init(e,t){let n=this;return n.stamp=e.stamp,n.encode=e.encode,e.fields&&!(t&Zx)&&(n.fields=e.fields),t&Hx?(n.addF=e.addF,n.add=e.add):(n.addF=null,n.add=[]),t&Ux?(n.remF=e.remF,n.rem=e.rem):(n.remF=null,n.rem=[]),t&Wx?(n.modF=e.modF,n.mod=e.mod):(n.modF=null,n.mod=[]),t&Xx?(n.srcF=null,n.source=null):(n.srcF=e.srcF,n.source=e.source,e.cleans&&(n.cleans=e.cleans)),n},runAfter(e){this.dataflow.runAfter(e)},changed(e){let t=e||qx;return t&Hx&&this.add.length||t&Ux&&this.rem.length||t&Wx&&this.mod.length},reflow(e){if(e)return this.fork(qx).reflow();let t=this.add.length,n=this.source&&this.source.length;return n&&n!==t&&(this.mod=this.source,t&&this.filter(Wx,Sx(this,Hx))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){let t=this.fields||={};return W(e)?e.forEach(e=>t[e]=!0):t[e]=!0,this},modified(e,t){let n=this.fields;return(t||this.mod.length)&&n?arguments.length?W(e)?e.some(e=>n[e]):n[e]:!!n:!1},filter(e,t){let n=this;return e&Hx&&(n.addF=Cx(n.addF,t)),e&Ux&&(n.remF=Cx(n.remF,t)),e&Wx&&(n.modF=Cx(n.modF,t)),e&Yx&&(n.srcF=Cx(n.srcF,t)),n},materialize(e){e||=qx;let t=this;return e&Hx&&t.addF&&(t.add=xx(t.add,t.addF),t.addF=null),e&Ux&&t.remF&&(t.rem=xx(t.rem,t.remF),t.remF=null),e&Wx&&t.modF&&(t.mod=xx(t.mod,t.modF),t.modF=null),e&Yx&&t.srcF&&(t.source=t.source.filter(t.srcF),t.srcF=null),t},visit(e,t){let n=this,r=t;if(e&Yx)return Eg(n.source,n.srcF,r),n;e&Hx&&Eg(n.add,n.addF,r),e&Ux&&Eg(n.rem,n.remF,r),e&Wx&&Eg(n.mod,n.modF,r);let i=n.source;if(e&Jx&&i){let e=n.add.length+n.mod.length;e===i.length||(e?Eg(i,Sx(n,Kx),r):Eg(i,n.srcF,r))}return n}},fg(wx,bx,{fork(e){let t=new bx(this.dataflow).init(this,e&this.NO_FIELDS);return e!==void 0&&(e&t.ADD&&this.visit(t.ADD,e=>t.add.push(e)),e&t.REM&&this.visit(t.REM,e=>t.rem.push(e)),e&t.MOD&&this.visit(t.MOD,e=>t.mod.push(e))),t},changed(e){return this.changes&e},modified(e){let t=this,n=t.fields;return n&&t.changes&t.MOD?W(e)?e.some(e=>n[e]):n[e]:0},filter(){U(`MultiPulse does not support filtering.`)},materialize(){U(`MultiPulse does not support materialization.`)},visit(e,t){let n=this,r=n.pulses,i=r.length,a=0;if(e&n.SOURCE)for(;athis.pulse=e):t!==e.StopPropagation&&(this.pulse=t),t},evaluate(e){let t=this.marshall(e.stamp),n=this.transform(t,e);return t.clear(),n},transform(){}}),$x={}}));function*tS(e,t){if(t==null)for(let t of e)t!=null&&t!==``&&(t=+t)>=t&&(yield t);else{let n=-1;for(let r of e)r=t(r,++n,e),r!=null&&r!==``&&(r=+r)>=r&&(yield r)}}function nS(e,t,n){let r=Float64Array.from(tS(e,n));return r.sort(Pg),t.map(e=>ase(r,e))}function rS(e,t){return nS(e,[.25,.5,.75],t)}function iS(e,t){let n=e.length,r=Boe(e,t),i=rS(e,t),a=(i[2]-i[0])/1.34;return 1.06*(Math.min(r,a)||r||Math.abs(i[0])||1)*n**-.2}function aS(e){let t=e.maxbins||20,n=e.base||10,r=Math.log(n),i=e.divide||[5,2],a=e.extent[0],o=e.extent[1],s,c,l,u,d,f,p=e.span||o-a||Math.abs(a)||1;if(e.step)s=e.step;else if(e.steps){for(u=p/t,d=0,f=e.steps.length;dt;)s*=n;for(d=0,f=i.length;d=l&&p/u<=t&&(s=u)}u=Math.log(s);let m=n**(-(u>=0?0:~~(-u/r)+1)-1);return(e.nice||e.nice===void 0)&&(u=Math.floor(a/s+m)*s,a=ae);let i=e.length,a=new Float64Array(i),o=0,s=1,c=r(e[0]),l=c,u=c+t,d;for(;s=u){for(l=(c+l)/2;o>1);oi;)e[o--]=e[r]}r=i,i=a}return e}function Dle(e){return function(){return e=(1103515245*e+12345)%2147483647,e/2147483647}}function Ole(e,t){t??(t=e,e=0);let n,r,i,a={min(e){return arguments.length?(n=e||0,i=r-n,a):n},max(e){return arguments.length?(r=e||0,i=r-n,a):r},sample(){return n+Math.floor(i*RS())},pdf(e){return e===Math.floor(e)&&e>=n&&e=r?1:(t-n+1)/i},icdf(e){return e>=0&&e<=1?n-1+Math.floor(e*i):NaN}};return a.min(e).max(t)}function cS(e,t){e||=0,t??=1;let n=0,r=0,i,a;if(VS===VS)n=VS,VS=NaN;else{do n=RS()*2-1,r=RS()*2-1,i=n*n+r*r;while(i===0||i>1);a=Math.sqrt(-2*Math.log(i)/i),n*=a,VS=r*a}return e+n*t}function lS(e,t,n){n??=1;let r=(e-(t||0))/n;return Math.exp(-.5*r*r)/(n*zS)}function uS(e,t,n){t||=0,n??=1;let r=(e-t)/n,i=Math.abs(r),a;if(i>37)a=0;else{let e=Math.exp(-i*i/2),t;i<7.07106781186547?(t=.0352624965998911*i+.700383064443688,t=t*i+6.37396220353165,t=t*i+33.912866078383,t=t*i+112.079291497871,t=t*i+221.213596169931,t=t*i+220.206867912376,a=e*t,t=.0883883476483184*i+1.75566716318264,t=t*i+16.064177579207,t=t*i+86.7807322029461,t=t*i+296.564248779674,t=t*i+637.333633378831,t=t*i+793.826512519948,t=t*i+440.413735824752,a/=t):(t=i+.65,t=i+4/t,t=i+3/t,t=i+2/t,t=i+1/t,a=e/t/2.506628274631)}return r>0?1-a:a}function dS(e,t,n){return e<0||e>1?NaN:(t||0)+(n??1)*BS*kle(2*e-1)}function kle(e){let t=-Math.log((1-e)*(1+e)),n;return t<6.25?(t-=3.125,n=-364441206401782e-35,n=-16850591381820166e-35+n*t,n=128584807152564e-32+n*t,n=11157877678025181e-33+n*t,n=-1333171662854621e-31+n*t,n=20972767875968562e-33+n*t,n=6637638134358324e-30+n*t,n=-4054566272975207e-29+n*t,n=-8151934197605472e-29+n*t,n=26335093153082323e-28+n*t,n=-12975133253453532e-27+n*t,n=-5415412054294628e-26+n*t,n=1.0512122733215323e-9+n*t,n=-4.112633980346984e-9+n*t,n=-2.9070369957882005e-8+n*t,n=4.2347877827932404e-7+n*t,n=-13654692000834679e-22+n*t,n=-13882523362786469e-21+n*t,n=.00018673420803405714+n*t,n=-.000740702534166267+n*t,n=-.006033670871430149+n*t,n=.24015818242558962+n*t,n=1.6536545626831027+n*t):t<16?(t=Math.sqrt(t)-3.25,n=2.2137376921775787e-9,n=9.075656193888539e-8+n*t,n=-2.7517406297064545e-7+n*t,n=1.8239629214389228e-8+n*t,n=15027403968909828e-22+n*t,n=-4013867526981546e-21+n*t,n=29234449089955446e-22+n*t,n=12475304481671779e-21+n*t,n=-47318229009055734e-21+n*t,n=6828485145957318e-20+n*t,n=24031110387097894e-21+n*t,n=-.0003550375203628475+n*t,n=.0009532893797373805+n*t,n=-.0016882755560235047+n*t,n=.002491442096107851+n*t,n=-.003751208507569241+n*t,n=.005370914553590064+n*t,n=1.0052589676941592+n*t,n=3.0838856104922208+n*t):Number.isFinite(t)?(t=Math.sqrt(t)-5,n=-27109920616438573e-27,n=-2555641816996525e-25+n*t,n=1.5076572693500548e-9+n*t,n=-3.789465440126737e-9+n*t,n=7.61570120807834e-9+n*t,n=-1.496002662714924e-8+n*t,n=2.914795345090108e-8+n*t,n=-6.771199775845234e-8+n*t,n=2.2900482228026655e-7+n*t,n=-9.9298272942317e-7+n*t,n=4526062597223154e-21+n*t,n=-1968177810553167e-20+n*t,n=7599527703001776e-20+n*t,n=-.00021503011930044477+n*t,n=-.00013871931833623122+n*t,n=1.0103004648645344+n*t,n=4.849906401408584+n*t):n=1/0,n*e}function fS(e,t){let n,r,i={mean(e){return arguments.length?(n=e||0,i):n},stdev(e){return arguments.length?(r=e??1,i):r},sample:()=>cS(n,r),pdf:e=>lS(e,n,r),cdf:e=>uS(e,n,r),icdf:e=>dS(e,n,r)};return i.mean(e).stdev(t)}function pS(e,t){let n=fS(),r=0,i={data(n){return arguments.length?(e=n,r=n?n.length:0,i.bandwidth(t)):e},bandwidth(n){return arguments.length?(t=n,!t&&e&&(t=iS(e)),i):t},sample(){return e[~~(RS()*r)]+t*n.sample()},pdf(i){let a=0,o=0;for(;omS(n,r),pdf:e=>hS(e,n,r),cdf:e=>gS(e,n,r),icdf:e=>_S(e,n,r)};return i.mean(e).stdev(t)}function yS(e,t){let n=0,r;function i(e){let t=[],r=0,i;for(i=0;i=t&&e<=n?1/(n-t):0}function SS(e,t,n){return n??(n=t??1,t=0),en?1:(e-t)/(n-t)}function CS(e,t,n){return n??(n=t??1,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function wS(e,t){let n,r,i={min(e){return arguments.length?(n=e||0,i):n},max(e){return arguments.length?(r=e??1,i):r},sample:()=>bS(n,r),pdf:e=>xS(e,n,r),cdf:e=>SS(e,n,r),icdf:e=>CS(e,n,r)};return t??(t=e??1,e=0),i.min(e).max(t)}function TS(e,t,n){let r=0,i=0;for(let a of e){let e=n(a);t(a)==null||e==null||isNaN(e)||(r+=(e-r)/++i)}return{coef:[r],predict:()=>r,rSquared:0}}function ES(e,t,n,r){let i=r-e*e,a=Math.abs(i)<1e-24?0:(n-e*t)/i;return[t-a*e,a]}function DS(e,t,n,r){e=e.filter(e=>{let r=t(e),i=n(e);return r!=null&&(r=+r)>=r&&i!=null&&(i=+i)>=i}),r&&e.sort((e,n)=>t(e)-t(n));let i=e.length,a=new Float64Array(i),o=new Float64Array(i),s=0,c=0,l=0,u,d,f;for(f of e)a[s]=u=+t(f),o[s]=d=+n(f),++s,c+=(u-c)/s,l+=(d-l)/s;for(s=0;s=a&&o!=null&&(o=+o)>=o&&r(a,o,++i)}function kS(e,t,n,r,i){let a=0,o=0;return OS(e,t,n,(e,t)=>{let n=t-i(e),s=t-r;a+=n*n,o+=s*s}),1-a/o}function AS(e,t,n){let r=0,i=0,a=0,o=0,s=0;OS(e,t,n,(e,t)=>{++s,r+=(e-r)/s,i+=(t-i)/s,a+=(e*t-a)/s,o+=(e*e-o)/s});let c=ES(r,i,a,o),l=e=>c[0]+c[1]*e;return{coef:c,predict:l,rSquared:kS(e,t,n,i,l)}}function jS(e,t,n){let r=0,i=0,a=0,o=0,s=0;OS(e,t,n,(e,t)=>{++s,e=Math.log(e),r+=(e-r)/s,i+=(t-i)/s,a+=(e*t-a)/s,o+=(e*e-o)/s});let c=ES(r,i,a,o),l=e=>c[0]+c[1]*Math.log(e);return{coef:c,predict:l,rSquared:kS(e,t,n,i,l)}}function MS(e,t,n){let[r,i,a,o]=DS(e,t,n),s=0,c=0,l=0,u=0,d=0,f,p,m;OS(e,t,n,(e,t)=>{f=r[d++],p=Math.log(t),m=f*t,s+=(t*p-s)/d,c+=(m-c)/d,l+=(m*p-l)/d,u+=(f*m-u)/d});let[h,g]=ES(c/o,s/o,l/o,u/o),_=e=>Math.exp(h+g*(e-a));return{coef:[Math.exp(h-g*a),g],predict:_,rSquared:kS(e,t,n,o,_)}}function NS(e,t,n){let r=0,i=0,a=0,o=0,s=0,c=0;OS(e,t,n,(e,t)=>{let n=Math.log(e),l=Math.log(t);++c,r+=(n-r)/c,i+=(l-i)/c,a+=(n*l-a)/c,o+=(n*n-o)/c,s+=(t-s)/c});let l=ES(r,i,a,o),u=e=>l[0]*e**+l[1];return l[0]=Math.exp(l[0]),{coef:l,predict:u,rSquared:kS(e,t,n,s,u)}}function PS(e,t,n){let[r,i,a,o]=DS(e,t,n),s=r.length,c=0,l=0,u=0,d=0,f=0,p,m,h,g;for(p=0;p(e-=a,y*e*e+b*e+x+o);return{coef:[x-b*a+y*a*a+o,b-2*y*a,y],predict:S,rSquared:kS(e,t,n,o,S)}}function FS(e,t,n,r){if(r===0)return TS(e,t,n);if(r===1)return AS(e,t,n);if(r===2)return PS(e,t,n);let[i,a,o,s]=DS(e,t,n),c=i.length,l=[],u=[],d=r+1,f,p,m,h,g;for(f=0;f{e-=o;let t=s+_[0]+_[1]*e+_[2]*e*e;for(f=3;f=0;--a)for(s=t[a],c=1,i[a]+=s,o=1;o<=a;++o)c*=(a+1-o)/o,i[a-o]+=s*n**+o*c;return i[0]+=r,i}function jle(e){let t=e.length-1,n=[],r,i,a,o,s;for(r=0;rMath.abs(e[r][o])&&(o=i);for(a=r;a=r;a--)e[a][i]-=e[a][r]*e[r][i]/e[r][r]}for(i=t-1;i>=0;--i){for(s=0,a=i+1;ai[o]-n?r:o,c=0,l=0,p=0,m=0,h=0,g=1/Math.abs(i[s]-n||1);for(let e=r;e<=o;++e){let t=i[e],r=a[e],o=Mle(Math.abs(n-t)*g)*f[e],s=t*o;c+=o,l+=s,p+=r*o,m+=r*s,h+=t*s}let[_,v]=ES(l/c,p/c,m/c,h/c);u[e]=_+v*n,d[e]=Math.abs(a[e]-u[e]),Nle(i,e+1,t)}if(e===HS)break;let n=lse(d);if(Math.abs(n)=1?US:(r=1-t*t)*r}return Ple(i,u,o,s)}function Mle(e){return(e=1-e*e*e)*e*e}function Nle(e,t,n){let r=e[t],i=n[0],a=n[1]+1;if(!(a>=e.length))for(;t>i&&e[a]-r<=r-e[i];)n[0]=++i,n[1]=a,++a}function Ple(e,t,n,r){let i=e.length,a=[],o=0,s=0,c=[],l;for(;o[t,e(t)],a=t[0],o=t[1],s=o-a,c=s/r,l=[i(a)],u=[];if(n===r){for(let e=1;e0;)u.push(i(a+e/n*s))}let d=l[0],f=u[u.length-1],p=1/s,m=Fle(d[1],u);for(;f;){let e=i((d[0]+f[0])/2);e[0]-d[0]>=c&&Ile(d,e,f,p,m)>WS?u.push(e):(d=f,l.push(f),u.pop()),f=u[u.length-1]}return l}function Fle(e,t){let n=e,r=e,i=t.length;for(let e=0;er&&(r=i)}return 1/(r-n)}function Ile(e,t,n,r,i){let a=Math.atan2(i*(n[1]-e[1]),r*(n[0]-e[0])),o=Math.atan2(i*(t[1]-e[1]),r*(t[0]-e[0]));return Math.abs(a-o)}var RS,zS,BS,VS,HS,US,WS,GS=o((()=>{e_(),RS=Math.random,zS=Math.sqrt(2*Math.PI),BS=Math.SQRT2,VS=NaN,HS=2,US=1e-12,WS=.5*Math.PI/180})),Lle=c({aggregate:()=>QS,bin:()=>$S,collect:()=>tC,compare:()=>nC,countpattern:()=>rC,cross:()=>iC,density:()=>oC,dotbin:()=>lC,expression:()=>uC,extent:()=>dC,facet:()=>pC,field:()=>mC,filter:()=>hC,flatten:()=>gC,fold:()=>_C,formula:()=>vC,generate:()=>yC,impute:()=>bC,joinaggregate:()=>xC,kde:()=>SC,key:()=>CC,load:()=>wC,lookup:()=>EC,multiextent:()=>DC,multivalues:()=>OC,params:()=>kC,pivot:()=>AC,prefacet:()=>jC,project:()=>MC,proxy:()=>NC,quantile:()=>PC,relay:()=>FC,sample:()=>IC,sequence:()=>LC,sieve:()=>RC,subflow:()=>fC,timeunit:()=>zC,tupleindex:()=>BC,values:()=>VC,window:()=>UC});function Rle(e){return t=>{let n=e.length,r=1,i=String(e[0](t));for(;rog({name:e,aggregate_param:r,out:n||e},KC,t)}function JS(e,t,n){return qC[e](n,t)}function YS(e,t){return e.idx-t.idx}function Ble(e){let t={};e.forEach(e=>t[e.name]=e);let n=e=>{e.req&&e.req.forEach(e=>{t[e]||n(t[e]=qC[e]())})};return e.forEach(n),Object.values(t).sort(YS)}function Vle(){this.valid=0,this.missing=0,this._ops.forEach(e=>e.aggregate_param==null?e.init(this):e.init(this,e.aggregate_param))}function Hle(e,t){if(e==null||e===``){++this.missing;return}e===e&&(++this.valid,this._ops.forEach(n=>n.add(this,e,t)))}function Ule(e,t){if(e==null||e===``){--this.missing;return}e===e&&(--this.valid,this._ops.forEach(n=>n.rem(this,e,t)))}function Wle(e){return this._out.forEach(t=>e[t.out]=t.value(this)),e}function XS(e,t){let n=t||Ch,r=Ble(e),i=e.slice().sort(YS);function a(e){this._ops=r,this._out=i,this.cell=e,this.init()}return a.prototype.init=Vle,a.prototype.add=Hle,a.prototype.rem=Ule,a.prototype.set=Wle,a.prototype.get=n,a.fields=e.map(e=>e.out),a}function ZS(e){this._key=e?bh(e):ox,this.reset()}function QS(e){K.call(this,null,e),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}function $S(e){K.call(this,null,e)}function eC(e,t,n){let r=e,i=t||[],a=n||[],o={},s=0;return{add:e=>a.push(e),remove:e=>o[r(e)]=++s,size:()=>i.length,data:(e,t)=>(s&&=(i=i.filter(e=>!o[r(e)]),o={},0),t&&e&&i.sort(e),a.length&&(i=e?Wae(e,i,a.sort(e)):i.concat(a),a=[]),i)}}function tC(e){K.call(this,[],e)}function nC(e){gx.call(this,null,Gle,e)}function Gle(e){return this.value&&!e.modified()?this.value:ng(e.fields,e.orders)}function rC(e){K.call(this,null,e)}function Kle(e,t,n){switch(t){case`upper`:e=e.toUpperCase();break;case`lower`:e=e.toLowerCase();break}return e.match(n)}function iC(e){K.call(this,null,e)}function qle(e,t,n,r){for(var i=[],a={},o=e.length,s=0,c,l;saC(e,t))):typeof r[n]===$C&&r[n](e[n]);return r}function oC(e){K.call(this,null,e)}function Jle(e){return()=>e.materialize(e.SOURCE).source}function sC(e,t){return e?e.map((e,n)=>t[n]||uh(e)):null}function cC(e,t,n){let r=[],i=e=>e(c),a,o,s,c,l,u;if(t==null)r.push(e.map(n));else for(a={},o=0,s=e.length;ot(n,e),dh(t),uh(t))}function dC(e){K.call(this,[void 0,void 0],e)}function fC(e,t){gx.call(this,e),this.parent=t,this.count=0}function pC(e){K.call(this,{},e),this._keys=ug();let t=this._targets=[];t.active=0,t.forEach=e=>{for(let n=0,r=t.active;nbh(e)):bh(e.name,e.as)}function hC(e){K.call(this,ug(),e)}function gC(e){K.call(this,[],e)}function _C(e){K.call(this,[],e)}function vC(e){K.call(this,null,e)}function yC(e){K.call(this,[],e)}function bC(e){K.call(this,[],e)}function Zle(e){var t=e.method||aw.value,n;if(aw[t]==null)U(`Unrecognized imputation method: `+t);else if(t===aw.value)return n=e.value===void 0?0:e.value,()=>n;else return aw[t]}function Qle(e){let t=e.field;return e=>e?t(e):NaN}function $le(e,t,n,r){var i=e=>e(g),a=[],o=r?r.slice():[],s={},c={},l,u,d,f,p,m,h,g;for(o.forEach((e,t)=>s[e]=t+1),f=0,h=e.length;fi&&(i=o[1]);return[r,i]}function OC(e){gx.call(this,null,rue,e)}function rue(e){return this.value&&!e.modified()?this.value:e.values.reduce((e,t)=>e.concat(t),[])}function kC(e){K.call(this,null,e)}function AC(e){QS.call(this,e)}function iue(e,t){let n=e.field,r=e.value,i=(e.op===`count`?`__count__`:e.op)||`sum`,a=dh(n).concat(dh(r)),o=oue(n,e.limit||0,t);return t.changed()&&e.set(`__pivot__`,null,null,!0),{key:e.key,groupby:e.groupby,ops:o.map(()=>i),fields:o.map(e=>aue(e,n,r,a)),as:o.map(e=>e+``),modified:e.modified.bind(e)}}function aue(e,t,n,r){return lh(r=>t(r)===e?n(r):NaN,r,e+``)}function oue(e,t,n){let r={},i=[];return n.visit(n.SOURCE,t=>{let n=e(t);r[n]||(r[n]=1,i.push(n))}),i.sort(rg),t?i.slice(0,t):i}function jC(e){pC.call(this,e)}function MC(e){K.call(this,null,e)}function sue(e,t,n,r){for(let i=0,a=n.length;ic[e]=1)}p(e.sort),t.forEach((e,t)=>{let c=n[t],m=r[t],h=i[t]||null,g=uh(c),_=qS(e,g,a[t]);if(p(c),o.push(_),cg(lw,e))s.push(cue(e,c,m,_));else{if(c==null&&e!==`count`&&U(`Null aggregate field specified.`),e===`count`){u.push(_);return}f=!1;let t=l[g];t||(t=l[g]=[],t.field=c,d.push(t)),t.push(JS(e,h,_))}}),(u.length||d.length)&&(this.cell=uue(d,u,f)),this.inputs=Object.keys(c)}function uue(e,t,n){e=e.map(e=>XS(e,e.field));let r={num:0,agg:null,store:!1,count:t};if(!n)for(var i=e.length,a=r.agg=Array(i),o=0;on?n:e}function fue(e,t,n,r){e.p0=e.i0,e.p1=e.i1;let i=t[0]==null?0:n+t[0],a=t[1]==null?r:n+t[1]+1;e.i0=WC(i,0,r),e.i1=WC(a,0,r),e.index=n}function pue(e,t){let n=e.i0,r=e.i1-1,i=e.compare,a=e.data,o=a.length-1;n>0&&!i(a[n],a[n-1])&&(e.i0=t.left(a,a[n])),r{Dg(),eS(),GS(),e_(),Ry(),GC=()=>{},KC={init:GC,add:GC,rem:GC,idx:0},qC={values:{init:e=>e.cell.store=!0,value:e=>e.cell.data.values(),idx:-1},count:{value:e=>e.cell.num},__count__:{value:e=>e.missing+e.valid},missing:{value:e=>e.missing},valid:{value:e=>e.valid},sum:{init:e=>e.sum=0,value:e=>e.valid?e.sum:void 0,add:(e,t)=>e.sum+=+t,rem:(e,t)=>e.sum-=t},product:{init:e=>e.product=1,value:e=>e.valid?e.product:void 0,add:(e,t)=>e.product*=t,rem:(e,t)=>e.product/=t},mean:{init:e=>e.mean=0,value:e=>e.valid?e.mean:void 0,add:(e,t)=>(e.mean_d=t-e.mean,e.mean+=e.mean_d/e.valid),rem:(e,t)=>(e.mean_d=t-e.mean,e.mean-=e.valid?e.mean_d/e.valid:e.mean)},average:{value:e=>e.valid?e.mean:void 0,req:[`mean`],idx:1},variance:{init:e=>e.dev=0,value:e=>e.valid>1?Math.max(0,e.dev)/(e.valid-1):void 0,add:(e,t)=>e.dev+=e.mean_d*(t-e.mean),rem:(e,t)=>e.dev-=e.mean_d*(t-e.mean),req:[`mean`],idx:1},variancep:{value:e=>e.valid?Math.max(0,e.dev)/e.valid:void 0,req:[`variance`],idx:2},stdev:{value:e=>e.valid>1?Math.sqrt(Math.max(0,e.dev)/(e.valid-1)):void 0,req:[`variance`],idx:2},stdevp:{value:e=>e.valid?Math.sqrt(Math.max(0,e.dev)/e.valid):void 0,req:[`variance`],idx:2},stderr:{value:e=>e.valid>1?Math.sqrt(Math.max(0,e.dev)/(e.valid*(e.valid-1))):void 0,req:[`variance`],idx:2},distinct:{value:e=>e.cell.data.distinct(e.get),req:[`values`],idx:3},ci0:{value:e=>e.cell.data.ci0(e.get),req:[`values`],idx:3},ci1:{value:e=>e.cell.data.ci1(e.get),req:[`values`],idx:3},median:{value:e=>e.cell.data.q2(e.get),req:[`values`],idx:3},q1:{value:e=>e.cell.data.q1(e.get),req:[`values`],idx:3},q3:{value:e=>e.cell.data.q3(e.get),req:[`values`],idx:3},min:{init:e=>e.min=void 0,value:e=>e.min=Number.isNaN(e.min)?e.cell.data.min(e.get):e.min,add:(e,t)=>{(t{t<=e.min&&(e.min=NaN)},req:[`values`],idx:4},max:{init:e=>e.max=void 0,value:e=>e.max=Number.isNaN(e.max)?e.cell.data.max(e.get):e.max,add:(e,t)=>{(t>e.max||e.max===void 0)&&(e.max=t)},rem:(e,t)=>{t>=e.max&&(e.max=NaN)},req:[`values`],idx:4},argmin:{init:e=>e.argmin=void 0,value:e=>e.argmin||e.cell.data.argmin(e.get),add:(e,t,n)=>{t{t<=e.min&&(e.argmin=void 0)},req:[`min`,`values`],idx:3},argmax:{init:e=>e.argmax=void 0,value:e=>e.argmax||e.cell.data.argmax(e.get),add:(e,t,n)=>{t>e.max&&(e.argmax=n)},rem:(e,t)=>{t>=e.max&&(e.argmax=void 0)},req:[`max`,`values`],idx:3},exponential:{init:(e,t)=>{e.exp=0,e.exp_r=t},value:e=>e.valid?e.exp*(1-e.exp_r)/(1-e.exp_r**e.valid):void 0,add:(e,t)=>e.exp=e.exp_r*e.exp+t,rem:(e,t)=>e.exp=(e.exp-t/e.exp_r**(e.valid-1))/e.exp_r},exponentialb:{value:e=>e.valid?e.exp*(1-e.exp_r):void 0,req:[`exponential`],idx:1}},JC=Object.keys(qC).filter(e=>e!==`__count__`),[...JC,`__count__`].forEach(e=>{qC[e]=zle(e,qC[e])}),YC=ZS.prototype,YC.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},YC.add=function(e){this._add.push(e)},YC.rem=function(e){this._rem.push(e)},YC.values=function(){if(this._get=null,this._rem.length===0)return this._add;let e=this._add,t=this._rem,n=this._key,r=e.length,i=t.length,a=Array(r-i),o={},s,c,l;for(s=0;s=0;)a=e(t[r])+``,cg(n,a)||(n[a]=1,++i);return i},YC.extent=function(e){if(this._get!==e||!this._ext){let t=this.values(),n=Cae(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},YC.argmin=function(e){return this.extent(e)[0]||{}},YC.argmax=function(e){return this.extent(e)[1]||{}},YC.min=function(e){let t=this.extent(e)[0];return t==null?void 0:e(t)},YC.max=function(e){let t=this.extent(e)[1];return t==null?void 0:e(t)},YC.quartile=function(e){return(this._get!==e||!this._q)&&(this._q=rS(this.values(),e),this._get=e),this._q},YC.q1=function(e){return this.quartile(e)[0]},YC.q2=function(e){return this.quartile(e)[1]},YC.q3=function(e){return this.quartile(e)[2]},YC.ci=function(e){return(this._get!==e||!this._ci)&&(this._ci=oS(this.values(),1e3,.05,e),this._get=e),this._ci},YC.ci0=function(e){return this.ci(e)[0]},YC.ci1=function(e){return this.ci(e)[1]},QS.Definition={type:`Aggregate`,metadata:{generates:!0,changes:!0},params:[{name:`groupby`,type:`field`,array:!0},{name:`ops`,type:`enum`,array:!0,values:JC},{name:`aggregate_params`,type:`number`,null:!0,array:!0},{name:`fields`,type:`field`,null:!0,array:!0},{name:`as`,type:`string`,null:!0,array:!0},{name:`drop`,type:`boolean`,default:!0},{name:`cross`,type:`boolean`,default:!1},{name:`key`,type:`field`}]},fg(QS,K,{transform(e,t){let n=this,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.modified();return n.stamp=r.stamp,n.value&&(i||t.modified(n._inputs,!0))?(n._prev=n.value,n.value=i?n.init(e):Object.create(null),t.visit(t.SOURCE,e=>n.add(e))):(n.value=n.value||n.init(e),t.visit(t.REM,e=>n.rem(e)),t.visit(t.ADD,e=>n.add(e))),r.modifies(n._outputs),n._drop=e.drop!==!1,e.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),t.clean()&&n._drop&&r.clean(!0).runAfter(()=>this.clean()),n.changes(r)},cross(){let e=this,t=e.value,n=e._dnames,r=n.map(()=>({})),i=n.length;function a(e){let t,a,o,s;for(t in e)for(o=e[t].tuple,a=0;a{let t=uh(e);return i(e),n.push(t),t}),this.cellkey=e.key?e.key:KS(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];let a=e.fields||[null],o=e.ops||[`count`],s=e.aggregate_params||[null],c=e.as||[],l=a.length,u={},d,f,p,m,h,g,_;for(l!==o.length&&U(`Unmatched number of fields and aggregate ops.`),_=0;_XS(e,e.field)),Object.create(null)},cellkey:KS(),cell(e,t){let n=this.value[e];return n?n.num===0&&this._drop&&n.stamp{let t=r(e);e[s]=t,e[c]=t==null?null:i+a*(1+(t-i)/a)}:e=>e[s]=r(e)),t.modifies(n?o:s)},_bins(e){if(this.value&&!e.modified())return this.value;let t=e.field,n=aS(e),r=n.step,i=n.start,a=i+Math.ceil((n.stop-i)/r)*r,o,s;(o=e.anchor)!=null&&(s=o-(i+r*Math.floor((o-i)/r)),i+=s,a+=s);let c=function(e){let n=Rh(t(e));return n==null?null:na?1/0:(n=Math.max(i,Math.min(n,a-r)),i+r*Math.floor(XC+(n-i)/r))};return c.start=i,c.stop=a,c.step=r,this.value=lh(c,dh(t),e.name||`bin_`+uh(t))}}),tC.Definition={type:`Collect`,metadata:{source:!0},params:[{name:`sort`,type:`compare`}]},fg(tC,K,{transform(e,t){let n=t.fork(t.ALL),r=eC(ox,this.value,n.materialize(n.ADD).add),i=e.sort,a=t.changed()||i&&(e.modified(`sort`)||t.modified(i.fields));return n.visit(n.REM,r.remove),this.modified(a),this.value=n.source=r.data(fx(i),a),t.source&&t.source.root&&(this.value.root=t.source.root),n}}),fg(nC,gx),rC.Definition={type:`CountPattern`,metadata:{generates:!0,changes:!0},params:[{name:`field`,type:`field`,required:!0},{name:`case`,type:`enum`,values:[`upper`,`lower`,`mixed`],default:`mixed`},{name:`pattern`,type:`string`,default:`[\\w"]+`},{name:`stopwords`,type:`string`,default:``},{name:`as`,type:`string`,array:!0,length:2,default:[`text`,`count`]}]},fg(rC,K,{transform(e,t){let n=t=>n=>{for(var r=Kle(s(n),e.case,a)||[],i,c=0,l=r.length;ci[e]=1+(i[e]||0)),u=n(e=>--i[e]);return r?t.visit(t.SOURCE,l):(t.visit(t.ADD,l),t.visit(t.REM,u)),this._finish(t,c)},_parameterCheck(e,t){let n=!1;return(e.modified(`stopwords`)||!this._stop)&&(this._stop=RegExp(`^`+(e.stopwords||``)+`$`,`i`),n=!0),(e.modified(`pattern`)||!this._match)&&(this._match=new RegExp(e.pattern||`[\\w']+`,`g`),n=!0),(e.modified(`field`)||t.modified(e.field.fields))&&(n=!0),n&&(this._counts={}),n},_finish(e,t){let n=this._counts,r=this._tuples||={},i=t[0],a=t[1],o=e.fork(e.NO_SOURCE|e.NO_FIELDS),s,c,l;for(s in n)c=r[s],l=n[s]||0,!c&&l?(r[s]=c=cx({}),c[i]=s,c[a]=l,o.add.push(c)):l===0?(c&&o.rem.push(c),n[s]=null,r[s]=null):c[a]!==l&&(c[a]=l,o.mod.push(c));return o.modifies(t)}}),iC.Definition={type:`Cross`,metadata:{generates:!0},params:[{name:`filter`,type:`expr`},{name:`as`,type:`string`,array:!0,length:2,default:[`a`,`b`]}]},fg(iC,K,{transform(e,t){let n=t.fork(t.NO_SOURCE),r=e.as||[`a`,`b`],i=r[0],a=r[1],o=!this.value||t.changed(t.ADD_REM)||e.modified(`as`)||e.modified(`filter`),s=this.value;return o?(s&&(n.rem=s),s=t.materialize(t.SOURCE).source,n.add=this.value=qle(s,i,a,e.filter||Eh)):n.mod=s,n.source=this.value,n.modifies(r)}}),ZC={kde:pS,mixture:yS,normal:fS,lognormal:vS,uniform:wS},QC=`distributions`,$C=`function`,ew=`field`,tw=[{key:{function:`normal`},params:[{name:`mean`,type:`number`,default:0},{name:`stdev`,type:`number`,default:1}]},{key:{function:`lognormal`},params:[{name:`mean`,type:`number`,default:0},{name:`stdev`,type:`number`,default:1}]},{key:{function:`uniform`},params:[{name:`min`,type:`number`,default:0},{name:`max`,type:`number`,default:1}]},{key:{function:`kde`},params:[{name:`field`,type:`field`,required:!0},{name:`from`,type:`data`},{name:`bandwidth`,type:`number`,default:0}]}],nw={key:{function:`mixture`},params:[{name:`distributions`,type:`param`,array:!0,params:tw},{name:`weights`,type:`number`,array:!0}]},oC.Definition={type:`Density`,metadata:{generates:!0},params:[{name:`extent`,type:`number`,array:!0,length:2},{name:`steps`,type:`number`},{name:`minsteps`,type:`number`,default:25},{name:`maxsteps`,type:`number`,default:200},{name:`method`,type:`string`,default:`pdf`,values:[`pdf`,`cdf`]},{name:`distribution`,type:`param`,params:tw.concat(nw)},{name:`as`,type:`string`,array:!0,default:[`value`,`density`]}]},fg(oC,K,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){let r=aC(e.distribution,Jle(t)),i=e.steps||e.minsteps||25,a=e.steps||e.maxsteps||200,o=e.method||`pdf`;o!==`pdf`&&o!==`cdf`&&U(`Invalid density method: `+o),!e.extent&&!r.data&&U(`Missing density extent parameter.`),o=r[o];let s=e.as||[`value`,`density`],c=e.extent||sg(r.data()),l=LS(o,c,i,a).map(e=>{let t={};return t[s[0]]=e[0],t[s[1]]=e[1],cx(t)});this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}}),rw=`bin`,lC.Definition={type:`DotBin`,metadata:{modifies:!0},params:[{name:`field`,type:`field`,required:!0},{name:`groupby`,type:`field`,array:!0},{name:`step`,type:`number`},{name:`smooth`,type:`boolean`,default:!1},{name:`as`,type:`string`,default:rw}]},iw=(e,t)=>xg(sg(e,t))/30,fg(lC,K,{transform(e,t){if(this.value&&!(e.modified()||t.changed()))return t;let n=t.materialize(t.SOURCE).source,r=cC(t.source,e.groupby,Ch),i=e.smooth||!1,a=e.field,o=e.step||iw(n,a),s=fx((e,t)=>a(e)-a(t)),c=e.as||rw,l=r.length,u=1/0,d=-1/0,f=0,p;for(;fd&&(d=t),e[++p][c]=t}return this.value={start:u,stop:d,step:o},t.reflow(!0).modifies(c)}}),fg(uC,gx),dC.Definition={type:`Extent`,metadata:{},params:[{name:`field`,type:`field`,required:!0}]},fg(dC,K,{transform(e,t){let n=this.value,r=e.field,i=t.changed()||t.modified(r.fields)||e.modified(`field`),a=n[0],o=n[1];if((i||a==null)&&(a=1/0,o=-1/0),t.visit(i?t.SOURCE:t.ADD,e=>{let t=Rh(r(e));t!=null&&(to&&(o=t))}),!Number.isFinite(a)||!Number.isFinite(o)){let e=uh(r);e&&=` for field "${e}"`,t.dataflow.warn(`Infinite extent${e}: [${a}, ${o}]`),a=o=void 0}this.value=[a,o]}}),fg(fC,gx,{connect(e){return this.detachSubflow=e.detachSubflow,this.targets().add(e),e.source=this},add(e){this.count+=1,this.value.add.push(e)},rem(e){--this.count,this.value.rem.push(e)},mod(e){this.value.mod.push(e)},init(e){this.value.init(e,e.NO_SOURCE)},evaluate(){return this.value}}),fg(pC,K,{activate(e){this._targets[this._targets.active++]=e},subflow(e,t,n,r){let i=this.value,a=cg(i,e)&&i[e],o,s;return a?a.value.stampe&&e.count>0);this.initTargets(e)}},initTargets(e){let t=this._targets,n=t.length,r=e?e.length:0,i=0;for(;ithis.subflow(e,i,t);return this._group=e.group||{},this.initTargets(),t.visit(t.REM,e=>{let t=ox(e),n=a.get(t);n!==void 0&&(a.delete(t),s(n).rem(e))}),t.visit(t.ADD,e=>{let t=r(e);a.set(ox(e),t),s(t).add(e)}),o||t.modified(r.fields)?t.visit(t.MOD,e=>{let t=ox(e),n=a.get(t),i=r(e);n===i?s(i).mod(e):(a.set(t,i),s(n).rem(e),s(i).add(e))}):t.changed(t.MOD)&&t.visit(t.MOD,e=>{s(a.get(ox(e))).mod(e)}),o&&t.visit(t.REFLOW,e=>{let t=ox(e),n=a.get(t),i=r(e);n!==i&&(a.set(t,i),s(n).rem(e),s(i).add(e))}),t.clean()?n.runAfter(()=>{this.clean(),a.clean()}):a.empty>n.cleanThreshold&&n.runAfter(a.clean),t}}),fg(mC,gx),hC.Definition={type:`Filter`,metadata:{changes:!0},params:[{name:`expr`,type:`expr`,required:!0}]},fg(hC,K,{transform(e,t){let n=t.dataflow,r=this.value,i=t.fork(),a=i.add,o=i.rem,s=i.mod,c=e.expr,l=!0;t.visit(t.REM,e=>{let t=ox(e);r.has(t)?r.delete(t):o.push(e)}),t.visit(t.ADD,t=>{c(t,e)?a.push(t):r.set(ox(t),1)});function u(t){let n=ox(t),i=c(t,e),u=r.get(n);i&&u?(r.delete(n),a.push(t)):!i&&!u?(r.set(n,1),o.push(t)):l&&i&&!u&&s.push(t)}return t.visit(t.MOD,u),e.modified()&&(l=!1,t.visit(t.REFLOW,u)),r.empty>n.cleanThreshold&&n.runAfter(r.clean),i}}),gC.Definition={type:`Flatten`,metadata:{generates:!0},params:[{name:`fields`,type:`field`,array:!0,required:!0},{name:`index`,type:`string`},{name:`as`,type:`string`,array:!0}]},fg(gC,K,{transform(e,t){let n=t.fork(t.NO_SOURCE),r=e.fields,i=sC(r,e.as||[]),a=e.index||null,o=i.length;return n.rem=this.value,t.visit(t.SOURCE,e=>{let t=r.map(t=>t(e)),s=t.reduce((e,t)=>Math.max(e,t.length),0),c=0,l,u;for(;c{for(let t=0,a;tt[r]=n(t,e))}}),fg(yC,K,{transform(e,t){let n=t.fork(t.ALL),r=e.generator,i=this.value,a=e.size-i.length,o,s,c;if(a>0){for(o=[];--a>=0;)o.push(c=cx(r(e))),i.push(c);n.add=n.add.length?n.materialize(n.ADD).add.concat(o):o}else s=i.slice(0,-a),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(s):s,i=i.slice(-a);return n.source=this.value=i,n}}),aw={value:`value`,median:lse,mean:sse,min:Xg,max:Yg},ow=[],bC.Definition={type:`Impute`,metadata:{changes:!0},params:[{name:`field`,type:`field`,required:!0},{name:`key`,type:`field`,required:!0},{name:`keyvals`,array:!0},{name:`groupby`,type:`field`,array:!0},{name:`method`,type:`enum`,default:`value`,values:[`value`,`mean`,`median`,`max`,`min`]},{name:`value`,default:0}]},fg(bC,K,{transform(e,t){var n=t.fork(t.ALL),r=Zle(e),i=Qle(e),a=uh(e.field),o=uh(e.key),s=(e.groupby||[]).map(uh),c=$le(t.source,e.groupby,e.key,e.keyvals),l=[],u=this.value,d=c.domain.length,f,p,m,h,g,_,v,y,b,x;for(g=0,y=c.length;gn.add(e))):(i=n.value=n.value||this.init(e),t.visit(t.REM,e=>n.rem(e)),t.visit(t.ADD,e=>n.add(e))),n.changes(),t.visit(t.SOURCE,e=>{og(e,i[n.cellkey(e)].tuple)}),t.reflow(r).modifies(this._outputs)},changes(){let e=this._adds,t=this._mods,n,r;for(n=0,r=this._alen;n{let n=pS(t,o)[s],r=e.counts?t.length:1;LS(n,u||sg(t),d,f).forEach(e=>{let n={};for(let e=0;e(this._pending=Qh(e.data),e=>e.touch(this)))}:n.request(e.url,e.format).then(e=>TC(this,t,Qh(e.data)))}}),EC.Definition={type:`Lookup`,metadata:{modifies:!0},params:[{name:`index`,type:`index`,params:[{name:`from`,type:`data`,required:!0},{name:`key`,type:`field`,required:!0}]},{name:`values`,type:`field`,array:!0},{name:`fields`,type:`field`,array:!0,required:!0},{name:`as`,type:`string`,array:!0},{name:`default`,default:null}]},fg(EC,K,{transform(e,t){let n=e.fields,r=e.index,i=e.values,a=e.default==null?null:e.default,o=e.modified(),s=n.length,c=o?t.SOURCE:t.ADD,l=t,u=e.as,d,f,p;return i?(f=i.length,s>1&&!u&&U(`Multi-field lookup requires explicit "as" parameter.`),u&&u.length!==s*f&&U(`The "as" parameter has too few output field names.`),u||=i.map(uh),d=function(e){for(var t=0,o=0,c,l;tt.modified(e.fields)),c|=p?t.MOD:0),t.visit(c,d),l.modifies(u)}}),fg(DC,gx),fg(OC,gx),fg(kC,K,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),AC.Definition={type:`Pivot`,metadata:{generates:!0,changes:!0},params:[{name:`groupby`,type:`field`,array:!0},{name:`field`,type:`field`,required:!0},{name:`value`,type:`field`,required:!0},{name:`op`,type:`enum`,values:JC,default:`sum`},{name:`limit`,type:`number`,default:0},{name:`key`,type:`field`}]},fg(AC,QS,{_transform:QS.prototype.transform,transform(e,t){return this._transform(iue(e,t),t)}}),fg(jC,pC,{transform(e,t){let n=e.subflow,r=e.field,i=e=>this.subflow(ox(e),n,t,e);return(e.modified(`field`)||r&&t.modified(dh(r)))&&U(`PreFacet does not support field modification.`),this.initTargets(),r?(t.visit(t.MOD,e=>{let t=i(e);r(e).forEach(e=>t.mod(e))}),t.visit(t.ADD,e=>{let t=i(e);r(e).forEach(e=>t.add(cx(e)))}),t.visit(t.REM,e=>{let t=i(e);r(e).forEach(e=>t.rem(e))})):(t.visit(t.MOD,e=>i(e).mod(e)),t.visit(t.ADD,e=>i(e).add(e)),t.visit(t.REM,e=>i(e).rem(e))),t.clean()&&t.runAfter(()=>this.clean()),t}}),MC.Definition={type:`Project`,metadata:{generates:!0,changes:!0},params:[{name:`fields`,type:`field`,array:!0},{name:`as`,type:`string`,null:!0,array:!0}]},fg(MC,K,{transform(e,t){let n=t.fork(t.NO_SOURCE),r=e.fields,i=sC(e.fields,e.as||[]),a=r?(e,t)=>sue(e,t,r,i):ux,o;return this.value?o=this.value:(t=t.addAll(),o=this.value={}),t.visit(t.REM,e=>{let t=ox(e);n.rem.push(o[t]),o[t]=null}),t.visit(t.ADD,e=>{let t=a(e,cx({}));o[ox(e)]=t,n.add.push(t)}),t.visit(t.MOD,e=>{n.mod.push(a(e,o[ox(e)]))}),n}}),fg(NC,K,{transform(e,t){return this.value=e.value,e.modified(`value`)?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}}),PC.Definition={type:`Quantile`,metadata:{generates:!0,changes:!0},params:[{name:`groupby`,type:`field`,array:!0},{name:`field`,type:`field`,required:!0},{name:`probs`,type:`number`,array:!0},{name:`step`,type:`number`,default:.01},{name:`as`,type:`string`,array:!0,default:[`prob`,`value`]}]},sw=1e-14,fg(PC,K,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.as||[`prob`,`value`];if(this.value&&!e.modified()&&!t.changed())return n.source=this.value,n;let i=t.materialize(t.SOURCE).source,a=cC(i,e.groupby,e.field),o=(e.groupby||[]).map(uh),s=[],c=e.step||.01,l=e.probs||$g(c/2,1-sw,c),u=l.length;return a.forEach(e=>{let t=nS(e,l);for(let n=0;n{let t=ox(e);n.rem.push(r[t]),r[t]=null}),t.visit(t.ADD,e=>{let t=lx(e);r[ox(e)]=t,n.add.push(t)}),t.visit(t.MOD,e=>{let t=r[ox(e)];for(let r in e)t[r]=e[r],n.modifies(r);n.mod.push(t)})),n}}),IC.Definition={type:`Sample`,metadata:{},params:[{name:`size`,type:`number`,default:1e3}]},fg(IC,K,{transform(e,t){let n=t.fork(t.NO_SOURCE),r=e.modified(`size`),i=e.size,a=this.value.reduce((e,t)=>(e[ox(t)]=1,e),{}),o=this.value,s=this.count,c=0;function l(e){let t,r;o.length=c&&(t=o[r],a[ox(t)]&&n.rem.push(t),o[r]=e)),++s}if(t.rem.length&&(t.visit(t.REM,e=>{let t=ox(e);a[t]&&(a[t]=-1,n.rem.push(e)),--s}),o=o.filter(e=>a[ox(e)]!==-1)),(t.rem.length||r)&&o.length{a[ox(e)]||l(e)}),c=-1),r&&o.length>i){let e=o.length-i;for(let t=0;t{a[ox(e)]&&n.mod.push(e)}),t.add.length&&t.visit(t.ADD,l),(t.add.length||c<0)&&(n.add=o.filter(e=>!a[ox(e)])),this.count=s,this.value=n.source=o,n}}),LC.Definition={type:`Sequence`,metadata:{generates:!0,changes:!0},params:[{name:`start`,type:`number`,required:!0},{name:`stop`,type:`number`,required:!0},{name:`step`,type:`number`,default:1},{name:`as`,type:`string`,default:`data`}]},fg(LC,K,{transform(e,t){if(this.value&&!e.modified())return;let n=t.materialize().fork(t.MOD),r=e.as||`data`;return n.rem=this.value?t.rem.concat(this.value):t.rem,this.value=$g(e.start,e.stop,e.step||1).map(e=>{let t={};return t[r]=e,cx(t)}),n.add=t.add.concat(this.value),n}}),fg(RC,K,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}}),cw=[`unit0`,`unit1`],zC.Definition={type:`TimeUnit`,metadata:{modifies:!0},params:[{name:`field`,type:`field`,required:!0},{name:`interval`,type:`boolean`,default:!0},{name:`units`,type:`enum`,values:ly,array:!0},{name:`step`,type:`number`,default:1},{name:`maxbins`,type:`number`,default:40},{name:`extent`,type:`date`,array:!0},{name:`inferUnits`,type:`boolean`,default:!1},{name:`timezone`,type:`enum`,default:`local`,values:[`local`,`utc`]},{name:`as`,type:`string`,array:!0,length:2,default:cw}]},fg(zC,K,{transform(e,t){let n=e.field,r=e.interval!==!1,i=e.timezone===`utc`,a=this._floor(e,t),o=(i?Wv:Uv)(a.unit).offset,s=e.as||cw,c=s[0],l=s[1],u=a.step,d=a.start||1/0,f=a.stop||-1/0,p=t.ADD;return(e.modified()||t.changed(t.REM)||t.modified(dh(n)))&&(t=t.reflow(!0),p=t.SOURCE,d=1/0,f=-1/0),t.visit(p,e=>{let t=n(e),i,s;t==null?(e[c]=null,r&&(e[l]=null)):(e[c]=i=s=a(t),r&&(e[l]=s=o(i,u)),if&&(f=s))}),a.start=d,a.stop=f,t.modifies(r?s:c)},_floor(e,t){let n=e.timezone===`utc`;e.inferUnits&&(e.units||e.step!=null||e.maxbins!=null||e.extent)&&t.dataflow.warn(`TimeUnit inferUnits overrides units, step, maxbins and extent.`);let{units:r,step:i}=e.inferUnits?Qv(t.materialize(t.SOURCE).source,e.field,n):e.units?{units:e.units,step:e.step||1}:Zv({extent:e.extent||sg(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),a=Ev(r),o=this.value||{},s=(n?Hv:Vv)(a,i);return s.unit=Ih(a),s.units=a,s.step=i,s.start=o.start,s.stop=o.stop,this.value=s}}),fg(BC,K,{transform(e,t){let n=t.dataflow,r=e.field,i=this.value,a=e=>i.set(r(e),e),o=!0;return e.modified(`field`)||t.modified(r.fields)?(i.clear(),t.visit(t.SOURCE,a)):t.changed()?(t.visit(t.REM,e=>i.delete(r(e))),t.visit(t.ADD,a)):o=!1,this.modified(o),i.empty>n.cleanThreshold&&n.runAfter(i.clean),t.fork()}}),fg(VC,K,{transform(e,t){(!this.value||e.modified(`field`)||e.modified(`sort`)||t.changed()||e.sort&&t.modified(e.sort.fields))&&(this.value=(e.sort?t.source.slice().sort(fx(e.sort)):t.source).map(e.field))}}),lw={row_number:function(){return{next:e=>e.index+1}},rank:function(){let e;return{init:()=>e=1,next:t=>{let n=t.index,r=t.data;return n&&t.compare(r[n-1],r[n])?e=n+1:e}}},dense_rank:function(){let e;return{init:()=>e=1,next:t=>{let n=t.index,r=t.data;return n&&t.compare(r[n-1],r[n])?++e:e}}},percent_rank:function(){let e=lw.rank(),t=e.next;return{init:e.init,next:e=>(t(e)-1)/(e.data.length-1)}},cume_dist:function(){let e;return{init:()=>e=0,next:t=>{let n=t.data,r=t.compare,i=t.index;if(e0||U(`ntile num must be greater than zero.`);let n=lw.cume_dist(),r=n.next;return{init:n.init,next:e=>Math.ceil(t*r(e))}},lag:function(e,t){return t=+t||1,{next:n=>{let r=n.index-t;return r>=0?e(n.data[r]):null}}},lead:function(e,t){return t=+t||1,{next:n=>{let r=n.index+t,i=n.data;return re(t.data[t.i0])}},last_value:function(e){return{next:t=>e(t.data[t.i1-1])}},nth_value:function(e,t){return t=+t,t>0||U(`nth_value nth must be greater than zero.`),{next:n=>{let r=n.i0+(t-1);return rt=null,next:n=>{let r=e(n.data[n.index]);return r==null?t:t=r}}},next_value:function(e){let t,n;return{init:()=>(t=null,n=-1),next:r=>{let i=r.data;return r.index<=n?t:(n=lue(e,i,r.index))<0?(n=i.length,t=null):t=e(i[n])}}}},uw=Object.keys(lw),dw=HC.prototype,dw.init=function(){this.windows.forEach(e=>e.init()),this.cell&&this.cell.init()},dw.update=function(e,t){let n=this.cell,r=this.windows,i=e.data,a=r&&r.length,o;if(n){for(o=e.p0;othis.group(i(e)),o=this.state;(!o||n)&&(o=this.state=new HC(e)),n||t.modified(o.inputs)?(this.value={},t.visit(t.SOURCE,e=>a(e).add(e))):(t.visit(t.REM,e=>a(e).remove(e)),t.visit(t.ADD,e=>a(e).add(e)));for(let t=0,n=this._mlen;t{}));function hue(e){return e>1?0:e<-1?Sw:Math.acos(e)}function mw(e){return e>=1?Cw:e<=-1?-Cw:Math.asin(e)}var hw,gw,_w,vw,yw,bw,xw,Sw,Cw,ww,Tw=o((()=>{hw=Math.abs,gw=Math.atan2,_w=Math.cos,vw=Math.max,yw=Math.min,bw=Math.sin,xw=Math.sqrt,Sw=Math.PI,Cw=Sw/2,ww=2*Sw}));function Ew(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return Ew;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t{Ow=Math.PI,kw=2*Ow,Aw=1e-6,jw=kw-Aw,Mw=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?Ew:gue(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>Aw)if(!(Math.abs(u*s-c*l)>Aw)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((Ow-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>Aw&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>Aw||Math.abs(this._y1-l)>Aw)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%kw+kw),d>jw?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>Aw&&this._append`A${n},${n},0,${+(d>=Ow)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}},Dw.prototype=Mw.prototype})),Nw=o((()=>{_ue()}));function Pw(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Mw(t)}var Fw=o((()=>{Nw()}));function vue(e){return e.innerRadius}function yue(e){return e.outerRadius}function bue(e){return e.startAngle}function xue(e){return e.endAngle}function Sue(e){return e&&e.padAngle}function Cue(e,t,n,r,i,a,o,s){var c=n-e,l=r-t,u=o-i,d=s-a,f=d*c-u*l;if(!(f*f<1e-12))return f=(u*(t-a)-d*(e-i))/f,[e+f*c,t+f*l]}function Iw(e,t,n,r,i,a,o){var s=e-n,c=t-r,l=(o?a:-a)/xw(s*s+c*c),u=l*c,d=-l*s,f=e+u,p=t+d,m=n+u,h=r+d,g=(f+m)/2,_=(p+h)/2,v=m-f,y=h-p,b=v*v+y*y,x=i-a,S=f*h-m*p,C=(y<0?-1:1)*xw(vw(0,x*x*b-S*S)),w=(S*y-v*C)/b,T=(-S*v-y*C)/b,E=(S*y+v*C)/b,D=(-S*v+y*C)/b,O=w-g,k=T-_,A=E-g,j=D-_;return O*O+k*k>A*A+j*j&&(w=E,T=D),{cx:w,cy:T,x01:-u,y01:-d,x11:w*(i/x-1),y11:T*(i/x-1)}}function wue(){var e=vue,t=yue,n=fw(0),r=null,i=bue,a=xue,o=Sue,s=null,c=Pw(l);function l(){var l,u,d=+e.apply(this,arguments),f=+t.apply(this,arguments),p=i.apply(this,arguments)-Cw,m=a.apply(this,arguments)-Cw,h=hw(m-p),g=m>p;if(s||=l=c(),f1e-12))s.moveTo(0,0);else if(h>ww-1e-12)s.moveTo(f*_w(p),f*bw(p)),s.arc(0,0,f,p,m,!g),d>1e-12&&(s.moveTo(d*_w(m),d*bw(m)),s.arc(0,0,d,m,p,g));else{var _=p,v=m,y=p,b=m,x=h,S=h,C=o.apply(this,arguments)/2,w=C>1e-12&&(r?+r.apply(this,arguments):xw(d*d+f*f)),T=yw(hw(f-d)/2,+n.apply(this,arguments)),E=T,D=T,O,k;if(w>1e-12){var A=mw(w/d*bw(C)),j=mw(w/f*bw(C));(x-=A*2)>1e-12?(A*=g?1:-1,y+=A,b-=A):(x=0,y=b=(p+m)/2),(S-=j*2)>1e-12?(j*=g?1:-1,_+=j,v-=j):(S=0,_=v=(p+m)/2)}var M=f*_w(_),N=f*bw(_),P=d*_w(b),F=d*bw(b);if(T>1e-12){var ee=f*_w(v),I=f*bw(v),te=d*_w(y),L=d*bw(y),ne;if(h1e-12?D>1e-12?(O=Iw(te,L,M,N,f,D,g),k=Iw(ee,I,P,F,f,D,g),s.moveTo(O.cx+O.x01,O.cy+O.y01),D1e-12)||!(x>1e-12)?s.lineTo(P,F):E>1e-12?(O=Iw(P,F,ee,I,d,-E,g),k=Iw(M,N,te,L,d,-E,g),s.lineTo(O.cx+O.x01,O.cy+O.y01),E{pw(),Tw(),Fw()}));function Lw(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}var Rw=o((()=>{Array.prototype.slice}));function zw(e){this._context=e}function Bw(e){return new zw(e)}var Vw=o((()=>{zw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}}}));function Hw(e){return e[0]}function Uw(e){return e[1]}var Ww=o((()=>{}));function Gw(e,t){var n=fw(!0),r=null,i=Bw,a=null,o=Pw(s);e=typeof e==`function`?e:e===void 0?Hw:fw(e),t=typeof t==`function`?t:t===void 0?Uw:fw(t);function s(s){var c,l=(s=Lw(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c{Rw(),pw(),Vw(),Fw(),Ww()}));function qw(e,t,n){var r=null,i=fw(!0),a=null,o=Bw,s=null,c=Pw(l);e=typeof e==`function`?e:e===void 0?Hw:fw(+e),t=typeof t==`function`?t:fw(t===void 0?0:+t),n=typeof n==`function`?n:n===void 0?Uw:fw(+n);function l(l){var u,d,f,p=(l=Lw(l)).length,m,h=!1,g,_=Array(p),v=Array(p);for(a??(s=o(g=c())),u=0;u<=p;++u){if(!(u=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return Gw().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:fw(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:fw(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:fw(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:fw(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:fw(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:fw(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:fw(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var Eue=o((()=>{Rw(),pw(),Vw(),Kw(),Fw(),Ww()})),Jw,Yw=o((()=>{Tw(),Jw={draw(e,t){let n=xw(t/Sw);e.moveTo(n,0),e.arc(0,0,n,0,ww)}}}));function Due(e,t){let n=null,r=Pw(i);e=typeof e==`function`?e:fw(e||Jw),t=typeof t==`function`?t:fw(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:fw(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:fw(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}var Oue=o((()=>{pw(),Fw(),Yw()}));function Xw(){}var Zw=o((()=>{}));function Qw(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function $w(e){this._context=e}function kue(e){return new $w(e)}var eT=o((()=>{$w.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Qw(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Qw(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}}));function tT(e){this._context=e}function Aue(e){return new tT(e)}var jue=o((()=>{Zw(),eT(),tT.prototype={areaStart:Xw,areaEnd:Xw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Qw(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}}));function nT(e){this._context=e}function Mue(e){return new nT(e)}var Nue=o((()=>{eT(),nT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Qw(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}}));function rT(e,t){this._basis=new $w(e),this._beta=t}var iT,Pue=o((()=>{eT(),rT.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],i=t[0],a=e[n]-r,o=t[n]-i,s=-1,c;++s<=n;)c=s/n,this._basis.point(this._beta*e[s]+(1-this._beta)*(r+c*a),this._beta*t[s]+(1-this._beta)*(i+c*o));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}},iT=(function e(t){function n(e){return t===1?new $w(e):new rT(e,t)}return n.beta=function(t){return e(+t)},n})(.85)}));function aT(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function oT(e,t){this._context=e,this._k=(1-t)/6}var sT,cT=o((()=>{oT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:aT(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:aT(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},sT=(function e(t){function n(e){return new oT(e,t)}return n.tension=function(t){return e(+t)},n})(0)}));function lT(e,t){this._context=e,this._k=(1-t)/6}var uT,dT=o((()=>{Zw(),cT(),lT.prototype={areaStart:Xw,areaEnd:Xw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:aT(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},uT=(function e(t){function n(e){return new lT(e,t)}return n.tension=function(t){return e(+t)},n})(0)}));function fT(e,t){this._context=e,this._k=(1-t)/6}var pT,mT=o((()=>{cT(),fT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:aT(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},pT=(function e(t){function n(e){return new fT(e,t)}return n.tension=function(t){return e(+t)},n})(0)}));function hT(e,t,n){var r=e._x1,i=e._y1,a=e._x2,o=e._y2;if(e._l01_a>1e-12){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,i=(i*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>1e-12){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);a=(a*l+e._x1*e._l23_2a-t*e._l12_2a)/u,o=(o*l+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,a,o,e._x2,e._y2)}function gT(e,t){this._context=e,this._alpha=t}var _T,vT=o((()=>{Tw(),cT(),gT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:hT(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},_T=(function e(t){function n(e){return t?new gT(e,t):new oT(e,0)}return n.alpha=function(t){return e(+t)},n})(.5)}));function yT(e,t){this._context=e,this._alpha=t}var bT,Fue=o((()=>{dT(),Zw(),vT(),yT.prototype={areaStart:Xw,areaEnd:Xw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:hT(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},bT=(function e(t){function n(e){return t?new yT(e,t):new lT(e,0)}return n.alpha=function(t){return e(+t)},n})(.5)}));function xT(e,t){this._context=e,this._alpha=t}var ST,Iue=o((()=>{mT(),vT(),xT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:hT(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},ST=(function e(t){function n(e){return t?new xT(e,t):new fT(e,0)}return n.alpha=function(t){return e(+t)},n})(.5)}));function CT(e){this._context=e}function Lue(e){return new CT(e)}var Rue=o((()=>{Zw(),CT.prototype={areaStart:Xw,areaEnd:Xw,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}}}));function wT(e){return e<0?-1:1}function TT(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(wT(a)+wT(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function ET(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function DT(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function OT(e){this._context=e}function kT(e){this._context=new AT(e)}function AT(e){this._context=e}function zue(e){return new OT(e)}function Bue(e){return new kT(e)}var Vue=o((()=>{OT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:DT(this,this._t0,ET(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,DT(this,ET(this,n=TT(this,e,t)),n);break;default:DT(this,this._t0,n=TT(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(kT.prototype=Object.create(OT.prototype)).point=function(e,t){OT.prototype.point.call(this,t,e)},AT.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}}}));function jT(e){this._context=e}function MT(e){var t,n=e.length-1,r,i=Array(n),a=Array(n),o=Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t{jT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=MT(e),i=MT(t),a=0,o=1;o{NT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}this._x=e,this._y=t}}})),Jue=o((()=>{Tue(),Eue(),Kw(),Rw(),pw(),Tw(),Vw(),Fw(),Oue(),Yw(),jue(),Nue(),eT(),Pue(),dT(),mT(),cT(),Fue(),Iue(),vT(),Rue(),Vue(),Uue(),que()}));function PT(e,t){if(typeof document<`u`&&document.createElement){let n=document.createElement(`canvas`);if(n&&n.getContext)return n.width=e,n.height=t,n}return null}var FT,IT=o((()=>{FT=()=>typeof Image<`u`?Image:null}));function LT(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function RT(e,t){switch(arguments.length){case 0:break;case 1:typeof e==`function`?this.interpolator(e):this.range(e);break;default:this.domain(e),typeof t==`function`?this.interpolator(t):this.range(t);break}return this}var zT=o((()=>{}));function BT(){var e=new Hg,t=[],n=[],r=VT;function i(i){let a=e.get(i);if(a===void 0){if(r!==VT)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new Hg;for(let r of n)e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return BT(t,n).unknown(r)},LT.apply(i,arguments),i}var VT,Yue=o((()=>{e_(),zT(),VT=Symbol(`implicit`)}));function HT(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function UT(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}var WT=o((()=>{}));function GT(){}function KT(){return this.rgb().formatHex()}function Xue(){return this.rgb().formatHex8()}function Zue(){return oE(this).formatHsl()}function qT(){return this.rgb().formatRgb()}function JT(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=_E.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?YT(t):n===3?new $T(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?XT(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?XT(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=vE.exec(e))?new $T(t[1],t[2],t[3],1):(t=yE.exec(e))?new $T(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=$ue.exec(e))?XT(t[1],t[2],t[3],t[4]):(t=ede.exec(e))?XT(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=tde.exec(e))?aE(t[1],t[2]/100,t[3]/100,1):(t=nde.exec(e))?aE(t[1],t[2]/100,t[3]/100,t[4]):bE.hasOwnProperty(e)?YT(bE[e]):e===`transparent`?new $T(NaN,NaN,NaN,0):null}function YT(e){return new $T(e>>16&255,e>>8&255,e&255,1)}function XT(e,t,n,r){return r<=0&&(e=t=n=NaN),new $T(e,t,n,r)}function ZT(e){return e instanceof GT||(e=JT(e)),e?(e=e.rgb(),new $T(e.r,e.g,e.b,e.opacity)):new $T}function QT(e,t,n,r){return arguments.length===1?ZT(e):new $T(e,t,n,r??1)}function $T(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function eE(){return`#${iE(this.r)}${iE(this.g)}${iE(this.b)}`}function Que(){return`#${iE(this.r)}${iE(this.g)}${iE(this.b)}${iE((isNaN(this.opacity)?1:this.opacity)*255)}`}function tE(){let e=nE(this.opacity);return`${e===1?`rgb(`:`rgba(`}${rE(this.r)}, ${rE(this.g)}, ${rE(this.b)}${e===1?`)`:`, ${e})`}`}function nE(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function rE(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function iE(e){return e=rE(e),(e<16?`0`:``)+e.toString(16)}function aE(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new cE(e,t,n,r)}function oE(e){if(e instanceof cE)return new cE(e.h,e.s,e.l,e.opacity);if(e instanceof GT||(e=JT(e)),!e)return new cE;if(e instanceof cE)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n0&&c<1?0:o,new cE(o,s,c,e.opacity)}function sE(e,t,n,r){return arguments.length===1?oE(e):new cE(e,t,n,r??1)}function cE(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function lE(e){return e=(e||0)%360,e<0?e+360:e}function uE(e){return Math.max(0,Math.min(1,e||0))}function dE(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var fE,pE,mE,hE,gE,_E,vE,yE,$ue,ede,tde,nde,bE,xE=o((()=>{WT(),fE=.7,pE=1/fE,mE=`\\s*([+-]?\\d+)\\s*`,hE=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,gE=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,_E=/^#([0-9a-f]{3,8})$/,vE=RegExp(`^rgb\\(${mE},${mE},${mE}\\)$`),yE=RegExp(`^rgb\\(${gE},${gE},${gE}\\)$`),$ue=RegExp(`^rgba\\(${mE},${mE},${mE},${hE}\\)$`),ede=RegExp(`^rgba\\(${gE},${gE},${gE},${hE}\\)$`),tde=RegExp(`^hsl\\(${hE},${gE},${gE}\\)$`),nde=RegExp(`^hsla\\(${hE},${gE},${gE},${hE}\\)$`),bE={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},HT(GT,JT,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:KT,formatHex:KT,formatHex8:Xue,formatHsl:Zue,formatRgb:qT,toString:qT}),HT($T,QT,UT(GT,{brighter(e){return e=e==null?pE:pE**+e,new $T(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?fE:fE**+e,new $T(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new $T(rE(this.r),rE(this.g),rE(this.b),nE(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:eE,formatHex:eE,formatHex8:Que,formatRgb:tE,toString:tE})),HT(cE,sE,UT(GT,{brighter(e){return e=e==null?pE:pE**+e,new cE(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?fE:fE**+e,new cE(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new $T(dE(e>=240?e-240:e+120,i,r),dE(e,i,r),dE(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new cE(lE(this.h),uE(this.s),uE(this.l),nE(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=nE(this.opacity);return`${e===1?`hsl(`:`hsla(`}${lE(this.h)}, ${uE(this.s)*100}%, ${uE(this.l)*100}%${e===1?`)`:`, ${e})`}`}}))})),SE,CE,rde=o((()=>{SE=Math.PI/180,CE=180/Math.PI}));function ide(e){if(e instanceof TE)return new TE(e.l,e.a,e.b,e.opacity);if(e instanceof jE)return ode(e);e instanceof $T||(e=ZT(e));var t=kE(e.r),n=kE(e.g),r=kE(e.b),i=EE((.2225045*t+.7168786*n+.0606169*r)/PE),a,o;return t===n&&n===r?a=o=i:(a=EE((.4360747*t+.3850649*n+.1430804*r)/NE),o=EE((.0139322*t+.0971045*n+.7141733*r)/FE)),new TE(116*i-16,500*(a-i),200*(i-o),e.opacity)}function wE(e,t,n,r){return arguments.length===1?ide(e):new TE(e,t,n,r??1)}function TE(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}function EE(e){return e>sde?e**(1/3):e/RE+IE}function DE(e){return e>LE?e*e*e:RE*(e-IE)}function OE(e){return 255*(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055)}function kE(e){return(e/=255)<=.04045?e/12.92:((e+.055)/1.055)**2.4}function ade(e){if(e instanceof jE)return new jE(e.h,e.c,e.l,e.opacity);if(e instanceof TE||(e=ide(e)),e.a===0&&e.b===0)return new jE(NaN,0{WT(),xE(),rde(),ME=18,NE=.96422,PE=1,FE=.82521,IE=4/29,LE=6/29,RE=3*LE*LE,sde=LE*LE*LE,HT(TE,wE,UT(GT,{brighter(e){return new TE(this.l+ME*(e??1),this.a,this.b,this.opacity)},darker(e){return new TE(this.l-ME*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return t=NE*DE(t),e=PE*DE(e),n=FE*DE(n),new $T(OE(3.1338561*t-1.6168667*e-.4906146*n),OE(-.9787684*t+1.9161415*e+.033454*n),OE(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}})),HT(jE,AE,UT(GT,{brighter(e){return new jE(this.h,this.c,this.l+ME*(e??1),this.opacity)},darker(e){return new jE(this.h,this.c,this.l-ME*(e??1),this.opacity)},rgb(){return ode(this).rgb()}}))}));function lde(e){if(e instanceof BE)return new BE(e.h,e.s,e.l,e.opacity);e instanceof $T||(e=ZT(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(JE*r+KE*t-qE*n)/(JE+KE-qE),a=r-i,o=(GE*(n-i)-UE*a)/WE,s=Math.sqrt(o*o+a*a)/(GE*i*(1-i)),c=s?Math.atan2(o,a)*CE-120:NaN;return new BE(c<0?c+360:c,s,i,e.opacity)}function zE(e,t,n,r){return arguments.length===1?lde(e):new BE(e,t,n,r??1)}function BE(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}var VE,HE,UE,WE,GE,KE,qE,JE,ude=o((()=>{WT(),xE(),rde(),VE=-.14861,HE=1.78277,UE=-.29227,WE=-.90649,GE=1.97294,KE=GE*WE,qE=GE*HE,JE=HE*UE-WE*VE,HT(BE,zE,UT(GT,{brighter(e){return e=e==null?pE:pE**+e,new BE(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?fE:fE**+e,new BE(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*SE,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new $T(255*(t+n*(VE*r+HE*i)),255*(t+n*(UE*r+WE*i)),255*(t+GE*r*n),this.opacity)}}))})),YE=o((()=>{xE(),cde(),ude()}));function dde(e,t,n,r,i){var a=e*e,o=a*e;return((1-3*e+3*a-o)*t+(4-6*a+3*o)*n+(1+3*e+3*a-3*o)*r+o*i)/6}function fde(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],a=e[r+1],o=r>0?e[r-1]:2*i-a,s=r{}));function pde(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),i=e[(r+t-1)%t],a=e[r%t],o=e[(r+1)%t],s=e[(r+2)%t];return dde((n-r/t)*t,i,a,o,s)}}var mde=o((()=>{XE()})),ZE,hde=o((()=>{ZE=e=>()=>e}));function gde(e,t){return function(n){return e+n*t}}function _de(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function QE(e,t){var n=t-e;return n?gde(e,n>180||n<-180?n-360*Math.round(n/360):n):ZE(isNaN(e)?t:e)}function vde(e){return(e=+e)==1?$E:function(t,n){return n-t?_de(t,n,e):ZE(isNaN(t)?n:t)}}function $E(e,t){var n=t-e;return n?gde(e,n):ZE(isNaN(e)?t:e)}var eD=o((()=>{hde()}));function yde(e){return function(t){var n=t.length,r=Array(n),i=Array(n),a=Array(n),o,s;for(o=0;o{YE(),XE(),mde(),eD(),tD=(function e(t){var n=vde(t);function r(e,t){var r=n((e=QT(e)).r,(t=QT(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=$E(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1),bde=yde(fde),xde=yde(pde)}));function nD(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i{}));function wde(e,t){return(Cde(t)?nD:Tde)(e,t)}function Tde(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o{lD(),rD()}));function Dde(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}var Ode=o((()=>{}));function iD(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var aD=o((()=>{}));function kde(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=cD(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var Ade=o((()=>{lD()}));function jde(e){return function(){return e}}function Mde(e){return function(t){return e(t)+``}}function Nde(e,t){var n=oD.lastIndex=sD.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=oD.exec(e))&&(i=sD.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:iD(r,i)})),n=sD.lastIndex;return n{aD(),oD=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,sD=new RegExp(oD.source,`g`)}));function cD(e,t){var n=typeof t,r;return t==null||n===`boolean`?ZE(t):(n===`number`?iD:n===`string`?(r=JT(t))?(t=r,tD):Nde:t instanceof JT?tD:t instanceof Date?Dde:Cde(t)?nD:Array.isArray(t)?Tde:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?kde:iD)(e,t)}var lD=o((()=>{YE(),Sde(),Ede(),Ode(),aD(),Ade(),Pde(),hde(),rD()}));function Fde(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var Ide=o((()=>{}));function Lde(e,t){var n=QE(+e,+t);return function(e){var t=n(e);return t-360*Math.floor(t/360)}}var Rde=o((()=>{eD()}));function uD(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var zde=o((()=>{}));function Bde(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r{dD=180/Math.PI,fD={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1}}));function Hde(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?fD:Bde(t.a,t.b,t.c,t.d,t.e,t.f)}function Ude(e){return e==null||(pD||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),pD.setAttribute(`transform`,e),!(e=pD.transform.baseVal.consolidate()))?fD:(e=e.matrix,Bde(e.a,e.b,e.c,e.d,e.e,e.f))}var pD,Wde=o((()=>{Vde()}));function Gde(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:iD(e,i)},{i:c-2,x:iD(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:iD(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:iD(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:iD(e,n)},{i:s-2,x:iD(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t{aD(),Wde(),Kde=Gde(Hde,`px, `,`px)`,`deg)`),qde=Gde(Ude,`, `,`)`,`)`)}));function Yde(e){return((e=Math.exp(e))+1/e)/2}function Xde(e){return((e=Math.exp(e))-1/e)/2}function Zde(e){return((e=Math.exp(2*e))-1)/(e+1)}var Qde,$de,efe=o((()=>{Qde=1e-12,$de=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p{YE(),eD(),nfe=tfe(QE),rfe=tfe($E)}));function afe(e,t){var n=$E((e=wE(e)).l,(t=wE(t)).l),r=$E(e.a,t.a),i=$E(e.b,t.b),a=$E(e.opacity,t.opacity);return function(t){return e.l=n(t),e.a=r(t),e.b=i(t),e.opacity=a(t),e+``}}var ofe=o((()=>{YE(),eD()}));function sfe(e){return function(t,n){var r=e((t=AE(t)).h,(n=AE(n)).h),i=$E(t.c,n.c),a=$E(t.l,n.l),o=$E(t.opacity,n.opacity);return function(e){return t.h=r(e),t.c=i(e),t.l=a(e),t.opacity=o(e),t+``}}}var cfe,lfe,ufe=o((()=>{YE(),eD(),cfe=sfe(QE),lfe=sfe($E)}));function dfe(e){return(function t(n){n=+n;function r(t,r){var i=e((t=zE(t)).h,(r=zE(r)).h),a=$E(t.s,r.s),o=$E(t.l,r.l),s=$E(t.opacity,r.opacity);return function(e){return t.h=i(e),t.s=a(e),t.l=o(e**+n),t.opacity=s(e),t+``}}return r.gamma=t,r})(1)}var ffe,pfe,mfe=o((()=>{YE(),eD(),ffe=dfe(QE),pfe=dfe($E)}));function mD(e,t){t===void 0&&(t=e,e=cD);for(var n=0,r=t.length-1,i=t[0],a=Array(r<0?0:r);n{lD()}));function gfe(e,t){for(var n=Array(t),r=0;r{})),vfe=c({interpolate:()=>cD,interpolateArray:()=>wde,interpolateBasis:()=>fde,interpolateBasisClosed:()=>pde,interpolateCubehelix:()=>ffe,interpolateCubehelixLong:()=>pfe,interpolateDate:()=>Dde,interpolateDiscrete:()=>Fde,interpolateHcl:()=>cfe,interpolateHclLong:()=>lfe,interpolateHsl:()=>nfe,interpolateHslLong:()=>rfe,interpolateHue:()=>Lde,interpolateLab:()=>afe,interpolateNumber:()=>iD,interpolateNumberArray:()=>nD,interpolateObject:()=>kde,interpolateRgb:()=>tD,interpolateRgbBasis:()=>bde,interpolateRgbBasisClosed:()=>xde,interpolateRound:()=>uD,interpolateString:()=>Nde,interpolateTransformCss:()=>Kde,interpolateTransformSvg:()=>qde,interpolateZoom:()=>$de,piecewise:()=>mD,quantize:()=>gfe}),hD=o((()=>{lD(),Ede(),XE(),mde(),Ode(),Ide(),Rde(),aD(),rD(),Ade(),zde(),Pde(),Jde(),efe(),Sde(),ife(),ofe(),ufe(),mfe(),hfe(),_fe()}));function yfe(e){return function(){return e}}var bfe=o((()=>{}));function gD(e){return+e}var _D=o((()=>{}));function vD(e){return e}function yD(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:yfe(isNaN(t)?NaN:.5)}function xfe(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function Sfe(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?Cfe:Sfe,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),iD))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,gD),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=uD,u()},d.clamp=function(e){return arguments.length?(o=e?!0:vD,u()):o!==vD},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function wfe(){return xD()(vD,vD)}var SD,CD=o((()=>{e_(),hD(),bfe(),_D(),SD=[0,1]}));function Tfe(e,t,n,r){var i=Jg(e,t,n),a;switch(r=a_(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=S_(i,o))&&(r.precision=a),b_(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=C_(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=x_(i))&&(r.precision=a-(r.type===`%`)*2);break}return y_(r)}var Efe=o((()=>{e_(),w_()}));function wD(e){var t=e.domain;return e.ticks=function(e){var n=t();return Kg(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return Tfe(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s0;){if(l=qg(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function Dfe(){var e=wfe();return e.copy=function(){return bD(e,Dfe())},LT.apply(e,arguments),wD(e)}var TD=o((()=>{e_(),CD(),zT(),Efe()}));function Ofe(e){var t;function n(e){return e==null||isNaN(e=+e)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,gD),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return Ofe(e).unknown(t)},e=arguments.length?Array.from(e,gD):[0,1],wD(n)}var kfe=o((()=>{TD(),_D()}));function Afe(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return a{}));function Mfe(e){return Math.log(e)}function Nfe(e){return Math.exp(e)}function Pfe(e){return-Math.log(-e)}function Ffe(e){return-Math.exp(-e)}function Ife(e){return isFinite(e)?+(`1e`+e):e<0?0:e}function Lfe(e){return e===10?Ife:e===Math.E?Math.exp:t=>e**+t}function Rfe(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function zfe(e){return(t,n)=>-e(-t,n)}function ED(e){let t=e(Mfe,Nfe),n=t.domain,r=10,i,a;function o(){return i=Rfe(r),a=Lfe(r),n()[0]<0?(i=zfe(i),a=zfe(a),e(Pfe,Ffe)):e(Mfe,Nfe),t}return t.base=function(e){return arguments.length?(r=+e,o()):r},t.domain=function(e){return arguments.length?(n(e),o()):n()},t.ticks=e=>{let t=n(),o=t[0],s=t[t.length-1],c=s0){for(;l<=u;++l)for(d=1;ds)break;m.push(f)}}else for(;l<=u;++l)for(d=r-1;d>=1;--d)if(f=l>0?d/a(-l):d*a(l),!(fs)break;m.push(f)}m.length*2{if(e??=10,n??=r===10?`s`:`,`,typeof n!=`function`&&(!(r%1)&&(n=a_(n)).precision==null&&(n.trim=!0),n=y_(n)),e===1/0)return n;let o=Math.max(1,r*e/t.ticks().length);return e=>{let t=e/a(Math.round(i(e)));return t*rn(Afe(n(),{floor:e=>a(Math.floor(i(e))),ceil:e=>a(Math.ceil(i(e)))})),t}function Bfe(){let e=ED(xD()).domain([1,10]);return e.copy=()=>bD(e,Bfe()).base(e.base()),LT.apply(e,arguments),e}var DD=o((()=>{e_(),w_(),jfe(),CD(),zT()}));function Vfe(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Hfe(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function OD(e){var t=1,n=e(Vfe(t),Hfe(t));return n.constant=function(n){return arguments.length?e(Vfe(t=+n),Hfe(t)):t},wD(n)}function Ufe(){var e=OD(xD());return e.copy=function(){return bD(e,Ufe()).constant(e.constant())},LT.apply(e,arguments)}var kD=o((()=>{TD(),CD(),zT()}));function Wfe(e){return function(t){return t<0?-((-t)**+e):t**+e}}function Gfe(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Kfe(e){return e<0?-e*e:e*e}function AD(e){var t=e(vD,vD),n=1;function r(){return n===1?e(vD,vD):n===.5?e(Gfe,Kfe):e(Wfe(n),Wfe(1/n))}return t.exponent=function(e){return arguments.length?(n=+e,r()):n},wD(t)}function jD(){var e=AD(xD());return e.copy=function(){return bD(e,jD()).exponent(e.exponent())},LT.apply(e,arguments),e}function qfe(){return jD.apply(null,arguments).exponent(.5)}var MD=o((()=>{TD(),CD(),zT()}));function Jfe(){var e=[],t=[],n=[],r;function i(){var r=0,i=Math.max(1,t.length);for(n=Array(i-1);++r0?n[i-1]:e[0],i{e_(),zT()}));function Xfe(){var e=0,t=1,n=1,r=[.5],i=[0,1],a;function o(e){return e!=null&&e<=e?i[Rg(r,e,0,n)]:a}function s(){var i=-1;for(r=Array(n);++i=n?[r[n-1],t]:[r[o-1],r[o]]},o.unknown=function(e){return arguments.length&&(a=e),o},o.thresholds=function(){return r.slice()},o.copy=function(){return Xfe().domain([e,t]).range(i).unknown(a)},LT.apply(wD(o),arguments)}var Zfe=o((()=>{e_(),TD(),zT()}));function Qfe(){var e=[.5],t=[0,1],n,r=1;function i(i){return i!=null&&i<=i?t[Rg(e,i,0,r)]:n}return i.domain=function(n){return arguments.length?(e=Array.from(n),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(n){return arguments.length?(t=Array.from(n),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(n){var r=t.indexOf(n);return[e[r-1],e[r]]},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return Qfe().domain(e).range(t).unknown(n)},LT.apply(i,arguments)}var $fe=o((()=>{e_(),zT()}));function epe(e){return new Date(e)}function tpe(e){return e instanceof Date?+e:+new Date(+e)}function ND(e,t,n,r,i,a,o,s,c,l){var u=wfe(),d=u.invert,f=u.domain,p=l(`.%L`),m=l(`:%S`),h=l(`%I:%M`),g=l(`%I %p`),_=l(`%a %d`),v=l(`%b %d`),y=l(`%B`),b=l(`%Y`);function x(e){return(c(e){Tv(),hb(),CD(),zT(),jfe()}));function ipe(){return LT.apply(ND(xv,Sv,vv,hv,ov,J_,G_,H_,z_,pb).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}var ape=o((()=>{Tv(),hb(),rpe(),zT()}));function PD(){var e=0,t=1,n,r,i,a,o=vD,s=!1,c;function l(e){return e==null||isNaN(e=+e)?c:o(i===0?.5:(e=(a(e)-n)*i,s?Math.max(0,Math.min(1,e)):e))}l.domain=function(o){return arguments.length?([e,t]=o,n=a(e=+e),r=a(t=+t),i=n===r?0:1/(r-n),l):[e,t]},l.clamp=function(e){return arguments.length?(s=!!e,l):s},l.interpolator=function(e){return arguments.length?(o=e,l):o};function u(e){return function(t){var n,r;return arguments.length?([n,r]=t,o=e(n,r),l):[o(0),o(1)]}}return l.range=u(cD),l.rangeRound=u(uD),l.unknown=function(e){return arguments.length?(c=e,l):c},function(o){return a=o,n=o(e),r=o(t),i=n===r?0:1/(r-n),l}}function FD(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function ID(){var e=wD(PD()(vD));return e.copy=function(){return FD(e,ID())},RT.apply(e,arguments)}function ope(){var e=ED(PD()).domain([1,10]);return e.copy=function(){return FD(e,ope()).base(e.base())},RT.apply(e,arguments)}function spe(){var e=OD(PD());return e.copy=function(){return FD(e,spe()).constant(e.constant())},RT.apply(e,arguments)}function LD(){var e=AD(PD());return e.copy=function(){return FD(e,LD()).exponent(e.exponent())},RT.apply(e,arguments)}function cpe(){return LD.apply(null,arguments).exponent(.5)}var lpe=o((()=>{hD(),CD(),zT(),TD(),DD(),kD(),MD()}));function RD(){var e=0,t=.5,n=1,r=1,i,a,o,s,c,l=vD,u,d=!1,f;function p(e){return isNaN(e=+e)?f:(e=.5+((e=+u(e))-a)*(r*e{hD(),CD(),zT(),TD(),DD(),lpe(),kD(),MD()})),hpe=o((()=>{e_(),Yue(),kfe(),TD(),DD(),kD(),MD(),CD(),_D(),Yfe(),Zfe(),$fe(),rpe(),ape(),lpe(),mpe(),Efe()}));function BD(e){for(var t=e.length/6|0,n=Array(t),r=0;r{})),gpe,_pe=o((()=>{VD(),gpe=BD(`1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf`)})),vpe,ype=o((()=>{VD(),vpe=BD(`7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666`)})),bpe,xpe=o((()=>{VD(),bpe=BD(`1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666`)})),Spe,Cpe=o((()=>{VD(),Spe=BD(`4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0`)})),wpe,Tpe=o((()=>{VD(),wpe=BD(`a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928`)})),Epe,Dpe=o((()=>{VD(),Epe=BD(`fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2`)})),Ope,kpe=o((()=>{VD(),Ope=BD(`b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc`)})),Ape,jpe=o((()=>{VD(),Ape=BD(`e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999`)})),Mpe,Npe=o((()=>{VD(),Mpe=BD(`66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3`)})),Ppe,Fpe=o((()=>{VD(),Ppe=BD(`8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f`)})),Ipe=o((()=>{_pe(),ype(),xpe(),Cpe(),Tpe(),Dpe(),kpe(),jpe(),Npe(),Fpe(),VD(),hD(),YE()}));function HD(e,t,n){let r=e-t+n*2;return e?r>0?r:1:0}function Lpe(e){return function(t){let n=t[0],r=t[1],i;return r=r&&n[c]<=i&&(a<0&&(a=c),o=c);if(!(a<0))return r=e.invertExtent(n[a]),i=e.invertExtent(n[o]),[r[0]===void 0?r[1]:r[0],i[1]===void 0?i[0]:i[1]]}}function UD(){let e=BT().unknown(void 0),t=e.domain,n=e.range,r=[0,1],i,a,o=!1,s=0,c=0,l=.5;delete e.unknown;function u(){let e=t().length,u=r[1]p+i*e);return n(u?m.reverse():m)}return e.domain=function(e){return arguments.length?(t(e),u()):t()},e.range=function(e){return arguments.length?(r=[+e[0],+e[1]],u()):r.slice()},e.rangeRound=function(e){return r=[+e[0],+e[1]],o=!0,u()},e.bandwidth=function(){return a},e.step=function(){return i},e.round=function(e){return arguments.length?(o=!!e,u()):o},e.padding=function(e){return arguments.length?(c=Math.max(0,Math.min(1,e)),s=c,u()):s},e.paddingInner=function(e){return arguments.length?(s=Math.max(0,Math.min(1,e)),u()):s},e.paddingOuter=function(e){return arguments.length?(c=Math.max(0,Math.min(1,e)),u()):c},e.align=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),u()):l},e.invertRange=function(e){if(e[0]==null||e[1]==null)return;let i=r[1]r[1-i])))return u=Math.max(0,Rg(o,c)-1),d=c===l?u:Rg(o,l)-1,c-o[u]>a+1e-10&&++u,i&&(f=u,u=s-d,d=s-f),u>d?void 0:t().slice(u,d+1)},e.invert=function(t){let n=e.invertRange([t,t]);return n&&n[0]},e.copy=function(){return UD().domain(t()).range(r).round(o).paddingInner(s).paddingOuter(c).align(l)},u()}function zpe(e){let t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return zpe(t())},e}function Bpe(){return zpe(UD().paddingInner(1))}function Vpe(e){return yme.call(e,Rh)}function Hpe(){let e=[],t=[];function n(n){return n==null||n!==n?void 0:t[(Rg(e,n)-1)%t.length]}return n.domain=function(t){return arguments.length?(e=Vpe(t),n):e.slice()},n.range=function(e){return arguments.length?(t=bme.call(e),n):t.slice()},n.tickFormat=function(t,n){return Tfe(e[0],Ih(e),t??10,n)},n.copy=function(){return Hpe().domain(n.domain()).range(n.range())},n}function Upe(e){return e[hO]=!0,e}function Wpe(e){return e&&e[hO]===!0}function Gpe(e,t,n){let r=function(){let n=t();return n.invertRange||=n.invert?Lpe(n):n.invertExtent?Rpe(n):void 0,n.type=e,Upe(n)};return r.metadata=Tg(Qh(n)),r}function WD(e,t,n){return arguments.length>1?(mO.set(e,Gpe(e,t,n)),this):Kpe(e)?mO.get(e):void 0}function Kpe(e){return mO.has(e)}function GD(e,t){let n=mO.get(e);return n&&n.metadata[t]}function KD(e){return GD(e,lO)}function qD(e){return GD(e,uO)}function JD(e){return GD(e,dO)}function YD(e){return GD(e,`log`)}function qpe(e){return GD(e,pO)}function Jpe(e){return GD(e,fO)}function Ype(e){return GD(e,oO)}function Xpe(e,t){let n=t[0],r=Ih(t)-n;return function(t){return e(n+t*r)}}function XD(e,t,n){return mD(ZD(t||`rgb`,n),e)}function Zpe(e,t){let n=Array(t),r=t+1;for(let i=0;ie[t]?o[t](e[t]()):0),o)}function ZD(e,t){let n=vfe[$pe(e)];return t!=null&&n&&n.gamma?n.gamma(t):n}function $pe(e){return`interpolate`+e.toLowerCase().split(`-`).map(e=>e[0].toUpperCase()+e.slice(1)).join(``)}function eme(e){if(W(e))return e;let t=e.length/6|0,n=Array(t);for(let r=0;r1?(gO[e]=t,this):gO[e]}function $D(e,t,n){let r;if(gg(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),n!=null)){let r=e.domain(),i=Math.min(r[0],Ih(r)),a=Math.max(r[0],Ih(r));if(t=Math.min(t,Math.floor((a-i)/n||1)+1),!e.bins&&!YD(e.type)&&!qpe(e.type)&&i1&&Jg(i,a,t)a&&(r=a,a=i,i=r,o=Eme),i=Math.floor(i),a=Math.ceil(a),t=t.map(t=>[t,e(t)]).filter(e=>i<=e[1]&&e[1]<=a).sort(o).map(e=>e[0]),n>0&&t.length>1){let e=[t[0],Ih(t)];for(;t.length>n&&t.length>=3;)t=t.filter((e,t)=>!(t%2));t.length<3&&(t=e)}return t}function eO(e,t){return e.bins?nme(e,e.bins,t):e.ticks?e.ticks(t):e.domain()}function rme(e,t,n,r,i,a){let o=t.type,s=wme;if(o===`time`||i===`time`)s=e.timeFormat(r);else if(o===`utc`||i===`utc`)s=e.utcFormat(r);else if(YD(o)){let i=e.formatFloat(r);if(a||t.bins)s=i;else{let e=ime(t,n,!1);s=t=>e(t)?i(t):``}}else if(t.tickFormat){let i=t.domain();s=e.formatSpan(i[0],i[i.length-1],n,r)}else r&&(s=e.format(r));return s}function ime(e,t,n){let r=eO(e,t),i=e.base(),a=Math.log(i),o=Math.max(1,i*t/r.length),s=e=>{let t=e/i**+Math.round(Math.log(e)/a);return t*i1?r[1]-r[0]:r[0],o;for(o=1;o(e-r)/a}function dme(e,t,n,r){let i=r||t.type;return vg(n)&&qpe(i)&&(n=n.replace(/%a/g,`%A`).replace(/%b/g,`%B`)),!n&&i===`time`?e.timeFormat(`%A, %d %B %Y, %X`):!n&&i===`utc`?e.utcFormat(`%A, %d %B %Y, %X UTC`):lme(e,t,5,null,n,r,!0)}function fme(e,t,n){n||={};let r=Math.max(3,n.maxlen||7),i=dme(e,t,n.format,n.formatType);if(JD(t.type)){let e=ame(t).slice(1).map(i),n=e.length;return`${n} boundar${n===1?`y`:`ies`}: ${e.join(`, `)}`}else if(qD(t.type)){let e=t.domain(),n=e.length,a=n>r?e.slice(0,r-2).map(i).join(`, `)+`, ending with `+e.slice(-1).map(i):e.map(i).join(`, `);return`${n} value${n===1?``:`s`}: ${a}`}else{let e=t.domain();return`values from ${i(e[0])} to ${i(Ih(e))}`}}var pme,tO,nO,rO,mme,iO,aO,oO,sO,cO,hme,gme,_me,vme,lO,uO,dO,fO,pO,yme,bme,mO,hO,xme,Sme,Cme,gO,wme,Tme,Eme,_O,vO,Dme,Ome,yO,kme,Ame,bO,xO=o((()=>{Dg(),e_(),hpe(),hD(),Ipe(),Ry(),pme=`identity`,tO=`linear`,nO=`sqrt`,rO=`symlog`,mme=`time`,iO=`sequential`,aO=`diverging`,oO=`quantile`,sO=`quantize`,cO=`threshold`,hme=`ordinal`,gme=`point`,_me=`band`,vme=`bin-ordinal`,lO=`continuous`,uO=`discrete`,dO=`discretizing`,fO=`interpolating`,pO=`temporal`,yme=Array.prototype.map,bme=Array.prototype.slice,mO=new Map,hO=Symbol(`vega_scale`),WD(pme,Ofe),WD(tO,Dfe,lO),WD(`log`,Bfe,[lO,`log`]),WD(`pow`,jD,lO),WD(nO,qfe,lO),WD(rO,Ufe,lO),WD(mme,npe,[lO,pO]),WD(`utc`,ipe,[lO,pO]),WD(iO,ID,[lO,fO]),WD(`${iO}-${tO}`,ID,[lO,fO]),WD(`${iO}-log`,ope,[lO,fO,`log`]),WD(`${iO}-pow`,LD,[lO,fO]),WD(`${iO}-${nO}`,cpe,[lO,fO]),WD(`${iO}-${rO}`,spe,[lO,fO]),WD(`${aO}-${tO}`,upe,[lO,fO]),WD(`${aO}-log`,dpe,[lO,fO,`log`]),WD(`${aO}-pow`,zD,[lO,fO]),WD(`${aO}-${nO}`,ppe,[lO,fO]),WD(`${aO}-${rO}`,fpe,[lO,fO]),WD(oO,Jfe,[dO,oO]),WD(sO,Xfe,dO),WD(cO,Qfe,dO),WD(vme,Hpe,[uO,dO]),WD(hme,BT,uO),WD(_me,UD,uO),WD(gme,Bpe,uO),xme=[`clamp`,`base`,`constant`,`exponent`],Sme={blues:`cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90`,greens:`d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429`,greys:`e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e`,oranges:`fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303`,purples:`e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c`,reds:`fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13`,blueGreen:`d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429`,bluePurple:`ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71`,greenBlue:`d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1`,orangeRed:`fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403`,purpleBlue:`dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281`,purpleBlueGreen:`dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353`,purpleRed:`dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a`,redPurple:`fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174`,yellowGreen:`e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034`,yellowOrangeBrown:`feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204`,yellowOrangeRed:`fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225`,blueOrange:`134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07`,brownBlueGreen:`704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147`,purpleGreen:`5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29`,purpleOrange:`4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07`,redBlue:`8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85`,redGrey:`8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434`,yellowGreenBlue:`eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185`,redYellowBlue:`a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695`,redYellowGreen:`a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837`,pinkYellowGreen:`8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419`,spectral:`9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2`,viridis:`440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725`,magma:`0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf`,inferno:`0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4`,plasma:`0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921`,cividis:`00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647`,rainbow:`6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa`,sinebow:`ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040`,turbo:`23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00`,browns:`eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632`,tealBlues:`bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985`,teals:`bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667`,warmGreys:`dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e`,goldGreen:`f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36`,goldOrange:`f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26`,goldRed:`f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e`,lightGreyRed:`efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b`,lightGreyTeal:`e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc`,lightMulti:`e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c`,lightOrange:`f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b`,lightTealBlue:`e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988`,darkBlue:`3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff`,darkGold:`3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff`,darkGreen:`3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa`,darkMulti:`3737371f5287197d8c29a86995ce3fffe800ffffff`,darkRed:`3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c`},Cme={accent:vpe,category10:gpe,category20:`1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5`,category20b:`393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6`,category20c:`3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9`,dark2:bpe,observable10:Spe,paired:wpe,pastel1:Epe,pastel2:Ope,set1:Ape,set2:Mpe,set3:Ppe,tableau10:`4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac`,tableau20:`4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5`},gO={},tme(Cme,eme),tme(Sme,e=>XD(eme(e))),wme=e=>W(e)?e.map(e=>String(e)):String(e),Tme=(e,t)=>e[1]-t[1],Eme=(e,t)=>t[1]-e[1],_O={[oO]:`quantiles`,[sO]:`thresholds`,[cO]:`domain`},vO={[oO]:`quantiles`,[sO]:`domain`},Dme=e=>_O[e.type]||e.bins,Ome=e=>(t,n,r)=>{let i=yO(r[n+1],yO(r.max,1/0)),a=bO(t,e),o=bO(i,e);return a&&o?a+` – `+o:o?`< `+o:`≥ `+a},yO=(e,t)=>e??t,kme=e=>(t,n)=>n?e(t):null,Ame=e=>t=>e(t),bO=(e,t)=>Number.isFinite(e)?t(e):null}));function jme(){Ik=0}function SO(e){return e&&e.gradient}function Mme(e,t,n){let r=e.gradient,i=e.id,a=r===`radial`?Lk:``;return i||(i=e.id=`gradient_`+Ik++,r===`radial`?(e.x1=CO(e.x1,.5),e.y1=CO(e.y1,.5),e.r1=CO(e.r1,0),e.x2=CO(e.x2,.5),e.y2=CO(e.y2,.5),e.r2=CO(e.r2,.5),a=Lk):(e.x1=CO(e.x1,0),e.y1=CO(e.y1,0),e.x2=CO(e.x2,1),e.y2=CO(e.y2,0))),t[i]=e,`url(`+(n||``)+`#`+a+i+`)`}function CO(e,t){return e??t}function Nme(e,t){var n=[],r;return r={gradient:`linear`,x1:e?e[0]:0,y1:e?e[1]:0,x2:t?t[0]:1,y2:t?t[1]:0,stops:n,stop:function(e,t){return n.push({offset:e,color:t}),r}}}function wO(e,t,n){var r=cg(Rk,e)&&Rk[e],i=null;return r&&(i=r.curve||r[t||`vertical`],r.tension&&n!=null&&(i=i[r.tension](n))),i}function TO(e){let t=[];return(e.match(Jge)||[]).forEach(e=>{let n=e[0],r=n.toLowerCase(),i=qge[r],a=Pme(r,i,e.slice(1).trim()),o=a.length;if(o1&&(h=Math.sqrt(h),n*=h,r*=h);let g=f/n,_=d/n,v=-d/r,y=f/r,b=g*s+_*c,x=v*s+y*c,S=g*e+_*t,C=v*e+y*t,w=1/((S-b)*(S-b)+(C-x)*(C-x))-.25;w<0&&(w=0);let T=Math.sqrt(w);a==i&&(T=-T);let E=.5*(b+S)-T*(C-x),D=.5*(x+C)+T*(S-b),O=Math.atan2(x-D,b-E),k=Math.atan2(C-D,S-E)-O;k<0&&a===1?k+=Vk:k>0&&a===0&&(k-=Vk);let A=Math.ceil(Math.abs(k/(Bk+.001))),j=[];for(let e=0;e+e}function OO(e,t,n){return Math.max(t,Math.min(e,n))}function Gme(){var e=Vme,t=Hme,n=Ume,r=Wme,i=DO(0),a=i,o=i,s=i,c=null;function l(l,u,d){var f,p=u??+e.call(this,l),m=d??+t.call(this,l),h=+n.call(this,l),g=+r.call(this,l),_=Math.min(h,g)/2,v=OO(+i.call(this,l),0,_),y=OO(+a.call(this,l),0,_),b=OO(+o.call(this,l),0,_),x=OO(+s.call(this,l),0,_);if(c||=f=Dw(),v<=0&&y<=0&&b<=0&&x<=0)c.rect(p,m,h,g);else{var S=p+h,C=m+g;c.moveTo(p+v,m),c.lineTo(S-y,m),c.bezierCurveTo(S-Xk*y,m,S,m+Xk*y,S,m+y),c.lineTo(S,C-x),c.bezierCurveTo(S,C-Xk*x,S-Xk*x,C,S-x,C),c.lineTo(p+b,C),c.bezierCurveTo(p+Xk*b,C,p,C-Xk*b,p,C-b),c.lineTo(p,m+v),c.bezierCurveTo(p,m+Xk*v,p+Xk*v,m,p+v,m),c.closePath()}if(f)return c=null,f+``||null}return l.x=function(t){return arguments.length?(e=DO(t),l):e},l.y=function(e){return arguments.length?(t=DO(e),l):t},l.width=function(e){return arguments.length?(n=DO(e),l):n},l.height=function(e){return arguments.length?(r=DO(e),l):r},l.cornerRadius=function(e,t,n,r){return arguments.length?(i=DO(e),a=t==null?i:DO(t),s=n==null?i:DO(n),o=r==null?a:DO(r),l):i},l.context=function(e){return arguments.length?(c=e??null,l):c},l}function Kme(){var e,t,n,r,i=null,a,o,s,c;function l(e,t,n){let r=n/2;if(a){var l=s-t,u=e-o;if(l||u){var d=Math.hypot(l,u),f=(l/=d)*c,p=(u/=d)*c,m=Math.atan2(u,l);i.moveTo(o-f,s-p),i.lineTo(e-l*r,t-u*r),i.arc(e,t,r,m-Math.PI,m),i.lineTo(o+f,s+p),i.arc(o,s,c,m,m+Math.PI)}else i.arc(e,t,r,0,Vk);i.closePath()}else a=1;o=e,s=t,c=r}function u(o){var s,c=o.length,u,d=!1,f;for(i??=f=Dw(),s=0;s<=c;++s)!(sQge?(u=o*o+s*a,u>=0&&(u=Math.sqrt(u),c=(-o+u)/a,l=(-o-u)/a)):c=.5*s/o,0f)return!1;h>d&&(d=h)}else if(p>0){if(h0?(e.globalAlpha=n,e.fillStyle=che(e,t,t.fill),!0):!1}function GO(e,t,n){var r=(r=t.strokeWidth)??1;return r<=0?!1:(n*=t.strokeOpacity==null?1:t.strokeOpacity,n>0?(e.globalAlpha=n,e.strokeStyle=che(e,t,t.stroke),e.lineWidth=r,e.lineCap=t.strokeCap||`butt`,e.lineJoin=t.strokeJoin||`miter`,e.miterLimit=t.strokeMiterLimit==null?4:t.strokeMiterLimit,e.setLineDash&&(e.setLineDash(t.strokeDash||T_e),e.lineDashOffset=t.strokeDashOffset||0),!0):!1)}function lhe(e,t){return e.zindex-t.zindex||e.index-t.index}function KO(e){if(!e.zdirty)return e.zitems;var t=e.items,n=[],r,i,a;for(i=0,a=t.length;i=0;)if(r=t(n[i]))return r;if(n===a){for(n=e.items,i=n.length;--i>=0;)if(!n[i].zindex&&(r=t(n[i])))return r}return null}function YO(e){return function(t,n,r){qO(n,n=>{(!r||r.intersects(n.bounds))&&dhe(e,t,n,n)})}}function uhe(e){return function(t,n,r){n.items.length&&(!r||r.intersects(n.bounds))&&dhe(e,t,n.items[0],n.items)}}function dhe(e,t,n,r){var i=n.opacity==null?1:n.opacity;i!==0&&(e(t,r)||(HO(t,n),n.fill&&WO(t,n,i)&&t.fill(),n.stroke&&GO(t,n,i)&&t.stroke()))}function XO(e){return e||=Eh,function(t,n,r,i,a,o){return r*=t.pixelRatio,i*=t.pixelRatio,JO(n,n=>{let s=n.bounds;if(!(s&&!s.contains(a,o)||!s)&&e(t,n,r,i,a,o))return n})}}function ZO(e,t){return function(n,r,i,a){var o=Array.isArray(r)?r[0]:r,s=t??o.fill,c=o.stroke&&n.isPointInStroke,l,u;return c&&(l=o.strokeWidth,u=o.strokeCap,n.lineWidth=l??1,n.lineCap=u??`butt`),e(n,r)?!1:s&&n.isPointInPath(i,a)||c&&n.isPointInStroke(i,a)}}function QO(e){return XO(ZO(e))}function $O(e,t){return`translate(`+e+`,`+t+`)`}function ek(e){return`rotate(`+e+`)`}function fhe(e,t){return`scale(`+e+`,`+t+`)`}function phe(e){return $O(e.x||0,e.y||0)}function mhe(e){return $O(e.x||0,e.y||0)+(e.angle?` `+ek(e.angle):``)}function hhe(e){return $O(e.x||0,e.y||0)+(e.angle?` `+ek(e.angle):``)+(e.scaleX||e.scaleY?` `+fhe(e.scaleX||1,e.scaleY||1):``)}function tk(e,t,n){function r(e,n){e(`transform`,mhe(n)),e(`d`,t(null,n))}function i(e,n){return t(RO(e,n.angle),n),LO(e,n,!0).translate(n.x||0,n.y||0)}function a(e,n){var r=n.x||0,i=n.y||0,a=n.angle||0;e.translate(r,i),a&&e.rotate(a*=zk),e.beginPath(),t(e,n),a&&e.rotate(-a),e.translate(-r,-i)}return{type:e,tag:`path`,nested:!1,attr:r,bound:i,draw:YO(a),pick:QO(a),isect:n||zO(a)}}function ghe(e,t){for(var n=e[0].orient===`horizontal`?t[1]:t[0],r=e[0].orient===`horizontal`?`y`:`x`,i=e.length,a=1/0,o,s;--i>=0;)e[i].defined!==!1&&(s=Math.abs(e[i][r]-n),s=0;)if(e[r].defined!==!1&&(i=e[r].x-t[0],a=e[r].y-t[1],o=i*i+a*a,o=0;)if(e[n].defined!==!1&&(r=e[n].x-t[0],i=e[n].y-t[1],a=r*r+i*i,r=e[n].size||1,a.5&&t<1.5?.5-Math.abs(t-1):0:e.strokeOffset}function She(e,t){e(`transform`,phe(t))}function Che(e,t){let n=xhe(t);e(`d`,jO(null,t,n,n))}function whe(e,t){e(`class`,`background`),e(`aria-hidden`,!0),Che(e,t)}function The(e,t){e(`class`,`foreground`),e(`aria-hidden`,!0),t.strokeForeground?Che(e,t):e(`d`,``)}function Ehe(e,t,n){e(`clip-path`,t.clip?MO(n,t,t):null)}function Dhe(e,t){if(!t.clip&&t.items){let n=t.items,r=n.length;for(let t=0;t{let i=t.x||0,a=t.y||0,o=t.strokeForeground,s=t.opacity==null?1:t.opacity;(t.stroke||t.fill)&&s&&(rk(e,t,i,a),HO(e,t),t.fill&&WO(e,t,s)&&e.fill(),t.stroke&&!o&&GO(e,t,s)&&e.stroke()),e.save(),e.translate(i,a),t.clip&&bhe(e,t),n&&n.translate(-i,-a),qO(t,t=>{(t.marktype===`group`||r==null||r.includes(t.marktype))&&this.draw(e,t,n,r)}),n&&n.translate(i,a),e.restore(),o&&t.stroke&&s&&(rk(e,t,i,a),HO(e,t),GO(e,t,s)&&e.stroke())})}function khe(e,t,n,r,i,a){if(t.bounds&&!t.bounds.contains(i,a)||!t.items)return null;let o=n*e.pixelRatio,s=r*e.pixelRatio;return JO(t,c=>{let l,u,d,f=c.bounds;if(f&&!f.contains(i,a))return;u=c.x||0,d=c.y||0;let p=u+(c.width||0),m=d+(c.height||0),h=c.clip;if(h&&(ip||am))return;if(e.save(),e.translate(u,d),u=i-u,d=a-d,h&&AO(c)&&!A_e(e,c,o,s))return e.restore(),null;let g=c.strokeForeground,_=t.interactive!==!1;return _&&g&&c.stroke&&k_e(e,c,o,s)?(e.restore(),c):(l=JO(c,e=>Ahe(e,u,d)?this.pick(e,n,r,u,d):null),!l&&_&&(c.fill||!g&&c.stroke)&&O_e(e,c,o,s)&&(l=c),e.restore(),l||null)})}function Ahe(e,t,n){return(e.interactive!==!1||e.marktype===`group`)&&e.bounds&&e.bounds.contains(t,n)}function ik(e,t){var n=e.image;return(!n||e.url&&e.url!==n.url)&&(n={complete:!1,width:0,height:0},t.loadImage(e.url).then(t=>{e.image=t,e.image.url=e.url})),n}function ak(e,t){return e.width==null?!t||!t.width?0:e.aspect!==!1&&e.height?e.height*t.width/t.height:t.width:e.width}function ok(e,t){return e.height==null?!t||!t.height?0:e.aspect!==!1&&e.width?e.width*t.height/t.width:t.height:e.height}function sk(e,t){return e===`center`?t/2:e===`right`?t:0}function ck(e,t){return e===`middle`?t/2:e===`bottom`?t:0}function jhe(e,t,n){let r=ik(t,n),i=ak(t,r),a=ok(t,r),o=(t.x||0)-sk(t.align,i),s=(t.y||0)-ck(t.baseline,a);e(`href`,!r.src&&r.toDataURL?r.toDataURL():r.src||``,bA[`xmlns:xlink`],`xlink:href`),e(`transform`,$O(o,s)),e(`width`,i),e(`height`,a),e(`preserveAspectRatio`,t.aspect===!1?`none`:`xMidYMid`)}function Mhe(e,t){let n=t.image,r=ak(t,n),i=ok(t,n),a=(t.x||0)-sk(t.align,r),o=(t.y||0)-ck(t.baseline,i);return e.set(a,o,a+r,o+i)}function Nhe(e,t,n){qO(t,t=>{if(n&&!n.intersects(t.bounds))return;let r=ik(t,this),i=ak(t,r),a=ok(t,r);if(i===0||a===0)return;let o=(t.x||0)-sk(t.align,i),s=(t.y||0)-ck(t.baseline,a),c,l,u;t.aspect!==!1&&(c=r.width/r.height,l=t.width/t.height,c===c&&l===l&&c!==l&&(l{if(!(n&&!n.intersects(t.bounds))){var r=t.opacity==null?1:t.opacity;r&&Vhe(e,t,r)&&(HO(e,t),e.stroke())}})}function Uhe(e,t,n,r){return e.isPointInStroke?Vhe(e,t,1)&&e.isPointInStroke(n,r):!1}function Whe(e){SA.width=e&&vA?dk:uk}function uk(e,t){return Ghe(gk(e,t),fk(e))}function Ghe(e,t){return~~(.8*e.length*t)}function dk(e,t){return fk(e)<=0||!(t=gk(e,t))?0:Khe(t,vk(e))}function Khe(e,t){let n=`(${t}) ${e}`,r=xA.get(n);return r===void 0&&(vA.font=t,r=vA.measureText(e).width,xA.set(n,r)),r}function fk(e){return e.fontSize==null?11:+e.fontSize||0}function pk(e){return e.lineHeight==null?fk(e)+2:e.lineHeight}function qhe(e){return W(e)?e.length>1?e:e[0]:e}function mk(e){return qhe(e.lineBreak&&e.text&&!W(e.text)?e.text.split(e.lineBreak):e.text)}function hk(e){let t=mk(e);return(W(t)?t.length-1:0)*pk(e)}function gk(e,t){let n=t==null?``:(t+``).trim();return e.limit>0&&n.length?Yhe(e,n):n}function Jhe(e){if(SA.width===dk){let t=vk(e);return e=>Khe(e,t)}else if(SA.width===uk){let t=fk(e);return e=>Ghe(e,t)}else return t=>SA.width(e,t)}function Yhe(e,t){var n=+e.limit,r=Jhe(e);if(r(t)>>1,r(t.slice(c))>n?o=c+1:s=c;return i+t.slice(o)}else{for(;o>>1),r(t.slice(0,c))Math.max(e,SA.width(t,n)),0)):d=SA.width(t,u),i===`center`?c-=d/2:i===`right`&&(c-=d),e.set(c+=o,l+=s,c+d,l+r),t.angle&&!n)e.rotate(t.angle*zk,o,s);else if(n===2)return e.rotatedPoints(t.angle*zk,o,s);return e}function Zhe(e,t,n){qO(t,t=>{var r=t.opacity==null?1:t.opacity,i,a,o,s,c,l,u;if(!(n&&!n.intersects(t.bounds)||r===0||t.fontSize<=0||t.text==null||t.text.length===0)){if(e.font=vk(t),e.textAlign=t.align||`left`,i=bk(t),a=i.x1,o=i.y1,t.angle&&(e.save(),e.translate(a,o),e.rotate(t.angle*zk),a=o=0),a+=t.dx||0,o+=(t.dy||0)+yk(t),l=mk(t),HO(e,t),W(l))for(c=pk(t),s=0;st;)e.removeChild(n[--r]);return e}function age(e){return`mark-`+e.marktype+(e.role?` role-`+e.role:``)+(e.name?` `+e.name:``)}function Dk(e,t){if(t.getScreenCTM){let n=oge(e,t.getScreenCTM());if(n)return n}return sge(e,t,t.getBoundingClientRect())}function oge(e,t){if(!t)return null;let n=t.a*t.d-t.b*t.c;if(!n)return null;let r=e.clientX-t.e,i=e.clientY-t.f;return[(t.d*r-t.c*i)/n,(t.a*i-t.b*r)/n]}function sge(e,t,n){let r=t.offsetWidth?n.width/t.offsetWidth:1,i=t.offsetHeight?n.height/t.offsetHeight:1;return[(e.clientX-n.left)/r-(t.clientLeft||0),(e.clientY-n.top)/i-(t.clientTop||0)]}function cge(e,t,n,r){var i=e&&e.mark,a,o;if(i&&(a=wA[i.marktype]).tip){for(o=Dk(t,n),o[0]-=r[0],o[1]-=r[1];e=e.mark.group;)o[0]-=e.x||0,o[1]-=e.y||0;e=a.tip(i.items,o)}return e}function lge(e,t,n,r){e.element().setAttribute(`title`,r||``)}function uge(e,t){QA(t).forEach(t=>dge(e,t))}function dge(e,t){let n=e.canvas();n&&!e._events[t]&&(e._events[t]=1,n.addEventListener(t,e[t]?n=>e[t](n):n=>e.fire(t,n)))}function Ok(e,t,n){t.forEach(t=>e.fire(t,n))}function fge(e,t,n){return function(r){let i=this._active,a=this.pickEvent(r);a===i?Ok(this,e,r):((!i||!i.exit)&&Ok(this,n,r),this._active=a,Ok(this,t,r),Ok(this,e,r))}}function pge(e){return function(t){Ok(this,e,t),this._active=null}}function mge(){return typeof window<`u`&&window.devicePixelRatio||1}function hge(e,t,n,r,i,a){let o=typeof HTMLElement<`u`&&e instanceof HTMLElement&&e.parentNode!=null,s=e.getContext(`2d`),c=o?mge():i;e.width=t*c,e.height=n*c;for(let e in a)s[e]=a[e];return o&&c!==1&&(e.style.width=t+`px`,e.style.height=n+`px`),s.pixelRatio=c,s.setTransform(c,0,0,c,c*r[0],c*r[1]),e}function gge(e,t,n){return t.expand(1).round(),e.pixelRatio%1&&t.scale(e.pixelRatio).round().scale(1/e.pixelRatio),t.translate(-(n[0]%1),-(n[1]%1)),e.beginPath(),e.rect(t.x1,t.y1,t.width(),t.height()),e.clip(),t}function _ge(e,t){let n=t.aria===!1;if(e(rj,n||void 0),n||t.description==null)for(let t in fj)e(fj[t],void 0);else{let n=t.mark.marktype;e(ij,t.description),e(aj,t.ariaRole||(n===`group`?sj:cj)),e(oj,t.ariaRoleDescription||`${n} mark`)}}function vge(e){return e.aria===!1?{[rj]:!0}:uj[e.role]?null:dj[e.role]?bge(e,dj[e.role]):yge(e)}function yge(e){let t=e.marktype,n=t===`group`||t===`text`||e.items.some(e=>e.description!=null&&e.aria!==!1);return lj(n?sj:cj,`${t} mark container`,e.description)}function bge(e,t){try{let n=e.items[0],r=t.caption||(()=>``);return lj(t.role||cj,t.desc,e.description||n.description||r(n))}catch{return null}}function xge(e){return Qh(e.text).join(` `)}function Sge(e){let t=e.datum,n=e.orient,r=t.title?wge(e):null,i=e.context,a=i.scales[t.scale].value,o=i.dataflow.locale(),s=a.type;return`${n===`left`||n===`right`?`Y`:`X`}-axis`+(r?` titled '${r}'`:``)+` for a ${qD(s)?`discrete`:s} scale with ${fme(o,a,e)}`}function Cge(e){let t=e.datum,n=t.title?wge(e):null,r=`${t.type||``} legend`.trim(),i=t.scales,a=Object.keys(i),o=e.context,s=o.scales[i[a[0]]].value,c=o.dataflow.locale();return Ege(r)+(n?` titled '${n}'`:``)+` for ${Tge(a)} with ${fme(c,s,e)}`}function wge(e){try{return Qh(Ih(e.items).items[0].text).join(` `)}catch{return null}}function Tge(e){return e=e.map(e=>e+(e===`fill`||e===`stroke`?` color`:``)),e.length<2?e[0]:e.slice(0,-1).join(`, `)+` and `+Ih(e)}function Ege(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function kk(){let e=``,t=``,n=``,r=[],i=()=>t=n=``,a=a=>{t&&(e+=`${t}>${n}`,i()),r.push(a)},o=(e,n)=>(n!=null&&(t+=` ${e}="${mj(n)}"`),s),s={open(e,...n){a(e),t=`<`+e;for(let e of n)for(let t in e)o(t,e[t]);return s},close(){let a=r.pop();return t?e+=t+(n?`>${n}`:`/>`):e+=``,i(),s},attr:o,text:e=>(n+=pj(e),s),toString:()=>e};return s}function Dge(e,t){if(e.open(t.tagName),t.hasAttributes()){let n=t.attributes,r=n.length;for(let t=0;t{i=e.mark(t,n,i,r),++a}),Ek(t,1+a)}function Mge(e,t,n,r,i){let a=e._svg,o;if(!a&&(o=t.ownerDocument,a=Ck(o,r,xj),e._svg=a,e.mark&&(a.__data__=e,a.__values__={fill:`default`},r===`g`))){let t=Ck(o,`path`,xj);a.appendChild(t),t.__data__=e;let n=Ck(o,`g`,xj);a.appendChild(n),n.__data__=e;let r=Ck(o,`path`,xj);a.appendChild(r),r.__data__=e,r.__values__={fill:`default`}}return(a.ownerSVGElement!==i||Nge(a,n))&&t.insertBefore(a,n?n.nextSibling:t.firstChild),a}function Nge(e,t){return e.parentNode&&e.parentNode.childNodes.length>1&&e.previousSibling!=t}function Ak(e,t,n){t!==wj[e]&&(n?Pge(Cj,e,t,n):Nk(Cj,e,t),wj[e]=t)}function jk(e,t,n){n!==wj[t]&&(n==null?e.style.removeProperty(t):e.style.setProperty(t,n+``),wj[t]=n)}function Mk(e,t){for(let n in t)Nk(e,n,t[n])}function Nk(e,t,n){n==null?e.removeAttribute(t):e.setAttribute(t,n)}function Pge(e,t,n,r){n==null?e.removeAttributeNS(r,t):e.setAttributeNS(r,t,n)}function Fge(){let e;return typeof window>`u`?``:(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}function Ige(e,t,n,r,i){let a;if(t==null||(r===`bgrect`&&n.interactive===!1&&(e[`pointer-events`]=`none`),r===`bgfore`&&(n.interactive===!1&&(e[`pointer-events`]=`none`),e.display=`none`,t.fill!==null)))return e;r===`image`&&t.smooth===!1&&(a=[`image-rendering: optimizeSpeed;`,`image-rendering: pixelated;`]),r===`text`&&(e[`font-family`]=_k(t),e[`font-size`]=fk(t)+`px`,e[`font-style`]=t.fontStyle,e[`font-variant`]=t.fontVariant,e[`font-weight`]=t.fontWeight);for(let n in gj){let r=t[n],a=gj[n];r===`transparent`&&(a===`fill`||a===`stroke`)||r!=null&&(SO(r)&&(r=Mme(r,i.gradient,``)),e[a]=r)}for(let e in _j){let n=t[e];n!=null&&(a||=[],a.push(`${_j[e]}: ${n};`))}return a&&(e.style=a.join(` `)),e}function Lge(e){Dj.svgMarkTypes=e.svgMarkTypes??[`text`],Dj.svgOnTop=e.svgOnTop??!0,Dj.debug=e.debug??!1}function Pk(e,t){return e=String(e||``).toLowerCase(),arguments.length>1?(Ij[e]=t,this):Ij[e]}function Rge(e,t,n){let r=[],i=new NO().union(t),a=e.marktype;return a?zge(e,i,n,r):a===`group`?Vge(e,i,n,r):U(`Intersect scene must be mark node or group item.`)}function zge(e,t,n,r){if(Bge(e,t,n)){let i=e.items,a=e.marktype,o=i.length,s=0;if(a===`group`)for(;s=0;a--)if(n[a]!=r[a])return!1;for(a=n.length-1;a>=0;a--)if(i=n[a],!Fk(e[i],t[i],i))return!1;return typeof e==typeof t}function Kge(){$me(),jme()}var Ik,Lk,Rk,qge,Jge,Yge,Xge,Zge,zk,Qge,Bk,Vk,Hk,Uk,Wk,Gk,Kk,qk,Jk,Yk,Xk,Zk,Qk,$ge,e_e,t_e,n_e,r_e,i_e,a_e,o_e,s_e,c_e,l_e,u_e,d_e,f_e,p_e,m_e,$k,h_e,g_e,__e,v_e,y_e,b_e,x_e,S_e,eA,tA,C_e,nA,rA,iA,aA,oA,sA,cA,lA,uA,dA,fA,pA,mA,hA,gA,_A,w_e,vA,yA,T_e,E_e,D_e,O_e,k_e,A_e,j_e,bA,M_e,N_e,P_e,F_e,I_e,L_e,R_e,xA,SA,z_e,CA,wA,TA,B_e,EA,DA,OA,V_e,H_e,U_e,kA,AA,jA,MA,W_e,NA,PA,FA,IA,G_e,LA,RA,zA,BA,VA,HA,UA,WA,GA,KA,qA,JA,YA,XA,ZA,QA,$A,ej,tj,nj,rj,ij,aj,oj,sj,cj,lj,uj,dj,fj,pj,mj,hj,gj,_j,vj,yj,bj,xj,Sj,Cj,wj,Tj,Ej,Dj,Oj,kj,Aj,jj,Mj,Nj,Pj,Fj,Ij,Lj,Rj,zj=o((()=>{Dg(),Jue(),Nw(),IT(),nx(),xO(),Ik=0,Lk=`p_`,Rk={basis:{curve:kue},"basis-closed":{curve:Aue},"basis-open":{curve:Mue},bundle:{curve:iT,tension:`beta`,value:.85},cardinal:{curve:sT,tension:`tension`,value:0},"cardinal-open":{curve:pT,tension:`tension`,value:0},"cardinal-closed":{curve:uT,tension:`tension`,value:0},"catmull-rom":{curve:_T,tension:`alpha`,value:.5},"catmull-rom-closed":{curve:bT,tension:`alpha`,value:.5},"catmull-rom-open":{curve:ST,tension:`alpha`,value:.5},linear:{curve:Bw},"linear-closed":{curve:Lue},monotone:{horizontal:Bue,vertical:zue},natural:{curve:Hue},step:{curve:Wue},"step-after":{curve:Kue},"step-before":{curve:Gue}},qge={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},Jge=/[mlhvzcsqta]([^mlhvzcsqta]*)/gi,Yge=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,Xge=/^((\s+,?\s*)|(,\s*))/,Zge=/^[01]/,zk=Math.PI/180,Qge=1e-14,Bk=Math.PI/2,Vk=Math.PI*2,Hk=Math.sqrt(3)/2,Uk={},Wk={},Gk=[].join,Kk=[`l`,0,0,0,0,0,0,0],qk=.5773502691896257,Jk={circle:{draw:function(e,t){let n=Math.sqrt(t)/2;e.moveTo(n,0),e.arc(0,0,n,0,Vk)}},cross:{draw:function(e,t){var n=Math.sqrt(t)/2,r=n/2.5;e.moveTo(-n,-r),e.lineTo(-n,r),e.lineTo(-r,r),e.lineTo(-r,n),e.lineTo(r,n),e.lineTo(r,r),e.lineTo(n,r),e.lineTo(n,-r),e.lineTo(r,-r),e.lineTo(r,-n),e.lineTo(-r,-n),e.lineTo(-r,-r),e.closePath()}},diamond:{draw:function(e,t){let n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.closePath()}},square:{draw:function(e,t){var n=Math.sqrt(t),r=-n/2;e.rect(r,r,n,n)}},arrow:{draw:function(e,t){var n=Math.sqrt(t)/2,r=n/7,i=n/2.5,a=n/8;e.moveTo(-r,n),e.lineTo(r,n),e.lineTo(r,-a),e.lineTo(i,-a),e.lineTo(0,-n),e.lineTo(-i,-a),e.lineTo(-r,-a),e.closePath()}},wedge:{draw:function(e,t){var n=Math.sqrt(t)/2,r=Hk*n,i=r-n*qk,a=n/4;e.moveTo(0,-r-i),e.lineTo(-a,r-i),e.lineTo(a,r-i),e.closePath()}},triangle:{draw:function(e,t){var n=Math.sqrt(t)/2,r=Hk*n,i=r-n*qk;e.moveTo(0,-r-i),e.lineTo(-n,r-i),e.lineTo(n,r-i),e.closePath()}},"triangle-up":{draw:function(e,t){var n=Math.sqrt(t)/2,r=Hk*n;e.moveTo(0,-r),e.lineTo(-n,r),e.lineTo(n,r),e.closePath()}},"triangle-down":{draw:function(e,t){var n=Math.sqrt(t)/2,r=Hk*n;e.moveTo(0,r),e.lineTo(-n,-r),e.lineTo(n,-r),e.closePath()}},"triangle-right":{draw:function(e,t){var n=Math.sqrt(t)/2,r=Hk*n;e.moveTo(r,0),e.lineTo(-r,-n),e.lineTo(-r,n),e.closePath()}},"triangle-left":{draw:function(e,t){var n=Math.sqrt(t)/2,r=Hk*n;e.moveTo(-r,0),e.lineTo(r,-n),e.lineTo(r,n),e.closePath()}},stroke:{draw:function(e,t){let n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(n,0)}}},Yk={},Xk=.448084975506,Zk=e=>e.x||0,Qk=e=>e.y||0,$ge=e=>e.width||0,e_e=e=>e.height||0,t_e=e=>(e.x||0)+(e.width||0),n_e=e=>(e.y||0)+(e.height||0),r_e=e=>e.startAngle||0,i_e=e=>e.endAngle||0,a_e=e=>e.padAngle||0,o_e=e=>e.innerRadius||0,s_e=e=>e.outerRadius||0,c_e=e=>e.cornerRadius||0,l_e=e=>kO(e.cornerRadiusTopLeft,e.cornerRadius)||0,u_e=e=>kO(e.cornerRadiusTopRight,e.cornerRadius)||0,d_e=e=>kO(e.cornerRadiusBottomRight,e.cornerRadius)||0,f_e=e=>kO(e.cornerRadiusBottomLeft,e.cornerRadius)||0,p_e=e=>kO(e.size,64),m_e=e=>e.size||1,$k=e=>e.defined!==!1,h_e=e=>zme(e.shape||`circle`),g_e=wue().startAngle(r_e).endAngle(i_e).padAngle(a_e).innerRadius(o_e).outerRadius(s_e).cornerRadius(c_e),__e=qw().x(Zk).y1(Qk).y0(n_e).defined($k),v_e=qw().y(Qk).x1(Zk).x0(t_e).defined($k),y_e=Gw().x(Zk).y(Qk).defined($k),b_e=Gme().x(Zk).y(Qk).width($ge).height(e_e).cornerRadius(l_e,u_e,d_e,f_e),x_e=Due().type(h_e).size(p_e),S_e=Kme().x(Zk).y(Qk).defined($k).size(m_e),eA=1,NO.prototype={clone(){return new NO(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2},set(e,t,n,r){return nthis.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},expand(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(e){return this.x1*=e,this.y1*=e,this.x2*=e,this.y2*=e,this},translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},rotate(e,t,n){let r=this.rotatedPoints(e,t,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},rotatedPoints(e,t,n){var{x1:r,y1:i,x2:a,y2:o}=this,s=Math.cos(e),c=Math.sin(e),l=t-t*s+n*c,u=n-t*c-n*s;return[s*r-c*i+l,c*r+s*i+u,s*r-c*o+l,c*r+s*o+u,s*a-c*i+l,c*a+s*i+u,s*a-c*o+l,c*a+s*o+u]},union(e){return e.x1this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2=e.x2&&this.y1<=e.y1&&this.y2>=e.y2},alignsWith(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},intersects(e){return e&&!(this.x2e.x2||this.y2e.y2)},contains(e,t){return!(ethis.x2||tthis.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},fg(FO,PO),tA=class{constructor(e){this._pending=0,this._loader=e||tx()}pending(){return this._pending}sanitizeURL(e){let t=this;return ehe(t),t._loader.sanitize(e,{context:`href`}).then(e=>(IO(t),e)).catch(()=>(IO(t),null))}loadImage(e){let t=this,n=FT();return ehe(t),t._loader.sanitize(e,{context:`image`}).then(e=>{let r=e.href;if(!r||!n)throw{url:r};let i=new n,a=cg(e,`crossOrigin`)?e.crossOrigin:`anonymous`;return a!=null&&(i.crossOrigin=a),i.onload=()=>IO(t),i.onerror=()=>IO(t),i.src=r,i}).catch(e=>(IO(t),{complete:!1,width:0,height:0,src:e&&e.url||``}))}ready(){let e=this;return new Promise(t=>{function n(r){e.pending()?setTimeout(()=>{n(!0)},10):t(r)}n(!1)})}},C_e=Vk-1e-8,uA=(e,t)=>nA.add(e,t),dA=(e,t)=>uA(rA=e,iA=t),fA=e=>uA(e,nA.y1),pA=e=>uA(nA.x1,e),mA=(e,t)=>oA*e+cA*t,hA=(e,t)=>sA*e+lA*t,gA=(e,t)=>uA(mA(e,t),hA(e,t)),_A=(e,t)=>dA(mA(e,t),hA(e,t)),w_e={beginPath(){},closePath(){},moveTo:_A,lineTo:_A,rect(e,t,n,r){aA?(gA(e+n,t),gA(e+n,t+r),gA(e,t+r),_A(e,t)):(uA(e+n,t+r),dA(e,t))},quadraticCurveTo(e,t,n,r){let i=mA(e,t),a=hA(e,t),o=mA(n,r),s=hA(n,r);the(rA,i,o,fA),the(iA,a,s,pA),dA(o,s)},bezierCurveTo(e,t,n,r,i,a){let o=mA(e,t),s=hA(e,t),c=mA(n,r),l=hA(n,r),u=mA(i,a),d=hA(i,a);nhe(rA,o,c,u,fA),nhe(iA,s,l,d,pA),dA(u,d)},arc(e,t,n,r,i,a){if(r+=aA,i+=aA,rA=n*Math.cos(i)+e,iA=n*Math.sin(i)+t,Math.abs(i-r)>C_e)uA(e-n,t-n),uA(e+n,t+n);else{let o=r=>uA(n*Math.cos(r)+e,n*Math.sin(r)+t),s,c;if(o(r),o(i),i!==r)if(r%=Vk,r<0&&(r+=Vk),i%=Vk,i<0&&(i+=Vk),ii;++c,s-=Bk)o(s);else for(s=r-r%Bk+Bk,c=0;c<4&&s=0;)if(e[r].type===t&&(!n||e[r].handler===n))return r;return-1}handlers(e){let t=this._handlers,n=[];if(e)n.push(...t[this.eventName(e)]);else for(let e in t)n.push(...t[e]);return n}eventName(e){let t=e.indexOf(`.`);return t<0?e:e.slice(0,t)}handleHref(e,t,n){this._loader.sanitize(n,{context:`href`}).then(t=>{let n=new MouseEvent(e.type,e),r=Ck(null,`a`);for(let e in t)r.setAttribute(e,t[e]);r.dispatchEvent(n)}).catch(()=>{})}handleTooltip(e,t,n){if(t&&t.tooltip!=null){t=cge(t,e,this.canvas(),this._origin);let r=n&&t&&t.tooltip||null;this._tooltip.call(this._obj,this,e,t,r)}}getItemBoundingClientRect(e){let t=this.canvas();if(!t)return;let n=t.getBoundingClientRect(),r=this._origin,i=e.bounds,a=i.width(),o=i.height(),s=i.x1+r[0]+n.left,c=i.y1+r[1]+n.top;for(;e.mark&&(e=e.mark.group);)s+=e.x||0,c+=e.y||0;return{x:s,y:c,width:a,height:o,left:s,top:c,right:s+a,bottom:c+o}}},OA=class{constructor(e){this._el=null,this._bgcolor=null,this._loader=new tA(e)}initialize(e,t,n,r,i){return this._el=e,this.resize(t,n,r,i)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}background(e){return arguments.length===0?this._bgcolor:(this._bgcolor=e,this)}resize(e,t,n,r){return this._width=e,this._height=t,this._origin=n||[0,0],this._scale=r||1,this}dirty(){}render(e,t){let n=this;return n._call=function(){n._render(e,t)},n._call(),n._call=null,n}_render(){}renderAsync(e,t){let n=this.render(e,t);return this._ready?this._ready.then(()=>n):Promise.resolve(n)}_load(e,t){var n=this,r=n._loader[e](t);if(!n._ready){let e=n._call;n._ready=n._loader.ready().then(t=>{t&&e(),n._ready=null})}return r}sanitizeURL(e){return this._load(`sanitizeURL`,e)}loadImage(e){return this._load(`loadImage`,e)}},V_e=`keydown`,H_e=`keypress`,U_e=`keyup`,kA=`dragenter`,AA=`dragleave`,jA=`dragover`,MA=`pointerdown`,W_e=`pointerup`,NA=`pointermove`,PA=`pointerout`,FA=`pointerover`,IA=`mousedown`,G_e=`mouseup`,LA=`mousemove`,RA=`mouseout`,zA=`mouseover`,BA=`click`,VA=`dblclick`,HA=`wheel`,UA=`mousewheel`,WA=`touchstart`,GA=`touchmove`,KA=`touchend`,qA=[V_e,H_e,U_e,kA,AA,jA,MA,W_e,NA,PA,FA,IA,G_e,LA,RA,zA,BA,VA,HA,UA,WA,GA,KA],JA=NA,YA=RA,XA=BA,ZA=class extends DA{constructor(e,t){super(e,t),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=qA,this.pointermove=fge([NA,LA],[FA,zA],[PA,RA]),this.dragover=fge([jA],[kA],[AA]),this.pointerout=pge([PA,RA]),this.dragleave=pge([AA])}initialize(e,t,n){return this._canvas=e&&wk(e,`canvas`),[BA,IA,MA,NA,PA,AA].forEach(e=>uge(this,e)),super.initialize(e,t,n)}canvas(){return this._canvas}context(){return this._canvas.getContext(`2d`)}DOMMouseScroll(e){this.fire(UA,e)}pointerdown(e){this._down=this._active,this.fire(MA,e)}mousedown(e){this._down=this._active,this.fire(IA,e)}click(e){this._down===this._active&&(this.fire(BA,e),this._down=null)}touchstart(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&=(this._active=this._touch,!1),this.fire(WA,e,!0)}touchmove(e){this.fire(GA,e,!0)}touchend(e){this.fire(KA,e,!0),this._touch=null}fire(e,t,n){let r=n?this._touch:this._active,i=this._handlers[e];if(t.vegaType=e,e===XA&&r&&r.href?this.handleHref(t,r,r.href):(e===JA||e===YA)&&this.handleTooltip(t,r,e!==YA),i)for(let e=0,n=i.length;e=0&&r.splice(i,1),this}pickEvent(e){let t=Dk(e,this._canvas),n=this._origin;return this.pick(this._scene,t[0],t[1],t[0]-n[0],t[1]-n[1])}pick(e,t,n,r,i){let a=this.context();return wA[e.marktype].pick.call(this,a,e,t,n,r,i)}},QA=e=>e===WA||e===GA||e===KA?[WA,GA,KA]:[e],$A=class extends OA{constructor(e){super(e),this._options={},this._redraw=!1,this._dirty=new NO,this._tempb=new NO}initialize(e,t,n,r,i,a){return this._options=a||{},this._canvas=this._options.externalContext?null:PT(1,1,this._options.type),e&&this._canvas&&(Ek(e,0).appendChild(this._canvas),this._canvas.setAttribute(`class`,`marks`)),super.initialize(e,t,n,r,i)}resize(e,t,n,r){if(super.resize(e,t,n,r),this._canvas)hge(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{let e=this._options.externalContext;e||U(`CanvasRenderer is missing a valid canvas or context`),e.scale(this._scale,this._scale),e.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this}canvas(){return this._canvas}context(){return this._options.externalContext||(this._canvas?this._canvas.getContext(`2d`):null)}dirty(e){let t=this._tempb.clear().union(e.bounds),n=e.mark.group;for(;n;)t.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(t)}_render(e,t){let n=this.context(),r=this._origin,i=this._width,a=this._height,o=this._dirty,s=ej(r,i,a);n.save();let c=this._redraw||o.empty()?(this._redraw=!1,s.expand(1)):gge(n,s.intersect(o),r);return this.clear(-r[0],-r[1],i,a),this.draw(n,e,c,t),n.restore(),o.clear(),this}draw(e,t,n,r){if(t.marktype!==`group`&&r!=null&&!r.includes(t.marktype))return;let i=wA[t.marktype];t.clip&&yhe(e,t),i.draw.call(this,e,t,n,r),t.clip&&e.restore()}clear(e,t,n,r){let i=this._options,a=this.context();i.type!==`pdf`&&!i.externalContext&&a.clearRect(e,t,n,r),this._bgcolor!=null&&(a.fillStyle=this._bgcolor,a.fillRect(e,t,n,r))}},ej=(e,t,n)=>new NO().set(0,0,t,n).translate(-e[0],-e[1]),tj=class extends DA{constructor(e,t){super(e,t);let n=this;n._hrefHandler=nj(n,(e,t)=>{t&&t.href&&n.handleHref(e,t,t.href)}),n._tooltipHandler=nj(n,(e,t)=>{n.handleTooltip(e,t,e.type!==YA)})}initialize(e,t,n){let r=this._svg;return r&&(r.removeEventListener(XA,this._hrefHandler),r.removeEventListener(JA,this._tooltipHandler),r.removeEventListener(YA,this._tooltipHandler)),this._svg=r=e&&wk(e,`svg`),r&&(r.addEventListener(XA,this._hrefHandler),r.addEventListener(JA,this._tooltipHandler),r.addEventListener(YA,this._tooltipHandler)),super.initialize(e,t,n)}canvas(){return this._svg}on(e,t){let n=this.eventName(e),r=this._handlers;if(this._handlerIndex(r[n],e,t)<0){let i={type:e,handler:t,listener:nj(this,t)};(r[n]||(r[n]=[])).push(i),this._svg&&this._svg.addEventListener(n,i.listener)}return this}off(e,t){let n=this.eventName(e),r=this._handlers[n],i=this._handlerIndex(r,e,t);return i>=0&&(this._svg&&this._svg.removeEventListener(n,r[i].listener),r.splice(i,1)),this}},nj=(e,t)=>n=>{let r=n.target.__data__;r=Array.isArray(r)?r[0]:r,n.vegaType=n.type,t.call(e._obj,n,r)},rj=`aria-hidden`,ij=`aria-label`,aj=`role`,oj=`aria-roledescription`,sj=`graphics-object`,cj=`graphics-symbol`,lj=(e,t,n)=>({[aj]:e,[oj]:t,[ij]:n||void 0}),uj=Tg([`axis-domain`,`axis-grid`,`axis-label`,`axis-tick`,`axis-title`,`legend-band`,`legend-entry`,`legend-gradient`,`legend-label`,`legend-title`,`legend-symbol`,`title`]),dj={axis:{desc:`axis`,caption:Sge},legend:{desc:`legend`,caption:Cge},"title-text":{desc:`title`,caption:e=>`Title text '${xge(e)}'`},"title-subtitle":{desc:`subtitle`,caption:e=>`Subtitle text '${xge(e)}'`}},fj={ariaRole:aj,ariaRoleDescription:oj,description:ij},pj=e=>(e+``).replace(/&/g,`&`).replace(//g,`>`),mj=e=>pj(e).replace(/"/g,`"`).replace(/\t/g,` `).replace(/\n/g,` `).replace(/\r/g,` `),hj=e=>Dge(kk(),e)+``,gj={fill:`fill`,fillOpacity:`fill-opacity`,stroke:`stroke`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,strokeCap:`stroke-linecap`,strokeJoin:`stroke-linejoin`,strokeDash:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeMiterLimit:`stroke-miterlimit`,opacity:`opacity`},_j={blend:`mix-blend-mode`},vj={fill:`none`,"stroke-miterlimit":4},yj=0,bj=`http://www.w3.org/2000/xmlns/`,xj=bA.xmlns,Sj=class extends OA{constructor(e){super(e),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}initialize(e,t,n,r,i){return this._defs={},this._clearDefs(),e&&(this._svg=Tk(e,0,`svg`,xj),this._svg.setAttributeNS(bj,`xmlns`,xj),this._svg.setAttributeNS(bj,`xmlns:xlink`,bA[`xmlns:xlink`]),this._svg.setAttribute(`version`,bA.version),this._svg.setAttribute(`class`,`marks`),Ek(e,1),this._root=Tk(this._svg,yj,`g`,xj),Mk(this._root,vj),Ek(this._svg,1)),this.background(this._bgcolor),super.initialize(e,t,n,r,i)}background(e){return arguments.length&&this._svg&&this._svg.style.setProperty(`background-color`,e),super.background(...arguments)}resize(e,t,n,r){return super.resize(e,t,n,r),this._svg&&(Mk(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}),this._root.setAttribute(`transform`,`translate(${this._origin})`)),this._dirty=[],this}canvas(){return this._svg}svg(){let e=this._svg,t=this._bgcolor;if(!e)return null;let n;t&&(e.removeAttribute(`style`),n=Tk(e,yj,`rect`,xj),Mk(n,{width:this._width,height:this._height,fill:t}));let r=hj(e);return t&&(e.removeChild(n),this._svg.style.setProperty(`background-color`,t)),r}_render(e,t){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,e,void 0,t),Ek(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this}dirty(e){e.dirty!==this._dirtyID&&(e.dirty=this._dirtyID,this._dirty.push(e))}isDirty(e){return this._dirtyAll||!e._svg||!e._svg.ownerSVGElement||e.dirty===this._dirtyID}_dirtyCheck(){this._dirtyAll=!0;let e=this._dirty;if(!e.length||!this._dirtyID)return!0;let t=++this._dirtyID,n,r,i,a,o,s,c;for(o=0,s=e.length;o{e.dirty=t})),!r.zdirty){if(n.exit){a.nested&&r.items.length?(c=r.items[0],c._svg&&this._update(a,c._svg,c)):n._svg&&(c=n._svg.parentNode,c&&c.removeChild(n._svg)),n._svg=null;continue}n=a.nested?r.items[0]:n,n._update!==t&&(!n._svg||!n._svg.ownerSVGElement?(this._dirtyAll=!1,Oge(n,t)):this._update(a,n._svg,n),n._update=t)}return!this._dirtyAll}mark(e,t,n,r){if(!this.isDirty(t))return t._svg;let i=this._svg,a=t.marktype,o=wA[a],s=t.interactive===!1?`none`:null,c=o.tag===`g`,l=Mge(t,e,n,`g`,i);if(a!==`group`&&r!=null&&!r.includes(a))return Ek(l,0),t._svg;l.setAttribute(`class`,age(t));let u=vge(t);for(let e in u)Nk(l,e,u[e]);c||Nk(l,`pointer-events`,s),Nk(l,`clip-path`,t.clip?MO(this,t,t.group):null);let d=null,f=0,p=e=>{let t=this.isDirty(e),n=Mge(e,l,d,o.tag,i);t&&(this._update(o,n,e),c&&jge(this,n,e,r)),d=n,++f};return o.nested?t.items.length&&p(t.items[0]):qO(t,p),Ek(l,f),l}_update(e,t,n){Cj=t,wj=t.__values__,_ge(Ak,n),e.attr(Ak,n,this);let r=Tj[e.type];r&&r.call(this,e,t,n),Cj&&this.style(Cj,n)}style(e,t){if(t!=null){for(let n in gj){let r=n===`font`?_k(t):t[n];if(r===wj[n])continue;let i=gj[n];r==null?e.removeAttribute(i):(SO(r)&&(r=Mme(r,this._defs.gradient,Fge())),e.setAttribute(i,r+``)),wj[n]=r}for(let n in _j)jk(e,_j[n],t[n])}}defs(){let e=this._svg,t=this._defs,n=t.el,r=0;for(let i in t.gradient)n||(t.el=n=Tk(e,1,`defs`,xj)),r=kge(n,t.gradient[i],r);for(let i in t.clipping)n||(t.el=n=Tk(e,1,`defs`,xj)),r=Age(n,t.clipping[i],r);n&&(r===0?(e.removeChild(n),t.el=null):Ek(n,r))}_clearDefs(){let e=this._defs;e.gradient={},e.clipping={}}},Cj=null,wj=null,Tj={group(e,t,n){let r=Cj=t.childNodes[2];wj=r.__values__,e.foreground(Ak,n,this),wj=t.__values__,Cj=t.childNodes[1],e.content(Ak,n,this);let i=Cj=t.childNodes[0];e.background(Ak,n,this);let a=n.mark.interactive===!1?`none`:null;if(a!==wj.events&&(Nk(r,`pointer-events`,a),Nk(i,`pointer-events`,a),wj.events=a),n.strokeForeground&&n.stroke){let e=n.fill;Nk(r,`display`,null),this.style(i,n),Nk(i,`stroke`,null),e&&(n.fill=null),wj=r.__values__,this.style(r,n),e&&(n.fill=e),Cj=null}else Nk(r,`display`,`none`)},image(e,t,n){n.smooth===!1?(jk(t,`image-rendering`,`optimizeSpeed`),jk(t,`image-rendering`,`pixelated`)):jk(t,`image-rendering`,null)},text(e,t,n){let r=mk(n),i,a,o,s;W(r)?(a=r.map(e=>gk(n,e)),i=a.join(` -`),i!==wj.text&&(Ek(t,0),o=t.ownerDocument,s=pk(n),a.forEach((e,r)=>{let i=Ck(o,`tspan`,xj);i.__data__=n,i.textContent=e,r&&(i.setAttribute(`x`,0),i.setAttribute(`dy`,s)),t.appendChild(i)}),wj.text=i)):(a=gk(n,r),a!==wj.text&&(t.textContent=a,wj.text=a)),Nk(t,`font-family`,_k(n)),Nk(t,`font-size`,fk(n)+`px`),Nk(t,`font-style`,n.fontStyle),Nk(t,`font-variant`,n.fontVariant),Nk(t,`font-weight`,n.fontWeight)}},Ej=class extends OA{constructor(e){super(e),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(e){let t=kk();t.open(`svg`,og({},bA,{class:`marks`,width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));let n=this._bgcolor;return n&&n!==`transparent`&&n!==`none`&&t.open(`rect`,{width:this._width,height:this._height,fill:n}).close(),t.open(`g`,vj,{transform:`translate(`+this._origin+`)`}),this.mark(t,e),t.close(),this.defs(t),this._text=t.close()+``,this}mark(e,t){let n=wA[t.marktype],r=n.tag,i=[_ge,n.attr];e.open(`g`,{class:age(t),"clip-path":t.clip?MO(this,t,t.group):null},vge(t),{"pointer-events":r!==`g`&&t.interactive===!1?`none`:null});let a=a=>{let o=this.href(a);if(o&&e.open(`a`,o),e.open(r,this.attr(t,a,i,r===`g`?null:r)),r===`text`){let t=mk(a);if(W(t)){let n={x:0,dy:pk(a)};for(let r=0;rthis.mark(e,t)),e.close(),r&&o?(i&&(a.fill=null),a.stroke=o,e.open(`path`,this.attr(t,a,n.foreground,`bgrect`)).close(),i&&(a.fill=i)):e.open(`path`,this.attr(t,a,n.foreground,`bgfore`)).close()}e.close(),o&&e.close()};return n.nested?t.items&&t.items.length&&a(t.items[0]):qO(t,a),e.close()}href(e){let t=e.href,n;if(t){if(n=this._hrefs&&this._hrefs[t])return n;this.sanitizeURL(t).then(e=>{e[`xlink:href`]=e.href,e.href=null,(this._hrefs||={})[t]=e})}return null}attr(e,t,n,r){let i={},a=(e,t,n,r)=>{i[r||e]=t};return Array.isArray(n)?n.forEach(e=>e(a,t,this)):n(a,t,this),r&&Ige(i,t,e,r,this._defs),i}defs(e){let t=this._defs.gradient,n=this._defs.clipping;if(Object.keys(t).length+Object.keys(n).length!==0){e.open(`defs`);for(let n in t){let r=t[n],i=r.stops;r.gradient===`radial`?(e.open(`pattern`,{id:Lk+n,viewBox:`0,0,1,1`,width:`100%`,height:`100%`,preserveAspectRatio:`xMidYMid slice`}),e.open(`rect`,{width:`1`,height:`1`,fill:`url(#`+n+`)`}).close(),e.close(),e.open(`radialGradient`,{id:n,fx:r.x1,fy:r.y1,fr:r.r1,cx:r.x2,cy:r.y2,r:r.r2})):e.open(`linearGradient`,{id:n,x1:r.x1,x2:r.x2,y1:r.y1,y2:r.y2});for(let t=0;t!Dj.svgMarkTypes.includes(e));this._svgRenderer.render(e,Dj.svgMarkTypes),this._canvasRenderer.render(e,n)}resize(e,t,n,r){return super.resize(e,t,n,r),this._svgRenderer.resize(e,t,n,r),this._canvasRenderer.resize(e,t,n,r),this}background(e){return Dj.svgOnTop?this._canvasRenderer.background(e):this._svgRenderer.background(e),this}},kj=class extends ZA{constructor(e,t){super(e,t)}initialize(e,t,n){let r=Tk(Tk(e,0,`div`),+!Dj.svgOnTop,`div`);return super.initialize(r,t,n)}},Aj=`canvas`,jj=`hybrid`,Mj=`png`,Nj=`svg`,Pj=`none`,Fj={Canvas:Aj,PNG:Mj,SVG:Nj,Hybrid:jj,None:Pj},Ij={},Ij[Aj]=Ij[Mj]={renderer:$A,headless:$A,handler:ZA},Ij[Nj]={renderer:Sj,headless:Ej,handler:tj},Ij[jj]={renderer:Oj,headless:Oj,handler:kj},Ij[Pj]={},Lj=new NO,Rj=1e-9})),K_e=c({bound:()=>Bj,identifier:()=>Hj,mark:()=>Uj,overlap:()=>Wj,render:()=>Gj,viewlayout:()=>tM});function Bj(e){K.call(this,null,e)}function Vj(e,t,n){return t(e.bounds.clear(),e,n)}function Hj(e){K.call(this,0,e)}function q_e(e){return e._signals[BM]||(e._signals[BM]=e.add(0))}function Uj(e){K.call(this,null,e)}function J_e(e){let t=e.groups,n=e.parent;return t&&t.size===1?t.get(Object.keys(t.object)[0]):t&&n?t.lookup(n):null}function Wj(e){K.call(this,null,e)}function Gj(e){K.call(this,null,e)}function Kj(e,t,n){return e[t]===n?0:(e[t]=n,1)}function Y_e(e){var t=e.items[0].orient;return t===rM||t===iM}function X_e(e){let t=+e.grid;return[e.ticks?t++:-1,e.labels?t++:-1,t+ +e.domain]}function Z_e(e,t,n,r){var i=t.items[0],a=i.datum,o=i.translate==null?.5:i.translate,s=i.orient,c=X_e(a),l=i.range,u=i.offset,d=i.position,f=i.minExtent,p=i.maxExtent,m=a.title&&i.items[c[2]].items[0],h=i.titlePadding,g=i.bounds,_=m&&hk(m),v=0,y=0,b,x;switch(JM.clear().union(g),g.clear(),(b=c[0])>-1&&g.union(i.items[b].bounds),(b=c[1])>-1&&g.union(i.items[b].bounds),s){case nM:v=d||0,y=-u,x=Math.max(f,Math.min(p,-g.y1)),g.add(0,-x).add(l,0),m&&qj(e,m,x,h,_,0,-1,g);break;case rM:v=-u,y=d||0,x=Math.max(f,Math.min(p,-g.x1)),g.add(-x,0).add(0,l),m&&qj(e,m,x,h,_,1,-1,g);break;case iM:v=n+u,y=d||0,x=Math.max(f,Math.min(p,g.x2)),g.add(0,0).add(x,l),m&&qj(e,m,x,h,_,1,1,g);break;case aM:v=d||0,y=r+u,x=Math.max(f,Math.min(p,g.y2)),g.add(0,0).add(l,x),m&&qj(e,m,x,h,0,0,1,g);break;default:v=i.x,y=i.y}return LO(g.translate(v,y),i),Kj(i,`x`,v+o)|Kj(i,`y`,y+o)&&(i.bounds=JM,e.dirty(i),i.bounds=g,e.dirty(i)),i.mark.bounds.clear().union(g)}function qj(e,t,n,r,i,a,o,s){let c=t.bounds;if(t.auto){let s=o*(n+i+r),l=0,u=0;e.dirty(t),a?l=(t.x||0)-(t.x=s):u=(t.y||0)-(t.y=s),t.mark.bounds.clear().union(c.translate(-l,-u)),e.dirty(t)}s.union(c)}function Q_e(e){var t=e.items,n=t.length,r=0,i,a;let o={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;r1)for(C=0;C0&&(y[C]+=A/2);if(s&&Jj(n.center,zM)&&u!==1)for(C=0;C0&&(b[C]+=j/2);for(C=0;Ci&&(e.warn(`Grid headers exceed limit: `+i),t=t.slice(0,i)),h+=a,v=0,b=t.length;v=0&&(C=n[y])==null;y-=f);s?(w=p==null?C.x:Math.round(C.bounds.x1+p*C.bounds.width()),T=h):(w=h,T=p==null?C.y:Math.round(C.bounds.y1+p*C.bounds.height())),x.union(S.bounds.translate(w-(S.x||0),T-(S.y||0))),S.x=w,S.y=T,e.dirty(S),g=o(g,x[l])}return g}function Qj(e,t,n,r,i,a){if(t){e.dirty(t);var o=n,s=n;r?o=Math.round(i.x1+a*i.width()):s=Math.round(i.y1+a*i.height()),t.bounds.translate(o-(t.x||0),s-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=o,t.y=s,e.dirty(t)}}function ive(e,t){let n=e[t]||{};return(t,r)=>n[t]==null?e[t]==null?r:e[t]:n[t]}function ave(e,t){let n=-1/0;return e.forEach(e=>{e.offset!=null&&(n=Math.max(n,e.offset))}),n>-1/0?n:t}function ove(e,t,n,r,i,a,o){let s=ive(n,t),c=ave(e,s(`offset`,0)),l=s(`anchor`,uM),u=s(`frame`,hM),d=l===fM?1:l===dM?.5:0,f=u===gM?r.x1+d*r.width():d*(a||i.width()+2*i.x1),p=u===gM?i.y1+d*i.height():d*(o||r.height()+2*r.y1),m={align:IM,bounds:s(`bounds`,LM),columns:s(`direction`)===`vertical`?1:e.length,padding:s(`margin`,8),center:s(`center`),nodirty:!0};switch(t){case rM:m.anchor={x:Math.floor(r.x1)-c,column:fM,y:p,row:l};break;case iM:m.anchor={x:Math.ceil(r.x2)+c,y:p,row:l};break;case nM:m.anchor={y:Math.floor(i.y1)-c,row:fM,x:f,column:l};break;case aM:m.anchor={y:Math.ceil(i.y2)+c,x:f,column:l};break;case oM:m.anchor={x:c,y:c};break;case sM:m.anchor={x:a-c,y:c,column:fM};break;case cM:m.anchor={x:c,y:o-c,row:fM};break;case lM:m.anchor={x:a-c,y:o-c,column:fM,row:fM};break}return m}function sve(e,t){var n=t.items[0],r=n.datum,i=n.orient,a=n.bounds,o=n.x,s=n.y,c,l;return n._bounds?n._bounds.clear().union(a):n._bounds=a.clone(),a.clear(),lve(e,n,n.items[0].items[0]),a=cve(n,a),c=2*n.padding,l=2*n.padding,a.empty()||(c=Math.ceil(a.width()+c),l=Math.ceil(a.height()+l)),r.type===kM&&uve(n.items[0].items[0].items[0].items),i!==PM&&(n.x=o=0,n.y=s=0),n.width=c,n.height=l,LO(a.set(o,s,o+c,s+l),n),n.mark.bounds.clear().union(a),n}function cve(e,t){return e.items.forEach(e=>t.union(e.bounds)),t.empty()&&(t.x2=e.padding,t.y2=e.padding),t.x1=e.padding,t.y1=e.padding,t}function lve(e,t,n){var r=t.padding,i=r-n.x,a=r-n.y;if(!t.datum.title)(i||a)&&eM(e,n,i,a);else{var o=t.items[1].items[0],s=o.anchor,c=t.titlePadding||0,l=r-o.x,u=r-o.y;switch(o.orient){case rM:i+=Math.ceil(o.bounds.width())+c;break;case iM:case aM:break;default:a+=o.bounds.height()+c}switch((i||a)&&eM(e,n,i,a),o.orient){case rM:u+=$j(t,n,o,s,1,1);break;case iM:l+=$j(t,n,o,fM,0,0)+c,u+=$j(t,n,o,s,1,1);break;case aM:l+=$j(t,n,o,s,0,0),u+=$j(t,n,o,fM,-1,0,1)+c;break;default:l+=$j(t,n,o,s,0,0)}(l||u)&&eM(e,o,l,u),(l=Math.round(o.bounds.x1-r))<0&&(eM(e,n,-l,0),eM(e,o,-l,0))}}function $j(e,t,n,r,i,a,o){let s=e.datum.type!==`symbol`,c=n.datum.vgrad,l=(s&&(a||!c)&&!o?t.items[0]:t).bounds[i?`y2`:`x2`]-e.padding,u=c&&a?l:0,d=c&&a?0:l,f=i<=0?0:hk(n);return Math.round(r===uM?u:r===fM?d-f:.5*(l-f))}function eM(e,t,n,r){t.x+=n,t.y+=r,t.bounds.translate(n,r),t.mark.bounds.translate(n,r),e.dirty(t)}function uve(e){let t=e.reduce((e,t)=>(e[t.column]=Math.max(t.bounds.x2-t.x,e[t.column]||0),e),{});e.forEach(e=>{e.width=t[e.column],e.height=e.bounds.y2-e.y})}function dve(e,t,n,r,i){var a=t.items[0],o=a.frame,s=a.orient,c=a.anchor,l=a.offset,u=a.padding,d=a.items[0].items[0],f=a.items[1]&&a.items[1].items[0],p=s===rM||s===iM?r:n,m=0,h=0,g=0,_=0,v=0,y;if(o===hM?s===rM&&(m=r,p=0):s===rM?(m=i.y2,p=i.y1):s===iM?(m=i.y1,p=i.y2):(m=i.x1,p=i.x2),y=c===uM?m:c===fM?p:(m+p)/2,f&&f.text){switch(s){case nM:case aM:v=d.bounds.height()+u;break;case rM:_=d.bounds.width()+u;break;case iM:_=-d.bounds.width()-u;break}JM.clear().union(f.bounds),JM.translate(_-(f.x||0),v-(f.y||0)),Kj(f,`x`,_)|Kj(f,`y`,v)&&(e.dirty(f),f.bounds.clear().union(JM),f.mark.bounds.clear().union(JM),e.dirty(f)),JM.clear().union(f.bounds)}else JM.clear();switch(JM.union(d.bounds),s){case nM:h=y,g=i.y1-JM.height()-l;break;case rM:h=i.x1-JM.width()-l,g=y;break;case iM:h=i.x2+JM.width()+l,g=y;break;case aM:h=y,g=i.y2+l;break;default:h=a.x,g=a.y}return Kj(a,`x`,h)|Kj(a,`y`,g)&&(JM.translate(h,g),e.dirty(a),a.bounds.clear().union(JM),t.bounds.clear().union(JM),e.dirty(a)),a.bounds}function tM(e){K.call(this,null,e)}function fve(e){return e&&e.mark.role!==`legend-entry`}function pve(e,t,n){var r=t.items,i=Math.max(0,t.width||0),a=Math.max(0,t.height||0),o=new NO().set(0,0,i,a),s=o.clone(),c=o.clone(),l=[],u,d,f,p,m,h;for(m=0,h=r.length;m{f=e.orient||iM,f!==PM&&(t[f]||(t[f]=[])).push(e)});for(let r in t){let o=t[r];Xj(e,o,ove(o,r,n.legends,s,c,i,a))}l.forEach(t=>{let r=t.bounds;if(r.equals(t._bounds)||(t.bounds=t._bounds,e.dirty(t),t.bounds=r,e.dirty(t)),n.autosize&&(n.autosize.type===AM||n.autosize.type===jM||n.autosize.type===MM))switch(t.orient){case rM:case iM:o.add(r.x1,0).add(r.x2,0);break;case nM:case aM:o.add(0,r.y1).add(0,r.y2)}else o.union(r)})}o.union(s).union(c),u&&o.union(dve(e,u,i,a,o)),t.clip&&o.set(0,0,t.width||0,t.height||0),mve(e,t,o,n)}function mve(e,t,n,r){let i=r.autosize||{},a=i.type;if(e._autosize<1||!a)return;let o=e._width,s=e._height,c=Math.max(0,t.width||0),l=Math.max(0,Math.ceil(-n.x1)),u=Math.max(0,t.height||0),d=Math.max(0,Math.ceil(-n.y1)),f=Math.max(0,Math.ceil(n.x2-c)),p=Math.max(0,Math.ceil(n.y2-u));if(i.contains===OM){let t=e.padding();o-=t.left+t.right,s-=t.top+t.bottom}a===PM?(l=0,d=0,c=o,u=s):a===AM?(c=Math.max(0,o-l-f),u=Math.max(0,s-d-p)):a===jM?(c=Math.max(0,o-l-f),s=u+d+p):a===MM?(o=c+l+f,u=Math.max(0,s-d-p)):a===NM&&(o=c+l+f,s=u+d+p),e._resizeView(o,s,c,u,[l,d],i.resize)}var nM,rM,iM,aM,oM,sM,cM,lM,uM,dM,fM,pM,mM,hM,gM,_M,vM,yM,bM,xM,SM,CM,wM,TM,EM,DM,OM,kM,AM,jM,MM,NM,PM,FM,IM,LM,RM,zM,BM,VM,HM,UM,WM,GM,KM,qM,JM,YM,XM,hve=o((()=>{eS(),zj(),Dg(),nM=`top`,rM=`left`,iM=`right`,aM=`bottom`,oM=`top-left`,sM=`top-right`,cM=`bottom-left`,lM=`bottom-right`,uM=`start`,dM=`middle`,fM=`end`,pM=`x`,mM=`y`,hM=`group`,gM=`bounds`,_M=`axis`,vM=`title`,yM=`frame`,bM=`scope`,xM=`legend`,SM=`row-header`,CM=`row-footer`,wM=`row-title`,TM=`column-header`,EM=`column-footer`,DM=`column-title`,OM=`padding`,kM=`symbol`,AM=`fit`,jM=`fit-x`,MM=`fit-y`,NM=`pad`,PM=`none`,FM=`all`,IM=`each`,LM=`flush`,RM=`column`,zM=`row`,fg(Bj,K,{transform(e,t){let n=t.dataflow,r=e.mark,i=r.marktype,a=wA[i],o=a.bound,s=r.bounds,c;if(a.nested)r.items.length&&n.dirty(r.items[0]),s=Vj(r,o),r.items.forEach(e=>{e.bounds.clear().union(s)});else if(i===hM||e.modified())switch(t.visit(t.MOD,e=>n.dirty(e)),s.clear(),r.items.forEach(e=>s.union(Vj(e,o))),r.role){case _M:case xM:case vM:t.reflow()}else c=t.changed(t.REM),t.visit(t.ADD,e=>{s.union(Vj(e,o))}),t.visit(t.MOD,e=>{c||=s.alignsWith(e.bounds),n.dirty(e),s.union(Vj(e,o))}),c&&(s.clear(),r.items.forEach(e=>s.union(e.bounds)));return Uge(r),t.modifies(`bounds`)}}),BM=`:vega_identifier:`,Hj.Definition={type:`Identifier`,metadata:{modifies:!0},params:[{name:`as`,type:`string`,required:!0}]},fg(Hj,K,{transform(e,t){let n=q_e(t.dataflow),r=e.as,i=n.value;return t.visit(t.ADD,e=>e[r]=e[r]||++i),n.set(this.value=i),t}}),fg(Uj,K,{transform(e,t){let n=this.value;n||(n=t.dataflow.scenegraph().mark(e.markdef,J_e(e),e.index),n.group.context=e.context,e.context.group||(e.context.group=n.group),n.source=this.source,n.clip=e.clip,n.interactive=e.interactive,this.value=n);let r=n.marktype===hM?FO:PO;return t.visit(t.ADD,e=>r.call(e,n)),(e.modified(`clip`)||e.modified(`interactive`))&&(n.clip=e.clip,n.interactive=!!e.interactive,n.zdirty=!0,t.reflow()),n.items=t.source,t}}),VM={parity:e=>e.filter((e,t)=>t%2?e.opacity=0:1),greedy:(e,t)=>{let n;return e.filter((e,r)=>!r||!HM(n.bounds,e.bounds,t)?(n=e,1):e.opacity=0)}},HM=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),UM=(e,t)=>{for(var n=1,r=e.length,i=e[0].bounds,a;n{let t=e.bounds;return t.width()>1&&t.height()>1},GM=(e,t,n)=>{var r=e.range(),i=new NO;return t===nM||t===aM?i.set(r[0],-1/0,r[1],1/0):i.set(-1/0,r[0],1/0,r[1]),i.expand(n||1),e=>i.encloses(e.bounds)},KM=e=>(e.forEach(e=>e.opacity=1),e),qM=(e,t)=>e.reflow(t.modified()).modifies(`opacity`),fg(Wj,K,{transform(e,t){let n=VM[e.method]||VM.parity,r=e.separation||0,i=t.materialize(t.SOURCE).source,a,o;if(!i||!i.length)return;if(!e.method)return e.modified(`method`)&&(KM(i),t=qM(t,e)),t;if(i=i.filter(WM),!i.length)return;if(e.sort&&(i=i.slice().sort(e.sort)),a=KM(i),t=qM(t,e),a.length>=3&&UM(a,r)){do a=n(a,r);while(a.length>=3&&UM(a,r));a.length<3&&!Ih(i).opacity&&(a.length>1&&(Ih(a).opacity=0),Ih(i).opacity=1)}e.boundScale&&e.boundTolerance>=0&&(o=GM(e.boundScale,e.boundOrient,+e.boundTolerance),i.forEach(e=>{o(e)||(e.opacity=0)}));let s=a[0].mark.bounds.clear();return i.forEach(e=>{e.opacity&&s.union(e.bounds)}),t}}),fg(Gj,K,{transform(e,t){let n=t.dataflow;if(t.visit(t.ALL,e=>n.dirty(e)),t.fields&&t.fields.zindex){let e=t.source&&t.source[0];e&&(e.mark.zdirty=!0)}}}),JM=new NO,YM=(e,t)=>Math.floor(Math.min(e,t)),XM=(e,t)=>Math.ceil(Math.max(e,t)),fg(tM,K,{transform(e,t){let n=t.dataflow;return e.mark.items.forEach(t=>{e.layout&&tve(n,t,e.layout),pve(n,t,e)}),fve(e.mark.group)?t.reflow():t}})})),gve=c({axisticks:()=>ZM,datajoin:()=>QM,encode:()=>$M,legendentries:()=>eN,linkpath:()=>tN,pie:()=>nN,scale:()=>iN,sortitems:()=>cN,stack:()=>lN});function ZM(e){K.call(this,null,e)}function QM(e){K.call(this,null,e)}function _ve(){return cx({})}function vve(e){let t=ug().test(e=>e.exit);return t.lookup=n=>t.get(e(n)),t}function $M(e){K.call(this,null,e)}function eN(e){K.call(this,[],e)}function tN(e){K.call(this,{},e)}function nN(e){K.call(this,null,e)}function yve(e){let t=e.type;return!e.bins&&(t===`linear`||t===`pow`||t===`sqrt`)}function rN(e){return KD(e)&&e!==`sequential`}function iN(e){K.call(this,null,e),this.modified(!0)}function bve(e){var t=e.type,n=``,r;return t===`sequential`?iO+`-`+tO:(xve(e)&&(r=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(e.domainMid!=null):0,n=r===2?iO+`-`:r===3?aO+`-`:``),(n+t||`linear`).toLowerCase())}function xve(e){let t=e.type;return KD(t)&&t!==`time`&&t!==`utc`&&(e.scheme||e.range&&e.range.length&&e.range.every(vg))}function Sve(e,t,n){let r=Cve(e,t.domainRaw,n);if(r>-1)return r;var i=t.domain,a=e.type,o=t.zero||t.zero===void 0&&yve(e),s,c;if(!i)return 0;if((o||t.domainMin!=null||t.domainMax!=null||t.domainMid!=null)&&(s=(i=i.slice()).length-1||1,o&&(i[0]>0&&(i[0]=0),i[s]<0&&(i[s]=0)),t.domainMin!=null&&(i[0]=t.domainMin),t.domainMax!=null&&(i[s]=t.domainMax),t.domainMid!=null)){c=t.domainMid;let e=c>i[s]?s+1:ce+(t<0?-1:+(t>0)),0))!==t.length&&n.warn(`Log scale domain includes zero: `+G(t)),t}function Tve(e,t,n){let r=t.bins;if(r&&!W(r)){let t=e.domain(),n=t[0],i=Ih(t),a=r.step,o=r.start==null?n:r.start,s=r.stop==null?i:r.stop;a||U(`Scale bins parameter missing step property.`),oi&&(s=a*Math.floor(i/a)),r=$g(o,s+a/2,a)}return r?e.bins=r:e.bins&&delete e.bins,e.type===`bin-ordinal`&&(r?!t.domain&&!t.domainRaw&&(e.domain(r),n=r.length):e.bins=e.domain()),n}function Eve(e,t,n){var r=e.type,i=t.round||!1,a=t.range;if(t.rangeStep!=null)a=Dve(r,t,n);else if(t.scheme&&(a=Ove(r,t,n),eg(a))){if(e.interpolator)return e.interpolator(a);U(`Scale type ${r} does not support interpolating color schemes.`)}if(a&&Jpe(r))return e.interpolator(XD(sN(a,t.reverse),t.interpolate,t.interpolateGamma));a&&t.interpolate&&e.interpolate?e.interpolate(ZD(t.interpolate,t.interpolateGamma)):eg(e.round)?e.round(i):eg(e.rangeRound)&&e.interpolate(i?uD:cD),a&&e.range(sN(a,t.reverse))}function Dve(e,t,n){e!==`band`&&e!==`point`&&U(`Only band and point scales support rangeStep.`);var r=(t.paddingOuter==null?t.padding:t.paddingOuter)||0,i=e===`point`?1:(t.paddingInner==null?t.padding:t.paddingInner)||0;return[0,t.rangeStep*HD(n,i,r)]}function Ove(e,t,n){var r=t.schemeExtent,i,a;return W(t.scheme)?a=XD(t.scheme,t.interpolate,t.interpolateGamma):(i=t.scheme.toLowerCase(),a=QD(i),a||U(`Unrecognized scheme name: ${t.scheme}`)),n=e===`threshold`?n+1:e===`bin-ordinal`?n-1:e===`quantile`||e===`quantize`?+t.schemeCount||DN:n,Jpe(e)?oN(a,r,t.reverse):eg(a)?Zpe(oN(a,r),n):e===`ordinal`?a:a.slice(0,n)}function oN(e,t,n){return eg(e)&&(t||n)?Xpe(e,sN(t||[0,1],n)):e}function sN(e,t){return t?e.slice().reverse():e}function cN(e){K.call(this,null,e)}function lN(e){K.call(this,null,e)}function kve(e,t,n,r,i){for(var a=(t-e.sum)/2,o=e.length,s=0,c;se(u),o,s,c,l,u,d,f,p,m;if(t==null)i.push(e.slice());else for(o={},s=0,c=e.length;sm&&(m=p),n&&f.sort(n)}return i.max=m,i}var uN,dN,fN,pN,mN,hN,gN,_N,vN,yN,bN,xN,SN,CN,wN,TN,EN,DN,ON,kN,AN,jN,MN,Nve=o((()=>{eS(),xO(),Dg(),e_(),hD(),fg(ZM,K,{transform(e,t){if(this.value&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=this.value,a=e.scale,o=$D(a,e.count==null?e.values?e.values.length:10:e.count,e.minstep),s=e.format||rme(n,a,o,e.formatSpecifier,e.formatType,!!e.values),c=e.values?nme(a,e.values,o):eO(a,o);return i&&(r.rem=i),i=c.map((e,t)=>cx({index:t/(c.length-1||1),tickIndex:t,value:e,label:s(e)})),e.extra&&i.length&&i.push(cx({index:-1,tickIndex:-1,extra:{value:i[0].value},label:``})),r.source=i,r.add=i,this.value=i,r}}),fg(QM,K,{transform(e,t){var n=t.dataflow,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.item||_ve,a=e.key||ox,o=this.value;return W(r.encode)&&(r.encode=null),o&&(e.modified(`key`)||t.modified(a))&&U(`DataJoin does not support modified key function or fields.`),o||(t=t.addAll(),this.value=o=vve(a)),t.visit(t.ADD,e=>{let t=a(e),n=o.get(t);n?n.exit?(o.empty--,r.add.push(n)):r.mod.push(n):(n=i(e),o.set(t,n),r.add.push(n)),n.datum=e,n.exit=!1}),t.visit(t.MOD,e=>{let t=a(e),n=o.get(t);n&&(n.datum=e,r.mod.push(n))}),t.visit(t.REM,e=>{let t=a(e),n=o.get(t);e===n.datum&&!n.exit&&(r.rem.push(n),n.exit=!0,++o.empty)}),t.changed(t.ADD_MOD)&&r.modifies(`datum`),(t.clean()||e.clean&&o.empty>n.cleanThreshold)&&n.runAfter(o.clean),r}}),fg($M,K,{transform(e,t){var n=t.fork(t.ADD_REM),r=e.mod||!1,i=e.encoders,a=t.encode;if(W(a))if(n.changed()||a.every(e=>i[e]))a=a[0],n.encode=null;else return t.StopPropagation;var o=a===`enter`,s=i.update||Dh,c=i.enter||Dh,l=i.exit||Dh,u=(a&&!o?i[a]:s)||Dh;if(t.changed(t.ADD)&&(t.visit(t.ADD,t=>{c(t,e),s(t,e)}),n.modifies(c.output),n.modifies(s.output),u!==Dh&&u!==s&&(t.visit(t.ADD,t=>{u(t,e)}),n.modifies(u.output))),t.changed(t.REM)&&l!==Dh&&(t.visit(t.REM,t=>{l(t,e)}),n.modifies(l.output)),o||u!==Dh){let i=t.MOD|(e.modified()?t.REFLOW:0);o?(t.visit(i,t=>{let i=c(t,e)||r;(u(t,e)||i)&&n.mod.push(t)}),n.mod.length&&n.modifies(c.output)):t.visit(i,t=>{(u(t,e)||r)&&n.mod.push(t)}),n.mod.length&&n.modifies(u.output)}return n.changed()?n:t.StopPropagation}}),fg(eN,K,{transform(e,t){if(this.value!=null&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=this.value,a=e.type||`symbol`,o=e.scale,s=+e.limit,c=$D(o,e.count==null?5:e.count,e.minstep),l=!!e.values||a===`symbol`,u=e.format||lme(n,o,c,a,e.formatSpecifier,e.formatType,l),d=e.values||ame(o,c),f,p,m,h,g;return i&&(r.rem=i),a===`symbol`?(s&&d.length>s?(t.dataflow.warn(`Symbol legend count exceeds limit, filtering items.`),i=d.slice(0,s-1),g=!0):i=d,eg(m=e.size)?(!e.values&&o(i[0])===0&&(i=i.slice(1)),h=i.reduce((t,n)=>Math.max(t,m(n,e)),0)):m=ig(h=m||8),i=i.map((t,n)=>cx({index:n,label:u(t,n,i),value:t,offset:h,size:m(t,e)})),g&&(g=d[i.length],i.push(cx({index:i.length,label:`\u2026${d.length-i.length} entries`,value:g,offset:h,size:m(g,e)})))):a===`gradient`?(f=o.domain(),p=Qpe(o,f[0],Ih(f)),d.length<3&&!e.values&&f[0]!==Ih(f)&&(d=[f[0],Ih(f)]),i=d.map((e,t)=>cx({index:t,label:u(e,t,d),value:e,perc:p(e)}))):(m=d.length-1,p=ume(o),i=d.map((e,t)=>cx({index:t,label:u(e,t,d),value:e,perc:t?p(e):0,perc2:t===m?1:p(d[t+1])}))),r.source=i,r.add=i,this.value=i,r}}),uN=e=>e.source.x,dN=e=>e.source.y,fN=e=>e.target.x,pN=e=>e.target.y,tN.Definition={type:`LinkPath`,metadata:{modifies:!0},params:[{name:`sourceX`,type:`field`,default:`source.x`},{name:`sourceY`,type:`field`,default:`source.y`},{name:`targetX`,type:`field`,default:`target.x`},{name:`targetY`,type:`field`,default:`target.y`},{name:`orient`,type:`enum`,default:`vertical`,values:[`horizontal`,`vertical`,`radial`]},{name:`shape`,type:`enum`,default:`line`,values:[`line`,`arc`,`curve`,`diagonal`,`orthogonal`]},{name:`require`,type:`signal`},{name:`as`,type:`string`,default:`path`}]},fg(tN,K,{transform(e,t){var n=e.sourceX||uN,r=e.sourceY||dN,i=e.targetX||fN,a=e.targetY||pN,o=e.as||`path`,s=e.orient||`vertical`,c=e.shape||`line`,l=EN.get(c+`-`+s)||EN.get(c);return l||U(`LinkPath unsupported type: `+e.shape+(e.orient?`-`+e.orient:``)),t.visit(t.SOURCE,e=>{e[o]=l(n(e),r(e),i(e),a(e))}),t.reflow(e.modified()).modifies(o)}}),mN=(e,t,n,r)=>`M`+e+`,`+t+`L`+n+`,`+r,hN=(e,t,n,r)=>mN(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),gN=(e,t,n,r)=>{var i=n-e,a=r-t,o=Math.hypot(i,a)/2,s=180*Math.atan2(a,i)/Math.PI;return`M`+e+`,`+t+`A`+o+`,`+o+` `+s+` 0 1 `+n+`,`+r},_N=(e,t,n,r)=>gN(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),vN=(e,t,n,r)=>{let i=n-e,a=r-t,o=.2*(i+a),s=.2*(a-i);return`M`+e+`,`+t+`C`+(e+o)+`,`+(t+s)+` `+(n+s)+`,`+(r-o)+` `+n+`,`+r},yN=(e,t,n,r)=>vN(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),bN=(e,t,n,r)=>`M`+e+`,`+t+`V`+r+`H`+n,xN=(e,t,n,r)=>`M`+e+`,`+t+`H`+n+`V`+r,SN=(e,t,n,r)=>{let i=Math.cos(e),a=Math.sin(e),o=Math.cos(n),s=Math.sin(n),c=Math.abs(n-e)>Math.PI?n<=e:n>e;return`M`+t*i+`,`+t*a+`A`+t+`,`+t+` 0 0,`+ +!!c+` `+t*o+`,`+t*s+`L`+r*o+`,`+r*s},CN=(e,t,n,r)=>{let i=(e+n)/2;return`M`+e+`,`+t+`C`+i+`,`+t+` `+i+`,`+r+` `+n+`,`+r},wN=(e,t,n,r)=>{let i=(t+r)/2;return`M`+e+`,`+t+`C`+e+`,`+i+` `+n+`,`+i+` `+n+`,`+r},TN=(e,t,n,r)=>{let i=Math.cos(e),a=Math.sin(e),o=Math.cos(n),s=Math.sin(n),c=(t+r)/2;return`M`+t*i+`,`+t*a+`C`+c*i+`,`+c*a+` `+c*o+`,`+c*s+` `+r*o+`,`+r*s},EN=ug({line:mN,"line-radial":hN,arc:gN,"arc-radial":_N,curve:vN,"curve-radial":yN,"orthogonal-horizontal":bN,"orthogonal-vertical":xN,"orthogonal-radial":SN,"diagonal-horizontal":CN,"diagonal-vertical":wN,"diagonal-radial":TN}),nN.Definition={type:`Pie`,metadata:{modifies:!0},params:[{name:`field`,type:`field`},{name:`startAngle`,type:`number`,default:0},{name:`endAngle`,type:`number`,default:6.283185307179586},{name:`sort`,type:`boolean`,default:!1},{name:`as`,type:`string`,array:!0,length:2,default:[`startAngle`,`endAngle`]}]},fg(nN,K,{transform(e,t){var n=e.as||[`startAngle`,`endAngle`],r=n[0],i=n[1],a=e.field||Th,o=e.startAngle||0,s=e.endAngle==null?2*Math.PI:e.endAngle,c=t.source,l=c.map(a),u=l.length,d=o,f=(s-o)/hse(l),p=$g(u),m,h,g;for(e.sort&&p.sort((e,t)=>l[e]-l[t]),m=0;m1?0:e<-1?IN:Math.acos(e)}function PN(e){return e>1?LN:e<-1?-LN:Math.asin(e)}var FN,IN,LN,RN,zN,BN,VN,HN,UN,WN,GN,KN,qN,JN,YN,XN,ZN,QN,$N,eP,tP=o((()=>{FN=1e-6,IN=Math.PI,LN=IN/2,RN=IN/4,zN=IN*2,BN=180/IN,VN=IN/180,HN=Math.abs,UN=Math.atan,WN=Math.atan2,GN=Math.cos,KN=Math.ceil,qN=Math.exp,JN=Math.hypot,YN=Math.log,XN=Math.pow,ZN=Math.sin,QN=Math.sign||function(e){return e>0?1:e<0?-1:0},$N=Math.sqrt,eP=Math.tan}));function nP(){}var rP=o((()=>{}));function iP(e,t){e&&lP.hasOwnProperty(e.type)&&lP[e.type](e,t)}function aP(e,t,n){var r=-1,i=e.length-n,a;for(t.lineStart();++r{cP={Feature:function(e,t){iP(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r=0?1:-1,i=r*n,a=GN(t),o=ZN(t),s=vP*o,c=_P*a+s*GN(i),l=s*r*ZN(i);fP.add(WN(l,c)),gP=e,_P=a,vP=o}function Lve(e){return pP=new Bg,sP(e,yP),pP*2}var fP,pP,mP,hP,gP,_P,vP,yP,bP=o((()=>{e_(),tP(),rP(),uP(),fP=new Bg,pP=new Bg,yP={point:nP,lineStart:nP,lineEnd:nP,polygonStart:function(){fP=new Bg,yP.lineStart=Pve,yP.lineEnd=Fve},polygonEnd:function(){var e=+fP;pP.add(e<0?zN+e:e),this.lineStart=this.lineEnd=this.point=nP},sphere:function(){pP.add(zN)}}}));function xP(e){return[WN(e[1],e[0]),PN(e[2])]}function SP(e){var t=e[0],n=e[1],r=GN(n);return[r*GN(t),r*ZN(t),ZN(n)]}function CP(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function wP(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function TP(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function EP(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function DP(e){var t=$N(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var OP=o((()=>{tP()}));function kP(e,t){GP.push(KP=[IP=e,RP=e]),tzP&&(zP=t)}function AP(e,t){var n=SP([e*VN,t*VN]);if(UP){var r=wP(UP,n),i=wP([r[1],-r[0],0],r);DP(i),i=xP(i);var a=e-BP,o=a>0?1:-1,s=i[0]*BN*o,c,l=HN(a)>180;l^(o*BPzP&&(zP=c)):(s=(s+360)%360-180,l^(o*BPzP&&(zP=t))),l?ePP(IP,RP)&&(RP=e):PP(e,RP)>PP(IP,RP)&&(IP=e):RP>=IP?(eRP&&(RP=e)):e>BP?PP(IP,e)>PP(IP,RP)&&(RP=e):PP(e,RP)>PP(IP,RP)&&(IP=e)}else GP.push(KP=[IP=e,RP=e]);tzP&&(zP=t),UP=n,BP=e}function jP(){qP.point=AP}function MP(){KP[0]=IP,KP[1]=RP,qP.point=kP,UP=null}function NP(e,t){if(UP){var n=e-BP;WP.add(HN(n)>180?n+(n>0?360:-360):n)}else VP=e,HP=t;yP.point(e,t),AP(e,t)}function Rve(){yP.lineStart()}function zve(){NP(VP,HP),yP.lineEnd(),HN(WP)>1e-6&&(IP=-(RP=180)),KP[0]=IP,KP[1]=RP,UP=null}function PP(e,t){return(t-=e)<0?t+360:t}function Bve(e,t){return e[0]-t[0]}function FP(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tPP(r[0],r[1])&&(r[1]=i[1]),PP(i[0],r[1])>PP(r[0],r[1])&&(r[0]=i[0])):a.push(r=i);for(o=-1/0,n=a.length-1,t=0,r=a[n];t<=n;r=i,++t)i=a[t],(s=PP(r[1],i[0]))>o&&(o=s,IP=i[0],RP=r[1])}return GP=KP=null,IP===1/0||LP===1/0?[[NaN,NaN],[NaN,NaN]]:[[IP,LP],[RP,zP]]}var IP,LP,RP,zP,BP,VP,HP,UP,WP,GP,KP,qP,Hve=o((()=>{e_(),bP(),OP(),tP(),uP(),qP={point:kP,lineStart:jP,lineEnd:MP,polygonStart:function(){qP.point=NP,qP.lineStart=Rve,qP.lineEnd=zve,WP=new Bg,yP.polygonStart()},polygonEnd:function(){yP.polygonEnd(),qP.point=kP,qP.lineStart=jP,qP.lineEnd=MP,fP<0?(IP=-(RP=180),LP=-(zP=90)):WP>1e-6?zP=90:WP<-1e-6&&(LP=-90),KP[0]=IP,KP[1]=RP},sphere:function(){IP=-(RP=180),LP=-(zP=90)}}}));function JP(e,t){e*=VN,t*=VN;var n=GN(t);YP(n*GN(e),n*ZN(e),ZN(t))}function YP(e,t,n){++$P,tF+=(e-tF)/$P,nF+=(t-nF)/$P,rF+=(n-rF)/$P}function XP(){hF.point=Uve}function Uve(e,t){e*=VN,t*=VN;var n=GN(t);fF=n*GN(e),pF=n*ZN(e),mF=ZN(t),hF.point=Wve,YP(fF,pF,mF)}function Wve(e,t){e*=VN,t*=VN;var n=GN(t),r=n*GN(e),i=n*ZN(e),a=ZN(t),o=WN($N((o=pF*a-mF*i)*o+(o=mF*r-fF*a)*o+(o=fF*i-pF*r)*o),fF*r+pF*i+mF*a);eF+=o,iF+=o*(fF+(fF=r)),aF+=o*(pF+(pF=i)),oF+=o*(mF+(mF=a)),YP(fF,pF,mF)}function ZP(){hF.point=JP}function Gve(){hF.point=qve}function Kve(){QP(uF,dF),hF.point=JP}function qve(e,t){uF=e,dF=t,e*=VN,t*=VN,hF.point=QP;var n=GN(t);fF=n*GN(e),pF=n*ZN(e),mF=ZN(t),YP(fF,pF,mF)}function QP(e,t){e*=VN,t*=VN;var n=GN(t),r=n*GN(e),i=n*ZN(e),a=ZN(t),o=pF*a-mF*i,s=mF*r-fF*a,c=fF*i-pF*r,l=JN(o,s,c),u=PN(l),d=l&&-u/l;sF.add(d*o),cF.add(d*s),lF.add(d*c),eF+=u,iF+=u*(fF+(fF=r)),aF+=u*(pF+(pF=i)),oF+=u*(mF+(mF=a)),YP(fF,pF,mF)}function Jve(e){$P=eF=tF=nF=rF=iF=aF=oF=0,sF=new Bg,cF=new Bg,lF=new Bg,sP(e,hF);var t=+sF,n=+cF,r=+lF,i=JN(t,n,r);return i<1e-12&&(t=iF,n=aF,r=oF,eF<1e-6&&(t=tF,n=nF,r=rF),i=JN(t,n,r),i<1e-12)?[NaN,NaN]:[WN(n,t)*BN,PN(r/i)*BN]}var $P,eF,tF,nF,rF,iF,aF,oF,sF,cF,lF,uF,dF,fF,pF,mF,hF,Yve=o((()=>{e_(),tP(),rP(),uP(),hF={sphere:nP,point:JP,lineStart:XP,lineEnd:ZP,polygonStart:function(){hF.lineStart=Gve,hF.lineEnd=Kve},polygonEnd:function(){hF.lineStart=XP,hF.lineEnd=ZP}}}));function gF(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,r){return n=t.invert(n,r),n&&e.invert(n[0],n[1])}),n}var _F=o((()=>{}));function vF(e,t){return HN(e)>IN&&(e-=Math.round(e/zN)*zN),[e,t]}function yF(e,t,n){return(e%=zN)?t||n?gF(xF(e),SF(t,n)):xF(e):t||n?SF(t,n):vF}function bF(e){return function(t,n){return t+=e,HN(t)>IN&&(t-=Math.round(t/zN)*zN),[t,n]}}function xF(e){var t=bF(e);return t.invert=bF(-e),t}function SF(e,t){var n=GN(e),r=ZN(e),i=GN(t),a=ZN(t);function o(e,t){var o=GN(t),s=GN(e)*o,c=ZN(e)*o,l=ZN(t),u=l*n+s*r;return[WN(c*i-u*a,s*n-l*r),PN(u*i+c*a)]}return o.invert=function(e,t){var o=GN(t),s=GN(e)*o,c=ZN(e)*o,l=ZN(t),u=l*i-c*a;return[WN(c*i+l*a,s*n+u*r),PN(u*n-s*r)]},o}function Xve(e){e=yF(e[0]*VN,e[1]*VN,e.length>2?e[2]*VN:0);function t(t){return t=e(t[0]*VN,t[1]*VN),t[0]*=BN,t[1]*=BN,t}return t.invert=function(t){return t=e.invert(t[0]*VN,t[1]*VN),t[0]*=BN,t[1]*=BN,t},t}var CF=o((()=>{_F(),tP(),vF.invert=vF}));function Zve(e,t,n,r,i,a){if(n){var o=GN(t),s=ZN(t),c=r*n;i==null?(i=t+r*zN,a=t-c/2):(i=wF(o,i),a=wF(o,a),(r>0?ia)&&(i+=r*zN));for(var l,u=i;r>0?u>a:u{OP(),tP()}));function EF(){var e=[],t;return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:nP,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}var DF=o((()=>{rP()}));function OF(e,t){return HN(e[0]-t[0])<1e-6&&HN(e[1]-t[1])<1e-6}var kF=o((()=>{tP()}));function AF(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function jF(e,t,n,r,i){var a=[],o=[],s,c;if(e.forEach(function(e){if(!((t=e.length-1)<=0)){var t,n=e[0],r=e[t],c;if(OF(n,r)){if(!n[2]&&!r[2]){for(i.lineStart(),s=0;s=0;--s)i.point((d=u[s])[0],d[1]);else r(f.x,f.p.x,-1,i);f=f.p}f=f.o,u=f.z,p=!p}while(!f.v);i.lineEnd()}}}function MF(e){if(t=e.length){for(var t,n=0,r=e[0],i;++n{kF(),tP()}));function PF(e){return HN(e[0])<=IN?e[0]:QN(e[0])*((HN(e[0])+IN)%zN-IN)}function Qve(e,t){var n=PF(t),r=t[1],i=ZN(r),a=[ZN(n),-GN(n),0],o=0,s=0,c=new Bg;i===1?r=LN+FN:i===-1&&(r=-LN-FN);for(var l=0,u=e.length;l=0?1:-1,E=T*w,D=E>IN,O=g*S;if(c.add(WN(O*T*ZN(E),_*C+O*GN(E))),o+=D?w+T*zN:w,D^m>=n^b>=n){var k=wP(SP(p),SP(y));DP(k);var A=wP(a,k);DP(A);var j=(D^w>=0?-1:1)*PN(A[2]);(r>j||r===j&&(k[0]||k[1]))&&(s+=D^w>=0?1:-1)}}return(o<-1e-6||o<1e-6&&c<-1e-12)^s&1}var FF=o((()=>{e_(),OP(),tP()}));function IF(e,t,n,r){return function(i){var a=t(i),o=EF(),s=t(o),c=!1,l,u,d,f={point:p,lineStart:h,lineEnd:g,polygonStart:function(){f.point=_,f.lineStart=v,f.lineEnd=y,u=[],l=[]},polygonEnd:function(){f.point=p,f.lineStart=h,f.lineEnd=g,u=fse(u);var e=Qve(l,r);u.length?(c||=(i.polygonStart(),!0),jF(u,eye,e,n,i)):e&&(c||=(i.polygonStart(),!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),c&&=(i.polygonEnd(),!1),u=l=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function p(t,n){e(t,n)&&i.point(t,n)}function m(e,t){a.point(e,t)}function h(){f.point=m,a.lineStart()}function g(){f.point=p,a.lineEnd()}function _(e,t){d.push([e,t]),s.point(e,t)}function v(){s.lineStart(),d=[]}function y(){_(d[0][0],d[0][1]),s.lineEnd();var e=s.clean(),t=o.result(),n,r=t.length,a,f,p;if(d.pop(),l.push(d),d=null,r){if(e&1){if(f=t[0],(a=f.length-1)>0){for(c||=(i.polygonStart(),!0),i.lineStart(),n=0;n1&&e&2&&t.push(t.pop().concat(t.shift())),u.push(t.filter($ve))}}return f}}function $ve(e){return e.length>1}function eye(e,t){return((e=e.x)[0]<0?e[1]-LN-FN:LN-e[1])-((t=t.x)[0]<0?t[1]-LN-FN:LN-t[1])}var LF=o((()=>{DF(),NF(),tP(),FF(),e_()}));function tye(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(a,o){var s=a>0?IN:-IN,c=HN(a-t);HN(c-IN)<1e-6?(e.point(t,n=(n+o)/2>0?LN:-LN),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(s,n),e.point(a,n),i=0):r!==s&&c>=IN&&(HN(t-r)<1e-6&&(t-=r*FN),HN(a-s)<1e-6&&(a-=s*FN),n=nye(t,n,a,o),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(s,n),i=0),e.point(t=a,n=o),r=s},lineEnd:function(){e.lineEnd(),t=n=NaN},clean:function(){return 2-i}}}function nye(e,t,n,r){var i,a,o=ZN(e-n);return HN(o)>1e-6?UN((ZN(t)*(a=GN(r))*ZN(n)-ZN(r)*(i=GN(t))*ZN(e))/(i*a*o)):(t+r)/2}function rye(e,t,n,r){var i;if(e==null)i=n*LN,r.point(-IN,i),r.point(0,i),r.point(IN,i),r.point(IN,0),r.point(IN,-i),r.point(0,-i),r.point(-IN,-i),r.point(-IN,0),r.point(-IN,i);else if(HN(e[0]-t[0])>1e-6){var a=e[0]{LF(),tP(),RF=IF(function(){return!0},tye,rye,[-IN,-LN])}));function iye(e){var t=GN(e),n=2*VN,r=t>0,i=HN(t)>FN;function a(t,r,i,a){Zve(a,e,n,i,t,r)}function o(e,n){return GN(e)*GN(n)>t}function s(e){var t,n,a,s,u;return{lineStart:function(){s=a=!1,u=1},point:function(d,f){var p=[d,f],m,h=o(d,f),g=r?h?0:l(d,f):h?l(d+(d<0?IN:-IN),f):0;if(!t&&(s=a=h)&&e.lineStart(),h!==a&&(m=c(t,p),(!m||OF(t,m)||OF(p,m))&&(p[2]=1)),h!==a)u=0,h?(e.lineStart(),m=c(p,t),e.point(m[0],m[1])):(m=c(t,p),e.point(m[0],m[1],2),e.lineEnd()),t=m;else if(i&&t&&r^h){var _;!(g&n)&&(_=c(p,t,!0))&&(u=0,r?(e.lineStart(),e.point(_[0][0],_[0][1]),e.point(_[1][0],_[1][1]),e.lineEnd()):(e.point(_[1][0],_[1][1]),e.lineEnd(),e.lineStart(),e.point(_[0][0],_[0][1],3)))}h&&(!t||!OF(t,p))&&e.point(p[0],p[1]),t=p,a=h,n=g},lineEnd:function(){a&&e.lineEnd(),t=null},clean:function(){return u|(s&&a)<<1}}}function c(e,n,r){var i=SP(e),a=SP(n),o=[1,0,0],s=wP(i,a),c=CP(s,s),l=s[0],u=c-l*l;if(!u)return!r&&e;var d=t*c/u,f=-t*l/u,p=wP(o,s),m=EP(o,d);TP(m,EP(s,f));var h=p,g=CP(m,h),_=CP(h,h),v=g*g-_*(CP(m,m)-1);if(!(v<0)){var y=$N(v),b=EP(h,(-g-y)/_);if(TP(b,m),b=xP(b),!r)return b;var x=e[0],S=n[0],C=e[1],w=n[1],T;S0^b[1]<(HN(b[0]-x)<1e-6?C:w):C<=b[1]&&b[1]<=w:E>IN^(x<=b[0]&&b[0]<=S)){var k=EP(h,(-g+y)/_);return TP(k,m),[b,xP(k)]}}}function l(t,n){var i=r?e:IN-e,a=0;return t<-i?a|=1:t>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}return IF(o,s,a,r?[0,-e]:[-IN,e-IN])}var BF=o((()=>{OP(),TF(),tP(),kF(),LF()}));function aye(e,t,n,r,i,a){var o=e[0],s=e[1],c=t[0],l=t[1],u=0,d=1,f=c-o,p=l-s,m=n-o;if(!(!f&&m>0)){if(m/=f,f<0){if(m0){if(m>d)return;m>u&&(u=m)}if(m=i-o,!(!f&&m<0)){if(m/=f,f<0){if(m>d)return;m>u&&(u=m)}else if(f>0){if(m0)){if(m/=p,p<0){if(m0){if(m>d)return;m>u&&(u=m)}if(m=a-s,!(!p&&m<0)){if(m/=p,p<0){if(m>d)return;m>u&&(u=m)}else if(p>0){if(m0&&(e[0]=o+u*f,e[1]=s+u*p),d<1&&(t[0]=o+d*f,t[1]=s+d*p),!0}}}}}var oye=o((()=>{}));function VF(e,t,n,r){function i(i,a){return e<=i&&i<=n&&t<=a&&a<=r}function a(i,a,s,l){var u=0,d=0;if(i==null||(u=o(i,s))!==(d=o(a,s))||c(i,a)<0^s>0)do l.point(u===0||u===3?e:n,u>1?r:t);while((u=(u+s+4)%4)!==d);else l.point(a[0],a[1])}function o(r,i){return HN(r[0]-e)<1e-6?i>0?0:3:HN(r[0]-n)<1e-6?i>0?2:1:HN(r[1]-t)<1e-6?+(i>0):i>0?3:2}function s(e,t){return c(e.x,t.x)}function c(e,t){var n=o(e,1),r=o(t,1);return n===r?n===0?t[1]-e[1]:n===1?e[0]-t[0]:n===2?e[1]-t[1]:t[0]-e[0]:n-r}return function(o){var c=o,l=EF(),u,d,f,p,m,h,g,_,v,y,b,x={point:S,lineStart:E,lineEnd:D,polygonStart:w,polygonEnd:T};function S(e,t){i(e,t)&&c.point(e,t)}function C(){for(var t=0,n=0,i=d.length;nr&&(f-l)*(r-u)>(p-u)*(e-l)&&++t:p<=r&&(f-l)*(r-u)<(p-u)*(e-l)&&--t;return t}function w(){c=l,u=[],d=[],b=!0}function T(){var e=C(),t=b&&e,n=(u=fse(u)).length;(t||n)&&(o.polygonStart(),t&&(o.lineStart(),a(null,null,1,o),o.lineEnd()),n&&jF(u,s,e,a,o),o.polygonEnd()),c=o,u=d=f=null}function E(){x.point=O,d&&d.push(f=[]),y=!0,v=!1,g=_=NaN}function D(){u&&(O(p,m),h&&v&&l.rejoin(),u.push(l.result())),x.point=S,v&&c.lineEnd()}function O(a,o){var s=i(a,o);if(d&&f.push([a,o]),y)p=a,m=o,h=s,y=!1,s&&(c.lineStart(),c.point(a,o));else if(s&&v)c.point(a,o);else{var l=[g=Math.max(UF,Math.min(HF,g)),_=Math.max(UF,Math.min(HF,_))],u=[a=Math.max(UF,Math.min(HF,a)),o=Math.max(UF,Math.min(HF,o))];aye(l,u,e,t,n,r)?(v||(c.lineStart(),c.point(l[0],l[1])),c.point(u[0],u[1]),s||c.lineEnd(),b=!1):s&&(c.lineStart(),c.point(a,o),b=!1)}g=a,_=o,v=s}return x}}var HF,UF,WF=o((()=>{tP(),DF(),oye(),NF(),e_(),HF=1e9,UF=-HF}));function GF(e,t,n){var r=$g(e,t-FN,n).concat(t);return function(e){return r.map(function(t){return[e,t]})}}function KF(e,t,n){var r=$g(e,t-FN,n).concat(t);return function(e){return r.map(function(t){return[t,e]})}}function sye(){var e,t,n,r,i,a,o,s,c=10,l=c,u=90,d=360,f,p,m,h,g=2.5;function _(){return{type:`MultiLineString`,coordinates:v()}}function v(){return $g(KN(r/u)*u,n,u).map(m).concat($g(KN(s/d)*d,o,d).map(h)).concat($g(KN(t/c)*c,e,c).filter(function(e){return HN(e%u)>FN}).map(f)).concat($g(KN(a/l)*l,i,l).filter(function(e){return HN(e%d)>FN}).map(p))}return _.lines=function(){return v().map(function(e){return{type:`LineString`,coordinates:e}})},_.outline=function(){return{type:`Polygon`,coordinates:[m(r).concat(h(o).slice(1),m(n).reverse().slice(1),h(s).reverse().slice(1))]}},_.extent=function(e){return arguments.length?_.extentMajor(e).extentMinor(e):_.extentMinor()},_.extentMajor=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],s=+e[0][1],o=+e[1][1],r>n&&(e=r,r=n,n=e),s>o&&(e=s,s=o,o=e),_.precision(g)):[[r,s],[n,o]]},_.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],a=+n[0][1],i=+n[1][1],t>e&&(n=t,t=e,e=n),a>i&&(n=a,a=i,i=n),_.precision(g)):[[t,a],[e,i]]},_.step=function(e){return arguments.length?_.stepMajor(e).stepMinor(e):_.stepMinor()},_.stepMajor=function(e){return arguments.length?(u=+e[0],d=+e[1],_):[u,d]},_.stepMinor=function(e){return arguments.length?(c=+e[0],l=+e[1],_):[c,l]},_.precision=function(c){return arguments.length?(g=+c,f=GF(a,i,90),p=KF(t,e,g),m=GF(s,o,90),h=KF(r,n,g),_):g},_.extentMajor([[-180,-90+FN],[180,90-FN]]).extentMinor([[-180,-80-FN],[180,80+FN]])}var cye=o((()=>{e_(),tP()})),qF,JF=o((()=>{qF=e=>e}));function lye(){nI.point=uye}function uye(e,t){nI.point=YF,QF=eI=e,$F=tI=t}function YF(e,t){ZF.add(tI*e-eI*t),eI=e,tI=t}function dye(){YF(QF,$F)}var XF,ZF,QF,$F,eI,tI,nI,fye=o((()=>{e_(),tP(),rP(),XF=new Bg,ZF=new Bg,nI={point:nP,lineStart:nP,lineEnd:nP,polygonStart:function(){nI.lineStart=lye,nI.lineEnd=dye},polygonEnd:function(){nI.lineStart=nI.lineEnd=nI.point=nP,XF.add(HN(ZF)),ZF=new Bg},result:function(){var e=XF/2;return XF=new Bg,e}}}));function pye(e,t){eaI&&(aI=e),toI&&(oI=t)}var rI,iI,aI,oI,sI,cI=o((()=>{rP(),rI=1/0,iI=rI,aI=-rI,oI=aI,sI={point:pye,lineStart:nP,lineEnd:nP,polygonStart:nP,polygonEnd:nP,result:function(){var e=[[rI,iI],[aI,oI]];return aI=oI=-(iI=rI=1/0),e}}}));function lI(e,t){pI+=e,mI+=t,++hI}function uI(){EI.point=mye}function mye(e,t){EI.point=hye,lI(wI=e,TI=t)}function hye(e,t){var n=e-wI,r=t-TI,i=$N(n*n+r*r);gI+=i*(wI+e)/2,_I+=i*(TI+t)/2,vI+=i,lI(wI=e,TI=t)}function dI(){EI.point=lI}function gye(){EI.point=vye}function _ye(){fI(SI,CI)}function vye(e,t){EI.point=fI,lI(SI=wI=e,CI=TI=t)}function fI(e,t){var n=e-wI,r=t-TI,i=$N(n*n+r*r);gI+=i*(wI+e)/2,_I+=i*(TI+t)/2,vI+=i,i=TI*e-wI*t,yI+=i*(wI+e),bI+=i*(TI+t),xI+=i*3,lI(wI=e,TI=t)}var pI,mI,hI,gI,_I,vI,yI,bI,xI,SI,CI,wI,TI,EI,yye=o((()=>{tP(),pI=0,mI=0,hI=0,gI=0,_I=0,vI=0,yI=0,bI=0,xI=0,EI={point:lI,lineStart:uI,lineEnd:dI,polygonStart:function(){EI.lineStart=gye,EI.lineEnd=_ye},polygonEnd:function(){EI.point=lI,EI.lineStart=uI,EI.lineEnd=dI},result:function(){var e=xI?[yI/xI,bI/xI]:vI?[gI/vI,_I/vI]:hI?[pI/hI,mI/hI]:[NaN,NaN];return pI=mI=hI=gI=_I=vI=yI=bI=xI=0,e}}}));function DI(e){this._context=e}var bye=o((()=>{tP(),rP(),DI.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,zN);break}},result:nP}}));function xye(e,t){FI.point=OI,jI=NI=e,MI=PI=t}function OI(e,t){NI-=e,PI-=t,kI.add($N(NI*NI+PI*PI)),NI=e,PI=t}var kI,AI,jI,MI,NI,PI,FI,Sye=o((()=>{e_(),tP(),rP(),kI=new Bg,FI={point:nP,lineStart:function(){FI.point=xye},lineEnd:function(){AI&&OI(jI,MI),FI.point=nP},polygonStart:function(){AI=!0},polygonEnd:function(){AI=null},result:function(){var e=+kI;return kI=new Bg,e}}}));function II(e){let t=1;this._+=e[0];for(let n=e.length;t=0))throw RangeError(`invalid digits: ${e}`);if(t>15)return II;if(t!==LI){let e=10**t;LI=t,RI=function(t){let n=1;this._+=t[0];for(let r=t.length;n{VI=class{constructor(e){this._append=e==null?II:Cye(e),this._radius=4.5,this._=``}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+=`Z`),this._point=NaN}point(e,t){switch(this._point){case 0:this._append`M${e},${t}`,this._point=1;break;case 1:this._append`L${e},${t}`;break;default:if(this._append`M${e},${t}`,this._radius!==zI||this._append!==RI){let e=this._radius,t=this._;this._=``,this._append`m0,${e}a${e},${e} 0 1,1 0,${-2*e}a${e},${e} 0 1,1 0,${2*e}z`,zI=e,RI=this._append,BI=this._,this._=t}this._+=BI;break}}result(){let e=this._;return this._=``,e.length?e:null}}}));function HI(e,t){let n=3,r=4.5,i,a;function o(e){return e&&(typeof r==`function`&&a.pointRadius(+r.apply(this,arguments)),sP(e,i(a))),a.result()}return o.area=function(e){return sP(e,i(nI)),nI.result()},o.measure=function(e){return sP(e,i(FI)),FI.result()},o.bounds=function(e){return sP(e,i(sI)),sI.result()},o.centroid=function(e){return sP(e,i(EI)),EI.result()},o.projection=function(t){return arguments.length?(i=t==null?(e=null,qF):(e=t).stream,o):e},o.context=function(e){return arguments.length?(a=e==null?(t=null,new VI(n)):new DI(t=e),typeof r!=`function`&&a.pointRadius(r),o):t},o.pointRadius=function(e){return arguments.length?(r=typeof e==`function`?e:(a.pointRadius(+e),+e),o):r},o.digits=function(e){if(!arguments.length)return n;if(e==null)n=null;else{let t=Math.floor(e);if(!(t>=0))throw RangeError(`invalid digits: ${e}`);n=t}return t===null&&(a=new VI(n)),o},o.projection(e).digits(n).context(t)}var Tye=o((()=>{JF(),uP(),fye(),cI(),yye(),bye(),Sye(),wye()}));function UI(e){return function(t){var n=new WI;for(var r in e)n[r]=e[r];return n.stream=t,n}}function WI(){}var GI=o((()=>{WI.prototype={constructor:WI,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}}}));function KI(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),sP(n,e.stream(sI)),t(sI.result()),r!=null&&e.clipExtent(r),e}function qI(e,t,n){return KI(e,function(n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],a=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),o=+t[0][0]+(r-a*(n[1][0]+n[0][0]))/2,s=+t[0][1]+(i-a*(n[1][1]+n[0][1]))/2;e.scale(150*a).translate([o,s])},n)}function JI(e,t,n){return qI(e,[[0,0],t],n)}function YI(e,t,n){return KI(e,function(n){var r=+t,i=r/(n[1][0]-n[0][0]),a=(r-i*(n[1][0]+n[0][0]))/2,o=-i*n[0][1];e.scale(150*i).translate([a,o])},n)}function XI(e,t,n){return KI(e,function(n){var r=+t,i=r/(n[1][1]-n[0][1]),a=-i*n[0][0],o=(r-i*(n[1][1]+n[0][1]))/2;e.scale(150*i).translate([a,o])},n)}var ZI=o((()=>{uP(),cI()}));function QI(e,t){return+t?Dye(e,t):Eye(e)}function Eye(e){return UI({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function Dye(e,t){function n(r,i,a,o,s,c,l,u,d,f,p,m,h,g){var _=l-r,v=u-i,y=_*_+v*v;if(y>4*t&&h--){var b=o+f,x=s+p,S=c+m,C=$N(b*b+x*x+S*S),w=PN(S/=C),T=HN(HN(S)-1)<1e-6||HN(a-d)<1e-6?(a+d)/2:WN(x,b),E=e(T,w),D=E[0],O=E[1],k=D-r,A=O-i,j=v*k-_*A;(j*j/y>t||HN((_*k+v*A)/y-.5)>.3||o*f+s*p+c*m{OP(),tP(),GI(),$I=16,eL=GN(30*VN)}));function kye(e){return UI({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function Aye(e,t,n,r,i){function a(a,o){return a*=r,o*=i,[t+e*a,n-e*o]}return a.invert=function(a,o){return[(a-t)/e*r,(n-o)/e*i]},a}function tL(e,t,n,r,i,a){if(!a)return Aye(e,t,n,r,i);var o=GN(a),s=ZN(a),c=o*e,l=s*e,u=o/e,d=s/e,f=(s*n-o*t)/e,p=(s*t+o*n)/e;function m(e,a){return e*=r,a*=i,[c*e-l*a+t,n-l*e-c*a]}return m.invert=function(e,t){return[r*(u*e-d*t+f),i*(p-d*e-u*t)]},m}function nL(e){return rL(function(){return e})()}function rL(e){var t,n=150,r=480,i=250,a=0,o=0,s=0,c=0,l=0,u,d=0,f=1,p=1,m=null,h=RF,g=null,_,v,y,b=qF,x=.5,S,C,w,T,E;function D(e){return w(e[0]*VN,e[1]*VN)}function O(e){return e=w.invert(e[0],e[1]),e&&[e[0]*BN,e[1]*BN]}D.stream=function(e){return T&&E===e?T:T=iL(kye(u)(h(S(b(E=e)))))},D.preclip=function(e){return arguments.length?(h=e,m=void 0,A()):h},D.postclip=function(e){return arguments.length?(b=e,g=_=v=y=null,A()):b},D.clipAngle=function(e){return arguments.length?(h=+e?iye(m=e*VN):(m=null,RF),A()):m*BN},D.clipExtent=function(e){return arguments.length?(b=e==null?(g=_=v=y=null,qF):VF(g=+e[0][0],_=+e[0][1],v=+e[1][0],y=+e[1][1]),A()):g==null?null:[[g,_],[v,y]]},D.scale=function(e){return arguments.length?(n=+e,k()):n},D.translate=function(e){return arguments.length?(r=+e[0],i=+e[1],k()):[r,i]},D.center=function(e){return arguments.length?(a=e[0]%360*VN,o=e[1]%360*VN,k()):[a*BN,o*BN]},D.rotate=function(e){return arguments.length?(s=e[0]%360*VN,c=e[1]%360*VN,l=e.length>2?e[2]%360*VN:0,k()):[s*BN,c*BN,l*BN]},D.angle=function(e){return arguments.length?(d=e%360*VN,k()):d*BN},D.reflectX=function(e){return arguments.length?(f=e?-1:1,k()):f<0},D.reflectY=function(e){return arguments.length?(p=e?-1:1,k()):p<0},D.precision=function(e){return arguments.length?(S=QI(C,x=e*e),A()):$N(x)},D.fitExtent=function(e,t){return qI(D,e,t)},D.fitSize=function(e,t){return JI(D,e,t)},D.fitWidth=function(e,t){return YI(D,e,t)},D.fitHeight=function(e,t){return XI(D,e,t)};function k(){var e=tL(n,0,0,f,p,d).apply(null,t(a,o)),m=tL(n,r-e[0],i-e[1],f,p,d);return u=yF(s,c,l),C=gF(t,m),w=gF(u,C),S=QI(C,x),A()}function A(){return T=E=null,D}return function(){return t=e.apply(this,arguments),D.invert=t.invert&&O,k()}}var iL,aL=o((()=>{zF(),BF(),WF(),_F(),JF(),tP(),CF(),GI(),ZI(),Oye(),iL=UI({point:function(e,t){this.stream.point(e*VN,t*VN)}})}));function oL(e){var t=0,n=IN/3,r=rL(e),i=r(t,n);return i.parallels=function(e){return arguments.length?r(t=e[0]*VN,n=e[1]*VN):[t*BN,n*BN]},i}var sL=o((()=>{tP(),aL()}));function jye(e){var t=GN(e);function n(e,n){return[e*t,ZN(n)/t]}return n.invert=function(e,n){return[e/t,PN(n*t)]},n}var Mye=o((()=>{tP()}));function Nye(e,t){var n=ZN(e),r=(n+ZN(t))/2;if(HN(r)<1e-6)return jye(e);var i=1+n*(2*r-n),a=$N(i)/r;function o(e,t){var n=$N(i-2*r*ZN(t))/r;return[n*ZN(e*=r),a-n*GN(e)]}return o.invert=function(e,t){var n=a-t,o=WN(e,HN(n))*QN(n);return n*r<0&&(o-=IN*QN(e)*QN(n)),[o/r,PN((i-(e*e+n*n)*r*r)/(2*r))]},o}function cL(){return oL(Nye).scale(155.424).center([0,33.6442])}var lL=o((()=>{tP(),sL(),Mye()}));function uL(){return cL().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}var dL=o((()=>{lL()}));function Pye(e){var t=e.length;return{point:function(n,r){for(var i=-1;++i=.12&&s<.234&&a>=-.425&&a<-.214?i:s>=.166&&s<.234&&a>=-.214&&a<-.115?o:n).invert(e)},u.stream=function(r){return e&&t===r?e:e=Pye([n.stream(t=r),i.stream(r),o.stream(r)])},u.precision=function(e){return arguments.length?(n.precision(e),i.precision(e),o.precision(e),d()):n.precision()},u.scale=function(e){return arguments.length?(n.scale(e),i.scale(e*.35),o.scale(e),u.translate(n.translate())):n.scale()},u.translate=function(e){if(!arguments.length)return n.translate();var t=n.scale(),c=+e[0],u=+e[1];return r=n.translate(e).clipExtent([[c-.455*t,u-.238*t],[c+.455*t,u+.238*t]]).stream(l),a=i.translate([c-.307*t,u+.201*t]).clipExtent([[c-.425*t+FN,u+.12*t+FN],[c-.214*t-FN,u+.234*t-FN]]).stream(l),s=o.translate([c-.205*t,u+.212*t]).clipExtent([[c-.214*t+FN,u+.166*t+FN],[c-.115*t-FN,u+.234*t-FN]]).stream(l),d()},u.fitExtent=function(e,t){return qI(u,e,t)},u.fitSize=function(e,t){return JI(u,e,t)},u.fitWidth=function(e,t){return YI(u,e,t)},u.fitHeight=function(e,t){return XI(u,e,t)};function d(){return e=t=null,u}return u.scale(1070)}var Iye=o((()=>{tP(),dL(),lL(),ZI()}));function fL(e){return function(t,n){var r=GN(t),i=GN(n),a=e(r*i);return a===1/0?[2,0]:[a*i*ZN(t),a*ZN(n)]}}function pL(e){return function(t,n){var r=$N(t*t+n*n),i=e(r),a=ZN(i),o=GN(i);return[WN(t*a,r*o),PN(r&&n*a/r)]}}var mL=o((()=>{tP()}));function Lye(){return nL(hL).scale(124.75).clipAngle(179.999)}var hL,Rye=o((()=>{tP(),mL(),aL(),hL=fL(function(e){return $N(2/(1+e))}),hL.invert=pL(function(e){return 2*PN(e/2)})}));function zye(){return nL(gL).scale(79.4188).clipAngle(179.999)}var gL,Bye=o((()=>{tP(),mL(),aL(),gL=fL(function(e){return(e=NN(e))&&e/ZN(e)}),gL.invert=pL(function(e){return e})}));function _L(e,t){return[e,YN(eP((LN+t)/2))]}function Vye(){return vL(_L).scale(961/zN)}function vL(e){var t=nL(e),n=t.center,r=t.scale,i=t.translate,a=t.clipExtent,o=null,s,c,l;t.scale=function(e){return arguments.length?(r(e),u()):r()},t.translate=function(e){return arguments.length?(i(e),u()):i()},t.center=function(e){return arguments.length?(n(e),u()):n()},t.clipExtent=function(e){return arguments.length?(e==null?o=s=c=l=null:(o=+e[0][0],s=+e[0][1],c=+e[1][0],l=+e[1][1]),u()):o==null?null:[[o,s],[c,l]]};function u(){var n=IN*r(),i=t(Xve(t.rotate()).invert([0,0]));return a(o==null?[[i[0]-n,i[1]-n],[i[0]+n,i[1]+n]]:e===_L?[[Math.max(i[0]-n,o),s],[Math.min(i[0]+n,c),l]]:[[o,Math.max(i[1]-n,s)],[c,Math.min(i[1]+n,l)]])}return u()}var yL=o((()=>{tP(),CF(),aL(),_L.invert=function(e,t){return[e,2*UN(qN(t))-LN]}}));function bL(e){return eP((LN+e)/2)}function Hye(e,t){var n=GN(e),r=e===t?ZN(e):YN(n/GN(t))/YN(bL(t)/bL(e)),i=n*XN(bL(e),r)/r;if(!r)return _L;function a(e,t){i>0?t<-LN+1e-6&&(t=-LN+FN):t>LN-1e-6&&(t=LN-FN);var n=i/XN(bL(t),r);return[n*ZN(r*e),i-n*GN(r*e)]}return a.invert=function(e,t){var n=i-t,a=QN(r)*$N(e*e+n*n),o=WN(e,HN(n))*QN(n);return n*r<0&&(o-=IN*QN(e)*QN(n)),[o/r,2*UN(XN(i/a,1/r))-LN]},a}function Uye(){return oL(Hye).scale(109.5).parallels([30,30])}var Wye=o((()=>{tP(),sL(),yL()}));function xL(e,t){return[e,t]}function Gye(){return nL(xL).scale(152.63)}var SL=o((()=>{aL(),xL.invert=xL}));function Kye(e,t){var n=GN(e),r=e===t?ZN(e):(n-GN(t))/(t-e),i=n/r+e;if(HN(r)<1e-6)return xL;function a(e,t){var n=i-t,a=r*e;return[n*ZN(a),i-n*GN(a)]}return a.invert=function(e,t){var n=i-t,a=WN(e,HN(n))*QN(n);return n*r<0&&(a-=IN*QN(e)*QN(n)),[a/r,i-QN(r)*$N(e*e+n*n)]},a}function qye(){return oL(Kye).scale(131.154).center([0,13.9389])}var Jye=o((()=>{tP(),sL(),SL()}));function CL(e,t){var n=PN(OL*ZN(t)),r=n*n,i=r*r*r;return[e*GN(n)/(OL*(wL+3*TL*r+i*(7*EL+9*DL*r))),n*(wL+TL*r+i*(EL+DL*r))]}function Yye(){return nL(CL).scale(177.158)}var wL,TL,EL,DL,OL,kL,Xye=o((()=>{aL(),tP(),wL=1.340264,TL=-.081106,EL=893e-6,DL=.003796,OL=$N(3)/2,kL=12,CL.invert=function(e,t){for(var n=t,r=n*n,i=r*r*r,a=0,o,s,c;a{tP(),mL(),aL(),AL.invert=pL(UN)}));function $ye(){var e=1,t=0,n=0,r=1,i=1,a=0,o,s,c=null,l,u,d,f=1,p=1,m=UI({point:function(e,t){var n=y([e,t]);this.stream.point(n[0],n[1])}}),h=qF,g,_;function v(){return f=e*r,p=e*i,g=_=null,y}function y(e){var r=e[0]*f,i=e[1]*p;if(a){var c=i*o-r*s;r=r*o+i*s,i=c}return[r+t,i+n]}return y.invert=function(e){var r=e[0]-t,i=e[1]-n;if(a){var c=i*o+r*s;r=r*o-i*s,i=c}return[r/f,i/p]},y.stream=function(e){return g&&_===e?g:g=m(h(_=e))},y.postclip=function(e){return arguments.length?(h=e,c=l=u=d=null,v()):h},y.clipExtent=function(e){return arguments.length?(h=e==null?(c=l=u=d=null,qF):VF(c=+e[0][0],l=+e[0][1],u=+e[1][0],d=+e[1][1]),v()):c==null?null:[[c,l],[u,d]]},y.scale=function(t){return arguments.length?(e=+t,v()):e},y.translate=function(e){return arguments.length?(t=+e[0],n=+e[1],v()):[t,n]},y.angle=function(e){return arguments.length?(a=e%360*VN,s=ZN(a),o=GN(a),v()):a*BN},y.reflectX=function(e){return arguments.length?(r=e?-1:1,v()):r<0},y.reflectY=function(e){return arguments.length?(i=e?-1:1,v()):i<0},y.fitExtent=function(e,t){return qI(y,e,t)},y.fitSize=function(e,t){return JI(y,e,t)},y.fitWidth=function(e,t){return YI(y,e,t)},y.fitHeight=function(e,t){return XI(y,e,t)},y}var ebe=o((()=>{WF(),JF(),GI(),ZI(),tP()}));function jL(e,t){var n=t*t,r=n*n;return[e*(.8707-.131979*n+r*(-.013791+r*(.003971*n-.001529*r))),t*(1.007226+n*(.015085+r*(-.044475+.028874*n-.005916*r)))]}function tbe(){return nL(jL).scale(175.295)}var nbe=o((()=>{aL(),tP(),jL.invert=function(e,t){var n=t,r=25,i;do{var a=n*n,o=a*a;n-=i=(n*(1.007226+a*(.015085+o*(-.044475+.028874*a-.005916*o)))-t)/(1.007226+a*(.015085*3+o*(-.044475*7+.028874*9*a-.005916*11*o)))}while(HN(i)>1e-6&&--r>0);return[e/(.8707+(a=n*n)*(-.131979+a*(-.013791+a*a*a*(.003971-.001529*a)))),n]}}));function ML(e,t){return[GN(t)*ZN(e),ZN(t)]}function rbe(){return nL(ML).scale(249.5).clipAngle(90+FN)}var ibe=o((()=>{tP(),mL(),aL(),ML.invert=pL(PN)}));function NL(e,t){var n=GN(t),r=1+GN(e)*n;return[n*ZN(e)/r,ZN(t)/r]}function abe(){return nL(NL).scale(250).clipAngle(142)}var obe=o((()=>{tP(),mL(),aL(),NL.invert=pL(function(e){return 2*UN(e)})}));function PL(e,t){return[YN(eP((LN+t)/2)),-e]}function sbe(){var e=vL(PL),t=e.center,n=e.rotate;return e.center=function(e){return arguments.length?t([-e[1],e[0]]):(e=t(),[e[1],-e[0]])},e.rotate=function(e){return arguments.length?n([e[0],e[1],e.length>2?e[2]+90:90]):(e=n(),[e[0],e[1],e[2]-90])},n([0,0,90]).scale(159.155)}var cbe=o((()=>{tP(),yL(),PL.invert=function(e,t){return[-t,2*UN(qN(e))-LN]}})),FL=o((()=>{bP(),Hve(),Yve(),TF(),zF(),BF(),WF(),FF(),e_(),tP(),rP(),uP(),cye(),Tye(),dL(),Iye(),Rye(),Bye(),Wye(),lL(),Jye(),Xye(),SL(),Qye(),ebe(),aL(),yL(),nbe(),ibe(),obe(),cbe(),CF(),GI()}));function IL(e){return e>1?VL:e<-1?-VL:Math.asin(e)}function lbe(e){return e>0?Math.sqrt(e):0}var LL,RL,zL,BL,VL,HL,UL=o((()=>{LL=Math.abs,RL=Math.cos,zL=Math.sin,BL=Math.PI,VL=BL/2,BL/4,HL=lbe(2),BL*2,180/BL,BL/180}));function ube(e,t){var n=e*zL(t),r=30,i;do t-=i=(t+zL(t)-n)/(1+RL(t));while(LL(i)>1e-6&&--r>0);return t/2}function dbe(e,t,n){function r(r,i){return[e*r*RL(i=ube(n,i)),t*zL(i)]}return r.invert=function(r,i){return i=IL(i/t),[r/(e*RL(i)),IL((2*i+zL(2*i))/n)]},r}function fbe(){return nL(WL).scale(169.529)}var WL,pbe=o((()=>{FL(),UL(),WL=dbe(HL/VL,HL,BL)})),mbe=o((()=>{FL(),UL(),pbe(),e_()}));function hbe(e,t){return function n(){let r=t();return r.type=e,r.path=HI().projection(r),r.copy=r.copy||function(){let e=n();return JL.forEach(t=>{r[t]&&e[t](r[t]())}),e.path.pointRadius(r.path.pointRadius()),e},Upe(r)}}function GL(e,t){if(!e||typeof e!=`string`)throw Error(`Projection type must be a name string.`);return e=e.toLowerCase(),arguments.length>1?(YL[e]=hbe(e,t),this):YL[e]||null}function KL(e){return e&&e.path||qL}var qL,JL,YL,XL=o((()=>{FL(),mbe(),xO(),qL=HI(),JL=[`clipAngle`,`clipExtent`,`scale`,`translate`,`center`,`rotate`,`parallels`,`precision`,`reflectX`,`reflectY`,`coefficient`,`distance`,`fraction`,`lobes`,`parallel`,`radius`,`ratio`,`spacing`,`tilt`],YL={albers:uL,albersusa:Fye,azimuthalequalarea:Lye,azimuthalequidistant:zye,conicconformal:Uye,conicequalarea:cL,conicequidistant:qye,equalEarth:Yye,equirectangular:Gye,gnomonic:Zye,identity:$ye,mercator:Vye,mollweide:fbe,naturalEarth1:tbe,orthographic:rbe,stereographic:abe,transversemercator:sbe};for(let e in YL)GL(e,YL[e])})),gbe=c({contour:()=>cR,geojson:()=>lR,geopath:()=>uR,geopoint:()=>dR,geoshape:()=>fR,graticule:()=>pR,heatmap:()=>mR,isocontour:()=>$L,kde2d:()=>oR,projection:()=>gR});function _be(){}function ZL(){var e=1,t=1,n=s;function r(e,t){return t.map(t=>i(e,t))}function i(e,t){var r=[],i=[];return a(e,t,a=>{n(a,e,t),vbe(a)>0?r.push([a]):i.push(a)}),i.forEach(e=>{for(var t=0,n=r.length,i;t=r,f,p;for(vR[d<<1].forEach(m);++c=r,vR[u|d<<1].forEach(m);for(vR[d<<0].forEach(m);++l=r,f=n[l*e]>=r,vR[d<<1|f<<2].forEach(m);++c=r,p=f,f=n[l*e+c+1]>=r,vR[u|d<<1|f<<2|p<<3].forEach(m);vR[d|f<<3].forEach(m)}for(c=-1,f=n[l*e]>=r,vR[f<<2].forEach(m);++c=r,vR[f<<2|p<<3].forEach(m);vR[f<<3].forEach(m);function m(e){var t=[e[0][0]+c,e[0][1]+l],n=[e[1][0]+c,e[1][1]+l],r=o(t),u=o(n),d,f;(d=s[r])?(f=a[u])?(delete s[d.end],delete a[f.start],d===f?(d.ring.push(n),i(d.ring)):a[d.start]=s[f.end]={start:d.start,end:f.end,ring:d.ring.concat(f.ring)}):(delete s[d.end],d.ring.push(n),s[d.end=u]=d):(d=a[u])?(f=s[r])?(delete a[d.start],delete s[f.end],d===f?(d.ring.push(n),i(d.ring)):a[f.start]=s[d.end]={start:f.start,end:d.end,ring:f.ring.concat(d.ring)}):(delete a[d.start],d.ring.unshift(t),a[d.start=r]=d):a[r]=s[u]={start:r,end:u,ring:[t,n]}}}function o(t){return t[0]*2+t[1]*(e+1)*4}function s(n,r,i){n.forEach(n=>{var a=n[0],o=n[1],s=a|0,c=o|0,l,u=r[c*e+s];a>0&&a0&&o=0&&a>=0||U(`invalid size`),e=i,t=a,r},r.smooth=function(e){return arguments.length?(n=e?s:_be,r):n===s},r}function vbe(e){for(var t=0,n=e.length,r=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++tr!=p>r&&n<(f-l)*(r-u)/(p-u)+l&&(i=-i)}return i}function xbe(e,t,n){var r;return Sbe(e,t,n)&&Cbe(e[r=+(e[0]===t[0])],n[r],t[r])}function Sbe(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function Cbe(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function QL(e,t,n){return function(r){var i=sg(r),a=n?Math.min(i[0],0):i[0],o=i[1],s=o-a,c=t?Jg(a,o,e):s/(e+1);return $g(a+c,o,c)}}function $L(e){K.call(this,null,e)}function wbe(e,t,n){let r=QL(n.levels||10,n.nice,n.zero!==!1);return n.resolve===`shared`?r(e.map(e=>Yg(t(e).values))):r}function Tbe(e,t,n,r){let i=r.scale||t.scale,a=r.translate||t.translate;if(eg(i)&&(i=i(n,r)),eg(a)&&(a=a(n,r)),(i===1||i==null)&&!a)return;let o=(gg(i)?i:i[0])||1,s=(gg(i)?i:i[1])||1,c=a&&a[0]||0,l=a&&a[1]||0;e.forEach(eR(t,o,s,c,l))}function eR(e,t,n,r,i){let a=e.x1||0,o=e.y1||0,s=t*n<0;function c(e){e.forEach(l)}function l(e){s&&e.reverse(),e.forEach(u)}function u(e){e[0]=(e[0]-a)*t+r,e[1]=(e[1]-o)*n+i}return function(e){return e.coordinates.forEach(c),e}}function tR(e,t,n){let r=e>=0?e:iS(t,n);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function nR(e){return eg(e)?e:ig(+e)}function rR(){var e=e=>e[0],t=e=>e[1],n=Th,r=[-1,-1],i=960,a=500,o=2;function s(s,c){let l=tR(r[0],s,e)>>o,u=tR(r[1],s,t)>>o,d=l?l+2:0,f=u?u+2:0,p=2*d+(i>>o),m=2*f+(a>>o),h=new Float32Array(p*m),g=new Float32Array(p*m),_=h;s.forEach(r=>{let i=d+(+e(r)>>o),a=f+(+t(r)>>o);i>=0&&i=0&&a0&&u>0?(iR(p,m,h,g,l),aR(p,m,g,h,u),iR(p,m,h,g,l),aR(p,m,g,h,u),iR(p,m,h,g,l),aR(p,m,g,h,u)):l>0?(iR(p,m,h,g,l),iR(p,m,g,h,l),iR(p,m,h,g,l),_=g):u>0&&(aR(p,m,h,g,u),aR(p,m,g,h,u),aR(p,m,h,g,u),_=g);let v=c?2**(-2*o):1/hse(_);for(let e=0,t=p*m;e>o),y2:f+(a>>o)}}return s.x=function(t){return arguments.length?(e=nR(t),s):e},s.y=function(e){return arguments.length?(t=nR(e),s):t},s.weight=function(e){return arguments.length?(n=nR(e),s):n},s.size=function(e){if(!arguments.length)return[i,a];var t=+e[0],n=+e[1];return t>=0&&n>=0||U(`invalid size`),i=t,a=n,s},s.cellSize=function(e){return arguments.length?((e=+e)>=1||U(`invalid cell size`),o=Math.floor(Math.log(e)/Math.LN2),s):1<=i&&(t>=a&&(s-=n[t-a+o*e]),r[t-i+o*e]=s/Math.min(t+1,e-1+a-t,a))}function aR(e,t,n,r,i){let a=(i<<1)+1;for(let o=0;o=i&&(s>=a&&(c-=n[o+(s-a)*e]),r[o+(s-i)*e]=c/Math.min(s+1,t-1+a-s,a))}function oR(e){K.call(this,null,e)}function sR(e,t){return yR.forEach(n=>t[n]==null?0:e[n](t[n])),e}function Ebe(e,t){var n=[],r=e=>e(s),i,a,o,s,c,l;if(t==null)n.push(e);else for(i={},a=0,o=e.length;ae(t(n)):r=>{var i=e.pointRadius(),a=e.pointRadius(n)(t(r));return e.pointRadius(i),a};return r.context=t=>(e.context(t),r),r}function pR(e){K.call(this,[],e),this.generator=sye()}function mR(e){K.call(this,null,e)}function kbe(e,t){let n;return eg(e)?(n=n=>QT(e(n,t)),n.dep=hR(e)):n=ig(QT(e||`#888`)),n}function Abe(e,t){let n;return eg(e)?(n=n=>e(n,t),n.dep=hR(e)):e?n=ig(e):(n=e=>e.$value/e.$max||0,n.dep=!0),n}function hR(e){if(!eg(e))return!1;let t=Tg(dh(e));return t.$x||t.$y||t.$value||t.$max}function jbe(e,t,n,r){let i=e.width,a=e.height,o=e.x1||0,s=e.y1||0,c=e.x2||i,l=e.y2||a,u=e.values,d=u?e=>u[e]:wh,f=PT(c-o,l-s),p=f.getContext(`2d`),m=p.getImageData(0,0,c-o,l-s),h=m.data;for(let e=s,a=0;ee.concat(Fbe(t)),[])}}function Fbe(e){return e.type===xR?e.features:Qh(e).filter(e=>e!=null).map(e=>e.type===bR?e:{type:bR,geometry:e})}var vR,yR,bR,xR,SR,Ibe=o((()=>{eS(),Dg(),e_(),GS(),XL(),FL(),YE(),IT(),vR=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]],$L.Definition={type:`Isocontour`,metadata:{generates:!0},params:[{name:`field`,type:`field`},{name:`thresholds`,type:`number`,array:!0},{name:`levels`,type:`number`},{name:`nice`,type:`boolean`,default:!1},{name:`resolve`,type:`enum`,values:[`shared`,`independent`],default:`independent`},{name:`zero`,type:`boolean`,default:!0},{name:`smooth`,type:`boolean`,default:!0},{name:`scale`,type:`number`,expr:!0},{name:`translate`,type:`number`,array:!0,expr:!0},{name:`as`,type:`string`,null:!0,default:`contour`}]},fg($L,K,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=t.materialize(t.SOURCE).source,i=e.field||Ch,a=ZL().smooth(e.smooth!==!1),o=e.thresholds||wbe(r,i,e),s=e.as===null?null:e.as||`contour`,c=[];return r.forEach(t=>{let n=i(t),r=a.size([n.width,n.height])(n.values,W(o)?o:o(n.values));Tbe(r,n,t,e),r.forEach(e=>{c.push(ux(t,cx(s==null?e:{[s]:e})))})}),this.value&&(n.rem=this.value),this.value=n.source=n.add=c,n}}),oR.Definition={type:`KDE2D`,metadata:{generates:!0},params:[{name:`size`,type:`number`,array:!0,length:2,required:!0},{name:`x`,type:`field`,required:!0},{name:`y`,type:`field`,required:!0},{name:`weight`,type:`field`},{name:`groupby`,type:`field`,array:!0},{name:`cellSize`,type:`number`},{name:`bandwidth`,type:`number`,array:!0,length:2},{name:`counts`,type:`boolean`,default:!1},{name:`as`,type:`string`,default:`grid`}]},yR=[`x`,`y`,`weight`,`size`,`cellSize`,`bandwidth`],fg(oR,K,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=t.materialize(t.SOURCE).source,i=Ebe(r,e.groupby),a=(e.groupby||[]).map(uh),o=sR(rR(),e),s=e.as||`grid`,c=[];function l(e,t){for(let n=0;ncx(l({[s]:o(t,e.counts)},t.dims))),this.value&&(n.rem=this.value),this.value=n.source=n.add=c,n}}),cR.Definition={type:`Contour`,metadata:{generates:!0},params:[{name:`size`,type:`number`,array:!0,length:2,required:!0},{name:`values`,type:`number`,array:!0},{name:`x`,type:`field`},{name:`y`,type:`field`},{name:`weight`,type:`field`},{name:`cellSize`,type:`number`},{name:`bandwidth`,type:`number`},{name:`count`,type:`number`},{name:`nice`,type:`boolean`,default:!1},{name:`thresholds`,type:`number`,array:!0},{name:`smooth`,type:`boolean`,default:!0}]},fg(cR,K,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=ZL().smooth(e.smooth!==!1),i=e.values,a=e.thresholds||QL(e.count||10,e.nice,!!i),o=e.size,s,c;return i||=(i=t.materialize(t.SOURCE).source,s=sR(rR(),e)(i,!0),c=eR(s,s.scale||1,s.scale||1,0,0),o=[s.width,s.height],s.values),a=W(a)?a:a(i),i=r.size(o)(i,a),c&&i.forEach(c),this.value&&(n.rem=this.value),this.value=n.source=n.add=(i||[]).map(cx),n}}),bR=`Feature`,xR=`FeatureCollection`,SR=`MultiPoint`,lR.Definition={type:`GeoJSON`,metadata:{},params:[{name:`fields`,type:`field`,array:!0,length:2},{name:`geojson`,type:`field`}]},fg(lR,K,{transform(e,t){var n=this._features,r=this._points,i=e.fields,a=i&&i[0],o=i&&i[1],s=e.geojson||!i&&Ch,c=t.ADD,l=e.modified()||t.changed(t.REM)||t.modified(dh(s))||a&&t.modified(dh(a))||o&&t.modified(dh(o));(!this.value||l)&&(c=t.SOURCE,this._features=n=[],this._points=r=[]),s&&t.visit(c,e=>n.push(s(e))),a&&o&&(t.visit(c,e=>{var t=a(e),n=o(e);t!=null&&n!=null&&(t=+t)===t&&(n=+n)===n&&r.push([t,n])}),n=n.concat({type:bR,geometry:{type:SR,coordinates:r}})),this.value={type:xR,features:n}}}),uR.Definition={type:`GeoPath`,metadata:{modifies:!0},params:[{name:`projection`,type:`projection`},{name:`field`,type:`field`},{name:`pointRadius`,type:`number`,expr:!0},{name:`as`,type:`string`,default:`path`}]},fg(uR,K,{transform(e,t){var n=t.fork(t.ALL),r=this.value,i=e.field||Ch,a=e.as||`path`,o=n.SOURCE;!r||e.modified()?(this.value=r=KL(e.projection),n.materialize().reflow()):o=i===Ch||t.modified(i.fields)?n.ADD_MOD:n.ADD;let s=Dbe(r,e.pointRadius);return n.visit(o,e=>e[a]=r(i(e))),r.pointRadius(s),n.modifies(a)}}),dR.Definition={type:`GeoPoint`,metadata:{modifies:!0},params:[{name:`projection`,type:`projection`,required:!0},{name:`fields`,type:`field`,array:!0,required:!0,length:2},{name:`as`,type:`string`,array:!0,length:2,default:[`x`,`y`]}]},fg(dR,K,{transform(e,t){var n=e.projection,r=e.fields[0],i=e.fields[1],a=e.as||[`x`,`y`],o=a[0],s=a[1],c;function l(e){let t=n([r(e),i(e)]);t?(e[o]=t[0],e[s]=t[1]):(e[o]=void 0,e[s]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,l):(c=t.modified(r.fields)||t.modified(i.fields),t.visit(c?t.ADD_MOD:t.ADD,l)),t.modifies(a)}}),fR.Definition={type:`GeoShape`,metadata:{modifies:!0,nomod:!0},params:[{name:`projection`,type:`projection`},{name:`field`,type:`field`,default:`datum`},{name:`pointRadius`,type:`number`,expr:!0},{name:`as`,type:`string`,default:`shape`}]},fg(fR,K,{transform(e,t){var n=t.fork(t.ALL),r=this.value,i=e.as||`shape`,a=n.ADD;return(!r||e.modified())&&(this.value=r=Obe(KL(e.projection),e.field||bh(`datum`),e.pointRadius),n.materialize().reflow(),a=n.SOURCE),n.visit(a,e=>e[i]=r),n.modifies(i)}}),pR.Definition={type:`Graticule`,metadata:{changes:!0,generates:!0},params:[{name:`extent`,type:`array`,array:!0,length:2,content:{type:`number`,array:!0,length:2}},{name:`extentMajor`,type:`array`,array:!0,length:2,content:{type:`number`,array:!0,length:2}},{name:`extentMinor`,type:`array`,array:!0,length:2,content:{type:`number`,array:!0,length:2}},{name:`step`,type:`number`,array:!0,length:2},{name:`stepMajor`,type:`number`,array:!0,length:2,default:[90,360]},{name:`stepMinor`,type:`number`,array:!0,length:2,default:[10,10]},{name:`precision`,type:`number`,default:2.5}]},fg(pR,K,{transform(e,t){var n=this.value,r=this.generator,i;if(!n.length||e.modified())for(let t in e)eg(r[t])&&r[t](e[t]);return i=r(),n.length?t.mod.push(dx(n[0],i)):t.add.push(cx(i)),n[0]=i,t}}),mR.Definition={type:`heatmap`,metadata:{modifies:!0},params:[{name:`field`,type:`field`},{name:`color`,type:`string`,expr:!0},{name:`opacity`,type:`number`,expr:!0},{name:`resolve`,type:`enum`,values:[`shared`,`independent`],default:`independent`},{name:`as`,type:`string`,default:`image`}]},fg(mR,K,{transform(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var n=t.materialize(t.SOURCE).source,r=e.resolve===`shared`,i=e.field||Ch,a=Abe(e.opacity,e),o=kbe(e.color,e),s=e.as||`image`,c={$x:0,$y:0,$value:0,$max:r?Yg(n.map(e=>Yg(i(e).values))):0};return n.forEach(e=>{let t=i(e),n=og({},e,c);r||(n.$max=Yg(t.values||[])),e[s]=jbe(t,n,o.dep?o:ig(o(n)),a.dep?a:ig(a(n)))}),t.reflow(!0).modifies(s)}}),fg(gR,K,{transform(e,t){let n=this.value;return!n||e.modified(`type`)?(this.value=n=Nbe(e.type),JL.forEach(t=>{e[t]!=null&&_R(n,t,e[t])})):JL.forEach(t=>{e.modified(t)&&_R(n,t,e[t])}),e.pointRadius!=null&&n.path.pointRadius(e.pointRadius),e.fit&&Mbe(n,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)}})}));function Lbe(e,t){var n,r=1;e??=0,t??=0;function i(){var i,a=n.length,o,s=0,c=0;for(i=0;i{}));function zbe(e){let t=+this._x.call(null,e),n=+this._y.call(null,e);return CR(this.cover(t,n),t,n,e)}function CR(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,a=e._root,o={data:r},s=e._x0,c=e._y0,l=e._x1,u=e._y1,d,f,p,m,h,g,_,v;if(!a)return e._root=o,e;for(;a.length;)if((h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f,i=a,!(a=a[_=g<<1|h]))return i[_]=o,e;if(p=+e._x.call(null,a.data),m=+e._y.call(null,a.data),t===p&&n===m)return o.next=a,i?i[_]=o:e._root=o,e;do i=i?i[_]=[,,,,]:e._root=[,,,,],(h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f;while((_=g<<1|h)==(v=(m>=f)<<1|p>=d));return i[v]=a,i[_]=o,e}function Bbe(e){var t,n,r=e.length,i,a,o=Array(r),s=Array(r),c=1/0,l=1/0,u=-1/0,d=-1/0;for(n=0;nu&&(u=i),ad&&(d=a));if(c>u||l>d)return this;for(this.cover(c,l).cover(u,d),n=0;n{}));function Hbe(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(n))i=(n=Math.floor(e))+1,a=(r=Math.floor(t))+1;else{for(var o=i-n||1,s=this._root,c,l;n>e||e>=i||r>t||t>=a;)switch(l=(t{}));function Wbe(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}var Gbe=o((()=>{}));function Kbe(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}var qbe=o((()=>{}));function wR(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i}var TR=o((()=>{}));function Jbe(e,t,n){var r,i=this._x0,a=this._y0,o,s,c,l,u=this._x1,d=this._y1,f=[],p=this._root,m,h;for(p&&f.push(new wR(p,i,a,u,d)),n==null?n=1/0:(i=e-n,a=t-n,u=e+n,d=t+n,n*=n);m=f.pop();)if(!(!(p=m.node)||(o=m.x0)>u||(s=m.y0)>d||(c=m.x1)=_)<<1|e>=g)&&(m=f[f.length-1],f[f.length-1]=f[f.length-1-h],f[f.length-1-h]=m)}else{var v=e-+this._x.call(null,p.data),y=t-+this._y.call(null,p.data),b=v*v+y*y;if(b{TR()}));function Xbe(e){if(isNaN(u=+this._x.call(null,e))||isNaN(d=+this._y.call(null,e)))return this;var t,n=this._root,r,i,a,o=this._x0,s=this._y0,c=this._x1,l=this._y1,u,d,f,p,m,h,g,_;if(!n)return this;if(n.length)for(;;){if((m=u>=(f=(o+c)/2))?o=f:c=f,(h=d>=(p=(s+l)/2))?s=p:l=p,t=n,!(n=n[g=h<<1|m]))return this;if(!n.length)break;(t[g+1&3]||t[g+2&3]||t[g+3&3])&&(r=t,_=g)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[g]=a:delete t[g],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[_]=n:this._root=n),this):(this._root=a,this)}function Zbe(e){for(var t=0,n=e.length;t{}));function $be(){return this._root}var exe=o((()=>{}));function txe(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}var nxe=o((()=>{}));function rxe(e){var t=[],n,r=this._root,i,a,o,s,c;for(r&&t.push(new wR(r,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(r=n.node,a=n.x0,o=n.y0,s=n.x1,c=n.y1)&&r.length){var l=(a+s)/2,u=(o+c)/2;(i=r[3])&&t.push(new wR(i,l,u,s,c)),(i=r[2])&&t.push(new wR(i,a,u,l,c)),(i=r[1])&&t.push(new wR(i,l,o,s,u)),(i=r[0])&&t.push(new wR(i,a,o,l,u))}return this}var ixe=o((()=>{TR()}));function axe(e){var t=[],n=[],r;for(this._root&&t.push(new wR(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.y0,c=r.x1,l=r.y1,u=(o+c)/2,d=(s+l)/2;(a=i[0])&&t.push(new wR(a,o,s,u,d)),(a=i[1])&&t.push(new wR(a,u,s,c,d)),(a=i[2])&&t.push(new wR(a,o,d,u,l)),(a=i[3])&&t.push(new wR(a,u,d,c,l))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}var oxe=o((()=>{TR()}));function sxe(e){return e[0]}function cxe(e){return arguments.length?(this._x=e,this):this._x}var lxe=o((()=>{}));function uxe(e){return e[1]}function dxe(e){return arguments.length?(this._y=e,this):this._y}var fxe=o((()=>{}));function ER(e,t,n){var r=new DR(t??sxe,n??uxe,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function DR(e,t,n,r,i,a){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function OR(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var kR,pxe=o((()=>{Vbe(),Ube(),Gbe(),qbe(),Ybe(),Qbe(),exe(),nxe(),ixe(),oxe(),lxe(),fxe(),kR=ER.prototype=DR.prototype,kR.copy=function(){var e=new DR(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=OR(t),e;for(n=[{source:t,target:e._root=[,,,,]}];t=n.pop();)for(var i=0;i<4;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=[,,,,]}):t.target[i]=OR(r));return e},kR.add=zbe,kR.addAll=Bbe,kR.cover=Hbe,kR.data=Wbe,kR.extent=Kbe,kR.find=Jbe,kR.remove=Xbe,kR.removeAll=Zbe,kR.root=$be,kR.size=txe,kR.visit=rxe,kR.visitAfter=axe,kR.x=cxe,kR.y=dxe})),AR=o((()=>{pxe()}));function jR(e){return function(){return e}}var MR=o((()=>{}));function NR(e){return(e()-.5)*1e-6}var PR=o((()=>{}));function mxe(e){return e.x+e.vx}function hxe(e){return e.y+e.vy}function gxe(e){var t,n,r,i=1,a=1;typeof e!=`function`&&(e=jR(e==null?1:+e));function o(){for(var e,o=t.length,c,l,u,d,f,p,m=0;ml.index){var h=u-s.x-s.vx,g=d-s.y-s.vy,_=h*h+g*g;_u+m||ad+m||oe.r&&(e.r=e[t].r)}function c(){if(t){var r,i=t.length,a;for(n=Array(i),r=0;r{AR(),MR(),PR()}));function vxe(e){return e.index}function FR(e,t){var n=e.get(t);if(!n)throw Error(`node not found: `+t);return n}function yxe(e){var t=vxe,n=d,r,i=jR(30),a,o,s,c,l,u=1;e??=[];function d(e){return 1/Math.min(s[e.source.index],s[e.target.index])}function f(t){for(var n=0,i=e.length;n[t(e,n,o),e])),d;for(n=0,s=Array(i);n{MR(),PR()}));function IR(){for(var e=0,t=arguments.length,n={},r;e=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}function Sxe(e,t){for(var n=0,r=e.length,i;n{zR={value:()=>{}},LR.prototype=IR.prototype={constructor:LR,on:function(e,t){var n=this._,r=xxe(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a0)for(var n=Array(i),r=0,i,a;r{Cxe()}));function BR(){return QR||=(tz(Txe),ez.now()+$R)}function Txe(){QR=0}function VR(){this._call=this._time=this._next=null}function HR(e,t,n){var r=new VR;return r.restart(e,t,n),r}function Exe(){BR(),++GR;for(var e=YR,t;e;)(t=QR-e._time)>=0&&e._call.call(void 0,t),e=e._next;--GR}function UR(){QR=(ZR=ez.now())+$R,GR=KR=0;try{Exe()}finally{GR=0,Oxe(),QR=0}}function Dxe(){var e=ez.now(),t=e-ZR;t>JR&&($R-=t,ZR=e)}function Oxe(){for(var e,t=YR,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:YR=n);XR=e,WR(r)}function WR(e){GR||(KR&&=clearTimeout(KR),e-QR>24?(e<1/0&&(KR=setTimeout(UR,e-ez.now()-$R)),qR&&=clearInterval(qR)):(qR||=(ZR=ez.now(),setInterval(Dxe,JR)),GR=1,tz(UR)))}var GR,KR,qR,JR,YR,XR,ZR,QR,$R,ez,tz,nz=o((()=>{GR=0,KR=0,qR=0,JR=1e3,ZR=0,QR=0,$R=0,ez=typeof performance==`object`&&performance.now?performance:Date,tz=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)},VR.prototype=HR.prototype={constructor:VR,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?BR():+n)+(t==null?0:+t),!this._next&&XR!==this&&(XR?XR._next=this:YR=this,XR=this),this._call=e,this._time=n,WR()},stop:function(){this._call&&(this._call=null,this._time=1/0,WR())}}}));function kxe(e,t,n){var r=new VR,i=t;return t==null?(r.restart(e,t,n),r):(r._restart=r.restart,r.restart=function(e,t,n){t=+t,n=n==null?BR():+n,r._restart(function a(o){o+=i,r._restart(a,i+=t,n),e(o)},t,n)},r.restart(e,t,n),r)}var Axe=o((()=>{nz()})),rz=o((()=>{nz(),Axe()}));function jxe(){let e=1;return()=>(e=(iz*e+az)%oz)/oz}var iz,az,oz,Mxe=o((()=>{iz=1664525,az=1013904223,oz=4294967296}));function Nxe(e){return e.x}function Pxe(e){return e.y}function Fxe(e){var t,n=1,r=.001,i=1-r**(1/300),a=0,o=.6,s=new Map,c=HR(d),l=IR(`tick`,`end`),u=jxe();e??=[];function d(){f(),l.call(`tick`,t),n1?(n==null?s.delete(e):s.set(e,m(n)),t):s.get(e)},find:function(t,n,r){var i=0,a=e.length,o,s,c,l,u;for(r==null?r=1/0:r*=r,i=0;i1?(l.on(e,n),t):l.on(e)}}}var sz,cz,lz=o((()=>{wxe(),rz(),Mxe(),sz=10,cz=Math.PI*(3-Math.sqrt(5))}));function Ixe(){var e,t,n,r,i=jR(-30),a,o=1,s=1/0,c=.81;function l(n){var i,a=e.length,o=ER(e,Nxe,Pxe).visitAfter(d);for(r=n,i=0;i=s)){(e.data!==t||e.next)&&(d===0&&(d=NR(n),m+=d*d),f===0&&(f=NR(n),m+=f*f),m{AR(),MR(),PR(),lz()}));function Rxe(e){var t=jR(.1),n,r,i;typeof e!=`function`&&(e=jR(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t{MR()}));function Bxe(e){var t=jR(.1),n,r,i;typeof e!=`function`&&(e=jR(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t{MR()})),Hxe=o((()=>{Rbe(),_xe(),bxe(),Lxe(),MR(),lz(),zxe(),Vxe()})),Uxe=c({force:()=>uz});function uz(e){K.call(this,null,e)}function Wxe(e,t){return()=>e.touch(t).run()}function Gxe(e,t){let n=Fxe(e),r=n.stop,i=n.restart,a=!1;return n.stopped=()=>a,n.restart=()=>(a=!1,i()),n.stop=()=>(a=!0,r()),dz(n,t,!0).on(`end`,()=>a=!0)}function dz(e,t,n,r){var i=Qh(t.forces),a,o,s,c;for(a=0,o=mz.length;at(e,n):t)}var fz,pz,mz,hz,gz,Yxe=o((()=>{eS(),Dg(),Hxe(),fz={center:Lbe,collide:gxe,nbody:Ixe,link:yxe,x:Rxe,y:Bxe},pz=`forces`,mz=[`alpha`,`alphaMin`,`alphaTarget`,`velocityDecay`,`forces`],hz=[`static`,`iterations`],gz=[`x`,`y`,`vx`,`vy`],uz.Definition={type:`Force`,metadata:{modifies:!0},params:[{name:`static`,type:`boolean`,default:!1},{name:`restart`,type:`boolean`,default:!1},{name:`iterations`,type:`number`,default:300},{name:`alpha`,type:`number`,default:1},{name:`alphaMin`,type:`number`,default:.001},{name:`alphaTarget`,type:`number`,default:0},{name:`velocityDecay`,type:`number`,default:.4},{name:`forces`,type:`param`,array:!0,params:[{key:{force:`center`},params:[{name:`x`,type:`number`,default:0},{name:`y`,type:`number`,default:0}]},{key:{force:`collide`},params:[{name:`radius`,type:`number`,expr:!0},{name:`strength`,type:`number`,default:.7},{name:`iterations`,type:`number`,default:1}]},{key:{force:`nbody`},params:[{name:`strength`,type:`number`,default:-30,expr:!0},{name:`theta`,type:`number`,default:.9},{name:`distanceMin`,type:`number`,default:1},{name:`distanceMax`,type:`number`}]},{key:{force:`link`},params:[{name:`links`,type:`data`},{name:`id`,type:`field`},{name:`distance`,type:`number`,default:30,expr:!0},{name:`strength`,type:`number`,expr:!0},{name:`iterations`,type:`number`,default:1}]},{key:{force:`x`},params:[{name:`strength`,type:`number`,default:.1},{name:`x`,type:`field`}]},{key:{force:`y`},params:[{name:`strength`,type:`number`,default:.1},{name:`y`,type:`field`}]}]},{name:`as`,type:`string`,array:!0,modify:!1,default:gz}]},fg(uz,K,{transform(e,t){var n=this.value,r=t.changed(t.ADD_REM),i=e.modified(mz),a=e.iterations||300;if(n?(r&&(t.modifies(`index`),n.nodes(t.source)),(i||t.changed(t.MOD))&&dz(n,e,0,t)):(this.value=n=Gxe(t.source,e),n.on(`tick`,Wxe(t.dataflow,this)),e.static||(r=!0,n.tick()),t.modifies(`index`)),i||r||e.modified(hz)||t.changed()&&e.restart){if(n.alpha(Math.max(n.alpha(),e.alpha||1)).alphaDecay(1-n.alphaMin()**(1/a)),e.static)for(n.stop();--a>=0;)n.tick();else if(n.stopped()&&n.restart(),!r)return t.StopPropagation}return this.finish(e,t)},finish(e,t){let n=t.dataflow;for(let e=this._argops,t=0,s=e.length,c;t{}));function aSe(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function oSe(){return this.eachAfter(aSe)}var sSe=o((()=>{}));function cSe(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}var lSe=o((()=>{}));function uSe(e,t){for(var n=this,r=[n],i,a,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}var dSe=o((()=>{}));function fSe(e,t){for(var n=this,r=[n],i=[],a,o,s,c=-1;n=r.pop();)if(i.push(n),a=n.children)for(o=0,s=a.length;o{}));function mSe(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}var hSe=o((()=>{}));function gSe(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}var _Se=o((()=>{}));function vSe(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}var ySe=o((()=>{}));function bSe(e){for(var t=this,n=xSe(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function xSe(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}var SSe=o((()=>{}));function CSe(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}var wSe=o((()=>{}));function TSe(){return Array.from(this)}var ESe=o((()=>{}));function DSe(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}var OSe=o((()=>{}));function kSe(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}var ASe=o((()=>{}));function*jSe(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i{}));function _z(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=FSe)):t===void 0&&(t=PSe);for(var n=new yz(e),r,i=[n],a,o,s,c;r=i.pop();)if((o=t(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,s=c-1;s>=0;--s)i.push(a=o[s]=new yz(o[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(vz)}function NSe(){return _z(this).eachBefore(ISe)}function PSe(e){return e.children}function FSe(e){return Array.isArray(e)?e[1]:null}function ISe(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function vz(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function yz(e){this.data=e,this.depth=this.height=0,this.parent=null}var bz=o((()=>{sSe(),lSe(),dSe(),pSe(),hSe(),_Se(),ySe(),SSe(),wSe(),ESe(),OSe(),ASe(),MSe(),yz.prototype=_z.prototype={constructor:yz,count:oSe,each:cSe,eachAfter:fSe,eachBefore:uSe,find:mSe,sum:gSe,sort:vSe,path:bSe,ancestors:CSe,descendants:TSe,leaves:DSe,links:kSe,copy:NSe,[Symbol.iterator]:jSe}}));function xz(e){return e==null?null:Sz(e)}function Sz(e){if(typeof e!=`function`)throw Error();return e}var Cz=o((()=>{}));function wz(){return 0}function Tz(e){return function(){return e}}var Ez=o((()=>{}));function LSe(){let e=1;return()=>(e=(Dz*e+Oz)%kz)/kz}var Dz,Oz,kz,RSe=o((()=>{Dz=1664525,Oz=1013904223,kz=4294967296}));function zSe(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function BSe(e,t){let n=e.length,r,i;for(;n;)i=t()*n--|0,r=e[n],e[n]=e[i],e[i]=r;return e}var Az=o((()=>{}));function VSe(e,t){for(var n=0,r=(e=BSe(Array.from(e),t)).length,i=[],a,o;n0&&n*n>r*r+i*i}function Nz(e,t){for(var n=0;n1e-6?(D+Math.sqrt(D*D-4*E*O))/(2*E):O/D);return{x:r+S+C*k,y:i+w+T*k,r:k}}var Iz=o((()=>{Az()}));function Lz(e,t,n){var r=e.x-t.x,i,a,o=e.y-t.y,s,c,l=r*r+o*o;l?(a=t.r+n.r,a*=a,c=e.r+n.r,c*=c,a>c?(i=(l+c-a)/(2*l),s=Math.sqrt(Math.max(0,c/l-i*i)),n.x=e.x-i*r-s*o,n.y=e.y-i*o+s*r):(i=(l+a-c)/(2*l),s=Math.sqrt(Math.max(0,a/l-i*i)),n.x=t.x+i*r-s*o,n.y=t.y+i*o+s*r)):(n.x=t.x+n.r,n.y=t.y)}function Rz(e,t){var n=e.r+t.r-1e-6,r=t.x-e.x,i=t.y-e.y;return n>0&&n*n>r*r+i*i}function zz(e){var t=e._,n=e.next._,r=t.r+n.r,i=(t.x*n.r+n.x*t.r)/r,a=(t.y*n.r+n.y*t.r)/r;return i*i+a*a}function Bz(e){this._=e,this.next=null,this.previous=null}function GSe(e,t){if(!(a=(e=zSe(e)).length))return 0;var n=e[0],r,i,a,o,s,c,l,u,d,f;if(n.x=0,n.y=0,!(a>1))return n.r;if(r=e[1],n.x=-r.r,r.x=n.r,r.y=0,!(a>2))return n.r+r.r;Lz(r,n,i=e[2]),n=new Bz(n),r=new Bz(r),i=new Bz(i),n.next=i.previous=r,r.next=n.previous=i,i.next=r.previous=n;pack:for(c=3;c{Az(),Iz()}));function KSe(e){return Math.sqrt(e.value)}function qSe(){var e=null,t=1,n=1,r=wz;function i(i){let a=LSe();return i.x=t/2,i.y=n/2,e?i.eachBefore(Hz(e)).eachAfter(Uz(r,.5,a)).eachBefore(Wz(1)):i.eachBefore(Hz(KSe)).eachAfter(Uz(wz,1,a)).eachAfter(Uz(r,i.r/Math.min(t,n),a)).eachBefore(Wz(Math.min(t,n)/(2*i.r))),i}return i.radius=function(t){return arguments.length?(e=xz(t),i):e},i.size=function(e){return arguments.length?(t=+e[0],n=+e[1],i):[t,n]},i.padding=function(e){return arguments.length?(r=typeof e==`function`?e:Tz(+e),i):r},i}function Hz(e){return function(t){t.children||(t.r=Math.max(0,+e(t)||0))}}function Uz(e,t,n){return function(r){if(i=r.children){var i,a,o=i.length,s=e(r)*t||0,c;if(s)for(a=0;a{Cz(),Ez(),RSe(),Vz()}));function Gz(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}var Kz=o((()=>{}));function qz(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(r-t)/e.value;++s{}));function YSe(){var e=1,t=1,n=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=e,i.y1=t/o,i.eachBefore(a(t,o)),r&&i.eachBefore(Gz),i}function a(e,t){return function(r){r.children&&qz(r,r.x0,e*(r.depth+1)/t,r.x1,e*(r.depth+2)/t);var i=r.x0,a=r.y0,o=r.x1-n,s=r.y1-n;o{Kz(),Jz()}));function ZSe(e){return e.id}function QSe(e){return e.parentId}function Yz(){var e=ZSe,t=QSe,n;function r(r){var i=Array.from(r),a=e,o=t,s,c,l,u,d,f,p,m,h=new Map;if(n!=null){let e=i.map((e,t)=>$Se(n(e,t,r))),t=e.map(Xz),s=new Set(e).add(``);for(let n of t)s.has(n)||(s.add(n),e.push(n),t.push(Xz(n)),i.push(eB));a=(t,n)=>e[n],o=(e,n)=>t[n]}for(l=0,s=i.length;l=0&&(f=i[e],f.data===eB);--e)f.data=null}if(u.parent=Qz,u.eachBefore(function(e){e.depth=e.parent.depth+1,--s}).eachBefore(vz),u.parent=null,s>0)throw Error(`cycle`);return u}return r.id=function(t){return arguments.length?(e=xz(t),r):e},r.parentId=function(e){return arguments.length?(t=xz(e),r):t},r.path=function(e){return arguments.length?(n=xz(e),r):n},r}function $Se(e){e=`${e}`;let t=e.length;return Zz(e,t-1)&&!Zz(e,t-2)&&(e=e.slice(0,-1)),e[0]===`/`?e:`/${e}`}function Xz(e){let t=e.length;if(t<2)return``;for(;--t>1&&!Zz(e,t););return e.slice(0,t)}function Zz(e,t){if(e[t]===`/`){let n=0;for(;t>0&&e[--t]===`\\`;)++n;if(!(n&1))return!0}return!1}var Qz,$z,eB,eCe=o((()=>{Cz(),bz(),Qz={depth:-1},$z={},eB={}}));function tCe(e,t){return e.parent===t.parent?1:2}function tB(e){var t=e.children;return t?t[0]:e.t}function nB(e){var t=e.children;return t?t[t.length-1]:e.t}function nCe(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function rCe(e){for(var t=0,n=0,r=e.children,i=r.length,a;--i>=0;)a=r[i],a.z+=t,a.m+=t,t+=a.s+(n+=a.c)}function iCe(e,t,n){return e.a.parent===t.parent?e.a:n}function rB(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}function aCe(e){for(var t=new rB(e,0),n,r=[t],i,a,o,s;n=r.pop();)if(a=n._.children)for(n.children=Array(s=a.length),o=s-1;o>=0;--o)r.push(i=n.children[o]=new rB(a[o],o)),i.parent=n;return(t.parent=new rB(null,0)).children=[t],t}function oCe(){var e=tCe,t=1,n=1,r=null;function i(i){var s=aCe(i);if(s.eachAfter(a),s.parent.m=-s.z,s.eachBefore(o),r)i.eachBefore(c);else{var l=i,u=i,d=i;i.eachBefore(function(e){e.xu.x&&(u=e),e.depth>d.depth&&(d=e)});var f=l===u?1:e(l,u)/2,p=f-l.x,m=t/(u.x+f+p),h=n/(d.depth||1);i.eachBefore(function(e){e.x=(e.x+p)*m,e.y=e.depth*h})}return i}function a(t){var n=t.children,r=t.parent.children,i=t.i?r[t.i-1]:null;if(n){rCe(t);var a=(n[0].z+n[n.length-1].z)/2;i?(t.z=i.z+e(t._,i._),t.m=t.z-a):t.z=a}else i&&(t.z=i.z+e(t._,i._));t.parent.A=s(t,i,t.parent.A||r[0])}function o(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(t,n,r){if(n){for(var i=t,a=t,o=n,s=i.parent.children[0],c=i.m,l=a.m,u=o.m,d=s.m,f;o=nB(o),i=tB(i),o&&i;)s=tB(s),a=nB(a),a.a=t,f=o.z+u-i.z-c+e(o._,i._),f>0&&(nCe(iCe(o,t,r),t,f),c+=f,l+=f),u+=o.m,c+=i.m,d+=s.m,l+=a.m;o&&!nB(a)&&(a.t=o,a.m+=u-l),i&&!tB(s)&&(s.t=i,s.m+=c-d,r=t)}return r}function c(e){e.x*=t,e.y=e.depth*n}return i.separation=function(t){return arguments.length?(e=t,i):e},i.size=function(e){return arguments.length?(r=!1,t=+e[0],n=+e[1],i):r?null:[t,n]},i.nodeSize=function(e){return arguments.length?(r=!0,t=+e[0],n=+e[1],i):r?[t,n]:null},i}var sCe=o((()=>{bz(),rB.prototype=Object.create(yz.prototype)}));function iB(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(i-n)/e.value;++s{}));function oB(e,t,n,r,i,a){for(var o=[],s=t.children,c,l,u=0,d=0,f=s.length,p,m,h=t.value,g,_,v,y,b,x,S;uv&&(v=l),S=g*g*x,y=Math.max(v/S,S/_),y>b){g-=l;break}b=y}o.push(c={value:g,dice:p{Jz(),aB(),sB=(1+Math.sqrt(5))/2,cB=(function e(t){function n(e,n,r,i,a){oB(t,e,n,r,i,a)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n})(sB)}));function cCe(){var e=cB,t=!1,n=1,r=1,i=[0],a=wz,o=wz,s=wz,c=wz,l=wz;function u(e){return e.x0=e.y0=0,e.x1=n,e.y1=r,e.eachBefore(d),i=[0],t&&e.eachBefore(Gz),e}function d(t){var n=i[t.depth],r=t.x0+n,u=t.y0+n,d=t.x1-n,f=t.y1-n;d{Kz(),lB(),Cz(),Ez()}));function uCe(e,t,n,r,i){var a=e.children,o,s=a.length,c,l=Array(s+1);for(l[0]=c=o=0;o=t-1){var c=a[e];c.x0=r,c.y0=i,c.x1=o,c.y1=s;return}for(var d=l[e],f=n/2+d,p=e+1,m=t-1;p>>1;l[h]s-i){var v=n?(r*_+o*g)/n:o;u(e,p,g,r,i,v,s),u(p,t,_,v,i,o,s)}else{var y=n?(i*_+s*g)/n:s;u(e,p,g,r,i,o,y),u(p,t,_,r,y,o,s)}}}var dCe=o((()=>{}));function fCe(e,t,n,r,i){(e.depth&1?iB:qz)(e,t,n,r,i)}var pCe=o((()=>{Jz(),aB()})),uB,mCe=o((()=>{Jz(),aB(),lB(),uB=(function e(t){function n(e,n,r,i,a){if((o=e._squarify)&&o.ratio===t)for(var o,s,c,l,u=-1,d,f=o.length,p=e.value;++u1?t:1)},n})(sB)})),hCe=o((()=>{iSe(),bz(),JSe(),Vz(),Iz(),XSe(),eCe(),sCe(),lCe(),dCe(),Jz(),aB(),pCe(),lB(),mCe()})),gCe=c({nest:()=>fB,pack:()=>mB,partition:()=>hB,stratify:()=>gB,tree:()=>_B,treelinks:()=>vB,treemap:()=>yB});function dB(e,t,n){let r={};return e.each(e=>{let i=e.data;n(i)&&(r[t(i)]=e)}),e.lookup=r,e}function fB(e){K.call(this,null,e)}function _Ce(){let e=[],t={entries:e=>r(n(e,0),0),key:n=>(e.push(n),t)};function n(t,r){if(r>=e.length)return t;let i=t.length,a=e[r++],o={},s={},c=-1,l,u,d;for(;++ce.length)return t;let i=[];for(let e in t)i.push({key:e,values:r(t[e],n)});return i}return t}function pB(e){K.call(this,null,e)}function vCe(e,t,n){for(let r,i=0,a=t.length;i{eS(),Dg(),hCe(),fB.Definition={type:`Nest`,metadata:{treesource:!0,changes:!0},params:[{name:`keys`,type:`field`,array:!0},{name:`generate`,type:`boolean`}]},bB=e=>e.values,fg(fB,K,{transform(e,t){t.source||U(`Nest transform requires an upstream data source.`);var n=e.generate,r=e.modified(),i=t.clone(),a=this.value;return(!a||r||t.changed())&&(a&&a.each(e=>{e.children&&ax(e.data)&&i.rem.push(e.data)}),this.value=a=_z({values:Qh(e.keys).reduce((e,t)=>(e.key(t),e),_Ce()).entries(i.source)},bB),n&&a.each(e=>{e.children&&(e=cx(e.data),i.add.push(e),i.source.push(e))}),dB(a,ox,ox)),i.source.root=a,i}}),xB=(e,t)=>e.parent===t.parent?1:2,fg(pB,K,{transform(e,t){(!t.source||!t.source.root)&&U(this.constructor.name+` transform requires a backing tree data source.`);let n=this.layout(e.method),r=this.fields,i=t.source.root,a=e.as||r;e.field?i.sum(e.field):i.count(),e.sort&&i.sort(fx(e.sort,e=>e.data)),vCe(n,this.params,e),n.separation&&n.separation(e.separation===!1?Th:xB);try{this.value=n(i)}catch(e){U(e)}return i.each(e=>yCe(e,r,a)),t.reflow(e.modified()).modifies(a).modifies(`leaf`)}}),SB=[`x`,`y`,`r`,`depth`,`children`],mB.Definition={type:`Pack`,metadata:{tree:!0,modifies:!0},params:[{name:`field`,type:`field`},{name:`sort`,type:`compare`},{name:`padding`,type:`number`,default:0},{name:`radius`,type:`field`,default:null},{name:`size`,type:`number`,array:!0,length:2},{name:`as`,type:`string`,array:!0,length:SB.length,default:SB}]},fg(mB,pB,{layout:qSe,params:[`radius`,`size`,`padding`],fields:SB}),CB=[`x0`,`y0`,`x1`,`y1`,`depth`,`children`],hB.Definition={type:`Partition`,metadata:{tree:!0,modifies:!0},params:[{name:`field`,type:`field`},{name:`sort`,type:`compare`},{name:`padding`,type:`number`,default:0},{name:`round`,type:`boolean`,default:!1},{name:`size`,type:`number`,array:!0,length:2},{name:`as`,type:`string`,array:!0,length:CB.length,default:CB}]},fg(hB,pB,{layout:YSe,params:[`size`,`round`,`padding`],fields:CB}),gB.Definition={type:`Stratify`,metadata:{treesource:!0},params:[{name:`key`,type:`field`,required:!0},{name:`parentKey`,type:`field`,required:!0}]},fg(gB,K,{transform(e,t){t.source||U(`Stratify transform requires an upstream data source.`);let n=this.value,r=e.modified(),i=t.fork(t.ALL).materialize(t.SOURCE),a=!n||r||t.changed(t.ADD_REM)||t.modified(e.key.fields)||t.modified(e.parentKey.fields);return i.source=i.source.slice(),a&&(n=i.source.length?dB(Yz().id(e.key).parentId(e.parentKey)(i.source),e.key,Eh):dB(Yz()([{}]),e.key,e.key)),i.source.root=this.value=n,i}}),wB={tidy:oCe,cluster:rSe},TB=[`x`,`y`,`depth`,`children`],_B.Definition={type:`Tree`,metadata:{tree:!0,modifies:!0},params:[{name:`field`,type:`field`},{name:`sort`,type:`compare`},{name:`method`,type:`enum`,default:`tidy`,values:[`tidy`,`cluster`]},{name:`size`,type:`number`,array:!0,length:2},{name:`nodeSize`,type:`number`,array:!0,length:2},{name:`separation`,type:`boolean`,default:!0},{name:`as`,type:`string`,array:!0,length:TB.length,default:TB}]},fg(_B,pB,{layout(e){let t=e||`tidy`;if(cg(wB,t))return wB[t]();U(`Unrecognized Tree layout method: `+t)},params:[`size`,`nodeSize`],fields:TB}),vB.Definition={type:`TreeLinks`,metadata:{tree:!0,generates:!0,changes:!0},params:[]},fg(vB,K,{transform(e,t){let n=this.value,r=t.source&&t.source.root,i=t.fork(t.NO_SOURCE),a={};return r||U(`TreeLinks transform requires a tree data source.`),t.changed(t.ADD_REM)?(i.rem=n,t.visit(t.SOURCE,e=>a[ox(e)]=1),r.each(e=>{let t=e.data,n=e.parent&&e.parent.data;n&&a[ox(t)]&&a[ox(n)]&&i.add.push(cx({source:n,target:t}))}),this.value=i.add):t.changed(t.MOD)&&(t.visit(t.MOD,e=>a[ox(e)]=1),n.forEach(e=>{(a[ox(e.source)]||a[ox(e.target)])&&i.mod.push(e)})),i}}),EB={binary:uCe,dice:qz,slice:iB,slicedice:fCe,squarify:cB,resquarify:uB},DB=[`x0`,`y0`,`x1`,`y1`,`depth`,`children`],yB.Definition={type:`Treemap`,metadata:{tree:!0,modifies:!0},params:[{name:`field`,type:`field`},{name:`sort`,type:`compare`},{name:`method`,type:`enum`,default:`squarify`,values:[`squarify`,`resquarify`,`binary`,`dice`,`slice`,`slicedice`]},{name:`padding`,type:`number`,default:0},{name:`paddingInner`,type:`number`,default:0},{name:`paddingOuter`,type:`number`,default:0},{name:`paddingTop`,type:`number`,default:0},{name:`paddingRight`,type:`number`,default:0},{name:`paddingBottom`,type:`number`,default:0},{name:`paddingLeft`,type:`number`,default:0},{name:`ratio`,type:`number`,default:1.618033988749895},{name:`round`,type:`boolean`,default:!1},{name:`size`,type:`number`,array:!0,length:2},{name:`as`,type:`string`,array:!0,length:DB.length,default:DB}]},fg(yB,pB,{layout(){let e=cCe();return e.ratio=t=>{let n=e.tile();n.ratio&&e.tile(n.ratio(t))},e.method=t=>{cg(EB,t)?e.tile(EB[t]):U(`Unrecognized Treemap layout method: `+t)},e},params:[`method`,`ratio`,`size`,`round`,`padding`,`paddingInner`,`paddingOuter`,`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`],fields:DB})})),xCe=c({label:()=>NB});function SCe(e,t){let n=e.bitmap();return(t||[]).forEach(t=>n.set(e(t.boundary[0]),e(t.boundary[3]))),[n,void 0]}function CCe(e,t,n,r,i){let a=e.width,o=e.height,s=r||i,c=PT(a,o).getContext(`2d`),l=PT(a,o).getContext(`2d`),u=s&&PT(a,o).getContext(`2d`);n.forEach(e=>kB(c,e,!1)),kB(l,t,!1),s&&kB(u,t,!0);let d=OB(c,a,o),f=OB(l,a,o),p=s&&OB(u,a,o),m=e.bitmap(),h=s&&e.bitmap(),g,_,v,y,b,x,S,C;for(_=0;_{t.items.forEach(t=>kB(e,t.items,n))}):wA[r].draw(e,{items:n?t.map(wCe):t})}function wCe(e){let t=ux(e,{});return t.stroke&&t.strokeOpacity!==0||t.fill&&t.fillOpacity!==0?{...t,strokeOpacity:1,stroke:`#000`,fillOpacity:0}:t}function TCe(e,t){let n=new Uint32Array(~~((e*t+LB)/LB));function r(e,t){n[e]|=t}function i(e,t){n[e]&=t}return{array:n,get:(t,r)=>{let i=r*e+t;return n[i>>>FB]&1<<(i&IB)},set:(t,n)=>{let i=n*e+t;r(i>>>FB,1<<(i&IB))},clear:(t,n)=>{let r=n*e+t;i(r>>>FB,~(1<<(r&IB)))},getRange:(t,r,i,a)=>{let o=a,s,c,l,u;for(;o>=r;--o)if(s=o*e+t,c=o*e+i,l=s>>>FB,u=c>>>FB,l===u){if(n[l]&RB[s&IB]&zB[(c&IB)+1])return!0}else{if(n[l]&RB[s&IB]||n[u]&zB[(c&IB)+1])return!0;for(let e=l+1;e{let o,s,c,l,u;for(;n<=a;++n)if(o=n*e+t,s=n*e+i,c=o>>>FB,l=s>>>FB,c===l)r(c,RB[o&IB]&zB[(s&IB)+1]);else for(r(c,RB[o&IB]),r(l,zB[(s&IB)+1]),u=c+1;u{let o,s,c,l,u;for(;n<=a;++n)if(o=n*e+t,s=n*e+r,c=o>>>FB,l=s>>>FB,c===l)i(c,zB[o&IB]|RB[(s&IB)+1]);else for(i(c,zB[o&IB]),i(l,RB[(s&IB)+1]),u=c+1;un<0||r<0||a>=t||i>=e}}function ECe(e,t,n){let r=Math.max(1,Math.sqrt(e*t/1e6)),i=~~((e+2*n+r)/r),a=~~((t+2*n+r)/r),o=e=>~~((e+n)/r);return o.invert=e=>e*r-n,o.bitmap=()=>TCe(i,a),o.ratio=r,o.padding=n,o.width=e,o.height=t,o}function DCe(e,t,n,r){let i=e.width,a=e.height;return function(e){let t=e.datum.datum.items[r].items,n=t.length,o=e.datum.fontSize,s=SA.width(e.datum,e.datum.text),c=0,l,u,d,f,p,m,h;for(let r=0;r=c&&(c=h,e.x=p,e.y=m);return p=s/2,m=o/2,l=e.x-p,u=e.x+p,d=e.y-m,f=e.y+m,e.align=`center`,l<0&&u<=i?e.align=`left`:0<=l&&ii||t-(o=r/2)<0||t+o>a}function jB(e,t,n,r,i,a,o,s){let c=i*a/(r*2),l=e(t-c),u=e(t+c),d=e(n-(a/=2)),f=e(n+a);return o.outOfBounds(l,d,u,f)||o.getRange(l,d,u,f)||s&&s.getRange(l,d,u,f)}function OCe(e,t,n,r){let i=e.width,a=e.height,o=t[0],s=t[1];function c(t,n,r,c,l){let u=e.invert(t),d=e.invert(n),f=r,p=a,m;if(!AB(u,d,c,l,i,a)&&!jB(e,u,d,l,c,f,o,s)&&!jB(e,u,d,l,c,l,o,null)){for(;p-f>=1;)m=(f+p)/2,jB(e,u,d,l,c,m,o,s)?p=m:f=m;if(f>r)return[u,d,f,!0]}}return function(t){let s=t.datum.datum.items[r].items,l=s.length,u=t.datum.fontSize,d=SA.width(t.datum,t.datum.text),f=n?u:0,p=!1,m=!1,h=0,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M;for(let r=0;r_&&(M=g,g=_,_=M),v>y&&(M=v,v=y,y=M),w=e(g),E=e(_),T=~~((w+E)/2),D=e(v),k=e(y),O=~~((D+k)/2),S=T;S>=w;--S)for(C=O;C>=D;--C)j=c(S,C,f,d,u),j&&([t.x,t.y,f,p]=j);for(S=T;S<=E;++S)for(C=O;C<=k;++C)j=c(S,C,f,d,u),j&&([t.x,t.y,f,p]=j);!p&&!n&&(A=Math.abs(_-g+y-v),b=(g+_)/2,x=(v+y)/2,A>=h&&!AB(b,x,d,u,i,a)&&!jB(e,b,x,u,d,u,o,null)&&(h=A,t.x=b,t.y=x,m=!0))}return p||m?(b=d/2,x=u/2,o.setRange(e(t.x-b),e(t.y-x),e(t.x+b),e(t.y+x)),t.align=`center`,t.baseline=`middle`,!0):!1}}function kCe(e,t,n,r){let i=e.width,a=e.height,o=t[0],s=t[1],c=e.bitmap();return function(t){let l=t.datum.datum.items[r].items,u=l.length,d=t.datum.fontSize,f=SA.width(t.datum,t.datum.text),p=[],m=n?d:0,h=!1,g=!1,_=0,v,y,b,x,S,C,w,T,E,D,O,k;for(let r=0;r=1;)O=(E+D)/2,jB(e,S,C,d,f,O,o,s)?D=O:E=O;E>m&&(t.x=S,t.y=C,m=E,h=!0)}}!h&&!n&&(k=Math.abs(y-v+x-b),S=(v+y)/2,C=(b+x)/2,k>=_&&!AB(S,C,f,d,i,a)&&!jB(e,S,C,d,f,d,o,null)&&(_=k,t.x=S,t.y=C,g=!0))}return h||g?(S=f/2,C=d/2,o.setRange(e(t.x-S),e(t.y-C),e(t.x+S),e(t.y+C)),t.align=`center`,t.baseline=`middle`,!0):!1}}function ACe(e,t,n,r){let i=e.width,a=e.height,o=t[0],s=t[1],c=r.length;return function(t){let l=t.boundary,u=t.datum.fontSize;if(l[2]<0||l[5]<0||l[0]>i||l[3]>a)return!1;let d=t.textWidth??0,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E;for(let i=0;i>>2&3)-1,m=f===0&&p===0||r[i]<0,h=f&&p?Math.SQRT1_2:1,g=r[i]<0?-1:1,_=l[1+f]+r[i]*f*h,S=l[4+p]+g*u*p/2+r[i]*p*h,y=S-u/2,b=S+u/2,C=e(_),T=e(y),E=e(b),!d)if(MB(C,C,T,E,o,s,_,_,y,b,l,m))d=SA.width(t.datum,t.datum.text);else continue;if(x=_+g*d*f/2,_=x-d/2,v=x+d/2,C=e(_),w=e(v),MB(C,w,T,E,o,s,_,v,y,b,l,m))return t.x=f?f*g<0?v:_:x,t.y=p?p*g<0?b:y:S,t.align=HB[f*g+1],t.baseline=UB[p*g+1],o.setRange(C,T,w,E),!0}return!1}}function MB(e,t,n,r,i,a,o,s,c,l,u,d){return!(i.outOfBounds(e,n,t,r)||(d&&a||i).getRange(e,n,t,r))}function jCe(e,t,n,r,i,a,o,s,c,l,u){if(!e.length)return e;let d=Math.max(r.length,i.length),f=MCe(r,d),p=NCe(i,d),m=PCe(e[0].datum),h=m===`group`&&e[0].datum.items[c].marktype,g=h===`area`,_=FCe(m,h,s,c),v=l===null||l===1/0,y=g&&u===`naive`,b=-1,x=-1,S=e.map(e=>{let t=v?SA.width(e,e.text):void 0;return b=Math.max(b,t),x=Math.max(x,e.fontSize),{datum:e,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:_(e),textWidth:t}});l=l===null||l===1/0?Math.max(b,x)+Math.max(...r):l;let C=ECe(t[0],t[1],l),w;if(!y){n&&S.sort((e,t)=>n(e.datum,t.datum));let t=!1;for(let e=0;ee.datum);w=a.length||r?CCe(C,r||[],a,t,g):SCe(C,o&&S)}let T=g?GB[u](C,w,o,c):ACe(C,w,p,f);return S.forEach(e=>e.opacity=+T(e)),S}function MCe(e,t){let n=new Float64Array(t),r=e.length;for(let t=0;t[e.x,e.x,e.x,e.y,e.y,e.y];return e?e===`line`||e===`area`?e=>i(e.datum):t===`line`?e=>{let t=e.datum.items[r].items;return i(t.length?t[n===`start`?0:t.length-1]:{x:NaN,y:NaN})}:e=>{let t=e.datum.bounds;return[t.x1,(t.x1+t.x2)/2,t.x2,t.y1,(t.y1+t.y2)/2,t.y2]}:i}function NB(e){K.call(this,null,e)}var PB,FB,IB,LB,RB,zB,BB,VB,HB,UB,WB,GB,KB,qB,ICe=o((()=>{zj(),IT(),eS(),Dg(),PB=4278190080,FB=5,IB=31,LB=32,RB=new Uint32Array(33),zB=new Uint32Array(33),zB[0]=0,RB[0]=~zB[0];for(let e=1;e<=LB;++e)zB[e]=zB[e-1]<<1|1,RB[e]=~zB[e];BB=[-1,-1,1,1],VB=[-1,1,-1,1],HB=[`right`,`center`,`left`],UB=[`bottom`,`middle`,`top`],WB={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},GB={naive:DCe,"reduced-search":OCe,floodfill:kCe},KB=[`x`,`y`,`opacity`,`align`,`baseline`],qB=[`top-left`,`left`,`bottom-left`,`top`,`bottom`,`top-right`,`right`,`bottom-right`],NB.Definition={type:`Label`,metadata:{modifies:!0},params:[{name:`size`,type:`number`,array:!0,length:2,required:!0},{name:`sort`,type:`compare`},{name:`anchor`,type:`string`,array:!0,default:qB},{name:`offset`,type:`number`,array:!0,default:[1]},{name:`padding`,type:`number`,default:0,null:!0},{name:`lineAnchor`,type:`string`,values:[`start`,`end`],default:`end`},{name:`markIndex`,type:`number`,default:0},{name:`avoidBaseMark`,type:`boolean`,default:!0},{name:`avoidMarks`,type:`data`,array:!0},{name:`method`,type:`string`,default:`naive`},{name:`as`,type:`string`,array:!0,length:KB.length,default:KB}]},fg(NB,K,{transform(e,t){function n(n){let r=e[n];return eg(r)&&t.modified(r.fields)}let r=e.modified();if(!(r||t.changed(t.ADD_REM)||n(`sort`)))return;(!e.size||e.size.length!==2)&&U(`Size parameter should be specified as a [width, height] array.`);let i=e.as||KB;return jCe(t.materialize(t.SOURCE).source||[],e.size,e.sort,Qh(e.offset==null?1:e.offset),Qh(e.anchor||qB),e.avoidMarks||[],e.avoidBaseMark!==!1,e.lineAnchor||`end`,e.markIndex||0,e.padding===void 0?0:e.padding,e.method||`naive`).forEach(e=>{let t=e.datum;t[i[0]]=e.x,t[i[1]]=e.y,t[i[2]]=e.opacity,t[i[3]]=e.align,t[i[4]]=e.baseline}),t.reflow(r).modifies(i)}})})),LCe=c({loess:()=>YB,regression:()=>XB});function JB(e,t){var n=[],r=function(e){return e(s)},i,a,o,s,c,l;if(t==null)n.push(e);else for(i={},a=0,o=e.length;a{GS(),eS(),Dg(),YB.Definition={type:`Loess`,metadata:{generates:!0},params:[{name:`x`,type:`field`,required:!0},{name:`y`,type:`field`,required:!0},{name:`groupby`,type:`field`,array:!0},{name:`bandwidth`,type:`number`,default:.3},{name:`as`,type:`string`,array:!0}]},fg(YB,K,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){let r=t.materialize(t.SOURCE).source,i=JB(r,e.groupby),a=(e.groupby||[]).map(uh),o=a.length,s=e.as||[uh(e.x),uh(e.y)],c=[];i.forEach(t=>{IS(t,e.x,e.y,e.bandwidth||.3).forEach(e=>{let n={};for(let e=0;ee===`poly`?t:e===`quad`?2:1,XB.Definition={type:`Regression`,metadata:{generates:!0},params:[{name:`x`,type:`field`,required:!0},{name:`y`,type:`field`,required:!0},{name:`groupby`,type:`field`,array:!0},{name:`method`,type:`string`,default:`linear`,values:Object.keys(ZB)},{name:`order`,type:`number`,default:3},{name:`extent`,type:`number`,array:!0,length:2},{name:`params`,type:`boolean`,default:!1},{name:`as`,type:`string`,array:!0}]},fg(XB,K,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){let r=t.materialize(t.SOURCE).source,i=JB(r,e.groupby),a=(e.groupby||[]).map(uh),o=e.method||`linear`,s=e.order==null?3:e.order,c=QB(o,s),l=e.as||[uh(e.x),uh(e.y)],u=ZB[o],d=[],f=e.extent;cg(ZB,o)||U(`Invalid regression method: `+o),f!=null&&o===`log`&&f[0]<=0&&(t.dataflow.warn(`Ignoring extent with values <= 0 for log regression.`),f=null),i.forEach(n=>{if(n.length<=c){t.dataflow.warn(`Skipping regression with more parameters than data points.`);return}let r=u(n,e.x,e.y,s);if(e.params){d.push(cx({keys:n.dims,coef:r.coef,rSquared:r.rSquared}));return}let i=f||sg(n,e.x),p=e=>{let t={};for(let e=0;ep([e,r.predict(e)])):LS(r.predict,i,25,200).forEach(p)}),this.value&&(n.rem=this.value),this.value=n.add=n.source=d}return n}})}));function $B(e,t,n,r,i){let a,o,s,c,l=t[0],u=r[0],d=0,f=0;u>l==u>-l?(a=l,l=t[++d]):(a=u,u=r[++f]);let p=0;if(dl==u>-l?(o=l+a,s=a-(o-l),l=t[++d]):(o=u+a,s=a-(o-u),u=r[++f]),a=o,s!==0&&(i[p++]=s);dl==u>-l?(o=a+l,c=o-a,s=a-(o-c)+(l-c),l=t[++d]):(o=a+u,c=o-a,s=a-(o-c)+(u-c),u=r[++f]),a=o,s!==0&&(i[p++]=s);for(;d{eV=11102230246251565e-32,tV=134217729,nV=3.000000000000001*eV}));function BCe(e,t,n,r,i,a,o){let s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T=e-i,E=n-i,D=t-a,O=r-a;b=T*O,f=tV*T,p=f-(f-T),m=T-p,f=tV*O,h=f-(f-O),g=O-h,x=m*g-(b-p*h-m*h-p*g),S=D*E,f=tV*D,p=f-(f-D),m=D-p,f=tV*E,h=f-(f-E),g=E-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,cV[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,cV[1]=y-(_+d)+(d-S),w=v+_,d=w-v,cV[2]=v-(w-d)+(_-d),cV[3]=w;let k=zCe(4,cV),A=oV*o;if(k>=A||-k>=A||(d=e-T,s=e-(T+d)+(d-i),d=n-E,l=n-(E+d)+(d-i),d=t-D,c=t-(D+d)+(d-a),d=r-O,u=r-(O+d)+(d-a),s===0&&c===0&&l===0&&u===0)||(A=sV*o+nV*Math.abs(k),k+=T*u+O*s-(D*l+E*c),k>=A||-k>=A))return k;b=s*O,f=tV*s,p=f-(f-s),m=s-p,f=tV*O,h=f-(f-O),g=O-h,x=m*g-(b-p*h-m*h-p*g),S=c*E,f=tV*c,p=f-(f-c),m=c-p,f=tV*E,h=f-(f-E),g=E-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,fV[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,fV[1]=y-(_+d)+(d-S),w=v+_,d=w-v,fV[2]=v-(w-d)+(_-d),fV[3]=w;let j=$B(4,cV,4,fV,lV);b=T*u,f=tV*T,p=f-(f-T),m=T-p,f=tV*u,h=f-(f-u),g=u-h,x=m*g-(b-p*h-m*h-p*g),S=D*l,f=tV*D,p=f-(f-D),m=D-p,f=tV*l,h=f-(f-l),g=l-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,fV[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,fV[1]=y-(_+d)+(d-S),w=v+_,d=w-v,fV[2]=v-(w-d)+(_-d),fV[3]=w;let M=$B(j,lV,4,fV,uV);b=s*u,f=tV*s,p=f-(f-s),m=s-p,f=tV*u,h=f-(f-u),g=u-h,x=m*g-(b-p*h-m*h-p*g),S=c*l,f=tV*c,p=f-(f-c),m=c-p,f=tV*l,h=f-(f-l),g=l-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,fV[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,fV[1]=y-(_+d)+(d-S),w=v+_,d=w-v,fV[2]=v-(w-d)+(_-d),fV[3]=w;let N=$B(M,uV,4,fV,dV);return dV[N-1]}function iV(e,t,n,r,i,a){let o=(t-a)*(n-i),s=(e-i)*(r-a),c=o-s,l=Math.abs(o+s);return Math.abs(c)>=aV*l?c:-BCe(e,t,n,r,i,a,l)}var aV,oV,sV,cV,lV,uV,dV,fV,VCe=o((()=>{rV(),aV=(3+16*eV)*eV,oV=(2+12*eV)*eV,sV=(9+64*eV)*eV*eV,cV=q(4),lV=q(8),uV=q(12),dV=q(16),fV=q(4)})),HCe=o((()=>{rV(),(7+56*eV)*eV,(3+28*eV)*eV,(26+288*eV)*eV*eV,q(4),q(4),q(4),q(4),q(4),q(4),q(4),q(4),q(4),q(8),q(8),q(8),q(4),q(8),q(8),q(16),q(12),q(192),q(192)})),UCe=o((()=>{rV(),(10+96*eV)*eV,(4+48*eV)*eV,(44+576*eV)*eV*eV,q(4),q(4),q(4),q(4),q(4),q(4),q(4),q(4),q(8),q(8),q(8),q(8),q(8),q(8),q(8),q(8),q(8),q(4),q(4),q(4),q(8),q(16),q(16),q(16),q(32),q(32),q(48),q(64),q(1152),q(1152)})),WCe=o((()=>{rV(),(16+224*eV)*eV,(5+72*eV)*eV,(71+1408*eV)*eV*eV,q(4),q(4),q(4),q(4),q(4),q(4),q(4),q(4),q(4),q(4),q(24),q(24),q(24),q(24),q(24),q(24),q(24),q(24),q(24),q(24),q(1152),q(1152),q(1152),q(1152),q(1152),q(2304),q(2304),q(3456),q(5760),q(8),q(8),q(8),q(16),q(24),q(48),q(48),q(96),q(192),q(384),q(384),q(384),q(768),q(96),q(96),q(96),q(1152)})),GCe=o((()=>{VCe(),HCe(),UCe(),WCe()}));function KCe(e,t){let n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function pV(e,t,n,r){let i=e-n,a=t-r;return i*i+a*a}function qCe(e,t,n,r,i,a,o,s){let c=e-o,l=t-s,u=n-o,d=r-s,f=i-o,p=a-s,m=c*c+l*l,h=u*u+d*d,g=f*f+p*p;return c*(d*g-h*p)-l*(u*g-h*f)+m*(u*p-d*f)<0}function JCe(e,t,n,r,i,a){let o=n-e,s=r-t,c=i-e,l=a-t,u=o*o+s*s,d=c*c+l*l,f=.5/(o*l-s*c),p=(l*u-s*d)*f,m=(o*d-c*u)*f;return p*p+m*m}function YCe(e,t,n,r,i,a){let o=n-e,s=r-t,c=i-e,l=a-t,u=o*o+s*s,d=c*c+l*l,f=.5/(o*l-s*c);return{x:e+(l*u-s*d)*f,y:t+(o*d-c*u)*f}}function mV(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){let r=e[i],a=t[r],o=i-1;for(;o>=n&&t[e[o]]>a;)e[o+1]=e[o--];e[o+1]=r}else{let i=n+r>>1,a=n+1,o=r;hV(e,i,a),t[e[n]]>t[e[r]]&&hV(e,n,r),t[e[a]]>t[e[r]]&&hV(e,a,r),t[e[n]]>t[e[a]]&&hV(e,n,a);let s=e[a],c=t[s];for(;;){do a++;while(t[e[a]]c);if(o=o-n?(mV(e,t,a,r),mV(e,t,n,o-1)):(mV(e,t,n,o-1),mV(e,t,a,r))}}function hV(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function XCe(e){return e[0]}function ZCe(e){return e[1]}var gV,_V,vV,QCe=o((()=>{GCe(),gV=2**-52,_V=new Uint32Array(512),vV=class e{static from(t,n=XCe,r=ZCe){let i=t.length,a=new Float64Array(i*2);for(let e=0;e>1;if(t>0&&typeof e[0]!=`number`)throw Error(`Expected coords to contain numbers.`);this.coords=e;let n=Math.max(2*t-5,0);this._triangles=new Uint32Array(n*3),this._halfedges=new Int32Array(n*3),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.trianglesLen=0,this._cx=0,this._cy=0,this._hullStart=0,this.hull=this._triangles,this.triangles=this._triangles,this.halfedges=this._halfedges,this.update()}update(){let{coords:e,_hullPrev:t,_hullNext:n,_hullTri:r,_hullHash:i}=this,a=e.length>>1,o=1/0,s=1/0,c=-1/0,l=-1/0;for(let t=0;tc&&(c=n),r>l&&(l=r),this._ids[t]=t}let u=(o+c)/2,d=(s+l)/2,f=0,p=0,m=0;for(let t=0,n=1/0;t0&&(p=t,n=r)}let _=e[2*p],v=e[2*p+1],y=1/0;for(let t=0;tr&&(t[n++]=i,r=a)}this.hull=t.subarray(0,n),this.triangles=new Uint32Array,this.halfedges=new Int32Array;return}if(iV(h,g,_,v,b,x)<0){let e=p,t=_,n=v;p=m,_=b,v=x,m=e,b=t,x=n}let S=YCe(h,g,_,v,b,x);this._cx=S.x,this._cy=S.y;for(let t=0;t0&&Math.abs(l-o)<=gV&&Math.abs(u-s)<=gV||(o=l,s=u,c===f||c===p||c===m))continue;let d=0;for(let e=0,t=this._hashKey(l,u);e=0;)if(h=g,h===d){h=-1;break}if(h===-1)continue;let _=this._addTriangle(h,c,n[h],-1,-1,r[h]);r[c]=this._legalize(_+2),r[h]=_,C++;let v=n[h];for(;g=n[v],iV(l,u,e[2*v],e[2*v+1],e[2*g],e[2*g+1])<0;)_=this._addTriangle(v,c,g,r[c],-1,r[v]),r[c]=this._legalize(_+2),n[v]=v,C--,v=g;if(h===d)for(;g=t[h],iV(l,u,e[2*g],e[2*g+1],e[2*h],e[2*h+1])<0;)_=this._addTriangle(g,c,h,-1,r[h],r[g]),this._legalize(_+2),r[g]=_,n[h]=h,C--,h=g;this._hullStart=t[c]=h,n[h]=t[v]=c,n[c]=v,i[this._hashKey(l,u)]=c,i[this._hashKey(e[2*h],e[2*h+1])]=h}this.hull=new Uint32Array(C);for(let e=0,t=this._hullStart;e{yV=1e-6,bV=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=``}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+=`Z`)}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){e=+e,t=+t,n=+n;let r=e+n,i=t;if(n<0)throw Error(`negative radius`);this._x1===null?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>yV||Math.abs(this._y1-i)>yV)&&(this._+=`L`+r+`,`+i),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(e,t,n,r){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}})),SV,CV=o((()=>{SV=class{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}}})),wV,TV=o((()=>{xV(),CV(),wV=class{constructor(e,[t,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(t=+t))||!((i=+i)>=(n=+n)))throw Error(`invalid bounds`);this.delaunay=e,this._circumcenters=new Float64Array(e.points.length*2),this.vectors=new Float64Array(e.points.length*2),this.xmax=r,this.xmin=t,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:e,hull:t,triangles:n},vectors:r}=this,i,a,o=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let r=0,s=0,c=n.length,l,u;r1;)i-=2;for(let e=2;e0){if(t>=this.ymax)return null;(a=(this.ymax-t)/r)0){if(e>=this.xmax)return null;(a=(this.xmax-e)/n)this.xmax?2:0)|(tthis.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t1e-10)return!1}return!0}function nwe(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}function rwe(e,t,n,r){let i=e.length,a=new Float64Array(i*2);for(let o=0;o{QCe(),xV(),CV(),TV(),EV=2*Math.PI,DV=Math.pow,OV=class e{static from(t,n=$Ce,r=ewe,i){return new e(`length`in t?rwe(t,n,r,i):Float64Array.from(iwe(t,n,r,i)))}constructor(e){this._delaunator=new vV(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&twe(e)){this.collinear=Int32Array.from({length:t.length/2},(e,t)=>t).sort((e,n)=>t[2*e]-t[2*n]||t[2*e+1]-t[2*n+1]);let e=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[t[2*e],t[2*e+1],t[2*n],t[2*n+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let e=0,n=t.length/2;e0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],a[r[0]]=1,r.length===2&&(a[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(e){return new wV(this,e)}*neighbors(e){let{inedges:t,hull:n,_hullIndex:r,halfedges:i,triangles:a,collinear:o}=this;if(o){let t=o.indexOf(e);t>0&&(yield o[t-1]),t=0&&i!==n&&i!==r;)n=i;return i}_step(e,t,n){let{inedges:r,hull:i,_hullIndex:a,halfedges:o,triangles:s,points:c}=this;if(r[e]===-1||!c.length)return(e+1)%(c.length>>1);let l=e,u=DV(t-c[e*2],2)+DV(n-c[e*2+1],2),d=r[e],f=d;do{let r=s[f],d=DV(t-c[r*2],2)+DV(n-c[r*2+1],2);if(d{awe(),TV()})),swe=c({voronoi:()=>kV});function kV(e){K.call(this,null,e)}function cwe(e){let t=e[0][0],n=e[0][1],r=e.length-1;for(;e[r][0]===t&&e[r][1]===n;--r);return`M`+e.slice(0,r+1).join(`L`)+`Z`}function lwe(e){return e.length===2&&e[0][0]===e[1][0]&&e[0][1]===e[1][1]}var AV,uwe=o((()=>{eS(),Dg(),owe(),kV.Definition={type:`Voronoi`,metadata:{modifies:!0},params:[{name:`x`,type:`field`,required:!0},{name:`y`,type:`field`,required:!0},{name:`size`,type:`number`,array:!0,length:2},{name:`extent`,type:`array`,array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:`number`,array:!0,length:2}},{name:`as`,type:`string`,default:`path`}]},AV=[-1e5,-1e5,1e5,1e5],fg(kV,K,{transform(e,t){let n=e.as||`path`,r=t.source;if(!r||!r.length)return t;let i=e.size;i=i?[0,0,i[0],i[1]]:(i=e.extent)?[i[0][0],i[0][1],i[1][0],i[1][1]]:AV;let a=this.value=OV.from(r,e.x,e.y).voronoi(i);for(let e=0,t=r.length;eNV});function fwe(){var e=[256,256],t,n,r,i,a,o,s,c=jV,l=[],u=Math.random,d={};d.layout=function(){for(var c=f(PT()),d=vwe((e[0]>>5)*e[1]),m=null,h=l.length,g=-1,_=[],v=l.map(e=>({text:t(e),font:n(e),style:i(e),weight:a(e),rotate:o(e),size:~~(r(e)+1e-14),padding:s(e),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:e})).sort((e,t)=>t.size-e.size);++g>1,y.y=e[1]*(u()+.5)>>1,pwe(c,y,v,g),y.hasText&&p(d,y,m)&&(_.push(y),m?hwe(m,y):m=[{x:y.x+y.x0,y:y.y+y.y0},{x:y.x+y.x1,y:y.y+y.y1}],y.x-=e[0]>>1,y.y-=e[1]>>1)}return _};function f(e){e.width=e.height=1;var t=Math.sqrt(e.getContext(`2d`).getImageData(0,0,1,1).data.length>>2);e.width=(FV<<5)/t,e.height=IV/t;var n=e.getContext(`2d`);return n.fillStyle=n.strokeStyle=`red`,n.textAlign=`center`,{context:n,ratio:t}}function p(t,n,r){for(var i=n.x,a=n.y,o=Math.hypot(e[0],e[1]),s=c(e),l=u()<.5?1:-1,d=-l,f,p,m;(f=s(d+=l))&&(p=~~f[0],m=~~f[1],!(Math.min(Math.abs(p),Math.abs(m))>=o));)if(n.x=i+p,n.y=a+m,!(n.x+n.x0<0||n.y+n.y0<0||n.x+n.x1>e[0]||n.y+n.y1>e[1])&&(!r||!mwe(n,t,e[0]))&&(!r||gwe(n,r))){for(var h=n.sprite,g=n.width>>5,_=e[0]>>5,v=n.x-(g<<4),y=v&127,b=32-y,x=n.y1-n.y0,S=(n.y+n.y0)*_+(v>>5),C,w=0;w>>y:0);S+=_}return n.sprite=null,!0}return!1}return d.words=function(e){return arguments.length?(l=e,d):l},d.size=function(t){return arguments.length?(e=[+t[0],+t[1]],d):e},d.font=function(e){return arguments.length?(n=MV(e),d):n},d.fontStyle=function(e){return arguments.length?(i=MV(e),d):i},d.fontWeight=function(e){return arguments.length?(a=MV(e),d):a},d.rotate=function(e){return arguments.length?(o=MV(e),d):o},d.text=function(e){return arguments.length?(t=MV(e),d):t},d.spiral=function(e){return arguments.length?(c=LV[e]||e,d):c},d.fontSize=function(e){return arguments.length?(r=MV(e),d):r},d.padding=function(e){return arguments.length?(s=MV(e),d):s},d.random=function(e){return arguments.length?(u=e,d):u},d}function pwe(e,t,n,r){if(!t.sprite){var i=e.context,a=e.ratio;i.clearRect(0,0,(FV<<5)/a,IV/a);var o=0,s=0,c=0,l=n.length,u,d,f,p,m;for(--r;++r>5<<5,f=~~Math.max(Math.abs(v+y),Math.abs(v-y))}else u=u+31>>5<<5;if(f>c&&(c=f),o+u>=FV<<5&&(o=0,s+=c,c=0),s+f>=IV)break;i.translate((o+(u>>1))/a,(s+(f>>1))/a),t.rotate&&i.rotate(t.rotate*PV),i.fillText(t.text,0,0),t.padding&&(i.lineWidth=2*t.padding,i.strokeText(t.text,0,0)),i.restore(),t.width=u,t.height=f,t.xoff=o,t.yoff=s,t.x1=u>>1,t.y1=f>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,o+=u}for(var x=i.getImageData(0,0,(FV<<5)/a,IV/a).data,S=[];--r>=0;)if(t=n[r],t.hasText){for(u=t.width,d=u>>5,f=t.y1-t.y0,p=0;p>5),E=x[(s+m)*(FV<<5)+(o+p)<<2]?1<<31-p%32:0;S[T]|=E,C|=E}C?w=m:(t.y0++,f--,m--,s++)}t.y1=t.y0+w,t.sprite=S.slice(0,(t.y1-t.y0)*d)}}}function mwe(e,t,n){n>>=5;for(var r=e.sprite,i=e.width>>5,a=e.x-(i<<4),o=a&127,s=32-o,c=e.y1-e.y0,l=(e.y+e.y0)*n+(a>>5),u,d=0;d>>o:0))&t[l+f])return!0;l+=n}return!1}function hwe(e,t){var n=e[0],r=e[1];t.x+t.x0r.x&&(r.x=t.x+t.x1),t.y+t.y1>r.y&&(r.y=t.y+t.y1)}function gwe(e,t){return e.x+e.x1>t[0].x&&e.x+e.x0t[0].y&&e.y+e.y0{IT(),eS(),Dg(),xO(),GS(),PV=Math.PI/180,FV=64,IV=2048,LV={archimedean:jV,rectangular:_we},RV=[`x`,`y`,`font`,`fontSize`,`fontStyle`,`fontWeight`,`angle`],zV=[`text`,`font`,`rotate`,`fontSize`,`fontStyle`,`fontWeight`],NV.Definition={type:`Wordcloud`,metadata:{modifies:!0},params:[{name:`size`,type:`number`,array:!0,length:2},{name:`font`,type:`string`,expr:!0,default:`sans-serif`},{name:`fontStyle`,type:`string`,expr:!0,default:`normal`},{name:`fontWeight`,type:`string`,expr:!0,default:`normal`},{name:`fontSize`,type:`number`,expr:!0,default:14},{name:`fontSizeRange`,type:`number`,array:`nullable`,default:[10,50]},{name:`rotate`,type:`number`,expr:!0,default:0},{name:`text`,type:`field`},{name:`spiral`,type:`string`,values:[`archimedean`,`rectangular`]},{name:`padding`,type:`number`,expr:!0},{name:`as`,type:`string`,array:!0,length:7,default:RV}]},fg(NV,K,{transform(e,t){e.size&&!(e.size[0]&&e.size[1])&&U(`Wordcloud size dimensions must be non-zero.`);function n(n){let r=e[n];return eg(r)&&t.modified(r.fields)}let r=e.modified();if(!(r||t.changed(t.ADD_REM)||zV.some(n)))return;let i=t.materialize(t.SOURCE).source,a=this.value,o=e.as||RV,s=e.fontSize||14,c;if(eg(s)?c=e.fontSizeRange:s=ig(s),c){let e=s,t=WD(`sqrt`)().domain(sg(i,e)).range(c);s=n=>t(e(n))}i.forEach(e=>{e[o[0]]=NaN,e[o[1]]=NaN,e[o[3]]=0});let l=a.words(i).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||`archimedean`).rotate(e.rotate||0).font(e.font||`sans-serif`).fontStyle(e.fontStyle||`normal`).fontWeight(e.fontWeight||`normal`).fontSize(s).random(RS).layout(),u=a.size(),d=u[0]>>1,f=u[1]>>1,p=l.length;for(let e=0,t,n;eUV,resolvefilter:()=>WV});function xwe(){let e=8,t=[],n=qV(0),r=BV(0,e),i=BV(0,e);return{data:()=>t,seen:()=>n=Swe(n,t.length),add(e){for(let n=0,r=t.length,i=e.length,a;nt.length,curr:()=>r,prev:()=>i,reset:e=>i[e]=r[e],all:()=>e<257?255:e<65537?65535:4294967295,set(e,t){r[e]|=t},clear(e,t){r[e]&=~t},resize(t,n){(t>r.length||n>e)&&(e=Math.max(n,e),r=BV(t,e,r),i=BV(t,e))}}}function Swe(e,t,n){return e.length>=t?e:(n||=new e.constructor(t),n.set(e),n)}function BV(e,t,n){let r=(t<257?GV:t<65537?KV:qV)(e);return n&&r.set(n),r}function VV(e,t,n){let r=1<0)for(f=0;fe,size:()=>n}}function Cwe(e,t){return e.sort.call(t,(t,n)=>{let r=e[t],i=e[n];return ri)}),Koe(e,t)}function wwe(e,t,n,r,i,a,o,s,c){let l=0,u=0,d;for(d=0;l{e_(),eS(),Dg(),GV=e=>new Uint8Array(e),KV=e=>new Uint16Array(e),qV=e=>new Uint32Array(e),UV.Definition={type:`CrossFilter`,metadata:{},params:[{name:`fields`,type:`field`,array:!0,required:!0},{name:`query`,type:`array`,array:!0,required:!0,content:{type:`number`,array:!0,length:2}}]},fg(UV,K,{transform(e,t){return this._dims?e.modified(`fields`)||e.fields.some(e=>t.modified(e.fields))?this.reinit(e,t):this.eval(e,t):this.init(e,t)},init(e,t){let n=e.fields,r=e.query,i=this._indices={},a=this._dims=[],o=r.length,s=0,c,l;for(;s{let e=i.remove(t,n);for(let t in r)r[t].reindex(e)})},update(e,t,n){let r=this._dims,i=e.query,a=t.stamp,o=r.length,s=0,c,l;for(n.filters=0,l=0;lp)for(g=p,_=Math.min(d,m);g<_;++g)v=c[g],a[v]!==n&&(s[v]=o[v],a[v]=n,r.push(v)),o[v]^=h;if(f>m)for(g=Math.max(d,m),_=f;g<_;++g)v=c[g],a[v]!==n&&(s[v]=o[v],a[v]=n,r.push(v)),o[v]^=h;else if(fu)for(p=u,m=Math.min(c,d);pd)for(p=Math.max(c,d),m=l;ps[e]&n?null:o[e];return a.filter(a.MOD,l),i&i-1?(a.filter(a.ADD,e=>{let t=s[e]&n;return!t&&t^c[e]&n?o[e]:null}),a.filter(a.REM,e=>{let t=s[e]&n;return t&&!(t^(t^c[e]&n))?o[e]:null})):(a.filter(a.ADD,l),a.filter(a.REM,e=>(s[e]&n)===i?o[e]:null)),a.filter(a.SOURCE,e=>l(e._index))}})}));function JV(e){this.type=e}function Ewe(e){switch(e.type){case NH:return e.elements;case PH:case LH:return[e.left,e.right];case FH:return[e.callee].concat(e.arguments);case IH:return[e.test,e.consequent,e.alternate];case RH:return[e.object,e.property];case zH:return e.properties;case jH:return[e.key,e.value];case BH:return[e.argument];case MH:case AH:case kH:default:return[]}}function YV(e,t){if(!e)throw Error(`ASSERT: `+t)}function XV(e){return e>=48&&e<=57}function ZV(e){return`0123456789abcdefABCDEF`.includes(e)}function QV(e){return`01234567`.includes(e)}function Dwe(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e)}function $V(e){return e===10||e===13||e===8232||e===8233}function eH(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&CU.test(String.fromCharCode(e))}function tH(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&wU.test(String.fromCharCode(e))}function nH(){for(;J1114111||e!==`}`)&&hH({},dU,xU),t<=65535?String.fromCharCode(t):(n=(t-65536>>10)+55296,r=(t-65536&1023)+56320,String.fromCharCode(n,r))}function iH(){var e=HH.charCodeAt(J++),t=String.fromCharCode(e);for(e===92&&(HH.charCodeAt(J)!==117&&hH({},dU,xU),++J,e=rH(`u`),(!e||e===`\\`||!eH(e.charCodeAt(0)))&&hH({},dU,xU),t=e);J>>=`)return J+=4,{type:ZH,value:o,start:e,end:J};if(a=o.substr(0,3),a===`>>>`||a===`<<=`||a===`>>=`)return J+=3,{type:ZH,value:a,start:e,end:J};if(i=a.substr(0,2),r===i[1]&&`+-<>&|`.includes(r)||i===`=>`)return J+=2,{type:ZH,value:i,start:e,end:J};if(i===`//`&&hH({},dU,xU),`<>=!+-*%&|^/`.includes(r))return++J,{type:ZH,value:r,start:e,end:J};hH({},dU,xU)}function jwe(e){let t=``;for(;J{if(parseInt(t,16)<=1114111)return`x`;hH({},_U)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,`x`));try{new RegExp(n)}catch{hH({},_U)}try{return new RegExp(e,t)}catch{return null}}function Fwe(){var e=HH[J],t,n,r,i;for(YV(e===`/`,`Regular expression literal must start with a slash`),t=HH[J++],n=!1,r=!1;J=0&&hH({},_U,n),{value:n,literal:t}}function Lwe(){var e,t,n,r;return WH=null,nH(),e=J,t=Fwe(),n=Iwe(),r=Pwe(t.value,n.value),{literal:t.literal+n.literal,value:r,regex:{pattern:t.value,flags:n.value},start:e,end:J}}function Rwe(e){return e.type===qH||e.type===JH||e.type===GH||e.type===YH}function sH(){if(nH(),J>=UH)return{type:KH,start:J,end:J};let e=HH.charCodeAt(J);return eH(e)?Awe():e===40||e===41||e===59?aH():e===39||e===34?Nwe():e===46?XV(HH.charCodeAt(J+1))?oH():aH():XV(e)?oH():aH()}function cH(){let e=WH;return J=e.end,WH=sH(),J=e.end,e}function lH(){let e=J;WH=sH(),J=e}function zwe(e){let t=new JV(eU);return t.elements=e,t}function uH(e,t,n){let r=new JV(e===`||`||e===`&&`?oU:tU);return r.operator=e,r.left=t,r.right=n,r}function Bwe(e,t){let n=new JV(nU);return n.callee=e,n.arguments=t,n}function Vwe(e,t,n){let r=new JV(rU);return r.test=e,r.consequent=t,r.alternate=n,r}function dH(e){let t=new JV(iU);return t.name=e,t}function fH(e){let t=new JV(aU);return t.value=e.value,t.raw=HH.slice(e.start,e.end),e.regex&&(t.raw===`//`&&(t.raw=`/(?:)/`),t.regex=e.regex),t}function pH(e,t,n){let r=new JV(sU);return r.computed=e===`[`,r.object=t,r.property=n,r.computed||(n.member=!0),r}function Hwe(e){let t=new JV(cU);return t.properties=e,t}function mH(e,t,n){let r=new JV(lU);return r.key=t,r.value=n,r.kind=e,r}function Uwe(e,t){let n=new JV(uU);return n.operator=e,n.argument=t,n.prefix=!0,n}function hH(e,t){var n,r=Array.prototype.slice.call(arguments,2),i=t.replace(/%(\d)/g,(e,t)=>(YV(t`:case`<=`:case`>=`:case`instanceof`:case`in`:t=7;break;case`<<`:case`>>`:case`>>>`:t=8;break;case`+`:case`-`:t=9;break;case`*`:case`/`:case`%`:t=11;break}return t}function eTe(){var e=WH,t,n,r,i,a,o,s,c=SH(),l;if(r=WH,i=CH(r),i===0)return c;for(r.prec=i,cH(),t=[e,WH],o=SH(),a=[c,r,o];(i=CH(WH))>0;){for(;a.length>2&&i<=a[a.length-2].prec;)o=a.pop(),s=a.pop().value,c=a.pop(),t.pop(),n=uH(s,c,o),a.push(n);r=cH(),r.prec=i,a.push(r),t.push(WH),n=SH(),a.push(n)}for(l=a.length-1,n=a[l],t.pop();l>1;)t.pop(),n=uH(a[l-1].value,a[l-2],n),l-=2;return n}function wH(){var e=eTe(),t,n;return vH(`?`)&&(cH(),t=wH(),_H(`:`),n=wH(),e=Vwe(e,t,n)),e}function TH(){let e=wH();if(vH(`,`))throw Error(SU);return e}function EH(e){HH=e,J=0,UH=HH.length,WH=null,lH();let t=TH();if(WH.type!==KH)throw Error(`Unexpect token after expression.`);return t}function DH(e){function t(t,n,r,i){let a=e(n[0]);return r&&(a=r+`(`+a+`)`,r.lastIndexOf(`new `,0)===0&&(a=`(`+a+`)`)),a+`.`+t+(i<0?``:i===0?`()`:`(`+n.slice(1).map(e).join(`,`)+`)`)}function n(e,n,r){return i=>t(e,i,n,r)}let r=`new Date`,i=`String`,a=`RegExp`;return{isNaN:`Number.isNaN`,isFinite:`Number.isFinite`,abs:`Math.abs`,acos:`Math.acos`,asin:`Math.asin`,atan:`Math.atan`,atan2:`Math.atan2`,ceil:`Math.ceil`,cos:`Math.cos`,exp:`Math.exp`,floor:`Math.floor`,hypot:`Math.hypot`,log:`Math.log`,max:`Math.max`,min:`Math.min`,pow:`Math.pow`,random:`Math.random`,round:`Math.round`,sin:`Math.sin`,sqrt:`Math.sqrt`,tan:`Math.tan`,clamp:function(t){t.length<3&&U(`Missing arguments to clamp function.`),t.length>3&&U(`Too many arguments to clamp function.`);let n=t.map(e);return`Math.max(`+n[1]+`, Math.min(`+n[2]+`,`+n[0]+`))`},now:`Date.now`,utc:`Date.UTC`,datetime:r,date:n(`getDate`,r,0),day:n(`getDay`,r,0),year:n(`getFullYear`,r,0),month:n(`getMonth`,r,0),hours:n(`getHours`,r,0),minutes:n(`getMinutes`,r,0),seconds:n(`getSeconds`,r,0),milliseconds:n(`getMilliseconds`,r,0),time:n(`getTime`,r,0),timezoneoffset:n(`getTimezoneOffset`,r,0),utcdate:n(`getUTCDate`,r,0),utcday:n(`getUTCDay`,r,0),utcyear:n(`getUTCFullYear`,r,0),utcmonth:n(`getUTCMonth`,r,0),utchours:n(`getUTCHours`,r,0),utcminutes:n(`getUTCMinutes`,r,0),utcseconds:n(`getUTCSeconds`,r,0),utcmilliseconds:n(`getUTCMilliseconds`,r,0),length:n(`length`,null,-1),parseFloat:`parseFloat`,parseInt:`parseInt`,upper:n(`toUpperCase`,i,0),lower:n(`toLowerCase`,i,0),substring:n(`substring`,i),split:n(`split`,i),trim:n(`trim`,i,0),btoa:`btoa`,atob:`atob`,encodeURIComponent:`encodeURIComponent`,regexp:a,test:n(`test`,a),if:function(t){t.length<3&&U(`Missing arguments to if function.`),t.length>3&&U(`Too many arguments to if function.`);let n=t.map(e);return`(`+n[0]+`?`+n[1]+`:`+n[2]+`)`}}}function tTe(e){let t=e&&e.length-1;return t&&(e[0]===`"`&&e[t]===`"`||e[0]===`'`&&e[t]===`'`)?e.slice(1,-1):e}function OH(e){e||={};let t=e.allowed?Tg(e.allowed):{},n=e.forbidden?Tg(e.forbidden):{},r=e.constants||DU,i=(e.functions||DH)(d),a=e.globalvar,o=e.fieldvar,s=eg(a)?a:e=>`${a}["${e}"]`,c={},l={},u=0;function d(e){if(vg(e))return e;let t=f[e.type];return t??U(`Unsupported type: `+e.type),t(e)}let f={Literal:e=>e.raw,Identifier:e=>{let i=e.name;return u>0?i:cg(n,i)?U(`Illegal identifier: `+i):cg(r,i)?r[i]:cg(t,i)?i:(c[i]=1,s(i))},MemberExpression:e=>{let t=!e.computed,n=d(e.object);t&&(u+=1);let r=d(e.property);return n===o&&(l[tTe(r)]=1),t&&--u,n+(t?`.`+r:`[`+r+`]`)},CallExpression:e=>{e.callee.type!==`Identifier`&&U(`Illegal callee type: `+e.callee.type);let t=e.callee.name,n=e.arguments,r=cg(i,t)&&i[t];return r||U(`Unrecognized function: `+t),eg(r)?r(n):r+`(`+n.map(d).join(`,`)+`)`},ArrayExpression:e=>`[`+e.elements.map(d).join(`,`)+`]`,BinaryExpression:e=>`(`+d(e.left)+` `+e.operator+` `+d(e.right)+`)`,UnaryExpression:e=>`(`+e.operator+d(e.argument)+`)`,ConditionalExpression:e=>`(`+d(e.test)+`?`+d(e.consequent)+`:`+d(e.alternate)+`)`,LogicalExpression:e=>`(`+d(e.left)+e.operator+d(e.right)+`)`,ObjectExpression:e=>{for(let t of e.properties){let e=t.key.name;Oh.has(e)&&U(`Illegal property: `+e)}return`{`+e.properties.map(d).join(`,`)+`}`},Property:e=>{u+=1;let t=d(e.key);return--u,t+`:`+d(e.value)}};function p(e){let t={code:d(e),globals:Object.keys(c),fields:Object.keys(l)};return c={},l={},t}return p.functions=i,p.constants=r,p}var kH,AH,jH,MH,NH,PH,FH,IH,LH,RH,zH,BH,VH,HH,J,UH,WH,GH,KH,qH,JH,YH,XH,ZH,QH,$H,eU,tU,nU,rU,iU,aU,oU,sU,cU,lU,uU,dU,fU,pU,mU,hU,gU,_U,vU,yU,bU,xU,SU,CU,wU,TU,EU,DU,OU=o((()=>{Dg(),kH=`RawCode`,AH=`Literal`,jH=`Property`,MH=`Identifier`,NH=`ArrayExpression`,PH=`BinaryExpression`,FH=`CallExpression`,IH=`ConditionalExpression`,LH=`LogicalExpression`,RH=`MemberExpression`,zH=`ObjectExpression`,BH=`UnaryExpression`,JV.prototype.visit=function(e){let t,n,r;if(e(this))return 1;for(t=Ewe(this),n=0,r=t.length;n`,VH[qH]=`Identifier`,VH[JH]=`Keyword`,VH[YH]=`Null`,VH[XH]=`Numeric`,VH[ZH]=`Punctuator`,VH[QH]=`String`,VH[$H]=`RegularExpression`,eU=`ArrayExpression`,tU=`BinaryExpression`,nU=`CallExpression`,rU=`ConditionalExpression`,iU=`Identifier`,aU=`Literal`,oU=`LogicalExpression`,sU=`MemberExpression`,cU=`ObjectExpression`,lU=`Property`,uU=`UnaryExpression`,dU=`Unexpected token %0`,fU=`Unexpected number`,pU=`Unexpected string`,mU=`Unexpected identifier`,hU=`Unexpected reserved word`,gU=`Unexpected end of input`,_U=`Invalid regular expression`,vU=`Invalid regular expression: missing /`,yU=`Octal literals are not allowed in strict mode.`,bU=`Duplicate data property in object literal not allowed in strict mode`,xU=`ILLEGAL`,SU=`Disabled.`,CU=RegExp(`[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]`),wU=RegExp(`[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]`),TU={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1},EU={if:1},DU={NaN:`NaN`,E:`Math.E`,LN2:`Math.LN2`,LN10:`Math.LN10`,LOG2E:`Math.LOG2E`,LOG10E:`Math.LOG10E`,PI:`Math.PI`,SQRT1_2:`Math.SQRT1_2`,SQRT2:`Math.SQRT2`,MIN_VALUE:`Number.MIN_VALUE`,MAX_VALUE:`Number.MAX_VALUE`}}));function kU(e){return(!e.getter||!e.getter[MU])&&(e.getter=bh(e.field),e.getter[MU]=!0),e.getter}function AU(e,t){for(var n=t.fields,r=t.values,i=n.length,a=0,o,s;a=r[a])return!1}else if(s.type===qU){if(o>r[a])return!1}else if(s.type===JU){if(o<=r[a])return!1}else if(s.type===YU){if(oog(t.fields?{values:t.fields.map(t=>kU(t)(e.datum))}:{[zU]:BU(e.datum)},t))}function aTe(e,t,n,r){for(var i=this.context.data[e],a=i?i.values.value:[],o={},s={},c={},l,u,d,f,p,m,h,g,_,v,y=a.length,b=0,x,S;b(e[u[n].field]=t,e),{})))}else p=zU,m=BU(l),h=o[p]||(o[p]={}),g=h[f]||(h[f]=[]),g.push(m),n&&(g=s[f]||(s[f]=[]),g.push({[zU]:m}));if(t||=PU,o[zU]?o[zU]=nW[`${zU}_${t}`](...Object.values(o[zU])):Object.keys(o).forEach(e=>{o[e]=Object.keys(o[e]).map(t=>o[e][t]).reduce((n,r)=>n===void 0?r:nW[`${c[e]}_${t}`](n,r))}),a=Object.keys(s),n&&a.length){let e=r?IU:FU;o[e]=t===PU?{[LU]:a.reduce((e,t)=>(e.push(...s[t]),e),[])}:{[RU]:a.map(e=>({[LU]:s[e]}))}}return o}function jU(e,t,n,r){t[0].type!==`Literal`&&U(`First argument to selection functions must be a string literal.`);let i=t[0].value,a=t.length>=2&&Ih(t).value,o=`@unit`,s=rW+i;a===NU&&!cg(r,o)&&(r[o]=n.getData(i).indataRef(n,`unit`)),cg(r,s)||(r[s]=n.getData(i).tuplesRef())}var MU,NU,PU,FU,IU,LU,RU,zU,BU,VU,HU,UU,WU,GU,KU,qU,JU,YU,XU,ZU,QU,$U,eW,tW,nW,rW,oTe=o((()=>{e_(),Dg(),OU(),MU=Symbol(`vega_selection_getter`),NU=`intersect`,PU=`union`,FU=`vlMulti`,IU=`vlPoint`,LU=`or`,RU=`and`,zU=`_vgsid_`,BU=bh(zU),VU=`E`,HU=`R`,UU=`R-E`,WU=`R-LE`,GU=`R-RE`,KU=`E-LT`,qU=`E-LTE`,JU=`E-GT`,YU=`E-GTE`,XU=`E-VALID`,ZU=`E-ONE`,QU=`index:unit`,$U=Ig(BU),eW=$U.left,tW=$U.right,nW={[`${zU}_union`]:bse,[`${zU}_intersect`]:_se,E_union:function(e,t){if(!e.length)return t;for(var n=0,r=t.length;nt.includes(e)):t},R_union:function(e,t){var n=Rh(t[0]),r=Rh(t[1]);return n>r&&(n=t[1],r=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]r&&(n=t[1],r=t[0]),e.length?rr&&(e[1]=r),e):[n,r]}},rW=`:`}));function iW(e){let t=this.context.data[e];return t?t.values.value:[]}function sTe(e,t,n){let r=this.context.data[e][`index:`+t],i=r?r.value.get(n):void 0;return i&&i.count}function cTe(e,t){let n=this.context.dataflow,r=this.context.data[e].input;return n.pulse(r,n.changeset().remove(Eh).insert(t)),1}function lTe(e,t,n){if(e){let n=this.context.dataflow,r=e.mark.source;n.pulse(r,n.changeset().encode(e,t))}return n===void 0?e:n}function aW(e,t,n){return!Number.isInteger(e)||!Number.isInteger(t)?``:(kW.setYear(2e3),kW.setMonth(e),kW.setDate(t),TW.call(this,kW,n))}function uTe(e){return aW.call(this,e,1,`%B`)}function dTe(e){return aW.call(this,e,1,`%b`)}function fTe(e){return aW.call(this,0,2+e,`%A`)}function pTe(e){return aW.call(this,0,2+e,`%a`)}function oW(e,t,n,r){t[0].type!==`Literal`&&U(`First argument to data functions must be a string literal.`);let i=t[0].value,a=`:`+i;if(!cg(a,r))try{r[a]=n.getData(i).tuplesRef()}catch{}}function mTe(e,t,n,r){t[0].type!==`Literal`&&U(`First argument to indata must be a string literal.`),t[1].type!==`Literal`&&U(`Second argument to indata must be a string literal.`);let i=t[0].value,a=t[1].value,o=`@`+a;cg(o,r)||(r[o]=n.getData(i).indataRef(n,a))}function sW(e,t,n,r){if(t[0].type===`Literal`)cW(n,r,t[0].value);else for(e in n.scales)cW(n,r,e)}function cW(e,t,n){let r=`%`+n;if(!cg(t,r))try{t[r]=e.scaleRef(n)}catch{}}function lW(e,t){if(vg(e)){let n=t.scales[e];return n&&Wpe(n.value)?n.value:void 0}else if(eg(e))return Wpe(e)?e:void 0}function hTe(e,t,n){t.__bandwidth=e=>e&&e.bandwidth?e.bandwidth():0,n._bandwidth=sW,n._range=sW,n._scale=sW;let r=t=>`_[`+(t.type===`Literal`?G(`%`+t.value):G(`%`)+`+`+e(t))+`]`;return{_bandwidth:e=>`this.__bandwidth(${r(e[0])})`,_range:e=>`${r(e[0])}.range()`,_scale:t=>`${r(t[0])}(${e(t[1])})`}}function uW(e,t){return function(n,r,i){if(n){let t=lW(n,(i||this).context);return t&&t.path[e](r)}else return t(r)}}function gTe(e,t){let n=lW(e,(t||this).context);return n&&n.scale()}function _Te(e){let t=this.context.group,n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n}function dW(e,t,n){try{e[t].apply(e,[`EXPRESSION`].concat([].slice.call(n)))}catch(t){e.warn(t)}return n[n.length-1]}function vTe(){return dW(this.context.dataflow,`warn`,arguments)}function yTe(){return dW(this.context.dataflow,`info`,arguments)}function bTe(){return dW(this.context.dataflow,`debug`,arguments)}function fW(e){let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function pW(e){let t=QT(e),n=fW(t.r),r=fW(t.g),i=fW(t.b);return .2126*n+.7152*r+.0722*i}function xTe(e,t){let n=pW(e),r=pW(t),i=Math.max(n,r),a=Math.min(n,r);return(i+.05)/(a+.05)}function STe(){let e=[].slice.call(arguments);return e.unshift({}),og(...e)}function mW(e,t){return e===t||e!==e&&t!==t?!0:W(e)?W(t)&&e.length===t.length?CTe(e,t):!1:jh(e)&&jh(t)?hW(e,t):!1}function CTe(e,t){for(let n=0,r=e.length;nhW(e,t)}function wTe(e,t,n,r,i,a){let o=this.context.dataflow,s=this.context.data[e],c=s.input,l=o.stamp(),u=s.changes,d,f;if(o._trigger===!1||!(c.value.length||t||r))return 0;if((!u||u.stamp{s.modified=!0,o.pulse(c,u).run()},!0,1)),n&&(d=n===!0?Eh:W(n)||ax(n)?n:gW(n),u.remove(d)),t&&u.insert(t),r&&(d=gW(r),c.value.some(d)?u.remove(d):u.insert(r)),i){if(eg(i))throw Error(`modify parameter must be a data tuple, not a function`);for(f in a)u.modify(i,f,a[f])}return 1}function TTe(e){let t=e.touches,n=t[0].clientX-t[1].clientX,r=t[0].clientY-t[1].clientY;return Math.hypot(n,r)}function ETe(e){let t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)}function DTe(e,t){let n=NW[t]||(NW[t]=bh(t));return W(e)?e.map(n):n(e)}function _W(e){return W(e)||ArrayBuffer.isView(e)?e:null}function vW(e){return _W(e)||(vg(e)?e:null)}function OTe(e,...t){return _W(e).join(...t)}function kTe(e,...t){return vW(e).indexOf(...t)}function ATe(e,...t){return vW(e).lastIndexOf(...t)}function jTe(e,...t){return vW(e).slice(...t)}function MTe(e,t,n){return eg(n)&&U(`Function argument passed to replace.`),!vg(t)&&!_g(t)&&U(`Please pass a string or RegExp argument to replace.`),String(e).replace(t,n)}function NTe(e){return _W(e).slice().reverse()}function PTe(e){return _W(e).slice().sort(rg)}function FTe(e,t,n){return HD(e||0,t||0,n||0)}function ITe(e,t){let n=lW(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0}function LTe(e,t){let n=lW(e,(t||this).context);return n?n.copy():void 0}function RTe(e,t){let n=lW(e,(t||this).context);return n?n.domain():[]}function zTe(e,t,n){let r=lW(e,(n||this).context);return r?W(t)?(r.invertRange||r.invert)(t):(r.invert||r.invertExtent)(t):void 0}function BTe(e,t){let n=lW(e,(t||this).context);return n&&n.range?n.range():[]}function VTe(e,t,n){let r=lW(e,(n||this).context);return r?r(t):void 0}function HTe(e,t,n,r,i){e=lW(e,(i||this).context);let a=Nme(t,n),o=e.domain(),s=o[0],c=Ih(o),l=Ch;return c-s?l=Qpe(e,s,c):e=(e.interpolator?WD(`sequential`)().interpolator(e.interpolator()):WD(`linear`)().interpolate(e.interpolate()).range(e.range())).domain([s=0,c=1]),e.ticks&&(o=e.ticks(+r||15),s!==o[0]&&o.unshift(s),c!==Ih(o)&&o.push(c)),o.forEach(t=>a.stop(l(t),e(t))),a}function UTe(e,t,n){let r=lW(e,(n||this).context);return function(e){return r?r.path.context(e)(t):``}}function WTe(e){let t=null;return function(n){return n?EO(n,t||=TO(e)):e}}function yW(e,t){let n=iW.call(t,e);return n.root&&n.root.lookup||{}}function GTe(e,t,n){let r=yW(e,this),i=r[t],a=r[n];return i&&a?i.path(a).map(PW):void 0}function KTe(e,t){let n=yW(e,this)[t];return n?n.ancestors().map(PW):void 0}function qTe(){let e=FW();return e?e.screen:{}}function JTe(){let e=FW();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]}function YTe(){let e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]}function bW(e,t,n){if(!e)return[];let[r,i]=e,a=new NO().set(r[0],r[1],i[0],i[1]);return Rge(n||this.context.dataflow.scenegraph().root,a,XTe(t))}function XTe(e){let t=null;if(e){let n=Qh(e.marktype),r=Qh(e.markname);t=e=>(!n.length||n.some(t=>e.marktype===t))&&(!r.length||r.some(t=>e.name===t))}return t}function ZTe(e,t,n,r=5){e=Qh(e);let i=e[e.length-1];return i===void 0||Math.hypot(i[0]-t,i[1]-n)>r?[...e,[t,n]]:e}function QTe(e){return Qh(e).reduce((t,[n,r],i)=>t+=i==0?`M ${n},${r} `:i===e.length-1?` Z`:`L ${n},${r} `,``)}function $Te(e,t,n){let{x:r,y:i,mark:a}=n,o=new NO().set(2**53-1,2**53-1,-(2**53-1),-(2**53-1));for(let[e,n]of t)eo.x2&&(o.x2=e),no.y2&&(o.y2=n);return o.translate(r,i),bW([[o.x1,o.y1],[o.x2,o.y2]],e,a).filter(e=>eEe(e.x,e.y,t))}function eEe(e,t,n){let r=0;for(let i=0,a=n.length-1;it!=s>t&&e<(o-c)*(t-l)/(s-l)+c&&r++}return r&1}function tEe(e){let t=DH(e);LW.forEach(e=>t[e]=RW+e);for(let e in IW)t[e]=zW+e;return og(t,hTe(e,IW,BW)),t}function xW(e,t,n){return arguments.length===1?IW[e]:(IW[e]=t,n&&(BW[e]=n),HW&&(HW.functions[e]=zW+e),this)}function SW(e,t){let n={},r;try{e=vg(e)?e:G(e)+``,r=EH(e)}catch{U(`Expression parse error: `+e)}r.visit(e=>{if(e.type!==`CallExpression`)return;let r=e.callee.name,i=VW.visitors[r];i&&i(r,e.arguments,t,n)});let i=HW(r);return i.globals.forEach(e=>{let r=`$`+e;!cg(n,r)&&t.getSignal(e)&&(n[r]=t.signalRef(e))}),{$expr:og({code:i.code},t.options.ast?{ast:r}:null),$fields:i.fields,$params:n}}var CW,wW,TW,EW,DW,OW,kW,AW,jW,MW,NW,PW,FW,IW,LW,RW,zW,BW,VW,HW,UW=o((()=>{Dg(),OU(),xO(),FL(),YE(),eS(),zj(),oTe(),GS(),Ry(),e_(),CW=e=>function(t,n){let r=this.context.dataflow.locale();return t===null?`null`:r[e](n)(t)},wW=CW(`format`),TW=CW(`timeFormat`),EW=CW(`utcFormat`),DW=CW(`timeParse`),OW=CW(`utcParse`),kW=new Date(2e3,0,1),AW=uW(`area`,Lve),jW=uW(`bounds`,Vve),MW=uW(`centroid`,Jve),NW={},PW=e=>e.data,FW=()=>typeof window<`u`&&window||null,IW={random(){return RS()},cumulativeNormal:uS,cumulativeLogNormal:gS,cumulativeUniform:SS,densityNormal:lS,densityLogNormal:hS,densityUniform:xS,quantileNormal:dS,quantileLogNormal:_S,quantileUniform:CS,sampleNormal:cS,sampleLogNormal:mS,sampleUniform:bS,isArray:W,isBoolean:mg,isDate:hg,isDefined(e){return e!==void 0},isNumber:gg,isObject:jh,isRegExp:_g,isString:vg,isTuple:ax,isValid(e){return e!=null&&e===e},toBoolean:Sg,toDate(e){return Cg(e)},toNumber:Rh,toString:wg,indexof:kTe,join:OTe,lastindexof:ATe,replace:MTe,reverse:NTe,sort:PTe,slice:jTe,flush:Eae,lerp:Rae,merge:STe,pad:qae,peek:Ih,pluck:DTe,span:xg,inrange:pg,truncate:noe,rgb:QT,lab:wE,hcl:AE,hsl:sE,luminance:pW,contrast:xTe,sequence:$g,format:wW,utcFormat:EW,utcParse:OW,utcOffset:qv,utcSequence:Xv,timeFormat:TW,timeParse:DW,timeOffset:Kv,timeSequence:Yv,timeUnitSpecifier:Dv,monthFormat:uTe,monthAbbrevFormat:dTe,dayFormat:fTe,dayAbbrevFormat:pTe,quarter:lae,utcquarter:uae,week:Av,utcweek:Fv,dayofyear:kv,utcdayofyear:Pv,warn:vTe,info:yTe,debug:bTe,extent(e){return sg(e)},inScope:_Te,intersect:bW,clampRange:fae,pinchDistance:TTe,pinchAngle:ETe,screen:qTe,containerSize:YTe,windowSize:JTe,bandspace:FTe,setdata:cTe,pathShape:WTe,panLinear:iae,panLog:aae,panPow:oae,panSymlog:sae,zoomLinear:Vh,zoomLog:Hh,zoomPow:Uh,zoomSymlog:Wh,encode:lTe,modify:wTe,lassoAppend:ZTe,lassoPath:QTe,intersectLasso:$Te},LW=[`view`,`item`,`group`,`xy`,`x`,`y`],RW=`event.vega.`,zW=`this.`,BW={},VW={forbidden:[`_`],allowed:[`datum`,`event`,`item`],fieldvar:`datum`,globalvar:e=>`_[${G(`$`+e)}]`,functions:tEe,constants:DU,visitors:BW},HW=OH(VW),xW(`bandwidth`,ITe,sW),xW(`copy`,LTe,sW),xW(`domain`,RTe,sW),xW(`range`,BTe,sW),xW(`invert`,zTe,sW),xW(`scale`,VTe,sW),xW(`gradient`,HTe,sW),xW(`geoArea`,AW,sW),xW(`geoBounds`,jW,sW),xW(`geoCentroid`,MW,sW),xW(`geoShape`,UTe,sW),xW(`geoScale`,gTe,sW),xW(`indata`,sTe,mTe),xW(`data`,iW,oW),xW(`treePath`,GTe,oW),xW(`treeAncestors`,KTe,oW),xW(`vlSelectionTest`,nTe,jU),xW(`vlSelectionIdTest`,rTe,jU),xW(`vlSelectionResolve`,aTe,jU),xW(`vlSelectionTuples`,iTe)}));function nEe(e){let t=this,n=e.operators||[];return e.background&&(t.background=e.background),e.eventConfig&&(t.eventConfig=e.eventConfig),e.locale&&(t.locale=e.locale),n.forEach(e=>t.parseOperator(e)),n.forEach(e=>t.parseOperatorParameters(e)),(e.streams||[]).forEach(e=>t.parseStream(e)),(e.updates||[]).forEach(e=>t.parseUpdate(e)),t.resolve()}function rEe(e,t){let n=``;return XW[t]?n:(e.x2&&(e.x?(ZW[t]&&(n+=`if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;`),n+=`o.width=o.x2-o.x;`):n+=`o.x=o.x2-(o.width||0);`),e.xc&&(n+=`o.x=o.xc-(o.width||0)/2;`),e.y2&&(e.y?(ZW[t]&&(n+=`if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;`),n+=`o.height=o.y2-o.y;`):n+=`o.y=o.y2-(o.height||0);`),e.yc&&(n+=`o.y=o.yc-(o.height||0)/2;`),n)}function WW(e){return(e+``).toLowerCase()}function iEe(e){return WW(e)===`operator`}function aEe(e){return WW(e)===`collect`}function GW(e,t,n){n.endsWith(`;`)||(n=`return(`+n+`);`);let r=Function(...t.concat(n));return e&&e.functions?r.bind(e.functions):r}function oEe(e,t,n,r){return`((u = ${e}) < (v = ${t}) || u == null) && v != null ? ${n} +`)}function l(t){return t.map(u).join(e)}function u(e){return e==null?``:e instanceof Date?uoe(e):t.test(e+=``)?`"`+e.replace(/"/g,`""`)+`"`:e}return{parse:r,parseRows:i,format:o,formatBody:s,formatRows:c,formatRow:l,formatValue:u}}var kg,Ag,jg,Mg,Ng,foe=o((()=>{kg={},Ag={},jg=34,Mg=10,Ng=13})),poe=o((()=>{foe()}));function moe(e){return e}var hoe=o((()=>{}));function goe(e){if(e==null)return moe;var t,n,r=e.scale[0],i=e.scale[1],a=e.translate[0],o=e.translate[1];return function(e,s){s||(t=n=0);var c=2,l=e.length,u=Array(l);for(u[0]=(t+=e[0])*r+a,u[1]=(n+=e[1])*i+o;c{hoe()}));function voe(e,t){for(var n,r=e.length,i=r-t;i<--r;)n=e[i],e[i++]=e[r],e[r]=n}var yoe=o((()=>{}));function boe(e,t){return typeof t==`string`&&(t=e.objects[t]),t.type===`GeometryCollection`?{type:`FeatureCollection`,features:t.geometries.map(function(t){return xoe(e,t)})}:xoe(e,t)}function xoe(e,t){var n=t.id,r=t.bbox,i=t.properties==null?{}:t.properties,a=Soe(e,t);return n==null&&r==null?{type:`Feature`,properties:i,geometry:a}:r==null?{type:`Feature`,id:n,properties:i,geometry:a}:{type:`Feature`,id:n,bbox:r,properties:i,geometry:a}}function Soe(e,t){var n=goe(e.transform),r=e.arcs;function i(e,t){t.length&&t.pop();for(var i=r[e<0?~e:e],a=0,o=i.length;a{yoe(),_oe()}));function woe(e,t){var n={},r={},i={},a=[],o=-1;t.forEach(function(n,r){var i=e.arcs[n<0?~n:n],a;i.length<3&&!i[1][0]&&!i[1][1]&&(a=t[++o],t[o]=n,t[r]=a)}),t.forEach(function(e){var t=s(e),n=t[0],a=t[1],o,c;if(o=i[n])if(delete i[o.end],o.push(e),o.end=a,c=r[a]){delete r[c.start];var l=c===o?o:o.concat(c);r[l.start=o.start]=i[l.end=c.end]=l}else r[o.start]=i[o.end]=o;else if(o=r[a])if(delete r[o.start],o.unshift(e),o.start=n,c=i[n]){delete i[c.end];var u=c===o?o:c.concat(o);r[u.start=c.start]=i[u.end=o.end]=u}else r[o.start]=i[o.end]=o;else o=[e],r[o.start=n]=i[o.end=a]=o});function s(t){var n=e.arcs[t<0?~t:t],r=n[0],i;return e.transform?(i=[0,0],n.forEach(function(e){i[0]+=e[0],i[1]+=e[1]})):i=n[n.length-1],t<0?[i,r]:[r,i]}function c(e,t){for(var r in e){var i=e[r];delete t[i.start],delete i.start,delete i.end,i.forEach(function(e){n[e<0?~e:e]=1}),a.push(i)}}return c(i,r),c(r,i),t.forEach(function(e){n[e<0?~e:e]||a.push([e])}),a}var Toe=o((()=>{}));function Eoe(e){return Soe(e,Doe.apply(this,arguments))}function Doe(e,t,n){var r,i,a;if(arguments.length>1)r=Ooe(e,t,n);else for(i=0,r=Array(a=e.arcs.length);i{Coe(),Toe()})),Aoe=o((()=>{_oe(),Coe(),koe(),Toe(),hoe()}));function Pg(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}var Fg=o((()=>{}));function joe(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}var Moe=o((()=>{}));function Ig(e){let t,n,r;e.length===2?(t=e===Pg||e===joe?e:Noe,n=e,r=e):(t=Pg,n=(t,n)=>Pg(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i>>1;n(e[t],r)<0?i=t+1:a=t}while(i>>1;n(e[t],r)<=0?i=t+1:a=t}while(in&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function Noe(){return 0}var Poe=o((()=>{Fg(),Moe()}));function Foe(e){return e===null?NaN:+e}function*Ioe(e,t){if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(yield t);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var Loe=o((()=>{})),Lg,Rg,zg,Roe=o((()=>{Fg(),Poe(),Loe(),Lg=Ig(Pg),Rg=Lg.right,zg=Lg.left,Ig(Foe).center}));function zoe(e,t){let n=0,r,i=0,a=0;if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(r=t-i,i+=r/++n,a+=r*(t-i));else{let o=-1;for(let s of e)(s=t(s,++o,e))!=null&&(s=+s)>=s&&(r=s-i,i+=r/++n,a+=r*(s-i))}if(n>1)return a/(n-1)}var Boe=o((()=>{}));function Voe(e,t){let n=zoe(e,t);return n&&Math.sqrt(n)}var Hoe=o((()=>{Boe()})),Bg,Uoe=o((()=>{Bg=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){let t=this._partials,n=0;for(let r=0;r0){for(a=e[--t];t>0&&(n=a,r=e[--t],a=n+r,i=r-(a-n),!i););t>0&&(i<0&&e[t-1]<0||i>0&&e[t-1]>0)&&(r=i*2,n=a+r,r==n-a&&(a=n))}return a}}}));function Vg({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function Woe({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function Goe({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function Koe(e){return typeof e==`object`&&e?e.valueOf():e}var Hg,Ug,Wg=o((()=>{Hg=class extends Map{constructor(e,t=Koe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(Vg(this,e))}has(e){return super.has(Vg(this,e))}set(e,t){return super.set(Woe(this,e),t)}delete(e){return super.delete(Goe(this,e))}},Ug=class extends Set{constructor(e,t=Koe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let t of e)this.add(t)}has(e){return super.has(Vg(this,e))}add(e){return super.add(Woe(this,e))}delete(e){return super.delete(Goe(this,e))}}}));function qoe(e,t){return Array.from(t,t=>e[t])}var Joe=o((()=>{}));function Yoe(e=Pg){if(e===Pg)return Xoe;if(typeof e!=`function`)throw TypeError(`compare is not a function`);return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function Xoe(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et))}var Zoe=o((()=>{Fg()}));function Gg(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=Qoe?10:a>=$oe?5:a>=ese?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/lt&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*lt&&--c),c0))return[];if(e===t)return[e];let r=t=i))return[];let s=a-i+1,c=Array(s);if(r)if(o<0)for(let e=0;e{Qoe=Math.sqrt(50),$oe=Math.sqrt(10),ese=Math.sqrt(2)}));function Yg(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n=i)&&(n=i)}return n}var nse=o((()=>{}));function Xg(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}var rse=o((()=>{}));function ise(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?Xoe:Yoe(i);r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1),u=Math.max(n,Math.floor(t-o*c/a+l)),d=Math.min(r,Math.floor(t+(a-o)*c/a+l));ise(e,t,u,d,i)}let a=e[t],o=n,s=r;for(Zg(e,n,t),i(e[r],a)>0&&Zg(e,n,r);o0;)--s}i(e[n],a)===0?Zg(e,n,s):(++s,Zg(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function Zg(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}var ase=o((()=>{Zoe()}));function Qg(e,t,n){if(e=Float64Array.from(Ioe(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return Xg(e);if(t>=1)return Yg(e);var r,i=(r-1)*t,a=Math.floor(i),o=Yg(ise(e,a).subarray(0,a+1));return o+(Xg(e.subarray(a+1))-o)*(i-a)}}function ose(e,t,n=Foe){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(+n(e[a+1],a+1,e)-o)*(i-a)}}var sse=o((()=>{nse(),rse(),ase(),Loe()}));function cse(e,t){let n=0,r=0;if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(++n,r+=t);else{let i=-1;for(let a of e)(a=t(a,++i,e))!=null&&(a=+a)>=a&&(++n,r+=a)}if(n)return r/n}var lse=o((()=>{}));function use(e,t){return Qg(e,.5,t)}var dse=o((()=>{sse()}));function*fse(e){for(let t of e)yield*t}function pse(e){return Array.from(fse(e))}var mse=o((()=>{}));function $g(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r{}));function gse(e,t){let n=0;if(t===void 0)for(let t of e)(t=+t)&&(n+=t);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}var _se=o((()=>{}));function vse(e,...t){e=new Ug(e),t=t.map(yse);out:for(let n of e)for(let r of t)if(!r.has(n)){e.delete(n);continue out}return e}function yse(e){return e instanceof Ug?e:new Ug(e)}var bse=o((()=>{Wg()}));function xse(...e){let t=new Ug;for(let n of e)for(let e of n)t.add(e);return t}var Sse=o((()=>{Wg()})),e_=o((()=>{Roe(),Fg(),Poe(),Moe(),Hoe(),Uoe(),Wg(),Zoe(),tse(),sse(),nse(),lse(),dse(),mse(),rse(),Joe(),ase(),hse(),_se(),Boe(),bse(),Sse()}));function Cse(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function t_(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}var n_=o((()=>{}));function r_(e){return e=t_(Math.abs(e)),e?e[1]:NaN}var i_=o((()=>{n_()}));function wse(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}var Tse=o((()=>{}));function Ese(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var Dse=o((()=>{}));function a_(e){if(!(t=s_.exec(e)))throw Error(`invalid format: `+e);var t;return new o_({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function o_(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}var s_,c_=o((()=>{s_=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i,a_.prototype=o_.prototype,o_.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type}}));function Ose(e){out:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var kse=o((()=>{}));function Ase(e,t){var n=t_(e,t);if(!n)return l_=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(l_=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+t_(e,Math.max(0,t+a-1))[0]}var l_,u_=o((()=>{n_()}));function d_(e,t){var n=t_(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var jse=o((()=>{n_()})),f_,Mse=o((()=>{n_(),u_(),jse(),f_={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:Cse,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>d_(e*100,t),r:d_,s:Ase,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)}}));function p_(e){return e}var Nse=o((()=>{}));function m_(e){var t=e.grouping===void 0||e.thousands===void 0?p_:wse(h_.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?p_:Ese(h_.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=a_(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):f_[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=f_[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=Ose(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&l_!==void 0?g_[8+l_/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++op||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(r_(t)/3)))*3,r=10**-n,i=l((e=a_(e),e.type=`f`,e),{suffix:g_[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var h_,g_,__=o((()=>{i_(),Tse(),Dse(),c_(),kse(),Mse(),u_(),Nse(),h_=Array.prototype.map,g_=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`]}));function Pse(e){return v_=m_(e),y_=v_.format,b_=v_.formatPrefix,v_}var v_,y_,b_,Fse=o((()=>{__(),Pse({thousands:`,`,grouping:[3],currency:[`$`,``]})}));function x_(e){return Math.max(0,-r_(Math.abs(e)))}var Ise=o((()=>{i_()}));function S_(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(r_(t)/3)))*3-r_(Math.abs(e)))}var Lse=o((()=>{i_()}));function C_(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,r_(t)-r_(e))+1}var Rse=o((()=>{i_()})),w_=o((()=>{Fse(),__(),c_(),Ise(),Lse(),Rse()}));function T_(e,t,n,r){function i(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t(t(e=new Date(+e),n==null?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o=[];if(n=i.ceil(n),a=a==null?1:Math.floor(a),!(n0))return o;let s;do o.push(s=new Date(+n)),t(n,a),e(n);while(sT_(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(E_.setTime(+t),D_.setTime(+r),e(E_),e(D_),Math.floor(n(E_,D_))),i.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i)),i}var E_,D_,O_=o((()=>{E_=new Date,D_=new Date})),k_,A_=o((()=>{O_(),k_=T_(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e),k_.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?T_(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):k_),k_.range})),j_,M_,N_,P_,F_,I_,L_,R_=o((()=>{j_=1e3,M_=j_*60,N_=M_*60,P_=N_*24,F_=P_*7,I_=P_*30,L_=P_*365})),z_,B_=o((()=>{O_(),R_(),z_=T_(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*j_)},(e,t)=>(t-e)/j_,e=>e.getUTCSeconds()),z_.range})),V_,H_,U_=o((()=>{O_(),R_(),V_=T_(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*j_)},(e,t)=>{e.setTime(+e+t*M_)},(e,t)=>(t-e)/M_,e=>e.getMinutes()),V_.range,H_=T_(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*M_)},(e,t)=>(t-e)/M_,e=>e.getUTCMinutes()),H_.range})),W_,G_,K_=o((()=>{O_(),R_(),W_=T_(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*j_-e.getMinutes()*M_)},(e,t)=>{e.setTime(+e+t*N_)},(e,t)=>(t-e)/N_,e=>e.getHours()),W_.range,G_=T_(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*N_)},(e,t)=>(t-e)/N_,e=>e.getUTCHours()),G_.range})),q_,J_,Y_,X_=o((()=>{O_(),R_(),q_=T_(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*M_)/P_,e=>e.getDate()-1),q_.range,J_=T_(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/P_,e=>e.getUTCDate()-1),J_.range,Y_=T_(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/P_,e=>Math.floor(e/P_)),Y_.range}));function Z_(e){return T_(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*M_)/F_)}function Q_(e){return T_(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/F_)}var $_,ev,tv,nv,rv,iv,av,ov,sv,cv,lv,uv,dv,fv,pv=o((()=>{O_(),R_(),$_=Z_(0),ev=Z_(1),tv=Z_(2),nv=Z_(3),rv=Z_(4),iv=Z_(5),av=Z_(6),$_.range,ev.range,tv.range,nv.range,rv.range,iv.range,av.range,ov=Q_(0),sv=Q_(1),cv=Q_(2),lv=Q_(3),uv=Q_(4),dv=Q_(5),fv=Q_(6),ov.range,sv.range,cv.range,lv.range,uv.range,dv.range,fv.range})),mv,hv,gv=o((()=>{O_(),mv=T_(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth()),mv.range,hv=T_(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth()),hv.range})),_v,vv,yv=o((()=>{O_(),_v=T_(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear()),_v.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:T_(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),_v.range,vv=T_(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear()),vv.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:T_(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),vv.range}));function bv(e,t,n,r,i,a){let o=[[z_,1,j_],[z_,5,5*j_],[z_,15,15*j_],[z_,30,30*j_],[a,1,M_],[a,5,5*M_],[a,15,15*M_],[a,30,30*M_],[i,1,N_],[i,3,3*N_],[i,6,6*N_],[i,12,12*N_],[r,1,P_],[r,2,2*P_],[n,1,F_],[t,1,I_],[t,3,3*I_],[e,1,L_]];function s(e,t,n){let r=te).right(o,i);if(a===o.length)return e.every(Jg(t/L_,n/L_,r));if(a===0)return k_.every(Math.max(Jg(t,n,r),1));let[s,c]=o[i/o[a-1][2]{e_(),R_(),A_(),B_(),U_(),K_(),X_(),pv(),gv(),yv(),[xv,Sv]=bv(vv,hv,ov,Y_,G_,H_),[Cv,wv]=bv(_v,mv,$_,q_,W_,V_)})),Tv=o((()=>{O_(),A_(),B_(),U_(),K_(),X_(),pv(),gv(),yv(),zse()}));function Ev(e){let t=Qh(e).slice(),n={};return t.length||U(`Missing time unit.`),t.forEach(e=>{cg(uy,e)?n[e]=1:U(`Invalid time unit: ${e}.`)}),(n.week||n.day?1:0)+(n.quarter||n.month||n.date?1:0)+ +!!n.dayofyear>1&&U(`Incompatible time units: ${e}`),t.sort((e,t)=>uy[e]-uy[t]),t}function Dv(e,t){let n=og({},dy,t),r=Ev(e),i=r.length,a=``,o=0,s,c;for(o=0;oo;--s)if(c=r.slice(o,s).join(`-`),n[c]!=null){a+=n[c],o=s;break}return a.trim()}function Ov(e){return fy.setFullYear(e),fy.setMonth(0),fy.setDate(1),fy.setHours(0,0,0,0),fy}function kv(e){return jv(new Date(e))}function Av(e){return Mv(new Date(e))}function jv(e){return q_.count(Ov(e.getFullYear())-1,e)}function Mv(e){return $_.count(Ov(e.getFullYear())-1,e)}function Nv(e){return Ov(e).getDay()}function Bse(e,t,n,r,i,a,o){if(0<=e&&e<100){let s=new Date(-1,t,n,r,i,a,o);return s.setFullYear(e),s}return new Date(e,t,n,r,i,a,o)}function Pv(e){return Iv(new Date(e))}function Fv(e){return Lv(new Date(e))}function Iv(e){let t=Date.UTC(e.getUTCFullYear(),0,1);return J_.count(t-1,e)}function Lv(e){let t=Date.UTC(e.getUTCFullYear(),0,1);return ov.count(t-1,e)}function Rv(e){return fy.setTime(Date.UTC(e,0,1)),fy.getUTCDay()}function Vse(e,t,n,r,i,a,o){if(0<=e&&e<100){let e=new Date(Date.UTC(-1,t,n,r,i,a,o));return e.setUTCFullYear(n.y),e}return new Date(Date.UTC(e,t,n,r,i,a,o))}function zv(e,t,n,r,i){let a=t||1,o=Ih(e),s=(e,t,i)=>(i||=e,Hse(n[i],r[i],e===o&&a,t)),c=new Date,l=Tg(e),u=l.year?s($v):ig(2012),d=l.month?s(ty):l.quarter?s(ey):wh,f=l.week&&l.day?s(`day`,1,`weekday`):l.week?s(ny,1):l.day?s(`day`,1):l.date?s(ry,1):l.dayofyear?s(iy,1):Th,p=l.hours?s(ay):wh,m=l.minutes?s(oy):wh,h=l.seconds?s(sy):wh,g=l.milliseconds?s(cy):wh;return function(e){c.setTime(+e);let t=u(c);return i(t,d(c),f(c,t),p(c),m(c),h(c),g(c))}}function Hse(e,t,n,r){let i=n<=1?e:r?(t,i)=>r+n*Math.floor((e(t,i)-r)/n):(t,r)=>n*Math.floor(e(t,r)/n);return t?(e,n)=>t(i(e,n),n):i}function Bv(e,t,n){return t+e*7-(n+6)%7}function Vv(e,t){return zv(e,t||1,py,my,Bse)}function Hv(e,t){return zv(e,t||1,hy,gy,Vse)}function Uv(e){return _y[e]}function Wv(e){return vy[e]}function Gv(e,t,n){return e?e.offset(t,n):void 0}function Kv(e,t,n){return Gv(Uv(e),t,n)}function qv(e,t,n){return Gv(Wv(e),t,n)}function Jv(e,t,n,r){return e?e.range(t,n,r):void 0}function Yv(e,t,n,r){return Jv(Uv(e),t,n,r)}function Xv(e,t,n,r){return Jv(Wv(e),t,n,r)}function Zv(e){let t=e.extent,n=e.maxbins||40,r=Math.abs(xg(t))/n,i=Ig(e=>e[2]).right(Py,r),a,o;return i===Py.length?(a=Ny,o=Jg(t[0]/Ty,t[1]/Ty,n)):i?(i=Py[r/Py[i-1][2]{let n=t(e),r=new Date(n);return Number.isNaN(+r)&&U(`Invalid date: ${n}`),r}),a=Ly.findIndex(e=>!e.aligned(i,r)),o=Ly.findIndex(e=>!e.skippable&&!e.aligned(i,r)),s=o>a+1?o:a,{units:c,step:l}=Ly[s-1];return{units:c,step:l}}var $v,ey,ty,ny,ry,iy,ay,oy,sy,cy,ly,uy,dy,fy,py,my,hy,gy,_y,vy,yy,by,xy,Sy,Cy,wy,Ty,Ey,Dy,Oy,ky,Ay,jy,My,Ny,Py,Fy,Iy,Ly,Ry=o((()=>{Dg(),Tv(),e_(),$v=`year`,ey=`quarter`,ty=`month`,ny=`week`,ry=`date`,iy=`dayofyear`,ay=`hours`,oy=`minutes`,sy=`seconds`,cy=`milliseconds`,ly=[$v,ey,ty,ny,ry,`day`,iy,ay,oy,sy,cy],uy=ly.reduce((e,t,n)=>(e[t]=1+n,e),{}),dy={[$v]:`%Y `,[ey]:`Q%q `,[ty]:`%b `,[ry]:`%d `,[ny]:`W%U `,day:`%a `,[iy]:`%j `,[ay]:`%H:00`,[oy]:`00:%M`,[sy]:`:%S`,[cy]:`.%L`,[`${$v}-${ty}`]:`%Y-%m `,[`${$v}-${ty}-${ry}`]:`%Y-%m-%d `,[`${ay}-${oy}`]:`%H:%M`},fy=new Date,py={[$v]:e=>e.getFullYear(),[ey]:e=>Math.floor(e.getMonth()/3),[ty]:e=>e.getMonth(),[ry]:e=>e.getDate(),[ay]:e=>e.getHours(),[oy]:e=>e.getMinutes(),[sy]:e=>e.getSeconds(),[cy]:e=>e.getMilliseconds(),[iy]:e=>jv(e),[ny]:e=>Mv(e),weekday:(e,t)=>Bv(Mv(e),e.getDay(),Nv(t)),day:(e,t)=>Bv(1,e.getDay(),Nv(t))},my={[ey]:e=>3*e,[ny]:(e,t)=>Bv(e,0,Nv(t))},hy={[$v]:e=>e.getUTCFullYear(),[ey]:e=>Math.floor(e.getUTCMonth()/3),[ty]:e=>e.getUTCMonth(),[ry]:e=>e.getUTCDate(),[ay]:e=>e.getUTCHours(),[oy]:e=>e.getUTCMinutes(),[sy]:e=>e.getUTCSeconds(),[cy]:e=>e.getUTCMilliseconds(),[iy]:e=>Iv(e),[ny]:e=>Lv(e),day:(e,t)=>Bv(1,e.getUTCDay(),Rv(t)),weekday:(e,t)=>Bv(Lv(e),e.getUTCDay(),Rv(t))},gy={[ey]:e=>3*e,[ny]:(e,t)=>Bv(e,0,Rv(t))},_y={[$v]:_v,[ey]:mv.every(3),[ty]:mv,[ny]:$_,[ry]:q_,day:q_,[iy]:q_,[ay]:W_,[oy]:V_,[sy]:z_,[cy]:k_},vy={[$v]:vv,[ey]:hv.every(3),[ty]:hv,[ny]:ov,[ry]:J_,day:J_,[iy]:J_,[ay]:G_,[oy]:H_,[sy]:z_,[cy]:k_},yy=1e3,by=yy*60,xy=by*60,Sy=xy*24,Cy=Sy*7,wy=Sy*30,Ty=Sy*365,Ey=[$v,ty,ry,ay,oy,sy,cy],Dy=Ey.slice(0,-1),Oy=Dy.slice(0,-1),ky=Oy.slice(0,-1),Ay=ky.slice(0,-1),jy=[$v,ny],My=[$v,ty],Ny=[$v],Py=[[Dy,1,yy],[Dy,5,5*yy],[Dy,15,15*yy],[Dy,30,30*yy],[Oy,1,by],[Oy,5,5*by],[Oy,15,15*by],[Oy,30,30*by],[ky,1,xy],[ky,3,3*xy],[ky,6,6*xy],[ky,12,12*xy],[Ay,1,Sy],[jy,1,Cy],[My,1,wy],[My,3,3*wy],[Ny,1,Ty]],Fy={[$v]:e=>e.getFullYear(),[ty]:e=>e.getMonth(),[ry]:e=>e.getDate(),day:e=>e.getDay(),[ay]:e=>e.getHours(),[oy]:e=>e.getMinutes(),[sy]:e=>e.getSeconds(),[cy]:e=>e.getMilliseconds()},Iy={[$v]:e=>e.getUTCFullYear(),[ty]:e=>e.getUTCMonth(),[ry]:e=>e.getUTCDate(),day:e=>e.getUTCDay(),[ay]:e=>e.getUTCHours(),[oy]:e=>e.getUTCMinutes(),[sy]:e=>e.getUTCSeconds(),[cy]:e=>e.getUTCMilliseconds()},Ly=[{units:[$v,ty,ry,ay,oy,sy,cy],step:1,aligned:()=>!0},{units:[$v,ty,ry,ay,oy,sy],step:1,aligned:(e,t)=>e.every(e=>t[cy](e)===0)},{units:[$v,ty,ry,ay,oy],step:1,aligned:(e,t)=>e.every(e=>t[sy](e)===0)},{units:[$v,ty,ry,ay,oy],step:5,aligned:(e,t)=>e.every(e=>t[oy](e)%5==0)},{units:[$v,ty,ry,ay,oy],step:10,aligned:(e,t)=>e.every(e=>t[oy](e)%10==0)},{units:[$v,ty,ry,ay],step:1,aligned:(e,t)=>e.every(e=>t[oy](e)===0)},{units:[$v,ty,ry],step:1,aligned:(e,t)=>e.every(e=>t[ay](e)===0)},{units:[$v,ny],step:1,skippable:!0,aligned:(e,t)=>new Set(e.map(e=>t.day(e))).size===1},{units:[$v,ty],step:1,aligned:(e,t)=>e.every(e=>t[ry](e)===1)},{units:[$v,ty],step:3,aligned:(e,t)=>e.every(e=>t[ty](e)%3==0)},{units:[$v],step:1,aligned:(e,t)=>e.every(e=>t[ty](e)===0)},{units:[$v],step:10,aligned:(e,t)=>e.every(e=>t[$v](e)%10==0)},{aligned:()=>!1}]}));function zy(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function By(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Vy(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function Hy(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,o=e.shortDays,s=e.months,c=e.shortMonths,l=Wy(i),u=Gy(i),d=Wy(a),f=Gy(a),p=Wy(o),m=Gy(o),h=Wy(s),g=Gy(s),_=Wy(c),v=Gy(c),y={a:N,A:P,b:F,B:ee,c:null,d:Xy,e:Xy,f:lce,g:yce,G:xce,H:oce,I:sce,j:cce,L:Zy,m:uce,M:dce,p:I,q:te,Q:rb,s:ib,S:fce,u:pce,U:mce,V:hce,w:gce,W:_ce,x:null,X:null,y:vce,Y:bce,Z:Sce,"%":nb},b={a:L,A:ne,b:re,B:ie,c:null,d:$y,e:$y,f:Ece,g:Ice,G:Rce,H:Cce,I:wce,j:Tce,L:eb,m:Dce,M:Oce,p:ae,q:oe,Q:rb,s:ib,S:kce,u:Ace,U:jce,V:Mce,w:Nce,W:Pce,x:null,X:null,y:Fce,Y:Lce,Z:zce,"%":nb},x={a:E,A:D,b:O,B:k,c:A,d:Jy,e:Jy,f:nce,g:qy,G:Ky,H:Yy,I:Yy,j:Qse,L:tce,m:Zse,M:$se,p:T,q:Xse,Q:ice,s:ace,S:ece,u:Gse,U:Kse,V:qse,w:Wse,W:Jse,x:j,X:M,y:qy,Y:Ky,Z:Yse,"%":rce};y.x=S(n,y),y.X=S(r,y),y.c=S(t,y),b.x=S(n,b),b.X=S(r,b),b.c=S(t,b);function S(e,t){return function(n){var r=[],i=-1,a=0,o=e.length,s,c,l;for(n instanceof Date||(n=new Date(+n));++i53)return null;`w`in r||(r.w=1),`Z`in r?(a=By(Vy(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?sv.ceil(a):sv(a),a=J_.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=zy(Vy(r.y,0,1)),o=a.getDay(),a=o>4||o===0?ev.ceil(a):ev(a),a=q_.offset(a,(r.V-1)*7),r.y=a.getFullYear(),r.m=a.getMonth(),r.d=a.getDate()+(r.w+6)%7)}else(`W`in r||`U`in r)&&(`w`in r||(r.w=`u`in r?r.u%7:+(`W`in r)),o=`Z`in r?By(Vy(r.y,0,1)).getUTCDay():zy(Vy(r.y,0,1)).getDay(),r.m=0,r.d=`W`in r?(r.w+6)%7+r.W*7-(o+5)%7:r.w+r.U*7-(o+6)%7);return`Z`in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,By(r)):zy(r)}}function w(e,t,n,r){for(var i=0,a=t.length,o=n.length,s,c;i=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=x[s in ab?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!=n.charCodeAt(r++))return-1}return r}function T(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1}function E(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function D(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1}function O(e,t,n){var r=_.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1}function k(e,t,n){var r=h.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1}function A(e,n,r){return w(e,t,n,r)}function j(e,t,r){return w(e,n,t,r)}function M(e,t,n){return w(e,r,t,n)}function N(e){return o[e.getDay()]}function P(e){return a[e.getDay()]}function F(e){return c[e.getMonth()]}function ee(e){return s[e.getMonth()]}function I(e){return i[+(e.getHours()>=12)]}function te(e){return 1+~~(e.getMonth()/3)}function L(e){return o[e.getUTCDay()]}function ne(e){return a[e.getUTCDay()]}function re(e){return c[e.getUTCMonth()]}function ie(e){return s[e.getUTCMonth()]}function ae(e){return i[+(e.getUTCHours()>=12)]}function oe(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=S(e+=``,y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+=``,b);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e+=``,!0);return t.toString=function(){return e},t}}}function Uy(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a[e.toLowerCase(),t]))}function Wse(e,t,n){var r=ob.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Gse(e,t,n){var r=ob.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function Kse(e,t,n){var r=ob.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function qse(e,t,n){var r=ob.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function Jse(e,t,n){var r=ob.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Ky(e,t,n){var r=ob.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function qy(e,t,n){var r=ob.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Yse(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||`00`)),n+r[0].length):-1}function Xse(e,t,n){var r=ob.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function Zse(e,t,n){var r=ob.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Jy(e,t,n){var r=ob.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Qse(e,t,n){var r=ob.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Yy(e,t,n){var r=ob.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function $se(e,t,n){var r=ob.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function ece(e,t,n){var r=ob.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function tce(e,t,n){var r=ob.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function nce(e,t,n){var r=ob.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function rce(e,t,n){var r=sb.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function ice(e,t,n){var r=ob.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function ace(e,t,n){var r=ob.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function Xy(e,t){return Uy(e.getDate(),t,2)}function oce(e,t){return Uy(e.getHours(),t,2)}function sce(e,t){return Uy(e.getHours()%12||12,t,2)}function cce(e,t){return Uy(1+q_.count(_v(e),e),t,3)}function Zy(e,t){return Uy(e.getMilliseconds(),t,3)}function lce(e,t){return Zy(e,t)+`000`}function uce(e,t){return Uy(e.getMonth()+1,t,2)}function dce(e,t){return Uy(e.getMinutes(),t,2)}function fce(e,t){return Uy(e.getSeconds(),t,2)}function pce(e){var t=e.getDay();return t===0?7:t}function mce(e,t){return Uy($_.count(_v(e)-1,e),t,2)}function Qy(e){var t=e.getDay();return t>=4||t===0?rv(e):rv.ceil(e)}function hce(e,t){return e=Qy(e),Uy(rv.count(_v(e),e)+(_v(e).getDay()===4),t,2)}function gce(e){return e.getDay()}function _ce(e,t){return Uy(ev.count(_v(e)-1,e),t,2)}function vce(e,t){return Uy(e.getFullYear()%100,t,2)}function yce(e,t){return e=Qy(e),Uy(e.getFullYear()%100,t,2)}function bce(e,t){return Uy(e.getFullYear()%1e4,t,4)}function xce(e,t){var n=e.getDay();return e=n>=4||n===0?rv(e):rv.ceil(e),Uy(e.getFullYear()%1e4,t,4)}function Sce(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+Uy(t/60|0,`0`,2)+Uy(t%60,`0`,2)}function $y(e,t){return Uy(e.getUTCDate(),t,2)}function Cce(e,t){return Uy(e.getUTCHours(),t,2)}function wce(e,t){return Uy(e.getUTCHours()%12||12,t,2)}function Tce(e,t){return Uy(1+J_.count(vv(e),e),t,3)}function eb(e,t){return Uy(e.getUTCMilliseconds(),t,3)}function Ece(e,t){return eb(e,t)+`000`}function Dce(e,t){return Uy(e.getUTCMonth()+1,t,2)}function Oce(e,t){return Uy(e.getUTCMinutes(),t,2)}function kce(e,t){return Uy(e.getUTCSeconds(),t,2)}function Ace(e){var t=e.getUTCDay();return t===0?7:t}function jce(e,t){return Uy(ov.count(vv(e)-1,e),t,2)}function tb(e){var t=e.getUTCDay();return t>=4||t===0?uv(e):uv.ceil(e)}function Mce(e,t){return e=tb(e),Uy(uv.count(vv(e),e)+(vv(e).getUTCDay()===4),t,2)}function Nce(e){return e.getUTCDay()}function Pce(e,t){return Uy(sv.count(vv(e)-1,e),t,2)}function Fce(e,t){return Uy(e.getUTCFullYear()%100,t,2)}function Ice(e,t){return e=tb(e),Uy(e.getUTCFullYear()%100,t,2)}function Lce(e,t){return Uy(e.getUTCFullYear()%1e4,t,4)}function Rce(e,t){var n=e.getUTCDay();return e=n>=4||n===0?uv(e):uv.ceil(e),Uy(e.getUTCFullYear()%1e4,t,4)}function zce(){return`+0000`}function nb(){return`%`}function rb(e){return+e}function ib(e){return Math.floor(e/1e3)}var ab,ob,sb,cb,lb=o((()=>{Tv(),ab={"-":``,_:` `,0:`0`},ob=/^\s*\d+/,sb=/^%/,cb=/[\\^$*+?|[\]().{}]/g}));function Bce(e){return ub=Hy(e),db=ub.format,fb=ub.parse,pb=ub.utcFormat,mb=ub.utcParse,ub}var ub,db,fb,pb,mb,Vce=o((()=>{lb(),Bce({dateTime:`%x, %X`,date:`%-m/%-d/%Y`,time:`%-I:%M:%S %p`,periods:[`AM`,`PM`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`]})})),hb=o((()=>{Vce(),lb()}));function gb(e){let t={};return n=>t[n]||(t[n]=e(n))}function Hce(e,t){return n=>{let r=e(n),i=r.indexOf(t);if(i<0)return r;let a=Uce(r,i),o=ai;)if(r[a]!==`0`){++a;break}return r.slice(0,a)+o}}function Uce(e,t){let n=e.lastIndexOf(`e`),r;if(n>0)return n;for(n=e.length;--n>t;)if(r=e.charCodeAt(n),r>=48&&r<=57)return n+1}function _b(e){let t=gb(e.format),n=e.formatPrefix;return{format:t,formatPrefix:n,formatFloat(e){let n=a_(e||`,`);if(n.precision==null){switch(n.precision=12,n.type){case`%`:n.precision-=2;break;case`e`:--n.precision;break}return Hce(t(n),t(`.1f`)(1)[1])}else return t(n)},formatSpan(e,r,i,a){a=a_(a??`,f`);let o=Jg(e,r,i),s=Math.max(Math.abs(e),Math.abs(r)),c;if(a.precision==null)switch(a.type){case`s`:return isNaN(c=S_(o,s))||(a.precision=c),n(a,s);case``:case`e`:case`g`:case`p`:case`r`:isNaN(c=C_(o,s))||(a.precision=c-(a.type===`e`));break;case`f`:case`%`:isNaN(c=x_(o))||(a.precision=c-(a.type===`%`)*2);break}return t(a)}}}function vb(){return Ob=_b({format:y_,formatPrefix:b_})}function yb(e){return _b(m_(e))}function bb(e){return arguments.length?Ob=yb(e):Ob}function xb(e,t,n){n||={},jh(n)||U(`Invalid time multi-format specifier: ${n}`);let r=t(sy),i=t(oy),a=t(ay),o=t(ry),s=t(ny),c=t(ty),l=t(ey),u=t($v),d=e(n.milliseconds||`.%L`),f=e(n.seconds||`:%S`),p=e(n.minutes||`%I:%M`),m=e(n.hours||`%I %p`),h=e(n.date||n.day||`%a %d`),g=e(n.week||`%b %d`),_=e(n.month||`%B`),v=e(n.quarter||`%B`),y=e(n.year||`%Y`);return e=>(r(e)vg(e)?t(e):xb(t,Uv,e),utcFormat:e=>vg(e)?n(e):xb(n,Wv,e),timeParse:gb(e.parse),utcParse:gb(e.utcParse)}}function Cb(){return kb=Sb({format:db,parse:fb,utcFormat:pb,utcParse:mb})}function wb(e){return Sb(Hy(e))}function Tb(e){return arguments.length?kb=wb(e):kb}function Eb(e,t){let n=e?yb(e):bb(),r=t?wb(t):Tb();return Ab(n,r)}function Db(e,t){let n=arguments.length;return n&&n!==2&&U(`defaultLocale expects either zero or two arguments.`),n?Ab(bb(e),Tb(t)):Ab(bb(),Tb())}function Wce(){return vb(),Cb(),Db()}var Ob,kb,Ab,jb=o((()=>{e_(),w_(),Ry(),Dg(),hb(),vb(),Cb(),Ab=(e,t)=>og({},e,t)}));function Gce(e){return t=>({options:t||{},sanitize:qce,load:Kce,fileAccess:!1,file:Jce(e),http:Xce})}async function Kce(e,t){let n=await this.sanitize(e,t),r=n.href;return n.localFile?this.file(r):this.http(r,t?.http)}async function qce(e,t){t=og({},this.options,t);let n=this.fileAccess,r={href:null},i,a,o,s=Hb.test(e.replace(Ub,``));(e==null||typeof e!=`string`||!s)&&U(`Sanitize failure, invalid URI: `+G(e));let c=Vb.test(e);return(o=t.baseURL)&&!c&&(!e.startsWith(`/`)&&!o.endsWith(`/`)&&(e=`/`+e),e=o+e),a=(i=e.startsWith(Wb))||t.mode===`file`||t.mode!==`http`&&!c&&n,i?e=e.slice(7):e.startsWith(`//`)&&(t.defaultProtocol===`file`?(e=e.slice(2),a=!0):e=(t.defaultProtocol||`http`)+`:`+e),Object.defineProperty(r,"localFile",{value:!!a}),r.href=e,t.target&&(r.target=t.target+``),t.rel&&(r.rel=t.rel+``),t.context===`image`&&t.crossOrigin&&(r.crossOrigin=t.crossOrigin+``),r}function Jce(e){return e?t=>new Promise((n,r)=>{e.readFile(t,(e,t)=>{e?r(e):n(t)})}):Yce}async function Yce(){U(`No file system access.`)}async function Xce(e,t){let n=og({},this.options.http,t),r=t&&t.response,i=await fetch(e,n);return i.ok?eg(i[r])?i[r]():i.text():U(i.status+``+i.statusText)}function Mb(e,t){if(!e||!e.length)return`unknown`;let n=e.length,r=Zb.length,i=Zb.map((e,t)=>t+1);for(let a=0,o=0,s,c;ae===0?t:e,0)-1]}function Nb(e,t){return t.reduce((t,n)=>(t[n]=Mb(e,n),t),{})}function Pb(e){let t=function(t,n){let r={delimiter:e};return Fb(t,n?og(n,r):r)};return t.responseType=`text`,t}function Fb(e,t){return t.header&&(e=t.header.map(G).join(t.delimiter)+` +`+e),doe(t.delimiter).parse(e+``)}function Zce(e){return typeof Buffer==`function`&&eg(Buffer.isBuffer)?Buffer.isBuffer(e):!1}function Ib(e,t){let n=t&&t.property?bh(t.property):Ch;return jh(e)&&!Zce(e)?Qce(n(e),t):n(JSON.parse(e))}function Qce(e,t){return!W(e)&&Nae(e)&&(e=[...e]),t&&t.copy?JSON.parse(JSON.stringify(e)):e}function Lb(e,t){let n,r,i,a;return e=Ib(e,t),t&&t.feature?(n=boe,i=t.feature):t&&t.mesh?(n=Eoe,i=t.mesh,a=$b[t.filter]):U(`Missing TopoJSON feature or mesh parameter.`),r=(r=e.objects[i])?n(e,r,a):U(`Invalid TopoJSON object: `+i),r&&r.features||[r]}function Rb(e,t){return arguments.length>1?(ex[e]=t,this):cg(ex,e)?ex[e]:null}function zb(e){let t=Rb(e);return t&&t.responseType||`text`}function Bb(e,t,n,r){t||={};let i=Rb(t.type||`json`);return i||U(`Unknown data format type: `+t.type),e=i(e,t),t.parse&&$ce(e,t.parse,n,r),cg(e,`columns`)&&delete e.columns,e}function $ce(e,t,n,r){if(!e.length)return;let i=Tb();n||=i.timeParse,r||=i.utcParse;let a=e.columns||Object.keys(e[0]),o,s,c,l,u,d;t===`auto`&&(t=Nb(e,a)),a=Object.keys(t);let f=a.map(e=>{let i=t[e],a,o;if(i&&(i.startsWith(`date:`)||i.startsWith(`utc:`)))return a=i.split(/:(.+)?/,2),o=a[1],(o[0]===`'`&&o[o.length-1]===`'`||o[0]===`"`&&o[o.length-1]===`"`)&&(o=o.slice(1,-1)),(a[0]===`utc`?r:n)(o);if(!Xb[i])throw Error(`Illegal format pattern: `+e+`:`+i);return Xb[i]});for(c=0,u=e.length,d=a.length;c{Dg(),poe(),Aoe(),jb(),Vb=/^(data:|([A-Za-z]+:)?\/\/)/,Hb=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,Ub=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Wb=`file://`,Gb=e=>e!=null&&e===e,Kb=e=>e===`true`||e===`false`||e===!0||e===!1,qb=e=>!Number.isNaN(Date.parse(e)),Jb=e=>!Number.isNaN(+e)&&!(e instanceof Date),Yb=e=>Jb(e)&&Number.isInteger(+e),Xb={boolean:Sg,integer:Rh,number:Rh,date:Cg,string:wg,unknown:Ch},Zb=[Kb,Yb,Jb,qb],Qb=[`boolean`,`integer`,`number`,`date`],Fb.responseType=`text`,Ib.responseType=`json`,$b={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t},Lb.responseType=`json`,ex={dsv:Fb,csv:Pb(`,`),tsv:Pb(` `),json:Ib,topojson:Lb},tx=Gce(null)}));function rx(e){let t=e||Ch,n=[],r={};return n.add=e=>{let i=t(e);return r[i]||(r[i]=1,n.push(e)),n},n.remove=e=>{let i=t(e);if(r[i]){r[i]=0;let t=n.indexOf(e);t>=0&&n.splice(t,1)}return n},n}async function ix(e,t){try{await t(e)}catch(t){e.error(t)}}function ax(e){return!!(e&&ox(e))}function ox(e){return e[jx]}function sx(e,t){return e[jx]=t,e}function cx(e){let t=e===Object(e)?e:{data:e};return ox(t)?t:sx(t,Mx++)}function lx(e){return ux(e,cx({}))}function ux(e,t){for(let n in e)t[n]=e[n];return t}function dx(e,t){return sx(t,ox(e))}function fx(e,t){return e?t?(n,r)=>e(n,r)||ox(t(n))-ox(t(r)):(t,n)=>e(t,n)||ox(t)-ox(n):null}function px(e){return e&&e.constructor===mx}function mx(){let e=[],t=[],n=[],r=[],i=[],a=null,o=!1;return{constructor:mx,insert(t){let n=Qh(t),r=n.length;for(let t=0;t{m(e)&&(l[ox(e)]=-1)});for(d=0,f=e.length;d0&&(_(h,m,p.value),s.modifies(m));for(d=0,f=i.length;d{m(e)&&l[ox(e)]>0&&_(e,p.field,p.value)}),s.modifies(p.field);if(o)s.mod=t.length||r.length?c.filter(e=>l[ox(e)]>0):c.slice();else for(g in u)s.mod.push(u[g]);return(a||a==null&&(t.length||r.length))&&s.clean(!0),s}}}function hx(){Object.defineProperty(this,Nx,{writable:!0,value:{}})}function gx(e,t,n,r){this.id=++Px,this.value=e,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,t&&(this._update=t),n&&this.parameters(n,r)}function _x(e){return function(t){let n=this.flags;return arguments.length===0?!!(n&e):(this.flags=t?n|e:n&~e,this)}}function ele(e,t,n,r){let i=1,a;return e instanceof gx?a=e:e&&e.prototype instanceof gx?a=new e:eg(e)?a=new gx(null,e):(i=0,a=new gx(e,t)),this.rank(a),i&&(r=n,n=t),n&&this.connect(a,a.parameters(n,r)),this.touch(a),a}function tle(e,t){let n=e.rank,r=t.length;for(let i=0;it=e);return n.requests=0,n.done=()=>{--n.requests===0&&(e._pending=null,t(e))},e._pending=n}function cle(e,t,n,r,i){return(e instanceof gx?ule:lle)(this,e,t,n,r,i),this}function lle(e,t,n,r,i,a){let o=og({},a,Bx),s,c;eg(n)||(n=ig(n)),r===void 0?s=t=>e.touch(n(t)):eg(r)?(c=new gx(null,r,i,!1),s=t=>{c.evaluate(t);let r=n(t),i=c.value;px(i)?e.pulse(r,i,a):e.update(r,i,o)}):s=t=>e.update(n(t),r,o),t.apply(s)}function ule(e,t,n,r,i,a){if(r===void 0)t.targets().add(n);else{let o=a||{},s=new gx(null,dle(n,r),i,!1);s.modified(o.force),s.rank=t.rank,t.targets().add(s),n&&(s.skip(!0),s.value=n.value,s.targets().add(n),e.connect(n,[s]))}}function dle(e,t){return t=eg(t)?t:ig(t),e?function(n,r){let i=t(n,r);return e.skip()||(e.skip(i!==this.value).value=i),i}:t}function fle(e){e.rank=++this._rank}function ple(e){let t=[e],n,r,i;for(;t.length;)if(this.rank(n=t.pop()),r=n._targets)for(i=r.length;--i>=0;)t.push(n=r[i]),n===e&&U(`Cycle detected in dataflow graph.`)}function bx(e,t,n){this.dataflow=e,this.stamp=t??-1,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function xx(e,t){let n=[];return Eg(e,t,e=>n.push(e)),n}function Sx(e,t){let n={};return e.visit(t,e=>{n[ox(e)]=1}),e=>n[ox(e)]?null:e}function Cx(e,t){return e?(n,r)=>e(n,r)&&t(n,r):t}function wx(e,t,n,r){let i=this,a=0;this.dataflow=e,this.stamp=t,this.fields=null,this.encode=r||null,this.pulses=n;for(let e of n)if(e.stamp===t){if(e.fields){let t=i.fields||={};for(let n in e.fields)t[n]=1}e.changed(i.ADD)&&(a|=i.ADD),e.changed(i.REM)&&(a|=i.REM),e.changed(i.MOD)&&(a|=i.MOD)}this.changes=a}async function mle(e,t,n){let r=this,i=[];if(r._pulse)return Tx(r);if(r._pending&&await r._pending,t&&await ix(r,t),!r._touched.length)return r.debug(`Dataflow invoked, but nothing to do.`),r;let a=++r._clock;r._pulse=new bx(r,a,e),r._touched.forEach(e=>r._enqueue(e,!0)),r._touched=rx(Sh);let o=0,s,c,l;try{for(;r._heap.size()>0;){if(s=r._heap.pop(),s.rank!==s.qrank){r._enqueue(s,!0);continue}c=s.run(r._getPulse(s,e)),c.then?c=await c:c.async&&(i.push(c.async),c=Vx),c!==Vx&&s._targets&&s._targets.forEach(e=>r._enqueue(e)),++o}}catch(e){r._heap.clear(),l=e}if(r._input={},r._pulse=null,r.debug(`Pulse ${a}: ${o} operators`),l&&(r._postrun=[],r.error(l)),r._postrun.length){let e=r._postrun.sort((e,t)=>t.priority-e.priority);r._postrun=[];for(let t=0;tr.runAsync(null,()=>{e.forEach(e=>{try{e(r)}catch(e){r.error(e)}})})),r}async function hle(e,t,n){for(;this._running;)await this._running;let r=()=>this._running=null;return(this._running=this.evaluate(e,t,n)).then(r,r),this._running}function gle(e,t,n){return this._pulse?Tx(this):(this.evaluate(e,t,n),this)}function _le(e,t,n){if(this._pulse||t)this._postrun.push({priority:n||0,callback:e});else try{e(this)}catch(e){this.error(e)}}function Tx(e){return e.error(`Dataflow already running. Use runAsync() to chain invocations.`),e}function vle(e,t){let n=e.stampe.pulse),t):this._input[e.id]||ble(this._pulse,n&&n.pulse)}function ble(e,t){return t&&t.stamp===e.stamp?t:(e=e.fork(),t&&t!==Vx&&(e.source=t.source),e)}function xle(e,t){let n=t||Qx;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this}function Sle(e,t,n){let r=n||Qx;return(e.set(t)||r.force)&&this.touch(e,r),this}function Cle(e,t,n){this.touch(e,n||Qx);let r=new bx(this,this._clock+ +!this._pulse),i=e.pulse&&e.pulse.source||[];return r.target=e,this._input[e.id]=t.pulse(r,i),this}function wle(e){let t=[];return{clear:()=>t=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),Ex(t,0,t.length-1,e)),pop:()=>{let n=t.pop(),r;return t.length?(r=t[0],t[0]=n,Tle(t,0,e)):r=n,r}}}function Ex(e,t,n,r){let i,a,o=e[n];for(;n>t;){if(a=n-1>>1,i=e[a],r(o,i)<0){e[n]=i,n=a;continue}break}return e[n]=o}function Tle(e,t,n){let r=t,i=e.length,a=e[t],o=(t<<1)+1,s;for(;o=0&&(o=s),e[t]=e[o],t=o,o=(t<<1)+1;return e[t]=a,Ex(e,r,t,n)}function Dx(){this.logger(kh()),this.logLevel(1),this._clock=0,this._rank=0,this._locale=Db();try{this._loader=tx()}catch{}this._touched=rx(Sh),this._input={},this._pulse=null,this._heap=wle((e,t)=>e.qrank-t.qrank),this._postrun=[]}function Ox(e){return function(){return this._log[e].apply(this,arguments)}}function K(e,t){gx.call(this,e,null,t)}function kx(e){let t=Ax(e);return t&&t.Definition||null}function Ax(e){return e&&=e.toLowerCase(),cg($x,e)?$x[e]:null}var jx,Mx,Nx,Px,Fx,Ix,Lx,Rx,zx,Bx,Vx,Hx,Ux,Wx,Gx,Kx,qx,Jx,Yx,Xx,Zx,Qx,$x,eS=o((()=>{Dg(),nx(),jb(),jx=Symbol(`vega_id`),Mx=1,Nx=`_:mod:_`,hx.prototype={set(e,t,n,r){let i=this,a=i[e],o=i[Nx];return t!=null&&t>=0?(a[t]!==n||r)&&(a[t]=n,o[t+`:`+e]=-1,o[e]=-1):(a!==n||r)&&(i[e]=n,o[e]=W(n)?1+n.length:-1),i},modified(e,t){let n=this[Nx];if(!arguments.length){for(let e in n)if(n[e])return!0;return!1}else if(W(e)){for(let t=0;t=0?t+1{o instanceof gx?(o!==this&&(t&&o.targets().add(this),a.push(o)),i.push({op:o,name:e,index:n})):r.set(e,n,o)};for(o in e)if(s=e[o],o===Fx)Qh(s).forEach(e=>{e instanceof gx?e!==this&&(e.targets().add(this),a.push(e)):U(`Pulse parameters must be operator instances.`)}),this.source=s;else if(W(s))for(r.set(o,-1,Array(c=s.length)),l=0;l{let n=Date.now();return n-t>e?(t=n,1):0})},debounce(e){let t=yx();return this.targets().add(yx(null,null,ag(e,e=>{let n=e.dataflow;t.receive(e),n&&n.run&&n.run()}))),t},between(e,t){let n=!1;return e.targets().add(yx(null,null,()=>n=!0)),t.targets().add(yx(null,null,()=>n=!1)),this.filter(()=>n)},detach(){this._filter=Eh,this._targets=null}},Bx={skip:!0},Vx={},Hx=1,Ux=2,Wx=4,Gx=3,Kx=5,qx=7,Jx=8,Yx=16,Xx=32,Zx=64,bx.prototype={StopPropagation:Vx,ADD:Hx,REM:Ux,MOD:Wx,ADD_REM:Gx,ADD_MOD:Kx,ALL:qx,REFLOW:Jx,SOURCE:Yx,NO_SOURCE:Xx,NO_FIELDS:Zx,fork(e){return new bx(this.dataflow).init(this,e)},clone(){let e=this.fork(qx);return e.add=e.add.slice(),e.rem=e.rem.slice(),e.mod=e.mod.slice(),e.source&&=e.source.slice(),e.materialize(23)},addAll(){let e=this;return!e.source||e.add===e.rem||!e.rem.length&&e.source.length===e.add.length?e:(e=new bx(this.dataflow).init(this),e.add=e.source,e.rem=[],e)},init(e,t){let n=this;return n.stamp=e.stamp,n.encode=e.encode,e.fields&&!(t&Zx)&&(n.fields=e.fields),t&Hx?(n.addF=e.addF,n.add=e.add):(n.addF=null,n.add=[]),t&Ux?(n.remF=e.remF,n.rem=e.rem):(n.remF=null,n.rem=[]),t&Wx?(n.modF=e.modF,n.mod=e.mod):(n.modF=null,n.mod=[]),t&Xx?(n.srcF=null,n.source=null):(n.srcF=e.srcF,n.source=e.source,e.cleans&&(n.cleans=e.cleans)),n},runAfter(e){this.dataflow.runAfter(e)},changed(e){let t=e||qx;return t&Hx&&this.add.length||t&Ux&&this.rem.length||t&Wx&&this.mod.length},reflow(e){if(e)return this.fork(qx).reflow();let t=this.add.length,n=this.source&&this.source.length;return n&&n!==t&&(this.mod=this.source,t&&this.filter(Wx,Sx(this,Hx))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){let t=this.fields||={};return W(e)?e.forEach(e=>t[e]=!0):t[e]=!0,this},modified(e,t){let n=this.fields;return(t||this.mod.length)&&n?arguments.length?W(e)?e.some(e=>n[e]):n[e]:!!n:!1},filter(e,t){let n=this;return e&Hx&&(n.addF=Cx(n.addF,t)),e&Ux&&(n.remF=Cx(n.remF,t)),e&Wx&&(n.modF=Cx(n.modF,t)),e&Yx&&(n.srcF=Cx(n.srcF,t)),n},materialize(e){e||=qx;let t=this;return e&Hx&&t.addF&&(t.add=xx(t.add,t.addF),t.addF=null),e&Ux&&t.remF&&(t.rem=xx(t.rem,t.remF),t.remF=null),e&Wx&&t.modF&&(t.mod=xx(t.mod,t.modF),t.modF=null),e&Yx&&t.srcF&&(t.source=t.source.filter(t.srcF),t.srcF=null),t},visit(e,t){let n=this,r=t;if(e&Yx)return Eg(n.source,n.srcF,r),n;e&Hx&&Eg(n.add,n.addF,r),e&Ux&&Eg(n.rem,n.remF,r),e&Wx&&Eg(n.mod,n.modF,r);let i=n.source;if(e&Jx&&i){let e=n.add.length+n.mod.length;e===i.length||(e?Eg(i,Sx(n,Kx),r):Eg(i,n.srcF,r))}return n}},fg(wx,bx,{fork(e){let t=new bx(this.dataflow).init(this,e&this.NO_FIELDS);return e!==void 0&&(e&t.ADD&&this.visit(t.ADD,e=>t.add.push(e)),e&t.REM&&this.visit(t.REM,e=>t.rem.push(e)),e&t.MOD&&this.visit(t.MOD,e=>t.mod.push(e))),t},changed(e){return this.changes&e},modified(e){let t=this,n=t.fields;return n&&t.changes&t.MOD?W(e)?e.some(e=>n[e]):n[e]:0},filter(){U(`MultiPulse does not support filtering.`)},materialize(){U(`MultiPulse does not support materialization.`)},visit(e,t){let n=this,r=n.pulses,i=r.length,a=0;if(e&n.SOURCE)for(;athis.pulse=e):t!==e.StopPropagation&&(this.pulse=t),t},evaluate(e){let t=this.marshall(e.stamp),n=this.transform(t,e);return t.clear(),n},transform(){}}),$x={}}));function*tS(e,t){if(t==null)for(let t of e)t!=null&&t!==``&&(t=+t)>=t&&(yield t);else{let n=-1;for(let r of e)r=t(r,++n,e),r!=null&&r!==``&&(r=+r)>=r&&(yield r)}}function nS(e,t,n){let r=Float64Array.from(tS(e,n));return r.sort(Pg),t.map(e=>ose(r,e))}function rS(e,t){return nS(e,[.25,.5,.75],t)}function iS(e,t){let n=e.length,r=Voe(e,t),i=rS(e,t),a=(i[2]-i[0])/1.34;return 1.06*(Math.min(r,a)||r||Math.abs(i[0])||1)*n**-.2}function aS(e){let t=e.maxbins||20,n=e.base||10,r=Math.log(n),i=e.divide||[5,2],a=e.extent[0],o=e.extent[1],s,c,l,u,d,f,p=e.span||o-a||Math.abs(a)||1;if(e.step)s=e.step;else if(e.steps){for(u=p/t,d=0,f=e.steps.length;dt;)s*=n;for(d=0,f=i.length;d=l&&p/u<=t&&(s=u)}u=Math.log(s);let m=n**(-(u>=0?0:~~(-u/r)+1)-1);return(e.nice||e.nice===void 0)&&(u=Math.floor(a/s+m)*s,a=ae);let i=e.length,a=new Float64Array(i),o=0,s=1,c=r(e[0]),l=c,u=c+t,d;for(;s=u){for(l=(c+l)/2;o>1);oi;)e[o--]=e[r]}r=i,i=a}return e}function Ole(e){return function(){return e=(1103515245*e+12345)%2147483647,e/2147483647}}function kle(e,t){t??(t=e,e=0);let n,r,i,a={min(e){return arguments.length?(n=e||0,i=r-n,a):n},max(e){return arguments.length?(r=e||0,i=r-n,a):r},sample(){return n+Math.floor(i*RS())},pdf(e){return e===Math.floor(e)&&e>=n&&e=r?1:(t-n+1)/i},icdf(e){return e>=0&&e<=1?n-1+Math.floor(e*i):NaN}};return a.min(e).max(t)}function cS(e,t){e||=0,t??=1;let n=0,r=0,i,a;if(VS===VS)n=VS,VS=NaN;else{do n=RS()*2-1,r=RS()*2-1,i=n*n+r*r;while(i===0||i>1);a=Math.sqrt(-2*Math.log(i)/i),n*=a,VS=r*a}return e+n*t}function lS(e,t,n){n??=1;let r=(e-(t||0))/n;return Math.exp(-.5*r*r)/(n*zS)}function uS(e,t,n){t||=0,n??=1;let r=(e-t)/n,i=Math.abs(r),a;if(i>37)a=0;else{let e=Math.exp(-i*i/2),t;i<7.07106781186547?(t=.0352624965998911*i+.700383064443688,t=t*i+6.37396220353165,t=t*i+33.912866078383,t=t*i+112.079291497871,t=t*i+221.213596169931,t=t*i+220.206867912376,a=e*t,t=.0883883476483184*i+1.75566716318264,t=t*i+16.064177579207,t=t*i+86.7807322029461,t=t*i+296.564248779674,t=t*i+637.333633378831,t=t*i+793.826512519948,t=t*i+440.413735824752,a/=t):(t=i+.65,t=i+4/t,t=i+3/t,t=i+2/t,t=i+1/t,a=e/t/2.506628274631)}return r>0?1-a:a}function dS(e,t,n){return e<0||e>1?NaN:(t||0)+(n??1)*BS*Ale(2*e-1)}function Ale(e){let t=-Math.log((1-e)*(1+e)),n;return t<6.25?(t-=3.125,n=-364441206401782e-35,n=-16850591381820166e-35+n*t,n=128584807152564e-32+n*t,n=11157877678025181e-33+n*t,n=-1333171662854621e-31+n*t,n=20972767875968562e-33+n*t,n=6637638134358324e-30+n*t,n=-4054566272975207e-29+n*t,n=-8151934197605472e-29+n*t,n=26335093153082323e-28+n*t,n=-12975133253453532e-27+n*t,n=-5415412054294628e-26+n*t,n=1.0512122733215323e-9+n*t,n=-4.112633980346984e-9+n*t,n=-2.9070369957882005e-8+n*t,n=4.2347877827932404e-7+n*t,n=-13654692000834679e-22+n*t,n=-13882523362786469e-21+n*t,n=.00018673420803405714+n*t,n=-.000740702534166267+n*t,n=-.006033670871430149+n*t,n=.24015818242558962+n*t,n=1.6536545626831027+n*t):t<16?(t=Math.sqrt(t)-3.25,n=2.2137376921775787e-9,n=9.075656193888539e-8+n*t,n=-2.7517406297064545e-7+n*t,n=1.8239629214389228e-8+n*t,n=15027403968909828e-22+n*t,n=-4013867526981546e-21+n*t,n=29234449089955446e-22+n*t,n=12475304481671779e-21+n*t,n=-47318229009055734e-21+n*t,n=6828485145957318e-20+n*t,n=24031110387097894e-21+n*t,n=-.0003550375203628475+n*t,n=.0009532893797373805+n*t,n=-.0016882755560235047+n*t,n=.002491442096107851+n*t,n=-.003751208507569241+n*t,n=.005370914553590064+n*t,n=1.0052589676941592+n*t,n=3.0838856104922208+n*t):Number.isFinite(t)?(t=Math.sqrt(t)-5,n=-27109920616438573e-27,n=-2555641816996525e-25+n*t,n=1.5076572693500548e-9+n*t,n=-3.789465440126737e-9+n*t,n=7.61570120807834e-9+n*t,n=-1.496002662714924e-8+n*t,n=2.914795345090108e-8+n*t,n=-6.771199775845234e-8+n*t,n=2.2900482228026655e-7+n*t,n=-9.9298272942317e-7+n*t,n=4526062597223154e-21+n*t,n=-1968177810553167e-20+n*t,n=7599527703001776e-20+n*t,n=-.00021503011930044477+n*t,n=-.00013871931833623122+n*t,n=1.0103004648645344+n*t,n=4.849906401408584+n*t):n=1/0,n*e}function fS(e,t){let n,r,i={mean(e){return arguments.length?(n=e||0,i):n},stdev(e){return arguments.length?(r=e??1,i):r},sample:()=>cS(n,r),pdf:e=>lS(e,n,r),cdf:e=>uS(e,n,r),icdf:e=>dS(e,n,r)};return i.mean(e).stdev(t)}function pS(e,t){let n=fS(),r=0,i={data(n){return arguments.length?(e=n,r=n?n.length:0,i.bandwidth(t)):e},bandwidth(n){return arguments.length?(t=n,!t&&e&&(t=iS(e)),i):t},sample(){return e[~~(RS()*r)]+t*n.sample()},pdf(i){let a=0,o=0;for(;omS(n,r),pdf:e=>hS(e,n,r),cdf:e=>gS(e,n,r),icdf:e=>_S(e,n,r)};return i.mean(e).stdev(t)}function yS(e,t){let n=0,r;function i(e){let t=[],r=0,i;for(i=0;i=t&&e<=n?1/(n-t):0}function SS(e,t,n){return n??(n=t??1,t=0),en?1:(e-t)/(n-t)}function CS(e,t,n){return n??(n=t??1,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function wS(e,t){let n,r,i={min(e){return arguments.length?(n=e||0,i):n},max(e){return arguments.length?(r=e??1,i):r},sample:()=>bS(n,r),pdf:e=>xS(e,n,r),cdf:e=>SS(e,n,r),icdf:e=>CS(e,n,r)};return t??(t=e??1,e=0),i.min(e).max(t)}function TS(e,t,n){let r=0,i=0;for(let a of e){let e=n(a);t(a)==null||e==null||isNaN(e)||(r+=(e-r)/++i)}return{coef:[r],predict:()=>r,rSquared:0}}function ES(e,t,n,r){let i=r-e*e,a=Math.abs(i)<1e-24?0:(n-e*t)/i;return[t-a*e,a]}function DS(e,t,n,r){e=e.filter(e=>{let r=t(e),i=n(e);return r!=null&&(r=+r)>=r&&i!=null&&(i=+i)>=i}),r&&e.sort((e,n)=>t(e)-t(n));let i=e.length,a=new Float64Array(i),o=new Float64Array(i),s=0,c=0,l=0,u,d,f;for(f of e)a[s]=u=+t(f),o[s]=d=+n(f),++s,c+=(u-c)/s,l+=(d-l)/s;for(s=0;s=a&&o!=null&&(o=+o)>=o&&r(a,o,++i)}function kS(e,t,n,r,i){let a=0,o=0;return OS(e,t,n,(e,t)=>{let n=t-i(e),s=t-r;a+=n*n,o+=s*s}),1-a/o}function AS(e,t,n){let r=0,i=0,a=0,o=0,s=0;OS(e,t,n,(e,t)=>{++s,r+=(e-r)/s,i+=(t-i)/s,a+=(e*t-a)/s,o+=(e*e-o)/s});let c=ES(r,i,a,o),l=e=>c[0]+c[1]*e;return{coef:c,predict:l,rSquared:kS(e,t,n,i,l)}}function jS(e,t,n){let r=0,i=0,a=0,o=0,s=0;OS(e,t,n,(e,t)=>{++s,e=Math.log(e),r+=(e-r)/s,i+=(t-i)/s,a+=(e*t-a)/s,o+=(e*e-o)/s});let c=ES(r,i,a,o),l=e=>c[0]+c[1]*Math.log(e);return{coef:c,predict:l,rSquared:kS(e,t,n,i,l)}}function MS(e,t,n){let[r,i,a,o]=DS(e,t,n),s=0,c=0,l=0,u=0,d=0,f,p,m;OS(e,t,n,(e,t)=>{f=r[d++],p=Math.log(t),m=f*t,s+=(t*p-s)/d,c+=(m-c)/d,l+=(m*p-l)/d,u+=(f*m-u)/d});let[h,g]=ES(c/o,s/o,l/o,u/o),_=e=>Math.exp(h+g*(e-a));return{coef:[Math.exp(h-g*a),g],predict:_,rSquared:kS(e,t,n,o,_)}}function NS(e,t,n){let r=0,i=0,a=0,o=0,s=0,c=0;OS(e,t,n,(e,t)=>{let n=Math.log(e),l=Math.log(t);++c,r+=(n-r)/c,i+=(l-i)/c,a+=(n*l-a)/c,o+=(n*n-o)/c,s+=(t-s)/c});let l=ES(r,i,a,o),u=e=>l[0]*e**+l[1];return l[0]=Math.exp(l[0]),{coef:l,predict:u,rSquared:kS(e,t,n,s,u)}}function PS(e,t,n){let[r,i,a,o]=DS(e,t,n),s=r.length,c=0,l=0,u=0,d=0,f=0,p,m,h,g;for(p=0;p(e-=a,y*e*e+b*e+x+o);return{coef:[x-b*a+y*a*a+o,b-2*y*a,y],predict:S,rSquared:kS(e,t,n,o,S)}}function FS(e,t,n,r){if(r===0)return TS(e,t,n);if(r===1)return AS(e,t,n);if(r===2)return PS(e,t,n);let[i,a,o,s]=DS(e,t,n),c=i.length,l=[],u=[],d=r+1,f,p,m,h,g;for(f=0;f{e-=o;let t=s+_[0]+_[1]*e+_[2]*e*e;for(f=3;f=0;--a)for(s=t[a],c=1,i[a]+=s,o=1;o<=a;++o)c*=(a+1-o)/o,i[a-o]+=s*n**+o*c;return i[0]+=r,i}function Mle(e){let t=e.length-1,n=[],r,i,a,o,s;for(r=0;rMath.abs(e[r][o])&&(o=i);for(a=r;a=r;a--)e[a][i]-=e[a][r]*e[r][i]/e[r][r]}for(i=t-1;i>=0;--i){for(s=0,a=i+1;ai[o]-n?r:o,c=0,l=0,p=0,m=0,h=0,g=1/Math.abs(i[s]-n||1);for(let e=r;e<=o;++e){let t=i[e],r=a[e],o=Nle(Math.abs(n-t)*g)*f[e],s=t*o;c+=o,l+=s,p+=r*o,m+=r*s,h+=t*s}let[_,v]=ES(l/c,p/c,m/c,h/c);u[e]=_+v*n,d[e]=Math.abs(a[e]-u[e]),Ple(i,e+1,t)}if(e===HS)break;let n=use(d);if(Math.abs(n)=1?US:(r=1-t*t)*r}return Fle(i,u,o,s)}function Nle(e){return(e=1-e*e*e)*e*e}function Ple(e,t,n){let r=e[t],i=n[0],a=n[1]+1;if(!(a>=e.length))for(;t>i&&e[a]-r<=r-e[i];)n[0]=++i,n[1]=a,++a}function Fle(e,t,n,r){let i=e.length,a=[],o=0,s=0,c=[],l;for(;o[t,e(t)],a=t[0],o=t[1],s=o-a,c=s/r,l=[i(a)],u=[];if(n===r){for(let e=1;e0;)u.push(i(a+e/n*s))}let d=l[0],f=u[u.length-1],p=1/s,m=Ile(d[1],u);for(;f;){let e=i((d[0]+f[0])/2);e[0]-d[0]>=c&&Lle(d,e,f,p,m)>WS?u.push(e):(d=f,l.push(f),u.pop()),f=u[u.length-1]}return l}function Ile(e,t){let n=e,r=e,i=t.length;for(let e=0;er&&(r=i)}return 1/(r-n)}function Lle(e,t,n,r,i){let a=Math.atan2(i*(n[1]-e[1]),r*(n[0]-e[0])),o=Math.atan2(i*(t[1]-e[1]),r*(t[0]-e[0]));return Math.abs(a-o)}var RS,zS,BS,VS,HS,US,WS,GS=o((()=>{e_(),RS=Math.random,zS=Math.sqrt(2*Math.PI),BS=Math.SQRT2,VS=NaN,HS=2,US=1e-12,WS=.5*Math.PI/180})),Rle=c({aggregate:()=>QS,bin:()=>$S,collect:()=>tC,compare:()=>nC,countpattern:()=>rC,cross:()=>iC,density:()=>oC,dotbin:()=>lC,expression:()=>uC,extent:()=>dC,facet:()=>pC,field:()=>mC,filter:()=>hC,flatten:()=>gC,fold:()=>_C,formula:()=>vC,generate:()=>yC,impute:()=>bC,joinaggregate:()=>xC,kde:()=>SC,key:()=>CC,load:()=>wC,lookup:()=>EC,multiextent:()=>DC,multivalues:()=>OC,params:()=>kC,pivot:()=>AC,prefacet:()=>jC,project:()=>MC,proxy:()=>NC,quantile:()=>PC,relay:()=>FC,sample:()=>IC,sequence:()=>LC,sieve:()=>RC,subflow:()=>fC,timeunit:()=>zC,tupleindex:()=>BC,values:()=>VC,window:()=>UC});function zle(e){return t=>{let n=e.length,r=1,i=String(e[0](t));for(;rog({name:e,aggregate_param:r,out:n||e},KC,t)}function JS(e,t,n){return qC[e](n,t)}function YS(e,t){return e.idx-t.idx}function Vle(e){let t={};e.forEach(e=>t[e.name]=e);let n=e=>{e.req&&e.req.forEach(e=>{t[e]||n(t[e]=qC[e]())})};return e.forEach(n),Object.values(t).sort(YS)}function Hle(){this.valid=0,this.missing=0,this._ops.forEach(e=>e.aggregate_param==null?e.init(this):e.init(this,e.aggregate_param))}function Ule(e,t){if(e==null||e===``){++this.missing;return}e===e&&(++this.valid,this._ops.forEach(n=>n.add(this,e,t)))}function Wle(e,t){if(e==null||e===``){--this.missing;return}e===e&&(--this.valid,this._ops.forEach(n=>n.rem(this,e,t)))}function Gle(e){return this._out.forEach(t=>e[t.out]=t.value(this)),e}function XS(e,t){let n=t||Ch,r=Vle(e),i=e.slice().sort(YS);function a(e){this._ops=r,this._out=i,this.cell=e,this.init()}return a.prototype.init=Hle,a.prototype.add=Ule,a.prototype.rem=Wle,a.prototype.set=Gle,a.prototype.get=n,a.fields=e.map(e=>e.out),a}function ZS(e){this._key=e?bh(e):ox,this.reset()}function QS(e){K.call(this,null,e),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}function $S(e){K.call(this,null,e)}function eC(e,t,n){let r=e,i=t||[],a=n||[],o={},s=0;return{add:e=>a.push(e),remove:e=>o[r(e)]=++s,size:()=>i.length,data:(e,t)=>(s&&=(i=i.filter(e=>!o[r(e)]),o={},0),t&&e&&i.sort(e),a.length&&(i=e?Gae(e,i,a.sort(e)):i.concat(a),a=[]),i)}}function tC(e){K.call(this,[],e)}function nC(e){gx.call(this,null,Kle,e)}function Kle(e){return this.value&&!e.modified()?this.value:ng(e.fields,e.orders)}function rC(e){K.call(this,null,e)}function qle(e,t,n){switch(t){case`upper`:e=e.toUpperCase();break;case`lower`:e=e.toLowerCase();break}return e.match(n)}function iC(e){K.call(this,null,e)}function Jle(e,t,n,r){for(var i=[],a={},o=e.length,s=0,c,l;saC(e,t))):typeof r[n]===$C&&r[n](e[n]);return r}function oC(e){K.call(this,null,e)}function Yle(e){return()=>e.materialize(e.SOURCE).source}function sC(e,t){return e?e.map((e,n)=>t[n]||uh(e)):null}function cC(e,t,n){let r=[],i=e=>e(c),a,o,s,c,l,u;if(t==null)r.push(e.map(n));else for(a={},o=0,s=e.length;ot(n,e),dh(t),uh(t))}function dC(e){K.call(this,[void 0,void 0],e)}function fC(e,t){gx.call(this,e),this.parent=t,this.count=0}function pC(e){K.call(this,{},e),this._keys=ug();let t=this._targets=[];t.active=0,t.forEach=e=>{for(let n=0,r=t.active;nbh(e)):bh(e.name,e.as)}function hC(e){K.call(this,ug(),e)}function gC(e){K.call(this,[],e)}function _C(e){K.call(this,[],e)}function vC(e){K.call(this,null,e)}function yC(e){K.call(this,[],e)}function bC(e){K.call(this,[],e)}function Qle(e){var t=e.method||aw.value,n;if(aw[t]==null)U(`Unrecognized imputation method: `+t);else if(t===aw.value)return n=e.value===void 0?0:e.value,()=>n;else return aw[t]}function $le(e){let t=e.field;return e=>e?t(e):NaN}function eue(e,t,n,r){var i=e=>e(g),a=[],o=r?r.slice():[],s={},c={},l,u,d,f,p,m,h,g;for(o.forEach((e,t)=>s[e]=t+1),f=0,h=e.length;fi&&(i=o[1]);return[r,i]}function OC(e){gx.call(this,null,iue,e)}function iue(e){return this.value&&!e.modified()?this.value:e.values.reduce((e,t)=>e.concat(t),[])}function kC(e){K.call(this,null,e)}function AC(e){QS.call(this,e)}function aue(e,t){let n=e.field,r=e.value,i=(e.op===`count`?`__count__`:e.op)||`sum`,a=dh(n).concat(dh(r)),o=sue(n,e.limit||0,t);return t.changed()&&e.set(`__pivot__`,null,null,!0),{key:e.key,groupby:e.groupby,ops:o.map(()=>i),fields:o.map(e=>oue(e,n,r,a)),as:o.map(e=>e+``),modified:e.modified.bind(e)}}function oue(e,t,n,r){return lh(r=>t(r)===e?n(r):NaN,r,e+``)}function sue(e,t,n){let r={},i=[];return n.visit(n.SOURCE,t=>{let n=e(t);r[n]||(r[n]=1,i.push(n))}),i.sort(rg),t?i.slice(0,t):i}function jC(e){pC.call(this,e)}function MC(e){K.call(this,null,e)}function cue(e,t,n,r){for(let i=0,a=n.length;ic[e]=1)}p(e.sort),t.forEach((e,t)=>{let c=n[t],m=r[t],h=i[t]||null,g=uh(c),_=qS(e,g,a[t]);if(p(c),o.push(_),cg(lw,e))s.push(lue(e,c,m,_));else{if(c==null&&e!==`count`&&U(`Null aggregate field specified.`),e===`count`){u.push(_);return}f=!1;let t=l[g];t||(t=l[g]=[],t.field=c,d.push(t)),t.push(JS(e,h,_))}}),(u.length||d.length)&&(this.cell=due(d,u,f)),this.inputs=Object.keys(c)}function due(e,t,n){e=e.map(e=>XS(e,e.field));let r={num:0,agg:null,store:!1,count:t};if(!n)for(var i=e.length,a=r.agg=Array(i),o=0;on?n:e}function pue(e,t,n,r){e.p0=e.i0,e.p1=e.i1;let i=t[0]==null?0:n+t[0],a=t[1]==null?r:n+t[1]+1;e.i0=WC(i,0,r),e.i1=WC(a,0,r),e.index=n}function mue(e,t){let n=e.i0,r=e.i1-1,i=e.compare,a=e.data,o=a.length-1;n>0&&!i(a[n],a[n-1])&&(e.i0=t.left(a,a[n])),r{Dg(),eS(),GS(),e_(),Ry(),GC=()=>{},KC={init:GC,add:GC,rem:GC,idx:0},qC={values:{init:e=>e.cell.store=!0,value:e=>e.cell.data.values(),idx:-1},count:{value:e=>e.cell.num},__count__:{value:e=>e.missing+e.valid},missing:{value:e=>e.missing},valid:{value:e=>e.valid},sum:{init:e=>e.sum=0,value:e=>e.valid?e.sum:void 0,add:(e,t)=>e.sum+=+t,rem:(e,t)=>e.sum-=t},product:{init:e=>e.product=1,value:e=>e.valid?e.product:void 0,add:(e,t)=>e.product*=t,rem:(e,t)=>e.product/=t},mean:{init:e=>e.mean=0,value:e=>e.valid?e.mean:void 0,add:(e,t)=>(e.mean_d=t-e.mean,e.mean+=e.mean_d/e.valid),rem:(e,t)=>(e.mean_d=t-e.mean,e.mean-=e.valid?e.mean_d/e.valid:e.mean)},average:{value:e=>e.valid?e.mean:void 0,req:[`mean`],idx:1},variance:{init:e=>e.dev=0,value:e=>e.valid>1?Math.max(0,e.dev)/(e.valid-1):void 0,add:(e,t)=>e.dev+=e.mean_d*(t-e.mean),rem:(e,t)=>e.dev-=e.mean_d*(t-e.mean),req:[`mean`],idx:1},variancep:{value:e=>e.valid?Math.max(0,e.dev)/e.valid:void 0,req:[`variance`],idx:2},stdev:{value:e=>e.valid>1?Math.sqrt(Math.max(0,e.dev)/(e.valid-1)):void 0,req:[`variance`],idx:2},stdevp:{value:e=>e.valid?Math.sqrt(Math.max(0,e.dev)/e.valid):void 0,req:[`variance`],idx:2},stderr:{value:e=>e.valid>1?Math.sqrt(Math.max(0,e.dev)/(e.valid*(e.valid-1))):void 0,req:[`variance`],idx:2},distinct:{value:e=>e.cell.data.distinct(e.get),req:[`values`],idx:3},ci0:{value:e=>e.cell.data.ci0(e.get),req:[`values`],idx:3},ci1:{value:e=>e.cell.data.ci1(e.get),req:[`values`],idx:3},median:{value:e=>e.cell.data.q2(e.get),req:[`values`],idx:3},q1:{value:e=>e.cell.data.q1(e.get),req:[`values`],idx:3},q3:{value:e=>e.cell.data.q3(e.get),req:[`values`],idx:3},min:{init:e=>e.min=void 0,value:e=>e.min=Number.isNaN(e.min)?e.cell.data.min(e.get):e.min,add:(e,t)=>{(t{t<=e.min&&(e.min=NaN)},req:[`values`],idx:4},max:{init:e=>e.max=void 0,value:e=>e.max=Number.isNaN(e.max)?e.cell.data.max(e.get):e.max,add:(e,t)=>{(t>e.max||e.max===void 0)&&(e.max=t)},rem:(e,t)=>{t>=e.max&&(e.max=NaN)},req:[`values`],idx:4},argmin:{init:e=>e.argmin=void 0,value:e=>e.argmin||e.cell.data.argmin(e.get),add:(e,t,n)=>{t{t<=e.min&&(e.argmin=void 0)},req:[`min`,`values`],idx:3},argmax:{init:e=>e.argmax=void 0,value:e=>e.argmax||e.cell.data.argmax(e.get),add:(e,t,n)=>{t>e.max&&(e.argmax=n)},rem:(e,t)=>{t>=e.max&&(e.argmax=void 0)},req:[`max`,`values`],idx:3},exponential:{init:(e,t)=>{e.exp=0,e.exp_r=t},value:e=>e.valid?e.exp*(1-e.exp_r)/(1-e.exp_r**e.valid):void 0,add:(e,t)=>e.exp=e.exp_r*e.exp+t,rem:(e,t)=>e.exp=(e.exp-t/e.exp_r**(e.valid-1))/e.exp_r},exponentialb:{value:e=>e.valid?e.exp*(1-e.exp_r):void 0,req:[`exponential`],idx:1}},JC=Object.keys(qC).filter(e=>e!==`__count__`),[...JC,`__count__`].forEach(e=>{qC[e]=Ble(e,qC[e])}),YC=ZS.prototype,YC.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},YC.add=function(e){this._add.push(e)},YC.rem=function(e){this._rem.push(e)},YC.values=function(){if(this._get=null,this._rem.length===0)return this._add;let e=this._add,t=this._rem,n=this._key,r=e.length,i=t.length,a=Array(r-i),o={},s,c,l;for(s=0;s=0;)a=e(t[r])+``,cg(n,a)||(n[a]=1,++i);return i},YC.extent=function(e){if(this._get!==e||!this._ext){let t=this.values(),n=wae(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},YC.argmin=function(e){return this.extent(e)[0]||{}},YC.argmax=function(e){return this.extent(e)[1]||{}},YC.min=function(e){let t=this.extent(e)[0];return t==null?void 0:e(t)},YC.max=function(e){let t=this.extent(e)[1];return t==null?void 0:e(t)},YC.quartile=function(e){return(this._get!==e||!this._q)&&(this._q=rS(this.values(),e),this._get=e),this._q},YC.q1=function(e){return this.quartile(e)[0]},YC.q2=function(e){return this.quartile(e)[1]},YC.q3=function(e){return this.quartile(e)[2]},YC.ci=function(e){return(this._get!==e||!this._ci)&&(this._ci=oS(this.values(),1e3,.05,e),this._get=e),this._ci},YC.ci0=function(e){return this.ci(e)[0]},YC.ci1=function(e){return this.ci(e)[1]},QS.Definition={type:`Aggregate`,metadata:{generates:!0,changes:!0},params:[{name:`groupby`,type:`field`,array:!0},{name:`ops`,type:`enum`,array:!0,values:JC},{name:`aggregate_params`,type:`number`,null:!0,array:!0},{name:`fields`,type:`field`,null:!0,array:!0},{name:`as`,type:`string`,null:!0,array:!0},{name:`drop`,type:`boolean`,default:!0},{name:`cross`,type:`boolean`,default:!1},{name:`key`,type:`field`}]},fg(QS,K,{transform(e,t){let n=this,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.modified();return n.stamp=r.stamp,n.value&&(i||t.modified(n._inputs,!0))?(n._prev=n.value,n.value=i?n.init(e):Object.create(null),t.visit(t.SOURCE,e=>n.add(e))):(n.value=n.value||n.init(e),t.visit(t.REM,e=>n.rem(e)),t.visit(t.ADD,e=>n.add(e))),r.modifies(n._outputs),n._drop=e.drop!==!1,e.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),t.clean()&&n._drop&&r.clean(!0).runAfter(()=>this.clean()),n.changes(r)},cross(){let e=this,t=e.value,n=e._dnames,r=n.map(()=>({})),i=n.length;function a(e){let t,a,o,s;for(t in e)for(o=e[t].tuple,a=0;a{let t=uh(e);return i(e),n.push(t),t}),this.cellkey=e.key?e.key:KS(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];let a=e.fields||[null],o=e.ops||[`count`],s=e.aggregate_params||[null],c=e.as||[],l=a.length,u={},d,f,p,m,h,g,_;for(l!==o.length&&U(`Unmatched number of fields and aggregate ops.`),_=0;_XS(e,e.field)),Object.create(null)},cellkey:KS(),cell(e,t){let n=this.value[e];return n?n.num===0&&this._drop&&n.stamp{let t=r(e);e[s]=t,e[c]=t==null?null:i+a*(1+(t-i)/a)}:e=>e[s]=r(e)),t.modifies(n?o:s)},_bins(e){if(this.value&&!e.modified())return this.value;let t=e.field,n=aS(e),r=n.step,i=n.start,a=i+Math.ceil((n.stop-i)/r)*r,o,s;(o=e.anchor)!=null&&(s=o-(i+r*Math.floor((o-i)/r)),i+=s,a+=s);let c=function(e){let n=Rh(t(e));return n==null?null:na?1/0:(n=Math.max(i,Math.min(n,a-r)),i+r*Math.floor(XC+(n-i)/r))};return c.start=i,c.stop=a,c.step=r,this.value=lh(c,dh(t),e.name||`bin_`+uh(t))}}),tC.Definition={type:`Collect`,metadata:{source:!0},params:[{name:`sort`,type:`compare`}]},fg(tC,K,{transform(e,t){let n=t.fork(t.ALL),r=eC(ox,this.value,n.materialize(n.ADD).add),i=e.sort,a=t.changed()||i&&(e.modified(`sort`)||t.modified(i.fields));return n.visit(n.REM,r.remove),this.modified(a),this.value=n.source=r.data(fx(i),a),t.source&&t.source.root&&(this.value.root=t.source.root),n}}),fg(nC,gx),rC.Definition={type:`CountPattern`,metadata:{generates:!0,changes:!0},params:[{name:`field`,type:`field`,required:!0},{name:`case`,type:`enum`,values:[`upper`,`lower`,`mixed`],default:`mixed`},{name:`pattern`,type:`string`,default:`[\\w"]+`},{name:`stopwords`,type:`string`,default:``},{name:`as`,type:`string`,array:!0,length:2,default:[`text`,`count`]}]},fg(rC,K,{transform(e,t){let n=t=>n=>{for(var r=qle(s(n),e.case,a)||[],i,c=0,l=r.length;ci[e]=1+(i[e]||0)),u=n(e=>--i[e]);return r?t.visit(t.SOURCE,l):(t.visit(t.ADD,l),t.visit(t.REM,u)),this._finish(t,c)},_parameterCheck(e,t){let n=!1;return(e.modified(`stopwords`)||!this._stop)&&(this._stop=RegExp(`^`+(e.stopwords||``)+`$`,`i`),n=!0),(e.modified(`pattern`)||!this._match)&&(this._match=new RegExp(e.pattern||`[\\w']+`,`g`),n=!0),(e.modified(`field`)||t.modified(e.field.fields))&&(n=!0),n&&(this._counts={}),n},_finish(e,t){let n=this._counts,r=this._tuples||={},i=t[0],a=t[1],o=e.fork(e.NO_SOURCE|e.NO_FIELDS),s,c,l;for(s in n)c=r[s],l=n[s]||0,!c&&l?(r[s]=c=cx({}),c[i]=s,c[a]=l,o.add.push(c)):l===0?(c&&o.rem.push(c),n[s]=null,r[s]=null):c[a]!==l&&(c[a]=l,o.mod.push(c));return o.modifies(t)}}),iC.Definition={type:`Cross`,metadata:{generates:!0},params:[{name:`filter`,type:`expr`},{name:`as`,type:`string`,array:!0,length:2,default:[`a`,`b`]}]},fg(iC,K,{transform(e,t){let n=t.fork(t.NO_SOURCE),r=e.as||[`a`,`b`],i=r[0],a=r[1],o=!this.value||t.changed(t.ADD_REM)||e.modified(`as`)||e.modified(`filter`),s=this.value;return o?(s&&(n.rem=s),s=t.materialize(t.SOURCE).source,n.add=this.value=Jle(s,i,a,e.filter||Eh)):n.mod=s,n.source=this.value,n.modifies(r)}}),ZC={kde:pS,mixture:yS,normal:fS,lognormal:vS,uniform:wS},QC=`distributions`,$C=`function`,ew=`field`,tw=[{key:{function:`normal`},params:[{name:`mean`,type:`number`,default:0},{name:`stdev`,type:`number`,default:1}]},{key:{function:`lognormal`},params:[{name:`mean`,type:`number`,default:0},{name:`stdev`,type:`number`,default:1}]},{key:{function:`uniform`},params:[{name:`min`,type:`number`,default:0},{name:`max`,type:`number`,default:1}]},{key:{function:`kde`},params:[{name:`field`,type:`field`,required:!0},{name:`from`,type:`data`},{name:`bandwidth`,type:`number`,default:0}]}],nw={key:{function:`mixture`},params:[{name:`distributions`,type:`param`,array:!0,params:tw},{name:`weights`,type:`number`,array:!0}]},oC.Definition={type:`Density`,metadata:{generates:!0},params:[{name:`extent`,type:`number`,array:!0,length:2},{name:`steps`,type:`number`},{name:`minsteps`,type:`number`,default:25},{name:`maxsteps`,type:`number`,default:200},{name:`method`,type:`string`,default:`pdf`,values:[`pdf`,`cdf`]},{name:`distribution`,type:`param`,params:tw.concat(nw)},{name:`as`,type:`string`,array:!0,default:[`value`,`density`]}]},fg(oC,K,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){let r=aC(e.distribution,Yle(t)),i=e.steps||e.minsteps||25,a=e.steps||e.maxsteps||200,o=e.method||`pdf`;o!==`pdf`&&o!==`cdf`&&U(`Invalid density method: `+o),!e.extent&&!r.data&&U(`Missing density extent parameter.`),o=r[o];let s=e.as||[`value`,`density`],c=e.extent||sg(r.data()),l=LS(o,c,i,a).map(e=>{let t={};return t[s[0]]=e[0],t[s[1]]=e[1],cx(t)});this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}}),rw=`bin`,lC.Definition={type:`DotBin`,metadata:{modifies:!0},params:[{name:`field`,type:`field`,required:!0},{name:`groupby`,type:`field`,array:!0},{name:`step`,type:`number`},{name:`smooth`,type:`boolean`,default:!1},{name:`as`,type:`string`,default:rw}]},iw=(e,t)=>xg(sg(e,t))/30,fg(lC,K,{transform(e,t){if(this.value&&!(e.modified()||t.changed()))return t;let n=t.materialize(t.SOURCE).source,r=cC(t.source,e.groupby,Ch),i=e.smooth||!1,a=e.field,o=e.step||iw(n,a),s=fx((e,t)=>a(e)-a(t)),c=e.as||rw,l=r.length,u=1/0,d=-1/0,f=0,p;for(;fd&&(d=t),e[++p][c]=t}return this.value={start:u,stop:d,step:o},t.reflow(!0).modifies(c)}}),fg(uC,gx),dC.Definition={type:`Extent`,metadata:{},params:[{name:`field`,type:`field`,required:!0}]},fg(dC,K,{transform(e,t){let n=this.value,r=e.field,i=t.changed()||t.modified(r.fields)||e.modified(`field`),a=n[0],o=n[1];if((i||a==null)&&(a=1/0,o=-1/0),t.visit(i?t.SOURCE:t.ADD,e=>{let t=Rh(r(e));t!=null&&(to&&(o=t))}),!Number.isFinite(a)||!Number.isFinite(o)){let e=uh(r);e&&=` for field "${e}"`,t.dataflow.warn(`Infinite extent${e}: [${a}, ${o}]`),a=o=void 0}this.value=[a,o]}}),fg(fC,gx,{connect(e){return this.detachSubflow=e.detachSubflow,this.targets().add(e),e.source=this},add(e){this.count+=1,this.value.add.push(e)},rem(e){--this.count,this.value.rem.push(e)},mod(e){this.value.mod.push(e)},init(e){this.value.init(e,e.NO_SOURCE)},evaluate(){return this.value}}),fg(pC,K,{activate(e){this._targets[this._targets.active++]=e},subflow(e,t,n,r){let i=this.value,a=cg(i,e)&&i[e],o,s;return a?a.value.stampe&&e.count>0);this.initTargets(e)}},initTargets(e){let t=this._targets,n=t.length,r=e?e.length:0,i=0;for(;ithis.subflow(e,i,t);return this._group=e.group||{},this.initTargets(),t.visit(t.REM,e=>{let t=ox(e),n=a.get(t);n!==void 0&&(a.delete(t),s(n).rem(e))}),t.visit(t.ADD,e=>{let t=r(e);a.set(ox(e),t),s(t).add(e)}),o||t.modified(r.fields)?t.visit(t.MOD,e=>{let t=ox(e),n=a.get(t),i=r(e);n===i?s(i).mod(e):(a.set(t,i),s(n).rem(e),s(i).add(e))}):t.changed(t.MOD)&&t.visit(t.MOD,e=>{s(a.get(ox(e))).mod(e)}),o&&t.visit(t.REFLOW,e=>{let t=ox(e),n=a.get(t),i=r(e);n!==i&&(a.set(t,i),s(n).rem(e),s(i).add(e))}),t.clean()?n.runAfter(()=>{this.clean(),a.clean()}):a.empty>n.cleanThreshold&&n.runAfter(a.clean),t}}),fg(mC,gx),hC.Definition={type:`Filter`,metadata:{changes:!0},params:[{name:`expr`,type:`expr`,required:!0}]},fg(hC,K,{transform(e,t){let n=t.dataflow,r=this.value,i=t.fork(),a=i.add,o=i.rem,s=i.mod,c=e.expr,l=!0;t.visit(t.REM,e=>{let t=ox(e);r.has(t)?r.delete(t):o.push(e)}),t.visit(t.ADD,t=>{c(t,e)?a.push(t):r.set(ox(t),1)});function u(t){let n=ox(t),i=c(t,e),u=r.get(n);i&&u?(r.delete(n),a.push(t)):!i&&!u?(r.set(n,1),o.push(t)):l&&i&&!u&&s.push(t)}return t.visit(t.MOD,u),e.modified()&&(l=!1,t.visit(t.REFLOW,u)),r.empty>n.cleanThreshold&&n.runAfter(r.clean),i}}),gC.Definition={type:`Flatten`,metadata:{generates:!0},params:[{name:`fields`,type:`field`,array:!0,required:!0},{name:`index`,type:`string`},{name:`as`,type:`string`,array:!0}]},fg(gC,K,{transform(e,t){let n=t.fork(t.NO_SOURCE),r=e.fields,i=sC(r,e.as||[]),a=e.index||null,o=i.length;return n.rem=this.value,t.visit(t.SOURCE,e=>{let t=r.map(t=>t(e)),s=t.reduce((e,t)=>Math.max(e,t.length),0),c=0,l,u;for(;c{for(let t=0,a;tt[r]=n(t,e))}}),fg(yC,K,{transform(e,t){let n=t.fork(t.ALL),r=e.generator,i=this.value,a=e.size-i.length,o,s,c;if(a>0){for(o=[];--a>=0;)o.push(c=cx(r(e))),i.push(c);n.add=n.add.length?n.materialize(n.ADD).add.concat(o):o}else s=i.slice(0,-a),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(s):s,i=i.slice(-a);return n.source=this.value=i,n}}),aw={value:`value`,median:use,mean:cse,min:Xg,max:Yg},ow=[],bC.Definition={type:`Impute`,metadata:{changes:!0},params:[{name:`field`,type:`field`,required:!0},{name:`key`,type:`field`,required:!0},{name:`keyvals`,array:!0},{name:`groupby`,type:`field`,array:!0},{name:`method`,type:`enum`,default:`value`,values:[`value`,`mean`,`median`,`max`,`min`]},{name:`value`,default:0}]},fg(bC,K,{transform(e,t){var n=t.fork(t.ALL),r=Qle(e),i=$le(e),a=uh(e.field),o=uh(e.key),s=(e.groupby||[]).map(uh),c=eue(t.source,e.groupby,e.key,e.keyvals),l=[],u=this.value,d=c.domain.length,f,p,m,h,g,_,v,y,b,x;for(g=0,y=c.length;gn.add(e))):(i=n.value=n.value||this.init(e),t.visit(t.REM,e=>n.rem(e)),t.visit(t.ADD,e=>n.add(e))),n.changes(),t.visit(t.SOURCE,e=>{og(e,i[n.cellkey(e)].tuple)}),t.reflow(r).modifies(this._outputs)},changes(){let e=this._adds,t=this._mods,n,r;for(n=0,r=this._alen;n{let n=pS(t,o)[s],r=e.counts?t.length:1;LS(n,u||sg(t),d,f).forEach(e=>{let n={};for(let e=0;e(this._pending=Qh(e.data),e=>e.touch(this)))}:n.request(e.url,e.format).then(e=>TC(this,t,Qh(e.data)))}}),EC.Definition={type:`Lookup`,metadata:{modifies:!0},params:[{name:`index`,type:`index`,params:[{name:`from`,type:`data`,required:!0},{name:`key`,type:`field`,required:!0}]},{name:`values`,type:`field`,array:!0},{name:`fields`,type:`field`,array:!0,required:!0},{name:`as`,type:`string`,array:!0},{name:`default`,default:null}]},fg(EC,K,{transform(e,t){let n=e.fields,r=e.index,i=e.values,a=e.default==null?null:e.default,o=e.modified(),s=n.length,c=o?t.SOURCE:t.ADD,l=t,u=e.as,d,f,p;return i?(f=i.length,s>1&&!u&&U(`Multi-field lookup requires explicit "as" parameter.`),u&&u.length!==s*f&&U(`The "as" parameter has too few output field names.`),u||=i.map(uh),d=function(e){for(var t=0,o=0,c,l;tt.modified(e.fields)),c|=p?t.MOD:0),t.visit(c,d),l.modifies(u)}}),fg(DC,gx),fg(OC,gx),fg(kC,K,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),AC.Definition={type:`Pivot`,metadata:{generates:!0,changes:!0},params:[{name:`groupby`,type:`field`,array:!0},{name:`field`,type:`field`,required:!0},{name:`value`,type:`field`,required:!0},{name:`op`,type:`enum`,values:JC,default:`sum`},{name:`limit`,type:`number`,default:0},{name:`key`,type:`field`}]},fg(AC,QS,{_transform:QS.prototype.transform,transform(e,t){return this._transform(aue(e,t),t)}}),fg(jC,pC,{transform(e,t){let n=e.subflow,r=e.field,i=e=>this.subflow(ox(e),n,t,e);return(e.modified(`field`)||r&&t.modified(dh(r)))&&U(`PreFacet does not support field modification.`),this.initTargets(),r?(t.visit(t.MOD,e=>{let t=i(e);r(e).forEach(e=>t.mod(e))}),t.visit(t.ADD,e=>{let t=i(e);r(e).forEach(e=>t.add(cx(e)))}),t.visit(t.REM,e=>{let t=i(e);r(e).forEach(e=>t.rem(e))})):(t.visit(t.MOD,e=>i(e).mod(e)),t.visit(t.ADD,e=>i(e).add(e)),t.visit(t.REM,e=>i(e).rem(e))),t.clean()&&t.runAfter(()=>this.clean()),t}}),MC.Definition={type:`Project`,metadata:{generates:!0,changes:!0},params:[{name:`fields`,type:`field`,array:!0},{name:`as`,type:`string`,null:!0,array:!0}]},fg(MC,K,{transform(e,t){let n=t.fork(t.NO_SOURCE),r=e.fields,i=sC(e.fields,e.as||[]),a=r?(e,t)=>cue(e,t,r,i):ux,o;return this.value?o=this.value:(t=t.addAll(),o=this.value={}),t.visit(t.REM,e=>{let t=ox(e);n.rem.push(o[t]),o[t]=null}),t.visit(t.ADD,e=>{let t=a(e,cx({}));o[ox(e)]=t,n.add.push(t)}),t.visit(t.MOD,e=>{n.mod.push(a(e,o[ox(e)]))}),n}}),fg(NC,K,{transform(e,t){return this.value=e.value,e.modified(`value`)?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}}),PC.Definition={type:`Quantile`,metadata:{generates:!0,changes:!0},params:[{name:`groupby`,type:`field`,array:!0},{name:`field`,type:`field`,required:!0},{name:`probs`,type:`number`,array:!0},{name:`step`,type:`number`,default:.01},{name:`as`,type:`string`,array:!0,default:[`prob`,`value`]}]},sw=1e-14,fg(PC,K,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.as||[`prob`,`value`];if(this.value&&!e.modified()&&!t.changed())return n.source=this.value,n;let i=t.materialize(t.SOURCE).source,a=cC(i,e.groupby,e.field),o=(e.groupby||[]).map(uh),s=[],c=e.step||.01,l=e.probs||$g(c/2,1-sw,c),u=l.length;return a.forEach(e=>{let t=nS(e,l);for(let n=0;n{let t=ox(e);n.rem.push(r[t]),r[t]=null}),t.visit(t.ADD,e=>{let t=lx(e);r[ox(e)]=t,n.add.push(t)}),t.visit(t.MOD,e=>{let t=r[ox(e)];for(let r in e)t[r]=e[r],n.modifies(r);n.mod.push(t)})),n}}),IC.Definition={type:`Sample`,metadata:{},params:[{name:`size`,type:`number`,default:1e3}]},fg(IC,K,{transform(e,t){let n=t.fork(t.NO_SOURCE),r=e.modified(`size`),i=e.size,a=this.value.reduce((e,t)=>(e[ox(t)]=1,e),{}),o=this.value,s=this.count,c=0;function l(e){let t,r;o.length=c&&(t=o[r],a[ox(t)]&&n.rem.push(t),o[r]=e)),++s}if(t.rem.length&&(t.visit(t.REM,e=>{let t=ox(e);a[t]&&(a[t]=-1,n.rem.push(e)),--s}),o=o.filter(e=>a[ox(e)]!==-1)),(t.rem.length||r)&&o.length{a[ox(e)]||l(e)}),c=-1),r&&o.length>i){let e=o.length-i;for(let t=0;t{a[ox(e)]&&n.mod.push(e)}),t.add.length&&t.visit(t.ADD,l),(t.add.length||c<0)&&(n.add=o.filter(e=>!a[ox(e)])),this.count=s,this.value=n.source=o,n}}),LC.Definition={type:`Sequence`,metadata:{generates:!0,changes:!0},params:[{name:`start`,type:`number`,required:!0},{name:`stop`,type:`number`,required:!0},{name:`step`,type:`number`,default:1},{name:`as`,type:`string`,default:`data`}]},fg(LC,K,{transform(e,t){if(this.value&&!e.modified())return;let n=t.materialize().fork(t.MOD),r=e.as||`data`;return n.rem=this.value?t.rem.concat(this.value):t.rem,this.value=$g(e.start,e.stop,e.step||1).map(e=>{let t={};return t[r]=e,cx(t)}),n.add=t.add.concat(this.value),n}}),fg(RC,K,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}}),cw=[`unit0`,`unit1`],zC.Definition={type:`TimeUnit`,metadata:{modifies:!0},params:[{name:`field`,type:`field`,required:!0},{name:`interval`,type:`boolean`,default:!0},{name:`units`,type:`enum`,values:ly,array:!0},{name:`step`,type:`number`,default:1},{name:`maxbins`,type:`number`,default:40},{name:`extent`,type:`date`,array:!0},{name:`inferUnits`,type:`boolean`,default:!1},{name:`timezone`,type:`enum`,default:`local`,values:[`local`,`utc`]},{name:`as`,type:`string`,array:!0,length:2,default:cw}]},fg(zC,K,{transform(e,t){let n=e.field,r=e.interval!==!1,i=e.timezone===`utc`,a=this._floor(e,t),o=(i?Wv:Uv)(a.unit).offset,s=e.as||cw,c=s[0],l=s[1],u=a.step,d=a.start||1/0,f=a.stop||-1/0,p=t.ADD;return(e.modified()||t.changed(t.REM)||t.modified(dh(n)))&&(t=t.reflow(!0),p=t.SOURCE,d=1/0,f=-1/0),t.visit(p,e=>{let t=n(e),i,s;t==null?(e[c]=null,r&&(e[l]=null)):(e[c]=i=s=a(t),r&&(e[l]=s=o(i,u)),if&&(f=s))}),a.start=d,a.stop=f,t.modifies(r?s:c)},_floor(e,t){let n=e.timezone===`utc`;e.inferUnits&&(e.units||e.step!=null||e.maxbins!=null||e.extent)&&t.dataflow.warn(`TimeUnit inferUnits overrides units, step, maxbins and extent.`);let{units:r,step:i}=e.inferUnits?Qv(t.materialize(t.SOURCE).source,e.field,n):e.units?{units:e.units,step:e.step||1}:Zv({extent:e.extent||sg(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),a=Ev(r),o=this.value||{},s=(n?Hv:Vv)(a,i);return s.unit=Ih(a),s.units=a,s.step=i,s.start=o.start,s.stop=o.stop,this.value=s}}),fg(BC,K,{transform(e,t){let n=t.dataflow,r=e.field,i=this.value,a=e=>i.set(r(e),e),o=!0;return e.modified(`field`)||t.modified(r.fields)?(i.clear(),t.visit(t.SOURCE,a)):t.changed()?(t.visit(t.REM,e=>i.delete(r(e))),t.visit(t.ADD,a)):o=!1,this.modified(o),i.empty>n.cleanThreshold&&n.runAfter(i.clean),t.fork()}}),fg(VC,K,{transform(e,t){(!this.value||e.modified(`field`)||e.modified(`sort`)||t.changed()||e.sort&&t.modified(e.sort.fields))&&(this.value=(e.sort?t.source.slice().sort(fx(e.sort)):t.source).map(e.field))}}),lw={row_number:function(){return{next:e=>e.index+1}},rank:function(){let e;return{init:()=>e=1,next:t=>{let n=t.index,r=t.data;return n&&t.compare(r[n-1],r[n])?e=n+1:e}}},dense_rank:function(){let e;return{init:()=>e=1,next:t=>{let n=t.index,r=t.data;return n&&t.compare(r[n-1],r[n])?++e:e}}},percent_rank:function(){let e=lw.rank(),t=e.next;return{init:e.init,next:e=>(t(e)-1)/(e.data.length-1)}},cume_dist:function(){let e;return{init:()=>e=0,next:t=>{let n=t.data,r=t.compare,i=t.index;if(e0||U(`ntile num must be greater than zero.`);let n=lw.cume_dist(),r=n.next;return{init:n.init,next:e=>Math.ceil(t*r(e))}},lag:function(e,t){return t=+t||1,{next:n=>{let r=n.index-t;return r>=0?e(n.data[r]):null}}},lead:function(e,t){return t=+t||1,{next:n=>{let r=n.index+t,i=n.data;return re(t.data[t.i0])}},last_value:function(e){return{next:t=>e(t.data[t.i1-1])}},nth_value:function(e,t){return t=+t,t>0||U(`nth_value nth must be greater than zero.`),{next:n=>{let r=n.i0+(t-1);return rt=null,next:n=>{let r=e(n.data[n.index]);return r==null?t:t=r}}},next_value:function(e){let t,n;return{init:()=>(t=null,n=-1),next:r=>{let i=r.data;return r.index<=n?t:(n=uue(e,i,r.index))<0?(n=i.length,t=null):t=e(i[n])}}}},uw=Object.keys(lw),dw=HC.prototype,dw.init=function(){this.windows.forEach(e=>e.init()),this.cell&&this.cell.init()},dw.update=function(e,t){let n=this.cell,r=this.windows,i=e.data,a=r&&r.length,o;if(n){for(o=e.p0;othis.group(i(e)),o=this.state;(!o||n)&&(o=this.state=new HC(e)),n||t.modified(o.inputs)?(this.value={},t.visit(t.SOURCE,e=>a(e).add(e))):(t.visit(t.REM,e=>a(e).remove(e)),t.visit(t.ADD,e=>a(e).add(e)));for(let t=0,n=this._mlen;t{}));function gue(e){return e>1?0:e<-1?Sw:Math.acos(e)}function mw(e){return e>=1?Cw:e<=-1?-Cw:Math.asin(e)}var hw,gw,_w,vw,yw,bw,xw,Sw,Cw,ww,Tw=o((()=>{hw=Math.abs,gw=Math.atan2,_w=Math.cos,vw=Math.max,yw=Math.min,bw=Math.sin,xw=Math.sqrt,Sw=Math.PI,Cw=Sw/2,ww=2*Sw}));function Ew(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return Ew;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t{Ow=Math.PI,kw=2*Ow,Aw=1e-6,jw=kw-Aw,Mw=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?Ew:_ue(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>Aw)if(!(Math.abs(u*s-c*l)>Aw)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((Ow-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>Aw&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>Aw||Math.abs(this._y1-l)>Aw)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%kw+kw),d>jw?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>Aw&&this._append`A${n},${n},0,${+(d>=Ow)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}},Dw.prototype=Mw.prototype})),Nw=o((()=>{vue()}));function Pw(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Mw(t)}var Fw=o((()=>{Nw()}));function yue(e){return e.innerRadius}function bue(e){return e.outerRadius}function xue(e){return e.startAngle}function Sue(e){return e.endAngle}function Cue(e){return e&&e.padAngle}function wue(e,t,n,r,i,a,o,s){var c=n-e,l=r-t,u=o-i,d=s-a,f=d*c-u*l;if(!(f*f<1e-12))return f=(u*(t-a)-d*(e-i))/f,[e+f*c,t+f*l]}function Iw(e,t,n,r,i,a,o){var s=e-n,c=t-r,l=(o?a:-a)/xw(s*s+c*c),u=l*c,d=-l*s,f=e+u,p=t+d,m=n+u,h=r+d,g=(f+m)/2,_=(p+h)/2,v=m-f,y=h-p,b=v*v+y*y,x=i-a,S=f*h-m*p,C=(y<0?-1:1)*xw(vw(0,x*x*b-S*S)),w=(S*y-v*C)/b,T=(-S*v-y*C)/b,E=(S*y+v*C)/b,D=(-S*v+y*C)/b,O=w-g,k=T-_,A=E-g,j=D-_;return O*O+k*k>A*A+j*j&&(w=E,T=D),{cx:w,cy:T,x01:-u,y01:-d,x11:w*(i/x-1),y11:T*(i/x-1)}}function Tue(){var e=yue,t=bue,n=fw(0),r=null,i=xue,a=Sue,o=Cue,s=null,c=Pw(l);function l(){var l,u,d=+e.apply(this,arguments),f=+t.apply(this,arguments),p=i.apply(this,arguments)-Cw,m=a.apply(this,arguments)-Cw,h=hw(m-p),g=m>p;if(s||=l=c(),f1e-12))s.moveTo(0,0);else if(h>ww-1e-12)s.moveTo(f*_w(p),f*bw(p)),s.arc(0,0,f,p,m,!g),d>1e-12&&(s.moveTo(d*_w(m),d*bw(m)),s.arc(0,0,d,m,p,g));else{var _=p,v=m,y=p,b=m,x=h,S=h,C=o.apply(this,arguments)/2,w=C>1e-12&&(r?+r.apply(this,arguments):xw(d*d+f*f)),T=yw(hw(f-d)/2,+n.apply(this,arguments)),E=T,D=T,O,k;if(w>1e-12){var A=mw(w/d*bw(C)),j=mw(w/f*bw(C));(x-=A*2)>1e-12?(A*=g?1:-1,y+=A,b-=A):(x=0,y=b=(p+m)/2),(S-=j*2)>1e-12?(j*=g?1:-1,_+=j,v-=j):(S=0,_=v=(p+m)/2)}var M=f*_w(_),N=f*bw(_),P=d*_w(b),F=d*bw(b);if(T>1e-12){var ee=f*_w(v),I=f*bw(v),te=d*_w(y),L=d*bw(y),ne;if(h1e-12?D>1e-12?(O=Iw(te,L,M,N,f,D,g),k=Iw(ee,I,P,F,f,D,g),s.moveTo(O.cx+O.x01,O.cy+O.y01),D1e-12)||!(x>1e-12)?s.lineTo(P,F):E>1e-12?(O=Iw(P,F,ee,I,d,-E,g),k=Iw(M,N,te,L,d,-E,g),s.lineTo(O.cx+O.x01,O.cy+O.y01),E{pw(),Tw(),Fw()}));function Lw(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}var Rw=o((()=>{Array.prototype.slice}));function zw(e){this._context=e}function Bw(e){return new zw(e)}var Vw=o((()=>{zw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}}}));function Hw(e){return e[0]}function Uw(e){return e[1]}var Ww=o((()=>{}));function Gw(e,t){var n=fw(!0),r=null,i=Bw,a=null,o=Pw(s);e=typeof e==`function`?e:e===void 0?Hw:fw(e),t=typeof t==`function`?t:t===void 0?Uw:fw(t);function s(s){var c,l=(s=Lw(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c{Rw(),pw(),Vw(),Fw(),Ww()}));function qw(e,t,n){var r=null,i=fw(!0),a=null,o=Bw,s=null,c=Pw(l);e=typeof e==`function`?e:e===void 0?Hw:fw(+e),t=typeof t==`function`?t:fw(t===void 0?0:+t),n=typeof n==`function`?n:n===void 0?Uw:fw(+n);function l(l){var u,d,f,p=(l=Lw(l)).length,m,h=!1,g,_=Array(p),v=Array(p);for(a??(s=o(g=c())),u=0;u<=p;++u){if(!(u=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return Gw().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:fw(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:fw(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:fw(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:fw(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:fw(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:fw(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:fw(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var Due=o((()=>{Rw(),pw(),Vw(),Kw(),Fw(),Ww()})),Jw,Yw=o((()=>{Tw(),Jw={draw(e,t){let n=xw(t/Sw);e.moveTo(n,0),e.arc(0,0,n,0,ww)}}}));function Oue(e,t){let n=null,r=Pw(i);e=typeof e==`function`?e:fw(e||Jw),t=typeof t==`function`?t:fw(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:fw(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:fw(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}var kue=o((()=>{pw(),Fw(),Yw()}));function Xw(){}var Zw=o((()=>{}));function Qw(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function $w(e){this._context=e}function Aue(e){return new $w(e)}var eT=o((()=>{$w.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Qw(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Qw(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}}));function tT(e){this._context=e}function jue(e){return new tT(e)}var Mue=o((()=>{Zw(),eT(),tT.prototype={areaStart:Xw,areaEnd:Xw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Qw(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}}));function nT(e){this._context=e}function Nue(e){return new nT(e)}var Pue=o((()=>{eT(),nT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Qw(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}}));function rT(e,t){this._basis=new $w(e),this._beta=t}var iT,Fue=o((()=>{eT(),rT.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],i=t[0],a=e[n]-r,o=t[n]-i,s=-1,c;++s<=n;)c=s/n,this._basis.point(this._beta*e[s]+(1-this._beta)*(r+c*a),this._beta*t[s]+(1-this._beta)*(i+c*o));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}},iT=(function e(t){function n(e){return t===1?new $w(e):new rT(e,t)}return n.beta=function(t){return e(+t)},n})(.85)}));function aT(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function oT(e,t){this._context=e,this._k=(1-t)/6}var sT,cT=o((()=>{oT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:aT(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:aT(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},sT=(function e(t){function n(e){return new oT(e,t)}return n.tension=function(t){return e(+t)},n})(0)}));function lT(e,t){this._context=e,this._k=(1-t)/6}var uT,dT=o((()=>{Zw(),cT(),lT.prototype={areaStart:Xw,areaEnd:Xw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:aT(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},uT=(function e(t){function n(e){return new lT(e,t)}return n.tension=function(t){return e(+t)},n})(0)}));function fT(e,t){this._context=e,this._k=(1-t)/6}var pT,mT=o((()=>{cT(),fT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:aT(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},pT=(function e(t){function n(e){return new fT(e,t)}return n.tension=function(t){return e(+t)},n})(0)}));function hT(e,t,n){var r=e._x1,i=e._y1,a=e._x2,o=e._y2;if(e._l01_a>1e-12){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,i=(i*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>1e-12){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);a=(a*l+e._x1*e._l23_2a-t*e._l12_2a)/u,o=(o*l+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,a,o,e._x2,e._y2)}function gT(e,t){this._context=e,this._alpha=t}var _T,vT=o((()=>{Tw(),cT(),gT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:hT(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},_T=(function e(t){function n(e){return t?new gT(e,t):new oT(e,0)}return n.alpha=function(t){return e(+t)},n})(.5)}));function yT(e,t){this._context=e,this._alpha=t}var bT,Iue=o((()=>{dT(),Zw(),vT(),yT.prototype={areaStart:Xw,areaEnd:Xw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:hT(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},bT=(function e(t){function n(e){return t?new yT(e,t):new lT(e,0)}return n.alpha=function(t){return e(+t)},n})(.5)}));function xT(e,t){this._context=e,this._alpha=t}var ST,Lue=o((()=>{mT(),vT(),xT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:hT(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},ST=(function e(t){function n(e){return t?new xT(e,t):new fT(e,0)}return n.alpha=function(t){return e(+t)},n})(.5)}));function CT(e){this._context=e}function Rue(e){return new CT(e)}var zue=o((()=>{Zw(),CT.prototype={areaStart:Xw,areaEnd:Xw,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}}}));function wT(e){return e<0?-1:1}function TT(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(wT(a)+wT(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function ET(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function DT(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function OT(e){this._context=e}function kT(e){this._context=new AT(e)}function AT(e){this._context=e}function Bue(e){return new OT(e)}function Vue(e){return new kT(e)}var Hue=o((()=>{OT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:DT(this,this._t0,ET(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,DT(this,ET(this,n=TT(this,e,t)),n);break;default:DT(this,this._t0,n=TT(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(kT.prototype=Object.create(OT.prototype)).point=function(e,t){OT.prototype.point.call(this,t,e)},AT.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}}}));function jT(e){this._context=e}function MT(e){var t,n=e.length-1,r,i=Array(n),a=Array(n),o=Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t{jT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=MT(e),i=MT(t),a=0,o=1;o{NT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}this._x=e,this._y=t}}})),Yue=o((()=>{Eue(),Due(),Kw(),Rw(),pw(),Tw(),Vw(),Fw(),kue(),Yw(),Mue(),Pue(),eT(),Fue(),dT(),mT(),cT(),Iue(),Lue(),vT(),zue(),Hue(),Wue(),Jue()}));function PT(e,t){if(typeof document<`u`&&document.createElement){let n=document.createElement(`canvas`);if(n&&n.getContext)return n.width=e,n.height=t,n}return null}var FT,IT=o((()=>{FT=()=>typeof Image<`u`?Image:null}));function LT(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function RT(e,t){switch(arguments.length){case 0:break;case 1:typeof e==`function`?this.interpolator(e):this.range(e);break;default:this.domain(e),typeof t==`function`?this.interpolator(t):this.range(t);break}return this}var zT=o((()=>{}));function BT(){var e=new Hg,t=[],n=[],r=VT;function i(i){let a=e.get(i);if(a===void 0){if(r!==VT)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new Hg;for(let r of n)e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return BT(t,n).unknown(r)},LT.apply(i,arguments),i}var VT,Xue=o((()=>{e_(),zT(),VT=Symbol(`implicit`)}));function HT(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function UT(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}var WT=o((()=>{}));function GT(){}function KT(){return this.rgb().formatHex()}function Zue(){return this.rgb().formatHex8()}function Que(){return oE(this).formatHsl()}function qT(){return this.rgb().formatRgb()}function JT(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=ede.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?YT(t):n===3?new $T(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?XT(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?XT(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=tde.exec(e))?new $T(t[1],t[2],t[3],1):(t=nde.exec(e))?new $T(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=rde.exec(e))?XT(t[1],t[2],t[3],t[4]):(t=ide.exec(e))?XT(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ade.exec(e))?aE(t[1],t[2]/100,t[3]/100,1):(t=ode.exec(e))?aE(t[1],t[2]/100,t[3]/100,t[4]):_E.hasOwnProperty(e)?YT(_E[e]):e===`transparent`?new $T(NaN,NaN,NaN,0):null}function YT(e){return new $T(e>>16&255,e>>8&255,e&255,1)}function XT(e,t,n,r){return r<=0&&(e=t=n=NaN),new $T(e,t,n,r)}function ZT(e){return e instanceof GT||(e=JT(e)),e?(e=e.rgb(),new $T(e.r,e.g,e.b,e.opacity)):new $T}function QT(e,t,n,r){return arguments.length===1?ZT(e):new $T(e,t,n,r??1)}function $T(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function eE(){return`#${iE(this.r)}${iE(this.g)}${iE(this.b)}`}function $ue(){return`#${iE(this.r)}${iE(this.g)}${iE(this.b)}${iE((isNaN(this.opacity)?1:this.opacity)*255)}`}function tE(){let e=nE(this.opacity);return`${e===1?`rgb(`:`rgba(`}${rE(this.r)}, ${rE(this.g)}, ${rE(this.b)}${e===1?`)`:`, ${e})`}`}function nE(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function rE(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function iE(e){return e=rE(e),(e<16?`0`:``)+e.toString(16)}function aE(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new cE(e,t,n,r)}function oE(e){if(e instanceof cE)return new cE(e.h,e.s,e.l,e.opacity);if(e instanceof GT||(e=JT(e)),!e)return new cE;if(e instanceof cE)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n0&&c<1?0:o,new cE(o,s,c,e.opacity)}function sE(e,t,n,r){return arguments.length===1?oE(e):new cE(e,t,n,r??1)}function cE(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function lE(e){return e=(e||0)%360,e<0?e+360:e}function uE(e){return Math.max(0,Math.min(1,e||0))}function dE(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var fE,pE,mE,hE,gE,ede,tde,nde,rde,ide,ade,ode,_E,vE=o((()=>{WT(),fE=.7,pE=1/fE,mE=`\\s*([+-]?\\d+)\\s*`,hE=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,gE=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,ede=/^#([0-9a-f]{3,8})$/,tde=RegExp(`^rgb\\(${mE},${mE},${mE}\\)$`),nde=RegExp(`^rgb\\(${gE},${gE},${gE}\\)$`),rde=RegExp(`^rgba\\(${mE},${mE},${mE},${hE}\\)$`),ide=RegExp(`^rgba\\(${gE},${gE},${gE},${hE}\\)$`),ade=RegExp(`^hsl\\(${hE},${gE},${gE}\\)$`),ode=RegExp(`^hsla\\(${hE},${gE},${gE},${hE}\\)$`),_E={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},HT(GT,JT,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:KT,formatHex:KT,formatHex8:Zue,formatHsl:Que,formatRgb:qT,toString:qT}),HT($T,QT,UT(GT,{brighter(e){return e=e==null?pE:pE**+e,new $T(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?fE:fE**+e,new $T(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new $T(rE(this.r),rE(this.g),rE(this.b),nE(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:eE,formatHex:eE,formatHex8:$ue,formatRgb:tE,toString:tE})),HT(cE,sE,UT(GT,{brighter(e){return e=e==null?pE:pE**+e,new cE(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?fE:fE**+e,new cE(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new $T(dE(e>=240?e-240:e+120,i,r),dE(e,i,r),dE(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new cE(lE(this.h),uE(this.s),uE(this.l),nE(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=nE(this.opacity);return`${e===1?`hsl(`:`hsla(`}${lE(this.h)}, ${uE(this.s)*100}%, ${uE(this.l)*100}%${e===1?`)`:`, ${e})`}`}}))})),yE,bE,sde=o((()=>{yE=Math.PI/180,bE=180/Math.PI}));function cde(e){if(e instanceof SE)return new SE(e.l,e.a,e.b,e.opacity);if(e instanceof OE)return ude(e);e instanceof $T||(e=ZT(e));var t=EE(e.r),n=EE(e.g),r=EE(e.b),i=CE((.2225045*t+.7168786*n+.0606169*r)/jE),a,o;return t===n&&n===r?a=o=i:(a=CE((.4360747*t+.3850649*n+.1430804*r)/AE),o=CE((.0139322*t+.0971045*n+.7141733*r)/ME)),new SE(116*i-16,500*(a-i),200*(i-o),e.opacity)}function xE(e,t,n,r){return arguments.length===1?cde(e):new SE(e,t,n,r??1)}function SE(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}function CE(e){return e>dde?e**(1/3):e/FE+NE}function wE(e){return e>PE?e*e*e:FE*(e-NE)}function TE(e){return 255*(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055)}function EE(e){return(e/=255)<=.04045?e/12.92:((e+.055)/1.055)**2.4}function lde(e){if(e instanceof OE)return new OE(e.h,e.c,e.l,e.opacity);if(e instanceof SE||(e=cde(e)),e.a===0&&e.b===0)return new OE(NaN,0{WT(),vE(),sde(),kE=18,AE=.96422,jE=1,ME=.82521,NE=4/29,PE=6/29,FE=3*PE*PE,dde=PE*PE*PE,HT(SE,xE,UT(GT,{brighter(e){return new SE(this.l+kE*(e??1),this.a,this.b,this.opacity)},darker(e){return new SE(this.l-kE*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return t=AE*wE(t),e=jE*wE(e),n=ME*wE(n),new $T(TE(3.1338561*t-1.6168667*e-.4906146*n),TE(-.9787684*t+1.9161415*e+.033454*n),TE(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}})),HT(OE,DE,UT(GT,{brighter(e){return new OE(this.h,this.c,this.l+kE*(e??1),this.opacity)},darker(e){return new OE(this.h,this.c,this.l-kE*(e??1),this.opacity)},rgb(){return ude(this).rgb()}}))}));function pde(e){if(e instanceof LE)return new LE(e.h,e.s,e.l,e.opacity);e instanceof $T||(e=ZT(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(GE*r+UE*t-WE*n)/(GE+UE-WE),a=r-i,o=(HE*(n-i)-BE*a)/VE,s=Math.sqrt(o*o+a*a)/(HE*i*(1-i)),c=s?Math.atan2(o,a)*bE-120:NaN;return new LE(c<0?c+360:c,s,i,e.opacity)}function IE(e,t,n,r){return arguments.length===1?pde(e):new LE(e,t,n,r??1)}function LE(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}var RE,zE,BE,VE,HE,UE,WE,GE,mde=o((()=>{WT(),vE(),sde(),RE=-.14861,zE=1.78277,BE=-.29227,VE=-.90649,HE=1.97294,UE=HE*VE,WE=HE*zE,GE=zE*BE-VE*RE,HT(LE,IE,UT(GT,{brighter(e){return e=e==null?pE:pE**+e,new LE(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?fE:fE**+e,new LE(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*yE,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new $T(255*(t+n*(RE*r+zE*i)),255*(t+n*(BE*r+VE*i)),255*(t+HE*r*n),this.opacity)}}))})),KE=o((()=>{vE(),fde(),mde()}));function hde(e,t,n,r,i){var a=e*e,o=a*e;return((1-3*e+3*a-o)*t+(4-6*a+3*o)*n+(1+3*e+3*a-3*o)*r+o*i)/6}function gde(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],a=e[r+1],o=r>0?e[r-1]:2*i-a,s=r{}));function _de(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),i=e[(r+t-1)%t],a=e[r%t],o=e[(r+1)%t],s=e[(r+2)%t];return hde((n-r/t)*t,i,a,o,s)}}var vde=o((()=>{qE()})),JE,yde=o((()=>{JE=e=>()=>e}));function bde(e,t){return function(n){return e+n*t}}function xde(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function YE(e,t){var n=t-e;return n?bde(e,n>180||n<-180?n-360*Math.round(n/360):n):JE(isNaN(e)?t:e)}function Sde(e){return(e=+e)==1?XE:function(t,n){return n-t?xde(t,n,e):JE(isNaN(t)?n:t)}}function XE(e,t){var n=t-e;return n?bde(e,n):JE(isNaN(e)?t:e)}var ZE=o((()=>{yde()}));function Cde(e){return function(t){var n=t.length,r=Array(n),i=Array(n),a=Array(n),o,s;for(o=0;o{KE(),qE(),vde(),ZE(),QE=(function e(t){var n=Sde(t);function r(e,t){var r=n((e=QT(e)).r,(t=QT(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=XE(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1),wde=Cde(gde),Tde=Cde(_de)}));function $E(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i{}));function Ode(e,t){return(Dde(t)?$E:kde)(e,t)}function kde(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o{oD(),eD()}));function jde(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}var Mde=o((()=>{}));function tD(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var nD=o((()=>{}));function Nde(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=aD(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var Pde=o((()=>{oD()}));function Fde(e){return function(){return e}}function Ide(e){return function(t){return e(t)+``}}function Lde(e,t){var n=rD.lastIndex=iD.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=rD.exec(e))&&(i=iD.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:tD(r,i)})),n=iD.lastIndex;return n{nD(),rD=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,iD=new RegExp(rD.source,`g`)}));function aD(e,t){var n=typeof t,r;return t==null||n===`boolean`?JE(t):(n===`number`?tD:n===`string`?(r=JT(t))?(t=r,QE):Lde:t instanceof JT?QE:t instanceof Date?jde:Dde(t)?$E:Array.isArray(t)?kde:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?Nde:tD)(e,t)}var oD=o((()=>{KE(),Ede(),Ade(),Mde(),nD(),Pde(),Rde(),yde(),eD()}));function zde(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var Bde=o((()=>{}));function Vde(e,t){var n=YE(+e,+t);return function(e){var t=n(e);return t-360*Math.floor(t/360)}}var Hde=o((()=>{ZE()}));function sD(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var Ude=o((()=>{}));function Wde(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r{cD=180/Math.PI,lD={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1}}));function Kde(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?lD:Wde(t.a,t.b,t.c,t.d,t.e,t.f)}function qde(e){return e==null||(uD||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),uD.setAttribute(`transform`,e),!(e=uD.transform.baseVal.consolidate()))?lD:(e=e.matrix,Wde(e.a,e.b,e.c,e.d,e.e,e.f))}var uD,Jde=o((()=>{Gde()}));function Yde(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:tD(e,i)},{i:c-2,x:tD(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:tD(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:tD(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:tD(e,n)},{i:s-2,x:tD(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t{nD(),Jde(),Xde=Yde(Kde,`px, `,`px)`,`deg)`),Zde=Yde(qde,`, `,`)`,`)`)}));function $de(e){return((e=Math.exp(e))+1/e)/2}function efe(e){return((e=Math.exp(e))-1/e)/2}function tfe(e){return((e=Math.exp(2*e))-1)/(e+1)}var nfe,rfe,ife=o((()=>{nfe=1e-12,rfe=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p{KE(),ZE(),ofe=afe(YE),sfe=afe(XE)}));function lfe(e,t){var n=XE((e=xE(e)).l,(t=xE(t)).l),r=XE(e.a,t.a),i=XE(e.b,t.b),a=XE(e.opacity,t.opacity);return function(t){return e.l=n(t),e.a=r(t),e.b=i(t),e.opacity=a(t),e+``}}var ufe=o((()=>{KE(),ZE()}));function dfe(e){return function(t,n){var r=e((t=DE(t)).h,(n=DE(n)).h),i=XE(t.c,n.c),a=XE(t.l,n.l),o=XE(t.opacity,n.opacity);return function(e){return t.h=r(e),t.c=i(e),t.l=a(e),t.opacity=o(e),t+``}}}var ffe,pfe,mfe=o((()=>{KE(),ZE(),ffe=dfe(YE),pfe=dfe(XE)}));function hfe(e){return(function t(n){n=+n;function r(t,r){var i=e((t=IE(t)).h,(r=IE(r)).h),a=XE(t.s,r.s),o=XE(t.l,r.l),s=XE(t.opacity,r.opacity);return function(e){return t.h=i(e),t.s=a(e),t.l=o(e**+n),t.opacity=s(e),t+``}}return r.gamma=t,r})(1)}var gfe,_fe,vfe=o((()=>{KE(),ZE(),gfe=hfe(YE),_fe=hfe(XE)}));function dD(e,t){t===void 0&&(t=e,e=aD);for(var n=0,r=t.length-1,i=t[0],a=Array(r<0?0:r);n{oD()}));function bfe(e,t){for(var n=Array(t),r=0;r{})),Sfe=c({interpolate:()=>aD,interpolateArray:()=>Ode,interpolateBasis:()=>gde,interpolateBasisClosed:()=>_de,interpolateCubehelix:()=>gfe,interpolateCubehelixLong:()=>_fe,interpolateDate:()=>jde,interpolateDiscrete:()=>zde,interpolateHcl:()=>ffe,interpolateHclLong:()=>pfe,interpolateHsl:()=>ofe,interpolateHslLong:()=>sfe,interpolateHue:()=>Vde,interpolateLab:()=>lfe,interpolateNumber:()=>tD,interpolateNumberArray:()=>$E,interpolateObject:()=>Nde,interpolateRgb:()=>QE,interpolateRgbBasis:()=>wde,interpolateRgbBasisClosed:()=>Tde,interpolateRound:()=>sD,interpolateString:()=>Lde,interpolateTransformCss:()=>Xde,interpolateTransformSvg:()=>Zde,interpolateZoom:()=>rfe,piecewise:()=>dD,quantize:()=>bfe}),fD=o((()=>{oD(),Ade(),qE(),vde(),Mde(),Bde(),Hde(),nD(),eD(),Pde(),Ude(),Rde(),Qde(),ife(),Ede(),cfe(),ufe(),mfe(),vfe(),yfe(),xfe()}));function Cfe(e){return function(){return e}}var wfe=o((()=>{}));function pD(e){return+e}var mD=o((()=>{}));function hD(e){return e}function gD(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:Cfe(isNaN(t)?NaN:.5)}function Tfe(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function Efe(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?Dfe:Efe,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),tD))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,pD),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=sD,u()},d.clamp=function(e){return arguments.length?(o=e?!0:hD,u()):o!==hD},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function Ofe(){return vD()(hD,hD)}var yD,bD=o((()=>{e_(),fD(),wfe(),mD(),yD=[0,1]}));function kfe(e,t,n,r){var i=Jg(e,t,n),a;switch(r=a_(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=S_(i,o))&&(r.precision=a),b_(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=C_(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=x_(i))&&(r.precision=a-(r.type===`%`)*2);break}return y_(r)}var Afe=o((()=>{e_(),w_()}));function xD(e){var t=e.domain;return e.ticks=function(e){var n=t();return Kg(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return kfe(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s0;){if(l=qg(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function jfe(){var e=Ofe();return e.copy=function(){return _D(e,jfe())},LT.apply(e,arguments),xD(e)}var SD=o((()=>{e_(),bD(),zT(),Afe()}));function Mfe(e){var t;function n(e){return e==null||isNaN(e=+e)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,pD),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return Mfe(e).unknown(t)},e=arguments.length?Array.from(e,pD):[0,1],xD(n)}var Nfe=o((()=>{SD(),mD()}));function Pfe(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return a{}));function Ife(e){return Math.log(e)}function Lfe(e){return Math.exp(e)}function Rfe(e){return-Math.log(-e)}function zfe(e){return-Math.exp(-e)}function Bfe(e){return isFinite(e)?+(`1e`+e):e<0?0:e}function Vfe(e){return e===10?Bfe:e===Math.E?Math.exp:t=>e**+t}function Hfe(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function Ufe(e){return(t,n)=>-e(-t,n)}function CD(e){let t=e(Ife,Lfe),n=t.domain,r=10,i,a;function o(){return i=Hfe(r),a=Vfe(r),n()[0]<0?(i=Ufe(i),a=Ufe(a),e(Rfe,zfe)):e(Ife,Lfe),t}return t.base=function(e){return arguments.length?(r=+e,o()):r},t.domain=function(e){return arguments.length?(n(e),o()):n()},t.ticks=e=>{let t=n(),o=t[0],s=t[t.length-1],c=s0){for(;l<=u;++l)for(d=1;ds)break;m.push(f)}}else for(;l<=u;++l)for(d=r-1;d>=1;--d)if(f=l>0?d/a(-l):d*a(l),!(fs)break;m.push(f)}m.length*2{if(e??=10,n??=r===10?`s`:`,`,typeof n!=`function`&&(!(r%1)&&(n=a_(n)).precision==null&&(n.trim=!0),n=y_(n)),e===1/0)return n;let o=Math.max(1,r*e/t.ticks().length);return e=>{let t=e/a(Math.round(i(e)));return t*rn(Pfe(n(),{floor:e=>a(Math.floor(i(e))),ceil:e=>a(Math.ceil(i(e)))})),t}function Wfe(){let e=CD(vD()).domain([1,10]);return e.copy=()=>_D(e,Wfe()).base(e.base()),LT.apply(e,arguments),e}var wD=o((()=>{e_(),w_(),Ffe(),bD(),zT()}));function Gfe(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Kfe(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function TD(e){var t=1,n=e(Gfe(t),Kfe(t));return n.constant=function(n){return arguments.length?e(Gfe(t=+n),Kfe(t)):t},xD(n)}function qfe(){var e=TD(vD());return e.copy=function(){return _D(e,qfe()).constant(e.constant())},LT.apply(e,arguments)}var ED=o((()=>{SD(),bD(),zT()}));function Jfe(e){return function(t){return t<0?-((-t)**+e):t**+e}}function Yfe(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Xfe(e){return e<0?-e*e:e*e}function DD(e){var t=e(hD,hD),n=1;function r(){return n===1?e(hD,hD):n===.5?e(Yfe,Xfe):e(Jfe(n),Jfe(1/n))}return t.exponent=function(e){return arguments.length?(n=+e,r()):n},xD(t)}function OD(){var e=DD(vD());return e.copy=function(){return _D(e,OD()).exponent(e.exponent())},LT.apply(e,arguments),e}function Zfe(){return OD.apply(null,arguments).exponent(.5)}var kD=o((()=>{SD(),bD(),zT()}));function Qfe(){var e=[],t=[],n=[],r;function i(){var r=0,i=Math.max(1,t.length);for(n=Array(i-1);++r0?n[i-1]:e[0],i{e_(),zT()}));function epe(){var e=0,t=1,n=1,r=[.5],i=[0,1],a;function o(e){return e!=null&&e<=e?i[Rg(r,e,0,n)]:a}function s(){var i=-1;for(r=Array(n);++i=n?[r[n-1],t]:[r[o-1],r[o]]},o.unknown=function(e){return arguments.length&&(a=e),o},o.thresholds=function(){return r.slice()},o.copy=function(){return epe().domain([e,t]).range(i).unknown(a)},LT.apply(xD(o),arguments)}var tpe=o((()=>{e_(),SD(),zT()}));function npe(){var e=[.5],t=[0,1],n,r=1;function i(i){return i!=null&&i<=i?t[Rg(e,i,0,r)]:n}return i.domain=function(n){return arguments.length?(e=Array.from(n),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(n){return arguments.length?(t=Array.from(n),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(n){var r=t.indexOf(n);return[e[r-1],e[r]]},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return npe().domain(e).range(t).unknown(n)},LT.apply(i,arguments)}var rpe=o((()=>{e_(),zT()}));function ipe(e){return new Date(e)}function ape(e){return e instanceof Date?+e:+new Date(+e)}function AD(e,t,n,r,i,a,o,s,c,l){var u=Ofe(),d=u.invert,f=u.domain,p=l(`.%L`),m=l(`:%S`),h=l(`%I:%M`),g=l(`%I %p`),_=l(`%a %d`),v=l(`%b %d`),y=l(`%B`),b=l(`%Y`);function x(e){return(c(e){Tv(),hb(),bD(),zT(),Ffe()}));function cpe(){return LT.apply(AD(xv,Sv,vv,hv,ov,J_,G_,H_,z_,pb).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}var lpe=o((()=>{Tv(),hb(),spe(),zT()}));function jD(){var e=0,t=1,n,r,i,a,o=hD,s=!1,c;function l(e){return e==null||isNaN(e=+e)?c:o(i===0?.5:(e=(a(e)-n)*i,s?Math.max(0,Math.min(1,e)):e))}l.domain=function(o){return arguments.length?([e,t]=o,n=a(e=+e),r=a(t=+t),i=n===r?0:1/(r-n),l):[e,t]},l.clamp=function(e){return arguments.length?(s=!!e,l):s},l.interpolator=function(e){return arguments.length?(o=e,l):o};function u(e){return function(t){var n,r;return arguments.length?([n,r]=t,o=e(n,r),l):[o(0),o(1)]}}return l.range=u(aD),l.rangeRound=u(sD),l.unknown=function(e){return arguments.length?(c=e,l):c},function(o){return a=o,n=o(e),r=o(t),i=n===r?0:1/(r-n),l}}function MD(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function ND(){var e=xD(jD()(hD));return e.copy=function(){return MD(e,ND())},RT.apply(e,arguments)}function upe(){var e=CD(jD()).domain([1,10]);return e.copy=function(){return MD(e,upe()).base(e.base())},RT.apply(e,arguments)}function dpe(){var e=TD(jD());return e.copy=function(){return MD(e,dpe()).constant(e.constant())},RT.apply(e,arguments)}function PD(){var e=DD(jD());return e.copy=function(){return MD(e,PD()).exponent(e.exponent())},RT.apply(e,arguments)}function fpe(){return PD.apply(null,arguments).exponent(.5)}var ppe=o((()=>{fD(),bD(),zT(),SD(),wD(),ED(),kD()}));function FD(){var e=0,t=.5,n=1,r=1,i,a,o,s,c,l=hD,u,d=!1,f;function p(e){return isNaN(e=+e)?f:(e=.5+((e=+u(e))-a)*(r*e{fD(),bD(),zT(),SD(),wD(),ppe(),ED(),kD()})),ype=o((()=>{e_(),Xue(),Nfe(),SD(),wD(),ED(),kD(),bD(),mD(),$fe(),tpe(),rpe(),spe(),lpe(),ppe(),vpe(),Afe()}));function LD(e){for(var t=e.length/6|0,n=Array(t),r=0;r{})),bpe,xpe=o((()=>{RD(),bpe=LD(`1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf`)})),Spe,Cpe=o((()=>{RD(),Spe=LD(`7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666`)})),wpe,Tpe=o((()=>{RD(),wpe=LD(`1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666`)})),Epe,Dpe=o((()=>{RD(),Epe=LD(`4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0`)})),Ope,kpe=o((()=>{RD(),Ope=LD(`a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928`)})),Ape,jpe=o((()=>{RD(),Ape=LD(`fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2`)})),Mpe,Npe=o((()=>{RD(),Mpe=LD(`b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc`)})),Ppe,Fpe=o((()=>{RD(),Ppe=LD(`e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999`)})),Ipe,Lpe=o((()=>{RD(),Ipe=LD(`66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3`)})),Rpe,zpe=o((()=>{RD(),Rpe=LD(`8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f`)})),Bpe=o((()=>{xpe(),Cpe(),Tpe(),Dpe(),kpe(),jpe(),Npe(),Fpe(),Lpe(),zpe(),RD(),fD(),KE()}));function zD(e,t,n){let r=e-t+n*2;return e?r>0?r:1:0}function Vpe(e){return function(t){let n=t[0],r=t[1],i;return r=r&&n[c]<=i&&(a<0&&(a=c),o=c);if(!(a<0))return r=e.invertExtent(n[a]),i=e.invertExtent(n[o]),[r[0]===void 0?r[1]:r[0],i[1]===void 0?i[0]:i[1]]}}function BD(){let e=BT().unknown(void 0),t=e.domain,n=e.range,r=[0,1],i,a,o=!1,s=0,c=0,l=.5;delete e.unknown;function u(){let e=t().length,u=r[1]p+i*e);return n(u?m.reverse():m)}return e.domain=function(e){return arguments.length?(t(e),u()):t()},e.range=function(e){return arguments.length?(r=[+e[0],+e[1]],u()):r.slice()},e.rangeRound=function(e){return r=[+e[0],+e[1]],o=!0,u()},e.bandwidth=function(){return a},e.step=function(){return i},e.round=function(e){return arguments.length?(o=!!e,u()):o},e.padding=function(e){return arguments.length?(c=Math.max(0,Math.min(1,e)),s=c,u()):s},e.paddingInner=function(e){return arguments.length?(s=Math.max(0,Math.min(1,e)),u()):s},e.paddingOuter=function(e){return arguments.length?(c=Math.max(0,Math.min(1,e)),u()):c},e.align=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),u()):l},e.invertRange=function(e){if(e[0]==null||e[1]==null)return;let i=r[1]r[1-i])))return u=Math.max(0,Rg(o,c)-1),d=c===l?u:Rg(o,l)-1,c-o[u]>a+1e-10&&++u,i&&(f=u,u=s-d,d=s-f),u>d?void 0:t().slice(u,d+1)},e.invert=function(t){let n=e.invertRange([t,t]);return n&&n[0]},e.copy=function(){return BD().domain(t()).range(r).round(o).paddingInner(s).paddingOuter(c).align(l)},u()}function Upe(e){let t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return Upe(t())},e}function Wpe(){return Upe(BD().paddingInner(1))}function Gpe(e){return Cme.call(e,Rh)}function Kpe(){let e=[],t=[];function n(n){return n==null||n!==n?void 0:t[(Rg(e,n)-1)%t.length]}return n.domain=function(t){return arguments.length?(e=Gpe(t),n):e.slice()},n.range=function(e){return arguments.length?(t=wme.call(e),n):t.slice()},n.tickFormat=function(t,n){return kfe(e[0],Ih(e),t??10,n)},n.copy=function(){return Kpe().domain(n.domain()).range(n.range())},n}function qpe(e){return e[fO]=!0,e}function Jpe(e){return e&&e[fO]===!0}function Ype(e,t,n){let r=function(){let n=t();return n.invertRange||=n.invert?Vpe(n):n.invertExtent?Hpe(n):void 0,n.type=e,qpe(n)};return r.metadata=Tg(Qh(n)),r}function VD(e,t,n){return arguments.length>1?(dO.set(e,Ype(e,t,n)),this):Xpe(e)?dO.get(e):void 0}function Xpe(e){return dO.has(e)}function HD(e,t){let n=dO.get(e);return n&&n.metadata[t]}function UD(e){return HD(e,oO)}function WD(e){return HD(e,sO)}function GD(e){return HD(e,cO)}function KD(e){return HD(e,`log`)}function Zpe(e){return HD(e,uO)}function Qpe(e){return HD(e,lO)}function $pe(e){return HD(e,rO)}function eme(e,t){let n=t[0],r=Ih(t)-n;return function(t){return e(n+t*r)}}function qD(e,t,n){return dD(JD(t||`rgb`,n),e)}function tme(e,t){let n=Array(t),r=t+1;for(let i=0;ie[t]?o[t](e[t]()):0),o)}function JD(e,t){let n=Sfe[rme(e)];return t!=null&&n&&n.gamma?n.gamma(t):n}function rme(e){return`interpolate`+e.toLowerCase().split(`-`).map(e=>e[0].toUpperCase()+e.slice(1)).join(``)}function ime(e){if(W(e))return e;let t=e.length/6|0,n=Array(t);for(let r=0;r1?(pO[e]=t,this):pO[e]}function XD(e,t,n){let r;if(gg(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),n!=null)){let r=e.domain(),i=Math.min(r[0],Ih(r)),a=Math.max(r[0],Ih(r));if(t=Math.min(t,Math.floor((a-i)/n||1)+1),!e.bins&&!KD(e.type)&&!Zpe(e.type)&&i1&&Jg(i,a,t)a&&(r=a,a=i,i=r,o=Ame),i=Math.floor(i),a=Math.ceil(a),t=t.map(t=>[t,e(t)]).filter(e=>i<=e[1]&&e[1]<=a).sort(o).map(e=>e[0]),n>0&&t.length>1){let e=[t[0],Ih(t)];for(;t.length>n&&t.length>=3;)t=t.filter((e,t)=>!(t%2));t.length<3&&(t=e)}return t}function ZD(e,t){return e.bins?ome(e,e.bins,t):e.ticks?e.ticks(t):e.domain()}function sme(e,t,n,r,i,a){let o=t.type,s=Ome;if(o===`time`||i===`time`)s=e.timeFormat(r);else if(o===`utc`||i===`utc`)s=e.utcFormat(r);else if(KD(o)){let i=e.formatFloat(r);if(a||t.bins)s=i;else{let e=cme(t,n,!1);s=t=>e(t)?i(t):``}}else if(t.tickFormat){let i=t.domain();s=e.formatSpan(i[0],i[i.length-1],n,r)}else r&&(s=e.format(r));return s}function cme(e,t,n){let r=ZD(e,t),i=e.base(),a=Math.log(i),o=Math.max(1,i*t/r.length),s=e=>{let t=e/i**+Math.round(Math.log(e)/a);return t*i1?r[1]-r[0]:r[0],o;for(o=1;o(e-r)/a}function hme(e,t,n,r){let i=r||t.type;return vg(n)&&Zpe(i)&&(n=n.replace(/%a/g,`%A`).replace(/%b/g,`%B`)),!n&&i===`time`?e.timeFormat(`%A, %d %B %Y, %X`):!n&&i===`utc`?e.utcFormat(`%A, %d %B %Y, %X UTC`):pme(e,t,5,null,n,r,!0)}function gme(e,t,n){n||={};let r=Math.max(3,n.maxlen||7),i=hme(e,t,n.format,n.formatType);if(GD(t.type)){let e=lme(t).slice(1).map(i),n=e.length;return`${n} boundar${n===1?`y`:`ies`}: ${e.join(`, `)}`}else if(WD(t.type)){let e=t.domain(),n=e.length,a=n>r?e.slice(0,r-2).map(i).join(`, `)+`, ending with `+e.slice(-1).map(i):e.map(i).join(`, `);return`${n} value${n===1?``:`s`}: ${a}`}else{let e=t.domain();return`values from ${i(e[0])} to ${i(Ih(e))}`}}var _me,QD,$D,eO,vme,tO,nO,rO,iO,aO,yme,bme,xme,Sme,oO,sO,cO,lO,uO,Cme,wme,dO,fO,Tme,Eme,Dme,pO,Ome,kme,Ame,mO,hO,jme,Mme,gO,Nme,Pme,_O,vO=o((()=>{Dg(),e_(),ype(),fD(),Bpe(),Ry(),_me=`identity`,QD=`linear`,$D=`sqrt`,eO=`symlog`,vme=`time`,tO=`sequential`,nO=`diverging`,rO=`quantile`,iO=`quantize`,aO=`threshold`,yme=`ordinal`,bme=`point`,xme=`band`,Sme=`bin-ordinal`,oO=`continuous`,sO=`discrete`,cO=`discretizing`,lO=`interpolating`,uO=`temporal`,Cme=Array.prototype.map,wme=Array.prototype.slice,dO=new Map,fO=Symbol(`vega_scale`),VD(_me,Mfe),VD(QD,jfe,oO),VD(`log`,Wfe,[oO,`log`]),VD(`pow`,OD,oO),VD($D,Zfe,oO),VD(eO,qfe,oO),VD(vme,ope,[oO,uO]),VD(`utc`,cpe,[oO,uO]),VD(tO,ND,[oO,lO]),VD(`${tO}-${QD}`,ND,[oO,lO]),VD(`${tO}-log`,upe,[oO,lO,`log`]),VD(`${tO}-pow`,PD,[oO,lO]),VD(`${tO}-${$D}`,fpe,[oO,lO]),VD(`${tO}-${eO}`,dpe,[oO,lO]),VD(`${nO}-${QD}`,mpe,[oO,lO]),VD(`${nO}-log`,hpe,[oO,lO,`log`]),VD(`${nO}-pow`,ID,[oO,lO]),VD(`${nO}-${$D}`,_pe,[oO,lO]),VD(`${nO}-${eO}`,gpe,[oO,lO]),VD(rO,Qfe,[cO,rO]),VD(iO,epe,cO),VD(aO,npe,cO),VD(Sme,Kpe,[sO,cO]),VD(yme,BT,sO),VD(xme,BD,sO),VD(bme,Wpe,sO),Tme=[`clamp`,`base`,`constant`,`exponent`],Eme={blues:`cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90`,greens:`d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429`,greys:`e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e`,oranges:`fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303`,purples:`e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c`,reds:`fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13`,blueGreen:`d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429`,bluePurple:`ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71`,greenBlue:`d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1`,orangeRed:`fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403`,purpleBlue:`dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281`,purpleBlueGreen:`dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353`,purpleRed:`dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a`,redPurple:`fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174`,yellowGreen:`e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034`,yellowOrangeBrown:`feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204`,yellowOrangeRed:`fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225`,blueOrange:`134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07`,brownBlueGreen:`704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147`,purpleGreen:`5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29`,purpleOrange:`4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07`,redBlue:`8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85`,redGrey:`8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434`,yellowGreenBlue:`eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185`,redYellowBlue:`a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695`,redYellowGreen:`a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837`,pinkYellowGreen:`8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419`,spectral:`9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2`,viridis:`440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725`,magma:`0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf`,inferno:`0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4`,plasma:`0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921`,cividis:`00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647`,rainbow:`6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa`,sinebow:`ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040`,turbo:`23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00`,browns:`eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632`,tealBlues:`bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985`,teals:`bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667`,warmGreys:`dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e`,goldGreen:`f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36`,goldOrange:`f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26`,goldRed:`f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e`,lightGreyRed:`efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b`,lightGreyTeal:`e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc`,lightMulti:`e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c`,lightOrange:`f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b`,lightTealBlue:`e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988`,darkBlue:`3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff`,darkGold:`3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff`,darkGreen:`3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa`,darkMulti:`3737371f5287197d8c29a86995ce3fffe800ffffff`,darkRed:`3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c`},Dme={accent:Spe,category10:bpe,category20:`1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5`,category20b:`393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6`,category20c:`3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9`,dark2:wpe,observable10:Epe,paired:Ope,pastel1:Ape,pastel2:Mpe,set1:Ppe,set2:Ipe,set3:Rpe,tableau10:`4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac`,tableau20:`4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5`},pO={},ame(Dme,ime),ame(Eme,e=>qD(ime(e))),Ome=e=>W(e)?e.map(e=>String(e)):String(e),kme=(e,t)=>e[1]-t[1],Ame=(e,t)=>t[1]-e[1],mO={[rO]:`quantiles`,[iO]:`thresholds`,[aO]:`domain`},hO={[rO]:`quantiles`,[iO]:`domain`},jme=e=>mO[e.type]||e.bins,Mme=e=>(t,n,r)=>{let i=gO(r[n+1],gO(r.max,1/0)),a=_O(t,e),o=_O(i,e);return a&&o?a+` – `+o:o?`< `+o:`≥ `+a},gO=(e,t)=>e??t,Nme=e=>(t,n)=>n?e(t):null,Pme=e=>t=>e(t),_O=(e,t)=>Number.isFinite(e)?t(e):null}));function Fme(){Nk=0}function yO(e){return e&&e.gradient}function Ime(e,t,n){let r=e.gradient,i=e.id,a=r===`radial`?Pk:``;return i||(i=e.id=`gradient_`+Nk++,r===`radial`?(e.x1=bO(e.x1,.5),e.y1=bO(e.y1,.5),e.r1=bO(e.r1,0),e.x2=bO(e.x2,.5),e.y2=bO(e.y2,.5),e.r2=bO(e.r2,.5),a=Pk):(e.x1=bO(e.x1,0),e.y1=bO(e.y1,0),e.x2=bO(e.x2,1),e.y2=bO(e.y2,0))),t[i]=e,`url(`+(n||``)+`#`+a+i+`)`}function bO(e,t){return e??t}function Lme(e,t){var n=[],r;return r={gradient:`linear`,x1:e?e[0]:0,y1:e?e[1]:0,x2:t?t[0]:1,y2:t?t[1]:0,stops:n,stop:function(e,t){return n.push({offset:e,color:t}),r}}}function xO(e,t,n){var r=cg(Fk,e)&&Fk[e],i=null;return r&&(i=r.curve||r[t||`vertical`],r.tension&&n!=null&&(i=i[r.tension](n))),i}function SO(e){let t=[];return(e.match(Qge)||[]).forEach(e=>{let n=e[0],r=n.toLowerCase(),i=Zge[r],a=Rme(r,i,e.slice(1).trim()),o=a.length;if(o1&&(h=Math.sqrt(h),n*=h,r*=h);let g=f/n,_=d/n,v=-d/r,y=f/r,b=g*s+_*c,x=v*s+y*c,S=g*e+_*t,C=v*e+y*t,w=1/((S-b)*(S-b)+(C-x)*(C-x))-.25;w<0&&(w=0);let T=Math.sqrt(w);a==i&&(T=-T);let E=.5*(b+S)-T*(C-x),D=.5*(x+C)+T*(S-b),O=Math.atan2(x-D,b-E),k=Math.atan2(C-D,S-E)-O;k<0&&a===1?k+=Rk:k>0&&a===0&&(k-=Rk);let A=Math.ceil(Math.abs(k/(Lk+.001))),j=[];for(let e=0;e+e}function TO(e,t,n){return Math.max(t,Math.min(e,n))}function Yme(){var e=Gme,t=Kme,n=qme,r=Jme,i=wO(0),a=i,o=i,s=i,c=null;function l(l,u,d){var f,p=u??+e.call(this,l),m=d??+t.call(this,l),h=+n.call(this,l),g=+r.call(this,l),_=Math.min(h,g)/2,v=TO(+i.call(this,l),0,_),y=TO(+a.call(this,l),0,_),b=TO(+o.call(this,l),0,_),x=TO(+s.call(this,l),0,_);if(c||=f=Dw(),v<=0&&y<=0&&b<=0&&x<=0)c.rect(p,m,h,g);else{var S=p+h,C=m+g;c.moveTo(p+v,m),c.lineTo(S-y,m),c.bezierCurveTo(S-qk*y,m,S,m+qk*y,S,m+y),c.lineTo(S,C-x),c.bezierCurveTo(S,C-qk*x,S-qk*x,C,S-x,C),c.lineTo(p+b,C),c.bezierCurveTo(p+qk*b,C,p,C-qk*b,p,C-b),c.lineTo(p,m+v),c.bezierCurveTo(p,m+qk*v,p+qk*v,m,p+v,m),c.closePath()}if(f)return c=null,f+``||null}return l.x=function(t){return arguments.length?(e=wO(t),l):e},l.y=function(e){return arguments.length?(t=wO(e),l):t},l.width=function(e){return arguments.length?(n=wO(e),l):n},l.height=function(e){return arguments.length?(r=wO(e),l):r},l.cornerRadius=function(e,t,n,r){return arguments.length?(i=wO(e),a=t==null?i:wO(t),s=n==null?i:wO(n),o=r==null?a:wO(r),l):i},l.context=function(e){return arguments.length?(c=e??null,l):c},l}function Xme(){var e,t,n,r,i=null,a,o,s,c;function l(e,t,n){let r=n/2;if(a){var l=s-t,u=e-o;if(l||u){var d=Math.hypot(l,u),f=(l/=d)*c,p=(u/=d)*c,m=Math.atan2(u,l);i.moveTo(o-f,s-p),i.lineTo(e-l*r,t-u*r),i.arc(e,t,r,m-Math.PI,m),i.lineTo(o+f,s+p),i.arc(o,s,c,m,m+Math.PI)}else i.arc(e,t,r,0,Rk);i.closePath()}else a=1;o=e,s=t,c=r}function u(o){var s,c=o.length,u,d=!1,f;for(i??=f=Dw(),s=0;s<=c;++s)!(sn_e?(u=o*o+s*a,u>=0&&(u=Math.sqrt(u),c=(-o+u)/a,l=(-o-u)/a)):c=.5*s/o,0f)return!1;h>d&&(d=h)}else if(p>0){if(h0?(e.globalAlpha=n,e.fillStyle=fhe(e,t,t.fill),!0):!1}function HO(e,t,n){var r=(r=t.strokeWidth)??1;return r<=0?!1:(n*=t.strokeOpacity==null?1:t.strokeOpacity,n>0?(e.globalAlpha=n,e.strokeStyle=fhe(e,t,t.stroke),e.lineWidth=r,e.lineCap=t.strokeCap||`butt`,e.lineJoin=t.strokeJoin||`miter`,e.miterLimit=t.strokeMiterLimit==null?4:t.strokeMiterLimit,e.setLineDash&&(e.setLineDash(t.strokeDash||k_e),e.lineDashOffset=t.strokeDashOffset||0),!0):!1)}function phe(e,t){return e.zindex-t.zindex||e.index-t.index}function UO(e){if(!e.zdirty)return e.zitems;var t=e.items,n=[],r,i,a;for(i=0,a=t.length;i=0;)if(r=t(n[i]))return r;if(n===a){for(n=e.items,i=n.length;--i>=0;)if(!n[i].zindex&&(r=t(n[i])))return r}return null}function KO(e){return function(t,n,r){WO(n,n=>{(!r||r.intersects(n.bounds))&&hhe(e,t,n,n)})}}function mhe(e){return function(t,n,r){n.items.length&&(!r||r.intersects(n.bounds))&&hhe(e,t,n.items[0],n.items)}}function hhe(e,t,n,r){var i=n.opacity==null?1:n.opacity;i!==0&&(e(t,r)||(zO(t,n),n.fill&&VO(t,n,i)&&t.fill(),n.stroke&&HO(t,n,i)&&t.stroke()))}function qO(e){return e||=Eh,function(t,n,r,i,a,o){return r*=t.pixelRatio,i*=t.pixelRatio,GO(n,n=>{let s=n.bounds;if(!(s&&!s.contains(a,o)||!s)&&e(t,n,r,i,a,o))return n})}}function JO(e,t){return function(n,r,i,a){var o=Array.isArray(r)?r[0]:r,s=t??o.fill,c=o.stroke&&n.isPointInStroke,l,u;return c&&(l=o.strokeWidth,u=o.strokeCap,n.lineWidth=l??1,n.lineCap=u??`butt`),e(n,r)?!1:s&&n.isPointInPath(i,a)||c&&n.isPointInStroke(i,a)}}function YO(e){return qO(JO(e))}function XO(e,t){return`translate(`+e+`,`+t+`)`}function ZO(e){return`rotate(`+e+`)`}function ghe(e,t){return`scale(`+e+`,`+t+`)`}function _he(e){return XO(e.x||0,e.y||0)}function vhe(e){return XO(e.x||0,e.y||0)+(e.angle?` `+ZO(e.angle):``)}function yhe(e){return XO(e.x||0,e.y||0)+(e.angle?` `+ZO(e.angle):``)+(e.scaleX||e.scaleY?` `+ghe(e.scaleX||1,e.scaleY||1):``)}function QO(e,t,n){function r(e,n){e(`transform`,vhe(n)),e(`d`,t(null,n))}function i(e,n){return t(FO(e,n.angle),n),PO(e,n,!0).translate(n.x||0,n.y||0)}function a(e,n){var r=n.x||0,i=n.y||0,a=n.angle||0;e.translate(r,i),a&&e.rotate(a*=Ik),e.beginPath(),t(e,n),a&&e.rotate(-a),e.translate(-r,-i)}return{type:e,tag:`path`,nested:!1,attr:r,bound:i,draw:KO(a),pick:YO(a),isect:n||IO(a)}}function bhe(e,t){for(var n=e[0].orient===`horizontal`?t[1]:t[0],r=e[0].orient===`horizontal`?`y`:`x`,i=e.length,a=1/0,o,s;--i>=0;)e[i].defined!==!1&&(s=Math.abs(e[i][r]-n),s=0;)if(e[r].defined!==!1&&(i=e[r].x-t[0],a=e[r].y-t[1],o=i*i+a*a,o=0;)if(e[n].defined!==!1&&(r=e[n].x-t[0],i=e[n].y-t[1],a=r*r+i*i,r=e[n].size||1,a.5&&t<1.5?.5-Math.abs(t-1):0:e.strokeOffset}function Ehe(e,t){e(`transform`,_he(t))}function Dhe(e,t){let n=The(t);e(`d`,OO(null,t,n,n))}function Ohe(e,t){e(`class`,`background`),e(`aria-hidden`,!0),Dhe(e,t)}function khe(e,t){e(`class`,`foreground`),e(`aria-hidden`,!0),t.strokeForeground?Dhe(e,t):e(`d`,``)}function Ahe(e,t,n){e(`clip-path`,t.clip?kO(n,t,t):null)}function jhe(e,t){if(!t.clip&&t.items){let n=t.items,r=n.length;for(let t=0;t{let i=t.x||0,a=t.y||0,o=t.strokeForeground,s=t.opacity==null?1:t.opacity;(t.stroke||t.fill)&&s&&(ek(e,t,i,a),zO(e,t),t.fill&&VO(e,t,s)&&e.fill(),t.stroke&&!o&&HO(e,t,s)&&e.stroke()),e.save(),e.translate(i,a),t.clip&&whe(e,t),n&&n.translate(-i,-a),WO(t,t=>{(t.marktype===`group`||r==null||r.includes(t.marktype))&&this.draw(e,t,n,r)}),n&&n.translate(i,a),e.restore(),o&&t.stroke&&s&&(ek(e,t,i,a),zO(e,t),HO(e,t,s)&&e.stroke())})}function Nhe(e,t,n,r,i,a){if(t.bounds&&!t.bounds.contains(i,a)||!t.items)return null;let o=n*e.pixelRatio,s=r*e.pixelRatio;return GO(t,c=>{let l,u,d,f=c.bounds;if(f&&!f.contains(i,a))return;u=c.x||0,d=c.y||0;let p=u+(c.width||0),m=d+(c.height||0),h=c.clip;if(h&&(ip||am))return;if(e.save(),e.translate(u,d),u=i-u,d=a-d,h&&DO(c)&&!P_e(e,c,o,s))return e.restore(),null;let g=c.strokeForeground,_=t.interactive!==!1;return _&&g&&c.stroke&&N_e(e,c,o,s)?(e.restore(),c):(l=GO(c,e=>Phe(e,u,d)?this.pick(e,n,r,u,d):null),!l&&_&&(c.fill||!g&&c.stroke)&&M_e(e,c,o,s)&&(l=c),e.restore(),l||null)})}function Phe(e,t,n){return(e.interactive!==!1||e.marktype===`group`)&&e.bounds&&e.bounds.contains(t,n)}function tk(e,t){var n=e.image;return(!n||e.url&&e.url!==n.url)&&(n={complete:!1,width:0,height:0},t.loadImage(e.url).then(t=>{e.image=t,e.image.url=e.url})),n}function nk(e,t){return e.width==null?!t||!t.width?0:e.aspect!==!1&&e.height?e.height*t.width/t.height:t.width:e.width}function rk(e,t){return e.height==null?!t||!t.height?0:e.aspect!==!1&&e.width?e.width*t.height/t.width:t.height:e.height}function ik(e,t){return e===`center`?t/2:e===`right`?t:0}function ak(e,t){return e===`middle`?t/2:e===`bottom`?t:0}function Fhe(e,t,n){let r=tk(t,n),i=nk(t,r),a=rk(t,r),o=(t.x||0)-ik(t.align,i),s=(t.y||0)-ak(t.baseline,a);e(`href`,!r.src&&r.toDataURL?r.toDataURL():r.src||``,_A[`xmlns:xlink`],`xlink:href`),e(`transform`,XO(o,s)),e(`width`,i),e(`height`,a),e(`preserveAspectRatio`,t.aspect===!1?`none`:`xMidYMid`)}function Ihe(e,t){let n=t.image,r=nk(t,n),i=rk(t,n),a=(t.x||0)-ik(t.align,r),o=(t.y||0)-ak(t.baseline,i);return e.set(a,o,a+r,o+i)}function Lhe(e,t,n){WO(t,t=>{if(n&&!n.intersects(t.bounds))return;let r=tk(t,this),i=nk(t,r),a=rk(t,r);if(i===0||a===0)return;let o=(t.x||0)-ik(t.align,i),s=(t.y||0)-ak(t.baseline,a),c,l,u;t.aspect!==!1&&(c=r.width/r.height,l=t.width/t.height,c===c&&l===l&&c!==l&&(l{if(!(n&&!n.intersects(t.bounds))){var r=t.opacity==null?1:t.opacity;r&&Ghe(e,t,r)&&(zO(e,t),e.stroke())}})}function qhe(e,t,n,r){return e.isPointInStroke?Ghe(e,t,1)&&e.isPointInStroke(n,r):!1}function Jhe(e){yA.width=e&&hA?ck:sk}function sk(e,t){return Yhe(pk(e,t),lk(e))}function Yhe(e,t){return~~(.8*e.length*t)}function ck(e,t){return lk(e)<=0||!(t=pk(e,t))?0:Xhe(t,hk(e))}function Xhe(e,t){let n=`(${t}) ${e}`,r=vA.get(n);return r===void 0&&(hA.font=t,r=hA.measureText(e).width,vA.set(n,r)),r}function lk(e){return e.fontSize==null?11:+e.fontSize||0}function uk(e){return e.lineHeight==null?lk(e)+2:e.lineHeight}function Zhe(e){return W(e)?e.length>1?e:e[0]:e}function dk(e){return Zhe(e.lineBreak&&e.text&&!W(e.text)?e.text.split(e.lineBreak):e.text)}function fk(e){let t=dk(e);return(W(t)?t.length-1:0)*uk(e)}function pk(e,t){let n=t==null?``:(t+``).trim();return e.limit>0&&n.length?$he(e,n):n}function Qhe(e){if(yA.width===ck){let t=hk(e);return e=>Xhe(e,t)}else if(yA.width===sk){let t=lk(e);return e=>Yhe(e,t)}else return t=>yA.width(e,t)}function $he(e,t){var n=+e.limit,r=Qhe(e);if(r(t)>>1,r(t.slice(c))>n?o=c+1:s=c;return i+t.slice(o)}else{for(;o>>1),r(t.slice(0,c))Math.max(e,yA.width(t,n)),0)):d=yA.width(t,u),i===`center`?c-=d/2:i===`right`&&(c-=d),e.set(c+=o,l+=s,c+d,l+r),t.angle&&!n)e.rotate(t.angle*Ik,o,s);else if(n===2)return e.rotatedPoints(t.angle*Ik,o,s);return e}function tge(e,t,n){WO(t,t=>{var r=t.opacity==null?1:t.opacity,i,a,o,s,c,l,u;if(!(n&&!n.intersects(t.bounds)||r===0||t.fontSize<=0||t.text==null||t.text.length===0)){if(e.font=hk(t),e.textAlign=t.align||`left`,i=_k(t),a=i.x1,o=i.y1,t.angle&&(e.save(),e.translate(a,o),e.rotate(t.angle*Ik),a=o=0),a+=t.dx||0,o+=(t.dy||0)+gk(t),l=dk(t),zO(e,t),W(l))for(c=uk(t),s=0;st;)e.removeChild(n[--r]);return e}function lge(e){return`mark-`+e.marktype+(e.role?` role-`+e.role:``)+(e.name?` `+e.name:``)}function wk(e,t){if(t.getScreenCTM){let n=uge(e,t.getScreenCTM());if(n)return n}return dge(e,t,t.getBoundingClientRect())}function uge(e,t){if(!t)return null;let n=t.a*t.d-t.b*t.c;if(!n)return null;let r=e.clientX-t.e,i=e.clientY-t.f;return[(t.d*r-t.c*i)/n,(t.a*i-t.b*r)/n]}function dge(e,t,n){let r=t.offsetWidth?n.width/t.offsetWidth:1,i=t.offsetHeight?n.height/t.offsetHeight:1;return[(e.clientX-n.left)/r-(t.clientLeft||0),(e.clientY-n.top)/i-(t.clientTop||0)]}function fge(e,t,n,r){var i=e&&e.mark,a,o;if(i&&(a=xA[i.marktype]).tip){for(o=wk(t,n),o[0]-=r[0],o[1]-=r[1];e=e.mark.group;)o[0]-=e.x||0,o[1]-=e.y||0;e=a.tip(i.items,o)}return e}function pge(e,t,n,r){e.element().setAttribute(`title`,r||``)}function mge(e,t){YA(t).forEach(t=>hge(e,t))}function hge(e,t){let n=e.canvas();n&&!e._events[t]&&(e._events[t]=1,n.addEventListener(t,e[t]?n=>e[t](n):n=>e.fire(t,n)))}function Tk(e,t,n){t.forEach(t=>e.fire(t,n))}function gge(e,t,n){return function(r){let i=this._active,a=this.pickEvent(r);a===i?Tk(this,e,r):((!i||!i.exit)&&Tk(this,n,r),this._active=a,Tk(this,t,r),Tk(this,e,r))}}function _ge(e){return function(t){Tk(this,e,t),this._active=null}}function vge(){return typeof window<`u`&&window.devicePixelRatio||1}function yge(e,t,n,r,i,a){let o=typeof HTMLElement<`u`&&e instanceof HTMLElement&&e.parentNode!=null,s=e.getContext(`2d`),c=o?vge():i;e.width=t*c,e.height=n*c;for(let e in a)s[e]=a[e];return o&&c!==1&&(e.style.width=t+`px`,e.style.height=n+`px`),s.pixelRatio=c,s.setTransform(c,0,0,c,c*r[0],c*r[1]),e}function bge(e,t,n){return t.expand(1).round(),e.pixelRatio%1&&t.scale(e.pixelRatio).round().scale(1/e.pixelRatio),t.translate(-(n[0]%1),-(n[1]%1)),e.beginPath(),e.rect(t.x1,t.y1,t.width(),t.height()),e.clip(),t}function xge(e,t){let n=t.aria===!1;if(e(ej,n||void 0),n||t.description==null)for(let t in lj)e(lj[t],void 0);else{let n=t.mark.marktype;e(tj,t.description),e(nj,t.ariaRole||(n===`group`?ij:aj)),e(rj,t.ariaRoleDescription||`${n} mark`)}}function Sge(e){return e.aria===!1?{[ej]:!0}:sj[e.role]?null:cj[e.role]?wge(e,cj[e.role]):Cge(e)}function Cge(e){let t=e.marktype,n=t===`group`||t===`text`||e.items.some(e=>e.description!=null&&e.aria!==!1);return oj(n?ij:aj,`${t} mark container`,e.description)}function wge(e,t){try{let n=e.items[0],r=t.caption||(()=>``);return oj(t.role||aj,t.desc,e.description||n.description||r(n))}catch{return null}}function Tge(e){return Qh(e.text).join(` `)}function Ege(e){let t=e.datum,n=e.orient,r=t.title?Oge(e):null,i=e.context,a=i.scales[t.scale].value,o=i.dataflow.locale(),s=a.type;return`${n===`left`||n===`right`?`Y`:`X`}-axis`+(r?` titled '${r}'`:``)+` for a ${WD(s)?`discrete`:s} scale with ${gme(o,a,e)}`}function Dge(e){let t=e.datum,n=t.title?Oge(e):null,r=`${t.type||``} legend`.trim(),i=t.scales,a=Object.keys(i),o=e.context,s=o.scales[i[a[0]]].value,c=o.dataflow.locale();return Age(r)+(n?` titled '${n}'`:``)+` for ${kge(a)} with ${gme(c,s,e)}`}function Oge(e){try{return Qh(Ih(e.items).items[0].text).join(` `)}catch{return null}}function kge(e){return e=e.map(e=>e+(e===`fill`||e===`stroke`?` color`:``)),e.length<2?e[0]:e.slice(0,-1).join(`, `)+` and `+Ih(e)}function Age(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function Ek(){let e=``,t=``,n=``,r=[],i=()=>t=n=``,a=a=>{t&&(e+=`${t}>${n}`,i()),r.push(a)},o=(e,n)=>(n!=null&&(t+=` ${e}="${dj(n)}"`),s),s={open(e,...n){a(e),t=`<`+e;for(let e of n)for(let t in e)o(t,e[t]);return s},close(){let a=r.pop();return t?e+=t+(n?`>${n}`:`/>`):e+=``,i(),s},attr:o,text:e=>(n+=uj(e),s),toString:()=>e};return s}function jge(e,t){if(e.open(t.tagName),t.hasAttributes()){let n=t.attributes,r=n.length;for(let t=0;t{i=e.mark(t,n,i,r),++a}),Ck(t,1+a)}function Ige(e,t,n,r,i){let a=e._svg,o;if(!a&&(o=t.ownerDocument,a=bk(o,r,vj),e._svg=a,e.mark&&(a.__data__=e,a.__values__={fill:`default`},r===`g`))){let t=bk(o,`path`,vj);a.appendChild(t),t.__data__=e;let n=bk(o,`g`,vj);a.appendChild(n),n.__data__=e;let r=bk(o,`path`,vj);a.appendChild(r),r.__data__=e,r.__values__={fill:`default`}}return(a.ownerSVGElement!==i||Lge(a,n))&&t.insertBefore(a,n?n.nextSibling:t.firstChild),a}function Lge(e,t){return e.parentNode&&e.parentNode.childNodes.length>1&&e.previousSibling!=t}function Dk(e,t,n){t!==xj[e]&&(n?Rge(bj,e,t,n):Ak(bj,e,t),xj[e]=t)}function Ok(e,t,n){n!==xj[t]&&(n==null?e.style.removeProperty(t):e.style.setProperty(t,n+``),xj[t]=n)}function kk(e,t){for(let n in t)Ak(e,n,t[n])}function Ak(e,t,n){n==null?e.removeAttribute(t):e.setAttribute(t,n)}function Rge(e,t,n,r){n==null?e.removeAttributeNS(r,t):e.setAttributeNS(r,t,n)}function zge(){let e;return typeof window>`u`?``:(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}function Bge(e,t,n,r,i){let a;if(t==null||(r===`bgrect`&&n.interactive===!1&&(e[`pointer-events`]=`none`),r===`bgfore`&&(n.interactive===!1&&(e[`pointer-events`]=`none`),e.display=`none`,t.fill!==null)))return e;r===`image`&&t.smooth===!1&&(a=[`image-rendering: optimizeSpeed;`,`image-rendering: pixelated;`]),r===`text`&&(e[`font-family`]=mk(t),e[`font-size`]=lk(t)+`px`,e[`font-style`]=t.fontStyle,e[`font-variant`]=t.fontVariant,e[`font-weight`]=t.fontWeight);for(let n in pj){let r=t[n],a=pj[n];r===`transparent`&&(a===`fill`||a===`stroke`)||r!=null&&(yO(r)&&(r=Ime(r,i.gradient,``)),e[a]=r)}for(let e in mj){let n=t[e];n!=null&&(a||=[],a.push(`${mj[e]}: ${n};`))}return a&&(e.style=a.join(` `)),e}function Vge(e){wj.svgMarkTypes=e.svgMarkTypes??[`text`],wj.svgOnTop=e.svgOnTop??!0,wj.debug=e.debug??!1}function jk(e,t){return e=String(e||``).toLowerCase(),arguments.length>1?(Nj[e]=t,this):Nj[e]}function Hge(e,t,n){let r=[],i=new AO().union(t),a=e.marktype;return a?Uge(e,i,n,r):a===`group`?Gge(e,i,n,r):U(`Intersect scene must be mark node or group item.`)}function Uge(e,t,n,r){if(Wge(e,t,n)){let i=e.items,a=e.marktype,o=i.length,s=0;if(a===`group`)for(;s=0;a--)if(n[a]!=r[a])return!1;for(a=n.length-1;a>=0;a--)if(i=n[a],!Mk(e[i],t[i],i))return!1;return typeof e==typeof t}function Xge(){rhe(),Fme()}var Nk,Pk,Fk,Zge,Qge,$ge,e_e,t_e,Ik,n_e,Lk,Rk,zk,Bk,Vk,Hk,Uk,Wk,Gk,Kk,qk,Jk,Yk,r_e,i_e,a_e,o_e,s_e,c_e,l_e,u_e,d_e,f_e,p_e,m_e,h_e,g_e,__e,v_e,Xk,y_e,b_e,x_e,S_e,C_e,w_e,T_e,E_e,Zk,Qk,D_e,$k,eA,tA,nA,rA,iA,aA,oA,sA,cA,lA,uA,dA,fA,pA,mA,O_e,hA,gA,k_e,A_e,j_e,M_e,N_e,P_e,F_e,_A,I_e,L_e,R_e,z_e,B_e,V_e,H_e,vA,yA,U_e,bA,xA,SA,W_e,CA,wA,TA,G_e,K_e,q_e,EA,DA,OA,kA,J_e,AA,jA,MA,NA,Y_e,PA,FA,IA,LA,RA,zA,BA,VA,HA,UA,WA,GA,KA,qA,JA,YA,XA,ZA,QA,$A,ej,tj,nj,rj,ij,aj,oj,sj,cj,lj,uj,dj,fj,pj,mj,hj,gj,_j,vj,yj,bj,xj,Sj,Cj,wj,Tj,Ej,Dj,Oj,kj,Aj,jj,Mj,Nj,Pj,Fj,Ij=o((()=>{Dg(),Yue(),Nw(),IT(),nx(),vO(),Nk=0,Pk=`p_`,Fk={basis:{curve:Aue},"basis-closed":{curve:jue},"basis-open":{curve:Nue},bundle:{curve:iT,tension:`beta`,value:.85},cardinal:{curve:sT,tension:`tension`,value:0},"cardinal-open":{curve:pT,tension:`tension`,value:0},"cardinal-closed":{curve:uT,tension:`tension`,value:0},"catmull-rom":{curve:_T,tension:`alpha`,value:.5},"catmull-rom-closed":{curve:bT,tension:`alpha`,value:.5},"catmull-rom-open":{curve:ST,tension:`alpha`,value:.5},linear:{curve:Bw},"linear-closed":{curve:Rue},monotone:{horizontal:Vue,vertical:Bue},natural:{curve:Uue},step:{curve:Gue},"step-after":{curve:que},"step-before":{curve:Kue}},Zge={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},Qge=/[mlhvzcsqta]([^mlhvzcsqta]*)/gi,$ge=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,e_e=/^((\s+,?\s*)|(,\s*))/,t_e=/^[01]/,Ik=Math.PI/180,n_e=1e-14,Lk=Math.PI/2,Rk=Math.PI*2,zk=Math.sqrt(3)/2,Bk={},Vk={},Hk=[].join,Uk=[`l`,0,0,0,0,0,0,0],Wk=.5773502691896257,Gk={circle:{draw:function(e,t){let n=Math.sqrt(t)/2;e.moveTo(n,0),e.arc(0,0,n,0,Rk)}},cross:{draw:function(e,t){var n=Math.sqrt(t)/2,r=n/2.5;e.moveTo(-n,-r),e.lineTo(-n,r),e.lineTo(-r,r),e.lineTo(-r,n),e.lineTo(r,n),e.lineTo(r,r),e.lineTo(n,r),e.lineTo(n,-r),e.lineTo(r,-r),e.lineTo(r,-n),e.lineTo(-r,-n),e.lineTo(-r,-r),e.closePath()}},diamond:{draw:function(e,t){let n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.closePath()}},square:{draw:function(e,t){var n=Math.sqrt(t),r=-n/2;e.rect(r,r,n,n)}},arrow:{draw:function(e,t){var n=Math.sqrt(t)/2,r=n/7,i=n/2.5,a=n/8;e.moveTo(-r,n),e.lineTo(r,n),e.lineTo(r,-a),e.lineTo(i,-a),e.lineTo(0,-n),e.lineTo(-i,-a),e.lineTo(-r,-a),e.closePath()}},wedge:{draw:function(e,t){var n=Math.sqrt(t)/2,r=zk*n,i=r-n*Wk,a=n/4;e.moveTo(0,-r-i),e.lineTo(-a,r-i),e.lineTo(a,r-i),e.closePath()}},triangle:{draw:function(e,t){var n=Math.sqrt(t)/2,r=zk*n,i=r-n*Wk;e.moveTo(0,-r-i),e.lineTo(-n,r-i),e.lineTo(n,r-i),e.closePath()}},"triangle-up":{draw:function(e,t){var n=Math.sqrt(t)/2,r=zk*n;e.moveTo(0,-r),e.lineTo(-n,r),e.lineTo(n,r),e.closePath()}},"triangle-down":{draw:function(e,t){var n=Math.sqrt(t)/2,r=zk*n;e.moveTo(0,r),e.lineTo(-n,-r),e.lineTo(n,-r),e.closePath()}},"triangle-right":{draw:function(e,t){var n=Math.sqrt(t)/2,r=zk*n;e.moveTo(r,0),e.lineTo(-r,-n),e.lineTo(-r,n),e.closePath()}},"triangle-left":{draw:function(e,t){var n=Math.sqrt(t)/2,r=zk*n;e.moveTo(-r,0),e.lineTo(r,-n),e.lineTo(r,n),e.closePath()}},stroke:{draw:function(e,t){let n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(n,0)}}},Kk={},qk=.448084975506,Jk=e=>e.x||0,Yk=e=>e.y||0,r_e=e=>e.width||0,i_e=e=>e.height||0,a_e=e=>(e.x||0)+(e.width||0),o_e=e=>(e.y||0)+(e.height||0),s_e=e=>e.startAngle||0,c_e=e=>e.endAngle||0,l_e=e=>e.padAngle||0,u_e=e=>e.innerRadius||0,d_e=e=>e.outerRadius||0,f_e=e=>e.cornerRadius||0,p_e=e=>EO(e.cornerRadiusTopLeft,e.cornerRadius)||0,m_e=e=>EO(e.cornerRadiusTopRight,e.cornerRadius)||0,h_e=e=>EO(e.cornerRadiusBottomRight,e.cornerRadius)||0,g_e=e=>EO(e.cornerRadiusBottomLeft,e.cornerRadius)||0,__e=e=>EO(e.size,64),v_e=e=>e.size||1,Xk=e=>e.defined!==!1,y_e=e=>Ume(e.shape||`circle`),b_e=Tue().startAngle(s_e).endAngle(c_e).padAngle(l_e).innerRadius(u_e).outerRadius(d_e).cornerRadius(f_e),x_e=qw().x(Jk).y1(Yk).y0(o_e).defined(Xk),S_e=qw().y(Yk).x1(Jk).x0(a_e).defined(Xk),C_e=Gw().x(Jk).y(Yk).defined(Xk),w_e=Yme().x(Jk).y(Yk).width(r_e).height(i_e).cornerRadius(p_e,m_e,h_e,g_e),T_e=Oue().type(y_e).size(__e),E_e=Xme().x(Jk).y(Yk).defined(Xk).size(v_e),Zk=1,AO.prototype={clone(){return new AO(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2},set(e,t,n,r){return nthis.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},expand(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(e){return this.x1*=e,this.y1*=e,this.x2*=e,this.y2*=e,this},translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},rotate(e,t,n){let r=this.rotatedPoints(e,t,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},rotatedPoints(e,t,n){var{x1:r,y1:i,x2:a,y2:o}=this,s=Math.cos(e),c=Math.sin(e),l=t-t*s+n*c,u=n-t*c-n*s;return[s*r-c*i+l,c*r+s*i+u,s*r-c*o+l,c*r+s*o+u,s*a-c*i+l,c*a+s*i+u,s*a-c*o+l,c*a+s*o+u]},union(e){return e.x1this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2=e.x2&&this.y1<=e.y1&&this.y2>=e.y2},alignsWith(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},intersects(e){return e&&!(this.x2e.x2||this.y2e.y2)},contains(e,t){return!(ethis.x2||tthis.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},fg(MO,jO),Qk=class{constructor(e){this._pending=0,this._loader=e||tx()}pending(){return this._pending}sanitizeURL(e){let t=this;return ihe(t),t._loader.sanitize(e,{context:`href`}).then(e=>(NO(t),e)).catch(()=>(NO(t),null))}loadImage(e){let t=this,n=FT();return ihe(t),t._loader.sanitize(e,{context:`image`}).then(e=>{let r=e.href;if(!r||!n)throw{url:r};let i=new n,a=cg(e,`crossOrigin`)?e.crossOrigin:`anonymous`;return a!=null&&(i.crossOrigin=a),i.onload=()=>NO(t),i.onerror=()=>NO(t),i.src=r,i}).catch(e=>(NO(t),{complete:!1,width:0,height:0,src:e&&e.url||``}))}ready(){let e=this;return new Promise(t=>{function n(r){e.pending()?setTimeout(()=>{n(!0)},10):t(r)}n(!1)})}},D_e=Rk-1e-8,sA=(e,t)=>$k.add(e,t),cA=(e,t)=>sA(eA=e,tA=t),lA=e=>sA(e,$k.y1),uA=e=>sA($k.x1,e),dA=(e,t)=>rA*e+aA*t,fA=(e,t)=>iA*e+oA*t,pA=(e,t)=>sA(dA(e,t),fA(e,t)),mA=(e,t)=>cA(dA(e,t),fA(e,t)),O_e={beginPath(){},closePath(){},moveTo:mA,lineTo:mA,rect(e,t,n,r){nA?(pA(e+n,t),pA(e+n,t+r),pA(e,t+r),mA(e,t)):(sA(e+n,t+r),cA(e,t))},quadraticCurveTo(e,t,n,r){let i=dA(e,t),a=fA(e,t),o=dA(n,r),s=fA(n,r);ahe(eA,i,o,lA),ahe(tA,a,s,uA),cA(o,s)},bezierCurveTo(e,t,n,r,i,a){let o=dA(e,t),s=fA(e,t),c=dA(n,r),l=fA(n,r),u=dA(i,a),d=fA(i,a);ohe(eA,o,c,u,lA),ohe(tA,s,l,d,uA),cA(u,d)},arc(e,t,n,r,i,a){if(r+=nA,i+=nA,eA=n*Math.cos(i)+e,tA=n*Math.sin(i)+t,Math.abs(i-r)>D_e)sA(e-n,t-n),sA(e+n,t+n);else{let o=r=>sA(n*Math.cos(r)+e,n*Math.sin(r)+t),s,c;if(o(r),o(i),i!==r)if(r%=Rk,r<0&&(r+=Rk),i%=Rk,i<0&&(i+=Rk),ii;++c,s-=Lk)o(s);else for(s=r-r%Lk+Lk,c=0;c<4&&s=0;)if(e[r].type===t&&(!n||e[r].handler===n))return r;return-1}handlers(e){let t=this._handlers,n=[];if(e)n.push(...t[this.eventName(e)]);else for(let e in t)n.push(...t[e]);return n}eventName(e){let t=e.indexOf(`.`);return t<0?e:e.slice(0,t)}handleHref(e,t,n){this._loader.sanitize(n,{context:`href`}).then(t=>{let n=new MouseEvent(e.type,e),r=bk(null,`a`);for(let e in t)r.setAttribute(e,t[e]);r.dispatchEvent(n)}).catch(()=>{})}handleTooltip(e,t,n){if(t&&t.tooltip!=null){t=fge(t,e,this.canvas(),this._origin);let r=n&&t&&t.tooltip||null;this._tooltip.call(this._obj,this,e,t,r)}}getItemBoundingClientRect(e){let t=this.canvas();if(!t)return;let n=t.getBoundingClientRect(),r=this._origin,i=e.bounds,a=i.width(),o=i.height(),s=i.x1+r[0]+n.left,c=i.y1+r[1]+n.top;for(;e.mark&&(e=e.mark.group);)s+=e.x||0,c+=e.y||0;return{x:s,y:c,width:a,height:o,left:s,top:c,right:s+a,bottom:c+o}}},TA=class{constructor(e){this._el=null,this._bgcolor=null,this._loader=new Qk(e)}initialize(e,t,n,r,i){return this._el=e,this.resize(t,n,r,i)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}background(e){return arguments.length===0?this._bgcolor:(this._bgcolor=e,this)}resize(e,t,n,r){return this._width=e,this._height=t,this._origin=n||[0,0],this._scale=r||1,this}dirty(){}render(e,t){let n=this;return n._call=function(){n._render(e,t)},n._call(),n._call=null,n}_render(){}renderAsync(e,t){let n=this.render(e,t);return this._ready?this._ready.then(()=>n):Promise.resolve(n)}_load(e,t){var n=this,r=n._loader[e](t);if(!n._ready){let e=n._call;n._ready=n._loader.ready().then(t=>{t&&e(),n._ready=null})}return r}sanitizeURL(e){return this._load(`sanitizeURL`,e)}loadImage(e){return this._load(`loadImage`,e)}},G_e=`keydown`,K_e=`keypress`,q_e=`keyup`,EA=`dragenter`,DA=`dragleave`,OA=`dragover`,kA=`pointerdown`,J_e=`pointerup`,AA=`pointermove`,jA=`pointerout`,MA=`pointerover`,NA=`mousedown`,Y_e=`mouseup`,PA=`mousemove`,FA=`mouseout`,IA=`mouseover`,LA=`click`,RA=`dblclick`,zA=`wheel`,BA=`mousewheel`,VA=`touchstart`,HA=`touchmove`,UA=`touchend`,WA=[G_e,K_e,q_e,EA,DA,OA,kA,J_e,AA,jA,MA,NA,Y_e,PA,FA,IA,LA,RA,zA,BA,VA,HA,UA],GA=AA,KA=FA,qA=LA,JA=class extends wA{constructor(e,t){super(e,t),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=WA,this.pointermove=gge([AA,PA],[MA,IA],[jA,FA]),this.dragover=gge([OA],[EA],[DA]),this.pointerout=_ge([jA,FA]),this.dragleave=_ge([DA])}initialize(e,t,n){return this._canvas=e&&xk(e,`canvas`),[LA,NA,kA,AA,jA,DA].forEach(e=>mge(this,e)),super.initialize(e,t,n)}canvas(){return this._canvas}context(){return this._canvas.getContext(`2d`)}DOMMouseScroll(e){this.fire(BA,e)}pointerdown(e){this._down=this._active,this.fire(kA,e)}mousedown(e){this._down=this._active,this.fire(NA,e)}click(e){this._down===this._active&&(this.fire(LA,e),this._down=null)}touchstart(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&=(this._active=this._touch,!1),this.fire(VA,e,!0)}touchmove(e){this.fire(HA,e,!0)}touchend(e){this.fire(UA,e,!0),this._touch=null}fire(e,t,n){let r=n?this._touch:this._active,i=this._handlers[e];if(t.vegaType=e,e===qA&&r&&r.href?this.handleHref(t,r,r.href):(e===GA||e===KA)&&this.handleTooltip(t,r,e!==KA),i)for(let e=0,n=i.length;e=0&&r.splice(i,1),this}pickEvent(e){let t=wk(e,this._canvas),n=this._origin;return this.pick(this._scene,t[0],t[1],t[0]-n[0],t[1]-n[1])}pick(e,t,n,r,i){let a=this.context();return xA[e.marktype].pick.call(this,a,e,t,n,r,i)}},YA=e=>e===VA||e===HA||e===UA?[VA,HA,UA]:[e],XA=class extends TA{constructor(e){super(e),this._options={},this._redraw=!1,this._dirty=new AO,this._tempb=new AO}initialize(e,t,n,r,i,a){return this._options=a||{},this._canvas=this._options.externalContext?null:PT(1,1,this._options.type),e&&this._canvas&&(Ck(e,0).appendChild(this._canvas),this._canvas.setAttribute(`class`,`marks`)),super.initialize(e,t,n,r,i)}resize(e,t,n,r){if(super.resize(e,t,n,r),this._canvas)yge(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{let e=this._options.externalContext;e||U(`CanvasRenderer is missing a valid canvas or context`),e.scale(this._scale,this._scale),e.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this}canvas(){return this._canvas}context(){return this._options.externalContext||(this._canvas?this._canvas.getContext(`2d`):null)}dirty(e){let t=this._tempb.clear().union(e.bounds),n=e.mark.group;for(;n;)t.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(t)}_render(e,t){let n=this.context(),r=this._origin,i=this._width,a=this._height,o=this._dirty,s=ZA(r,i,a);n.save();let c=this._redraw||o.empty()?(this._redraw=!1,s.expand(1)):bge(n,s.intersect(o),r);return this.clear(-r[0],-r[1],i,a),this.draw(n,e,c,t),n.restore(),o.clear(),this}draw(e,t,n,r){if(t.marktype!==`group`&&r!=null&&!r.includes(t.marktype))return;let i=xA[t.marktype];t.clip&&Che(e,t),i.draw.call(this,e,t,n,r),t.clip&&e.restore()}clear(e,t,n,r){let i=this._options,a=this.context();i.type!==`pdf`&&!i.externalContext&&a.clearRect(e,t,n,r),this._bgcolor!=null&&(a.fillStyle=this._bgcolor,a.fillRect(e,t,n,r))}},ZA=(e,t,n)=>new AO().set(0,0,t,n).translate(-e[0],-e[1]),QA=class extends wA{constructor(e,t){super(e,t);let n=this;n._hrefHandler=$A(n,(e,t)=>{t&&t.href&&n.handleHref(e,t,t.href)}),n._tooltipHandler=$A(n,(e,t)=>{n.handleTooltip(e,t,e.type!==KA)})}initialize(e,t,n){let r=this._svg;return r&&(r.removeEventListener(qA,this._hrefHandler),r.removeEventListener(GA,this._tooltipHandler),r.removeEventListener(KA,this._tooltipHandler)),this._svg=r=e&&xk(e,`svg`),r&&(r.addEventListener(qA,this._hrefHandler),r.addEventListener(GA,this._tooltipHandler),r.addEventListener(KA,this._tooltipHandler)),super.initialize(e,t,n)}canvas(){return this._svg}on(e,t){let n=this.eventName(e),r=this._handlers;if(this._handlerIndex(r[n],e,t)<0){let i={type:e,handler:t,listener:$A(this,t)};(r[n]||(r[n]=[])).push(i),this._svg&&this._svg.addEventListener(n,i.listener)}return this}off(e,t){let n=this.eventName(e),r=this._handlers[n],i=this._handlerIndex(r,e,t);return i>=0&&(this._svg&&this._svg.removeEventListener(n,r[i].listener),r.splice(i,1)),this}},$A=(e,t)=>n=>{let r=n.target.__data__;r=Array.isArray(r)?r[0]:r,n.vegaType=n.type,t.call(e._obj,n,r)},ej=`aria-hidden`,tj=`aria-label`,nj=`role`,rj=`aria-roledescription`,ij=`graphics-object`,aj=`graphics-symbol`,oj=(e,t,n)=>({[nj]:e,[rj]:t,[tj]:n||void 0}),sj=Tg([`axis-domain`,`axis-grid`,`axis-label`,`axis-tick`,`axis-title`,`legend-band`,`legend-entry`,`legend-gradient`,`legend-label`,`legend-title`,`legend-symbol`,`title`]),cj={axis:{desc:`axis`,caption:Ege},legend:{desc:`legend`,caption:Dge},"title-text":{desc:`title`,caption:e=>`Title text '${Tge(e)}'`},"title-subtitle":{desc:`subtitle`,caption:e=>`Subtitle text '${Tge(e)}'`}},lj={ariaRole:nj,ariaRoleDescription:rj,description:tj},uj=e=>(e+``).replace(/&/g,`&`).replace(//g,`>`),dj=e=>uj(e).replace(/"/g,`"`).replace(/\t/g,` `).replace(/\n/g,` `).replace(/\r/g,` `),fj=e=>jge(Ek(),e)+``,pj={fill:`fill`,fillOpacity:`fill-opacity`,stroke:`stroke`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,strokeCap:`stroke-linecap`,strokeJoin:`stroke-linejoin`,strokeDash:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeMiterLimit:`stroke-miterlimit`,opacity:`opacity`},mj={blend:`mix-blend-mode`},hj={fill:`none`,"stroke-miterlimit":4},gj=0,_j=`http://www.w3.org/2000/xmlns/`,vj=_A.xmlns,yj=class extends TA{constructor(e){super(e),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}initialize(e,t,n,r,i){return this._defs={},this._clearDefs(),e&&(this._svg=Sk(e,0,`svg`,vj),this._svg.setAttributeNS(_j,`xmlns`,vj),this._svg.setAttributeNS(_j,`xmlns:xlink`,_A[`xmlns:xlink`]),this._svg.setAttribute(`version`,_A.version),this._svg.setAttribute(`class`,`marks`),Ck(e,1),this._root=Sk(this._svg,gj,`g`,vj),kk(this._root,hj),Ck(this._svg,1)),this.background(this._bgcolor),super.initialize(e,t,n,r,i)}background(e){return arguments.length&&this._svg&&this._svg.style.setProperty(`background-color`,e),super.background(...arguments)}resize(e,t,n,r){return super.resize(e,t,n,r),this._svg&&(kk(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}),this._root.setAttribute(`transform`,`translate(${this._origin})`)),this._dirty=[],this}canvas(){return this._svg}svg(){let e=this._svg,t=this._bgcolor;if(!e)return null;let n;t&&(e.removeAttribute(`style`),n=Sk(e,gj,`rect`,vj),kk(n,{width:this._width,height:this._height,fill:t}));let r=fj(e);return t&&(e.removeChild(n),this._svg.style.setProperty(`background-color`,t)),r}_render(e,t){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,e,void 0,t),Ck(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this}dirty(e){e.dirty!==this._dirtyID&&(e.dirty=this._dirtyID,this._dirty.push(e))}isDirty(e){return this._dirtyAll||!e._svg||!e._svg.ownerSVGElement||e.dirty===this._dirtyID}_dirtyCheck(){this._dirtyAll=!0;let e=this._dirty;if(!e.length||!this._dirtyID)return!0;let t=++this._dirtyID,n,r,i,a,o,s,c;for(o=0,s=e.length;o{e.dirty=t})),!r.zdirty){if(n.exit){a.nested&&r.items.length?(c=r.items[0],c._svg&&this._update(a,c._svg,c)):n._svg&&(c=n._svg.parentNode,c&&c.removeChild(n._svg)),n._svg=null;continue}n=a.nested?r.items[0]:n,n._update!==t&&(!n._svg||!n._svg.ownerSVGElement?(this._dirtyAll=!1,Mge(n,t)):this._update(a,n._svg,n),n._update=t)}return!this._dirtyAll}mark(e,t,n,r){if(!this.isDirty(t))return t._svg;let i=this._svg,a=t.marktype,o=xA[a],s=t.interactive===!1?`none`:null,c=o.tag===`g`,l=Ige(t,e,n,`g`,i);if(a!==`group`&&r!=null&&!r.includes(a))return Ck(l,0),t._svg;l.setAttribute(`class`,lge(t));let u=Sge(t);for(let e in u)Ak(l,e,u[e]);c||Ak(l,`pointer-events`,s),Ak(l,`clip-path`,t.clip?kO(this,t,t.group):null);let d=null,f=0,p=e=>{let t=this.isDirty(e),n=Ige(e,l,d,o.tag,i);t&&(this._update(o,n,e),c&&Fge(this,n,e,r)),d=n,++f};return o.nested?t.items.length&&p(t.items[0]):WO(t,p),Ck(l,f),l}_update(e,t,n){bj=t,xj=t.__values__,xge(Dk,n),e.attr(Dk,n,this);let r=Sj[e.type];r&&r.call(this,e,t,n),bj&&this.style(bj,n)}style(e,t){if(t!=null){for(let n in pj){let r=n===`font`?mk(t):t[n];if(r===xj[n])continue;let i=pj[n];r==null?e.removeAttribute(i):(yO(r)&&(r=Ime(r,this._defs.gradient,zge())),e.setAttribute(i,r+``)),xj[n]=r}for(let n in mj)Ok(e,mj[n],t[n])}}defs(){let e=this._svg,t=this._defs,n=t.el,r=0;for(let i in t.gradient)n||(t.el=n=Sk(e,1,`defs`,vj)),r=Nge(n,t.gradient[i],r);for(let i in t.clipping)n||(t.el=n=Sk(e,1,`defs`,vj)),r=Pge(n,t.clipping[i],r);n&&(r===0?(e.removeChild(n),t.el=null):Ck(n,r))}_clearDefs(){let e=this._defs;e.gradient={},e.clipping={}}},bj=null,xj=null,Sj={group(e,t,n){let r=bj=t.childNodes[2];xj=r.__values__,e.foreground(Dk,n,this),xj=t.__values__,bj=t.childNodes[1],e.content(Dk,n,this);let i=bj=t.childNodes[0];e.background(Dk,n,this);let a=n.mark.interactive===!1?`none`:null;if(a!==xj.events&&(Ak(r,`pointer-events`,a),Ak(i,`pointer-events`,a),xj.events=a),n.strokeForeground&&n.stroke){let e=n.fill;Ak(r,`display`,null),this.style(i,n),Ak(i,`stroke`,null),e&&(n.fill=null),xj=r.__values__,this.style(r,n),e&&(n.fill=e),bj=null}else Ak(r,`display`,`none`)},image(e,t,n){n.smooth===!1?(Ok(t,`image-rendering`,`optimizeSpeed`),Ok(t,`image-rendering`,`pixelated`)):Ok(t,`image-rendering`,null)},text(e,t,n){let r=dk(n),i,a,o,s;W(r)?(a=r.map(e=>pk(n,e)),i=a.join(` +`),i!==xj.text&&(Ck(t,0),o=t.ownerDocument,s=uk(n),a.forEach((e,r)=>{let i=bk(o,`tspan`,vj);i.__data__=n,i.textContent=e,r&&(i.setAttribute(`x`,0),i.setAttribute(`dy`,s)),t.appendChild(i)}),xj.text=i)):(a=pk(n,r),a!==xj.text&&(t.textContent=a,xj.text=a)),Ak(t,`font-family`,mk(n)),Ak(t,`font-size`,lk(n)+`px`),Ak(t,`font-style`,n.fontStyle),Ak(t,`font-variant`,n.fontVariant),Ak(t,`font-weight`,n.fontWeight)}},Cj=class extends TA{constructor(e){super(e),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(e){let t=Ek();t.open(`svg`,og({},_A,{class:`marks`,width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));let n=this._bgcolor;return n&&n!==`transparent`&&n!==`none`&&t.open(`rect`,{width:this._width,height:this._height,fill:n}).close(),t.open(`g`,hj,{transform:`translate(`+this._origin+`)`}),this.mark(t,e),t.close(),this.defs(t),this._text=t.close()+``,this}mark(e,t){let n=xA[t.marktype],r=n.tag,i=[xge,n.attr];e.open(`g`,{class:lge(t),"clip-path":t.clip?kO(this,t,t.group):null},Sge(t),{"pointer-events":r!==`g`&&t.interactive===!1?`none`:null});let a=a=>{let o=this.href(a);if(o&&e.open(`a`,o),e.open(r,this.attr(t,a,i,r===`g`?null:r)),r===`text`){let t=dk(a);if(W(t)){let n={x:0,dy:uk(a)};for(let r=0;rthis.mark(e,t)),e.close(),r&&o?(i&&(a.fill=null),a.stroke=o,e.open(`path`,this.attr(t,a,n.foreground,`bgrect`)).close(),i&&(a.fill=i)):e.open(`path`,this.attr(t,a,n.foreground,`bgfore`)).close()}e.close(),o&&e.close()};return n.nested?t.items&&t.items.length&&a(t.items[0]):WO(t,a),e.close()}href(e){let t=e.href,n;if(t){if(n=this._hrefs&&this._hrefs[t])return n;this.sanitizeURL(t).then(e=>{e[`xlink:href`]=e.href,e.href=null,(this._hrefs||={})[t]=e})}return null}attr(e,t,n,r){let i={},a=(e,t,n,r)=>{i[r||e]=t};return Array.isArray(n)?n.forEach(e=>e(a,t,this)):n(a,t,this),r&&Bge(i,t,e,r,this._defs),i}defs(e){let t=this._defs.gradient,n=this._defs.clipping;if(Object.keys(t).length+Object.keys(n).length!==0){e.open(`defs`);for(let n in t){let r=t[n],i=r.stops;r.gradient===`radial`?(e.open(`pattern`,{id:Pk+n,viewBox:`0,0,1,1`,width:`100%`,height:`100%`,preserveAspectRatio:`xMidYMid slice`}),e.open(`rect`,{width:`1`,height:`1`,fill:`url(#`+n+`)`}).close(),e.close(),e.open(`radialGradient`,{id:n,fx:r.x1,fy:r.y1,fr:r.r1,cx:r.x2,cy:r.y2,r:r.r2})):e.open(`linearGradient`,{id:n,x1:r.x1,x2:r.x2,y1:r.y1,y2:r.y2});for(let t=0;t!wj.svgMarkTypes.includes(e));this._svgRenderer.render(e,wj.svgMarkTypes),this._canvasRenderer.render(e,n)}resize(e,t,n,r){return super.resize(e,t,n,r),this._svgRenderer.resize(e,t,n,r),this._canvasRenderer.resize(e,t,n,r),this}background(e){return wj.svgOnTop?this._canvasRenderer.background(e):this._svgRenderer.background(e),this}},Ej=class extends JA{constructor(e,t){super(e,t)}initialize(e,t,n){let r=Sk(Sk(e,0,`div`),+!wj.svgOnTop,`div`);return super.initialize(r,t,n)}},Dj=`canvas`,Oj=`hybrid`,kj=`png`,Aj=`svg`,jj=`none`,Mj={Canvas:Dj,PNG:kj,SVG:Aj,Hybrid:Oj,None:jj},Nj={},Nj[Dj]=Nj[kj]={renderer:XA,headless:XA,handler:JA},Nj[Aj]={renderer:yj,headless:Cj,handler:QA},Nj[Oj]={renderer:Tj,headless:Tj,handler:Ej},Nj[jj]={},Pj=new AO,Fj=1e-9})),X_e=c({bound:()=>Lj,identifier:()=>zj,mark:()=>Bj,overlap:()=>Vj,render:()=>Hj,viewlayout:()=>Qj});function Lj(e){K.call(this,null,e)}function Rj(e,t,n){return t(e.bounds.clear(),e,n)}function zj(e){K.call(this,0,e)}function Z_e(e){return e._signals[LM]||(e._signals[LM]=e.add(0))}function Bj(e){K.call(this,null,e)}function Q_e(e){let t=e.groups,n=e.parent;return t&&t.size===1?t.get(Object.keys(t.object)[0]):t&&n?t.lookup(n):null}function Vj(e){K.call(this,null,e)}function Hj(e){K.call(this,null,e)}function Uj(e,t,n){return e[t]===n?0:(e[t]=n,1)}function $_e(e){var t=e.items[0].orient;return t===eM||t===tM}function eve(e){let t=+e.grid;return[e.ticks?t++:-1,e.labels?t++:-1,t+ +e.domain]}function tve(e,t,n,r){var i=t.items[0],a=i.datum,o=i.translate==null?.5:i.translate,s=i.orient,c=eve(a),l=i.range,u=i.offset,d=i.position,f=i.minExtent,p=i.maxExtent,m=a.title&&i.items[c[2]].items[0],h=i.titlePadding,g=i.bounds,_=m&&fk(m),v=0,y=0,b,x;switch(GM.clear().union(g),g.clear(),(b=c[0])>-1&&g.union(i.items[b].bounds),(b=c[1])>-1&&g.union(i.items[b].bounds),s){case $j:v=d||0,y=-u,x=Math.max(f,Math.min(p,-g.y1)),g.add(0,-x).add(l,0),m&&Wj(e,m,x,h,_,0,-1,g);break;case eM:v=-u,y=d||0,x=Math.max(f,Math.min(p,-g.x1)),g.add(-x,0).add(0,l),m&&Wj(e,m,x,h,_,1,-1,g);break;case tM:v=n+u,y=d||0,x=Math.max(f,Math.min(p,g.x2)),g.add(0,0).add(x,l),m&&Wj(e,m,x,h,_,1,1,g);break;case nM:v=d||0,y=r+u,x=Math.max(f,Math.min(p,g.y2)),g.add(0,0).add(l,x),m&&Wj(e,m,x,h,0,0,1,g);break;default:v=i.x,y=i.y}return PO(g.translate(v,y),i),Uj(i,`x`,v+o)|Uj(i,`y`,y+o)&&(i.bounds=GM,e.dirty(i),i.bounds=g,e.dirty(i)),i.mark.bounds.clear().union(g)}function Wj(e,t,n,r,i,a,o,s){let c=t.bounds;if(t.auto){let s=o*(n+i+r),l=0,u=0;e.dirty(t),a?l=(t.x||0)-(t.x=s):u=(t.y||0)-(t.y=s),t.mark.bounds.clear().union(c.translate(-l,-u)),e.dirty(t)}s.union(c)}function nve(e){var t=e.items,n=t.length,r=0,i,a;let o={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;r1)for(C=0;C0&&(y[C]+=A/2);if(s&&Gj(n.center,IM)&&u!==1)for(C=0;C0&&(b[C]+=j/2);for(C=0;Ci&&(e.warn(`Grid headers exceed limit: `+i),t=t.slice(0,i)),h+=a,v=0,b=t.length;v=0&&(C=n[y])==null;y-=f);s?(w=p==null?C.x:Math.round(C.bounds.x1+p*C.bounds.width()),T=h):(w=h,T=p==null?C.y:Math.round(C.bounds.y1+p*C.bounds.height())),x.union(S.bounds.translate(w-(S.x||0),T-(S.y||0))),S.x=w,S.y=T,e.dirty(S),g=o(g,x[l])}return g}function Yj(e,t,n,r,i,a){if(t){e.dirty(t);var o=n,s=n;r?o=Math.round(i.x1+a*i.width()):s=Math.round(i.y1+a*i.height()),t.bounds.translate(o-(t.x||0),s-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=o,t.y=s,e.dirty(t)}}function cve(e,t){let n=e[t]||{};return(t,r)=>n[t]==null?e[t]==null?r:e[t]:n[t]}function lve(e,t){let n=-1/0;return e.forEach(e=>{e.offset!=null&&(n=Math.max(n,e.offset))}),n>-1/0?n:t}function uve(e,t,n,r,i,a,o){let s=cve(n,t),c=lve(e,s(`offset`,0)),l=s(`anchor`,sM),u=s(`frame`,fM),d=l===lM?1:l===cM?.5:0,f=u===pM?r.x1+d*r.width():d*(a||i.width()+2*i.x1),p=u===pM?i.y1+d*i.height():d*(o||r.height()+2*r.y1),m={align:NM,bounds:s(`bounds`,PM),columns:s(`direction`)===`vertical`?1:e.length,padding:s(`margin`,8),center:s(`center`),nodirty:!0};switch(t){case eM:m.anchor={x:Math.floor(r.x1)-c,column:lM,y:p,row:l};break;case tM:m.anchor={x:Math.ceil(r.x2)+c,y:p,row:l};break;case $j:m.anchor={y:Math.floor(i.y1)-c,row:lM,x:f,column:l};break;case nM:m.anchor={y:Math.ceil(i.y2)+c,x:f,column:l};break;case rM:m.anchor={x:c,y:c};break;case iM:m.anchor={x:a-c,y:c,column:lM};break;case aM:m.anchor={x:c,y:o-c,row:lM};break;case oM:m.anchor={x:a-c,y:o-c,column:lM,row:lM};break}return m}function dve(e,t){var n=t.items[0],r=n.datum,i=n.orient,a=n.bounds,o=n.x,s=n.y,c,l;return n._bounds?n._bounds.clear().union(a):n._bounds=a.clone(),a.clear(),pve(e,n,n.items[0].items[0]),a=fve(n,a),c=2*n.padding,l=2*n.padding,a.empty()||(c=Math.ceil(a.width()+c),l=Math.ceil(a.height()+l)),r.type===EM&&mve(n.items[0].items[0].items[0].items),i!==jM&&(n.x=o=0,n.y=s=0),n.width=c,n.height=l,PO(a.set(o,s,o+c,s+l),n),n.mark.bounds.clear().union(a),n}function fve(e,t){return e.items.forEach(e=>t.union(e.bounds)),t.empty()&&(t.x2=e.padding,t.y2=e.padding),t.x1=e.padding,t.y1=e.padding,t}function pve(e,t,n){var r=t.padding,i=r-n.x,a=r-n.y;if(!t.datum.title)(i||a)&&Zj(e,n,i,a);else{var o=t.items[1].items[0],s=o.anchor,c=t.titlePadding||0,l=r-o.x,u=r-o.y;switch(o.orient){case eM:i+=Math.ceil(o.bounds.width())+c;break;case tM:case nM:break;default:a+=o.bounds.height()+c}switch((i||a)&&Zj(e,n,i,a),o.orient){case eM:u+=Xj(t,n,o,s,1,1);break;case tM:l+=Xj(t,n,o,lM,0,0)+c,u+=Xj(t,n,o,s,1,1);break;case nM:l+=Xj(t,n,o,s,0,0),u+=Xj(t,n,o,lM,-1,0,1)+c;break;default:l+=Xj(t,n,o,s,0,0)}(l||u)&&Zj(e,o,l,u),(l=Math.round(o.bounds.x1-r))<0&&(Zj(e,n,-l,0),Zj(e,o,-l,0))}}function Xj(e,t,n,r,i,a,o){let s=e.datum.type!==`symbol`,c=n.datum.vgrad,l=(s&&(a||!c)&&!o?t.items[0]:t).bounds[i?`y2`:`x2`]-e.padding,u=c&&a?l:0,d=c&&a?0:l,f=i<=0?0:fk(n);return Math.round(r===sM?u:r===lM?d-f:.5*(l-f))}function Zj(e,t,n,r){t.x+=n,t.y+=r,t.bounds.translate(n,r),t.mark.bounds.translate(n,r),e.dirty(t)}function mve(e){let t=e.reduce((e,t)=>(e[t.column]=Math.max(t.bounds.x2-t.x,e[t.column]||0),e),{});e.forEach(e=>{e.width=t[e.column],e.height=e.bounds.y2-e.y})}function hve(e,t,n,r,i){var a=t.items[0],o=a.frame,s=a.orient,c=a.anchor,l=a.offset,u=a.padding,d=a.items[0].items[0],f=a.items[1]&&a.items[1].items[0],p=s===eM||s===tM?r:n,m=0,h=0,g=0,_=0,v=0,y;if(o===fM?s===eM&&(m=r,p=0):s===eM?(m=i.y2,p=i.y1):s===tM?(m=i.y1,p=i.y2):(m=i.x1,p=i.x2),y=c===sM?m:c===lM?p:(m+p)/2,f&&f.text){switch(s){case $j:case nM:v=d.bounds.height()+u;break;case eM:_=d.bounds.width()+u;break;case tM:_=-d.bounds.width()-u;break}GM.clear().union(f.bounds),GM.translate(_-(f.x||0),v-(f.y||0)),Uj(f,`x`,_)|Uj(f,`y`,v)&&(e.dirty(f),f.bounds.clear().union(GM),f.mark.bounds.clear().union(GM),e.dirty(f)),GM.clear().union(f.bounds)}else GM.clear();switch(GM.union(d.bounds),s){case $j:h=y,g=i.y1-GM.height()-l;break;case eM:h=i.x1-GM.width()-l,g=y;break;case tM:h=i.x2+GM.width()+l,g=y;break;case nM:h=y,g=i.y2+l;break;default:h=a.x,g=a.y}return Uj(a,`x`,h)|Uj(a,`y`,g)&&(GM.translate(h,g),e.dirty(a),a.bounds.clear().union(GM),t.bounds.clear().union(GM),e.dirty(a)),a.bounds}function Qj(e){K.call(this,null,e)}function gve(e){return e&&e.mark.role!==`legend-entry`}function _ve(e,t,n){var r=t.items,i=Math.max(0,t.width||0),a=Math.max(0,t.height||0),o=new AO().set(0,0,i,a),s=o.clone(),c=o.clone(),l=[],u,d,f,p,m,h;for(m=0,h=r.length;m{f=e.orient||tM,f!==jM&&(t[f]||(t[f]=[])).push(e)});for(let r in t){let o=t[r];qj(e,o,uve(o,r,n.legends,s,c,i,a))}l.forEach(t=>{let r=t.bounds;if(r.equals(t._bounds)||(t.bounds=t._bounds,e.dirty(t),t.bounds=r,e.dirty(t)),n.autosize&&(n.autosize.type===DM||n.autosize.type===OM||n.autosize.type===kM))switch(t.orient){case eM:case tM:o.add(r.x1,0).add(r.x2,0);break;case $j:case nM:o.add(0,r.y1).add(0,r.y2)}else o.union(r)})}o.union(s).union(c),u&&o.union(hve(e,u,i,a,o)),t.clip&&o.set(0,0,t.width||0,t.height||0),vve(e,t,o,n)}function vve(e,t,n,r){let i=r.autosize||{},a=i.type;if(e._autosize<1||!a)return;let o=e._width,s=e._height,c=Math.max(0,t.width||0),l=Math.max(0,Math.ceil(-n.x1)),u=Math.max(0,t.height||0),d=Math.max(0,Math.ceil(-n.y1)),f=Math.max(0,Math.ceil(n.x2-c)),p=Math.max(0,Math.ceil(n.y2-u));if(i.contains===TM){let t=e.padding();o-=t.left+t.right,s-=t.top+t.bottom}a===jM?(l=0,d=0,c=o,u=s):a===DM?(c=Math.max(0,o-l-f),u=Math.max(0,s-d-p)):a===OM?(c=Math.max(0,o-l-f),s=u+d+p):a===kM?(o=c+l+f,u=Math.max(0,s-d-p)):a===AM&&(o=c+l+f,s=u+d+p),e._resizeView(o,s,c,u,[l,d],i.resize)}var $j,eM,tM,nM,rM,iM,aM,oM,sM,cM,lM,uM,dM,fM,pM,mM,hM,gM,_M,vM,yM,bM,xM,SM,CM,wM,TM,EM,DM,OM,kM,AM,jM,MM,NM,PM,FM,IM,LM,RM,zM,BM,VM,HM,UM,WM,GM,KM,qM,yve=o((()=>{eS(),Ij(),Dg(),$j=`top`,eM=`left`,tM=`right`,nM=`bottom`,rM=`top-left`,iM=`top-right`,aM=`bottom-left`,oM=`bottom-right`,sM=`start`,cM=`middle`,lM=`end`,uM=`x`,dM=`y`,fM=`group`,pM=`bounds`,mM=`axis`,hM=`title`,gM=`frame`,_M=`scope`,vM=`legend`,yM=`row-header`,bM=`row-footer`,xM=`row-title`,SM=`column-header`,CM=`column-footer`,wM=`column-title`,TM=`padding`,EM=`symbol`,DM=`fit`,OM=`fit-x`,kM=`fit-y`,AM=`pad`,jM=`none`,MM=`all`,NM=`each`,PM=`flush`,FM=`column`,IM=`row`,fg(Lj,K,{transform(e,t){let n=t.dataflow,r=e.mark,i=r.marktype,a=xA[i],o=a.bound,s=r.bounds,c;if(a.nested)r.items.length&&n.dirty(r.items[0]),s=Rj(r,o),r.items.forEach(e=>{e.bounds.clear().union(s)});else if(i===fM||e.modified())switch(t.visit(t.MOD,e=>n.dirty(e)),s.clear(),r.items.forEach(e=>s.union(Rj(e,o))),r.role){case mM:case vM:case hM:t.reflow()}else c=t.changed(t.REM),t.visit(t.ADD,e=>{s.union(Rj(e,o))}),t.visit(t.MOD,e=>{c||=s.alignsWith(e.bounds),n.dirty(e),s.union(Rj(e,o))}),c&&(s.clear(),r.items.forEach(e=>s.union(e.bounds)));return qge(r),t.modifies(`bounds`)}}),LM=`:vega_identifier:`,zj.Definition={type:`Identifier`,metadata:{modifies:!0},params:[{name:`as`,type:`string`,required:!0}]},fg(zj,K,{transform(e,t){let n=Z_e(t.dataflow),r=e.as,i=n.value;return t.visit(t.ADD,e=>e[r]=e[r]||++i),n.set(this.value=i),t}}),fg(Bj,K,{transform(e,t){let n=this.value;n||(n=t.dataflow.scenegraph().mark(e.markdef,Q_e(e),e.index),n.group.context=e.context,e.context.group||(e.context.group=n.group),n.source=this.source,n.clip=e.clip,n.interactive=e.interactive,this.value=n);let r=n.marktype===fM?MO:jO;return t.visit(t.ADD,e=>r.call(e,n)),(e.modified(`clip`)||e.modified(`interactive`))&&(n.clip=e.clip,n.interactive=!!e.interactive,n.zdirty=!0,t.reflow()),n.items=t.source,t}}),RM={parity:e=>e.filter((e,t)=>t%2?e.opacity=0:1),greedy:(e,t)=>{let n;return e.filter((e,r)=>!r||!zM(n.bounds,e.bounds,t)?(n=e,1):e.opacity=0)}},zM=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),BM=(e,t)=>{for(var n=1,r=e.length,i=e[0].bounds,a;n{let t=e.bounds;return t.width()>1&&t.height()>1},HM=(e,t,n)=>{var r=e.range(),i=new AO;return t===$j||t===nM?i.set(r[0],-1/0,r[1],1/0):i.set(-1/0,r[0],1/0,r[1]),i.expand(n||1),e=>i.encloses(e.bounds)},UM=e=>(e.forEach(e=>e.opacity=1),e),WM=(e,t)=>e.reflow(t.modified()).modifies(`opacity`),fg(Vj,K,{transform(e,t){let n=RM[e.method]||RM.parity,r=e.separation||0,i=t.materialize(t.SOURCE).source,a,o;if(!i||!i.length)return;if(!e.method)return e.modified(`method`)&&(UM(i),t=WM(t,e)),t;if(i=i.filter(VM),!i.length)return;if(e.sort&&(i=i.slice().sort(e.sort)),a=UM(i),t=WM(t,e),a.length>=3&&BM(a,r)){do a=n(a,r);while(a.length>=3&&BM(a,r));a.length<3&&!Ih(i).opacity&&(a.length>1&&(Ih(a).opacity=0),Ih(i).opacity=1)}e.boundScale&&e.boundTolerance>=0&&(o=HM(e.boundScale,e.boundOrient,+e.boundTolerance),i.forEach(e=>{o(e)||(e.opacity=0)}));let s=a[0].mark.bounds.clear();return i.forEach(e=>{e.opacity&&s.union(e.bounds)}),t}}),fg(Hj,K,{transform(e,t){let n=t.dataflow;if(t.visit(t.ALL,e=>n.dirty(e)),t.fields&&t.fields.zindex){let e=t.source&&t.source[0];e&&(e.mark.zdirty=!0)}}}),GM=new AO,KM=(e,t)=>Math.floor(Math.min(e,t)),qM=(e,t)=>Math.ceil(Math.max(e,t)),fg(Qj,K,{transform(e,t){let n=t.dataflow;return e.mark.items.forEach(t=>{e.layout&&ave(n,t,e.layout),_ve(n,t,e)}),gve(e.mark.group)?t.reflow():t}})})),bve=c({axisticks:()=>JM,datajoin:()=>YM,encode:()=>XM,legendentries:()=>ZM,linkpath:()=>QM,pie:()=>$M,scale:()=>tN,sortitems:()=>aN,stack:()=>oN});function JM(e){K.call(this,null,e)}function YM(e){K.call(this,null,e)}function xve(){return cx({})}function Sve(e){let t=ug().test(e=>e.exit);return t.lookup=n=>t.get(e(n)),t}function XM(e){K.call(this,null,e)}function ZM(e){K.call(this,[],e)}function QM(e){K.call(this,{},e)}function $M(e){K.call(this,null,e)}function Cve(e){let t=e.type;return!e.bins&&(t===`linear`||t===`pow`||t===`sqrt`)}function eN(e){return UD(e)&&e!==`sequential`}function tN(e){K.call(this,null,e),this.modified(!0)}function wve(e){var t=e.type,n=``,r;return t===`sequential`?tO+`-`+QD:(Tve(e)&&(r=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(e.domainMid!=null):0,n=r===2?tO+`-`:r===3?nO+`-`:``),(n+t||`linear`).toLowerCase())}function Tve(e){let t=e.type;return UD(t)&&t!==`time`&&t!==`utc`&&(e.scheme||e.range&&e.range.length&&e.range.every(vg))}function Eve(e,t,n){let r=Dve(e,t.domainRaw,n);if(r>-1)return r;var i=t.domain,a=e.type,o=t.zero||t.zero===void 0&&Cve(e),s,c;if(!i)return 0;if((o||t.domainMin!=null||t.domainMax!=null||t.domainMid!=null)&&(s=(i=i.slice()).length-1||1,o&&(i[0]>0&&(i[0]=0),i[s]<0&&(i[s]=0)),t.domainMin!=null&&(i[0]=t.domainMin),t.domainMax!=null&&(i[s]=t.domainMax),t.domainMid!=null)){c=t.domainMid;let e=c>i[s]?s+1:ce+(t<0?-1:+(t>0)),0))!==t.length&&n.warn(`Log scale domain includes zero: `+G(t)),t}function kve(e,t,n){let r=t.bins;if(r&&!W(r)){let t=e.domain(),n=t[0],i=Ih(t),a=r.step,o=r.start==null?n:r.start,s=r.stop==null?i:r.stop;a||U(`Scale bins parameter missing step property.`),oi&&(s=a*Math.floor(i/a)),r=$g(o,s+a/2,a)}return r?e.bins=r:e.bins&&delete e.bins,e.type===`bin-ordinal`&&(r?!t.domain&&!t.domainRaw&&(e.domain(r),n=r.length):e.bins=e.domain()),n}function Ave(e,t,n){var r=e.type,i=t.round||!1,a=t.range;if(t.rangeStep!=null)a=jve(r,t,n);else if(t.scheme&&(a=Mve(r,t,n),eg(a))){if(e.interpolator)return e.interpolator(a);U(`Scale type ${r} does not support interpolating color schemes.`)}if(a&&Qpe(r))return e.interpolator(qD(iN(a,t.reverse),t.interpolate,t.interpolateGamma));a&&t.interpolate&&e.interpolate?e.interpolate(JD(t.interpolate,t.interpolateGamma)):eg(e.round)?e.round(i):eg(e.rangeRound)&&e.interpolate(i?sD:aD),a&&e.range(iN(a,t.reverse))}function jve(e,t,n){e!==`band`&&e!==`point`&&U(`Only band and point scales support rangeStep.`);var r=(t.paddingOuter==null?t.padding:t.paddingOuter)||0,i=e===`point`?1:(t.paddingInner==null?t.padding:t.paddingInner)||0;return[0,t.rangeStep*zD(n,i,r)]}function Mve(e,t,n){var r=t.schemeExtent,i,a;return W(t.scheme)?a=qD(t.scheme,t.interpolate,t.interpolateGamma):(i=t.scheme.toLowerCase(),a=YD(i),a||U(`Unrecognized scheme name: ${t.scheme}`)),n=e===`threshold`?n+1:e===`bin-ordinal`?n-1:e===`quantile`||e===`quantize`?+t.schemeCount||wN:n,Qpe(e)?rN(a,r,t.reverse):eg(a)?tme(rN(a,r),n):e===`ordinal`?a:a.slice(0,n)}function rN(e,t,n){return eg(e)&&(t||n)?eme(e,iN(t||[0,1],n)):e}function iN(e,t){return t?e.slice().reverse():e}function aN(e){K.call(this,null,e)}function oN(e){K.call(this,null,e)}function Nve(e,t,n,r,i){for(var a=(t-e.sum)/2,o=e.length,s=0,c;se(u),o,s,c,l,u,d,f,p,m;if(t==null)i.push(e.slice());else for(o={},s=0,c=e.length;sm&&(m=p),n&&f.sort(n)}return i.max=m,i}var sN,cN,lN,uN,dN,fN,pN,mN,hN,gN,_N,vN,yN,bN,xN,SN,CN,wN,TN,EN,DN,ON,kN,Lve=o((()=>{eS(),vO(),Dg(),e_(),fD(),fg(JM,K,{transform(e,t){if(this.value&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=this.value,a=e.scale,o=XD(a,e.count==null?e.values?e.values.length:10:e.count,e.minstep),s=e.format||sme(n,a,o,e.formatSpecifier,e.formatType,!!e.values),c=e.values?ome(a,e.values,o):ZD(a,o);return i&&(r.rem=i),i=c.map((e,t)=>cx({index:t/(c.length-1||1),tickIndex:t,value:e,label:s(e)})),e.extra&&i.length&&i.push(cx({index:-1,tickIndex:-1,extra:{value:i[0].value},label:``})),r.source=i,r.add=i,this.value=i,r}}),fg(YM,K,{transform(e,t){var n=t.dataflow,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.item||xve,a=e.key||ox,o=this.value;return W(r.encode)&&(r.encode=null),o&&(e.modified(`key`)||t.modified(a))&&U(`DataJoin does not support modified key function or fields.`),o||(t=t.addAll(),this.value=o=Sve(a)),t.visit(t.ADD,e=>{let t=a(e),n=o.get(t);n?n.exit?(o.empty--,r.add.push(n)):r.mod.push(n):(n=i(e),o.set(t,n),r.add.push(n)),n.datum=e,n.exit=!1}),t.visit(t.MOD,e=>{let t=a(e),n=o.get(t);n&&(n.datum=e,r.mod.push(n))}),t.visit(t.REM,e=>{let t=a(e),n=o.get(t);e===n.datum&&!n.exit&&(r.rem.push(n),n.exit=!0,++o.empty)}),t.changed(t.ADD_MOD)&&r.modifies(`datum`),(t.clean()||e.clean&&o.empty>n.cleanThreshold)&&n.runAfter(o.clean),r}}),fg(XM,K,{transform(e,t){var n=t.fork(t.ADD_REM),r=e.mod||!1,i=e.encoders,a=t.encode;if(W(a))if(n.changed()||a.every(e=>i[e]))a=a[0],n.encode=null;else return t.StopPropagation;var o=a===`enter`,s=i.update||Dh,c=i.enter||Dh,l=i.exit||Dh,u=(a&&!o?i[a]:s)||Dh;if(t.changed(t.ADD)&&(t.visit(t.ADD,t=>{c(t,e),s(t,e)}),n.modifies(c.output),n.modifies(s.output),u!==Dh&&u!==s&&(t.visit(t.ADD,t=>{u(t,e)}),n.modifies(u.output))),t.changed(t.REM)&&l!==Dh&&(t.visit(t.REM,t=>{l(t,e)}),n.modifies(l.output)),o||u!==Dh){let i=t.MOD|(e.modified()?t.REFLOW:0);o?(t.visit(i,t=>{let i=c(t,e)||r;(u(t,e)||i)&&n.mod.push(t)}),n.mod.length&&n.modifies(c.output)):t.visit(i,t=>{(u(t,e)||r)&&n.mod.push(t)}),n.mod.length&&n.modifies(u.output)}return n.changed()?n:t.StopPropagation}}),fg(ZM,K,{transform(e,t){if(this.value!=null&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=this.value,a=e.type||`symbol`,o=e.scale,s=+e.limit,c=XD(o,e.count==null?5:e.count,e.minstep),l=!!e.values||a===`symbol`,u=e.format||pme(n,o,c,a,e.formatSpecifier,e.formatType,l),d=e.values||lme(o,c),f,p,m,h,g;return i&&(r.rem=i),a===`symbol`?(s&&d.length>s?(t.dataflow.warn(`Symbol legend count exceeds limit, filtering items.`),i=d.slice(0,s-1),g=!0):i=d,eg(m=e.size)?(!e.values&&o(i[0])===0&&(i=i.slice(1)),h=i.reduce((t,n)=>Math.max(t,m(n,e)),0)):m=ig(h=m||8),i=i.map((t,n)=>cx({index:n,label:u(t,n,i),value:t,offset:h,size:m(t,e)})),g&&(g=d[i.length],i.push(cx({index:i.length,label:`\u2026${d.length-i.length} entries`,value:g,offset:h,size:m(g,e)})))):a===`gradient`?(f=o.domain(),p=nme(o,f[0],Ih(f)),d.length<3&&!e.values&&f[0]!==Ih(f)&&(d=[f[0],Ih(f)]),i=d.map((e,t)=>cx({index:t,label:u(e,t,d),value:e,perc:p(e)}))):(m=d.length-1,p=mme(o),i=d.map((e,t)=>cx({index:t,label:u(e,t,d),value:e,perc:t?p(e):0,perc2:t===m?1:p(d[t+1])}))),r.source=i,r.add=i,this.value=i,r}}),sN=e=>e.source.x,cN=e=>e.source.y,lN=e=>e.target.x,uN=e=>e.target.y,QM.Definition={type:`LinkPath`,metadata:{modifies:!0},params:[{name:`sourceX`,type:`field`,default:`source.x`},{name:`sourceY`,type:`field`,default:`source.y`},{name:`targetX`,type:`field`,default:`target.x`},{name:`targetY`,type:`field`,default:`target.y`},{name:`orient`,type:`enum`,default:`vertical`,values:[`horizontal`,`vertical`,`radial`]},{name:`shape`,type:`enum`,default:`line`,values:[`line`,`arc`,`curve`,`diagonal`,`orthogonal`]},{name:`require`,type:`signal`},{name:`as`,type:`string`,default:`path`}]},fg(QM,K,{transform(e,t){var n=e.sourceX||sN,r=e.sourceY||cN,i=e.targetX||lN,a=e.targetY||uN,o=e.as||`path`,s=e.orient||`vertical`,c=e.shape||`line`,l=CN.get(c+`-`+s)||CN.get(c);return l||U(`LinkPath unsupported type: `+e.shape+(e.orient?`-`+e.orient:``)),t.visit(t.SOURCE,e=>{e[o]=l(n(e),r(e),i(e),a(e))}),t.reflow(e.modified()).modifies(o)}}),dN=(e,t,n,r)=>`M`+e+`,`+t+`L`+n+`,`+r,fN=(e,t,n,r)=>dN(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),pN=(e,t,n,r)=>{var i=n-e,a=r-t,o=Math.hypot(i,a)/2,s=180*Math.atan2(a,i)/Math.PI;return`M`+e+`,`+t+`A`+o+`,`+o+` `+s+` 0 1 `+n+`,`+r},mN=(e,t,n,r)=>pN(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),hN=(e,t,n,r)=>{let i=n-e,a=r-t,o=.2*(i+a),s=.2*(a-i);return`M`+e+`,`+t+`C`+(e+o)+`,`+(t+s)+` `+(n+s)+`,`+(r-o)+` `+n+`,`+r},gN=(e,t,n,r)=>hN(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),_N=(e,t,n,r)=>`M`+e+`,`+t+`V`+r+`H`+n,vN=(e,t,n,r)=>`M`+e+`,`+t+`H`+n+`V`+r,yN=(e,t,n,r)=>{let i=Math.cos(e),a=Math.sin(e),o=Math.cos(n),s=Math.sin(n),c=Math.abs(n-e)>Math.PI?n<=e:n>e;return`M`+t*i+`,`+t*a+`A`+t+`,`+t+` 0 0,`+ +!!c+` `+t*o+`,`+t*s+`L`+r*o+`,`+r*s},bN=(e,t,n,r)=>{let i=(e+n)/2;return`M`+e+`,`+t+`C`+i+`,`+t+` `+i+`,`+r+` `+n+`,`+r},xN=(e,t,n,r)=>{let i=(t+r)/2;return`M`+e+`,`+t+`C`+e+`,`+i+` `+n+`,`+i+` `+n+`,`+r},SN=(e,t,n,r)=>{let i=Math.cos(e),a=Math.sin(e),o=Math.cos(n),s=Math.sin(n),c=(t+r)/2;return`M`+t*i+`,`+t*a+`C`+c*i+`,`+c*a+` `+c*o+`,`+c*s+` `+r*o+`,`+r*s},CN=ug({line:dN,"line-radial":fN,arc:pN,"arc-radial":mN,curve:hN,"curve-radial":gN,"orthogonal-horizontal":_N,"orthogonal-vertical":vN,"orthogonal-radial":yN,"diagonal-horizontal":bN,"diagonal-vertical":xN,"diagonal-radial":SN}),$M.Definition={type:`Pie`,metadata:{modifies:!0},params:[{name:`field`,type:`field`},{name:`startAngle`,type:`number`,default:0},{name:`endAngle`,type:`number`,default:6.283185307179586},{name:`sort`,type:`boolean`,default:!1},{name:`as`,type:`string`,array:!0,length:2,default:[`startAngle`,`endAngle`]}]},fg($M,K,{transform(e,t){var n=e.as||[`startAngle`,`endAngle`],r=n[0],i=n[1],a=e.field||Th,o=e.startAngle||0,s=e.endAngle==null?2*Math.PI:e.endAngle,c=t.source,l=c.map(a),u=l.length,d=o,f=(s-o)/gse(l),p=$g(u),m,h,g;for(e.sort&&p.sort((e,t)=>l[e]-l[t]),m=0;m1?0:e<-1?NN:Math.acos(e)}function jN(e){return e>1?PN:e<-1?-PN:Math.asin(e)}var MN,NN,PN,FN,IN,LN,RN,zN,BN,VN,HN,UN,WN,GN,KN,qN,JN,YN,XN,ZN,QN=o((()=>{MN=1e-6,NN=Math.PI,PN=NN/2,FN=NN/4,IN=NN*2,LN=180/NN,RN=NN/180,zN=Math.abs,BN=Math.atan,VN=Math.atan2,HN=Math.cos,UN=Math.ceil,WN=Math.exp,GN=Math.hypot,KN=Math.log,qN=Math.pow,JN=Math.sin,YN=Math.sign||function(e){return e>0?1:e<0?-1:0},XN=Math.sqrt,ZN=Math.tan}));function $N(){}var eP=o((()=>{}));function tP(e,t){e&&oP.hasOwnProperty(e.type)&&oP[e.type](e,t)}function nP(e,t,n){var r=-1,i=e.length-n,a;for(t.lineStart();++r{aP={Feature:function(e,t){tP(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r=0?1:-1,i=r*n,a=HN(t),o=JN(t),s=hP*o,c=mP*a+s*HN(i),l=s*r*JN(i);lP.add(VN(l,c)),pP=e,mP=a,hP=o}function Vve(e){return uP=new Bg,iP(e,gP),uP*2}var lP,uP,dP,fP,pP,mP,hP,gP,_P=o((()=>{e_(),QN(),eP(),sP(),lP=new Bg,uP=new Bg,gP={point:$N,lineStart:$N,lineEnd:$N,polygonStart:function(){lP=new Bg,gP.lineStart=Rve,gP.lineEnd=zve},polygonEnd:function(){var e=+lP;uP.add(e<0?IN+e:e),this.lineStart=this.lineEnd=this.point=$N},sphere:function(){uP.add(IN)}}}));function vP(e){return[VN(e[1],e[0]),jN(e[2])]}function yP(e){var t=e[0],n=e[1],r=HN(n);return[r*HN(t),r*JN(t),JN(n)]}function bP(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function xP(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function SP(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function CP(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function wP(e){var t=XN(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var TP=o((()=>{QN()}));function EP(e,t){HP.push(UP=[NP=e,FP=e]),tIP&&(IP=t)}function DP(e,t){var n=yP([e*RN,t*RN]);if(BP){var r=xP(BP,n),i=xP([r[1],-r[0],0],r);wP(i),i=vP(i);var a=e-LP,o=a>0?1:-1,s=i[0]*LN*o,c,l=zN(a)>180;l^(o*LPIP&&(IP=c)):(s=(s+360)%360-180,l^(o*LPIP&&(IP=t))),l?ejP(NP,FP)&&(FP=e):jP(e,FP)>jP(NP,FP)&&(NP=e):FP>=NP?(eFP&&(FP=e)):e>LP?jP(NP,e)>jP(NP,FP)&&(FP=e):jP(e,FP)>jP(NP,FP)&&(NP=e)}else HP.push(UP=[NP=e,FP=e]);tIP&&(IP=t),BP=n,LP=e}function OP(){WP.point=DP}function kP(){UP[0]=NP,UP[1]=FP,WP.point=EP,BP=null}function AP(e,t){if(BP){var n=e-LP;VP.add(zN(n)>180?n+(n>0?360:-360):n)}else RP=e,zP=t;gP.point(e,t),DP(e,t)}function Hve(){gP.lineStart()}function Uve(){AP(RP,zP),gP.lineEnd(),zN(VP)>1e-6&&(NP=-(FP=180)),UP[0]=NP,UP[1]=FP,BP=null}function jP(e,t){return(t-=e)<0?t+360:t}function Wve(e,t){return e[0]-t[0]}function MP(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tjP(r[0],r[1])&&(r[1]=i[1]),jP(i[0],r[1])>jP(r[0],r[1])&&(r[0]=i[0])):a.push(r=i);for(o=-1/0,n=a.length-1,t=0,r=a[n];t<=n;r=i,++t)i=a[t],(s=jP(r[1],i[0]))>o&&(o=s,NP=i[0],FP=r[1])}return HP=UP=null,NP===1/0||PP===1/0?[[NaN,NaN],[NaN,NaN]]:[[NP,PP],[FP,IP]]}var NP,PP,FP,IP,LP,RP,zP,BP,VP,HP,UP,WP,Kve=o((()=>{e_(),_P(),TP(),QN(),sP(),WP={point:EP,lineStart:OP,lineEnd:kP,polygonStart:function(){WP.point=AP,WP.lineStart=Hve,WP.lineEnd=Uve,VP=new Bg,gP.polygonStart()},polygonEnd:function(){gP.polygonEnd(),WP.point=EP,WP.lineStart=OP,WP.lineEnd=kP,lP<0?(NP=-(FP=180),PP=-(IP=90)):VP>1e-6?IP=90:VP<-1e-6&&(PP=-90),UP[0]=NP,UP[1]=FP},sphere:function(){NP=-(FP=180),PP=-(IP=90)}}}));function GP(e,t){e*=RN,t*=RN;var n=HN(t);KP(n*HN(e),n*JN(e),JN(t))}function KP(e,t,n){++XP,QP+=(e-QP)/XP,$P+=(t-$P)/XP,eF+=(n-eF)/XP}function qP(){fF.point=qve}function qve(e,t){e*=RN,t*=RN;var n=HN(t);lF=n*HN(e),uF=n*JN(e),dF=JN(t),fF.point=Jve,KP(lF,uF,dF)}function Jve(e,t){e*=RN,t*=RN;var n=HN(t),r=n*HN(e),i=n*JN(e),a=JN(t),o=VN(XN((o=uF*a-dF*i)*o+(o=dF*r-lF*a)*o+(o=lF*i-uF*r)*o),lF*r+uF*i+dF*a);ZP+=o,tF+=o*(lF+(lF=r)),nF+=o*(uF+(uF=i)),rF+=o*(dF+(dF=a)),KP(lF,uF,dF)}function JP(){fF.point=GP}function Yve(){fF.point=Zve}function Xve(){YP(sF,cF),fF.point=GP}function Zve(e,t){sF=e,cF=t,e*=RN,t*=RN,fF.point=YP;var n=HN(t);lF=n*HN(e),uF=n*JN(e),dF=JN(t),KP(lF,uF,dF)}function YP(e,t){e*=RN,t*=RN;var n=HN(t),r=n*HN(e),i=n*JN(e),a=JN(t),o=uF*a-dF*i,s=dF*r-lF*a,c=lF*i-uF*r,l=GN(o,s,c),u=jN(l),d=l&&-u/l;iF.add(d*o),aF.add(d*s),oF.add(d*c),ZP+=u,tF+=u*(lF+(lF=r)),nF+=u*(uF+(uF=i)),rF+=u*(dF+(dF=a)),KP(lF,uF,dF)}function Qve(e){XP=ZP=QP=$P=eF=tF=nF=rF=0,iF=new Bg,aF=new Bg,oF=new Bg,iP(e,fF);var t=+iF,n=+aF,r=+oF,i=GN(t,n,r);return i<1e-12&&(t=tF,n=nF,r=rF,ZP<1e-6&&(t=QP,n=$P,r=eF),i=GN(t,n,r),i<1e-12)?[NaN,NaN]:[VN(n,t)*LN,jN(r/i)*LN]}var XP,ZP,QP,$P,eF,tF,nF,rF,iF,aF,oF,sF,cF,lF,uF,dF,fF,$ve=o((()=>{e_(),QN(),eP(),sP(),fF={sphere:$N,point:GP,lineStart:qP,lineEnd:JP,polygonStart:function(){fF.lineStart=Yve,fF.lineEnd=Xve},polygonEnd:function(){fF.lineStart=qP,fF.lineEnd=JP}}}));function pF(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,r){return n=t.invert(n,r),n&&e.invert(n[0],n[1])}),n}var mF=o((()=>{}));function hF(e,t){return zN(e)>NN&&(e-=Math.round(e/IN)*IN),[e,t]}function gF(e,t,n){return(e%=IN)?t||n?pF(vF(e),yF(t,n)):vF(e):t||n?yF(t,n):hF}function _F(e){return function(t,n){return t+=e,zN(t)>NN&&(t-=Math.round(t/IN)*IN),[t,n]}}function vF(e){var t=_F(e);return t.invert=_F(-e),t}function yF(e,t){var n=HN(e),r=JN(e),i=HN(t),a=JN(t);function o(e,t){var o=HN(t),s=HN(e)*o,c=JN(e)*o,l=JN(t),u=l*n+s*r;return[VN(c*i-u*a,s*n-l*r),jN(u*i+c*a)]}return o.invert=function(e,t){var o=HN(t),s=HN(e)*o,c=JN(e)*o,l=JN(t),u=l*i-c*a;return[VN(c*i+l*a,s*n+u*r),jN(u*n-s*r)]},o}function eye(e){e=gF(e[0]*RN,e[1]*RN,e.length>2?e[2]*RN:0);function t(t){return t=e(t[0]*RN,t[1]*RN),t[0]*=LN,t[1]*=LN,t}return t.invert=function(t){return t=e.invert(t[0]*RN,t[1]*RN),t[0]*=LN,t[1]*=LN,t},t}var bF=o((()=>{mF(),QN(),hF.invert=hF}));function tye(e,t,n,r,i,a){if(n){var o=HN(t),s=JN(t),c=r*n;i==null?(i=t+r*IN,a=t-c/2):(i=xF(o,i),a=xF(o,a),(r>0?ia)&&(i+=r*IN));for(var l,u=i;r>0?u>a:u{TP(),QN()}));function CF(){var e=[],t;return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:$N,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}var wF=o((()=>{eP()}));function TF(e,t){return zN(e[0]-t[0])<1e-6&&zN(e[1]-t[1])<1e-6}var EF=o((()=>{QN()}));function DF(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function OF(e,t,n,r,i){var a=[],o=[],s,c;if(e.forEach(function(e){if(!((t=e.length-1)<=0)){var t,n=e[0],r=e[t],c;if(TF(n,r)){if(!n[2]&&!r[2]){for(i.lineStart(),s=0;s=0;--s)i.point((d=u[s])[0],d[1]);else r(f.x,f.p.x,-1,i);f=f.p}f=f.o,u=f.z,p=!p}while(!f.v);i.lineEnd()}}}function kF(e){if(t=e.length){for(var t,n=0,r=e[0],i;++n{EF(),QN()}));function jF(e){return zN(e[0])<=NN?e[0]:YN(e[0])*((zN(e[0])+NN)%IN-NN)}function nye(e,t){var n=jF(t),r=t[1],i=JN(r),a=[JN(n),-HN(n),0],o=0,s=0,c=new Bg;i===1?r=PN+MN:i===-1&&(r=-PN-MN);for(var l=0,u=e.length;l=0?1:-1,E=T*w,D=E>NN,O=g*S;if(c.add(VN(O*T*JN(E),_*C+O*HN(E))),o+=D?w+T*IN:w,D^m>=n^b>=n){var k=xP(yP(p),yP(y));wP(k);var A=xP(a,k);wP(A);var j=(D^w>=0?-1:1)*jN(A[2]);(r>j||r===j&&(k[0]||k[1]))&&(s+=D^w>=0?1:-1)}}return(o<-1e-6||o<1e-6&&c<-1e-12)^s&1}var MF=o((()=>{e_(),TP(),QN()}));function NF(e,t,n,r){return function(i){var a=t(i),o=CF(),s=t(o),c=!1,l,u,d,f={point:p,lineStart:h,lineEnd:g,polygonStart:function(){f.point=_,f.lineStart=v,f.lineEnd=y,u=[],l=[]},polygonEnd:function(){f.point=p,f.lineStart=h,f.lineEnd=g,u=pse(u);var e=nye(l,r);u.length?(c||=(i.polygonStart(),!0),OF(u,iye,e,n,i)):e&&(c||=(i.polygonStart(),!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),c&&=(i.polygonEnd(),!1),u=l=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function p(t,n){e(t,n)&&i.point(t,n)}function m(e,t){a.point(e,t)}function h(){f.point=m,a.lineStart()}function g(){f.point=p,a.lineEnd()}function _(e,t){d.push([e,t]),s.point(e,t)}function v(){s.lineStart(),d=[]}function y(){_(d[0][0],d[0][1]),s.lineEnd();var e=s.clean(),t=o.result(),n,r=t.length,a,f,p;if(d.pop(),l.push(d),d=null,r){if(e&1){if(f=t[0],(a=f.length-1)>0){for(c||=(i.polygonStart(),!0),i.lineStart(),n=0;n1&&e&2&&t.push(t.pop().concat(t.shift())),u.push(t.filter(rye))}}return f}}function rye(e){return e.length>1}function iye(e,t){return((e=e.x)[0]<0?e[1]-PN-MN:PN-e[1])-((t=t.x)[0]<0?t[1]-PN-MN:PN-t[1])}var PF=o((()=>{wF(),AF(),QN(),MF(),e_()}));function aye(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(a,o){var s=a>0?NN:-NN,c=zN(a-t);zN(c-NN)<1e-6?(e.point(t,n=(n+o)/2>0?PN:-PN),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(s,n),e.point(a,n),i=0):r!==s&&c>=NN&&(zN(t-r)<1e-6&&(t-=r*MN),zN(a-s)<1e-6&&(a-=s*MN),n=oye(t,n,a,o),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(s,n),i=0),e.point(t=a,n=o),r=s},lineEnd:function(){e.lineEnd(),t=n=NaN},clean:function(){return 2-i}}}function oye(e,t,n,r){var i,a,o=JN(e-n);return zN(o)>1e-6?BN((JN(t)*(a=HN(r))*JN(n)-JN(r)*(i=HN(t))*JN(e))/(i*a*o)):(t+r)/2}function sye(e,t,n,r){var i;if(e==null)i=n*PN,r.point(-NN,i),r.point(0,i),r.point(NN,i),r.point(NN,0),r.point(NN,-i),r.point(0,-i),r.point(-NN,-i),r.point(-NN,0),r.point(-NN,i);else if(zN(e[0]-t[0])>1e-6){var a=e[0]{PF(),QN(),FF=NF(function(){return!0},aye,sye,[-NN,-PN])}));function cye(e){var t=HN(e),n=2*RN,r=t>0,i=zN(t)>MN;function a(t,r,i,a){tye(a,e,n,i,t,r)}function o(e,n){return HN(e)*HN(n)>t}function s(e){var t,n,a,s,u;return{lineStart:function(){s=a=!1,u=1},point:function(d,f){var p=[d,f],m,h=o(d,f),g=r?h?0:l(d,f):h?l(d+(d<0?NN:-NN),f):0;if(!t&&(s=a=h)&&e.lineStart(),h!==a&&(m=c(t,p),(!m||TF(t,m)||TF(p,m))&&(p[2]=1)),h!==a)u=0,h?(e.lineStart(),m=c(p,t),e.point(m[0],m[1])):(m=c(t,p),e.point(m[0],m[1],2),e.lineEnd()),t=m;else if(i&&t&&r^h){var _;!(g&n)&&(_=c(p,t,!0))&&(u=0,r?(e.lineStart(),e.point(_[0][0],_[0][1]),e.point(_[1][0],_[1][1]),e.lineEnd()):(e.point(_[1][0],_[1][1]),e.lineEnd(),e.lineStart(),e.point(_[0][0],_[0][1],3)))}h&&(!t||!TF(t,p))&&e.point(p[0],p[1]),t=p,a=h,n=g},lineEnd:function(){a&&e.lineEnd(),t=null},clean:function(){return u|(s&&a)<<1}}}function c(e,n,r){var i=yP(e),a=yP(n),o=[1,0,0],s=xP(i,a),c=bP(s,s),l=s[0],u=c-l*l;if(!u)return!r&&e;var d=t*c/u,f=-t*l/u,p=xP(o,s),m=CP(o,d);SP(m,CP(s,f));var h=p,g=bP(m,h),_=bP(h,h),v=g*g-_*(bP(m,m)-1);if(!(v<0)){var y=XN(v),b=CP(h,(-g-y)/_);if(SP(b,m),b=vP(b),!r)return b;var x=e[0],S=n[0],C=e[1],w=n[1],T;S0^b[1]<(zN(b[0]-x)<1e-6?C:w):C<=b[1]&&b[1]<=w:E>NN^(x<=b[0]&&b[0]<=S)){var k=CP(h,(-g+y)/_);return SP(k,m),[b,vP(k)]}}}function l(t,n){var i=r?e:NN-e,a=0;return t<-i?a|=1:t>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}return NF(o,s,a,r?[0,-e]:[-NN,e-NN])}var LF=o((()=>{TP(),SF(),QN(),EF(),PF()}));function lye(e,t,n,r,i,a){var o=e[0],s=e[1],c=t[0],l=t[1],u=0,d=1,f=c-o,p=l-s,m=n-o;if(!(!f&&m>0)){if(m/=f,f<0){if(m0){if(m>d)return;m>u&&(u=m)}if(m=i-o,!(!f&&m<0)){if(m/=f,f<0){if(m>d)return;m>u&&(u=m)}else if(f>0){if(m0)){if(m/=p,p<0){if(m0){if(m>d)return;m>u&&(u=m)}if(m=a-s,!(!p&&m<0)){if(m/=p,p<0){if(m>d)return;m>u&&(u=m)}else if(p>0){if(m0&&(e[0]=o+u*f,e[1]=s+u*p),d<1&&(t[0]=o+d*f,t[1]=s+d*p),!0}}}}}var uye=o((()=>{}));function RF(e,t,n,r){function i(i,a){return e<=i&&i<=n&&t<=a&&a<=r}function a(i,a,s,l){var u=0,d=0;if(i==null||(u=o(i,s))!==(d=o(a,s))||c(i,a)<0^s>0)do l.point(u===0||u===3?e:n,u>1?r:t);while((u=(u+s+4)%4)!==d);else l.point(a[0],a[1])}function o(r,i){return zN(r[0]-e)<1e-6?i>0?0:3:zN(r[0]-n)<1e-6?i>0?2:1:zN(r[1]-t)<1e-6?+(i>0):i>0?3:2}function s(e,t){return c(e.x,t.x)}function c(e,t){var n=o(e,1),r=o(t,1);return n===r?n===0?t[1]-e[1]:n===1?e[0]-t[0]:n===2?e[1]-t[1]:t[0]-e[0]:n-r}return function(o){var c=o,l=CF(),u,d,f,p,m,h,g,_,v,y,b,x={point:S,lineStart:E,lineEnd:D,polygonStart:w,polygonEnd:T};function S(e,t){i(e,t)&&c.point(e,t)}function C(){for(var t=0,n=0,i=d.length;nr&&(f-l)*(r-u)>(p-u)*(e-l)&&++t:p<=r&&(f-l)*(r-u)<(p-u)*(e-l)&&--t;return t}function w(){c=l,u=[],d=[],b=!0}function T(){var e=C(),t=b&&e,n=(u=pse(u)).length;(t||n)&&(o.polygonStart(),t&&(o.lineStart(),a(null,null,1,o),o.lineEnd()),n&&OF(u,s,e,a,o),o.polygonEnd()),c=o,u=d=f=null}function E(){x.point=O,d&&d.push(f=[]),y=!0,v=!1,g=_=NaN}function D(){u&&(O(p,m),h&&v&&l.rejoin(),u.push(l.result())),x.point=S,v&&c.lineEnd()}function O(a,o){var s=i(a,o);if(d&&f.push([a,o]),y)p=a,m=o,h=s,y=!1,s&&(c.lineStart(),c.point(a,o));else if(s&&v)c.point(a,o);else{var l=[g=Math.max(BF,Math.min(zF,g)),_=Math.max(BF,Math.min(zF,_))],u=[a=Math.max(BF,Math.min(zF,a)),o=Math.max(BF,Math.min(zF,o))];lye(l,u,e,t,n,r)?(v||(c.lineStart(),c.point(l[0],l[1])),c.point(u[0],u[1]),s||c.lineEnd(),b=!1):s&&(c.lineStart(),c.point(a,o),b=!1)}g=a,_=o,v=s}return x}}var zF,BF,VF=o((()=>{QN(),wF(),uye(),AF(),e_(),zF=1e9,BF=-zF}));function HF(e,t,n){var r=$g(e,t-MN,n).concat(t);return function(e){return r.map(function(t){return[e,t]})}}function UF(e,t,n){var r=$g(e,t-MN,n).concat(t);return function(e){return r.map(function(t){return[t,e]})}}function dye(){var e,t,n,r,i,a,o,s,c=10,l=c,u=90,d=360,f,p,m,h,g=2.5;function _(){return{type:`MultiLineString`,coordinates:v()}}function v(){return $g(UN(r/u)*u,n,u).map(m).concat($g(UN(s/d)*d,o,d).map(h)).concat($g(UN(t/c)*c,e,c).filter(function(e){return zN(e%u)>MN}).map(f)).concat($g(UN(a/l)*l,i,l).filter(function(e){return zN(e%d)>MN}).map(p))}return _.lines=function(){return v().map(function(e){return{type:`LineString`,coordinates:e}})},_.outline=function(){return{type:`Polygon`,coordinates:[m(r).concat(h(o).slice(1),m(n).reverse().slice(1),h(s).reverse().slice(1))]}},_.extent=function(e){return arguments.length?_.extentMajor(e).extentMinor(e):_.extentMinor()},_.extentMajor=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],s=+e[0][1],o=+e[1][1],r>n&&(e=r,r=n,n=e),s>o&&(e=s,s=o,o=e),_.precision(g)):[[r,s],[n,o]]},_.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],a=+n[0][1],i=+n[1][1],t>e&&(n=t,t=e,e=n),a>i&&(n=a,a=i,i=n),_.precision(g)):[[t,a],[e,i]]},_.step=function(e){return arguments.length?_.stepMajor(e).stepMinor(e):_.stepMinor()},_.stepMajor=function(e){return arguments.length?(u=+e[0],d=+e[1],_):[u,d]},_.stepMinor=function(e){return arguments.length?(c=+e[0],l=+e[1],_):[c,l]},_.precision=function(c){return arguments.length?(g=+c,f=HF(a,i,90),p=UF(t,e,g),m=HF(s,o,90),h=UF(r,n,g),_):g},_.extentMajor([[-180,-90+MN],[180,90-MN]]).extentMinor([[-180,-80-MN],[180,80+MN]])}var fye=o((()=>{e_(),QN()})),WF,GF=o((()=>{WF=e=>e}));function pye(){$F.point=mye}function mye(e,t){$F.point=KF,YF=ZF=e,XF=QF=t}function KF(e,t){JF.add(QF*e-ZF*t),ZF=e,QF=t}function hye(){KF(YF,XF)}var qF,JF,YF,XF,ZF,QF,$F,gye=o((()=>{e_(),QN(),eP(),qF=new Bg,JF=new Bg,$F={point:$N,lineStart:$N,lineEnd:$N,polygonStart:function(){$F.lineStart=pye,$F.lineEnd=hye},polygonEnd:function(){$F.lineStart=$F.lineEnd=$F.point=$N,qF.add(zN(JF)),JF=new Bg},result:function(){var e=qF/2;return qF=new Bg,e}}}));function _ye(e,t){enI&&(nI=e),trI&&(rI=t)}var eI,tI,nI,rI,iI,aI=o((()=>{eP(),eI=1/0,tI=eI,nI=-eI,rI=nI,iI={point:_ye,lineStart:$N,lineEnd:$N,polygonStart:$N,polygonEnd:$N,result:function(){var e=[[eI,tI],[nI,rI]];return nI=rI=-(tI=eI=1/0),e}}}));function oI(e,t){uI+=e,dI+=t,++fI}function sI(){CI.point=vye}function vye(e,t){CI.point=yye,oI(xI=e,SI=t)}function yye(e,t){var n=e-xI,r=t-SI,i=XN(n*n+r*r);pI+=i*(xI+e)/2,mI+=i*(SI+t)/2,hI+=i,oI(xI=e,SI=t)}function cI(){CI.point=oI}function bye(){CI.point=Sye}function xye(){lI(yI,bI)}function Sye(e,t){CI.point=lI,oI(yI=xI=e,bI=SI=t)}function lI(e,t){var n=e-xI,r=t-SI,i=XN(n*n+r*r);pI+=i*(xI+e)/2,mI+=i*(SI+t)/2,hI+=i,i=SI*e-xI*t,gI+=i*(xI+e),_I+=i*(SI+t),vI+=i*3,oI(xI=e,SI=t)}var uI,dI,fI,pI,mI,hI,gI,_I,vI,yI,bI,xI,SI,CI,Cye=o((()=>{QN(),uI=0,dI=0,fI=0,pI=0,mI=0,hI=0,gI=0,_I=0,vI=0,CI={point:oI,lineStart:sI,lineEnd:cI,polygonStart:function(){CI.lineStart=bye,CI.lineEnd=xye},polygonEnd:function(){CI.point=oI,CI.lineStart=sI,CI.lineEnd=cI},result:function(){var e=vI?[gI/vI,_I/vI]:hI?[pI/hI,mI/hI]:fI?[uI/fI,dI/fI]:[NaN,NaN];return uI=dI=fI=pI=mI=hI=gI=_I=vI=0,e}}}));function wI(e){this._context=e}var wye=o((()=>{QN(),eP(),wI.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,IN);break}},result:$N}}));function Tye(e,t){MI.point=TI,OI=AI=e,kI=jI=t}function TI(e,t){AI-=e,jI-=t,EI.add(XN(AI*AI+jI*jI)),AI=e,jI=t}var EI,DI,OI,kI,AI,jI,MI,Eye=o((()=>{e_(),QN(),eP(),EI=new Bg,MI={point:$N,lineStart:function(){MI.point=Tye},lineEnd:function(){DI&&TI(OI,kI),MI.point=$N},polygonStart:function(){DI=!0},polygonEnd:function(){DI=null},result:function(){var e=+EI;return EI=new Bg,e}}}));function NI(e){let t=1;this._+=e[0];for(let n=e.length;t=0))throw RangeError(`invalid digits: ${e}`);if(t>15)return NI;if(t!==PI){let e=10**t;PI=t,FI=function(t){let n=1;this._+=t[0];for(let r=t.length;n{RI=class{constructor(e){this._append=e==null?NI:Dye(e),this._radius=4.5,this._=``}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+=`Z`),this._point=NaN}point(e,t){switch(this._point){case 0:this._append`M${e},${t}`,this._point=1;break;case 1:this._append`L${e},${t}`;break;default:if(this._append`M${e},${t}`,this._radius!==II||this._append!==FI){let e=this._radius,t=this._;this._=``,this._append`m0,${e}a${e},${e} 0 1,1 0,${-2*e}a${e},${e} 0 1,1 0,${2*e}z`,II=e,FI=this._append,LI=this._,this._=t}this._+=LI;break}}result(){let e=this._;return this._=``,e.length?e:null}}}));function zI(e,t){let n=3,r=4.5,i,a;function o(e){return e&&(typeof r==`function`&&a.pointRadius(+r.apply(this,arguments)),iP(e,i(a))),a.result()}return o.area=function(e){return iP(e,i($F)),$F.result()},o.measure=function(e){return iP(e,i(MI)),MI.result()},o.bounds=function(e){return iP(e,i(iI)),iI.result()},o.centroid=function(e){return iP(e,i(CI)),CI.result()},o.projection=function(t){return arguments.length?(i=t==null?(e=null,WF):(e=t).stream,o):e},o.context=function(e){return arguments.length?(a=e==null?(t=null,new RI(n)):new wI(t=e),typeof r!=`function`&&a.pointRadius(r),o):t},o.pointRadius=function(e){return arguments.length?(r=typeof e==`function`?e:(a.pointRadius(+e),+e),o):r},o.digits=function(e){if(!arguments.length)return n;if(e==null)n=null;else{let t=Math.floor(e);if(!(t>=0))throw RangeError(`invalid digits: ${e}`);n=t}return t===null&&(a=new RI(n)),o},o.projection(e).digits(n).context(t)}var kye=o((()=>{GF(),sP(),gye(),aI(),Cye(),wye(),Eye(),Oye()}));function BI(e){return function(t){var n=new VI;for(var r in e)n[r]=e[r];return n.stream=t,n}}function VI(){}var HI=o((()=>{VI.prototype={constructor:VI,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}}}));function UI(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),iP(n,e.stream(iI)),t(iI.result()),r!=null&&e.clipExtent(r),e}function WI(e,t,n){return UI(e,function(n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],a=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),o=+t[0][0]+(r-a*(n[1][0]+n[0][0]))/2,s=+t[0][1]+(i-a*(n[1][1]+n[0][1]))/2;e.scale(150*a).translate([o,s])},n)}function GI(e,t,n){return WI(e,[[0,0],t],n)}function KI(e,t,n){return UI(e,function(n){var r=+t,i=r/(n[1][0]-n[0][0]),a=(r-i*(n[1][0]+n[0][0]))/2,o=-i*n[0][1];e.scale(150*i).translate([a,o])},n)}function qI(e,t,n){return UI(e,function(n){var r=+t,i=r/(n[1][1]-n[0][1]),a=-i*n[0][0],o=(r-i*(n[1][1]+n[0][1]))/2;e.scale(150*i).translate([a,o])},n)}var JI=o((()=>{sP(),aI()}));function YI(e,t){return+t?jye(e,t):Aye(e)}function Aye(e){return BI({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function jye(e,t){function n(r,i,a,o,s,c,l,u,d,f,p,m,h,g){var _=l-r,v=u-i,y=_*_+v*v;if(y>4*t&&h--){var b=o+f,x=s+p,S=c+m,C=XN(b*b+x*x+S*S),w=jN(S/=C),T=zN(zN(S)-1)<1e-6||zN(a-d)<1e-6?(a+d)/2:VN(x,b),E=e(T,w),D=E[0],O=E[1],k=D-r,A=O-i,j=v*k-_*A;(j*j/y>t||zN((_*k+v*A)/y-.5)>.3||o*f+s*p+c*m{TP(),QN(),HI(),XI=16,ZI=HN(30*RN)}));function Nye(e){return BI({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function Pye(e,t,n,r,i){function a(a,o){return a*=r,o*=i,[t+e*a,n-e*o]}return a.invert=function(a,o){return[(a-t)/e*r,(n-o)/e*i]},a}function QI(e,t,n,r,i,a){if(!a)return Pye(e,t,n,r,i);var o=HN(a),s=JN(a),c=o*e,l=s*e,u=o/e,d=s/e,f=(s*n-o*t)/e,p=(s*t+o*n)/e;function m(e,a){return e*=r,a*=i,[c*e-l*a+t,n-l*e-c*a]}return m.invert=function(e,t){return[r*(u*e-d*t+f),i*(p-d*e-u*t)]},m}function $I(e){return eL(function(){return e})()}function eL(e){var t,n=150,r=480,i=250,a=0,o=0,s=0,c=0,l=0,u,d=0,f=1,p=1,m=null,h=FF,g=null,_,v,y,b=WF,x=.5,S,C,w,T,E;function D(e){return w(e[0]*RN,e[1]*RN)}function O(e){return e=w.invert(e[0],e[1]),e&&[e[0]*LN,e[1]*LN]}D.stream=function(e){return T&&E===e?T:T=tL(Nye(u)(h(S(b(E=e)))))},D.preclip=function(e){return arguments.length?(h=e,m=void 0,A()):h},D.postclip=function(e){return arguments.length?(b=e,g=_=v=y=null,A()):b},D.clipAngle=function(e){return arguments.length?(h=+e?cye(m=e*RN):(m=null,FF),A()):m*LN},D.clipExtent=function(e){return arguments.length?(b=e==null?(g=_=v=y=null,WF):RF(g=+e[0][0],_=+e[0][1],v=+e[1][0],y=+e[1][1]),A()):g==null?null:[[g,_],[v,y]]},D.scale=function(e){return arguments.length?(n=+e,k()):n},D.translate=function(e){return arguments.length?(r=+e[0],i=+e[1],k()):[r,i]},D.center=function(e){return arguments.length?(a=e[0]%360*RN,o=e[1]%360*RN,k()):[a*LN,o*LN]},D.rotate=function(e){return arguments.length?(s=e[0]%360*RN,c=e[1]%360*RN,l=e.length>2?e[2]%360*RN:0,k()):[s*LN,c*LN,l*LN]},D.angle=function(e){return arguments.length?(d=e%360*RN,k()):d*LN},D.reflectX=function(e){return arguments.length?(f=e?-1:1,k()):f<0},D.reflectY=function(e){return arguments.length?(p=e?-1:1,k()):p<0},D.precision=function(e){return arguments.length?(S=YI(C,x=e*e),A()):XN(x)},D.fitExtent=function(e,t){return WI(D,e,t)},D.fitSize=function(e,t){return GI(D,e,t)},D.fitWidth=function(e,t){return KI(D,e,t)},D.fitHeight=function(e,t){return qI(D,e,t)};function k(){var e=QI(n,0,0,f,p,d).apply(null,t(a,o)),m=QI(n,r-e[0],i-e[1],f,p,d);return u=gF(s,c,l),C=pF(t,m),w=pF(u,C),S=YI(C,x),A()}function A(){return T=E=null,D}return function(){return t=e.apply(this,arguments),D.invert=t.invert&&O,k()}}var tL,nL=o((()=>{IF(),LF(),VF(),mF(),GF(),QN(),bF(),HI(),JI(),Mye(),tL=BI({point:function(e,t){this.stream.point(e*RN,t*RN)}})}));function rL(e){var t=0,n=NN/3,r=eL(e),i=r(t,n);return i.parallels=function(e){return arguments.length?r(t=e[0]*RN,n=e[1]*RN):[t*LN,n*LN]},i}var iL=o((()=>{QN(),nL()}));function Fye(e){var t=HN(e);function n(e,n){return[e*t,JN(n)/t]}return n.invert=function(e,n){return[e/t,jN(n*t)]},n}var Iye=o((()=>{QN()}));function Lye(e,t){var n=JN(e),r=(n+JN(t))/2;if(zN(r)<1e-6)return Fye(e);var i=1+n*(2*r-n),a=XN(i)/r;function o(e,t){var n=XN(i-2*r*JN(t))/r;return[n*JN(e*=r),a-n*HN(e)]}return o.invert=function(e,t){var n=a-t,o=VN(e,zN(n))*YN(n);return n*r<0&&(o-=NN*YN(e)*YN(n)),[o/r,jN((i-(e*e+n*n)*r*r)/(2*r))]},o}function aL(){return rL(Lye).scale(155.424).center([0,33.6442])}var oL=o((()=>{QN(),iL(),Iye()}));function sL(){return aL().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}var cL=o((()=>{oL()}));function Rye(e){var t=e.length;return{point:function(n,r){for(var i=-1;++i=.12&&s<.234&&a>=-.425&&a<-.214?i:s>=.166&&s<.234&&a>=-.214&&a<-.115?o:n).invert(e)},u.stream=function(r){return e&&t===r?e:e=Rye([n.stream(t=r),i.stream(r),o.stream(r)])},u.precision=function(e){return arguments.length?(n.precision(e),i.precision(e),o.precision(e),d()):n.precision()},u.scale=function(e){return arguments.length?(n.scale(e),i.scale(e*.35),o.scale(e),u.translate(n.translate())):n.scale()},u.translate=function(e){if(!arguments.length)return n.translate();var t=n.scale(),c=+e[0],u=+e[1];return r=n.translate(e).clipExtent([[c-.455*t,u-.238*t],[c+.455*t,u+.238*t]]).stream(l),a=i.translate([c-.307*t,u+.201*t]).clipExtent([[c-.425*t+MN,u+.12*t+MN],[c-.214*t-MN,u+.234*t-MN]]).stream(l),s=o.translate([c-.205*t,u+.212*t]).clipExtent([[c-.214*t+MN,u+.166*t+MN],[c-.115*t-MN,u+.234*t-MN]]).stream(l),d()},u.fitExtent=function(e,t){return WI(u,e,t)},u.fitSize=function(e,t){return GI(u,e,t)},u.fitWidth=function(e,t){return KI(u,e,t)},u.fitHeight=function(e,t){return qI(u,e,t)};function d(){return e=t=null,u}return u.scale(1070)}var Bye=o((()=>{QN(),cL(),oL(),JI()}));function lL(e){return function(t,n){var r=HN(t),i=HN(n),a=e(r*i);return a===1/0?[2,0]:[a*i*JN(t),a*JN(n)]}}function uL(e){return function(t,n){var r=XN(t*t+n*n),i=e(r),a=JN(i),o=HN(i);return[VN(t*a,r*o),jN(r&&n*a/r)]}}var dL=o((()=>{QN()}));function Vye(){return $I(fL).scale(124.75).clipAngle(179.999)}var fL,Hye=o((()=>{QN(),dL(),nL(),fL=lL(function(e){return XN(2/(1+e))}),fL.invert=uL(function(e){return 2*jN(e/2)})}));function Uye(){return $I(pL).scale(79.4188).clipAngle(179.999)}var pL,Wye=o((()=>{QN(),dL(),nL(),pL=lL(function(e){return(e=AN(e))&&e/JN(e)}),pL.invert=uL(function(e){return e})}));function mL(e,t){return[e,KN(ZN((PN+t)/2))]}function Gye(){return hL(mL).scale(961/IN)}function hL(e){var t=$I(e),n=t.center,r=t.scale,i=t.translate,a=t.clipExtent,o=null,s,c,l;t.scale=function(e){return arguments.length?(r(e),u()):r()},t.translate=function(e){return arguments.length?(i(e),u()):i()},t.center=function(e){return arguments.length?(n(e),u()):n()},t.clipExtent=function(e){return arguments.length?(e==null?o=s=c=l=null:(o=+e[0][0],s=+e[0][1],c=+e[1][0],l=+e[1][1]),u()):o==null?null:[[o,s],[c,l]]};function u(){var n=NN*r(),i=t(eye(t.rotate()).invert([0,0]));return a(o==null?[[i[0]-n,i[1]-n],[i[0]+n,i[1]+n]]:e===mL?[[Math.max(i[0]-n,o),s],[Math.min(i[0]+n,c),l]]:[[o,Math.max(i[1]-n,s)],[c,Math.min(i[1]+n,l)]])}return u()}var gL=o((()=>{QN(),bF(),nL(),mL.invert=function(e,t){return[e,2*BN(WN(t))-PN]}}));function _L(e){return ZN((PN+e)/2)}function Kye(e,t){var n=HN(e),r=e===t?JN(e):KN(n/HN(t))/KN(_L(t)/_L(e)),i=n*qN(_L(e),r)/r;if(!r)return mL;function a(e,t){i>0?t<-PN+1e-6&&(t=-PN+MN):t>PN-1e-6&&(t=PN-MN);var n=i/qN(_L(t),r);return[n*JN(r*e),i-n*HN(r*e)]}return a.invert=function(e,t){var n=i-t,a=YN(r)*XN(e*e+n*n),o=VN(e,zN(n))*YN(n);return n*r<0&&(o-=NN*YN(e)*YN(n)),[o/r,2*BN(qN(i/a,1/r))-PN]},a}function qye(){return rL(Kye).scale(109.5).parallels([30,30])}var Jye=o((()=>{QN(),iL(),gL()}));function vL(e,t){return[e,t]}function Yye(){return $I(vL).scale(152.63)}var yL=o((()=>{nL(),vL.invert=vL}));function Xye(e,t){var n=HN(e),r=e===t?JN(e):(n-HN(t))/(t-e),i=n/r+e;if(zN(r)<1e-6)return vL;function a(e,t){var n=i-t,a=r*e;return[n*JN(a),i-n*HN(a)]}return a.invert=function(e,t){var n=i-t,a=VN(e,zN(n))*YN(n);return n*r<0&&(a-=NN*YN(e)*YN(n)),[a/r,i-YN(r)*XN(e*e+n*n)]},a}function Zye(){return rL(Xye).scale(131.154).center([0,13.9389])}var Qye=o((()=>{QN(),iL(),yL()}));function bL(e,t){var n=jN(TL*JN(t)),r=n*n,i=r*r*r;return[e*HN(n)/(TL*(xL+3*SL*r+i*(7*CL+9*wL*r))),n*(xL+SL*r+i*(CL+wL*r))]}function $ye(){return $I(bL).scale(177.158)}var xL,SL,CL,wL,TL,EL,ebe=o((()=>{nL(),QN(),xL=1.340264,SL=-.081106,CL=893e-6,wL=.003796,TL=XN(3)/2,EL=12,bL.invert=function(e,t){for(var n=t,r=n*n,i=r*r*r,a=0,o,s,c;a{QN(),dL(),nL(),DL.invert=uL(BN)}));function rbe(){var e=1,t=0,n=0,r=1,i=1,a=0,o,s,c=null,l,u,d,f=1,p=1,m=BI({point:function(e,t){var n=y([e,t]);this.stream.point(n[0],n[1])}}),h=WF,g,_;function v(){return f=e*r,p=e*i,g=_=null,y}function y(e){var r=e[0]*f,i=e[1]*p;if(a){var c=i*o-r*s;r=r*o+i*s,i=c}return[r+t,i+n]}return y.invert=function(e){var r=e[0]-t,i=e[1]-n;if(a){var c=i*o+r*s;r=r*o-i*s,i=c}return[r/f,i/p]},y.stream=function(e){return g&&_===e?g:g=m(h(_=e))},y.postclip=function(e){return arguments.length?(h=e,c=l=u=d=null,v()):h},y.clipExtent=function(e){return arguments.length?(h=e==null?(c=l=u=d=null,WF):RF(c=+e[0][0],l=+e[0][1],u=+e[1][0],d=+e[1][1]),v()):c==null?null:[[c,l],[u,d]]},y.scale=function(t){return arguments.length?(e=+t,v()):e},y.translate=function(e){return arguments.length?(t=+e[0],n=+e[1],v()):[t,n]},y.angle=function(e){return arguments.length?(a=e%360*RN,s=JN(a),o=HN(a),v()):a*LN},y.reflectX=function(e){return arguments.length?(r=e?-1:1,v()):r<0},y.reflectY=function(e){return arguments.length?(i=e?-1:1,v()):i<0},y.fitExtent=function(e,t){return WI(y,e,t)},y.fitSize=function(e,t){return GI(y,e,t)},y.fitWidth=function(e,t){return KI(y,e,t)},y.fitHeight=function(e,t){return qI(y,e,t)},y}var ibe=o((()=>{VF(),GF(),HI(),JI(),QN()}));function OL(e,t){var n=t*t,r=n*n;return[e*(.8707-.131979*n+r*(-.013791+r*(.003971*n-.001529*r))),t*(1.007226+n*(.015085+r*(-.044475+.028874*n-.005916*r)))]}function abe(){return $I(OL).scale(175.295)}var obe=o((()=>{nL(),QN(),OL.invert=function(e,t){var n=t,r=25,i;do{var a=n*n,o=a*a;n-=i=(n*(1.007226+a*(.015085+o*(-.044475+.028874*a-.005916*o)))-t)/(1.007226+a*(.015085*3+o*(-.044475*7+.028874*9*a-.005916*11*o)))}while(zN(i)>1e-6&&--r>0);return[e/(.8707+(a=n*n)*(-.131979+a*(-.013791+a*a*a*(.003971-.001529*a)))),n]}}));function kL(e,t){return[HN(t)*JN(e),JN(t)]}function sbe(){return $I(kL).scale(249.5).clipAngle(90+MN)}var cbe=o((()=>{QN(),dL(),nL(),kL.invert=uL(jN)}));function AL(e,t){var n=HN(t),r=1+HN(e)*n;return[n*JN(e)/r,JN(t)/r]}function lbe(){return $I(AL).scale(250).clipAngle(142)}var ube=o((()=>{QN(),dL(),nL(),AL.invert=uL(function(e){return 2*BN(e)})}));function jL(e,t){return[KN(ZN((PN+t)/2)),-e]}function dbe(){var e=hL(jL),t=e.center,n=e.rotate;return e.center=function(e){return arguments.length?t([-e[1],e[0]]):(e=t(),[e[1],-e[0]])},e.rotate=function(e){return arguments.length?n([e[0],e[1],e.length>2?e[2]+90:90]):(e=n(),[e[0],e[1],e[2]-90])},n([0,0,90]).scale(159.155)}var fbe=o((()=>{QN(),gL(),jL.invert=function(e,t){return[-t,2*BN(WN(e))-PN]}})),ML=o((()=>{_P(),Kve(),$ve(),SF(),IF(),LF(),VF(),MF(),e_(),QN(),eP(),sP(),fye(),kye(),cL(),Bye(),Hye(),Wye(),Jye(),oL(),Qye(),ebe(),yL(),nbe(),ibe(),nL(),gL(),obe(),cbe(),ube(),fbe(),bF(),HI()}));function NL(e){return e>1?RL:e<-1?-RL:Math.asin(e)}function pbe(e){return e>0?Math.sqrt(e):0}var PL,FL,IL,LL,RL,zL,BL=o((()=>{PL=Math.abs,FL=Math.cos,IL=Math.sin,LL=Math.PI,RL=LL/2,LL/4,zL=pbe(2),LL*2,180/LL,LL/180}));function mbe(e,t){var n=e*IL(t),r=30,i;do t-=i=(t+IL(t)-n)/(1+FL(t));while(PL(i)>1e-6&&--r>0);return t/2}function hbe(e,t,n){function r(r,i){return[e*r*FL(i=mbe(n,i)),t*IL(i)]}return r.invert=function(r,i){return i=NL(i/t),[r/(e*FL(i)),NL((2*i+IL(2*i))/n)]},r}function gbe(){return $I(VL).scale(169.529)}var VL,_be=o((()=>{ML(),BL(),VL=hbe(zL/RL,zL,LL)})),vbe=o((()=>{ML(),BL(),_be(),e_()}));function ybe(e,t){return function n(){let r=t();return r.type=e,r.path=zI().projection(r),r.copy=r.copy||function(){let e=n();return GL.forEach(t=>{r[t]&&e[t](r[t]())}),e.path.pointRadius(r.path.pointRadius()),e},qpe(r)}}function HL(e,t){if(!e||typeof e!=`string`)throw Error(`Projection type must be a name string.`);return e=e.toLowerCase(),arguments.length>1?(KL[e]=ybe(e,t),this):KL[e]||null}function UL(e){return e&&e.path||WL}var WL,GL,KL,qL=o((()=>{ML(),vbe(),vO(),WL=zI(),GL=[`clipAngle`,`clipExtent`,`scale`,`translate`,`center`,`rotate`,`parallels`,`precision`,`reflectX`,`reflectY`,`coefficient`,`distance`,`fraction`,`lobes`,`parallel`,`radius`,`ratio`,`spacing`,`tilt`],KL={albers:sL,albersusa:zye,azimuthalequalarea:Vye,azimuthalequidistant:Uye,conicconformal:qye,conicequalarea:aL,conicequidistant:Zye,equalEarth:$ye,equirectangular:Yye,gnomonic:tbe,identity:rbe,mercator:Gye,mollweide:gbe,naturalEarth1:abe,orthographic:sbe,stereographic:lbe,transversemercator:dbe};for(let e in KL)HL(e,KL[e])})),bbe=c({contour:()=>aR,geojson:()=>oR,geopath:()=>sR,geopoint:()=>cR,geoshape:()=>lR,graticule:()=>uR,heatmap:()=>dR,isocontour:()=>XL,kde2d:()=>rR,projection:()=>pR});function xbe(){}function JL(){var e=1,t=1,n=s;function r(e,t){return t.map(t=>i(e,t))}function i(e,t){var r=[],i=[];return a(e,t,a=>{n(a,e,t),Sbe(a)>0?r.push([a]):i.push(a)}),i.forEach(e=>{for(var t=0,n=r.length,i;t=r,f,p;for(hR[d<<1].forEach(m);++c=r,hR[u|d<<1].forEach(m);for(hR[d<<0].forEach(m);++l=r,f=n[l*e]>=r,hR[d<<1|f<<2].forEach(m);++c=r,p=f,f=n[l*e+c+1]>=r,hR[u|d<<1|f<<2|p<<3].forEach(m);hR[d|f<<3].forEach(m)}for(c=-1,f=n[l*e]>=r,hR[f<<2].forEach(m);++c=r,hR[f<<2|p<<3].forEach(m);hR[f<<3].forEach(m);function m(e){var t=[e[0][0]+c,e[0][1]+l],n=[e[1][0]+c,e[1][1]+l],r=o(t),u=o(n),d,f;(d=s[r])?(f=a[u])?(delete s[d.end],delete a[f.start],d===f?(d.ring.push(n),i(d.ring)):a[d.start]=s[f.end]={start:d.start,end:f.end,ring:d.ring.concat(f.ring)}):(delete s[d.end],d.ring.push(n),s[d.end=u]=d):(d=a[u])?(f=s[r])?(delete a[d.start],delete s[f.end],d===f?(d.ring.push(n),i(d.ring)):a[f.start]=s[d.end]={start:f.start,end:d.end,ring:f.ring.concat(d.ring)}):(delete a[d.start],d.ring.unshift(t),a[d.start=r]=d):a[r]=s[u]={start:r,end:u,ring:[t,n]}}}function o(t){return t[0]*2+t[1]*(e+1)*4}function s(n,r,i){n.forEach(n=>{var a=n[0],o=n[1],s=a|0,c=o|0,l,u=r[c*e+s];a>0&&a0&&o=0&&a>=0||U(`invalid size`),e=i,t=a,r},r.smooth=function(e){return arguments.length?(n=e?s:xbe,r):n===s},r}function Sbe(e){for(var t=0,n=e.length,r=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++tr!=p>r&&n<(f-l)*(r-u)/(p-u)+l&&(i=-i)}return i}function Tbe(e,t,n){var r;return Ebe(e,t,n)&&Dbe(e[r=+(e[0]===t[0])],n[r],t[r])}function Ebe(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function Dbe(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function YL(e,t,n){return function(r){var i=sg(r),a=n?Math.min(i[0],0):i[0],o=i[1],s=o-a,c=t?Jg(a,o,e):s/(e+1);return $g(a+c,o,c)}}function XL(e){K.call(this,null,e)}function Obe(e,t,n){let r=YL(n.levels||10,n.nice,n.zero!==!1);return n.resolve===`shared`?r(e.map(e=>Yg(t(e).values))):r}function kbe(e,t,n,r){let i=r.scale||t.scale,a=r.translate||t.translate;if(eg(i)&&(i=i(n,r)),eg(a)&&(a=a(n,r)),(i===1||i==null)&&!a)return;let o=(gg(i)?i:i[0])||1,s=(gg(i)?i:i[1])||1,c=a&&a[0]||0,l=a&&a[1]||0;e.forEach(ZL(t,o,s,c,l))}function ZL(e,t,n,r,i){let a=e.x1||0,o=e.y1||0,s=t*n<0;function c(e){e.forEach(l)}function l(e){s&&e.reverse(),e.forEach(u)}function u(e){e[0]=(e[0]-a)*t+r,e[1]=(e[1]-o)*n+i}return function(e){return e.coordinates.forEach(c),e}}function QL(e,t,n){let r=e>=0?e:iS(t,n);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function $L(e){return eg(e)?e:ig(+e)}function eR(){var e=e=>e[0],t=e=>e[1],n=Th,r=[-1,-1],i=960,a=500,o=2;function s(s,c){let l=QL(r[0],s,e)>>o,u=QL(r[1],s,t)>>o,d=l?l+2:0,f=u?u+2:0,p=2*d+(i>>o),m=2*f+(a>>o),h=new Float32Array(p*m),g=new Float32Array(p*m),_=h;s.forEach(r=>{let i=d+(+e(r)>>o),a=f+(+t(r)>>o);i>=0&&i=0&&a0&&u>0?(tR(p,m,h,g,l),nR(p,m,g,h,u),tR(p,m,h,g,l),nR(p,m,g,h,u),tR(p,m,h,g,l),nR(p,m,g,h,u)):l>0?(tR(p,m,h,g,l),tR(p,m,g,h,l),tR(p,m,h,g,l),_=g):u>0&&(nR(p,m,h,g,u),nR(p,m,g,h,u),nR(p,m,h,g,u),_=g);let v=c?2**(-2*o):1/gse(_);for(let e=0,t=p*m;e>o),y2:f+(a>>o)}}return s.x=function(t){return arguments.length?(e=$L(t),s):e},s.y=function(e){return arguments.length?(t=$L(e),s):t},s.weight=function(e){return arguments.length?(n=$L(e),s):n},s.size=function(e){if(!arguments.length)return[i,a];var t=+e[0],n=+e[1];return t>=0&&n>=0||U(`invalid size`),i=t,a=n,s},s.cellSize=function(e){return arguments.length?((e=+e)>=1||U(`invalid cell size`),o=Math.floor(Math.log(e)/Math.LN2),s):1<=i&&(t>=a&&(s-=n[t-a+o*e]),r[t-i+o*e]=s/Math.min(t+1,e-1+a-t,a))}function nR(e,t,n,r,i){let a=(i<<1)+1;for(let o=0;o=i&&(s>=a&&(c-=n[o+(s-a)*e]),r[o+(s-i)*e]=c/Math.min(s+1,t-1+a-s,a))}function rR(e){K.call(this,null,e)}function iR(e,t){return gR.forEach(n=>t[n]==null?0:e[n](t[n])),e}function Abe(e,t){var n=[],r=e=>e(s),i,a,o,s,c,l;if(t==null)n.push(e);else for(i={},a=0,o=e.length;ae(t(n)):r=>{var i=e.pointRadius(),a=e.pointRadius(n)(t(r));return e.pointRadius(i),a};return r.context=t=>(e.context(t),r),r}function uR(e){K.call(this,[],e),this.generator=dye()}function dR(e){K.call(this,null,e)}function Nbe(e,t){let n;return eg(e)?(n=n=>QT(e(n,t)),n.dep=fR(e)):n=ig(QT(e||`#888`)),n}function Pbe(e,t){let n;return eg(e)?(n=n=>e(n,t),n.dep=fR(e)):e?n=ig(e):(n=e=>e.$value/e.$max||0,n.dep=!0),n}function fR(e){if(!eg(e))return!1;let t=Tg(dh(e));return t.$x||t.$y||t.$value||t.$max}function Fbe(e,t,n,r){let i=e.width,a=e.height,o=e.x1||0,s=e.y1||0,c=e.x2||i,l=e.y2||a,u=e.values,d=u?e=>u[e]:wh,f=PT(c-o,l-s),p=f.getContext(`2d`),m=p.getImageData(0,0,c-o,l-s),h=m.data;for(let e=s,a=0;ee.concat(zbe(t)),[])}}function zbe(e){return e.type===vR?e.features:Qh(e).filter(e=>e!=null).map(e=>e.type===_R?e:{type:_R,geometry:e})}var hR,gR,_R,vR,yR,Bbe=o((()=>{eS(),Dg(),e_(),GS(),qL(),ML(),KE(),IT(),hR=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]],XL.Definition={type:`Isocontour`,metadata:{generates:!0},params:[{name:`field`,type:`field`},{name:`thresholds`,type:`number`,array:!0},{name:`levels`,type:`number`},{name:`nice`,type:`boolean`,default:!1},{name:`resolve`,type:`enum`,values:[`shared`,`independent`],default:`independent`},{name:`zero`,type:`boolean`,default:!0},{name:`smooth`,type:`boolean`,default:!0},{name:`scale`,type:`number`,expr:!0},{name:`translate`,type:`number`,array:!0,expr:!0},{name:`as`,type:`string`,null:!0,default:`contour`}]},fg(XL,K,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=t.materialize(t.SOURCE).source,i=e.field||Ch,a=JL().smooth(e.smooth!==!1),o=e.thresholds||Obe(r,i,e),s=e.as===null?null:e.as||`contour`,c=[];return r.forEach(t=>{let n=i(t),r=a.size([n.width,n.height])(n.values,W(o)?o:o(n.values));kbe(r,n,t,e),r.forEach(e=>{c.push(ux(t,cx(s==null?e:{[s]:e})))})}),this.value&&(n.rem=this.value),this.value=n.source=n.add=c,n}}),rR.Definition={type:`KDE2D`,metadata:{generates:!0},params:[{name:`size`,type:`number`,array:!0,length:2,required:!0},{name:`x`,type:`field`,required:!0},{name:`y`,type:`field`,required:!0},{name:`weight`,type:`field`},{name:`groupby`,type:`field`,array:!0},{name:`cellSize`,type:`number`},{name:`bandwidth`,type:`number`,array:!0,length:2},{name:`counts`,type:`boolean`,default:!1},{name:`as`,type:`string`,default:`grid`}]},gR=[`x`,`y`,`weight`,`size`,`cellSize`,`bandwidth`],fg(rR,K,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=t.materialize(t.SOURCE).source,i=Abe(r,e.groupby),a=(e.groupby||[]).map(uh),o=iR(eR(),e),s=e.as||`grid`,c=[];function l(e,t){for(let n=0;ncx(l({[s]:o(t,e.counts)},t.dims))),this.value&&(n.rem=this.value),this.value=n.source=n.add=c,n}}),aR.Definition={type:`Contour`,metadata:{generates:!0},params:[{name:`size`,type:`number`,array:!0,length:2,required:!0},{name:`values`,type:`number`,array:!0},{name:`x`,type:`field`},{name:`y`,type:`field`},{name:`weight`,type:`field`},{name:`cellSize`,type:`number`},{name:`bandwidth`,type:`number`},{name:`count`,type:`number`},{name:`nice`,type:`boolean`,default:!1},{name:`thresholds`,type:`number`,array:!0},{name:`smooth`,type:`boolean`,default:!0}]},fg(aR,K,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=JL().smooth(e.smooth!==!1),i=e.values,a=e.thresholds||YL(e.count||10,e.nice,!!i),o=e.size,s,c;return i||=(i=t.materialize(t.SOURCE).source,s=iR(eR(),e)(i,!0),c=ZL(s,s.scale||1,s.scale||1,0,0),o=[s.width,s.height],s.values),a=W(a)?a:a(i),i=r.size(o)(i,a),c&&i.forEach(c),this.value&&(n.rem=this.value),this.value=n.source=n.add=(i||[]).map(cx),n}}),_R=`Feature`,vR=`FeatureCollection`,yR=`MultiPoint`,oR.Definition={type:`GeoJSON`,metadata:{},params:[{name:`fields`,type:`field`,array:!0,length:2},{name:`geojson`,type:`field`}]},fg(oR,K,{transform(e,t){var n=this._features,r=this._points,i=e.fields,a=i&&i[0],o=i&&i[1],s=e.geojson||!i&&Ch,c=t.ADD,l=e.modified()||t.changed(t.REM)||t.modified(dh(s))||a&&t.modified(dh(a))||o&&t.modified(dh(o));(!this.value||l)&&(c=t.SOURCE,this._features=n=[],this._points=r=[]),s&&t.visit(c,e=>n.push(s(e))),a&&o&&(t.visit(c,e=>{var t=a(e),n=o(e);t!=null&&n!=null&&(t=+t)===t&&(n=+n)===n&&r.push([t,n])}),n=n.concat({type:_R,geometry:{type:yR,coordinates:r}})),this.value={type:vR,features:n}}}),sR.Definition={type:`GeoPath`,metadata:{modifies:!0},params:[{name:`projection`,type:`projection`},{name:`field`,type:`field`},{name:`pointRadius`,type:`number`,expr:!0},{name:`as`,type:`string`,default:`path`}]},fg(sR,K,{transform(e,t){var n=t.fork(t.ALL),r=this.value,i=e.field||Ch,a=e.as||`path`,o=n.SOURCE;!r||e.modified()?(this.value=r=UL(e.projection),n.materialize().reflow()):o=i===Ch||t.modified(i.fields)?n.ADD_MOD:n.ADD;let s=jbe(r,e.pointRadius);return n.visit(o,e=>e[a]=r(i(e))),r.pointRadius(s),n.modifies(a)}}),cR.Definition={type:`GeoPoint`,metadata:{modifies:!0},params:[{name:`projection`,type:`projection`,required:!0},{name:`fields`,type:`field`,array:!0,required:!0,length:2},{name:`as`,type:`string`,array:!0,length:2,default:[`x`,`y`]}]},fg(cR,K,{transform(e,t){var n=e.projection,r=e.fields[0],i=e.fields[1],a=e.as||[`x`,`y`],o=a[0],s=a[1],c;function l(e){let t=n([r(e),i(e)]);t?(e[o]=t[0],e[s]=t[1]):(e[o]=void 0,e[s]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,l):(c=t.modified(r.fields)||t.modified(i.fields),t.visit(c?t.ADD_MOD:t.ADD,l)),t.modifies(a)}}),lR.Definition={type:`GeoShape`,metadata:{modifies:!0,nomod:!0},params:[{name:`projection`,type:`projection`},{name:`field`,type:`field`,default:`datum`},{name:`pointRadius`,type:`number`,expr:!0},{name:`as`,type:`string`,default:`shape`}]},fg(lR,K,{transform(e,t){var n=t.fork(t.ALL),r=this.value,i=e.as||`shape`,a=n.ADD;return(!r||e.modified())&&(this.value=r=Mbe(UL(e.projection),e.field||bh(`datum`),e.pointRadius),n.materialize().reflow(),a=n.SOURCE),n.visit(a,e=>e[i]=r),n.modifies(i)}}),uR.Definition={type:`Graticule`,metadata:{changes:!0,generates:!0},params:[{name:`extent`,type:`array`,array:!0,length:2,content:{type:`number`,array:!0,length:2}},{name:`extentMajor`,type:`array`,array:!0,length:2,content:{type:`number`,array:!0,length:2}},{name:`extentMinor`,type:`array`,array:!0,length:2,content:{type:`number`,array:!0,length:2}},{name:`step`,type:`number`,array:!0,length:2},{name:`stepMajor`,type:`number`,array:!0,length:2,default:[90,360]},{name:`stepMinor`,type:`number`,array:!0,length:2,default:[10,10]},{name:`precision`,type:`number`,default:2.5}]},fg(uR,K,{transform(e,t){var n=this.value,r=this.generator,i;if(!n.length||e.modified())for(let t in e)eg(r[t])&&r[t](e[t]);return i=r(),n.length?t.mod.push(dx(n[0],i)):t.add.push(cx(i)),n[0]=i,t}}),dR.Definition={type:`heatmap`,metadata:{modifies:!0},params:[{name:`field`,type:`field`},{name:`color`,type:`string`,expr:!0},{name:`opacity`,type:`number`,expr:!0},{name:`resolve`,type:`enum`,values:[`shared`,`independent`],default:`independent`},{name:`as`,type:`string`,default:`image`}]},fg(dR,K,{transform(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var n=t.materialize(t.SOURCE).source,r=e.resolve===`shared`,i=e.field||Ch,a=Pbe(e.opacity,e),o=Nbe(e.color,e),s=e.as||`image`,c={$x:0,$y:0,$value:0,$max:r?Yg(n.map(e=>Yg(i(e).values))):0};return n.forEach(e=>{let t=i(e),n=og({},e,c);r||(n.$max=Yg(t.values||[])),e[s]=Fbe(t,n,o.dep?o:ig(o(n)),a.dep?a:ig(a(n)))}),t.reflow(!0).modifies(s)}}),fg(pR,K,{transform(e,t){let n=this.value;return!n||e.modified(`type`)?(this.value=n=Lbe(e.type),GL.forEach(t=>{e[t]!=null&&mR(n,t,e[t])})):GL.forEach(t=>{e.modified(t)&&mR(n,t,e[t])}),e.pointRadius!=null&&n.path.pointRadius(e.pointRadius),e.fit&&Ibe(n,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)}})}));function Vbe(e,t){var n,r=1;e??=0,t??=0;function i(){var i,a=n.length,o,s=0,c=0;for(i=0;i{}));function Ube(e){let t=+this._x.call(null,e),n=+this._y.call(null,e);return bR(this.cover(t,n),t,n,e)}function bR(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,a=e._root,o={data:r},s=e._x0,c=e._y0,l=e._x1,u=e._y1,d,f,p,m,h,g,_,v;if(!a)return e._root=o,e;for(;a.length;)if((h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f,i=a,!(a=a[_=g<<1|h]))return i[_]=o,e;if(p=+e._x.call(null,a.data),m=+e._y.call(null,a.data),t===p&&n===m)return o.next=a,i?i[_]=o:e._root=o,e;do i=i?i[_]=[,,,,]:e._root=[,,,,],(h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f;while((_=g<<1|h)==(v=(m>=f)<<1|p>=d));return i[v]=a,i[_]=o,e}function Wbe(e){var t,n,r=e.length,i,a,o=Array(r),s=Array(r),c=1/0,l=1/0,u=-1/0,d=-1/0;for(n=0;nu&&(u=i),ad&&(d=a));if(c>u||l>d)return this;for(this.cover(c,l).cover(u,d),n=0;n{}));function Kbe(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(n))i=(n=Math.floor(e))+1,a=(r=Math.floor(t))+1;else{for(var o=i-n||1,s=this._root,c,l;n>e||e>=i||r>t||t>=a;)switch(l=(t{}));function Jbe(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}var Ybe=o((()=>{}));function Xbe(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}var Zbe=o((()=>{}));function xR(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i}var SR=o((()=>{}));function Qbe(e,t,n){var r,i=this._x0,a=this._y0,o,s,c,l,u=this._x1,d=this._y1,f=[],p=this._root,m,h;for(p&&f.push(new xR(p,i,a,u,d)),n==null?n=1/0:(i=e-n,a=t-n,u=e+n,d=t+n,n*=n);m=f.pop();)if(!(!(p=m.node)||(o=m.x0)>u||(s=m.y0)>d||(c=m.x1)=_)<<1|e>=g)&&(m=f[f.length-1],f[f.length-1]=f[f.length-1-h],f[f.length-1-h]=m)}else{var v=e-+this._x.call(null,p.data),y=t-+this._y.call(null,p.data),b=v*v+y*y;if(b{SR()}));function exe(e){if(isNaN(u=+this._x.call(null,e))||isNaN(d=+this._y.call(null,e)))return this;var t,n=this._root,r,i,a,o=this._x0,s=this._y0,c=this._x1,l=this._y1,u,d,f,p,m,h,g,_;if(!n)return this;if(n.length)for(;;){if((m=u>=(f=(o+c)/2))?o=f:c=f,(h=d>=(p=(s+l)/2))?s=p:l=p,t=n,!(n=n[g=h<<1|m]))return this;if(!n.length)break;(t[g+1&3]||t[g+2&3]||t[g+3&3])&&(r=t,_=g)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[g]=a:delete t[g],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[_]=n:this._root=n),this):(this._root=a,this)}function txe(e){for(var t=0,n=e.length;t{}));function rxe(){return this._root}var ixe=o((()=>{}));function axe(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}var oxe=o((()=>{}));function sxe(e){var t=[],n,r=this._root,i,a,o,s,c;for(r&&t.push(new xR(r,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(r=n.node,a=n.x0,o=n.y0,s=n.x1,c=n.y1)&&r.length){var l=(a+s)/2,u=(o+c)/2;(i=r[3])&&t.push(new xR(i,l,u,s,c)),(i=r[2])&&t.push(new xR(i,a,u,l,c)),(i=r[1])&&t.push(new xR(i,l,o,s,u)),(i=r[0])&&t.push(new xR(i,a,o,l,u))}return this}var cxe=o((()=>{SR()}));function lxe(e){var t=[],n=[],r;for(this._root&&t.push(new xR(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.y0,c=r.x1,l=r.y1,u=(o+c)/2,d=(s+l)/2;(a=i[0])&&t.push(new xR(a,o,s,u,d)),(a=i[1])&&t.push(new xR(a,u,s,c,d)),(a=i[2])&&t.push(new xR(a,o,d,u,l)),(a=i[3])&&t.push(new xR(a,u,d,c,l))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}var uxe=o((()=>{SR()}));function dxe(e){return e[0]}function fxe(e){return arguments.length?(this._x=e,this):this._x}var pxe=o((()=>{}));function mxe(e){return e[1]}function hxe(e){return arguments.length?(this._y=e,this):this._y}var gxe=o((()=>{}));function CR(e,t,n){var r=new wR(t??dxe,n??mxe,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function wR(e,t,n,r,i,a){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function TR(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var ER,_xe=o((()=>{Gbe(),qbe(),Ybe(),Zbe(),$be(),nxe(),ixe(),oxe(),cxe(),uxe(),pxe(),gxe(),ER=CR.prototype=wR.prototype,ER.copy=function(){var e=new wR(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=TR(t),e;for(n=[{source:t,target:e._root=[,,,,]}];t=n.pop();)for(var i=0;i<4;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=[,,,,]}):t.target[i]=TR(r));return e},ER.add=Ube,ER.addAll=Wbe,ER.cover=Kbe,ER.data=Jbe,ER.extent=Xbe,ER.find=Qbe,ER.remove=exe,ER.removeAll=txe,ER.root=rxe,ER.size=axe,ER.visit=sxe,ER.visitAfter=lxe,ER.x=fxe,ER.y=hxe})),DR=o((()=>{_xe()}));function OR(e){return function(){return e}}var kR=o((()=>{}));function AR(e){return(e()-.5)*1e-6}var jR=o((()=>{}));function vxe(e){return e.x+e.vx}function yxe(e){return e.y+e.vy}function bxe(e){var t,n,r,i=1,a=1;typeof e!=`function`&&(e=OR(e==null?1:+e));function o(){for(var e,o=t.length,c,l,u,d,f,p,m=0;ml.index){var h=u-s.x-s.vx,g=d-s.y-s.vy,_=h*h+g*g;_u+m||ad+m||oe.r&&(e.r=e[t].r)}function c(){if(t){var r,i=t.length,a;for(n=Array(i),r=0;r{DR(),kR(),jR()}));function Sxe(e){return e.index}function MR(e,t){var n=e.get(t);if(!n)throw Error(`node not found: `+t);return n}function Cxe(e){var t=Sxe,n=d,r,i=OR(30),a,o,s,c,l,u=1;e??=[];function d(e){return 1/Math.min(s[e.source.index],s[e.target.index])}function f(t){for(var n=0,i=e.length;n[t(e,n,o),e])),d;for(n=0,s=Array(i);n{kR(),jR()}));function NR(){for(var e=0,t=arguments.length,n={},r;e=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}function Exe(e,t){for(var n=0,r=e.length,i;n{IR={value:()=>{}},PR.prototype=NR.prototype={constructor:PR,on:function(e,t){var n=this._,r=Txe(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a0)for(var n=Array(i),r=0,i,a;r{Dxe()}));function LR(){return YR||=(QR(kxe),ZR.now()+XR)}function kxe(){YR=0}function RR(){this._call=this._time=this._next=null}function zR(e,t,n){var r=new RR;return r.restart(e,t,n),r}function Axe(){LR(),++HR;for(var e=KR,t;e;)(t=YR-e._time)>=0&&e._call.call(void 0,t),e=e._next;--HR}function BR(){YR=(JR=ZR.now())+XR,HR=UR=0;try{Axe()}finally{HR=0,Mxe(),YR=0}}function jxe(){var e=ZR.now(),t=e-JR;t>GR&&(XR-=t,JR=e)}function Mxe(){for(var e,t=KR,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:KR=n);qR=e,VR(r)}function VR(e){HR||(UR&&=clearTimeout(UR),e-YR>24?(e<1/0&&(UR=setTimeout(BR,e-ZR.now()-XR)),WR&&=clearInterval(WR)):(WR||=(JR=ZR.now(),setInterval(jxe,GR)),HR=1,QR(BR)))}var HR,UR,WR,GR,KR,qR,JR,YR,XR,ZR,QR,$R=o((()=>{HR=0,UR=0,WR=0,GR=1e3,JR=0,YR=0,XR=0,ZR=typeof performance==`object`&&performance.now?performance:Date,QR=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)},RR.prototype=zR.prototype={constructor:RR,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?LR():+n)+(t==null?0:+t),!this._next&&qR!==this&&(qR?qR._next=this:KR=this,qR=this),this._call=e,this._time=n,VR()},stop:function(){this._call&&(this._call=null,this._time=1/0,VR())}}}));function Nxe(e,t,n){var r=new RR,i=t;return t==null?(r.restart(e,t,n),r):(r._restart=r.restart,r.restart=function(e,t,n){t=+t,n=n==null?LR():+n,r._restart(function a(o){o+=i,r._restart(a,i+=t,n),e(o)},t,n)},r.restart(e,t,n),r)}var Pxe=o((()=>{$R()})),ez=o((()=>{$R(),Pxe()}));function Fxe(){let e=1;return()=>(e=(tz*e+nz)%rz)/rz}var tz,nz,rz,Ixe=o((()=>{tz=1664525,nz=1013904223,rz=4294967296}));function Lxe(e){return e.x}function Rxe(e){return e.y}function zxe(e){var t,n=1,r=.001,i=1-r**(1/300),a=0,o=.6,s=new Map,c=zR(d),l=NR(`tick`,`end`),u=Fxe();e??=[];function d(){f(),l.call(`tick`,t),n1?(n==null?s.delete(e):s.set(e,m(n)),t):s.get(e)},find:function(t,n,r){var i=0,a=e.length,o,s,c,l,u;for(r==null?r=1/0:r*=r,i=0;i1?(l.on(e,n),t):l.on(e)}}}var iz,az,oz=o((()=>{Oxe(),ez(),Ixe(),iz=10,az=Math.PI*(3-Math.sqrt(5))}));function Bxe(){var e,t,n,r,i=OR(-30),a,o=1,s=1/0,c=.81;function l(n){var i,a=e.length,o=CR(e,Lxe,Rxe).visitAfter(d);for(r=n,i=0;i=s)){(e.data!==t||e.next)&&(d===0&&(d=AR(n),m+=d*d),f===0&&(f=AR(n),m+=f*f),m{DR(),kR(),jR(),oz()}));function Hxe(e){var t=OR(.1),n,r,i;typeof e!=`function`&&(e=OR(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t{kR()}));function Wxe(e){var t=OR(.1),n,r,i;typeof e!=`function`&&(e=OR(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t{kR()})),Kxe=o((()=>{Hbe(),xxe(),wxe(),Vxe(),kR(),oz(),Uxe(),Gxe()})),qxe=c({force:()=>sz});function sz(e){K.call(this,null,e)}function Jxe(e,t){return()=>e.touch(t).run()}function Yxe(e,t){let n=zxe(e),r=n.stop,i=n.restart,a=!1;return n.stopped=()=>a,n.restart=()=>(a=!1,i()),n.stop=()=>(a=!0,r()),cz(n,t,!0).on(`end`,()=>a=!0)}function cz(e,t,n,r){var i=Qh(t.forces),a,o,s,c;for(a=0,o=dz.length;at(e,n):t)}var lz,uz,dz,fz,pz,$xe=o((()=>{eS(),Dg(),Kxe(),lz={center:Vbe,collide:bxe,nbody:Bxe,link:Cxe,x:Hxe,y:Wxe},uz=`forces`,dz=[`alpha`,`alphaMin`,`alphaTarget`,`velocityDecay`,`forces`],fz=[`static`,`iterations`],pz=[`x`,`y`,`vx`,`vy`],sz.Definition={type:`Force`,metadata:{modifies:!0},params:[{name:`static`,type:`boolean`,default:!1},{name:`restart`,type:`boolean`,default:!1},{name:`iterations`,type:`number`,default:300},{name:`alpha`,type:`number`,default:1},{name:`alphaMin`,type:`number`,default:.001},{name:`alphaTarget`,type:`number`,default:0},{name:`velocityDecay`,type:`number`,default:.4},{name:`forces`,type:`param`,array:!0,params:[{key:{force:`center`},params:[{name:`x`,type:`number`,default:0},{name:`y`,type:`number`,default:0}]},{key:{force:`collide`},params:[{name:`radius`,type:`number`,expr:!0},{name:`strength`,type:`number`,default:.7},{name:`iterations`,type:`number`,default:1}]},{key:{force:`nbody`},params:[{name:`strength`,type:`number`,default:-30,expr:!0},{name:`theta`,type:`number`,default:.9},{name:`distanceMin`,type:`number`,default:1},{name:`distanceMax`,type:`number`}]},{key:{force:`link`},params:[{name:`links`,type:`data`},{name:`id`,type:`field`},{name:`distance`,type:`number`,default:30,expr:!0},{name:`strength`,type:`number`,expr:!0},{name:`iterations`,type:`number`,default:1}]},{key:{force:`x`},params:[{name:`strength`,type:`number`,default:.1},{name:`x`,type:`field`}]},{key:{force:`y`},params:[{name:`strength`,type:`number`,default:.1},{name:`y`,type:`field`}]}]},{name:`as`,type:`string`,array:!0,modify:!1,default:pz}]},fg(sz,K,{transform(e,t){var n=this.value,r=t.changed(t.ADD_REM),i=e.modified(dz),a=e.iterations||300;if(n?(r&&(t.modifies(`index`),n.nodes(t.source)),(i||t.changed(t.MOD))&&cz(n,e,0,t)):(this.value=n=Yxe(t.source,e),n.on(`tick`,Jxe(t.dataflow,this)),e.static||(r=!0,n.tick()),t.modifies(`index`)),i||r||e.modified(fz)||t.changed()&&e.restart){if(n.alpha(Math.max(n.alpha(),e.alpha||1)).alphaDecay(1-n.alphaMin()**(1/a)),e.static)for(n.stop();--a>=0;)n.tick();else if(n.stopped()&&n.restart(),!r)return t.StopPropagation}return this.finish(e,t)},finish(e,t){let n=t.dataflow;for(let e=this._argops,t=0,s=e.length,c;t{}));function lSe(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function uSe(){return this.eachAfter(lSe)}var dSe=o((()=>{}));function fSe(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}var pSe=o((()=>{}));function mSe(e,t){for(var n=this,r=[n],i,a,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}var hSe=o((()=>{}));function gSe(e,t){for(var n=this,r=[n],i=[],a,o,s,c=-1;n=r.pop();)if(i.push(n),a=n.children)for(o=0,s=a.length;o{}));function vSe(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}var ySe=o((()=>{}));function bSe(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}var xSe=o((()=>{}));function SSe(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}var CSe=o((()=>{}));function wSe(e){for(var t=this,n=TSe(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function TSe(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}var ESe=o((()=>{}));function DSe(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}var OSe=o((()=>{}));function kSe(){return Array.from(this)}var ASe=o((()=>{}));function jSe(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}var MSe=o((()=>{}));function NSe(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}var PSe=o((()=>{}));function*FSe(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i{}));function mz(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=zSe)):t===void 0&&(t=RSe);for(var n=new gz(e),r,i=[n],a,o,s,c;r=i.pop();)if((o=t(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,s=c-1;s>=0;--s)i.push(a=o[s]=new gz(o[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(hz)}function LSe(){return mz(this).eachBefore(BSe)}function RSe(e){return e.children}function zSe(e){return Array.isArray(e)?e[1]:null}function BSe(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function hz(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function gz(e){this.data=e,this.depth=this.height=0,this.parent=null}var _z=o((()=>{dSe(),pSe(),hSe(),_Se(),ySe(),xSe(),CSe(),ESe(),OSe(),ASe(),MSe(),PSe(),ISe(),gz.prototype=mz.prototype={constructor:gz,count:uSe,each:fSe,eachAfter:gSe,eachBefore:mSe,find:vSe,sum:bSe,sort:SSe,path:wSe,ancestors:DSe,descendants:kSe,leaves:jSe,links:NSe,copy:LSe,[Symbol.iterator]:FSe}}));function vz(e){return e==null?null:yz(e)}function yz(e){if(typeof e!=`function`)throw Error();return e}var bz=o((()=>{}));function xz(){return 0}function Sz(e){return function(){return e}}var Cz=o((()=>{}));function VSe(){let e=1;return()=>(e=(wz*e+Tz)%Ez)/Ez}var wz,Tz,Ez,HSe=o((()=>{wz=1664525,Tz=1013904223,Ez=4294967296}));function USe(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function WSe(e,t){let n=e.length,r,i;for(;n;)i=t()*n--|0,r=e[n],e[n]=e[i],e[i]=r;return e}var Dz=o((()=>{}));function GSe(e,t){for(var n=0,r=(e=WSe(Array.from(e),t)).length,i=[],a,o;n0&&n*n>r*r+i*i}function Az(e,t){for(var n=0;n1e-6?(D+Math.sqrt(D*D-4*E*O))/(2*E):O/D);return{x:r+S+C*k,y:i+w+T*k,r:k}}var Nz=o((()=>{Dz()}));function Pz(e,t,n){var r=e.x-t.x,i,a,o=e.y-t.y,s,c,l=r*r+o*o;l?(a=t.r+n.r,a*=a,c=e.r+n.r,c*=c,a>c?(i=(l+c-a)/(2*l),s=Math.sqrt(Math.max(0,c/l-i*i)),n.x=e.x-i*r-s*o,n.y=e.y-i*o+s*r):(i=(l+a-c)/(2*l),s=Math.sqrt(Math.max(0,a/l-i*i)),n.x=t.x+i*r-s*o,n.y=t.y+i*o+s*r)):(n.x=t.x+n.r,n.y=t.y)}function Fz(e,t){var n=e.r+t.r-1e-6,r=t.x-e.x,i=t.y-e.y;return n>0&&n*n>r*r+i*i}function Iz(e){var t=e._,n=e.next._,r=t.r+n.r,i=(t.x*n.r+n.x*t.r)/r,a=(t.y*n.r+n.y*t.r)/r;return i*i+a*a}function Lz(e){this._=e,this.next=null,this.previous=null}function YSe(e,t){if(!(a=(e=USe(e)).length))return 0;var n=e[0],r,i,a,o,s,c,l,u,d,f;if(n.x=0,n.y=0,!(a>1))return n.r;if(r=e[1],n.x=-r.r,r.x=n.r,r.y=0,!(a>2))return n.r+r.r;Pz(r,n,i=e[2]),n=new Lz(n),r=new Lz(r),i=new Lz(i),n.next=i.previous=r,r.next=n.previous=i,i.next=r.previous=n;pack:for(c=3;c{Dz(),Nz()}));function XSe(e){return Math.sqrt(e.value)}function ZSe(){var e=null,t=1,n=1,r=xz;function i(i){let a=VSe();return i.x=t/2,i.y=n/2,e?i.eachBefore(zz(e)).eachAfter(Bz(r,.5,a)).eachBefore(Vz(1)):i.eachBefore(zz(XSe)).eachAfter(Bz(xz,1,a)).eachAfter(Bz(r,i.r/Math.min(t,n),a)).eachBefore(Vz(Math.min(t,n)/(2*i.r))),i}return i.radius=function(t){return arguments.length?(e=vz(t),i):e},i.size=function(e){return arguments.length?(t=+e[0],n=+e[1],i):[t,n]},i.padding=function(e){return arguments.length?(r=typeof e==`function`?e:Sz(+e),i):r},i}function zz(e){return function(t){t.children||(t.r=Math.max(0,+e(t)||0))}}function Bz(e,t,n){return function(r){if(i=r.children){var i,a,o=i.length,s=e(r)*t||0,c;if(s)for(a=0;a{bz(),Cz(),HSe(),Rz()}));function Hz(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}var Uz=o((()=>{}));function Wz(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(r-t)/e.value;++s{}));function $Se(){var e=1,t=1,n=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=e,i.y1=t/o,i.eachBefore(a(t,o)),r&&i.eachBefore(Hz),i}function a(e,t){return function(r){r.children&&Wz(r,r.x0,e*(r.depth+1)/t,r.x1,e*(r.depth+2)/t);var i=r.x0,a=r.y0,o=r.x1-n,s=r.y1-n;o{Uz(),Gz()}));function tCe(e){return e.id}function nCe(e){return e.parentId}function Kz(){var e=tCe,t=nCe,n;function r(r){var i=Array.from(r),a=e,o=t,s,c,l,u,d,f,p,m,h=new Map;if(n!=null){let e=i.map((e,t)=>rCe(n(e,t,r))),t=e.map(qz),s=new Set(e).add(``);for(let n of t)s.has(n)||(s.add(n),e.push(n),t.push(qz(n)),i.push(Zz));a=(t,n)=>e[n],o=(e,n)=>t[n]}for(l=0,s=i.length;l=0&&(f=i[e],f.data===Zz);--e)f.data=null}if(u.parent=Yz,u.eachBefore(function(e){e.depth=e.parent.depth+1,--s}).eachBefore(hz),u.parent=null,s>0)throw Error(`cycle`);return u}return r.id=function(t){return arguments.length?(e=vz(t),r):e},r.parentId=function(e){return arguments.length?(t=vz(e),r):t},r.path=function(e){return arguments.length?(n=vz(e),r):n},r}function rCe(e){e=`${e}`;let t=e.length;return Jz(e,t-1)&&!Jz(e,t-2)&&(e=e.slice(0,-1)),e[0]===`/`?e:`/${e}`}function qz(e){let t=e.length;if(t<2)return``;for(;--t>1&&!Jz(e,t););return e.slice(0,t)}function Jz(e,t){if(e[t]===`/`){let n=0;for(;t>0&&e[--t]===`\\`;)++n;if(!(n&1))return!0}return!1}var Yz,Xz,Zz,iCe=o((()=>{bz(),_z(),Yz={depth:-1},Xz={},Zz={}}));function aCe(e,t){return e.parent===t.parent?1:2}function Qz(e){var t=e.children;return t?t[0]:e.t}function $z(e){var t=e.children;return t?t[t.length-1]:e.t}function oCe(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function sCe(e){for(var t=0,n=0,r=e.children,i=r.length,a;--i>=0;)a=r[i],a.z+=t,a.m+=t,t+=a.s+(n+=a.c)}function cCe(e,t,n){return e.a.parent===t.parent?e.a:n}function eB(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}function lCe(e){for(var t=new eB(e,0),n,r=[t],i,a,o,s;n=r.pop();)if(a=n._.children)for(n.children=Array(s=a.length),o=s-1;o>=0;--o)r.push(i=n.children[o]=new eB(a[o],o)),i.parent=n;return(t.parent=new eB(null,0)).children=[t],t}function uCe(){var e=aCe,t=1,n=1,r=null;function i(i){var s=lCe(i);if(s.eachAfter(a),s.parent.m=-s.z,s.eachBefore(o),r)i.eachBefore(c);else{var l=i,u=i,d=i;i.eachBefore(function(e){e.xu.x&&(u=e),e.depth>d.depth&&(d=e)});var f=l===u?1:e(l,u)/2,p=f-l.x,m=t/(u.x+f+p),h=n/(d.depth||1);i.eachBefore(function(e){e.x=(e.x+p)*m,e.y=e.depth*h})}return i}function a(t){var n=t.children,r=t.parent.children,i=t.i?r[t.i-1]:null;if(n){sCe(t);var a=(n[0].z+n[n.length-1].z)/2;i?(t.z=i.z+e(t._,i._),t.m=t.z-a):t.z=a}else i&&(t.z=i.z+e(t._,i._));t.parent.A=s(t,i,t.parent.A||r[0])}function o(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(t,n,r){if(n){for(var i=t,a=t,o=n,s=i.parent.children[0],c=i.m,l=a.m,u=o.m,d=s.m,f;o=$z(o),i=Qz(i),o&&i;)s=Qz(s),a=$z(a),a.a=t,f=o.z+u-i.z-c+e(o._,i._),f>0&&(oCe(cCe(o,t,r),t,f),c+=f,l+=f),u+=o.m,c+=i.m,d+=s.m,l+=a.m;o&&!$z(a)&&(a.t=o,a.m+=u-l),i&&!Qz(s)&&(s.t=i,s.m+=c-d,r=t)}return r}function c(e){e.x*=t,e.y=e.depth*n}return i.separation=function(t){return arguments.length?(e=t,i):e},i.size=function(e){return arguments.length?(r=!1,t=+e[0],n=+e[1],i):r?null:[t,n]},i.nodeSize=function(e){return arguments.length?(r=!0,t=+e[0],n=+e[1],i):r?[t,n]:null},i}var dCe=o((()=>{_z(),eB.prototype=Object.create(gz.prototype)}));function tB(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(i-n)/e.value;++s{}));function rB(e,t,n,r,i,a){for(var o=[],s=t.children,c,l,u=0,d=0,f=s.length,p,m,h=t.value,g,_,v,y,b,x,S;uv&&(v=l),S=g*g*x,y=Math.max(v/S,S/_),y>b){g-=l;break}b=y}o.push(c={value:g,dice:p{Gz(),nB(),iB=(1+Math.sqrt(5))/2,aB=(function e(t){function n(e,n,r,i,a){rB(t,e,n,r,i,a)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n})(iB)}));function fCe(){var e=aB,t=!1,n=1,r=1,i=[0],a=xz,o=xz,s=xz,c=xz,l=xz;function u(e){return e.x0=e.y0=0,e.x1=n,e.y1=r,e.eachBefore(d),i=[0],t&&e.eachBefore(Hz),e}function d(t){var n=i[t.depth],r=t.x0+n,u=t.y0+n,d=t.x1-n,f=t.y1-n;d{Uz(),oB(),bz(),Cz()}));function mCe(e,t,n,r,i){var a=e.children,o,s=a.length,c,l=Array(s+1);for(l[0]=c=o=0;o=t-1){var c=a[e];c.x0=r,c.y0=i,c.x1=o,c.y1=s;return}for(var d=l[e],f=n/2+d,p=e+1,m=t-1;p>>1;l[h]s-i){var v=n?(r*_+o*g)/n:o;u(e,p,g,r,i,v,s),u(p,t,_,v,i,o,s)}else{var y=n?(i*_+s*g)/n:s;u(e,p,g,r,i,o,y),u(p,t,_,r,y,o,s)}}}var hCe=o((()=>{}));function gCe(e,t,n,r,i){(e.depth&1?tB:Wz)(e,t,n,r,i)}var _Ce=o((()=>{Gz(),nB()})),sB,vCe=o((()=>{Gz(),nB(),oB(),sB=(function e(t){function n(e,n,r,i,a){if((o=e._squarify)&&o.ratio===t)for(var o,s,c,l,u=-1,d,f=o.length,p=e.value;++u1?t:1)},n})(iB)})),yCe=o((()=>{cSe(),_z(),QSe(),Rz(),Nz(),eCe(),iCe(),dCe(),pCe(),hCe(),Gz(),nB(),_Ce(),oB(),vCe()})),bCe=c({nest:()=>lB,pack:()=>dB,partition:()=>fB,stratify:()=>pB,tree:()=>mB,treelinks:()=>hB,treemap:()=>gB});function cB(e,t,n){let r={};return e.each(e=>{let i=e.data;n(i)&&(r[t(i)]=e)}),e.lookup=r,e}function lB(e){K.call(this,null,e)}function xCe(){let e=[],t={entries:e=>r(n(e,0),0),key:n=>(e.push(n),t)};function n(t,r){if(r>=e.length)return t;let i=t.length,a=e[r++],o={},s={},c=-1,l,u,d;for(;++ce.length)return t;let i=[];for(let e in t)i.push({key:e,values:r(t[e],n)});return i}return t}function uB(e){K.call(this,null,e)}function SCe(e,t,n){for(let r,i=0,a=t.length;i{eS(),Dg(),yCe(),lB.Definition={type:`Nest`,metadata:{treesource:!0,changes:!0},params:[{name:`keys`,type:`field`,array:!0},{name:`generate`,type:`boolean`}]},_B=e=>e.values,fg(lB,K,{transform(e,t){t.source||U(`Nest transform requires an upstream data source.`);var n=e.generate,r=e.modified(),i=t.clone(),a=this.value;return(!a||r||t.changed())&&(a&&a.each(e=>{e.children&&ax(e.data)&&i.rem.push(e.data)}),this.value=a=mz({values:Qh(e.keys).reduce((e,t)=>(e.key(t),e),xCe()).entries(i.source)},_B),n&&a.each(e=>{e.children&&(e=cx(e.data),i.add.push(e),i.source.push(e))}),cB(a,ox,ox)),i.source.root=a,i}}),vB=(e,t)=>e.parent===t.parent?1:2,fg(uB,K,{transform(e,t){(!t.source||!t.source.root)&&U(this.constructor.name+` transform requires a backing tree data source.`);let n=this.layout(e.method),r=this.fields,i=t.source.root,a=e.as||r;e.field?i.sum(e.field):i.count(),e.sort&&i.sort(fx(e.sort,e=>e.data)),SCe(n,this.params,e),n.separation&&n.separation(e.separation===!1?Th:vB);try{this.value=n(i)}catch(e){U(e)}return i.each(e=>CCe(e,r,a)),t.reflow(e.modified()).modifies(a).modifies(`leaf`)}}),yB=[`x`,`y`,`r`,`depth`,`children`],dB.Definition={type:`Pack`,metadata:{tree:!0,modifies:!0},params:[{name:`field`,type:`field`},{name:`sort`,type:`compare`},{name:`padding`,type:`number`,default:0},{name:`radius`,type:`field`,default:null},{name:`size`,type:`number`,array:!0,length:2},{name:`as`,type:`string`,array:!0,length:yB.length,default:yB}]},fg(dB,uB,{layout:ZSe,params:[`radius`,`size`,`padding`],fields:yB}),bB=[`x0`,`y0`,`x1`,`y1`,`depth`,`children`],fB.Definition={type:`Partition`,metadata:{tree:!0,modifies:!0},params:[{name:`field`,type:`field`},{name:`sort`,type:`compare`},{name:`padding`,type:`number`,default:0},{name:`round`,type:`boolean`,default:!1},{name:`size`,type:`number`,array:!0,length:2},{name:`as`,type:`string`,array:!0,length:bB.length,default:bB}]},fg(fB,uB,{layout:$Se,params:[`size`,`round`,`padding`],fields:bB}),pB.Definition={type:`Stratify`,metadata:{treesource:!0},params:[{name:`key`,type:`field`,required:!0},{name:`parentKey`,type:`field`,required:!0}]},fg(pB,K,{transform(e,t){t.source||U(`Stratify transform requires an upstream data source.`);let n=this.value,r=e.modified(),i=t.fork(t.ALL).materialize(t.SOURCE),a=!n||r||t.changed(t.ADD_REM)||t.modified(e.key.fields)||t.modified(e.parentKey.fields);return i.source=i.source.slice(),a&&(n=i.source.length?cB(Kz().id(e.key).parentId(e.parentKey)(i.source),e.key,Eh):cB(Kz()([{}]),e.key,e.key)),i.source.root=this.value=n,i}}),xB={tidy:uCe,cluster:sSe},SB=[`x`,`y`,`depth`,`children`],mB.Definition={type:`Tree`,metadata:{tree:!0,modifies:!0},params:[{name:`field`,type:`field`},{name:`sort`,type:`compare`},{name:`method`,type:`enum`,default:`tidy`,values:[`tidy`,`cluster`]},{name:`size`,type:`number`,array:!0,length:2},{name:`nodeSize`,type:`number`,array:!0,length:2},{name:`separation`,type:`boolean`,default:!0},{name:`as`,type:`string`,array:!0,length:SB.length,default:SB}]},fg(mB,uB,{layout(e){let t=e||`tidy`;if(cg(xB,t))return xB[t]();U(`Unrecognized Tree layout method: `+t)},params:[`size`,`nodeSize`],fields:SB}),hB.Definition={type:`TreeLinks`,metadata:{tree:!0,generates:!0,changes:!0},params:[]},fg(hB,K,{transform(e,t){let n=this.value,r=t.source&&t.source.root,i=t.fork(t.NO_SOURCE),a={};return r||U(`TreeLinks transform requires a tree data source.`),t.changed(t.ADD_REM)?(i.rem=n,t.visit(t.SOURCE,e=>a[ox(e)]=1),r.each(e=>{let t=e.data,n=e.parent&&e.parent.data;n&&a[ox(t)]&&a[ox(n)]&&i.add.push(cx({source:n,target:t}))}),this.value=i.add):t.changed(t.MOD)&&(t.visit(t.MOD,e=>a[ox(e)]=1),n.forEach(e=>{(a[ox(e.source)]||a[ox(e.target)])&&i.mod.push(e)})),i}}),CB={binary:mCe,dice:Wz,slice:tB,slicedice:gCe,squarify:aB,resquarify:sB},wB=[`x0`,`y0`,`x1`,`y1`,`depth`,`children`],gB.Definition={type:`Treemap`,metadata:{tree:!0,modifies:!0},params:[{name:`field`,type:`field`},{name:`sort`,type:`compare`},{name:`method`,type:`enum`,default:`squarify`,values:[`squarify`,`resquarify`,`binary`,`dice`,`slice`,`slicedice`]},{name:`padding`,type:`number`,default:0},{name:`paddingInner`,type:`number`,default:0},{name:`paddingOuter`,type:`number`,default:0},{name:`paddingTop`,type:`number`,default:0},{name:`paddingRight`,type:`number`,default:0},{name:`paddingBottom`,type:`number`,default:0},{name:`paddingLeft`,type:`number`,default:0},{name:`ratio`,type:`number`,default:1.618033988749895},{name:`round`,type:`boolean`,default:!1},{name:`size`,type:`number`,array:!0,length:2},{name:`as`,type:`string`,array:!0,length:wB.length,default:wB}]},fg(gB,uB,{layout(){let e=fCe();return e.ratio=t=>{let n=e.tile();n.ratio&&e.tile(n.ratio(t))},e.method=t=>{cg(CB,t)?e.tile(CB[t]):U(`Unrecognized Treemap layout method: `+t)},e},params:[`method`,`ratio`,`size`,`round`,`padding`,`paddingInner`,`paddingOuter`,`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`],fields:wB})})),TCe=c({label:()=>AB});function ECe(e,t){let n=e.bitmap();return(t||[]).forEach(t=>n.set(e(t.boundary[0]),e(t.boundary[3]))),[n,void 0]}function DCe(e,t,n,r,i){let a=e.width,o=e.height,s=r||i,c=PT(a,o).getContext(`2d`),l=PT(a,o).getContext(`2d`),u=s&&PT(a,o).getContext(`2d`);n.forEach(e=>EB(c,e,!1)),EB(l,t,!1),s&&EB(u,t,!0);let d=TB(c,a,o),f=TB(l,a,o),p=s&&TB(u,a,o),m=e.bitmap(),h=s&&e.bitmap(),g,_,v,y,b,x,S,C;for(_=0;_{t.items.forEach(t=>EB(e,t.items,n))}):xA[r].draw(e,{items:n?t.map(OCe):t})}function OCe(e){let t=ux(e,{});return t.stroke&&t.strokeOpacity!==0||t.fill&&t.fillOpacity!==0?{...t,strokeOpacity:1,stroke:`#000`,fillOpacity:0}:t}function kCe(e,t){let n=new Uint32Array(~~((e*t+PB)/PB));function r(e,t){n[e]|=t}function i(e,t){n[e]&=t}return{array:n,get:(t,r)=>{let i=r*e+t;return n[i>>>MB]&1<<(i&NB)},set:(t,n)=>{let i=n*e+t;r(i>>>MB,1<<(i&NB))},clear:(t,n)=>{let r=n*e+t;i(r>>>MB,~(1<<(r&NB)))},getRange:(t,r,i,a)=>{let o=a,s,c,l,u;for(;o>=r;--o)if(s=o*e+t,c=o*e+i,l=s>>>MB,u=c>>>MB,l===u){if(n[l]&FB[s&NB]&IB[(c&NB)+1])return!0}else{if(n[l]&FB[s&NB]||n[u]&IB[(c&NB)+1])return!0;for(let e=l+1;e{let o,s,c,l,u;for(;n<=a;++n)if(o=n*e+t,s=n*e+i,c=o>>>MB,l=s>>>MB,c===l)r(c,FB[o&NB]&IB[(s&NB)+1]);else for(r(c,FB[o&NB]),r(l,IB[(s&NB)+1]),u=c+1;u{let o,s,c,l,u;for(;n<=a;++n)if(o=n*e+t,s=n*e+r,c=o>>>MB,l=s>>>MB,c===l)i(c,IB[o&NB]|FB[(s&NB)+1]);else for(i(c,IB[o&NB]),i(l,FB[(s&NB)+1]),u=c+1;un<0||r<0||a>=t||i>=e}}function ACe(e,t,n){let r=Math.max(1,Math.sqrt(e*t/1e6)),i=~~((e+2*n+r)/r),a=~~((t+2*n+r)/r),o=e=>~~((e+n)/r);return o.invert=e=>e*r-n,o.bitmap=()=>kCe(i,a),o.ratio=r,o.padding=n,o.width=e,o.height=t,o}function jCe(e,t,n,r){let i=e.width,a=e.height;return function(e){let t=e.datum.datum.items[r].items,n=t.length,o=e.datum.fontSize,s=yA.width(e.datum,e.datum.text),c=0,l,u,d,f,p,m,h;for(let r=0;r=c&&(c=h,e.x=p,e.y=m);return p=s/2,m=o/2,l=e.x-p,u=e.x+p,d=e.y-m,f=e.y+m,e.align=`center`,l<0&&u<=i?e.align=`left`:0<=l&&ii||t-(o=r/2)<0||t+o>a}function OB(e,t,n,r,i,a,o,s){let c=i*a/(r*2),l=e(t-c),u=e(t+c),d=e(n-(a/=2)),f=e(n+a);return o.outOfBounds(l,d,u,f)||o.getRange(l,d,u,f)||s&&s.getRange(l,d,u,f)}function MCe(e,t,n,r){let i=e.width,a=e.height,o=t[0],s=t[1];function c(t,n,r,c,l){let u=e.invert(t),d=e.invert(n),f=r,p=a,m;if(!DB(u,d,c,l,i,a)&&!OB(e,u,d,l,c,f,o,s)&&!OB(e,u,d,l,c,l,o,null)){for(;p-f>=1;)m=(f+p)/2,OB(e,u,d,l,c,m,o,s)?p=m:f=m;if(f>r)return[u,d,f,!0]}}return function(t){let s=t.datum.datum.items[r].items,l=s.length,u=t.datum.fontSize,d=yA.width(t.datum,t.datum.text),f=n?u:0,p=!1,m=!1,h=0,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M;for(let r=0;r_&&(M=g,g=_,_=M),v>y&&(M=v,v=y,y=M),w=e(g),E=e(_),T=~~((w+E)/2),D=e(v),k=e(y),O=~~((D+k)/2),S=T;S>=w;--S)for(C=O;C>=D;--C)j=c(S,C,f,d,u),j&&([t.x,t.y,f,p]=j);for(S=T;S<=E;++S)for(C=O;C<=k;++C)j=c(S,C,f,d,u),j&&([t.x,t.y,f,p]=j);!p&&!n&&(A=Math.abs(_-g+y-v),b=(g+_)/2,x=(v+y)/2,A>=h&&!DB(b,x,d,u,i,a)&&!OB(e,b,x,u,d,u,o,null)&&(h=A,t.x=b,t.y=x,m=!0))}return p||m?(b=d/2,x=u/2,o.setRange(e(t.x-b),e(t.y-x),e(t.x+b),e(t.y+x)),t.align=`center`,t.baseline=`middle`,!0):!1}}function NCe(e,t,n,r){let i=e.width,a=e.height,o=t[0],s=t[1],c=e.bitmap();return function(t){let l=t.datum.datum.items[r].items,u=l.length,d=t.datum.fontSize,f=yA.width(t.datum,t.datum.text),p=[],m=n?d:0,h=!1,g=!1,_=0,v,y,b,x,S,C,w,T,E,D,O,k;for(let r=0;r=1;)O=(E+D)/2,OB(e,S,C,d,f,O,o,s)?D=O:E=O;E>m&&(t.x=S,t.y=C,m=E,h=!0)}}!h&&!n&&(k=Math.abs(y-v+x-b),S=(v+y)/2,C=(b+x)/2,k>=_&&!DB(S,C,f,d,i,a)&&!OB(e,S,C,d,f,d,o,null)&&(_=k,t.x=S,t.y=C,g=!0))}return h||g?(S=f/2,C=d/2,o.setRange(e(t.x-S),e(t.y-C),e(t.x+S),e(t.y+C)),t.align=`center`,t.baseline=`middle`,!0):!1}}function PCe(e,t,n,r){let i=e.width,a=e.height,o=t[0],s=t[1],c=r.length;return function(t){let l=t.boundary,u=t.datum.fontSize;if(l[2]<0||l[5]<0||l[0]>i||l[3]>a)return!1;let d=t.textWidth??0,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E;for(let i=0;i>>2&3)-1,m=f===0&&p===0||r[i]<0,h=f&&p?Math.SQRT1_2:1,g=r[i]<0?-1:1,_=l[1+f]+r[i]*f*h,S=l[4+p]+g*u*p/2+r[i]*p*h,y=S-u/2,b=S+u/2,C=e(_),T=e(y),E=e(b),!d)if(kB(C,C,T,E,o,s,_,_,y,b,l,m))d=yA.width(t.datum,t.datum.text);else continue;if(x=_+g*d*f/2,_=x-d/2,v=x+d/2,C=e(_),w=e(v),kB(C,w,T,E,o,s,_,v,y,b,l,m))return t.x=f?f*g<0?v:_:x,t.y=p?p*g<0?b:y:S,t.align=zB[f*g+1],t.baseline=BB[p*g+1],o.setRange(C,T,w,E),!0}return!1}}function kB(e,t,n,r,i,a,o,s,c,l,u,d){return!(i.outOfBounds(e,n,t,r)||(d&&a||i).getRange(e,n,t,r))}function FCe(e,t,n,r,i,a,o,s,c,l,u){if(!e.length)return e;let d=Math.max(r.length,i.length),f=ICe(r,d),p=LCe(i,d),m=RCe(e[0].datum),h=m===`group`&&e[0].datum.items[c].marktype,g=h===`area`,_=zCe(m,h,s,c),v=l===null||l===1/0,y=g&&u===`naive`,b=-1,x=-1,S=e.map(e=>{let t=v?yA.width(e,e.text):void 0;return b=Math.max(b,t),x=Math.max(x,e.fontSize),{datum:e,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:_(e),textWidth:t}});l=l===null||l===1/0?Math.max(b,x)+Math.max(...r):l;let C=ACe(t[0],t[1],l),w;if(!y){n&&S.sort((e,t)=>n(e.datum,t.datum));let t=!1;for(let e=0;ee.datum);w=a.length||r?DCe(C,r||[],a,t,g):ECe(C,o&&S)}let T=g?HB[u](C,w,o,c):PCe(C,w,p,f);return S.forEach(e=>e.opacity=+T(e)),S}function ICe(e,t){let n=new Float64Array(t),r=e.length;for(let t=0;t[e.x,e.x,e.x,e.y,e.y,e.y];return e?e===`line`||e===`area`?e=>i(e.datum):t===`line`?e=>{let t=e.datum.items[r].items;return i(t.length?t[n===`start`?0:t.length-1]:{x:NaN,y:NaN})}:e=>{let t=e.datum.bounds;return[t.x1,(t.x1+t.x2)/2,t.x2,t.y1,(t.y1+t.y2)/2,t.y2]}:i}function AB(e){K.call(this,null,e)}var jB,MB,NB,PB,FB,IB,LB,RB,zB,BB,VB,HB,UB,WB,BCe=o((()=>{Ij(),IT(),eS(),Dg(),jB=4278190080,MB=5,NB=31,PB=32,FB=new Uint32Array(33),IB=new Uint32Array(33),IB[0]=0,FB[0]=~IB[0];for(let e=1;e<=PB;++e)IB[e]=IB[e-1]<<1|1,FB[e]=~IB[e];LB=[-1,-1,1,1],RB=[-1,1,-1,1],zB=[`right`,`center`,`left`],BB=[`bottom`,`middle`,`top`],VB={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},HB={naive:jCe,"reduced-search":MCe,floodfill:NCe},UB=[`x`,`y`,`opacity`,`align`,`baseline`],WB=[`top-left`,`left`,`bottom-left`,`top`,`bottom`,`top-right`,`right`,`bottom-right`],AB.Definition={type:`Label`,metadata:{modifies:!0},params:[{name:`size`,type:`number`,array:!0,length:2,required:!0},{name:`sort`,type:`compare`},{name:`anchor`,type:`string`,array:!0,default:WB},{name:`offset`,type:`number`,array:!0,default:[1]},{name:`padding`,type:`number`,default:0,null:!0},{name:`lineAnchor`,type:`string`,values:[`start`,`end`],default:`end`},{name:`markIndex`,type:`number`,default:0},{name:`avoidBaseMark`,type:`boolean`,default:!0},{name:`avoidMarks`,type:`data`,array:!0},{name:`method`,type:`string`,default:`naive`},{name:`as`,type:`string`,array:!0,length:UB.length,default:UB}]},fg(AB,K,{transform(e,t){function n(n){let r=e[n];return eg(r)&&t.modified(r.fields)}let r=e.modified();if(!(r||t.changed(t.ADD_REM)||n(`sort`)))return;(!e.size||e.size.length!==2)&&U(`Size parameter should be specified as a [width, height] array.`);let i=e.as||UB;return FCe(t.materialize(t.SOURCE).source||[],e.size,e.sort,Qh(e.offset==null?1:e.offset),Qh(e.anchor||WB),e.avoidMarks||[],e.avoidBaseMark!==!1,e.lineAnchor||`end`,e.markIndex||0,e.padding===void 0?0:e.padding,e.method||`naive`).forEach(e=>{let t=e.datum;t[i[0]]=e.x,t[i[1]]=e.y,t[i[2]]=e.opacity,t[i[3]]=e.align,t[i[4]]=e.baseline}),t.reflow(r).modifies(i)}})})),VCe=c({loess:()=>KB,regression:()=>qB});function GB(e,t){var n=[],r=function(e){return e(s)},i,a,o,s,c,l;if(t==null)n.push(e);else for(i={},a=0,o=e.length;a{GS(),eS(),Dg(),KB.Definition={type:`Loess`,metadata:{generates:!0},params:[{name:`x`,type:`field`,required:!0},{name:`y`,type:`field`,required:!0},{name:`groupby`,type:`field`,array:!0},{name:`bandwidth`,type:`number`,default:.3},{name:`as`,type:`string`,array:!0}]},fg(KB,K,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){let r=t.materialize(t.SOURCE).source,i=GB(r,e.groupby),a=(e.groupby||[]).map(uh),o=a.length,s=e.as||[uh(e.x),uh(e.y)],c=[];i.forEach(t=>{IS(t,e.x,e.y,e.bandwidth||.3).forEach(e=>{let n={};for(let e=0;ee===`poly`?t:e===`quad`?2:1,qB.Definition={type:`Regression`,metadata:{generates:!0},params:[{name:`x`,type:`field`,required:!0},{name:`y`,type:`field`,required:!0},{name:`groupby`,type:`field`,array:!0},{name:`method`,type:`string`,default:`linear`,values:Object.keys(JB)},{name:`order`,type:`number`,default:3},{name:`extent`,type:`number`,array:!0,length:2},{name:`params`,type:`boolean`,default:!1},{name:`as`,type:`string`,array:!0}]},fg(qB,K,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){let r=t.materialize(t.SOURCE).source,i=GB(r,e.groupby),a=(e.groupby||[]).map(uh),o=e.method||`linear`,s=e.order==null?3:e.order,c=YB(o,s),l=e.as||[uh(e.x),uh(e.y)],u=JB[o],d=[],f=e.extent;cg(JB,o)||U(`Invalid regression method: `+o),f!=null&&o===`log`&&f[0]<=0&&(t.dataflow.warn(`Ignoring extent with values <= 0 for log regression.`),f=null),i.forEach(n=>{if(n.length<=c){t.dataflow.warn(`Skipping regression with more parameters than data points.`);return}let r=u(n,e.x,e.y,s);if(e.params){d.push(cx({keys:n.dims,coef:r.coef,rSquared:r.rSquared}));return}let i=f||sg(n,e.x),p=e=>{let t={};for(let e=0;ep([e,r.predict(e)])):LS(r.predict,i,25,200).forEach(p)}),this.value&&(n.rem=this.value),this.value=n.add=n.source=d}return n}})}));function XB(e,t,n,r,i){let a,o,s,c,l=t[0],u=r[0],d=0,f=0;u>l==u>-l?(a=l,l=t[++d]):(a=u,u=r[++f]);let p=0;if(dl==u>-l?(o=l+a,s=a-(o-l),l=t[++d]):(o=u+a,s=a-(o-u),u=r[++f]),a=o,s!==0&&(i[p++]=s);dl==u>-l?(o=a+l,c=o-a,s=a-(o-c)+(l-c),l=t[++d]):(o=a+u,c=o-a,s=a-(o-c)+(u-c),u=r[++f]),a=o,s!==0&&(i[p++]=s);for(;d{ZB=11102230246251565e-32,QB=134217729,$B=3.000000000000001*ZB}));function WCe(e,t,n,r,i,a,o){let s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T=e-i,E=n-i,D=t-a,O=r-a;b=T*O,f=QB*T,p=f-(f-T),m=T-p,f=QB*O,h=f-(f-O),g=O-h,x=m*g-(b-p*h-m*h-p*g),S=D*E,f=QB*D,p=f-(f-D),m=D-p,f=QB*E,h=f-(f-E),g=E-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,aV[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,aV[1]=y-(_+d)+(d-S),w=v+_,d=w-v,aV[2]=v-(w-d)+(_-d),aV[3]=w;let k=UCe(4,aV),A=rV*o;if(k>=A||-k>=A||(d=e-T,s=e-(T+d)+(d-i),d=n-E,l=n-(E+d)+(d-i),d=t-D,c=t-(D+d)+(d-a),d=r-O,u=r-(O+d)+(d-a),s===0&&c===0&&l===0&&u===0)||(A=iV*o+$B*Math.abs(k),k+=T*u+O*s-(D*l+E*c),k>=A||-k>=A))return k;b=s*O,f=QB*s,p=f-(f-s),m=s-p,f=QB*O,h=f-(f-O),g=O-h,x=m*g-(b-p*h-m*h-p*g),S=c*E,f=QB*c,p=f-(f-c),m=c-p,f=QB*E,h=f-(f-E),g=E-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,lV[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,lV[1]=y-(_+d)+(d-S),w=v+_,d=w-v,lV[2]=v-(w-d)+(_-d),lV[3]=w;let j=XB(4,aV,4,lV,oV);b=T*u,f=QB*T,p=f-(f-T),m=T-p,f=QB*u,h=f-(f-u),g=u-h,x=m*g-(b-p*h-m*h-p*g),S=D*l,f=QB*D,p=f-(f-D),m=D-p,f=QB*l,h=f-(f-l),g=l-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,lV[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,lV[1]=y-(_+d)+(d-S),w=v+_,d=w-v,lV[2]=v-(w-d)+(_-d),lV[3]=w;let M=XB(j,oV,4,lV,sV);b=s*u,f=QB*s,p=f-(f-s),m=s-p,f=QB*u,h=f-(f-u),g=u-h,x=m*g-(b-p*h-m*h-p*g),S=c*l,f=QB*c,p=f-(f-c),m=c-p,f=QB*l,h=f-(f-l),g=l-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,lV[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,lV[1]=y-(_+d)+(d-S),w=v+_,d=w-v,lV[2]=v-(w-d)+(_-d),lV[3]=w;let N=XB(M,sV,4,lV,cV);return cV[N-1]}function tV(e,t,n,r,i,a){let o=(t-a)*(n-i),s=(e-i)*(r-a),c=o-s,l=Math.abs(o+s);return Math.abs(c)>=nV*l?c:-WCe(e,t,n,r,i,a,l)}var nV,rV,iV,aV,oV,sV,cV,lV,GCe=o((()=>{eV(),nV=(3+16*ZB)*ZB,rV=(2+12*ZB)*ZB,iV=(9+64*ZB)*ZB*ZB,aV=q(4),oV=q(8),sV=q(12),cV=q(16),lV=q(4)})),KCe=o((()=>{eV(),(7+56*ZB)*ZB,(3+28*ZB)*ZB,(26+288*ZB)*ZB*ZB,q(4),q(4),q(4),q(4),q(4),q(4),q(4),q(4),q(4),q(8),q(8),q(8),q(4),q(8),q(8),q(16),q(12),q(192),q(192)})),qCe=o((()=>{eV(),(10+96*ZB)*ZB,(4+48*ZB)*ZB,(44+576*ZB)*ZB*ZB,q(4),q(4),q(4),q(4),q(4),q(4),q(4),q(4),q(8),q(8),q(8),q(8),q(8),q(8),q(8),q(8),q(8),q(4),q(4),q(4),q(8),q(16),q(16),q(16),q(32),q(32),q(48),q(64),q(1152),q(1152)})),JCe=o((()=>{eV(),(16+224*ZB)*ZB,(5+72*ZB)*ZB,(71+1408*ZB)*ZB*ZB,q(4),q(4),q(4),q(4),q(4),q(4),q(4),q(4),q(4),q(4),q(24),q(24),q(24),q(24),q(24),q(24),q(24),q(24),q(24),q(24),q(1152),q(1152),q(1152),q(1152),q(1152),q(2304),q(2304),q(3456),q(5760),q(8),q(8),q(8),q(16),q(24),q(48),q(48),q(96),q(192),q(384),q(384),q(384),q(768),q(96),q(96),q(96),q(1152)})),YCe=o((()=>{GCe(),KCe(),qCe(),JCe()}));function XCe(e,t){let n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function uV(e,t,n,r){let i=e-n,a=t-r;return i*i+a*a}function ZCe(e,t,n,r,i,a,o,s){let c=e-o,l=t-s,u=n-o,d=r-s,f=i-o,p=a-s,m=c*c+l*l,h=u*u+d*d,g=f*f+p*p;return c*(d*g-h*p)-l*(u*g-h*f)+m*(u*p-d*f)<0}function QCe(e,t,n,r,i,a){let o=n-e,s=r-t,c=i-e,l=a-t,u=o*o+s*s,d=c*c+l*l,f=.5/(o*l-s*c),p=(l*u-s*d)*f,m=(o*d-c*u)*f;return p*p+m*m}function $Ce(e,t,n,r,i,a){let o=n-e,s=r-t,c=i-e,l=a-t,u=o*o+s*s,d=c*c+l*l,f=.5/(o*l-s*c);return{x:e+(l*u-s*d)*f,y:t+(o*d-c*u)*f}}function dV(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){let r=e[i],a=t[r],o=i-1;for(;o>=n&&t[e[o]]>a;)e[o+1]=e[o--];e[o+1]=r}else{let i=n+r>>1,a=n+1,o=r;fV(e,i,a),t[e[n]]>t[e[r]]&&fV(e,n,r),t[e[a]]>t[e[r]]&&fV(e,a,r),t[e[n]]>t[e[a]]&&fV(e,n,a);let s=e[a],c=t[s];for(;;){do a++;while(t[e[a]]c);if(o=o-n?(dV(e,t,a,r),dV(e,t,n,o-1)):(dV(e,t,n,o-1),dV(e,t,a,r))}}function fV(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function ewe(e){return e[0]}function twe(e){return e[1]}var pV,mV,hV,nwe=o((()=>{YCe(),pV=2**-52,mV=new Uint32Array(512),hV=class e{static from(t,n=ewe,r=twe){let i=t.length,a=new Float64Array(i*2);for(let e=0;e>1;if(t>0&&typeof e[0]!=`number`)throw Error(`Expected coords to contain numbers.`);this.coords=e;let n=Math.max(2*t-5,0);this._triangles=new Uint32Array(n*3),this._halfedges=new Int32Array(n*3),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.trianglesLen=0,this._cx=0,this._cy=0,this._hullStart=0,this.hull=this._triangles,this.triangles=this._triangles,this.halfedges=this._halfedges,this.update()}update(){let{coords:e,_hullPrev:t,_hullNext:n,_hullTri:r,_hullHash:i}=this,a=e.length>>1,o=1/0,s=1/0,c=-1/0,l=-1/0;for(let t=0;tc&&(c=n),r>l&&(l=r),this._ids[t]=t}let u=(o+c)/2,d=(s+l)/2,f=0,p=0,m=0;for(let t=0,n=1/0;t0&&(p=t,n=r)}let _=e[2*p],v=e[2*p+1],y=1/0;for(let t=0;tr&&(t[n++]=i,r=a)}this.hull=t.subarray(0,n),this.triangles=new Uint32Array,this.halfedges=new Int32Array;return}if(tV(h,g,_,v,b,x)<0){let e=p,t=_,n=v;p=m,_=b,v=x,m=e,b=t,x=n}let S=$Ce(h,g,_,v,b,x);this._cx=S.x,this._cy=S.y;for(let t=0;t0&&Math.abs(l-o)<=pV&&Math.abs(u-s)<=pV||(o=l,s=u,c===f||c===p||c===m))continue;let d=0;for(let e=0,t=this._hashKey(l,u);e=0;)if(h=g,h===d){h=-1;break}if(h===-1)continue;let _=this._addTriangle(h,c,n[h],-1,-1,r[h]);r[c]=this._legalize(_+2),r[h]=_,C++;let v=n[h];for(;g=n[v],tV(l,u,e[2*v],e[2*v+1],e[2*g],e[2*g+1])<0;)_=this._addTriangle(v,c,g,r[c],-1,r[v]),r[c]=this._legalize(_+2),n[v]=v,C--,v=g;if(h===d)for(;g=t[h],tV(l,u,e[2*g],e[2*g+1],e[2*h],e[2*h+1])<0;)_=this._addTriangle(g,c,h,-1,r[h],r[g]),this._legalize(_+2),r[g]=_,n[h]=h,C--,h=g;this._hullStart=t[c]=h,n[h]=t[v]=c,n[c]=v,i[this._hashKey(l,u)]=c,i[this._hashKey(e[2*h],e[2*h+1])]=h}this.hull=new Uint32Array(C);for(let e=0,t=this._hullStart;e{gV=1e-6,_V=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=``}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+=`Z`)}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){e=+e,t=+t,n=+n;let r=e+n,i=t;if(n<0)throw Error(`negative radius`);this._x1===null?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>gV||Math.abs(this._y1-i)>gV)&&(this._+=`L`+r+`,`+i),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(e,t,n,r){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}})),yV,bV=o((()=>{yV=class{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}}})),xV,SV=o((()=>{vV(),bV(),xV=class{constructor(e,[t,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(t=+t))||!((i=+i)>=(n=+n)))throw Error(`invalid bounds`);this.delaunay=e,this._circumcenters=new Float64Array(e.points.length*2),this.vectors=new Float64Array(e.points.length*2),this.xmax=r,this.xmin=t,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:e,hull:t,triangles:n},vectors:r}=this,i,a,o=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let r=0,s=0,c=n.length,l,u;r1;)i-=2;for(let e=2;e0){if(t>=this.ymax)return null;(a=(this.ymax-t)/r)0){if(e>=this.xmax)return null;(a=(this.xmax-e)/n)this.xmax?2:0)|(tthis.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t1e-10)return!1}return!0}function owe(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}function swe(e,t,n,r){let i=e.length,a=new Float64Array(i*2);for(let o=0;o{nwe(),vV(),bV(),SV(),CV=2*Math.PI,wV=Math.pow,TV=class e{static from(t,n=rwe,r=iwe,i){return new e(`length`in t?swe(t,n,r,i):Float64Array.from(cwe(t,n,r,i)))}constructor(e){this._delaunator=new hV(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&awe(e)){this.collinear=Int32Array.from({length:t.length/2},(e,t)=>t).sort((e,n)=>t[2*e]-t[2*n]||t[2*e+1]-t[2*n+1]);let e=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[t[2*e],t[2*e+1],t[2*n],t[2*n+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let e=0,n=t.length/2;e0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],a[r[0]]=1,r.length===2&&(a[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(e){return new xV(this,e)}*neighbors(e){let{inedges:t,hull:n,_hullIndex:r,halfedges:i,triangles:a,collinear:o}=this;if(o){let t=o.indexOf(e);t>0&&(yield o[t-1]),t=0&&i!==n&&i!==r;)n=i;return i}_step(e,t,n){let{inedges:r,hull:i,_hullIndex:a,halfedges:o,triangles:s,points:c}=this;if(r[e]===-1||!c.length)return(e+1)%(c.length>>1);let l=e,u=wV(t-c[e*2],2)+wV(n-c[e*2+1],2),d=r[e],f=d;do{let r=s[f],d=wV(t-c[r*2],2)+wV(n-c[r*2+1],2);if(d{lwe(),SV()})),dwe=c({voronoi:()=>EV});function EV(e){K.call(this,null,e)}function fwe(e){let t=e[0][0],n=e[0][1],r=e.length-1;for(;e[r][0]===t&&e[r][1]===n;--r);return`M`+e.slice(0,r+1).join(`L`)+`Z`}function pwe(e){return e.length===2&&e[0][0]===e[1][0]&&e[0][1]===e[1][1]}var DV,mwe=o((()=>{eS(),Dg(),uwe(),EV.Definition={type:`Voronoi`,metadata:{modifies:!0},params:[{name:`x`,type:`field`,required:!0},{name:`y`,type:`field`,required:!0},{name:`size`,type:`number`,array:!0,length:2},{name:`extent`,type:`array`,array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:`number`,array:!0,length:2}},{name:`as`,type:`string`,default:`path`}]},DV=[-1e5,-1e5,1e5,1e5],fg(EV,K,{transform(e,t){let n=e.as||`path`,r=t.source;if(!r||!r.length)return t;let i=e.size;i=i?[0,0,i[0],i[1]]:(i=e.extent)?[i[0][0],i[0][1],i[1][0],i[1][1]]:DV;let a=this.value=TV.from(r,e.x,e.y).voronoi(i);for(let e=0,t=r.length;eAV});function gwe(){var e=[256,256],t,n,r,i,a,o,s,c=OV,l=[],u=Math.random,d={};d.layout=function(){for(var c=f(PT()),d=Swe((e[0]>>5)*e[1]),m=null,h=l.length,g=-1,_=[],v=l.map(e=>({text:t(e),font:n(e),style:i(e),weight:a(e),rotate:o(e),size:~~(r(e)+1e-14),padding:s(e),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:e})).sort((e,t)=>t.size-e.size);++g>1,y.y=e[1]*(u()+.5)>>1,_we(c,y,v,g),y.hasText&&p(d,y,m)&&(_.push(y),m?ywe(m,y):m=[{x:y.x+y.x0,y:y.y+y.y0},{x:y.x+y.x1,y:y.y+y.y1}],y.x-=e[0]>>1,y.y-=e[1]>>1)}return _};function f(e){e.width=e.height=1;var t=Math.sqrt(e.getContext(`2d`).getImageData(0,0,1,1).data.length>>2);e.width=(MV<<5)/t,e.height=NV/t;var n=e.getContext(`2d`);return n.fillStyle=n.strokeStyle=`red`,n.textAlign=`center`,{context:n,ratio:t}}function p(t,n,r){for(var i=n.x,a=n.y,o=Math.hypot(e[0],e[1]),s=c(e),l=u()<.5?1:-1,d=-l,f,p,m;(f=s(d+=l))&&(p=~~f[0],m=~~f[1],!(Math.min(Math.abs(p),Math.abs(m))>=o));)if(n.x=i+p,n.y=a+m,!(n.x+n.x0<0||n.y+n.y0<0||n.x+n.x1>e[0]||n.y+n.y1>e[1])&&(!r||!vwe(n,t,e[0]))&&(!r||bwe(n,r))){for(var h=n.sprite,g=n.width>>5,_=e[0]>>5,v=n.x-(g<<4),y=v&127,b=32-y,x=n.y1-n.y0,S=(n.y+n.y0)*_+(v>>5),C,w=0;w>>y:0);S+=_}return n.sprite=null,!0}return!1}return d.words=function(e){return arguments.length?(l=e,d):l},d.size=function(t){return arguments.length?(e=[+t[0],+t[1]],d):e},d.font=function(e){return arguments.length?(n=kV(e),d):n},d.fontStyle=function(e){return arguments.length?(i=kV(e),d):i},d.fontWeight=function(e){return arguments.length?(a=kV(e),d):a},d.rotate=function(e){return arguments.length?(o=kV(e),d):o},d.text=function(e){return arguments.length?(t=kV(e),d):t},d.spiral=function(e){return arguments.length?(c=PV[e]||e,d):c},d.fontSize=function(e){return arguments.length?(r=kV(e),d):r},d.padding=function(e){return arguments.length?(s=kV(e),d):s},d.random=function(e){return arguments.length?(u=e,d):u},d}function _we(e,t,n,r){if(!t.sprite){var i=e.context,a=e.ratio;i.clearRect(0,0,(MV<<5)/a,NV/a);var o=0,s=0,c=0,l=n.length,u,d,f,p,m;for(--r;++r>5<<5,f=~~Math.max(Math.abs(v+y),Math.abs(v-y))}else u=u+31>>5<<5;if(f>c&&(c=f),o+u>=MV<<5&&(o=0,s+=c,c=0),s+f>=NV)break;i.translate((o+(u>>1))/a,(s+(f>>1))/a),t.rotate&&i.rotate(t.rotate*jV),i.fillText(t.text,0,0),t.padding&&(i.lineWidth=2*t.padding,i.strokeText(t.text,0,0)),i.restore(),t.width=u,t.height=f,t.xoff=o,t.yoff=s,t.x1=u>>1,t.y1=f>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,o+=u}for(var x=i.getImageData(0,0,(MV<<5)/a,NV/a).data,S=[];--r>=0;)if(t=n[r],t.hasText){for(u=t.width,d=u>>5,f=t.y1-t.y0,p=0;p>5),E=x[(s+m)*(MV<<5)+(o+p)<<2]?1<<31-p%32:0;S[T]|=E,C|=E}C?w=m:(t.y0++,f--,m--,s++)}t.y1=t.y0+w,t.sprite=S.slice(0,(t.y1-t.y0)*d)}}}function vwe(e,t,n){n>>=5;for(var r=e.sprite,i=e.width>>5,a=e.x-(i<<4),o=a&127,s=32-o,c=e.y1-e.y0,l=(e.y+e.y0)*n+(a>>5),u,d=0;d>>o:0))&t[l+f])return!0;l+=n}return!1}function ywe(e,t){var n=e[0],r=e[1];t.x+t.x0r.x&&(r.x=t.x+t.x1),t.y+t.y1>r.y&&(r.y=t.y+t.y1)}function bwe(e,t){return e.x+e.x1>t[0].x&&e.x+e.x0t[0].y&&e.y+e.y0{IT(),eS(),Dg(),vO(),GS(),jV=Math.PI/180,MV=64,NV=2048,PV={archimedean:OV,rectangular:xwe},FV=[`x`,`y`,`font`,`fontSize`,`fontStyle`,`fontWeight`,`angle`],IV=[`text`,`font`,`rotate`,`fontSize`,`fontStyle`,`fontWeight`],AV.Definition={type:`Wordcloud`,metadata:{modifies:!0},params:[{name:`size`,type:`number`,array:!0,length:2},{name:`font`,type:`string`,expr:!0,default:`sans-serif`},{name:`fontStyle`,type:`string`,expr:!0,default:`normal`},{name:`fontWeight`,type:`string`,expr:!0,default:`normal`},{name:`fontSize`,type:`number`,expr:!0,default:14},{name:`fontSizeRange`,type:`number`,array:`nullable`,default:[10,50]},{name:`rotate`,type:`number`,expr:!0,default:0},{name:`text`,type:`field`},{name:`spiral`,type:`string`,values:[`archimedean`,`rectangular`]},{name:`padding`,type:`number`,expr:!0},{name:`as`,type:`string`,array:!0,length:7,default:FV}]},fg(AV,K,{transform(e,t){e.size&&!(e.size[0]&&e.size[1])&&U(`Wordcloud size dimensions must be non-zero.`);function n(n){let r=e[n];return eg(r)&&t.modified(r.fields)}let r=e.modified();if(!(r||t.changed(t.ADD_REM)||IV.some(n)))return;let i=t.materialize(t.SOURCE).source,a=this.value,o=e.as||FV,s=e.fontSize||14,c;if(eg(s)?c=e.fontSizeRange:s=ig(s),c){let e=s,t=VD(`sqrt`)().domain(sg(i,e)).range(c);s=n=>t(e(n))}i.forEach(e=>{e[o[0]]=NaN,e[o[1]]=NaN,e[o[3]]=0});let l=a.words(i).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||`archimedean`).rotate(e.rotate||0).font(e.font||`sans-serif`).fontStyle(e.fontStyle||`normal`).fontWeight(e.fontWeight||`normal`).fontSize(s).random(RS).layout(),u=a.size(),d=u[0]>>1,f=u[1]>>1,p=l.length;for(let e=0,t,n;eBV,resolvefilter:()=>VV});function Twe(){let e=8,t=[],n=WV(0),r=LV(0,e),i=LV(0,e);return{data:()=>t,seen:()=>n=Ewe(n,t.length),add(e){for(let n=0,r=t.length,i=e.length,a;nt.length,curr:()=>r,prev:()=>i,reset:e=>i[e]=r[e],all:()=>e<257?255:e<65537?65535:4294967295,set(e,t){r[e]|=t},clear(e,t){r[e]&=~t},resize(t,n){(t>r.length||n>e)&&(e=Math.max(n,e),r=LV(t,e,r),i=LV(t,e))}}}function Ewe(e,t,n){return e.length>=t?e:(n||=new e.constructor(t),n.set(e),n)}function LV(e,t,n){let r=(t<257?HV:t<65537?UV:WV)(e);return n&&r.set(n),r}function RV(e,t,n){let r=1<0)for(f=0;fe,size:()=>n}}function Dwe(e,t){return e.sort.call(t,(t,n)=>{let r=e[t],i=e[n];return ri)}),qoe(e,t)}function Owe(e,t,n,r,i,a,o,s,c){let l=0,u=0,d;for(d=0;l{e_(),eS(),Dg(),HV=e=>new Uint8Array(e),UV=e=>new Uint16Array(e),WV=e=>new Uint32Array(e),BV.Definition={type:`CrossFilter`,metadata:{},params:[{name:`fields`,type:`field`,array:!0,required:!0},{name:`query`,type:`array`,array:!0,required:!0,content:{type:`number`,array:!0,length:2}}]},fg(BV,K,{transform(e,t){return this._dims?e.modified(`fields`)||e.fields.some(e=>t.modified(e.fields))?this.reinit(e,t):this.eval(e,t):this.init(e,t)},init(e,t){let n=e.fields,r=e.query,i=this._indices={},a=this._dims=[],o=r.length,s=0,c,l;for(;s{let e=i.remove(t,n);for(let t in r)r[t].reindex(e)})},update(e,t,n){let r=this._dims,i=e.query,a=t.stamp,o=r.length,s=0,c,l;for(n.filters=0,l=0;lp)for(g=p,_=Math.min(d,m);g<_;++g)v=c[g],a[v]!==n&&(s[v]=o[v],a[v]=n,r.push(v)),o[v]^=h;if(f>m)for(g=Math.max(d,m),_=f;g<_;++g)v=c[g],a[v]!==n&&(s[v]=o[v],a[v]=n,r.push(v)),o[v]^=h;else if(fu)for(p=u,m=Math.min(c,d);pd)for(p=Math.max(c,d),m=l;ps[e]&n?null:o[e];return a.filter(a.MOD,l),i&i-1?(a.filter(a.ADD,e=>{let t=s[e]&n;return!t&&t^c[e]&n?o[e]:null}),a.filter(a.REM,e=>{let t=s[e]&n;return t&&!(t^(t^c[e]&n))?o[e]:null})):(a.filter(a.ADD,l),a.filter(a.REM,e=>(s[e]&n)===i?o[e]:null)),a.filter(a.SOURCE,e=>l(e._index))}})}));function GV(e){this.type=e}function Awe(e){switch(e.type){case AH:return e.elements;case jH:case PH:return[e.left,e.right];case MH:return[e.callee].concat(e.arguments);case NH:return[e.test,e.consequent,e.alternate];case FH:return[e.object,e.property];case IH:return e.properties;case OH:return[e.key,e.value];case LH:return[e.argument];case kH:case DH:case EH:default:return[]}}function KV(e,t){if(!e)throw Error(`ASSERT: `+t)}function qV(e){return e>=48&&e<=57}function JV(e){return`0123456789abcdefABCDEF`.includes(e)}function YV(e){return`01234567`.includes(e)}function jwe(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e)}function XV(e){return e===10||e===13||e===8232||e===8233}function ZV(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&bU.test(String.fromCharCode(e))}function QV(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&xU.test(String.fromCharCode(e))}function $V(){for(;J1114111||e!==`}`)&&fH({},cU,vU),t<=65535?String.fromCharCode(t):(n=(t-65536>>10)+55296,r=(t-65536&1023)+56320,String.fromCharCode(n,r))}function tH(){var e=zH.charCodeAt(J++),t=String.fromCharCode(e);for(e===92&&(zH.charCodeAt(J)!==117&&fH({},cU,vU),++J,e=eH(`u`),(!e||e===`\\`||!ZV(e.charCodeAt(0)))&&fH({},cU,vU),t=e);J>>=`)return J+=4,{type:JH,value:o,start:e,end:J};if(a=o.substr(0,3),a===`>>>`||a===`<<=`||a===`>>=`)return J+=3,{type:JH,value:a,start:e,end:J};if(i=a.substr(0,2),r===i[1]&&`+-<>&|`.includes(r)||i===`=>`)return J+=2,{type:JH,value:i,start:e,end:J};if(i===`//`&&fH({},cU,vU),`<>=!+-*%&|^/`.includes(r))return++J,{type:JH,value:r,start:e,end:J};fH({},cU,vU)}function Fwe(e){let t=``;for(;J{if(parseInt(t,16)<=1114111)return`x`;fH({},mU)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,`x`));try{new RegExp(n)}catch{fH({},mU)}try{return new RegExp(e,t)}catch{return null}}function zwe(){var e=zH[J],t,n,r,i;for(KV(e===`/`,`Regular expression literal must start with a slash`),t=zH[J++],n=!1,r=!1;J=0&&fH({},mU,n),{value:n,literal:t}}function Vwe(){var e,t,n,r;return VH=null,$V(),e=J,t=zwe(),n=Bwe(),r=Rwe(t.value,n.value),{literal:t.literal+n.literal,value:r,regex:{pattern:t.value,flags:n.value},start:e,end:J}}function Hwe(e){return e.type===WH||e.type===GH||e.type===HH||e.type===KH}function iH(){if($V(),J>=BH)return{type:UH,start:J,end:J};let e=zH.charCodeAt(J);return ZV(e)?Pwe():e===40||e===41||e===59?nH():e===39||e===34?Lwe():e===46?qV(zH.charCodeAt(J+1))?rH():nH():qV(e)?rH():nH()}function aH(){let e=VH;return J=e.end,VH=iH(),J=e.end,e}function oH(){let e=J;VH=iH(),J=e}function Uwe(e){let t=new GV(ZH);return t.elements=e,t}function sH(e,t,n){let r=new GV(e===`||`||e===`&&`?rU:QH);return r.operator=e,r.left=t,r.right=n,r}function Wwe(e,t){let n=new GV($H);return n.callee=e,n.arguments=t,n}function Gwe(e,t,n){let r=new GV(eU);return r.test=e,r.consequent=t,r.alternate=n,r}function cH(e){let t=new GV(tU);return t.name=e,t}function lH(e){let t=new GV(nU);return t.value=e.value,t.raw=zH.slice(e.start,e.end),e.regex&&(t.raw===`//`&&(t.raw=`/(?:)/`),t.regex=e.regex),t}function uH(e,t,n){let r=new GV(iU);return r.computed=e===`[`,r.object=t,r.property=n,r.computed||(n.member=!0),r}function Kwe(e){let t=new GV(aU);return t.properties=e,t}function dH(e,t,n){let r=new GV(oU);return r.key=t,r.value=n,r.kind=e,r}function qwe(e,t){let n=new GV(sU);return n.operator=e,n.argument=t,n.prefix=!0,n}function fH(e,t){var n,r=Array.prototype.slice.call(arguments,2),i=t.replace(/%(\d)/g,(e,t)=>(KV(t`:case`<=`:case`>=`:case`instanceof`:case`in`:t=7;break;case`<<`:case`>>`:case`>>>`:t=8;break;case`+`:case`-`:t=9;break;case`*`:case`/`:case`%`:t=11;break}return t}function iTe(){var e=VH,t,n,r,i,a,o,s,c=yH(),l;if(r=VH,i=bH(r),i===0)return c;for(r.prec=i,aH(),t=[e,VH],o=yH(),a=[c,r,o];(i=bH(VH))>0;){for(;a.length>2&&i<=a[a.length-2].prec;)o=a.pop(),s=a.pop().value,c=a.pop(),t.pop(),n=sH(s,c,o),a.push(n);r=aH(),r.prec=i,a.push(r),t.push(VH),n=yH(),a.push(n)}for(l=a.length-1,n=a[l],t.pop();l>1;)t.pop(),n=sH(a[l-1].value,a[l-2],n),l-=2;return n}function xH(){var e=iTe(),t,n;return hH(`?`)&&(aH(),t=xH(),mH(`:`),n=xH(),e=Gwe(e,t,n)),e}function SH(){let e=xH();if(hH(`,`))throw Error(yU);return e}function CH(e){zH=e,J=0,BH=zH.length,VH=null,oH();let t=SH();if(VH.type!==UH)throw Error(`Unexpect token after expression.`);return t}function wH(e){function t(t,n,r,i){let a=e(n[0]);return r&&(a=r+`(`+a+`)`,r.lastIndexOf(`new `,0)===0&&(a=`(`+a+`)`)),a+`.`+t+(i<0?``:i===0?`()`:`(`+n.slice(1).map(e).join(`,`)+`)`)}function n(e,n,r){return i=>t(e,i,n,r)}let r=`new Date`,i=`String`,a=`RegExp`;return{isNaN:`Number.isNaN`,isFinite:`Number.isFinite`,abs:`Math.abs`,acos:`Math.acos`,asin:`Math.asin`,atan:`Math.atan`,atan2:`Math.atan2`,ceil:`Math.ceil`,cos:`Math.cos`,exp:`Math.exp`,floor:`Math.floor`,hypot:`Math.hypot`,log:`Math.log`,max:`Math.max`,min:`Math.min`,pow:`Math.pow`,random:`Math.random`,round:`Math.round`,sin:`Math.sin`,sqrt:`Math.sqrt`,tan:`Math.tan`,clamp:function(t){t.length<3&&U(`Missing arguments to clamp function.`),t.length>3&&U(`Too many arguments to clamp function.`);let n=t.map(e);return`Math.max(`+n[1]+`, Math.min(`+n[2]+`,`+n[0]+`))`},now:`Date.now`,utc:`Date.UTC`,datetime:r,date:n(`getDate`,r,0),day:n(`getDay`,r,0),year:n(`getFullYear`,r,0),month:n(`getMonth`,r,0),hours:n(`getHours`,r,0),minutes:n(`getMinutes`,r,0),seconds:n(`getSeconds`,r,0),milliseconds:n(`getMilliseconds`,r,0),time:n(`getTime`,r,0),timezoneoffset:n(`getTimezoneOffset`,r,0),utcdate:n(`getUTCDate`,r,0),utcday:n(`getUTCDay`,r,0),utcyear:n(`getUTCFullYear`,r,0),utcmonth:n(`getUTCMonth`,r,0),utchours:n(`getUTCHours`,r,0),utcminutes:n(`getUTCMinutes`,r,0),utcseconds:n(`getUTCSeconds`,r,0),utcmilliseconds:n(`getUTCMilliseconds`,r,0),length:n(`length`,null,-1),parseFloat:`parseFloat`,parseInt:`parseInt`,upper:n(`toUpperCase`,i,0),lower:n(`toLowerCase`,i,0),substring:n(`substring`,i),split:n(`split`,i),trim:n(`trim`,i,0),btoa:`btoa`,atob:`atob`,encodeURIComponent:`encodeURIComponent`,regexp:a,test:n(`test`,a),if:function(t){t.length<3&&U(`Missing arguments to if function.`),t.length>3&&U(`Too many arguments to if function.`);let n=t.map(e);return`(`+n[0]+`?`+n[1]+`:`+n[2]+`)`}}}function aTe(e){let t=e&&e.length-1;return t&&(e[0]===`"`&&e[t]===`"`||e[0]===`'`&&e[t]===`'`)?e.slice(1,-1):e}function TH(e){e||={};let t=e.allowed?Tg(e.allowed):{},n=e.forbidden?Tg(e.forbidden):{},r=e.constants||wU,i=(e.functions||wH)(d),a=e.globalvar,o=e.fieldvar,s=eg(a)?a:e=>`${a}["${e}"]`,c={},l={},u=0;function d(e){if(vg(e))return e;let t=f[e.type];return t??U(`Unsupported type: `+e.type),t(e)}let f={Literal:e=>e.raw,Identifier:e=>{let i=e.name;return u>0?i:cg(n,i)?U(`Illegal identifier: `+i):cg(r,i)?r[i]:cg(t,i)?i:(c[i]=1,s(i))},MemberExpression:e=>{let t=!e.computed,n=d(e.object);t&&(u+=1);let r=d(e.property);return n===o&&(l[aTe(r)]=1),t&&--u,n+(t?`.`+r:`[`+r+`]`)},CallExpression:e=>{e.callee.type!==`Identifier`&&U(`Illegal callee type: `+e.callee.type);let t=e.callee.name,n=e.arguments,r=cg(i,t)&&i[t];return r||U(`Unrecognized function: `+t),eg(r)?r(n):r+`(`+n.map(d).join(`,`)+`)`},ArrayExpression:e=>`[`+e.elements.map(d).join(`,`)+`]`,BinaryExpression:e=>`(`+d(e.left)+` `+e.operator+` `+d(e.right)+`)`,UnaryExpression:e=>`(`+e.operator+d(e.argument)+`)`,ConditionalExpression:e=>`(`+d(e.test)+`?`+d(e.consequent)+`:`+d(e.alternate)+`)`,LogicalExpression:e=>`(`+d(e.left)+e.operator+d(e.right)+`)`,ObjectExpression:e=>{for(let t of e.properties){let e=t.key.name;Oh.has(e)&&U(`Illegal property: `+e)}return`{`+e.properties.map(d).join(`,`)+`}`},Property:e=>{u+=1;let t=d(e.key);return--u,t+`:`+d(e.value)}};function p(e){let t={code:d(e),globals:Object.keys(c),fields:Object.keys(l)};return c={},l={},t}return p.functions=i,p.constants=r,p}var EH,DH,OH,kH,AH,jH,MH,NH,PH,FH,IH,LH,RH,zH,J,BH,VH,HH,UH,WH,GH,KH,qH,JH,YH,XH,ZH,QH,$H,eU,tU,nU,rU,iU,aU,oU,sU,cU,lU,uU,dU,fU,pU,mU,hU,gU,_U,vU,yU,bU,xU,SU,CU,wU,TU=o((()=>{Dg(),EH=`RawCode`,DH=`Literal`,OH=`Property`,kH=`Identifier`,AH=`ArrayExpression`,jH=`BinaryExpression`,MH=`CallExpression`,NH=`ConditionalExpression`,PH=`LogicalExpression`,FH=`MemberExpression`,IH=`ObjectExpression`,LH=`UnaryExpression`,GV.prototype.visit=function(e){let t,n,r;if(e(this))return 1;for(t=Awe(this),n=0,r=t.length;n`,RH[WH]=`Identifier`,RH[GH]=`Keyword`,RH[KH]=`Null`,RH[qH]=`Numeric`,RH[JH]=`Punctuator`,RH[YH]=`String`,RH[XH]=`RegularExpression`,ZH=`ArrayExpression`,QH=`BinaryExpression`,$H=`CallExpression`,eU=`ConditionalExpression`,tU=`Identifier`,nU=`Literal`,rU=`LogicalExpression`,iU=`MemberExpression`,aU=`ObjectExpression`,oU=`Property`,sU=`UnaryExpression`,cU=`Unexpected token %0`,lU=`Unexpected number`,uU=`Unexpected string`,dU=`Unexpected identifier`,fU=`Unexpected reserved word`,pU=`Unexpected end of input`,mU=`Invalid regular expression`,hU=`Invalid regular expression: missing /`,gU=`Octal literals are not allowed in strict mode.`,_U=`Duplicate data property in object literal not allowed in strict mode`,vU=`ILLEGAL`,yU=`Disabled.`,bU=RegExp(`[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]`),xU=RegExp(`[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]`),SU={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1},CU={if:1},wU={NaN:`NaN`,E:`Math.E`,LN2:`Math.LN2`,LN10:`Math.LN10`,LOG2E:`Math.LOG2E`,LOG10E:`Math.LOG10E`,PI:`Math.PI`,SQRT1_2:`Math.SQRT1_2`,SQRT2:`Math.SQRT2`,MIN_VALUE:`Number.MIN_VALUE`,MAX_VALUE:`Number.MAX_VALUE`}}));function EU(e){return(!e.getter||!e.getter[kU])&&(e.getter=bh(e.field),e.getter[kU]=!0),e.getter}function DU(e,t){for(var n=t.fields,r=t.values,i=n.length,a=0,o,s;a=r[a])return!1}else if(s.type===WU){if(o>r[a])return!1}else if(s.type===GU){if(o<=r[a])return!1}else if(s.type===KU){if(oog(t.fields?{values:t.fields.map(t=>EU(t)(e.datum))}:{[IU]:LU(e.datum)},t))}function lTe(e,t,n,r){for(var i=this.context.data[e],a=i?i.values.value:[],o={},s={},c={},l,u,d,f,p,m,h,g,_,v,y=a.length,b=0,x,S;b(e[u[n].field]=t,e),{})))}else p=IU,m=LU(l),h=o[p]||(o[p]={}),g=h[f]||(h[f]=[]),g.push(m),n&&(g=s[f]||(s[f]=[]),g.push({[IU]:m}));if(t||=jU,o[IU]?o[IU]=$U[`${IU}_${t}`](...Object.values(o[IU])):Object.keys(o).forEach(e=>{o[e]=Object.keys(o[e]).map(t=>o[e][t]).reduce((n,r)=>n===void 0?r:$U[`${c[e]}_${t}`](n,r))}),a=Object.keys(s),n&&a.length){let e=r?NU:MU;o[e]=t===jU?{[PU]:a.reduce((e,t)=>(e.push(...s[t]),e),[])}:{[FU]:a.map(e=>({[PU]:s[e]}))}}return o}function OU(e,t,n,r){t[0].type!==`Literal`&&U(`First argument to selection functions must be a string literal.`);let i=t[0].value,a=t.length>=2&&Ih(t).value,o=`@unit`,s=eW+i;a===AU&&!cg(r,o)&&(r[o]=n.getData(i).indataRef(n,`unit`)),cg(r,s)||(r[s]=n.getData(i).tuplesRef())}var kU,AU,jU,MU,NU,PU,FU,IU,LU,RU,zU,BU,VU,HU,UU,WU,GU,KU,qU,JU,YU,XU,ZU,QU,$U,eW,uTe=o((()=>{e_(),Dg(),TU(),kU=Symbol(`vega_selection_getter`),AU=`intersect`,jU=`union`,MU=`vlMulti`,NU=`vlPoint`,PU=`or`,FU=`and`,IU=`_vgsid_`,LU=bh(IU),RU=`E`,zU=`R`,BU=`R-E`,VU=`R-LE`,HU=`R-RE`,UU=`E-LT`,WU=`E-LTE`,GU=`E-GT`,KU=`E-GTE`,qU=`E-VALID`,JU=`E-ONE`,YU=`index:unit`,XU=Ig(LU),ZU=XU.left,QU=XU.right,$U={[`${IU}_union`]:xse,[`${IU}_intersect`]:vse,E_union:function(e,t){if(!e.length)return t;for(var n=0,r=t.length;nt.includes(e)):t},R_union:function(e,t){var n=Rh(t[0]),r=Rh(t[1]);return n>r&&(n=t[1],r=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]r&&(n=t[1],r=t[0]),e.length?rr&&(e[1]=r),e):[n,r]}},eW=`:`}));function tW(e){let t=this.context.data[e];return t?t.values.value:[]}function dTe(e,t,n){let r=this.context.data[e][`index:`+t],i=r?r.value.get(n):void 0;return i&&i.count}function fTe(e,t){let n=this.context.dataflow,r=this.context.data[e].input;return n.pulse(r,n.changeset().remove(Eh).insert(t)),1}function pTe(e,t,n){if(e){let n=this.context.dataflow,r=e.mark.source;n.pulse(r,n.changeset().encode(e,t))}return n===void 0?e:n}function nW(e,t,n){return!Number.isInteger(e)||!Number.isInteger(t)?``:(EW.setYear(2e3),EW.setMonth(e),EW.setDate(t),SW.call(this,EW,n))}function mTe(e){return nW.call(this,e,1,`%B`)}function hTe(e){return nW.call(this,e,1,`%b`)}function gTe(e){return nW.call(this,0,2+e,`%A`)}function _Te(e){return nW.call(this,0,2+e,`%a`)}function rW(e,t,n,r){t[0].type!==`Literal`&&U(`First argument to data functions must be a string literal.`);let i=t[0].value,a=`:`+i;if(!cg(a,r))try{r[a]=n.getData(i).tuplesRef()}catch{}}function vTe(e,t,n,r){t[0].type!==`Literal`&&U(`First argument to indata must be a string literal.`),t[1].type!==`Literal`&&U(`Second argument to indata must be a string literal.`);let i=t[0].value,a=t[1].value,o=`@`+a;cg(o,r)||(r[o]=n.getData(i).indataRef(n,a))}function iW(e,t,n,r){if(t[0].type===`Literal`)aW(n,r,t[0].value);else for(e in n.scales)aW(n,r,e)}function aW(e,t,n){let r=`%`+n;if(!cg(t,r))try{t[r]=e.scaleRef(n)}catch{}}function oW(e,t){if(vg(e)){let n=t.scales[e];return n&&Jpe(n.value)?n.value:void 0}else if(eg(e))return Jpe(e)?e:void 0}function yTe(e,t,n){t.__bandwidth=e=>e&&e.bandwidth?e.bandwidth():0,n._bandwidth=iW,n._range=iW,n._scale=iW;let r=t=>`_[`+(t.type===`Literal`?G(`%`+t.value):G(`%`)+`+`+e(t))+`]`;return{_bandwidth:e=>`this.__bandwidth(${r(e[0])})`,_range:e=>`${r(e[0])}.range()`,_scale:t=>`${r(t[0])}(${e(t[1])})`}}function sW(e,t){return function(n,r,i){if(n){let t=oW(n,(i||this).context);return t&&t.path[e](r)}else return t(r)}}function bTe(e,t){let n=oW(e,(t||this).context);return n&&n.scale()}function xTe(e){let t=this.context.group,n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n}function cW(e,t,n){try{e[t].apply(e,[`EXPRESSION`].concat([].slice.call(n)))}catch(t){e.warn(t)}return n[n.length-1]}function STe(){return cW(this.context.dataflow,`warn`,arguments)}function CTe(){return cW(this.context.dataflow,`info`,arguments)}function wTe(){return cW(this.context.dataflow,`debug`,arguments)}function lW(e){let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function uW(e){let t=QT(e),n=lW(t.r),r=lW(t.g),i=lW(t.b);return .2126*n+.7152*r+.0722*i}function TTe(e,t){let n=uW(e),r=uW(t),i=Math.max(n,r),a=Math.min(n,r);return(i+.05)/(a+.05)}function ETe(){let e=[].slice.call(arguments);return e.unshift({}),og(...e)}function dW(e,t){return e===t||e!==e&&t!==t?!0:W(e)?W(t)&&e.length===t.length?DTe(e,t):!1:jh(e)&&jh(t)?fW(e,t):!1}function DTe(e,t){for(let n=0,r=e.length;nfW(e,t)}function OTe(e,t,n,r,i,a){let o=this.context.dataflow,s=this.context.data[e],c=s.input,l=o.stamp(),u=s.changes,d,f;if(o._trigger===!1||!(c.value.length||t||r))return 0;if((!u||u.stamp{s.modified=!0,o.pulse(c,u).run()},!0,1)),n&&(d=n===!0?Eh:W(n)||ax(n)?n:pW(n),u.remove(d)),t&&u.insert(t),r&&(d=pW(r),c.value.some(d)?u.remove(d):u.insert(r)),i){if(eg(i))throw Error(`modify parameter must be a data tuple, not a function`);for(f in a)u.modify(i,f,a[f])}return 1}function kTe(e){let t=e.touches,n=t[0].clientX-t[1].clientX,r=t[0].clientY-t[1].clientY;return Math.hypot(n,r)}function ATe(e){let t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)}function jTe(e,t){let n=AW[t]||(AW[t]=bh(t));return W(e)?e.map(n):n(e)}function mW(e){return W(e)||ArrayBuffer.isView(e)?e:null}function hW(e){return mW(e)||(vg(e)?e:null)}function MTe(e,...t){return mW(e).join(...t)}function NTe(e,...t){return hW(e).indexOf(...t)}function PTe(e,...t){return hW(e).lastIndexOf(...t)}function FTe(e,...t){return hW(e).slice(...t)}function ITe(e,t,n){return eg(n)&&U(`Function argument passed to replace.`),!vg(t)&&!_g(t)&&U(`Please pass a string or RegExp argument to replace.`),String(e).replace(t,n)}function LTe(e){return mW(e).slice().reverse()}function RTe(e){return mW(e).slice().sort(rg)}function zTe(e,t,n){return zD(e||0,t||0,n||0)}function BTe(e,t){let n=oW(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0}function VTe(e,t){let n=oW(e,(t||this).context);return n?n.copy():void 0}function HTe(e,t){let n=oW(e,(t||this).context);return n?n.domain():[]}function UTe(e,t,n){let r=oW(e,(n||this).context);return r?W(t)?(r.invertRange||r.invert)(t):(r.invert||r.invertExtent)(t):void 0}function WTe(e,t){let n=oW(e,(t||this).context);return n&&n.range?n.range():[]}function GTe(e,t,n){let r=oW(e,(n||this).context);return r?r(t):void 0}function KTe(e,t,n,r,i){e=oW(e,(i||this).context);let a=Lme(t,n),o=e.domain(),s=o[0],c=Ih(o),l=Ch;return c-s?l=nme(e,s,c):e=(e.interpolator?VD(`sequential`)().interpolator(e.interpolator()):VD(`linear`)().interpolate(e.interpolate()).range(e.range())).domain([s=0,c=1]),e.ticks&&(o=e.ticks(+r||15),s!==o[0]&&o.unshift(s),c!==Ih(o)&&o.push(c)),o.forEach(t=>a.stop(l(t),e(t))),a}function qTe(e,t,n){let r=oW(e,(n||this).context);return function(e){return r?r.path.context(e)(t):``}}function JTe(e){let t=null;return function(n){return n?CO(n,t||=SO(e)):e}}function gW(e,t){let n=tW.call(t,e);return n.root&&n.root.lookup||{}}function YTe(e,t,n){let r=gW(e,this),i=r[t],a=r[n];return i&&a?i.path(a).map(jW):void 0}function XTe(e,t){let n=gW(e,this)[t];return n?n.ancestors().map(jW):void 0}function ZTe(){let e=MW();return e?e.screen:{}}function QTe(){let e=MW();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]}function $Te(){let e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]}function _W(e,t,n){if(!e)return[];let[r,i]=e,a=new AO().set(r[0],r[1],i[0],i[1]);return Hge(n||this.context.dataflow.scenegraph().root,a,eEe(t))}function eEe(e){let t=null;if(e){let n=Qh(e.marktype),r=Qh(e.markname);t=e=>(!n.length||n.some(t=>e.marktype===t))&&(!r.length||r.some(t=>e.name===t))}return t}function tEe(e,t,n,r=5){e=Qh(e);let i=e[e.length-1];return i===void 0||Math.hypot(i[0]-t,i[1]-n)>r?[...e,[t,n]]:e}function nEe(e){return Qh(e).reduce((t,[n,r],i)=>t+=i==0?`M ${n},${r} `:i===e.length-1?` Z`:`L ${n},${r} `,``)}function rEe(e,t,n){let{x:r,y:i,mark:a}=n,o=new AO().set(2**53-1,2**53-1,-(2**53-1),-(2**53-1));for(let[e,n]of t)eo.x2&&(o.x2=e),no.y2&&(o.y2=n);return o.translate(r,i),_W([[o.x1,o.y1],[o.x2,o.y2]],e,a).filter(e=>iEe(e.x,e.y,t))}function iEe(e,t,n){let r=0;for(let i=0,a=n.length-1;it!=s>t&&e<(o-c)*(t-l)/(s-l)+c&&r++}return r&1}function aEe(e){let t=wH(e);PW.forEach(e=>t[e]=FW+e);for(let e in NW)t[e]=IW+e;return og(t,yTe(e,NW,LW)),t}function vW(e,t,n){return arguments.length===1?NW[e]:(NW[e]=t,n&&(LW[e]=n),zW&&(zW.functions[e]=IW+e),this)}function yW(e,t){let n={},r;try{e=vg(e)?e:G(e)+``,r=CH(e)}catch{U(`Expression parse error: `+e)}r.visit(e=>{if(e.type!==`CallExpression`)return;let r=e.callee.name,i=RW.visitors[r];i&&i(r,e.arguments,t,n)});let i=zW(r);return i.globals.forEach(e=>{let r=`$`+e;!cg(n,r)&&t.getSignal(e)&&(n[r]=t.signalRef(e))}),{$expr:og({code:i.code},t.options.ast?{ast:r}:null),$fields:i.fields,$params:n}}var bW,xW,SW,CW,wW,TW,EW,DW,OW,kW,AW,jW,MW,NW,PW,FW,IW,LW,RW,zW,BW=o((()=>{Dg(),TU(),vO(),ML(),KE(),eS(),Ij(),uTe(),GS(),Ry(),e_(),bW=e=>function(t,n){let r=this.context.dataflow.locale();return t===null?`null`:r[e](n)(t)},xW=bW(`format`),SW=bW(`timeFormat`),CW=bW(`utcFormat`),wW=bW(`timeParse`),TW=bW(`utcParse`),EW=new Date(2e3,0,1),DW=sW(`area`,Vve),OW=sW(`bounds`,Gve),kW=sW(`centroid`,Qve),AW={},jW=e=>e.data,MW=()=>typeof window<`u`&&window||null,NW={random(){return RS()},cumulativeNormal:uS,cumulativeLogNormal:gS,cumulativeUniform:SS,densityNormal:lS,densityLogNormal:hS,densityUniform:xS,quantileNormal:dS,quantileLogNormal:_S,quantileUniform:CS,sampleNormal:cS,sampleLogNormal:mS,sampleUniform:bS,isArray:W,isBoolean:mg,isDate:hg,isDefined(e){return e!==void 0},isNumber:gg,isObject:jh,isRegExp:_g,isString:vg,isTuple:ax,isValid(e){return e!=null&&e===e},toBoolean:Sg,toDate(e){return Cg(e)},toNumber:Rh,toString:wg,indexof:NTe,join:MTe,lastindexof:PTe,replace:ITe,reverse:LTe,sort:RTe,slice:FTe,flush:Dae,lerp:zae,merge:ETe,pad:Jae,peek:Ih,pluck:jTe,span:xg,inrange:pg,truncate:roe,rgb:QT,lab:xE,hcl:DE,hsl:sE,luminance:uW,contrast:TTe,sequence:$g,format:xW,utcFormat:CW,utcParse:TW,utcOffset:qv,utcSequence:Xv,timeFormat:SW,timeParse:wW,timeOffset:Kv,timeSequence:Yv,timeUnitSpecifier:Dv,monthFormat:mTe,monthAbbrevFormat:hTe,dayFormat:gTe,dayAbbrevFormat:_Te,quarter:uae,utcquarter:dae,week:Av,utcweek:Fv,dayofyear:kv,utcdayofyear:Pv,warn:STe,info:CTe,debug:wTe,extent(e){return sg(e)},inScope:xTe,intersect:_W,clampRange:pae,pinchDistance:kTe,pinchAngle:ATe,screen:ZTe,containerSize:$Te,windowSize:QTe,bandspace:zTe,setdata:fTe,pathShape:JTe,panLinear:aae,panLog:oae,panPow:sae,panSymlog:cae,zoomLinear:Vh,zoomLog:Hh,zoomPow:Uh,zoomSymlog:Wh,encode:pTe,modify:OTe,lassoAppend:tEe,lassoPath:nEe,intersectLasso:rEe},PW=[`view`,`item`,`group`,`xy`,`x`,`y`],FW=`event.vega.`,IW=`this.`,LW={},RW={forbidden:[`_`],allowed:[`datum`,`event`,`item`],fieldvar:`datum`,globalvar:e=>`_[${G(`$`+e)}]`,functions:aEe,constants:wU,visitors:LW},zW=TH(RW),vW(`bandwidth`,BTe,iW),vW(`copy`,VTe,iW),vW(`domain`,HTe,iW),vW(`range`,WTe,iW),vW(`invert`,UTe,iW),vW(`scale`,GTe,iW),vW(`gradient`,KTe,iW),vW(`geoArea`,DW,iW),vW(`geoBounds`,OW,iW),vW(`geoCentroid`,kW,iW),vW(`geoShape`,qTe,iW),vW(`geoScale`,bTe,iW),vW(`indata`,dTe,vTe),vW(`data`,tW,rW),vW(`treePath`,YTe,rW),vW(`treeAncestors`,XTe,rW),vW(`vlSelectionTest`,oTe,OU),vW(`vlSelectionIdTest`,sTe,OU),vW(`vlSelectionResolve`,lTe,OU),vW(`vlSelectionTuples`,cTe)}));function oEe(e){let t=this,n=e.operators||[];return e.background&&(t.background=e.background),e.eventConfig&&(t.eventConfig=e.eventConfig),e.locale&&(t.locale=e.locale),n.forEach(e=>t.parseOperator(e)),n.forEach(e=>t.parseOperatorParameters(e)),(e.streams||[]).forEach(e=>t.parseStream(e)),(e.updates||[]).forEach(e=>t.parseUpdate(e)),t.resolve()}function sEe(e,t){let n=``;return qW[t]?n:(e.x2&&(e.x?(JW[t]&&(n+=`if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;`),n+=`o.width=o.x2-o.x;`):n+=`o.x=o.x2-(o.width||0);`),e.xc&&(n+=`o.x=o.xc-(o.width||0)/2;`),e.y2&&(e.y?(JW[t]&&(n+=`if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;`),n+=`o.height=o.y2-o.y;`):n+=`o.y=o.y2-(o.height||0);`),e.yc&&(n+=`o.y=o.yc-(o.height||0)/2;`),n)}function VW(e){return(e+``).toLowerCase()}function cEe(e){return VW(e)===`operator`}function lEe(e){return VW(e)===`collect`}function HW(e,t,n){n.endsWith(`;`)||(n=`return(`+n+`);`);let r=Function(...t.concat(n));return e&&e.functions?r.bind(e.functions):r}function uEe(e,t,n,r){return`((u = ${e}) < (v = ${t}) || u == null) && v != null ? ${n} : (u > v || v == null) && u != null ? ${r} : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${n} - : v !== v && u === u ? ${r} : `}function sEe(e){let t=this;iEe(e.type)||!e.type?t.operator(e,e.update?t.operatorExpression(e.update):null):t.transform(e,e.type)}function cEe(e){let t=this;if(e.params){let n=t.get(e.id);n||U(`Invalid operator id: `+e.id),t.dataflow.connect(n,n.parameters(t.parseParameters(e.params),e.react,e.initonly))}}function lEe(e,t){t||={};let n=this;for(let r in e){let i=e[r];t[r]=W(i)?i.map(e=>KW(e,n,t)):KW(i,n,t)}return t}function KW(e,t,n){if(!e||!jh(e))return e;for(let r=0,i=$W.length,a;re&&e.$tupleid?ox:e);return t.fn[n]||(t.fn[n]=ng(r,e.$order,t.expr.codegen))}function hEe(e,t){let n=e.$encode,r={};for(let e in n){let i=n[e];r[e]=lh(t.encodeExpression(i.$expr),i.$fields),r[e].output=i.$output}return r}function gEe(e,t){return t}function _Ee(e,t){let n=e.$subflow;return function(e,r,i){let a=t.fork().parse(n),o=a.get(n.operators[0].id),s=a.signals.parent;return s&&s.set(i),o.detachSubflow=()=>t.detach(a),o}}function vEe(){return ox}function yEe(e){var t=this,n=e.filter==null?void 0:t.eventExpression(e.filter),r=e.stream==null?void 0:t.get(e.stream),i;e.source?r=t.events(e.source,e.type,n):e.merge&&(i=e.merge.map(e=>t.get(e)),r=i[0].merge.apply(i[0],i.slice(1))),e.between&&(i=e.between.map(e=>t.get(e)),r=r.between(i[0],i[1])),e.filter&&(r=r.filter(n)),e.throttle!=null&&(r=r.throttle(+e.throttle)),e.debounce!=null&&(r=r.debounce(+e.debounce)),r??U(`Invalid stream definition: `+JSON.stringify(e)),e.consume&&r.consume(!0),t.stream(e,r)}function bEe(e){var t=this,n=jh(n=e.source)?n.$ref:n,r=t.get(n),i=null,a=e.update,o=void 0;r||U(`Source not defined: `+e.source),i=e.target&&e.target.$expr?t.eventExpression(e.target.$expr):t.get(e.target),a&&a.$expr&&(a.$params&&(o=t.parseParameters(a.$params)),a=t.handlerExpression(a.$expr)),t.update(e,r,i,a,o)}function xEe(e){var t=this,n={};if(e.signals){var r=n.signals={};Object.keys(t.signals).forEach(n=>{let i=t.signals[n];e.signals(n,i)&&(r[n]=i.value)})}if(e.data){var i=n.data={};Object.keys(t.data).forEach(n=>{let r=t.data[n];e.data(n,r)&&(i[n]=r.input.value)})}return t.subcontext&&e.recurse!==!1&&(n.subcontext=t.subcontext.map(t=>t.getState(e))),n}function SEe(e){var t=this,n=t.dataflow,r=e.data,i=e.signals;Object.keys(i||{}).forEach(e=>{n.update(t.signals[e],i[e],eG)}),Object.keys(r||{}).forEach(e=>{n.pulse(t.data[e].input,n.changeset().remove(Eh).insert(r[e]))}),(e.subcontext||[]).forEach((e,n)=>{let r=t.subcontext[n];r&&r.setState(e)})}function qW(e,t,n,r){return new JW(e,t,n,r)}function JW(e,t,n,r){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=r||QW,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function YW(e){this.dataflow=e.dataflow,this.transforms=e.transforms,this.events=e.events,this.expr=e.expr,this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.nodes=Object.create(e.nodes),this.data=Object.create(e.data),this.fn=Object.create(e.fn),e.functions&&(this.functions=Object.create(e.functions),this.functions.context=this)}var XW,ZW,QW,$W,eG,tG=o((()=>{Dg(),eS(),XW=Tg([`rule`]),ZW=Tg([`group`,`image`,`rect`]),QW={operator:(e,t)=>GW(e,[`_`],t.code),parameter:(e,t)=>GW(e,[`datum`,`_`],t.code),event:(e,t)=>GW(e,[`event`],t.code),handler:(e,t)=>GW(e,[`_`,`event`],`var datum=event.item&&event.item.datum;return ${t.code};`),encode:(e,t)=>{let{marktype:n,channels:r}=t,i=`var o=item,datum=o.datum,m=0,$;`;for(let e in r){let t=`o[`+G(e)+`]`;i+=`$=${r[e].code};if(${t}!==$)${t}=$,m=1;`}return i+=rEe(r,n),i+=`return m;`,GW(e,[`item`,`_`],i)},codegen:{get(e){let t=`[${e.map(G).join(`][`)}]`,n=Function(`_`,`return _${t};`);return n.path=t,n},comparator(e,t){let n,r=Function(`a`,`b`,`var u, v; return `+e.map((e,r)=>{let i=t[r],a,o;return e.path?(a=`a${e.path}`,o=`b${e.path}`):((n||={})[`f`+r]=e,a=`this.f${r}(a)`,o=`this.f${r}(b)`),oEe(a,o,-i,i)}).join(``)+`0;`);return n?r.bind(n):r}}},$W=[{key:`$ref`,parse:uEe},{key:`$key`,parse:fEe},{key:`$expr`,parse:dEe},{key:`$field`,parse:pEe},{key:`$encode`,parse:hEe},{key:`$compare`,parse:mEe},{key:`$context`,parse:gEe},{key:`$subflow`,parse:_Ee},{key:`$tupleid`,parse:vEe}],eG={skip:!0},JW.prototype=YW.prototype={fork(){let e=new YW(this);return(this.subcontext||=[]).push(e),e},detach(e){this.subcontext=this.subcontext.filter(t=>t!==e);let t=Object.keys(e.nodes);for(let n of t)e.nodes[n]._targets=null;for(let n of t)e.nodes[n].detach();e.nodes=null},get(e){return this.nodes[e]},set(e,t){return this.nodes[e]=t},add(e,t){let n=this,r=n.dataflow,i=e.value;if(n.set(e.id,t),aEe(e.type)&&i&&(i.$ingest?r.ingest(t,i.$ingest,i.$format):i.$request?r.preload(t,i.$request,i.$format):r.pulse(t,r.changeset().insert(i))),e.root&&(n.root=t),e.parent){let i=n.get(e.parent.$ref);i?(r.connect(i,[t]),t.targets().add(i)):(n.unresolved=n.unresolved||[]).push(()=>{i=n.get(e.parent.$ref),r.connect(i,[t]),t.targets().add(i)})}if(e.signal&&(n.signals[e.signal]=t),e.scale&&(n.scales[e.scale]=t),e.data)for(let r in e.data){let i=n.data[r]||(n.data[r]={});e.data[r].forEach(e=>i[e]=t)}},resolve(){return(this.unresolved||[]).forEach(e=>e()),delete this.unresolved,this},operator(e,t){this.add(e,this.dataflow.add(e.value,t))},transform(e,t){this.add(e,this.dataflow.add(this.transforms[WW(t)]))},stream(e,t){this.set(e.id,t)},update(e,t,n,r,i){this.dataflow.on(t,n,r,i,e.options)},operatorExpression(e){return this.expr.operator(this,e)},parameterExpression(e){return this.expr.parameter(this,e)},eventExpression(e){return this.expr.event(this,e)},handlerExpression(e){return this.expr.handler(this,e)},encodeExpression(e){return this.expr.encode(this,e)},parse:nEe,parseOperator:sEe,parseOperatorParameters:cEe,parseParameters:lEe,parseStream:yEe,parseUpdate:bEe,getState:xEe,setState:SEe}}));function CEe(e){let t=e.container();t&&(t.setAttribute(`role`,`graphics-document`),t.setAttribute(`aria-roleDescription`,`visualization`),nG(t,e.description()))}function nG(e,t){e&&(t==null?e.removeAttribute(`aria-label`):e.setAttribute(`aria-label`,t))}function wEe(e){e.add(null,t=>(e._background=t.bg,e._resize=1,t.bg),{bg:e._signals.background})}function TEe(e){let t=e._signals.cursor||(e._signals.cursor=e.add({user:AG,item:null}));e.on(e.events(`view`,`pointermove`),t,(e,n)=>{let r=t.value,i=r?vg(r)?r:r.user:AG,a=n.item&&n.item.cursor||null;return r&&i===r.user&&a==r.item?r:{user:i,item:a}}),e.add(null,function(t){let n=t.cursor,r=this.value;return vg(n)||(r=n.item,n=n.user),rG(e,n&&n!==AG?n:r||n),r},{cursor:t})}function rG(e,t){let n=e.globalCursor()?typeof document<`u`&&document.body:e.container();if(n)return t==null?n.style.removeProperty(`cursor`):n.style.cursor=t}function iG(e,t){var n=e._runtime.data;return cg(n,t)||U(`Unrecognized data set: `+t),n[t]}function EEe(e,t){return arguments.length<2?iG(this,e).values.value:aG.call(this,e,mx().remove(Eh).insert(t))}function aG(e,t){px(t)||U(`Second argument to changes must be a changeset.`);let n=iG(this,e);return n.modified=!0,this.pulse(n.input,t)}function DEe(e,t){return aG.call(this,e,mx().insert(t))}function OEe(e,t){return aG.call(this,e,mx().remove(t))}function oG(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function sG(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function cG(e){var t=e.padding(),n=e._origin;return[t.left+n[0],t.top+n[1]]}function kEe(e){var t=cG(e),n=oG(e),r=sG(e);e._renderer.background(e.background()),e._renderer.resize(n,r,t),e._handler.origin(t),e._resizeListeners.forEach(t=>{try{t(n,r)}catch(t){e.error(t)}})}function AEe(e,t,n){var r=e._renderer,i=r&&r.canvas(),a,o,s;return i&&(s=cG(e),o=t.changedTouches?t.changedTouches[0]:t,a=Dk(o,i),a[0]-=s[0],a[1]-=s[1]),t.dataflow=e,t.item=n,t.vega=jEe(e,n,a),t}function jEe(e,t,n){let r=t?t.mark.marktype===`group`?t:t.mark.group:null;function i(e){var n=r,i;if(e){for(i=t;i;i=i.mark.group)if(i.mark.name===e){n=i;break}}return n&&n.mark&&n.mark.interactive?n:{}}function a(e){if(!e)return n;vg(e)&&(e=i(e));let t=n.slice();for(;e;)t[0]-=e.x||0,t[1]-=e.y||0,e=e.mark&&e.mark.group;return t}return{view:ig(e),item:ig(t||{}),group:i,xy:a,x:e=>a(e)[0],y:e=>a(e)[1]}}function MEe(e){let t=og({defaults:{}},e),n=(e,t)=>{t.forEach(t=>{W(e[t])&&(e[t]=Tg(e[t]))})};return n(t.defaults,[`prevent`,`allow`]),n(t,[`view`,`window`,`selector`]),t}function lG(e,t,n,r){e._eventListeners.push({type:n,sources:Qh(t),handler:r})}function NEe(e,t){var n=e._eventConfig.defaults,r=n.prevent,i=n.allow;return r===!1||i===!0?!1:r===!0||i===!1?!0:r?r[t]:i?!i[t]:e.preventDefault()}function uG(e,t,n){let r=e._eventConfig&&e._eventConfig[t];return r===!1||jh(r)&&!r[n]?(e.warn(`Blocked ${t} ${n} event listener.`),!1):!0}function PEe(e,t,n){var r=this,i=new vx(n),a=function(n,a){r.runAsync(null,()=>{e===jG&&NEe(r,t)&&n.preventDefault(),i.receive(AEe(r,n,a))})},o;if(e===MG)uG(r,`timer`,t)&&r.timer(a,t);else if(e===jG)uG(r,`view`,t)&&r.addEventListener(t,a,PG);else if(e===NG?uG(r,`window`,t)&&typeof window<`u`&&(o=[window]):typeof document<`u`&&uG(r,`selector`,t)&&(o=Array.from(document.querySelectorAll(e))),!o)r.warn(`Can not resolve event source: `+e);else{for(var s=0,c=o.length;s=0;)t[i].stop();for(i=r.length;--i>=0;)for(o=r[i],a=o.sources.length;--a>=0;)o.sources[a].removeEventListener(o.type,o.handler);for(e&&e.call(this,this._handler,null,null,null),i=n.length;--i>=0;)c=n[i].type,s=n[i].handler,this._handler.off(c,s);return this}function mG(e,t,n){let r=document.createElement(e);for(let e in t)r.setAttribute(e,t[e]);return n!=null&&(r.textContent=n),r}function LEe(e,t,n){if(!t)return;let r=n.param,i=n.state;return i||(i=n.state={elements:null,active:!1,set:null,update:t=>{t!=e.signal(r.signal)&&e.runAsync(null,()=>{i.source=!0,e.signal(r.signal,t)})}},r.debounce&&(i.update=ag(r.debounce,i.update))),(r.input==null&&r.element?REe:BEe)(i,t,r,e),i.active||(e.on(e._signals[r.signal],null,()=>{i.source?i.source=!1:i.set(e.signal(r.signal))}),i.active=!0),i}function REe(e,t,n,r){let i=n.event||`input`,a=()=>e.update(t.value);r.signal(n.signal,t.value),t.addEventListener(i,a),lG(r,t,i,a),e.set=e=>{t.value=e,t.dispatchEvent(zEe(i))}}function zEe(e){return typeof Event<`u`?new Event(e):{type:e}}function BEe(e,t,n,r){let i=r.signal(n.signal),a=mG(`div`,{class:FG}),o=n.input===`radio`?a:a.appendChild(mG(`label`));o.appendChild(mG(`span`,{class:IG},n.name||n.signal)),t.appendChild(a);let s=VEe;switch(n.input){case`checkbox`:s=HEe;break;case`select`:s=UEe;break;case`radio`:s=WEe;break;case`range`:s=GEe;break}s(e,o,n,i)}function VEe(e,t,n,r){let i=mG(`input`);for(let e in n)e!==`signal`&&e!==`element`&&i.setAttribute(e===`input`?`type`:e,n[e]);i.setAttribute(`name`,n.signal),i.value=r,t.appendChild(i),i.addEventListener(`input`,()=>e.update(i.value)),e.elements=[i],e.set=e=>i.value=e}function HEe(e,t,n,r){let i={type:`checkbox`,name:n.signal};r&&(i.checked=!0);let a=mG(`input`,i);t.appendChild(a),a.addEventListener(`change`,()=>e.update(a.checked)),e.elements=[a],e.set=e=>a.checked=!!e||null}function UEe(e,t,n,r){let i=mG(`select`,{name:n.signal}),a=n.labels||[];n.options.forEach((e,t)=>{let n={value:e};hG(e,r)&&(n.selected=!0),i.appendChild(mG(`option`,n,(a[t]||e)+``))}),t.appendChild(i),i.addEventListener(`change`,()=>{e.update(n.options[i.selectedIndex])}),e.elements=[i],e.set=e=>{for(let t=0,r=n.options.length;t{let s={type:`radio`,name:n.signal,value:t};hG(t,r)&&(s.checked=!0);let c=mG(`input`,s);c.addEventListener(`change`,()=>e.update(t));let l=mG(`label`,{},(a[o]||t)+``);return l.prepend(c),i.appendChild(l),c}),e.set=t=>{let n=e.elements,r=n.length;for(let e=0;e{c.textContent=s.value,e.update(+s.value)};s.addEventListener(`input`,l),s.addEventListener(`change`,l),e.elements=[s],e.set=e=>{s.value=e,c.textContent=e}}function hG(e,t){return e===t||e+``==t+``}function gG(e,t,n,r,i,a){return t||=new r(e.loader()),t.initialize(n,oG(e),sG(e),cG(e),i,a).background(e.background())}function _G(e,t){return t?function(){try{t.apply(this,arguments)}catch(t){e.error(t)}}:null}function KEe(e,t,n,r){let i=new r(e.loader(),_G(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,cG(e),e);return t&&t.handlers().forEach(e=>{i.on(e.type,e.handler)}),i}function qEe(e,t){let n=this,r=n._renderType,i=n._eventConfig.bind,a=Pk(r);e=n._el=e?vG(n,e,!0):null,CEe(n),a||n.error(`Unrecognized renderer type: `+r);let o=a.handler||ZA,s=e?a.renderer:a.headless;return n._renderer=s?gG(n,n._renderer,e,s):null,n._handler=KEe(n,n._handler,e,o),n._redraw=!0,e&&i!==`none`&&(t=t?n._elBind=vG(n,t,!0):e.appendChild(mG(`form`,{class:`vega-bindings`})),n._bind.forEach(e=>{e.param.element&&i!==`container`&&(e.element=vG(n,e.param.element,!!e.param.input))}),n._bind.forEach(e=>{LEe(n,e.element||t,e)})),n}function vG(e,t,n){if(typeof t==`string`)if(typeof document<`u`){if(t=document.querySelector(t),!t)return e.error(`Signal bind element not found: `+t),null}else return e.error(`DOM document instance not found.`),null;if(t&&n)try{t.textContent=``}catch(n){t=null,e.error(n)}return t}function yG(e){return jh(e)?{top:RG(e.top),bottom:RG(e.bottom),left:RG(e.left),right:RG(e.right)}:zG(RG(e))}async function bG(e,t,n,r){let i=Pk(t),a=i&&i.headless;return a||U(`Unrecognized renderer type: `+t),await e.runAsync(),gG(e,null,null,a,n,r).renderAsync(e._scenegraph.root)}async function JEe(e,t){e!==Fj.Canvas&&e!==Fj.SVG&&e!==Fj.PNG&&U(`Unrecognized image type: `+e);let n=await bG(this,e,t);return e===Fj.SVG?YEe(n.svg(),`image/svg+xml`):n.canvas().toDataURL(`image/png`)}function YEe(e,t){let n=new Blob([e],{type:t});return window.URL.createObjectURL(n)}async function XEe(e,t){return(await bG(this,Fj.Canvas,e,t)).canvas()}async function ZEe(e){return(await bG(this,Fj.SVG,e)).svg()}function QEe(e,t,n){return qW(e,$x,IW,n).parse(t)}function $Ee(e){var t=this._runtime.scales;return cg(t,e)||U(`Unrecognized scale or projection: `+e),t[e].value}function xG(e,t){var n=e.autosize(),r=e.padding();return t-(n&&n.contains===HG?r.left+r.right:0)}function SG(e,t){var n=e.autosize(),r=e.padding();return t-(n&&n.contains===HG?r.top+r.bottom:0)}function eDe(e){var t=e._signals,n=t[BG],r=t[VG],i=t[HG];function a(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,t=>{e._width=t.size,e._viewWidth=xG(e,t.size),a()},{size:n}),e._resizeHeight=e.add(null,t=>{e._height=t.size,e._viewHeight=SG(e,t.size),a()},{size:r});let o=e.add(null,a,{pad:i});e._resizeWidth.rank=n.rank+1,e._resizeHeight.rank=r.rank+1,o.rank=i.rank+1}function tDe(e,t,n,r,i,a){this.runAfter(o=>{let s=0;o._autosize=0,o.width()!==n&&(s=1,o.signal(BG,n,UG),o._resizeWidth.skip(!0)),o.height()!==r&&(s=1,o.signal(VG,r,UG),o._resizeHeight.skip(!0)),o._viewWidth!==e&&(o._resize=1,o._viewWidth=e),o._viewHeight!==t&&(o._resize=1,o._viewHeight=t),(o._origin[0]!==i[0]||o._origin[1]!==i[1])&&(o._resize=1,o._origin=i),s&&o.run(`enter`),a&&o.runAfter(e=>e.resize())},!1,1)}function nDe(e){return this._runtime.getState(e||{data:rDe,signals:iDe,recurse:!0})}function rDe(e,t){return t.modified&&W(t.input.value)&&!e.startsWith(`_:vega:_`)}function iDe(e,t){return!(e===`parent`||t instanceof $x.proxy)}function aDe(e){return this.runAsync(null,t=>{t._trigger=!1,t._runtime.setState(e)},e=>{e._trigger=!0}),this}function oDe(e,t){function n(t){e({timestamp:Date.now(),elapsed:t})}this._timers.push(kxe(n,t))}function sDe(e,t,n,r){let i=e.element();i&&i.setAttribute(`title`,cDe(r))}function cDe(e){return e==null?``:W(e)?CG(e):jh(e)&&!hg(e)?lDe(e):e+``}function lDe(e){return Object.keys(e).map(t=>{let n=e[t];return t+`: `+(W(n)?CG(n):wG(n))}).join(` -`)}function CG(e){return`[`+e.map(wG).join(`, `)+`]`}function wG(e){return W(e)?`[…]`:jh(e)&&!hg(e)?`{…}`:e}function uDe(){if(this.renderer()===`canvas`&&this._renderer._canvas){let e=null,t=()=>{e?.();let n=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);n.addEventListener(`change`,t),e=()=>{n.removeEventListener(`change`,t)},this._renderer._canvas.getContext(`2d`).pixelRatio=window.devicePixelRatio||1,this._redraw=!0,this._resize=1,this.resize().runAsync()};t()}}function TG(e,t){let n=this;if(t||={},Dx.call(n),t.loader&&n.loader(t.loader),t.logger&&n.logger(t.logger),t.logLevel!=null&&n.logLevel(t.logLevel),t.locale||e.locale){let r=og({},e.locale,t.locale);n.locale(Eb(r.number,r.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||Fj.Canvas,n._scenegraph=new EA;let r=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||sDe,n._redraw=!0,n._handler=new ZA().scene(r),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=MEe(e.eventConfig),n.globalCursor(n._eventConfig.globalCursor);let i=QEe(n,e,t.expr);n._runtime=i,n._signals=i.signals,n._bind=(e.bindings||[]).map(e=>({state:null,param:og({},e)})),i.root&&i.root.set(r),r.source=i.data.root.input,n.pulse(i.data.root.input,n.changeset().insert(r.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=xG(n,n._width),n._viewHeight=SG(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,eDe(n),wEe(n),TEe(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind),t.watchPixelRatio&&n._watchPixelRatio()}function EG(e,t){return cg(e._signals,t)?e._signals[t]:U(`Unrecognized signal name: `+G(t))}function DG(e,t){let n=(e._targets||[]).filter(e=>e._update&&e._update.handler===t);return n.length?n[0]:null}function OG(e,t,n,r){let i=DG(n,r);return i||(i=_G(e,()=>r(t,n.value)),i.handler=r,e.on(n,null,i)),e}function kG(e,t,n){let r=DG(t,n);return r&&t._targets.remove(r),e}var AG,jG,MG,NG,PG,FG,IG,LG,RG,zG,BG,VG,HG,UG,dDe=o((()=>{Dg(),eS(),zj(),e_(),UW(),tG(),rz(),jb(),AG=`default`,jG=`view`,MG=`timer`,NG=`window`,PG={trap:!1},FG=`vega-bind`,IG=`vega-bind-name`,LG=`vega-bind-radio`,RG=e=>+e||0,zG=e=>({top:e,bottom:e,left:e,right:e}),BG=`width`,VG=`height`,HG=`padding`,UG={skip:!0},fg(TG,Dx,{async evaluate(e,t,n){if(await Dx.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,kEe(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(e){this.error(e)}return n&&ix(this,n),this},dirty(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},description(e){if(arguments.length){let t=e==null?null:e+``;return t!==this._desc&&nG(this._el,this._desc=t),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(e,t,n){let r=EG(this,e);return arguments.length===1?r.value:this.update(r,t,n)},width(e){return arguments.length?this.signal(`width`,e):this.signal(`width`)},height(e){return arguments.length?this.signal(`height`,e):this.signal(`height`)},padding(e){return arguments.length?this.signal(`padding`,yG(e)):yG(this.signal(`padding`))},autosize(e){return arguments.length?this.signal(`autosize`,e):this.signal(`autosize`)},background(e){return arguments.length?this.signal(`background`,e):this.signal(`background`)},renderer(e){return arguments.length?(Pk(e)||U(`Unrecognized renderer type: `+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},tooltip(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},loader(e){return arguments.length?(e!==this._loader&&(Dx.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(EG(this,`autosize`))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:tDe,addEventListener(e,t,n){let r=t;return n&&n.trap===!1||(r=_G(this,t),r.raw=t),this._handler.on(e,r),this},removeEventListener(e,t){for(var n=this._handler.handlers(e),r=n.length,i,a;--r>=0;)if(a=n[r].type,i=n[r].handler,e===a&&(t===i||t===i.raw)){this._handler.off(a,i);break}return this},addResizeListener(e){let t=this._resizeListeners;return t.includes(e)||t.push(e),this},removeResizeListener(e){var t=this._resizeListeners,n=t.indexOf(e);return n>=0&&t.splice(n,1),this},addSignalListener(e,t){return OG(this,e,EG(this,e),t)},removeSignalListener(e,t){return kG(this,EG(this,e),t)},addDataListener(e,t){return OG(this,e,iG(this,e).values,t)},removeDataListener(e,t){return kG(this,iG(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){let t=rG(this,null);this._globalCursor=!!e,t&&rG(this,t)}return this}else return this._globalCursor},preventDefault(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},timer:oDe,events:PEe,finalize:IEe,hover:FEe,data:EEe,change:aG,insert:DEe,remove:OEe,scale:$Ee,initialize:qEe,toImageURL:JEe,toCanvas:XEe,toSVG:ZEe,getState:nDe,setState:aDe,_watchPixelRatio:uDe})}));function WG(e,t,n){return aK=t||JG,oK=n||iK,KG(e.trim()).map(qG)}function fDe(e){return oK[e]}function GG(e,t,n,r,i){let a=e.length,o=0,s;for(;t' after between selector: `+e;r=r.map(qG);let i=qG(e.slice(1).trim());return i.between?{between:r,stream:i}:(i.between=r,i)}function mDe(e){let t={source:aK},n=[],r=[0,0],i=0,a=0,o=e.length,s=0,c,l;if(e[o-1]===QG){if(s=e.lastIndexOf(ZG),s>=0){try{r=hDe(e.substring(s+1,o-1))}catch{throw`Invalid throttle specification: `+e}e=e.slice(0,s).trim(),o=e.length}else throw`Unmatched right brace: `+e;s=0}if(!o)throw e;if(e[0]===tK&&(i=++s),c=GG(e,s,$G),c1?(t.type=n[1],i?t.markname=n[0].slice(1):fDe(n[0])?t.marktype=n[0]:t.source=n[0]):t.type=n[0],t.type.slice(-1)===`!`&&(t.consume=!0,t.type=t.type.slice(0,-1)),l!=null&&(t.filter=l),r[0]&&(t.throttle=r[0]),r[1]&&(t.debounce=r[1]),t}function hDe(e){let t=e.split(eK);if(!e.length||t.length>2)throw e;return t.map(t=>{let n=+t;if(n!==n)throw e;return n})}var JG,YG,XG,ZG,QG,$G,eK,tK,nK,rK,iK,aK,oK,sK=o((()=>{JG=`view`,YG=`[`,XG=`]`,ZG=`{`,QG=`}`,$G=`:`,eK=`,`,tK=`@`,nK=`>`,rK=/[[\]{}]/,iK={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1}}));function gDe(e){return jh(e)?e:{type:e||`pad`}}function _De(e){return jh(e)?e.signal?e:{top:vq(e.top),bottom:vq(e.bottom),left:vq(e.left),right:vq(e.right)}:yq(vq(e))}function cK(e,t,n,r){return n==null?0:(jh(n)&&!W(n)||W(n)&&n.length&&jh(n[0])?e.update[t]=n:e[r||`enter`][t]={value:n},1)}function lK(e,t,n){for(let n in t)cK(e,n,t[n]);for(let t in n)cK(e,t,n[t],`update`)}function uK(e,t,n){for(let r in t)n&&cg(n,r)||(e[r]=og(e[r]||{},t[r]));return e}function dK(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}function vDe(e,t,n,r,i){let a={},o={},s,c,l,u;for(c in c=`lineBreak`,t===`text`&&i[c]!=null&&!dK(c,e)&&fK(a,c,i[c]),(n==`legend`||String(n).startsWith(`axis`))&&(n=null),u=n===`frame`?i.group:n===`mark`?og({},i.mark,i[t]):null,u)l=dK(c,e)||(c===`fill`||c===`stroke`)&&(dK(`fill`,e)||dK(`stroke`,e)),l||fK(a,c,u[c]);for(c in Qh(r).forEach(t=>{let n=i.style&&i.style[t];for(let t in n)dK(t,e)||fK(a,t,n[t])}),e=og({},e),a)u=a[c],u.signal?(s||={})[c]=u:o[c]=u;return e.enter=og(o,e.enter),s&&(e.update=og(s,e.update)),e}function fK(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}function pK(e){if(e.gradient!=null)return bDe(e);let t=e.signal?`(${e.signal})`:e.color?yDe(e.color):e.field==null?e.value===void 0?void 0:G(e.value):hK(e.field);return e.scale!=null&&(t=xDe(e,t)),t===void 0&&(t=null),e.exponent!=null&&(t=`pow(${t},${mK(e.exponent)})`),e.mult!=null&&(t+=`*${mK(e.mult)}`),e.offset!=null&&(t+=`+${mK(e.offset)}`),e.round&&(t=`round(${t})`),t}function yDe(e){return e.c?Bq(`hcl`,e.h,e.c,e.l):e.h||e.s?Bq(`hsl`,e.h,e.s,e.l):e.l||e.a?Bq(`lab`,e.l,e.a,e.b):e.r||e.g||e.b?Bq(`rgb`,e.r,e.g,e.b):null}function bDe(e){let t=[e.start,e.stop,e.count].map(e=>e==null?null:G(e));for(;t.length&&Ih(t)==null;)t.pop();return t.unshift(zq(e.gradient)),`gradient(${t.join(`,`)})`}function mK(e){return jh(e)?`(`+pK(e)+`)`:e}function hK(e){return gK(jh(e)?e:{datum:e})}function gK(e){let t,n,r;if(e.signal)t=`datum`,r=e.signal;else if(e.group||e.parent){for(n=Math.max(1,e.level||1),t=`item`;n-->0;)t+=`.mark.group`;e.parent?(r=e.parent,t+=`.datum`):r=e.group}else e.datum?(t=`datum`,r=e.datum):U(`Invalid field reference: `+G(e));return e.signal||(r=vg(r)?vh(r).map(G).join(`][`):gK(r)),t+`[`+r+`]`}function xDe(e,t){let n=zq(e.scale);return e.range==null?(t!==void 0&&(t=`_scale(${n}, ${t})`),e.band&&(t=(t?t+`+`:``)+`_bandwidth(${n})`+(+e.band==1?``:`*`+mK(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),t??=`0`):t=`lerp(_range(${n}), ${+e.range})`,t}function SDe(e){let t=``;return e.forEach(e=>{let n=pK(e);t+=e.test?`(${e.test})?${n}:`:n}),Ih(t)===`:`&&(t+=`null`),t}function _K(e,t,n,r,i,a){let o={};a||={},a.encoders={$encode:o},e=vDe(e,t,n,r,i.config);for(let n in e)o[n]=CDe(e[n],t,a,i);return a}function CDe(e,t,n,r){let i={},a={};for(let t in e)e[t]!=null&&(i[t]=TDe(wDe(e[t]),r,n,a));return{$expr:{marktype:t,channels:i},$fields:Object.keys(a),$output:Object.keys(e)}}function wDe(e){return W(e)?SDe(e):pK(e)}function TDe(e,t,n,r){let i=SW(e,t);return i.$fields.forEach(e=>r[e]=1),og(n,i.$params),i.$expr}function vK(e,t){U(e+` for "outer" push: `+G(t))}function yK(e,t){let n=e.name;if(e.push===Vq)t.signals[n]||vK(`No prior signal definition`,n),Hq.forEach(t=>{e[t]!==void 0&&vK(`Invalid property `,t)});else{let r=t.addSignal(n,e.value);e.react===!1&&(r.react=!1),e.bind&&t.addBinding(n,e.bind)}}function bK(e,t,n,r){this.id=-1,this.type=e,this.value=t,this.params=n,r&&(this.parent=r)}function xK(e,t,n,r){return new bK(e,t,n,r)}function SK(e,t){return xK(`operator`,e,t)}function CK(e){let t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function wK(e,t){return t?{$field:e,$name:t}:{$field:e}}function TK(e,t){return{$compare:e,$order:t}}function EDe(e,t){let n={$key:e};return t&&(n.$flat=!0),n}function DDe(e){return jh(e)?(e.order===Gq?`-`:`+`)+EK(e.op,e.field):``}function EK(e,t){return(e&&e.signal?`$`+e.signal:e||``)+(e&&t?`_`:``)+(t&&t.signal?`$`+t.signal:t?.replace(/\W+/g,`_`).replace(/^_+|_+$/g,``)||``)}function DK(e){return e&&e.signal}function ODe(e){return e&&e.expr}function OK(e){if(DK(e))return!0;if(jh(e)){for(let t in e)if(OK(e[t]))return!0}return!1}function kK(e,t){return e??t}function AK(e){return e&&e.signal||e}function jK(e,t){return(e.merge?ADe:e.stream?jDe:e.type?MDe:U(`Invalid stream specification: `+G(e)))(e,t)}function kDe(e){return e===Kq?qq:e||qq}function ADe(e,t){let n=MK({merge:e.merge.map(e=>jK(e,t))},e,t);return t.addStream(n).id}function jDe(e,t){let n=MK({stream:jK(e.stream,t)},e,t);return t.addStream(n).id}function MDe(e,t){let n;e.type===Jq?(n=t.event(Jq,e.throttle),e={between:e.between,filter:e.filter}):n=t.event(kDe(e.source),e.type);let r=MK({stream:n},e,t);return Object.keys(r).length===1?n:t.addStream(r).id}function MK(e,t,n){let r=t.between;return r&&(r.length!==2&&U(`Stream "between" parameter must have 2 entries: `+G(t)),e.between=[jK(r[0],n),jK(r[1],n)]),r=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&r.push(NDe(t.marktype,t.markname,t.markrole)),t.source===Kq&&r.push(`inScope(event.item)`),r.length&&(e.filter=SW(`(`+r.join(`)&&(`)+`)`,n).$expr),(r=t.throttle)!=null&&(e.throttle=+r),(r=t.debounce)!=null&&(e.debounce=+r),t.consume&&(e.consume=!0),e}function NDe(e,t,n){return`event.item`+(e&&e!==`*`?`&&event.item.mark.marktype==='`+e+`'`:``)+(n?`&&event.item.mark.role==='`+n+`'`:``)+(t?`&&event.item.mark.name==='`+t+`'`:``)}function PDe(e,t,n){let r=e.encode,i={target:n},a=e.events,o=e.update,s=[];a||U(`Signal update missing events specification.`),vg(a)&&(a=WG(a,t.isSubscope()?Kq:qq)),a=Qh(a).filter(e=>e.signal||e.scale?(s.push(e),0):1),s.length>1&&(s=[IDe(s)]),a.length&&s.push(a.length>1?{merge:a}:a[0]),r!=null&&(o&&U(`Signal encode and update are mutually exclusive.`),o=`encode(item(),`+G(r)+`)`),i.update=vg(o)?SW(o,t):o.expr==null?o.value==null?o.signal==null?U(`Invalid signal update specification.`):{$expr:Yq,$params:{$value:t.signalRef(o.signal)}}:o.value:SW(o.expr,t),e.force&&(i.options={force:!0}),s.forEach(e=>t.addUpdate(og(FDe(e,t),i)))}function FDe(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):jK(e,t)}}function IDe(e){return{signal:`[`+e.map(e=>e.scale?`scale("`+e.scale+`")`:e.signal)+`]`}}function LDe(e,t){let n=t.getSignal(e.name),r=e.update;e.init&&(r?U(`Signals can not include both init and update expressions.`):(r=e.init,n.initonly=!0)),r&&(r=SW(r,t),n.update=r.$expr,n.params=r.$params),e.on&&e.on.forEach(e=>PDe(e,t,n.id))}function RDe(e,t){let n=e.type||`linear`;Kpe(n)||U(`Unrecognized scale type: `+G(n)),t.addScale(e.name,{type:n,domain:void 0})}function zDe(e,t){let n=t.getScale(e.name).params,r;for(r in n.domain=IK(e.domain,e,t),e.range!=null&&(n.range=RK(e,t,n)),e.interpolate!=null&&YDe(e.interpolate,n),e.nice!=null&&(n.nice=JDe(e.nice,t)),e.bins!=null&&(n.bins=qDe(e.bins,t)),e)cg(n,r)||r===`name`||(n[r]=NK(e[r],t))}function NK(e,t){return jh(e)?e.signal?t.signalRef(e.signal):U(`Unsupported object: `+G(e)):e}function PK(e,t){return e.signal?t.signalRef(e.signal):e.map(e=>NK(e,t))}function FK(e){U(`Can not find data set: `+G(e))}function IK(e,t,n){if(!e){(t.domainMin!=null||t.domainMax!=null)&&U(`No scale domain defined for domainMin/domainMax to override.`);return}return e.signal?n.signalRef(e.signal):(W(e)?BDe:e.fields?HDe:VDe)(e,t,n)}function BDe(e,t,n){return e.map(e=>NK(e,n))}function VDe(e,t,n){let r=n.getData(e.data);return r||FK(e.data),qD(t.type)?r.valuesRef(n,e.field,LK(e.sort,!1)):Ype(t.type)?r.domainRef(n,e.field):r.extentRef(n,e.field)}function HDe(e,t,n){let r=e.data,i=e.fields.reduce((e,t)=>(t=vg(t)?{data:r,field:t}:W(t)||t.signal?UDe(t,n):t,e.push(t),e),[]);return(qD(t.type)?WDe:Ype(t.type)?GDe:KDe)(e,n,i)}function UDe(e,t){let n=`_:vega:_`+TJ++,r=eJ({});if(W(e))r.value={$ingest:e};else if(e.signal){let i=`setdata(`+G(n)+`,`+e.signal+`)`;r.params.input=t.signalRef(i)}return t.addDataPipeline(n,[r,xJ({})]),{data:n,field:`data`}}function WDe(e,t,n){let r=LK(e.sort,!0),i,a,o=n.map(e=>{let n=t.getData(e.data);return n||FK(e.data),n.countsRef(t,e.field,r)}),s={groupby:Uq,pulse:o};r&&(i=r.op||`count`,a=r.field?EK(i,r.field):`count`,s.ops=[EJ[i]],s.fields=[t.fieldRef(a)],s.as=[a]),i=t.add(Zq(s));let c=t.add(eJ({pulse:CK(i)}));return a=t.add(wJ({field:Uq,sort:t.sortRef(r),pulse:CK(c)})),CK(a)}function LK(e,t){return e&&(!e.field&&!e.op?jh(e)?e.field=`key`:e={field:`key`}:!e.field&&e.op!==`count`?U(`No field provided for sort aggregate op: `+e.op):t&&e.field&&e.op&&!EJ[e.op]&&U(`Multiple domain scales can not be sorted using `+e.op)),e}function GDe(e,t,n){let r=n.map(e=>{let n=t.getData(e.data);return n||FK(e.data),n.domainRef(t,e.field)});return CK(t.add(fJ({values:r})))}function KDe(e,t,n){let r=n.map(e=>{let n=t.getData(e.data);return n||FK(e.data),n.extentRef(t,e.field)});return CK(t.add(dJ({extents:r})))}function qDe(e,t){return e.signal||W(e)?PK(e,t):t.objectProperty(e)}function JDe(e,t){return e.signal?t.signalRef(e.signal):jh(e)?{interval:NK(e.interval),step:NK(e.step)}:NK(e)}function YDe(e,t){t.interpolate=NK(e.type||e),e.gamma!=null&&(t.interpolateGamma=NK(e.gamma))}function RK(e,t,n){let r=t.config.range,i=e.range;if(i.signal)return t.signalRef(i.signal);if(vg(i)){if(r&&cg(r,i))return e=og({},e,{range:r[i]}),RK(e,t,n);i===`width`?i=[0,{signal:`width`}]:i===`height`?i=qD(e.type)?[0,{signal:`height`}]:[{signal:`height`},0]:U(`Unrecognized scale range value: `+G(i))}else if(i.scheme){n.scheme=W(i.scheme)?PK(i.scheme,t):NK(i.scheme,t),i.extent&&(n.schemeExtent=PK(i.extent,t)),i.count&&(n.schemeCount=NK(i.count,t));return}else if(i.step){n.rangeStep=NK(i.step,t);return}else if(qD(e.type)&&!W(i))return IK(i,e,t);else W(i)||U(`Unsupported range type: `+G(i));return i.map(e=>(W(e)?PK:NK)(e,t))}function XDe(e,t){let n=t.config.projection||{},r={};for(let n in e)n!==`name`&&(r[n]=zK(e[n],n,t));for(let e in n)r[e]??(r[e]=zK(n[e],e,t));t.addProjection(e.name,r)}function zK(e,t,n){return W(e)?e.map(e=>zK(e,t,n)):jh(e)?e.signal?n.signalRef(e.signal):t===`fit`?e:U(`Unsupported parameter object: `+G(e)):e}function BK(e){return e.type=$J,e.interactive=e.interactive||!1,e}function VK(e,t){let n=(n,r)=>kK(e[n],kK(t[n],r));return n.isVertical=n=>MJ===kK(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>kK(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>kK(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>kK(e.columns,kK(t.columns,+n.isVertical(!0))),n}function HK(e,t){let n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function ZDe(e,t,n){let r=t.config.style[n];return r&&r[e]}function UK(e,t,n){return`item.anchor === '${NJ}' ? ${e} : item.anchor === '${FJ}' ? ${t} : ${n}`}function QDe(e){let t=e(`tickBand`),n=e(`tickOffset`),r,i;return t?t.signal?(r={signal:`(${t.signal}) === 'extent' ? 1 : 0.5`},i={signal:`(${t.signal}) === 'extent'`},jh(n)||(n={signal:`(${t.signal}) === 'extent' ? 0 : ${n}`})):t===`extent`?(r=1,i=!0,n=0):(r=.5,i=!1):(r=e(`bandPosition`),i=e(`tickExtra`)),{extra:i,band:r,offset:n}}function WK(e,t){return t?e?jh(e)?Object.assign({},e,{offset:WK(e.offset,t)}):{value:e,offset:t}:t:e}function GK(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=uK(e.encode,t,XJ)):e.interactive=!1,e}function $De(e,t,n,r){let i=VK(e,n),a=i.isVertical(),o=i.gradientThickness(),s=i.gradientLength(),c,l,u,d,f;a?(l=[0,1],u=[0,0],d=o,f=s):(l=[0,0],u=[1,0],d=s,f=o);let p={enter:c={opacity:ZJ,x:ZJ,y:ZJ,width:bq(d),height:bq(f)},update:og({},c,{opacity:QJ,fill:{gradient:t,start:l,stop:u}}),exit:{opacity:ZJ}};return lK(p,{stroke:i(`gradientStrokeColor`),strokeWidth:i(`gradientStrokeWidth`)},{opacity:i(`gradientOpacity`)}),GK({type:eY,role:Mq,encode:p},r)}function eOe(e,t,n,r,i){let a=VK(e,n),o=a.isVertical(),s=a.gradientThickness(),c=a.gradientLength(),l,u,d,f,p=``;o?(l=`y`,d=`y2`,u=`x`,f=`width`,p=`1-`):(l=`x`,d=`x2`,u=`y`,f=`height`);let m={opacity:ZJ,fill:{scale:t,field:BJ}};m[l]={signal:p+`datum.perc`,mult:c},m[u]=ZJ,m[d]={signal:p+`datum.perc2`,mult:c},m[f]=bq(s);let h={enter:m,update:og({},m,{opacity:QJ}),exit:{opacity:ZJ}};return lK(h,{stroke:a(`gradientStrokeColor`),strokeWidth:a(`gradientStrokeWidth`)},{opacity:a(`gradientOpacity`)}),GK({type:eY,role:Aq,key:BJ,from:i,encode:h},r)}function KK(e,t,n,r){let i=VK(e,t),a=i.isVertical(),o=bq(i.gradientThickness()),s=i.gradientLength(),c=i(`labelOverlap`),l,u,d,f,p=``,m={enter:l={opacity:ZJ},update:u={opacity:QJ,text:{field:LJ}},exit:{opacity:ZJ}};return lK(m,{fill:i(`labelColor`),fillOpacity:i(`labelOpacity`),font:i(`labelFont`),fontSize:i(`labelFontSize`),fontStyle:i(`labelFontStyle`),fontWeight:i(`labelFontWeight`),limit:kK(e.labelLimit,t.gradientLabelLimit)}),a?(l.align={value:`left`},l.baseline=u.baseline={signal:oY},d=`y`,f=`x`,p=`1-`):(l.align=u.align={signal:aY},l.baseline={value:`top`},d=`x`,f=`y`),l[d]=u[d]={signal:p+`datum.perc`,mult:s},l[f]=u[f]=o,o.offset=kK(e.labelOffset,t.gradientLabelOffset)||0,c=c?{separation:i(`labelSeparation`),method:c,order:`datum.index`}:void 0,GK({type:rY,role:Nq,style:VJ,key:BJ,from:r,encode:m,overlap:c},n)}function tOe(e,t,n,r,i){let a=VK(e,t),o=n.entries,s=!!(o&&o.interactive),c=o?o.name:void 0,l=a(`clipHeight`),u=a(`symbolOffset`),d={data:`value`},f=`(${i}) ? datum.${RJ} : datum.${JJ}`,p=l?bq(l):{field:JJ},m=`datum.${IJ}`,h=`max(1, ${i})`,g,_,v,y,b;p.mult=.5,g={enter:_={opacity:ZJ,x:{signal:f,mult:.5,offset:u},y:p},update:v={opacity:QJ,x:_.x,y:_.y},exit:{opacity:ZJ}};let x=null,S=null;e.fill||(x=t.symbolBaseFillColor,S=t.symbolBaseStrokeColor),lK(g,{fill:a(`symbolFillColor`,x),shape:a(`symbolType`),size:a(`symbolSize`),stroke:a(`symbolStrokeColor`,S),strokeDash:a(`symbolDash`),strokeDashOffset:a(`symbolDashOffset`),strokeWidth:a(`symbolStrokeWidth`)},{opacity:a(`symbolOpacity`)}),YJ.forEach(t=>{e[t]&&(v[t]=_[t]={scale:e[t],field:BJ})});let C=GK({type:nY,role:Pq,key:BJ,from:d,clip:l?!0:void 0,encode:g},n.symbols),w=bq(u);w.offset=a(`labelOffset`),g={enter:_={opacity:ZJ,x:{signal:f,offset:w},y:p},update:v={opacity:QJ,text:{field:LJ},x:_.x,y:_.y},exit:{opacity:ZJ}},lK(g,{align:a(`labelAlign`),baseline:a(`labelBaseline`),fill:a(`labelColor`),fillOpacity:a(`labelOpacity`),font:a(`labelFont`),fontSize:a(`labelFontSize`),fontStyle:a(`labelFontStyle`),fontWeight:a(`labelFontWeight`),limit:a(`labelLimit`)});let T=GK({type:rY,role:Nq,style:VJ,key:BJ,from:d,encode:g},n.labels);return g={enter:{noBound:{value:!l},width:ZJ,height:l?bq(l):ZJ,opacity:ZJ},exit:{opacity:ZJ},update:v={opacity:QJ,row:{signal:null},column:{signal:null}}},a.isVertical(!0)?(y=`ceil(item.mark.items.length / ${h})`,v.row.signal=`${m}%${y}`,v.column.signal=`floor(${m} / ${y})`,b={field:[`row`,m]}):(v.row.signal=`floor(${m} / ${h})`,v.column.signal=`${m} % ${h}`,b={field:m}),v.column.signal=`(${i})?${v.column.signal}:${m}`,r={facet:{data:r,name:`value`,groupby:IJ}},BK({role:Sq,from:r,encode:uK(g,o,XJ),marks:[C,T],name:c,interactive:s,sort:b})}function nOe(e,t){let n=VK(e,t);return{align:n(`gridAlign`),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n(`rowPadding`),column:n(`columnPadding`)}}}function rOe(e,t,n,r){let i=VK(e,t),a={enter:{opacity:ZJ},update:{opacity:QJ,x:{field:{group:`padding`}},y:{field:{group:`padding`}}},exit:{opacity:ZJ}};return lK(a,{orient:i(`titleOrient`),_anchor:i(`titleAnchor`),anchor:{signal:pY},angle:{signal:mY},align:{signal:fY},baseline:{signal:hY},text:e.title,fill:i(`titleColor`),fillOpacity:i(`titleOpacity`),font:i(`titleFont`),fontSize:i(`titleFontSize`),fontStyle:i(`titleFontStyle`),fontWeight:i(`titleFontWeight`),limit:i(`titleLimit`),lineHeight:i(`titleLineHeight`)},{align:i(`titleAlign`),baseline:i(`titleBaseline`)}),GK({type:rY,role:Fq,style:HJ,from:r,encode:a},n)}function iOe(e,t){let n;return jh(e)&&(e.signal?n=e.signal:e.path?n=`pathShape(`+qK(e.path)+`)`:e.sphere&&(n=`geoShape(`+qK(e.sphere)+`, {type: "Sphere"})`)),n?t.signalRef(n):!!e}function qK(e){return jh(e)&&e.signal?e.signal:G(e)}function JK(e){let t=e.role||``;return t.startsWith(`axis`)||t.startsWith(`legend`)||t.startsWith(`title`)?t:e.type===$J?Sq:t||`mark`}function aOe(e){return{marktype:e.type,name:e.name||void 0,role:e.role||JK(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function oOe(e,t){return e&&e.signal?t.signalRef(e.signal):e!==!1}function YK(e,t){let n=kx(e.type);n||U(`Unrecognized transform type: `+G(e.type));let r=xK(n.type.toLowerCase(),null,XK(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(r)),r.metadata=n.metadata||{},r}function XK(e,t,n){let r={},i=e.params.length;for(let a=0;aZK(e,t,n)):ZK(e,i,n)}function ZK(e,t,n){let r=e.type;if(DK(t))return yY(r)?U(`Expression references can not be signals.`):bY(r)?n.fieldRef(t):xY(r)?n.compareRef(t):n.signalRef(t.signal);{let i=e.expr||bY(r);return i&&gY(t)?n.exprRef(t.expr,t.as):i&&_Y(t)?wK(t.field,t.as):yY(r)?SW(t,n):vY(r)?CK(n.getData(t).values):bY(r)?wK(t):xY(r)?n.compareRef(t):t}}function cOe(e,t,n){return vg(t.from)||U(`Lookup "from" parameter must be a string literal.`),n.getData(t.from).lookupRef(n,t.key)}function lOe(e,t,n){let r=t[e.name];return e.array?(W(r)||U(`Expected an array of sub-parameters. Instead: `+G(r)),r.map(t=>QK(e,t,n))):QK(e,r,n)}function QK(e,t,n){let r=e.params.length,i;for(let n=0;ne??`null`).join(`,`)+`),0)`,t);c.update=l.$expr,c.params=l.$params}function aq(e,t){let n=JK(e),r=e.type===$J,i=e.from&&e.from.facet,a=e.overlap,o=e.layout||n===`scope`||n===`frame`,s,c,l,u,d,f,p,m=n===`mark`||o||i,h=uOe(e.from,r,t);c=t.add(nJ({key:h.key||(e.key?wK(e.key):void 0),pulse:h.pulse,clean:!r}));let g=CK(c);c=l=t.add(eJ({pulse:g})),c=t.add(uJ({markdef:aOe(e),interactive:oOe(e.interactive,t),clip:iOe(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef(`parent`):null,index:t.markpath(),pulse:CK(c)}));let _=CK(c);c=u=t.add(rJ(_K(e.encode,e.type,n,e.style,t,{mod:!1,pulse:_}))),c.params.parent=t.encode(),e.transform&&e.transform.forEach(e=>{let n=YK(e,t),r=n.metadata;(r.generates||r.changes)&&U(`Mark transforms should not generate new data.`),r.nomod||(u.params.mod=!0),n.params.pulse=CK(c),t.add(c=n)}),e.sort&&(c=t.add(SJ({sort:t.compareRef(e.sort),pulse:CK(c)})));let v=CK(c);(i||o)&&(o=t.add(CJ({layout:t.objectProperty(e.layout),legends:t.legends,mark:_,pulse:v})),f=CK(o));let y=t.add($q({mark:_,pulse:f||v}));p=CK(y),r&&(m&&(s=t.operators,s.pop(),o&&s.pop()),t.pushState(v,f||p,g),i?dOe(e,t,h):m?fOe(e,t,h):t.parse(e),t.popState(),m&&(o&&s.push(o),s.push(y))),a&&(p=pOe(a,p,t));let b=t.add(yJ({pulse:p})),x=t.add(xJ({pulse:CK(b)},void 0,t.parent()));e.name!=null&&(d=e.name,t.addData(d,new eq(t,l,b,x)),e.on&&e.on.forEach(e=>{(e.insert||e.remove||e.toggle)&&U(`Marks only support modify triggers.`),iq(e,t,d)}))}function pOe(e,t,n){let r=e.method,i=e.bound,a=e.separation,o={separation:DK(a)?n.signalRef(a.signal):a,method:DK(r)?n.signalRef(r.signal):r,pulse:t};if(e.order&&(o.sort=n.compareRef({field:e.order})),i){let e=i.tolerance;o.boundTolerance=DK(e)?n.signalRef(e.signal):+e,o.boundScale=n.scaleRef(i.scale),o.boundOrient=i.orient}return CK(n.add(pJ(o)))}function mOe(e,t){let n=t.config.legend,r=e.encode||{},i=VK(e,n),a=r.legend||{},o=a.name||void 0,s=a.interactive,c=a.style,l={},u=0,d,f,p;YJ.forEach(t=>e[t]?(l[t]=e[t],u||=e[t]):0),u||U(`Missing valid scale for legend.`);let m=hOe(e,t.scaleType(u)),h={title:e.title!=null,scales:l,type:m,vgrad:m!==`symbol`&&i.isVertical()},g=CK(t.add(eJ(null,[h]))),_={enter:{x:{value:0},y:{value:0}}},v=CK(t.add(cJ(f={type:m,scale:t.scaleRef(u),count:t.objectProperty(i(`tickCount`)),limit:t.property(i(`symbolLimit`)),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)})));return m===KJ?(p=[$De(e,u,n,r.gradient),KK(e,n,r.labels,v)],f.count=f.count||t.signalRef(`max(2,2*floor((${AK(i.gradientLength())})/100))`)):m===qJ?p=[eOe(e,u,n,r.gradient,v),KK(e,n,r.labels,v)]:(d=nOe(e,n),p=[tOe(e,n,r,v,AK(d.columns))],f.size=vOe(e,t,p[0].marks)),p=[BK({role:jq,from:g,encode:_,marks:p,layout:d,interactive:s})],h.title&&p.push(rOe(e,n,r.title,g)),aq(BK({role:kq,from:g,encode:uK(_Oe(i,e,n),a,XJ),marks:p,aria:i(`aria`),description:i(`description`),zindex:i(`zindex`),name:o,interactive:s,style:c}),t)}function hOe(e,t){let n=e.type||GJ;return!e.type&&gOe(e)===1&&(e.fill||e.stroke)&&(n=KD(t)?KJ:JD(t)?qJ:GJ),n===KJ?JD(t)?qJ:KJ:n}function gOe(e){return YJ.reduce((t,n)=>t+ +!!e[n],0)}function _Oe(e,t,n){let r={enter:{},update:{}};return lK(r,{orient:e(`orient`),offset:e(`offset`),padding:e(`padding`),titlePadding:e(`titlePadding`),cornerRadius:e(`cornerRadius`),fill:e(`fillColor`),stroke:e(`strokeColor`),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:e(`legendX`),y:e(`legendY`),format:t.format,formatType:t.formatType}),r}function vOe(e,t,n){return SW(`max(ceil(sqrt(${AK(oq(`size`,e,n))})+${AK(oq(`strokeWidth`,e,n))}),${AK(yOe(n[1].encode,t,VJ))})`,t)}function oq(e,t,n){return t[e]?`scale("${t[e]}",datum)`:HK(e,n[0].encode)}function yOe(e,t,n){return HK(`fontSize`,e)||ZDe(`fontSize`,t,n)}function bOe(e,t){e=vg(e)?{text:e}:e;let n=VK(e,t.config.title),r=e.encode||{},i=r.group||{},a=i.name||void 0,o=i.interactive,s=i.style,c=[],l=CK(t.add(eJ(null,[{}])));return c.push(COe(e,n,xOe(e),l)),e.subtitle&&c.push(wOe(e,n,r.subtitle,l)),aq(BK({role:Iq,from:l,encode:SOe(n,i),marks:c,aria:n(`aria`),description:n(`description`),zindex:n(`zindex`),name:a,interactive:o,style:s}),t)}function xOe(e){let t=e.encode;return t&&t.title||og({name:e.name,interactive:e.interactive,style:e.style},t)}function SOe(e,t){let n={enter:{},update:{}};return lK(n,{orient:e(`orient`),anchor:e(`anchor`),align:{signal:iY},angle:{signal:SY},limit:e(`limit`),frame:e(`frame`),offset:e(`offset`)||0,padding:e(`subtitlePadding`)}),uK(n,t,XJ)}function COe(e,t,n,r){let i={value:0},a=e.text,o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return lK(o,{text:a,align:{signal:`item.mark.group.align`},angle:{signal:`item.mark.group.angle`},limit:{signal:`item.mark.group.limit`},baseline:`top`,dx:t(`dx`),dy:t(`dy`),fill:t(`color`),font:t(`font`),fontSize:t(`fontSize`),fontStyle:t(`fontStyle`),fontWeight:t(`fontWeight`),lineHeight:t(`lineHeight`)},{align:t(`align`),angle:t(`angle`),baseline:t(`baseline`)}),GK({type:rY,role:Lq,style:UJ,from:r,encode:o},n)}function wOe(e,t,n,r){let i={value:0},a=e.subtitle,o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return lK(o,{text:a,align:{signal:`item.mark.group.align`},angle:{signal:`item.mark.group.angle`},limit:{signal:`item.mark.group.limit`},baseline:`top`,dx:t(`dx`),dy:t(`dy`),fill:t(`subtitleColor`),font:t(`subtitleFont`),fontSize:t(`subtitleFontSize`),fontStyle:t(`subtitleFontStyle`),fontWeight:t(`subtitleFontWeight`),lineHeight:t(`subtitleLineHeight`)},{align:t(`align`),angle:t(`angle`),baseline:t(`baseline`)}),GK({type:rY,role:Rq,style:WJ,from:r,encode:o},n)}function TOe(e,t){let n=[];e.transform&&e.transform.forEach(e=>{n.push(YK(e,t))}),e.on&&e.on.forEach(n=>{iq(n,t,e.name)}),t.addDataPipeline(e.name,EOe(e,t,n))}function EOe(e,t,n){let r=[],i=null,a=!1,o=!1,s,c,l,u,d;for(e.values?DK(e.values)||OK(e.format)?(r.push(cq(t,e)),r.push(i=sq())):r.push(i=sq({$ingest:e.values,$format:e.format})):e.url?OK(e.url)||OK(e.format)?(r.push(cq(t,e)),r.push(i=sq())):r.push(i=sq({$request:e.url,$format:e.format})):e.source&&(i=s=Qh(e.source).map(e=>CK(t.getData(e).output)),r.push(null)),c=0,l=n.length;ce==null?!dK(t,r):(n.update[t]=BY(bq(e),n.update[t]),!1),a=i(e(`titleX`),`x`),o=i(e(`titleY`),`y`);n.enter.auto=o===a?bq(o):TY(t,bq(o),bq(a))}function FOe(e,t){let n=DOe(e,t),r=e.encode||{},i=r.axis||{},a=i.name||void 0,o=i.interactive,s=i.style,c=VK(e,n),l=QDe(c),u={scale:e.scale,ticks:!!c(`ticks`),labels:!!c(`labels`),grid:!!c(`grid`),domain:!!c(`domain`),title:e.title!=null},d=CK(t.add(eJ({},[u]))),f=CK(t.add(Qq({scale:t.scaleRef(e.scale),extra:t.property(l.extra),count:t.objectProperty(e.tickCount),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)}))),p=[],m;return u.grid&&p.push(kOe(e,n,r.grid,f,l)),u.ticks&&(m=c(`tickSize`),p.push(jOe(e,n,r.ticks,f,m,l))),u.labels&&(m=u.ticks?m:0,p.push(MOe(e,n,r.labels,f,m,l))),u.domain&&p.push(OOe(e,n,r.domain,d)),u.title&&p.push(NOe(e,n,r.title,d)),aq(BK({role:Cq,from:d,encode:uK(IOe(c,e),i,XJ),marks:p,aria:c(`aria`),description:c(`description`),zindex:c(`zindex`),name:a,interactive:o,style:s}),t)}function IOe(e,t){let n={enter:{},update:{}};return lK(n,{orient:e(`orient`),offset:e(`offset`)||0,position:kK(t.position,0),titlePadding:e(`titlePadding`),minExtent:e(`minExtent`),maxExtent:e(`maxExtent`),range:{signal:`abs(span(range("${t.scale}")))`},translate:e(`translate`),format:t.format,formatType:t.formatType}),n}function pq(e,t,n){let r=Qh(e.signals),i=Qh(e.scales);return n||r.forEach(e=>yK(e,t)),Qh(e.projections).forEach(e=>XDe(e,t)),i.forEach(e=>RDe(e,t)),Qh(e.data).forEach(e=>TOe(e,t)),i.forEach(e=>zDe(e,t)),(n||r).forEach(e=>LDe(e,t)),Qh(e.axes).forEach(e=>FOe(e,t)),Qh(e.marks).forEach(e=>aq(e,t)),Qh(e.legends).forEach(e=>mOe(e,t)),e.title&&bOe(e.title,t),t.parseLambdas(),t}function LOe(e,t){let n=t.config,r=CK(t.root=t.add(SK())),i=ROe(e,n);i.forEach(e=>yK(e,t)),t.description=e.description||n.description,t.eventConfig=n.events,t.legends=t.objectProperty(n.legend&&n.legend.layout),t.locale=n.locale;let a=t.add(eJ()),o=t.add(rJ(_K(VY(e.encode),$J,xq,e.style,t,{pulse:CK(a)}))),s=t.add(CJ({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef(`autosize`),mark:r,pulse:CK(o)}));t.operators.pop(),t.pushState(CK(o),CK(s),null),pq(e,t,i),t.operators.push(s);let c=t.add($q({mark:r,pulse:CK(s)}));return c=t.add(yJ({pulse:CK(c)})),c=t.add(xJ({pulse:CK(c)})),t.addData(`root`,new eq(t,a,a,c)),t}function mq(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function ROe(e,t){let n=n=>kK(e[n],t[n]),r=[mq(`background`,n(`background`)),mq(`autosize`,gDe(n(`autosize`))),mq(`padding`,_De(n(`padding`))),mq(`width`,n(`width`)||0),mq(`height`,n(`height`)||0)],i=r.reduce((e,t)=>(e[t.name]=t,e),{}),a={};return Qh(e.signals).forEach(e=>{cg(i,e.name)?e=og(i[e.name],e):r.push(e),a[e.name]=e}),Qh(t.signals).forEach(e=>{!cg(a,e.name)&&!cg(i,e.name)&&r.push(e)}),r}function hq(e,t){this.config=e||{},this.options=t||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function gq(e){this.config=e.config,this.options=e.options,this.legends=e.legends,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}function _q(e){return(W(e)?zOe:BOe)(e)}function zOe(e){let t=e.length,n=`[`;for(let r=0;r0?`,`:``)+(jh(t)?t.signal||_q(t):G(t))}return n+`]`}function BOe(e){let t=`{`,n=0,r,i;for(r in e)i=e[r],t+=(++n>1?`,`:``)+G(r)+`:`+(jh(i)?i.signal||_q(i):G(i));return t+`}`}function VOe(){let e=`sans-serif`,t=`#4c78a8`,n=`#000`,r=`#888`,i=`#ddd`;return{description:`Vega visualization`,padding:0,autosize:`pad`,background:null,events:{defaults:{allow:[`wheel`]}},group:null,mark:null,arc:{fill:t},area:{fill:t},image:null,line:{stroke:t,strokeWidth:2},path:{stroke:t},rect:{fill:t},rule:{stroke:n},shape:{stroke:t},symbol:{fill:t,size:64},text:{fill:n,font:e,fontSize:11},trail:{fill:t,size:2},style:{"guide-label":{fill:n,font:e,fontSize:10},"guide-title":{fill:n,font:e,fontSize:11,fontWeight:`bold`},"group-title":{fill:n,font:e,fontSize:13,fontWeight:`bold`},"group-subtitle":{fill:n,font:e,fontSize:12},point:{size:30,strokeWidth:2,shape:`circle`},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:`square`},cell:{fill:`transparent`,stroke:i},view:{fill:`transparent`}},title:{orient:`top`,anchor:`middle`,offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:r,grid:!1,gridWidth:1,gridColor:i,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:r,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:`mercator`},legend:{orient:`right`,padding:0,gridAlign:`each`,columnPadding:10,rowPadding:2,symbolDirection:`vertical`,gradientDirection:`vertical`,gradientLength:200,gradientThickness:16,gradientStrokeColor:i,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:`left`,labelBaseline:`middle`,labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:`circle`,symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:`transparent`,symbolBaseStrokeColor:r,titleLimit:180,titleOrient:`top`,titlePadding:5,layout:{offset:18,direction:`horizontal`,left:{direction:`vertical`},right:{direction:`vertical`}}},range:{category:{scheme:`tableau10`},ordinal:{scheme:`blues`},heatmap:{scheme:`yellowgreenblue`},ramp:{scheme:`blues`},diverging:{scheme:`blueorange`,extent:[1,0]},symbol:[`circle`,`square`,`triangle-up`,`cross`,`diamond`,`triangle-right`,`triangle-down`,`triangle-left`]}}}function HOe(e,t,n){return jh(e)||U(`Input Vega specification must be an object.`),t=Nh(VOe(),t,e.config),LOe(e,new hq(t,n)).toRuntime()}var vq,yq,bq,xq,Sq,Cq,wq,Tq,Eq,Dq,Oq,kq,Aq,jq,Mq,Nq,Pq,Fq,Iq,Lq,Rq,zq,Bq,Vq,Hq,Uq,Wq,Gq,Kq,qq,Jq,Yq,Xq,Zq,Qq,$q,eJ,tJ,nJ,rJ,iJ,aJ,oJ,sJ,cJ,lJ,uJ,dJ,fJ,pJ,mJ,hJ,gJ,_J,vJ,yJ,bJ,xJ,SJ,CJ,wJ,TJ,EJ,DJ,OJ,kJ,AJ,jJ,MJ,NJ,PJ,FJ,IJ,LJ,RJ,zJ,BJ,VJ,HJ,UJ,WJ,GJ,KJ,qJ,JJ,YJ,XJ,ZJ,QJ,$J,eY,tY,nY,rY,iY,aY,oY,sY,cY,lY,uY,dY,fY,pY,mY,hY,gY,_Y,vY,yY,bY,xY,SY,CY,wY,TY,EY,DY,OY,kY,AY,jY,MY,NY,PY,FY,IY,LY,RY,zY,BY,VY,UOe=o((()=>{Dg(),UW(),sK(),xO(),eS(),vq=e=>+e||0,yq=e=>({top:e,bottom:e,left:e,right:e}),bq=e=>jh(e)&&!W(e)?og({},e):{value:e},xq=`frame`,Sq=`scope`,Cq=`axis`,wq=`axis-domain`,Tq=`axis-grid`,Eq=`axis-label`,Dq=`axis-tick`,Oq=`axis-title`,kq=`legend`,Aq=`legend-band`,jq=`legend-entry`,Mq=`legend-gradient`,Nq=`legend-label`,Pq=`legend-symbol`,Fq=`legend-title`,Iq=`title`,Lq=`title-text`,Rq=`title-subtitle`,zq=e=>vg(e)?G(e):e.signal?`(${e.signal})`:hK(e),Bq=(e,t,n,r)=>`(${e}(${[t,n,r].map(pK).join(`,`)})+'')`,Vq=`outer`,Hq=[`value`,`update`,`init`,`react`,`bind`],Uq=wK(`key`),Wq=`ascending`,Gq=`descending`,Kq=`scope`,qq=`view`,Jq=`timer`,Yq={code:`_.$value`,ast:{type:`Identifier`,value:`value`}},Xq=e=>(t,n,r)=>xK(e,n,t||void 0,r),Zq=Xq(`aggregate`),Qq=Xq(`axisticks`),$q=Xq(`bound`),eJ=Xq(`collect`),tJ=Xq(`compare`),nJ=Xq(`datajoin`),rJ=Xq(`encode`),iJ=Xq(`expression`),aJ=Xq(`facet`),oJ=Xq(`field`),sJ=Xq(`key`),cJ=Xq(`legendentries`),lJ=Xq(`load`),uJ=Xq(`mark`),dJ=Xq(`multiextent`),fJ=Xq(`multivalues`),pJ=Xq(`overlap`),mJ=Xq(`params`),hJ=Xq(`prefacet`),gJ=Xq(`projection`),_J=Xq(`proxy`),vJ=Xq(`relay`),yJ=Xq(`render`),bJ=Xq(`scale`),xJ=Xq(`sieve`),SJ=Xq(`sortitems`),CJ=Xq(`viewlayout`),wJ=Xq(`values`),TJ=0,EJ={min:`min`,max:`max`,count:`sum`},DJ=`top`,OJ=`left`,kJ=`right`,AJ=`bottom`,jJ=`center`,MJ=`vertical`,NJ=`start`,PJ=`middle`,FJ=`end`,IJ=`index`,LJ=`label`,RJ=`offset`,zJ=`perc`,BJ=`value`,VJ=`guide-label`,HJ=`guide-title`,UJ=`group-title`,WJ=`group-subtitle`,GJ=`symbol`,KJ=`gradient`,qJ=`discrete`,JJ=`size`,YJ=[JJ,`shape`,`fill`,`stroke`,`strokeWidth`,`strokeDash`,`opacity`],XJ={name:1,style:1,interactive:1},ZJ={value:0},QJ={value:1},$J=`group`,eY=`rect`,tY=`rule`,nY=`symbol`,rY=`text`,iY=UK(G(OJ),G(kJ),G(jJ)),aY=`datum.${zJ}<=0?"${OJ}":datum.${zJ}>=1?"${kJ}":"${jJ}"`,oY=`datum.${zJ}<=0?"${AJ}":datum.${zJ}>=1?"${DJ}":"${PJ}"`,sY=`item.orient === "left"`,cY=`item.orient === "right"`,lY=`(${sY} || ${cY})`,uY=`datum.vgrad && ${lY}`,dY=UK(`"top"`,`"bottom"`,`"middle"`),fY=`datum.vgrad && ${cY} ? (${UK(`"right"`,`"left"`,`"center"`)}) : (${lY} && !(datum.vgrad && ${sY})) ? "left" : ${iY}`,pY=`item._anchor || (${lY} ? "middle" : "start")`,mY=`${uY} ? (${sY} ? -90 : 90) : 0`,hY=`${lY} ? (datum.vgrad ? (${cY} ? "bottom" : "top") : ${dY}) : "top"`,gY=e=>e&&e.expr,_Y=e=>e&&e.field,vY=e=>e===`data`,yY=e=>e===`expr`,bY=e=>e===`field`,xY=e=>e===`compare`,eq.fromEntries=function(e,t){let n=t.length,r=t[n-1],i=t[n-2],a=t[0],o=null,s=1;for(a&&a.type===`load`&&(a=t[1]),e.add(t[0]);se===AJ||e===DJ,wY=(e,t,n)=>DK(e)?jY(e.signal,t,n):e===OJ||e===DJ?t:n,TY=(e,t,n)=>DK(e)?kY(e.signal,t,n):CY(e)?t:n,EY=(e,t,n)=>DK(e)?AY(e.signal,t,n):CY(e)?n:t,DY=(e,t,n)=>DK(e)?MY(e.signal,t,n):e===DJ?{value:t}:{value:n},OY=(e,t,n)=>DK(e)?NY(e.signal,t,n):e===kJ?{value:t}:{value:n},kY=(e,t,n)=>PY(`${e} === '${DJ}' || ${e} === '${AJ}'`,t,n),AY=(e,t,n)=>PY(`${e} !== '${DJ}' && ${e} !== '${AJ}'`,t,n),jY=(e,t,n)=>IY(`${e} === '${OJ}' || ${e} === '${DJ}'`,t,n),MY=(e,t,n)=>IY(`${e} === '${DJ}'`,t,n),NY=(e,t,n)=>IY(`${e} === '${kJ}'`,t,n),PY=(e,t,n)=>(t=t==null?t:bq(t),n=n==null?n:bq(n),FY(t)&&FY(n)?(t=t?t.signal||G(t.value):null,n=n?n.signal||G(n.value):null,{signal:`${e} ? (${t}) : (${n})`}):[og({test:e},t)].concat(n||[])),FY=e=>e==null||Object.keys(e).length===1,IY=(e,t,n)=>({signal:`${e} ? (${RY(t)}) : (${RY(n)})`}),LY=(e,t,n,r,i)=>({signal:(r==null?``:`${e} === '${OJ}' ? (${RY(r)}) : `)+(n==null?``:`${e} === '${AJ}' ? (${RY(n)}) : `)+(i==null?``:`${e} === '${kJ}' ? (${RY(i)}) : `)+(t==null?``:`${e} === '${DJ}' ? (${RY(t)}) : `)+`(null)`}),RY=e=>DK(e)?e.signal:e==null?null:G(e),zY=(e,t)=>t===0?0:DK(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t},BY=(e,t)=>{let n=e.signal;return n&&n.endsWith(`(null)`)?{signal:n.slice(0,-6)+t.signal}:e},VY=e=>uK({enter:{x:{value:0},y:{value:0}},update:{width:{signal:`width`},height:{signal:`height`}}},e),hq.prototype=gq.prototype={parse(e){return pq(e,this)},fork(){return new gq(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+`:`:0)+this._id++},add(e){return this.operators.push(e),e.id=this.id(),e.refs&&=(e.refs.forEach(t=>{t.$ref=e.id}),null),e},proxy(e){let t=e instanceof bK?CK(e):e;return this.add(_J({value:t}))},addStream(e){return this.streams.push(e),e.id=this.id(),e},addUpdate(e){return this.updates.push(e),e},finish(){let e,t;for(e in this.root&&(this.root.root=!0),this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(e,t,n){let r,i;e&&(r=e.data||={},i=r[t]||(r[t]=[]),i.push(n))}for(e in this.data){t=this.data[e],n(t.input,e,`input`),n(t.output,e,`output`),n(t.values,e,`values`);for(let r in t.index)n(t.index[r],e,`index:`+r)}return this},pushState(e,t,n){this._encode.push(CK(this.add(xJ({pulse:e})))),this._parent.push(t),this._lookup.push(n?CK(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return Ih(this._parent)},encode(){return Ih(this._encode)},lookup(){return Ih(this._lookup)},markpath(){let e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(vg(e))return wK(e,t);e.signal||U(`Unsupported field reference: `+G(e));let n=e.signal,r=this.field[n];if(!r){let e={name:this.signalRef(n)};t&&(e.as=t),this.field[n]=r=CK(this.add(oJ(e)))}return r},compareRef(e){let t=!1,n=e=>DK(e)?(t=!0,this.signalRef(e.signal)):ODe(e)?(t=!0,this.exprRef(e.expr)):e,r=Qh(e.field).map(n),i=Qh(e.order).map(n);return t?CK(this.add(tJ({fields:r,orders:i}))):TK(r,i)},keyRef(e,t){let n=!1,r=e=>DK(e)?(n=!0,CK(i[e.signal])):e,i=this.signals;return e=Qh(e).map(r),n?CK(this.add(sJ({fields:e,flat:t}))):EDe(e,t)},sortRef(e){if(!e)return e;let t=EK(e.op,e.field),n=e.order||Wq;return n.signal?CK(this.add(tJ({fields:t,orders:this.signalRef(n.signal)}))):TK(t,n)},event(e,t){let n=e+`:`+t;if(!this.events[n]){let r=this.id();this.streams.push({id:r,source:e,type:t}),this.events[n]=r}return this.events[n]},hasOwnSignal(e){return cg(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&U(`Duplicate signal name: `+G(e));let n=t instanceof bK?t:this.add(SK(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||U(`Unrecognized signal name: `+G(e)),this.signals[e]},signalRef(e){return this.signals[e]?CK(this.signals[e]):(cg(this.lambdas,e)||(this.lambdas[e]=this.add(SK(null))),CK(this.lambdas[e]))},parseLambdas(){let e=Object.keys(this.lambdas);for(let t=0,n=e.length;tNO,CanvasHandler:()=>ZA,CanvasRenderer:()=>$A,DATE:()=>ry,DAY:()=>`day`,DAYOFYEAR:()=>iy,Dataflow:()=>Dx,Debug:()=>4,DisallowedObjectProperties:()=>Oh,Error:()=>1,EventStream:()=>vx,Gradient:()=>Nme,GroupItem:()=>FO,HOURS:()=>ay,Handler:()=>DA,HybridHandler:()=>kj,HybridRenderer:()=>Oj,Info:()=>3,Item:()=>PO,MILLISECONDS:()=>cy,MINUTES:()=>oy,MONTH:()=>ty,Marks:()=>wA,MultiPulse:()=>wx,None:()=>0,Operator:()=>gx,Parameters:()=>hx,Pulse:()=>bx,QUARTER:()=>ey,RenderType:()=>Fj,Renderer:()=>OA,ResourceLoader:()=>tA,SECONDS:()=>sy,SVGHandler:()=>tj,SVGRenderer:()=>Sj,SVGStringRenderer:()=>Ej,Scenegraph:()=>EA,TIME_UNITS:()=>ly,Transform:()=>K,View:()=>TG,WEEK:()=>ny,Warn:()=>2,YEAR:()=>$v,accessor:()=>lh,accessorFields:()=>dh,accessorName:()=>uh,array:()=>Qh,ascending:()=>rg,bandwidthNRD:()=>iS,bin:()=>aS,bootstrapCI:()=>oS,boundClip:()=>Uge,boundContext:()=>RO,boundItem:()=>Sk,boundMark:()=>ege,boundStroke:()=>LO,changeset:()=>mx,clampRange:()=>fae,codegenExpression:()=>OH,compare:()=>ng,constant:()=>ig,cumulativeLogNormal:()=>gS,cumulativeNormal:()=>uS,cumulativeUniform:()=>SS,dayofyear:()=>kv,debounce:()=>ag,defaultLocale:()=>Db,definition:()=>kx,densityLogNormal:()=>hS,densityNormal:()=>lS,densityUniform:()=>xS,detectTimeUnits:()=>Qv,domChild:()=>Tk,domClear:()=>Ek,domCreate:()=>Ck,domFind:()=>wk,dotbin:()=>sS,error:()=>U,expressionFunction:()=>xW,extend:()=>og,extent:()=>sg,extentIndex:()=>Cae,falsy:()=>Dh,fastmap:()=>ug,field:()=>bh,flush:()=>Eae,font:()=>vk,fontFamily:()=>_k,fontSize:()=>fk,format:()=>ex,formatLocale:()=>bb,formats:()=>Rb,hasOwnProperty:()=>cg,id:()=>Sh,identity:()=>Ch,inferType:()=>Mb,inferTypes:()=>Nb,ingest:()=>cx,inherits:()=>fg,inrange:()=>pg,interpolate:()=>ZD,interpolateColors:()=>XD,interpolateRange:()=>Xpe,intersect:()=>Rge,intersectBoxLine:()=>VO,intersectPath:()=>zO,intersectPoint:()=>BO,intersectRule:()=>ahe,isArray:()=>W,isBoolean:()=>mg,isDate:()=>hg,isFunction:()=>eg,isIterable:()=>Mae,isNumber:()=>gg,isObject:()=>jh,isRegExp:()=>_g,isString:()=>vg,isTuple:()=>ax,key:()=>yg,lerp:()=>Rae,lineHeight:()=>pk,loader:()=>tx,locale:()=>Eb,logger:()=>kh,lruCache:()=>Bae,markup:()=>kk,merge:()=>Wae,mergeConfig:()=>Nh,multiLineOffset:()=>hk,one:()=>Th,pad:()=>qae,panLinear:()=>iae,panLog:()=>aae,panPow:()=>oae,panSymlog:()=>sae,parse:()=>HOe,parseExpression:()=>EH,parseSelector:()=>WG,path:()=>Dw,pathCurves:()=>wO,pathEqual:()=>Wge,pathParse:()=>TO,pathRectangle:()=>Gme,pathRender:()=>EO,pathSymbols:()=>zme,pathTrail:()=>Kme,peek:()=>Ih,point:()=>Dk,projection:()=>GL,quantileLogNormal:()=>_S,quantileNormal:()=>dS,quantileUniform:()=>CS,quantiles:()=>nS,quantizeInterpolator:()=>Zpe,quarter:()=>lae,quartiles:()=>rS,random:()=>RS,randomInteger:()=>Ole,randomKDE:()=>pS,randomLCG:()=>Dle,randomLogNormal:()=>vS,randomMixture:()=>yS,randomNormal:()=>fS,randomUniform:()=>wS,read:()=>Bb,regressionConstant:()=>TS,regressionExp:()=>MS,regressionLinear:()=>AS,regressionLoess:()=>IS,regressionLog:()=>jS,regressionPoly:()=>FS,regressionPow:()=>NS,regressionQuad:()=>PS,renderModule:()=>Pk,repeat:()=>bg,resetDefaultLocale:()=>Uce,resetSVGDefIds:()=>Kge,responseType:()=>zb,runtimeContext:()=>qW,sampleCurve:()=>LS,sampleLogNormal:()=>mS,sampleNormal:()=>cS,sampleUniform:()=>bS,scale:()=>WD,sceneEqual:()=>Fk,sceneFromJSON:()=>nge,scenePickVisit:()=>JO,sceneToJSON:()=>tge,sceneVisit:()=>qO,sceneZOrder:()=>KO,scheme:()=>QD,serializeXML:()=>hj,setHybridRendererOptions:()=>Lge,setRandom:()=>Tle,span:()=>xg,splitAccessPath:()=>vh,stringValue:()=>G,textMetrics:()=>SA,timeBin:()=>Zv,timeFloor:()=>Vv,timeFormatLocale:()=>Tb,timeInterval:()=>Uv,timeOffset:()=>Kv,timeSequence:()=>Yv,timeUnitSpecifier:()=>Dv,timeUnits:()=>Ev,toBoolean:()=>Sg,toDate:()=>Cg,toNumber:()=>Rh,toSet:()=>Tg,toString:()=>wg,transform:()=>Ax,transforms:()=>$x,truncate:()=>noe,truthy:()=>Eh,tupleid:()=>ox,typeParsers:()=>Xb,utcFloor:()=>Hv,utcInterval:()=>Wv,utcOffset:()=>qv,utcSequence:()=>Xv,utcdayofyear:()=>Pv,utcquarter:()=>uae,utcweek:()=>Fv,version:()=>UY,visitArray:()=>Eg,week:()=>Av,writeConfig:()=>Ph,zero:()=>wh,zoomLinear:()=>Vh,zoomLog:()=>Hh,zoomPow:()=>Uh,zoomSymlog:()=>Wh}),HY,UY,WY=o((()=>{Dg(),Dg(),eS(),mue(),hve(),Nve(),Ibe(),Yxe(),bCe(),ICe(),RCe(),uwe(),ywe(),Twe(),GS(),Ry(),nx(),zj(),xO(),XL(),dDe(),jb(),UW(),UOe(),tG(),OU(),sK(),HY=`6.3.1`,og($x,Lle,K_e,gve,gbe,Uxe,xCe,gCe,LCe,swe,dwe,bwe),UY=HY}));function GOe(e,t,n){let r;t.x2&&(t.x?(n&&e.x>e.x2&&(r=e.x,e.x=e.x2,e.x2=r),e.width=e.x2-e.x):e.x=e.x2-(e.width||0)),t.xc&&(e.x=e.xc-(e.width||0)/2),t.y2&&(t.y?(n&&e.y>e.y2&&(r=e.y,e.y=e.y2,e.y2=r),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),t.yc&&(e.y=e.yc-(e.height||0)/2)}function GY(e,t,n,r,i,a){let o=e=>tX[e.type](o,e);return o.memberDepth=0,o.fn=Object.create(t),o.params=n,o.datum=r,o.event=i,o.item=a,$Y.forEach(e=>o.fn[e]=(...t)=>i.vega[e](...t)),o(e)}var KY,qY,JY,YY,XY,ZY,QY,$Y,eX,tX,nX,KOe=o((()=>{Dg(),KY={NaN:NaN,E:Math.E,LN2:Math.LN2,LN10:Math.LN10,LOG2E:Math.LOG2E,LOG10E:Math.LOG10E,PI:Math.PI,SQRT1_2:Math.SQRT1_2,SQRT2:Math.SQRT2,MIN_VALUE:Number.MIN_VALUE,MAX_VALUE:Number.MAX_VALUE},qY={"*":(e,t)=>e*t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,">":(e,t)=>e>t,"<":(e,t)=>ee<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,"&":(e,t)=>e&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"<<":(e,t)=>e<>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t},JY={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e},YY=Array.prototype.slice,XY=(e,t,n)=>{let r=n?n(t[0]):t[0];return r[e].apply(r,YY.call(t,1))},ZY=(e,t=0,n=1,r=0,i=0,a=0,o=0)=>vg(e)?new Date(e):new Date(e,t,n,r,i,a,o),QY={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(e,t,n)=>Math.max(t,Math.min(n,e)),now:Date.now,utc:Date.UTC,datetime:ZY,date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return XY(`join`,arguments)},indexof:function(){return XY(`indexOf`,arguments)},lastindexof:function(){return XY(`lastIndexOf`,arguments)},slice:function(){return XY(`slice`,arguments)},reverse:e=>e.slice().reverse(),sort:e=>e.slice().sort(rg),parseFloat,parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return XY(`substring`,arguments,String)},split:function(){return XY(`split`,arguments,String)},replace:function(){return XY(`replace`,arguments,String)},trim:e=>String(e).trim(),btoa:e=>btoa(e),atob:e=>atob(e),encodeURIComponent:e=>encodeURIComponent(e),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)},$Y=[`view`,`item`,`group`,`xy`,`x`,`y`],eX=new Set([Function,eval,setTimeout,setInterval]),typeof setImmediate==`function`&&eX.add(setImmediate),tX={Literal:(e,t)=>t.value,Identifier:(e,t)=>{let n=t.name;return e.memberDepth>0?n:n===`datum`?e.datum:n===`event`?e.event:n===`item`?e.item:KY[n]||e.params[`$`+n]},MemberExpression:(e,t)=>{let n=!t.computed,r=e(t.object);n&&(e.memberDepth+=1);let i=e(t.property);if(n&&--e.memberDepth,eX.has(r[i])){console.error(`Prevented interpretation of member "${i}" which could lead to insecure code execution`);return}return r[i]},CallExpression:(e,t)=>{let n=t.arguments,r=t.callee.name;return r.startsWith(`_`)&&(r=r.slice(1)),r===`if`?e(n[0])?e(n[1]):e(n[2]):(e.fn[r]||QY[r]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>qY[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>JY[t.operator](e(t.argument)),ConditionalExpression:(e,t)=>e(t.test)?e(t.consequent):e(t.alternate),LogicalExpression:(e,t)=>t.operator===`&&`?e(t.left)&&e(t.right):e(t.left)||e(t.right),ObjectExpression:(e,t)=>t.properties.reduce((t,n)=>{e.memberDepth+=1;let r=e(n.key);--e.memberDepth;let i=e(n.value);return Oh.has(r)?console.error(`Prevented interpretation of property "${r}" which could lead to insecure code execution`):eX.has(i)?console.error(`Prevented interpretation of method "${r}" which could lead to insecure code execution`):t[r]=i,t},{})},nX={operator(e,t){let n=t.ast,r=e.functions;return e=>GY(n,r,e)},parameter(e,t){let n=t.ast,r=e.functions;return(e,t)=>GY(n,r,t,e)},event(e,t){let n=t.ast,r=e.functions;return e=>GY(n,r,void 0,void 0,e)},handler(e,t){let n=t.ast,r=e.functions;return(e,t)=>{let i=t.item&&t.item.datum;return GY(n,r,e,i,t)}},encode(e,t){let{marktype:n,channels:r}=t,i=e.functions,a=n===`group`||n===`image`||n===`rect`;return(e,t)=>{let o=e.datum,s=0,c;for(let n in r)c=GY(r[n].ast,i,t,o,void 0,e),e[n]!==c&&(e[n]=c,s=1);return n!==`rule`&&GOe(e,r,a),s}}}}));function rX(e){this.type=e}function qOe(e){switch(e.type){case zX:return e.elements;case BX:case UX:return[e.left,e.right];case VX:return[e.callee].concat(e.arguments);case HX:return[e.test,e.consequent,e.alternate];case WX:return[e.object,e.property];case GX:return e.properties;case LX:return[e.key,e.value];case KX:return[e.argument];case RX:case IX:case FX:default:return[]}}function iX(e,t){if(!e)throw Error(`ASSERT: `+t)}function aX(e){return e>=48&&e<=57}function oX(e){return`0123456789abcdefABCDEF`.includes(e)}function sX(e){return`01234567`.includes(e)}function JOe(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e)}function cX(e){return e===10||e===13||e===8232||e===8233}function lX(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&kZ.test(String.fromCharCode(e))}function uX(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&AZ.test(String.fromCharCode(e))}function dX(){for(;Y1114111||e!==`}`)&&wX({},_Z,DZ),t<=65535?String.fromCharCode(t):(n=(t-65536>>10)+55296,r=(t-65536&1023)+56320,String.fromCharCode(n,r))}function pX(){var e=JX.charCodeAt(Y++),t=String.fromCharCode(e);for(e===92&&(JX.charCodeAt(Y)!==117&&wX({},_Z,DZ),++Y,e=fX(`u`),(!e||e===`\\`||!lX(e.charCodeAt(0)))&&wX({},_Z,DZ),t=e);Y>>=`)return Y+=4,{type:rZ,value:o,start:e,end:Y};if(a=o.substr(0,3),a===`>>>`||a===`<<=`||a===`>>=`)return Y+=3,{type:rZ,value:a,start:e,end:Y};if(i=a.substr(0,2),r===i[1]&&`+-<>&|`.includes(r)||i===`=>`)return Y+=2,{type:rZ,value:i,start:e,end:Y};if(i===`//`&&wX({},_Z,DZ),`<>=!+-*%&|^/`.includes(r))return++Y,{type:rZ,value:r,start:e,end:Y};wX({},_Z,DZ)}function QOe(e){let t=``;for(;Y{if(parseInt(t,16)<=1114111)return`x`;wX({},CZ)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,`x`));try{new RegExp(n)}catch{wX({},CZ)}try{return new RegExp(e,t)}catch{return null}}function nke(){var e=JX[Y],t,n,r,i;for(iX(e===`/`,`Regular expression literal must start with a slash`),t=JX[Y++],n=!1,r=!1;Y=0&&wX({},CZ,n),{value:n,literal:t}}function ike(){var e,t,n,r;return XX=null,dX(),e=Y,t=nke(),n=rke(),r=tke(t.value,n.value),{literal:t.literal+n.literal,value:r,regex:{pattern:t.value,flags:n.value},start:e,end:Y}}function ake(e){return e.type===$X||e.type===eZ||e.type===ZX||e.type===tZ}function gX(){if(dX(),Y>=YX)return{type:QX,start:Y,end:Y};let e=JX.charCodeAt(Y);return lX(e)?ZOe():e===40||e===41||e===59?mX():e===39||e===34?eke():e===46?aX(JX.charCodeAt(Y+1))?hX():mX():aX(e)?hX():mX()}function _X(){let e=XX;return Y=e.end,XX=gX(),Y=e.end,e}function vX(){let e=Y;XX=gX(),Y=e}function oke(e){let t=new rX(oZ);return t.elements=e,t}function yX(e,t,n){let r=new rX(e===`||`||e===`&&`?fZ:sZ);return r.operator=e,r.left=t,r.right=n,r}function ske(e,t){let n=new rX(cZ);return n.callee=e,n.arguments=t,n}function cke(e,t,n){let r=new rX(lZ);return r.test=e,r.consequent=t,r.alternate=n,r}function bX(e){let t=new rX(uZ);return t.name=e,t}function xX(e){let t=new rX(dZ);return t.value=e.value,t.raw=JX.slice(e.start,e.end),e.regex&&(t.raw===`//`&&(t.raw=`/(?:)/`),t.regex=e.regex),t}function SX(e,t,n){let r=new rX(pZ);return r.computed=e===`[`,r.object=t,r.property=n,r.computed||(n.member=!0),r}function lke(e){let t=new rX(mZ);return t.properties=e,t}function CX(e,t,n){let r=new rX(hZ);return r.key=t,r.value=n,r.kind=e,r}function uke(e,t){let n=new rX(gZ);return n.operator=e,n.argument=t,n.prefix=!0,n}function wX(e,t){var n,r=Array.prototype.slice.call(arguments,2),i=t.replace(/%(\d)/g,(e,t)=>(iX(t`:case`<=`:case`>=`:case`instanceof`:case`in`:t=7;break;case`<<`:case`>>`:case`>>>`:t=8;break;case`+`:case`-`:t=9;break;case`*`:case`/`:case`%`:t=11;break}return t}function xke(){var e=XX,t,n,r,i,a,o,s,c=jX(),l;if(r=XX,i=MX(r),i===0)return c;for(r.prec=i,_X(),t=[e,XX],o=jX(),a=[c,r,o];(i=MX(XX))>0;){for(;a.length>2&&i<=a[a.length-2].prec;)o=a.pop(),s=a.pop().value,c=a.pop(),t.pop(),n=yX(s,c,o),a.push(n);r=_X(),r.prec=i,a.push(r),t.push(XX),n=jX(),a.push(n)}for(l=a.length-1,n=a[l],t.pop();l>1;)t.pop(),n=yX(a[l-1].value,a[l-2],n),l-=2;return n}function NX(){var e=xke(),t,n;return DX(`?`)&&(_X(),t=NX(),EX(`:`),n=NX(),e=cke(e,t,n)),e}function PX(){let e=NX();if(DX(`,`))throw Error(OZ);return e}function Ske(e){JX=e,Y=0,YX=JX.length,XX=null,vX();let t=PX();if(XX.type!==QX)throw Error(`Unexpect token after expression.`);return t}var FX,IX,LX,RX,zX,BX,VX,HX,UX,WX,GX,KX,qX,JX,Y,YX,XX,ZX,QX,$X,eZ,tZ,nZ,rZ,iZ,aZ,oZ,sZ,cZ,lZ,uZ,dZ,fZ,pZ,mZ,hZ,gZ,_Z,vZ,yZ,bZ,xZ,SZ,CZ,wZ,TZ,EZ,DZ,OZ,kZ,AZ,jZ,MZ,Cke=o((()=>{Dg(),FX=`RawCode`,IX=`Literal`,LX=`Property`,RX=`Identifier`,zX=`ArrayExpression`,BX=`BinaryExpression`,VX=`CallExpression`,HX=`ConditionalExpression`,UX=`LogicalExpression`,WX=`MemberExpression`,GX=`ObjectExpression`,KX=`UnaryExpression`,rX.prototype.visit=function(e){let t,n,r;if(e(this))return 1;for(t=qOe(this),n=0,r=t.length;n`,qX[$X]=`Identifier`,qX[eZ]=`Keyword`,qX[tZ]=`Null`,qX[nZ]=`Numeric`,qX[rZ]=`Punctuator`,qX[iZ]=`String`,qX[aZ]=`RegularExpression`,oZ=`ArrayExpression`,sZ=`BinaryExpression`,cZ=`CallExpression`,lZ=`ConditionalExpression`,uZ=`Identifier`,dZ=`Literal`,fZ=`LogicalExpression`,pZ=`MemberExpression`,mZ=`ObjectExpression`,hZ=`Property`,gZ=`UnaryExpression`,_Z=`Unexpected token %0`,vZ=`Unexpected number`,yZ=`Unexpected string`,bZ=`Unexpected identifier`,xZ=`Unexpected reserved word`,SZ=`Unexpected end of input`,CZ=`Invalid regular expression`,wZ=`Invalid regular expression: missing /`,TZ=`Octal literals are not allowed in strict mode.`,EZ=`Duplicate data property in object literal not allowed in strict mode`,DZ=`ILLEGAL`,OZ=`Disabled.`,kZ=RegExp(`[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]`),AZ=RegExp(`[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]`),jZ={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1},MZ={if:1}})),wke=c({accessPathDepth:()=>fQ,accessPathWithDatum:()=>aQ,accessWithDatumToUnescapedPath:()=>sQ,compile:()=>kRe,contains:()=>UZ,deepEqual:()=>yQ,deleteNestedProperty:()=>rQ,duplicate:()=>h2,entries:()=>_2,every:()=>GZ,fieldIntersection:()=>ZZ,flatAccessWithDatum:()=>oQ,getFirstDefined:()=>pQ,hasIntersection:()=>YZ,hasProperty:()=>X,hash:()=>VZ,internalField:()=>hQ,isBoolean:()=>$Z,isEmpty:()=>QZ,isEqual:()=>Eke,isInternalField:()=>gQ,isNullOrFalse:()=>HZ,isNumeric:()=>vQ,isPrimitive:()=>eQ,keys:()=>$,logicalExpr:()=>nQ,mergeDeep:()=>KZ,never:()=>RZ,normalize:()=>dPe,normalizeAngle:()=>_Q,omit:()=>BZ,pick:()=>zZ,prefixGenerator:()=>XZ,removePathFromField:()=>dQ,replaceAll:()=>uQ,replacePathInField:()=>lQ,resetIdCounter:()=>Oke,setEqual:()=>JZ,some:()=>WZ,stringify:()=>bQ,titleCase:()=>iQ,unescapeSingleQuoteAndPathDot:()=>cQ,unique:()=>qZ,uniqueId:()=>mQ,vals:()=>g2,varName:()=>tQ,version:()=>GVe});function NZ(e){return X(e,`or`)}function PZ(e){return X(e,`and`)}function FZ(e){return X(e,`not`)}function IZ(e,t){if(FZ(e))IZ(e.not,t);else if(PZ(e))for(let n of e.and)IZ(n,t);else if(NZ(e))for(let n of e.or)IZ(n,t);else t(e)}function LZ(e,t){return FZ(e)?{not:LZ(e.not,t)}:PZ(e)?{and:e.and.map(e=>LZ(e,t))}:NZ(e)?{or:e.or.map(e=>LZ(e,t))}:t(e)}function RZ(e){throw Error(e)}function zZ(e,t){let n={};for(let r of t)cg(e,r)&&(n[r]=e[r]);return n}function BZ(e,t){let n={...e};for(let e of t)delete n[e];return n}function VZ(e){if(gg(e))return e;let t=vg(e)?e:bQ(e);if(t.length<250)return t;let n=0;for(let e=0;et===0?e:`[${e}]`),r=e.map((t,n)=>e.slice(0,n+1).join(``));for(let e of r)t.add(e)}return t}function ZZ(e,t){return e===void 0||t===void 0||YZ(XZ(e),XZ(t))}function QZ(e){return $(e).length===0}function $Z(e){return e===!0||e===!1}function eQ(e){return vg(e)||gg(e)||$Z(e)}function tQ(e){let t=e.replace(/\W/g,`_`);return(e.match(/^\d+/)?`_`:``)+t}function nQ(e,t){return FZ(e)?`!(${nQ(e.not,t)})`:PZ(e)?`(${e.and.map(e=>nQ(e,t)).join(`) && (`)})`:NZ(e)?`(${e.or.map(e=>nQ(e,t)).join(`) || (`)})`:t(e)}function rQ(e,t){if(t.length===0)return!0;let n=t.shift();return n in e&&rQ(e[n],t)&&delete e[n],QZ(e)}function iQ(e){return e.charAt(0).toUpperCase()+e.substr(1)}function aQ(e,t=`datum`){let n=vh(e),r=[];for(let e=1;e<=n.length;e++){let i=`[${n.slice(0,e).map(G).join(`][`)}]`;r.push(`${t}${i}`)}return r.join(` && `)}function oQ(e,t=`datum`){return`${t}[${G(vh(e).join(`.`))}]`}function sQ(e){return`datum['${e.replaceAll(`'`,`\\'`)}']`}function cQ(e){return e.replaceAll(`\\'`,`'`).replaceAll(`\\.`,`.`)}function Dke(e){return e.replace(/(\[|\]|\.|'|")/g,`\\$1`)}function lQ(e){return`${vh(e).map(Dke).join(`\\.`)}`}function uQ(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`),`g`),n)}function dQ(e){return`${vh(e).join(`.`)}`}function fQ(e){return e?vh(e).length:0}function pQ(...e){return e.find(e=>e!==void 0)}function mQ(e){let t=++v2;return e?String(e)+t:t}function Oke(){v2=42}function hQ(e){return gQ(e)?e:`__${e}`}function gQ(e){return e.startsWith(`__`)}function _Q(e){if(e!==void 0)return(e%360+360)%360}function vQ(e){return gg(e)?!0:!isNaN(e)&&!isNaN(parseFloat(e))}function yQ(e,t){if(e===t)return!0;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(e.constructor.name!==t.constructor.name)return!1;let n,r;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!yQ(e[r],t[r]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let n of e.entries())if(!t.has(n[0]))return!1;for(let n of e.entries())if(!yQ(n[1],t.get(n[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e.entries())if(!t.has(n[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&e.valueOf!==y2.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&e.toString!==y2.toString)return e.toString()===t.toString();let i=Object.keys(e);if(n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!yQ(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function bQ(e){let t=[];return(function e(n){if(n?.toJSON&&typeof n.toJSON==`function`&&(n=n.toJSON()),n===void 0)return;if(typeof n==`number`)return isFinite(n)?`${n}`:`null`;if(typeof n!=`object`)return JSON.stringify(n);let r,i;if(Array.isArray(n)){for(i=`[`,r=0;rqQ(e[t])?tQ(`_${t}_${_2(e[t])}`):tQ(`_${t}_${e[t]}`)).join(``)}`}function WQ(e){return e===!0||KQ(e)&&!e.binned}function GQ(e){return e===`binned`||KQ(e)&&e.binned===!0}function KQ(e){return jh(e)}function qQ(e){return X(e,`param`)}function Ike(e){switch(e){case b2:case x2:case H2:case R2:case z2:case B2:case q2:case W2:case G2:case K2:case V2:return 6;case J2:return 4;default:return 10}}function JQ(e){return X(e,`expr`)}function YQ(e,{level:t}={level:0}){let n=$(e||{}),r={};for(let i of n)r[i]=t===0?e$(e[i]):YQ(e[i],{level:t-1});return r}function Lke(e){let{anchor:t,frame:n,offset:r,orient:i,angle:a,limit:o,color:s,subtitleColor:c,subtitleFont:l,subtitleFontSize:u,subtitleFontStyle:d,subtitleFontWeight:f,subtitleLineHeight:p,subtitlePadding:m,...h}=e,g={...h,...s?{fill:s}:{}},_={...t?{anchor:t}:{},...n?{frame:n}:{},...r?{offset:r}:{},...i?{orient:i}:{},...a===void 0?{}:{angle:a},...o===void 0?{}:{limit:o}},v={...c?{subtitleColor:c}:{},...l?{subtitleFont:l}:{},...u?{subtitleFontSize:u}:{},...d?{subtitleFontStyle:d}:{},...f?{subtitleFontWeight:f}:{},...p?{subtitleLineHeight:p}:{},...m?{subtitlePadding:m}:{}};return{titleMarkConfig:g,subtitleMarkConfig:zZ(e,[`align`,`baseline`,`dx`,`dy`,`limit`]),nonMarkTitleProperties:_,subtitle:v}}function XQ(e){return vg(e)||W(e)&&vg(e[0])}function ZQ(e){return X(e,`signal`)}function QQ(e){return X(e,`step`)}function Rke(e){return!W(e)&&X(e,`fields`)&&!X(e,`data`)}function zke(e){return!W(e)&&X(e,`fields`)&&X(e,`data`)}function $Q(e){return!W(e)&&X(e,`field`)&&X(e,`data`)}function Bke(e){let t=W(e.condition)?e.condition.map(Vke):Vke(e.condition);return{...e$(e),condition:t}}function e$(e){if(JQ(e)){let{expr:t,...n}=e;return{signal:t,...n}}return e}function Vke(e){if(JQ(e)){let{expr:t,...n}=e;return{signal:t,...n}}return e}function t$(e){if(JQ(e)){let{expr:t,...n}=e;return{signal:t,...n}}return ZQ(e)?e:e===void 0?void 0:{value:e}}function Hke(e){return ZQ(e)?e.signal:G(e)}function Uke(e){return ZQ(e)?e.signal:G(e.value)}function n$(e){return ZQ(e)?e.signal:e==null?null:G(e)}function Wke(e,t,n){for(let r of n){let n=i$(r,t.markDef,t.config);n!==void 0&&(e[r]=t$(n))}return e}function Gke(e){return[].concat(e.type,e.style??[])}function r$(e,t,n,r={}){let{vgChannel:i,ignoreVgConfig:a}=r;return i&&X(t,i)?t[i]:t[e]===void 0?a&&(!i||i===e)?void 0:i$(e,t,n,r):t[e]}function i$(e,t,n,{vgChannel:r}={}){let i=a$(e,t,n.style);return pQ(r?i:void 0,i,r?n[t.type][r]:void 0,n[t.type][e],r?n.mark[r]:n.mark[e])}function a$(e,t,n){return Kke(e,Gke(t),n)}function Kke(e,t,n){t=Qh(t);let r;for(let i of t){let t=n[i];X(t,e)&&(r=t[e])}return r}function qke(e,t){return Qh(e).reduce((e,n)=>(e.field.push(m1(n,t)),e.order.push(n.sort??`ascending`),e),{field:[],order:[]})}function Jke(e,t){let n=[...e];return t.forEach(e=>{for(let t of n)if(yQ(t,e))return;n.push(e)}),n}function Yke(e,t){return yQ(e,t)||!t?e:e?[...Qh(e),...Qh(t)].join(`, `):t}function Xke(e,t){let n=e.value,r=t.value;if(n==null||r===null)return{explicit:e.explicit,value:null};if((XQ(n)||ZQ(n))&&(XQ(r)||ZQ(r)))return{explicit:e.explicit,value:Yke(n,r)};if(XQ(n)||ZQ(n))return{explicit:e.explicit,value:n};if(XQ(r)||ZQ(r))return{explicit:e.explicit,value:r};if(!XQ(n)&&!ZQ(n)&&!XQ(r)&&!ZQ(r))return{explicit:e.explicit,value:Jke(n,r)};throw Error(`It should never reach here`)}function o$(e){return`Invalid specification ${bQ(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}function Zke(e){return`${e==`width`?`Width`:`Height`} "container" only works for single views and layered views.`}function Qke(e){return`${e==`width`?`Width`:`Height`} "container" only works well with autosize "fit" or "fit-${e==`width`?`x`:`y`}".`}function $ke(e){return e?`Dropping "fit-${e}" because spec has discrete ${AQ(e)}.`:`Dropping "fit" because spec has discrete size.`}function s$(e){return`Unknown field for ${e}. Cannot calculate view size.`}function eAe(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function tAe(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function nAe(e){return`The "nearest" transform is not supported for ${e} marks.`}function rAe(e){return`Selection not supported for ${e} yet.`}function iAe(e){return`Cannot find a selection named "${e}".`}function aAe(e){return`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`}function oAe(e){return`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`}function sAe(e){return`Unknown repeated value "${e}".`}function cAe(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}function lAe(e){return`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${G(e)}.`}function uAe(e,t,n,r){return`${e.length?`Multiple `:`No `}matching ${G(t)} encoding found for selection ${G(n.param)}. Using "field": ${G(r)}.`}function dAe(e){return`Unrecognized parse "${e}".`}function fAe(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function pAe(e){return`Ignoring an invalid transform: ${bQ(e)}.`}function mAe(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function hAe(e){let{parentProjection:t,projection:n}=e;return`Layer's shared projection ${bQ(t)} is overridden by a child projection ${bQ(n)}.`}function gAe(e){return`${e}Offset dropped because ${e} is continuous`}function _Ae(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${bQ(n)}}.`}function vAe(e){return`Invalid field type "${e}".`}function yAe(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}function bAe(e){return`Invalid aggregation operator "${e}".`}function xAe(e,t){let{fill:n,stroke:r}=t;return`Dropping color ${e} as the plot also has ${n&&r?`fill and stroke`:n?`fill`:`stroke`}.`}function SAe(e){return`Position range does not support relative band size for ${e}.`}function c$(e,t){return`Dropping ${bQ(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}function l$(e,t,n){return`${e} dropped as it is incompatible with "${t}".`}function CAe(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`}function wAe(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function TAe(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function EAe(e){return`Facet encoding dropped as ${e.join(` and `)} ${e.length>1?`are`:`is`} also specified.`}function u$(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${t===`ordinal`?`order`:`magnitude`}.`}function DAe(e){return`The ${e} for range marks cannot be an expression`}function OAe(e,t){return`Line mark is for continuous lines and thus cannot be used with ${e&&t?`x2 and y2`:e?`x2`:`y2`}. We will use the rule mark (line segments) instead.`}function kAe(e,t){return`Specified orient "${e}" overridden with "${t}".`}function AAe(e){return`Cannot use the scale property "${e}" with non-color channel.`}function jAe(e){return`Cannot use the relative band size with ${e} scale.`}function MAe(e){return`Using unaggregated domain with raw field has no effect (${bQ(e)}).`}function NAe(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function PAe(e){return`Unaggregated domain is currently unsupported for log scale (${bQ(e)}).`}function FAe(e){return`Cannot apply size to non-oriented mark "${e}".`}function IAe(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}function LAe(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}function RAe(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function zAe(e){return`The step for "${e}" is dropped because the ${e===`width`?`x`:`y`} is continuous.`}function BAe(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${bQ(n)} and ${bQ(r)}). Using ${bQ(n)}.`}function VAe(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${bQ(n)} and ${bQ(r)}). Using the union of the two domains.`}function HAe(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}function UAe(e){return`Dropping sort property ${bQ(e)} as unioned domains only support boolean or op "count", "min", and "max".`}function WAe(e,t){return`Unioning discrete legend values from ${e} and ${t}.`}function GAe(e){return`Cannot stack "${e}" if there is already "${e}2".`}function KAe(e){return`Stack is applied to a non-linear scale (${e}).`}function qAe(e){return`Stacking is applied even though the aggregate function is non-summative ("${e}").`}function d$(e,t){return`Invalid ${e}: ${bQ(t)}.`}function JAe(e){return`Dropping day from datetime ${bQ(e)} as day cannot be combined with other units.`}function YAe(e,t){return`${t?`extent `:``}${t&&e?`and `:``}${e?`center `:``}${t&&e?`are `:`is `}not needed when data are aggregated.`}function XAe(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}function ZAe(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}function QAe(e){return`1D error band does not support ${e}.`}function $Ae(e){return`Channel ${e} is required for "binned" bin.`}function eje(e){return`Channel ${e} should not be used with "binned" bin.`}function tje(e){return`Domain for ${e} is required for threshold scale.`}function nje(e){return S4=e,S4}function rje(){return S4=x4,S4}function f$(...e){S4.error(...e)}function Z(...e){S4.warn(...e)}function ije(...e){S4.debug(...e)}function p$(e){if(e&&jh(e)){for(let t of E4)if(X(e,t))return!0}return!1}function aje(e){if(vQ(e)&&(e=+e),gg(e))return e>4&&Z(d$(`quarter`,e)),e-1;throw Error(d$(`quarter`,e))}function oje(e){if(vQ(e)&&(e=+e),gg(e))return e-1;{let t=e.toLowerCase(),n=C4.indexOf(t);if(n!==-1)return n;let r=t.substr(0,3),i=Uze.indexOf(r);if(i!==-1)return i;throw Error(d$(`month`,e))}}function sje(e){if(vQ(e)&&(e=+e),gg(e))return e%7;{let t=e.toLowerCase(),n=w4.indexOf(t);if(n!==-1)return n;let r=t.substr(0,3),i=Wze.indexOf(r);if(i!==-1)return i;throw Error(d$(`day`,e))}}function m$(e,t){let n=[];if(t&&e.day!==void 0&&$(e).length>1&&(Z(JAe(e)),e=h2(e),delete e.day),e.year===void 0?n.push(2012):n.push(e.year),e.month!==void 0){let r=t?oje(e.month):e.month;n.push(r)}else if(e.quarter!==void 0){let r=t?aje(e.quarter):e.quarter;n.push(gg(r)?r*3:`${r}*3`)}else n.push(0);if(e.date!==void 0)n.push(e.date);else if(e.day!==void 0){let r=t?sje(e.day):e.day;n.push(gg(r)?r+1:`${r}+1`)}else n.push(1);for(let t of[`hours`,`minutes`,`seconds`,`milliseconds`]){let r=e[t];n.push(r===void 0?0:r)}return n}function h$(e){let t=m$(e,!0).join(`, `);return e.utc?`utc(${t})`:`datetime(${t})`}function cje(e){let t=m$(e,!1).join(`, `);return e.utc?`utc(${t})`:`datetime(${t})`}function lje(e){let t=m$(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}function uje(e){return cg(T4,e)}function g$(e){return jh(e)?e.binned:dje(e)}function dje(e){return e?.startsWith(`binned`)}function _$(e){return e.startsWith(`utc`)}function fje(e){return e.substring(3)}function v$(e){return E4.filter(t=>mje(e,t))}function pje(e){let t=v$(e);return t[t.length-1]}function mje(e,t){let n=e.indexOf(t);return!(n<0||n>0&&t===`seconds`&&e.charAt(n-1)===`i`||e.length>n+3&&t===`day`&&e.charAt(n+3)===`o`||n>0&&t===`year`&&e.charAt(n-1)===`f`)}function hje(e,t,{end:n}={end:!1}){let r=aQ(t),i=_$(e)?`utc`:``;function a(e){return e===`quarter`?`(${i}quarter(${r})-1)`:`${i}${e}(${r})`}let o,s={};for(let t of E4)mje(e,t)&&(s[t]=a(t),o=t);return n&&(s[o]+=`+1`),cje(s)}function gje(e){if(e)return`timeUnitSpecifier(${bQ(v$(e))}, ${bQ(Gze)})`}function _je(e,t,n){if(!e)return;let r=gje(e);return`${n||_$(e)?`utc`:`time`}Format(${t}, ${r})`}function y$(e){if(!e)return;let t;return vg(e)?t=dje(e)?{unit:e.substring(6),binned:!0}:{unit:e}:jh(e)&&(t={...e,...e.unit?{unit:e.unit}:{}}),_$(t.unit)&&(t.utc=!0,t.unit=fje(t.unit)),t}function vje(e){let{utc:t,...n}=y$(e);return n.unit?(t?`utc`:``)+$(n).map(e=>tQ(`${e===`unit`?``:`_${e}_`}${n[e]}`)).join(``):`${t?`utc`:``}timeunit${$(n).map(e=>tQ(`_${e}_${n[e]}`)).join(``)}`}function yje(e,t=e=>e){let n=y$(e),r=pje(n.unit);if(r&&r!==`day`){let e={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:i,part:a}=xje(r,n.step);return`${t(h$({...e,[a]:+e[a]+i}))} - ${t(h$(e))}`}}function bje(e){return cg(Kze,e)}function xje(e,t=1){if(bje(e))return{part:e,step:t};switch(e){case`day`:case`dayofyear`:return{part:`date`,step:t};case`quarter`:return{part:`month`,step:t*3};case`week`:return{part:`date`,step:t*7}}}function Sje(e){return X(e,`param`)}function b$(e){return!!e?.field&&e.equal!==void 0}function x$(e){return!!e?.field&&e.lt!==void 0}function S$(e){return!!e?.field&&e.lte!==void 0}function C$(e){return!!e?.field&&e.gt!==void 0}function w$(e){return!!e?.field&&e.gte!==void 0}function T$(e){return!!(e?.field&&(W(e.range)&&e.range.length===2||ZQ(e.range)))}function E$(e){return!!e?.field&&(W(e.oneOf)||W(e.in))}function Cje(e){return!!e?.field&&e.valid!==void 0}function wje(e){return E$(e)||b$(e)||T$(e)||x$(e)||C$(e)||S$(e)||w$(e)}function D$(e,t){return E1(e,{timeUnit:t,wrapTime:!0})}function Tje(e,t){return e.map(e=>D$(e,t))}function Eje(e,t=!0){let{field:n}=e,{unit:r,binned:i}=y$(e.timeUnit)||{},a=m1(e,{expr:`datum`}),o=r?`time(${i?a:hje(r,n)})`:a;if(b$(e))return`${o}===${D$(e.equal,r)}`;if(x$(e)){let t=e.lt;return`${o}<${D$(t,r)}`}else if(C$(e)){let t=e.gt;return`${o}>${D$(t,r)}`}else if(S$(e)){let t=e.lte;return`${o}<=${D$(t,r)}`}else if(w$(e)){let t=e.gte;return`${o}>=${D$(t,r)}`}else if(E$(e))return`indexof([${Tje(e.oneOf,r).join(`,`)}], ${o}) !== -1`;else if(Cje(e))return O$(o,e.valid);else if(T$(e)){let{range:n}=YQ(e),i=ZQ(n)?{signal:`${n.signal}[0]`}:n[0],a=ZQ(n)?{signal:`${n.signal}[1]`}:n[1];if(i!==null&&a!==null&&t)return`inrange(${o}, [${D$(i,r)}, ${D$(a,r)}])`;let s=[];return i!==null&&s.push(`${o} >= ${D$(i,r)}`),a!==null&&s.push(`${o} <= ${D$(a,r)}`),s.length>0?s.join(` && `):`true`}throw Error(`Invalid field predicate: ${bQ(e)}`)}function O$(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function Dje(e){return wje(e)&&e.timeUnit?{...e,timeUnit:y$(e.timeUnit)}:e}function Oje(e){return e===`quantitative`||e===`temporal`}function k$(e){return e===`ordinal`||e===`nominal`}function kje(e){if(e)switch(e=e.toLowerCase(),e){case`q`:case O4:return`quantitative`;case`t`:case A4:return`temporal`;case`o`:case k4:return`ordinal`;case`n`:case j4:return`nominal`;case M4:return`geojson`}}function Aje(e,t){let n=P4[e],r=P4[t];return n===r||n===`ordinal-position`&&r===`time`||r===`ordinal-position`&&n===`time`}function jje(e){return qze[e]}function Mje(e){return F4.has(e)}function A$(e){return Yze.has(e)}function j$(e){return Jze.has(e)}function M$(e){return I4.has(e)}function N$(e){return L4.has(e)}function Nje(e){return!vg(e)&&X(e,`name`)}function Pje(e){return X(e,`param`)}function Fje(e){return X(e,`unionWith`)}function Ije(e){return jh(e)&&`field`in e}function P$(e,t){switch(t){case`type`:case`domain`:case`reverse`:case`range`:return!0;case`scheme`:case`interpolate`:return![`point`,`band`,`identity`].includes(e);case`bins`:return![`point`,`band`,`identity`,`ordinal`].includes(e);case`round`:return M$(e)||e===`band`||e===`point`;case`padding`:case`rangeMin`:case`rangeMax`:return M$(e)||[`point`,`band`].includes(e);case`paddingOuter`:case`align`:return[`point`,`band`].includes(e);case`paddingInner`:return e===`band`;case`domainMax`:case`domainMid`:case`domainMin`:case`domainRaw`:case`clamp`:return M$(e);case`nice`:return M$(e)||e===`quantize`||e===`threshold`;case`exponent`:return e===`pow`;case`base`:return e===`log`;case`constant`:return e===`symlog`;case`zero`:return j$(e)&&!UZ([`log`,`time`,`utc`,`threshold`,`quantile`],e)}}function Lje(e,t){switch(t){case`interpolate`:case`scheme`:case`domainMid`:return wQ(e)?void 0:AAe(t);case`align`:case`type`:case`bins`:case`domain`:case`domainMax`:case`domainMin`:case`domainRaw`:case`range`:case`base`:case`exponent`:case`constant`:case`nice`:case`padding`:case`paddingInner`:case`paddingOuter`:case`rangeMax`:case`rangeMin`:case`reverse`:case`round`:case`clamp`:case`zero`:return}}function Rje(e,t){return UZ([k4,j4],t)?e===void 0||A$(e):t===A4?UZ([N4.TIME,N4.UTC,void 0],e):t!==O4||Mje(e)||N$(e)||e===void 0}function zje(e,t,n=!1){if(!LQ(e))return!1;switch(e){case C2:case w2:case D2:case O2:case j2:case k2:return M$(t)?!0:t===`band`||t===`point`&&!n;case L2:return UZ([`linear`,`band`],t);case H2:case q2:case W2:case G2:case K2:case U2:return M$(t)||N$(t)||UZ([`band`,`point`,`ordinal`],t);case R2:case z2:case B2:return t!==`band`;case J2:case V2:return t===`ordinal`||N$(t)}}function Bje(e){return jh(e)&&`value`in e}function F$(e){return[`line`,`area`,`trail`].includes(e)}function I$(e){return[`rect`,`bar`,`image`,`arc`,`tick`].includes(e)}function L$(e){return X(e,`type`)}function R$(e){return X(e,`band`)}function Vje(e){return L$(e)?e.type:e}function Hje(e,{isPath:t}){return e===void 0||e===`break-paths-show-path-domains`?t?`break-paths-show-domains`:`filter`:e===null?`show`:e}function z$({markDef:e,config:t,scaleChannel:n,scaleType:r,isCountAggregate:i}){if(!r||!j$(r)||i)return`always-valid`;let a=Hje(r$(`invalid`,e,t),{isPath:F$(e.type)});return t.scale?.invalid?.[n]===void 0?a:`show`}function Uje(e){return e===`break-paths-filter-domains`||e===`break-paths-show-domains`}function Wje({scaleName:e,scale:t,mode:n}){let r=`domain('${e}')`;if(!t||!e)return;let i=`${r}[0]`,a=`peek(${r})`,o=t.domainHasZero();return o===`definitely`?{scale:e,value:0}:o===`maybe`?{signal:`scale('${e}', inrange(0, ${r}) ? 0 : ${n===`zeroOrMin`?i:a})`}:{signal:`scale('${e}', ${n===`zeroOrMin`?i:a})`}}function Gje({scaleChannel:e,channelDef:t,scale:n,scaleName:r,markDef:i,config:a}){let o=n?.get(`type`),s=b1(t),c=z$({scaleChannel:e,markDef:i,config:a,scaleType:o,isCountAggregate:HQ(s?.aggregate)});if(s&&c===`show`){let t=a.scale.invalid?.[e]??`zero-or-min`;return{test:O$(m1(s,{expr:`datum`}),!1),...Kje(t,n,r)}}}function Kje(e,t,n){if(Bje(e)){let{value:t}=e;return ZQ(t)?{signal:t.signal}:{value:t}}return Wje({scale:t,scaleName:n,mode:`zeroOrMin`})}function B$(e){let{channel:t,channelDef:n,markDef:r,scale:i,scaleName:a,config:o}=e,s=DQ(t),c=U$(e),l=Gje({scaleChannel:s,channelDef:n,scale:i,scaleName:a,markDef:r,config:o});return l===void 0?c:[l,c]}function qje(e){let{datum:t}=e;return p$(t)?h$(t):`${bQ(t)}`}function V$(e,t,n,r){let i={};if(t&&(i.scale=t),o1(e)){let{datum:t}=e;p$(t)?i.signal=h$(t):ZQ(t)?i.signal=t.signal:JQ(t)?i.signal=t.expr:i.value=t}else i.field=m1(e,n);if(r){let{offset:e,band:t}=r;e&&(i.offset=e),t&&(i.band=t)}return i}function H$({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:r,startSuffix:i,endSuffix:a=`end`,bandPosition:o=.5}){let s=!ZQ(o)&&0{let r=E1(t,{timeUnit:Q(e)&&!g$(e.timeUnit)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return r===void 0?t:{signal:r}})}function D1(e,t){return WQ(e.bin)?LQ(t)&&[`ordinal`,`nominal`].includes(e.type):(console.warn(`Only call this method for binned field defs.`),!1)}function O1(e){return e?.condition}function AMe(e){return cg(yBe,e)}function k1(e){return X(e,`mark`)}function A1(e,t){let n=e?.[t];return n?W(n)?WZ(n,e=>!!e.field):Q(n)||r1(n):!1}function jMe(e,t){let n=e?.[t];return n?W(n)?WZ(n,e=>!!e.field):Q(n)||o1(n)||i1(n):!1}function MMe(e,t){if(NQ(t)){let n=e[t];if((Q(n)||o1(n))&&(k$(n.type)||Q(n)&&n.timeUnit))return jMe(e,MQ(t))}return!1}function NMe(e){return WZ(FRe,t=>{if(A1(e,t)){let n=e[t];if(W(n))return WZ(n,e=>!!e.aggregate);{let e=b1(n);return e&&!!e.aggregate}}return!1})}function PMe(e,t){let n=[],r=[],i=[],a=[],o={};return M1(e,(s,c)=>{if(Q(s)){let{field:l,aggregate:u,bin:d,timeUnit:f,...p}=s;if(u||f||d){let e=_1(s)?.title,m=m1(s,{forAs:!0}),h={...e?[]:{title:g1(s,t,{allowDisabling:!0})},...p,field:m};if(u){let e;if(BQ(u)?(e=`argmax`,m=m1({op:`argmax`,field:u.argmax},{forAs:!0}),h.field=`${m}.${l}`):zQ(u)?(e=`argmin`,m=m1({op:`argmin`,field:u.argmin},{forAs:!0}),h.field=`${m}.${l}`):u!==`boxplot`&&u!==`errorbar`&&u!==`errorband`&&(e=u),e){let t={op:e,as:m};l&&(t.field=l),a.push(t)}}else if(n.push(m),u1(s)&&WQ(d)){if(r.push({bin:d,field:l,as:m}),n.push(m1(s,{binSuffix:`end`})),D1(s,c)&&n.push(m1(s,{binSuffix:`range`})),NQ(c)){let e={field:`${m}_end`};o[`${c}2`]=e}h.bin=`binned`,EQ(c)||(h.type=O4)}else if(f&&!g$(f)){i.push({timeUnit:f,field:l,as:m});let e=u1(s)&&s.type!==A4&&`time`;e&&(c===Y2||c===$2?h.formatType=e:jke(c)?h.legend={formatType:e,...h.legend}:NQ(c)&&(h.axis={formatType:e,...h.axis}))}o[c]=h}else n.push(l),o[c]=e[c]}else o[c]=e[c]}),{bins:r,timeUnits:i,aggregate:a,groupby:n,encoding:o}}function FMe(e,t,n){let r=Nke(t,n);if(!r)return!1;if(r===`binned`){let n=e[t===T2?C2:w2];return!!(Q(n)&&Q(e[t])&&GQ(n.bin))}return!0}function IMe(e,t,n,r){let i={};for(let t of $(e))TQ(t)||Z(CAe(t));for(let a of GRe){if(!e[a])continue;let o=e[a];if(FQ(a)){let e=Ake(a),t=i[e];if(Q(t)&&Oje(t.type)&&Q(o)&&!t.timeUnit){Z(gAe(e));continue}}if(a===`angle`&&t===`arc`&&!e.theta&&(Z(Rze),a=j2),!FMe(e,a,t)){Z(l$(a,t));continue}if(a===H2&&t===`line`&&b1(e[a])?.aggregate){Z(zze);continue}if(a===R2&&(n?`fill`in e:`stroke`in e)){Z(xAe(`encoding`,{fill:`fill`in e,stroke:`stroke`in e}));continue}if(a===Z2||a===X2&&!W(o)&&!d1(o)||a===$2&&W(o)){if(o){if(a===X2){let t=e[a];if(dMe(t)){i[a]=t;continue}}i[a]=Qh(o).reduce((e,t)=>(Q(t)?e.push(C1(t,a)):Z(c$(t,a)),e),[])}}else{if(a===$2&&o===null)i[a]=null;else if(!Q(o)&&!o1(o)&&!d1(o)&&!n1(o)&&!ZQ(o)){Z(c$(o,a));continue}i[a]=TMe(o,a,r)}}return i}function j1(e,t){let n={};for(let r of $(e))n[r]=TMe(e[r],r,t,{compositeMark:!0});return n}function LMe(e){let t=[];for(let n of $(e))if(A1(e,n)){let r=e[n],i=Qh(r);for(let e of i)Q(e)?t.push(e):r1(e)&&t.push(e.condition)}return t}function M1(e,t,n){if(e)for(let r of $(e)){let i=e[r];if(W(i))for(let e of i)t.call(n,e,r);else t.call(n,i,r)}}function RMe(e,t,n,r){return e?$(e).reduce((n,i)=>{let a=e[i];return W(a)?a.reduce((e,n)=>t.call(r,e,n,i),n):t.call(r,n,a,i)},n):n}function zMe(e,t){return $(t).reduce((n,r)=>{switch(r){case C2:case w2:case e4:case n4:case t4:case T2:case E2:return n;case D2:case O2:if(e===`line`||e===`area`||e===`trail`){let e=t[r];if(Q(e)){let i=t[r===D2?C2:w2];if(Q(i)&&!i.aggregate&&!e.aggregate){let t=m1(i,{}),r=m1(e,{});t&&r&&t!==r&&n.push(t)}}}return n;case j2:case M2:case k2:case A2:case L2:case N2:case P2:case F2:case I2:case Y2:case V2:case U2:case $2:return n;case X2:if(e===`line`||e===`trail`)return n;case Z2:case Q2:{let e=t[r];if(W(e)||Q(e))for(let t of Qh(e))t.aggregate||n.push(m1(t,{}));return n}case H2:if(e===`trail`)return n;case R2:case z2:case B2:case W2:case G2:case K2:case J2:case q2:{let e=b1(t[r]);return e&&!e.aggregate&&n.push(m1(e,{})),n}}},[])}function BMe(e){let{tooltip:t,...n}=e;if(!t)return{filteredEncoding:n};let r,i;if(W(t)){for(let e of t)e.aggregate?(r||=[],r.push(e)):(i||=[],i.push(e));r&&(n.tooltip=r)}else t.aggregate?n.tooltip=t:i=t;return W(i)&&i.length===1&&(i=i[0]),{customTooltipWithoutAggregatedField:i,filteredEncoding:n}}function N1(e,t,n,r=!0){if(`tooltip`in n)return{tooltip:n.tooltip};let i=e.map(({fieldPrefix:e,titlePrefix:n})=>{let i=r?` of ${P1(t)}`:``;return{field:e+t.field,type:t.type,title:ZQ(n)?{signal:`${n}"${escape(i)}"`}:n+i}}),a=LMe(n).map(gMe);return{tooltip:[...i,...qZ(a,VZ)]}}function P1(e){let{title:t,field:n}=e;return pQ(t,n)}function F1(e,t,n,r,i){let{scale:a,axis:o}=n;return({partName:s,mark:c,positionPrefix:l,endPositionPrefix:u=void 0,extraEncoding:d={}})=>{let f=P1(n);return VMe(e,s,i,{mark:c,encoding:{[t]:{field:`${l}_${n.field}`,type:n.type,...f===void 0?{}:{title:f},...a===void 0?{}:{scale:a},...o===void 0?{}:{axis:o}},...vg(u)?{[`${t}2`]:{field:`${u}_${n.field}`}}:{},...r,...d}})}}function VMe(e,t,n,r){let{clip:i,color:a,opacity:o}=e,s=e.type;return e[t]||e[t]===void 0&&n[t]?[{...r,mark:{...n[t],...i?{clip:i}:{},...a?{color:a}:{},...o?{opacity:o}:{},...L$(r.mark)?r.mark:{type:r.mark},style:`${s}-${String(t)}`,...mg(e[t])?{}:e[t]}}]:[]}function HMe(e,t,n){let{encoding:r}=e,i=t===`vertical`?`y`:`x`,a=r[i],o=r[`${i}2`],s=r[`${i}Error`],c=r[`${i}Error2`];return{continuousAxisChannelDef:I1(a,n),continuousAxisChannelDef2:I1(o,n),continuousAxisChannelDefError:I1(s,n),continuousAxisChannelDefError2:I1(c,n),continuousAxis:i}}function I1(e,t){if(e?.aggregate){let{aggregate:n,...r}=e;return n!==t&&Z(ZAe(n,t)),r}else return e}function UMe(e,t){let{mark:n,encoding:r}=e,{x:i,y:a}=r;if(L$(n)&&n.orient)return n.orient;if(s1(i)){if(s1(a)){let e=Q(i)&&i.aggregate,n=Q(a)&&a.aggregate;if(!e&&n===t)return`vertical`;if(!n&&e===t)return`horizontal`;if(e===t&&n===t)throw Error(`Both x and y cannot have aggregate`);return T1(a)&&!T1(i)?`horizontal`:`vertical`}return`horizontal`}else if(s1(a))return`vertical`;else throw Error(`Need a valid continuous axis for ${t}s`)}function WMe(e){return gg(e)?`tukey`:e}function GMe(e,{config:t}){e={...e,encoding:j1(e.encoding,t)};let{mark:n,encoding:r,params:i,projection:a,...o}=e,s=L$(n)?n:{type:n};i&&Z(rAe(`boxplot`));let c=s.extent??t.boxplot.extent,l=r$(`size`,s,t),u=s.invalid,d=WMe(c),{bins:f,timeUnits:p,transform:m,continuousAxisChannelDef:h,continuousAxis:g,groupby:_,aggregate:v,encodingWithoutContinuousAxis:y,ticksOrient:b,boxOrient:x,customTooltipWithoutAggregatedField:S}=qMe(e,c,t),C=dQ(h.field),{color:w,size:T,...E}=y,D=e=>F1(s,g,h,e,t.boxplot),O=D(E),k=D(y),A=(jh(t.boxplot.box)?t.boxplot.box.color:t.mark.color)||`#4c78a8`,j=D({...E,...T?{size:T}:{},color:{condition:{test:`${sQ(`lower_box_${h.field}`)} >= ${sQ(`upper_box_${h.field}`)}`,...w||{value:A}}}}),M=N1([{fieldPrefix:d===`min-max`?`upper_whisker_`:`max_`,titlePrefix:`Max`},{fieldPrefix:`upper_box_`,titlePrefix:`Q3`},{fieldPrefix:`mid_box_`,titlePrefix:`Median`},{fieldPrefix:`lower_box_`,titlePrefix:`Q1`},{fieldPrefix:d===`min-max`?`lower_whisker_`:`min_`,titlePrefix:`Min`}],h,y),N={type:`tick`,color:`black`,opacity:1,orient:b,invalid:u,aria:!1},P=d===`min-max`?M:N1([{fieldPrefix:`upper_whisker_`,titlePrefix:`Upper Whisker`},{fieldPrefix:`lower_whisker_`,titlePrefix:`Lower Whisker`}],h,y),F=[...O({partName:`rule`,mark:{type:`rule`,invalid:u,aria:!1},positionPrefix:`lower_whisker`,endPositionPrefix:`lower_box`,extraEncoding:P}),...O({partName:`rule`,mark:{type:`rule`,invalid:u,aria:!1},positionPrefix:`upper_box`,endPositionPrefix:`upper_whisker`,extraEncoding:P}),...O({partName:`ticks`,mark:N,positionPrefix:`lower_whisker`,extraEncoding:P}),...O({partName:`ticks`,mark:N,positionPrefix:`upper_whisker`,extraEncoding:P})],ee=[...d===`tukey`?[]:F,...k({partName:`box`,mark:{type:`bar`,...l?{size:l}:{},orient:x,invalid:u,ariaRoleDescription:`box`},positionPrefix:`lower_box`,endPositionPrefix:`upper_box`,extraEncoding:M}),...j({partName:`median`,mark:{type:`tick`,invalid:u,...jh(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{},...l?{size:l}:{},orient:b,aria:!1},positionPrefix:`mid_box`,extraEncoding:M})];if(d===`min-max`)return{...o,transform:(o.transform??[]).concat(m),layer:ee};let I=sQ(`lower_box_${h.field}`),te=sQ(`upper_box_${h.field}`),L=`(${te} - ${I})`,ne=`${I} - ${c} * ${L}`,re=`${te} + ${c} * ${L}`,ie=sQ(h.field),ae={joinaggregate:KMe(h.field),groupby:_},oe={transform:[{filter:`(${ne} <= ${ie}) && (${ie} <= ${re})`},{aggregate:[{op:`min`,field:h.field,as:`lower_whisker_${C}`},{op:`max`,field:h.field,as:`upper_whisker_${C}`},{op:`min`,field:`lower_box_${h.field}`,as:`lower_box_${C}`},{op:`max`,field:`upper_box_${h.field}`,as:`upper_box_${C}`},...v],groupby:_}],layer:F},{tooltip:se,...ce}=E,{scale:le,axis:ue}=h,de=P1(h),fe=VMe(s,`outliers`,t.boxplot,{transform:[{filter:`(${ie} < ${ne}) || (${ie} > ${re})`}],mark:`point`,encoding:{[g]:{field:h.field,type:h.type,...de===void 0?{}:{title:de},...le===void 0?{}:{scale:le},...ue===void 0?{}:{axis:ue}},...ce,...w?{color:w}:{},...S?{tooltip:S}:{}}})[0],pe,me=[...f,...p,ae];return fe?pe={transform:me,layer:[fe,oe]}:(pe=oe,pe.transform.unshift(...me)),{...o,layer:[pe,{transform:m,layer:ee}]}}function KMe(e){let t=dQ(e);return[{op:`q1`,field:e,as:`lower_box_${t}`},{op:`q3`,field:e,as:`upper_box_${t}`}]}function qMe(e,t,n){let r=UMe(e,l3),{continuousAxisChannelDef:i,continuousAxis:a}=HMe(e,r,l3),o=i.field,s=dQ(o),c=WMe(t),l=[...KMe(o),{op:`median`,field:o,as:`mid_box_${s}`},{op:`min`,field:o,as:(c===`min-max`?`lower_whisker_`:`min_`)+s},{op:`max`,field:o,as:(c===`min-max`?`upper_whisker_`:`max_`)+s}],u=c===`min-max`||c===`tukey`?[]:[{calculate:`${sQ(`upper_box_${s}`)} - ${sQ(`lower_box_${s}`)}`,as:`iqr_${s}`},{calculate:`min(${sQ(`upper_box_${s}`)} + ${sQ(`iqr_${s}`)} * ${t}, ${sQ(`max_${s}`)})`,as:`upper_whisker_${s}`},{calculate:`max(${sQ(`lower_box_${s}`)} - ${sQ(`iqr_${s}`)} * ${t}, ${sQ(`min_${s}`)})`,as:`lower_whisker_${s}`}],{[a]:d,...f}=e.encoding,{customTooltipWithoutAggregatedField:p,filteredEncoding:m}=BMe(f),{bins:h,timeUnits:g,aggregate:_,groupby:v,encoding:y}=PMe(m,n),b=r===`vertical`?`horizontal`:`vertical`,x=r;return{bins:h,timeUnits:g,transform:[...h,...g,{aggregate:[..._,...l],groupby:v},...u],groupby:v,aggregate:_,continuousAxisChannelDef:i,continuousAxis:a,encodingWithoutContinuousAxis:y,ticksOrient:b,boxOrient:x,customTooltipWithoutAggregatedField:p}}function JMe(e,{config:t}){e={...e,encoding:j1(e.encoding,t)};let{transform:n,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:a,ticksOrient:o,markDef:s,outerSpec:c,tooltipEncoding:l}=$Me(e,u3,t);delete a.size;let u=F1(s,i,r,a,t.errorbar),d=s.thickness,f=s.size,p={type:`tick`,orient:o,aria:!1,...d===void 0?{}:{thickness:d},...f===void 0?{}:{size:f}},m=[...u({partName:`ticks`,mark:p,positionPrefix:`lower`,extraEncoding:l}),...u({partName:`ticks`,mark:p,positionPrefix:`upper`,extraEncoding:l}),...u({partName:`rule`,mark:{type:`rule`,ariaRoleDescription:`errorbar`,...d===void 0?{}:{size:d}},positionPrefix:`lower`,endPositionPrefix:`upper`,extraEncoding:l})];return{...c,transform:n,...m.length>1?{layer:m}:{...m[0]}}}function YMe(e,t){let{encoding:n}=e;if(XMe(n))return{orient:UMe(e,t),inputType:`raw`};let r=ZMe(n),i=QMe(n),a=n.x,o=n.y;if(r){if(i)throw Error(`${t} cannot be both type aggregated-upper-lower and aggregated-error`);let e=n.x2,r=n.y2;if(l1(e)&&l1(r))throw Error(`${t} cannot have both x2 and y2`);if(l1(e)){if(s1(a))return{orient:`horizontal`,inputType:`aggregated-upper-lower`};throw Error(`Both x and x2 have to be quantitative in ${t}`)}else if(l1(r)){if(s1(o))return{orient:`vertical`,inputType:`aggregated-upper-lower`};throw Error(`Both y and y2 have to be quantitative in ${t}`)}throw Error(`No ranged axis`)}else{let e=n.xError,r=n.xError2,i=n.yError,s=n.yError2;if(l1(r)&&!l1(e))throw Error(`${t} cannot have xError2 without xError`);if(l1(s)&&!l1(i))throw Error(`${t} cannot have yError2 without yError`);if(l1(e)&&l1(i))throw Error(`${t} cannot have both xError and yError with both are quantiative`);if(l1(e)){if(s1(a))return{orient:`horizontal`,inputType:`aggregated-error`};throw Error(`All x, xError, and xError2 (if exist) have to be quantitative`)}else if(l1(i)){if(s1(o))return{orient:`vertical`,inputType:`aggregated-error`};throw Error(`All y, yError, and yError2 (if exist) have to be quantitative`)}throw Error(`No ranged axis`)}}function XMe(e){return(l1(e.x)||l1(e.y))&&!l1(e.x2)&&!l1(e.y2)&&!l1(e.xError)&&!l1(e.xError2)&&!l1(e.yError)&&!l1(e.yError2)}function ZMe(e){return l1(e.x2)||l1(e.y2)}function QMe(e){return l1(e.xError)||l1(e.xError2)||l1(e.yError)||l1(e.yError2)}function $Me(e,t,n){let{mark:r,encoding:i,params:a,projection:o,...s}=e,c=L$(r)?r:{type:r};a&&Z(rAe(t));let{orient:l,inputType:u}=YMe(e,t),{continuousAxisChannelDef:d,continuousAxisChannelDef2:f,continuousAxisChannelDefError:p,continuousAxisChannelDefError2:m,continuousAxis:h}=HMe(e,l,t),{errorBarSpecificAggregate:g,postAggregateCalculates:_,tooltipSummary:v,tooltipTitleWithFieldName:y}=eNe(c,d,f,p,m,u,t,n),{[h]:b,[h===`x`?`x2`:`y2`]:x,[h===`x`?`xError`:`yError`]:S,[h===`x`?`xError2`:`yError2`]:C,...w}=i,{bins:T,timeUnits:E,aggregate:D,groupby:O,encoding:k}=PMe(w,n),A=[...D,...g],j=u===`raw`?O:[],M=N1(v,d,k,y);return{transform:[...s.transform??[],...T,...E,...A.length===0?[]:[{aggregate:A,groupby:j}],..._],groupby:j,continuousAxisChannelDef:d,continuousAxis:h,encodingWithoutContinuousAxis:k,ticksOrient:l===`vertical`?`horizontal`:`vertical`,markDef:c,outerSpec:s,tooltipEncoding:M}}function eNe(e,t,n,r,i,a,o,s){let c=[],l=[],u=t.field,d,f=!1;if(a===`raw`){let t=e.center?e.center:e.extent?e.extent===`iqr`?`median`:`mean`:s.errorbar.center,n=e.extent?e.extent:t===`mean`?`stderr`:`iqr`;if(t===`median`!=(n===`iqr`)&&Z(XAe(t,n,o)),n===`stderr`||n===`stdev`)c=[{op:n,field:u,as:`extent_${u}`},{op:t,field:u,as:`center_${u}`}],l=[{calculate:`${sQ(`center_${u}`)} + ${sQ(`extent_${u}`)}`,as:`upper_${u}`},{calculate:`${sQ(`center_${u}`)} - ${sQ(`extent_${u}`)}`,as:`lower_${u}`}],d=[{fieldPrefix:`center_`,titlePrefix:iQ(t)},{fieldPrefix:`upper_`,titlePrefix:tNe(t,n,`+`)},{fieldPrefix:`lower_`,titlePrefix:tNe(t,n,`-`)}],f=!0;else{let e,t,r;n===`ci`?(e=`mean`,t=`ci0`,r=`ci1`):(e=`median`,t=`q1`,r=`q3`),c=[{op:t,field:u,as:`lower_${u}`},{op:r,field:u,as:`upper_${u}`},{op:e,field:u,as:`center_${u}`}],d=[{fieldPrefix:`upper_`,titlePrefix:g1({field:u,aggregate:r,type:`quantitative`},s,{allowDisabling:!1})},{fieldPrefix:`lower_`,titlePrefix:g1({field:u,aggregate:t,type:`quantitative`},s,{allowDisabling:!1})},{fieldPrefix:`center_`,titlePrefix:g1({field:u,aggregate:e,type:`quantitative`},s,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&Z(YAe(e.center,e.extent)),a===`aggregated-upper-lower`?(d=[],l=[{calculate:sQ(n.field),as:`upper_${u}`},{calculate:sQ(u),as:`lower_${u}`}]):a===`aggregated-error`&&(d=[{fieldPrefix:``,titlePrefix:u}],l=[{calculate:`${sQ(u)} + ${sQ(r.field)}`,as:`upper_${u}`}],i?l.push({calculate:`${sQ(u)} + ${sQ(i.field)}`,as:`lower_${u}`}):l.push({calculate:`${sQ(u)} - ${sQ(r.field)}`,as:`lower_${u}`}));for(let e of l)d.push({fieldPrefix:e.as.substring(0,6),titlePrefix:uQ(uQ(e.calculate,`datum['`,``),`']`,``)})}return{postAggregateCalculates:l,errorBarSpecificAggregate:c,tooltipSummary:d,tooltipTitleWithFieldName:f}}function tNe(e,t,n){return`${iQ(e)} ${n} ${t}`}function nNe(e,{config:t}){e={...e,encoding:j1(e.encoding,t)};let{transform:n,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:a,markDef:o,outerSpec:s,tooltipEncoding:c}=$Me(e,d3,t),l=o,u=F1(l,i,r,a,t.errorband),d=e.encoding.x!==void 0&&e.encoding.y!==void 0,f={type:d?`area`:`rect`},p={type:d?`line`:`rule`},m={...l.interpolate?{interpolate:l.interpolate}:{},...l.tension&&l.interpolate?{tension:l.tension}:{}};return d?(f={...f,...m,ariaRoleDescription:`errorband`},p={...p,...m,aria:!1}):l.interpolate?Z(QAe(`interpolate`)):l.tension&&Z(QAe(`tension`)),{...s,transform:n,layer:[...u({partName:`band`,mark:f,positionPrefix:`lower`,endPositionPrefix:`upper`,extraEncoding:c}),...u({partName:`borders`,mark:p,positionPrefix:`lower`,extraEncoding:c}),...u({partName:`borders`,mark:p,positionPrefix:`upper`,extraEncoding:c})]}}function L1(e,t,n){let r=new c3(e,t);f3[e]={normalizer:r,parts:n}}function rNe(){return $(f3)}function R1(e){return e===`legend`||!!e?.legend}function z1(e){return R1(e)&&jh(e)}function B1(e){return!!e?.select}function iNe(e){let t=[];for(let n of e||[]){if(B1(n))continue;let{expr:e,bind:r,...i}=n;if(r&&e){let n={...i,bind:r,init:e};t.push(n)}else{let n={...i,...e?{update:e}:{},...r?{bind:r}:{}};t.push(n)}}return t}function aNe(e){return H1(e)||U1(e)||V1(e)}function V1(e){return X(e,`concat`)}function H1(e){return X(e,`vconcat`)}function U1(e){return X(e,`hconcat`)}function oNe({step:e,offsetIsDiscrete:t}){return t?e.for??`offset`:`position`}function W1(e){return X(e,`step`)}function sNe(e){return X(e,`view`)||X(e,`width`)||X(e,`height`)}function cNe(e,t,n){let r=n[t],i={},{spacing:a,columns:o}=r;a!==void 0&&(i.spacing=a),o!==void 0&&($$(e)&&!Z$(e.facet)||V1(e))&&(i.columns=o),H1(e)&&(i.columns=1);for(let t of MBe)if(e[t]!==void 0)if(t===`spacing`){let n=e[t];i[t]=gg(n)?n:{row:n.row??a,column:n.column??a}}else i[t]=e[t];return i}function G1(e,t){return e[t]??e[t===`width`?`continuousWidth`:`continuousHeight`]}function K1(e,t){let n=q1(e,t);return W1(n)?n.step:y3}function q1(e,t){return pQ(e[t]??e[t===`width`?`discreteWidth`:`discreteHeight`],{step:e.step})}function lNe(e={}){return{signals:[{name:`color`,value:jh(e)?{...S3,...e}:S3}],mark:{color:{signal:`color.blue`}},rule:{color:{signal:`color.gray0`}},text:{color:{signal:`color.gray0`}},style:{"guide-label":{fill:{signal:`color.gray0`}},"guide-title":{fill:{signal:`color.gray0`}},"group-title":{fill:{signal:`color.gray0`}},"group-subtitle":{fill:{signal:`color.gray0`}},cell:{stroke:{signal:`color.gray8`}}},axis:{domainColor:{signal:`color.gray13`},gridColor:{signal:`color.gray8`},tickColor:{signal:`color.gray13`}},range:{category:[{signal:`color.blue`},{signal:`color.orange`},{signal:`color.red`},{signal:`color.teal`},{signal:`color.green`},{signal:`color.yellow`},{signal:`color.purple`},{signal:`color.pink`},{signal:`color.brown`},{signal:`color.grey8`}]}}}function uNe(e){return{signals:[{name:`fontSize`,value:jh(e)?{...x3,...e}:x3}],text:{fontSize:{signal:`fontSize.text`}},style:{"guide-label":{fontSize:{signal:`fontSize.guideLabel`}},"guide-title":{fontSize:{signal:`fontSize.guideTitle`}},"group-title":{fontSize:{signal:`fontSize.groupTitle`}},"group-subtitle":{fontSize:{signal:`fontSize.groupSubtitle`}}}}}function dNe(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}function fNe(e){let t=$(e||{}),n={};for(let r of t){let t=e[r];n[r]=O1(t)?Bke(t):e$(t)}return n}function pNe(e){let t=$(e),n={};for(let r of t)n[r]=fNe(e[r]);return n}function mNe(e={}){let{color:t,font:n,fontSize:r,selection:i,...a}=e,o=Nh({},h2(NBe),n?dNe(n):{},t?lNe(t):{},r?uNe(r):{},a||{});i&&Ph(o,`selection`,i,!0);let s=BZ(o,PBe);for(let e of[`background`,`lineBreak`,`padding`])o[e]&&(s[e]=e$(o[e]));for(let e of Q4)o[e]&&(s[e]=YQ(o[e]));for(let e of s3)o[e]&&(s[e]=fNe(o[e]));for(let e of h3)o[e]&&(s[e]=YQ(o[e]));if(o.legend&&(s.legend=YQ(o.legend)),o.scale){let{invalid:e,...t}=o.scale,n=YQ(e,{level:1});s.scale={...YQ(t),...$(n).length>0?{invalid:n}:{}}}return o.style&&(s.style=pNe(o.style)),o.title&&(s.title=YQ(o.title)),o.view&&(s.view=YQ(o.view)),s}function hNe(e){e=h2(e);for(let t of IBe)delete e[t];if(e.axis)for(let t in e.axis)O1(e.axis[t])&&delete e.axis[t];if(e.legend)for(let t of EBe)delete e.legend[t];if(e.mark){for(let t of X4)delete e.mark[t];e.mark.tooltip&&jh(e.mark.tooltip)&&delete e.mark.tooltip}e.params&&(e.signals=(e.signals||[]).concat(iNe(e.params)),delete e.params);for(let t of FBe){for(let n of X4)delete e[t][n];let n=LBe[t];if(n)for(let r of n)delete e[t][r];_Ne(e,t)}for(let t of rNe())delete e[t];gNe(e);for(let t in e)jh(e[t])&&QZ(e[t])&&delete e[t];return QZ(e)?void 0:e}function gNe(e){let{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:r}=Lke(e.title);QZ(t)||(e.style[`group-title`]={...e.style[`group-title`],...t}),QZ(n)||(e.style[`group-subtitle`]={...e.style[`group-subtitle`],...n}),QZ(r)?delete e.title:e.title=r}function _Ne(e,t,n,r){let i=e[t];t===`view`&&(n=`cell`);let a={...i,...e.style[n??t]};QZ(a)||(e.style[n??t]=a),delete e[t]}function J1(e){return X(e,`layer`)}function vNe(e){return X(e,`repeat`)}function yNe(e){return!W(e.repeat)&&X(e.repeat,`layer`)}function bNe(e){return cg(RBe,e)}function Y1(e){return Q(e)&&a1(e)===`quantitative`&&!e.bin}function xNe(e,t,{orient:n,type:r}){let i=t===`x`?`y`:`radius`,a=t===`x`&&[`bar`,`area`].includes(r),o=e[t],s=e[i];if(Q(o)&&Q(s)){if(Y1(o)&&Y1(s)){if(o.stack)return t;if(s.stack)return i;let e=Q(o)&&!!o.aggregate;if(e!==(Q(s)&&!!s.aggregate))return e?t:i;if(a){if(n===`vertical`)return i;if(n===`horizontal`)return t}}else if(Y1(o))return t;else if(Y1(s))return i}else if(Y1(o))return a&&n===`vertical`?void 0:t;else if(Y1(s))return a&&n===`horizontal`?void 0:i}function SNe(e){switch(e){case`x`:return`y`;case`y`:return`x`;case`theta`:return`radius`;case`radius`:return`theta`}}function CNe(e,t){let n=L$(e)?e:{type:e},r=n.type;if(!zBe.has(r))return null;let i=xNe(t,`x`,n)||xNe(t,`theta`,n);if(!i)return null;let a=t[i],o=Q(a)?m1(a,{}):void 0,s=SNe(i),c=[],l=new Set;if(t[s]){let e=t[s],n=Q(e)?m1(e,{}):void 0;n&&n!==o&&(c.push(s),l.add(n))}let u=s===`x`?`xOffset`:`yOffset`,d=t[u],f=Q(d)?m1(d,{}):void 0;f&&f!==o&&(c.push(u),l.add(f));let p=oze.reduce((e,n)=>{if(n!==`tooltip`&&A1(t,n)){let r=t[n];for(let t of Qh(r)){let r=b1(t);if(r.aggregate)continue;let i=m1(r,{});(!i||!l.has(i))&&e.push({channel:n,fieldDef:r})}}return e},[]),m;return a.stack===void 0?BBe.has(r)&&(m=`zero`):m=mg(a.stack)?a.stack?`zero`:null:a.stack,!m||!bNe(m)||NMe(t)&&p.length===0?null:(a?.scale?.type&&a?.scale?.type!==N4.LINEAR&&a?.stack&&Z(KAe(a.scale.type)),l1(t[kQ(i)])?(a.stack!==void 0&&Z(GAe(i)),null):(Q(a)&&a.aggregate&&!Cze.has(a.aggregate)&&Z(qAe(a.aggregate)),{groupbyChannels:c,groupbyFields:l,fieldChannel:i,impute:a.impute!==null&&F$(r),stackBy:p,offset:m}))}function wNe(e,t,n){let r=YQ(e),i=r$(`orient`,r,n);if(r.orient=ONe(r.type,t,i),i!==void 0&&i!==r.orient&&Z(kAe(r.orient,i)),r.type===`bar`&&r.orient){let e=r$(`cornerRadiusEnd`,r,n);if(e!==void 0){let n=r.orient===`horizontal`&&t.x2||r.orient===`vertical`&&t.y2?[`cornerRadius`]:mBe[r.orient];for(let t of n)r[t]=e;r.cornerRadiusEnd!==void 0&&delete r.cornerRadiusEnd}}let a=r$(`opacity`,r,n),o=r$(`fillOpacity`,r,n);return a===void 0&&o===void 0&&(r.opacity=ENe(r.type,t)),r$(`cursor`,r,n)===void 0&&(r.cursor=TNe(r,t,n)),r}function TNe(e,t,n){return t.href||e.href||r$(`href`,e,n)?`pointer`:e.cursor}function ENe(e,t){if(UZ([U4,K4,q4,J4],e)&&!NMe(t))return w3}function DNe(e,t,{graticule:n}){if(n)return!1;let r=i$(`filled`,e,t),i=e.type;return pQ(r,i!==U4&&i!==H4&&i!==W4)}function ONe(e,t,n){switch(e){case U4:case q4:case J4:case oBe:case aBe:return}let{x:r,y:i,x2:a,y2:o}=t;switch(e){case G4:case V4:if(Q(r)&&(GQ(r.bin)||Q(i)&&i.aggregate&&!r.aggregate))return`vertical`;if(Q(i)&&(GQ(i.bin)||Q(r)&&r.aggregate&&!i.aggregate))return`horizontal`;if(o||a){if(n)return n;if(!a)return(Q(r)&&r.type===O4&&!WQ(r.bin)||c1(r))&&Q(i)&&GQ(i.bin)?`horizontal`:`vertical`;if(!o)return(Q(i)&&i.type===O4&&!WQ(i.bin)||c1(i))&&Q(r)&&GQ(r.bin)?`vertical`:`horizontal`}case W4:if(a&&!(Q(r)&&GQ(r.bin))&&o&&!(Q(i)&&GQ(i.bin)))return;case B4:if(o)return Q(i)&&GQ(i.bin)?`horizontal`:`vertical`;if(a)return Q(r)&&GQ(r.bin)?`vertical`:`horizontal`;if(e===W4){if(r&&!i)return`vertical`;if(i&&!r)return`horizontal`}case H4:case K4:{let t=pMe(r),a=pMe(i);if(n)return n;if(t&&!a)return e===`tick`?`vertical`:`horizontal`;if(!t&&a)return e===`tick`?`horizontal`:`vertical`;if(t&&a)return`vertical`;{let e=u1(r)&&r.type===A4,t=u1(i)&&i.type===A4;if(e&&!t)return`vertical`;if(!e&&t)return`horizontal`}return}}return`vertical`}function kNe(e){let{point:t,line:n,...r}=e;return $(r).length>1?r:r.type}function ANe(e){for(let t of[`line`,`area`,`rule`,`trail`])e[t]&&(e={...e,[t]:BZ(e[t],[`point`,`line`])});return e}function X1(e,t={},n){return e.point===`transparent`?{opacity:0}:e.point?jh(e.point)?e.point:{}:e.point===void 0?t.point||n.shape?jh(t.point)?t.point:{}:void 0:null}function jNe(e,t={}){return e.line?e.line===!0?{}:e.line:e.line===void 0?t.line?t.line===!0?{}:t.line:void 0:null}function MNe(e,t){return t?Z$(e)?INe(e,t):NNe(e,t):e}function Z1(e,t){return t?INe(e,t):e}function Q1(e,t,n){let r=t[e];if(sMe(r)){if(r.repeat in n)return{...t,[e]:n[r.repeat]};Z(sAe(r.repeat));return}return t}function NNe(e,t){if(e=Q1(`field`,e,t),e!==void 0){if(e===null)return null;if(e1(e)&&X$(e.sort)){let n=Q1(`field`,e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function PNe(e,t){if(Q(e))return NNe(e,t);{let n=Q1(`datum`,e,t);return n!==e&&!n.type&&(n.type=`nominal`),n}}function FNe(e,t){if(l1(e)){let n=PNe(e,t);if(n)return n;if(n1(e))return{condition:e.condition}}else{if(i1(e)){let n=PNe(e.condition,t);if(n)return{...e,condition:n};{let{condition:t,...n}=e;return n}}return e}}function INe(e,t){let n={};for(let r in e)if(X(e,r)){let i=e[r];if(W(i))n[r]=i.map(e=>FNe(e,t)).filter(e=>e);else{let e=FNe(i,t);e!==void 0&&(n[r]=e)}}return n}function LNe({parentEncoding:e,encoding:t={},layer:n}){let r={};if(e){let i=new Set([...$(e),...$(t)]);for(let a of i){let i=t[a],o=e[a];if(l1(i)){let e={...o,...i};r[a]=e}else i1(i)?r[a]={...i,condition:{...o,...i.condition}}:i||i===null?r[a]=i:(n||d1(o)||ZQ(o)||l1(o)||W(o))&&(r[a]=o)}}else r=t;return!r||QZ(r)?void 0:r}function RNe(e){let{parentProjection:t,projection:n}=e;return t&&n&&Z(hAe({parentProjection:t,projection:n})),n??t}function $1(e){return X(e,`filter`)}function zNe(e){return X(e,`stop`)}function BNe(e){return X(e,`lookup`)}function VNe(e){return X(e,`data`)}function HNe(e){return X(e,`param`)}function UNe(e){return X(e,`pivot`)}function WNe(e){return X(e,`density`)}function GNe(e){return X(e,`quantile`)}function KNe(e){return X(e,`regression`)}function qNe(e){return X(e,`loess`)}function JNe(e){return X(e,`sample`)}function YNe(e){return X(e,`window`)}function XNe(e){return X(e,`joinaggregate`)}function ZNe(e){return X(e,`flatten`)}function QNe(e){return X(e,`calculate`)}function $Ne(e){return X(e,`bin`)}function ePe(e){return X(e,`impute`)}function tPe(e){return X(e,`timeUnit`)}function nPe(e){return X(e,`aggregate`)}function rPe(e){return X(e,`stack`)}function iPe(e){return X(e,`fold`)}function aPe(e){return X(e,`extent`)&&!X(e,`density`)&&!X(e,`regression`)}function oPe(e){return e.map(e=>$1(e)?{filter:LZ(e.filter,Dje)}:e)}function sPe(e,t){let{transform:n,...r}=e;if(n){let e=n.map(e=>{if($1(e))return{filter:e0(e,t)};if($Ne(e)&&KQ(e.bin))return{...e,bin:lPe(e.bin)};if(BNe(e)){let{selection:t,...n}=e.from;return t?{...e,from:{param:t,...n}}:e}return e});return{...r,transform:e}}return e}function cPe(e,t){let n=h2(e);if(Q(n)&&KQ(n.bin)&&(n.bin=lPe(n.bin)),f1(n)&&n.scale?.domain?.selection){let{selection:e,...t}=n.scale.domain;n.scale.domain={...t,...e?{param:e}:{}}}if(n1(n))if(W(n.condition))n.condition=n.condition.map(e=>{let{selection:n,param:r,test:i,...a}=e;return r?e:{...a,test:e0(e,t)}});else{let{selection:e,param:r,test:i,...a}=cPe(n.condition,t);n.condition=r?n.condition:{...a,test:e0(n.condition,t)}}return n}function lPe(e){let t=e.extent;if(t?.selection){let{selection:n,...r}=t;return{...e,extent:{...r,param:n}}}return e}function e0(e,t){let n=e=>LZ(e,e=>{let n={param:e,empty:t.emptySelections[e]??!0};return t.selectionPredicates[e]??=[],t.selectionPredicates[e].push(n),n});return e.selection?n(e.selection):LZ(e.test||e.filter,e=>e.selection?n(e.selection):e)}function uPe(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function dPe(e,t){t===void 0&&(t=mNe(e.config));let n=fPe(e,t),{width:r,height:i}=e,a=mPe(n,{width:r,height:i,autosize:e.autosize},t);return{...n,...a?{autosize:a}:{}}}function fPe(e,t={}){let n={config:t};return qBe.map(GBe.map(KBe.map(e,n),n),n)}function pPe(e){return vg(e)?{type:e}:e??{}}function mPe(e,t,n){let{width:r,height:i}=t,a=k1(e)||J1(e),o={};a?r==`container`&&i==`container`?(o.type=`fit`,o.contains=`padding`):r==`container`?(o.type=`fit-x`,o.contains=`padding`):i==`container`&&(o.type=`fit-y`,o.contains=`padding`):(r==`container`&&(Z(Zke(`width`)),r=void 0),i==`container`&&(Z(Zke(`height`)),i=void 0));let s={type:`pad`,...o,...n?pPe(n.autosize):{},...pPe(e.autosize)};if(s.type===`fit`&&!a&&(Z(Oze),s.type=`pad`),r==`container`&&!(s.type==`fit`||s.type==`fit-x`)&&Z(Qke(`width`)),i==`container`&&!(s.type==`fit`||s.type==`fit-y`)&&Z(Qke(`height`)),!yQ(s,{type:`pad`}))return s}function hPe(e){return[`fit`,`fit-x`,`fit-y`].includes(e)}function gPe(e){return e?`fit-${PQ(e)}`:`fit`}function _Pe(e,t){let n={};for(let t of JBe)e&&e[t]!==void 0&&(n[t]=e$(e[t]));return t&&(n.params=e.params),n}function t0(e){return{explicit:!0,value:e}}function n0(e){return{explicit:!1,value:e}}function vPe(e){return(t,n,r,i)=>{let a=e(t.value,n.value);return a>0?t:a<0?n:r0(t,n,r,i)}}function r0(e,t,n,r){return e.explicit&&t.explicit&&Z(BAe(n,r,e.value,t.value)),e}function i0(e,t,n,r,i=r0){return e===void 0||e.value===void 0?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:yQ(e.value,t.value)?e:i(e,t,n,r)}function a0(e){return X(e,`url`)}function o0(e){return X(e,`values`)}function yPe(e){return X(e,`name`)&&!a0(e)&&!o0(e)&&!s0(e)}function s0(e){return e&&(bPe(e)||xPe(e)||c0(e))}function bPe(e){return X(e,`sequence`)}function xPe(e){return X(e,`sphere`)}function c0(e){return X(e,`graticule`)}function SPe({invalid:e,isPath:t}){switch(Hje(e,{isPath:t})){case`filter`:return{marks:`exclude-invalid-values`,scales:`exclude-invalid-values`};case`break-paths-show-domains`:return{marks:t?`include-invalid-values`:`exclude-invalid-values`,scales:`include-invalid-values`};case`break-paths-filter-domains`:return{marks:t?`include-invalid-values`:`exclude-invalid-values`,scales:`exclude-invalid-values`};case`show`:return{marks:`include-invalid-values`,scales:`include-invalid-values`}}}function CPe(e){let{marks:t,scales:n}=SPe(e);return t===n?D3.Main:n===`include-invalid-values`?D3.PreFilterInvalid:D3.PostFilterInvalid}function l0(e){return e.as!==void 0}function wPe(e){return`${e}_end`}function TPe({timeUnit:e,field:t,reverse:n}){let{unit:r,utc:i}=e,{part:a,step:o}=xje(pje(r),e.step);return`${i?`utcOffset`:`timeOffset`}('${a}', ${sQ(t)}, ${n?-o:o})`}function EPe([e,t],n,r){if(n!==void 0&&n!==.5){let i=sQ(e),a=sQ(t);return[{type:`formula`,expr:DPe([TPe({timeUnit:r,field:e,reverse:!0}),i],n+.5),as:`${e}_${j3}`},{type:`formula`,expr:DPe([i,a],n+.5),as:`${e}_${M3}`}]}return[]}function DPe([e,t],n){return`${1-n} * ${e} + ${n} * ${t}`}function OPe(e){let{signals:t,hasLegend:n,index:r,...i}=e;return i.field=lQ(i.field),i}function u0(e,t=!0,n=Ch){if(W(e)){let r=e.map(e=>u0(e,t,n));return t?`[${r.join(`, `)}]`:r}else if(p$(e))return n(t?h$(e):lje(e));return t?n(bQ(e)):e}function kPe(e,t){for(let n of g2(e.component.selection??{})){let r=n.name,i=`${r}${i6}, ${n.resolve===`global`?`true`:`{unit: ${E0(e)}}`}`;for(let r of o6)r.defined(n)&&(r.signals&&(t=r.signals(e,n,t)),r.modifyExpr&&(i=r.modifyExpr(e,n,i)));t.push({name:r+lVe,on:[{events:{signal:n.name+i6},update:`modify(${G(n.name+r6)}, ${i})`}]})}return d0(t)}function APe(e,t){if(e.component.selection&&$(e.component.selection).length){let n=G(e.getName(`cell`));t.unshift({name:`facet`,value:{},on:[{events:WG(`pointermove`,`scope`),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return d0(t)}function jPe(e,t){let n=!1;for(let r of g2(e.component.selection??{})){let i=r.name,a=G(i+r6);if(t.filter(e=>e.name===i).length===0){let e=r.resolve===`global`?`union`:r.resolve,n=r.type===`point`?`, true, true)`:`)`;t.push({name:r.name,update:`${a6}(${a}, ${G(e)}${n}`})}n=!0;for(let n of o6)n.defined(r)&&n.topLevelSignals&&(t=n.topLevelSignals(e,r,t))}return n&&t.filter(e=>e.name===`unit`).length===0&&t.unshift({name:`unit`,value:{},on:[{events:`pointermove`,update:`isTuple(group()) ? group() : unit`}]}),d0(t)}function MPe(e,t){let n=[],r=[],i=E0(e,{escape:!1});for(let a of g2(e.component.selection??{})){let o={name:a.name+r6};if(a.project.hasSelectionId&&(o.transform=[{type:`collect`,sort:{field:_3}}]),a.init){let e=a.project.items.map(OPe);o.values=a.project.hasSelectionId?a.init.map(e=>({unit:i,[_3]:u0(e,!1)[0]})):a.init.map(t=>({unit:i,fields:e,values:u0(t,!1)}))}if([...n,...t].filter(e=>e.name===a.name+r6).length||n.push(o),O0(a)&&t.length){let n=e.lookupDataSource(e.getDataName(D3.Main)),i=t.find(e=>e.name===n),a=i.transform.find(e=>e.type===`filter`&&e.expr.includes(`vlSelectionTest`));if(a){i.transform=i.transform.filter(e=>e!==a);let e={name:i.name+P3,source:i.name,transform:[a]};r.push(e)}}}return n.concat(t,r)}function NPe(e,t){for(let n of g2(e.component.selection??{}))for(let r of o6)r.defined(n)&&r.marks&&(t=r.marks(e,n,t));return t}function PPe(e,t){for(let n of e.children)r2(n)&&(t=NPe(n,t));return t}function FPe(e,t,n,r){let i=hFe(e,t.param,t);return{signal:j$(n.get(`type`))&&W(r)&&r[0]>r[1]?`isValid(${i}) && reverse(${i})`:i}}function d0(e){return e.map(e=>(e.on&&!e.on.length&&delete e.on,e))}function f0(e,t){return`domain(${G(e.scaleName(t))})`}function p0(e){return e.parent&&o2(e.parent)&&(!e.parent.parent||p0(e.parent.parent))}function IPe(e,t,n,r){let i=!e.hasProjection,a=n.channel,o=n.signals.visual,s=G(i?e.scaleName(a):e.projectionName()),c=e=>`scale(${s}, ${e})`,l=e.getSizeSignalRef(a===C2?`width`:`height`).signal,u=`${a}(unit)`,d=t.events.reduce((e,t)=>[...e,{events:t.between[0],update:`[${u}, ${u}]`},{events:t,update:`[${o}[0], clamp(${u}, 0, ${l})]`}],[]);if(i){let i=n.signals.data,l=H3.defined(t),u=e.getScaleComponent(a),f=u?u.get(`type`):void 0,p=r?{init:u0(r,!0,c)}:{value:[]};return d.push({events:{signal:t.name+W3},update:j$(f)?`[${c(`${i}[0]`)}, ${c(`${i}[1]`)}]`:`[0, 0]`}),l?[{name:i,on:[]}]:[{name:o,...p,on:d},{name:i,...r?{init:u0(r)}:{},on:[{events:{signal:o},update:`${o}[0] === ${o}[1] ? null : invert(${s}, ${o})`}]}]}else{let e=a===C2?0:1,n=t.name+K3;return[{name:o,...r?{init:`[${n}[0][${e}], ${n}[1][${e}]]`}:{value:[]},on:d}]}}function m0({model:e,channelDef:t,vgChannel:n,invalidValueRef:r,mainRefFn:i}){let a=n1(t)&&t.condition,o=[];a&&(o=Qh(a).map(t=>{let n=i(t);if(oMe(t)){let{param:r,empty:i}=t;return{test:mFe(e,{param:r,empty:i}),...n}}else return{test:A0(e,t.test),...n}})),r!==void 0&&o.push(r);let s=i(t);return s!==void 0&&o.push(s),o.length>1||o.length===1&&o[0].test?{[n]:o}:o.length===1?{[n]:o[0]}:{}}function h0(e,t=`text`){let n=e.encoding[t];return m0({model:e,channelDef:n,vgChannel:t,mainRefFn:t=>g0(t,e.config),invalidValueRef:void 0})}function g0(e,t,n=`datum`){if(e){if(d1(e))return t$(e.value);if(l1(e)){let{format:r,formatType:i}=y1(e);return K$({fieldOrDatumDef:e,format:r,formatType:i,expr:n,config:t})}}}function LPe(e,t={}){let{encoding:n,markDef:r,config:i,stack:a}=e,o=n.tooltip;if(W(o))return{tooltip:zPe({tooltip:o},a,i,t)};{let s=t.reactiveGeom?`datum.datum`:`datum`;return m0({model:e,channelDef:o,vgChannel:`tooltip`,mainRefFn:e=>{let o=BPe(e,i,s);if(o)return o;if(e===null)return;let c=r$(`tooltip`,r,i);if(c===!0&&(c={content:`encoding`}),vg(c))return{value:c};if(jh(c))return ZQ(c)?c:c.content===`encoding`?zPe(n,a,i,t):{signal:s}},invalidValueRef:void 0})}}function RPe(e,t,n,{reactiveGeom:r}={}){let i={...n,...n.tooltipFormat},a=new Set,o=r?`datum.datum`:`datum`,s=[];function c(n,r){let c=DQ(r),l=u1(n)?n:{...n,type:e[c].type},u=Qh(l.title||v1(l,i)).join(`, `).replaceAll(/"/g,`\\"`),d;if(NQ(r)){let t=r===`x`?`x2`:`y2`,n=b1(e[t]);if(GQ(l.bin)&&n){let e=m1(l,{expr:o}),r=m1(n,{expr:o}),{format:s,formatType:c}=y1(l);d=Y$(e,r,s,c,i),a.add(t)}}if((NQ(r)||r===j2||r===k2)&&t&&t.fieldChannel===r&&t.offset===`normalize`){let{format:e,formatType:t}=y1(l);d=K$({fieldOrDatumDef:l,format:e,formatType:t,expr:o,config:i,normalizeStack:!0}).signal}d??=BPe(l,i,o).signal,s.push({channel:r,key:u,value:d})}M1(e,(e,t)=>{Q(e)?c(e,t):r1(e)&&c(e.condition,t)});let l={};for(let{channel:e,key:t,value:n}of s)!a.has(e)&&!l[t]&&(l[t]=n);return l}function zPe(e,t,n,{reactiveGeom:r}={}){let i=RPe(e,t,n,{reactiveGeom:r}),a=_2(i).map(([e,t])=>`"${e}": ${t}`);return a.length>0?{signal:`{${a.join(`, `)}}`}:void 0}function BPe(e,t,n=`datum`){if(Q(e)&&k$(e.type)&&!e.timeUnit&&!y1(e).format&&!y1(e).formatType){let t=`${n}["${e.field}"]`;return{signal:`isValid(${t}) ? isArray(${t}) ? join(${t}, '\\n') : ${t} : ""+${t}`}}return g0(e,t,n)}function VPe(e){let{markDef:t,config:n}=e,r=r$(`aria`,t,n);return r===!1?{}:{...r?{aria:r}:{},...HPe(e),...UPe(e)}}function HPe(e){let{mark:t,markDef:n,config:r}=e;if(r.aria===!1)return{};let i=r$(`ariaRoleDescription`,n,r);return i==null?cg(Eze,t)?{}:{ariaRoleDescription:{value:t}}:{ariaRoleDescription:{value:i}}}function UPe(e){let{encoding:t,markDef:n,config:r,stack:i}=e,a=t.description;if(a)return m0({model:e,channelDef:a,vgChannel:`description`,mainRefFn:t=>g0(t,e.config),invalidValueRef:void 0});let o=r$(`description`,n,r);if(o!=null)return{description:t$(o)};if(r.aria===!1)return{};let s=RPe(t,i,r);if(!QZ(s))return{description:{signal:_2(s).filter(([e])=>!e.startsWith(`_`)).map(([e,t])=>[e,t.replaceAll(`\\n`,` `)]).map(([e,t],n)=>`"${n>0?`; `:``}${e}: " + (${t})`).join(` + `)}}}function _0(e,t,n={}){let{markDef:r,encoding:i,config:a}=t,{vgChannel:o}=n,{defaultRef:s,defaultValue:c}=n,l=i[e];s===void 0&&(c??=r$(e,r,a,{vgChannel:o,ignoreVgConfig:!n1(l)}),c!==void 0&&(s=t$(c)));let u={markDef:r,config:a,scaleName:t.scaleName(e),scale:t.getScaleComponent(e)},d=Gje({...u,scaleChannel:e,channelDef:l});return m0({model:t,channelDef:l,vgChannel:o??e,invalidValueRef:d,mainRefFn:t=>U$({...u,channel:e,channelDef:t,stack:null,defaultRef:s})})}function WPe(e,t={filled:void 0}){let{markDef:n,encoding:r,config:i}=e,{type:a}=n,o=t.filled??r$(`filled`,n,i),s=UZ([`bar`,`point`,`circle`,`square`,`geoshape`],a)?`transparent`:void 0,c=r$(o===!0?`color`:void 0,n,i,{vgChannel:`fill`})??i.mark[o===!0&&`color`]??s,l=r$(o===!1?`color`:void 0,n,i,{vgChannel:`stroke`})??i.mark[o===!1&&`color`],u=o?`fill`:`stroke`,d={...c?{fill:t$(c)}:{},...l?{stroke:t$(l)}:{}};return n.color&&(o?n.fill:n.stroke)&&Z(xAe(`property`,{fill:`fill`in n,stroke:`stroke`in n})),{...d,..._0(`color`,e,{vgChannel:u,defaultValue:o?c:l}),..._0(`fill`,e,{defaultValue:r.fill?c:void 0}),..._0(`stroke`,e,{defaultValue:r.stroke?l:void 0})}}function GPe(e){let{encoding:t,mark:n}=e,r=t.order;return!F$(n)&&d1(r)?m0({model:e,channelDef:r,vgChannel:`zindex`,mainRefFn:e=>t$(e.value),invalidValueRef:void 0}):{}}function v0({channel:e,markDef:t,encoding:n={},model:r,bandPosition:i}){let a=`${e}Offset`,o=t[a],s=n[a];if((a===`xOffset`||a===`yOffset`)&&s)return{offsetType:`encoding`,offset:U$({channel:a,channelDef:s,markDef:t,config:r?.config,scaleName:r.scaleName(a),scale:r.getScaleComponent(a),stack:null,defaultRef:t$(o),bandPosition:i})};let c=t[a];return c?{offsetType:`visual`,offset:c}:{}}function y0(e,t,{defaultPos:n,vgChannel:r}){let{encoding:i,markDef:a,config:o,stack:s}=t,c=i[e],l=i[kQ(e)],u=t.scaleName(e),d=t.getScaleComponent(e),{offset:f,offsetType:p}=v0({channel:e,markDef:a,encoding:i,model:t,bandPosition:.5}),m=b0({model:t,defaultPos:n,channel:e,scaleName:u,scale:d}),h=!c&&NQ(e)&&(i.latitude||i.longitude)?{field:t.getName(e)}:KPe({channel:e,channelDef:c,channel2Def:l,markDef:a,config:o,scaleName:u,scale:d,stack:s,offset:f,defaultRef:m,bandPosition:p===`encoding`?0:void 0});return h?{[r||e]:h}:void 0}function KPe(e){let{channel:t,channelDef:n,scaleName:r,stack:i,offset:a,markDef:o}=e;if(l1(n)&&i&&t===i.fieldChannel){if(Q(n)){let e=n.bandPosition;if(e===void 0&&o.type===`text`&&(t===`radius`||t===`theta`)&&(e=.5),e!==void 0)return H$({scaleName:r,fieldOrDatumDef:n,startSuffix:`start`,bandPosition:e,offset:a})}return V$(n,r,{suffix:`end`},{offset:a})}return B$(e)}function b0({model:e,defaultPos:t,channel:n,scaleName:r,scale:i}){let{markDef:a,config:o}=e;return()=>{let s=DQ(n),c=OQ(n),l=r$(n,a,o,{vgChannel:c});if(l!==void 0)return W$(n,l);switch(t){case`zeroOrMin`:return qPe({scaleName:r,scale:i,mode:`zeroOrMin`,mainChannel:s,config:o});case`zeroOrMax`:return qPe({scaleName:r,scale:i,mode:{zeroOrMax:{widthSignal:e.width.signal,heightSignal:e.height.signal}},mainChannel:s,config:o});case`mid`:return{...e[AQ(n)],mult:.5}}}}function qPe({mainChannel:e,config:t,...n}){let r=Wje(n),{mode:i}=n;if(r)return r;switch(e){case`radius`:{if(i===`zeroOrMin`)return{value:0};let{widthSignal:e,heightSignal:t}=i.zeroOrMax;return{signal:`min(${e},${t})/2`}}case`theta`:return i===`zeroOrMin`?{value:0}:{signal:`2*PI`};case`x`:return i===`zeroOrMin`?{value:0}:{field:{group:`width`}};case`y`:return i===`zeroOrMin`?{field:{group:`height`}}:{value:0}}}function JPe(e,t,n,r=`middle`){if(e===`radius`||e===`theta`)return OQ(e);let i=e===`x`?`align`:`baseline`,a=r$(i,t,n),o;return ZQ(a)?(Z(DAe(i)),o=void 0):o=a,e===`x`?rVe[o||(r===`top`?`left`:`center`)]:iVe[o||r]}function x0(e,t,{defaultPos:n,defaultPos2:r,range:i}){return i?YPe(e,t,{defaultPos:n,defaultPos2:r}):y0(e,t,{defaultPos:n})}function YPe(e,t,{defaultPos:n,defaultPos2:r}){let{markDef:i,config:a}=t,o=kQ(e),s=AQ(e),c=XPe(t,r,o);return{...y0(e,t,{defaultPos:n,vgChannel:c[s]?JPe(e,i,a):OQ(e)}),...c}}function XPe(e,t,n){let{encoding:r,mark:i,markDef:a,stack:o,config:s}=e,c=DQ(n),l=AQ(n),u=OQ(n),d=r[c],f=e.scaleName(c),p=e.getScaleComponent(c),{offset:m}=n in r||n in a?v0({channel:n,markDef:a,encoding:r,model:e}):v0({channel:c,markDef:a,encoding:r,model:e});if(!d&&(n===`x2`||n===`y2`)&&(r.latitude||r.longitude)){let t=AQ(n),r=e.markDef[t];return r==null?{[u]:{field:e.getName(n)}}:{[t]:{value:r}}}let h=ZPe({channel:n,channelDef:d,channel2Def:r[n],markDef:a,config:s,scaleName:f,scale:p,stack:o,offset:m,defaultRef:void 0});return h===void 0?S0(n,a)||S0(n,{[n]:a$(n,a,s.style),[l]:a$(l,a,s.style)})||S0(n,s[i])||S0(n,s.mark)||{[u]:b0({model:e,defaultPos:t,channel:n,scaleName:f,scale:p})()}:{[u]:h}}function ZPe({channel:e,channelDef:t,channel2Def:n,markDef:r,config:i,scaleName:a,scale:o,stack:s,offset:c,defaultRef:l}){return l1(t)&&s&&e.charAt(0)===s.fieldChannel.charAt(0)?V$(t,a,{suffix:`start`},{offset:c}):B$({channel:e,channelDef:n,scaleName:a,scale:o,stack:s,markDef:r,config:i,offset:c,defaultRef:l})}function S0(e,t){let n=AQ(e),r=OQ(e);if(t[r]!==void 0)return{[r]:W$(e,t[r])};if(t[e]!==void 0)return{[r]:W$(e,t[e])};if(t[n]){let r=t[n];if(R$(r))Z(SAe(n));else return{[n]:W$(e,r)}}}function C0(e,t){let{config:n,encoding:r,markDef:i}=e,a=i.type,o=kQ(t),s=AQ(t),c=r[t],l=r[o],u=e.getScaleComponent(t),d=u?u.get(`type`):void 0,f=i.orient,p=r[s]??r.size??r$(`size`,i,n,{vgChannel:s}),m=jQ(t),h=a===`bar`&&(t===`x`?f===`vertical`:f===`horizontal`)||a===`tick`&&(t===`y`?f===`vertical`:f===`horizontal`);return Q(c)&&(WQ(c.bin)||GQ(c.bin)||c.timeUnit&&!l)&&!(p&&!R$(p))&&!r[m]&&!A$(d)?tFe({fieldDef:c,fieldDef2:l,channel:t,model:e}):(l1(c)&&A$(d)||h)&&!l?$Pe(c,t,e):YPe(t,e,{defaultPos:`zeroOrMax`,defaultPos2:`zeroOrMin`})}function QPe(e,t,n,r,i,a,o){if(R$(i))if(n){let e=n.get(`type`);if(e===`band`){let e=`bandwidth('${t}')`;i.band!==1&&(e=`${i.band} * ${e}`);let n=i$(`minBandSize`,{type:o},r);return{signal:n?`max(${n$(n)}, ${e})`:e}}else i.band!==1&&Z(jAe(e))}else return{mult:i.band,field:{group:e}};else if(ZQ(i))return i;else if(i)return{value:i};if(n){let e=n.get(`range`);if(QQ(e)&&gg(e.step))return{value:e.step-2}}if(!a){let{bandPaddingInner:t,barBandPaddingInner:n,rectBandPaddingInner:i,tickBandPaddingInner:a}=r.scale,s=pQ(t,o===`tick`?a:o===`bar`?n:i);if(ZQ(s))return{signal:`(1 - (${s.signal})) * ${e}`};if(gg(s))return{signal:`${1-s} * ${e}`}}return{value:K1(r.view,e)-2}}function $Pe(e,t,n){let{markDef:r,encoding:i,config:a,stack:o}=n,s=r.orient,c=n.scaleName(t),l=n.getScaleComponent(t),u=AQ(t),d=kQ(t),f=jQ(t),p=n.scaleName(f),m=n.getScaleComponent(MQ(t)),h=r.type===`tick`||s===`horizontal`&&t===`y`||s===`vertical`&&t===`x`,g;(i.size||r.size)&&(h?g=_0(`size`,n,{vgChannel:u,defaultRef:t$(r.size)}):Z(FAe(r.type)));let _=!!g,v=lMe({channel:t,fieldDef:e,markDef:r,config:a,scaleType:(l||m)?.get(`type`),useVlSizeChannel:h});g||={[u]:QPe(u,p||c,m||l,a,v,!!e,r.type)};let y=JPe(t,r,a,(l||m)?.get(`type`)===`band`&&R$(v)&&!_?`top`:`middle`),b=y===`xc`||y===`yc`,{offset:x,offsetType:S}=v0({channel:t,markDef:r,encoding:i,model:n,bandPosition:b?.5:0}),C=(b&&S!==`encoding`&&Q(e)&&e.timeUnit&&!i[d]?t1({fieldDef:e,markDef:r,config:a}):void 0)??(b?S===`encoding`?0:.5:ZQ(v)?{signal:`(1-${v})/2`}:R$(v)?(1-v.band)/2:0),w=B$({channel:t,channelDef:e,markDef:r,config:a,scaleName:c,scale:l,stack:o,offset:x,defaultRef:b0({model:n,defaultPos:`mid`,channel:t,scaleName:c,scale:l}),bandPosition:C});if(u)return{[y]:w,...g};{let e=OQ(d),t=g[u],n=x?{...t,offset:x}:t;return{[y]:w,[e]:W(w)?[w[0],{...w[1],offset:n}]:{...w,offset:n}}}}function eFe(e,t,n,r,i,a,o){if(xQ(e))return 0;let s=e===`x`||e===`y2`,c=s?-t/2:t/2;if(ZQ(n)||ZQ(i)||ZQ(r)||a){let e=n$(n),t=n$(i),l=n$(r),u=n$(a),d=a?`(${o} < ${u} ? ${s?``:`-`}0.5 * (${u} - (${o})) : ${c})`:c,f=l?`${l} + `:``,p=e?`(${e} ? -1 : 1) * `:``,m=t?`(${t} + ${d})`:d;return{signal:f+p+m}}else return i||=0,r+(n?-i-c:+i+c)}function tFe({fieldDef:e,fieldDef2:t,channel:n,model:r}){let{config:i,markDef:a,encoding:o}=r,s=r.getScaleComponent(n),c=r.scaleName(n),l=s?s.get(`type`):void 0,u=s.get(`reverse`),d=lMe({channel:n,fieldDef:e,markDef:a,config:i,scaleType:l}),f=(r.component.axes[n]?.[0])?.get(`translate`)??.5,p=NQ(n)?r$(`binSpacing`,a,i)??0:0,m=kQ(n),h=OQ(n),g=OQ(m),_=i$(`minBandSize`,a,i),{offset:v}=v0({channel:n,markDef:a,encoding:o,model:r,bandPosition:0}),{offset:y}=v0({channel:m,markDef:a,encoding:o,model:r,bandPosition:0}),b=Jje({fieldDef:e,scaleName:c}),x=eFe(n,p,u,f,v,_,b),S=eFe(m,p,u,f,y??v,_,b),C=ZQ(d)?{signal:`(1-${d.signal})/2`}:R$(d)?(1-d.band)/2:.5,w=t1({fieldDef:e,fieldDef2:t,markDef:a,config:i});if(WQ(e.bin)||e.timeUnit){let t=e.timeUnit&&w!==.5;return{[g]:nFe({fieldDef:e,scaleName:c,bandPosition:C,offset:S,useRectOffsetField:t}),[h]:nFe({fieldDef:e,scaleName:c,bandPosition:ZQ(C)?{signal:`1-${C.signal}`}:1-C,offset:x,useRectOffsetField:t})}}else if(GQ(e.bin)){let n=V$(e,c,{},{offset:S});if(Q(t))return{[g]:n,[h]:V$(t,c,{},{offset:x})};if(KQ(e.bin)&&e.bin.step)return{[g]:n,[h]:{signal:`scale("${c}", ${m1(e,{expr:`datum`})} + ${e.bin.step})`,offset:x}}}Z($Ae(m))}function nFe({fieldDef:e,scaleName:t,bandPosition:n,offset:r,useRectOffsetField:i}){return H$({scaleName:t,fieldOrDatumDef:e,bandPosition:n,offset:r,...i?{startSuffix:j3,endSuffix:M3}:{}})}function w0(e,t){let{fill:n=void 0,stroke:r=void 0}=t.color===`include`?WPe(e):{};return{...iFe(e.markDef,t),...rFe(`fill`,n),...rFe(`stroke`,r),..._0(`opacity`,e),..._0(`fillOpacity`,e),..._0(`strokeOpacity`,e),..._0(`strokeWidth`,e),..._0(`strokeDash`,e),...GPe(e),...LPe(e),...h0(e,`href`),...VPe(e)}}function rFe(e,t){return t?{[e]:t}:{}}function iFe(e,t){return Tze.reduce((n,r)=>(!aVe.has(r)&&X(e,r)&&t[r]!==`ignore`&&(n[r]=t$(e[r])),n),{})}function T0(e){let{config:t,markDef:n}=e,r=new Set;if(e.forEachFieldDef((i,a)=>{let o;if(!LQ(a)||!(o=e.getScaleType(a)))return;let s=HQ(i.aggregate);if(Uje(z$({scaleChannel:a,markDef:n,config:t,scaleType:o,isCountAggregate:s}))){let t=e.vgField(a,{expr:`datum`,binSuffix:e.stack?.impute?`mid`:void 0});t&&r.add(t)}}),r.size>0)return{defined:{signal:[...r].map(e=>O$(e,!0)).join(` && `)}}}function aFe(e,t){if(t!==void 0)return{[e]:t$(t)}}function oFe(e,t,n){let r=e.fieldDef(t)?.field;for(let i of g2(e.component.selection??{})){let e=i.project.hasField[r]??i.project.hasChannel[t];if(e&&Q3.defined(i)){let t=n.get(`selections`)??[];t.push(i.name),n.set(`selections`,t,!1),e.hasLegend=!0}}}function sFe(e,t,n,r,i){let a=t.name,o=a+$3,s=a+e6,c=n.channel,l=H3.defined(t),u=i.find(e=>e.name===n.signals[l?`data`:`visual`]),d=e.getSizeSignalRef(r).signal,f=e.getScaleComponent(c),p=f?.get(`type`),m=f?.get(`reverse`),h=l?c===C2?m?``:`-`:m?`-`:``:``,g=`${o}.extent_${c}`,_=`${h}${s}.${c} / ${l?`${d}`:`span(${g})`}`,v=`${!l||!f?`panLinear`:p===`log`?`panLog`:p===`symlog`?`panSymlog`:p===`pow`?`panPow`:`panLinear`}(${g}, ${_}${l?p===`pow`?`, ${f.get(`exponent`)??1}`:p===`symlog`?`, ${f.get(`constant`)??1}`:``:``})`;u.on.push({events:{signal:s},update:l?v:`clampRange(${v}, 0, ${d})`})}function cFe(e,t,n,r,i){let a=t.name,o=n.channel,s=H3.defined(t),c=i.find(e=>e.name===n.signals[s?`data`:`visual`]),l=e.getSizeSignalRef(r).signal,u=e.getScaleComponent(o),d=u?.get(`type`),f=s?f0(e,o):c.name,p=a+n6,m=`${a}${t6}.${o}`,h=`${!s||!u?`zoomLinear`:d===`log`?`zoomLog`:d===`symlog`?`zoomSymlog`:d===`pow`?`zoomPow`:`zoomLinear`}(${f}, ${m}, ${p}${s?d===`pow`?`, ${u.get(`exponent`)??1}`:d===`symlog`?`, ${u.get(`constant`)??1}`:``:``})`;c.on.push({events:{signal:p},update:s?h:`clampRange(${h}, 0, ${l})`})}function lFe(e){let t=e.parent;for(;t&&!i2(t);)t=t.parent;return t}function E0(e,{escape:t}={escape:!0}){let n=t?G(e.name):e.name,r=lFe(e);if(r){let{facet:e}=r;for(let t of s4)e[t]&&(n+=` + '__facet_${t}_' + (facet[${G(r.vgField(t))}])`)}return n}function D0(e){return g2(e.component.selection??{}).reduce((e,t)=>e||t.project.hasSelectionId,!1)}function uFe(e,t){(vg(t.select)||!t.select.on)&&delete e.events,(vg(t.select)||!t.select.clear)&&delete e.clear,(vg(t.select)||!t.select.toggle)&&delete e.toggle}function O0(e){return e.events?.find(e=>`type`in e&&e.type===`timer`)}function k0(e){let t=[];return e.type===`Identifier`?[e.name]:e.type===`Literal`?[e.value]:(e.type===`MemberExpression`&&(t.push(...k0(e.object)),t.push(...k0(e.property))),t)}function dFe(e){return e.object.type===`MemberExpression`?dFe(e.object):e.object.name===`datum`}function fFe(e){let t=Ske(e),n=new Set;return t.visit(e=>{e.type===`MemberExpression`&&dFe(e)&&n.add(k0(e).slice(1).join(`.`))}),n}function pFe(e,t){let n={},r=e.config.selection;if(!t||!t.length)return n;let i=0;for(let a of t){let t=tQ(a.name),o=a.select,s=vg(o)?o:o.type,c=jh(o)?h2(o):{type:s},l=r[s];for(let e in l)e===`fields`||e===`encodings`||(e===`mark`&&(c.mark={...l.mark,...c.mark}),(c[e]===void 0||c[e]===!0)&&(c[e]=h2(l[e]??c[e])));let u=n[t]={...c,name:t,type:s,init:a.value,bind:a.bind,events:vg(c.on)?WG(c.on,`scope`):Qh(h2(c.on))};if(O0(u)&&(i++,i>1)){delete n[t];continue}let d=h2(a);for(let t of o6)t.defined(u)&&t.parse&&t.parse(e,u,d)}return i>1&&Z(Pze),n}function mFe(e,t,n,r=`datum`){let i=vg(t)?t:t.param,a=tQ(i),o=G(a+r6),s;try{s=e.getSelectionComponent(a,i)}catch{return`!!${a}`}if(s.project.timeUnit){let t=n??e.component.data.raw,r=s.project.timeUnit.clone();t.parent?r.insertAsParentOf(t):t.parent=r}let c=`${s.project.hasSelectionId?`vlSelectionIdTest(`:`vlSelectionTest(`}${o}, ${r}${s.resolve===`global`?`)`:`, ${G(s.resolve)})`}`,l=`length(data(${o}))`;return t.empty===!1?`${l} && ${c}`:`!${l} || ${c}`}function hFe(e,t,n){let r=tQ(t),i=n.encoding,a=n.field,o;try{o=e.getSelectionComponent(r,t)}catch{return r}if(!i&&!a)a=o.project.items[0].field,o.project.items.length>1&&Z(lAe(a));else if(i&&!a){let e=o.project.items.filter(e=>e.channel===i);!e.length||e.length>1?(a=o.project.items[0].field,Z(uAe(e,i,n,a))):a=e[0].field}return`${o.name}[${G(lQ(a))}]`}function gFe(e,t){for(let[n,r]of _2(e.component.selection??{})){let i=e.getName(`lookup_${n}`);e.component.data.outputNodes[i]=r.materialized=new k3(new s6(t,e,{param:n}),i,D3.Lookup,e.component.data.outputNodeRefCounts)}}function A0(e,t,n){return nQ(t,t=>vg(t)?t:Sje(t)?mFe(e,t,n):Eje(t))}function _Fe(e,t){if(e)return W(e)&&!XQ(e)?e.map(e=>v1(e,t)).join(`, `):e}function j0(e,t,n,r){e.encode??={},e.encode[t]??={},e.encode[t].update??={},e.encode[t].update[n]=r}function M0(e,t,n,r={header:!1}){let{disable:i,orient:a,scale:o,labelExpr:s,title:c,zindex:l,...u}=e.combine();if(!i){for(let e in u){let n=e,r=vBe[n],i=u[n];if(r&&r!==t&&r!==`both`)delete u[n];else if(O1(i)){let{condition:e,...t}=i,r=Qh(e),a=i3[n];if(a){let{vgProp:e,part:i}=a;j0(u,i,e,[...r.map(e=>{let{test:t,...n}=e;return{test:A0(null,t),...n}}),t]),delete u[n]}else a===null&&(u[n]={signal:r.map(e=>{let{test:t,...n}=e;return`${A0(null,t)} ? ${Uke(n)} : `}).join(``)+Uke(t)})}else if(ZQ(i)){let e=i3[n];if(e){let{vgProp:t,part:r}=e;j0(u,r,t,i),delete u[n]}}UZ([`labelAlign`,`labelBaseline`],n)&&u[n]===null&&delete u[n]}if(t===`grid`){if(!u.grid)return;if(u.encode){let{grid:e}=u.encode;u.encode={...e?{grid:e}:{}},QZ(u.encode)&&delete u.encode}return{scale:o,orient:a,...u,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:pQ(l,0)}}else{if(!r.header&&e.mainExtracted)return;if(s!==void 0){let e=s;u.encode?.labels?.update&&ZQ(u.encode.labels.update.text)&&(e=uQ(s,`datum.label`,u.encode.labels.update.text.signal)),j0(u,`labels`,`text`,{signal:e})}if(u.labelAlign===null&&delete u.labelAlign,u.encode){for(let t of a3)e.hasAxisPart(t)||delete u.encode[t];QZ(u.encode)&&delete u.encode}let t=_Fe(c,n);return{scale:o,orient:a,grid:!1,...t?{title:t}:{},...u,...n.aria===!1?{aria:!1}:{},zindex:pQ(l,0)}}}}function vFe(e){let{axes:t}=e.component,n=[];for(let r of d4)if(t[r]){for(let i of t[r])if(!i.get(`disable`)&&!i.get(`gridScale`)){let t=r===`x`?`height`:`width`,i=e.getSizeSignalRef(t).signal;t!==i&&n.push({name:t,update:i})}}return n}function yFe(e,t){let{x:n=[],y:r=[]}=e;return[...n.map(e=>M0(e,`grid`,t)),...r.map(e=>M0(e,`grid`,t)),...n.map(e=>M0(e,`main`,t)),...r.map(e=>M0(e,`main`,t))].filter(e=>e)}function bFe(e,t,n,r){return Object.assign.apply(null,[{},...e.map(e=>{if(e===`axisOrient`){let e=n===`x`?`bottom`:`left`,i=t[n===`x`?`axisBottom`:`axisLeft`]||{},a=t[n===`x`?`axisTop`:`axisRight`]||{},o=new Set([...$(i),...$(a)]),s={};for(let t of o.values())s[t]={signal:`${r.signal} === "${e}" ? ${n$(i[t])} : ${n$(a[t])}`};return s}return t[e]})])}function xFe(e,t,n,r){let i=t===`band`?[`axisDiscrete`,`axisBand`]:t===`point`?[`axisDiscrete`,`axisPoint`]:Mje(t)?[`axisQuantitative`]:t===`time`||t===`utc`?[`axisTemporal`]:[],a=e===`x`?`axisX`:`axisY`,o=ZQ(n)?`axisOrient`:`axis${iQ(n)}`,s=[...i,...i.map(e=>a+e.substr(4))],c=[`axis`,o,a];return{vlOnlyAxisConfig:bFe(s,r,e,n),vgAxisConfig:bFe(c,r,e,n),axisConfigStyle:SFe([...c,...s],r)}}function SFe(e,t){let n=[{}];for(let r of e){let e=t[r]?.style;if(e){e=Qh(e);for(let r of e)n.push(t.style[r])}}return Object.assign.apply(null,n)}function N0(e,t,n,r={}){let i=Kke(e,n,t);if(i!==void 0)return{configFrom:`style`,configValue:i};for(let t of[`vlOnlyAxisConfig`,`vgAxisConfig`,`axisConfigStyle`])if(r[t]?.[e]!==void 0)return{configFrom:t,configValue:r[t][e]};return{}}function CFe(e,t){return!A$(e)&&Q(t)&&!WQ(t?.bin)&&!GQ(t?.bin)}function wFe(e,t){let n=t===`x`?`y`:`x`;if(e.getScaleComponent(n))return e.scaleName(n)}function TFe(e,t,n,r,i){let a=t?.labelAngle;if(a!==void 0)return ZQ(a)?a:_Q(a);{let{configValue:a}=N0(`labelAngle`,r,t?.style,i);return a===void 0?n===C2&&UZ([j4,k4],e.type)&&!(Q(e)&&e.timeUnit)?270:void 0:_Q(a)}}function P0(e){return`(((${e.signal} % 360) + 360) % 360)`}function EFe(e,t,n,r){if(e!==void 0)if(n===`x`){if(ZQ(e)){let n=P0(e);return{signal:`(45 < ${n} && ${n} < 135) || (225 < ${n} && ${n} < 315) ? "middle" :(${n} <= 45 || 315 <= ${n}) === ${ZQ(t)?`(${t.signal} === "top")`:t===`top`} ? "bottom" : "top"`}}if(450;if(a||u){let s=t===`row`?`height`:`width`;return{name:e.getName(`${t}_${n}`),type:`group`,role:`${t}-${n}`,...r.facetFieldDef?{from:{data:e.getName(`${t}_domain`)},sort:BFe(o,t)}:{},...u&&c?{from:{data:e.getName(`facet_domain_${t}`)}}:{},...a?{title:a}:{},...i.sizeSignal?{encode:{update:{[s]:i.sizeSignal}}}:{},...u?{axes:l}:{}}}}return null}function HFe(e,t){return uVe[t][e]}function UFe(e,t){let n={};for(let r of s4){let i=e[r];if(i?.facetFieldDef){let{titleAnchor:e,titleOrient:a}=R0([`titleAnchor`,`titleOrient`],i.facetFieldDef.header,t,r),o=I0(r,a),s=HFe(e,o);s!==void 0&&(n[o]=s)}}return QZ(n)?void 0:n}function WFe(e,t,n,r,i){let a={};for(let o of r){if(!i[o])continue;let r=L0(o,t?.header,e,n);r!==void 0&&(a[i[o]]=r)}return a}function B0(e){return[...V0(e,`width`),...V0(e,`height`),...V0(e,`childWidth`),...V0(e,`childHeight`)]}function V0(e,t){let n=t===`width`?`x`:`y`,r=e.component.layoutSize.get(t);if(r==null||r===`merged`)return[];let i=e.getSizeSignalRef(t).signal;if(r===`step`){let t=e.getScaleComponent(n);if(t){let r=t.get(`type`),a=t.get(`range`);if(A$(r)&&QQ(a)){let r=e.scaleName(n);return i2(e.parent)&&e.parent.component.resolve.scale[n]===`independent`?[GFe(r,a)]:[GFe(r,a),{name:i,update:KFe(r,t,`domain('${r}').length`)}]}}throw Error(`layout size is step although width/height is not step.`)}else if(r==`container`){let t=i.endsWith(`width`),n=t?`containerSize()[0]`:`containerSize()[1]`,r=`isFinite(${n}) ? ${n} : ${G1(e.config.view,t?`width`:`height`)}`;return[{name:i,init:r,on:[{update:r,events:`window:resize`}]}]}else return[{name:i,value:r}]}function GFe(e,t){let n=`${e}_step`;return ZQ(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function KFe(e,t,n){let r=t.get(`type`),i=t.get(`padding`),a=pQ(t.get(`paddingOuter`),i),o=t.get(`paddingInner`);return o=r===`band`?o===void 0?i:o:1,`bandspace(${n}, ${n$(o)}, ${n$(a)}) * ${e}_step`}function qFe(e){return e===`childWidth`?`width`:e===`childHeight`?`height`:e}function JFe(e,t){return $(e).reduce((n,r)=>({...n,...m0({model:t,channelDef:e[r],vgChannel:r,mainRefFn:e=>t$(e.value),invalidValueRef:void 0})}),{})}function YFe(e,t){if(i2(t))return e===`theta`?`independent`:`shared`;if(o2(t))return`shared`;if(a2(t))return NQ(e)||e===`theta`||e===`radius`?`independent`:`shared`;throw Error(`invalid model type for resolve`)}function H0(e,t){let n=e.scale[t],r=NQ(t)?`axis`:`legend`;return n===`independent`?(e[r][t]===`shared`&&Z(HAe(t)),`independent`):e[r][t]||`shared`}function XFe(e,{fieldOrDatumDef:t,model:n,channel:r,legendCmpt:i,legendType:a}){if(a!==`symbol`)return;let{markDef:o,encoding:s,config:c,mark:l}=n,u=o.filled&&l!==`trail`,d={...Wke({},n,dBe),...WPe(n,{filled:u})},f=i.get(`symbolOpacity`)??c.legend.symbolOpacity,p=i.get(`symbolFillColor`)??c.legend.symbolFillColor,m=i.get(`symbolStrokeColor`)??c.legend.symbolStrokeColor,h=f===void 0?eIe(s.opacity)??o.opacity:void 0;if(d.fill){if(r===`fill`||u&&r===R2)delete d.fill;else if(X(d.fill,`field`))p?delete d.fill:(d.fill=t$(c.legend.symbolBaseFillColor??`black`),d.fillOpacity=t$(h??1));else if(W(d.fill)){let e=U0(s.fill??s.color)??o.fill??(u&&o.color);e&&(d.fill=t$(e))}}if(d.stroke){if(r===`stroke`||!u&&r===R2)delete d.stroke;else if(X(d.stroke,`field`)||m)delete d.stroke;else if(W(d.stroke)){let e=pQ(U0(s.stroke||s.color),o.stroke,u?o.color:void 0);e&&(d.stroke={value:e})}}if(r!==W2){let e=Q(t)&&nIe(n,i,t);e?d.opacity=[{test:e,...t$(h??1)},t$(c.legend.unselectedOpacity)]:h&&(d.opacity=t$(h))}return d={...d,...e},QZ(d)?void 0:d}function ZFe(e,{model:t,legendType:n,legendCmpt:r}){if(n!==`gradient`)return;let{config:i,markDef:a,encoding:o}=t,s={},c=(r.get(`gradientOpacity`)??i.legend.gradientOpacity)===void 0?eIe(o.opacity)||a.opacity:void 0;return c&&(s.opacity=t$(c)),s={...s,...e},QZ(s)?void 0:s}function QFe(e,{fieldOrDatumDef:t,model:n,channel:r,legendCmpt:i}){let a=n.legend(r)||{},o=n.config,s=Q(t)?nIe(n,i,t):void 0,c=s?[{test:s,value:1},{value:o.legend.unselectedOpacity}]:void 0,{format:l,formatType:u}=a,d;G$(u)?d=q$({fieldOrDatumDef:t,field:`datum.value`,format:l,formatType:u,config:o}):l===void 0&&u===void 0&&o.customFormatTypes&&(t.type===`quantitative`&&o.numberFormatType?d=q$({fieldOrDatumDef:t,field:`datum.value`,format:o.numberFormat,formatType:o.numberFormatType,config:o}):t.type===`temporal`&&o.timeFormatType&&Q(t)&&t.timeUnit===void 0&&(d=q$({fieldOrDatumDef:t,field:`datum.value`,format:o.timeFormat,formatType:o.timeFormatType,config:o})));let f={...c?{opacity:c}:{},...d?{text:d}:{},...e};return QZ(f)?void 0:f}function $Fe(e,{legendCmpt:t}){return t.get(`selections`)?.length?{...e,fill:{value:`transparent`}}:e}function eIe(e){return tIe(e,(e,t)=>Math.max(e,t.value))}function U0(e){return tIe(e,(e,t)=>pQ(e,t.value))}function tIe(e,t){if(fMe(e))return Qh(e.condition).reduce(t,e.value);if(d1(e))return e.value}function nIe(e,t,n){let r=t.get(`selections`);if(!r?.length)return;let i=G(n.field);return r.map(e=>`(!length(data(${G(tQ(e)+r6)})) || (${e}[${i}] && indexof(${e}[${i}], datum.value) >= 0))`).join(` || `)}function rIe(e,t){let n=e.values;if(W(n))return kMe(t,n);if(ZQ(n))return n}function iIe(e,t,n,r){if(t!==`shape`){let e=U0(n)??r;if(e)return e}switch(e){case`bar`:case`rect`:case`image`:case`square`:return`square`;case`line`:case`trail`:case`rule`:return`stroke`;case`arc`:case`point`:case`circle`:case`tick`:case`geoshape`:case`area`:case`text`:return`circle`}}function aIe(e){let{legend:t}=e;return pQ(t.type,oIe(e))}function oIe({channel:e,timeUnit:t,scaleType:n}){if(wQ(e)){if(UZ([`quarter`,`month`,`day`],t))return`symbol`;if(M$(n))return`gradient`}return`symbol`}function sIe({legendConfig:e,legendType:t,orient:n,legend:r}){return r.direction??e[t?`gradientDirection`:`symbolDirection`]??cIe(n,t)}function cIe(e,t){switch(e){case`top`:case`bottom`:return`horizontal`;case`left`:case`right`:case`none`:case void 0:return;default:return t===`gradient`?`horizontal`:void 0}}function lIe({legendConfig:e,model:t,direction:n,orient:r,scaleType:i}){let{gradientHorizontalMaxLength:a,gradientHorizontalMinLength:o,gradientVerticalMaxLength:s,gradientVerticalMinLength:c}=e;if(M$(i))return n===`horizontal`?r===`top`||r===`bottom`?uIe(t,`width`,o,a):o:uIe(t,`height`,c,s)}function uIe(e,t,n,r){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${r})`}}function dIe(e){if(UZ([`quantile`,`threshold`,`log`,`symlog`],e))return`greedy`}function fIe(e){let t=r2(e)?pIe(e):_Ie(e);return e.component.legends=t,t}function pIe(e){let{encoding:t}=e,n={};for(let r of[R2,...g3]){let i=x1(t[r]);!i||!e.getScaleComponent(r)||r===V2&&Q(i)&&i.type===M4||(n[r]=gIe(e,r))}return n}function mIe(e,t){let n=e.scaleName(t);if(e.mark===`trail`){if(t===`color`)return{stroke:n};if(t===`size`)return{strokeWidth:n}}return t===`color`?e.markDef.filled?{fill:n}:{stroke:n}:{[t]:n}}function hIe(e,t,n,r){switch(t){case`disable`:return n!==void 0;case`values`:return!!n?.values;case`title`:if(t===`title`&&e===r?.title)return!0}return e===(n||{})[t]}function gIe(e,t){let n=e.legend(t),{markDef:r,encoding:i,config:a}=e,o=a.legend,s=new dVe({},mIe(e,t));oFe(e,t,s);let c=n===void 0?o.disable:!n;if(s.set(`disable`,c,n!==void 0),c)return s;n||={};let l=e.getScaleComponent(t).get(`type`),u=x1(i[t]),d=Q(u)?y$(u.timeUnit)?.unit:void 0,f=n.orient||a.legend.orient||`right`,p=aIe({legend:n,channel:t,timeUnit:d,scaleType:l}),m=sIe({legend:n,legendType:p,orient:f,legendConfig:o}),h={legend:n,channel:t,model:e,markDef:r,encoding:i,fieldOrDatumDef:u,legendConfig:o,config:a,scaleType:l,orient:f,legendType:p,direction:m};for(let r of f6){if(p===`gradient`&&r.startsWith(`symbol`)||p===`symbol`&&r.startsWith(`gradient`))continue;let i=r in m6?m6[r](h):n[r];if(i!==void 0){let o=hIe(i,r,n,e.fieldDef(t));(o||a.legend[r]===void 0)&&s.set(r,i,o)}}let g=n?.encoding??{},_=s.get(`selections`),v={},y={fieldOrDatumDef:u,model:e,channel:t,legendCmpt:s,legendType:p};for(let t of[`labels`,`legend`,`title`,`symbols`,`gradient`,`entries`]){let n=JFe(g[t]??{},e),r=t in p6?p6[t](n,y):n;r!==void 0&&!QZ(r)&&(v[t]={..._?.length&&Q(u)?{name:`${tQ(u.field)}_legend_${t}`}:{},..._?.length?{interactive:!0}:{},update:_?.length?{...r,cursor:{value:`pointer`}}:r})}return QZ(v)||s.set(`encode`,v,!!n?.encoding),s}function _Ie(e){let{legends:t,resolve:n}=e.component;for(let r of e.children){fIe(r);for(let i of $(r.component.legends))n.legend[i]=H0(e.component.resolve,i),n.legend[i]===`shared`&&(t[i]=vIe(t[i],r.component.legends[i]),t[i]||(n.legend[i]=`independent`,delete t[i]))}for(let r of $(t))for(let t of e.children)t.component.legends[r]&&n.legend[r]===`shared`&&delete t.component.legends[r];return t}function vIe(e,t){if(!e)return t.clone();let n=e.getWithExplicit(`orient`),r=t.getWithExplicit(`orient`);if(n.explicit&&r.explicit&&n.value!==r.value)return;let i=!1;for(let n of f6){let r=i0(e.getWithExplicit(n),t.getWithExplicit(n),n,`legend`,(e,t)=>{switch(n){case`symbolType`:return yIe(e,t);case`title`:return Xke(e,t);case`type`:return i=!0,n0(`symbol`)}return r0(e,t,n,`legend`)});e.setWithExplicit(n,r)}return i&&(e.implicit?.encode?.gradient&&rQ(e.implicit,[`encode`,`gradient`]),e.explicit?.encode?.gradient&&rQ(e.explicit,[`encode`,`gradient`])),e}function yIe(e,t){return t.value===`circle`?t:e}function bIe(e,t,n,r){if(D1(t,n)){let i=r2(e)?e.axis(n)??e.legend(n)??{}:{},a=m1(t,{expr:`datum`}),o=m1(t,{expr:`datum`,binSuffix:`end`});return{formulaAs:m1(t,{binSuffix:`range`,forAs:!0}),formula:Y$(a,o,i.format,i.formatType,r)}}return{}}function xIe(e,t){return`${UQ(e)}_${t}`}function SIe(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}function W0(e,t,n){let r=xIe(w1(n,void 0)??{},t);return e.getName(`${r}_bins`)}function CIe(e){return`as`in e}function wIe(e,t,n){let r,i;r=CIe(e)?vg(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[m1(e,{forAs:!0}),m1(e,{binSuffix:`end`,forAs:!0})];let a={...w1(t,void 0)},o=xIe(a,e.field),{signal:s,extentSignal:c}=SIe(n,o);if(qQ(a.extent)){let e=a.extent;i=hFe(n,e.param,e),delete a.extent}return{key:o,binComponent:{bin:a,field:e.field,as:[r],...s?{signal:s}:{},...c?{extentSignal:c}:{},...i?{span:i}:{}}}}function TIe(e,t,n,r){let i=r2(r)?r.encoding[kQ(t)]:void 0;if(u1(n)&&r2(r)&&uMe(n,i,r.markDef,r.config)){e.add(m1(n,{})),e.add(m1(n,{suffix:`end`}));let{mark:i,markDef:a,config:o}=r,s=t1({fieldDef:n,markDef:a,config:o});I$(i)&&s!==.5&&NQ(t)&&(e.add(m1(n,{suffix:j3})),e.add(m1(n,{suffix:M3}))),n.bin&&D1(n,t)&&e.add(m1(n,{binSuffix:`range`}))}else if(CQ(t)){let n=SQ(t);e.add(r.getName(n))}else e.add(m1(n));return f1(n)&&Ije(n.scale?.range)&&e.add(n.scale.range.field),e}function EIe(e,t){for(let n of $(t)){let r=t[n];for(let t of $(r))n in e?e[n][t]=new Set([...e[n][t]??[],...r[t]]):e[n]={[t]:r[t]}}}function DIe(e){return e.startsWith(`'`)&&e.endsWith(`'`)||e.startsWith(`"`)&&e.endsWith(`"`)?e.slice(1,-1):e}function OIe(e,t){let n=aQ(e);return t===`number`?`toNumber(${n})`:t===`boolean`?`toBoolean(${n})`:t===`string`?`toString(${n})`:t===`date`?`toDate(${n})`:t===`flatten`?n:t.startsWith(`date:`)?`timeParse(${n},'${DIe(t.slice(5,t.length))}')`:t.startsWith(`utc:`)?`utcParse(${n},'${DIe(t.slice(4,t.length))}')`:(Z(dAe(t)),null)}function kIe(e){let t={};return IZ(e.filter,e=>{if(wje(e)){let n=null;b$(e)?n=e$(e.equal):S$(e)?n=e$(e.lte):x$(e)?n=e$(e.lt):C$(e)?n=e$(e.gt):w$(e)?n=e$(e.gte):T$(e)?n=e.range[0]:E$(e)&&(n=(e.oneOf??e.in)[0]),n&&(p$(n)?t[e.field]=`date`:gg(n)?t[e.field]=`number`:vg(n)&&(t[e.field]=`string`)),e.timeUnit&&(t[e.field]=`date`)}}),t}function AIe(e){let t={};function n(e){T1(e)?t[e.field]=`date`:e.type===`quantitative`&&Fke(e.aggregate)?t[e.field]=`number`:fQ(e.field)>1?e.field in t||(t[e.field]=`flatten`):f1(e)&&X$(e.sort)&&fQ(e.sort.field)>1&&(e.sort.field in t||(t[e.sort.field]=`flatten`))}if((r2(e)||i2(e))&&e.forEachFieldDef((t,r)=>{if(u1(t))n(t);else{let i=DQ(r),a=e.fieldDef(i);n({...t,type:a.type})}}),r2(e)){let{mark:n,markDef:r,encoding:i}=e;if(F$(n)&&!e.encoding.order){let e=i[r.orient===`horizontal`?`y`:`x`];Q(e)&&e.type===`quantitative`&&!(e.field in t)&&(t[e.field]=`number`)}}return t}function jIe(e){let t={};if(r2(e)&&e.component.selection)for(let n of $(e.component.selection)){let r=e.component.selection[n];for(let e of r.project.items)!e.channel&&fQ(e.field)>1&&(t[e.field]=`flatten`)}return t}function G0(e){return e instanceof S6||e instanceof b6||e instanceof x6}function K0(e){return`isValid(${e}) && isFinite(+${e})`}function MIe(e){return e.stack.stackBy.reduce((e,t)=>{let n=t.fieldDef,r=m1(n);return r&&e.push(r),e},[])}function NIe(e){return W(e)&&e.every(e=>vg(e))&&e.length>1}function PIe(e){function t(n){if(!(n instanceof _6)){let r=n.clone();if(r instanceof k3){let t=A6+r.getSource();r.setSource(t),e.model.component.data.outputNodes[t]=r}else(r instanceof g6||r instanceof O6||r instanceof k6||r instanceof E6)&&r.addDimensions(e.fields);for(let e of n.children.flatMap(t))e.parent=r;return[r]}return n.children.flatMap(t)}return t}function q0(e){if(e instanceof _6)if(e.numChildren()===1&&!(e.children[0]instanceof k3)){let t=e.children[0];(t instanceof g6||t instanceof O6||t instanceof k6||t instanceof E6)&&t.addDimensions(e.fields),t.swapWithParent(),q0(e)}else{let t=e.model.component.data.main;FIe(t);let n=PIe(e),r=e.children.map(n).flat();for(let e of r)e.parent=t}else e.children.map(q0)}function FIe(e){if(e instanceof k3&&e.type===D3.Main&&e.numChildren()===1){let t=e.children[0];t instanceof _6||(t.swapWithParent(),FIe(e))}}function J0(e){for(let t of e){for(let e of t.children)if(e.parent!==t)return!1;if(!J0(t.children))return!1}return!0}function Y0(e,t){let n=!1;for(let r of t)n=e.optimize(r)||n;return n}function IIe(e,t,n){let r=e.sources,i=!1;return i=Y0(new hVe,r)||i,i=Y0(new pVe(t),r)||i,r=r.filter(e=>e.numChildren()>0),i=Y0(new vVe,r)||i,r=r.filter(e=>e.numChildren()>0),n||(i=Y0(new gVe,r)||i,i=Y0(new xVe(t),r)||i,i=Y0(new mVe,r)||i,i=Y0(new _Ve,r)||i,i=Y0(new bVe,r)||i,i=Y0(new yVe,r)||i,i=Y0(new fVe,r)||i,i=Y0(new SVe,r)||i),e.sources=r,i}function LIe(e,t){J0(e.sources);let n=0,r=0;for(let r=0;r({signal:`{data: ${E1(e,{timeUnit:n,type:t})}}`}))}function X0(e,t,n){let r=y$(n)?.unit;return t===`temporal`||r?UIe(e,t,r):[e]}function Z0(e,t,n,r){let{encoding:i,markDef:a,mark:o,config:s,stack:c}=n,l=x1(i[r]),{type:u}=l,d=l.timeUnit,f=CPe({invalid:i$(`invalid`,a,s),isPath:F$(o)});if(Fje(t)){let i=Z0(e,void 0,n,r);return t0([...X0(t.unionWith,u,d),...i.value])}else if(ZQ(t))return t0([t]);else if(t&&t!==`unaggregated`&&!Pje(t))return t0(X0(t,u,d));if(c&&r===c.fieldChannel){if(c.offset===`normalize`)return n0([[0,1]]);let e=n.requestDataName(f);return n0([{data:e,field:n.vgField(r,{suffix:`start`})},{data:e,field:n.vgField(r,{suffix:`end`})}])}let p=LQ(r)&&Q(l)?GIe(n,r,e):void 0;if(o1(l))return n0(X0([l.datum],u,d));let m=l;if(t===`unaggregated`){let{field:e}=l;return n0([{data:n.requestDataName(f),field:m1({field:e,aggregate:`min`})},{data:n.requestDataName(f),field:m1({field:e,aggregate:`max`})}])}else if(WQ(m.bin)){if(A$(e))return n0(e===`bin-ordinal`?[]:[{data:$Z(p)?n.requestDataName(f):n.requestDataName(D3.Raw),field:n.vgField(r,D1(m,r)?{binSuffix:`range`}:{}),sort:p===!0||!jh(p)?{field:n.vgField(r,{}),op:`min`}:p}]);{let{bin:e}=m;if(WQ(e)){let t=W0(n,m.field,e);return n0([new M6(()=>{let e=n.getSignalName(t);return`[${e}.start, ${e}.stop]`})])}else return n0([{data:n.requestDataName(f),field:n.vgField(r,{})}])}}else if(m.timeUnit&&UZ([`time`,`utc`],e)){let e=i[kQ(r)];if(uMe(m,e,a,s)){let t=n.requestDataName(f),i=t1({fieldDef:m,fieldDef2:e,markDef:a,config:s}),c=I$(o)&&i!==.5&&NQ(r);return n0([{data:t,field:n.vgField(r,c?{suffix:j3}:{})},{data:t,field:n.vgField(r,{suffix:c?M3:`end`})}])}}return n0(p?[{data:$Z(p)?n.requestDataName(f):n.requestDataName(D3.Raw),field:n.vgField(r),sort:p}]:[{data:n.requestDataName(f),field:n.vgField(r)}])}function Q0(e,t){let{op:n,field:r,order:i}=e;return{op:n??(t?`sum`:e3),...r?{field:lQ(r)}:{},...i?{order:i}:{}}}function WIe(e,t){let n=e.component.scales[t],r=e.specifiedScales[t].domain,i=e.fieldDef(t)?.bin,a=Pje(r)?r:void 0,o=KQ(i)&&qQ(i.extent)?i.extent:void 0;(a||o)&&n.set(`selectionExtent`,a??o,!0)}function GIe(e,t,n){if(!A$(n))return;let r=e.fieldDef(t),i=r.sort;if(aMe(i))return{op:`min`,field:F0(r,t),order:`ascending`};let{stack:a}=e,o=a?new Set([...a.groupbyFields,...a.stackBy.map(e=>e.fieldDef.field)]):void 0;if(X$(i))return Q0(i,a&&!o.has(i.field));if(iMe(i)){let{encoding:t,order:n}=i,r=e.fieldDef(t),{aggregate:s,field:c}=r,l=a&&!o.has(c);if(zQ(s)||BQ(s))return Q0({field:m1(r),order:n},l);if(VQ(s)||!s)return Q0({op:s,field:c,order:n},l)}else if(i===`descending`)return{op:`min`,field:e.vgField(t),order:`descending`};else if(UZ([`ascending`,void 0],i))return!0}function KIe(e,t){let{aggregate:n,type:r}=e;return n?vg(n)&&!wze.has(n)?{valid:!1,reason:NAe(n)}:r===`quantitative`&&t===`log`?{valid:!1,reason:PAe(e)}:{valid:!0}:{valid:!1,reason:MAe(e)}}function $0(e,t,n,r){return e.explicit&&t.explicit&&Z(VAe(n,r,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function qIe(e){let t=qZ(e.map(e=>{if($Q(e)){let{sort:t,...n}=e;return n}return e}),VZ),n=qZ(e.map(e=>{if($Q(e)){let t=e.sort;return t!==void 0&&!$Z(t)&&(`op`in t&&t.op===`count`&&delete t.field,t.order===`ascending`&&delete t.order),t}}).filter(e=>e!==void 0),VZ);if(t.length===0)return;if(t.length===1){let t=e[0];if($Q(t)&&n.length>0){let e=n[0];if(n.length>1){Z(b4);let t=n.filter(e=>jh(e)&&`op`in e&&e.op!==`min`);e=n.every(e=>jh(e)&&`op`in e)&&t.length===1?t[0]:!0}else if(jh(e)&&`field`in e){let n=e.field;t.field===n&&(e=!e.order||{order:e.order})}return{...t,sort:e}}return t}let r=qZ(n.map(e=>$Z(e)||!(`op`in e)||vg(e.op)&&cg(xze,e.op)?e:(Z(UAe(e)),!0)),VZ),i;r.length===1?i=r[0]:r.length>1&&(Z(b4),i=!0);let a=qZ(e.map(e=>$Q(e)?e.data:null),e=>e);return a.length===1&&a[0]!==null?{data:a[0],fields:t.map(e=>e.field),...i?{sort:i}:{}}:{fields:t,...i?{sort:i}:{}}}function e2(e){if($Q(e)&&vg(e.field))return e.field;if(Rke(e)){let t;for(let n of e.fields)if($Q(n)&&vg(n.field)){if(!t)t=n.field;else if(t!==n.field)return Z(Bze),t}return Z(Vze),t}else if(zke(e)){Z(Hze);let t=e.fields[0];return vg(t)?t:void 0}}function t2(e,t){return qIe(e.component.scales[t].get(`domains`).map(t=>($Q(t)&&(t.data=e.lookupDataSource(t.data)),t)))}function JIe(e,t,n,r){e.encode??={},e.encode[t]??={},e.encode[t].update??={},e.encode[t].update[n]=r}function YIe(e,t){if(r2(e)){let n=e.fieldDef(t);if(n?.field)return n.field}let n=(e.children??[]).map(e=>YIe(e,t)).filter(e=>!!e);if(n.length>0){let e=qZ(n,VZ);return e.length===1?e[0]:void 0}}function XIe(e,t,n){if(t===n)return!0;let r=e.getScaleType(t),i=e.getScaleType(n);return!r||!i?!1:A$(r)===A$(i)}function ZIe(e,t){return e?`field:${e}`:`channel:${String(t)}`}function QIe(e){if(W(e)){let t=e.filter(eQ);return t.length>0?t:null}if(Rke(e)){let t=[];if(t.push(...e.fields.flatMap(e=>W(e)?e.filter(eQ):[])),t.length>0)return qZ(t,VZ)}return null}function n2(e,t){try{return QIe(t2(e,t))}catch{return null}}function $Ie(e,t,n){let r=n2(e,t),i=n2(e,n);return r&&i?qZ([...r,...i],VZ):null}function eLe(e,t,n){t&&t.length>0&&(e.getWithExplicit(`values`)?.explicit||(n&&Z(n),e.set(`values`,t,!1)))}function tLe(e,t,n){let r=e.getScaleComponent(t),i=e.getScaleComponent(n);if(!r||!i)return!1;let a=r.getWithExplicit(`domains`),o=i.getWithExplicit(`domains`);if(!(a?.explicit&&o?.explicit))return!1;let s=t2(e,t),c=t2(e,n);return VZ(s)===VZ(c)}function nLe(e){let t=e.component.legends,n={};for(let r of $(t)){let i=ZIe(YIe(e,r),r);if(!n[i]){n[i]=[{channel:r,cmpt:t[r].clone()}];continue}let a=!1;for(let o of n[i])if(XIe(e,o.channel,r)&&vIe(o.cmpt,t[r])){let t=e.getScaleType(o.channel),n=e.getScaleType(r);t&&n&&A$(t)&&A$(n)&&(tLe(e,o.channel,r)?eLe(o.cmpt,n2(e,o.channel)):eLe(o.cmpt,$Ie(e,o.channel,r),WAe(o.channel,r))),a=!0;break}a||n[i].push({channel:r,cmpt:t[r].clone()})}return g2(n).flat().map(t=>rLe(t.cmpt,e.config)).filter(e=>e!==void 0)}function rLe(e,t){let{disable:n,labelExpr:r,selections:i,...a}=e.combine();if(!n){if(t.aria===!1&&a.aria==null&&(a.aria=!1),a.encode?.symbols){let e=a.encode.symbols.update;e.fill&&e.fill.value!==`transparent`&&!e.stroke&&!a.stroke&&(e.stroke={value:`transparent`});for(let t of g3)a[t]&&delete e[t]}if(a.title||delete a.title,r!==void 0){let e=r;a.encode?.labels?.update&&ZQ(a.encode.labels.update.text)&&(e=uQ(r,`datum.label`,a.encode.labels.update.text.signal)),JIe(a,`labels`,`text`,{signal:e})}return a}}function iLe(e){return o2(e)||a2(e)?aLe(e):oLe(e)}function aLe(e){return e.children.reduce((e,t)=>e.concat(t.assembleProjections()),oLe(e))}function oLe(e){let t=e.component.projection;if(!t||t.merged)return[];let n=t.combine(),{name:r}=n;if(t.data){let i={signal:`[${t.size.map(e=>e.signal).join(`, `)}]`},a=t.data.reduce((t,n)=>{let r=ZQ(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return UZ(t,r)||t.push(r),t},[]);if(a.length<=0)throw Error(`Projection's fit didn't find any data sources`);return[{name:r,size:i,fit:{signal:a.length>1?`[${a.join(`, `)}]`:a[0]},...n}]}else return[{name:r,translate:{signal:`[width / 2, height / 2]`},...n}]}function sLe(e){e.component.projection=r2(e)?cLe(e):dLe(e)}function cLe(e){if(e.hasProjection){let t=YQ(e.specifiedProjection),n=!(t&&(t.scale!=null||t.translate!=null)),r=n?[e.getSizeSignalRef(`width`),e.getSizeSignalRef(`height`)]:void 0,i=n?lLe(e):void 0,a=new N6(e.projectionName(!0),{...YQ(e.config.projection),...t},r,i);return a.get(`type`)||a.set(`type`,`equalEarth`,!1),a}}function lLe(e){let t=[],{encoding:n}=e;for(let r of[[P2,N2],[I2,F2]])(x1(n[r[0]])||x1(n[r[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});return e.channelHasField(V2)&&e.typedFieldDef(V2).type===M4&&t.push({signal:e.getName(`geojson_${t.length}`)}),t.length===0&&t.push(e.requestDataName(D3.Main)),t}function uLe(e,t){let n=GZ(CVe,n=>!!(!cg(e.explicit,n)&&!cg(t.explicit,n)||cg(e.explicit,n)&&cg(t.explicit,n)&&yQ(e.get(n),t.get(n))));if(yQ(e.size,t.size)){if(n)return e;if(yQ(e.explicit,{}))return t;if(yQ(t.explicit,{}))return e}return null}function dLe(e){if(e.children.length===0)return;let t;for(let t of e.children)sLe(t);let n=GZ(e.children,e=>{let n=e.component.projection;if(!n)return!0;if(t){let e=uLe(t,n);return e&&(t=e),!!e}else return t=n,!0});if(t&&n){let n=e.projectionName(!0),r=new N6(n,t.specifiedProjection,t.size,h2(t.data));for(let t of e.children){let e=t.component.projection;e&&(e.isFit&&r.data.push(...t.component.projection.data),t.renameProjection(e.get(`name`),n),e.merged=!0)}return r}}function fLe(e){return o2(e)||a2(e)?e.children.reduce((e,t)=>e.concat(fLe(t)),pLe(e)):pLe(e)}function pLe(e){return $(e.component.scales).reduce((t,n)=>{let r=e.component.scales[n];if(r.merged)return t;let i=r.combine(),{name:a,type:o,selectionExtent:s,domains:c,range:l,reverse:u,...d}=i,f=mLe(i.range,a,n,e),p=t2(e,n),m=s?FPe(e,s,r,p):null;return t.push({name:a,type:o,...p?{domain:p}:{},...m?{domainRaw:m}:{},range:f,...u===void 0?{}:{reverse:u},...d}),t},[])}function mLe(e,t,n,r){if(NQ(n)){if(QQ(e))return{step:{signal:`${t}_step`}}}else if(jh(e)&&$Q(e))return{...e,data:r.lookupDataSource(e.data)};return e}function hLe(e){let t=e.component.scales;for(let n of g4){let r=t[n];if(!r)continue;let i=_Le(n,e);r.setWithExplicit(`range`,i)}}function gLe(e,t){let n=e.fieldDef(t);if(n?.bin){let{bin:r,field:i}=n,a=AQ(t),o=e.getName(a);if(jh(r)&&r.binned&&r.step!==void 0)return new M6(()=>{let n=e.scaleName(t),i=`(domain("${n}")[1] - domain("${n}")[0]) / ${r.step}`;return`${e.getSignalName(o)} / (${i})`});if(WQ(r)){let t=W0(e,i,r);return new M6(()=>{let n=e.getSignalName(t),r=`(${n}.stop - ${n}.start) / ${n}.step`;return`${e.getSignalName(o)} / (${r})`})}}}function _Le(e,t){let n=t.specifiedScales[e],{size:r}=t,i=t.getScaleComponent(e).get(`type`);for(let r of wVe)if(n[r]!==void 0){let a=P$(i,r),o=Lje(e,r);if(!a)Z(RAe(i,r,e));else if(o)Z(o);else switch(r){case`range`:{let r=n.range;if(W(r)){if(NQ(e))return t0(r.map(e=>{if(e===`width`||e===`height`){let n=t.getName(e),r=t.getSignalName.bind(t);return M6.fromName(r,n)}return e}))}else if(jh(r))return t0({data:t.requestDataName(D3.Main),field:r.field,sort:{op:`min`,field:t.vgField(e)}});return t0(r)}case`scheme`:return t0(vLe(n[r]))}}let a=e===C2||e===`xOffset`?`width`:`height`,o=r[a];if(W1(o)){if(NQ(e))if(A$(i)){let n=xLe(o,t,e);if(n)return t0({step:n})}else Z(zAe(a));else if(FQ(e)){let n=e===D2?`x`:`y`;if(t.getScaleComponent(n).get(`type`)===`band`){let e=SLe(o,i);if(e)return t0(e)}}}let{rangeMin:s,rangeMax:c}=n,l=bLe(e,t);return(s!==void 0||c!==void 0)&&P$(i,`rangeMin`)&&W(l)&&l.length===2?t0([s??l[0],c??l[1]]):n0(l)}function vLe(e){return Nje(e)?{scheme:e.name,...BZ(e,[`name`])}:{scheme:e}}function yLe(e,t,n,{center:r}={}){let i=AQ(e),a=t.getName(i),o=t.getSignalName.bind(t);return e===w2&&j$(n)?r?[M6.fromName(e=>`${o(e)}/2`,a),M6.fromName(e=>`-${o(e)}/2`,a)]:[M6.fromName(o,a),0]:r?[M6.fromName(e=>`-${o(e)}/2`,a),M6.fromName(e=>`${o(e)}/2`,a)]:[0,M6.fromName(o,a)]}function bLe(e,t){let{size:n,config:r,mark:i,encoding:a}=t,{type:o}=x1(a[e]),s=t.getScaleComponent(e).get(`type`),{domain:c,domainMid:l}=t.specifiedScales[e];switch(e){case C2:case w2:if(UZ([`point`,`band`],s)){let i=wLe(e,n,r.view);if(W1(i))return{step:xLe(i,t,e)}}return yLe(e,t,s);case D2:case O2:return CLe(e,t,s);case H2:{let a=DLe(i,r),o=OLe(i,n,t,r);return N$(s)?ELe(a,o,TLe(s,r,c,e)):[a,o]}case j2:return[0,Math.PI*2];case U2:return[0,360];case k2:return[0,new M6(()=>`min(${t.getSignalName(i2(t.parent)?`child_width`:`width`)},${t.getSignalName(i2(t.parent)?`child_height`:`height`)})/2`)];case L2:return{step:1e3/r.scale.framesPerSecond};case q2:return[r.scale.minStrokeWidth,r.scale.maxStrokeWidth];case J2:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case V2:return`symbol`;case R2:case z2:case B2:return s===`ordinal`?o===`nominal`?`category`:`ordinal`:l===void 0?i===`rect`||i===`geoshape`?`heatmap`:`ramp`:`diverging`;case W2:case G2:case K2:return[r.scale.minOpacity,r.scale.maxOpacity]}}function xLe(e,t,n){let{encoding:r}=t,i=t.getScaleComponent(n),a=MQ(n),o=r[a];if(oNe({step:e,offsetIsDiscrete:l1(o)&&k$(o.type)})===`offset`&&jMe(r,a)){let n=t.getScaleComponent(a),r=`domain('${t.scaleName(a)}').length`;if(n.get(`type`)===`band`){let e=n.get(`paddingInner`)??n.get(`padding`)??0,t=n.get(`paddingOuter`)??n.get(`padding`)??0;r=`bandspace(${r}, ${e}, ${t})`}let o=i.get(`paddingInner`)??i.get(`padding`);return{signal:`${e.step} * ${r} / (1-${Hke(o)})`}}else return e.step}function SLe(e,t){if(oNe({step:e,offsetIsDiscrete:A$(t)})===`offset`)return{step:e.step}}function CLe(e,t,n){let r=e===D2?`x`:`y`,i=t.getScaleComponent(r);if(!i)return yLe(r,t,n,{center:!0});let a=i.get(`type`),o=t.scaleName(r),{markDef:s,config:c}=t;if(a===`band`){let e=wLe(r,t.size,t.config.view);if(W1(e)){let t=SLe(e,n);if(t)return t}return[0,{signal:`bandwidth('${o}')`}]}else{let n=t.encoding[r];if(Q(n)&&n.timeUnit){let e=yje(n.timeUnit,e=>`scale('${o}', ${e})`),r=t.config.scale.bandWithNestedOffsetPaddingInner,i=t1({fieldDef:n,markDef:s,config:c})-.5,a=i===0?``:` + ${i}`;if(r){let t=ZQ(r)?`${r.signal}/2${a}`:`${r/2+i}`,n=ZQ(r)?`(1 - ${r.signal}/2)${a}`:`${1-r/2+i}`;return[{signal:`${t} * (${e})`},{signal:`${n} * (${e})`}]}return[0,{signal:e}]}return RZ(`Cannot use ${e} scale if ${r} scale is not discrete.`)}}function wLe(e,t,n){let r=e===C2?`width`:`height`,i=t[r];return i===void 0?q1(n,r):i}function TLe(e,t,n,r){switch(e){case`quantile`:return t.scale.quantileCount;case`quantize`:return t.scale.quantizeCount;case`threshold`:return n!==void 0&&W(n)?n.length+1:(Z(tje(r)),3)}}function ELe(e,t,n){let r=()=>{let r=n$(t),i=n$(e),a=`(${r} - ${i}) / (${n} - 1)`;return`sequence(${i}, ${r} + ${a}, ${a})`};return ZQ(t)?new M6(r):{signal:r()}}function DLe(e,t){switch(e){case`bar`:case`tick`:return t.scale.minBandSize;case`line`:case`trail`:case`rule`:return t.scale.minStrokeWidth;case`text`:return t.scale.minFontSize;case`point`:case`square`:case`circle`:return t.scale.minSize}throw Error(l$(`size`,e))}function OLe(e,t,n,r){let i={x:gLe(n,`x`),y:gLe(n,`y`)};switch(e){case`bar`:case`tick`:{if(r.scale.maxBandSize!==void 0)return r.scale.maxBandSize;let e=kLe(t,i,r.view);return gg(e)?e-1:new M6(()=>`${e.signal} - 1`)}case`line`:case`trail`:case`rule`:return r.scale.maxStrokeWidth;case`text`:return r.scale.maxFontSize;case`point`:case`square`:case`circle`:{if(r.scale.maxSize)return r.scale.maxSize;let e=kLe(t,i,r.view);return gg(e)?(F6*e)**2:new M6(()=>`pow(${F6} * ${e.signal}, 2)`)}}throw Error(l$(`size`,e))}function kLe(e,t,n){let r=W1(e.width)?e.width.step:K1(n,`width`),i=W1(e.height)?e.height.step:K1(n,`height`);return t.x||t.y?new M6(()=>`min(${[t.x?t.x.signal:r,t.y?t.y.signal:i].join(`, `)})`):Math.min(r,i)}function ALe(e,t){r2(e)?jLe(e,t):NLe(e,t)}function jLe(e,t){let n=e.component.scales,{config:r,encoding:i,markDef:a,specifiedScales:o}=e;for(let s of $(n)){let c=o[s],l=n[s],u=e.getScaleComponent(s),d=x1(i[s]),f=c[t],p=u.get(`type`),m=u.get(`padding`),h=u.get(`paddingInner`),g=P$(p,t),_=Lje(s,t);if(f!==void 0&&(g?_&&Z(_):Z(RAe(p,t,s))),g&&_===void 0)if(f!==void 0){let e=d.timeUnit,n=d.type;switch(t){case`domainMax`:case`domainMin`:p$(c[t])||n===`temporal`||e?l.set(t,{signal:E1(c[t],{type:n,timeUnit:e})},!0):l.set(t,c[t],!0);break;default:l.copyKeyFromObject(t,c)}}else{let n=X(I6,t)?I6[t]({model:e,channel:s,fieldOrDatumDef:d,scaleType:p,scalePadding:m,scalePaddingInner:h,domain:c.domain,domainMin:c.domainMin,domainMax:c.domainMax,markDef:a,config:r,hasNestedOffsetScale:MMe(i,s),hasSecondaryRangeChannel:!!i[kQ(s)]}):r.scale[t];n!==void 0&&l.set(t,n,!1)}}}function MLe(e){r2(e)?hLe(e):NLe(e,`range`)}function NLe(e,t){let n=e.component.scales;for(let n of e.children)t===`range`?MLe(n):ALe(n,t);for(let r of $(n)){let i;for(let n of e.children){let e=n.component.scales[r];if(e){let n=e.getWithExplicit(t);i=i0(i,n,t,`scale`,vPe((e,n)=>{switch(t){case`range`:return e.step&&n.step?e.step-n.step:0}return 0}))}}n[r].setWithExplicit(t,i)}}function PLe(e,t){let n=t.bin;if(WQ(n)){let r=W0(e,t.field,n);return new M6(()=>e.getSignalName(r))}else if(GQ(n)&&KQ(n)&&n.step!==void 0)return{step:n.step}}function FLe(e,t){if(UZ([R2,z2,B2],e)&&t!==`nominal`)return`hcl`}function ILe(e,t,n,r,i,a){if(!(b1(a)?.bin||W(n)||i!=null||r!=null||UZ([N4.TIME,N4.UTC],e)))return NQ(t)?!0:void 0}function LLe(e,t,n,r,i,a){if(NQ(e)){if(M$(t)){if(n.continuousPadding!==void 0)return n.continuousPadding;let{type:t,orient:o}=i;if(t===`bar`&&!(Q(r)&&(r.bin||r.timeUnit))&&(o===`vertical`&&e===`x`||o===`horizontal`&&e===`y`))return a.continuousBandSize}if(t===N4.POINT)return n.pointPadding}}function RLe(e,t,n,r,i,a=!1){if(e===void 0){if(NQ(t)){let{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:r,tickBandPaddingInner:o,bandWithNestedOffsetPaddingInner:s}=i;return a?s:pQ(e,n===`bar`?t:n===`tick`?o:r)}else if(FQ(t)&&r===N4.BAND)return i.offsetBandPaddingInner}}function zLe(e,t,n,r,i,a=!1){if(e===void 0){if(NQ(t)){let{bandPaddingOuter:e,bandWithNestedOffsetPaddingOuter:t}=i;if(a)return t;if(n===N4.BAND)return pQ(e,ZQ(r)?{signal:`${r.signal}/2`}:r/2)}else if(FQ(t)){if(n===N4.POINT)return .5;if(n===N4.BAND)return i.offsetBandPaddingOuter}}}function BLe(e,t,n,r){if(n===`x`&&r.xReverse!==void 0)return j$(e)&&t===`descending`?ZQ(r.xReverse)?{signal:`!${r.xReverse.signal}`}:!r.xReverse:r.xReverse;if(j$(e)&&t===`descending`)return!0}function VLe(e,t,n,r,i,a,o){if(n&&n!==`unaggregated`&&j$(i)){if(W(n)){let e=n[0],t=n[n.length-1];if(gg(e)&&e<=0&&gg(t)&&t>=0)return!0}return!1}if(e===`size`&&t.type===`quantitative`&&!N$(i))return!0;if(!(Q(t)&&t.bin)&&UZ([...d4,...sze],e)){let{orient:t,type:n}=r;return UZ([`bar`,`area`,`line`,`trail`],n)&&(t===`horizontal`&&e===`y`||t===`vertical`&&e===`x`)?!1:UZ([`bar`,`area`],n)&&!o?!0:a?.zero}return!1}function HLe(e,t,n,r,i=!1){let a=ULe(t,n,r,i),{type:o}=e;return LQ(t)?o===void 0?a:zje(t,o)?Q(n)&&!Rje(o,n.type)?(Z(LAe(o,a)),a):o:(Z(IAe(t,o,a)),a):null}function ULe(e,t,n,r){switch(t.type){case`nominal`:case`ordinal`:{if(wQ(e)||RQ(e)===`discrete`)return e===`shape`&&t.type===`ordinal`&&Z(u$(e,`ordinal`)),`ordinal`;if(IQ(e))return`band`;if(NQ(e)||FQ(e)){if(UZ([`rect`,`bar`,`image`,`rule`,`tick`],n.type)||r)return`band`}else if(n.type===`arc`&&e in f4)return`band`;let i=n[AQ(e)];return R$(i)||p1(t)&&t.axis?.tickBand?`band`:`point`}case`temporal`:return wQ(e)?`time`:RQ(e)===`discrete`?(Z(u$(e,`temporal`)),`ordinal`):Q(t)&&t.timeUnit&&y$(t.timeUnit).utc?`utc`:IQ(e)?`band`:`time`;case`quantitative`:return wQ(e)?Q(t)&&WQ(t.bin)?`bin-ordinal`:`linear`:RQ(e)===`discrete`?(Z(u$(e,`quantitative`)),`ordinal`):IQ(e)?`band`:`linear`;case`geojson`:return}throw Error(vAe(t.type))}function WLe(e,{ignoreRange:t}={}){GLe(e),RIe(e);for(let t of iBe)ALe(e,t);t||MLe(e)}function GLe(e){r2(e)?e.component.scales=KLe(e):e.component.scales=qLe(e)}function KLe(e){let{encoding:t,mark:n,markDef:r}=e,i={};for(let a of g4){let o=x1(t[a]);if(o&&n===Y4&&a===V2&&o.type===M4)continue;let s=o&&o.scale;if(o&&s!==null&&s!==!1){s??={};let n=MMe(t,a),c=HLe(s,a,o,r,n);i[a]=new P6(e.scaleName(`${a}`,!0),{value:c,explicit:s.type===c})}}return i}function qLe(e){let t=e.component.scales={},n={},r=e.component.resolve;for(let t of e.children){GLe(t);for(let i of $(t.component.scales))if(r.scale[i]??=YFe(i,e),r.scale[i]===`shared`){let e=n[i],a=t.component.scales[i].getWithExplicit(`type`);e?Aje(e.value,a.value)?n[i]=i0(e,a,`type`,`scale`,TVe):(r.scale[i]=`independent`,delete n[i]):n[i]=a}}for(let r of $(n)){let i=e.scaleName(r,!0),a=n[r];t[r]=new P6(i,a);for(let t of e.children){let e=t.component.scales[r];e&&(t.renameScale(e.get(`name`),i),e.merged=!0)}}return t}function r2(e){return e?.type===`unit`}function i2(e){return e?.type===`facet`}function a2(e){return e?.type===`concat`}function o2(e){return e?.type===`layer`}function JLe(e){let t=0;function n(r,i){if(r instanceof S6&&!r.isGenerator&&!a0(r.data)&&(e.push(i),i={name:null,source:i.name,transform:[]}),r instanceof v6&&(r.parent instanceof S6&&!i.source?(i.format={...i.format,parse:r.assembleFormatParse()},i.transform.push(...r.assembleTransforms(!0))):i.transform.push(...r.assembleTransforms())),r instanceof _6){i.name||=`data_${t++}`,!i.source||i.transform.length>0?(e.push(i),r.data=i.name):r.data=i.source,e.push(...r.assemble());return}switch((r instanceof b6||r instanceof x6||r instanceof D6||r instanceof s6||r instanceof l6||r instanceof G6||r instanceof g6||r instanceof J6||r instanceof k6||r instanceof E6||r instanceof U6||r instanceof H6||r instanceof B6||r instanceof q6||r instanceof Y6||r instanceof X6||r instanceof y6||r instanceof Q6||r instanceof Z6||r instanceof V6)&&i.transform.push(r.assemble()),(r instanceof h6||r instanceof A3||r instanceof K6||r instanceof O6||r instanceof W6)&&i.transform.push(...r.assemble()),r instanceof k3&&(i.source&&i.transform.length===0?r.setSource(i.source):r.parent instanceof k3?r.setSource(i.name):(i.name||=`data_${t++}`,r.setSource(i.name),r.numChildren()===1&&(e.push(i),i={name:null,source:i.name,transform:[]}))),r.numChildren()){case 0:r instanceof k3&&(!i.source||i.transform.length>0)&&e.push(i);break;case 1:n(r.children[0],i);break;default:{i.name||=`data_${t++}`;let a=i.name;!i.source||i.transform.length>0?e.push(i):a=i.source;for(let e of r.children)n(e,{name:null,source:a,transform:[]});break}}}return n}function YLe(e){let t=[],n=JLe(t);for(let t of e.children)n(t,{source:e.name,name:null,transform:[]});return t}function XLe(e,t){let n=[],r=JLe(n),i=0;for(let t of e.sources)t.hasName()||(t.dataName=`source_${i++}`),r(t,t.assemble());for(let e of n)e.transform.length===0&&delete e.transform;let a=0;for(let[e,t]of n.entries())(t.transform??[]).length===0&&!t.source&&n.splice(a++,0,n.splice(e,1)[0]);for(let t of n)for(let n of t.transform??[])n.type===`lookup`&&(n.from=e.outputNodes[n.from].getSource());for(let e of n)e.name in t&&(e.values=t[e.name]);return n}function ZLe(e){return e===`top`||e===`left`||ZQ(e)?`header`:`footer`}function QLe(e){for(let t of s4)$Le(e,t);tRe(e,`x`),tRe(e,`y`)}function $Le(e,t){let{facet:n,config:r,child:i,component:a}=e;if(e.channelHasField(t)){let o=n[t],s=L0(`title`,null,r,t),c=g1(o,r,{allowDisabling:!0,includeDefault:s===void 0||!!s});i.component.layoutHeaders[t].title&&(c=W(c)?c.join(`, `):c,c+=` / ${i.component.layoutHeaders[t].title}`,i.component.layoutHeaders[t].title=null);let l=L0(`labelOrient`,o.header,r,t),u=o.header!==null&&pQ(o.header?.labels,r.header.labels,!0),d=UZ([`bottom`,`right`],l)?`footer`:`header`;a.layoutHeaders[t]={title:o.header===null?null:c,facetFieldDef:o,[d]:t===`facet`?[]:[eRe(e,t,u)]}}}function eRe(e,t,n){let r=t===`row`?`height`:`width`;return{labels:n,sizeSignal:e.child.component.layoutSize.get(r)?e.child.getSizeSignalRef(r):void 0,axes:[]}}function tRe(e,t){let{child:n}=e;if(n.component.axes[t]){let{layoutHeaders:r,resolve:i}=e.component;if(i.axis[t]=H0(i,t),i.axis[t]===`shared`){let i=t===`x`?`column`:`row`,a=r[i];for(let r of n.component.axes[t]){let t=ZLe(r.get(`orient`));a[t]??=[eRe(e,i,!1)];let n=M0(r,`main`,e.config,{header:!0});n&&a[t][0].axes.push(n),r.mainExtracted=!0}}}}function nRe(e){s2(e),c2(e,`width`),c2(e,`height`)}function rRe(e){s2(e);let t=e.layout.columns===1?`width`:`childWidth`,n=e.layout.columns===void 0?`height`:`childHeight`;c2(e,t),c2(e,n)}function s2(e){for(let t of e.children)t.parseLayoutSize()}function c2(e,t){let n=qFe(t),r=PQ(n),i=e.component.resolve,a=e.component.layoutSize,o;for(let t of e.children){let a=t.component.layoutSize.getWithExplicit(n),s=i.scale[r]??YFe(r,e);if(s===`independent`&&a.value===`step`){o=void 0;break}if(o){if(s===`independent`&&o.value!==a.value){o=void 0;break}o=i0(o,a,n,``)}else o=a}if(o){for(let r of e.children)e.renameSignal(r.getName(n),e.getName(t)),r.component.layoutSize.set(n,`merged`,!1);a.setWithExplicit(t,o)}else a.setWithExplicit(t,{explicit:!1,value:void 0})}function iRe(e){let{size:t,component:n}=e;for(let r of d4){let i=AQ(r);if(t[i]!=null&&t[i]!=null){let e=t[i];n.layoutSize.set(i,W1(e)?`step`:e,!0)}else{let t=aRe(e,i);n.layoutSize.set(i,t,!1)}}}function aRe(e,t){let n=t===`width`?`x`:`y`,r=e.config,i=e.getScaleComponent(n);if(i){let e=i.get(`type`),n=i.get(`range`);if(A$(e)){let e=q1(r.view,t);return QQ(n)||W1(e)?`step`:e}else return G1(r.view,t)}else if(e.hasProjection||e.mark===`arc`)return G1(r.view,t);else{let e=q1(r.view,t);return W1(e)?e.step:e}}function l2(e,t,n){return m1(t,{suffix:`by_${m1(e)}`,...n})}function oRe(e,t){let{row:n,column:r}=t;if(n&&r){let t=null;for(let i of[n,r])if(X$(i.sort)){let{field:n,op:r=e3}=i.sort;e=t=new E6(e,{joinaggregate:[{op:r,field:n,as:l2(i,i.sort,{forAs:!0})}],groupby:[m1(i)]})}return t}return null}function sRe(e,t){for(let n of t){let t=n.data;if(e.name&&n.hasName()&&e.name!==n.dataName)continue;let r=e.format?.mesh,i=t.format?.feature;if(r&&i)continue;let a=e.format?.feature;if((a||i)&&a!==i)continue;let o=t.format?.mesh;if(!((r||o)&&r!==o)){if(o0(e)&&o0(t)){if(yQ(e.values,t.values))return n}else if(a0(e)&&a0(t)){if(e.url===t.url)return n}else if(yPe(e)&&e.name===n.dataName)return n}}return null}function cRe(e,t){if(e.data||!e.parent){if(e.data===null){let e=new S6({values:[]});return t.push(e),e}let n=sRe(e.data,t);if(n)return s0(e.data)||(n.data.format=KZ({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{let n=new S6(e.data);return t.push(n),n}}else return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}function lRe(e,t,n){let r=0;for(let i of t.transforms){let a,o;if(QNe(i))o=e=new l6(e,i),a=`derived`;else if($1(i)){let r=kIe(i);o=e=v6.makeWithAncestors(e,{},r,n)??e,e=new s6(e,t,i.filter)}else if($Ne(i))o=e=h6.makeFromTransform(e,i,t),a=`number`;else if(tPe(i))a=`date`,n.getWithExplicit(i.field).value===void 0&&(e=new v6(e,{[i.field]:a}),n.set(i.field,a,!1)),o=e=A3.makeFromTransform(e,i);else if(nPe(i))o=e=g6.makeFromTransform(e,i),a=`number`,D0(t)&&(e=new y6(e));else if(BNe(i))o=e=J6.make(e,t,i,r++),a=`derived`;else if(YNe(i))o=e=new k6(e,i),a=`number`;else if(XNe(i))o=e=new E6(e,i),a=`number`;else if(rPe(i))o=e=O6.makeFromTransform(e,i),a=`derived`;else if(iPe(i))o=e=new U6(e,i),a=`derived`;else if(aPe(i))o=e=new V6(e,i),a=`derived`;else if(ZNe(i))o=e=new H6(e,i),a=`derived`;else if(UNe(i))o=e=new Z6(e,i),a=`derived`;else if(JNe(i))e=new Q6(e,i);else if(ePe(i))o=e=K6.makeFromTransform(e,i),a=`derived`;else if(WNe(i))o=e=new B6(e,i),a=`derived`;else if(GNe(i))o=e=new Y6(e,i),a=`derived`;else if(KNe(i))o=e=new X6(e,i),a=`derived`;else if(qNe(i))o=e=new q6(e,i),a=`derived`;else{Z(pAe(i));continue}if(o&&a!==void 0)for(let e of o.producedFields()??[])n.set(e,a,!1)}return e}function u2(e){let t=cRe(e,e.component.data.sources),{outputNodes:n,outputNodeRefCounts:r}=e.component.data,i=e.data,a=!(i&&(s0(i)||a0(i)||o0(i)))&&e.parent?e.parent.component.data.ancestorParse.clone():new YBe;s0(i)?(bPe(i)?t=new x6(t,i.sequence):c0(i)&&(t=new b6(t,i.graticule)),a.parseNothing=!0):i?.format?.parse===null&&(a.parseNothing=!0),t=v6.makeExplicit(t,e,a)??t,t=new y6(t);let o=e.parent&&o2(e.parent);(r2(e)||i2(e))&&o&&(t=h6.makeFromEncoding(t,e)??t),e.transforms.length>0&&(t=lRe(t,e,a));let s=jIe(e),c=AIe(e);t=v6.makeWithAncestors(t,{},{...s,...c},a)??t,r2(e)&&(t=W6.parseAll(t,e),t=G6.parseAll(t,e)),(r2(e)||i2(e))&&(o||(t=h6.makeFromEncoding(t,e)??t),t=A3.makeFromEncoding(t,e)??t,t=l6.parseAllForSortIndex(t,e));let l=t=d2(D3.Raw,e,t);if(r2(e)){let n=g6.makeFromEncoding(t,e);n&&(t=n,D0(e)&&(t=new y6(t))),t=K6.makeFromEncoding(t,e)??t,t=O6.makeFromEncoding(t,e)??t}let u,d;if(r2(e)){let{markDef:n,mark:r,config:i}=e,{marks:a,scales:o}=d=SPe({invalid:r$(`invalid`,n,i),isPath:F$(r)});a!==o&&o===`include-invalid-values`&&(u=t=d2(D3.PreFilterInvalid,e,t)),a===`exclude-invalid-values`&&(t=D6.make(t,e,d)??t)}let f=t=d2(D3.Main,e,t),p;if(r2(e)&&d){let{marks:n,scales:r}=d;n===`include-invalid-values`&&r===`exclude-invalid-values`&&(t=D6.make(t,e,d)??t,p=t=d2(D3.PostFilterInvalid,e,t))}r2(e)&&gFe(e,f);let m=null;if(i2(e)){let r=e.getName(`facet`);t=oRe(t,e.facet)??t,m=new _6(t,e,r,f.getSource()),n[r]=m}return{...e.component.data,outputNodes:n,outputNodeRefCounts:r,raw:l,main:f,facetRoot:m,ancestorParse:a,preFilterInvalid:u,postFilterInvalid:p}}function d2(e,t,n){let{outputNodes:r,outputNodeRefCounts:i}=t.component.data,a=t.getDataName(e),o=new k3(n,a,e,i);return r[a]=o,o}function uRe(e){return e===!1||e===null}function dRe(e,t,n){let{encoding:r,config:i}=e,a=x1(r[t])??x1(r[kQ(t)]),{format:o,formatType:s}=e.axis(t)||{};if(G$(s))return{text:q$({fieldOrDatumDef:a,field:`datum.value`,format:o,formatType:s,config:i}),...n};if(o===void 0&&s===void 0&&i.customFormatTypes){if(a1(a)===`quantitative`){if(p1(a)&&a.stack===`normalize`&&i.normalizedNumberFormatType)return{text:q$({fieldOrDatumDef:a,field:`datum.value`,format:i.normalizedNumberFormat,formatType:i.normalizedNumberFormatType,config:i}),...n};if(i.numberFormatType)return{text:q$({fieldOrDatumDef:a,field:`datum.value`,format:i.numberFormat,formatType:i.numberFormatType,config:i}),...n}}if(a1(a)===`temporal`&&i.timeFormatType&&Q(a)&&!a.timeUnit)return{text:q$({fieldOrDatumDef:a,field:`datum.value`,format:i.timeFormat,formatType:i.timeFormatType,config:i}),...n}}return n}function fRe(e){return d4.reduce((t,n)=>(e.component.scales[n]&&(t[n]=[_Re(n,e)]),t),{})}function pRe(e){let{axes:t,resolve:n}=e.component,r={top:0,bottom:0,right:0,left:0};for(let r of e.children){r.parseAxesAndHeaders();for(let i of $(r.component.axes))n.axis[i]=H0(e.component.resolve,i),n.axis[i]===`shared`&&(t[i]=mRe(t[i],r.component.axes[i]),t[i]||(n.axis[i]=`independent`,delete t[i]))}for(let i of d4){for(let a of e.children)if(a.component.axes[i]){if(n.axis[i]===`independent`){t[i]=(t[i]??[]).concat(a.component.axes[i]);for(let e of a.component.axes[i]){let{value:t,explicit:n}=e.getWithExplicit(`orient`);if(!ZQ(t)){if(r[t]>0&&!n){let n=kVe[t];r[t]>r[n]&&e.set(`orient`,n,!1)}r[t]++}}}delete a.component.axes[i]}if(n.axis[i]===`independent`&&t[i]&&t[i].length>1)for(let[e,n]of(t[i]||[]).entries())e>0&&n.get(`grid`)&&!n.explicit.grid&&(n.implicit.grid=!1)}}function mRe(e,t){if(e){if(e.length!==t.length)return;let n=e.length;for(let r=0;re.clone());return e}function hRe(e,t){for(let n of $6){let r=i0(e.getWithExplicit(n),t.getWithExplicit(n),n,`axis`,(e,t)=>{switch(n){case`title`:return Xke(e,t);case`gridScale`:return{explicit:e.explicit,value:pQ(e.value,t.value)}}return r0(e,t,n,`axis`)});e.setWithExplicit(n,r)}return e}function gRe(e,t,n,r,i){if(t===`disable`)return n!==void 0;switch(n||={},t){case`titleAngle`:case`labelAngle`:return e===(ZQ(n.labelAngle)?n.labelAngle:_Q(n.labelAngle));case`values`:return!!n.values;case`encode`:return!!n.encoding||!!n.labelAngle;case`title`:if(e===NFe(r,i))return!0}return e===n[t]}function _Re(e,t){let n=t.axis(e),r=new OVe,i=x1(t.encoding[e]),{mark:a,config:o}=t,s=n?.orient||o[e===`x`?`axisX`:`axisY`]?.orient||o.axis?.orient||AFe(e),c=t.getScaleComponent(e).get(`type`),l=xFe(e,c,s,t.config),u=n===void 0?N0(`disable`,o.style,n?.style,l).configValue:!n;if(r.set(`disable`,u,n!==void 0),u)return r;n||={};let d=TFe(i,n,e,o.style,l),f=Qje(n.formatType,i,c),p=Zje(i,i.type,n.format,n.formatType,o,!0),m={fieldOrDatumDef:i,axis:n,channel:e,model:t,scaleType:c,orient:s,labelAngle:d,format:p,formatType:f,mark:a,config:o};for(let i of $6){let a=i in c6?c6[i](m):AMe(i)?n[i]:void 0,s=a!==void 0,c=gRe(a,i,n,t,e);if(s&&c)r.set(i,a,c);else{let{configValue:e=void 0,configFrom:t=void 0}=AMe(i)&&i!==`values`?N0(i,o.style,n.style,l):{},u=e!==void 0;s&&!u?r.set(i,a,c):(t!==`vgAxisConfig`||AVe.has(i)&&u||O1(e)||ZQ(e))&&r.set(i,e,!1)}}let h=n.encoding??{},g=a3.reduce((n,i)=>{if(!r.hasAxisPart(i))return n;let a=JFe(h[i]??{},t),o=i===`labels`?dRe(t,e,a):a;return o!==void 0&&!QZ(o)&&(n[i]={update:o}),n},{});return QZ(g)||r.set(`encode`,g,!!n.encoding||n.labelAngle!==void 0),r}function vRe({encoding:e,size:t}){for(let n of d4){let r=AQ(n);W1(t[r])&&s1(e[n])&&(delete t[r],Z(zAe(r)))}return t}function f2(e,t){let{config:n}=e;return{...w0(e,{align:`ignore`,baseline:`ignore`,color:`include`,size:`include`,orient:`ignore`,theta:`ignore`}),...y0(`x`,e,{defaultPos:`mid`}),...y0(`y`,e,{defaultPos:`mid`}),..._0(`size`,e),..._0(`angle`,e),...yRe(e,n,t)}}function yRe(e,t,n){return n?{shape:{value:n}}:_0(`shape`,e)}function bRe(e,t,n){if(r$(`align`,e,n)===void 0)return`center`}function xRe(e,t,n){if(r$(`baseline`,e,n)===void 0)return`middle`}function SRe(e){if(UZ([H4,B4,sBe],e.mark)){let t=zMe(e.mark,e.encoding);if(t.length>0)return CRe(e,t)}else if(e.mark===V4){let t=v4.some(t=>r$(t,e.markDef,e.config));if(e.stack&&!e.fieldDef(`size`)&&t)return wRe(e)}return p2(e)}function CRe(e,t){return[{name:e.getName(`pathgroup`),type:`group`,from:{facet:{name:t8+e.requestDataName(D3.Main),data:e.requestDataName(D3.Main),groupby:t}},encode:{update:{width:{field:{group:`width`}},height:{field:{group:`height`}}}},marks:p2(e,{fromPrefix:t8})}]}function wRe(e){let[t]=p2(e,{fromPrefix:n8}),n=e.scaleName(e.stack.fieldChannel),r=(t={})=>e.vgField(e.stack.fieldChannel,t),i=(e,t)=>`${e}(${[r({prefix:`min`,suffix:`start`,expr:t}),r({prefix:`max`,suffix:`start`,expr:t}),r({prefix:`min`,suffix:`end`,expr:t}),r({prefix:`max`,suffix:`end`,expr:t})].map(e=>`scale('${n}',${e})`).join(`,`)})`,a,o;e.stack.fieldChannel===`x`?(a={...zZ(t.encode.update,[`y`,`yc`,`y2`,`height`,...v4]),x:{signal:i(`min`,`datum`)},x2:{signal:i(`max`,`datum`)},clip:{value:!0}},o={x:{field:{group:`x`},mult:-1},height:{field:{group:`height`}}},t.encode.update={...BZ(t.encode.update,[`y`,`yc`,`y2`]),height:{field:{group:`height`}}}):(a={...zZ(t.encode.update,[`x`,`xc`,`x2`,`width`]),y:{signal:i(`min`,`datum`)},y2:{signal:i(`max`,`datum`)},clip:{value:!0}},o={y:{field:{group:`y`},mult:-1},width:{field:{group:`width`}}},t.encode.update={...BZ(t.encode.update,[`x`,`xc`,`x2`]),width:{field:{group:`width`}}});for(let n of v4){let r=i$(n,e.markDef,e.config);t.encode.update[n]?(a[n]=t.encode.update[n],delete t.encode.update[n]):r&&(a[n]=t$(r)),r&&(t.encode.update[n]={value:0})}let s=[];if(e.stack.groupbyChannels?.length>0)for(let t of e.stack.groupbyChannels){let n=e.fieldDef(t),r=m1(n);r&&s.push(r),(n?.bin||n?.timeUnit)&&s.push(m1(n,{binSuffix:`end`}))}return a=[`stroke`,`strokeWidth`,`strokeJoin`,`strokeCap`,`strokeDash`,`strokeDashOffset`,`strokeMiterLimit`,`strokeOpacity`].reduce((n,r)=>{if(t.encode.update[r])return{...n,[r]:t.encode.update[r]};{let t=i$(r,e.markDef,e.config);return t===void 0?n:{...n,[r]:t$(t)}}},a),a.stroke&&(a.strokeForeground={value:!0},a.strokeOffset={value:0}),[{type:`group`,from:{facet:{data:e.requestDataName(D3.Main),name:n8+e.requestDataName(D3.Main),groupby:s,aggregate:{fields:[r({suffix:`start`}),r({suffix:`start`}),r({suffix:`end`}),r({suffix:`end`})],ops:[`min`,`max`,`min`,`max`]}}},encode:{update:a},marks:[{type:`group`,encode:{update:o},marks:[t]}]}]}function TRe(e){let{encoding:t,stack:n,mark:r,markDef:i,config:a}=e,o=t.order;if(!(!W(o)&&d1(o)&&HZ(o.value)||!o&&HZ(r$(`order`,i,a)))){if((W(o)||Q(o))&&!n)return qke(o,{expr:`datum`});if(F$(r)){let e=i.orient===`horizontal`?`y`:`x`,n=t[e];if(Q(n))return{field:e}}}}function p2(e,t={fromPrefix:``}){let{mark:n,markDef:r,encoding:i,config:a}=e,o=pQ(r.clip,ERe(e),DRe(e)),s=Gke(r),c=i.key,l=TRe(e),u=ORe(e);u&&Object.values(e.component.selection).some(e=>e.type===`point`&&!e.bind&&e.on!==`pointerover`)&&(e.markDef.cursor??=`pointer`);let d=r$(`aria`,r,a),f=e8[n].postEncodingTransform?e8[n].postEncodingTransform(e):null;return[{name:e.getName(`marks`),type:e8[n].vgMark,...o?{clip:o}:{},...s?{style:s}:{},...c?{key:c.field}:{},...l?{sort:l}:{},...u||{},...d===!1?{aria:d}:{},from:{data:t.fromPrefix+e.requestDataName(D3.Main)},encode:{update:e8[n].encodeEntry(e)},...f?{transform:f}:{}}]}function ERe(e){let t=e.getScaleComponent(`x`),n=e.getScaleComponent(`y`);return t?.get(`selectionExtent`)||n?.get(`selectionExtent`)?!0:void 0}function DRe(e){let t=e.component.projection;return t&&!t.isFit?!0:void 0}function ORe(e){if(!e.component.selection)return null;let t=$(e.component.selection).length,n=t,r=e.parent;for(;r&&n===0;)n=$(r.component.selection).length,r=r.parent;return n?{interactive:t>0||e.mark===`geoshape`||!!e.encoding.tooltip||!!e.markDef.tooltip}:null}function m2(e,t,n,r,i){if($$(e))return new EVe(e,t,n,i);if(J1(e))return new WVe(e,t,n,r,i);if(k1(e))return new r8(e,t,n,r,i);if(aNe(e))return new DVe(e,t,n,i);throw Error(o$(e))}function kRe(e,t={}){t.logger&&nje(t.logger),t.fieldTitle&&SMe(t.fieldTitle);try{let n=mNe(Nh(t.config,e.config)),r=dPe(e,n),i=m2(r,null,``,void 0,n);return i.parse(),LIe(i.component.data,i),{spec:jRe(i,ARe(e,r.autosize,n,i),e.datasets,e.usermeta),normalized:r}}finally{t.logger&&rje(),t.fieldTitle&&CMe()}}function ARe(e,t,n,r){let i=r.component.layoutSize.get(`width`),a=r.component.layoutSize.get(`height`);if(t===void 0?(t={type:`pad`},r.hasAxisOrientSignalRef()&&(t.resize=!0)):vg(t)&&(t={type:t}),i&&a&&hPe(t.type)){if(i===`step`&&a===`step`)Z($ke()),t.type=`pad`;else if(i===`step`||a===`step`){let e=i===`step`?`width`:`height`;Z($ke(PQ(e))),t.type=gPe(e===`width`?`height`:`width`)}}return{...$(t).length===1&&t.type?t.type===`pad`?{}:{autosize:t.type}:{autosize:t},..._Pe(n,!1),..._Pe(e,!0)}}function jRe(e,t,n={},r){let i=e.config?hNe(e.config):void 0,a=XLe(e.component.data,n),o=e.assembleSelectionData(a),s=e.assembleProjections(),c=e.assembleTitle(),l=e.assembleGroupStyle(),u=e.assembleGroupEncodeEntry(!0),d=e.assembleLayoutSignals();d=d.filter(e=>(e.name===`width`||e.name===`height`)&&e.value!==void 0?(t[e.name]=+e.value,!1):!0);let{params:f,...p}=t;return{$schema:`https://vega.github.io/schema/vega/v6.json`,...e.description?{description:e.description}:{},...p,...c?{title:c}:{},...l?{style:l}:{},...u?{encode:{update:u}}:{},data:o,...s.length>0?{projections:s}:{},...e.assembleGroup([...d,...e.assembleSelectionTopLevelSignals([]),...iNe(f)]),...i?{config:i}:{},...r?{usermeta:r}:{}}}var MRe,h2,$,g2,_2,v2,y2,b2,x2,S2,C2,w2,T2,E2,D2,O2,k2,A2,j2,M2,N2,P2,F2,I2,L2,R2,z2,B2,V2,H2,U2,W2,G2,K2,q2,J2,Y2,X2,Z2,Q2,$2,e4,t4,n4,NRe,r4,i4,PRe,a4,o4,s4,c4,FRe,IRe,LRe,RRe,zRe,BRe,VRe,HRe,URe,WRe,GRe,KRe,qRe,JRe,YRe,XRe,ZRe,QRe,$Re,eze,tze,nze,rze,ize,aze,l4,oze,u4,d4,f4,sze,p4,cze,lze,uze,dze,fze,pze,mze,hze,gze,m4,_ze,h4,g4,_4,vze,yze,bze,xze,Sze,Cze,wze,Tze,Eze,v4,Dze,Oze,kze,Aze,jze,Mze,Nze,Pze,y4,Fze,Ize,Lze,Rze,zze,b4,Bze,Vze,Hze,x4,S4,C4,Uze,w4,Wze,T4,E4,Gze,Kze,D4,O4,k4,A4,j4,M4,N4,P4,qze,F4,I4,L4,Jze,Yze,Xze,Zze,Qze,$ze,eBe,tBe,nBe,rBe,iBe,R4,z4,B4,V4,aBe,H4,U4,oBe,W4,G4,K4,sBe,q4,J4,Y4,cBe,lBe,uBe,dBe,X4,Z4,fBe,pBe,Q4,mBe,$4,hBe,gBe,e3,_Be,t3,n3,r3,i3,a3,vBe,o3,yBe,s3,c3,l3,bBe,xBe,u3,SBe,CBe,d3,wBe,TBe,f3,EBe,p3,m3,DBe,OBe,h3,g3,kBe,ABe,_3,jBe,v3,MBe,y3,NBe,b3,x3,S3,PBe,FBe,IBe,LBe,C3,RBe,zBe,BBe,w3,VBe,HBe,UBe,WBe,T3,GBe,KBe,qBe,JBe,E3,YBe,D3,O3,k3,A3,j3,M3,N3,XBe,ZBe,P3,F3,I3,L3,R3,z3,B3,V3,QBe,$Be,eVe,H3,U3,W3,G3,K3,tVe,nVe,rVe,iVe,aVe,q3,J3,Y3,X3,Z3,oVe,Q3,$3,e6,sVe,t6,n6,cVe,r6,i6,lVe,a6,o6,s6,c6,l6,u6,d6,uVe,f6,dVe,p6,m6,h6,g6,_6,v6,y6,b6,x6,S6,C6,w6,T6,fVe,pVe,mVe,hVe,gVe,_Ve,vVe,yVe,bVe,xVe,SVe,E6,D6,O6,k6,A6,j6,M6,CVe,N6,P6,wVe,F6,I6,TVe,L6,R6,z6,B6,V6,H6,U6,W6,G6,K6,q6,J6,Y6,X6,Z6,Q6,EVe,DVe,$6,OVe,kVe,AVe,jVe,MVe,NVe,PVe,FVe,IVe,LVe,RVe,zVe,BVe,VVe,HVe,UVe,e8,t8,n8,r8,WVe,GVe,KVe=o((()=>{Dg(),WY(),sK(),Cke(),MRe={version:`6.4.3`},h2=structuredClone,Set.prototype.toJSON=function(){return`Set(${[...this].map(e=>bQ(e)).join(`,`)})`},$=Object.keys,g2=Object.values,_2=Object.entries,v2=42,y2=Object.getPrototypeOf(structuredClone({})),b2=`row`,x2=`column`,S2=`facet`,C2=`x`,w2=`y`,T2=`x2`,E2=`y2`,D2=`xOffset`,O2=`yOffset`,k2=`radius`,A2=`radius2`,j2=`theta`,M2=`theta2`,N2=`latitude`,P2=`longitude`,F2=`latitude2`,I2=`longitude2`,L2=`time`,R2=`color`,z2=`fill`,B2=`stroke`,V2=`shape`,H2=`size`,U2=`angle`,W2=`opacity`,G2=`fillOpacity`,K2=`strokeOpacity`,q2=`strokeWidth`,J2=`strokeDash`,Y2=`text`,X2=`order`,Z2=`detail`,Q2=`key`,$2=`tooltip`,e4=`href`,t4=`url`,n4=`description`,NRe={x:1,y:1,x2:1,y2:1},r4={theta:1,theta2:1,radius:1,radius2:1},i4={longitude:1,longitude2:1,latitude:1,latitude2:1},PRe=$(i4),a4={...NRe,...r4,...i4,xOffset:1,yOffset:1,color:1,fill:1,stroke:1,time:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeDash:1,size:1,angle:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1,url:1,description:1},o4={row:1,column:1,facet:1},s4=$(o4),c4={...a4,...o4},FRe=$(c4),{order:IRe,detail:LRe,tooltip:RRe,...zRe}=c4,{row:BRe,column:VRe,facet:HRe,...URe}=zRe,WRe=[T2,E2,F2,I2,M2,A2],GRe=$(a4),{x:KRe,y:qRe,x2:JRe,y2:YRe,xOffset:XRe,yOffset:ZRe,latitude:QRe,longitude:$Re,latitude2:eze,longitude2:tze,theta:nze,theta2:rze,radius:ize,radius2:aze,...l4}=a4,oze=$(l4),u4={x:1,y:1},d4=$(u4),f4={theta:1,radius:1},sze=$(f4),p4={xOffset:1,yOffset:1},cze={time:1},{text:lze,tooltip:uze,href:dze,url:fze,description:pze,detail:mze,key:hze,order:gze,...m4}=l4,_ze=$(m4),h4={...u4,...f4,...p4,...m4},g4=$(h4),_4={arc:`always`,area:`always`,bar:`always`,circle:`always`,geoshape:`always`,image:`always`,line:`always`,rule:`always`,point:`always`,rect:`always`,square:`always`,trail:`always`,text:`always`,tick:`always`},{geoshape:vze,...yze}=_4,bze={argmax:1,argmin:1,average:1,count:1,distinct:1,exponential:1,exponentialb:1,product:1,max:1,mean:1,median:1,min:1,missing:1,q1:1,q3:1,ci0:1,ci1:1,stderr:1,stdev:1,stdevp:1,sum:1,valid:1,values:1,variance:1,variancep:1},xze={count:1,min:1,max:1},Sze=new Set([`count`,`valid`,`missing`,`distinct`]),Cze=new Set([`count`,`sum`,`distinct`,`valid`,`missing`]),wze=new Set([`mean`,`average`,`median`,`q1`,`q3`,`min`,`max`]),Tze=$({aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1,url:1,smooth:1}),Eze={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},v4=[`cornerRadius`,`cornerRadiusTopLeft`,`cornerRadiusTopRight`,`cornerRadiusBottomLeft`,`cornerRadiusBottomRight`],Dze=` – `,Oze=`Autosize "fit" only works for single views and layered views.`,kze=`Scale bindings are currently only supported for scales with unbinned, continuous domains.`,Aze=`Sequntial scales are deprecated. The available quantitative scale type values are linear, log, pow, sqrt, symlog, time and utc`,jze=`Legend bindings are only supported for selections over an individual field or encoding channel.`,Mze=`The same selection must be used to override scale domains in a layered view.`,Nze=`Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.`,Pze=`Multiple timer selections in one unit spec are not supported. Ignoring all but the first.`,y4=`Animation involving facet, layer, or concat is currently unsupported.`,Fze=`Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).`,Ize=`Attempt to add the same child twice.`,Lze=`If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.`,Rze=`Arc marks uses theta channel rather than angle, replacing angle with theta.`,zze=`Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.`,b4=`Domains that should be unioned has conflicting sort properties. Sort will be set to true.`,Bze=`Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.`,Vze=`Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.`,Hze=`Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.`,x4=kh(2),S4=x4,C4=[`january`,`february`,`march`,`april`,`may`,`june`,`july`,`august`,`september`,`october`,`november`,`december`],Uze=C4.map(e=>e.substr(0,3)),w4=[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`],Wze=w4.map(e=>e.substr(0,3)),T4={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},E4=$(T4),Gze={"year-month":`%b %Y `,"year-month-date":`%b %d, %Y `},Kze={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},D4={quantitative:`quantitative`,ordinal:`ordinal`,temporal:`temporal`,nominal:`nominal`,geojson:`geojson`},O4=D4.quantitative,k4=D4.ordinal,A4=D4.temporal,j4=D4.nominal,M4=D4.geojson,N4={LINEAR:`linear`,LOG:`log`,POW:`pow`,SQRT:`sqrt`,TIME:`time`,UTC:`utc`,POINT:`point`,BAND:`band`},P4={linear:`numeric`,log:`numeric`,pow:`numeric`,sqrt:`numeric`,symlog:`numeric`,identity:`numeric`,sequential:`numeric`,time:`time`,utc:`time`,ordinal:`ordinal`,"bin-ordinal":`bin-ordinal`,point:`ordinal-position`,band:`ordinal-position`,quantile:`discretizing`,quantize:`discretizing`,threshold:`discretizing`},qze={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0},F4=new Set([`linear`,`log`,`pow`,`sqrt`,`symlog`]),I4=new Set([...F4,`time`,`utc`]),L4=new Set([`quantile`,`quantize`,`threshold`]),Jze=new Set([...I4,...L4,`sequential`,`identity`]),Yze=new Set([`ordinal`,`bin-ordinal`,`point`,`band`]),Xze={pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,tickBandPaddingInner:.25,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:4,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0,framesPerSecond:2,animationDuration:5},{type:Zze,domain:Qze,range:$ze,rangeMax:eBe,rangeMin:tBe,scheme:nBe,...rBe}={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},iBe=$(rBe),R4={arc:`arc`,area:`area`,bar:`bar`,image:`image`,line:`line`,point:`point`,rect:`rect`,rule:`rule`,text:`text`,tick:`tick`,trail:`trail`,circle:`circle`,square:`square`,geoshape:`geoshape`},z4=R4.arc,B4=R4.area,V4=R4.bar,aBe=R4.image,H4=R4.line,U4=R4.point,oBe=R4.rect,W4=R4.rule,G4=R4.text,K4=R4.tick,sBe=R4.trail,q4=R4.circle,J4=R4.square,Y4=R4.geoshape,cBe=new Set($(R4)),lBe=[`stroke`,`strokeWidth`,`strokeDash`,`strokeDashOffset`,`strokeOpacity`,`strokeJoin`,`strokeMiterLimit`],uBe=[`fill`,`fillOpacity`],dBe=[...lBe,...uBe],X4=$({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),Z4=[`binSpacing`,`continuousBandSize`,`discreteBandSize`,`minBandSize`],fBe={area:[`line`,`point`],bar:Z4,rect:Z4,line:[`point`],tick:[`bandSize`,`thickness`,...Z4]},pBe={color:`#4c78a8`,invalid:`break-paths-show-path-domains`,timeUnitBandSize:1},Q4=$({mark:1,arc:1,area:1,bar:1,circle:1,image:1,line:1,point:1,rect:1,rule:1,square:1,text:1,tick:1,trail:1,geoshape:1}),mBe={horizontal:[`cornerRadiusTopRight`,`cornerRadiusBottomRight`],vertical:[`cornerRadiusTopLeft`,`cornerRadiusTopRight`]},$4={binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},hBe={...$4,binSpacing:1},gBe={...$4,thickness:1},e3=`min`,_Be={x:1,y:1,color:1,fill:1,stroke:1,strokeWidth:1,size:1,shape:1,fillOpacity:1,strokeOpacity:1,opacity:1,text:1},t3=(e,t)=>{switch(t.fieldTitle){case`plain`:return e.field;case`functional`:return xMe(e);default:return bMe(e,t)}},n3=t3,r3={compatible:!0},i3={labelAlign:{part:`labels`,vgProp:`align`},labelBaseline:{part:`labels`,vgProp:`baseline`},labelColor:{part:`labels`,vgProp:`fill`},labelFont:{part:`labels`,vgProp:`font`},labelFontSize:{part:`labels`,vgProp:`fontSize`},labelFontStyle:{part:`labels`,vgProp:`fontStyle`},labelFontWeight:{part:`labels`,vgProp:`fontWeight`},labelOpacity:{part:`labels`,vgProp:`opacity`},labelOffset:null,labelPadding:null,gridColor:{part:`grid`,vgProp:`stroke`},gridDash:{part:`grid`,vgProp:`strokeDash`},gridDashOffset:{part:`grid`,vgProp:`strokeDashOffset`},gridOpacity:{part:`grid`,vgProp:`opacity`},gridWidth:{part:`grid`,vgProp:`strokeWidth`},tickColor:{part:`ticks`,vgProp:`stroke`},tickDash:{part:`ticks`,vgProp:`strokeDash`},tickDashOffset:{part:`ticks`,vgProp:`strokeDashOffset`},tickOpacity:{part:`ticks`,vgProp:`opacity`},tickSize:null,tickWidth:{part:`ticks`,vgProp:`strokeWidth`}},a3=[`domain`,`grid`,`labels`,`ticks`,`title`],vBe={grid:`grid`,gridCap:`grid`,gridColor:`grid`,gridDash:`grid`,gridDashOffset:`grid`,gridOpacity:`grid`,gridScale:`grid`,gridWidth:`grid`,orient:`main`,bandPosition:`both`,aria:`main`,description:`main`,domain:`main`,domainCap:`main`,domainColor:`main`,domainDash:`main`,domainDashOffset:`main`,domainOpacity:`main`,domainWidth:`main`,format:`main`,formatType:`main`,labelAlign:`main`,labelAngle:`main`,labelBaseline:`main`,labelBound:`main`,labelColor:`main`,labelFlush:`main`,labelFlushOffset:`main`,labelFont:`main`,labelFontSize:`main`,labelFontStyle:`main`,labelFontWeight:`main`,labelLimit:`main`,labelLineHeight:`main`,labelOffset:`main`,labelOpacity:`main`,labelOverlap:`main`,labelPadding:`main`,labels:`main`,labelSeparation:`main`,maxExtent:`main`,minExtent:`main`,offset:`both`,position:`main`,tickCap:`main`,tickColor:`main`,tickDash:`main`,tickDashOffset:`main`,tickMinStep:`both`,tickOffset:`both`,tickOpacity:`main`,tickRound:`both`,ticks:`main`,tickSize:`main`,tickWidth:`both`,title:`main`,titleAlign:`main`,titleAnchor:`main`,titleAngle:`main`,titleBaseline:`main`,titleColor:`main`,titleFont:`main`,titleFontSize:`main`,titleFontStyle:`main`,titleFontWeight:`main`,titleLimit:`main`,titleLineHeight:`main`,titleOpacity:`main`,titlePadding:`main`,titleX:`main`,titleY:`main`,encode:`both`,scale:`both`,tickBand:`both`,tickCount:`both`,tickExtra:`both`,translate:`both`,values:`both`,zindex:`both`},o3={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},yBe={...o3,style:1,labelExpr:1,encoding:1},s3=$({axis:1,axisBand:1,axisBottom:1,axisDiscrete:1,axisLeft:1,axisPoint:1,axisQuantitative:1,axisRight:1,axisTemporal:1,axisTop:1,axisX:1,axisXBand:1,axisXDiscrete:1,axisXPoint:1,axisXQuantitative:1,axisXTemporal:1,axisY:1,axisYBand:1,axisYDiscrete:1,axisYPoint:1,axisYQuantitative:1,axisYTemporal:1}),c3=class{name;run;constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return k1(e)?Vje(e.mark)===this.name:!1}},l3=`boxplot`,bBe=[`box`,`median`,`outliers`,`rule`,`ticks`],xBe=new c3(l3,GMe),u3=`errorbar`,SBe=[`ticks`,`rule`],CBe=new c3(u3,JMe),d3=`errorband`,wBe=[`band`,`borders`],TBe=new c3(d3,nNe),f3={},L1(l3,GMe,bBe),L1(u3,JMe,SBe),L1(d3,nNe,wBe),EBe=[`gradientHorizontalMaxLength`,`gradientHorizontalMinLength`,`gradientVerticalMaxLength`,`gradientVerticalMinLength`,`unselectedOpacity`],p3={titleAlign:`align`,titleAnchor:`anchor`,titleAngle:`angle`,titleBaseline:`baseline`,titleColor:`color`,titleFont:`font`,titleFontSize:`fontSize`,titleFontStyle:`fontStyle`,titleFontWeight:`fontWeight`,titleLimit:`limit`,titleLineHeight:`lineHeight`,titleOrient:`orient`,titlePadding:`offset`},m3={labelAlign:`align`,labelAnchor:`anchor`,labelAngle:`angle`,labelBaseline:`baseline`,labelColor:`color`,labelFont:`font`,labelFontSize:`fontSize`,labelFontStyle:`fontStyle`,labelFontWeight:`fontWeight`,labelLimit:`limit`,labelLineHeight:`lineHeight`,labelOrient:`orient`,labelPadding:`offset`},DBe=$(p3),OBe=$(m3),h3=$({header:1,headerRow:1,headerColumn:1,headerFacet:1}),g3=[`size`,`shape`,`fill`,`stroke`,`strokeDash`,`strokeWidth`,`opacity`],kBe={gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},ABe={aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1},_3=`_vgsid_`,jBe={point:{on:`click`,fields:[_3],toggle:`event.shiftKey`,resolve:`global`,clear:`dblclick`},interval:{on:`[pointerdown, window:pointerup] > window:pointermove!`,encodings:[`x`,`y`],translate:`[pointerdown, window:pointerup] > window:pointermove!`,zoom:`wheel!`,mark:{fill:`#333`,fillOpacity:.125,stroke:`white`},resolve:`global`,clear:`dblclick`}},v3=20,MBe=$({align:1,bounds:1,center:1,columns:1,spacing:1}),y3=20,NBe={background:`white`,padding:5,timeFormat:`%b %d, %Y`,countTitle:`Count of Records`,view:{continuousWidth:300,continuousHeight:300,step:y3},mark:pBe,arc:{},area:{},bar:hBe,circle:{},geoshape:{},image:{},line:{},point:{},rect:$4,rule:{color:`black`},square:{},text:{color:`black`},tick:gBe,trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:`white`},outliers:{},rule:{},ticks:null},errorbar:{center:`mean`,rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:Xze,projection:{},legend:kBe,header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:jBe,style:{},title:{},facet:{spacing:v3},concat:{spacing:v3},normalizedNumberFormat:`.0%`},b3=[`#4c78a8`,`#f58518`,`#e45756`,`#72b7b2`,`#54a24b`,`#eeca3b`,`#b279a2`,`#ff9da6`,`#9d755d`,`#bab0ac`],x3={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},S3={blue:b3[0],orange:b3[1],red:b3[2],teal:b3[3],green:b3[4],yellow:b3[5],purple:b3[6],pink:b3[7],brown:b3[8],gray0:`#000`,gray1:`#111`,gray2:`#222`,gray3:`#333`,gray4:`#444`,gray5:`#555`,gray6:`#666`,gray7:`#777`,gray8:`#888`,gray9:`#999`,gray10:`#aaa`,gray11:`#bbb`,gray12:`#ccc`,gray13:`#ddd`,gray14:`#eee`,gray15:`#fff`},PBe=[...Q4,...s3,...h3,`background`,`padding`,`legend`,`lineBreak`,`scale`,`style`,`title`,`view`],FBe=new Set([`view`,...cBe]),IBe=`color.fontSize.background.padding.facet.concat.numberFormat.numberFormatType.normalizedNumberFormat.normalizedNumberFormatType.timeFormat.countTitle.header.axisQuantitative.axisTemporal.axisDiscrete.axisPoint.axisXBand.axisXPoint.axisXDiscrete.axisXQuantitative.axisXTemporal.axisYBand.axisYPoint.axisYDiscrete.axisYQuantitative.axisYTemporal.scale.selection.overlay`.split(`.`),LBe={view:[`continuousWidth`,`continuousHeight`,`discreteWidth`,`discreteHeight`,`step`],...fBe},C3=class{map(e,t){return $$(e)?this.mapFacet(e,t):vNe(e)?this.mapRepeat(e,t):U1(e)?this.mapHConcat(e,t):H1(e)?this.mapVConcat(e,t):V1(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(J1(e))return this.mapLayer(e,t);if(k1(e))return this.mapUnit(e,t);throw Error(o$(e))}mapLayer(e,t){return{...e,layer:e.layer.map(e=>this.mapLayerOrUnit(e,t))}}mapHConcat(e,t){return{...e,hconcat:e.hconcat.map(e=>this.map(e,t))}}mapVConcat(e,t){return{...e,vconcat:e.vconcat.map(e=>this.map(e,t))}}mapConcat(e,t){let{concat:n,...r}=e;return{...r,concat:n.map(e=>this.map(e,t))}}mapFacet(e,t){return{...e,spec:this.map(e.spec,t)}}mapRepeat(e,t){return{...e,spec:this.map(e.spec,t)}}},RBe={zero:1,center:1,normalize:1},zBe=new Set([z4,V4,B4,W4,U4,q4,J4,H4,G4,K4]),BBe=new Set([V4,B4,z4]),w3=.7,VBe=class{name=`path-overlay`;hasMatchingType(e,t){if(k1(e)){let{mark:n,encoding:r}=e,i=L$(n)?n:{type:n};switch(i.type){case`line`:case`rule`:case`trail`:return!!X1(i,t[i.type],r);case`area`:return!!X1(i,t[i.type],r)||!!jNe(i,t[i.type])}}return!1}run(e,t,n){let{config:r}=t,{params:i,projection:a,mark:o,name:s,encoding:c,...l}=e,u=j1(c,r),d=L$(o)?o:{type:o},f=X1(d,r[d.type],u),p=d.type===`area`&&jNe(d,r[d.type]),m=[{name:s,...i?{params:i}:{},mark:kNe({...d.type===`area`&&r$(`opacity`,d,r)==null&&r$(`fillOpacity`,d,r)==null?{opacity:w3}:{},...d}),encoding:BZ(u,[`shape`])}],h=CNe(wNe(d,u,r),u),g=u;if(h){let{fieldChannel:e,offset:t}=h;g={...u,[e]:{...u[e],...t?{stack:t}:{}}}}return g=BZ(g,[`y2`,`x2`]),p&&m.push({...a?{projection:a}:{},mark:{type:`line`,...zZ(d,[`clip`,`interpolate`,`tension`,`tooltip`]),...p},encoding:g}),f&&m.push({...a?{projection:a}:{},mark:{type:`point`,opacity:1,filled:!0,...zZ(d,[`clip`,`tooltip`]),...f},encoding:g}),n({...l,layer:m},{...t,config:ANe(r)})}},HBe=class{name=`RuleForRangedLine`;hasMatchingType(e){if(k1(e)){let{encoding:t,mark:n}=e;if(n===`line`||L$(n)&&n.type===`line`)for(let e of WRe){let n=t[DQ(e)];if(t[e]&&(Q(n)&&!GQ(n.bin)||o1(n)))return!0}}return!1}run(e,t,n){let{encoding:r,mark:i}=e;return Z(OAe(!!r.x2,!!r.y2)),n({...e,mark:jh(i)?{...i,type:`rule`}:`rule`},t)}},UBe=class extends C3{nonFacetUnitNormalizers=[xBe,CBe,TBe,new VBe,new HBe];map(e,t){if(k1(e)){let n=A1(e.encoding,b2),r=A1(e.encoding,x2),i=A1(e.encoding,S2);if(n||r||i)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){let{parentEncoding:n,parentProjection:r}=t,i=Z1(e.encoding,t.repeater),a={...e,...e.name?{name:[t.repeaterPrefix,e.name].filter(e=>e).join(`_`)}:{},...i?{encoding:i}:{}};if(n||r)return this.mapUnitWithParentEncodingOrProjection(a,t);let o=this.mapLayerOrUnit.bind(this);for(let e of this.nonFacetUnitNormalizers)if(e.hasMatchingType(a,t.config))return e.run(a,t,o);return a}mapRepeat(e,t){return yNe(e)?this.mapLayerRepeat(e,t):this.mapNonLayerRepeat(e,t)}mapLayerRepeat(e,t){let{repeat:n,spec:r,...i}=e,{row:a,column:o,layer:s}=n,{repeater:c={},repeaterPrefix:l=``}=t;return a||o?this.mapRepeat({...e,repeat:{...a?{row:a}:{},...o?{column:o}:{}},spec:{repeat:{layer:s},spec:r}},t):{...i,layer:s.map(e=>{let n={...c,layer:e},i=`${(r.name?`${r.name}_`:``)+l}child__layer_${tQ(e)}`,a=this.mapLayerOrUnit(r,{...t,repeater:n,repeaterPrefix:i});return a.name=i,a})}}mapNonLayerRepeat(e,t){let{repeat:n,spec:r,data:i,...a}=e;!W(n)&&e.columns&&(e=BZ(e,[`columns`]),Z(cAe(`repeat`)));let o=[],{repeater:s={},repeaterPrefix:c=``}=t,l=!W(n)&&n.row||[s?s.row:null],u=!W(n)&&n.column||[s?s.column:null],d=W(n)&&n||[s?s.repeat:null];for(let e of d)for(let i of l)for(let a of u){let l={repeat:e,row:i,column:a,layer:s.layer},u=`${(r.name?`${r.name}_`:``)+c}child__${W(n)?`${tQ(e)}`:(n.row?`row_${tQ(i)}`:``)+(n.column?`column_${tQ(a)}`:``)}`,d=this.map(r,{...t,repeater:l,repeaterPrefix:u});d.name=u,o.push(BZ(d,[`data`]))}let f=W(n)?e.columns:n.column?n.column.length:1;return{data:r.data??i,align:`all`,...a,columns:f,concat:o}}mapFacet(e,t){let{facet:n}=e;return Z$(n)&&e.columns&&(e=BZ(e,[`columns`]),Z(cAe(`facet`))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){let{encoding:n,projection:r}=e,{parentEncoding:i,parentProjection:a,config:o}=t,s=RNe({parentProjection:a,projection:r}),c=LNe({parentEncoding:i,encoding:Z1(n,t.repeater)});return this.mapUnit({...e,...s?{projection:s}:{},...c?{encoding:c}:{}},{config:o})}mapFacetedUnit(e,t){let{row:n,column:r,facet:i,...a}=e.encoding,{mark:o,width:s,projection:c,height:l,view:u,params:d,encoding:f,...p}=e,{facetMapping:m,layout:h}=this.getFacetMappingAndLayout({row:n,column:r,facet:i},t),g=Z1(a,t.repeater);return this.mapFacet({...p,...h,facet:m,spec:{...s?{width:s}:{},...l?{height:l}:{},...u?{view:u}:{},...c?{projection:c}:{},mark:o,encoding:g,...d?{params:d}:{}}},t)}getFacetMappingAndLayout(e,t){let{row:n,column:r,facet:i}=e;if(n||r){i&&Z(EAe([...n?[b2]:[],...r?[x2]:[]]));let t={},a={};for(let n of[b2,x2]){let r=e[n];if(r){let{align:e,center:i,spacing:o,columns:s,...c}=r;t[n]=c;for(let e of[`align`,`center`,`spacing`])r[e]!==void 0&&(a[e]??={},a[e][n]=r[e])}}return{facetMapping:t,layout:a}}else{let{align:e,center:n,spacing:r,columns:a,...o}=i;return{facetMapping:MNe(o,t.repeater),layout:{...e?{align:e}:{},...n?{center:n}:{},...r?{spacing:r}:{},...a?{columns:a}:{}}}}}mapLayer(e,{parentEncoding:t,parentProjection:n,...r}){let{encoding:i,projection:a,...o}=e,s={...r,parentEncoding:LNe({parentEncoding:t,encoding:i,layer:!0}),parentProjection:RNe({parentProjection:n,projection:a})};return super.mapLayer({...o,...e.name?{name:[s.repeaterPrefix,e.name].filter(e=>e).join(`_`)}:{}},s)}},WBe=class extends C3{map(e,t){return t.emptySelections??={},t.selectionPredicates??={},e=sPe(e,t),super.map(e,t)}mapLayerOrUnit(e,t){if(e=sPe(e,t),e.encoding){let n={};for(let[r,i]of _2(e.encoding))n[r]=cPe(i,t);e={...e,encoding:n}}return super.mapLayerOrUnit(e,t)}mapUnit(e,t){let{selection:n,...r}=e;return n?{...r,params:_2(n).map(([e,n])=>{let{init:r,bind:i,empty:a,...o}=n;o.type===`single`?(o.type=`point`,o.toggle=!1):o.type===`multi`&&(o.type=`point`),t.emptySelections[e]=a!==`none`;for(let n of g2(t.selectionPredicates[e]??{}))n.empty=a!==`none`;return{name:e,value:r,select:o,bind:i}})}:e}},T3=class extends C3{map(e,t){let n=t.selections??[];if(e.params&&!k1(e)){let t=[];for(let r of e.params)B1(r)?n.push(r):t.push(r);e.params=t}return t.selections=n,super.map(e,t)}mapUnit(e,t){let n=t.selections;if(!n||!n.length)return e;let r=(t.path??[]).concat(e.name),i=[];for(let t of n)if(!t.views||!t.views.length)i.push(t);else for(let n of t.views)(vg(n)&&(n===e.name||r.includes(n))||W(n)&&n.map(e=>r.indexOf(e)).every((e,t,n)=>e!==-1&&(t===0||e>n[t-1])))&&i.push(t);return i.length&&(e.params=i),e}};for(let e of[`mapFacet`,`mapRepeat`,`mapHConcat`,`mapVConcat`,`mapLayer`]){let t=T3.prototype[e];T3.prototype[e]=function(e,n){return t.call(this,e,uPe(e,n))}}GBe=new UBe,KBe=new WBe,qBe=new T3,JBe=[`background`,`padding`],E3=class e{explicit;implicit;constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new e(h2(this.explicit),h2(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(e){return pQ(this.explicit[e],this.implicit[e])}getWithExplicit(e){return this.explicit[e]===void 0?this.implicit[e]===void 0?{explicit:!1,value:void 0}:{explicit:!1,value:this.implicit[e]}:{explicit:!0,value:this.explicit[e]}}setWithExplicit(e,{value:t,explicit:n}){t!==void 0&&this.set(e,t,n)}set(e,t,n){return delete this[n?`implicit`:`explicit`][e],this[n?`explicit`:`implicit`][e]=t,this}copyKeyFromSplit(e,{explicit:t,implicit:n}){t[e]===void 0?n[e]!==void 0&&this.set(e,n[e],!1):this.set(e,t[e],!0)}copyKeyFromObject(e,t){t[e]!==void 0&&this.set(e,t[e],!0)}copyAll(e){for(let t of $(e.combine())){let n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}},YBe=class extends E3{explicit;implicit;parseNothing;constructor(e={},t={},n=!1){super(e,t),this.explicit=e,this.implicit=t,this.parseNothing=n}clone(){let e=super.clone();return e.parseNothing=this.parseNothing,e}},(function(e){e[e.Raw=0]=`Raw`,e[e.Main=1]=`Main`,e[e.Row=2]=`Row`,e[e.Column=3]=`Column`,e[e.Lookup=4]=`Lookup`,e[e.PreFilterInvalid=5]=`PreFilterInvalid`,e[e.PostFilterInvalid=6]=`PostFilterInvalid`})(D3||={}),O3=class{debugName;_children=[];_parent=null;_hash;constructor(e,t){this.debugName=t,e&&(this.parent=e)}clone(){throw Error(`Cannot clone node`)}get parent(){return this._parent}set parent(e){this._parent=e,e&&e.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(e,t){if(this._children.includes(e)){Z(Ize);return}t===void 0?this._children.push(e):this._children.splice(t,0,e)}removeChild(e){let t=this._children.indexOf(e);return this._children.splice(t,1),t}remove(){let e=this._parent.removeChild(this);for(let t of this._children)t._parent=this._parent,this._parent.addChild(t,e++)}insertAsParentOf(e){let t=e.parent;t.removeChild(this),this.parent=t,e.parent=this}swapWithParent(){let e=this._parent,t=e.parent;for(let t of this._children)t.parent=e;this._children=[],e.removeChild(this);let n=e.parent.removeChild(e);this._parent=t,t.addChild(this,n),e.parent=this}},k3=class extends O3{type;refCounts;_source;_name;clone(){let e=new this.constructor;return e.debugName=`clone_${this.debugName}`,e._source=this._source,e._name=`clone_${this._name}`,e.type=this.type,e.refCounts=this.refCounts,e.refCounts[e._name]=0,e}constructor(e,t,n,r){super(e,t),this.type=n,this.refCounts=r,this._source=this._name=t,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}dependentFields(){return new Set}producedFields(){return new Set}hash(){return this._hash===void 0&&(this._hash=`Output ${mQ()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}},A3=class e extends O3{timeUnits;clone(){return new e(null,h2(this.timeUnits))}constructor(e,t){super(e),this.timeUnits=t}static makeFromEncoding(t,n){let r=n.reduceFieldDef((e,t,r)=>{let{field:i,timeUnit:a}=t;if(a){let o;if(g$(a)){if(r2(n)){let{mark:e,markDef:r,config:s}=n,c=t1({fieldDef:t,markDef:r,config:s});(I$(e)||c)&&(o={timeUnit:y$(a),field:i})}}else o={as:m1(t,{forAs:!0}),field:i,timeUnit:a};if(r2(n)){let{mark:e,markDef:i,config:a}=n,s=t1({fieldDef:t,markDef:i,config:a});I$(e)&&NQ(r)&&s!==.5&&(o.rectBandPosition=s)}o&&(e[VZ(o)]=o)}return e},{});return QZ(r)?null:new e(t,r)}static makeFromTransform(t,n){let{timeUnit:r,...i}={...n},a=y$(r),o={...i,timeUnit:a};return new e(t,{[VZ(o)]:o})}merge(e){this.timeUnits={...this.timeUnits};for(let t in e.timeUnits)this.timeUnits[t]||(this.timeUnits[t]=e.timeUnits[t]);for(let t of e.children)e.removeChild(t),t.parent=this;e.remove()}removeFormulas(e){let t={};for(let[n,r]of _2(this.timeUnits)){let i=l0(r)?r.as:`${r.field}_end`;e.has(i)||(t[n]=r)}this.timeUnits=t}producedFields(){return new Set(g2(this.timeUnits).map(e=>l0(e)?e.as:wPe(e.field)))}dependentFields(){return new Set(g2(this.timeUnits).map(e=>e.field))}hash(){return`TimeUnit ${VZ(this.timeUnits)}`}assemble(){let e=[];for(let t of g2(this.timeUnits)){let{rectBandPosition:n}=t,r=y$(t.timeUnit);if(l0(t)){let{field:i,as:a}=t,{unit:o,utc:s,...c}=r,l=[a,`${a}_end`];e.push({field:lQ(i),type:`timeunit`,...o?{units:v$(o)}:{},...s?{timezone:`utc`}:{},...c,as:l}),e.push(...EPe(l,n,r))}else if(t){let{field:i}=t,a=cQ(i),o=TPe({timeUnit:r,field:a}),s=wPe(a);e.push({type:`formula`,expr:o,as:s}),e.push(...EPe([a,s],n,r))}}return e}},j3=`offsetted_rect_start`,M3=`offsetted_rect_end`,N3=`_tuple_fields`,XBe=class{hasChannel;hasField;hasSelectionId;timeUnit;items;constructor(...e){this.items=e,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}},ZBe={defined:()=>!0,parse:(e,t,n)=>{let r=t.name,i=t.project??=new XBe,a={},o={},s=new Set,c=(e,t)=>{let n=t===`visual`?e.channel:e.field,i=tQ(`${r}_${n}`);for(let e=1;s.has(i);e++)i=tQ(`${r}_${n}_${e}`);return s.add(i),{[t]:i}},l=t.type,u=e.config.selection[l],d=n.value===void 0?null:Qh(n.value),{fields:f,encodings:p}=jh(n.select)?n.select:{};if(!f&&!p&&d){for(let e of d)if(jh(e))for(let t of $(e))kke(t)?(p||=[]).push(t):l===`interval`?(Z(Nze),p=u.encodings):(f??=[]).push(t)}!f&&!p&&(p=u.encodings,`fields`in u&&(f=u.fields));for(let t of p??[]){let n=e.fieldDef(t);if(n){let r=n.field;if(n.aggregate){Z(tAe(t,n.aggregate));continue}else if(!r){Z(eAe(t));continue}if(n.timeUnit&&!g$(n.timeUnit)){r=e.vgField(t);let i={timeUnit:n.timeUnit,as:r,field:n.field};o[VZ(i)]=i}if(!a[r]){let o=l===`interval`&&LQ(t)&&j$(e.getScaleComponent(t).get(`type`))?`R`:n.bin?`R-RE`:`E`,s={field:r,channel:t,type:o,index:i.items.length};s.signals={...c(s,`data`),...c(s,`visual`)},i.items.push(a[r]=s),i.hasField[r]=a[r],i.hasSelectionId=i.hasSelectionId||r===_3,CQ(t)?(s.geoChannel=t,s.channel=SQ(t),i.hasChannel[s.channel]=a[r]):i.hasChannel[t]=a[r]}}else Z(eAe(t))}for(let e of f??[]){if(i.hasField[e])continue;let t={type:`E`,field:e,index:i.items.length};t.signals={...c(t,`data`)},i.items.push(t),i.hasField[e]=t,i.hasSelectionId=i.hasSelectionId||e===_3}d&&(t.init=d.map(e=>i.items.map(t=>jh(e)?e[t.geoChannel||t.channel]===void 0?e[t.field]:e[t.geoChannel||t.channel]:e))),QZ(o)||(i.timeUnit=new A3(null,o))},signals:(e,t,n)=>{let r=t.name+N3;return n.filter(e=>e.name===r).length>0||t.project.hasSelectionId?n:n.concat({name:r,value:t.project.items.map(OPe)})}},P3=`_curr`,F3=`anim_value`,I3=`anim_clock`,L3=`eased_anim_clock`,R3=`min_extent`,z3=`max_range_extent`,B3=`last_tick_at`,V3=`is_playing`,QBe=1/60*1e3,$Be=(e,t)=>[{name:L3,update:I3},{name:`${e}_domain`,init:`domain('${t}')`},{name:R3,init:`extent(${e}_domain)[0]`},{name:z3,init:`extent(range('${t}'))[1]`},{name:F3,update:`invert('${t}', ${L3})`}],eVe={defined:e=>e.type===`point`,topLevelSignals:(e,t,n)=>(O0(t)&&(n=n.concat([{name:I3,init:`0`,on:[{events:{type:`timer`,throttle:QBe},update:`${V3} ? (${I3} + (now() - ${B3}) > ${z3} ? 0 : ${I3} + (now() - ${B3})) : ${I3}`}]},{name:B3,init:`now()`,on:[{events:[{signal:I3},{signal:V3}],update:`now()`}]},{name:V3,init:`true`}])),n),signals:(e,t,n)=>{let r=t.name,i=r+N3,a=t.project,o=`(item().isVoronoi ? datum.datum : datum)`,s=g2(e.component.selection??{}).reduce((e,t)=>t.type===`interval`?e.concat(t.name+U3):e,[]).map(e=>`indexof(item().mark.name, '${e}') < 0`).join(` && `),c=`datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0${s?` && ${s}`:``}`,l=`unit: ${E0(e)}, `;if(t.project.hasSelectionId)l+=`${_3}: ${o}[${G(_3)}]`;else if(O0(t))l+=`fields: ${i}, values: [${F3} ? ${F3} : ${R3}]`;else{let t=a.items.map(t=>e.fieldDef(t.channel)?.bin?`[${o}[${G(e.vgField(t.channel,{}))}], ${o}[${G(e.vgField(t.channel,{binSuffix:`end`}))}]]`:`${o}[${G(t.field)}]`).join(`, `);l+=`fields: ${i}, values: [${t}]`}if(O0(t))return n.concat($Be(t.name,e.scaleName(L2)),[{name:r+i6,on:[{events:[{signal:L3},{signal:F3}],update:`{${l}}`,force:!0}]}]);{let e=t.events;return n.concat([{name:r+i6,on:e?[{events:e,update:`${c} ? {${l}} : null`,force:!0}]:[]}])}}},H3={defined:e=>e.type===`interval`&&e.resolve===`global`&&e.bind&&e.bind===`scales`,parse:(e,t)=>{let n=t.scales=[];for(let r of t.project.items){let i=r.channel;if(!LQ(i))continue;let a=e.getScaleComponent(i),o=a?a.get(`type`):void 0;if(o==`sequential`&&Z(Aze),!a||!j$(o)){Z(kze);continue}a.set(`selectionExtent`,{param:t.name,field:r.field},!0),n.push(r)}},topLevelSignals:(e,t,n)=>{let r=t.scales.filter(e=>n.filter(t=>t.name===e.signals.data).length===0);if(!e.parent||p0(e)||r.length===0)return n;let i=n.find(e=>e.name===t.name),a=i.update;if(a.includes(a6))i.update=`{${r.map(e=>`${G(lQ(e.field))}: ${e.signals.data}`).join(`, `)}}`;else{for(let e of r){let t=`${G(lQ(e.field))}: ${e.signals.data}`;a.includes(t)||(a=`${a.substring(0,a.length-1)}, ${t}}`)}i.update=a}return n.concat(r.map(e=>({name:e.signals.data})))},signals:(e,t,n)=>{if(e.parent&&!p0(e))for(let e of t.scales){let t=n.find(t=>t.name===e.signals.data);t.push=`outer`,delete t.value,delete t.update}return n}},U3=`_brush`,W3=`_scale_trigger`,G3=`geo_interval_init_tick`,K3=`_init`,tVe=`_center`,nVe={defined:e=>e.type===`interval`,parse:(e,t,n)=>{if(e.hasProjection){let e={...jh(n.select)?n.select:{}};e.fields=[_3],e.encodings||=n.value?$(n.value):[P2,N2],n.select={type:`interval`,...e}}if(t.translate&&!H3.defined(t)){let e=`!event.item || event.item.mark.name !== ${G(t.name+U3)}`;for(let n of t.events){if(!n.between){Z(`${n} is not an ordered event stream for interval selections.`);continue}let t=Qh(n.between[0].filter??=[]);t.includes(e)||t.push(e)}}},signals:(e,t,n)=>{let r=t.name,i=r+i6,a=g2(t.project.hasChannel).filter(e=>e.channel===C2||e.channel===w2),o=t.init?t.init[0]:null;if(n.push(...a.reduce((n,r)=>n.concat(IPe(e,t,r,o?.[r.index])),[])),e.hasProjection){let s=G(e.projectionName()),c=e.projectionName()+tVe,{x:l,y:u}=t.project.hasChannel,d=l?.signals.visual,f=u?.signals.visual,p=l?o?.[l.index]:`${c}[0]`,m=u?o?.[u.index]:`${c}[1]`,h=t=>e.getSizeSignalRef(t).signal,g=`[[${d?`${d}[0]`:`0`}, ${f?`${f}[0]`:`0`}],[${d?`${d}[1]`:h(`width`)}, ${f?`${f}[1]`:h(`height`)}]]`;o&&(n.unshift({name:r+K3,init:`[scale(${s}, [${l?p[0]:p}, ${u?m[0]:m}]), scale(${s}, [${l?p[1]:p}, ${u?m[1]:m}])]`}),(!l||!u)&&(n.find(e=>e.name===c)||n.unshift({name:c,update:`invert(${s}, [${h(`width`)}/2, ${h(`height`)}/2])`})));let _=`vlSelectionTuples(${`intersect(${g}, {markname: ${G(e.getName(`marks`))}}, unit.mark)`}, ${`{unit: ${E0(e)}}`})`,v=a.map(e=>e.signals.visual);return n.concat({name:i,on:[{events:[...v.length?[{signal:v.join(` || `)}]:[],...o?[{signal:G3}]:[]],update:_}]})}else{if(!H3.defined(t)){let t=r+W3,i=a.map(t=>{let n=t.channel,{data:r,visual:i}=t.signals,a=G(e.scaleName(n)),o=j$(e.getScaleComponent(n).get(`type`))?`+`:``;return`(!isArray(${r}) || (${o}invert(${a}, ${i})[0] === ${o}${r}[0] && ${o}invert(${a}, ${i})[1] === ${o}${r}[1]))`});i.length&&n.push({name:t,value:{},on:[{events:a.map(t=>({scale:e.scaleName(t.channel)})),update:`${i.join(` && `)} ? ${t} : {}`}]})}let s=a.map(e=>e.signals.data),c=`unit: ${E0(e)}, fields: ${r+N3}, values`;return n.concat({name:i,...o?{init:`{${c}: ${u0(o)}}`}:{},...s.length?{on:[{events:[{signal:s.join(` || `)}],update:`${s.join(` && `)} ? {${c}: [${s}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>(r2(e)&&e.hasProjection&&t.init&&(n.filter(e=>e.name===G3).length||n.unshift({name:G3,value:null,on:[{events:`timer{1}`,update:`${G3} === null ? {} : ${G3}`}]})),n),marks:(e,t,n)=>{let r=t.name,{x:i,y:a}=t.project.hasChannel,o=i?.signals.visual,s=a?.signals.visual,c=`data(${G(t.name+r6)})`;if(H3.defined(t)||!i&&!a)return n;let l={x:i===void 0?{value:0}:{signal:`${o}[0]`},y:a===void 0?{value:0}:{signal:`${s}[0]`},x2:i===void 0?{field:{group:`width`}}:{signal:`${o}[1]`},y2:a===void 0?{field:{group:`height`}}:{signal:`${s}[1]`}};if(t.resolve===`global`)for(let t of $(l))l[t]=[{test:`${c}.length && ${c}[0].unit === ${E0(e)}`,...l[t]},{value:0}];let{fill:u,fillOpacity:d,cursor:f,...p}=t.mark,m=$(p).reduce((e,t)=>(e[t]=[{test:[i!==void 0&&`${o}[0] !== ${o}[1]`,a!==void 0&&`${s}[0] !== ${s}[1]`].filter(e=>e).join(` && `),value:p[t]},{value:null}],e),{}),h=f??(t.translate?`move`:null);return[{name:`${r+U3}_bg`,type:`rect`,clip:!0,encode:{enter:{fill:{value:u},fillOpacity:{value:d}},update:l}},...n,{name:r+U3,type:`rect`,clip:!0,encode:{enter:{...h?{cursor:{value:h}}:{},fill:{value:`transparent`}},update:{...l,...m}}}]}},rVe={left:`x`,center:`xc`,right:`x2`},iVe={top:`y`,middle:`yc`,bottom:`y2`},aVe=new Set([`aria`,`width`,`height`]),q3=`voronoi`,J3={defined:e=>e.type===`point`&&e.nearest,parse:(e,t)=>{if(t.events)for(let n of t.events)n.markname=e.getName(q3)},marks:(e,t,n)=>{let{x:r,y:i}=t.project.hasChannel,a=e.mark;if(F$(a))return Z(nAe(a)),n;let o={name:e.getName(q3),type:`path`,interactive:!0,aria:!1,from:{data:e.getName(`marks`)},encode:{update:{fill:{value:`transparent`},strokeWidth:{value:.35},stroke:{value:`transparent`},isVoronoi:{value:!0},...LPe(e,{reactiveGeom:!0})}},transform:[{type:`voronoi`,x:{expr:r||!i?`datum.datum.x || 0`:`0`},y:{expr:i||!r?`datum.datum.y || 0`:`0`},size:[e.getSizeSignalRef(`width`),e.getSizeSignalRef(`height`)]}]},s=0,c=!1;return n.forEach((t,n)=>{let r=t.name??``;r===e.component.mark[0].name?s=n:r.includes(q3)&&(c=!0)}),c||n.splice(s+1,0,o),n}},Y3={defined:e=>e.type===`point`&&e.resolve===`global`&&e.bind&&e.bind!==`scales`&&!R1(e.bind),parse:(e,t,n)=>uFe(t,n),topLevelSignals:(e,t,n)=>{let r=t.name,i=t.project,a=t.bind,o=t.init?.[0],s=J3.defined(t)?`(item().isVoronoi ? datum.datum : datum)`:`datum`;return i.items.forEach((e,i)=>{let c=tQ(`${r}_${e.field}`);n.filter(e=>e.name===c).length||n.unshift({name:c,...o?{init:u0(o[i])}:{value:null},on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${s}[${G(e.field)}] : null`}]:[],bind:a[e.field]??a[e.channel]??a})}),n},signals:(e,t,n)=>{let r=t.name,i=t.project,a=n.find(e=>e.name===r+i6),o=r+N3,s=i.items.map(e=>tQ(`${r}_${e.field}`)),c=s.map(e=>`${e} !== null`).join(` && `);return s.length&&(a.update=`${c} ? {fields: ${o}, values: [${s.join(`, `)}]} : null`),delete a.value,delete a.on,n}},X3=`_toggle`,Z3={defined:e=>e.type===`point`&&!O0(e)&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+X3,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{let n=t.name+i6,r=t.name+X3;return`${r} ? null : ${n}, ${t.resolve===`global`?`${r} ? null : true, `:`${r} ? null : {unit: ${E0(e)}}, `}${r} ? ${n} : null`}},oVe={defined:e=>e.clear!==void 0&&e.clear!==!1&&!O0(e),parse:(e,t)=>{t.clear&&=vg(t.clear)?WG(t.clear,`view`):t.clear},topLevelSignals:(e,t,n)=>{if(Y3.defined(t))for(let e of t.project.items){let r=n.findIndex(n=>n.name===tQ(`${t.name}_${e.field}`));r!==-1&&n[r].on.push({events:t.clear,update:`null`})}return n},signals:(e,t,n)=>{function r(e,r){e!==-1&&n[e].on&&n[e].on.push({events:t.clear,update:r})}if(t.type===`interval`)for(let e of t.project.items){let t=n.findIndex(t=>t.name===e.signals.visual);r(t,`[0, 0]`),t===-1&&r(n.findIndex(t=>t.name===e.signals.data),`null`)}else{let e=n.findIndex(e=>e.name===t.name+i6);r(e,`null`),Z3.defined(t)&&(e=n.findIndex(e=>e.name===t.name+X3),r(e,`false`))}return n}},Q3={defined:e=>{let t=e.resolve===`global`&&e.bind&&R1(e.bind),n=e.project.items.length===1&&e.project.items[0].field!==_3;return t&&!n&&Z(jze),t&&n},parse:(e,t,n)=>{let r=h2(n);if(r.select=vg(r.select)?{type:r.select,toggle:t.toggle}:{...r.select,toggle:t.toggle},uFe(t,r),jh(n.select)&&(n.select.on||n.select.clear)){let e=`event.item && indexof(event.item.mark.role, "legend") < 0`;for(let n of t.events)n.filter=Qh(n.filter??[]),n.filter.includes(e)||n.filter.push(e)}let i=z1(t.bind)?t.bind.legend:`click`;t.bind={legend:{merge:vg(i)?WG(i,`view`):Qh(i)}}},topLevelSignals:(e,t,n)=>{let r=t.name,i=z1(t.bind)&&t.bind.legend,a=e=>t=>{let n=h2(t);return n.markname=e,n};for(let e of t.project.items){if(!e.hasLegend)continue;let o=`${tQ(e.field)}_legend`,s=`${r}_${o}`;if(n.filter(e=>e.name===s).length===0){let e=i.merge.map(a(`${o}_symbols`)).concat(i.merge.map(a(`${o}_labels`))).concat(i.merge.map(a(`${o}_entries`)));n.unshift({name:s,...t.init?{}:{value:null},on:[{events:e,update:`isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value`,force:!0},{events:i.merge,update:`!event.item || !datum ? null : ${s}`,force:!0}]})}}return n},signals:(e,t,n)=>{let r=t.name,i=t.project,a=n.find(e=>e.name===r+i6),o=r+N3,s=i.items.filter(e=>e.hasLegend).map(e=>tQ(`${r}_${tQ(e.field)}_legend`)),c=`${s.map(e=>`${e} !== null`).join(` && `)} ? {fields: ${o}, values: [${s.join(`, `)}]} : null`;t.events&&s.length>0?a.on.push({events:s.map(e=>({signal:e})),update:c}):s.length>0&&(a.update=c,delete a.value,delete a.on);let l=n.find(e=>e.name===r+X3),u=z1(t.bind)&&t.bind.legend;return l&&(t.events?l.on.push({...l.on[0],events:u}):l.on[0].events=u),n}},$3=`_translate_anchor`,e6=`_translate_delta`,sVe={defined:e=>e.type===`interval`&&e.translate,signals:(e,t,n)=>{let r=t.name,i=H3.defined(t),a=r+$3,{x:o,y:s}=t.project.hasChannel,c=WG(t.translate,`scope`);return i||(c=c.map(e=>(e.between[0].markname=r+U3,e))),n.push({name:a,value:{},on:[{events:c.map(e=>e.between[0]),update:`{x: x(unit), y: y(unit)${o===void 0?``:`, extent_x: ${i?f0(e,C2):`slice(${o.signals.visual})`}`}${s===void 0?``:`, extent_y: ${i?f0(e,w2):`slice(${s.signals.visual})`}`}}`}]},{name:r+e6,value:{},on:[{events:c,update:`{x: ${a}.x - x(unit), y: ${a}.y - y(unit)}`}]}),o!==void 0&&sFe(e,t,o,`width`,n),s!==void 0&&sFe(e,t,s,`height`,n),n}},t6=`_zoom_anchor`,n6=`_zoom_delta`,cVe={defined:e=>e.type===`interval`&&e.zoom,signals:(e,t,n)=>{let r=t.name,i=H3.defined(t),a=r+n6,{x:o,y:s}=t.project.hasChannel,c=G(e.scaleName(C2)),l=G(e.scaleName(w2)),u=WG(t.zoom,`scope`);return i||(u=u.map(e=>(e.markname=r+U3,e))),n.push({name:r+t6,on:[{events:u,update:i?`{${[c?`x: invert(${c}, x(unit))`:``,l?`y: invert(${l}, y(unit))`:``].filter(e=>e).join(`, `)}}`:`{x: x(unit), y: y(unit)}`}]},{name:a,on:[{events:u,force:!0,update:`pow(1.001, event.deltaY * pow(16, event.deltaMode))`}]}),o!==void 0&&cFe(e,t,o,`width`,n),s!==void 0&&cFe(e,t,s,`height`,n),n}},r6=`_store`,i6=`_tuple`,lVe=`_modify`,a6=`vlSelectionResolve`,o6=[eVe,nVe,ZBe,Z3,Y3,H3,Q3,oVe,sVe,cVe,J3],s6=class e extends O3{model;filter;expr;_dependentFields;clone(){return new e(null,this.model,h2(this.filter))}constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=A0(this.model,this.filter,this),this._dependentFields=fFe(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:`filter`,expr:this.expr}}hash(){return`Filter ${this.expr}`}},c6={scale:({model:e,channel:t})=>e.scaleName(t),format:({format:e})=>e,formatType:({formatType:e})=>e,grid:({fieldOrDatumDef:e,axis:t,scaleType:n})=>t.grid??CFe(n,e),gridScale:({model:e,channel:t})=>wFe(e,t),labelAlign:({axis:e,labelAngle:t,orient:n,channel:r})=>e.labelAlign||DFe(t,n,r),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:r})=>e.labelBaseline||EFe(t,n,r),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>e.labelFlush??OFe(t.type,n),labelOverlap:({axis:e,fieldOrDatumDef:t,scaleType:n})=>e.labelOverlap??kFe(t.type,n,Q(t)&&!!t.timeUnit,Q(t)?t.sort:void 0),orient:({orient:e})=>e,tickCount:({channel:e,model:t,axis:n,fieldOrDatumDef:r,scaleType:i})=>{let a=e===`x`?`width`:e===`y`?`height`:void 0,o=a?t.getSizeSignalRef(a):void 0;return n.tickCount??jFe({fieldOrDatumDef:r,scaleType:i,size:o,values:n.values})},tickMinStep:({axis:e,format:t,fieldOrDatumDef:n})=>e.tickMinStep??MFe({format:t,fieldOrDatumDef:n}),title:({axis:e,model:t,channel:n})=>{if(e.title!==void 0)return e.title;let r=NFe(t,n);if(r!==void 0)return r;let i=t.typedFieldDef(n),a=n===`x`?`x2`:`y2`,o=t.fieldDef(a);return Jke(i?[cMe(i)]:[],Q(o)?[cMe(o)]:[])},values:({axis:e,fieldOrDatumDef:t})=>PFe(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>e.zindex??FFe(n,t)},l6=class e extends O3{transform;_dependentFields;clone(){return new e(null,h2(this.transform))}constructor(e,t){super(e),this.transform=t,this._dependentFields=fFe(this.transform.calculate)}static parseAllForSortIndex(t,n){return n.forEachFieldDef((n,r)=>{if(f1(n)&&aMe(n.sort)){let{field:i,timeUnit:a}=n,o=n.sort,s=o.map((e,t)=>`${Eje({field:i,timeUnit:a,equal:e})} ? ${t} : `).join(``)+o.length;t=new e(t,{calculate:s,as:F0(n,r,{forAs:!0})})}}),t}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:`formula`,expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${VZ(this.transform)}`}},u6=[`row`,`column`],d6=[`header`,`footer`],uVe={column:{start:0,end:1},row:{start:1,end:0}},f6=$({...ABe,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1}),dVe=class extends E3{},p6={symbols:XFe,gradient:ZFe,labels:QFe,entries:$Fe},m6={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{let{format:r,formatType:i}=t;return Zje(e,e.type,r,i,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{let{formatType:r}=e;return Qje(r,t,n)},gradientLength:e=>{let{legend:t,legendConfig:n}=e;return t.gradientLength??n.gradientLength??lIe(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>e.labelOverlap??t.labelOverlap??dIe(n),symbolType:({legend:e,markDef:t,channel:n,encoding:r})=>e.symbolType??iIe(t.type,n,r.shape,t.shape),title:({fieldOrDatumDef:e,config:t})=>g1(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(wQ(n)&&M$(t)){if(e===`gradient`)return}else if(e===`symbol`)return;return e},values:({fieldOrDatumDef:e,legend:t})=>rIe(t,e)},h6=class e extends O3{bins;clone(){return new e(null,h2(this.bins))}constructor(e,t){super(e),this.bins=t}static makeFromEncoding(t,n){let r=n.reduceFieldDef((e,t,r)=>{if(u1(t)&&WQ(t.bin)){let{key:i,binComponent:a}=wIe(t,t.bin,n);e[i]={...a,...e[i],...bIe(n,t,r,n.config)}}return e},{});return QZ(r)?null:new e(t,r)}static makeFromTransform(t,n,r){let{key:i,binComponent:a}=wIe(n,n.bin,r);return new e(t,{[i]:a})}merge(e,t){for(let n of $(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=qZ([...this.bins[n].as,...e.bins[n].as],VZ)):this.bins[n]=e.bins[n];for(let t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(g2(this.bins).map(e=>e.as).flat(2))}dependentFields(){return new Set(g2(this.bins).map(e=>e.field))}hash(){return`Bin ${VZ(this.bins)}`}assemble(){return g2(this.bins).flatMap(e=>{let t=[],[n,...r]=e.as,{extent:i,...a}=e.bin,o={type:`bin`,field:lQ(e.field),as:n,signal:e.signal,...qQ(i)?{extent:null}:{extent:i},...e.span?{span:{signal:`span(${e.span})`}}:{},...a};!i&&e.extentSignal&&(t.push({type:`extent`,field:lQ(e.field),signal:e.extentSignal}),o.extent={signal:e.extentSignal}),t.push(o);for(let e of r)for(let r=0;r<2;r++)t.push({type:`formula`,expr:m1({field:n[r]},{expr:`datum`}),as:e[r]});return e.formula&&t.push({type:`formula`,expr:e.formula,as:e.formulaAs}),t})}},g6=class e extends O3{dimensions;measures;clone(){return new e(null,new Set(this.dimensions),h2(this.measures))}constructor(e,t,n){super(e),this.dimensions=t,this.measures=n}get groupBy(){return this.dimensions}static makeFromEncoding(t,n){let r=!1;n.forEachFieldDef(e=>{e.aggregate&&(r=!0)});let i={},a=new Set;return!r||(n.forEachFieldDef((e,t)=>{let{aggregate:r,field:o}=e;if(r)if(r===`count`)i[`*`]??={},i[`*`].count=new Set([m1(e,{forAs:!0})]);else{if(zQ(r)||BQ(r)){let e=zQ(r)?`argmin`:`argmax`,t=r[e];i[t]??={},i[t][e]=new Set([m1({op:e,field:t},{forAs:!0})])}else i[o]??={},i[o][r]=new Set([m1(e,{forAs:!0})]);LQ(t)&&n.scaleDomain(t)===`unaggregated`&&(i[o]??={},i[o].min=new Set([m1({field:o,aggregate:`min`},{forAs:!0})]),i[o].max=new Set([m1({field:o,aggregate:`max`},{forAs:!0})]))}else TIe(a,t,e,n)}),a.size+$(i).length===0)?null:new e(t,a,i)}static makeFromTransform(t,n){let r=new Set,i={};for(let e of n.aggregate){let{op:t,field:n,as:r}=e;t&&(t===`count`?(i[`*`]??={},i[`*`].count=new Set([r||m1(e,{forAs:!0})])):(i[n]??={},i[n][t]??=new Set,i[n][t].add(r||m1(e,{forAs:!0}))))}for(let e of n.groupby??[])r.add(e);return r.size+$(i).length===0?null:new e(t,r,i)}merge(e){return JZ(this.dimensions,e.dimensions)?(EIe(this.measures,e.measures),!0):(ije(`different dimensions, cannot merge`),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...$(this.measures)])}producedFields(){let e=new Set;for(let t of $(this.measures))for(let n of $(this.measures[t])){let r=this.measures[t][n];r.size===0?e.add(`${n}_${t}`):r.forEach(e.add,e)}return e}hash(){return`Aggregate ${VZ({dimensions:this.dimensions,measures:this.measures})}`}assemble(){let e=[],t=[],n=[];for(let r of $(this.measures))for(let i of $(this.measures[r]))for(let a of this.measures[r][i])n.push(a),e.push(i),t.push(r===`*`?null:lQ(r));return{type:`aggregate`,groupby:[...this.dimensions].map(lQ),ops:e,fields:t,as:n}}},_6=class extends O3{model;name;data;column;row;facet;childModel;constructor(e,t,n,r){super(e),this.model=t,this.name=n,this.data=r;for(let e of s4){let n=t.facet[e];if(n){let{bin:r,sort:i}=n;this[e]={name:t.getName(`${e}_domain`),fields:[m1(n),...WQ(r)?[m1(n,{binSuffix:`end`})]:[]],...X$(i)?{sortField:i}:W(i)?{sortIndexField:F0(n,e)}:{}}}}this.childModel=t.child}hash(){let e=`Facet`;for(let t of s4)this[t]&&(e+=` ${t.charAt(0)}:${VZ(this[t])}`);return e}get fields(){let e=[];for(let t of s4)this[t]?.fields&&e.push(...this[t].fields);return e}dependentFields(){let e=new Set(this.fields);for(let t of s4)this[t]&&(this[t].sortField&&e.add(this[t].sortField.field),this[t].sortIndexField&&e.add(this[t].sortIndexField));return e}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){let e={};for(let t of d4){let n=this.childModel.component.scales[t];if(n&&!n.merged){let r=n.get(`type`),i=n.get(`range`);if(A$(r)&&QQ(i)){let n=e2(t2(this.childModel,t));n?e[t]=n:Z(s$(t))}}}return e}assembleRowColumnHeaderData(e,t,n){let r={row:`y`,column:`x`,facet:void 0}[e],i=[],a=[],o=[];r&&n&&n[r]&&(t?(i.push(`distinct_${n[r]}`),a.push(`max`)):(i.push(n[r]),a.push(`distinct`)),o.push(`distinct_${n[r]}`));let{sortField:s,sortIndexField:c}=this[e];if(s){let{op:e=e3,field:t}=s;i.push(t),a.push(e),o.push(m1(s,{forAs:!0}))}else c&&(i.push(c),a.push(`max`),o.push(c));return{name:this[e].name,source:t??this.data,transform:[{type:`aggregate`,groupby:this[e].fields,...i.length?{fields:i,ops:a,as:o}:{}}]}}assembleFacetHeaderData(e){let{columns:t}=this.model.layout,{layoutHeaders:n}=this.model.component,r=[],i={};for(let e of u6){for(let t of d6){let r=n[e]?.[t]??[];for(let t of r)if(t.axes?.length>0){i[e]=!0;break}}if(i[e]){let n=`length(data("${this.facet.name}"))`,i=e===`row`?t?{signal:`ceil(${n} / ${t})`}:1:t?{signal:`min(${n}, ${t})`}:{signal:n};r.push({name:`${this.facet.name}_${e}`,transform:[{type:`sequence`,start:0,stop:i}]})}}let{row:a,column:o}=i;return(a||o)&&r.unshift(this.assembleRowColumnHeaderData(`facet`,null,e)),r}assemble(){let e=[],t=null,n=this.getChildIndependentFieldsWithStep(),{column:r,row:i,facet:a}=this;if(r&&i&&(n.x||n.y)){t=`cross_${this.column.name}_${this.row.name}`;let r=[].concat(n.x??[],n.y??[]),i=r.map(()=>`distinct`);e.push({name:t,source:this.data,transform:[{type:`aggregate`,groupby:this.fields,fields:r,ops:i}]})}for(let r of[x2,b2])this[r]&&e.push(this.assembleRowColumnHeaderData(r,t,n));if(a){let t=this.assembleFacetHeaderData(n);t&&e.push(...t)}return e}},v6=class e extends O3{_parse;clone(){return new e(null,h2(this._parse))}constructor(e,t){super(e),this._parse=t}hash(){return`Parse ${VZ(this._parse)}`}static makeExplicit(e,t,n){let r={},i=t.data;return!s0(i)&&i?.format?.parse&&(r=i.format.parse),this.makeWithAncestors(e,r,{},n)}static makeWithAncestors(t,n,r,i){for(let e of $(r)){let t=i.getWithExplicit(e);t.value!==void 0&&(t.explicit||t.value===r[e]||t.value===`derived`||r[e]===`flatten`?delete r[e]:Z(fAe(e,r[e],t.value)))}for(let e of $(n)){let t=i.get(e);t!==void 0&&(t===n[e]?delete n[e]:Z(fAe(e,n[e],t)))}let a=new E3(n,r);i.copyAll(a);let o={};for(let e of $(a.combine())){let t=a.get(e);t!==null&&(o[e]=t)}return $(o).length===0||i.parseNothing?null:new e(t,o)}get parse(){return this._parse}merge(e){this._parse={...this._parse,...e.parse},e.remove()}assembleFormatParse(){let e={};for(let t of $(this._parse)){let n=this._parse[t];fQ(t)===1&&(e[t]=n)}return e}producedFields(){return new Set($(this._parse))}dependentFields(){return new Set($(this._parse))}assembleTransforms(e=!1){return $(this._parse).filter(t=>!e||fQ(t)>1).map(e=>{let t=OIe(e,this._parse[e]);return t?{type:`formula`,expr:t,as:dQ(e)}:null}).filter(e=>e!==null)}},y6=class e extends O3{clone(){return new e(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([_3])}hash(){return`Identifier`}assemble(){return{type:`identifier`,as:_3}}},b6=class e extends O3{params;clone(){return new e(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${VZ(this.params)}`}assemble(){return{type:`graticule`,...this.params===!0?{}:this.params}}},x6=class e extends O3{params;clone(){return new e(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??`data`])}hash(){return`Hash ${VZ(this.params)}`}assemble(){return{type:`sequence`,...this.params}}},S6=class extends O3{_data;_name;_generator;constructor(e){super(null),e??={name:`source`};let t;if(s0(e)||(t=e.format?{...BZ(e.format,[`parse`])}:{}),o0(e))this._data={values:e.values};else if(a0(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];UZ([`json`,`csv`,`tsv`,`dsv`,`topojson`],n)||(n=`json`),t.type=n}}else xPe(e)?this._data={values:[{type:`Sphere`}]}:(yPe(e)||s0(e))&&(this._data={});this._generator=s0(e),e.name&&(this._name=e.name),t&&!QZ(t)&&(this._data.format=t)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(e){this._name=e}set parent(e){throw Error(`Source nodes have to be roots.`)}remove(){throw Error(`Source nodes are roots and cannot be removed.`)}hash(){throw Error(`Cannot hash sources`)}assemble(){return{name:this._name,...this._data,transform:[]}}},C6=class{#e;constructor(){this.#e=!1}setModified(){this.#e=!0}get modifiedFlag(){return this.#e}},w6=class extends C6{getNodeDepths(e,t,n){n.set(e,t);for(let r of e.children)this.getNodeDepths(r,t+1,n);return n}optimize(e){let t=[...this.getNodeDepths(e,0,new Map).entries()].sort((e,t)=>t[1]-e[1]);for(let e of t)this.run(e[0]);return this.modifiedFlag}},T6=class extends C6{optimize(e){this.run(e);for(let t of e.children)this.optimize(t);return this.modifiedFlag}},fVe=class extends T6{mergeNodes(e,t){let n=t.shift();for(let r of t)e.removeChild(r),r.parent=n,r.remove()}run(e){let t=e.children.map(e=>e.hash()),n={};for(let r=0;r1&&(this.setModified(),this.mergeNodes(e,n[t]))}},pVe=class extends T6{requiresSelectionId;constructor(e){super(),this.requiresSelectionId=e&&D0(e)}run(e){e instanceof y6&&(this.requiresSelectionId&&(G0(e.parent)||e.parent instanceof g6||e.parent instanceof v6)||(this.setModified(),e.remove()))}},mVe=class extends C6{optimize(e){return this.run(e,new Set),this.modifiedFlag}run(e,t){let n=new Set;e instanceof A3&&(n=e.producedFields(),YZ(n,t)&&(this.setModified(),e.removeFormulas(t),e.producedFields.length===0&&e.remove()));for(let r of e.children)this.run(r,new Set([...t,...n]))}},hVe=class extends T6{constructor(){super()}run(e){e instanceof k3&&!e.isRequired()&&(this.setModified(),e.remove())}},gVe=class extends w6{run(e){if(!G0(e)&&!(e.numChildren()>1)){for(let t of e.children)if(t instanceof v6)if(e instanceof v6)this.setModified(),e.merge(t);else{if(ZZ(e.producedFields(),t.dependentFields()))continue;this.setModified(),t.swapWithParent()}}}},_Ve=class extends w6{run(e){let t=[...e.children],n=e.children.filter(e=>e instanceof v6);if(e.numChildren()>1&&n.length>=1){let r={},i=new Set;for(let e of n){let t=e.parse;for(let e of $(t))e in r?r[e]!==t[e]&&i.add(e):r[e]=t[e]}for(let e of i)delete r[e];if(!QZ(r)){this.setModified();let n=new v6(e,r);for(let i of t){if(i instanceof v6)for(let e of $(r))delete i.parse[e];e.removeChild(i),i.parent=n,i instanceof v6&&$(i.parse).length===0&&i.remove()}}}}},vVe=class extends w6{run(e){e instanceof k3||e.numChildren()>0||e instanceof _6||e instanceof S6||(this.setModified(),e.remove())}},yVe=class extends w6{run(e){let t=e.children.filter(e=>e instanceof A3),n=t.pop();for(let e of t)this.setModified(),n.merge(e)}},bVe=class extends w6{run(e){let t=e.children.filter(e=>e instanceof g6),n={};for(let e of t){let t=VZ(e.groupBy);t in n||(n[t]=[]),n[t].push(e)}for(let t of $(n)){let r=n[t];if(r.length>1){let t=r.pop();for(let n of r)t.merge(n)&&(e.removeChild(n),n.parent=t,n.remove(),this.setModified())}}}},xVe=class extends w6{model;constructor(e){super(),this.model=e}run(e){let t=!(G0(e)||e instanceof s6||e instanceof v6||e instanceof y6),n=[],r=[];for(let i of e.children)i instanceof h6&&(t&&!ZZ(e.producedFields(),i.dependentFields())?n.push(i):r.push(i));if(n.length>0){let t=n.pop();for(let e of n)t.merge(e,this.model.renameSignal.bind(this.model));this.setModified(),e instanceof h6?e.merge(t,this.model.renameSignal.bind(this.model)):t.swapWithParent()}if(r.length>1){let e=r.pop();for(let t of r)e.merge(t,this.model.renameSignal.bind(this.model));this.setModified()}}},SVe=class extends w6{run(e){let t=[...e.children];if(!WZ(t,e=>e instanceof k3)||e.numChildren()<=1)return;let n=[],r;for(let i of t)if(i instanceof k3){let t=i;for(;t.numChildren()===1;){let[e]=t.children;if(e instanceof k3)t=e;else break}n.push(...t.children),r?(e.removeChild(i),i.parent=r.parent,r.parent.removeChild(r),r.parent=t,this.setModified()):r=t}else n.push(i);if(n.length){this.setModified();for(let e of n)e.parent.removeChild(e),e.parent=r}}},E6=class e extends O3{transform;clone(){return new e(null,h2(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=qZ(this.transform.groupby.concat(e),e=>e)}dependentFields(){let e=new Set;return this.transform.groupby&&this.transform.groupby.forEach(e.add,e),this.transform.joinaggregate.map(e=>e.field).filter(e=>e!==void 0).forEach(e.add,e),e}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(e){return e.as??m1(e)}hash(){return`JoinAggregateTransform ${VZ(this.transform)}`}assemble(){let e=[],t=[],n=[];for(let r of this.transform.joinaggregate)t.push(r.op),n.push(this.getDefaultName(r)),e.push(r.field===void 0?null:r.field);let r=this.transform.groupby;return{type:`joinaggregate`,as:n,ops:t,fields:e,...r===void 0?{}:{groupby:r}}}},D6=class e extends O3{filter;clone(){return new e(null,{...this.filter})}constructor(e,t){super(e),this.filter=t}static make(t,n,r){let{config:i,markDef:a}=n,{marks:o,scales:s}=r;if(o===`include-invalid-values`&&s===`include-invalid-values`)return null;let c=n.reduceFieldDef((e,t,r)=>{let o=LQ(r)&&n.getScaleComponent(r);if(o){let n=o.get(`type`),{aggregate:s}=t,c=z$({scaleChannel:r,markDef:a,config:i,scaleType:n,isCountAggregate:HQ(s)});c!==`show`&&c!==`always-valid`&&(e[t.field]=t)}return e},{});return $(c).length?new e(t,c):null}dependentFields(){return new Set($(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${VZ(this.filter)}`}assemble(){let e=$(this.filter).reduce((e,t)=>{let n=this.filter[t],r=m1(n,{expr:`datum`});return n!==null&&(n.type===`temporal`?e.push(`(isDate(${r}) || (${K0(r)}))`):n.type===`quantitative`&&e.push(K0(r))),e},[]);return e.length>0?{type:`filter`,expr:e.join(` && `)}:null}},O6=class e extends O3{_stack;clone(){return new e(null,h2(this._stack))}constructor(e,t){super(e),this._stack=t}static makeFromTransform(t,n){let{stack:r,groupby:i,as:a,offset:o=`zero`}=n,s=[],c=[];if(n.sort!==void 0)for(let e of n.sort)s.push(e.field),c.push(pQ(e.order,`ascending`));let l={field:s,order:c},u;return u=NIe(a)?a:vg(a)?[a,`${a}_end`]:[`${n.stack}_start`,`${n.stack}_end`],new e(t,{dimensionFieldDefs:[],stackField:r,groupby:i,offset:o,sort:l,facetby:[],as:u})}static makeFromEncoding(t,n){let r=n.stack,{encoding:i}=n;if(!r)return null;let{groupbyChannels:a,fieldChannel:o,offset:s,impute:c}=r,l=a.map(e=>{let t=i[e];return b1(t)}).filter(e=>!!e),u=MIe(n),d=n.encoding.order,f;if(W(d)||Q(d))f=qke(d);else{let e=dMe(d)?d.sort:o===`y`?`descending`:`ascending`;f=u.reduce((t,n)=>(t.field.includes(n)||(t.field.push(n),t.order.push(e)),t),{field:[],order:[]})}return new e(t,{dimensionFieldDefs:l,stackField:n.vgField(o),facetby:[],stackby:u,sort:f,offset:s,impute:c,as:[n.vgField(o,{suffix:`start`,forAs:!0}),n.vgField(o,{suffix:`end`,forAs:!0})]})}get stack(){return this._stack}addDimensions(e){this._stack.facetby.push(...e)}dependentFields(){let e=new Set;return e.add(this._stack.stackField),this.getGroupbyFields().forEach(e.add,e),this._stack.facetby.forEach(e.add,e),this._stack.sort.field.forEach(e.add,e),e}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${VZ(this._stack)}`}getGroupbyFields(){let{dimensionFieldDefs:e,impute:t,groupby:n}=this._stack;return e.length>0?e.map(e=>e.bin?t?[m1(e,{binSuffix:`mid`})]:[m1(e,{}),m1(e,{binSuffix:`end`})]:[m1(e)]).flat():n??[]}assemble(){let e=[],{facetby:t,dimensionFieldDefs:n,stackField:r,stackby:i,sort:a,offset:o,impute:s,as:c}=this._stack;if(s)for(let a of n){let{bandPosition:n=.5,bin:o}=a;if(o){let t=m1(a,{expr:`datum`}),r=m1(a,{expr:`datum`,binSuffix:`end`});e.push({type:`formula`,expr:`${K0(t)} ? ${n}*${t}+${1-n}*${r} : ${t}`,as:m1(a,{binSuffix:`mid`,forAs:!0})})}e.push({type:`impute`,field:r,groupby:[...i,...t],key:m1(a,{binSuffix:`mid`}),method:`value`,value:0})}return e.push({type:`stack`,groupby:[...this.getGroupbyFields(),...t],field:r,sort:a,as:c,offset:o}),e}},k6=class e extends O3{transform;clone(){return new e(null,h2(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=qZ(this.transform.groupby.concat(e),e=>e)}dependentFields(){let e=new Set;return(this.transform.groupby??[]).forEach(e.add,e),(this.transform.sort??[]).forEach(t=>e.add(t.field)),this.transform.window.map(e=>e.field).filter(e=>e!==void 0).forEach(e.add,e),e}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(e){return e.as??m1(e)}hash(){return`WindowTransform ${VZ(this.transform)}`}assemble(){let e=[],t=[],n=[],r=[];for(let i of this.transform.window)t.push(i.op),n.push(this.getDefaultName(i)),r.push(i.param===void 0?null:i.param),e.push(i.field===void 0?null:i.field);let i=this.transform.frame,a=this.transform.groupby;if(i&&i[0]===null&&i[1]===null&&t.every(e=>VQ(e)))return{type:`joinaggregate`,as:n,ops:t,fields:e,...a===void 0?{}:{groupby:a}};let o=[],s=[];if(this.transform.sort!==void 0)for(let e of this.transform.sort)o.push(e.field),s.push(e.order??`ascending`);let c={field:o,order:s},l=this.transform.ignorePeers;return{type:`window`,params:r,as:n,ops:t,fields:e,sort:c,...l===void 0?{}:{ignorePeers:l},...a===void 0?{}:{groupby:a},...i===void 0?{}:{frame:i}}}},A6=`scale_`,j6=5,M6=class e{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}signal;static fromName(t,n){return new e(()=>t(n))}},CVe=[`type`,`clipAngle`,`clipExtent`,`center`,`rotate`,`precision`,`reflectX`,`reflectY`,`coefficient`,`distance`,`fraction`,`lobes`,`parallel`,`radius`,`ratio`,`spacing`,`tilt`],N6=class extends E3{specifiedProjection;size;data;merged=!1;constructor(e,t,n,r){super({...t},{name:e}),this.specifiedProjection=t,this.size=n,this.data=r}get isFit(){return!!this.data}},P6=class extends E3{merged=!1;constructor(e,t){super({},{name:e}),this.setWithExplicit(`type`,t)}domainHasZero(){let e=this.get(`type`);if(UZ([N4.LOG,N4.TIME,N4.UTC],e))return`definitely-not`;let t=this.get(`zero`);if(t===!0||t===void 0&&UZ([N4.LINEAR,N4.SQRT,N4.POW],e))return`definitely`;let n=this.get(`domains`);if(n.length>0){let e=!1,t=!1,r=!1;for(let i of n){if(W(i)){let n=i[0],r=i[i.length-1];if(gg(n)&&gg(r))if(n<=0&&r>=0){e=!0;continue}else{t=!0;continue}}r=!0}if(e)return`definitely`;if(t&&!r)return`definitely-not`}return`maybe`}},wVe=[`range`,`scheme`],F6=.95,I6={bins:({model:e,fieldOrDatumDef:t})=>Q(t)?PLe(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>FLe(e,t.type),nice:({scaleType:e,channel:t,domain:n,domainMin:r,domainMax:i,fieldOrDatumDef:a})=>ILe(e,t,n,r,i,a),padding:({channel:e,scaleType:t,fieldOrDatumDef:n,markDef:r,config:i})=>LLe(e,t,i.scale,n,r,i.bar),paddingInner:({scalePadding:e,channel:t,markDef:n,scaleType:r,config:i,hasNestedOffsetScale:a})=>RLe(e,t,n.type,r,i.scale,a),paddingOuter:({scalePadding:e,channel:t,scaleType:n,scalePaddingInner:r,config:i,hasNestedOffsetScale:a})=>zLe(e,t,n,r,i.scale,a),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:r})=>BLe(t,Q(e)?e.sort:void 0,n,r.scale),zero:({channel:e,fieldOrDatumDef:t,domain:n,markDef:r,scaleType:i,config:a,hasSecondaryRangeChannel:o})=>VLe(e,t,n,r,i,a.scale,o)},TVe=vPe((e,t)=>jje(e)-jje(t)),L6=class{nameMap;constructor(){this.nameMap={}}rename(e,t){this.nameMap[e]=t}has(e){return this.nameMap[e]!==void 0}get(e){for(;this.nameMap[e]&&e!==this.nameMap[e];)e=this.nameMap[e];return e}},R6=class{type;parent;config;name;size;title;description;data;transforms;layout;scaleNameMap;projectionNameMap;signalNameMap;component;view;constructor(e,t,n,r,i,a,o){this.type=t,this.parent=n,this.config=i,this.parent=n,this.config=i,this.view=YQ(o),this.name=e.name??r,this.title=XQ(e.title)?{text:e.title}:e.title?YQ(e.title):void 0,this.scaleNameMap=n?n.scaleNameMap:new L6,this.projectionNameMap=n?n.projectionNameMap:new L6,this.signalNameMap=n?n.signalNameMap:new L6,this.data=e.data,this.description=e.description,this.transforms=oPe(e.transform??[]),this.layout=t===`layer`||t===`unit`?{}:cNe(e,t,i),this.component={data:{sources:n?n.component.data.sources:[],outputNodes:n?n.component.data.outputNodes:{},outputNodeRefCounts:n?n.component.data.outputNodeRefCounts:{},isFaceted:$$(e)||n?.component.data.isFaceted&&e.data===void 0},layoutSize:new E3,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...a?h2(a):{}},selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef(`width`)}get height(){return this.getSizeSignalRef(`height`)}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){WLe(this)}parseProjection(){sLe(this)}renameTopLevelLayoutSizeSignal(){this.getName(`width`)!==`width`&&this.renameSignal(this.getName(`width`),`width`),this.getName(`height`)!==`height`&&this.renameSignal(this.getName(`height`),`height`)}parseLegends(){fIe(this)}assembleEncodeFromView(e){let{style:t,...n}=e,r={};for(let e of $(n)){let t=n[e];t!==void 0&&(r[e]=t$(t))}return r}assembleGroupEncodeEntry(e){let t={};return this.view&&(t=this.assembleEncodeFromView(this.view)),!e&&(this.description&&(t.description=t$(this.description)),this.type===`unit`||this.type===`layer`)?{width:this.getSizeSignalRef(`width`),height:this.getSizeSignalRef(`height`),...t}:QZ(t)?void 0:t}assembleLayout(){if(!this.layout)return;let{spacing:e,...t}=this.layout,{component:n,config:r}=this,i=UFe(n.layoutHeaders,r);return{padding:e,...this.assembleDefaultLayout(),...t,...i?{titleBand:i}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){let{layoutHeaders:e}=this.component,t=[];for(let n of s4)e[n].title&&t.push(IFe(this,n));for(let e of u6)t=t.concat(zFe(this,e));return t}assembleAxes(){return yFe(this.component.axes,this.config)}assembleLegends(){return nLe(this)}assembleProjections(){return iLe(this)}assembleTitle(){let{encoding:e,...t}=this.title??{},n={...Lke(this.config.title).nonMarkTitleProperties,...t,...e?{encode:{update:e}}:{}};if(n.text)return UZ([`unit`,`layer`],this.type)?UZ([`middle`,void 0],n.anchor)&&(n.frame??=`group`):n.anchor??=`start`,QZ(n)?void 0:n}assembleGroup(e=[]){let t={};e=e.concat(this.assembleSignals()),e.length>0&&(t.signals=e);let n=this.assembleLayout();n&&(t.layout=n),t.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());let r=!this.parent||i2(this.parent)?fLe(this):[];r.length>0&&(t.scales=r);let i=this.assembleAxes();i.length>0&&(t.axes=i);let a=this.assembleLegends();return a.length>0&&(t.legends=a),t}getName(e){return tQ((this.name?`${this.name}_`:``)+e)}getDataName(e){return this.getName(D3[e].toLowerCase())}requestDataName(e){let t=this.getDataName(e),n=this.component.data.outputNodeRefCounts;return n[t]=(n[t]||0)+1,t}getSizeSignalRef(e){if(i2(this.parent)){let t=PQ(qFe(e)),n=this.component.scales[t];if(n&&!n.merged){let e=n.get(`type`),r=n.get(`range`);if(A$(e)&&QQ(r)){let e=n.get(`name`),r=e2(t2(this,t));return r?{signal:KFe(e,n,m1({aggregate:`distinct`,field:r},{expr:`datum`}))}:(Z(s$(t)),null)}}}return{signal:this.signalNameMap.get(this.getName(e))}}lookupDataSource(e){let t=this.component.data.outputNodes[e];return t?t.getSource():e}getSignalName(e){return this.signalNameMap.get(e)}renameSignal(e,t){this.signalNameMap.rename(e,t)}renameScale(e,t){this.scaleNameMap.rename(e,t)}renameProjection(e,t){this.projectionNameMap.rename(e,t)}scaleName(e,t){if(t)return this.getName(e);if(TQ(e)&&LQ(e)&&this.component.scales[e]||this.scaleNameMap.has(this.getName(e)))return this.scaleNameMap.get(this.getName(e))}projectionName(e){if(e)return this.getName(`projection`);if(this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName(`projection`)))return this.projectionNameMap.get(this.getName(`projection`))}getScaleComponent(e){if(!this.component.scales)throw Error(`getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().`);let t=this.component.scales[e];return t&&!t.merged?t:this.parent?this.parent.getScaleComponent(e):void 0}getScaleType(e){let t=this.getScaleComponent(e);return t?t.get(`type`):void 0}getSelectionComponent(e,t){let n=this.component.selection[e];if(!n&&this.parent&&(n=this.parent.getSelectionComponent(e,t)),!n)throw Error(iAe(t));return n}hasAxisOrientSignalRef(){return this.component.axes.x?.some(e=>e.hasOrientSignalRef())||this.component.axes.y?.some(e=>e.hasOrientSignalRef())}},z6=class extends R6{vgField(e,t={}){let n=this.fieldDef(e);if(n)return m1(n,t)}reduceFieldDef(e,t){return RMe(this.getMapping(),(t,n,r)=>{let i=b1(n);return i?e(t,i,r):t},t)}forEachFieldDef(e,t){M1(this.getMapping(),(t,n)=>{let r=b1(t);r&&e(r,n)},t)}},B6=class e extends O3{transform;clone(){return new e(null,h2(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=h2(t);let n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??`value`,n[1]??`density`];let r=this.transform.resolve??`shared`;this.transform.resolve=r}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${VZ(this.transform)}`}assemble(){let{density:e,...t}=this.transform,n={type:`kde`,field:e,...t};return n.resolve=this.transform.resolve,n}},V6=class e extends O3{transform;clone(){return new e(null,h2(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=h2(t)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${VZ(this.transform)}`}assemble(){let{extent:e,param:t}=this.transform;return{type:`extent`,field:e,signal:t}}},H6=class e extends O3{transform;clone(){return new e(this.parent,h2(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=h2(t);let{flatten:n,as:r=[]}=this.transform;this.transform.as=n.map((e,t)=>r[t]??e)}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${VZ(this.transform)}`}assemble(){let{flatten:e,as:t}=this.transform;return{type:`flatten`,fields:e,as:t}}},U6=class e extends O3{transform;clone(){return new e(null,h2(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=h2(t);let n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??`key`,n[1]??`value`]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${VZ(this.transform)}`}assemble(){let{fold:e,as:t}=this.transform;return{type:`fold`,fields:e,as:t}}},W6=class e extends O3{fields;geojson;signal;clone(){return new e(null,h2(this.fields),this.geojson,this.signal)}static parseAll(t,n){if(n.component.projection&&!n.component.projection.isFit)return t;let r=0;for(let i of[[P2,N2],[I2,F2]]){let a=i.map(e=>{let t=x1(n.encoding[e]);return Q(t)?t.field:o1(t)?{expr:`${t.datum}`}:d1(t)?{expr:`${t.value}`}:void 0});(a[0]||a[1])&&(t=new e(t,a,null,n.getName(`geojson_${r++}`)))}if(n.channelHasField(V2)){let i=n.typedFieldDef(V2);i.type===M4&&(t=new e(t,null,i.field,n.getName(`geojson_${r}`)))}return t}constructor(e,t,n,r){super(e),this.fields=t,this.geojson=n,this.signal=r}dependentFields(){let e=(this.fields??[]).filter(vg);return new Set([...this.geojson?[this.geojson]:[],...e])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${VZ(this.fields)}`}assemble(){return[...this.geojson?[{type:`filter`,expr:`isValid(datum["${this.geojson}"])`}]:[],{type:`geojson`,...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}},G6=class e extends O3{projection;fields;as;clone(){return new e(null,this.projection,h2(this.fields),h2(this.as))}constructor(e,t,n,r){super(e),this.projection=t,this.fields=n,this.as=r}static parseAll(t,n){if(!n.projectionName())return t;for(let r of[[P2,N2],[I2,F2]]){let i=r.map(e=>{let t=x1(n.encoding[e]);return Q(t)?t.field:o1(t)?{expr:`${t.datum}`}:d1(t)?{expr:`${t.value}`}:void 0}),a=r[0]===I2?`2`:``;(i[0]||i[1])&&(t=new e(t,n.projectionName(),i,[n.getName(`x${a}`),n.getName(`y${a}`)]))}return t}dependentFields(){return new Set(this.fields.filter(vg))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${VZ(this.fields)} ${VZ(this.as)}`}assemble(){return{type:`geopoint`,projection:this.projection,fields:this.fields,as:this.as}}},K6=class e extends O3{transform;clone(){return new e(null,h2(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(e){let{start:t=0,stop:n,step:r}=e;return{signal:`sequence(${[t,n,...r?[r]:[]].join(`,`)})`}}static makeFromTransform(t,n){return new e(t,n)}static makeFromEncoding(t,n){let r=n.encoding,i=r.x,a=r.y;if(Q(i)&&Q(a)){let o=i.impute?i:a.impute?a:void 0;if(o===void 0)return;let s=i.impute?a:a.impute?i:void 0,{method:c,value:l,frame:u,keyvals:d}=o.impute,f=zMe(n.mark,r);return new e(t,{impute:o.field,key:s.field,...c?{method:c}:{},...l===void 0?{}:{value:l},...u?{frame:u}:{},...d===void 0?{}:{keyvals:d},...f.length?{groupby:f}:{}})}return null}hash(){return`Impute ${VZ(this.transform)}`}assemble(){let{impute:e,key:t,keyvals:n,method:r,groupby:i,value:a,frame:o=[null,null]}=this.transform,s={type:`impute`,field:e,key:t,...n?{keyvals:zNe(n)?this.processSequence(n):n}:{},method:`value`,...i?{groupby:i}:{},value:!r||r===`value`?a:null};return r&&r!==`value`?[s,{type:`window`,as:[`imputed_${e}_value`],ops:[r],fields:[e],frame:o,ignorePeers:!1,...i?{groupby:i}:{}},{type:`formula`,expr:`datum.${e} === null ? datum.imputed_${e}_value : datum.${e}`,as:e}]:[s]}},q6=class e extends O3{transform;clone(){return new e(null,h2(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=h2(t);let n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${VZ(this.transform)}`}assemble(){let{loess:e,on:t,...n}=this.transform;return{type:`loess`,x:t,y:e,...n}}},J6=class e extends O3{transform;secondary;clone(){return new e(null,h2(this.transform),this.secondary)}constructor(e,t,n){super(e),this.transform=t,this.secondary=n}static make(t,n,r,i){let a=n.component.data.sources,{from:o}=r,s=null;if(VNe(o)){let e=sRe(o.data,a);e||(e=new S6(o.data),a.push(e));let t=n.getName(`lookup_${i}`);s=new k3(e,t,D3.Lookup,n.component.data.outputNodeRefCounts),n.component.data.outputNodes[t]=s}else if(HNe(o)){let e=o.param;r={as:e,...r};let t;try{t=n.getSelectionComponent(tQ(e),e)}catch{throw Error(aAe(e))}if(s=t.materialized,!s)throw Error(oAe(e))}return new e(t,r,s.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?Qh(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${VZ({transform:this.transform,secondary:this.secondary})}`}assemble(){let e;if(this.transform.from.fields)e={values:this.transform.from.fields,...this.transform.as?{as:Qh(this.transform.as)}:{}};else{let t=this.transform.as;vg(t)||(Z(Lze),t=`_lookup`),e={as:[t]}}return{type:`lookup`,from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...e,...this.transform.default?{default:this.transform.default}:{}}}},Y6=class e extends O3{transform;clone(){return new e(null,h2(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=h2(t);let n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??`prob`,n[1]??`value`]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${VZ(this.transform)}`}assemble(){let{quantile:e,...t}=this.transform;return{type:`quantile`,field:e,...t}}},X6=class e extends O3{transform;clone(){return new e(null,h2(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=h2(t);let n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${VZ(this.transform)}`}assemble(){let{regression:e,on:t,...n}=this.transform;return{type:`regression`,x:t,y:e,...n}}},Z6=class e extends O3{transform;clone(){return new e(null,h2(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=qZ((this.transform.groupby??[]).concat(e),e=>e)}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${VZ(this.transform)}`}assemble(){let{pivot:e,value:t,groupby:n,limit:r,op:i}=this.transform;return{type:`pivot`,field:e,value:t,...r===void 0?{}:{limit:r},...i===void 0?{}:{op:i},...n===void 0?{}:{groupby:n}}}},Q6=class e extends O3{transform;clone(){return new e(null,h2(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${VZ(this.transform)}`}assemble(){return{type:`sample`,size:this.transform.sample}}},EVe=class e extends z6{facet;child;children;constructor(e,t,n,r){super(e,`facet`,t,n,r,e.resolve),this.child=m2(e.spec,this,this.getName(`child`),void 0,r),this.children=[this.child],this.facet=this.initFacet(e.facet)}initFacet(e){if(!Z$(e))return{facet:this.initFacetFieldDef(e,`facet`)};let t=$(e),n={};for(let r of t){if(![b2,x2].includes(r)){Z(l$(r,`facet`));break}let t=e[r];if(t.field===void 0){Z(c$(t,r));break}n[r]=this.initFacetFieldDef(t,r)}return n}initFacetFieldDef(e,t){let n=C1(e,t);return n.header?n.header=YQ(n.header):n.header===null&&(n.header=null),n}channelHasField(e){return X(this.facet,e)}fieldDef(e){return this.facet[e]}parseData(){this.component.data=u2(this),this.child.parseData()}parseLayoutSize(){s2(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection,g2(this.component.selection).some(e=>O0(e))&&f$(y4)}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),QLe(this)}assembleSelectionTopLevelSignals(e){return this.child.assembleSelectionTopLevelSignals(e)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(e){return this.child.assembleSelectionData(e)}getHeaderLayoutMixins(){let e={};for(let t of s4)for(let n of d6){let r=this.component.layoutHeaders[t],i=r[n],{facetFieldDef:a}=r;if(a){let n=L0(`titleOrient`,a.header,this.config,t);if([`right`,`bottom`].includes(n)){let r=I0(t,n);e.titleAnchor??={},e.titleAnchor[r]=`end`}}if(i?.[0]){let i=t===`row`?`height`:`width`,a=n===`header`?`headerBand`:`footerBand`;t!==`facet`&&!this.child.component.layoutSize.get(i)&&(e[a]??={},e[a][t]=.5),r.title&&(e.offset??={},e.offset[t===`row`?`rowTitle`:`columnTitle`]=10)}}return e}assembleDefaultLayout(){let{column:e,row:t}=this.facet,n=e?this.columnDistinctSignal():t?1:void 0,r=`all`;return(!t&&this.component.resolve.scale.x===`independent`||!e&&this.component.resolve.scale.y===`independent`)&&(r=`none`),{...this.getHeaderLayoutMixins(),...n?{columns:n}:{},bounds:`full`,align:r}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof e))return{signal:`length(data('${this.getName(`column_domain`)}'))`}}assembleGroupStyle(){}assembleGroup(t){return this.parent&&this.parent instanceof e?{...this.channelHasField(`column`)?{encode:{update:{columns:{field:m1(this.facet.column,{prefix:`distinct`})}}}}:{},...super.assembleGroup(t)}:super.assembleGroup(t)}getCardinalityAggregateForChild(){let t=[],n=[],r=[];if(this.child instanceof e){if(this.child.channelHasField(`column`)){let e=m1(this.child.facet.column);t.push(e),n.push(`distinct`),r.push(`distinct_${e}`)}}else for(let e of d4){let i=this.child.component.scales[e];if(i&&!i.merged){let a=i.get(`type`),o=i.get(`range`);if(A$(a)&&QQ(o)){let i=e2(t2(this.child,e));i?(t.push(i),n.push(`distinct`),r.push(`distinct_${i}`)):Z(s$(e))}}}return{fields:t,ops:n,as:r}}assembleFacet(){let{name:e,data:t}=this.component.data.facetRoot,{row:n,column:r}=this.facet,{fields:i,ops:a,as:o}=this.getCardinalityAggregateForChild(),s=[];for(let e of s4){let t=this.facet[e];if(t){s.push(m1(t));let{bin:c,sort:l}=t;if(WQ(c)&&s.push(m1(t,{binSuffix:`end`})),X$(l)){let{field:e,op:s=e3}=l,c=l2(t,l);n&&r?(i.push(c),a.push(`max`),o.push(c)):(i.push(e),a.push(s),o.push(c))}else if(W(l)){let n=F0(t,e);i.push(n),a.push(`max`),o.push(n)}}}let c=!!n&&!!r;return{name:e,data:t,groupby:s,...c||i.length>0?{aggregate:{...c?{cross:c}:{},...i.length?{fields:i,ops:a,as:o}:{}}}:{}}}facetSortFields(e){let{facet:t}=this,n=t[e];return n?X$(n.sort)?[l2(n,n.sort,{expr:`datum`})]:W(n.sort)?[F0(n,e,{expr:`datum`})]:[m1(n,{expr:`datum`})]:[]}facetSortOrder(e){let{facet:t}=this,n=t[e];if(n){let{sort:e}=n;return[(X$(e)?e.order:!W(e)&&e)||`ascending`]}return[]}assembleLabelTitle(){let{facet:e,config:t}=this;if(e.facet)return z0(e.facet,`facet`,t);let n={row:[`top`,`bottom`],column:[`left`,`right`]};for(let r of u6)if(e[r]){let i=L0(`labelOrient`,e[r]?.header,t,r);if(n[r].includes(i))return z0(e[r],r,t)}}assembleMarks(){let{child:e}=this,t=this.component.data.facetRoot,n=YLe(t),r=e.assembleGroupEncodeEntry(!1),i=this.assembleLabelTitle()||e.assembleTitle(),a=e.assembleGroupStyle();return[{name:this.getName(`cell`),type:`group`,...i?{title:i}:{},...a?{style:a}:{},from:{facet:this.assembleFacet()},sort:{field:s4.map(e=>this.facetSortFields(e)).flat(),order:s4.map(e=>this.facetSortOrder(e)).flat()},...n.length>0?{data:n}:{},...r?{encode:{update:r}}:{},...e.assembleGroup(APe(this,[]))}]}getMapping(){return this.facet}},DVe=class extends R6{children;constructor(e,t,n,r){super(e,`concat`,t,n,r,e.resolve),(e.resolve?.axis?.x===`shared`||e.resolve?.axis?.y===`shared`)&&Z(Fze),this.children=this.getChildren(e).map((e,t)=>m2(e,this,this.getName(`concat_${t}`),void 0,r))}parseData(){this.component.data=u2(this);for(let e of this.children)e.parseData()}parseSelections(){this.component.selection={};for(let e of this.children){e.parseSelections();for(let t of $(e.component.selection))this.component.selection[t]=e.component.selection[t]}g2(this.component.selection).some(e=>O0(e))&&f$(y4)}parseMarkGroup(){for(let e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){for(let e of this.children)e.parseAxesAndHeaders()}getChildren(e){return H1(e)?e.vconcat:U1(e)?e.hconcat:e.concat}parseLayoutSize(){rRe(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(e){return this.children.reduce((e,t)=>t.assembleSelectionTopLevelSignals(e),e)}assembleSignals(){return this.children.forEach(e=>e.assembleSignals()),[]}assembleLayoutSignals(){let e=B0(this);for(let t of this.children)e.push(...t.assembleLayoutSignals());return e}assembleSelectionData(e){return this.children.reduce((e,t)=>t.assembleSelectionData(e),e)}assembleMarks(){return this.children.map(e=>{let t=e.assembleTitle(),n=e.assembleGroupStyle(),r=e.assembleGroupEncodeEntry(!1);return{type:`group`,name:e.getName(`group`),...t?{title:t}:{},...n?{style:n}:{},...r?{encode:{update:r}}:{},...e.assembleGroup()}})}assembleGroupStyle(){}assembleDefaultLayout(){let e=this.layout.columns;return{...e==null?{}:{columns:e},bounds:`full`,align:`each`}}},$6=$({disable:1,gridScale:1,scale:1,...o3,labelExpr:1,encode:1}),OVe=class e extends E3{explicit;implicit;mainExtracted;constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new e(h2(this.explicit),h2(this.implicit),this.mainExtracted)}hasAxisPart(e){return e===`axis`?!0:e===`grid`||e===`title`?!!this.get(e):!uRe(this.get(e))}hasOrientSignalRef(){return ZQ(this.explicit.orient)}},kVe={bottom:`top`,top:`bottom`,left:`right`,right:`left`},AVe=new Set([`grid`,`translate`,`format`,`formatType`,`orient`,`labelExpr`,`tickCount`,`position`,`tickMinStep`]),jVe={vgMark:`arc`,encodeEntry:e=>({...w0(e,{align:`ignore`,baseline:`ignore`,color:`include`,size:`ignore`,orient:`ignore`,theta:`ignore`}),...y0(`x`,e,{defaultPos:`mid`}),...y0(`y`,e,{defaultPos:`mid`}),...C0(e,`radius`),...C0(e,`theta`)})},MVe={vgMark:`area`,encodeEntry:e=>({...w0(e,{align:`ignore`,baseline:`ignore`,color:`include`,orient:`include`,size:`ignore`,theta:`ignore`}),...x0(`x`,e,{defaultPos:`zeroOrMin`,defaultPos2:`zeroOrMin`,range:e.markDef.orient===`horizontal`}),...x0(`y`,e,{defaultPos:`zeroOrMin`,defaultPos2:`zeroOrMin`,range:e.markDef.orient===`vertical`}),...T0(e)})},NVe={vgMark:`rect`,encodeEntry:e=>({...w0(e,{align:`ignore`,baseline:`ignore`,color:`include`,orient:`ignore`,size:`ignore`,theta:`ignore`}),...C0(e,`x`),...C0(e,`y`)})},PVe={vgMark:`shape`,encodeEntry:e=>({...w0(e,{align:`ignore`,baseline:`ignore`,color:`include`,size:`ignore`,orient:`ignore`,theta:`ignore`})}),postEncodingTransform:e=>{let{encoding:t}=e,n=t.shape;return[{type:`geoshape`,projection:e.projectionName(),...n&&Q(n)&&n.type===M4?{field:m1(n,{expr:`datum`})}:{}}]}},FVe={vgMark:`image`,encodeEntry:e=>({...w0(e,{align:`ignore`,baseline:`ignore`,color:`ignore`,orient:`ignore`,size:`ignore`,theta:`ignore`}),...C0(e,`x`),...C0(e,`y`),...h0(e,`url`)})},IVe={vgMark:`line`,encodeEntry:e=>({...w0(e,{align:`ignore`,baseline:`ignore`,color:`include`,size:`ignore`,orient:`ignore`,theta:`ignore`}),...y0(`x`,e,{defaultPos:`mid`}),...y0(`y`,e,{defaultPos:`mid`}),..._0(`size`,e,{vgChannel:`strokeWidth`}),...T0(e)})},LVe={vgMark:`trail`,encodeEntry:e=>({...w0(e,{align:`ignore`,baseline:`ignore`,color:`include`,size:`include`,orient:`ignore`,theta:`ignore`}),...y0(`x`,e,{defaultPos:`mid`}),...y0(`y`,e,{defaultPos:`mid`}),..._0(`size`,e),...T0(e)})},RVe={vgMark:`symbol`,encodeEntry:e=>f2(e)},zVe={vgMark:`symbol`,encodeEntry:e=>f2(e,`circle`)},BVe={vgMark:`symbol`,encodeEntry:e=>f2(e,`square`)},VVe={vgMark:`rect`,encodeEntry:e=>({...w0(e,{align:`ignore`,baseline:`ignore`,color:`include`,orient:`ignore`,size:`ignore`,theta:`ignore`}),...C0(e,`x`),...C0(e,`y`)})},HVe={vgMark:`rule`,encodeEntry:e=>{let{markDef:t}=e,n=t.orient;return!e.encoding.x&&!e.encoding.y&&!e.encoding.latitude&&!e.encoding.longitude?{}:{...w0(e,{align:`ignore`,baseline:`ignore`,color:`include`,orient:`ignore`,size:`ignore`,theta:`ignore`}),...x0(`x`,e,{defaultPos:n===`horizontal`?`zeroOrMax`:`mid`,defaultPos2:`zeroOrMin`,range:n!==`vertical`}),...x0(`y`,e,{defaultPos:n===`vertical`?`zeroOrMax`:`mid`,defaultPos2:`zeroOrMin`,range:n!==`horizontal`}),..._0(`size`,e,{vgChannel:`strokeWidth`})}}},UVe={vgMark:`text`,encodeEntry:e=>{let{config:t,encoding:n}=e;return{...w0(e,{align:`include`,baseline:`include`,color:`include`,size:`ignore`,orient:`ignore`,theta:`include`}),...y0(`x`,e,{defaultPos:`mid`}),...y0(`y`,e,{defaultPos:`mid`}),...h0(e),..._0(`size`,e,{vgChannel:`fontSize`}),..._0(`angle`,e),...aFe(`align`,bRe(e.markDef,n,t)),...aFe(`baseline`,xRe(e.markDef,n,t)),...y0(`radius`,e,{defaultPos:null}),...y0(`theta`,e,{defaultPos:null})}}},e8={arc:jVe,area:MVe,bar:NVe,circle:zVe,geoshape:PVe,image:FVe,line:IVe,point:RVe,rect:VVe,rule:HVe,square:BVe,text:UVe,tick:{vgMark:`rect`,encodeEntry:e=>{let{config:t,markDef:n}=e,r=n.orient,i=r===`horizontal`?`x`:`y`,a=r===`horizontal`?`y`:`x`,o=r===`horizontal`?`height`:`width`;return{...w0(e,{align:`ignore`,baseline:`ignore`,color:`include`,orient:`ignore`,size:`ignore`,theta:`ignore`}),...C0(e,i),...y0(a,e,{defaultPos:`mid`,vgChannel:a===`y`?`yc`:`xc`}),[o]:t$(r$(`thickness`,n,t))}}},trail:LVe},t8=`faceted_path_`,n8=`stack_group_`,r8=class extends z6{markDef;encoding;specifiedScales={};stack;specifiedAxes={};specifiedLegends={};specifiedProjection={};selection=[];children=[];constructor(e,t,n,r={},i){super(e,`unit`,t,n,i,void 0,sNe(e)?e.view:void 0);let a=L$(e.mark)?{...e.mark}:{type:e.mark},o=a.type;a.filled===void 0&&(a.filled=DNe(a,i,{graticule:e.data&&c0(e.data)}));let s=this.encoding=IMe(e.encoding||{},o,a.filled,i);this.markDef=wNe(a,s,i),this.size=vRe({encoding:s,size:sNe(e)?{...r,...e.width===void 0?{}:{width:e.width},...e.height===void 0?{}:{height:e.height}}:r}),this.stack=CNe(this.markDef,s),this.specifiedScales=this.initScales(o,s),this.specifiedAxes=this.initAxes(s),this.specifiedLegends=this.initLegends(s),this.specifiedProjection=e.projection,this.selection=(e.params??[]).filter(e=>B1(e)),this.alignStackOrderWithColorDomain()}get hasProjection(){let{encoding:e}=this,t=this.mark===Y4,n=e&&PRe.some(t=>l1(e[t]));return t||n}scaleDomain(e){let t=this.specifiedScales[e];return t?t.domain:void 0}axis(e){return this.specifiedAxes[e]}legend(e){return this.specifiedLegends[e]}initScales(e,t){return g4.reduce((e,n)=>{let r=x1(t[n]);return r&&(e[n]=this.initScale(r.scale??{})),e},{})}initScale(e){let{domain:t,range:n}=e,r=YQ(e);return W(t)&&(r.domain=t.map(e$)),W(n)&&(r.range=n.map(e$)),r}initAxes(e){return d4.reduce((t,n)=>{let r=e[n];if(l1(r)||n===C2&&l1(e.x2)||n===w2&&l1(e.y2)){let e=l1(r)?r.axis:void 0;t[n]=e&&this.initAxis({...e})}return t},{})}initAxis(e){let t=$(e),n={};for(let r of t){let t=e[r];n[r]=O1(t)?Bke(t):e$(t)}return n}initLegends(e){return _ze.reduce((t,n)=>{let r=x1(e[n]);if(r&&Mke(n)){let e=r.legend;t[n]=e&&YQ(e)}return t},{})}alignStackOrderWithColorDomain(){let{color:e,fill:t,order:n,xOffset:r,yOffset:i}=this.encoding,a=t||e,o=Q(a)?a:void 0,s=o?.field,c=o?.scale,l=o?.type,u=c?.domain,d=r||i,f=Q(d)?d:void 0,p=`_${s}_sort_index`;if(!n&&Array.isArray(u)&&typeof s==`string`&&l===`nominal`)if(f&&!f.sort)f.sort=u;else{if(!this.stack)return;let e=`indexof(${G(u)}, datum['${s}'])`,t=this.markDef?.orient===`horizontal`?`ascending`:`descending`;this.transforms.push({calculate:e,as:p}),this.encoding.order={field:p,type:`quantitative`,sort:t}}}parseData(){this.component.data=u2(this)}parseLayoutSize(){iRe(this)}parseSelections(){this.component.selection=pFe(this,this.selection)}parseMarkGroup(){this.component.mark=SRe(this)}parseAxesAndHeaders(){this.component.axes=fRe(this)}assembleSelectionTopLevelSignals(e){return jPe(this,e)}assembleSignals(){return[...vFe(this),...kPe(this,[])]}assembleSelectionData(e){return MPe(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return B0(this)}correctDataNames=e=>(e.from?.data&&(e.from.data=this.lookupDataSource(e.from.data),`time`in this.encoding&&(e.from.data=e.from.data+P3)),e.from?.facet?.data&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e);assembleMarks(){let e=this.component.mark??[];return(!this.parent||!o2(this.parent))&&(e=NPe(this,e)),e.map(this.correctDataNames)}assembleGroupStyle(){let{style:e}=this.view||{};return e===void 0?this.encoding.x||this.encoding.y?`cell`:`view`:e}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return A1(this.encoding,e)}fieldDef(e){let t=this.encoding[e];return b1(t)}typedFieldDef(e){let t=this.fieldDef(e);return u1(t)?t:null}},WVe=class e extends R6{children;constructor(t,n,r,i,a){super(t,`layer`,n,r,a,t.resolve,t.view);let o={...i,...t.width?{width:t.width}:{},...t.height?{height:t.height}:{}};this.children=t.layer.map((t,n)=>{if(J1(t))return new e(t,this,this.getName(`layer_${n}`),o,a);if(k1(t))return new r8(t,this,this.getName(`layer_${n}`),o,a);throw Error(o$(t))})}parseData(){this.component.data=u2(this);for(let e of this.children)e.parseData()}parseLayoutSize(){nRe(this)}parseSelections(){this.component.selection={};for(let e of this.children){e.parseSelections();for(let t of $(e.component.selection))this.component.selection[t]=e.component.selection[t]}g2(this.component.selection).some(e=>O0(e))&&f$(y4)}parseMarkGroup(){for(let e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){pRe(this)}assembleSelectionTopLevelSignals(e){return this.children.reduce((e,t)=>t.assembleSelectionTopLevelSignals(e),e)}assembleSignals(){return this.children.reduce((e,t)=>e.concat(t.assembleSignals()),vFe(this))}assembleLayoutSignals(){return this.children.reduce((e,t)=>e.concat(t.assembleLayoutSignals()),B0(this))}assembleSelectionData(e){return this.children.reduce((e,t)=>t.assembleSelectionData(e),e)}assembleGroupStyle(){let e=new Set;for(let t of this.children)for(let n of Qh(t.assembleGroupStyle()))e.add(n);let t=Array.from(e);return t.length>1?t:t.length===1?t[0]:void 0}assembleTitle(){let e=super.assembleTitle();if(e)return e;for(let t of this.children)if(e=t.assembleTitle(),e)return e}assembleLayout(){return null}assembleMarks(){return PPe(this,this.children.flatMap(e=>e.assembleMarks()))}assembleLegends(){return this.children.reduce((e,t)=>e.concat(t.assembleLegends()),nLe(this))}},GVe=MRe.version}));function qVe(e){let[t,n]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:n}}var JVe=o((()=>{})),YVe=c({carbong10:()=>OHe,carbong100:()=>AHe,carbong90:()=>kHe,carbonwhite:()=>DHe,dark:()=>ZVe,excel:()=>QVe,fivethirtyeight:()=>tHe,ggplot2:()=>nHe,googlecharts:()=>mHe,latimes:()=>oHe,powerbi:()=>CHe,quartz:()=>sHe,urbaninstitute:()=>pHe,version:()=>jHe,vox:()=>cHe});function i8({theme:e,background:t}){let n=[`white`,`g10`].includes(e)?`light`:`dark`,r=K8.gridBg[e],i=K8.textPrimary[e],a=K8.textSecondary[e],o=n===`dark`?THe:EHe,s=n===`dark`?`#d4bbff`:`#6929c4`;return{background:t,arc:{fill:s},area:{fill:s},path:{stroke:s},rect:{fill:s},shape:{stroke:s},symbol:{stroke:s},circle:{fill:s},view:{fill:r,stroke:r},group:{fill:r},title:{color:i,anchor:`start`,dy:-15,fontSize:16,font:W8,fontWeight:600},axis:{labelColor:a,labelFontSize:12,labelFont:wHe,labelFontWeight:G8,titleColor:i,titleFontWeight:600,titleFontSize:12,grid:!0,gridColor:K8.layerAccent01[e],labelAngle:0},axisX:{titlePadding:10},axisY:{titlePadding:2.5},style:{"guide-label":{font:W8,fill:a,fontWeight:G8},"guide-title":{font:W8,fill:a,fontWeight:G8}},range:{category:o,diverging:[`#750e13`,`#a2191f`,`#da1e28`,`#fa4d56`,`#ff8389`,`#ffb3b8`,`#ffd7d9`,`#fff1f1`,`#e5f6ff`,`#bae6ff`,`#82cfff`,`#33b1ff`,`#1192e8`,`#0072c3`,`#00539a`,`#003a6d`],heatmap:[`#f6f2ff`,`#e8daff`,`#d4bbff`,`#be95ff`,`#a56eff`,`#8a3ffc`,`#6929c4`,`#491d8b`,`#31135e`,`#1c0f30`]}}}var XVe,a8,o8,ZVe,s8,QVe,c8,l8,$Ve,eHe,u8,d8,tHe,f8,nHe,rHe,iHe,p8,m8,aHe,h8,g8,_8,v8,y8,oHe,b8,x8,sHe,S8,cHe,C8,w8,lHe,T8,E8,uHe,dHe,fHe,D8,pHe,O8,k8,A8,mHe,j8,M8,N8,P8,F8,I8,L8,R8,z8,hHe,B8,gHe,_He,vHe,yHe,bHe,xHe,SHe,V8,H8,U8,CHe,W8,wHe,G8,K8,THe,EHe,DHe,OHe,kHe,AHe,jHe,MHe=o((()=>{XVe={version:`3.0.0`},a8=`#fff`,o8=`#888`,ZVe={background:`#333`,view:{stroke:o8},title:{color:a8,subtitleColor:a8},style:{"guide-label":{fill:a8},"guide-title":{fill:a8}},axis:{domainColor:a8,gridColor:o8,tickColor:a8}},s8=`#4572a7`,QVe={background:`#fff`,arc:{fill:s8},area:{fill:s8},line:{stroke:s8,strokeWidth:2},path:{stroke:s8},rect:{fill:s8},shape:{stroke:s8},symbol:{fill:s8,strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:`#000000`,gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:`middle`,labelFontSize:11,symbolSize:50,symbolType:`square`},range:{category:[`#4572a7`,`#aa4643`,`#8aa453`,`#71598e`,`#4598ae`,`#d98445`,`#94aace`,`#d09393`,`#b9cc98`,`#a99cbc`]}},c8=`#30a2da`,l8=`#cbcbcb`,$Ve=`#999`,eHe=`#333`,u8=`#f0f0f0`,d8=`#333`,tHe={arc:{fill:c8},area:{fill:c8},axis:{domainColor:l8,grid:!0,gridColor:l8,gridWidth:1,labelColor:$Ve,labelFontSize:10,titleColor:eHe,tickColor:l8,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:u8,group:{fill:u8},legend:{labelColor:d8,labelFontSize:11,padding:1,symbolSize:30,symbolType:`square`,titleColor:d8,titleFontSize:14,titlePadding:10},line:{stroke:c8,strokeWidth:2},path:{stroke:c8,strokeWidth:.5},rect:{fill:c8},range:{category:[`#30a2da`,`#fc4f30`,`#e5ae38`,`#6d904f`,`#8b8b8b`,`#b96db8`,`#ff9e27`,`#56cc60`,`#52d2ca`,`#52689e`,`#545454`,`#9fe4f8`],diverging:[`#cc0020`,`#e77866`,`#f6e7e1`,`#d6e8ed`,`#91bfd9`,`#1d78b5`],heatmap:[`#d6e8ed`,`#cee0e5`,`#91bfd9`,`#549cc6`,`#1d78b5`]},point:{filled:!0,shape:`circle`},shape:{stroke:c8},bar:{binSpacing:2,fill:c8,stroke:null},title:{anchor:`start`,fontSize:24,fontWeight:600,offset:20}},f8=`#000`,nHe={group:{fill:`#e5e5e5`},arc:{fill:f8},area:{fill:f8},line:{stroke:f8},path:{stroke:f8},rect:{fill:f8},shape:{stroke:f8},symbol:{fill:f8,size:40},axis:{domain:!1,grid:!0,gridColor:`#FFFFFF`,gridOpacity:1,labelColor:`#7F7F7F`,labelPadding:4,tickColor:`#7F7F7F`,tickSize:5.67,titleFontSize:16,titleFontWeight:`normal`},legend:{labelBaseline:`middle`,labelFontSize:11,symbolSize:40},range:{category:[`#000000`,`#7F7F7F`,`#1A1A1A`,`#999999`,`#333333`,`#B0B0B0`,`#4D4D4D`,`#C9C9C9`,`#666666`,`#DCDCDC`]}},rHe=22,iHe=`normal`,p8=`Benton Gothic, sans-serif`,m8=11.5,aHe=`normal`,h8=`#82c6df`,g8=`Benton Gothic Bold, sans-serif`,_8=`normal`,v8=13,y8={"category-6":[`#ec8431`,`#829eb1`,`#c89d29`,`#3580b1`,`#adc839`,`#ab7fb4`],"fire-7":[`#fbf2c7`,`#f9e39c`,`#f8d36e`,`#f4bb6a`,`#e68a4f`,`#d15a40`,`#ab4232`],"fireandice-6":[`#e68a4f`,`#f4bb6a`,`#f9e39c`,`#dadfe2`,`#a6b7c6`,`#849eae`]},oHe={background:`#ffffff`,title:{anchor:`start`,color:`#000000`,font:g8,fontSize:rHe,fontWeight:iHe},arc:{fill:h8},area:{fill:h8},line:{stroke:h8,strokeWidth:2},path:{stroke:h8},rect:{fill:h8},shape:{stroke:h8},symbol:{fill:h8,size:30},axis:{labelFont:p8,labelFontSize:m8,labelFontWeight:aHe,titleFont:g8,titleFontSize:v8,titleFontWeight:_8},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:`middle`,maxExtent:45,minExtent:45,tickSize:2,titleAlign:`left`,titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:p8,labelFontSize:m8,symbolType:`square`,titleFont:g8,titleFontSize:v8,titleFontWeight:_8},range:{category:y8[`category-6`],diverging:y8[`fireandice-6`],heatmap:y8[`fire-7`],ordinal:y8[`fire-7`],ramp:y8[`fire-7`]}},b8=`#ab5787`,x8=`#979797`,sHe={background:`#f9f9f9`,arc:{fill:b8},area:{fill:b8},line:{stroke:b8},path:{stroke:b8},rect:{fill:b8},shape:{stroke:b8},symbol:{fill:b8,size:30},axis:{domainColor:x8,domainWidth:.5,gridWidth:.2,labelColor:x8,tickColor:x8,tickWidth:.2,titleColor:x8},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:`square`},range:{category:[`#ab5787`,`#51b2e5`,`#703c5c`,`#168dd9`,`#d190b6`,`#00609f`,`#d365ba`,`#154866`,`#666666`,`#c4c4c4`]}},S8=`#3e5c69`,cHe={background:`#fff`,arc:{fill:S8},area:{fill:S8},line:{stroke:S8},path:{stroke:S8},rect:{fill:S8},shape:{stroke:S8},symbol:{fill:S8},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:`normal`},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:`square`},range:{category:[`#3e5c69`,`#6793a6`,`#182429`,`#0570b0`,`#3690c0`,`#74a9cf`,`#a6bddb`,`#e2ddf2`]}},C8=`#1696d2`,w8=`#000000`,lHe=`#FFFFFF`,T8=`Lato`,E8=`Lato`,uHe=`Lato`,dHe=`#DEDDDD`,fHe=18,D8={"shades-blue":[`#CFE8F3`,`#A2D4EC`,`#73BFE2`,`#46ABDB`,`#1696D2`,`#12719E`,`#0A4C6A`,`#062635`],"six-groups-cat-1":[`#1696d2`,`#ec008b`,`#fdbf11`,`#000000`,`#d2d2d2`,`#55b748`],"six-groups-seq":[`#cfe8f3`,`#a2d4ec`,`#73bfe2`,`#46abdb`,`#1696d2`,`#12719e`],"diverging-colors":[`#ca5800`,`#fdbf11`,`#fdd870`,`#fff2cf`,`#cfe8f3`,`#73bfe2`,`#1696d2`,`#0a4c6a`]},pHe={background:lHe,title:{anchor:`start`,fontSize:fHe,font:T8},axisX:{domain:!0,domainColor:w8,domainWidth:1,grid:!1,labelFontSize:12,labelFont:E8,labelAngle:0,tickColor:w8,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:T8},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:dHe,gridWidth:1,labelFontSize:12,labelFont:E8,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:T8,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:E8,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:T8,orient:`right`,offset:10},view:{stroke:`transparent`},range:{category:D8[`six-groups-cat-1`],diverging:D8[`diverging-colors`],heatmap:D8[`diverging-colors`],ordinal:D8[`six-groups-seq`],ramp:D8[`shades-blue`]},area:{fill:C8},rect:{fill:C8},line:{color:C8,stroke:C8,strokeWidth:5},trail:{color:C8,stroke:C8,strokeWidth:0,size:1},path:{stroke:C8,strokeWidth:.5},point:{filled:!0},text:{font:uHe,color:C8,fontSize:11,align:`center`,fontWeight:400,size:11},style:{bar:{fill:C8,stroke:null}},arc:{fill:C8},shape:{stroke:C8},symbol:{fill:C8,size:30}},O8=`#3366CC`,k8=`#ccc`,A8=`Arial, sans-serif`,mHe={arc:{fill:O8},area:{fill:O8},path:{stroke:O8},rect:{fill:O8},shape:{stroke:O8},symbol:{stroke:O8},circle:{fill:O8},background:`#fff`,padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:A8,fontSize:12},"guide-title":{font:A8,fontSize:12},"group-title":{font:A8,fontSize:12}},title:{font:A8,fontSize:14,fontWeight:`bold`,dy:-3,anchor:`start`},axis:{gridColor:k8,tickColor:k8,domain:!1,grid:!0},range:{category:[`#4285F4`,`#DB4437`,`#F4B400`,`#0F9D58`,`#AB47BC`,`#00ACC1`,`#FF7043`,`#9E9D24`,`#5C6BC0`,`#F06292`,`#00796B`,`#C2185B`],heatmap:[`#c6dafc`,`#5e97f6`,`#2a56c6`]}},j8=e=>e*1.3333333333333333,M8=j8(9),N8=j8(10),P8=j8(12),F8=`Segoe UI`,I8=`wf_standard-font, helvetica, arial, sans-serif`,L8=`#252423`,R8=`#605E5C`,z8=`transparent`,hHe=`#C8C6C4`,B8=`#118DFF`,gHe=`#12239E`,_He=`#E66C37`,vHe=`#6B007B`,yHe=`#E044A7`,bHe=`#744EC2`,xHe=`#D9B300`,SHe=`#D64550`,V8=B8,H8=`#DEEFFF`,U8=[H8,V8],CHe={view:{stroke:z8},background:z8,font:F8,header:{titleFont:I8,titleFontSize:P8,titleColor:L8,labelFont:F8,labelFontSize:N8,labelColor:R8},axis:{ticks:!1,grid:!1,domain:!1,labelColor:R8,labelFontSize:M8,titleFont:I8,titleColor:L8,titleFontSize:P8,titleFontWeight:`normal`},axisQuantitative:{tickCount:3,grid:!0,gridColor:hHe,gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:B8},line:{stroke:B8,strokeWidth:3,strokeCap:`round`,strokeJoin:`round`},text:{font:F8,fontSize:M8,fill:R8},arc:{fill:B8},area:{fill:B8,line:!0,opacity:.6},path:{stroke:B8},rect:{fill:B8},point:{fill:B8,filled:!0,size:75},shape:{stroke:B8},symbol:{fill:B8,strokeWidth:1.5,size:50},legend:{titleFont:F8,titleFontWeight:`bold`,titleColor:R8,labelFont:F8,labelFontSize:N8,labelColor:R8,symbolType:`circle`,symbolSize:75},range:{category:[B8,gHe,_He,vHe,yHe,bHe,xHe,SHe],diverging:U8,heatmap:U8,ordinal:[H8,`#c7e4ff`,`#b0d9ff`,`#9aceff`,`#83c3ff`,`#6cb9ff`,`#55aeff`,`#3fa3ff`,`#2898ff`,V8]}},W8=`IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif`,wHe=`IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", sans-serif`,G8=400,K8={textPrimary:{g90:`#f4f4f4`,g100:`#f4f4f4`,white:`#161616`,g10:`#161616`},textSecondary:{g90:`#c6c6c6`,g100:`#c6c6c6`,white:`#525252`,g10:`#525252`},layerAccent01:{white:`#e0e0e0`,g10:`#e0e0e0`,g90:`#525252`,g100:`#393939`},gridBg:{white:`#ffffff`,g10:`#ffffff`,g90:`#161616`,g100:`#161616`}},THe=[`#8a3ffc`,`#33b1ff`,`#007d79`,`#ff7eb6`,`#fa4d56`,`#fff1f1`,`#6fdc8c`,`#4589ff`,`#d12771`,`#d2a106`,`#08bdba`,`#bae6ff`,`#ba4e00`,`#d4bbff`],EHe=[`#6929c4`,`#1192e8`,`#005d5d`,`#9f1853`,`#fa4d56`,`#570408`,`#198038`,`#002d9c`,`#ee538b`,`#b28600`,`#009d9a`,`#012749`,`#8a3800`,`#a56eff`],DHe=i8({theme:`white`,background:`#ffffff`}),OHe=i8({theme:`g10`,background:`#f4f4f4`}),kHe=i8({theme:`g90`,background:`#262626`}),AHe=i8({theme:`g100`,background:`#161616`}),jHe=XVe.version}));function NHe(e,t,n,r){if(W(e))return`[${e.map(e=>t(vg(e)?e:FHe(e,n))).join(`, `)}]`;if(jh(e)){let i=``,{title:a,image:o,...s}=e;a&&(i+=`

${t(a)}

`),o&&(i+=``);let c=Object.keys(s);if(c.length>0){i+=``;for(let e of c){let r=s[e];r!==void 0&&(jh(r)&&(r=FHe(r,n)),i+=``)}i+=`
${t(e)}${t(r)}
`}return i||`{}`}return t(e)}function PHe(e){let t=[];return function(n,r){if(typeof r!=`object`||!r)return r;let i=t.indexOf(this)+1;return t.length=i,t.length>e?`[Object]`:t.indexOf(r)>=0?`[Circular]`:(t.push(r),r)}}function FHe(e,t){return JSON.stringify(e,PHe(t))}function IHe(e){return String(e).replace(/&/g,`&`).replace(/=0&&e.y>=0&&e.x+t.width<=window.innerWidth&&e.y+t.height<=window.innerHeight}function UHe(e,t,n){return e.clientX>=t.x&&e.clientX<=t.x+n.width&&e.clientY>=t.y&&e.clientY<=t.y+n.height}var WHe,GHe,q8,KHe,qHe,JHe=o((()=>{Dg(),WHe={version:`1.0.0`},GHe=`#vg-tooltip-element { + : v !== v && u === u ? ${r} : `}function dEe(e){let t=this;cEe(e.type)||!e.type?t.operator(e,e.update?t.operatorExpression(e.update):null):t.transform(e,e.type)}function fEe(e){let t=this;if(e.params){let n=t.get(e.id);n||U(`Invalid operator id: `+e.id),t.dataflow.connect(n,n.parameters(t.parseParameters(e.params),e.react,e.initonly))}}function pEe(e,t){t||={};let n=this;for(let r in e){let i=e[r];t[r]=W(i)?i.map(e=>UW(e,n,t)):UW(i,n,t)}return t}function UW(e,t,n){if(!e||!jh(e))return e;for(let r=0,i=XW.length,a;re&&e.$tupleid?ox:e);return t.fn[n]||(t.fn[n]=ng(r,e.$order,t.expr.codegen))}function yEe(e,t){let n=e.$encode,r={};for(let e in n){let i=n[e];r[e]=lh(t.encodeExpression(i.$expr),i.$fields),r[e].output=i.$output}return r}function bEe(e,t){return t}function xEe(e,t){let n=e.$subflow;return function(e,r,i){let a=t.fork().parse(n),o=a.get(n.operators[0].id),s=a.signals.parent;return s&&s.set(i),o.detachSubflow=()=>t.detach(a),o}}function SEe(){return ox}function CEe(e){var t=this,n=e.filter==null?void 0:t.eventExpression(e.filter),r=e.stream==null?void 0:t.get(e.stream),i;e.source?r=t.events(e.source,e.type,n):e.merge&&(i=e.merge.map(e=>t.get(e)),r=i[0].merge.apply(i[0],i.slice(1))),e.between&&(i=e.between.map(e=>t.get(e)),r=r.between(i[0],i[1])),e.filter&&(r=r.filter(n)),e.throttle!=null&&(r=r.throttle(+e.throttle)),e.debounce!=null&&(r=r.debounce(+e.debounce)),r??U(`Invalid stream definition: `+JSON.stringify(e)),e.consume&&r.consume(!0),t.stream(e,r)}function wEe(e){var t=this,n=jh(n=e.source)?n.$ref:n,r=t.get(n),i=null,a=e.update,o=void 0;r||U(`Source not defined: `+e.source),i=e.target&&e.target.$expr?t.eventExpression(e.target.$expr):t.get(e.target),a&&a.$expr&&(a.$params&&(o=t.parseParameters(a.$params)),a=t.handlerExpression(a.$expr)),t.update(e,r,i,a,o)}function TEe(e){var t=this,n={};if(e.signals){var r=n.signals={};Object.keys(t.signals).forEach(n=>{let i=t.signals[n];e.signals(n,i)&&(r[n]=i.value)})}if(e.data){var i=n.data={};Object.keys(t.data).forEach(n=>{let r=t.data[n];e.data(n,r)&&(i[n]=r.input.value)})}return t.subcontext&&e.recurse!==!1&&(n.subcontext=t.subcontext.map(t=>t.getState(e))),n}function EEe(e){var t=this,n=t.dataflow,r=e.data,i=e.signals;Object.keys(i||{}).forEach(e=>{n.update(t.signals[e],i[e],ZW)}),Object.keys(r||{}).forEach(e=>{n.pulse(t.data[e].input,n.changeset().remove(Eh).insert(r[e]))}),(e.subcontext||[]).forEach((e,n)=>{let r=t.subcontext[n];r&&r.setState(e)})}function WW(e,t,n,r){return new GW(e,t,n,r)}function GW(e,t,n,r){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=r||YW,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function KW(e){this.dataflow=e.dataflow,this.transforms=e.transforms,this.events=e.events,this.expr=e.expr,this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.nodes=Object.create(e.nodes),this.data=Object.create(e.data),this.fn=Object.create(e.fn),e.functions&&(this.functions=Object.create(e.functions),this.functions.context=this)}var qW,JW,YW,XW,ZW,QW=o((()=>{Dg(),eS(),qW=Tg([`rule`]),JW=Tg([`group`,`image`,`rect`]),YW={operator:(e,t)=>HW(e,[`_`],t.code),parameter:(e,t)=>HW(e,[`datum`,`_`],t.code),event:(e,t)=>HW(e,[`event`],t.code),handler:(e,t)=>HW(e,[`_`,`event`],`var datum=event.item&&event.item.datum;return ${t.code};`),encode:(e,t)=>{let{marktype:n,channels:r}=t,i=`var o=item,datum=o.datum,m=0,$;`;for(let e in r){let t=`o[`+G(e)+`]`;i+=`$=${r[e].code};if(${t}!==$)${t}=$,m=1;`}return i+=sEe(r,n),i+=`return m;`,HW(e,[`item`,`_`],i)},codegen:{get(e){let t=`[${e.map(G).join(`][`)}]`,n=Function(`_`,`return _${t};`);return n.path=t,n},comparator(e,t){let n,r=Function(`a`,`b`,`var u, v; return `+e.map((e,r)=>{let i=t[r],a,o;return e.path?(a=`a${e.path}`,o=`b${e.path}`):((n||={})[`f`+r]=e,a=`this.f${r}(a)`,o=`this.f${r}(b)`),uEe(a,o,-i,i)}).join(``)+`0;`);return n?r.bind(n):r}}},XW=[{key:`$ref`,parse:mEe},{key:`$key`,parse:gEe},{key:`$expr`,parse:hEe},{key:`$field`,parse:_Ee},{key:`$encode`,parse:yEe},{key:`$compare`,parse:vEe},{key:`$context`,parse:bEe},{key:`$subflow`,parse:xEe},{key:`$tupleid`,parse:SEe}],ZW={skip:!0},GW.prototype=KW.prototype={fork(){let e=new KW(this);return(this.subcontext||=[]).push(e),e},detach(e){this.subcontext=this.subcontext.filter(t=>t!==e);let t=Object.keys(e.nodes);for(let n of t)e.nodes[n]._targets=null;for(let n of t)e.nodes[n].detach();e.nodes=null},get(e){return this.nodes[e]},set(e,t){return this.nodes[e]=t},add(e,t){let n=this,r=n.dataflow,i=e.value;if(n.set(e.id,t),lEe(e.type)&&i&&(i.$ingest?r.ingest(t,i.$ingest,i.$format):i.$request?r.preload(t,i.$request,i.$format):r.pulse(t,r.changeset().insert(i))),e.root&&(n.root=t),e.parent){let i=n.get(e.parent.$ref);i?(r.connect(i,[t]),t.targets().add(i)):(n.unresolved=n.unresolved||[]).push(()=>{i=n.get(e.parent.$ref),r.connect(i,[t]),t.targets().add(i)})}if(e.signal&&(n.signals[e.signal]=t),e.scale&&(n.scales[e.scale]=t),e.data)for(let r in e.data){let i=n.data[r]||(n.data[r]={});e.data[r].forEach(e=>i[e]=t)}},resolve(){return(this.unresolved||[]).forEach(e=>e()),delete this.unresolved,this},operator(e,t){this.add(e,this.dataflow.add(e.value,t))},transform(e,t){this.add(e,this.dataflow.add(this.transforms[VW(t)]))},stream(e,t){this.set(e.id,t)},update(e,t,n,r,i){this.dataflow.on(t,n,r,i,e.options)},operatorExpression(e){return this.expr.operator(this,e)},parameterExpression(e){return this.expr.parameter(this,e)},eventExpression(e){return this.expr.event(this,e)},handlerExpression(e){return this.expr.handler(this,e)},encodeExpression(e){return this.expr.encode(this,e)},parse:oEe,parseOperator:dEe,parseOperatorParameters:fEe,parseParameters:pEe,parseStream:CEe,parseUpdate:wEe,getState:TEe,setState:EEe}}));function DEe(e){let t=e.container();t&&(t.setAttribute(`role`,`graphics-document`),t.setAttribute(`aria-roleDescription`,`visualization`),$W(t,e.description()))}function $W(e,t){e&&(t==null?e.removeAttribute(`aria-label`):e.setAttribute(`aria-label`,t))}function OEe(e){e.add(null,t=>(e._background=t.bg,e._resize=1,t.bg),{bg:e._signals.background})}function kEe(e){let t=e._signals.cursor||(e._signals.cursor=e.add({user:DG,item:null}));e.on(e.events(`view`,`pointermove`),t,(e,n)=>{let r=t.value,i=r?vg(r)?r:r.user:DG,a=n.item&&n.item.cursor||null;return r&&i===r.user&&a==r.item?r:{user:i,item:a}}),e.add(null,function(t){let n=t.cursor,r=this.value;return vg(n)||(r=n.item,n=n.user),eG(e,n&&n!==DG?n:r||n),r},{cursor:t})}function eG(e,t){let n=e.globalCursor()?typeof document<`u`&&document.body:e.container();if(n)return t==null?n.style.removeProperty(`cursor`):n.style.cursor=t}function tG(e,t){var n=e._runtime.data;return cg(n,t)||U(`Unrecognized data set: `+t),n[t]}function AEe(e,t){return arguments.length<2?tG(this,e).values.value:nG.call(this,e,mx().remove(Eh).insert(t))}function nG(e,t){px(t)||U(`Second argument to changes must be a changeset.`);let n=tG(this,e);return n.modified=!0,this.pulse(n.input,t)}function jEe(e,t){return nG.call(this,e,mx().insert(t))}function MEe(e,t){return nG.call(this,e,mx().remove(t))}function rG(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function iG(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function aG(e){var t=e.padding(),n=e._origin;return[t.left+n[0],t.top+n[1]]}function NEe(e){var t=aG(e),n=rG(e),r=iG(e);e._renderer.background(e.background()),e._renderer.resize(n,r,t),e._handler.origin(t),e._resizeListeners.forEach(t=>{try{t(n,r)}catch(t){e.error(t)}})}function PEe(e,t,n){var r=e._renderer,i=r&&r.canvas(),a,o,s;return i&&(s=aG(e),o=t.changedTouches?t.changedTouches[0]:t,a=wk(o,i),a[0]-=s[0],a[1]-=s[1]),t.dataflow=e,t.item=n,t.vega=FEe(e,n,a),t}function FEe(e,t,n){let r=t?t.mark.marktype===`group`?t:t.mark.group:null;function i(e){var n=r,i;if(e){for(i=t;i;i=i.mark.group)if(i.mark.name===e){n=i;break}}return n&&n.mark&&n.mark.interactive?n:{}}function a(e){if(!e)return n;vg(e)&&(e=i(e));let t=n.slice();for(;e;)t[0]-=e.x||0,t[1]-=e.y||0,e=e.mark&&e.mark.group;return t}return{view:ig(e),item:ig(t||{}),group:i,xy:a,x:e=>a(e)[0],y:e=>a(e)[1]}}function IEe(e){let t=og({defaults:{}},e),n=(e,t)=>{t.forEach(t=>{W(e[t])&&(e[t]=Tg(e[t]))})};return n(t.defaults,[`prevent`,`allow`]),n(t,[`view`,`window`,`selector`]),t}function oG(e,t,n,r){e._eventListeners.push({type:n,sources:Qh(t),handler:r})}function LEe(e,t){var n=e._eventConfig.defaults,r=n.prevent,i=n.allow;return r===!1||i===!0?!1:r===!0||i===!1?!0:r?r[t]:i?!i[t]:e.preventDefault()}function sG(e,t,n){let r=e._eventConfig&&e._eventConfig[t];return r===!1||jh(r)&&!r[n]?(e.warn(`Blocked ${t} ${n} event listener.`),!1):!0}function REe(e,t,n){var r=this,i=new vx(n),a=function(n,a){r.runAsync(null,()=>{e===OG&&LEe(r,t)&&n.preventDefault(),i.receive(PEe(r,n,a))})},o;if(e===kG)sG(r,`timer`,t)&&r.timer(a,t);else if(e===OG)sG(r,`view`,t)&&r.addEventListener(t,a,jG);else if(e===AG?sG(r,`window`,t)&&typeof window<`u`&&(o=[window]):typeof document<`u`&&sG(r,`selector`,t)&&(o=Array.from(document.querySelectorAll(e))),!o)r.warn(`Can not resolve event source: `+e);else{for(var s=0,c=o.length;s=0;)t[i].stop();for(i=r.length;--i>=0;)for(o=r[i],a=o.sources.length;--a>=0;)o.sources[a].removeEventListener(o.type,o.handler);for(e&&e.call(this,this._handler,null,null,null),i=n.length;--i>=0;)c=n[i].type,s=n[i].handler,this._handler.off(c,s);return this}function dG(e,t,n){let r=document.createElement(e);for(let e in t)r.setAttribute(e,t[e]);return n!=null&&(r.textContent=n),r}function VEe(e,t,n){if(!t)return;let r=n.param,i=n.state;return i||(i=n.state={elements:null,active:!1,set:null,update:t=>{t!=e.signal(r.signal)&&e.runAsync(null,()=>{i.source=!0,e.signal(r.signal,t)})}},r.debounce&&(i.update=ag(r.debounce,i.update))),(r.input==null&&r.element?HEe:WEe)(i,t,r,e),i.active||(e.on(e._signals[r.signal],null,()=>{i.source?i.source=!1:i.set(e.signal(r.signal))}),i.active=!0),i}function HEe(e,t,n,r){let i=n.event||`input`,a=()=>e.update(t.value);r.signal(n.signal,t.value),t.addEventListener(i,a),oG(r,t,i,a),e.set=e=>{t.value=e,t.dispatchEvent(UEe(i))}}function UEe(e){return typeof Event<`u`?new Event(e):{type:e}}function WEe(e,t,n,r){let i=r.signal(n.signal),a=dG(`div`,{class:MG}),o=n.input===`radio`?a:a.appendChild(dG(`label`));o.appendChild(dG(`span`,{class:NG},n.name||n.signal)),t.appendChild(a);let s=GEe;switch(n.input){case`checkbox`:s=KEe;break;case`select`:s=qEe;break;case`radio`:s=JEe;break;case`range`:s=YEe;break}s(e,o,n,i)}function GEe(e,t,n,r){let i=dG(`input`);for(let e in n)e!==`signal`&&e!==`element`&&i.setAttribute(e===`input`?`type`:e,n[e]);i.setAttribute(`name`,n.signal),i.value=r,t.appendChild(i),i.addEventListener(`input`,()=>e.update(i.value)),e.elements=[i],e.set=e=>i.value=e}function KEe(e,t,n,r){let i={type:`checkbox`,name:n.signal};r&&(i.checked=!0);let a=dG(`input`,i);t.appendChild(a),a.addEventListener(`change`,()=>e.update(a.checked)),e.elements=[a],e.set=e=>a.checked=!!e||null}function qEe(e,t,n,r){let i=dG(`select`,{name:n.signal}),a=n.labels||[];n.options.forEach((e,t)=>{let n={value:e};fG(e,r)&&(n.selected=!0),i.appendChild(dG(`option`,n,(a[t]||e)+``))}),t.appendChild(i),i.addEventListener(`change`,()=>{e.update(n.options[i.selectedIndex])}),e.elements=[i],e.set=e=>{for(let t=0,r=n.options.length;t{let s={type:`radio`,name:n.signal,value:t};fG(t,r)&&(s.checked=!0);let c=dG(`input`,s);c.addEventListener(`change`,()=>e.update(t));let l=dG(`label`,{},(a[o]||t)+``);return l.prepend(c),i.appendChild(l),c}),e.set=t=>{let n=e.elements,r=n.length;for(let e=0;e{c.textContent=s.value,e.update(+s.value)};s.addEventListener(`input`,l),s.addEventListener(`change`,l),e.elements=[s],e.set=e=>{s.value=e,c.textContent=e}}function fG(e,t){return e===t||e+``==t+``}function pG(e,t,n,r,i,a){return t||=new r(e.loader()),t.initialize(n,rG(e),iG(e),aG(e),i,a).background(e.background())}function mG(e,t){return t?function(){try{t.apply(this,arguments)}catch(t){e.error(t)}}:null}function XEe(e,t,n,r){let i=new r(e.loader(),mG(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,aG(e),e);return t&&t.handlers().forEach(e=>{i.on(e.type,e.handler)}),i}function ZEe(e,t){let n=this,r=n._renderType,i=n._eventConfig.bind,a=jk(r);e=n._el=e?hG(n,e,!0):null,DEe(n),a||n.error(`Unrecognized renderer type: `+r);let o=a.handler||JA,s=e?a.renderer:a.headless;return n._renderer=s?pG(n,n._renderer,e,s):null,n._handler=XEe(n,n._handler,e,o),n._redraw=!0,e&&i!==`none`&&(t=t?n._elBind=hG(n,t,!0):e.appendChild(dG(`form`,{class:`vega-bindings`})),n._bind.forEach(e=>{e.param.element&&i!==`container`&&(e.element=hG(n,e.param.element,!!e.param.input))}),n._bind.forEach(e=>{VEe(n,e.element||t,e)})),n}function hG(e,t,n){if(typeof t==`string`)if(typeof document<`u`){if(t=document.querySelector(t),!t)return e.error(`Signal bind element not found: `+t),null}else return e.error(`DOM document instance not found.`),null;if(t&&n)try{t.textContent=``}catch(n){t=null,e.error(n)}return t}function gG(e){return jh(e)?{top:FG(e.top),bottom:FG(e.bottom),left:FG(e.left),right:FG(e.right)}:IG(FG(e))}async function _G(e,t,n,r){let i=jk(t),a=i&&i.headless;return a||U(`Unrecognized renderer type: `+t),await e.runAsync(),pG(e,null,null,a,n,r).renderAsync(e._scenegraph.root)}async function QEe(e,t){e!==Mj.Canvas&&e!==Mj.SVG&&e!==Mj.PNG&&U(`Unrecognized image type: `+e);let n=await _G(this,e,t);return e===Mj.SVG?$Ee(n.svg(),`image/svg+xml`):n.canvas().toDataURL(`image/png`)}function $Ee(e,t){let n=new Blob([e],{type:t});return window.URL.createObjectURL(n)}async function eDe(e,t){return(await _G(this,Mj.Canvas,e,t)).canvas()}async function tDe(e){return(await _G(this,Mj.SVG,e)).svg()}function nDe(e,t,n){return WW(e,$x,NW,n).parse(t)}function rDe(e){var t=this._runtime.scales;return cg(t,e)||U(`Unrecognized scale or projection: `+e),t[e].value}function vG(e,t){var n=e.autosize(),r=e.padding();return t-(n&&n.contains===zG?r.left+r.right:0)}function yG(e,t){var n=e.autosize(),r=e.padding();return t-(n&&n.contains===zG?r.top+r.bottom:0)}function iDe(e){var t=e._signals,n=t[LG],r=t[RG],i=t[zG];function a(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,t=>{e._width=t.size,e._viewWidth=vG(e,t.size),a()},{size:n}),e._resizeHeight=e.add(null,t=>{e._height=t.size,e._viewHeight=yG(e,t.size),a()},{size:r});let o=e.add(null,a,{pad:i});e._resizeWidth.rank=n.rank+1,e._resizeHeight.rank=r.rank+1,o.rank=i.rank+1}function aDe(e,t,n,r,i,a){this.runAfter(o=>{let s=0;o._autosize=0,o.width()!==n&&(s=1,o.signal(LG,n,BG),o._resizeWidth.skip(!0)),o.height()!==r&&(s=1,o.signal(RG,r,BG),o._resizeHeight.skip(!0)),o._viewWidth!==e&&(o._resize=1,o._viewWidth=e),o._viewHeight!==t&&(o._resize=1,o._viewHeight=t),(o._origin[0]!==i[0]||o._origin[1]!==i[1])&&(o._resize=1,o._origin=i),s&&o.run(`enter`),a&&o.runAfter(e=>e.resize())},!1,1)}function oDe(e){return this._runtime.getState(e||{data:sDe,signals:cDe,recurse:!0})}function sDe(e,t){return t.modified&&W(t.input.value)&&!e.startsWith(`_:vega:_`)}function cDe(e,t){return!(e===`parent`||t instanceof $x.proxy)}function lDe(e){return this.runAsync(null,t=>{t._trigger=!1,t._runtime.setState(e)},e=>{e._trigger=!0}),this}function uDe(e,t){function n(t){e({timestamp:Date.now(),elapsed:t})}this._timers.push(Nxe(n,t))}function dDe(e,t,n,r){let i=e.element();i&&i.setAttribute(`title`,fDe(r))}function fDe(e){return e==null?``:W(e)?bG(e):jh(e)&&!hg(e)?pDe(e):e+``}function pDe(e){return Object.keys(e).map(t=>{let n=e[t];return t+`: `+(W(n)?bG(n):xG(n))}).join(` +`)}function bG(e){return`[`+e.map(xG).join(`, `)+`]`}function xG(e){return W(e)?`[…]`:jh(e)&&!hg(e)?`{…}`:e}function mDe(){if(this.renderer()===`canvas`&&this._renderer._canvas){let e=null,t=()=>{e?.();let n=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);n.addEventListener(`change`,t),e=()=>{n.removeEventListener(`change`,t)},this._renderer._canvas.getContext(`2d`).pixelRatio=window.devicePixelRatio||1,this._redraw=!0,this._resize=1,this.resize().runAsync()};t()}}function SG(e,t){let n=this;if(t||={},Dx.call(n),t.loader&&n.loader(t.loader),t.logger&&n.logger(t.logger),t.logLevel!=null&&n.logLevel(t.logLevel),t.locale||e.locale){let r=og({},e.locale,t.locale);n.locale(Eb(r.number,r.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||Mj.Canvas,n._scenegraph=new CA;let r=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||dDe,n._redraw=!0,n._handler=new JA().scene(r),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=IEe(e.eventConfig),n.globalCursor(n._eventConfig.globalCursor);let i=nDe(n,e,t.expr);n._runtime=i,n._signals=i.signals,n._bind=(e.bindings||[]).map(e=>({state:null,param:og({},e)})),i.root&&i.root.set(r),r.source=i.data.root.input,n.pulse(i.data.root.input,n.changeset().insert(r.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=vG(n,n._width),n._viewHeight=yG(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,iDe(n),OEe(n),kEe(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind),t.watchPixelRatio&&n._watchPixelRatio()}function CG(e,t){return cg(e._signals,t)?e._signals[t]:U(`Unrecognized signal name: `+G(t))}function wG(e,t){let n=(e._targets||[]).filter(e=>e._update&&e._update.handler===t);return n.length?n[0]:null}function TG(e,t,n,r){let i=wG(n,r);return i||(i=mG(e,()=>r(t,n.value)),i.handler=r,e.on(n,null,i)),e}function EG(e,t,n){let r=wG(t,n);return r&&t._targets.remove(r),e}var DG,OG,kG,AG,jG,MG,NG,PG,FG,IG,LG,RG,zG,BG,hDe=o((()=>{Dg(),eS(),Ij(),e_(),BW(),QW(),ez(),jb(),DG=`default`,OG=`view`,kG=`timer`,AG=`window`,jG={trap:!1},MG=`vega-bind`,NG=`vega-bind-name`,PG=`vega-bind-radio`,FG=e=>+e||0,IG=e=>({top:e,bottom:e,left:e,right:e}),LG=`width`,RG=`height`,zG=`padding`,BG={skip:!0},fg(SG,Dx,{async evaluate(e,t,n){if(await Dx.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,NEe(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(e){this.error(e)}return n&&ix(this,n),this},dirty(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},description(e){if(arguments.length){let t=e==null?null:e+``;return t!==this._desc&&$W(this._el,this._desc=t),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(e,t,n){let r=CG(this,e);return arguments.length===1?r.value:this.update(r,t,n)},width(e){return arguments.length?this.signal(`width`,e):this.signal(`width`)},height(e){return arguments.length?this.signal(`height`,e):this.signal(`height`)},padding(e){return arguments.length?this.signal(`padding`,gG(e)):gG(this.signal(`padding`))},autosize(e){return arguments.length?this.signal(`autosize`,e):this.signal(`autosize`)},background(e){return arguments.length?this.signal(`background`,e):this.signal(`background`)},renderer(e){return arguments.length?(jk(e)||U(`Unrecognized renderer type: `+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},tooltip(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},loader(e){return arguments.length?(e!==this._loader&&(Dx.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(CG(this,`autosize`))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:aDe,addEventListener(e,t,n){let r=t;return n&&n.trap===!1||(r=mG(this,t),r.raw=t),this._handler.on(e,r),this},removeEventListener(e,t){for(var n=this._handler.handlers(e),r=n.length,i,a;--r>=0;)if(a=n[r].type,i=n[r].handler,e===a&&(t===i||t===i.raw)){this._handler.off(a,i);break}return this},addResizeListener(e){let t=this._resizeListeners;return t.includes(e)||t.push(e),this},removeResizeListener(e){var t=this._resizeListeners,n=t.indexOf(e);return n>=0&&t.splice(n,1),this},addSignalListener(e,t){return TG(this,e,CG(this,e),t)},removeSignalListener(e,t){return EG(this,CG(this,e),t)},addDataListener(e,t){return TG(this,e,tG(this,e).values,t)},removeDataListener(e,t){return EG(this,tG(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){let t=eG(this,null);this._globalCursor=!!e,t&&eG(this,t)}return this}else return this._globalCursor},preventDefault(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},timer:uDe,events:REe,finalize:BEe,hover:zEe,data:AEe,change:nG,insert:jEe,remove:MEe,scale:rDe,initialize:ZEe,toImageURL:QEe,toCanvas:eDe,toSVG:tDe,getState:oDe,setState:lDe,_watchPixelRatio:mDe})}));function VG(e,t,n){return nK=t||GG,rK=n||tK,UG(e.trim()).map(WG)}function gDe(e){return rK[e]}function HG(e,t,n,r,i){let a=e.length,o=0,s;for(;t' after between selector: `+e;r=r.map(WG);let i=WG(e.slice(1).trim());return i.between?{between:r,stream:i}:(i.between=r,i)}function vDe(e){let t={source:nK},n=[],r=[0,0],i=0,a=0,o=e.length,s=0,c,l;if(e[o-1]===YG){if(s=e.lastIndexOf(JG),s>=0){try{r=yDe(e.substring(s+1,o-1))}catch{throw`Invalid throttle specification: `+e}e=e.slice(0,s).trim(),o=e.length}else throw`Unmatched right brace: `+e;s=0}if(!o)throw e;if(e[0]===QG&&(i=++s),c=HG(e,s,XG),c1?(t.type=n[1],i?t.markname=n[0].slice(1):gDe(n[0])?t.marktype=n[0]:t.source=n[0]):t.type=n[0],t.type.slice(-1)===`!`&&(t.consume=!0,t.type=t.type.slice(0,-1)),l!=null&&(t.filter=l),r[0]&&(t.throttle=r[0]),r[1]&&(t.debounce=r[1]),t}function yDe(e){let t=e.split(ZG);if(!e.length||t.length>2)throw e;return t.map(t=>{let n=+t;if(n!==n)throw e;return n})}var GG,KG,qG,JG,YG,XG,ZG,QG,$G,eK,tK,nK,rK,iK=o((()=>{GG=`view`,KG=`[`,qG=`]`,JG=`{`,YG=`}`,XG=`:`,ZG=`,`,QG=`@`,$G=`>`,eK=/[[\]{}]/,tK={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1}}));function bDe(e){return jh(e)?e:{type:e||`pad`}}function xDe(e){return jh(e)?e.signal?e:{top:hq(e.top),bottom:hq(e.bottom),left:hq(e.left),right:hq(e.right)}:gq(hq(e))}function aK(e,t,n,r){return n==null?0:(jh(n)&&!W(n)||W(n)&&n.length&&jh(n[0])?e.update[t]=n:e[r||`enter`][t]={value:n},1)}function oK(e,t,n){for(let n in t)aK(e,n,t[n]);for(let t in n)aK(e,t,n[t],`update`)}function sK(e,t,n){for(let r in t)n&&cg(n,r)||(e[r]=og(e[r]||{},t[r]));return e}function cK(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}function SDe(e,t,n,r,i){let a={},o={},s,c,l,u;for(c in c=`lineBreak`,t===`text`&&i[c]!=null&&!cK(c,e)&&lK(a,c,i[c]),(n==`legend`||String(n).startsWith(`axis`))&&(n=null),u=n===`frame`?i.group:n===`mark`?og({},i.mark,i[t]):null,u)l=cK(c,e)||(c===`fill`||c===`stroke`)&&(cK(`fill`,e)||cK(`stroke`,e)),l||lK(a,c,u[c]);for(c in Qh(r).forEach(t=>{let n=i.style&&i.style[t];for(let t in n)cK(t,e)||lK(a,t,n[t])}),e=og({},e),a)u=a[c],u.signal?(s||={})[c]=u:o[c]=u;return e.enter=og(o,e.enter),s&&(e.update=og(s,e.update)),e}function lK(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}function uK(e){if(e.gradient!=null)return wDe(e);let t=e.signal?`(${e.signal})`:e.color?CDe(e.color):e.field==null?e.value===void 0?void 0:G(e.value):fK(e.field);return e.scale!=null&&(t=TDe(e,t)),t===void 0&&(t=null),e.exponent!=null&&(t=`pow(${t},${dK(e.exponent)})`),e.mult!=null&&(t+=`*${dK(e.mult)}`),e.offset!=null&&(t+=`+${dK(e.offset)}`),e.round&&(t=`round(${t})`),t}function CDe(e){return e.c?Lq(`hcl`,e.h,e.c,e.l):e.h||e.s?Lq(`hsl`,e.h,e.s,e.l):e.l||e.a?Lq(`lab`,e.l,e.a,e.b):e.r||e.g||e.b?Lq(`rgb`,e.r,e.g,e.b):null}function wDe(e){let t=[e.start,e.stop,e.count].map(e=>e==null?null:G(e));for(;t.length&&Ih(t)==null;)t.pop();return t.unshift(Iq(e.gradient)),`gradient(${t.join(`,`)})`}function dK(e){return jh(e)?`(`+uK(e)+`)`:e}function fK(e){return pK(jh(e)?e:{datum:e})}function pK(e){let t,n,r;if(e.signal)t=`datum`,r=e.signal;else if(e.group||e.parent){for(n=Math.max(1,e.level||1),t=`item`;n-->0;)t+=`.mark.group`;e.parent?(r=e.parent,t+=`.datum`):r=e.group}else e.datum?(t=`datum`,r=e.datum):U(`Invalid field reference: `+G(e));return e.signal||(r=vg(r)?vh(r).map(G).join(`][`):pK(r)),t+`[`+r+`]`}function TDe(e,t){let n=Iq(e.scale);return e.range==null?(t!==void 0&&(t=`_scale(${n}, ${t})`),e.band&&(t=(t?t+`+`:``)+`_bandwidth(${n})`+(+e.band==1?``:`*`+dK(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),t??=`0`):t=`lerp(_range(${n}), ${+e.range})`,t}function EDe(e){let t=``;return e.forEach(e=>{let n=uK(e);t+=e.test?`(${e.test})?${n}:`:n}),Ih(t)===`:`&&(t+=`null`),t}function mK(e,t,n,r,i,a){let o={};a||={},a.encoders={$encode:o},e=SDe(e,t,n,r,i.config);for(let n in e)o[n]=DDe(e[n],t,a,i);return a}function DDe(e,t,n,r){let i={},a={};for(let t in e)e[t]!=null&&(i[t]=kDe(ODe(e[t]),r,n,a));return{$expr:{marktype:t,channels:i},$fields:Object.keys(a),$output:Object.keys(e)}}function ODe(e){return W(e)?EDe(e):uK(e)}function kDe(e,t,n,r){let i=yW(e,t);return i.$fields.forEach(e=>r[e]=1),og(n,i.$params),i.$expr}function hK(e,t){U(e+` for "outer" push: `+G(t))}function gK(e,t){let n=e.name;if(e.push===Rq)t.signals[n]||hK(`No prior signal definition`,n),zq.forEach(t=>{e[t]!==void 0&&hK(`Invalid property `,t)});else{let r=t.addSignal(n,e.value);e.react===!1&&(r.react=!1),e.bind&&t.addBinding(n,e.bind)}}function _K(e,t,n,r){this.id=-1,this.type=e,this.value=t,this.params=n,r&&(this.parent=r)}function vK(e,t,n,r){return new _K(e,t,n,r)}function yK(e,t){return vK(`operator`,e,t)}function bK(e){let t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function xK(e,t){return t?{$field:e,$name:t}:{$field:e}}function SK(e,t){return{$compare:e,$order:t}}function ADe(e,t){let n={$key:e};return t&&(n.$flat=!0),n}function jDe(e){return jh(e)?(e.order===Hq?`-`:`+`)+CK(e.op,e.field):``}function CK(e,t){return(e&&e.signal?`$`+e.signal:e||``)+(e&&t?`_`:``)+(t&&t.signal?`$`+t.signal:t?.replace(/\W+/g,`_`).replace(/^_+|_+$/g,``)||``)}function wK(e){return e&&e.signal}function MDe(e){return e&&e.expr}function TK(e){if(wK(e))return!0;if(jh(e)){for(let t in e)if(TK(e[t]))return!0}return!1}function EK(e,t){return e??t}function DK(e){return e&&e.signal||e}function OK(e,t){return(e.merge?PDe:e.stream?FDe:e.type?IDe:U(`Invalid stream specification: `+G(e)))(e,t)}function NDe(e){return e===Uq?Wq:e||Wq}function PDe(e,t){let n=kK({merge:e.merge.map(e=>OK(e,t))},e,t);return t.addStream(n).id}function FDe(e,t){let n=kK({stream:OK(e.stream,t)},e,t);return t.addStream(n).id}function IDe(e,t){let n;e.type===Gq?(n=t.event(Gq,e.throttle),e={between:e.between,filter:e.filter}):n=t.event(NDe(e.source),e.type);let r=kK({stream:n},e,t);return Object.keys(r).length===1?n:t.addStream(r).id}function kK(e,t,n){let r=t.between;return r&&(r.length!==2&&U(`Stream "between" parameter must have 2 entries: `+G(t)),e.between=[OK(r[0],n),OK(r[1],n)]),r=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&r.push(LDe(t.marktype,t.markname,t.markrole)),t.source===Uq&&r.push(`inScope(event.item)`),r.length&&(e.filter=yW(`(`+r.join(`)&&(`)+`)`,n).$expr),(r=t.throttle)!=null&&(e.throttle=+r),(r=t.debounce)!=null&&(e.debounce=+r),t.consume&&(e.consume=!0),e}function LDe(e,t,n){return`event.item`+(e&&e!==`*`?`&&event.item.mark.marktype==='`+e+`'`:``)+(n?`&&event.item.mark.role==='`+n+`'`:``)+(t?`&&event.item.mark.name==='`+t+`'`:``)}function RDe(e,t,n){let r=e.encode,i={target:n},a=e.events,o=e.update,s=[];a||U(`Signal update missing events specification.`),vg(a)&&(a=VG(a,t.isSubscope()?Uq:Wq)),a=Qh(a).filter(e=>e.signal||e.scale?(s.push(e),0):1),s.length>1&&(s=[BDe(s)]),a.length&&s.push(a.length>1?{merge:a}:a[0]),r!=null&&(o&&U(`Signal encode and update are mutually exclusive.`),o=`encode(item(),`+G(r)+`)`),i.update=vg(o)?yW(o,t):o.expr==null?o.value==null?o.signal==null?U(`Invalid signal update specification.`):{$expr:Kq,$params:{$value:t.signalRef(o.signal)}}:o.value:yW(o.expr,t),e.force&&(i.options={force:!0}),s.forEach(e=>t.addUpdate(og(zDe(e,t),i)))}function zDe(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):OK(e,t)}}function BDe(e){return{signal:`[`+e.map(e=>e.scale?`scale("`+e.scale+`")`:e.signal)+`]`}}function VDe(e,t){let n=t.getSignal(e.name),r=e.update;e.init&&(r?U(`Signals can not include both init and update expressions.`):(r=e.init,n.initonly=!0)),r&&(r=yW(r,t),n.update=r.$expr,n.params=r.$params),e.on&&e.on.forEach(e=>RDe(e,t,n.id))}function HDe(e,t){let n=e.type||`linear`;Xpe(n)||U(`Unrecognized scale type: `+G(n)),t.addScale(e.name,{type:n,domain:void 0})}function UDe(e,t){let n=t.getScale(e.name).params,r;for(r in n.domain=NK(e.domain,e,t),e.range!=null&&(n.range=FK(e,t,n)),e.interpolate!=null&&$De(e.interpolate,n),e.nice!=null&&(n.nice=QDe(e.nice,t)),e.bins!=null&&(n.bins=ZDe(e.bins,t)),e)cg(n,r)||r===`name`||(n[r]=AK(e[r],t))}function AK(e,t){return jh(e)?e.signal?t.signalRef(e.signal):U(`Unsupported object: `+G(e)):e}function jK(e,t){return e.signal?t.signalRef(e.signal):e.map(e=>AK(e,t))}function MK(e){U(`Can not find data set: `+G(e))}function NK(e,t,n){if(!e){(t.domainMin!=null||t.domainMax!=null)&&U(`No scale domain defined for domainMin/domainMax to override.`);return}return e.signal?n.signalRef(e.signal):(W(e)?WDe:e.fields?KDe:GDe)(e,t,n)}function WDe(e,t,n){return e.map(e=>AK(e,n))}function GDe(e,t,n){let r=n.getData(e.data);return r||MK(e.data),WD(t.type)?r.valuesRef(n,e.field,PK(e.sort,!1)):$pe(t.type)?r.domainRef(n,e.field):r.extentRef(n,e.field)}function KDe(e,t,n){let r=e.data,i=e.fields.reduce((e,t)=>(t=vg(t)?{data:r,field:t}:W(t)||t.signal?qDe(t,n):t,e.push(t),e),[]);return(WD(t.type)?JDe:$pe(t.type)?YDe:XDe)(e,n,i)}function qDe(e,t){let n=`_:vega:_`+SJ++,r=Zq({});if(W(e))r.value={$ingest:e};else if(e.signal){let i=`setdata(`+G(n)+`,`+e.signal+`)`;r.params.input=t.signalRef(i)}return t.addDataPipeline(n,[r,vJ({})]),{data:n,field:`data`}}function JDe(e,t,n){let r=PK(e.sort,!0),i,a,o=n.map(e=>{let n=t.getData(e.data);return n||MK(e.data),n.countsRef(t,e.field,r)}),s={groupby:Bq,pulse:o};r&&(i=r.op||`count`,a=r.field?CK(i,r.field):`count`,s.ops=[CJ[i]],s.fields=[t.fieldRef(a)],s.as=[a]),i=t.add(Jq(s));let c=t.add(Zq({pulse:bK(i)}));return a=t.add(xJ({field:Bq,sort:t.sortRef(r),pulse:bK(c)})),bK(a)}function PK(e,t){return e&&(!e.field&&!e.op?jh(e)?e.field=`key`:e={field:`key`}:!e.field&&e.op!==`count`?U(`No field provided for sort aggregate op: `+e.op):t&&e.field&&e.op&&!CJ[e.op]&&U(`Multiple domain scales can not be sorted using `+e.op)),e}function YDe(e,t,n){let r=n.map(e=>{let n=t.getData(e.data);return n||MK(e.data),n.domainRef(t,e.field)});return bK(t.add(lJ({values:r})))}function XDe(e,t,n){let r=n.map(e=>{let n=t.getData(e.data);return n||MK(e.data),n.extentRef(t,e.field)});return bK(t.add(cJ({extents:r})))}function ZDe(e,t){return e.signal||W(e)?jK(e,t):t.objectProperty(e)}function QDe(e,t){return e.signal?t.signalRef(e.signal):jh(e)?{interval:AK(e.interval),step:AK(e.step)}:AK(e)}function $De(e,t){t.interpolate=AK(e.type||e),e.gamma!=null&&(t.interpolateGamma=AK(e.gamma))}function FK(e,t,n){let r=t.config.range,i=e.range;if(i.signal)return t.signalRef(i.signal);if(vg(i)){if(r&&cg(r,i))return e=og({},e,{range:r[i]}),FK(e,t,n);i===`width`?i=[0,{signal:`width`}]:i===`height`?i=WD(e.type)?[0,{signal:`height`}]:[{signal:`height`},0]:U(`Unrecognized scale range value: `+G(i))}else if(i.scheme){n.scheme=W(i.scheme)?jK(i.scheme,t):AK(i.scheme,t),i.extent&&(n.schemeExtent=jK(i.extent,t)),i.count&&(n.schemeCount=AK(i.count,t));return}else if(i.step){n.rangeStep=AK(i.step,t);return}else if(WD(e.type)&&!W(i))return NK(i,e,t);else W(i)||U(`Unsupported range type: `+G(i));return i.map(e=>(W(e)?jK:AK)(e,t))}function eOe(e,t){let n=t.config.projection||{},r={};for(let n in e)n!==`name`&&(r[n]=IK(e[n],n,t));for(let e in n)r[e]??(r[e]=IK(n[e],e,t));t.addProjection(e.name,r)}function IK(e,t,n){return W(e)?e.map(e=>IK(e,t,n)):jh(e)?e.signal?n.signalRef(e.signal):t===`fit`?e:U(`Unsupported parameter object: `+G(e)):e}function LK(e){return e.type=XJ,e.interactive=e.interactive||!1,e}function RK(e,t){let n=(n,r)=>EK(e[n],EK(t[n],r));return n.isVertical=n=>kJ===EK(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>EK(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>EK(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>EK(e.columns,EK(t.columns,+n.isVertical(!0))),n}function zK(e,t){let n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function tOe(e,t,n){let r=t.config.style[n];return r&&r[e]}function BK(e,t,n){return`item.anchor === '${AJ}' ? ${e} : item.anchor === '${MJ}' ? ${t} : ${n}`}function nOe(e){let t=e(`tickBand`),n=e(`tickOffset`),r,i;return t?t.signal?(r={signal:`(${t.signal}) === 'extent' ? 1 : 0.5`},i={signal:`(${t.signal}) === 'extent'`},jh(n)||(n={signal:`(${t.signal}) === 'extent' ? 0 : ${n}`})):t===`extent`?(r=1,i=!0,n=0):(r=.5,i=!1):(r=e(`bandPosition`),i=e(`tickExtra`)),{extra:i,band:r,offset:n}}function VK(e,t){return t?e?jh(e)?Object.assign({},e,{offset:VK(e.offset,t)}):{value:e,offset:t}:t:e}function HK(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=sK(e.encode,t,qJ)):e.interactive=!1,e}function rOe(e,t,n,r){let i=RK(e,n),a=i.isVertical(),o=i.gradientThickness(),s=i.gradientLength(),c,l,u,d,f;a?(l=[0,1],u=[0,0],d=o,f=s):(l=[0,0],u=[1,0],d=s,f=o);let p={enter:c={opacity:JJ,x:JJ,y:JJ,width:_q(d),height:_q(f)},update:og({},c,{opacity:YJ,fill:{gradient:t,start:l,stop:u}}),exit:{opacity:JJ}};return oK(p,{stroke:i(`gradientStrokeColor`),strokeWidth:i(`gradientStrokeWidth`)},{opacity:i(`gradientOpacity`)}),HK({type:ZJ,role:kq,encode:p},r)}function iOe(e,t,n,r,i){let a=RK(e,n),o=a.isVertical(),s=a.gradientThickness(),c=a.gradientLength(),l,u,d,f,p=``;o?(l=`y`,d=`y2`,u=`x`,f=`width`,p=`1-`):(l=`x`,d=`x2`,u=`y`,f=`height`);let m={opacity:JJ,fill:{scale:t,field:LJ}};m[l]={signal:p+`datum.perc`,mult:c},m[u]=JJ,m[d]={signal:p+`datum.perc2`,mult:c},m[f]=_q(s);let h={enter:m,update:og({},m,{opacity:YJ}),exit:{opacity:JJ}};return oK(h,{stroke:a(`gradientStrokeColor`),strokeWidth:a(`gradientStrokeWidth`)},{opacity:a(`gradientOpacity`)}),HK({type:ZJ,role:Dq,key:LJ,from:i,encode:h},r)}function UK(e,t,n,r){let i=RK(e,t),a=i.isVertical(),o=_q(i.gradientThickness()),s=i.gradientLength(),c=i(`labelOverlap`),l,u,d,f,p=``,m={enter:l={opacity:JJ},update:u={opacity:YJ,text:{field:PJ}},exit:{opacity:JJ}};return oK(m,{fill:i(`labelColor`),fillOpacity:i(`labelOpacity`),font:i(`labelFont`),fontSize:i(`labelFontSize`),fontStyle:i(`labelFontStyle`),fontWeight:i(`labelFontWeight`),limit:EK(e.labelLimit,t.gradientLabelLimit)}),a?(l.align={value:`left`},l.baseline=u.baseline={signal:rY},d=`y`,f=`x`,p=`1-`):(l.align=u.align={signal:nY},l.baseline={value:`top`},d=`x`,f=`y`),l[d]=u[d]={signal:p+`datum.perc`,mult:s},l[f]=u[f]=o,o.offset=EK(e.labelOffset,t.gradientLabelOffset)||0,c=c?{separation:i(`labelSeparation`),method:c,order:`datum.index`}:void 0,HK({type:eY,role:Aq,style:RJ,key:LJ,from:r,encode:m,overlap:c},n)}function aOe(e,t,n,r,i){let a=RK(e,t),o=n.entries,s=!!(o&&o.interactive),c=o?o.name:void 0,l=a(`clipHeight`),u=a(`symbolOffset`),d={data:`value`},f=`(${i}) ? datum.${FJ} : datum.${GJ}`,p=l?_q(l):{field:GJ},m=`datum.${NJ}`,h=`max(1, ${i})`,g,_,v,y,b;p.mult=.5,g={enter:_={opacity:JJ,x:{signal:f,mult:.5,offset:u},y:p},update:v={opacity:YJ,x:_.x,y:_.y},exit:{opacity:JJ}};let x=null,S=null;e.fill||(x=t.symbolBaseFillColor,S=t.symbolBaseStrokeColor),oK(g,{fill:a(`symbolFillColor`,x),shape:a(`symbolType`),size:a(`symbolSize`),stroke:a(`symbolStrokeColor`,S),strokeDash:a(`symbolDash`),strokeDashOffset:a(`symbolDashOffset`),strokeWidth:a(`symbolStrokeWidth`)},{opacity:a(`symbolOpacity`)}),KJ.forEach(t=>{e[t]&&(v[t]=_[t]={scale:e[t],field:LJ})});let C=HK({type:$J,role:jq,key:LJ,from:d,clip:l?!0:void 0,encode:g},n.symbols),w=_q(u);w.offset=a(`labelOffset`),g={enter:_={opacity:JJ,x:{signal:f,offset:w},y:p},update:v={opacity:YJ,text:{field:PJ},x:_.x,y:_.y},exit:{opacity:JJ}},oK(g,{align:a(`labelAlign`),baseline:a(`labelBaseline`),fill:a(`labelColor`),fillOpacity:a(`labelOpacity`),font:a(`labelFont`),fontSize:a(`labelFontSize`),fontStyle:a(`labelFontStyle`),fontWeight:a(`labelFontWeight`),limit:a(`labelLimit`)});let T=HK({type:eY,role:Aq,style:RJ,key:LJ,from:d,encode:g},n.labels);return g={enter:{noBound:{value:!l},width:JJ,height:l?_q(l):JJ,opacity:JJ},exit:{opacity:JJ},update:v={opacity:YJ,row:{signal:null},column:{signal:null}}},a.isVertical(!0)?(y=`ceil(item.mark.items.length / ${h})`,v.row.signal=`${m}%${y}`,v.column.signal=`floor(${m} / ${y})`,b={field:[`row`,m]}):(v.row.signal=`floor(${m} / ${h})`,v.column.signal=`${m} % ${h}`,b={field:m}),v.column.signal=`(${i})?${v.column.signal}:${m}`,r={facet:{data:r,name:`value`,groupby:NJ}},LK({role:yq,from:r,encode:sK(g,o,qJ),marks:[C,T],name:c,interactive:s,sort:b})}function oOe(e,t){let n=RK(e,t);return{align:n(`gridAlign`),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n(`rowPadding`),column:n(`columnPadding`)}}}function sOe(e,t,n,r){let i=RK(e,t),a={enter:{opacity:JJ},update:{opacity:YJ,x:{field:{group:`padding`}},y:{field:{group:`padding`}}},exit:{opacity:JJ}};return oK(a,{orient:i(`titleOrient`),_anchor:i(`titleAnchor`),anchor:{signal:uY},angle:{signal:dY},align:{signal:lY},baseline:{signal:fY},text:e.title,fill:i(`titleColor`),fillOpacity:i(`titleOpacity`),font:i(`titleFont`),fontSize:i(`titleFontSize`),fontStyle:i(`titleFontStyle`),fontWeight:i(`titleFontWeight`),limit:i(`titleLimit`),lineHeight:i(`titleLineHeight`)},{align:i(`titleAlign`),baseline:i(`titleBaseline`)}),HK({type:eY,role:Mq,style:zJ,from:r,encode:a},n)}function cOe(e,t){let n;return jh(e)&&(e.signal?n=e.signal:e.path?n=`pathShape(`+WK(e.path)+`)`:e.sphere&&(n=`geoShape(`+WK(e.sphere)+`, {type: "Sphere"})`)),n?t.signalRef(n):!!e}function WK(e){return jh(e)&&e.signal?e.signal:G(e)}function GK(e){let t=e.role||``;return t.startsWith(`axis`)||t.startsWith(`legend`)||t.startsWith(`title`)?t:e.type===XJ?yq:t||`mark`}function lOe(e){return{marktype:e.type,name:e.name||void 0,role:e.role||GK(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function uOe(e,t){return e&&e.signal?t.signalRef(e.signal):e!==!1}function KK(e,t){let n=kx(e.type);n||U(`Unrecognized transform type: `+G(e.type));let r=vK(n.type.toLowerCase(),null,qK(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(r)),r.metadata=n.metadata||{},r}function qK(e,t,n){let r={},i=e.params.length;for(let a=0;aJK(e,t,n)):JK(e,i,n)}function JK(e,t,n){let r=e.type;if(wK(t))return gY(r)?U(`Expression references can not be signals.`):_Y(r)?n.fieldRef(t):vY(r)?n.compareRef(t):n.signalRef(t.signal);{let i=e.expr||_Y(r);return i&&pY(t)?n.exprRef(t.expr,t.as):i&&mY(t)?xK(t.field,t.as):gY(r)?yW(t,n):hY(r)?bK(n.getData(t).values):_Y(r)?xK(t):vY(r)?n.compareRef(t):t}}function fOe(e,t,n){return vg(t.from)||U(`Lookup "from" parameter must be a string literal.`),n.getData(t.from).lookupRef(n,t.key)}function pOe(e,t,n){let r=t[e.name];return e.array?(W(r)||U(`Expected an array of sub-parameters. Instead: `+G(r)),r.map(t=>YK(e,t,n))):YK(e,r,n)}function YK(e,t,n){let r=e.params.length,i;for(let n=0;ne??`null`).join(`,`)+`),0)`,t);c.update=l.$expr,c.params=l.$params}function nq(e,t){let n=GK(e),r=e.type===XJ,i=e.from&&e.from.facet,a=e.overlap,o=e.layout||n===`scope`||n===`frame`,s,c,l,u,d,f,p,m=n===`mark`||o||i,h=mOe(e.from,r,t);c=t.add($q({key:h.key||(e.key?xK(e.key):void 0),pulse:h.pulse,clean:!r}));let g=bK(c);c=l=t.add(Zq({pulse:g})),c=t.add(sJ({markdef:lOe(e),interactive:uOe(e.interactive,t),clip:cOe(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef(`parent`):null,index:t.markpath(),pulse:bK(c)}));let _=bK(c);c=u=t.add(eJ(mK(e.encode,e.type,n,e.style,t,{mod:!1,pulse:_}))),c.params.parent=t.encode(),e.transform&&e.transform.forEach(e=>{let n=KK(e,t),r=n.metadata;(r.generates||r.changes)&&U(`Mark transforms should not generate new data.`),r.nomod||(u.params.mod=!0),n.params.pulse=bK(c),t.add(c=n)}),e.sort&&(c=t.add(yJ({sort:t.compareRef(e.sort),pulse:bK(c)})));let v=bK(c);(i||o)&&(o=t.add(bJ({layout:t.objectProperty(e.layout),legends:t.legends,mark:_,pulse:v})),f=bK(o));let y=t.add(Xq({mark:_,pulse:f||v}));p=bK(y),r&&(m&&(s=t.operators,s.pop(),o&&s.pop()),t.pushState(v,f||p,g),i?hOe(e,t,h):m?gOe(e,t,h):t.parse(e),t.popState(),m&&(o&&s.push(o),s.push(y))),a&&(p=_Oe(a,p,t));let b=t.add(gJ({pulse:p})),x=t.add(vJ({pulse:bK(b)},void 0,t.parent()));e.name!=null&&(d=e.name,t.addData(d,new ZK(t,l,b,x)),e.on&&e.on.forEach(e=>{(e.insert||e.remove||e.toggle)&&U(`Marks only support modify triggers.`),tq(e,t,d)}))}function _Oe(e,t,n){let r=e.method,i=e.bound,a=e.separation,o={separation:wK(a)?n.signalRef(a.signal):a,method:wK(r)?n.signalRef(r.signal):r,pulse:t};if(e.order&&(o.sort=n.compareRef({field:e.order})),i){let e=i.tolerance;o.boundTolerance=wK(e)?n.signalRef(e.signal):+e,o.boundScale=n.scaleRef(i.scale),o.boundOrient=i.orient}return bK(n.add(uJ(o)))}function vOe(e,t){let n=t.config.legend,r=e.encode||{},i=RK(e,n),a=r.legend||{},o=a.name||void 0,s=a.interactive,c=a.style,l={},u=0,d,f,p;KJ.forEach(t=>e[t]?(l[t]=e[t],u||=e[t]):0),u||U(`Missing valid scale for legend.`);let m=yOe(e,t.scaleType(u)),h={title:e.title!=null,scales:l,type:m,vgrad:m!==`symbol`&&i.isVertical()},g=bK(t.add(Zq(null,[h]))),_={enter:{x:{value:0},y:{value:0}}},v=bK(t.add(aJ(f={type:m,scale:t.scaleRef(u),count:t.objectProperty(i(`tickCount`)),limit:t.property(i(`symbolLimit`)),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)})));return m===UJ?(p=[rOe(e,u,n,r.gradient),UK(e,n,r.labels,v)],f.count=f.count||t.signalRef(`max(2,2*floor((${DK(i.gradientLength())})/100))`)):m===WJ?p=[iOe(e,u,n,r.gradient,v),UK(e,n,r.labels,v)]:(d=oOe(e,n),p=[aOe(e,n,r,v,DK(d.columns))],f.size=SOe(e,t,p[0].marks)),p=[LK({role:Oq,from:g,encode:_,marks:p,layout:d,interactive:s})],h.title&&p.push(sOe(e,n,r.title,g)),nq(LK({role:Eq,from:g,encode:sK(xOe(i,e,n),a,qJ),marks:p,aria:i(`aria`),description:i(`description`),zindex:i(`zindex`),name:o,interactive:s,style:c}),t)}function yOe(e,t){let n=e.type||HJ;return!e.type&&bOe(e)===1&&(e.fill||e.stroke)&&(n=UD(t)?UJ:GD(t)?WJ:HJ),n===UJ?GD(t)?WJ:UJ:n}function bOe(e){return KJ.reduce((t,n)=>t+ +!!e[n],0)}function xOe(e,t,n){let r={enter:{},update:{}};return oK(r,{orient:e(`orient`),offset:e(`offset`),padding:e(`padding`),titlePadding:e(`titlePadding`),cornerRadius:e(`cornerRadius`),fill:e(`fillColor`),stroke:e(`strokeColor`),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:e(`legendX`),y:e(`legendY`),format:t.format,formatType:t.formatType}),r}function SOe(e,t,n){return yW(`max(ceil(sqrt(${DK(rq(`size`,e,n))})+${DK(rq(`strokeWidth`,e,n))}),${DK(COe(n[1].encode,t,RJ))})`,t)}function rq(e,t,n){return t[e]?`scale("${t[e]}",datum)`:zK(e,n[0].encode)}function COe(e,t,n){return zK(`fontSize`,e)||tOe(`fontSize`,t,n)}function wOe(e,t){e=vg(e)?{text:e}:e;let n=RK(e,t.config.title),r=e.encode||{},i=r.group||{},a=i.name||void 0,o=i.interactive,s=i.style,c=[],l=bK(t.add(Zq(null,[{}])));return c.push(DOe(e,n,TOe(e),l)),e.subtitle&&c.push(OOe(e,n,r.subtitle,l)),nq(LK({role:Nq,from:l,encode:EOe(n,i),marks:c,aria:n(`aria`),description:n(`description`),zindex:n(`zindex`),name:a,interactive:o,style:s}),t)}function TOe(e){let t=e.encode;return t&&t.title||og({name:e.name,interactive:e.interactive,style:e.style},t)}function EOe(e,t){let n={enter:{},update:{}};return oK(n,{orient:e(`orient`),anchor:e(`anchor`),align:{signal:tY},angle:{signal:yY},limit:e(`limit`),frame:e(`frame`),offset:e(`offset`)||0,padding:e(`subtitlePadding`)}),sK(n,t,qJ)}function DOe(e,t,n,r){let i={value:0},a=e.text,o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return oK(o,{text:a,align:{signal:`item.mark.group.align`},angle:{signal:`item.mark.group.angle`},limit:{signal:`item.mark.group.limit`},baseline:`top`,dx:t(`dx`),dy:t(`dy`),fill:t(`color`),font:t(`font`),fontSize:t(`fontSize`),fontStyle:t(`fontStyle`),fontWeight:t(`fontWeight`),lineHeight:t(`lineHeight`)},{align:t(`align`),angle:t(`angle`),baseline:t(`baseline`)}),HK({type:eY,role:Pq,style:BJ,from:r,encode:o},n)}function OOe(e,t,n,r){let i={value:0},a=e.subtitle,o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return oK(o,{text:a,align:{signal:`item.mark.group.align`},angle:{signal:`item.mark.group.angle`},limit:{signal:`item.mark.group.limit`},baseline:`top`,dx:t(`dx`),dy:t(`dy`),fill:t(`subtitleColor`),font:t(`subtitleFont`),fontSize:t(`subtitleFontSize`),fontStyle:t(`subtitleFontStyle`),fontWeight:t(`subtitleFontWeight`),lineHeight:t(`subtitleLineHeight`)},{align:t(`align`),angle:t(`angle`),baseline:t(`baseline`)}),HK({type:eY,role:Fq,style:VJ,from:r,encode:o},n)}function kOe(e,t){let n=[];e.transform&&e.transform.forEach(e=>{n.push(KK(e,t))}),e.on&&e.on.forEach(n=>{tq(n,t,e.name)}),t.addDataPipeline(e.name,AOe(e,t,n))}function AOe(e,t,n){let r=[],i=null,a=!1,o=!1,s,c,l,u,d;for(e.values?wK(e.values)||TK(e.format)?(r.push(aq(t,e)),r.push(i=iq())):r.push(i=iq({$ingest:e.values,$format:e.format})):e.url?TK(e.url)||TK(e.format)?(r.push(aq(t,e)),r.push(i=iq())):r.push(i=iq({$request:e.url,$format:e.format})):e.source&&(i=s=Qh(e.source).map(e=>bK(t.getData(e).output)),r.push(null)),c=0,l=n.length;ce==null?!cK(t,r):(n.update[t]=LY(_q(e),n.update[t]),!1),a=i(e(`titleX`),`x`),o=i(e(`titleY`),`y`);n.enter.auto=o===a?_q(o):SY(t,_q(o),_q(a))}function zOe(e,t){let n=jOe(e,t),r=e.encode||{},i=r.axis||{},a=i.name||void 0,o=i.interactive,s=i.style,c=RK(e,n),l=nOe(c),u={scale:e.scale,ticks:!!c(`ticks`),labels:!!c(`labels`),grid:!!c(`grid`),domain:!!c(`domain`),title:e.title!=null},d=bK(t.add(Zq({},[u]))),f=bK(t.add(Yq({scale:t.scaleRef(e.scale),extra:t.property(l.extra),count:t.objectProperty(e.tickCount),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)}))),p=[],m;return u.grid&&p.push(NOe(e,n,r.grid,f,l)),u.ticks&&(m=c(`tickSize`),p.push(FOe(e,n,r.ticks,f,m,l))),u.labels&&(m=u.ticks?m:0,p.push(IOe(e,n,r.labels,f,m,l))),u.domain&&p.push(MOe(e,n,r.domain,d)),u.title&&p.push(LOe(e,n,r.title,d)),nq(LK({role:bq,from:d,encode:sK(BOe(c,e),i,qJ),marks:p,aria:c(`aria`),description:c(`description`),zindex:c(`zindex`),name:a,interactive:o,style:s}),t)}function BOe(e,t){let n={enter:{},update:{}};return oK(n,{orient:e(`orient`),offset:e(`offset`)||0,position:EK(t.position,0),titlePadding:e(`titlePadding`),minExtent:e(`minExtent`),maxExtent:e(`maxExtent`),range:{signal:`abs(span(range("${t.scale}")))`},translate:e(`translate`),format:t.format,formatType:t.formatType}),n}function uq(e,t,n){let r=Qh(e.signals),i=Qh(e.scales);return n||r.forEach(e=>gK(e,t)),Qh(e.projections).forEach(e=>eOe(e,t)),i.forEach(e=>HDe(e,t)),Qh(e.data).forEach(e=>kOe(e,t)),i.forEach(e=>UDe(e,t)),(n||r).forEach(e=>VDe(e,t)),Qh(e.axes).forEach(e=>zOe(e,t)),Qh(e.marks).forEach(e=>nq(e,t)),Qh(e.legends).forEach(e=>vOe(e,t)),e.title&&wOe(e.title,t),t.parseLambdas(),t}function VOe(e,t){let n=t.config,r=bK(t.root=t.add(yK())),i=HOe(e,n);i.forEach(e=>gK(e,t)),t.description=e.description||n.description,t.eventConfig=n.events,t.legends=t.objectProperty(n.legend&&n.legend.layout),t.locale=n.locale;let a=t.add(Zq()),o=t.add(eJ(mK(RY(e.encode),XJ,vq,e.style,t,{pulse:bK(a)}))),s=t.add(bJ({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef(`autosize`),mark:r,pulse:bK(o)}));t.operators.pop(),t.pushState(bK(o),bK(s),null),uq(e,t,i),t.operators.push(s);let c=t.add(Xq({mark:r,pulse:bK(s)}));return c=t.add(gJ({pulse:bK(c)})),c=t.add(vJ({pulse:bK(c)})),t.addData(`root`,new ZK(t,a,a,c)),t}function dq(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function HOe(e,t){let n=n=>EK(e[n],t[n]),r=[dq(`background`,n(`background`)),dq(`autosize`,bDe(n(`autosize`))),dq(`padding`,xDe(n(`padding`))),dq(`width`,n(`width`)||0),dq(`height`,n(`height`)||0)],i=r.reduce((e,t)=>(e[t.name]=t,e),{}),a={};return Qh(e.signals).forEach(e=>{cg(i,e.name)?e=og(i[e.name],e):r.push(e),a[e.name]=e}),Qh(t.signals).forEach(e=>{!cg(a,e.name)&&!cg(i,e.name)&&r.push(e)}),r}function fq(e,t){this.config=e||{},this.options=t||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function pq(e){this.config=e.config,this.options=e.options,this.legends=e.legends,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}function mq(e){return(W(e)?UOe:WOe)(e)}function UOe(e){let t=e.length,n=`[`;for(let r=0;r0?`,`:``)+(jh(t)?t.signal||mq(t):G(t))}return n+`]`}function WOe(e){let t=`{`,n=0,r,i;for(r in e)i=e[r],t+=(++n>1?`,`:``)+G(r)+`:`+(jh(i)?i.signal||mq(i):G(i));return t+`}`}function GOe(){let e=`sans-serif`,t=`#4c78a8`,n=`#000`,r=`#888`,i=`#ddd`;return{description:`Vega visualization`,padding:0,autosize:`pad`,background:null,events:{defaults:{allow:[`wheel`]}},group:null,mark:null,arc:{fill:t},area:{fill:t},image:null,line:{stroke:t,strokeWidth:2},path:{stroke:t},rect:{fill:t},rule:{stroke:n},shape:{stroke:t},symbol:{fill:t,size:64},text:{fill:n,font:e,fontSize:11},trail:{fill:t,size:2},style:{"guide-label":{fill:n,font:e,fontSize:10},"guide-title":{fill:n,font:e,fontSize:11,fontWeight:`bold`},"group-title":{fill:n,font:e,fontSize:13,fontWeight:`bold`},"group-subtitle":{fill:n,font:e,fontSize:12},point:{size:30,strokeWidth:2,shape:`circle`},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:`square`},cell:{fill:`transparent`,stroke:i},view:{fill:`transparent`}},title:{orient:`top`,anchor:`middle`,offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:r,grid:!1,gridWidth:1,gridColor:i,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:r,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:`mercator`},legend:{orient:`right`,padding:0,gridAlign:`each`,columnPadding:10,rowPadding:2,symbolDirection:`vertical`,gradientDirection:`vertical`,gradientLength:200,gradientThickness:16,gradientStrokeColor:i,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:`left`,labelBaseline:`middle`,labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:`circle`,symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:`transparent`,symbolBaseStrokeColor:r,titleLimit:180,titleOrient:`top`,titlePadding:5,layout:{offset:18,direction:`horizontal`,left:{direction:`vertical`},right:{direction:`vertical`}}},range:{category:{scheme:`tableau10`},ordinal:{scheme:`blues`},heatmap:{scheme:`yellowgreenblue`},ramp:{scheme:`blues`},diverging:{scheme:`blueorange`,extent:[1,0]},symbol:[`circle`,`square`,`triangle-up`,`cross`,`diamond`,`triangle-right`,`triangle-down`,`triangle-left`]}}}function KOe(e,t,n){return jh(e)||U(`Input Vega specification must be an object.`),t=Nh(GOe(),t,e.config),VOe(e,new fq(t,n)).toRuntime()}var hq,gq,_q,vq,yq,bq,xq,Sq,Cq,wq,Tq,Eq,Dq,Oq,kq,Aq,jq,Mq,Nq,Pq,Fq,Iq,Lq,Rq,zq,Bq,Vq,Hq,Uq,Wq,Gq,Kq,qq,Jq,Yq,Xq,Zq,Qq,$q,eJ,tJ,nJ,rJ,iJ,aJ,oJ,sJ,cJ,lJ,uJ,dJ,fJ,pJ,mJ,hJ,gJ,_J,vJ,yJ,bJ,xJ,SJ,CJ,wJ,TJ,EJ,DJ,OJ,kJ,AJ,jJ,MJ,NJ,PJ,FJ,IJ,LJ,RJ,zJ,BJ,VJ,HJ,UJ,WJ,GJ,KJ,qJ,JJ,YJ,XJ,ZJ,QJ,$J,eY,tY,nY,rY,iY,aY,oY,sY,cY,lY,uY,dY,fY,pY,mY,hY,gY,_Y,vY,yY,bY,xY,SY,CY,wY,TY,EY,DY,OY,kY,AY,jY,MY,NY,PY,FY,IY,LY,RY,qOe=o((()=>{Dg(),BW(),iK(),vO(),eS(),hq=e=>+e||0,gq=e=>({top:e,bottom:e,left:e,right:e}),_q=e=>jh(e)&&!W(e)?og({},e):{value:e},vq=`frame`,yq=`scope`,bq=`axis`,xq=`axis-domain`,Sq=`axis-grid`,Cq=`axis-label`,wq=`axis-tick`,Tq=`axis-title`,Eq=`legend`,Dq=`legend-band`,Oq=`legend-entry`,kq=`legend-gradient`,Aq=`legend-label`,jq=`legend-symbol`,Mq=`legend-title`,Nq=`title`,Pq=`title-text`,Fq=`title-subtitle`,Iq=e=>vg(e)?G(e):e.signal?`(${e.signal})`:fK(e),Lq=(e,t,n,r)=>`(${e}(${[t,n,r].map(uK).join(`,`)})+'')`,Rq=`outer`,zq=[`value`,`update`,`init`,`react`,`bind`],Bq=xK(`key`),Vq=`ascending`,Hq=`descending`,Uq=`scope`,Wq=`view`,Gq=`timer`,Kq={code:`_.$value`,ast:{type:`Identifier`,value:`value`}},qq=e=>(t,n,r)=>vK(e,n,t||void 0,r),Jq=qq(`aggregate`),Yq=qq(`axisticks`),Xq=qq(`bound`),Zq=qq(`collect`),Qq=qq(`compare`),$q=qq(`datajoin`),eJ=qq(`encode`),tJ=qq(`expression`),nJ=qq(`facet`),rJ=qq(`field`),iJ=qq(`key`),aJ=qq(`legendentries`),oJ=qq(`load`),sJ=qq(`mark`),cJ=qq(`multiextent`),lJ=qq(`multivalues`),uJ=qq(`overlap`),dJ=qq(`params`),fJ=qq(`prefacet`),pJ=qq(`projection`),mJ=qq(`proxy`),hJ=qq(`relay`),gJ=qq(`render`),_J=qq(`scale`),vJ=qq(`sieve`),yJ=qq(`sortitems`),bJ=qq(`viewlayout`),xJ=qq(`values`),SJ=0,CJ={min:`min`,max:`max`,count:`sum`},wJ=`top`,TJ=`left`,EJ=`right`,DJ=`bottom`,OJ=`center`,kJ=`vertical`,AJ=`start`,jJ=`middle`,MJ=`end`,NJ=`index`,PJ=`label`,FJ=`offset`,IJ=`perc`,LJ=`value`,RJ=`guide-label`,zJ=`guide-title`,BJ=`group-title`,VJ=`group-subtitle`,HJ=`symbol`,UJ=`gradient`,WJ=`discrete`,GJ=`size`,KJ=[GJ,`shape`,`fill`,`stroke`,`strokeWidth`,`strokeDash`,`opacity`],qJ={name:1,style:1,interactive:1},JJ={value:0},YJ={value:1},XJ=`group`,ZJ=`rect`,QJ=`rule`,$J=`symbol`,eY=`text`,tY=BK(G(TJ),G(EJ),G(OJ)),nY=`datum.${IJ}<=0?"${TJ}":datum.${IJ}>=1?"${EJ}":"${OJ}"`,rY=`datum.${IJ}<=0?"${DJ}":datum.${IJ}>=1?"${wJ}":"${jJ}"`,iY=`item.orient === "left"`,aY=`item.orient === "right"`,oY=`(${iY} || ${aY})`,sY=`datum.vgrad && ${oY}`,cY=BK(`"top"`,`"bottom"`,`"middle"`),lY=`datum.vgrad && ${aY} ? (${BK(`"right"`,`"left"`,`"center"`)}) : (${oY} && !(datum.vgrad && ${iY})) ? "left" : ${tY}`,uY=`item._anchor || (${oY} ? "middle" : "start")`,dY=`${sY} ? (${iY} ? -90 : 90) : 0`,fY=`${oY} ? (datum.vgrad ? (${aY} ? "bottom" : "top") : ${cY}) : "top"`,pY=e=>e&&e.expr,mY=e=>e&&e.field,hY=e=>e===`data`,gY=e=>e===`expr`,_Y=e=>e===`field`,vY=e=>e===`compare`,ZK.fromEntries=function(e,t){let n=t.length,r=t[n-1],i=t[n-2],a=t[0],o=null,s=1;for(a&&a.type===`load`&&(a=t[1]),e.add(t[0]);se===DJ||e===wJ,xY=(e,t,n)=>wK(e)?OY(e.signal,t,n):e===TJ||e===wJ?t:n,SY=(e,t,n)=>wK(e)?EY(e.signal,t,n):bY(e)?t:n,CY=(e,t,n)=>wK(e)?DY(e.signal,t,n):bY(e)?n:t,wY=(e,t,n)=>wK(e)?kY(e.signal,t,n):e===wJ?{value:t}:{value:n},TY=(e,t,n)=>wK(e)?AY(e.signal,t,n):e===EJ?{value:t}:{value:n},EY=(e,t,n)=>jY(`${e} === '${wJ}' || ${e} === '${DJ}'`,t,n),DY=(e,t,n)=>jY(`${e} !== '${wJ}' && ${e} !== '${DJ}'`,t,n),OY=(e,t,n)=>NY(`${e} === '${TJ}' || ${e} === '${wJ}'`,t,n),kY=(e,t,n)=>NY(`${e} === '${wJ}'`,t,n),AY=(e,t,n)=>NY(`${e} === '${EJ}'`,t,n),jY=(e,t,n)=>(t=t==null?t:_q(t),n=n==null?n:_q(n),MY(t)&&MY(n)?(t=t?t.signal||G(t.value):null,n=n?n.signal||G(n.value):null,{signal:`${e} ? (${t}) : (${n})`}):[og({test:e},t)].concat(n||[])),MY=e=>e==null||Object.keys(e).length===1,NY=(e,t,n)=>({signal:`${e} ? (${FY(t)}) : (${FY(n)})`}),PY=(e,t,n,r,i)=>({signal:(r==null?``:`${e} === '${TJ}' ? (${FY(r)}) : `)+(n==null?``:`${e} === '${DJ}' ? (${FY(n)}) : `)+(i==null?``:`${e} === '${EJ}' ? (${FY(i)}) : `)+(t==null?``:`${e} === '${wJ}' ? (${FY(t)}) : `)+`(null)`}),FY=e=>wK(e)?e.signal:e==null?null:G(e),IY=(e,t)=>t===0?0:wK(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t},LY=(e,t)=>{let n=e.signal;return n&&n.endsWith(`(null)`)?{signal:n.slice(0,-6)+t.signal}:e},RY=e=>sK({enter:{x:{value:0},y:{value:0}},update:{width:{signal:`width`},height:{signal:`height`}}},e),fq.prototype=pq.prototype={parse(e){return uq(e,this)},fork(){return new pq(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+`:`:0)+this._id++},add(e){return this.operators.push(e),e.id=this.id(),e.refs&&=(e.refs.forEach(t=>{t.$ref=e.id}),null),e},proxy(e){let t=e instanceof _K?bK(e):e;return this.add(mJ({value:t}))},addStream(e){return this.streams.push(e),e.id=this.id(),e},addUpdate(e){return this.updates.push(e),e},finish(){let e,t;for(e in this.root&&(this.root.root=!0),this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(e,t,n){let r,i;e&&(r=e.data||={},i=r[t]||(r[t]=[]),i.push(n))}for(e in this.data){t=this.data[e],n(t.input,e,`input`),n(t.output,e,`output`),n(t.values,e,`values`);for(let r in t.index)n(t.index[r],e,`index:`+r)}return this},pushState(e,t,n){this._encode.push(bK(this.add(vJ({pulse:e})))),this._parent.push(t),this._lookup.push(n?bK(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return Ih(this._parent)},encode(){return Ih(this._encode)},lookup(){return Ih(this._lookup)},markpath(){let e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(vg(e))return xK(e,t);e.signal||U(`Unsupported field reference: `+G(e));let n=e.signal,r=this.field[n];if(!r){let e={name:this.signalRef(n)};t&&(e.as=t),this.field[n]=r=bK(this.add(rJ(e)))}return r},compareRef(e){let t=!1,n=e=>wK(e)?(t=!0,this.signalRef(e.signal)):MDe(e)?(t=!0,this.exprRef(e.expr)):e,r=Qh(e.field).map(n),i=Qh(e.order).map(n);return t?bK(this.add(Qq({fields:r,orders:i}))):SK(r,i)},keyRef(e,t){let n=!1,r=e=>wK(e)?(n=!0,bK(i[e.signal])):e,i=this.signals;return e=Qh(e).map(r),n?bK(this.add(iJ({fields:e,flat:t}))):ADe(e,t)},sortRef(e){if(!e)return e;let t=CK(e.op,e.field),n=e.order||Vq;return n.signal?bK(this.add(Qq({fields:t,orders:this.signalRef(n.signal)}))):SK(t,n)},event(e,t){let n=e+`:`+t;if(!this.events[n]){let r=this.id();this.streams.push({id:r,source:e,type:t}),this.events[n]=r}return this.events[n]},hasOwnSignal(e){return cg(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&U(`Duplicate signal name: `+G(e));let n=t instanceof _K?t:this.add(yK(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||U(`Unrecognized signal name: `+G(e)),this.signals[e]},signalRef(e){return this.signals[e]?bK(this.signals[e]):(cg(this.lambdas,e)||(this.lambdas[e]=this.add(yK(null))),bK(this.lambdas[e]))},parseLambdas(){let e=Object.keys(this.lambdas);for(let t=0,n=e.length;tAO,CanvasHandler:()=>JA,CanvasRenderer:()=>XA,DATE:()=>ry,DAY:()=>`day`,DAYOFYEAR:()=>iy,Dataflow:()=>Dx,Debug:()=>4,DisallowedObjectProperties:()=>Oh,Error:()=>1,EventStream:()=>vx,Gradient:()=>Lme,GroupItem:()=>MO,HOURS:()=>ay,Handler:()=>wA,HybridHandler:()=>Ej,HybridRenderer:()=>Tj,Info:()=>3,Item:()=>jO,MILLISECONDS:()=>cy,MINUTES:()=>oy,MONTH:()=>ty,Marks:()=>xA,MultiPulse:()=>wx,None:()=>0,Operator:()=>gx,Parameters:()=>hx,Pulse:()=>bx,QUARTER:()=>ey,RenderType:()=>Mj,Renderer:()=>TA,ResourceLoader:()=>Qk,SECONDS:()=>sy,SVGHandler:()=>QA,SVGRenderer:()=>yj,SVGStringRenderer:()=>Cj,Scenegraph:()=>CA,TIME_UNITS:()=>ly,Transform:()=>K,View:()=>SG,WEEK:()=>ny,Warn:()=>2,YEAR:()=>$v,accessor:()=>lh,accessorFields:()=>dh,accessorName:()=>uh,array:()=>Qh,ascending:()=>rg,bandwidthNRD:()=>iS,bin:()=>aS,bootstrapCI:()=>oS,boundClip:()=>qge,boundContext:()=>FO,boundItem:()=>yk,boundMark:()=>ige,boundStroke:()=>PO,changeset:()=>mx,clampRange:()=>pae,codegenExpression:()=>TH,compare:()=>ng,constant:()=>ig,cumulativeLogNormal:()=>gS,cumulativeNormal:()=>uS,cumulativeUniform:()=>SS,dayofyear:()=>kv,debounce:()=>ag,defaultLocale:()=>Db,definition:()=>kx,densityLogNormal:()=>hS,densityNormal:()=>lS,densityUniform:()=>xS,detectTimeUnits:()=>Qv,domChild:()=>Sk,domClear:()=>Ck,domCreate:()=>bk,domFind:()=>xk,dotbin:()=>sS,error:()=>U,expressionFunction:()=>vW,extend:()=>og,extent:()=>sg,extentIndex:()=>wae,falsy:()=>Dh,fastmap:()=>ug,field:()=>bh,flush:()=>Dae,font:()=>hk,fontFamily:()=>mk,fontSize:()=>lk,format:()=>ex,formatLocale:()=>bb,formats:()=>Rb,hasOwnProperty:()=>cg,id:()=>Sh,identity:()=>Ch,inferType:()=>Mb,inferTypes:()=>Nb,ingest:()=>cx,inherits:()=>fg,inrange:()=>pg,interpolate:()=>JD,interpolateColors:()=>qD,interpolateRange:()=>eme,intersect:()=>Hge,intersectBoxLine:()=>RO,intersectPath:()=>IO,intersectPoint:()=>LO,intersectRule:()=>lhe,isArray:()=>W,isBoolean:()=>mg,isDate:()=>hg,isFunction:()=>eg,isIterable:()=>Nae,isNumber:()=>gg,isObject:()=>jh,isRegExp:()=>_g,isString:()=>vg,isTuple:()=>ax,key:()=>yg,lerp:()=>zae,lineHeight:()=>uk,loader:()=>tx,locale:()=>Eb,logger:()=>kh,lruCache:()=>Vae,markup:()=>Ek,merge:()=>Gae,mergeConfig:()=>Nh,multiLineOffset:()=>fk,one:()=>Th,pad:()=>Jae,panLinear:()=>aae,panLog:()=>oae,panPow:()=>sae,panSymlog:()=>cae,parse:()=>KOe,parseExpression:()=>CH,parseSelector:()=>VG,path:()=>Dw,pathCurves:()=>xO,pathEqual:()=>Jge,pathParse:()=>SO,pathRectangle:()=>Yme,pathRender:()=>CO,pathSymbols:()=>Ume,pathTrail:()=>Xme,peek:()=>Ih,point:()=>wk,projection:()=>HL,quantileLogNormal:()=>_S,quantileNormal:()=>dS,quantileUniform:()=>CS,quantiles:()=>nS,quantizeInterpolator:()=>tme,quarter:()=>uae,quartiles:()=>rS,random:()=>RS,randomInteger:()=>kle,randomKDE:()=>pS,randomLCG:()=>Ole,randomLogNormal:()=>vS,randomMixture:()=>yS,randomNormal:()=>fS,randomUniform:()=>wS,read:()=>Bb,regressionConstant:()=>TS,regressionExp:()=>MS,regressionLinear:()=>AS,regressionLoess:()=>IS,regressionLog:()=>jS,regressionPoly:()=>FS,regressionPow:()=>NS,regressionQuad:()=>PS,renderModule:()=>jk,repeat:()=>bg,resetDefaultLocale:()=>Wce,resetSVGDefIds:()=>Xge,responseType:()=>zb,runtimeContext:()=>WW,sampleCurve:()=>LS,sampleLogNormal:()=>mS,sampleNormal:()=>cS,sampleUniform:()=>bS,scale:()=>VD,sceneEqual:()=>Mk,sceneFromJSON:()=>oge,scenePickVisit:()=>GO,sceneToJSON:()=>age,sceneVisit:()=>WO,sceneZOrder:()=>UO,scheme:()=>YD,serializeXML:()=>fj,setHybridRendererOptions:()=>Vge,setRandom:()=>Ele,span:()=>xg,splitAccessPath:()=>vh,stringValue:()=>G,textMetrics:()=>yA,timeBin:()=>Zv,timeFloor:()=>Vv,timeFormatLocale:()=>Tb,timeInterval:()=>Uv,timeOffset:()=>Kv,timeSequence:()=>Yv,timeUnitSpecifier:()=>Dv,timeUnits:()=>Ev,toBoolean:()=>Sg,toDate:()=>Cg,toNumber:()=>Rh,toSet:()=>Tg,toString:()=>wg,transform:()=>Ax,transforms:()=>$x,truncate:()=>roe,truthy:()=>Eh,tupleid:()=>ox,typeParsers:()=>Xb,utcFloor:()=>Hv,utcInterval:()=>Wv,utcOffset:()=>qv,utcSequence:()=>Xv,utcdayofyear:()=>Pv,utcquarter:()=>dae,utcweek:()=>Fv,version:()=>BY,visitArray:()=>Eg,week:()=>Av,writeConfig:()=>Ph,zero:()=>wh,zoomLinear:()=>Vh,zoomLog:()=>Hh,zoomPow:()=>Uh,zoomSymlog:()=>Wh}),zY,BY,VY=o((()=>{Dg(),Dg(),eS(),hue(),yve(),Lve(),Bbe(),$xe(),wCe(),BCe(),HCe(),mwe(),Cwe(),kwe(),GS(),Ry(),nx(),Ij(),vO(),qL(),hDe(),jb(),BW(),qOe(),QW(),TU(),iK(),zY=`6.3.1`,og($x,Rle,X_e,bve,bbe,qxe,TCe,bCe,VCe,dwe,hwe,wwe),BY=zY}));function YOe(e,t,n){let r;t.x2&&(t.x?(n&&e.x>e.x2&&(r=e.x,e.x=e.x2,e.x2=r),e.width=e.x2-e.x):e.x=e.x2-(e.width||0)),t.xc&&(e.x=e.xc-(e.width||0)/2),t.y2&&(t.y?(n&&e.y>e.y2&&(r=e.y,e.y=e.y2,e.y2=r),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),t.yc&&(e.y=e.yc-(e.height||0)/2)}function HY(e,t,n,r,i,a){let o=e=>QY[e.type](o,e);return o.memberDepth=0,o.fn=Object.create(t),o.params=n,o.datum=r,o.event=i,o.item=a,XY.forEach(e=>o.fn[e]=(...t)=>i.vega[e](...t)),o(e)}var UY,WY,GY,KY,qY,JY,YY,XY,ZY,QY,$Y,XOe=o((()=>{Dg(),UY={NaN:NaN,E:Math.E,LN2:Math.LN2,LN10:Math.LN10,LOG2E:Math.LOG2E,LOG10E:Math.LOG10E,PI:Math.PI,SQRT1_2:Math.SQRT1_2,SQRT2:Math.SQRT2,MIN_VALUE:Number.MIN_VALUE,MAX_VALUE:Number.MAX_VALUE},WY={"*":(e,t)=>e*t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,">":(e,t)=>e>t,"<":(e,t)=>ee<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,"&":(e,t)=>e&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"<<":(e,t)=>e<>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t},GY={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e},KY=Array.prototype.slice,qY=(e,t,n)=>{let r=n?n(t[0]):t[0];return r[e].apply(r,KY.call(t,1))},JY=(e,t=0,n=1,r=0,i=0,a=0,o=0)=>vg(e)?new Date(e):new Date(e,t,n,r,i,a,o),YY={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(e,t,n)=>Math.max(t,Math.min(n,e)),now:Date.now,utc:Date.UTC,datetime:JY,date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return qY(`join`,arguments)},indexof:function(){return qY(`indexOf`,arguments)},lastindexof:function(){return qY(`lastIndexOf`,arguments)},slice:function(){return qY(`slice`,arguments)},reverse:e=>e.slice().reverse(),sort:e=>e.slice().sort(rg),parseFloat,parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return qY(`substring`,arguments,String)},split:function(){return qY(`split`,arguments,String)},replace:function(){return qY(`replace`,arguments,String)},trim:e=>String(e).trim(),btoa:e=>btoa(e),atob:e=>atob(e),encodeURIComponent:e=>encodeURIComponent(e),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)},XY=[`view`,`item`,`group`,`xy`,`x`,`y`],ZY=new Set([Function,eval,setTimeout,setInterval]),typeof setImmediate==`function`&&ZY.add(setImmediate),QY={Literal:(e,t)=>t.value,Identifier:(e,t)=>{let n=t.name;return e.memberDepth>0?n:n===`datum`?e.datum:n===`event`?e.event:n===`item`?e.item:UY[n]||e.params[`$`+n]},MemberExpression:(e,t)=>{let n=!t.computed,r=e(t.object);n&&(e.memberDepth+=1);let i=e(t.property);if(n&&--e.memberDepth,ZY.has(r[i])){console.error(`Prevented interpretation of member "${i}" which could lead to insecure code execution`);return}return r[i]},CallExpression:(e,t)=>{let n=t.arguments,r=t.callee.name;return r.startsWith(`_`)&&(r=r.slice(1)),r===`if`?e(n[0])?e(n[1]):e(n[2]):(e.fn[r]||YY[r]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>WY[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>GY[t.operator](e(t.argument)),ConditionalExpression:(e,t)=>e(t.test)?e(t.consequent):e(t.alternate),LogicalExpression:(e,t)=>t.operator===`&&`?e(t.left)&&e(t.right):e(t.left)||e(t.right),ObjectExpression:(e,t)=>t.properties.reduce((t,n)=>{e.memberDepth+=1;let r=e(n.key);--e.memberDepth;let i=e(n.value);return Oh.has(r)?console.error(`Prevented interpretation of property "${r}" which could lead to insecure code execution`):ZY.has(i)?console.error(`Prevented interpretation of method "${r}" which could lead to insecure code execution`):t[r]=i,t},{})},$Y={operator(e,t){let n=t.ast,r=e.functions;return e=>HY(n,r,e)},parameter(e,t){let n=t.ast,r=e.functions;return(e,t)=>HY(n,r,t,e)},event(e,t){let n=t.ast,r=e.functions;return e=>HY(n,r,void 0,void 0,e)},handler(e,t){let n=t.ast,r=e.functions;return(e,t)=>{let i=t.item&&t.item.datum;return HY(n,r,e,i,t)}},encode(e,t){let{marktype:n,channels:r}=t,i=e.functions,a=n===`group`||n===`image`||n===`rect`;return(e,t)=>{let o=e.datum,s=0,c;for(let n in r)c=HY(r[n].ast,i,t,o,void 0,e),e[n]!==c&&(e[n]=c,s=1);return n!==`rule`&&YOe(e,r,a),s}}}}));function eX(e){this.type=e}function ZOe(e){switch(e.type){case IX:return e.elements;case LX:case BX:return[e.left,e.right];case RX:return[e.callee].concat(e.arguments);case zX:return[e.test,e.consequent,e.alternate];case VX:return[e.object,e.property];case HX:return e.properties;case PX:return[e.key,e.value];case UX:return[e.argument];case FX:case NX:case MX:default:return[]}}function tX(e,t){if(!e)throw Error(`ASSERT: `+t)}function nX(e){return e>=48&&e<=57}function rX(e){return`0123456789abcdefABCDEF`.includes(e)}function iX(e){return`01234567`.includes(e)}function QOe(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e)}function aX(e){return e===10||e===13||e===8232||e===8233}function oX(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&EZ.test(String.fromCharCode(e))}function sX(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&DZ.test(String.fromCharCode(e))}function cX(){for(;Y1114111||e!==`}`)&&xX({},mZ,wZ),t<=65535?String.fromCharCode(t):(n=(t-65536>>10)+55296,r=(t-65536&1023)+56320,String.fromCharCode(n,r))}function uX(){var e=GX.charCodeAt(Y++),t=String.fromCharCode(e);for(e===92&&(GX.charCodeAt(Y)!==117&&xX({},mZ,wZ),++Y,e=lX(`u`),(!e||e===`\\`||!oX(e.charCodeAt(0)))&&xX({},mZ,wZ),t=e);Y>>=`)return Y+=4,{type:eZ,value:o,start:e,end:Y};if(a=o.substr(0,3),a===`>>>`||a===`<<=`||a===`>>=`)return Y+=3,{type:eZ,value:a,start:e,end:Y};if(i=a.substr(0,2),r===i[1]&&`+-<>&|`.includes(r)||i===`=>`)return Y+=2,{type:eZ,value:i,start:e,end:Y};if(i===`//`&&xX({},mZ,wZ),`<>=!+-*%&|^/`.includes(r))return++Y,{type:eZ,value:r,start:e,end:Y};xX({},mZ,wZ)}function nke(e){let t=``;for(;Y{if(parseInt(t,16)<=1114111)return`x`;xX({},bZ)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,`x`));try{new RegExp(n)}catch{xX({},bZ)}try{return new RegExp(e,t)}catch{return null}}function oke(){var e=GX[Y],t,n,r,i;for(tX(e===`/`,`Regular expression literal must start with a slash`),t=GX[Y++],n=!1,r=!1;Y=0&&xX({},bZ,n),{value:n,literal:t}}function cke(){var e,t,n,r;return qX=null,cX(),e=Y,t=oke(),n=ske(),r=ake(t.value,n.value),{literal:t.literal+n.literal,value:r,regex:{pattern:t.value,flags:n.value},start:e,end:Y}}function lke(e){return e.type===XX||e.type===ZX||e.type===JX||e.type===QX}function pX(){if(cX(),Y>=KX)return{type:YX,start:Y,end:Y};let e=GX.charCodeAt(Y);return oX(e)?tke():e===40||e===41||e===59?dX():e===39||e===34?ike():e===46?nX(GX.charCodeAt(Y+1))?fX():dX():nX(e)?fX():dX()}function mX(){let e=qX;return Y=e.end,qX=pX(),Y=e.end,e}function hX(){let e=Y;qX=pX(),Y=e}function uke(e){let t=new eX(rZ);return t.elements=e,t}function gX(e,t,n){let r=new eX(e===`||`||e===`&&`?lZ:iZ);return r.operator=e,r.left=t,r.right=n,r}function dke(e,t){let n=new eX(aZ);return n.callee=e,n.arguments=t,n}function fke(e,t,n){let r=new eX(oZ);return r.test=e,r.consequent=t,r.alternate=n,r}function _X(e){let t=new eX(sZ);return t.name=e,t}function vX(e){let t=new eX(cZ);return t.value=e.value,t.raw=GX.slice(e.start,e.end),e.regex&&(t.raw===`//`&&(t.raw=`/(?:)/`),t.regex=e.regex),t}function yX(e,t,n){let r=new eX(uZ);return r.computed=e===`[`,r.object=t,r.property=n,r.computed||(n.member=!0),r}function pke(e){let t=new eX(dZ);return t.properties=e,t}function bX(e,t,n){let r=new eX(fZ);return r.key=t,r.value=n,r.kind=e,r}function mke(e,t){let n=new eX(pZ);return n.operator=e,n.argument=t,n.prefix=!0,n}function xX(e,t){var n,r=Array.prototype.slice.call(arguments,2),i=t.replace(/%(\d)/g,(e,t)=>(tX(t`:case`<=`:case`>=`:case`instanceof`:case`in`:t=7;break;case`<<`:case`>>`:case`>>>`:t=8;break;case`+`:case`-`:t=9;break;case`*`:case`/`:case`%`:t=11;break}return t}function Tke(){var e=qX,t,n,r,i,a,o,s,c=OX(),l;if(r=qX,i=kX(r),i===0)return c;for(r.prec=i,mX(),t=[e,qX],o=OX(),a=[c,r,o];(i=kX(qX))>0;){for(;a.length>2&&i<=a[a.length-2].prec;)o=a.pop(),s=a.pop().value,c=a.pop(),t.pop(),n=gX(s,c,o),a.push(n);r=mX(),r.prec=i,a.push(r),t.push(qX),n=OX(),a.push(n)}for(l=a.length-1,n=a[l],t.pop();l>1;)t.pop(),n=gX(a[l-1].value,a[l-2],n),l-=2;return n}function AX(){var e=Tke(),t,n;return wX(`?`)&&(mX(),t=AX(),CX(`:`),n=AX(),e=fke(e,t,n)),e}function jX(){let e=AX();if(wX(`,`))throw Error(TZ);return e}function Eke(e){GX=e,Y=0,KX=GX.length,qX=null,hX();let t=jX();if(qX.type!==YX)throw Error(`Unexpect token after expression.`);return t}var MX,NX,PX,FX,IX,LX,RX,zX,BX,VX,HX,UX,WX,GX,Y,KX,qX,JX,YX,XX,ZX,QX,$X,eZ,tZ,nZ,rZ,iZ,aZ,oZ,sZ,cZ,lZ,uZ,dZ,fZ,pZ,mZ,hZ,gZ,_Z,vZ,yZ,bZ,xZ,SZ,CZ,wZ,TZ,EZ,DZ,OZ,kZ,Dke=o((()=>{Dg(),MX=`RawCode`,NX=`Literal`,PX=`Property`,FX=`Identifier`,IX=`ArrayExpression`,LX=`BinaryExpression`,RX=`CallExpression`,zX=`ConditionalExpression`,BX=`LogicalExpression`,VX=`MemberExpression`,HX=`ObjectExpression`,UX=`UnaryExpression`,eX.prototype.visit=function(e){let t,n,r;if(e(this))return 1;for(t=ZOe(this),n=0,r=t.length;n`,WX[XX]=`Identifier`,WX[ZX]=`Keyword`,WX[QX]=`Null`,WX[$X]=`Numeric`,WX[eZ]=`Punctuator`,WX[tZ]=`String`,WX[nZ]=`RegularExpression`,rZ=`ArrayExpression`,iZ=`BinaryExpression`,aZ=`CallExpression`,oZ=`ConditionalExpression`,sZ=`Identifier`,cZ=`Literal`,lZ=`LogicalExpression`,uZ=`MemberExpression`,dZ=`ObjectExpression`,fZ=`Property`,pZ=`UnaryExpression`,mZ=`Unexpected token %0`,hZ=`Unexpected number`,gZ=`Unexpected string`,_Z=`Unexpected identifier`,vZ=`Unexpected reserved word`,yZ=`Unexpected end of input`,bZ=`Invalid regular expression`,xZ=`Invalid regular expression: missing /`,SZ=`Octal literals are not allowed in strict mode.`,CZ=`Duplicate data property in object literal not allowed in strict mode`,wZ=`ILLEGAL`,TZ=`Disabled.`,EZ=RegExp(`[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]`),DZ=RegExp(`[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]`),OZ={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1},kZ={if:1}})),Oke=c({accessPathDepth:()=>lQ,accessPathWithDatum:()=>nQ,accessWithDatumToUnescapedPath:()=>iQ,compile:()=>NRe,contains:()=>BZ,deepEqual:()=>gQ,deleteNestedProperty:()=>eQ,duplicate:()=>f2,entries:()=>m2,every:()=>HZ,fieldIntersection:()=>JZ,flatAccessWithDatum:()=>rQ,getFirstDefined:()=>uQ,hasIntersection:()=>KZ,hasProperty:()=>X,hash:()=>RZ,internalField:()=>fQ,isBoolean:()=>XZ,isEmpty:()=>YZ,isEqual:()=>Ake,isInternalField:()=>pQ,isNullOrFalse:()=>zZ,isNumeric:()=>hQ,isPrimitive:()=>ZZ,keys:()=>$,logicalExpr:()=>$Z,mergeDeep:()=>UZ,never:()=>FZ,normalize:()=>hPe,normalizeAngle:()=>mQ,omit:()=>LZ,pick:()=>IZ,prefixGenerator:()=>qZ,removePathFromField:()=>cQ,replaceAll:()=>sQ,replacePathInField:()=>oQ,resetIdCounter:()=>Mke,setEqual:()=>GZ,some:()=>VZ,stringify:()=>_Q,titleCase:()=>tQ,unescapeSingleQuoteAndPathDot:()=>aQ,unique:()=>WZ,uniqueId:()=>dQ,vals:()=>p2,varName:()=>QZ,version:()=>JVe});function AZ(e){return X(e,`or`)}function jZ(e){return X(e,`and`)}function MZ(e){return X(e,`not`)}function NZ(e,t){if(MZ(e))NZ(e.not,t);else if(jZ(e))for(let n of e.and)NZ(n,t);else if(AZ(e))for(let n of e.or)NZ(n,t);else t(e)}function PZ(e,t){return MZ(e)?{not:PZ(e.not,t)}:jZ(e)?{and:e.and.map(e=>PZ(e,t))}:AZ(e)?{or:e.or.map(e=>PZ(e,t))}:t(e)}function FZ(e){throw Error(e)}function IZ(e,t){let n={};for(let r of t)cg(e,r)&&(n[r]=e[r]);return n}function LZ(e,t){let n={...e};for(let e of t)delete n[e];return n}function RZ(e){if(gg(e))return e;let t=vg(e)?e:_Q(e);if(t.length<250)return t;let n=0;for(let e=0;et===0?e:`[${e}]`),r=e.map((t,n)=>e.slice(0,n+1).join(``));for(let e of r)t.add(e)}return t}function JZ(e,t){return e===void 0||t===void 0||KZ(qZ(e),qZ(t))}function YZ(e){return $(e).length===0}function XZ(e){return e===!0||e===!1}function ZZ(e){return vg(e)||gg(e)||XZ(e)}function QZ(e){let t=e.replace(/\W/g,`_`);return(e.match(/^\d+/)?`_`:``)+t}function $Z(e,t){return MZ(e)?`!(${$Z(e.not,t)})`:jZ(e)?`(${e.and.map(e=>$Z(e,t)).join(`) && (`)})`:AZ(e)?`(${e.or.map(e=>$Z(e,t)).join(`) || (`)})`:t(e)}function eQ(e,t){if(t.length===0)return!0;let n=t.shift();return n in e&&eQ(e[n],t)&&delete e[n],YZ(e)}function tQ(e){return e.charAt(0).toUpperCase()+e.substr(1)}function nQ(e,t=`datum`){let n=vh(e),r=[];for(let e=1;e<=n.length;e++){let i=`[${n.slice(0,e).map(G).join(`][`)}]`;r.push(`${t}${i}`)}return r.join(` && `)}function rQ(e,t=`datum`){return`${t}[${G(vh(e).join(`.`))}]`}function iQ(e){return`datum['${e.replaceAll(`'`,`\\'`)}']`}function aQ(e){return e.replaceAll(`\\'`,`'`).replaceAll(`\\.`,`.`)}function jke(e){return e.replace(/(\[|\]|\.|'|")/g,`\\$1`)}function oQ(e){return`${vh(e).map(jke).join(`\\.`)}`}function sQ(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`),`g`),n)}function cQ(e){return`${vh(e).join(`.`)}`}function lQ(e){return e?vh(e).length:0}function uQ(...e){return e.find(e=>e!==void 0)}function dQ(e){let t=++h2;return e?String(e)+t:t}function Mke(){h2=42}function fQ(e){return pQ(e)?e:`__${e}`}function pQ(e){return e.startsWith(`__`)}function mQ(e){if(e!==void 0)return(e%360+360)%360}function hQ(e){return gg(e)?!0:!isNaN(e)&&!isNaN(parseFloat(e))}function gQ(e,t){if(e===t)return!0;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(e.constructor.name!==t.constructor.name)return!1;let n,r;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!gQ(e[r],t[r]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let n of e.entries())if(!t.has(n[0]))return!1;for(let n of e.entries())if(!gQ(n[1],t.get(n[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e.entries())if(!t.has(n[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&e.valueOf!==g2.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&e.toString!==g2.toString)return e.toString()===t.toString();let i=Object.keys(e);if(n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!gQ(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function _Q(e){let t=[];return(function e(n){if(n?.toJSON&&typeof n.toJSON==`function`&&(n=n.toJSON()),n===void 0)return;if(typeof n==`number`)return isFinite(n)?`${n}`:`null`;if(typeof n!=`object`)return JSON.stringify(n);let r,i;if(Array.isArray(n)){for(i=`[`,r=0;rWQ(e[t])?QZ(`_${t}_${m2(e[t])}`):QZ(`_${t}_${e[t]}`)).join(``)}`}function VQ(e){return e===!0||UQ(e)&&!e.binned}function HQ(e){return e===`binned`||UQ(e)&&e.binned===!0}function UQ(e){return jh(e)}function WQ(e){return X(e,`param`)}function Bke(e){switch(e){case _2:case v2:case z2:case F2:case I2:case L2:case W2:case V2:case H2:case U2:case R2:return 6;case G2:return 4;default:return 10}}function GQ(e){return X(e,`expr`)}function KQ(e,{level:t}={level:0}){let n=$(e||{}),r={};for(let i of n)r[i]=t===0?ZQ(e[i]):KQ(e[i],{level:t-1});return r}function Vke(e){let{anchor:t,frame:n,offset:r,orient:i,angle:a,limit:o,color:s,subtitleColor:c,subtitleFont:l,subtitleFontSize:u,subtitleFontStyle:d,subtitleFontWeight:f,subtitleLineHeight:p,subtitlePadding:m,...h}=e,g={...h,...s?{fill:s}:{}},_={...t?{anchor:t}:{},...n?{frame:n}:{},...r?{offset:r}:{},...i?{orient:i}:{},...a===void 0?{}:{angle:a},...o===void 0?{}:{limit:o}},v={...c?{subtitleColor:c}:{},...l?{subtitleFont:l}:{},...u?{subtitleFontSize:u}:{},...d?{subtitleFontStyle:d}:{},...f?{subtitleFontWeight:f}:{},...p?{subtitleLineHeight:p}:{},...m?{subtitlePadding:m}:{}};return{titleMarkConfig:g,subtitleMarkConfig:IZ(e,[`align`,`baseline`,`dx`,`dy`,`limit`]),nonMarkTitleProperties:_,subtitle:v}}function qQ(e){return vg(e)||W(e)&&vg(e[0])}function JQ(e){return X(e,`signal`)}function YQ(e){return X(e,`step`)}function Hke(e){return!W(e)&&X(e,`fields`)&&!X(e,`data`)}function Uke(e){return!W(e)&&X(e,`fields`)&&X(e,`data`)}function XQ(e){return!W(e)&&X(e,`field`)&&X(e,`data`)}function Wke(e){let t=W(e.condition)?e.condition.map(Gke):Gke(e.condition);return{...ZQ(e),condition:t}}function ZQ(e){if(GQ(e)){let{expr:t,...n}=e;return{signal:t,...n}}return e}function Gke(e){if(GQ(e)){let{expr:t,...n}=e;return{signal:t,...n}}return e}function QQ(e){if(GQ(e)){let{expr:t,...n}=e;return{signal:t,...n}}return JQ(e)?e:e===void 0?void 0:{value:e}}function Kke(e){return JQ(e)?e.signal:G(e)}function qke(e){return JQ(e)?e.signal:G(e.value)}function $Q(e){return JQ(e)?e.signal:e==null?null:G(e)}function Jke(e,t,n){for(let r of n){let n=t$(r,t.markDef,t.config);n!==void 0&&(e[r]=QQ(n))}return e}function Yke(e){return[].concat(e.type,e.style??[])}function e$(e,t,n,r={}){let{vgChannel:i,ignoreVgConfig:a}=r;return i&&X(t,i)?t[i]:t[e]===void 0?a&&(!i||i===e)?void 0:t$(e,t,n,r):t[e]}function t$(e,t,n,{vgChannel:r}={}){let i=n$(e,t,n.style);return uQ(r?i:void 0,i,r?n[t.type][r]:void 0,n[t.type][e],r?n.mark[r]:n.mark[e])}function n$(e,t,n){return Xke(e,Yke(t),n)}function Xke(e,t,n){t=Qh(t);let r;for(let i of t){let t=n[i];X(t,e)&&(r=t[e])}return r}function Zke(e,t){return Qh(e).reduce((e,n)=>(e.field.push(d1(n,t)),e.order.push(n.sort??`ascending`),e),{field:[],order:[]})}function Qke(e,t){let n=[...e];return t.forEach(e=>{for(let t of n)if(gQ(t,e))return;n.push(e)}),n}function $ke(e,t){return gQ(e,t)||!t?e:e?[...Qh(e),...Qh(t)].join(`, `):t}function eAe(e,t){let n=e.value,r=t.value;if(n==null||r===null)return{explicit:e.explicit,value:null};if((qQ(n)||JQ(n))&&(qQ(r)||JQ(r)))return{explicit:e.explicit,value:$ke(n,r)};if(qQ(n)||JQ(n))return{explicit:e.explicit,value:n};if(qQ(r)||JQ(r))return{explicit:e.explicit,value:r};if(!qQ(n)&&!JQ(n)&&!qQ(r)&&!JQ(r))return{explicit:e.explicit,value:Qke(n,r)};throw Error(`It should never reach here`)}function r$(e){return`Invalid specification ${_Q(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}function tAe(e){return`${e==`width`?`Width`:`Height`} "container" only works for single views and layered views.`}function nAe(e){return`${e==`width`?`Width`:`Height`} "container" only works well with autosize "fit" or "fit-${e==`width`?`x`:`y`}".`}function rAe(e){return e?`Dropping "fit-${e}" because spec has discrete ${DQ(e)}.`:`Dropping "fit" because spec has discrete size.`}function i$(e){return`Unknown field for ${e}. Cannot calculate view size.`}function iAe(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function aAe(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function oAe(e){return`The "nearest" transform is not supported for ${e} marks.`}function sAe(e){return`Selection not supported for ${e} yet.`}function cAe(e){return`Cannot find a selection named "${e}".`}function lAe(e){return`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`}function uAe(e){return`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`}function dAe(e){return`Unknown repeated value "${e}".`}function fAe(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}function pAe(e){return`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${G(e)}.`}function mAe(e,t,n,r){return`${e.length?`Multiple `:`No `}matching ${G(t)} encoding found for selection ${G(n.param)}. Using "field": ${G(r)}.`}function hAe(e){return`Unrecognized parse "${e}".`}function gAe(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function _Ae(e){return`Ignoring an invalid transform: ${_Q(e)}.`}function vAe(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function yAe(e){let{parentProjection:t,projection:n}=e;return`Layer's shared projection ${_Q(t)} is overridden by a child projection ${_Q(n)}.`}function bAe(e){return`${e}Offset dropped because ${e} is continuous`}function xAe(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${_Q(n)}}.`}function SAe(e){return`Invalid field type "${e}".`}function CAe(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}function wAe(e){return`Invalid aggregation operator "${e}".`}function TAe(e,t){let{fill:n,stroke:r}=t;return`Dropping color ${e} as the plot also has ${n&&r?`fill and stroke`:n?`fill`:`stroke`}.`}function EAe(e){return`Position range does not support relative band size for ${e}.`}function a$(e,t){return`Dropping ${_Q(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}function o$(e,t,n){return`${e} dropped as it is incompatible with "${t}".`}function DAe(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`}function OAe(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function kAe(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function AAe(e){return`Facet encoding dropped as ${e.join(` and `)} ${e.length>1?`are`:`is`} also specified.`}function s$(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${t===`ordinal`?`order`:`magnitude`}.`}function jAe(e){return`The ${e} for range marks cannot be an expression`}function MAe(e,t){return`Line mark is for continuous lines and thus cannot be used with ${e&&t?`x2 and y2`:e?`x2`:`y2`}. We will use the rule mark (line segments) instead.`}function NAe(e,t){return`Specified orient "${e}" overridden with "${t}".`}function PAe(e){return`Cannot use the scale property "${e}" with non-color channel.`}function FAe(e){return`Cannot use the relative band size with ${e} scale.`}function IAe(e){return`Using unaggregated domain with raw field has no effect (${_Q(e)}).`}function LAe(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function RAe(e){return`Unaggregated domain is currently unsupported for log scale (${_Q(e)}).`}function zAe(e){return`Cannot apply size to non-oriented mark "${e}".`}function BAe(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}function VAe(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}function HAe(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function UAe(e){return`The step for "${e}" is dropped because the ${e===`width`?`x`:`y`} is continuous.`}function WAe(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${_Q(n)} and ${_Q(r)}). Using ${_Q(n)}.`}function GAe(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${_Q(n)} and ${_Q(r)}). Using the union of the two domains.`}function KAe(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}function qAe(e){return`Dropping sort property ${_Q(e)} as unioned domains only support boolean or op "count", "min", and "max".`}function JAe(e,t){return`Unioning discrete legend values from ${e} and ${t}.`}function YAe(e){return`Cannot stack "${e}" if there is already "${e}2".`}function XAe(e){return`Stack is applied to a non-linear scale (${e}).`}function ZAe(e){return`Stacking is applied even though the aggregate function is non-summative ("${e}").`}function c$(e,t){return`Invalid ${e}: ${_Q(t)}.`}function QAe(e){return`Dropping day from datetime ${_Q(e)} as day cannot be combined with other units.`}function $Ae(e,t){return`${t?`extent `:``}${t&&e?`and `:``}${e?`center `:``}${t&&e?`are `:`is `}not needed when data are aggregated.`}function eje(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}function tje(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}function nje(e){return`1D error band does not support ${e}.`}function rje(e){return`Channel ${e} is required for "binned" bin.`}function ije(e){return`Channel ${e} should not be used with "binned" bin.`}function aje(e){return`Domain for ${e} is required for threshold scale.`}function oje(e){return y4=e,y4}function sje(){return y4=v4,y4}function l$(...e){y4.error(...e)}function Z(...e){y4.warn(...e)}function cje(...e){y4.debug(...e)}function u$(e){if(e&&jh(e)){for(let t of C4)if(X(e,t))return!0}return!1}function lje(e){if(hQ(e)&&(e=+e),gg(e))return e>4&&Z(c$(`quarter`,e)),e-1;throw Error(c$(`quarter`,e))}function uje(e){if(hQ(e)&&(e=+e),gg(e))return e-1;{let t=e.toLowerCase(),n=b4.indexOf(t);if(n!==-1)return n;let r=t.substr(0,3),i=qze.indexOf(r);if(i!==-1)return i;throw Error(c$(`month`,e))}}function dje(e){if(hQ(e)&&(e=+e),gg(e))return e%7;{let t=e.toLowerCase(),n=x4.indexOf(t);if(n!==-1)return n;let r=t.substr(0,3),i=Jze.indexOf(r);if(i!==-1)return i;throw Error(c$(`day`,e))}}function d$(e,t){let n=[];if(t&&e.day!==void 0&&$(e).length>1&&(Z(QAe(e)),e=f2(e),delete e.day),e.year===void 0?n.push(2012):n.push(e.year),e.month!==void 0){let r=t?uje(e.month):e.month;n.push(r)}else if(e.quarter!==void 0){let r=t?lje(e.quarter):e.quarter;n.push(gg(r)?r*3:`${r}*3`)}else n.push(0);if(e.date!==void 0)n.push(e.date);else if(e.day!==void 0){let r=t?dje(e.day):e.day;n.push(gg(r)?r+1:`${r}+1`)}else n.push(1);for(let t of[`hours`,`minutes`,`seconds`,`milliseconds`]){let r=e[t];n.push(r===void 0?0:r)}return n}function f$(e){let t=d$(e,!0).join(`, `);return e.utc?`utc(${t})`:`datetime(${t})`}function fje(e){let t=d$(e,!1).join(`, `);return e.utc?`utc(${t})`:`datetime(${t})`}function pje(e){let t=d$(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}function mje(e){return cg(S4,e)}function p$(e){return jh(e)?e.binned:hje(e)}function hje(e){return e?.startsWith(`binned`)}function m$(e){return e.startsWith(`utc`)}function gje(e){return e.substring(3)}function h$(e){return C4.filter(t=>vje(e,t))}function _je(e){let t=h$(e);return t[t.length-1]}function vje(e,t){let n=e.indexOf(t);return!(n<0||n>0&&t===`seconds`&&e.charAt(n-1)===`i`||e.length>n+3&&t===`day`&&e.charAt(n+3)===`o`||n>0&&t===`year`&&e.charAt(n-1)===`f`)}function yje(e,t,{end:n}={end:!1}){let r=nQ(t),i=m$(e)?`utc`:``;function a(e){return e===`quarter`?`(${i}quarter(${r})-1)`:`${i}${e}(${r})`}let o,s={};for(let t of C4)vje(e,t)&&(s[t]=a(t),o=t);return n&&(s[o]+=`+1`),fje(s)}function bje(e){if(e)return`timeUnitSpecifier(${_Q(h$(e))}, ${_Q(Yze)})`}function xje(e,t,n){if(!e)return;let r=bje(e);return`${n||m$(e)?`utc`:`time`}Format(${t}, ${r})`}function g$(e){if(!e)return;let t;return vg(e)?t=hje(e)?{unit:e.substring(6),binned:!0}:{unit:e}:jh(e)&&(t={...e,...e.unit?{unit:e.unit}:{}}),m$(t.unit)&&(t.utc=!0,t.unit=gje(t.unit)),t}function Sje(e){let{utc:t,...n}=g$(e);return n.unit?(t?`utc`:``)+$(n).map(e=>QZ(`${e===`unit`?``:`_${e}_`}${n[e]}`)).join(``):`${t?`utc`:``}timeunit${$(n).map(e=>QZ(`_${e}_${n[e]}`)).join(``)}`}function Cje(e,t=e=>e){let n=g$(e),r=_je(n.unit);if(r&&r!==`day`){let e={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:i,part:a}=Tje(r,n.step);return`${t(f$({...e,[a]:+e[a]+i}))} - ${t(f$(e))}`}}function wje(e){return cg(Xze,e)}function Tje(e,t=1){if(wje(e))return{part:e,step:t};switch(e){case`day`:case`dayofyear`:return{part:`date`,step:t};case`quarter`:return{part:`month`,step:t*3};case`week`:return{part:`date`,step:t*7}}}function Eje(e){return X(e,`param`)}function _$(e){return!!e?.field&&e.equal!==void 0}function v$(e){return!!e?.field&&e.lt!==void 0}function y$(e){return!!e?.field&&e.lte!==void 0}function b$(e){return!!e?.field&&e.gt!==void 0}function x$(e){return!!e?.field&&e.gte!==void 0}function S$(e){return!!(e?.field&&(W(e.range)&&e.range.length===2||JQ(e.range)))}function C$(e){return!!e?.field&&(W(e.oneOf)||W(e.in))}function Dje(e){return!!e?.field&&e.valid!==void 0}function Oje(e){return C$(e)||_$(e)||S$(e)||v$(e)||b$(e)||y$(e)||x$(e)}function w$(e,t){return C1(e,{timeUnit:t,wrapTime:!0})}function kje(e,t){return e.map(e=>w$(e,t))}function Aje(e,t=!0){let{field:n}=e,{unit:r,binned:i}=g$(e.timeUnit)||{},a=d1(e,{expr:`datum`}),o=r?`time(${i?a:yje(r,n)})`:a;if(_$(e))return`${o}===${w$(e.equal,r)}`;if(v$(e)){let t=e.lt;return`${o}<${w$(t,r)}`}else if(b$(e)){let t=e.gt;return`${o}>${w$(t,r)}`}else if(y$(e)){let t=e.lte;return`${o}<=${w$(t,r)}`}else if(x$(e)){let t=e.gte;return`${o}>=${w$(t,r)}`}else if(C$(e))return`indexof([${kje(e.oneOf,r).join(`,`)}], ${o}) !== -1`;else if(Dje(e))return T$(o,e.valid);else if(S$(e)){let{range:n}=KQ(e),i=JQ(n)?{signal:`${n.signal}[0]`}:n[0],a=JQ(n)?{signal:`${n.signal}[1]`}:n[1];if(i!==null&&a!==null&&t)return`inrange(${o}, [${w$(i,r)}, ${w$(a,r)}])`;let s=[];return i!==null&&s.push(`${o} >= ${w$(i,r)}`),a!==null&&s.push(`${o} <= ${w$(a,r)}`),s.length>0?s.join(` && `):`true`}throw Error(`Invalid field predicate: ${_Q(e)}`)}function T$(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function jje(e){return Oje(e)&&e.timeUnit?{...e,timeUnit:g$(e.timeUnit)}:e}function Mje(e){return e===`quantitative`||e===`temporal`}function E$(e){return e===`ordinal`||e===`nominal`}function Nje(e){if(e)switch(e=e.toLowerCase(),e){case`q`:case T4:return`quantitative`;case`t`:case D4:return`temporal`;case`o`:case E4:return`ordinal`;case`n`:case O4:return`nominal`;case k4:return`geojson`}}function Pje(e,t){let n=j4[e],r=j4[t];return n===r||n===`ordinal-position`&&r===`time`||r===`ordinal-position`&&n===`time`}function Fje(e){return Zze[e]}function Ije(e){return M4.has(e)}function D$(e){return $ze.has(e)}function O$(e){return Qze.has(e)}function k$(e){return N4.has(e)}function A$(e){return P4.has(e)}function Lje(e){return!vg(e)&&X(e,`name`)}function Rje(e){return X(e,`param`)}function zje(e){return X(e,`unionWith`)}function Bje(e){return jh(e)&&`field`in e}function j$(e,t){switch(t){case`type`:case`domain`:case`reverse`:case`range`:return!0;case`scheme`:case`interpolate`:return![`point`,`band`,`identity`].includes(e);case`bins`:return![`point`,`band`,`identity`,`ordinal`].includes(e);case`round`:return k$(e)||e===`band`||e===`point`;case`padding`:case`rangeMin`:case`rangeMax`:return k$(e)||[`point`,`band`].includes(e);case`paddingOuter`:case`align`:return[`point`,`band`].includes(e);case`paddingInner`:return e===`band`;case`domainMax`:case`domainMid`:case`domainMin`:case`domainRaw`:case`clamp`:return k$(e);case`nice`:return k$(e)||e===`quantize`||e===`threshold`;case`exponent`:return e===`pow`;case`base`:return e===`log`;case`constant`:return e===`symlog`;case`zero`:return O$(e)&&!BZ([`log`,`time`,`utc`,`threshold`,`quantile`],e)}}function Vje(e,t){switch(t){case`interpolate`:case`scheme`:case`domainMid`:return xQ(e)?void 0:PAe(t);case`align`:case`type`:case`bins`:case`domain`:case`domainMax`:case`domainMin`:case`domainRaw`:case`range`:case`base`:case`exponent`:case`constant`:case`nice`:case`padding`:case`paddingInner`:case`paddingOuter`:case`rangeMax`:case`rangeMin`:case`reverse`:case`round`:case`clamp`:case`zero`:return}}function Hje(e,t){return BZ([E4,O4],t)?e===void 0||D$(e):t===D4?BZ([A4.TIME,A4.UTC,void 0],e):t!==T4||Ije(e)||A$(e)||e===void 0}function Uje(e,t,n=!1){if(!PQ(e))return!1;switch(e){case b2:case x2:case w2:case T2:case O2:case E2:return k$(t)?!0:t===`band`||t===`point`&&!n;case P2:return BZ([`linear`,`band`],t);case z2:case W2:case V2:case H2:case U2:case B2:return k$(t)||A$(t)||BZ([`band`,`point`,`ordinal`],t);case F2:case I2:case L2:return t!==`band`;case G2:case R2:return t===`ordinal`||A$(t)}}function Wje(e){return jh(e)&&`value`in e}function M$(e){return[`line`,`area`,`trail`].includes(e)}function N$(e){return[`rect`,`bar`,`image`,`arc`,`tick`].includes(e)}function P$(e){return X(e,`type`)}function F$(e){return X(e,`band`)}function Gje(e){return P$(e)?e.type:e}function Kje(e,{isPath:t}){return e===void 0||e===`break-paths-show-path-domains`?t?`break-paths-show-domains`:`filter`:e===null?`show`:e}function I$({markDef:e,config:t,scaleChannel:n,scaleType:r,isCountAggregate:i}){if(!r||!O$(r)||i)return`always-valid`;let a=Kje(e$(`invalid`,e,t),{isPath:M$(e.type)});return t.scale?.invalid?.[n]===void 0?a:`show`}function qje(e){return e===`break-paths-filter-domains`||e===`break-paths-show-domains`}function Jje({scaleName:e,scale:t,mode:n}){let r=`domain('${e}')`;if(!t||!e)return;let i=`${r}[0]`,a=`peek(${r})`,o=t.domainHasZero();return o===`definitely`?{scale:e,value:0}:o===`maybe`?{signal:`scale('${e}', inrange(0, ${r}) ? 0 : ${n===`zeroOrMin`?i:a})`}:{signal:`scale('${e}', ${n===`zeroOrMin`?i:a})`}}function Yje({scaleChannel:e,channelDef:t,scale:n,scaleName:r,markDef:i,config:a}){let o=n?.get(`type`),s=_1(t),c=I$({scaleChannel:e,markDef:i,config:a,scaleType:o,isCountAggregate:zQ(s?.aggregate)});if(s&&c===`show`){let t=a.scale.invalid?.[e]??`zero-or-min`;return{test:T$(d1(s,{expr:`datum`}),!1),...Xje(t,n,r)}}}function Xje(e,t,n){if(Wje(e)){let{value:t}=e;return JQ(t)?{signal:t.signal}:{value:t}}return Jje({scale:t,scaleName:n,mode:`zeroOrMin`})}function L$(e){let{channel:t,channelDef:n,markDef:r,scale:i,scaleName:a,config:o}=e,s=wQ(t),c=B$(e),l=Yje({scaleChannel:s,channelDef:n,scale:i,scaleName:a,markDef:r,config:o});return l===void 0?c:[l,c]}function Zje(e){let{datum:t}=e;return u$(t)?f$(t):`${_Q(t)}`}function R$(e,t,n,r){let i={};if(t&&(i.scale=t),r1(e)){let{datum:t}=e;u$(t)?i.signal=f$(t):JQ(t)?i.signal=t.signal:GQ(t)?i.signal=t.expr:i.value=t}else i.field=d1(e,n);if(r){let{offset:e,band:t}=r;e&&(i.offset=e),t&&(i.band=t)}return i}function z$({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:r,startSuffix:i,endSuffix:a=`end`,bandPosition:o=.5}){let s=!JQ(o)&&0{let r=C1(t,{timeUnit:Q(e)&&!p$(e.timeUnit)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return r===void 0?t:{signal:r}})}function w1(e,t){return VQ(e.bin)?PQ(t)&&[`ordinal`,`nominal`].includes(e.type):(console.warn(`Only call this method for binned field defs.`),!1)}function T1(e){return e?.condition}function PMe(e){return cg(CBe,e)}function E1(e){return X(e,`mark`)}function D1(e,t){let n=e?.[t];return n?W(n)?VZ(n,e=>!!e.field):Q(n)||e1(n):!1}function FMe(e,t){let n=e?.[t];return n?W(n)?VZ(n,e=>!!e.field):Q(n)||r1(n)||t1(n):!1}function IMe(e,t){if(AQ(t)){let n=e[t];if((Q(n)||r1(n))&&(E$(n.type)||Q(n)&&n.timeUnit))return FMe(e,kQ(t))}return!1}function LMe(e){return VZ(zRe,t=>{if(D1(e,t)){let n=e[t];if(W(n))return VZ(n,e=>!!e.aggregate);{let e=_1(n);return e&&!!e.aggregate}}return!1})}function RMe(e,t){let n=[],r=[],i=[],a=[],o={};return k1(e,(s,c)=>{if(Q(s)){let{field:l,aggregate:u,bin:d,timeUnit:f,...p}=s;if(u||f||d){let e=m1(s)?.title,m=d1(s,{forAs:!0}),h={...e?[]:{title:p1(s,t,{allowDisabling:!0})},...p,field:m};if(u){let e;if(LQ(u)?(e=`argmax`,m=d1({op:`argmax`,field:u.argmax},{forAs:!0}),h.field=`${m}.${l}`):IQ(u)?(e=`argmin`,m=d1({op:`argmin`,field:u.argmin},{forAs:!0}),h.field=`${m}.${l}`):u!==`boxplot`&&u!==`errorbar`&&u!==`errorband`&&(e=u),e){let t={op:e,as:m};l&&(t.field=l),a.push(t)}}else if(n.push(m),s1(s)&&VQ(d)){if(r.push({bin:d,field:l,as:m}),n.push(d1(s,{binSuffix:`end`})),w1(s,c)&&n.push(d1(s,{binSuffix:`range`})),AQ(c)){let e={field:`${m}_end`};o[`${c}2`]=e}h.bin=`binned`,CQ(c)||(h.type=T4)}else if(f&&!p$(f)){i.push({timeUnit:f,field:l,as:m});let e=s1(s)&&s.type!==D4&&`time`;e&&(c===K2||c===X2?h.formatType=e:Fke(c)?h.legend={formatType:e,...h.legend}:AQ(c)&&(h.axis={formatType:e,...h.axis}))}o[c]=h}else n.push(l),o[c]=e[c]}else o[c]=e[c]}),{bins:r,timeUnits:i,aggregate:a,groupby:n,encoding:o}}function zMe(e,t,n){let r=Lke(t,n);if(!r)return!1;if(r===`binned`){let n=e[t===S2?b2:x2];return!!(Q(n)&&Q(e[t])&&HQ(n.bin))}return!0}function BMe(e,t,n,r){let i={};for(let t of $(e))SQ(t)||Z(DAe(t));for(let a of YRe){if(!e[a])continue;let o=e[a];if(MQ(a)){let e=Pke(a),t=i[e];if(Q(t)&&Mje(t.type)&&Q(o)&&!t.timeUnit){Z(bAe(e));continue}}if(a===`angle`&&t===`arc`&&!e.theta&&(Z(Hze),a=O2),!zMe(e,a,t)){Z(o$(a,t));continue}if(a===z2&&t===`line`&&_1(e[a])?.aggregate){Z(Uze);continue}if(a===F2&&(n?`fill`in e:`stroke`in e)){Z(TAe(`encoding`,{fill:`fill`in e,stroke:`stroke`in e}));continue}if(a===J2||a===q2&&!W(o)&&!c1(o)||a===X2&&W(o)){if(o){if(a===q2){let t=e[a];if(hMe(t)){i[a]=t;continue}}i[a]=Qh(o).reduce((e,t)=>(Q(t)?e.push(b1(t,a)):Z(a$(t,a)),e),[])}}else{if(a===X2&&o===null)i[a]=null;else if(!Q(o)&&!r1(o)&&!c1(o)&&!$$(o)&&!JQ(o)){Z(a$(o,a));continue}i[a]=kMe(o,a,r)}}return i}function O1(e,t){let n={};for(let r of $(e))n[r]=kMe(e[r],r,t,{compositeMark:!0});return n}function VMe(e){let t=[];for(let n of $(e))if(D1(e,n)){let r=e[n],i=Qh(r);for(let e of i)Q(e)?t.push(e):e1(e)&&t.push(e.condition)}return t}function k1(e,t,n){if(e)for(let r of $(e)){let i=e[r];if(W(i))for(let e of i)t.call(n,e,r);else t.call(n,i,r)}}function HMe(e,t,n,r){return e?$(e).reduce((n,i)=>{let a=e[i];return W(a)?a.reduce((e,n)=>t.call(r,e,n,i),n):t.call(r,n,a,i)},n):n}function UMe(e,t){return $(t).reduce((n,r)=>{switch(r){case b2:case x2:case Z2:case $2:case Q2:case S2:case C2:return n;case w2:case T2:if(e===`line`||e===`area`||e===`trail`){let e=t[r];if(Q(e)){let i=t[r===w2?b2:x2];if(Q(i)&&!i.aggregate&&!e.aggregate){let t=d1(i,{}),r=d1(e,{});t&&r&&t!==r&&n.push(t)}}}return n;case O2:case k2:case E2:case D2:case P2:case A2:case j2:case M2:case N2:case K2:case R2:case B2:case X2:return n;case q2:if(e===`line`||e===`trail`)return n;case J2:case Y2:{let e=t[r];if(W(e)||Q(e))for(let t of Qh(e))t.aggregate||n.push(d1(t,{}));return n}case z2:if(e===`trail`)return n;case F2:case I2:case L2:case V2:case H2:case U2:case G2:case W2:{let e=_1(t[r]);return e&&!e.aggregate&&n.push(d1(e,{})),n}}},[])}function WMe(e){let{tooltip:t,...n}=e;if(!t)return{filteredEncoding:n};let r,i;if(W(t)){for(let e of t)e.aggregate?(r||=[],r.push(e)):(i||=[],i.push(e));r&&(n.tooltip=r)}else t.aggregate?n.tooltip=t:i=t;return W(i)&&i.length===1&&(i=i[0]),{customTooltipWithoutAggregatedField:i,filteredEncoding:n}}function A1(e,t,n,r=!0){if(`tooltip`in n)return{tooltip:n.tooltip};let i=e.map(({fieldPrefix:e,titlePrefix:n})=>{let i=r?` of ${j1(t)}`:``;return{field:e+t.field,type:t.type,title:JQ(n)?{signal:`${n}"${escape(i)}"`}:n+i}}),a=VMe(n).map(bMe);return{tooltip:[...i,...WZ(a,RZ)]}}function j1(e){let{title:t,field:n}=e;return uQ(t,n)}function M1(e,t,n,r,i){let{scale:a,axis:o}=n;return({partName:s,mark:c,positionPrefix:l,endPositionPrefix:u=void 0,extraEncoding:d={}})=>{let f=j1(n);return GMe(e,s,i,{mark:c,encoding:{[t]:{field:`${l}_${n.field}`,type:n.type,...f===void 0?{}:{title:f},...a===void 0?{}:{scale:a},...o===void 0?{}:{axis:o}},...vg(u)?{[`${t}2`]:{field:`${u}_${n.field}`}}:{},...r,...d}})}}function GMe(e,t,n,r){let{clip:i,color:a,opacity:o}=e,s=e.type;return e[t]||e[t]===void 0&&n[t]?[{...r,mark:{...n[t],...i?{clip:i}:{},...a?{color:a}:{},...o?{opacity:o}:{},...P$(r.mark)?r.mark:{type:r.mark},style:`${s}-${String(t)}`,...mg(e[t])?{}:e[t]}}]:[]}function KMe(e,t,n){let{encoding:r}=e,i=t===`vertical`?`y`:`x`,a=r[i],o=r[`${i}2`],s=r[`${i}Error`],c=r[`${i}Error2`];return{continuousAxisChannelDef:N1(a,n),continuousAxisChannelDef2:N1(o,n),continuousAxisChannelDefError:N1(s,n),continuousAxisChannelDefError2:N1(c,n),continuousAxis:i}}function N1(e,t){if(e?.aggregate){let{aggregate:n,...r}=e;return n!==t&&Z(tje(n,t)),r}else return e}function qMe(e,t){let{mark:n,encoding:r}=e,{x:i,y:a}=r;if(P$(n)&&n.orient)return n.orient;if(i1(i)){if(i1(a)){let e=Q(i)&&i.aggregate,n=Q(a)&&a.aggregate;if(!e&&n===t)return`vertical`;if(!n&&e===t)return`horizontal`;if(e===t&&n===t)throw Error(`Both x and y cannot have aggregate`);return S1(a)&&!S1(i)?`horizontal`:`vertical`}return`horizontal`}else if(i1(a))return`vertical`;else throw Error(`Need a valid continuous axis for ${t}s`)}function JMe(e){return gg(e)?`tukey`:e}function YMe(e,{config:t}){e={...e,encoding:O1(e.encoding,t)};let{mark:n,encoding:r,params:i,projection:a,...o}=e,s=P$(n)?n:{type:n};i&&Z(sAe(`boxplot`));let c=s.extent??t.boxplot.extent,l=e$(`size`,s,t),u=s.invalid,d=JMe(c),{bins:f,timeUnits:p,transform:m,continuousAxisChannelDef:h,continuousAxis:g,groupby:_,aggregate:v,encodingWithoutContinuousAxis:y,ticksOrient:b,boxOrient:x,customTooltipWithoutAggregatedField:S}=ZMe(e,c,t),C=cQ(h.field),{color:w,size:T,...E}=y,D=e=>M1(s,g,h,e,t.boxplot),O=D(E),k=D(y),A=(jh(t.boxplot.box)?t.boxplot.box.color:t.mark.color)||`#4c78a8`,j=D({...E,...T?{size:T}:{},color:{condition:{test:`${iQ(`lower_box_${h.field}`)} >= ${iQ(`upper_box_${h.field}`)}`,...w||{value:A}}}}),M=A1([{fieldPrefix:d===`min-max`?`upper_whisker_`:`max_`,titlePrefix:`Max`},{fieldPrefix:`upper_box_`,titlePrefix:`Q3`},{fieldPrefix:`mid_box_`,titlePrefix:`Median`},{fieldPrefix:`lower_box_`,titlePrefix:`Q1`},{fieldPrefix:d===`min-max`?`lower_whisker_`:`min_`,titlePrefix:`Min`}],h,y),N={type:`tick`,color:`black`,opacity:1,orient:b,invalid:u,aria:!1},P=d===`min-max`?M:A1([{fieldPrefix:`upper_whisker_`,titlePrefix:`Upper Whisker`},{fieldPrefix:`lower_whisker_`,titlePrefix:`Lower Whisker`}],h,y),F=[...O({partName:`rule`,mark:{type:`rule`,invalid:u,aria:!1},positionPrefix:`lower_whisker`,endPositionPrefix:`lower_box`,extraEncoding:P}),...O({partName:`rule`,mark:{type:`rule`,invalid:u,aria:!1},positionPrefix:`upper_box`,endPositionPrefix:`upper_whisker`,extraEncoding:P}),...O({partName:`ticks`,mark:N,positionPrefix:`lower_whisker`,extraEncoding:P}),...O({partName:`ticks`,mark:N,positionPrefix:`upper_whisker`,extraEncoding:P})],ee=[...d===`tukey`?[]:F,...k({partName:`box`,mark:{type:`bar`,...l?{size:l}:{},orient:x,invalid:u,ariaRoleDescription:`box`},positionPrefix:`lower_box`,endPositionPrefix:`upper_box`,extraEncoding:M}),...j({partName:`median`,mark:{type:`tick`,invalid:u,...jh(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{},...l?{size:l}:{},orient:b,aria:!1},positionPrefix:`mid_box`,extraEncoding:M})];if(d===`min-max`)return{...o,transform:(o.transform??[]).concat(m),layer:ee};let I=iQ(`lower_box_${h.field}`),te=iQ(`upper_box_${h.field}`),L=`(${te} - ${I})`,ne=`${I} - ${c} * ${L}`,re=`${te} + ${c} * ${L}`,ie=iQ(h.field),ae={joinaggregate:XMe(h.field),groupby:_},oe={transform:[{filter:`(${ne} <= ${ie}) && (${ie} <= ${re})`},{aggregate:[{op:`min`,field:h.field,as:`lower_whisker_${C}`},{op:`max`,field:h.field,as:`upper_whisker_${C}`},{op:`min`,field:`lower_box_${h.field}`,as:`lower_box_${C}`},{op:`max`,field:`upper_box_${h.field}`,as:`upper_box_${C}`},...v],groupby:_}],layer:F},{tooltip:se,...ce}=E,{scale:le,axis:ue}=h,de=j1(h),fe=GMe(s,`outliers`,t.boxplot,{transform:[{filter:`(${ie} < ${ne}) || (${ie} > ${re})`}],mark:`point`,encoding:{[g]:{field:h.field,type:h.type,...de===void 0?{}:{title:de},...le===void 0?{}:{scale:le},...ue===void 0?{}:{axis:ue}},...ce,...w?{color:w}:{},...S?{tooltip:S}:{}}})[0],pe,me=[...f,...p,ae];return fe?pe={transform:me,layer:[fe,oe]}:(pe=oe,pe.transform.unshift(...me)),{...o,layer:[pe,{transform:m,layer:ee}]}}function XMe(e){let t=cQ(e);return[{op:`q1`,field:e,as:`lower_box_${t}`},{op:`q3`,field:e,as:`upper_box_${t}`}]}function ZMe(e,t,n){let r=qMe(e,o3),{continuousAxisChannelDef:i,continuousAxis:a}=KMe(e,r,o3),o=i.field,s=cQ(o),c=JMe(t),l=[...XMe(o),{op:`median`,field:o,as:`mid_box_${s}`},{op:`min`,field:o,as:(c===`min-max`?`lower_whisker_`:`min_`)+s},{op:`max`,field:o,as:(c===`min-max`?`upper_whisker_`:`max_`)+s}],u=c===`min-max`||c===`tukey`?[]:[{calculate:`${iQ(`upper_box_${s}`)} - ${iQ(`lower_box_${s}`)}`,as:`iqr_${s}`},{calculate:`min(${iQ(`upper_box_${s}`)} + ${iQ(`iqr_${s}`)} * ${t}, ${iQ(`max_${s}`)})`,as:`upper_whisker_${s}`},{calculate:`max(${iQ(`lower_box_${s}`)} - ${iQ(`iqr_${s}`)} * ${t}, ${iQ(`min_${s}`)})`,as:`lower_whisker_${s}`}],{[a]:d,...f}=e.encoding,{customTooltipWithoutAggregatedField:p,filteredEncoding:m}=WMe(f),{bins:h,timeUnits:g,aggregate:_,groupby:v,encoding:y}=RMe(m,n),b=r===`vertical`?`horizontal`:`vertical`,x=r;return{bins:h,timeUnits:g,transform:[...h,...g,{aggregate:[..._,...l],groupby:v},...u],groupby:v,aggregate:_,continuousAxisChannelDef:i,continuousAxis:a,encodingWithoutContinuousAxis:y,ticksOrient:b,boxOrient:x,customTooltipWithoutAggregatedField:p}}function QMe(e,{config:t}){e={...e,encoding:O1(e.encoding,t)};let{transform:n,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:a,ticksOrient:o,markDef:s,outerSpec:c,tooltipEncoding:l}=rNe(e,s3,t);delete a.size;let u=M1(s,i,r,a,t.errorbar),d=s.thickness,f=s.size,p={type:`tick`,orient:o,aria:!1,...d===void 0?{}:{thickness:d},...f===void 0?{}:{size:f}},m=[...u({partName:`ticks`,mark:p,positionPrefix:`lower`,extraEncoding:l}),...u({partName:`ticks`,mark:p,positionPrefix:`upper`,extraEncoding:l}),...u({partName:`rule`,mark:{type:`rule`,ariaRoleDescription:`errorbar`,...d===void 0?{}:{size:d}},positionPrefix:`lower`,endPositionPrefix:`upper`,extraEncoding:l})];return{...c,transform:n,...m.length>1?{layer:m}:{...m[0]}}}function $Me(e,t){let{encoding:n}=e;if(eNe(n))return{orient:qMe(e,t),inputType:`raw`};let r=tNe(n),i=nNe(n),a=n.x,o=n.y;if(r){if(i)throw Error(`${t} cannot be both type aggregated-upper-lower and aggregated-error`);let e=n.x2,r=n.y2;if(o1(e)&&o1(r))throw Error(`${t} cannot have both x2 and y2`);if(o1(e)){if(i1(a))return{orient:`horizontal`,inputType:`aggregated-upper-lower`};throw Error(`Both x and x2 have to be quantitative in ${t}`)}else if(o1(r)){if(i1(o))return{orient:`vertical`,inputType:`aggregated-upper-lower`};throw Error(`Both y and y2 have to be quantitative in ${t}`)}throw Error(`No ranged axis`)}else{let e=n.xError,r=n.xError2,i=n.yError,s=n.yError2;if(o1(r)&&!o1(e))throw Error(`${t} cannot have xError2 without xError`);if(o1(s)&&!o1(i))throw Error(`${t} cannot have yError2 without yError`);if(o1(e)&&o1(i))throw Error(`${t} cannot have both xError and yError with both are quantiative`);if(o1(e)){if(i1(a))return{orient:`horizontal`,inputType:`aggregated-error`};throw Error(`All x, xError, and xError2 (if exist) have to be quantitative`)}else if(o1(i)){if(i1(o))return{orient:`vertical`,inputType:`aggregated-error`};throw Error(`All y, yError, and yError2 (if exist) have to be quantitative`)}throw Error(`No ranged axis`)}}function eNe(e){return(o1(e.x)||o1(e.y))&&!o1(e.x2)&&!o1(e.y2)&&!o1(e.xError)&&!o1(e.xError2)&&!o1(e.yError)&&!o1(e.yError2)}function tNe(e){return o1(e.x2)||o1(e.y2)}function nNe(e){return o1(e.xError)||o1(e.xError2)||o1(e.yError)||o1(e.yError2)}function rNe(e,t,n){let{mark:r,encoding:i,params:a,projection:o,...s}=e,c=P$(r)?r:{type:r};a&&Z(sAe(t));let{orient:l,inputType:u}=$Me(e,t),{continuousAxisChannelDef:d,continuousAxisChannelDef2:f,continuousAxisChannelDefError:p,continuousAxisChannelDefError2:m,continuousAxis:h}=KMe(e,l,t),{errorBarSpecificAggregate:g,postAggregateCalculates:_,tooltipSummary:v,tooltipTitleWithFieldName:y}=iNe(c,d,f,p,m,u,t,n),{[h]:b,[h===`x`?`x2`:`y2`]:x,[h===`x`?`xError`:`yError`]:S,[h===`x`?`xError2`:`yError2`]:C,...w}=i,{bins:T,timeUnits:E,aggregate:D,groupby:O,encoding:k}=RMe(w,n),A=[...D,...g],j=u===`raw`?O:[],M=A1(v,d,k,y);return{transform:[...s.transform??[],...T,...E,...A.length===0?[]:[{aggregate:A,groupby:j}],..._],groupby:j,continuousAxisChannelDef:d,continuousAxis:h,encodingWithoutContinuousAxis:k,ticksOrient:l===`vertical`?`horizontal`:`vertical`,markDef:c,outerSpec:s,tooltipEncoding:M}}function iNe(e,t,n,r,i,a,o,s){let c=[],l=[],u=t.field,d,f=!1;if(a===`raw`){let t=e.center?e.center:e.extent?e.extent===`iqr`?`median`:`mean`:s.errorbar.center,n=e.extent?e.extent:t===`mean`?`stderr`:`iqr`;if(t===`median`!=(n===`iqr`)&&Z(eje(t,n,o)),n===`stderr`||n===`stdev`)c=[{op:n,field:u,as:`extent_${u}`},{op:t,field:u,as:`center_${u}`}],l=[{calculate:`${iQ(`center_${u}`)} + ${iQ(`extent_${u}`)}`,as:`upper_${u}`},{calculate:`${iQ(`center_${u}`)} - ${iQ(`extent_${u}`)}`,as:`lower_${u}`}],d=[{fieldPrefix:`center_`,titlePrefix:tQ(t)},{fieldPrefix:`upper_`,titlePrefix:aNe(t,n,`+`)},{fieldPrefix:`lower_`,titlePrefix:aNe(t,n,`-`)}],f=!0;else{let e,t,r;n===`ci`?(e=`mean`,t=`ci0`,r=`ci1`):(e=`median`,t=`q1`,r=`q3`),c=[{op:t,field:u,as:`lower_${u}`},{op:r,field:u,as:`upper_${u}`},{op:e,field:u,as:`center_${u}`}],d=[{fieldPrefix:`upper_`,titlePrefix:p1({field:u,aggregate:r,type:`quantitative`},s,{allowDisabling:!1})},{fieldPrefix:`lower_`,titlePrefix:p1({field:u,aggregate:t,type:`quantitative`},s,{allowDisabling:!1})},{fieldPrefix:`center_`,titlePrefix:p1({field:u,aggregate:e,type:`quantitative`},s,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&Z($Ae(e.center,e.extent)),a===`aggregated-upper-lower`?(d=[],l=[{calculate:iQ(n.field),as:`upper_${u}`},{calculate:iQ(u),as:`lower_${u}`}]):a===`aggregated-error`&&(d=[{fieldPrefix:``,titlePrefix:u}],l=[{calculate:`${iQ(u)} + ${iQ(r.field)}`,as:`upper_${u}`}],i?l.push({calculate:`${iQ(u)} + ${iQ(i.field)}`,as:`lower_${u}`}):l.push({calculate:`${iQ(u)} - ${iQ(r.field)}`,as:`lower_${u}`}));for(let e of l)d.push({fieldPrefix:e.as.substring(0,6),titlePrefix:sQ(sQ(e.calculate,`datum['`,``),`']`,``)})}return{postAggregateCalculates:l,errorBarSpecificAggregate:c,tooltipSummary:d,tooltipTitleWithFieldName:f}}function aNe(e,t,n){return`${tQ(e)} ${n} ${t}`}function oNe(e,{config:t}){e={...e,encoding:O1(e.encoding,t)};let{transform:n,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:a,markDef:o,outerSpec:s,tooltipEncoding:c}=rNe(e,c3,t),l=o,u=M1(l,i,r,a,t.errorband),d=e.encoding.x!==void 0&&e.encoding.y!==void 0,f={type:d?`area`:`rect`},p={type:d?`line`:`rule`},m={...l.interpolate?{interpolate:l.interpolate}:{},...l.tension&&l.interpolate?{tension:l.tension}:{}};return d?(f={...f,...m,ariaRoleDescription:`errorband`},p={...p,...m,aria:!1}):l.interpolate?Z(nje(`interpolate`)):l.tension&&Z(nje(`tension`)),{...s,transform:n,layer:[...u({partName:`band`,mark:f,positionPrefix:`lower`,endPositionPrefix:`upper`,extraEncoding:c}),...u({partName:`borders`,mark:p,positionPrefix:`lower`,extraEncoding:c}),...u({partName:`borders`,mark:p,positionPrefix:`upper`,extraEncoding:c})]}}function P1(e,t,n){let r=new a3(e,t);l3[e]={normalizer:r,parts:n}}function sNe(){return $(l3)}function F1(e){return e===`legend`||!!e?.legend}function I1(e){return F1(e)&&jh(e)}function L1(e){return!!e?.select}function cNe(e){let t=[];for(let n of e||[]){if(L1(n))continue;let{expr:e,bind:r,...i}=n;if(r&&e){let n={...i,bind:r,init:e};t.push(n)}else{let n={...i,...e?{update:e}:{},...r?{bind:r}:{}};t.push(n)}}return t}function lNe(e){return z1(e)||B1(e)||R1(e)}function R1(e){return X(e,`concat`)}function z1(e){return X(e,`vconcat`)}function B1(e){return X(e,`hconcat`)}function uNe({step:e,offsetIsDiscrete:t}){return t?e.for??`offset`:`position`}function V1(e){return X(e,`step`)}function dNe(e){return X(e,`view`)||X(e,`width`)||X(e,`height`)}function fNe(e,t,n){let r=n[t],i={},{spacing:a,columns:o}=r;a!==void 0&&(i.spacing=a),o!==void 0&&(X$(e)&&!J$(e.facet)||R1(e))&&(i.columns=o),z1(e)&&(i.columns=1);for(let t of IBe)if(e[t]!==void 0)if(t===`spacing`){let n=e[t];i[t]=gg(n)?n:{row:n.row??a,column:n.column??a}}else i[t]=e[t];return i}function H1(e,t){return e[t]??e[t===`width`?`continuousWidth`:`continuousHeight`]}function U1(e,t){let n=W1(e,t);return V1(n)?n.step:g3}function W1(e,t){return uQ(e[t]??e[t===`width`?`discreteWidth`:`discreteHeight`],{step:e.step})}function pNe(e={}){return{signals:[{name:`color`,value:jh(e)?{...y3,...e}:y3}],mark:{color:{signal:`color.blue`}},rule:{color:{signal:`color.gray0`}},text:{color:{signal:`color.gray0`}},style:{"guide-label":{fill:{signal:`color.gray0`}},"guide-title":{fill:{signal:`color.gray0`}},"group-title":{fill:{signal:`color.gray0`}},"group-subtitle":{fill:{signal:`color.gray0`}},cell:{stroke:{signal:`color.gray8`}}},axis:{domainColor:{signal:`color.gray13`},gridColor:{signal:`color.gray8`},tickColor:{signal:`color.gray13`}},range:{category:[{signal:`color.blue`},{signal:`color.orange`},{signal:`color.red`},{signal:`color.teal`},{signal:`color.green`},{signal:`color.yellow`},{signal:`color.purple`},{signal:`color.pink`},{signal:`color.brown`},{signal:`color.grey8`}]}}}function mNe(e){return{signals:[{name:`fontSize`,value:jh(e)?{...v3,...e}:v3}],text:{fontSize:{signal:`fontSize.text`}},style:{"guide-label":{fontSize:{signal:`fontSize.guideLabel`}},"guide-title":{fontSize:{signal:`fontSize.guideTitle`}},"group-title":{fontSize:{signal:`fontSize.groupTitle`}},"group-subtitle":{fontSize:{signal:`fontSize.groupSubtitle`}}}}}function hNe(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}function gNe(e){let t=$(e||{}),n={};for(let r of t){let t=e[r];n[r]=T1(t)?Wke(t):ZQ(t)}return n}function _Ne(e){let t=$(e),n={};for(let r of t)n[r]=gNe(e[r]);return n}function vNe(e={}){let{color:t,font:n,fontSize:r,selection:i,...a}=e,o=Nh({},f2(LBe),n?hNe(n):{},t?pNe(t):{},r?mNe(r):{},a||{});i&&Ph(o,`selection`,i,!0);let s=LZ(o,RBe);for(let e of[`background`,`lineBreak`,`padding`])o[e]&&(s[e]=ZQ(o[e]));for(let e of Y4)o[e]&&(s[e]=KQ(o[e]));for(let e of i3)o[e]&&(s[e]=gNe(o[e]));for(let e of f3)o[e]&&(s[e]=KQ(o[e]));if(o.legend&&(s.legend=KQ(o.legend)),o.scale){let{invalid:e,...t}=o.scale,n=KQ(e,{level:1});s.scale={...KQ(t),...$(n).length>0?{invalid:n}:{}}}return o.style&&(s.style=_Ne(o.style)),o.title&&(s.title=KQ(o.title)),o.view&&(s.view=KQ(o.view)),s}function yNe(e){e=f2(e);for(let t of BBe)delete e[t];if(e.axis)for(let t in e.axis)T1(e.axis[t])&&delete e.axis[t];if(e.legend)for(let t of ABe)delete e.legend[t];if(e.mark){for(let t of q4)delete e.mark[t];e.mark.tooltip&&jh(e.mark.tooltip)&&delete e.mark.tooltip}e.params&&(e.signals=(e.signals||[]).concat(cNe(e.params)),delete e.params);for(let t of zBe){for(let n of q4)delete e[t][n];let n=VBe[t];if(n)for(let r of n)delete e[t][r];xNe(e,t)}for(let t of sNe())delete e[t];bNe(e);for(let t in e)jh(e[t])&&YZ(e[t])&&delete e[t];return YZ(e)?void 0:e}function bNe(e){let{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:r}=Vke(e.title);YZ(t)||(e.style[`group-title`]={...e.style[`group-title`],...t}),YZ(n)||(e.style[`group-subtitle`]={...e.style[`group-subtitle`],...n}),YZ(r)?delete e.title:e.title=r}function xNe(e,t,n,r){let i=e[t];t===`view`&&(n=`cell`);let a={...i,...e.style[n??t]};YZ(a)||(e.style[n??t]=a),delete e[t]}function G1(e){return X(e,`layer`)}function SNe(e){return X(e,`repeat`)}function CNe(e){return!W(e.repeat)&&X(e.repeat,`layer`)}function wNe(e){return cg(HBe,e)}function K1(e){return Q(e)&&n1(e)===`quantitative`&&!e.bin}function TNe(e,t,{orient:n,type:r}){let i=t===`x`?`y`:`radius`,a=t===`x`&&[`bar`,`area`].includes(r),o=e[t],s=e[i];if(Q(o)&&Q(s)){if(K1(o)&&K1(s)){if(o.stack)return t;if(s.stack)return i;let e=Q(o)&&!!o.aggregate;if(e!==(Q(s)&&!!s.aggregate))return e?t:i;if(a){if(n===`vertical`)return i;if(n===`horizontal`)return t}}else if(K1(o))return t;else if(K1(s))return i}else if(K1(o))return a&&n===`vertical`?void 0:t;else if(K1(s))return a&&n===`horizontal`?void 0:i}function ENe(e){switch(e){case`x`:return`y`;case`y`:return`x`;case`theta`:return`radius`;case`radius`:return`theta`}}function DNe(e,t){let n=P$(e)?e:{type:e},r=n.type;if(!UBe.has(r))return null;let i=TNe(t,`x`,n)||TNe(t,`theta`,n);if(!i)return null;let a=t[i],o=Q(a)?d1(a,{}):void 0,s=ENe(i),c=[],l=new Set;if(t[s]){let e=t[s],n=Q(e)?d1(e,{}):void 0;n&&n!==o&&(c.push(s),l.add(n))}let u=s===`x`?`xOffset`:`yOffset`,d=t[u],f=Q(d)?d1(d,{}):void 0;f&&f!==o&&(c.push(u),l.add(f));let p=uze.reduce((e,n)=>{if(n!==`tooltip`&&D1(t,n)){let r=t[n];for(let t of Qh(r)){let r=_1(t);if(r.aggregate)continue;let i=d1(r,{});(!i||!l.has(i))&&e.push({channel:n,fieldDef:r})}}return e},[]),m;return a.stack===void 0?WBe.has(r)&&(m=`zero`):m=mg(a.stack)?a.stack?`zero`:null:a.stack,!m||!wNe(m)||LMe(t)&&p.length===0?null:(a?.scale?.type&&a?.scale?.type!==A4.LINEAR&&a?.stack&&Z(XAe(a.scale.type)),o1(t[EQ(i)])?(a.stack!==void 0&&Z(YAe(i)),null):(Q(a)&&a.aggregate&&!Dze.has(a.aggregate)&&Z(ZAe(a.aggregate)),{groupbyChannels:c,groupbyFields:l,fieldChannel:i,impute:a.impute!==null&&M$(r),stackBy:p,offset:m}))}function ONe(e,t,n){let r=KQ(e),i=e$(`orient`,r,n);if(r.orient=MNe(r.type,t,i),i!==void 0&&i!==r.orient&&Z(NAe(r.orient,i)),r.type===`bar`&&r.orient){let e=e$(`cornerRadiusEnd`,r,n);if(e!==void 0){let n=r.orient===`horizontal`&&t.x2||r.orient===`vertical`&&t.y2?[`cornerRadius`]:vBe[r.orient];for(let t of n)r[t]=e;r.cornerRadiusEnd!==void 0&&delete r.cornerRadiusEnd}}let a=e$(`opacity`,r,n),o=e$(`fillOpacity`,r,n);return a===void 0&&o===void 0&&(r.opacity=ANe(r.type,t)),e$(`cursor`,r,n)===void 0&&(r.cursor=kNe(r,t,n)),r}function kNe(e,t,n){return t.href||e.href||e$(`href`,e,n)?`pointer`:e.cursor}function ANe(e,t){if(BZ([B4,U4,W4,G4],e)&&!LMe(t))return x3}function jNe(e,t,{graticule:n}){if(n)return!1;let r=t$(`filled`,e,t),i=e.type;return uQ(r,i!==B4&&i!==z4&&i!==V4)}function MNe(e,t,n){switch(e){case B4:case W4:case G4:case uBe:case lBe:return}let{x:r,y:i,x2:a,y2:o}=t;switch(e){case H4:case R4:if(Q(r)&&(HQ(r.bin)||Q(i)&&i.aggregate&&!r.aggregate))return`vertical`;if(Q(i)&&(HQ(i.bin)||Q(r)&&r.aggregate&&!i.aggregate))return`horizontal`;if(o||a){if(n)return n;if(!a)return(Q(r)&&r.type===T4&&!VQ(r.bin)||a1(r))&&Q(i)&&HQ(i.bin)?`horizontal`:`vertical`;if(!o)return(Q(i)&&i.type===T4&&!VQ(i.bin)||a1(i))&&Q(r)&&HQ(r.bin)?`vertical`:`horizontal`}case V4:if(a&&!(Q(r)&&HQ(r.bin))&&o&&!(Q(i)&&HQ(i.bin)))return;case L4:if(o)return Q(i)&&HQ(i.bin)?`horizontal`:`vertical`;if(a)return Q(r)&&HQ(r.bin)?`vertical`:`horizontal`;if(e===V4){if(r&&!i)return`vertical`;if(i&&!r)return`horizontal`}case z4:case U4:{let t=_Me(r),a=_Me(i);if(n)return n;if(t&&!a)return e===`tick`?`vertical`:`horizontal`;if(!t&&a)return e===`tick`?`horizontal`:`vertical`;if(t&&a)return`vertical`;{let e=s1(r)&&r.type===D4,t=s1(i)&&i.type===D4;if(e&&!t)return`vertical`;if(!e&&t)return`horizontal`}return}}return`vertical`}function NNe(e){let{point:t,line:n,...r}=e;return $(r).length>1?r:r.type}function PNe(e){for(let t of[`line`,`area`,`rule`,`trail`])e[t]&&(e={...e,[t]:LZ(e[t],[`point`,`line`])});return e}function q1(e,t={},n){return e.point===`transparent`?{opacity:0}:e.point?jh(e.point)?e.point:{}:e.point===void 0?t.point||n.shape?jh(t.point)?t.point:{}:void 0:null}function FNe(e,t={}){return e.line?e.line===!0?{}:e.line:e.line===void 0?t.line?t.line===!0?{}:t.line:void 0:null}function INe(e,t){return t?J$(e)?BNe(e,t):LNe(e,t):e}function J1(e,t){return t?BNe(e,t):e}function Y1(e,t,n){let r=t[e];if(dMe(r)){if(r.repeat in n)return{...t,[e]:n[r.repeat]};Z(dAe(r.repeat));return}return t}function LNe(e,t){if(e=Y1(`field`,e,t),e!==void 0){if(e===null)return null;if(Z$(e)&&q$(e.sort)){let n=Y1(`field`,e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function RNe(e,t){if(Q(e))return LNe(e,t);{let n=Y1(`datum`,e,t);return n!==e&&!n.type&&(n.type=`nominal`),n}}function zNe(e,t){if(o1(e)){let n=RNe(e,t);if(n)return n;if($$(e))return{condition:e.condition}}else{if(t1(e)){let n=RNe(e.condition,t);if(n)return{...e,condition:n};{let{condition:t,...n}=e;return n}}return e}}function BNe(e,t){let n={};for(let r in e)if(X(e,r)){let i=e[r];if(W(i))n[r]=i.map(e=>zNe(e,t)).filter(e=>e);else{let e=zNe(i,t);e!==void 0&&(n[r]=e)}}return n}function VNe({parentEncoding:e,encoding:t={},layer:n}){let r={};if(e){let i=new Set([...$(e),...$(t)]);for(let a of i){let i=t[a],o=e[a];if(o1(i)){let e={...o,...i};r[a]=e}else t1(i)?r[a]={...i,condition:{...o,...i.condition}}:i||i===null?r[a]=i:(n||c1(o)||JQ(o)||o1(o)||W(o))&&(r[a]=o)}}else r=t;return!r||YZ(r)?void 0:r}function HNe(e){let{parentProjection:t,projection:n}=e;return t&&n&&Z(yAe({parentProjection:t,projection:n})),n??t}function X1(e){return X(e,`filter`)}function UNe(e){return X(e,`stop`)}function WNe(e){return X(e,`lookup`)}function GNe(e){return X(e,`data`)}function KNe(e){return X(e,`param`)}function qNe(e){return X(e,`pivot`)}function JNe(e){return X(e,`density`)}function YNe(e){return X(e,`quantile`)}function XNe(e){return X(e,`regression`)}function ZNe(e){return X(e,`loess`)}function QNe(e){return X(e,`sample`)}function $Ne(e){return X(e,`window`)}function ePe(e){return X(e,`joinaggregate`)}function tPe(e){return X(e,`flatten`)}function nPe(e){return X(e,`calculate`)}function rPe(e){return X(e,`bin`)}function iPe(e){return X(e,`impute`)}function aPe(e){return X(e,`timeUnit`)}function oPe(e){return X(e,`aggregate`)}function sPe(e){return X(e,`stack`)}function cPe(e){return X(e,`fold`)}function lPe(e){return X(e,`extent`)&&!X(e,`density`)&&!X(e,`regression`)}function uPe(e){return e.map(e=>X1(e)?{filter:PZ(e.filter,jje)}:e)}function dPe(e,t){let{transform:n,...r}=e;if(n){let e=n.map(e=>{if(X1(e))return{filter:Z1(e,t)};if(rPe(e)&&UQ(e.bin))return{...e,bin:pPe(e.bin)};if(WNe(e)){let{selection:t,...n}=e.from;return t?{...e,from:{param:t,...n}}:e}return e});return{...r,transform:e}}return e}function fPe(e,t){let n=f2(e);if(Q(n)&&UQ(n.bin)&&(n.bin=pPe(n.bin)),l1(n)&&n.scale?.domain?.selection){let{selection:e,...t}=n.scale.domain;n.scale.domain={...t,...e?{param:e}:{}}}if($$(n))if(W(n.condition))n.condition=n.condition.map(e=>{let{selection:n,param:r,test:i,...a}=e;return r?e:{...a,test:Z1(e,t)}});else{let{selection:e,param:r,test:i,...a}=fPe(n.condition,t);n.condition=r?n.condition:{...a,test:Z1(n.condition,t)}}return n}function pPe(e){let t=e.extent;if(t?.selection){let{selection:n,...r}=t;return{...e,extent:{...r,param:n}}}return e}function Z1(e,t){let n=e=>PZ(e,e=>{let n={param:e,empty:t.emptySelections[e]??!0};return t.selectionPredicates[e]??=[],t.selectionPredicates[e].push(n),n});return e.selection?n(e.selection):PZ(e.test||e.filter,e=>e.selection?n(e.selection):e)}function mPe(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function hPe(e,t){t===void 0&&(t=vNe(e.config));let n=gPe(e,t),{width:r,height:i}=e,a=vPe(n,{width:r,height:i,autosize:e.autosize},t);return{...n,...a?{autosize:a}:{}}}function gPe(e,t={}){let n={config:t};return ZBe.map(YBe.map(XBe.map(e,n),n),n)}function _Pe(e){return vg(e)?{type:e}:e??{}}function vPe(e,t,n){let{width:r,height:i}=t,a=E1(e)||G1(e),o={};a?r==`container`&&i==`container`?(o.type=`fit`,o.contains=`padding`):r==`container`?(o.type=`fit-x`,o.contains=`padding`):i==`container`&&(o.type=`fit-y`,o.contains=`padding`):(r==`container`&&(Z(tAe(`width`)),r=void 0),i==`container`&&(Z(tAe(`height`)),i=void 0));let s={type:`pad`,...o,...n?_Pe(n.autosize):{},..._Pe(e.autosize)};if(s.type===`fit`&&!a&&(Z(Mze),s.type=`pad`),r==`container`&&!(s.type==`fit`||s.type==`fit-x`)&&Z(nAe(`width`)),i==`container`&&!(s.type==`fit`||s.type==`fit-y`)&&Z(nAe(`height`)),!gQ(s,{type:`pad`}))return s}function yPe(e){return[`fit`,`fit-x`,`fit-y`].includes(e)}function bPe(e){return e?`fit-${jQ(e)}`:`fit`}function xPe(e,t){let n={};for(let t of QBe)e&&e[t]!==void 0&&(n[t]=ZQ(e[t]));return t&&(n.params=e.params),n}function Q1(e){return{explicit:!0,value:e}}function $1(e){return{explicit:!1,value:e}}function SPe(e){return(t,n,r,i)=>{let a=e(t.value,n.value);return a>0?t:a<0?n:e0(t,n,r,i)}}function e0(e,t,n,r){return e.explicit&&t.explicit&&Z(WAe(n,r,e.value,t.value)),e}function t0(e,t,n,r,i=e0){return e===void 0||e.value===void 0?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:gQ(e.value,t.value)?e:i(e,t,n,r)}function n0(e){return X(e,`url`)}function r0(e){return X(e,`values`)}function CPe(e){return X(e,`name`)&&!n0(e)&&!r0(e)&&!i0(e)}function i0(e){return e&&(wPe(e)||TPe(e)||a0(e))}function wPe(e){return X(e,`sequence`)}function TPe(e){return X(e,`sphere`)}function a0(e){return X(e,`graticule`)}function EPe({invalid:e,isPath:t}){switch(Kje(e,{isPath:t})){case`filter`:return{marks:`exclude-invalid-values`,scales:`exclude-invalid-values`};case`break-paths-show-domains`:return{marks:t?`include-invalid-values`:`exclude-invalid-values`,scales:`include-invalid-values`};case`break-paths-filter-domains`:return{marks:t?`include-invalid-values`:`exclude-invalid-values`,scales:`exclude-invalid-values`};case`show`:return{marks:`include-invalid-values`,scales:`include-invalid-values`}}}function DPe(e){let{marks:t,scales:n}=EPe(e);return t===n?w3.Main:n===`include-invalid-values`?w3.PreFilterInvalid:w3.PostFilterInvalid}function o0(e){return e.as!==void 0}function OPe(e){return`${e}_end`}function kPe({timeUnit:e,field:t,reverse:n}){let{unit:r,utc:i}=e,{part:a,step:o}=Tje(_je(r),e.step);return`${i?`utcOffset`:`timeOffset`}('${a}', ${iQ(t)}, ${n?-o:o})`}function APe([e,t],n,r){if(n!==void 0&&n!==.5){let i=iQ(e),a=iQ(t);return[{type:`formula`,expr:jPe([kPe({timeUnit:r,field:e,reverse:!0}),i],n+.5),as:`${e}_${O3}`},{type:`formula`,expr:jPe([i,a],n+.5),as:`${e}_${k3}`}]}return[]}function jPe([e,t],n){return`${1-n} * ${e} + ${n} * ${t}`}function MPe(e){let{signals:t,hasLegend:n,index:r,...i}=e;return i.field=oQ(i.field),i}function s0(e,t=!0,n=Ch){if(W(e)){let r=e.map(e=>s0(e,t,n));return t?`[${r.join(`, `)}]`:r}else if(u$(e))return n(t?f$(e):pje(e));return t?n(_Q(e)):e}function NPe(e,t){for(let n of p2(e.component.selection??{})){let r=n.name,i=`${r}${t6}, ${n.resolve===`global`?`true`:`{unit: ${C0(e)}}`}`;for(let r of r6)r.defined(n)&&(r.signals&&(t=r.signals(e,n,t)),r.modifyExpr&&(i=r.modifyExpr(e,n,i)));t.push({name:r+pVe,on:[{events:{signal:n.name+t6},update:`modify(${G(n.name+e6)}, ${i})`}]})}return c0(t)}function PPe(e,t){if(e.component.selection&&$(e.component.selection).length){let n=G(e.getName(`cell`));t.unshift({name:`facet`,value:{},on:[{events:VG(`pointermove`,`scope`),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return c0(t)}function FPe(e,t){let n=!1;for(let r of p2(e.component.selection??{})){let i=r.name,a=G(i+e6);if(t.filter(e=>e.name===i).length===0){let e=r.resolve===`global`?`union`:r.resolve,n=r.type===`point`?`, true, true)`:`)`;t.push({name:r.name,update:`${n6}(${a}, ${G(e)}${n}`})}n=!0;for(let n of r6)n.defined(r)&&n.topLevelSignals&&(t=n.topLevelSignals(e,r,t))}return n&&t.filter(e=>e.name===`unit`).length===0&&t.unshift({name:`unit`,value:{},on:[{events:`pointermove`,update:`isTuple(group()) ? group() : unit`}]}),c0(t)}function IPe(e,t){let n=[],r=[],i=C0(e,{escape:!1});for(let a of p2(e.component.selection??{})){let o={name:a.name+e6};if(a.project.hasSelectionId&&(o.transform=[{type:`collect`,sort:{field:m3}}]),a.init){let e=a.project.items.map(MPe);o.values=a.project.hasSelectionId?a.init.map(e=>({unit:i,[m3]:s0(e,!1)[0]})):a.init.map(t=>({unit:i,fields:e,values:s0(t,!1)}))}if([...n,...t].filter(e=>e.name===a.name+e6).length||n.push(o),T0(a)&&t.length){let n=e.lookupDataSource(e.getDataName(w3.Main)),i=t.find(e=>e.name===n),a=i.transform.find(e=>e.type===`filter`&&e.expr.includes(`vlSelectionTest`));if(a){i.transform=i.transform.filter(e=>e!==a);let e={name:i.name+j3,source:i.name,transform:[a]};r.push(e)}}}return n.concat(t,r)}function LPe(e,t){for(let n of p2(e.component.selection??{}))for(let r of r6)r.defined(n)&&r.marks&&(t=r.marks(e,n,t));return t}function RPe(e,t){for(let n of e.children)e2(n)&&(t=LPe(n,t));return t}function zPe(e,t,n,r){let i=yFe(e,t.param,t);return{signal:O$(n.get(`type`))&&W(r)&&r[0]>r[1]?`isValid(${i}) && reverse(${i})`:i}}function c0(e){return e.map(e=>(e.on&&!e.on.length&&delete e.on,e))}function l0(e,t){return`domain(${G(e.scaleName(t))})`}function u0(e){return e.parent&&r2(e.parent)&&(!e.parent.parent||u0(e.parent.parent))}function BPe(e,t,n,r){let i=!e.hasProjection,a=n.channel,o=n.signals.visual,s=G(i?e.scaleName(a):e.projectionName()),c=e=>`scale(${s}, ${e})`,l=e.getSizeSignalRef(a===b2?`width`:`height`).signal,u=`${a}(unit)`,d=t.events.reduce((e,t)=>[...e,{events:t.between[0],update:`[${u}, ${u}]`},{events:t,update:`[${o}[0], clamp(${u}, 0, ${l})]`}],[]);if(i){let i=n.signals.data,l=z3.defined(t),u=e.getScaleComponent(a),f=u?u.get(`type`):void 0,p=r?{init:s0(r,!0,c)}:{value:[]};return d.push({events:{signal:t.name+V3},update:O$(f)?`[${c(`${i}[0]`)}, ${c(`${i}[1]`)}]`:`[0, 0]`}),l?[{name:i,on:[]}]:[{name:o,...p,on:d},{name:i,...r?{init:s0(r)}:{},on:[{events:{signal:o},update:`${o}[0] === ${o}[1] ? null : invert(${s}, ${o})`}]}]}else{let e=a===b2?0:1,n=t.name+U3;return[{name:o,...r?{init:`[${n}[0][${e}], ${n}[1][${e}]]`}:{value:[]},on:d}]}}function d0({model:e,channelDef:t,vgChannel:n,invalidValueRef:r,mainRefFn:i}){let a=$$(t)&&t.condition,o=[];a&&(o=Qh(a).map(t=>{let n=i(t);if(uMe(t)){let{param:r,empty:i}=t;return{test:vFe(e,{param:r,empty:i}),...n}}else return{test:D0(e,t.test),...n}})),r!==void 0&&o.push(r);let s=i(t);return s!==void 0&&o.push(s),o.length>1||o.length===1&&o[0].test?{[n]:o}:o.length===1?{[n]:o[0]}:{}}function f0(e,t=`text`){let n=e.encoding[t];return d0({model:e,channelDef:n,vgChannel:t,mainRefFn:t=>p0(t,e.config),invalidValueRef:void 0})}function p0(e,t,n=`datum`){if(e){if(c1(e))return QQ(e.value);if(o1(e)){let{format:r,formatType:i}=g1(e);return U$({fieldOrDatumDef:e,format:r,formatType:i,expr:n,config:t})}}}function VPe(e,t={}){let{encoding:n,markDef:r,config:i,stack:a}=e,o=n.tooltip;if(W(o))return{tooltip:UPe({tooltip:o},a,i,t)};{let s=t.reactiveGeom?`datum.datum`:`datum`;return d0({model:e,channelDef:o,vgChannel:`tooltip`,mainRefFn:e=>{let o=WPe(e,i,s);if(o)return o;if(e===null)return;let c=e$(`tooltip`,r,i);if(c===!0&&(c={content:`encoding`}),vg(c))return{value:c};if(jh(c))return JQ(c)?c:c.content===`encoding`?UPe(n,a,i,t):{signal:s}},invalidValueRef:void 0})}}function HPe(e,t,n,{reactiveGeom:r}={}){let i={...n,...n.tooltipFormat},a=new Set,o=r?`datum.datum`:`datum`,s=[];function c(n,r){let c=wQ(r),l=s1(n)?n:{...n,type:e[c].type},u=Qh(l.title||h1(l,i)).join(`, `).replaceAll(/"/g,`\\"`),d;if(AQ(r)){let t=r===`x`?`x2`:`y2`,n=_1(e[t]);if(HQ(l.bin)&&n){let e=d1(l,{expr:o}),r=d1(n,{expr:o}),{format:s,formatType:c}=g1(l);d=K$(e,r,s,c,i),a.add(t)}}if((AQ(r)||r===O2||r===E2)&&t&&t.fieldChannel===r&&t.offset===`normalize`){let{format:e,formatType:t}=g1(l);d=U$({fieldOrDatumDef:l,format:e,formatType:t,expr:o,config:i,normalizeStack:!0}).signal}d??=WPe(l,i,o).signal,s.push({channel:r,key:u,value:d})}k1(e,(e,t)=>{Q(e)?c(e,t):e1(e)&&c(e.condition,t)});let l={};for(let{channel:e,key:t,value:n}of s)!a.has(e)&&!l[t]&&(l[t]=n);return l}function UPe(e,t,n,{reactiveGeom:r}={}){let i=HPe(e,t,n,{reactiveGeom:r}),a=m2(i).map(([e,t])=>`"${e}": ${t}`);return a.length>0?{signal:`{${a.join(`, `)}}`}:void 0}function WPe(e,t,n=`datum`){if(Q(e)&&E$(e.type)&&!e.timeUnit&&!g1(e).format&&!g1(e).formatType){let t=`${n}["${e.field}"]`;return{signal:`isValid(${t}) ? isArray(${t}) ? join(${t}, '\\n') : ${t} : ""+${t}`}}return p0(e,t,n)}function GPe(e){let{markDef:t,config:n}=e,r=e$(`aria`,t,n);return r===!1?{}:{...r?{aria:r}:{},...KPe(e),...qPe(e)}}function KPe(e){let{mark:t,markDef:n,config:r}=e;if(r.aria===!1)return{};let i=e$(`ariaRoleDescription`,n,r);return i==null?cg(Aze,t)?{}:{ariaRoleDescription:{value:t}}:{ariaRoleDescription:{value:i}}}function qPe(e){let{encoding:t,markDef:n,config:r,stack:i}=e,a=t.description;if(a)return d0({model:e,channelDef:a,vgChannel:`description`,mainRefFn:t=>p0(t,e.config),invalidValueRef:void 0});let o=e$(`description`,n,r);if(o!=null)return{description:QQ(o)};if(r.aria===!1)return{};let s=HPe(t,i,r);if(!YZ(s))return{description:{signal:m2(s).filter(([e])=>!e.startsWith(`_`)).map(([e,t])=>[e,t.replaceAll(`\\n`,` `)]).map(([e,t],n)=>`"${n>0?`; `:``}${e}: " + (${t})`).join(` + `)}}}function m0(e,t,n={}){let{markDef:r,encoding:i,config:a}=t,{vgChannel:o}=n,{defaultRef:s,defaultValue:c}=n,l=i[e];s===void 0&&(c??=e$(e,r,a,{vgChannel:o,ignoreVgConfig:!$$(l)}),c!==void 0&&(s=QQ(c)));let u={markDef:r,config:a,scaleName:t.scaleName(e),scale:t.getScaleComponent(e)},d=Yje({...u,scaleChannel:e,channelDef:l});return d0({model:t,channelDef:l,vgChannel:o??e,invalidValueRef:d,mainRefFn:t=>B$({...u,channel:e,channelDef:t,stack:null,defaultRef:s})})}function JPe(e,t={filled:void 0}){let{markDef:n,encoding:r,config:i}=e,{type:a}=n,o=t.filled??e$(`filled`,n,i),s=BZ([`bar`,`point`,`circle`,`square`,`geoshape`],a)?`transparent`:void 0,c=e$(o===!0?`color`:void 0,n,i,{vgChannel:`fill`})??i.mark[o===!0&&`color`]??s,l=e$(o===!1?`color`:void 0,n,i,{vgChannel:`stroke`})??i.mark[o===!1&&`color`],u=o?`fill`:`stroke`,d={...c?{fill:QQ(c)}:{},...l?{stroke:QQ(l)}:{}};return n.color&&(o?n.fill:n.stroke)&&Z(TAe(`property`,{fill:`fill`in n,stroke:`stroke`in n})),{...d,...m0(`color`,e,{vgChannel:u,defaultValue:o?c:l}),...m0(`fill`,e,{defaultValue:r.fill?c:void 0}),...m0(`stroke`,e,{defaultValue:r.stroke?l:void 0})}}function YPe(e){let{encoding:t,mark:n}=e,r=t.order;return!M$(n)&&c1(r)?d0({model:e,channelDef:r,vgChannel:`zindex`,mainRefFn:e=>QQ(e.value),invalidValueRef:void 0}):{}}function h0({channel:e,markDef:t,encoding:n={},model:r,bandPosition:i}){let a=`${e}Offset`,o=t[a],s=n[a];if((a===`xOffset`||a===`yOffset`)&&s)return{offsetType:`encoding`,offset:B$({channel:a,channelDef:s,markDef:t,config:r?.config,scaleName:r.scaleName(a),scale:r.getScaleComponent(a),stack:null,defaultRef:QQ(o),bandPosition:i})};let c=t[a];return c?{offsetType:`visual`,offset:c}:{}}function g0(e,t,{defaultPos:n,vgChannel:r}){let{encoding:i,markDef:a,config:o,stack:s}=t,c=i[e],l=i[EQ(e)],u=t.scaleName(e),d=t.getScaleComponent(e),{offset:f,offsetType:p}=h0({channel:e,markDef:a,encoding:i,model:t,bandPosition:.5}),m=_0({model:t,defaultPos:n,channel:e,scaleName:u,scale:d}),h=!c&&AQ(e)&&(i.latitude||i.longitude)?{field:t.getName(e)}:XPe({channel:e,channelDef:c,channel2Def:l,markDef:a,config:o,scaleName:u,scale:d,stack:s,offset:f,defaultRef:m,bandPosition:p===`encoding`?0:void 0});return h?{[r||e]:h}:void 0}function XPe(e){let{channel:t,channelDef:n,scaleName:r,stack:i,offset:a,markDef:o}=e;if(o1(n)&&i&&t===i.fieldChannel){if(Q(n)){let e=n.bandPosition;if(e===void 0&&o.type===`text`&&(t===`radius`||t===`theta`)&&(e=.5),e!==void 0)return z$({scaleName:r,fieldOrDatumDef:n,startSuffix:`start`,bandPosition:e,offset:a})}return R$(n,r,{suffix:`end`},{offset:a})}return L$(e)}function _0({model:e,defaultPos:t,channel:n,scaleName:r,scale:i}){let{markDef:a,config:o}=e;return()=>{let s=wQ(n),c=TQ(n),l=e$(n,a,o,{vgChannel:c});if(l!==void 0)return V$(n,l);switch(t){case`zeroOrMin`:return ZPe({scaleName:r,scale:i,mode:`zeroOrMin`,mainChannel:s,config:o});case`zeroOrMax`:return ZPe({scaleName:r,scale:i,mode:{zeroOrMax:{widthSignal:e.width.signal,heightSignal:e.height.signal}},mainChannel:s,config:o});case`mid`:return{...e[DQ(n)],mult:.5}}}}function ZPe({mainChannel:e,config:t,...n}){let r=Jje(n),{mode:i}=n;if(r)return r;switch(e){case`radius`:{if(i===`zeroOrMin`)return{value:0};let{widthSignal:e,heightSignal:t}=i.zeroOrMax;return{signal:`min(${e},${t})/2`}}case`theta`:return i===`zeroOrMin`?{value:0}:{signal:`2*PI`};case`x`:return i===`zeroOrMin`?{value:0}:{field:{group:`width`}};case`y`:return i===`zeroOrMin`?{field:{group:`height`}}:{value:0}}}function QPe(e,t,n,r=`middle`){if(e===`radius`||e===`theta`)return TQ(e);let i=e===`x`?`align`:`baseline`,a=e$(i,t,n),o;return JQ(a)?(Z(jAe(i)),o=void 0):o=a,e===`x`?sVe[o||(r===`top`?`left`:`center`)]:cVe[o||r]}function v0(e,t,{defaultPos:n,defaultPos2:r,range:i}){return i?$Pe(e,t,{defaultPos:n,defaultPos2:r}):g0(e,t,{defaultPos:n})}function $Pe(e,t,{defaultPos:n,defaultPos2:r}){let{markDef:i,config:a}=t,o=EQ(e),s=DQ(e),c=eFe(t,r,o);return{...g0(e,t,{defaultPos:n,vgChannel:c[s]?QPe(e,i,a):TQ(e)}),...c}}function eFe(e,t,n){let{encoding:r,mark:i,markDef:a,stack:o,config:s}=e,c=wQ(n),l=DQ(n),u=TQ(n),d=r[c],f=e.scaleName(c),p=e.getScaleComponent(c),{offset:m}=n in r||n in a?h0({channel:n,markDef:a,encoding:r,model:e}):h0({channel:c,markDef:a,encoding:r,model:e});if(!d&&(n===`x2`||n===`y2`)&&(r.latitude||r.longitude)){let t=DQ(n),r=e.markDef[t];return r==null?{[u]:{field:e.getName(n)}}:{[t]:{value:r}}}let h=tFe({channel:n,channelDef:d,channel2Def:r[n],markDef:a,config:s,scaleName:f,scale:p,stack:o,offset:m,defaultRef:void 0});return h===void 0?y0(n,a)||y0(n,{[n]:n$(n,a,s.style),[l]:n$(l,a,s.style)})||y0(n,s[i])||y0(n,s.mark)||{[u]:_0({model:e,defaultPos:t,channel:n,scaleName:f,scale:p})()}:{[u]:h}}function tFe({channel:e,channelDef:t,channel2Def:n,markDef:r,config:i,scaleName:a,scale:o,stack:s,offset:c,defaultRef:l}){return o1(t)&&s&&e.charAt(0)===s.fieldChannel.charAt(0)?R$(t,a,{suffix:`start`},{offset:c}):L$({channel:e,channelDef:n,scaleName:a,scale:o,stack:s,markDef:r,config:i,offset:c,defaultRef:l})}function y0(e,t){let n=DQ(e),r=TQ(e);if(t[r]!==void 0)return{[r]:V$(e,t[r])};if(t[e]!==void 0)return{[r]:V$(e,t[e])};if(t[n]){let r=t[n];if(F$(r))Z(EAe(n));else return{[n]:V$(e,r)}}}function b0(e,t){let{config:n,encoding:r,markDef:i}=e,a=i.type,o=EQ(t),s=DQ(t),c=r[t],l=r[o],u=e.getScaleComponent(t),d=u?u.get(`type`):void 0,f=i.orient,p=r[s]??r.size??e$(`size`,i,n,{vgChannel:s}),m=OQ(t),h=a===`bar`&&(t===`x`?f===`vertical`:f===`horizontal`)||a===`tick`&&(t===`y`?f===`vertical`:f===`horizontal`);return Q(c)&&(VQ(c.bin)||HQ(c.bin)||c.timeUnit&&!l)&&!(p&&!F$(p))&&!r[m]&&!D$(d)?aFe({fieldDef:c,fieldDef2:l,channel:t,model:e}):(o1(c)&&D$(d)||h)&&!l?rFe(c,t,e):$Pe(t,e,{defaultPos:`zeroOrMax`,defaultPos2:`zeroOrMin`})}function nFe(e,t,n,r,i,a,o){if(F$(i))if(n){let e=n.get(`type`);if(e===`band`){let e=`bandwidth('${t}')`;i.band!==1&&(e=`${i.band} * ${e}`);let n=t$(`minBandSize`,{type:o},r);return{signal:n?`max(${$Q(n)}, ${e})`:e}}else i.band!==1&&Z(FAe(e))}else return{mult:i.band,field:{group:e}};else if(JQ(i))return i;else if(i)return{value:i};if(n){let e=n.get(`range`);if(YQ(e)&&gg(e.step))return{value:e.step-2}}if(!a){let{bandPaddingInner:t,barBandPaddingInner:n,rectBandPaddingInner:i,tickBandPaddingInner:a}=r.scale,s=uQ(t,o===`tick`?a:o===`bar`?n:i);if(JQ(s))return{signal:`(1 - (${s.signal})) * ${e}`};if(gg(s))return{signal:`${1-s} * ${e}`}}return{value:U1(r.view,e)-2}}function rFe(e,t,n){let{markDef:r,encoding:i,config:a,stack:o}=n,s=r.orient,c=n.scaleName(t),l=n.getScaleComponent(t),u=DQ(t),d=EQ(t),f=OQ(t),p=n.scaleName(f),m=n.getScaleComponent(kQ(t)),h=r.type===`tick`||s===`horizontal`&&t===`y`||s===`vertical`&&t===`x`,g;(i.size||r.size)&&(h?g=m0(`size`,n,{vgChannel:u,defaultRef:QQ(r.size)}):Z(zAe(r.type)));let _=!!g,v=pMe({channel:t,fieldDef:e,markDef:r,config:a,scaleType:(l||m)?.get(`type`),useVlSizeChannel:h});g||={[u]:nFe(u,p||c,m||l,a,v,!!e,r.type)};let y=QPe(t,r,a,(l||m)?.get(`type`)===`band`&&F$(v)&&!_?`top`:`middle`),b=y===`xc`||y===`yc`,{offset:x,offsetType:S}=h0({channel:t,markDef:r,encoding:i,model:n,bandPosition:b?.5:0}),C=(b&&S!==`encoding`&&Q(e)&&e.timeUnit&&!i[d]?Q$({fieldDef:e,markDef:r,config:a}):void 0)??(b?S===`encoding`?0:.5:JQ(v)?{signal:`(1-${v})/2`}:F$(v)?(1-v.band)/2:0),w=L$({channel:t,channelDef:e,markDef:r,config:a,scaleName:c,scale:l,stack:o,offset:x,defaultRef:_0({model:n,defaultPos:`mid`,channel:t,scaleName:c,scale:l}),bandPosition:C});if(u)return{[y]:w,...g};{let e=TQ(d),t=g[u],n=x?{...t,offset:x}:t;return{[y]:w,[e]:W(w)?[w[0],{...w[1],offset:n}]:{...w,offset:n}}}}function iFe(e,t,n,r,i,a,o){if(vQ(e))return 0;let s=e===`x`||e===`y2`,c=s?-t/2:t/2;if(JQ(n)||JQ(i)||JQ(r)||a){let e=$Q(n),t=$Q(i),l=$Q(r),u=$Q(a),d=a?`(${o} < ${u} ? ${s?``:`-`}0.5 * (${u} - (${o})) : ${c})`:c,f=l?`${l} + `:``,p=e?`(${e} ? -1 : 1) * `:``,m=t?`(${t} + ${d})`:d;return{signal:f+p+m}}else return i||=0,r+(n?-i-c:+i+c)}function aFe({fieldDef:e,fieldDef2:t,channel:n,model:r}){let{config:i,markDef:a,encoding:o}=r,s=r.getScaleComponent(n),c=r.scaleName(n),l=s?s.get(`type`):void 0,u=s.get(`reverse`),d=pMe({channel:n,fieldDef:e,markDef:a,config:i,scaleType:l}),f=(r.component.axes[n]?.[0])?.get(`translate`)??.5,p=AQ(n)?e$(`binSpacing`,a,i)??0:0,m=EQ(n),h=TQ(n),g=TQ(m),_=t$(`minBandSize`,a,i),{offset:v}=h0({channel:n,markDef:a,encoding:o,model:r,bandPosition:0}),{offset:y}=h0({channel:m,markDef:a,encoding:o,model:r,bandPosition:0}),b=Qje({fieldDef:e,scaleName:c}),x=iFe(n,p,u,f,v,_,b),S=iFe(m,p,u,f,y??v,_,b),C=JQ(d)?{signal:`(1-${d.signal})/2`}:F$(d)?(1-d.band)/2:.5,w=Q$({fieldDef:e,fieldDef2:t,markDef:a,config:i});if(VQ(e.bin)||e.timeUnit){let t=e.timeUnit&&w!==.5;return{[g]:oFe({fieldDef:e,scaleName:c,bandPosition:C,offset:S,useRectOffsetField:t}),[h]:oFe({fieldDef:e,scaleName:c,bandPosition:JQ(C)?{signal:`1-${C.signal}`}:1-C,offset:x,useRectOffsetField:t})}}else if(HQ(e.bin)){let n=R$(e,c,{},{offset:S});if(Q(t))return{[g]:n,[h]:R$(t,c,{},{offset:x})};if(UQ(e.bin)&&e.bin.step)return{[g]:n,[h]:{signal:`scale("${c}", ${d1(e,{expr:`datum`})} + ${e.bin.step})`,offset:x}}}Z(rje(m))}function oFe({fieldDef:e,scaleName:t,bandPosition:n,offset:r,useRectOffsetField:i}){return z$({scaleName:t,fieldOrDatumDef:e,bandPosition:n,offset:r,...i?{startSuffix:O3,endSuffix:k3}:{}})}function x0(e,t){let{fill:n=void 0,stroke:r=void 0}=t.color===`include`?JPe(e):{};return{...cFe(e.markDef,t),...sFe(`fill`,n),...sFe(`stroke`,r),...m0(`opacity`,e),...m0(`fillOpacity`,e),...m0(`strokeOpacity`,e),...m0(`strokeWidth`,e),...m0(`strokeDash`,e),...YPe(e),...VPe(e),...f0(e,`href`),...GPe(e)}}function sFe(e,t){return t?{[e]:t}:{}}function cFe(e,t){return kze.reduce((n,r)=>(!lVe.has(r)&&X(e,r)&&t[r]!==`ignore`&&(n[r]=QQ(e[r])),n),{})}function S0(e){let{config:t,markDef:n}=e,r=new Set;if(e.forEachFieldDef((i,a)=>{let o;if(!PQ(a)||!(o=e.getScaleType(a)))return;let s=zQ(i.aggregate);if(qje(I$({scaleChannel:a,markDef:n,config:t,scaleType:o,isCountAggregate:s}))){let t=e.vgField(a,{expr:`datum`,binSuffix:e.stack?.impute?`mid`:void 0});t&&r.add(t)}}),r.size>0)return{defined:{signal:[...r].map(e=>T$(e,!0)).join(` && `)}}}function lFe(e,t){if(t!==void 0)return{[e]:QQ(t)}}function uFe(e,t,n){let r=e.fieldDef(t)?.field;for(let i of p2(e.component.selection??{})){let e=i.project.hasField[r]??i.project.hasChannel[t];if(e&&Y3.defined(i)){let t=n.get(`selections`)??[];t.push(i.name),n.set(`selections`,t,!1),e.hasLegend=!0}}}function dFe(e,t,n,r,i){let a=t.name,o=a+X3,s=a+Z3,c=n.channel,l=z3.defined(t),u=i.find(e=>e.name===n.signals[l?`data`:`visual`]),d=e.getSizeSignalRef(r).signal,f=e.getScaleComponent(c),p=f?.get(`type`),m=f?.get(`reverse`),h=l?c===b2?m?``:`-`:m?`-`:``:``,g=`${o}.extent_${c}`,_=`${h}${s}.${c} / ${l?`${d}`:`span(${g})`}`,v=`${!l||!f?`panLinear`:p===`log`?`panLog`:p===`symlog`?`panSymlog`:p===`pow`?`panPow`:`panLinear`}(${g}, ${_}${l?p===`pow`?`, ${f.get(`exponent`)??1}`:p===`symlog`?`, ${f.get(`constant`)??1}`:``:``})`;u.on.push({events:{signal:s},update:l?v:`clampRange(${v}, 0, ${d})`})}function fFe(e,t,n,r,i){let a=t.name,o=n.channel,s=z3.defined(t),c=i.find(e=>e.name===n.signals[s?`data`:`visual`]),l=e.getSizeSignalRef(r).signal,u=e.getScaleComponent(o),d=u?.get(`type`),f=s?l0(e,o):c.name,p=a+$3,m=`${a}${Q3}.${o}`,h=`${!s||!u?`zoomLinear`:d===`log`?`zoomLog`:d===`symlog`?`zoomSymlog`:d===`pow`?`zoomPow`:`zoomLinear`}(${f}, ${m}, ${p}${s?d===`pow`?`, ${u.get(`exponent`)??1}`:d===`symlog`?`, ${u.get(`constant`)??1}`:``:``})`;c.on.push({events:{signal:p},update:s?h:`clampRange(${h}, 0, ${l})`})}function pFe(e){let t=e.parent;for(;t&&!t2(t);)t=t.parent;return t}function C0(e,{escape:t}={escape:!0}){let n=t?G(e.name):e.name,r=pFe(e);if(r){let{facet:e}=r;for(let t of i4)e[t]&&(n+=` + '__facet_${t}_' + (facet[${G(r.vgField(t))}])`)}return n}function w0(e){return p2(e.component.selection??{}).reduce((e,t)=>e||t.project.hasSelectionId,!1)}function mFe(e,t){(vg(t.select)||!t.select.on)&&delete e.events,(vg(t.select)||!t.select.clear)&&delete e.clear,(vg(t.select)||!t.select.toggle)&&delete e.toggle}function T0(e){return e.events?.find(e=>`type`in e&&e.type===`timer`)}function E0(e){let t=[];return e.type===`Identifier`?[e.name]:e.type===`Literal`?[e.value]:(e.type===`MemberExpression`&&(t.push(...E0(e.object)),t.push(...E0(e.property))),t)}function hFe(e){return e.object.type===`MemberExpression`?hFe(e.object):e.object.name===`datum`}function gFe(e){let t=Eke(e),n=new Set;return t.visit(e=>{e.type===`MemberExpression`&&hFe(e)&&n.add(E0(e).slice(1).join(`.`))}),n}function _Fe(e,t){let n={},r=e.config.selection;if(!t||!t.length)return n;let i=0;for(let a of t){let t=QZ(a.name),o=a.select,s=vg(o)?o:o.type,c=jh(o)?f2(o):{type:s},l=r[s];for(let e in l)e===`fields`||e===`encodings`||(e===`mark`&&(c.mark={...l.mark,...c.mark}),(c[e]===void 0||c[e]===!0)&&(c[e]=f2(l[e]??c[e])));let u=n[t]={...c,name:t,type:s,init:a.value,bind:a.bind,events:vg(c.on)?VG(c.on,`scope`):Qh(f2(c.on))};if(T0(u)&&(i++,i>1)){delete n[t];continue}let d=f2(a);for(let t of r6)t.defined(u)&&t.parse&&t.parse(e,u,d)}return i>1&&Z(Rze),n}function vFe(e,t,n,r=`datum`){let i=vg(t)?t:t.param,a=QZ(i),o=G(a+e6),s;try{s=e.getSelectionComponent(a,i)}catch{return`!!${a}`}if(s.project.timeUnit){let t=n??e.component.data.raw,r=s.project.timeUnit.clone();t.parent?r.insertAsParentOf(t):t.parent=r}let c=`${s.project.hasSelectionId?`vlSelectionIdTest(`:`vlSelectionTest(`}${o}, ${r}${s.resolve===`global`?`)`:`, ${G(s.resolve)})`}`,l=`length(data(${o}))`;return t.empty===!1?`${l} && ${c}`:`!${l} || ${c}`}function yFe(e,t,n){let r=QZ(t),i=n.encoding,a=n.field,o;try{o=e.getSelectionComponent(r,t)}catch{return r}if(!i&&!a)a=o.project.items[0].field,o.project.items.length>1&&Z(pAe(a));else if(i&&!a){let e=o.project.items.filter(e=>e.channel===i);!e.length||e.length>1?(a=o.project.items[0].field,Z(mAe(e,i,n,a))):a=e[0].field}return`${o.name}[${G(oQ(a))}]`}function bFe(e,t){for(let[n,r]of m2(e.component.selection??{})){let i=e.getName(`lookup_${n}`);e.component.data.outputNodes[i]=r.materialized=new E3(new i6(t,e,{param:n}),i,w3.Lookup,e.component.data.outputNodeRefCounts)}}function D0(e,t,n){return $Z(t,t=>vg(t)?t:Eje(t)?vFe(e,t,n):Aje(t))}function xFe(e,t){if(e)return W(e)&&!qQ(e)?e.map(e=>h1(e,t)).join(`, `):e}function O0(e,t,n,r){e.encode??={},e.encode[t]??={},e.encode[t].update??={},e.encode[t].update[n]=r}function k0(e,t,n,r={header:!1}){let{disable:i,orient:a,scale:o,labelExpr:s,title:c,zindex:l,...u}=e.combine();if(!i){for(let e in u){let n=e,r=SBe[n],i=u[n];if(r&&r!==t&&r!==`both`)delete u[n];else if(T1(i)){let{condition:e,...t}=i,r=Qh(e),a=t3[n];if(a){let{vgProp:e,part:i}=a;O0(u,i,e,[...r.map(e=>{let{test:t,...n}=e;return{test:D0(null,t),...n}}),t]),delete u[n]}else a===null&&(u[n]={signal:r.map(e=>{let{test:t,...n}=e;return`${D0(null,t)} ? ${qke(n)} : `}).join(``)+qke(t)})}else if(JQ(i)){let e=t3[n];if(e){let{vgProp:t,part:r}=e;O0(u,r,t,i),delete u[n]}}BZ([`labelAlign`,`labelBaseline`],n)&&u[n]===null&&delete u[n]}if(t===`grid`){if(!u.grid)return;if(u.encode){let{grid:e}=u.encode;u.encode={...e?{grid:e}:{}},YZ(u.encode)&&delete u.encode}return{scale:o,orient:a,...u,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:uQ(l,0)}}else{if(!r.header&&e.mainExtracted)return;if(s!==void 0){let e=s;u.encode?.labels?.update&&JQ(u.encode.labels.update.text)&&(e=sQ(s,`datum.label`,u.encode.labels.update.text.signal)),O0(u,`labels`,`text`,{signal:e})}if(u.labelAlign===null&&delete u.labelAlign,u.encode){for(let t of n3)e.hasAxisPart(t)||delete u.encode[t];YZ(u.encode)&&delete u.encode}let t=xFe(c,n);return{scale:o,orient:a,grid:!1,...t?{title:t}:{},...u,...n.aria===!1?{aria:!1}:{},zindex:uQ(l,0)}}}}function SFe(e){let{axes:t}=e.component,n=[];for(let r of c4)if(t[r]){for(let i of t[r])if(!i.get(`disable`)&&!i.get(`gridScale`)){let t=r===`x`?`height`:`width`,i=e.getSizeSignalRef(t).signal;t!==i&&n.push({name:t,update:i})}}return n}function CFe(e,t){let{x:n=[],y:r=[]}=e;return[...n.map(e=>k0(e,`grid`,t)),...r.map(e=>k0(e,`grid`,t)),...n.map(e=>k0(e,`main`,t)),...r.map(e=>k0(e,`main`,t))].filter(e=>e)}function wFe(e,t,n,r){return Object.assign.apply(null,[{},...e.map(e=>{if(e===`axisOrient`){let e=n===`x`?`bottom`:`left`,i=t[n===`x`?`axisBottom`:`axisLeft`]||{},a=t[n===`x`?`axisTop`:`axisRight`]||{},o=new Set([...$(i),...$(a)]),s={};for(let t of o.values())s[t]={signal:`${r.signal} === "${e}" ? ${$Q(i[t])} : ${$Q(a[t])}`};return s}return t[e]})])}function TFe(e,t,n,r){let i=t===`band`?[`axisDiscrete`,`axisBand`]:t===`point`?[`axisDiscrete`,`axisPoint`]:Ije(t)?[`axisQuantitative`]:t===`time`||t===`utc`?[`axisTemporal`]:[],a=e===`x`?`axisX`:`axisY`,o=JQ(n)?`axisOrient`:`axis${tQ(n)}`,s=[...i,...i.map(e=>a+e.substr(4))],c=[`axis`,o,a];return{vlOnlyAxisConfig:wFe(s,r,e,n),vgAxisConfig:wFe(c,r,e,n),axisConfigStyle:EFe([...c,...s],r)}}function EFe(e,t){let n=[{}];for(let r of e){let e=t[r]?.style;if(e){e=Qh(e);for(let r of e)n.push(t.style[r])}}return Object.assign.apply(null,n)}function A0(e,t,n,r={}){let i=Xke(e,n,t);if(i!==void 0)return{configFrom:`style`,configValue:i};for(let t of[`vlOnlyAxisConfig`,`vgAxisConfig`,`axisConfigStyle`])if(r[t]?.[e]!==void 0)return{configFrom:t,configValue:r[t][e]};return{}}function DFe(e,t){return!D$(e)&&Q(t)&&!VQ(t?.bin)&&!HQ(t?.bin)}function OFe(e,t){let n=t===`x`?`y`:`x`;if(e.getScaleComponent(n))return e.scaleName(n)}function kFe(e,t,n,r,i){let a=t?.labelAngle;if(a!==void 0)return JQ(a)?a:mQ(a);{let{configValue:a}=A0(`labelAngle`,r,t?.style,i);return a===void 0?n===b2&&BZ([O4,E4],e.type)&&!(Q(e)&&e.timeUnit)?270:void 0:mQ(a)}}function j0(e){return`(((${e.signal} % 360) + 360) % 360)`}function AFe(e,t,n,r){if(e!==void 0)if(n===`x`){if(JQ(e)){let n=j0(e);return{signal:`(45 < ${n} && ${n} < 135) || (225 < ${n} && ${n} < 315) ? "middle" :(${n} <= 45 || 315 <= ${n}) === ${JQ(t)?`(${t.signal} === "top")`:t===`top`} ? "bottom" : "top"`}}if(450;if(a||u){let s=t===`row`?`height`:`width`;return{name:e.getName(`${t}_${n}`),type:`group`,role:`${t}-${n}`,...r.facetFieldDef?{from:{data:e.getName(`${t}_domain`)},sort:WFe(o,t)}:{},...u&&c?{from:{data:e.getName(`facet_domain_${t}`)}}:{},...a?{title:a}:{},...i.sizeSignal?{encode:{update:{[s]:i.sizeSignal}}}:{},...u?{axes:l}:{}}}}return null}function KFe(e,t){return mVe[t][e]}function qFe(e,t){let n={};for(let r of i4){let i=e[r];if(i?.facetFieldDef){let{titleAnchor:e,titleOrient:a}=F0([`titleAnchor`,`titleOrient`],i.facetFieldDef.header,t,r),o=N0(r,a),s=KFe(e,o);s!==void 0&&(n[o]=s)}}return YZ(n)?void 0:n}function JFe(e,t,n,r,i){let a={};for(let o of r){if(!i[o])continue;let r=P0(o,t?.header,e,n);r!==void 0&&(a[i[o]]=r)}return a}function L0(e){return[...R0(e,`width`),...R0(e,`height`),...R0(e,`childWidth`),...R0(e,`childHeight`)]}function R0(e,t){let n=t===`width`?`x`:`y`,r=e.component.layoutSize.get(t);if(r==null||r===`merged`)return[];let i=e.getSizeSignalRef(t).signal;if(r===`step`){let t=e.getScaleComponent(n);if(t){let r=t.get(`type`),a=t.get(`range`);if(D$(r)&&YQ(a)){let r=e.scaleName(n);return t2(e.parent)&&e.parent.component.resolve.scale[n]===`independent`?[YFe(r,a)]:[YFe(r,a),{name:i,update:XFe(r,t,`domain('${r}').length`)}]}}throw Error(`layout size is step although width/height is not step.`)}else if(r==`container`){let t=i.endsWith(`width`),n=t?`containerSize()[0]`:`containerSize()[1]`,r=`isFinite(${n}) ? ${n} : ${H1(e.config.view,t?`width`:`height`)}`;return[{name:i,init:r,on:[{update:r,events:`window:resize`}]}]}else return[{name:i,value:r}]}function YFe(e,t){let n=`${e}_step`;return JQ(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function XFe(e,t,n){let r=t.get(`type`),i=t.get(`padding`),a=uQ(t.get(`paddingOuter`),i),o=t.get(`paddingInner`);return o=r===`band`?o===void 0?i:o:1,`bandspace(${n}, ${$Q(o)}, ${$Q(a)}) * ${e}_step`}function ZFe(e){return e===`childWidth`?`width`:e===`childHeight`?`height`:e}function QFe(e,t){return $(e).reduce((n,r)=>({...n,...d0({model:t,channelDef:e[r],vgChannel:r,mainRefFn:e=>QQ(e.value),invalidValueRef:void 0})}),{})}function $Fe(e,t){if(t2(t))return e===`theta`?`independent`:`shared`;if(r2(t))return`shared`;if(n2(t))return AQ(e)||e===`theta`||e===`radius`?`independent`:`shared`;throw Error(`invalid model type for resolve`)}function z0(e,t){let n=e.scale[t],r=AQ(t)?`axis`:`legend`;return n===`independent`?(e[r][t]===`shared`&&Z(KAe(t)),`independent`):e[r][t]||`shared`}function eIe(e,{fieldOrDatumDef:t,model:n,channel:r,legendCmpt:i,legendType:a}){if(a!==`symbol`)return;let{markDef:o,encoding:s,config:c,mark:l}=n,u=o.filled&&l!==`trail`,d={...Jke({},n,hBe),...JPe(n,{filled:u})},f=i.get(`symbolOpacity`)??c.legend.symbolOpacity,p=i.get(`symbolFillColor`)??c.legend.symbolFillColor,m=i.get(`symbolStrokeColor`)??c.legend.symbolStrokeColor,h=f===void 0?iIe(s.opacity)??o.opacity:void 0;if(d.fill){if(r===`fill`||u&&r===F2)delete d.fill;else if(X(d.fill,`field`))p?delete d.fill:(d.fill=QQ(c.legend.symbolBaseFillColor??`black`),d.fillOpacity=QQ(h??1));else if(W(d.fill)){let e=B0(s.fill??s.color)??o.fill??(u&&o.color);e&&(d.fill=QQ(e))}}if(d.stroke){if(r===`stroke`||!u&&r===F2)delete d.stroke;else if(X(d.stroke,`field`)||m)delete d.stroke;else if(W(d.stroke)){let e=uQ(B0(s.stroke||s.color),o.stroke,u?o.color:void 0);e&&(d.stroke={value:e})}}if(r!==V2){let e=Q(t)&&oIe(n,i,t);e?d.opacity=[{test:e,...QQ(h??1)},QQ(c.legend.unselectedOpacity)]:h&&(d.opacity=QQ(h))}return d={...d,...e},YZ(d)?void 0:d}function tIe(e,{model:t,legendType:n,legendCmpt:r}){if(n!==`gradient`)return;let{config:i,markDef:a,encoding:o}=t,s={},c=(r.get(`gradientOpacity`)??i.legend.gradientOpacity)===void 0?iIe(o.opacity)||a.opacity:void 0;return c&&(s.opacity=QQ(c)),s={...s,...e},YZ(s)?void 0:s}function nIe(e,{fieldOrDatumDef:t,model:n,channel:r,legendCmpt:i}){let a=n.legend(r)||{},o=n.config,s=Q(t)?oIe(n,i,t):void 0,c=s?[{test:s,value:1},{value:o.legend.unselectedOpacity}]:void 0,{format:l,formatType:u}=a,d;H$(u)?d=W$({fieldOrDatumDef:t,field:`datum.value`,format:l,formatType:u,config:o}):l===void 0&&u===void 0&&o.customFormatTypes&&(t.type===`quantitative`&&o.numberFormatType?d=W$({fieldOrDatumDef:t,field:`datum.value`,format:o.numberFormat,formatType:o.numberFormatType,config:o}):t.type===`temporal`&&o.timeFormatType&&Q(t)&&t.timeUnit===void 0&&(d=W$({fieldOrDatumDef:t,field:`datum.value`,format:o.timeFormat,formatType:o.timeFormatType,config:o})));let f={...c?{opacity:c}:{},...d?{text:d}:{},...e};return YZ(f)?void 0:f}function rIe(e,{legendCmpt:t}){return t.get(`selections`)?.length?{...e,fill:{value:`transparent`}}:e}function iIe(e){return aIe(e,(e,t)=>Math.max(e,t.value))}function B0(e){return aIe(e,(e,t)=>uQ(e,t.value))}function aIe(e,t){if(gMe(e))return Qh(e.condition).reduce(t,e.value);if(c1(e))return e.value}function oIe(e,t,n){let r=t.get(`selections`);if(!r?.length)return;let i=G(n.field);return r.map(e=>`(!length(data(${G(QZ(e)+e6)})) || (${e}[${i}] && indexof(${e}[${i}], datum.value) >= 0))`).join(` || `)}function sIe(e,t){let n=e.values;if(W(n))return NMe(t,n);if(JQ(n))return n}function cIe(e,t,n,r){if(t!==`shape`){let e=B0(n)??r;if(e)return e}switch(e){case`bar`:case`rect`:case`image`:case`square`:return`square`;case`line`:case`trail`:case`rule`:return`stroke`;case`arc`:case`point`:case`circle`:case`tick`:case`geoshape`:case`area`:case`text`:return`circle`}}function lIe(e){let{legend:t}=e;return uQ(t.type,uIe(e))}function uIe({channel:e,timeUnit:t,scaleType:n}){if(xQ(e)){if(BZ([`quarter`,`month`,`day`],t))return`symbol`;if(k$(n))return`gradient`}return`symbol`}function dIe({legendConfig:e,legendType:t,orient:n,legend:r}){return r.direction??e[t?`gradientDirection`:`symbolDirection`]??fIe(n,t)}function fIe(e,t){switch(e){case`top`:case`bottom`:return`horizontal`;case`left`:case`right`:case`none`:case void 0:return;default:return t===`gradient`?`horizontal`:void 0}}function pIe({legendConfig:e,model:t,direction:n,orient:r,scaleType:i}){let{gradientHorizontalMaxLength:a,gradientHorizontalMinLength:o,gradientVerticalMaxLength:s,gradientVerticalMinLength:c}=e;if(k$(i))return n===`horizontal`?r===`top`||r===`bottom`?mIe(t,`width`,o,a):o:mIe(t,`height`,c,s)}function mIe(e,t,n,r){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${r})`}}function hIe(e){if(BZ([`quantile`,`threshold`,`log`,`symlog`],e))return`greedy`}function gIe(e){let t=e2(e)?_Ie(e):xIe(e);return e.component.legends=t,t}function _Ie(e){let{encoding:t}=e,n={};for(let r of[F2,...p3]){let i=v1(t[r]);!i||!e.getScaleComponent(r)||r===R2&&Q(i)&&i.type===k4||(n[r]=bIe(e,r))}return n}function vIe(e,t){let n=e.scaleName(t);if(e.mark===`trail`){if(t===`color`)return{stroke:n};if(t===`size`)return{strokeWidth:n}}return t===`color`?e.markDef.filled?{fill:n}:{stroke:n}:{[t]:n}}function yIe(e,t,n,r){switch(t){case`disable`:return n!==void 0;case`values`:return!!n?.values;case`title`:if(t===`title`&&e===r?.title)return!0}return e===(n||{})[t]}function bIe(e,t){let n=e.legend(t),{markDef:r,encoding:i,config:a}=e,o=a.legend,s=new hVe({},vIe(e,t));uFe(e,t,s);let c=n===void 0?o.disable:!n;if(s.set(`disable`,c,n!==void 0),c)return s;n||={};let l=e.getScaleComponent(t).get(`type`),u=v1(i[t]),d=Q(u)?g$(u.timeUnit)?.unit:void 0,f=n.orient||a.legend.orient||`right`,p=lIe({legend:n,channel:t,timeUnit:d,scaleType:l}),m=dIe({legend:n,legendType:p,orient:f,legendConfig:o}),h={legend:n,channel:t,model:e,markDef:r,encoding:i,fieldOrDatumDef:u,legendConfig:o,config:a,scaleType:l,orient:f,legendType:p,direction:m};for(let r of l6){if(p===`gradient`&&r.startsWith(`symbol`)||p===`symbol`&&r.startsWith(`gradient`))continue;let i=r in d6?d6[r](h):n[r];if(i!==void 0){let o=yIe(i,r,n,e.fieldDef(t));(o||a.legend[r]===void 0)&&s.set(r,i,o)}}let g=n?.encoding??{},_=s.get(`selections`),v={},y={fieldOrDatumDef:u,model:e,channel:t,legendCmpt:s,legendType:p};for(let t of[`labels`,`legend`,`title`,`symbols`,`gradient`,`entries`]){let n=QFe(g[t]??{},e),r=t in u6?u6[t](n,y):n;r!==void 0&&!YZ(r)&&(v[t]={..._?.length&&Q(u)?{name:`${QZ(u.field)}_legend_${t}`}:{},..._?.length?{interactive:!0}:{},update:_?.length?{...r,cursor:{value:`pointer`}}:r})}return YZ(v)||s.set(`encode`,v,!!n?.encoding),s}function xIe(e){let{legends:t,resolve:n}=e.component;for(let r of e.children){gIe(r);for(let i of $(r.component.legends))n.legend[i]=z0(e.component.resolve,i),n.legend[i]===`shared`&&(t[i]=SIe(t[i],r.component.legends[i]),t[i]||(n.legend[i]=`independent`,delete t[i]))}for(let r of $(t))for(let t of e.children)t.component.legends[r]&&n.legend[r]===`shared`&&delete t.component.legends[r];return t}function SIe(e,t){if(!e)return t.clone();let n=e.getWithExplicit(`orient`),r=t.getWithExplicit(`orient`);if(n.explicit&&r.explicit&&n.value!==r.value)return;let i=!1;for(let n of l6){let r=t0(e.getWithExplicit(n),t.getWithExplicit(n),n,`legend`,(e,t)=>{switch(n){case`symbolType`:return CIe(e,t);case`title`:return eAe(e,t);case`type`:return i=!0,$1(`symbol`)}return e0(e,t,n,`legend`)});e.setWithExplicit(n,r)}return i&&(e.implicit?.encode?.gradient&&eQ(e.implicit,[`encode`,`gradient`]),e.explicit?.encode?.gradient&&eQ(e.explicit,[`encode`,`gradient`])),e}function CIe(e,t){return t.value===`circle`?t:e}function wIe(e,t,n,r){if(w1(t,n)){let i=e2(e)?e.axis(n)??e.legend(n)??{}:{},a=d1(t,{expr:`datum`}),o=d1(t,{expr:`datum`,binSuffix:`end`});return{formulaAs:d1(t,{binSuffix:`range`,forAs:!0}),formula:K$(a,o,i.format,i.formatType,r)}}return{}}function TIe(e,t){return`${BQ(e)}_${t}`}function EIe(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}function V0(e,t,n){let r=TIe(x1(n,void 0)??{},t);return e.getName(`${r}_bins`)}function DIe(e){return`as`in e}function OIe(e,t,n){let r,i;r=DIe(e)?vg(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[d1(e,{forAs:!0}),d1(e,{binSuffix:`end`,forAs:!0})];let a={...x1(t,void 0)},o=TIe(a,e.field),{signal:s,extentSignal:c}=EIe(n,o);if(WQ(a.extent)){let e=a.extent;i=yFe(n,e.param,e),delete a.extent}return{key:o,binComponent:{bin:a,field:e.field,as:[r],...s?{signal:s}:{},...c?{extentSignal:c}:{},...i?{span:i}:{}}}}function kIe(e,t,n,r){let i=e2(r)?r.encoding[EQ(t)]:void 0;if(s1(n)&&e2(r)&&mMe(n,i,r.markDef,r.config)){e.add(d1(n,{})),e.add(d1(n,{suffix:`end`}));let{mark:i,markDef:a,config:o}=r,s=Q$({fieldDef:n,markDef:a,config:o});N$(i)&&s!==.5&&AQ(t)&&(e.add(d1(n,{suffix:O3})),e.add(d1(n,{suffix:k3}))),n.bin&&w1(n,t)&&e.add(d1(n,{binSuffix:`range`}))}else if(bQ(t)){let n=yQ(t);e.add(r.getName(n))}else e.add(d1(n));return l1(n)&&Bje(n.scale?.range)&&e.add(n.scale.range.field),e}function AIe(e,t){for(let n of $(t)){let r=t[n];for(let t of $(r))n in e?e[n][t]=new Set([...e[n][t]??[],...r[t]]):e[n]={[t]:r[t]}}}function jIe(e){return e.startsWith(`'`)&&e.endsWith(`'`)||e.startsWith(`"`)&&e.endsWith(`"`)?e.slice(1,-1):e}function MIe(e,t){let n=nQ(e);return t===`number`?`toNumber(${n})`:t===`boolean`?`toBoolean(${n})`:t===`string`?`toString(${n})`:t===`date`?`toDate(${n})`:t===`flatten`?n:t.startsWith(`date:`)?`timeParse(${n},'${jIe(t.slice(5,t.length))}')`:t.startsWith(`utc:`)?`utcParse(${n},'${jIe(t.slice(4,t.length))}')`:(Z(hAe(t)),null)}function NIe(e){let t={};return NZ(e.filter,e=>{if(Oje(e)){let n=null;_$(e)?n=ZQ(e.equal):y$(e)?n=ZQ(e.lte):v$(e)?n=ZQ(e.lt):b$(e)?n=ZQ(e.gt):x$(e)?n=ZQ(e.gte):S$(e)?n=e.range[0]:C$(e)&&(n=(e.oneOf??e.in)[0]),n&&(u$(n)?t[e.field]=`date`:gg(n)?t[e.field]=`number`:vg(n)&&(t[e.field]=`string`)),e.timeUnit&&(t[e.field]=`date`)}}),t}function PIe(e){let t={};function n(e){S1(e)?t[e.field]=`date`:e.type===`quantitative`&&zke(e.aggregate)?t[e.field]=`number`:lQ(e.field)>1?e.field in t||(t[e.field]=`flatten`):l1(e)&&q$(e.sort)&&lQ(e.sort.field)>1&&(e.sort.field in t||(t[e.sort.field]=`flatten`))}if((e2(e)||t2(e))&&e.forEachFieldDef((t,r)=>{if(s1(t))n(t);else{let i=wQ(r),a=e.fieldDef(i);n({...t,type:a.type})}}),e2(e)){let{mark:n,markDef:r,encoding:i}=e;if(M$(n)&&!e.encoding.order){let e=i[r.orient===`horizontal`?`y`:`x`];Q(e)&&e.type===`quantitative`&&!(e.field in t)&&(t[e.field]=`number`)}}return t}function FIe(e){let t={};if(e2(e)&&e.component.selection)for(let n of $(e.component.selection)){let r=e.component.selection[n];for(let e of r.project.items)!e.channel&&lQ(e.field)>1&&(t[e.field]=`flatten`)}return t}function H0(e){return e instanceof y6||e instanceof _6||e instanceof v6}function U0(e){return`isValid(${e}) && isFinite(+${e})`}function IIe(e){return e.stack.stackBy.reduce((e,t)=>{let n=t.fieldDef,r=d1(n);return r&&e.push(r),e},[])}function LIe(e){return W(e)&&e.every(e=>vg(e))&&e.length>1}function RIe(e){function t(n){if(!(n instanceof m6)){let r=n.clone();if(r instanceof E3){let t=D6+r.getSource();r.setSource(t),e.model.component.data.outputNodes[t]=r}else(r instanceof p6||r instanceof T6||r instanceof E6||r instanceof C6)&&r.addDimensions(e.fields);for(let e of n.children.flatMap(t))e.parent=r;return[r]}return n.children.flatMap(t)}return t}function W0(e){if(e instanceof m6)if(e.numChildren()===1&&!(e.children[0]instanceof E3)){let t=e.children[0];(t instanceof p6||t instanceof T6||t instanceof E6||t instanceof C6)&&t.addDimensions(e.fields),t.swapWithParent(),W0(e)}else{let t=e.model.component.data.main;zIe(t);let n=RIe(e),r=e.children.map(n).flat();for(let e of r)e.parent=t}else e.children.map(W0)}function zIe(e){if(e instanceof E3&&e.type===w3.Main&&e.numChildren()===1){let t=e.children[0];t instanceof m6||(t.swapWithParent(),zIe(e))}}function G0(e){for(let t of e){for(let e of t.children)if(e.parent!==t)return!1;if(!G0(t.children))return!1}return!0}function K0(e,t){let n=!1;for(let r of t)n=e.optimize(r)||n;return n}function BIe(e,t,n){let r=e.sources,i=!1;return i=K0(new yVe,r)||i,i=K0(new _Ve(t),r)||i,r=r.filter(e=>e.numChildren()>0),i=K0(new SVe,r)||i,r=r.filter(e=>e.numChildren()>0),n||(i=K0(new bVe,r)||i,i=K0(new TVe(t),r)||i,i=K0(new vVe,r)||i,i=K0(new xVe,r)||i,i=K0(new wVe,r)||i,i=K0(new CVe,r)||i,i=K0(new gVe,r)||i,i=K0(new EVe,r)||i),e.sources=r,i}function VIe(e,t){G0(e.sources);let n=0,r=0;for(let r=0;r({signal:`{data: ${C1(e,{timeUnit:n,type:t})}}`}))}function q0(e,t,n){let r=g$(n)?.unit;return t===`temporal`||r?qIe(e,t,r):[e]}function J0(e,t,n,r){let{encoding:i,markDef:a,mark:o,config:s,stack:c}=n,l=v1(i[r]),{type:u}=l,d=l.timeUnit,f=DPe({invalid:t$(`invalid`,a,s),isPath:M$(o)});if(zje(t)){let i=J0(e,void 0,n,r);return Q1([...q0(t.unionWith,u,d),...i.value])}else if(JQ(t))return Q1([t]);else if(t&&t!==`unaggregated`&&!Rje(t))return Q1(q0(t,u,d));if(c&&r===c.fieldChannel){if(c.offset===`normalize`)return $1([[0,1]]);let e=n.requestDataName(f);return $1([{data:e,field:n.vgField(r,{suffix:`start`})},{data:e,field:n.vgField(r,{suffix:`end`})}])}let p=PQ(r)&&Q(l)?YIe(n,r,e):void 0;if(r1(l))return $1(q0([l.datum],u,d));let m=l;if(t===`unaggregated`){let{field:e}=l;return $1([{data:n.requestDataName(f),field:d1({field:e,aggregate:`min`})},{data:n.requestDataName(f),field:d1({field:e,aggregate:`max`})}])}else if(VQ(m.bin)){if(D$(e))return $1(e===`bin-ordinal`?[]:[{data:XZ(p)?n.requestDataName(f):n.requestDataName(w3.Raw),field:n.vgField(r,w1(m,r)?{binSuffix:`range`}:{}),sort:p===!0||!jh(p)?{field:n.vgField(r,{}),op:`min`}:p}]);{let{bin:e}=m;if(VQ(e)){let t=V0(n,m.field,e);return $1([new k6(()=>{let e=n.getSignalName(t);return`[${e}.start, ${e}.stop]`})])}else return $1([{data:n.requestDataName(f),field:n.vgField(r,{})}])}}else if(m.timeUnit&&BZ([`time`,`utc`],e)){let e=i[EQ(r)];if(mMe(m,e,a,s)){let t=n.requestDataName(f),i=Q$({fieldDef:m,fieldDef2:e,markDef:a,config:s}),c=N$(o)&&i!==.5&&AQ(r);return $1([{data:t,field:n.vgField(r,c?{suffix:O3}:{})},{data:t,field:n.vgField(r,{suffix:c?k3:`end`})}])}}return $1(p?[{data:XZ(p)?n.requestDataName(f):n.requestDataName(w3.Raw),field:n.vgField(r),sort:p}]:[{data:n.requestDataName(f),field:n.vgField(r)}])}function Y0(e,t){let{op:n,field:r,order:i}=e;return{op:n??(t?`sum`:Z4),...r?{field:oQ(r)}:{},...i?{order:i}:{}}}function JIe(e,t){let n=e.component.scales[t],r=e.specifiedScales[t].domain,i=e.fieldDef(t)?.bin,a=Rje(r)?r:void 0,o=UQ(i)&&WQ(i.extent)?i.extent:void 0;(a||o)&&n.set(`selectionExtent`,a??o,!0)}function YIe(e,t,n){if(!D$(n))return;let r=e.fieldDef(t),i=r.sort;if(lMe(i))return{op:`min`,field:M0(r,t),order:`ascending`};let{stack:a}=e,o=a?new Set([...a.groupbyFields,...a.stackBy.map(e=>e.fieldDef.field)]):void 0;if(q$(i))return Y0(i,a&&!o.has(i.field));if(cMe(i)){let{encoding:t,order:n}=i,r=e.fieldDef(t),{aggregate:s,field:c}=r,l=a&&!o.has(c);if(IQ(s)||LQ(s))return Y0({field:d1(r),order:n},l);if(RQ(s)||!s)return Y0({op:s,field:c,order:n},l)}else if(i===`descending`)return{op:`min`,field:e.vgField(t),order:`descending`};else if(BZ([`ascending`,void 0],i))return!0}function XIe(e,t){let{aggregate:n,type:r}=e;return n?vg(n)&&!Oze.has(n)?{valid:!1,reason:LAe(n)}:r===`quantitative`&&t===`log`?{valid:!1,reason:RAe(e)}:{valid:!0}:{valid:!1,reason:IAe(e)}}function X0(e,t,n,r){return e.explicit&&t.explicit&&Z(GAe(n,r,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function ZIe(e){let t=WZ(e.map(e=>{if(XQ(e)){let{sort:t,...n}=e;return n}return e}),RZ),n=WZ(e.map(e=>{if(XQ(e)){let t=e.sort;return t!==void 0&&!XZ(t)&&(`op`in t&&t.op===`count`&&delete t.field,t.order===`ascending`&&delete t.order),t}}).filter(e=>e!==void 0),RZ);if(t.length===0)return;if(t.length===1){let t=e[0];if(XQ(t)&&n.length>0){let e=n[0];if(n.length>1){Z(_4);let t=n.filter(e=>jh(e)&&`op`in e&&e.op!==`min`);e=n.every(e=>jh(e)&&`op`in e)&&t.length===1?t[0]:!0}else if(jh(e)&&`field`in e){let n=e.field;t.field===n&&(e=!e.order||{order:e.order})}return{...t,sort:e}}return t}let r=WZ(n.map(e=>XZ(e)||!(`op`in e)||vg(e.op)&&cg(Tze,e.op)?e:(Z(qAe(e)),!0)),RZ),i;r.length===1?i=r[0]:r.length>1&&(Z(_4),i=!0);let a=WZ(e.map(e=>XQ(e)?e.data:null),e=>e);return a.length===1&&a[0]!==null?{data:a[0],fields:t.map(e=>e.field),...i?{sort:i}:{}}:{fields:t,...i?{sort:i}:{}}}function Z0(e){if(XQ(e)&&vg(e.field))return e.field;if(Hke(e)){let t;for(let n of e.fields)if(XQ(n)&&vg(n.field)){if(!t)t=n.field;else if(t!==n.field)return Z(Wze),t}return Z(Gze),t}else if(Uke(e)){Z(Kze);let t=e.fields[0];return vg(t)?t:void 0}}function Q0(e,t){return ZIe(e.component.scales[t].get(`domains`).map(t=>(XQ(t)&&(t.data=e.lookupDataSource(t.data)),t)))}function QIe(e,t,n,r){e.encode??={},e.encode[t]??={},e.encode[t].update??={},e.encode[t].update[n]=r}function $Ie(e,t){if(e2(e)){let n=e.fieldDef(t);if(n?.field)return n.field}let n=(e.children??[]).map(e=>$Ie(e,t)).filter(e=>!!e);if(n.length>0){let e=WZ(n,RZ);return e.length===1?e[0]:void 0}}function eLe(e,t,n){if(t===n)return!0;let r=e.getScaleType(t),i=e.getScaleType(n);return!r||!i?!1:D$(r)===D$(i)}function tLe(e,t){return e?`field:${e}`:`channel:${String(t)}`}function nLe(e){if(W(e)){let t=e.filter(ZZ);return t.length>0?t:null}if(Hke(e)){let t=[];if(t.push(...e.fields.flatMap(e=>W(e)?e.filter(ZZ):[])),t.length>0)return WZ(t,RZ)}return null}function $0(e,t){try{return nLe(Q0(e,t))}catch{return null}}function rLe(e,t,n){let r=$0(e,t),i=$0(e,n);return r&&i?WZ([...r,...i],RZ):null}function iLe(e,t,n){t&&t.length>0&&(e.getWithExplicit(`values`)?.explicit||(n&&Z(n),e.set(`values`,t,!1)))}function aLe(e,t,n){let r=e.getScaleComponent(t),i=e.getScaleComponent(n);if(!r||!i)return!1;let a=r.getWithExplicit(`domains`),o=i.getWithExplicit(`domains`);if(!(a?.explicit&&o?.explicit))return!1;let s=Q0(e,t),c=Q0(e,n);return RZ(s)===RZ(c)}function oLe(e){let t=e.component.legends,n={};for(let r of $(t)){let i=tLe($Ie(e,r),r);if(!n[i]){n[i]=[{channel:r,cmpt:t[r].clone()}];continue}let a=!1;for(let o of n[i])if(eLe(e,o.channel,r)&&SIe(o.cmpt,t[r])){let t=e.getScaleType(o.channel),n=e.getScaleType(r);t&&n&&D$(t)&&D$(n)&&(aLe(e,o.channel,r)?iLe(o.cmpt,$0(e,o.channel)):iLe(o.cmpt,rLe(e,o.channel,r),JAe(o.channel,r))),a=!0;break}a||n[i].push({channel:r,cmpt:t[r].clone()})}return p2(n).flat().map(t=>sLe(t.cmpt,e.config)).filter(e=>e!==void 0)}function sLe(e,t){let{disable:n,labelExpr:r,selections:i,...a}=e.combine();if(!n){if(t.aria===!1&&a.aria==null&&(a.aria=!1),a.encode?.symbols){let e=a.encode.symbols.update;e.fill&&e.fill.value!==`transparent`&&!e.stroke&&!a.stroke&&(e.stroke={value:`transparent`});for(let t of p3)a[t]&&delete e[t]}if(a.title||delete a.title,r!==void 0){let e=r;a.encode?.labels?.update&&JQ(a.encode.labels.update.text)&&(e=sQ(r,`datum.label`,a.encode.labels.update.text.signal)),QIe(a,`labels`,`text`,{signal:e})}return a}}function cLe(e){return r2(e)||n2(e)?lLe(e):uLe(e)}function lLe(e){return e.children.reduce((e,t)=>e.concat(t.assembleProjections()),uLe(e))}function uLe(e){let t=e.component.projection;if(!t||t.merged)return[];let n=t.combine(),{name:r}=n;if(t.data){let i={signal:`[${t.size.map(e=>e.signal).join(`, `)}]`},a=t.data.reduce((t,n)=>{let r=JQ(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return BZ(t,r)||t.push(r),t},[]);if(a.length<=0)throw Error(`Projection's fit didn't find any data sources`);return[{name:r,size:i,fit:{signal:a.length>1?`[${a.join(`, `)}]`:a[0]},...n}]}else return[{name:r,translate:{signal:`[width / 2, height / 2]`},...n}]}function dLe(e){e.component.projection=e2(e)?fLe(e):hLe(e)}function fLe(e){if(e.hasProjection){let t=KQ(e.specifiedProjection),n=!(t&&(t.scale!=null||t.translate!=null)),r=n?[e.getSizeSignalRef(`width`),e.getSizeSignalRef(`height`)]:void 0,i=n?pLe(e):void 0,a=new A6(e.projectionName(!0),{...KQ(e.config.projection),...t},r,i);return a.get(`type`)||a.set(`type`,`equalEarth`,!1),a}}function pLe(e){let t=[],{encoding:n}=e;for(let r of[[j2,A2],[N2,M2]])(v1(n[r[0]])||v1(n[r[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});return e.channelHasField(R2)&&e.typedFieldDef(R2).type===k4&&t.push({signal:e.getName(`geojson_${t.length}`)}),t.length===0&&t.push(e.requestDataName(w3.Main)),t}function mLe(e,t){let n=HZ(DVe,n=>!!(!cg(e.explicit,n)&&!cg(t.explicit,n)||cg(e.explicit,n)&&cg(t.explicit,n)&&gQ(e.get(n),t.get(n))));if(gQ(e.size,t.size)){if(n)return e;if(gQ(e.explicit,{}))return t;if(gQ(t.explicit,{}))return e}return null}function hLe(e){if(e.children.length===0)return;let t;for(let t of e.children)dLe(t);let n=HZ(e.children,e=>{let n=e.component.projection;if(!n)return!0;if(t){let e=mLe(t,n);return e&&(t=e),!!e}else return t=n,!0});if(t&&n){let n=e.projectionName(!0),r=new A6(n,t.specifiedProjection,t.size,f2(t.data));for(let t of e.children){let e=t.component.projection;e&&(e.isFit&&r.data.push(...t.component.projection.data),t.renameProjection(e.get(`name`),n),e.merged=!0)}return r}}function gLe(e){return r2(e)||n2(e)?e.children.reduce((e,t)=>e.concat(gLe(t)),_Le(e)):_Le(e)}function _Le(e){return $(e.component.scales).reduce((t,n)=>{let r=e.component.scales[n];if(r.merged)return t;let i=r.combine(),{name:a,type:o,selectionExtent:s,domains:c,range:l,reverse:u,...d}=i,f=vLe(i.range,a,n,e),p=Q0(e,n),m=s?zPe(e,s,r,p):null;return t.push({name:a,type:o,...p?{domain:p}:{},...m?{domainRaw:m}:{},range:f,...u===void 0?{}:{reverse:u},...d}),t},[])}function vLe(e,t,n,r){if(AQ(n)){if(YQ(e))return{step:{signal:`${t}_step`}}}else if(jh(e)&&XQ(e))return{...e,data:r.lookupDataSource(e.data)};return e}function yLe(e){let t=e.component.scales;for(let n of p4){let r=t[n];if(!r)continue;let i=xLe(n,e);r.setWithExplicit(`range`,i)}}function bLe(e,t){let n=e.fieldDef(t);if(n?.bin){let{bin:r,field:i}=n,a=DQ(t),o=e.getName(a);if(jh(r)&&r.binned&&r.step!==void 0)return new k6(()=>{let n=e.scaleName(t),i=`(domain("${n}")[1] - domain("${n}")[0]) / ${r.step}`;return`${e.getSignalName(o)} / (${i})`});if(VQ(r)){let t=V0(e,i,r);return new k6(()=>{let n=e.getSignalName(t),r=`(${n}.stop - ${n}.start) / ${n}.step`;return`${e.getSignalName(o)} / (${r})`})}}}function xLe(e,t){let n=t.specifiedScales[e],{size:r}=t,i=t.getScaleComponent(e).get(`type`);for(let r of OVe)if(n[r]!==void 0){let a=j$(i,r),o=Vje(e,r);if(!a)Z(HAe(i,r,e));else if(o)Z(o);else switch(r){case`range`:{let r=n.range;if(W(r)){if(AQ(e))return Q1(r.map(e=>{if(e===`width`||e===`height`){let n=t.getName(e),r=t.getSignalName.bind(t);return k6.fromName(r,n)}return e}))}else if(jh(r))return Q1({data:t.requestDataName(w3.Main),field:r.field,sort:{op:`min`,field:t.vgField(e)}});return Q1(r)}case`scheme`:return Q1(SLe(n[r]))}}let a=e===b2||e===`xOffset`?`width`:`height`,o=r[a];if(V1(o)){if(AQ(e))if(D$(i)){let n=TLe(o,t,e);if(n)return Q1({step:n})}else Z(UAe(a));else if(MQ(e)){let n=e===w2?`x`:`y`;if(t.getScaleComponent(n).get(`type`)===`band`){let e=ELe(o,i);if(e)return Q1(e)}}}let{rangeMin:s,rangeMax:c}=n,l=wLe(e,t);return(s!==void 0||c!==void 0)&&j$(i,`rangeMin`)&&W(l)&&l.length===2?Q1([s??l[0],c??l[1]]):$1(l)}function SLe(e){return Lje(e)?{scheme:e.name,...LZ(e,[`name`])}:{scheme:e}}function CLe(e,t,n,{center:r}={}){let i=DQ(e),a=t.getName(i),o=t.getSignalName.bind(t);return e===x2&&O$(n)?r?[k6.fromName(e=>`${o(e)}/2`,a),k6.fromName(e=>`-${o(e)}/2`,a)]:[k6.fromName(o,a),0]:r?[k6.fromName(e=>`-${o(e)}/2`,a),k6.fromName(e=>`${o(e)}/2`,a)]:[0,k6.fromName(o,a)]}function wLe(e,t){let{size:n,config:r,mark:i,encoding:a}=t,{type:o}=v1(a[e]),s=t.getScaleComponent(e).get(`type`),{domain:c,domainMid:l}=t.specifiedScales[e];switch(e){case b2:case x2:if(BZ([`point`,`band`],s)){let i=OLe(e,n,r.view);if(V1(i))return{step:TLe(i,t,e)}}return CLe(e,t,s);case w2:case T2:return DLe(e,t,s);case z2:{let a=jLe(i,r),o=MLe(i,n,t,r);return A$(s)?ALe(a,o,kLe(s,r,c,e)):[a,o]}case O2:return[0,Math.PI*2];case B2:return[0,360];case E2:return[0,new k6(()=>`min(${t.getSignalName(t2(t.parent)?`child_width`:`width`)},${t.getSignalName(t2(t.parent)?`child_height`:`height`)})/2`)];case P2:return{step:1e3/r.scale.framesPerSecond};case W2:return[r.scale.minStrokeWidth,r.scale.maxStrokeWidth];case G2:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case R2:return`symbol`;case F2:case I2:case L2:return s===`ordinal`?o===`nominal`?`category`:`ordinal`:l===void 0?i===`rect`||i===`geoshape`?`heatmap`:`ramp`:`diverging`;case V2:case H2:case U2:return[r.scale.minOpacity,r.scale.maxOpacity]}}function TLe(e,t,n){let{encoding:r}=t,i=t.getScaleComponent(n),a=kQ(n),o=r[a];if(uNe({step:e,offsetIsDiscrete:o1(o)&&E$(o.type)})===`offset`&&FMe(r,a)){let n=t.getScaleComponent(a),r=`domain('${t.scaleName(a)}').length`;if(n.get(`type`)===`band`){let e=n.get(`paddingInner`)??n.get(`padding`)??0,t=n.get(`paddingOuter`)??n.get(`padding`)??0;r=`bandspace(${r}, ${e}, ${t})`}let o=i.get(`paddingInner`)??i.get(`padding`);return{signal:`${e.step} * ${r} / (1-${Kke(o)})`}}else return e.step}function ELe(e,t){if(uNe({step:e,offsetIsDiscrete:D$(t)})===`offset`)return{step:e.step}}function DLe(e,t,n){let r=e===w2?`x`:`y`,i=t.getScaleComponent(r);if(!i)return CLe(r,t,n,{center:!0});let a=i.get(`type`),o=t.scaleName(r),{markDef:s,config:c}=t;if(a===`band`){let e=OLe(r,t.size,t.config.view);if(V1(e)){let t=ELe(e,n);if(t)return t}return[0,{signal:`bandwidth('${o}')`}]}else{let n=t.encoding[r];if(Q(n)&&n.timeUnit){let e=Cje(n.timeUnit,e=>`scale('${o}', ${e})`),r=t.config.scale.bandWithNestedOffsetPaddingInner,i=Q$({fieldDef:n,markDef:s,config:c})-.5,a=i===0?``:` + ${i}`;if(r){let t=JQ(r)?`${r.signal}/2${a}`:`${r/2+i}`,n=JQ(r)?`(1 - ${r.signal}/2)${a}`:`${1-r/2+i}`;return[{signal:`${t} * (${e})`},{signal:`${n} * (${e})`}]}return[0,{signal:e}]}return FZ(`Cannot use ${e} scale if ${r} scale is not discrete.`)}}function OLe(e,t,n){let r=e===b2?`width`:`height`,i=t[r];return i===void 0?W1(n,r):i}function kLe(e,t,n,r){switch(e){case`quantile`:return t.scale.quantileCount;case`quantize`:return t.scale.quantizeCount;case`threshold`:return n!==void 0&&W(n)?n.length+1:(Z(aje(r)),3)}}function ALe(e,t,n){let r=()=>{let r=$Q(t),i=$Q(e),a=`(${r} - ${i}) / (${n} - 1)`;return`sequence(${i}, ${r} + ${a}, ${a})`};return JQ(t)?new k6(r):{signal:r()}}function jLe(e,t){switch(e){case`bar`:case`tick`:return t.scale.minBandSize;case`line`:case`trail`:case`rule`:return t.scale.minStrokeWidth;case`text`:return t.scale.minFontSize;case`point`:case`square`:case`circle`:return t.scale.minSize}throw Error(o$(`size`,e))}function MLe(e,t,n,r){let i={x:bLe(n,`x`),y:bLe(n,`y`)};switch(e){case`bar`:case`tick`:{if(r.scale.maxBandSize!==void 0)return r.scale.maxBandSize;let e=NLe(t,i,r.view);return gg(e)?e-1:new k6(()=>`${e.signal} - 1`)}case`line`:case`trail`:case`rule`:return r.scale.maxStrokeWidth;case`text`:return r.scale.maxFontSize;case`point`:case`square`:case`circle`:{if(r.scale.maxSize)return r.scale.maxSize;let e=NLe(t,i,r.view);return gg(e)?(M6*e)**2:new k6(()=>`pow(${M6} * ${e.signal}, 2)`)}}throw Error(o$(`size`,e))}function NLe(e,t,n){let r=V1(e.width)?e.width.step:U1(n,`width`),i=V1(e.height)?e.height.step:U1(n,`height`);return t.x||t.y?new k6(()=>`min(${[t.x?t.x.signal:r,t.y?t.y.signal:i].join(`, `)})`):Math.min(r,i)}function PLe(e,t){e2(e)?FLe(e,t):LLe(e,t)}function FLe(e,t){let n=e.component.scales,{config:r,encoding:i,markDef:a,specifiedScales:o}=e;for(let s of $(n)){let c=o[s],l=n[s],u=e.getScaleComponent(s),d=v1(i[s]),f=c[t],p=u.get(`type`),m=u.get(`padding`),h=u.get(`paddingInner`),g=j$(p,t),_=Vje(s,t);if(f!==void 0&&(g?_&&Z(_):Z(HAe(p,t,s))),g&&_===void 0)if(f!==void 0){let e=d.timeUnit,n=d.type;switch(t){case`domainMax`:case`domainMin`:u$(c[t])||n===`temporal`||e?l.set(t,{signal:C1(c[t],{type:n,timeUnit:e})},!0):l.set(t,c[t],!0);break;default:l.copyKeyFromObject(t,c)}}else{let n=X(N6,t)?N6[t]({model:e,channel:s,fieldOrDatumDef:d,scaleType:p,scalePadding:m,scalePaddingInner:h,domain:c.domain,domainMin:c.domainMin,domainMax:c.domainMax,markDef:a,config:r,hasNestedOffsetScale:IMe(i,s),hasSecondaryRangeChannel:!!i[EQ(s)]}):r.scale[t];n!==void 0&&l.set(t,n,!1)}}}function ILe(e){e2(e)?yLe(e):LLe(e,`range`)}function LLe(e,t){let n=e.component.scales;for(let n of e.children)t===`range`?ILe(n):PLe(n,t);for(let r of $(n)){let i;for(let n of e.children){let e=n.component.scales[r];if(e){let n=e.getWithExplicit(t);i=t0(i,n,t,`scale`,SPe((e,n)=>{switch(t){case`range`:return e.step&&n.step?e.step-n.step:0}return 0}))}}n[r].setWithExplicit(t,i)}}function RLe(e,t){let n=t.bin;if(VQ(n)){let r=V0(e,t.field,n);return new k6(()=>e.getSignalName(r))}else if(HQ(n)&&UQ(n)&&n.step!==void 0)return{step:n.step}}function zLe(e,t){if(BZ([F2,I2,L2],e)&&t!==`nominal`)return`hcl`}function BLe(e,t,n,r,i,a){if(!(_1(a)?.bin||W(n)||i!=null||r!=null||BZ([A4.TIME,A4.UTC],e)))return AQ(t)?!0:void 0}function VLe(e,t,n,r,i,a){if(AQ(e)){if(k$(t)){if(n.continuousPadding!==void 0)return n.continuousPadding;let{type:t,orient:o}=i;if(t===`bar`&&!(Q(r)&&(r.bin||r.timeUnit))&&(o===`vertical`&&e===`x`||o===`horizontal`&&e===`y`))return a.continuousBandSize}if(t===A4.POINT)return n.pointPadding}}function HLe(e,t,n,r,i,a=!1){if(e===void 0){if(AQ(t)){let{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:r,tickBandPaddingInner:o,bandWithNestedOffsetPaddingInner:s}=i;return a?s:uQ(e,n===`bar`?t:n===`tick`?o:r)}else if(MQ(t)&&r===A4.BAND)return i.offsetBandPaddingInner}}function ULe(e,t,n,r,i,a=!1){if(e===void 0){if(AQ(t)){let{bandPaddingOuter:e,bandWithNestedOffsetPaddingOuter:t}=i;if(a)return t;if(n===A4.BAND)return uQ(e,JQ(r)?{signal:`${r.signal}/2`}:r/2)}else if(MQ(t)){if(n===A4.POINT)return .5;if(n===A4.BAND)return i.offsetBandPaddingOuter}}}function WLe(e,t,n,r){if(n===`x`&&r.xReverse!==void 0)return O$(e)&&t===`descending`?JQ(r.xReverse)?{signal:`!${r.xReverse.signal}`}:!r.xReverse:r.xReverse;if(O$(e)&&t===`descending`)return!0}function GLe(e,t,n,r,i,a,o){if(n&&n!==`unaggregated`&&O$(i)){if(W(n)){let e=n[0],t=n[n.length-1];if(gg(e)&&e<=0&&gg(t)&&t>=0)return!0}return!1}if(e===`size`&&t.type===`quantitative`&&!A$(i))return!0;if(!(Q(t)&&t.bin)&&BZ([...c4,...dze],e)){let{orient:t,type:n}=r;return BZ([`bar`,`area`,`line`,`trail`],n)&&(t===`horizontal`&&e===`y`||t===`vertical`&&e===`x`)?!1:BZ([`bar`,`area`],n)&&!o?!0:a?.zero}return!1}function KLe(e,t,n,r,i=!1){let a=qLe(t,n,r,i),{type:o}=e;return PQ(t)?o===void 0?a:Uje(t,o)?Q(n)&&!Hje(o,n.type)?(Z(VAe(o,a)),a):o:(Z(BAe(t,o,a)),a):null}function qLe(e,t,n,r){switch(t.type){case`nominal`:case`ordinal`:{if(xQ(e)||FQ(e)===`discrete`)return e===`shape`&&t.type===`ordinal`&&Z(s$(e,`ordinal`)),`ordinal`;if(NQ(e))return`band`;if(AQ(e)||MQ(e)){if(BZ([`rect`,`bar`,`image`,`rule`,`tick`],n.type)||r)return`band`}else if(n.type===`arc`&&e in l4)return`band`;let i=n[DQ(e)];return F$(i)||u1(t)&&t.axis?.tickBand?`band`:`point`}case`temporal`:return xQ(e)?`time`:FQ(e)===`discrete`?(Z(s$(e,`temporal`)),`ordinal`):Q(t)&&t.timeUnit&&g$(t.timeUnit).utc?`utc`:NQ(e)?`band`:`time`;case`quantitative`:return xQ(e)?Q(t)&&VQ(t.bin)?`bin-ordinal`:`linear`:FQ(e)===`discrete`?(Z(s$(e,`quantitative`)),`ordinal`):NQ(e)?`band`:`linear`;case`geojson`:return}throw Error(SAe(t.type))}function JLe(e,{ignoreRange:t}={}){YLe(e),HIe(e);for(let t of cBe)PLe(e,t);t||ILe(e)}function YLe(e){e2(e)?e.component.scales=XLe(e):e.component.scales=ZLe(e)}function XLe(e){let{encoding:t,mark:n,markDef:r}=e,i={};for(let a of p4){let o=v1(t[a]);if(o&&n===K4&&a===R2&&o.type===k4)continue;let s=o&&o.scale;if(o&&s!==null&&s!==!1){s??={};let n=IMe(t,a),c=KLe(s,a,o,r,n);i[a]=new j6(e.scaleName(`${a}`,!0),{value:c,explicit:s.type===c})}}return i}function ZLe(e){let t=e.component.scales={},n={},r=e.component.resolve;for(let t of e.children){YLe(t);for(let i of $(t.component.scales))if(r.scale[i]??=$Fe(i,e),r.scale[i]===`shared`){let e=n[i],a=t.component.scales[i].getWithExplicit(`type`);e?Pje(e.value,a.value)?n[i]=t0(e,a,`type`,`scale`,kVe):(r.scale[i]=`independent`,delete n[i]):n[i]=a}}for(let r of $(n)){let i=e.scaleName(r,!0),a=n[r];t[r]=new j6(i,a);for(let t of e.children){let e=t.component.scales[r];e&&(t.renameScale(e.get(`name`),i),e.merged=!0)}}return t}function e2(e){return e?.type===`unit`}function t2(e){return e?.type===`facet`}function n2(e){return e?.type===`concat`}function r2(e){return e?.type===`layer`}function QLe(e){let t=0;function n(r,i){if(r instanceof y6&&!r.isGenerator&&!n0(r.data)&&(e.push(i),i={name:null,source:i.name,transform:[]}),r instanceof h6&&(r.parent instanceof y6&&!i.source?(i.format={...i.format,parse:r.assembleFormatParse()},i.transform.push(...r.assembleTransforms(!0))):i.transform.push(...r.assembleTransforms())),r instanceof m6){i.name||=`data_${t++}`,!i.source||i.transform.length>0?(e.push(i),r.data=i.name):r.data=i.source,e.push(...r.assemble());return}switch((r instanceof _6||r instanceof v6||r instanceof w6||r instanceof i6||r instanceof o6||r instanceof H6||r instanceof p6||r instanceof G6||r instanceof E6||r instanceof C6||r instanceof B6||r instanceof z6||r instanceof L6||r instanceof W6||r instanceof K6||r instanceof q6||r instanceof g6||r instanceof Y6||r instanceof J6||r instanceof R6)&&i.transform.push(r.assemble()),(r instanceof f6||r instanceof D3||r instanceof U6||r instanceof T6||r instanceof V6)&&i.transform.push(...r.assemble()),r instanceof E3&&(i.source&&i.transform.length===0?r.setSource(i.source):r.parent instanceof E3?r.setSource(i.name):(i.name||=`data_${t++}`,r.setSource(i.name),r.numChildren()===1&&(e.push(i),i={name:null,source:i.name,transform:[]}))),r.numChildren()){case 0:r instanceof E3&&(!i.source||i.transform.length>0)&&e.push(i);break;case 1:n(r.children[0],i);break;default:{i.name||=`data_${t++}`;let a=i.name;!i.source||i.transform.length>0?e.push(i):a=i.source;for(let e of r.children)n(e,{name:null,source:a,transform:[]});break}}}return n}function $Le(e){let t=[],n=QLe(t);for(let t of e.children)n(t,{source:e.name,name:null,transform:[]});return t}function eRe(e,t){let n=[],r=QLe(n),i=0;for(let t of e.sources)t.hasName()||(t.dataName=`source_${i++}`),r(t,t.assemble());for(let e of n)e.transform.length===0&&delete e.transform;let a=0;for(let[e,t]of n.entries())(t.transform??[]).length===0&&!t.source&&n.splice(a++,0,n.splice(e,1)[0]);for(let t of n)for(let n of t.transform??[])n.type===`lookup`&&(n.from=e.outputNodes[n.from].getSource());for(let e of n)e.name in t&&(e.values=t[e.name]);return n}function tRe(e){return e===`top`||e===`left`||JQ(e)?`header`:`footer`}function nRe(e){for(let t of i4)rRe(e,t);aRe(e,`x`),aRe(e,`y`)}function rRe(e,t){let{facet:n,config:r,child:i,component:a}=e;if(e.channelHasField(t)){let o=n[t],s=P0(`title`,null,r,t),c=p1(o,r,{allowDisabling:!0,includeDefault:s===void 0||!!s});i.component.layoutHeaders[t].title&&(c=W(c)?c.join(`, `):c,c+=` / ${i.component.layoutHeaders[t].title}`,i.component.layoutHeaders[t].title=null);let l=P0(`labelOrient`,o.header,r,t),u=o.header!==null&&uQ(o.header?.labels,r.header.labels,!0),d=BZ([`bottom`,`right`],l)?`footer`:`header`;a.layoutHeaders[t]={title:o.header===null?null:c,facetFieldDef:o,[d]:t===`facet`?[]:[iRe(e,t,u)]}}}function iRe(e,t,n){let r=t===`row`?`height`:`width`;return{labels:n,sizeSignal:e.child.component.layoutSize.get(r)?e.child.getSizeSignalRef(r):void 0,axes:[]}}function aRe(e,t){let{child:n}=e;if(n.component.axes[t]){let{layoutHeaders:r,resolve:i}=e.component;if(i.axis[t]=z0(i,t),i.axis[t]===`shared`){let i=t===`x`?`column`:`row`,a=r[i];for(let r of n.component.axes[t]){let t=tRe(r.get(`orient`));a[t]??=[iRe(e,i,!1)];let n=k0(r,`main`,e.config,{header:!0});n&&a[t][0].axes.push(n),r.mainExtracted=!0}}}}function oRe(e){i2(e),a2(e,`width`),a2(e,`height`)}function sRe(e){i2(e);let t=e.layout.columns===1?`width`:`childWidth`,n=e.layout.columns===void 0?`height`:`childHeight`;a2(e,t),a2(e,n)}function i2(e){for(let t of e.children)t.parseLayoutSize()}function a2(e,t){let n=ZFe(t),r=jQ(n),i=e.component.resolve,a=e.component.layoutSize,o;for(let t of e.children){let a=t.component.layoutSize.getWithExplicit(n),s=i.scale[r]??$Fe(r,e);if(s===`independent`&&a.value===`step`){o=void 0;break}if(o){if(s===`independent`&&o.value!==a.value){o=void 0;break}o=t0(o,a,n,``)}else o=a}if(o){for(let r of e.children)e.renameSignal(r.getName(n),e.getName(t)),r.component.layoutSize.set(n,`merged`,!1);a.setWithExplicit(t,o)}else a.setWithExplicit(t,{explicit:!1,value:void 0})}function cRe(e){let{size:t,component:n}=e;for(let r of c4){let i=DQ(r);if(t[i]!=null&&t[i]!=null){let e=t[i];n.layoutSize.set(i,V1(e)?`step`:e,!0)}else{let t=lRe(e,i);n.layoutSize.set(i,t,!1)}}}function lRe(e,t){let n=t===`width`?`x`:`y`,r=e.config,i=e.getScaleComponent(n);if(i){let e=i.get(`type`),n=i.get(`range`);if(D$(e)){let e=W1(r.view,t);return YQ(n)||V1(e)?`step`:e}else return H1(r.view,t)}else if(e.hasProjection||e.mark===`arc`)return H1(r.view,t);else{let e=W1(r.view,t);return V1(e)?e.step:e}}function o2(e,t,n){return d1(t,{suffix:`by_${d1(e)}`,...n})}function uRe(e,t){let{row:n,column:r}=t;if(n&&r){let t=null;for(let i of[n,r])if(q$(i.sort)){let{field:n,op:r=Z4}=i.sort;e=t=new C6(e,{joinaggregate:[{op:r,field:n,as:o2(i,i.sort,{forAs:!0})}],groupby:[d1(i)]})}return t}return null}function dRe(e,t){for(let n of t){let t=n.data;if(e.name&&n.hasName()&&e.name!==n.dataName)continue;let r=e.format?.mesh,i=t.format?.feature;if(r&&i)continue;let a=e.format?.feature;if((a||i)&&a!==i)continue;let o=t.format?.mesh;if(!((r||o)&&r!==o)){if(r0(e)&&r0(t)){if(gQ(e.values,t.values))return n}else if(n0(e)&&n0(t)){if(e.url===t.url)return n}else if(CPe(e)&&e.name===n.dataName)return n}}return null}function fRe(e,t){if(e.data||!e.parent){if(e.data===null){let e=new y6({values:[]});return t.push(e),e}let n=dRe(e.data,t);if(n)return i0(e.data)||(n.data.format=UZ({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{let n=new y6(e.data);return t.push(n),n}}else return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}function pRe(e,t,n){let r=0;for(let i of t.transforms){let a,o;if(nPe(i))o=e=new o6(e,i),a=`derived`;else if(X1(i)){let r=NIe(i);o=e=h6.makeWithAncestors(e,{},r,n)??e,e=new i6(e,t,i.filter)}else if(rPe(i))o=e=f6.makeFromTransform(e,i,t),a=`number`;else if(aPe(i))a=`date`,n.getWithExplicit(i.field).value===void 0&&(e=new h6(e,{[i.field]:a}),n.set(i.field,a,!1)),o=e=D3.makeFromTransform(e,i);else if(oPe(i))o=e=p6.makeFromTransform(e,i),a=`number`,w0(t)&&(e=new g6(e));else if(WNe(i))o=e=G6.make(e,t,i,r++),a=`derived`;else if($Ne(i))o=e=new E6(e,i),a=`number`;else if(ePe(i))o=e=new C6(e,i),a=`number`;else if(sPe(i))o=e=T6.makeFromTransform(e,i),a=`derived`;else if(cPe(i))o=e=new B6(e,i),a=`derived`;else if(lPe(i))o=e=new R6(e,i),a=`derived`;else if(tPe(i))o=e=new z6(e,i),a=`derived`;else if(qNe(i))o=e=new J6(e,i),a=`derived`;else if(QNe(i))e=new Y6(e,i);else if(iPe(i))o=e=U6.makeFromTransform(e,i),a=`derived`;else if(JNe(i))o=e=new L6(e,i),a=`derived`;else if(YNe(i))o=e=new K6(e,i),a=`derived`;else if(XNe(i))o=e=new q6(e,i),a=`derived`;else if(ZNe(i))o=e=new W6(e,i),a=`derived`;else{Z(_Ae(i));continue}if(o&&a!==void 0)for(let e of o.producedFields()??[])n.set(e,a,!1)}return e}function s2(e){let t=fRe(e,e.component.data.sources),{outputNodes:n,outputNodeRefCounts:r}=e.component.data,i=e.data,a=!(i&&(i0(i)||n0(i)||r0(i)))&&e.parent?e.parent.component.data.ancestorParse.clone():new $Be;i0(i)?(wPe(i)?t=new v6(t,i.sequence):a0(i)&&(t=new _6(t,i.graticule)),a.parseNothing=!0):i?.format?.parse===null&&(a.parseNothing=!0),t=h6.makeExplicit(t,e,a)??t,t=new g6(t);let o=e.parent&&r2(e.parent);(e2(e)||t2(e))&&o&&(t=f6.makeFromEncoding(t,e)??t),e.transforms.length>0&&(t=pRe(t,e,a));let s=FIe(e),c=PIe(e);t=h6.makeWithAncestors(t,{},{...s,...c},a)??t,e2(e)&&(t=V6.parseAll(t,e),t=H6.parseAll(t,e)),(e2(e)||t2(e))&&(o||(t=f6.makeFromEncoding(t,e)??t),t=D3.makeFromEncoding(t,e)??t,t=o6.parseAllForSortIndex(t,e));let l=t=c2(w3.Raw,e,t);if(e2(e)){let n=p6.makeFromEncoding(t,e);n&&(t=n,w0(e)&&(t=new g6(t))),t=U6.makeFromEncoding(t,e)??t,t=T6.makeFromEncoding(t,e)??t}let u,d;if(e2(e)){let{markDef:n,mark:r,config:i}=e,{marks:a,scales:o}=d=EPe({invalid:e$(`invalid`,n,i),isPath:M$(r)});a!==o&&o===`include-invalid-values`&&(u=t=c2(w3.PreFilterInvalid,e,t)),a===`exclude-invalid-values`&&(t=w6.make(t,e,d)??t)}let f=t=c2(w3.Main,e,t),p;if(e2(e)&&d){let{marks:n,scales:r}=d;n===`include-invalid-values`&&r===`exclude-invalid-values`&&(t=w6.make(t,e,d)??t,p=t=c2(w3.PostFilterInvalid,e,t))}e2(e)&&bFe(e,f);let m=null;if(t2(e)){let r=e.getName(`facet`);t=uRe(t,e.facet)??t,m=new m6(t,e,r,f.getSource()),n[r]=m}return{...e.component.data,outputNodes:n,outputNodeRefCounts:r,raw:l,main:f,facetRoot:m,ancestorParse:a,preFilterInvalid:u,postFilterInvalid:p}}function c2(e,t,n){let{outputNodes:r,outputNodeRefCounts:i}=t.component.data,a=t.getDataName(e),o=new E3(n,a,e,i);return r[a]=o,o}function mRe(e){return e===!1||e===null}function hRe(e,t,n){let{encoding:r,config:i}=e,a=v1(r[t])??v1(r[EQ(t)]),{format:o,formatType:s}=e.axis(t)||{};if(H$(s))return{text:W$({fieldOrDatumDef:a,field:`datum.value`,format:o,formatType:s,config:i}),...n};if(o===void 0&&s===void 0&&i.customFormatTypes){if(n1(a)===`quantitative`){if(u1(a)&&a.stack===`normalize`&&i.normalizedNumberFormatType)return{text:W$({fieldOrDatumDef:a,field:`datum.value`,format:i.normalizedNumberFormat,formatType:i.normalizedNumberFormatType,config:i}),...n};if(i.numberFormatType)return{text:W$({fieldOrDatumDef:a,field:`datum.value`,format:i.numberFormat,formatType:i.numberFormatType,config:i}),...n}}if(n1(a)===`temporal`&&i.timeFormatType&&Q(a)&&!a.timeUnit)return{text:W$({fieldOrDatumDef:a,field:`datum.value`,format:i.timeFormat,formatType:i.timeFormatType,config:i}),...n}}return n}function gRe(e){return c4.reduce((t,n)=>(e.component.scales[n]&&(t[n]=[xRe(n,e)]),t),{})}function _Re(e){let{axes:t,resolve:n}=e.component,r={top:0,bottom:0,right:0,left:0};for(let r of e.children){r.parseAxesAndHeaders();for(let i of $(r.component.axes))n.axis[i]=z0(e.component.resolve,i),n.axis[i]===`shared`&&(t[i]=vRe(t[i],r.component.axes[i]),t[i]||(n.axis[i]=`independent`,delete t[i]))}for(let i of c4){for(let a of e.children)if(a.component.axes[i]){if(n.axis[i]===`independent`){t[i]=(t[i]??[]).concat(a.component.axes[i]);for(let e of a.component.axes[i]){let{value:t,explicit:n}=e.getWithExplicit(`orient`);if(!JQ(t)){if(r[t]>0&&!n){let n=NVe[t];r[t]>r[n]&&e.set(`orient`,n,!1)}r[t]++}}}delete a.component.axes[i]}if(n.axis[i]===`independent`&&t[i]&&t[i].length>1)for(let[e,n]of(t[i]||[]).entries())e>0&&n.get(`grid`)&&!n.explicit.grid&&(n.implicit.grid=!1)}}function vRe(e,t){if(e){if(e.length!==t.length)return;let n=e.length;for(let r=0;re.clone());return e}function yRe(e,t){for(let n of X6){let r=t0(e.getWithExplicit(n),t.getWithExplicit(n),n,`axis`,(e,t)=>{switch(n){case`title`:return eAe(e,t);case`gridScale`:return{explicit:e.explicit,value:uQ(e.value,t.value)}}return e0(e,t,n,`axis`)});e.setWithExplicit(n,r)}return e}function bRe(e,t,n,r,i){if(t===`disable`)return n!==void 0;switch(n||={},t){case`titleAngle`:case`labelAngle`:return e===(JQ(n.labelAngle)?n.labelAngle:mQ(n.labelAngle));case`values`:return!!n.values;case`encode`:return!!n.encoding||!!n.labelAngle;case`title`:if(e===LFe(r,i))return!0}return e===n[t]}function xRe(e,t){let n=t.axis(e),r=new MVe,i=v1(t.encoding[e]),{mark:a,config:o}=t,s=n?.orient||o[e===`x`?`axisX`:`axisY`]?.orient||o.axis?.orient||PFe(e),c=t.getScaleComponent(e).get(`type`),l=TFe(e,c,s,t.config),u=n===void 0?A0(`disable`,o.style,n?.style,l).configValue:!n;if(r.set(`disable`,u,n!==void 0),u)return r;n||={};let d=kFe(i,n,e,o.style,l),f=nMe(n.formatType,i,c),p=tMe(i,i.type,n.format,n.formatType,o,!0),m={fieldOrDatumDef:i,axis:n,channel:e,model:t,scaleType:c,orient:s,labelAngle:d,format:p,formatType:f,mark:a,config:o};for(let i of X6){let a=i in a6?a6[i](m):PMe(i)?n[i]:void 0,s=a!==void 0,c=bRe(a,i,n,t,e);if(s&&c)r.set(i,a,c);else{let{configValue:e=void 0,configFrom:t=void 0}=PMe(i)&&i!==`values`?A0(i,o.style,n.style,l):{},u=e!==void 0;s&&!u?r.set(i,a,c):(t!==`vgAxisConfig`||PVe.has(i)&&u||T1(e)||JQ(e))&&r.set(i,e,!1)}}let h=n.encoding??{},g=n3.reduce((n,i)=>{if(!r.hasAxisPart(i))return n;let a=QFe(h[i]??{},t),o=i===`labels`?hRe(t,e,a):a;return o!==void 0&&!YZ(o)&&(n[i]={update:o}),n},{});return YZ(g)||r.set(`encode`,g,!!n.encoding||n.labelAngle!==void 0),r}function SRe({encoding:e,size:t}){for(let n of c4){let r=DQ(n);V1(t[r])&&i1(e[n])&&(delete t[r],Z(UAe(r)))}return t}function l2(e,t){let{config:n}=e;return{...x0(e,{align:`ignore`,baseline:`ignore`,color:`include`,size:`include`,orient:`ignore`,theta:`ignore`}),...g0(`x`,e,{defaultPos:`mid`}),...g0(`y`,e,{defaultPos:`mid`}),...m0(`size`,e),...m0(`angle`,e),...CRe(e,n,t)}}function CRe(e,t,n){return n?{shape:{value:n}}:m0(`shape`,e)}function wRe(e,t,n){if(e$(`align`,e,n)===void 0)return`center`}function TRe(e,t,n){if(e$(`baseline`,e,n)===void 0)return`middle`}function ERe(e){if(BZ([z4,L4,dBe],e.mark)){let t=UMe(e.mark,e.encoding);if(t.length>0)return DRe(e,t)}else if(e.mark===R4){let t=h4.some(t=>e$(t,e.markDef,e.config));if(e.stack&&!e.fieldDef(`size`)&&t)return ORe(e)}return u2(e)}function DRe(e,t){return[{name:e.getName(`pathgroup`),type:`group`,from:{facet:{name:$6+e.requestDataName(w3.Main),data:e.requestDataName(w3.Main),groupby:t}},encode:{update:{width:{field:{group:`width`}},height:{field:{group:`height`}}}},marks:u2(e,{fromPrefix:$6})}]}function ORe(e){let[t]=u2(e,{fromPrefix:e8}),n=e.scaleName(e.stack.fieldChannel),r=(t={})=>e.vgField(e.stack.fieldChannel,t),i=(e,t)=>`${e}(${[r({prefix:`min`,suffix:`start`,expr:t}),r({prefix:`max`,suffix:`start`,expr:t}),r({prefix:`min`,suffix:`end`,expr:t}),r({prefix:`max`,suffix:`end`,expr:t})].map(e=>`scale('${n}',${e})`).join(`,`)})`,a,o;e.stack.fieldChannel===`x`?(a={...IZ(t.encode.update,[`y`,`yc`,`y2`,`height`,...h4]),x:{signal:i(`min`,`datum`)},x2:{signal:i(`max`,`datum`)},clip:{value:!0}},o={x:{field:{group:`x`},mult:-1},height:{field:{group:`height`}}},t.encode.update={...LZ(t.encode.update,[`y`,`yc`,`y2`]),height:{field:{group:`height`}}}):(a={...IZ(t.encode.update,[`x`,`xc`,`x2`,`width`]),y:{signal:i(`min`,`datum`)},y2:{signal:i(`max`,`datum`)},clip:{value:!0}},o={y:{field:{group:`y`},mult:-1},width:{field:{group:`width`}}},t.encode.update={...LZ(t.encode.update,[`x`,`xc`,`x2`]),width:{field:{group:`width`}}});for(let n of h4){let r=t$(n,e.markDef,e.config);t.encode.update[n]?(a[n]=t.encode.update[n],delete t.encode.update[n]):r&&(a[n]=QQ(r)),r&&(t.encode.update[n]={value:0})}let s=[];if(e.stack.groupbyChannels?.length>0)for(let t of e.stack.groupbyChannels){let n=e.fieldDef(t),r=d1(n);r&&s.push(r),(n?.bin||n?.timeUnit)&&s.push(d1(n,{binSuffix:`end`}))}return a=[`stroke`,`strokeWidth`,`strokeJoin`,`strokeCap`,`strokeDash`,`strokeDashOffset`,`strokeMiterLimit`,`strokeOpacity`].reduce((n,r)=>{if(t.encode.update[r])return{...n,[r]:t.encode.update[r]};{let t=t$(r,e.markDef,e.config);return t===void 0?n:{...n,[r]:QQ(t)}}},a),a.stroke&&(a.strokeForeground={value:!0},a.strokeOffset={value:0}),[{type:`group`,from:{facet:{data:e.requestDataName(w3.Main),name:e8+e.requestDataName(w3.Main),groupby:s,aggregate:{fields:[r({suffix:`start`}),r({suffix:`start`}),r({suffix:`end`}),r({suffix:`end`})],ops:[`min`,`max`,`min`,`max`]}}},encode:{update:a},marks:[{type:`group`,encode:{update:o},marks:[t]}]}]}function kRe(e){let{encoding:t,stack:n,mark:r,markDef:i,config:a}=e,o=t.order;if(!(!W(o)&&c1(o)&&zZ(o.value)||!o&&zZ(e$(`order`,i,a)))){if((W(o)||Q(o))&&!n)return Zke(o,{expr:`datum`});if(M$(r)){let e=i.orient===`horizontal`?`y`:`x`,n=t[e];if(Q(n))return{field:e}}}}function u2(e,t={fromPrefix:``}){let{mark:n,markDef:r,encoding:i,config:a}=e,o=uQ(r.clip,ARe(e),jRe(e)),s=Yke(r),c=i.key,l=kRe(e),u=MRe(e);u&&Object.values(e.component.selection).some(e=>e.type===`point`&&!e.bind&&e.on!==`pointerover`)&&(e.markDef.cursor??=`pointer`);let d=e$(`aria`,r,a),f=Q6[n].postEncodingTransform?Q6[n].postEncodingTransform(e):null;return[{name:e.getName(`marks`),type:Q6[n].vgMark,...o?{clip:o}:{},...s?{style:s}:{},...c?{key:c.field}:{},...l?{sort:l}:{},...u||{},...d===!1?{aria:d}:{},from:{data:t.fromPrefix+e.requestDataName(w3.Main)},encode:{update:Q6[n].encodeEntry(e)},...f?{transform:f}:{}}]}function ARe(e){let t=e.getScaleComponent(`x`),n=e.getScaleComponent(`y`);return t?.get(`selectionExtent`)||n?.get(`selectionExtent`)?!0:void 0}function jRe(e){let t=e.component.projection;return t&&!t.isFit?!0:void 0}function MRe(e){if(!e.component.selection)return null;let t=$(e.component.selection).length,n=t,r=e.parent;for(;r&&n===0;)n=$(r.component.selection).length,r=r.parent;return n?{interactive:t>0||e.mark===`geoshape`||!!e.encoding.tooltip||!!e.markDef.tooltip}:null}function d2(e,t,n,r,i){if(X$(e))return new AVe(e,t,n,i);if(G1(e))return new qVe(e,t,n,r,i);if(E1(e))return new t8(e,t,n,r,i);if(lNe(e))return new jVe(e,t,n,i);throw Error(r$(e))}function NRe(e,t={}){t.logger&&oje(t.logger),t.fieldTitle&&EMe(t.fieldTitle);try{let n=vNe(Nh(t.config,e.config)),r=hPe(e,n),i=d2(r,null,``,void 0,n);return i.parse(),VIe(i.component.data,i),{spec:FRe(i,PRe(e,r.autosize,n,i),e.datasets,e.usermeta),normalized:r}}finally{t.logger&&sje(),t.fieldTitle&&DMe()}}function PRe(e,t,n,r){let i=r.component.layoutSize.get(`width`),a=r.component.layoutSize.get(`height`);if(t===void 0?(t={type:`pad`},r.hasAxisOrientSignalRef()&&(t.resize=!0)):vg(t)&&(t={type:t}),i&&a&&yPe(t.type)){if(i===`step`&&a===`step`)Z(rAe()),t.type=`pad`;else if(i===`step`||a===`step`){let e=i===`step`?`width`:`height`;Z(rAe(jQ(e))),t.type=bPe(e===`width`?`height`:`width`)}}return{...$(t).length===1&&t.type?t.type===`pad`?{}:{autosize:t.type}:{autosize:t},...xPe(n,!1),...xPe(e,!0)}}function FRe(e,t,n={},r){let i=e.config?yNe(e.config):void 0,a=eRe(e.component.data,n),o=e.assembleSelectionData(a),s=e.assembleProjections(),c=e.assembleTitle(),l=e.assembleGroupStyle(),u=e.assembleGroupEncodeEntry(!0),d=e.assembleLayoutSignals();d=d.filter(e=>(e.name===`width`||e.name===`height`)&&e.value!==void 0?(t[e.name]=+e.value,!1):!0);let{params:f,...p}=t;return{$schema:`https://vega.github.io/schema/vega/v6.json`,...e.description?{description:e.description}:{},...p,...c?{title:c}:{},...l?{style:l}:{},...u?{encode:{update:u}}:{},data:o,...s.length>0?{projections:s}:{},...e.assembleGroup([...d,...e.assembleSelectionTopLevelSignals([]),...cNe(f)]),...i?{config:i}:{},...r?{usermeta:r}:{}}}var IRe,f2,$,p2,m2,h2,g2,_2,v2,y2,b2,x2,S2,C2,w2,T2,E2,D2,O2,k2,A2,j2,M2,N2,P2,F2,I2,L2,R2,z2,B2,V2,H2,U2,W2,G2,K2,q2,J2,Y2,X2,Z2,Q2,$2,LRe,e4,t4,RRe,n4,r4,i4,a4,zRe,BRe,VRe,HRe,URe,WRe,GRe,KRe,qRe,JRe,YRe,XRe,ZRe,QRe,$Re,eze,tze,nze,rze,ize,aze,oze,sze,cze,lze,o4,uze,s4,c4,l4,dze,u4,fze,pze,mze,hze,gze,_ze,vze,yze,bze,d4,xze,f4,p4,m4,Sze,Cze,wze,Tze,Eze,Dze,Oze,kze,Aze,h4,jze,Mze,Nze,Pze,Fze,Ize,Lze,Rze,g4,zze,Bze,Vze,Hze,Uze,_4,Wze,Gze,Kze,v4,y4,b4,qze,x4,Jze,S4,C4,Yze,Xze,w4,T4,E4,D4,O4,k4,A4,j4,Zze,M4,N4,P4,Qze,$ze,eBe,tBe,nBe,rBe,iBe,aBe,oBe,sBe,cBe,F4,I4,L4,R4,lBe,z4,B4,uBe,V4,H4,U4,dBe,W4,G4,K4,fBe,pBe,mBe,hBe,q4,J4,gBe,_Be,Y4,vBe,X4,yBe,bBe,Z4,xBe,Q4,$4,e3,t3,n3,SBe,r3,CBe,i3,a3,o3,wBe,TBe,s3,EBe,DBe,c3,OBe,kBe,l3,ABe,u3,d3,jBe,MBe,f3,p3,NBe,PBe,m3,FBe,h3,IBe,g3,LBe,_3,v3,y3,RBe,zBe,BBe,VBe,b3,HBe,UBe,WBe,x3,GBe,KBe,qBe,JBe,S3,YBe,XBe,ZBe,QBe,C3,$Be,w3,T3,E3,D3,O3,k3,A3,eVe,tVe,j3,M3,N3,P3,F3,I3,L3,R3,nVe,rVe,iVe,z3,B3,V3,H3,U3,aVe,oVe,sVe,cVe,lVe,W3,G3,K3,q3,J3,uVe,Y3,X3,Z3,dVe,Q3,$3,fVe,e6,t6,pVe,n6,r6,i6,a6,o6,s6,c6,mVe,l6,hVe,u6,d6,f6,p6,m6,h6,g6,_6,v6,y6,b6,x6,S6,gVe,_Ve,vVe,yVe,bVe,xVe,SVe,CVe,wVe,TVe,EVe,C6,w6,T6,E6,D6,O6,k6,DVe,A6,j6,OVe,M6,N6,kVe,P6,F6,I6,L6,R6,z6,B6,V6,H6,U6,W6,G6,K6,q6,J6,Y6,AVe,jVe,X6,MVe,NVe,PVe,FVe,IVe,LVe,Z6,RVe,zVe,BVe,VVe,HVe,UVe,WVe,GVe,KVe,Q6,$6,e8,t8,qVe,JVe,YVe=o((()=>{Dg(),VY(),iK(),Dke(),IRe={version:`6.4.3`},f2=structuredClone,Set.prototype.toJSON=function(){return`Set(${[...this].map(e=>_Q(e)).join(`,`)})`},$=Object.keys,p2=Object.values,m2=Object.entries,h2=42,g2=Object.getPrototypeOf(structuredClone({})),_2=`row`,v2=`column`,y2=`facet`,b2=`x`,x2=`y`,S2=`x2`,C2=`y2`,w2=`xOffset`,T2=`yOffset`,E2=`radius`,D2=`radius2`,O2=`theta`,k2=`theta2`,A2=`latitude`,j2=`longitude`,M2=`latitude2`,N2=`longitude2`,P2=`time`,F2=`color`,I2=`fill`,L2=`stroke`,R2=`shape`,z2=`size`,B2=`angle`,V2=`opacity`,H2=`fillOpacity`,U2=`strokeOpacity`,W2=`strokeWidth`,G2=`strokeDash`,K2=`text`,q2=`order`,J2=`detail`,Y2=`key`,X2=`tooltip`,Z2=`href`,Q2=`url`,$2=`description`,LRe={x:1,y:1,x2:1,y2:1},e4={theta:1,theta2:1,radius:1,radius2:1},t4={longitude:1,longitude2:1,latitude:1,latitude2:1},RRe=$(t4),n4={...LRe,...e4,...t4,xOffset:1,yOffset:1,color:1,fill:1,stroke:1,time:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeDash:1,size:1,angle:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1,url:1,description:1},r4={row:1,column:1,facet:1},i4=$(r4),a4={...n4,...r4},zRe=$(a4),{order:BRe,detail:VRe,tooltip:HRe,...URe}=a4,{row:WRe,column:GRe,facet:KRe,...qRe}=URe,JRe=[S2,C2,M2,N2,k2,D2],YRe=$(n4),{x:XRe,y:ZRe,x2:QRe,y2:$Re,xOffset:eze,yOffset:tze,latitude:nze,longitude:rze,latitude2:ize,longitude2:aze,theta:oze,theta2:sze,radius:cze,radius2:lze,...o4}=n4,uze=$(o4),s4={x:1,y:1},c4=$(s4),l4={theta:1,radius:1},dze=$(l4),u4={xOffset:1,yOffset:1},fze={time:1},{text:pze,tooltip:mze,href:hze,url:gze,description:_ze,detail:vze,key:yze,order:bze,...d4}=o4,xze=$(d4),f4={...s4,...l4,...u4,...d4},p4=$(f4),m4={arc:`always`,area:`always`,bar:`always`,circle:`always`,geoshape:`always`,image:`always`,line:`always`,rule:`always`,point:`always`,rect:`always`,square:`always`,trail:`always`,text:`always`,tick:`always`},{geoshape:Sze,...Cze}=m4,wze={argmax:1,argmin:1,average:1,count:1,distinct:1,exponential:1,exponentialb:1,product:1,max:1,mean:1,median:1,min:1,missing:1,q1:1,q3:1,ci0:1,ci1:1,stderr:1,stdev:1,stdevp:1,sum:1,valid:1,values:1,variance:1,variancep:1},Tze={count:1,min:1,max:1},Eze=new Set([`count`,`valid`,`missing`,`distinct`]),Dze=new Set([`count`,`sum`,`distinct`,`valid`,`missing`]),Oze=new Set([`mean`,`average`,`median`,`q1`,`q3`,`min`,`max`]),kze=$({aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1,url:1,smooth:1}),Aze={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},h4=[`cornerRadius`,`cornerRadiusTopLeft`,`cornerRadiusTopRight`,`cornerRadiusBottomLeft`,`cornerRadiusBottomRight`],jze=` – `,Mze=`Autosize "fit" only works for single views and layered views.`,Nze=`Scale bindings are currently only supported for scales with unbinned, continuous domains.`,Pze=`Sequntial scales are deprecated. The available quantitative scale type values are linear, log, pow, sqrt, symlog, time and utc`,Fze=`Legend bindings are only supported for selections over an individual field or encoding channel.`,Ize=`The same selection must be used to override scale domains in a layered view.`,Lze=`Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.`,Rze=`Multiple timer selections in one unit spec are not supported. Ignoring all but the first.`,g4=`Animation involving facet, layer, or concat is currently unsupported.`,zze=`Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).`,Bze=`Attempt to add the same child twice.`,Vze=`If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.`,Hze=`Arc marks uses theta channel rather than angle, replacing angle with theta.`,Uze=`Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.`,_4=`Domains that should be unioned has conflicting sort properties. Sort will be set to true.`,Wze=`Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.`,Gze=`Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.`,Kze=`Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.`,v4=kh(2),y4=v4,b4=[`january`,`february`,`march`,`april`,`may`,`june`,`july`,`august`,`september`,`october`,`november`,`december`],qze=b4.map(e=>e.substr(0,3)),x4=[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`],Jze=x4.map(e=>e.substr(0,3)),S4={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},C4=$(S4),Yze={"year-month":`%b %Y `,"year-month-date":`%b %d, %Y `},Xze={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},w4={quantitative:`quantitative`,ordinal:`ordinal`,temporal:`temporal`,nominal:`nominal`,geojson:`geojson`},T4=w4.quantitative,E4=w4.ordinal,D4=w4.temporal,O4=w4.nominal,k4=w4.geojson,A4={LINEAR:`linear`,LOG:`log`,POW:`pow`,SQRT:`sqrt`,TIME:`time`,UTC:`utc`,POINT:`point`,BAND:`band`},j4={linear:`numeric`,log:`numeric`,pow:`numeric`,sqrt:`numeric`,symlog:`numeric`,identity:`numeric`,sequential:`numeric`,time:`time`,utc:`time`,ordinal:`ordinal`,"bin-ordinal":`bin-ordinal`,point:`ordinal-position`,band:`ordinal-position`,quantile:`discretizing`,quantize:`discretizing`,threshold:`discretizing`},Zze={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0},M4=new Set([`linear`,`log`,`pow`,`sqrt`,`symlog`]),N4=new Set([...M4,`time`,`utc`]),P4=new Set([`quantile`,`quantize`,`threshold`]),Qze=new Set([...N4,...P4,`sequential`,`identity`]),$ze=new Set([`ordinal`,`bin-ordinal`,`point`,`band`]),eBe={pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,tickBandPaddingInner:.25,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:4,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0,framesPerSecond:2,animationDuration:5},{type:tBe,domain:nBe,range:rBe,rangeMax:iBe,rangeMin:aBe,scheme:oBe,...sBe}={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},cBe=$(sBe),F4={arc:`arc`,area:`area`,bar:`bar`,image:`image`,line:`line`,point:`point`,rect:`rect`,rule:`rule`,text:`text`,tick:`tick`,trail:`trail`,circle:`circle`,square:`square`,geoshape:`geoshape`},I4=F4.arc,L4=F4.area,R4=F4.bar,lBe=F4.image,z4=F4.line,B4=F4.point,uBe=F4.rect,V4=F4.rule,H4=F4.text,U4=F4.tick,dBe=F4.trail,W4=F4.circle,G4=F4.square,K4=F4.geoshape,fBe=new Set($(F4)),pBe=[`stroke`,`strokeWidth`,`strokeDash`,`strokeDashOffset`,`strokeOpacity`,`strokeJoin`,`strokeMiterLimit`],mBe=[`fill`,`fillOpacity`],hBe=[...pBe,...mBe],q4=$({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),J4=[`binSpacing`,`continuousBandSize`,`discreteBandSize`,`minBandSize`],gBe={area:[`line`,`point`],bar:J4,rect:J4,line:[`point`],tick:[`bandSize`,`thickness`,...J4]},_Be={color:`#4c78a8`,invalid:`break-paths-show-path-domains`,timeUnitBandSize:1},Y4=$({mark:1,arc:1,area:1,bar:1,circle:1,image:1,line:1,point:1,rect:1,rule:1,square:1,text:1,tick:1,trail:1,geoshape:1}),vBe={horizontal:[`cornerRadiusTopRight`,`cornerRadiusBottomRight`],vertical:[`cornerRadiusTopLeft`,`cornerRadiusTopRight`]},X4={binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},yBe={...X4,binSpacing:1},bBe={...X4,thickness:1},Z4=`min`,xBe={x:1,y:1,color:1,fill:1,stroke:1,strokeWidth:1,size:1,shape:1,fillOpacity:1,strokeOpacity:1,opacity:1,text:1},Q4=(e,t)=>{switch(t.fieldTitle){case`plain`:return e.field;case`functional`:return TMe(e);default:return wMe(e,t)}},$4=Q4,e3={compatible:!0},t3={labelAlign:{part:`labels`,vgProp:`align`},labelBaseline:{part:`labels`,vgProp:`baseline`},labelColor:{part:`labels`,vgProp:`fill`},labelFont:{part:`labels`,vgProp:`font`},labelFontSize:{part:`labels`,vgProp:`fontSize`},labelFontStyle:{part:`labels`,vgProp:`fontStyle`},labelFontWeight:{part:`labels`,vgProp:`fontWeight`},labelOpacity:{part:`labels`,vgProp:`opacity`},labelOffset:null,labelPadding:null,gridColor:{part:`grid`,vgProp:`stroke`},gridDash:{part:`grid`,vgProp:`strokeDash`},gridDashOffset:{part:`grid`,vgProp:`strokeDashOffset`},gridOpacity:{part:`grid`,vgProp:`opacity`},gridWidth:{part:`grid`,vgProp:`strokeWidth`},tickColor:{part:`ticks`,vgProp:`stroke`},tickDash:{part:`ticks`,vgProp:`strokeDash`},tickDashOffset:{part:`ticks`,vgProp:`strokeDashOffset`},tickOpacity:{part:`ticks`,vgProp:`opacity`},tickSize:null,tickWidth:{part:`ticks`,vgProp:`strokeWidth`}},n3=[`domain`,`grid`,`labels`,`ticks`,`title`],SBe={grid:`grid`,gridCap:`grid`,gridColor:`grid`,gridDash:`grid`,gridDashOffset:`grid`,gridOpacity:`grid`,gridScale:`grid`,gridWidth:`grid`,orient:`main`,bandPosition:`both`,aria:`main`,description:`main`,domain:`main`,domainCap:`main`,domainColor:`main`,domainDash:`main`,domainDashOffset:`main`,domainOpacity:`main`,domainWidth:`main`,format:`main`,formatType:`main`,labelAlign:`main`,labelAngle:`main`,labelBaseline:`main`,labelBound:`main`,labelColor:`main`,labelFlush:`main`,labelFlushOffset:`main`,labelFont:`main`,labelFontSize:`main`,labelFontStyle:`main`,labelFontWeight:`main`,labelLimit:`main`,labelLineHeight:`main`,labelOffset:`main`,labelOpacity:`main`,labelOverlap:`main`,labelPadding:`main`,labels:`main`,labelSeparation:`main`,maxExtent:`main`,minExtent:`main`,offset:`both`,position:`main`,tickCap:`main`,tickColor:`main`,tickDash:`main`,tickDashOffset:`main`,tickMinStep:`both`,tickOffset:`both`,tickOpacity:`main`,tickRound:`both`,ticks:`main`,tickSize:`main`,tickWidth:`both`,title:`main`,titleAlign:`main`,titleAnchor:`main`,titleAngle:`main`,titleBaseline:`main`,titleColor:`main`,titleFont:`main`,titleFontSize:`main`,titleFontStyle:`main`,titleFontWeight:`main`,titleLimit:`main`,titleLineHeight:`main`,titleOpacity:`main`,titlePadding:`main`,titleX:`main`,titleY:`main`,encode:`both`,scale:`both`,tickBand:`both`,tickCount:`both`,tickExtra:`both`,translate:`both`,values:`both`,zindex:`both`},r3={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},CBe={...r3,style:1,labelExpr:1,encoding:1},i3=$({axis:1,axisBand:1,axisBottom:1,axisDiscrete:1,axisLeft:1,axisPoint:1,axisQuantitative:1,axisRight:1,axisTemporal:1,axisTop:1,axisX:1,axisXBand:1,axisXDiscrete:1,axisXPoint:1,axisXQuantitative:1,axisXTemporal:1,axisY:1,axisYBand:1,axisYDiscrete:1,axisYPoint:1,axisYQuantitative:1,axisYTemporal:1}),a3=class{name;run;constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return E1(e)?Gje(e.mark)===this.name:!1}},o3=`boxplot`,wBe=[`box`,`median`,`outliers`,`rule`,`ticks`],TBe=new a3(o3,YMe),s3=`errorbar`,EBe=[`ticks`,`rule`],DBe=new a3(s3,QMe),c3=`errorband`,OBe=[`band`,`borders`],kBe=new a3(c3,oNe),l3={},P1(o3,YMe,wBe),P1(s3,QMe,EBe),P1(c3,oNe,OBe),ABe=[`gradientHorizontalMaxLength`,`gradientHorizontalMinLength`,`gradientVerticalMaxLength`,`gradientVerticalMinLength`,`unselectedOpacity`],u3={titleAlign:`align`,titleAnchor:`anchor`,titleAngle:`angle`,titleBaseline:`baseline`,titleColor:`color`,titleFont:`font`,titleFontSize:`fontSize`,titleFontStyle:`fontStyle`,titleFontWeight:`fontWeight`,titleLimit:`limit`,titleLineHeight:`lineHeight`,titleOrient:`orient`,titlePadding:`offset`},d3={labelAlign:`align`,labelAnchor:`anchor`,labelAngle:`angle`,labelBaseline:`baseline`,labelColor:`color`,labelFont:`font`,labelFontSize:`fontSize`,labelFontStyle:`fontStyle`,labelFontWeight:`fontWeight`,labelLimit:`limit`,labelLineHeight:`lineHeight`,labelOrient:`orient`,labelPadding:`offset`},jBe=$(u3),MBe=$(d3),f3=$({header:1,headerRow:1,headerColumn:1,headerFacet:1}),p3=[`size`,`shape`,`fill`,`stroke`,`strokeDash`,`strokeWidth`,`opacity`],NBe={gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},PBe={aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1},m3=`_vgsid_`,FBe={point:{on:`click`,fields:[m3],toggle:`event.shiftKey`,resolve:`global`,clear:`dblclick`},interval:{on:`[pointerdown, window:pointerup] > window:pointermove!`,encodings:[`x`,`y`],translate:`[pointerdown, window:pointerup] > window:pointermove!`,zoom:`wheel!`,mark:{fill:`#333`,fillOpacity:.125,stroke:`white`},resolve:`global`,clear:`dblclick`}},h3=20,IBe=$({align:1,bounds:1,center:1,columns:1,spacing:1}),g3=20,LBe={background:`white`,padding:5,timeFormat:`%b %d, %Y`,countTitle:`Count of Records`,view:{continuousWidth:300,continuousHeight:300,step:g3},mark:_Be,arc:{},area:{},bar:yBe,circle:{},geoshape:{},image:{},line:{},point:{},rect:X4,rule:{color:`black`},square:{},text:{color:`black`},tick:bBe,trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:`white`},outliers:{},rule:{},ticks:null},errorbar:{center:`mean`,rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:eBe,projection:{},legend:NBe,header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:FBe,style:{},title:{},facet:{spacing:h3},concat:{spacing:h3},normalizedNumberFormat:`.0%`},_3=[`#4c78a8`,`#f58518`,`#e45756`,`#72b7b2`,`#54a24b`,`#eeca3b`,`#b279a2`,`#ff9da6`,`#9d755d`,`#bab0ac`],v3={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},y3={blue:_3[0],orange:_3[1],red:_3[2],teal:_3[3],green:_3[4],yellow:_3[5],purple:_3[6],pink:_3[7],brown:_3[8],gray0:`#000`,gray1:`#111`,gray2:`#222`,gray3:`#333`,gray4:`#444`,gray5:`#555`,gray6:`#666`,gray7:`#777`,gray8:`#888`,gray9:`#999`,gray10:`#aaa`,gray11:`#bbb`,gray12:`#ccc`,gray13:`#ddd`,gray14:`#eee`,gray15:`#fff`},RBe=[...Y4,...i3,...f3,`background`,`padding`,`legend`,`lineBreak`,`scale`,`style`,`title`,`view`],zBe=new Set([`view`,...fBe]),BBe=`color.fontSize.background.padding.facet.concat.numberFormat.numberFormatType.normalizedNumberFormat.normalizedNumberFormatType.timeFormat.countTitle.header.axisQuantitative.axisTemporal.axisDiscrete.axisPoint.axisXBand.axisXPoint.axisXDiscrete.axisXQuantitative.axisXTemporal.axisYBand.axisYPoint.axisYDiscrete.axisYQuantitative.axisYTemporal.scale.selection.overlay`.split(`.`),VBe={view:[`continuousWidth`,`continuousHeight`,`discreteWidth`,`discreteHeight`,`step`],...gBe},b3=class{map(e,t){return X$(e)?this.mapFacet(e,t):SNe(e)?this.mapRepeat(e,t):B1(e)?this.mapHConcat(e,t):z1(e)?this.mapVConcat(e,t):R1(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(G1(e))return this.mapLayer(e,t);if(E1(e))return this.mapUnit(e,t);throw Error(r$(e))}mapLayer(e,t){return{...e,layer:e.layer.map(e=>this.mapLayerOrUnit(e,t))}}mapHConcat(e,t){return{...e,hconcat:e.hconcat.map(e=>this.map(e,t))}}mapVConcat(e,t){return{...e,vconcat:e.vconcat.map(e=>this.map(e,t))}}mapConcat(e,t){let{concat:n,...r}=e;return{...r,concat:n.map(e=>this.map(e,t))}}mapFacet(e,t){return{...e,spec:this.map(e.spec,t)}}mapRepeat(e,t){return{...e,spec:this.map(e.spec,t)}}},HBe={zero:1,center:1,normalize:1},UBe=new Set([I4,R4,L4,V4,B4,W4,G4,z4,H4,U4]),WBe=new Set([R4,L4,I4]),x3=.7,GBe=class{name=`path-overlay`;hasMatchingType(e,t){if(E1(e)){let{mark:n,encoding:r}=e,i=P$(n)?n:{type:n};switch(i.type){case`line`:case`rule`:case`trail`:return!!q1(i,t[i.type],r);case`area`:return!!q1(i,t[i.type],r)||!!FNe(i,t[i.type])}}return!1}run(e,t,n){let{config:r}=t,{params:i,projection:a,mark:o,name:s,encoding:c,...l}=e,u=O1(c,r),d=P$(o)?o:{type:o},f=q1(d,r[d.type],u),p=d.type===`area`&&FNe(d,r[d.type]),m=[{name:s,...i?{params:i}:{},mark:NNe({...d.type===`area`&&e$(`opacity`,d,r)==null&&e$(`fillOpacity`,d,r)==null?{opacity:x3}:{},...d}),encoding:LZ(u,[`shape`])}],h=DNe(ONe(d,u,r),u),g=u;if(h){let{fieldChannel:e,offset:t}=h;g={...u,[e]:{...u[e],...t?{stack:t}:{}}}}return g=LZ(g,[`y2`,`x2`]),p&&m.push({...a?{projection:a}:{},mark:{type:`line`,...IZ(d,[`clip`,`interpolate`,`tension`,`tooltip`]),...p},encoding:g}),f&&m.push({...a?{projection:a}:{},mark:{type:`point`,opacity:1,filled:!0,...IZ(d,[`clip`,`tooltip`]),...f},encoding:g}),n({...l,layer:m},{...t,config:PNe(r)})}},KBe=class{name=`RuleForRangedLine`;hasMatchingType(e){if(E1(e)){let{encoding:t,mark:n}=e;if(n===`line`||P$(n)&&n.type===`line`)for(let e of JRe){let n=t[wQ(e)];if(t[e]&&(Q(n)&&!HQ(n.bin)||r1(n)))return!0}}return!1}run(e,t,n){let{encoding:r,mark:i}=e;return Z(MAe(!!r.x2,!!r.y2)),n({...e,mark:jh(i)?{...i,type:`rule`}:`rule`},t)}},qBe=class extends b3{nonFacetUnitNormalizers=[TBe,DBe,kBe,new GBe,new KBe];map(e,t){if(E1(e)){let n=D1(e.encoding,_2),r=D1(e.encoding,v2),i=D1(e.encoding,y2);if(n||r||i)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){let{parentEncoding:n,parentProjection:r}=t,i=J1(e.encoding,t.repeater),a={...e,...e.name?{name:[t.repeaterPrefix,e.name].filter(e=>e).join(`_`)}:{},...i?{encoding:i}:{}};if(n||r)return this.mapUnitWithParentEncodingOrProjection(a,t);let o=this.mapLayerOrUnit.bind(this);for(let e of this.nonFacetUnitNormalizers)if(e.hasMatchingType(a,t.config))return e.run(a,t,o);return a}mapRepeat(e,t){return CNe(e)?this.mapLayerRepeat(e,t):this.mapNonLayerRepeat(e,t)}mapLayerRepeat(e,t){let{repeat:n,spec:r,...i}=e,{row:a,column:o,layer:s}=n,{repeater:c={},repeaterPrefix:l=``}=t;return a||o?this.mapRepeat({...e,repeat:{...a?{row:a}:{},...o?{column:o}:{}},spec:{repeat:{layer:s},spec:r}},t):{...i,layer:s.map(e=>{let n={...c,layer:e},i=`${(r.name?`${r.name}_`:``)+l}child__layer_${QZ(e)}`,a=this.mapLayerOrUnit(r,{...t,repeater:n,repeaterPrefix:i});return a.name=i,a})}}mapNonLayerRepeat(e,t){let{repeat:n,spec:r,data:i,...a}=e;!W(n)&&e.columns&&(e=LZ(e,[`columns`]),Z(fAe(`repeat`)));let o=[],{repeater:s={},repeaterPrefix:c=``}=t,l=!W(n)&&n.row||[s?s.row:null],u=!W(n)&&n.column||[s?s.column:null],d=W(n)&&n||[s?s.repeat:null];for(let e of d)for(let i of l)for(let a of u){let l={repeat:e,row:i,column:a,layer:s.layer},u=`${(r.name?`${r.name}_`:``)+c}child__${W(n)?`${QZ(e)}`:(n.row?`row_${QZ(i)}`:``)+(n.column?`column_${QZ(a)}`:``)}`,d=this.map(r,{...t,repeater:l,repeaterPrefix:u});d.name=u,o.push(LZ(d,[`data`]))}let f=W(n)?e.columns:n.column?n.column.length:1;return{data:r.data??i,align:`all`,...a,columns:f,concat:o}}mapFacet(e,t){let{facet:n}=e;return J$(n)&&e.columns&&(e=LZ(e,[`columns`]),Z(fAe(`facet`))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){let{encoding:n,projection:r}=e,{parentEncoding:i,parentProjection:a,config:o}=t,s=HNe({parentProjection:a,projection:r}),c=VNe({parentEncoding:i,encoding:J1(n,t.repeater)});return this.mapUnit({...e,...s?{projection:s}:{},...c?{encoding:c}:{}},{config:o})}mapFacetedUnit(e,t){let{row:n,column:r,facet:i,...a}=e.encoding,{mark:o,width:s,projection:c,height:l,view:u,params:d,encoding:f,...p}=e,{facetMapping:m,layout:h}=this.getFacetMappingAndLayout({row:n,column:r,facet:i},t),g=J1(a,t.repeater);return this.mapFacet({...p,...h,facet:m,spec:{...s?{width:s}:{},...l?{height:l}:{},...u?{view:u}:{},...c?{projection:c}:{},mark:o,encoding:g,...d?{params:d}:{}}},t)}getFacetMappingAndLayout(e,t){let{row:n,column:r,facet:i}=e;if(n||r){i&&Z(AAe([...n?[_2]:[],...r?[v2]:[]]));let t={},a={};for(let n of[_2,v2]){let r=e[n];if(r){let{align:e,center:i,spacing:o,columns:s,...c}=r;t[n]=c;for(let e of[`align`,`center`,`spacing`])r[e]!==void 0&&(a[e]??={},a[e][n]=r[e])}}return{facetMapping:t,layout:a}}else{let{align:e,center:n,spacing:r,columns:a,...o}=i;return{facetMapping:INe(o,t.repeater),layout:{...e?{align:e}:{},...n?{center:n}:{},...r?{spacing:r}:{},...a?{columns:a}:{}}}}}mapLayer(e,{parentEncoding:t,parentProjection:n,...r}){let{encoding:i,projection:a,...o}=e,s={...r,parentEncoding:VNe({parentEncoding:t,encoding:i,layer:!0}),parentProjection:HNe({parentProjection:n,projection:a})};return super.mapLayer({...o,...e.name?{name:[s.repeaterPrefix,e.name].filter(e=>e).join(`_`)}:{}},s)}},JBe=class extends b3{map(e,t){return t.emptySelections??={},t.selectionPredicates??={},e=dPe(e,t),super.map(e,t)}mapLayerOrUnit(e,t){if(e=dPe(e,t),e.encoding){let n={};for(let[r,i]of m2(e.encoding))n[r]=fPe(i,t);e={...e,encoding:n}}return super.mapLayerOrUnit(e,t)}mapUnit(e,t){let{selection:n,...r}=e;return n?{...r,params:m2(n).map(([e,n])=>{let{init:r,bind:i,empty:a,...o}=n;o.type===`single`?(o.type=`point`,o.toggle=!1):o.type===`multi`&&(o.type=`point`),t.emptySelections[e]=a!==`none`;for(let n of p2(t.selectionPredicates[e]??{}))n.empty=a!==`none`;return{name:e,value:r,select:o,bind:i}})}:e}},S3=class extends b3{map(e,t){let n=t.selections??[];if(e.params&&!E1(e)){let t=[];for(let r of e.params)L1(r)?n.push(r):t.push(r);e.params=t}return t.selections=n,super.map(e,t)}mapUnit(e,t){let n=t.selections;if(!n||!n.length)return e;let r=(t.path??[]).concat(e.name),i=[];for(let t of n)if(!t.views||!t.views.length)i.push(t);else for(let n of t.views)(vg(n)&&(n===e.name||r.includes(n))||W(n)&&n.map(e=>r.indexOf(e)).every((e,t,n)=>e!==-1&&(t===0||e>n[t-1])))&&i.push(t);return i.length&&(e.params=i),e}};for(let e of[`mapFacet`,`mapRepeat`,`mapHConcat`,`mapVConcat`,`mapLayer`]){let t=S3.prototype[e];S3.prototype[e]=function(e,n){return t.call(this,e,mPe(e,n))}}YBe=new qBe,XBe=new JBe,ZBe=new S3,QBe=[`background`,`padding`],C3=class e{explicit;implicit;constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new e(f2(this.explicit),f2(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(e){return uQ(this.explicit[e],this.implicit[e])}getWithExplicit(e){return this.explicit[e]===void 0?this.implicit[e]===void 0?{explicit:!1,value:void 0}:{explicit:!1,value:this.implicit[e]}:{explicit:!0,value:this.explicit[e]}}setWithExplicit(e,{value:t,explicit:n}){t!==void 0&&this.set(e,t,n)}set(e,t,n){return delete this[n?`implicit`:`explicit`][e],this[n?`explicit`:`implicit`][e]=t,this}copyKeyFromSplit(e,{explicit:t,implicit:n}){t[e]===void 0?n[e]!==void 0&&this.set(e,n[e],!1):this.set(e,t[e],!0)}copyKeyFromObject(e,t){t[e]!==void 0&&this.set(e,t[e],!0)}copyAll(e){for(let t of $(e.combine())){let n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}},$Be=class extends C3{explicit;implicit;parseNothing;constructor(e={},t={},n=!1){super(e,t),this.explicit=e,this.implicit=t,this.parseNothing=n}clone(){let e=super.clone();return e.parseNothing=this.parseNothing,e}},(function(e){e[e.Raw=0]=`Raw`,e[e.Main=1]=`Main`,e[e.Row=2]=`Row`,e[e.Column=3]=`Column`,e[e.Lookup=4]=`Lookup`,e[e.PreFilterInvalid=5]=`PreFilterInvalid`,e[e.PostFilterInvalid=6]=`PostFilterInvalid`})(w3||={}),T3=class{debugName;_children=[];_parent=null;_hash;constructor(e,t){this.debugName=t,e&&(this.parent=e)}clone(){throw Error(`Cannot clone node`)}get parent(){return this._parent}set parent(e){this._parent=e,e&&e.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(e,t){if(this._children.includes(e)){Z(Bze);return}t===void 0?this._children.push(e):this._children.splice(t,0,e)}removeChild(e){let t=this._children.indexOf(e);return this._children.splice(t,1),t}remove(){let e=this._parent.removeChild(this);for(let t of this._children)t._parent=this._parent,this._parent.addChild(t,e++)}insertAsParentOf(e){let t=e.parent;t.removeChild(this),this.parent=t,e.parent=this}swapWithParent(){let e=this._parent,t=e.parent;for(let t of this._children)t.parent=e;this._children=[],e.removeChild(this);let n=e.parent.removeChild(e);this._parent=t,t.addChild(this,n),e.parent=this}},E3=class extends T3{type;refCounts;_source;_name;clone(){let e=new this.constructor;return e.debugName=`clone_${this.debugName}`,e._source=this._source,e._name=`clone_${this._name}`,e.type=this.type,e.refCounts=this.refCounts,e.refCounts[e._name]=0,e}constructor(e,t,n,r){super(e,t),this.type=n,this.refCounts=r,this._source=this._name=t,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}dependentFields(){return new Set}producedFields(){return new Set}hash(){return this._hash===void 0&&(this._hash=`Output ${dQ()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}},D3=class e extends T3{timeUnits;clone(){return new e(null,f2(this.timeUnits))}constructor(e,t){super(e),this.timeUnits=t}static makeFromEncoding(t,n){let r=n.reduceFieldDef((e,t,r)=>{let{field:i,timeUnit:a}=t;if(a){let o;if(p$(a)){if(e2(n)){let{mark:e,markDef:r,config:s}=n,c=Q$({fieldDef:t,markDef:r,config:s});(N$(e)||c)&&(o={timeUnit:g$(a),field:i})}}else o={as:d1(t,{forAs:!0}),field:i,timeUnit:a};if(e2(n)){let{mark:e,markDef:i,config:a}=n,s=Q$({fieldDef:t,markDef:i,config:a});N$(e)&&AQ(r)&&s!==.5&&(o.rectBandPosition=s)}o&&(e[RZ(o)]=o)}return e},{});return YZ(r)?null:new e(t,r)}static makeFromTransform(t,n){let{timeUnit:r,...i}={...n},a=g$(r),o={...i,timeUnit:a};return new e(t,{[RZ(o)]:o})}merge(e){this.timeUnits={...this.timeUnits};for(let t in e.timeUnits)this.timeUnits[t]||(this.timeUnits[t]=e.timeUnits[t]);for(let t of e.children)e.removeChild(t),t.parent=this;e.remove()}removeFormulas(e){let t={};for(let[n,r]of m2(this.timeUnits)){let i=o0(r)?r.as:`${r.field}_end`;e.has(i)||(t[n]=r)}this.timeUnits=t}producedFields(){return new Set(p2(this.timeUnits).map(e=>o0(e)?e.as:OPe(e.field)))}dependentFields(){return new Set(p2(this.timeUnits).map(e=>e.field))}hash(){return`TimeUnit ${RZ(this.timeUnits)}`}assemble(){let e=[];for(let t of p2(this.timeUnits)){let{rectBandPosition:n}=t,r=g$(t.timeUnit);if(o0(t)){let{field:i,as:a}=t,{unit:o,utc:s,...c}=r,l=[a,`${a}_end`];e.push({field:oQ(i),type:`timeunit`,...o?{units:h$(o)}:{},...s?{timezone:`utc`}:{},...c,as:l}),e.push(...APe(l,n,r))}else if(t){let{field:i}=t,a=aQ(i),o=kPe({timeUnit:r,field:a}),s=OPe(a);e.push({type:`formula`,expr:o,as:s}),e.push(...APe([a,s],n,r))}}return e}},O3=`offsetted_rect_start`,k3=`offsetted_rect_end`,A3=`_tuple_fields`,eVe=class{hasChannel;hasField;hasSelectionId;timeUnit;items;constructor(...e){this.items=e,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}},tVe={defined:()=>!0,parse:(e,t,n)=>{let r=t.name,i=t.project??=new eVe,a={},o={},s=new Set,c=(e,t)=>{let n=t===`visual`?e.channel:e.field,i=QZ(`${r}_${n}`);for(let e=1;s.has(i);e++)i=QZ(`${r}_${n}_${e}`);return s.add(i),{[t]:i}},l=t.type,u=e.config.selection[l],d=n.value===void 0?null:Qh(n.value),{fields:f,encodings:p}=jh(n.select)?n.select:{};if(!f&&!p&&d){for(let e of d)if(jh(e))for(let t of $(e))Nke(t)?(p||=[]).push(t):l===`interval`?(Z(Lze),p=u.encodings):(f??=[]).push(t)}!f&&!p&&(p=u.encodings,`fields`in u&&(f=u.fields));for(let t of p??[]){let n=e.fieldDef(t);if(n){let r=n.field;if(n.aggregate){Z(aAe(t,n.aggregate));continue}else if(!r){Z(iAe(t));continue}if(n.timeUnit&&!p$(n.timeUnit)){r=e.vgField(t);let i={timeUnit:n.timeUnit,as:r,field:n.field};o[RZ(i)]=i}if(!a[r]){let o=l===`interval`&&PQ(t)&&O$(e.getScaleComponent(t).get(`type`))?`R`:n.bin?`R-RE`:`E`,s={field:r,channel:t,type:o,index:i.items.length};s.signals={...c(s,`data`),...c(s,`visual`)},i.items.push(a[r]=s),i.hasField[r]=a[r],i.hasSelectionId=i.hasSelectionId||r===m3,bQ(t)?(s.geoChannel=t,s.channel=yQ(t),i.hasChannel[s.channel]=a[r]):i.hasChannel[t]=a[r]}}else Z(iAe(t))}for(let e of f??[]){if(i.hasField[e])continue;let t={type:`E`,field:e,index:i.items.length};t.signals={...c(t,`data`)},i.items.push(t),i.hasField[e]=t,i.hasSelectionId=i.hasSelectionId||e===m3}d&&(t.init=d.map(e=>i.items.map(t=>jh(e)?e[t.geoChannel||t.channel]===void 0?e[t.field]:e[t.geoChannel||t.channel]:e))),YZ(o)||(i.timeUnit=new D3(null,o))},signals:(e,t,n)=>{let r=t.name+A3;return n.filter(e=>e.name===r).length>0||t.project.hasSelectionId?n:n.concat({name:r,value:t.project.items.map(MPe)})}},j3=`_curr`,M3=`anim_value`,N3=`anim_clock`,P3=`eased_anim_clock`,F3=`min_extent`,I3=`max_range_extent`,L3=`last_tick_at`,R3=`is_playing`,nVe=1/60*1e3,rVe=(e,t)=>[{name:P3,update:N3},{name:`${e}_domain`,init:`domain('${t}')`},{name:F3,init:`extent(${e}_domain)[0]`},{name:I3,init:`extent(range('${t}'))[1]`},{name:M3,update:`invert('${t}', ${P3})`}],iVe={defined:e=>e.type===`point`,topLevelSignals:(e,t,n)=>(T0(t)&&(n=n.concat([{name:N3,init:`0`,on:[{events:{type:`timer`,throttle:nVe},update:`${R3} ? (${N3} + (now() - ${L3}) > ${I3} ? 0 : ${N3} + (now() - ${L3})) : ${N3}`}]},{name:L3,init:`now()`,on:[{events:[{signal:N3},{signal:R3}],update:`now()`}]},{name:R3,init:`true`}])),n),signals:(e,t,n)=>{let r=t.name,i=r+A3,a=t.project,o=`(item().isVoronoi ? datum.datum : datum)`,s=p2(e.component.selection??{}).reduce((e,t)=>t.type===`interval`?e.concat(t.name+B3):e,[]).map(e=>`indexof(item().mark.name, '${e}') < 0`).join(` && `),c=`datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0${s?` && ${s}`:``}`,l=`unit: ${C0(e)}, `;if(t.project.hasSelectionId)l+=`${m3}: ${o}[${G(m3)}]`;else if(T0(t))l+=`fields: ${i}, values: [${M3} ? ${M3} : ${F3}]`;else{let t=a.items.map(t=>e.fieldDef(t.channel)?.bin?`[${o}[${G(e.vgField(t.channel,{}))}], ${o}[${G(e.vgField(t.channel,{binSuffix:`end`}))}]]`:`${o}[${G(t.field)}]`).join(`, `);l+=`fields: ${i}, values: [${t}]`}if(T0(t))return n.concat(rVe(t.name,e.scaleName(P2)),[{name:r+t6,on:[{events:[{signal:P3},{signal:M3}],update:`{${l}}`,force:!0}]}]);{let e=t.events;return n.concat([{name:r+t6,on:e?[{events:e,update:`${c} ? {${l}} : null`,force:!0}]:[]}])}}},z3={defined:e=>e.type===`interval`&&e.resolve===`global`&&e.bind&&e.bind===`scales`,parse:(e,t)=>{let n=t.scales=[];for(let r of t.project.items){let i=r.channel;if(!PQ(i))continue;let a=e.getScaleComponent(i),o=a?a.get(`type`):void 0;if(o==`sequential`&&Z(Pze),!a||!O$(o)){Z(Nze);continue}a.set(`selectionExtent`,{param:t.name,field:r.field},!0),n.push(r)}},topLevelSignals:(e,t,n)=>{let r=t.scales.filter(e=>n.filter(t=>t.name===e.signals.data).length===0);if(!e.parent||u0(e)||r.length===0)return n;let i=n.find(e=>e.name===t.name),a=i.update;if(a.includes(n6))i.update=`{${r.map(e=>`${G(oQ(e.field))}: ${e.signals.data}`).join(`, `)}}`;else{for(let e of r){let t=`${G(oQ(e.field))}: ${e.signals.data}`;a.includes(t)||(a=`${a.substring(0,a.length-1)}, ${t}}`)}i.update=a}return n.concat(r.map(e=>({name:e.signals.data})))},signals:(e,t,n)=>{if(e.parent&&!u0(e))for(let e of t.scales){let t=n.find(t=>t.name===e.signals.data);t.push=`outer`,delete t.value,delete t.update}return n}},B3=`_brush`,V3=`_scale_trigger`,H3=`geo_interval_init_tick`,U3=`_init`,aVe=`_center`,oVe={defined:e=>e.type===`interval`,parse:(e,t,n)=>{if(e.hasProjection){let e={...jh(n.select)?n.select:{}};e.fields=[m3],e.encodings||=n.value?$(n.value):[j2,A2],n.select={type:`interval`,...e}}if(t.translate&&!z3.defined(t)){let e=`!event.item || event.item.mark.name !== ${G(t.name+B3)}`;for(let n of t.events){if(!n.between){Z(`${n} is not an ordered event stream for interval selections.`);continue}let t=Qh(n.between[0].filter??=[]);t.includes(e)||t.push(e)}}},signals:(e,t,n)=>{let r=t.name,i=r+t6,a=p2(t.project.hasChannel).filter(e=>e.channel===b2||e.channel===x2),o=t.init?t.init[0]:null;if(n.push(...a.reduce((n,r)=>n.concat(BPe(e,t,r,o?.[r.index])),[])),e.hasProjection){let s=G(e.projectionName()),c=e.projectionName()+aVe,{x:l,y:u}=t.project.hasChannel,d=l?.signals.visual,f=u?.signals.visual,p=l?o?.[l.index]:`${c}[0]`,m=u?o?.[u.index]:`${c}[1]`,h=t=>e.getSizeSignalRef(t).signal,g=`[[${d?`${d}[0]`:`0`}, ${f?`${f}[0]`:`0`}],[${d?`${d}[1]`:h(`width`)}, ${f?`${f}[1]`:h(`height`)}]]`;o&&(n.unshift({name:r+U3,init:`[scale(${s}, [${l?p[0]:p}, ${u?m[0]:m}]), scale(${s}, [${l?p[1]:p}, ${u?m[1]:m}])]`}),(!l||!u)&&(n.find(e=>e.name===c)||n.unshift({name:c,update:`invert(${s}, [${h(`width`)}/2, ${h(`height`)}/2])`})));let _=`vlSelectionTuples(${`intersect(${g}, {markname: ${G(e.getName(`marks`))}}, unit.mark)`}, ${`{unit: ${C0(e)}}`})`,v=a.map(e=>e.signals.visual);return n.concat({name:i,on:[{events:[...v.length?[{signal:v.join(` || `)}]:[],...o?[{signal:H3}]:[]],update:_}]})}else{if(!z3.defined(t)){let t=r+V3,i=a.map(t=>{let n=t.channel,{data:r,visual:i}=t.signals,a=G(e.scaleName(n)),o=O$(e.getScaleComponent(n).get(`type`))?`+`:``;return`(!isArray(${r}) || (${o}invert(${a}, ${i})[0] === ${o}${r}[0] && ${o}invert(${a}, ${i})[1] === ${o}${r}[1]))`});i.length&&n.push({name:t,value:{},on:[{events:a.map(t=>({scale:e.scaleName(t.channel)})),update:`${i.join(` && `)} ? ${t} : {}`}]})}let s=a.map(e=>e.signals.data),c=`unit: ${C0(e)}, fields: ${r+A3}, values`;return n.concat({name:i,...o?{init:`{${c}: ${s0(o)}}`}:{},...s.length?{on:[{events:[{signal:s.join(` || `)}],update:`${s.join(` && `)} ? {${c}: [${s}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>(e2(e)&&e.hasProjection&&t.init&&(n.filter(e=>e.name===H3).length||n.unshift({name:H3,value:null,on:[{events:`timer{1}`,update:`${H3} === null ? {} : ${H3}`}]})),n),marks:(e,t,n)=>{let r=t.name,{x:i,y:a}=t.project.hasChannel,o=i?.signals.visual,s=a?.signals.visual,c=`data(${G(t.name+e6)})`;if(z3.defined(t)||!i&&!a)return n;let l={x:i===void 0?{value:0}:{signal:`${o}[0]`},y:a===void 0?{value:0}:{signal:`${s}[0]`},x2:i===void 0?{field:{group:`width`}}:{signal:`${o}[1]`},y2:a===void 0?{field:{group:`height`}}:{signal:`${s}[1]`}};if(t.resolve===`global`)for(let t of $(l))l[t]=[{test:`${c}.length && ${c}[0].unit === ${C0(e)}`,...l[t]},{value:0}];let{fill:u,fillOpacity:d,cursor:f,...p}=t.mark,m=$(p).reduce((e,t)=>(e[t]=[{test:[i!==void 0&&`${o}[0] !== ${o}[1]`,a!==void 0&&`${s}[0] !== ${s}[1]`].filter(e=>e).join(` && `),value:p[t]},{value:null}],e),{}),h=f??(t.translate?`move`:null);return[{name:`${r+B3}_bg`,type:`rect`,clip:!0,encode:{enter:{fill:{value:u},fillOpacity:{value:d}},update:l}},...n,{name:r+B3,type:`rect`,clip:!0,encode:{enter:{...h?{cursor:{value:h}}:{},fill:{value:`transparent`}},update:{...l,...m}}}]}},sVe={left:`x`,center:`xc`,right:`x2`},cVe={top:`y`,middle:`yc`,bottom:`y2`},lVe=new Set([`aria`,`width`,`height`]),W3=`voronoi`,G3={defined:e=>e.type===`point`&&e.nearest,parse:(e,t)=>{if(t.events)for(let n of t.events)n.markname=e.getName(W3)},marks:(e,t,n)=>{let{x:r,y:i}=t.project.hasChannel,a=e.mark;if(M$(a))return Z(oAe(a)),n;let o={name:e.getName(W3),type:`path`,interactive:!0,aria:!1,from:{data:e.getName(`marks`)},encode:{update:{fill:{value:`transparent`},strokeWidth:{value:.35},stroke:{value:`transparent`},isVoronoi:{value:!0},...VPe(e,{reactiveGeom:!0})}},transform:[{type:`voronoi`,x:{expr:r||!i?`datum.datum.x || 0`:`0`},y:{expr:i||!r?`datum.datum.y || 0`:`0`},size:[e.getSizeSignalRef(`width`),e.getSizeSignalRef(`height`)]}]},s=0,c=!1;return n.forEach((t,n)=>{let r=t.name??``;r===e.component.mark[0].name?s=n:r.includes(W3)&&(c=!0)}),c||n.splice(s+1,0,o),n}},K3={defined:e=>e.type===`point`&&e.resolve===`global`&&e.bind&&e.bind!==`scales`&&!F1(e.bind),parse:(e,t,n)=>mFe(t,n),topLevelSignals:(e,t,n)=>{let r=t.name,i=t.project,a=t.bind,o=t.init?.[0],s=G3.defined(t)?`(item().isVoronoi ? datum.datum : datum)`:`datum`;return i.items.forEach((e,i)=>{let c=QZ(`${r}_${e.field}`);n.filter(e=>e.name===c).length||n.unshift({name:c,...o?{init:s0(o[i])}:{value:null},on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${s}[${G(e.field)}] : null`}]:[],bind:a[e.field]??a[e.channel]??a})}),n},signals:(e,t,n)=>{let r=t.name,i=t.project,a=n.find(e=>e.name===r+t6),o=r+A3,s=i.items.map(e=>QZ(`${r}_${e.field}`)),c=s.map(e=>`${e} !== null`).join(` && `);return s.length&&(a.update=`${c} ? {fields: ${o}, values: [${s.join(`, `)}]} : null`),delete a.value,delete a.on,n}},q3=`_toggle`,J3={defined:e=>e.type===`point`&&!T0(e)&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+q3,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{let n=t.name+t6,r=t.name+q3;return`${r} ? null : ${n}, ${t.resolve===`global`?`${r} ? null : true, `:`${r} ? null : {unit: ${C0(e)}}, `}${r} ? ${n} : null`}},uVe={defined:e=>e.clear!==void 0&&e.clear!==!1&&!T0(e),parse:(e,t)=>{t.clear&&=vg(t.clear)?VG(t.clear,`view`):t.clear},topLevelSignals:(e,t,n)=>{if(K3.defined(t))for(let e of t.project.items){let r=n.findIndex(n=>n.name===QZ(`${t.name}_${e.field}`));r!==-1&&n[r].on.push({events:t.clear,update:`null`})}return n},signals:(e,t,n)=>{function r(e,r){e!==-1&&n[e].on&&n[e].on.push({events:t.clear,update:r})}if(t.type===`interval`)for(let e of t.project.items){let t=n.findIndex(t=>t.name===e.signals.visual);r(t,`[0, 0]`),t===-1&&r(n.findIndex(t=>t.name===e.signals.data),`null`)}else{let e=n.findIndex(e=>e.name===t.name+t6);r(e,`null`),J3.defined(t)&&(e=n.findIndex(e=>e.name===t.name+q3),r(e,`false`))}return n}},Y3={defined:e=>{let t=e.resolve===`global`&&e.bind&&F1(e.bind),n=e.project.items.length===1&&e.project.items[0].field!==m3;return t&&!n&&Z(Fze),t&&n},parse:(e,t,n)=>{let r=f2(n);if(r.select=vg(r.select)?{type:r.select,toggle:t.toggle}:{...r.select,toggle:t.toggle},mFe(t,r),jh(n.select)&&(n.select.on||n.select.clear)){let e=`event.item && indexof(event.item.mark.role, "legend") < 0`;for(let n of t.events)n.filter=Qh(n.filter??[]),n.filter.includes(e)||n.filter.push(e)}let i=I1(t.bind)?t.bind.legend:`click`;t.bind={legend:{merge:vg(i)?VG(i,`view`):Qh(i)}}},topLevelSignals:(e,t,n)=>{let r=t.name,i=I1(t.bind)&&t.bind.legend,a=e=>t=>{let n=f2(t);return n.markname=e,n};for(let e of t.project.items){if(!e.hasLegend)continue;let o=`${QZ(e.field)}_legend`,s=`${r}_${o}`;if(n.filter(e=>e.name===s).length===0){let e=i.merge.map(a(`${o}_symbols`)).concat(i.merge.map(a(`${o}_labels`))).concat(i.merge.map(a(`${o}_entries`)));n.unshift({name:s,...t.init?{}:{value:null},on:[{events:e,update:`isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value`,force:!0},{events:i.merge,update:`!event.item || !datum ? null : ${s}`,force:!0}]})}}return n},signals:(e,t,n)=>{let r=t.name,i=t.project,a=n.find(e=>e.name===r+t6),o=r+A3,s=i.items.filter(e=>e.hasLegend).map(e=>QZ(`${r}_${QZ(e.field)}_legend`)),c=`${s.map(e=>`${e} !== null`).join(` && `)} ? {fields: ${o}, values: [${s.join(`, `)}]} : null`;t.events&&s.length>0?a.on.push({events:s.map(e=>({signal:e})),update:c}):s.length>0&&(a.update=c,delete a.value,delete a.on);let l=n.find(e=>e.name===r+q3),u=I1(t.bind)&&t.bind.legend;return l&&(t.events?l.on.push({...l.on[0],events:u}):l.on[0].events=u),n}},X3=`_translate_anchor`,Z3=`_translate_delta`,dVe={defined:e=>e.type===`interval`&&e.translate,signals:(e,t,n)=>{let r=t.name,i=z3.defined(t),a=r+X3,{x:o,y:s}=t.project.hasChannel,c=VG(t.translate,`scope`);return i||(c=c.map(e=>(e.between[0].markname=r+B3,e))),n.push({name:a,value:{},on:[{events:c.map(e=>e.between[0]),update:`{x: x(unit), y: y(unit)${o===void 0?``:`, extent_x: ${i?l0(e,b2):`slice(${o.signals.visual})`}`}${s===void 0?``:`, extent_y: ${i?l0(e,x2):`slice(${s.signals.visual})`}`}}`}]},{name:r+Z3,value:{},on:[{events:c,update:`{x: ${a}.x - x(unit), y: ${a}.y - y(unit)}`}]}),o!==void 0&&dFe(e,t,o,`width`,n),s!==void 0&&dFe(e,t,s,`height`,n),n}},Q3=`_zoom_anchor`,$3=`_zoom_delta`,fVe={defined:e=>e.type===`interval`&&e.zoom,signals:(e,t,n)=>{let r=t.name,i=z3.defined(t),a=r+$3,{x:o,y:s}=t.project.hasChannel,c=G(e.scaleName(b2)),l=G(e.scaleName(x2)),u=VG(t.zoom,`scope`);return i||(u=u.map(e=>(e.markname=r+B3,e))),n.push({name:r+Q3,on:[{events:u,update:i?`{${[c?`x: invert(${c}, x(unit))`:``,l?`y: invert(${l}, y(unit))`:``].filter(e=>e).join(`, `)}}`:`{x: x(unit), y: y(unit)}`}]},{name:a,on:[{events:u,force:!0,update:`pow(1.001, event.deltaY * pow(16, event.deltaMode))`}]}),o!==void 0&&fFe(e,t,o,`width`,n),s!==void 0&&fFe(e,t,s,`height`,n),n}},e6=`_store`,t6=`_tuple`,pVe=`_modify`,n6=`vlSelectionResolve`,r6=[iVe,oVe,tVe,J3,K3,z3,Y3,uVe,dVe,fVe,G3],i6=class e extends T3{model;filter;expr;_dependentFields;clone(){return new e(null,this.model,f2(this.filter))}constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=D0(this.model,this.filter,this),this._dependentFields=gFe(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:`filter`,expr:this.expr}}hash(){return`Filter ${this.expr}`}},a6={scale:({model:e,channel:t})=>e.scaleName(t),format:({format:e})=>e,formatType:({formatType:e})=>e,grid:({fieldOrDatumDef:e,axis:t,scaleType:n})=>t.grid??DFe(n,e),gridScale:({model:e,channel:t})=>OFe(e,t),labelAlign:({axis:e,labelAngle:t,orient:n,channel:r})=>e.labelAlign||jFe(t,n,r),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:r})=>e.labelBaseline||AFe(t,n,r),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>e.labelFlush??MFe(t.type,n),labelOverlap:({axis:e,fieldOrDatumDef:t,scaleType:n})=>e.labelOverlap??NFe(t.type,n,Q(t)&&!!t.timeUnit,Q(t)?t.sort:void 0),orient:({orient:e})=>e,tickCount:({channel:e,model:t,axis:n,fieldOrDatumDef:r,scaleType:i})=>{let a=e===`x`?`width`:e===`y`?`height`:void 0,o=a?t.getSizeSignalRef(a):void 0;return n.tickCount??FFe({fieldOrDatumDef:r,scaleType:i,size:o,values:n.values})},tickMinStep:({axis:e,format:t,fieldOrDatumDef:n})=>e.tickMinStep??IFe({format:t,fieldOrDatumDef:n}),title:({axis:e,model:t,channel:n})=>{if(e.title!==void 0)return e.title;let r=LFe(t,n);if(r!==void 0)return r;let i=t.typedFieldDef(n),a=n===`x`?`x2`:`y2`,o=t.fieldDef(a);return Qke(i?[fMe(i)]:[],Q(o)?[fMe(o)]:[])},values:({axis:e,fieldOrDatumDef:t})=>RFe(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>e.zindex??zFe(n,t)},o6=class e extends T3{transform;_dependentFields;clone(){return new e(null,f2(this.transform))}constructor(e,t){super(e),this.transform=t,this._dependentFields=gFe(this.transform.calculate)}static parseAllForSortIndex(t,n){return n.forEachFieldDef((n,r)=>{if(l1(n)&&lMe(n.sort)){let{field:i,timeUnit:a}=n,o=n.sort,s=o.map((e,t)=>`${Aje({field:i,timeUnit:a,equal:e})} ? ${t} : `).join(``)+o.length;t=new e(t,{calculate:s,as:M0(n,r,{forAs:!0})})}}),t}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:`formula`,expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${RZ(this.transform)}`}},s6=[`row`,`column`],c6=[`header`,`footer`],mVe={column:{start:0,end:1},row:{start:1,end:0}},l6=$({...PBe,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1}),hVe=class extends C3{},u6={symbols:eIe,gradient:tIe,labels:nIe,entries:rIe},d6={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{let{format:r,formatType:i}=t;return tMe(e,e.type,r,i,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{let{formatType:r}=e;return nMe(r,t,n)},gradientLength:e=>{let{legend:t,legendConfig:n}=e;return t.gradientLength??n.gradientLength??pIe(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>e.labelOverlap??t.labelOverlap??hIe(n),symbolType:({legend:e,markDef:t,channel:n,encoding:r})=>e.symbolType??cIe(t.type,n,r.shape,t.shape),title:({fieldOrDatumDef:e,config:t})=>p1(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(xQ(n)&&k$(t)){if(e===`gradient`)return}else if(e===`symbol`)return;return e},values:({fieldOrDatumDef:e,legend:t})=>sIe(t,e)},f6=class e extends T3{bins;clone(){return new e(null,f2(this.bins))}constructor(e,t){super(e),this.bins=t}static makeFromEncoding(t,n){let r=n.reduceFieldDef((e,t,r)=>{if(s1(t)&&VQ(t.bin)){let{key:i,binComponent:a}=OIe(t,t.bin,n);e[i]={...a,...e[i],...wIe(n,t,r,n.config)}}return e},{});return YZ(r)?null:new e(t,r)}static makeFromTransform(t,n,r){let{key:i,binComponent:a}=OIe(n,n.bin,r);return new e(t,{[i]:a})}merge(e,t){for(let n of $(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=WZ([...this.bins[n].as,...e.bins[n].as],RZ)):this.bins[n]=e.bins[n];for(let t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(p2(this.bins).map(e=>e.as).flat(2))}dependentFields(){return new Set(p2(this.bins).map(e=>e.field))}hash(){return`Bin ${RZ(this.bins)}`}assemble(){return p2(this.bins).flatMap(e=>{let t=[],[n,...r]=e.as,{extent:i,...a}=e.bin,o={type:`bin`,field:oQ(e.field),as:n,signal:e.signal,...WQ(i)?{extent:null}:{extent:i},...e.span?{span:{signal:`span(${e.span})`}}:{},...a};!i&&e.extentSignal&&(t.push({type:`extent`,field:oQ(e.field),signal:e.extentSignal}),o.extent={signal:e.extentSignal}),t.push(o);for(let e of r)for(let r=0;r<2;r++)t.push({type:`formula`,expr:d1({field:n[r]},{expr:`datum`}),as:e[r]});return e.formula&&t.push({type:`formula`,expr:e.formula,as:e.formulaAs}),t})}},p6=class e extends T3{dimensions;measures;clone(){return new e(null,new Set(this.dimensions),f2(this.measures))}constructor(e,t,n){super(e),this.dimensions=t,this.measures=n}get groupBy(){return this.dimensions}static makeFromEncoding(t,n){let r=!1;n.forEachFieldDef(e=>{e.aggregate&&(r=!0)});let i={},a=new Set;return!r||(n.forEachFieldDef((e,t)=>{let{aggregate:r,field:o}=e;if(r)if(r===`count`)i[`*`]??={},i[`*`].count=new Set([d1(e,{forAs:!0})]);else{if(IQ(r)||LQ(r)){let e=IQ(r)?`argmin`:`argmax`,t=r[e];i[t]??={},i[t][e]=new Set([d1({op:e,field:t},{forAs:!0})])}else i[o]??={},i[o][r]=new Set([d1(e,{forAs:!0})]);PQ(t)&&n.scaleDomain(t)===`unaggregated`&&(i[o]??={},i[o].min=new Set([d1({field:o,aggregate:`min`},{forAs:!0})]),i[o].max=new Set([d1({field:o,aggregate:`max`},{forAs:!0})]))}else kIe(a,t,e,n)}),a.size+$(i).length===0)?null:new e(t,a,i)}static makeFromTransform(t,n){let r=new Set,i={};for(let e of n.aggregate){let{op:t,field:n,as:r}=e;t&&(t===`count`?(i[`*`]??={},i[`*`].count=new Set([r||d1(e,{forAs:!0})])):(i[n]??={},i[n][t]??=new Set,i[n][t].add(r||d1(e,{forAs:!0}))))}for(let e of n.groupby??[])r.add(e);return r.size+$(i).length===0?null:new e(t,r,i)}merge(e){return GZ(this.dimensions,e.dimensions)?(AIe(this.measures,e.measures),!0):(cje(`different dimensions, cannot merge`),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...$(this.measures)])}producedFields(){let e=new Set;for(let t of $(this.measures))for(let n of $(this.measures[t])){let r=this.measures[t][n];r.size===0?e.add(`${n}_${t}`):r.forEach(e.add,e)}return e}hash(){return`Aggregate ${RZ({dimensions:this.dimensions,measures:this.measures})}`}assemble(){let e=[],t=[],n=[];for(let r of $(this.measures))for(let i of $(this.measures[r]))for(let a of this.measures[r][i])n.push(a),e.push(i),t.push(r===`*`?null:oQ(r));return{type:`aggregate`,groupby:[...this.dimensions].map(oQ),ops:e,fields:t,as:n}}},m6=class extends T3{model;name;data;column;row;facet;childModel;constructor(e,t,n,r){super(e),this.model=t,this.name=n,this.data=r;for(let e of i4){let n=t.facet[e];if(n){let{bin:r,sort:i}=n;this[e]={name:t.getName(`${e}_domain`),fields:[d1(n),...VQ(r)?[d1(n,{binSuffix:`end`})]:[]],...q$(i)?{sortField:i}:W(i)?{sortIndexField:M0(n,e)}:{}}}}this.childModel=t.child}hash(){let e=`Facet`;for(let t of i4)this[t]&&(e+=` ${t.charAt(0)}:${RZ(this[t])}`);return e}get fields(){let e=[];for(let t of i4)this[t]?.fields&&e.push(...this[t].fields);return e}dependentFields(){let e=new Set(this.fields);for(let t of i4)this[t]&&(this[t].sortField&&e.add(this[t].sortField.field),this[t].sortIndexField&&e.add(this[t].sortIndexField));return e}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){let e={};for(let t of c4){let n=this.childModel.component.scales[t];if(n&&!n.merged){let r=n.get(`type`),i=n.get(`range`);if(D$(r)&&YQ(i)){let n=Z0(Q0(this.childModel,t));n?e[t]=n:Z(i$(t))}}}return e}assembleRowColumnHeaderData(e,t,n){let r={row:`y`,column:`x`,facet:void 0}[e],i=[],a=[],o=[];r&&n&&n[r]&&(t?(i.push(`distinct_${n[r]}`),a.push(`max`)):(i.push(n[r]),a.push(`distinct`)),o.push(`distinct_${n[r]}`));let{sortField:s,sortIndexField:c}=this[e];if(s){let{op:e=Z4,field:t}=s;i.push(t),a.push(e),o.push(d1(s,{forAs:!0}))}else c&&(i.push(c),a.push(`max`),o.push(c));return{name:this[e].name,source:t??this.data,transform:[{type:`aggregate`,groupby:this[e].fields,...i.length?{fields:i,ops:a,as:o}:{}}]}}assembleFacetHeaderData(e){let{columns:t}=this.model.layout,{layoutHeaders:n}=this.model.component,r=[],i={};for(let e of s6){for(let t of c6){let r=n[e]?.[t]??[];for(let t of r)if(t.axes?.length>0){i[e]=!0;break}}if(i[e]){let n=`length(data("${this.facet.name}"))`,i=e===`row`?t?{signal:`ceil(${n} / ${t})`}:1:t?{signal:`min(${n}, ${t})`}:{signal:n};r.push({name:`${this.facet.name}_${e}`,transform:[{type:`sequence`,start:0,stop:i}]})}}let{row:a,column:o}=i;return(a||o)&&r.unshift(this.assembleRowColumnHeaderData(`facet`,null,e)),r}assemble(){let e=[],t=null,n=this.getChildIndependentFieldsWithStep(),{column:r,row:i,facet:a}=this;if(r&&i&&(n.x||n.y)){t=`cross_${this.column.name}_${this.row.name}`;let r=[].concat(n.x??[],n.y??[]),i=r.map(()=>`distinct`);e.push({name:t,source:this.data,transform:[{type:`aggregate`,groupby:this.fields,fields:r,ops:i}]})}for(let r of[v2,_2])this[r]&&e.push(this.assembleRowColumnHeaderData(r,t,n));if(a){let t=this.assembleFacetHeaderData(n);t&&e.push(...t)}return e}},h6=class e extends T3{_parse;clone(){return new e(null,f2(this._parse))}constructor(e,t){super(e),this._parse=t}hash(){return`Parse ${RZ(this._parse)}`}static makeExplicit(e,t,n){let r={},i=t.data;return!i0(i)&&i?.format?.parse&&(r=i.format.parse),this.makeWithAncestors(e,r,{},n)}static makeWithAncestors(t,n,r,i){for(let e of $(r)){let t=i.getWithExplicit(e);t.value!==void 0&&(t.explicit||t.value===r[e]||t.value===`derived`||r[e]===`flatten`?delete r[e]:Z(gAe(e,r[e],t.value)))}for(let e of $(n)){let t=i.get(e);t!==void 0&&(t===n[e]?delete n[e]:Z(gAe(e,n[e],t)))}let a=new C3(n,r);i.copyAll(a);let o={};for(let e of $(a.combine())){let t=a.get(e);t!==null&&(o[e]=t)}return $(o).length===0||i.parseNothing?null:new e(t,o)}get parse(){return this._parse}merge(e){this._parse={...this._parse,...e.parse},e.remove()}assembleFormatParse(){let e={};for(let t of $(this._parse)){let n=this._parse[t];lQ(t)===1&&(e[t]=n)}return e}producedFields(){return new Set($(this._parse))}dependentFields(){return new Set($(this._parse))}assembleTransforms(e=!1){return $(this._parse).filter(t=>!e||lQ(t)>1).map(e=>{let t=MIe(e,this._parse[e]);return t?{type:`formula`,expr:t,as:cQ(e)}:null}).filter(e=>e!==null)}},g6=class e extends T3{clone(){return new e(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([m3])}hash(){return`Identifier`}assemble(){return{type:`identifier`,as:m3}}},_6=class e extends T3{params;clone(){return new e(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${RZ(this.params)}`}assemble(){return{type:`graticule`,...this.params===!0?{}:this.params}}},v6=class e extends T3{params;clone(){return new e(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??`data`])}hash(){return`Hash ${RZ(this.params)}`}assemble(){return{type:`sequence`,...this.params}}},y6=class extends T3{_data;_name;_generator;constructor(e){super(null),e??={name:`source`};let t;if(i0(e)||(t=e.format?{...LZ(e.format,[`parse`])}:{}),r0(e))this._data={values:e.values};else if(n0(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];BZ([`json`,`csv`,`tsv`,`dsv`,`topojson`],n)||(n=`json`),t.type=n}}else TPe(e)?this._data={values:[{type:`Sphere`}]}:(CPe(e)||i0(e))&&(this._data={});this._generator=i0(e),e.name&&(this._name=e.name),t&&!YZ(t)&&(this._data.format=t)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(e){this._name=e}set parent(e){throw Error(`Source nodes have to be roots.`)}remove(){throw Error(`Source nodes are roots and cannot be removed.`)}hash(){throw Error(`Cannot hash sources`)}assemble(){return{name:this._name,...this._data,transform:[]}}},b6=class{#e;constructor(){this.#e=!1}setModified(){this.#e=!0}get modifiedFlag(){return this.#e}},x6=class extends b6{getNodeDepths(e,t,n){n.set(e,t);for(let r of e.children)this.getNodeDepths(r,t+1,n);return n}optimize(e){let t=[...this.getNodeDepths(e,0,new Map).entries()].sort((e,t)=>t[1]-e[1]);for(let e of t)this.run(e[0]);return this.modifiedFlag}},S6=class extends b6{optimize(e){this.run(e);for(let t of e.children)this.optimize(t);return this.modifiedFlag}},gVe=class extends S6{mergeNodes(e,t){let n=t.shift();for(let r of t)e.removeChild(r),r.parent=n,r.remove()}run(e){let t=e.children.map(e=>e.hash()),n={};for(let r=0;r1&&(this.setModified(),this.mergeNodes(e,n[t]))}},_Ve=class extends S6{requiresSelectionId;constructor(e){super(),this.requiresSelectionId=e&&w0(e)}run(e){e instanceof g6&&(this.requiresSelectionId&&(H0(e.parent)||e.parent instanceof p6||e.parent instanceof h6)||(this.setModified(),e.remove()))}},vVe=class extends b6{optimize(e){return this.run(e,new Set),this.modifiedFlag}run(e,t){let n=new Set;e instanceof D3&&(n=e.producedFields(),KZ(n,t)&&(this.setModified(),e.removeFormulas(t),e.producedFields.length===0&&e.remove()));for(let r of e.children)this.run(r,new Set([...t,...n]))}},yVe=class extends S6{constructor(){super()}run(e){e instanceof E3&&!e.isRequired()&&(this.setModified(),e.remove())}},bVe=class extends x6{run(e){if(!H0(e)&&!(e.numChildren()>1)){for(let t of e.children)if(t instanceof h6)if(e instanceof h6)this.setModified(),e.merge(t);else{if(JZ(e.producedFields(),t.dependentFields()))continue;this.setModified(),t.swapWithParent()}}}},xVe=class extends x6{run(e){let t=[...e.children],n=e.children.filter(e=>e instanceof h6);if(e.numChildren()>1&&n.length>=1){let r={},i=new Set;for(let e of n){let t=e.parse;for(let e of $(t))e in r?r[e]!==t[e]&&i.add(e):r[e]=t[e]}for(let e of i)delete r[e];if(!YZ(r)){this.setModified();let n=new h6(e,r);for(let i of t){if(i instanceof h6)for(let e of $(r))delete i.parse[e];e.removeChild(i),i.parent=n,i instanceof h6&&$(i.parse).length===0&&i.remove()}}}}},SVe=class extends x6{run(e){e instanceof E3||e.numChildren()>0||e instanceof m6||e instanceof y6||(this.setModified(),e.remove())}},CVe=class extends x6{run(e){let t=e.children.filter(e=>e instanceof D3),n=t.pop();for(let e of t)this.setModified(),n.merge(e)}},wVe=class extends x6{run(e){let t=e.children.filter(e=>e instanceof p6),n={};for(let e of t){let t=RZ(e.groupBy);t in n||(n[t]=[]),n[t].push(e)}for(let t of $(n)){let r=n[t];if(r.length>1){let t=r.pop();for(let n of r)t.merge(n)&&(e.removeChild(n),n.parent=t,n.remove(),this.setModified())}}}},TVe=class extends x6{model;constructor(e){super(),this.model=e}run(e){let t=!(H0(e)||e instanceof i6||e instanceof h6||e instanceof g6),n=[],r=[];for(let i of e.children)i instanceof f6&&(t&&!JZ(e.producedFields(),i.dependentFields())?n.push(i):r.push(i));if(n.length>0){let t=n.pop();for(let e of n)t.merge(e,this.model.renameSignal.bind(this.model));this.setModified(),e instanceof f6?e.merge(t,this.model.renameSignal.bind(this.model)):t.swapWithParent()}if(r.length>1){let e=r.pop();for(let t of r)e.merge(t,this.model.renameSignal.bind(this.model));this.setModified()}}},EVe=class extends x6{run(e){let t=[...e.children];if(!VZ(t,e=>e instanceof E3)||e.numChildren()<=1)return;let n=[],r;for(let i of t)if(i instanceof E3){let t=i;for(;t.numChildren()===1;){let[e]=t.children;if(e instanceof E3)t=e;else break}n.push(...t.children),r?(e.removeChild(i),i.parent=r.parent,r.parent.removeChild(r),r.parent=t,this.setModified()):r=t}else n.push(i);if(n.length){this.setModified();for(let e of n)e.parent.removeChild(e),e.parent=r}}},C6=class e extends T3{transform;clone(){return new e(null,f2(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=WZ(this.transform.groupby.concat(e),e=>e)}dependentFields(){let e=new Set;return this.transform.groupby&&this.transform.groupby.forEach(e.add,e),this.transform.joinaggregate.map(e=>e.field).filter(e=>e!==void 0).forEach(e.add,e),e}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(e){return e.as??d1(e)}hash(){return`JoinAggregateTransform ${RZ(this.transform)}`}assemble(){let e=[],t=[],n=[];for(let r of this.transform.joinaggregate)t.push(r.op),n.push(this.getDefaultName(r)),e.push(r.field===void 0?null:r.field);let r=this.transform.groupby;return{type:`joinaggregate`,as:n,ops:t,fields:e,...r===void 0?{}:{groupby:r}}}},w6=class e extends T3{filter;clone(){return new e(null,{...this.filter})}constructor(e,t){super(e),this.filter=t}static make(t,n,r){let{config:i,markDef:a}=n,{marks:o,scales:s}=r;if(o===`include-invalid-values`&&s===`include-invalid-values`)return null;let c=n.reduceFieldDef((e,t,r)=>{let o=PQ(r)&&n.getScaleComponent(r);if(o){let n=o.get(`type`),{aggregate:s}=t,c=I$({scaleChannel:r,markDef:a,config:i,scaleType:n,isCountAggregate:zQ(s)});c!==`show`&&c!==`always-valid`&&(e[t.field]=t)}return e},{});return $(c).length?new e(t,c):null}dependentFields(){return new Set($(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${RZ(this.filter)}`}assemble(){let e=$(this.filter).reduce((e,t)=>{let n=this.filter[t],r=d1(n,{expr:`datum`});return n!==null&&(n.type===`temporal`?e.push(`(isDate(${r}) || (${U0(r)}))`):n.type===`quantitative`&&e.push(U0(r))),e},[]);return e.length>0?{type:`filter`,expr:e.join(` && `)}:null}},T6=class e extends T3{_stack;clone(){return new e(null,f2(this._stack))}constructor(e,t){super(e),this._stack=t}static makeFromTransform(t,n){let{stack:r,groupby:i,as:a,offset:o=`zero`}=n,s=[],c=[];if(n.sort!==void 0)for(let e of n.sort)s.push(e.field),c.push(uQ(e.order,`ascending`));let l={field:s,order:c},u;return u=LIe(a)?a:vg(a)?[a,`${a}_end`]:[`${n.stack}_start`,`${n.stack}_end`],new e(t,{dimensionFieldDefs:[],stackField:r,groupby:i,offset:o,sort:l,facetby:[],as:u})}static makeFromEncoding(t,n){let r=n.stack,{encoding:i}=n;if(!r)return null;let{groupbyChannels:a,fieldChannel:o,offset:s,impute:c}=r,l=a.map(e=>{let t=i[e];return _1(t)}).filter(e=>!!e),u=IIe(n),d=n.encoding.order,f;if(W(d)||Q(d))f=Zke(d);else{let e=hMe(d)?d.sort:o===`y`?`descending`:`ascending`;f=u.reduce((t,n)=>(t.field.includes(n)||(t.field.push(n),t.order.push(e)),t),{field:[],order:[]})}return new e(t,{dimensionFieldDefs:l,stackField:n.vgField(o),facetby:[],stackby:u,sort:f,offset:s,impute:c,as:[n.vgField(o,{suffix:`start`,forAs:!0}),n.vgField(o,{suffix:`end`,forAs:!0})]})}get stack(){return this._stack}addDimensions(e){this._stack.facetby.push(...e)}dependentFields(){let e=new Set;return e.add(this._stack.stackField),this.getGroupbyFields().forEach(e.add,e),this._stack.facetby.forEach(e.add,e),this._stack.sort.field.forEach(e.add,e),e}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${RZ(this._stack)}`}getGroupbyFields(){let{dimensionFieldDefs:e,impute:t,groupby:n}=this._stack;return e.length>0?e.map(e=>e.bin?t?[d1(e,{binSuffix:`mid`})]:[d1(e,{}),d1(e,{binSuffix:`end`})]:[d1(e)]).flat():n??[]}assemble(){let e=[],{facetby:t,dimensionFieldDefs:n,stackField:r,stackby:i,sort:a,offset:o,impute:s,as:c}=this._stack;if(s)for(let a of n){let{bandPosition:n=.5,bin:o}=a;if(o){let t=d1(a,{expr:`datum`}),r=d1(a,{expr:`datum`,binSuffix:`end`});e.push({type:`formula`,expr:`${U0(t)} ? ${n}*${t}+${1-n}*${r} : ${t}`,as:d1(a,{binSuffix:`mid`,forAs:!0})})}e.push({type:`impute`,field:r,groupby:[...i,...t],key:d1(a,{binSuffix:`mid`}),method:`value`,value:0})}return e.push({type:`stack`,groupby:[...this.getGroupbyFields(),...t],field:r,sort:a,as:c,offset:o}),e}},E6=class e extends T3{transform;clone(){return new e(null,f2(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=WZ(this.transform.groupby.concat(e),e=>e)}dependentFields(){let e=new Set;return(this.transform.groupby??[]).forEach(e.add,e),(this.transform.sort??[]).forEach(t=>e.add(t.field)),this.transform.window.map(e=>e.field).filter(e=>e!==void 0).forEach(e.add,e),e}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(e){return e.as??d1(e)}hash(){return`WindowTransform ${RZ(this.transform)}`}assemble(){let e=[],t=[],n=[],r=[];for(let i of this.transform.window)t.push(i.op),n.push(this.getDefaultName(i)),r.push(i.param===void 0?null:i.param),e.push(i.field===void 0?null:i.field);let i=this.transform.frame,a=this.transform.groupby;if(i&&i[0]===null&&i[1]===null&&t.every(e=>RQ(e)))return{type:`joinaggregate`,as:n,ops:t,fields:e,...a===void 0?{}:{groupby:a}};let o=[],s=[];if(this.transform.sort!==void 0)for(let e of this.transform.sort)o.push(e.field),s.push(e.order??`ascending`);let c={field:o,order:s},l=this.transform.ignorePeers;return{type:`window`,params:r,as:n,ops:t,fields:e,sort:c,...l===void 0?{}:{ignorePeers:l},...a===void 0?{}:{groupby:a},...i===void 0?{}:{frame:i}}}},D6=`scale_`,O6=5,k6=class e{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}signal;static fromName(t,n){return new e(()=>t(n))}},DVe=[`type`,`clipAngle`,`clipExtent`,`center`,`rotate`,`precision`,`reflectX`,`reflectY`,`coefficient`,`distance`,`fraction`,`lobes`,`parallel`,`radius`,`ratio`,`spacing`,`tilt`],A6=class extends C3{specifiedProjection;size;data;merged=!1;constructor(e,t,n,r){super({...t},{name:e}),this.specifiedProjection=t,this.size=n,this.data=r}get isFit(){return!!this.data}},j6=class extends C3{merged=!1;constructor(e,t){super({},{name:e}),this.setWithExplicit(`type`,t)}domainHasZero(){let e=this.get(`type`);if(BZ([A4.LOG,A4.TIME,A4.UTC],e))return`definitely-not`;let t=this.get(`zero`);if(t===!0||t===void 0&&BZ([A4.LINEAR,A4.SQRT,A4.POW],e))return`definitely`;let n=this.get(`domains`);if(n.length>0){let e=!1,t=!1,r=!1;for(let i of n){if(W(i)){let n=i[0],r=i[i.length-1];if(gg(n)&&gg(r))if(n<=0&&r>=0){e=!0;continue}else{t=!0;continue}}r=!0}if(e)return`definitely`;if(t&&!r)return`definitely-not`}return`maybe`}},OVe=[`range`,`scheme`],M6=.95,N6={bins:({model:e,fieldOrDatumDef:t})=>Q(t)?RLe(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>zLe(e,t.type),nice:({scaleType:e,channel:t,domain:n,domainMin:r,domainMax:i,fieldOrDatumDef:a})=>BLe(e,t,n,r,i,a),padding:({channel:e,scaleType:t,fieldOrDatumDef:n,markDef:r,config:i})=>VLe(e,t,i.scale,n,r,i.bar),paddingInner:({scalePadding:e,channel:t,markDef:n,scaleType:r,config:i,hasNestedOffsetScale:a})=>HLe(e,t,n.type,r,i.scale,a),paddingOuter:({scalePadding:e,channel:t,scaleType:n,scalePaddingInner:r,config:i,hasNestedOffsetScale:a})=>ULe(e,t,n,r,i.scale,a),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:r})=>WLe(t,Q(e)?e.sort:void 0,n,r.scale),zero:({channel:e,fieldOrDatumDef:t,domain:n,markDef:r,scaleType:i,config:a,hasSecondaryRangeChannel:o})=>GLe(e,t,n,r,i,a.scale,o)},kVe=SPe((e,t)=>Fje(e)-Fje(t)),P6=class{nameMap;constructor(){this.nameMap={}}rename(e,t){this.nameMap[e]=t}has(e){return this.nameMap[e]!==void 0}get(e){for(;this.nameMap[e]&&e!==this.nameMap[e];)e=this.nameMap[e];return e}},F6=class{type;parent;config;name;size;title;description;data;transforms;layout;scaleNameMap;projectionNameMap;signalNameMap;component;view;constructor(e,t,n,r,i,a,o){this.type=t,this.parent=n,this.config=i,this.parent=n,this.config=i,this.view=KQ(o),this.name=e.name??r,this.title=qQ(e.title)?{text:e.title}:e.title?KQ(e.title):void 0,this.scaleNameMap=n?n.scaleNameMap:new P6,this.projectionNameMap=n?n.projectionNameMap:new P6,this.signalNameMap=n?n.signalNameMap:new P6,this.data=e.data,this.description=e.description,this.transforms=uPe(e.transform??[]),this.layout=t===`layer`||t===`unit`?{}:fNe(e,t,i),this.component={data:{sources:n?n.component.data.sources:[],outputNodes:n?n.component.data.outputNodes:{},outputNodeRefCounts:n?n.component.data.outputNodeRefCounts:{},isFaceted:X$(e)||n?.component.data.isFaceted&&e.data===void 0},layoutSize:new C3,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...a?f2(a):{}},selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef(`width`)}get height(){return this.getSizeSignalRef(`height`)}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){JLe(this)}parseProjection(){dLe(this)}renameTopLevelLayoutSizeSignal(){this.getName(`width`)!==`width`&&this.renameSignal(this.getName(`width`),`width`),this.getName(`height`)!==`height`&&this.renameSignal(this.getName(`height`),`height`)}parseLegends(){gIe(this)}assembleEncodeFromView(e){let{style:t,...n}=e,r={};for(let e of $(n)){let t=n[e];t!==void 0&&(r[e]=QQ(t))}return r}assembleGroupEncodeEntry(e){let t={};return this.view&&(t=this.assembleEncodeFromView(this.view)),!e&&(this.description&&(t.description=QQ(this.description)),this.type===`unit`||this.type===`layer`)?{width:this.getSizeSignalRef(`width`),height:this.getSizeSignalRef(`height`),...t}:YZ(t)?void 0:t}assembleLayout(){if(!this.layout)return;let{spacing:e,...t}=this.layout,{component:n,config:r}=this,i=qFe(n.layoutHeaders,r);return{padding:e,...this.assembleDefaultLayout(),...t,...i?{titleBand:i}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){let{layoutHeaders:e}=this.component,t=[];for(let n of i4)e[n].title&&t.push(BFe(this,n));for(let e of s6)t=t.concat(UFe(this,e));return t}assembleAxes(){return CFe(this.component.axes,this.config)}assembleLegends(){return oLe(this)}assembleProjections(){return cLe(this)}assembleTitle(){let{encoding:e,...t}=this.title??{},n={...Vke(this.config.title).nonMarkTitleProperties,...t,...e?{encode:{update:e}}:{}};if(n.text)return BZ([`unit`,`layer`],this.type)?BZ([`middle`,void 0],n.anchor)&&(n.frame??=`group`):n.anchor??=`start`,YZ(n)?void 0:n}assembleGroup(e=[]){let t={};e=e.concat(this.assembleSignals()),e.length>0&&(t.signals=e);let n=this.assembleLayout();n&&(t.layout=n),t.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());let r=!this.parent||t2(this.parent)?gLe(this):[];r.length>0&&(t.scales=r);let i=this.assembleAxes();i.length>0&&(t.axes=i);let a=this.assembleLegends();return a.length>0&&(t.legends=a),t}getName(e){return QZ((this.name?`${this.name}_`:``)+e)}getDataName(e){return this.getName(w3[e].toLowerCase())}requestDataName(e){let t=this.getDataName(e),n=this.component.data.outputNodeRefCounts;return n[t]=(n[t]||0)+1,t}getSizeSignalRef(e){if(t2(this.parent)){let t=jQ(ZFe(e)),n=this.component.scales[t];if(n&&!n.merged){let e=n.get(`type`),r=n.get(`range`);if(D$(e)&&YQ(r)){let e=n.get(`name`),r=Z0(Q0(this,t));return r?{signal:XFe(e,n,d1({aggregate:`distinct`,field:r},{expr:`datum`}))}:(Z(i$(t)),null)}}}return{signal:this.signalNameMap.get(this.getName(e))}}lookupDataSource(e){let t=this.component.data.outputNodes[e];return t?t.getSource():e}getSignalName(e){return this.signalNameMap.get(e)}renameSignal(e,t){this.signalNameMap.rename(e,t)}renameScale(e,t){this.scaleNameMap.rename(e,t)}renameProjection(e,t){this.projectionNameMap.rename(e,t)}scaleName(e,t){if(t)return this.getName(e);if(SQ(e)&&PQ(e)&&this.component.scales[e]||this.scaleNameMap.has(this.getName(e)))return this.scaleNameMap.get(this.getName(e))}projectionName(e){if(e)return this.getName(`projection`);if(this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName(`projection`)))return this.projectionNameMap.get(this.getName(`projection`))}getScaleComponent(e){if(!this.component.scales)throw Error(`getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().`);let t=this.component.scales[e];return t&&!t.merged?t:this.parent?this.parent.getScaleComponent(e):void 0}getScaleType(e){let t=this.getScaleComponent(e);return t?t.get(`type`):void 0}getSelectionComponent(e,t){let n=this.component.selection[e];if(!n&&this.parent&&(n=this.parent.getSelectionComponent(e,t)),!n)throw Error(cAe(t));return n}hasAxisOrientSignalRef(){return this.component.axes.x?.some(e=>e.hasOrientSignalRef())||this.component.axes.y?.some(e=>e.hasOrientSignalRef())}},I6=class extends F6{vgField(e,t={}){let n=this.fieldDef(e);if(n)return d1(n,t)}reduceFieldDef(e,t){return HMe(this.getMapping(),(t,n,r)=>{let i=_1(n);return i?e(t,i,r):t},t)}forEachFieldDef(e,t){k1(this.getMapping(),(t,n)=>{let r=_1(t);r&&e(r,n)},t)}},L6=class e extends T3{transform;clone(){return new e(null,f2(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=f2(t);let n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??`value`,n[1]??`density`];let r=this.transform.resolve??`shared`;this.transform.resolve=r}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${RZ(this.transform)}`}assemble(){let{density:e,...t}=this.transform,n={type:`kde`,field:e,...t};return n.resolve=this.transform.resolve,n}},R6=class e extends T3{transform;clone(){return new e(null,f2(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=f2(t)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${RZ(this.transform)}`}assemble(){let{extent:e,param:t}=this.transform;return{type:`extent`,field:e,signal:t}}},z6=class e extends T3{transform;clone(){return new e(this.parent,f2(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=f2(t);let{flatten:n,as:r=[]}=this.transform;this.transform.as=n.map((e,t)=>r[t]??e)}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${RZ(this.transform)}`}assemble(){let{flatten:e,as:t}=this.transform;return{type:`flatten`,fields:e,as:t}}},B6=class e extends T3{transform;clone(){return new e(null,f2(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=f2(t);let n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??`key`,n[1]??`value`]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${RZ(this.transform)}`}assemble(){let{fold:e,as:t}=this.transform;return{type:`fold`,fields:e,as:t}}},V6=class e extends T3{fields;geojson;signal;clone(){return new e(null,f2(this.fields),this.geojson,this.signal)}static parseAll(t,n){if(n.component.projection&&!n.component.projection.isFit)return t;let r=0;for(let i of[[j2,A2],[N2,M2]]){let a=i.map(e=>{let t=v1(n.encoding[e]);return Q(t)?t.field:r1(t)?{expr:`${t.datum}`}:c1(t)?{expr:`${t.value}`}:void 0});(a[0]||a[1])&&(t=new e(t,a,null,n.getName(`geojson_${r++}`)))}if(n.channelHasField(R2)){let i=n.typedFieldDef(R2);i.type===k4&&(t=new e(t,null,i.field,n.getName(`geojson_${r}`)))}return t}constructor(e,t,n,r){super(e),this.fields=t,this.geojson=n,this.signal=r}dependentFields(){let e=(this.fields??[]).filter(vg);return new Set([...this.geojson?[this.geojson]:[],...e])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${RZ(this.fields)}`}assemble(){return[...this.geojson?[{type:`filter`,expr:`isValid(datum["${this.geojson}"])`}]:[],{type:`geojson`,...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}},H6=class e extends T3{projection;fields;as;clone(){return new e(null,this.projection,f2(this.fields),f2(this.as))}constructor(e,t,n,r){super(e),this.projection=t,this.fields=n,this.as=r}static parseAll(t,n){if(!n.projectionName())return t;for(let r of[[j2,A2],[N2,M2]]){let i=r.map(e=>{let t=v1(n.encoding[e]);return Q(t)?t.field:r1(t)?{expr:`${t.datum}`}:c1(t)?{expr:`${t.value}`}:void 0}),a=r[0]===N2?`2`:``;(i[0]||i[1])&&(t=new e(t,n.projectionName(),i,[n.getName(`x${a}`),n.getName(`y${a}`)]))}return t}dependentFields(){return new Set(this.fields.filter(vg))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${RZ(this.fields)} ${RZ(this.as)}`}assemble(){return{type:`geopoint`,projection:this.projection,fields:this.fields,as:this.as}}},U6=class e extends T3{transform;clone(){return new e(null,f2(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(e){let{start:t=0,stop:n,step:r}=e;return{signal:`sequence(${[t,n,...r?[r]:[]].join(`,`)})`}}static makeFromTransform(t,n){return new e(t,n)}static makeFromEncoding(t,n){let r=n.encoding,i=r.x,a=r.y;if(Q(i)&&Q(a)){let o=i.impute?i:a.impute?a:void 0;if(o===void 0)return;let s=i.impute?a:a.impute?i:void 0,{method:c,value:l,frame:u,keyvals:d}=o.impute,f=UMe(n.mark,r);return new e(t,{impute:o.field,key:s.field,...c?{method:c}:{},...l===void 0?{}:{value:l},...u?{frame:u}:{},...d===void 0?{}:{keyvals:d},...f.length?{groupby:f}:{}})}return null}hash(){return`Impute ${RZ(this.transform)}`}assemble(){let{impute:e,key:t,keyvals:n,method:r,groupby:i,value:a,frame:o=[null,null]}=this.transform,s={type:`impute`,field:e,key:t,...n?{keyvals:UNe(n)?this.processSequence(n):n}:{},method:`value`,...i?{groupby:i}:{},value:!r||r===`value`?a:null};return r&&r!==`value`?[s,{type:`window`,as:[`imputed_${e}_value`],ops:[r],fields:[e],frame:o,ignorePeers:!1,...i?{groupby:i}:{}},{type:`formula`,expr:`datum.${e} === null ? datum.imputed_${e}_value : datum.${e}`,as:e}]:[s]}},W6=class e extends T3{transform;clone(){return new e(null,f2(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=f2(t);let n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${RZ(this.transform)}`}assemble(){let{loess:e,on:t,...n}=this.transform;return{type:`loess`,x:t,y:e,...n}}},G6=class e extends T3{transform;secondary;clone(){return new e(null,f2(this.transform),this.secondary)}constructor(e,t,n){super(e),this.transform=t,this.secondary=n}static make(t,n,r,i){let a=n.component.data.sources,{from:o}=r,s=null;if(GNe(o)){let e=dRe(o.data,a);e||(e=new y6(o.data),a.push(e));let t=n.getName(`lookup_${i}`);s=new E3(e,t,w3.Lookup,n.component.data.outputNodeRefCounts),n.component.data.outputNodes[t]=s}else if(KNe(o)){let e=o.param;r={as:e,...r};let t;try{t=n.getSelectionComponent(QZ(e),e)}catch{throw Error(lAe(e))}if(s=t.materialized,!s)throw Error(uAe(e))}return new e(t,r,s.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?Qh(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${RZ({transform:this.transform,secondary:this.secondary})}`}assemble(){let e;if(this.transform.from.fields)e={values:this.transform.from.fields,...this.transform.as?{as:Qh(this.transform.as)}:{}};else{let t=this.transform.as;vg(t)||(Z(Vze),t=`_lookup`),e={as:[t]}}return{type:`lookup`,from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...e,...this.transform.default?{default:this.transform.default}:{}}}},K6=class e extends T3{transform;clone(){return new e(null,f2(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=f2(t);let n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??`prob`,n[1]??`value`]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${RZ(this.transform)}`}assemble(){let{quantile:e,...t}=this.transform;return{type:`quantile`,field:e,...t}}},q6=class e extends T3{transform;clone(){return new e(null,f2(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=f2(t);let n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${RZ(this.transform)}`}assemble(){let{regression:e,on:t,...n}=this.transform;return{type:`regression`,x:t,y:e,...n}}},J6=class e extends T3{transform;clone(){return new e(null,f2(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=WZ((this.transform.groupby??[]).concat(e),e=>e)}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${RZ(this.transform)}`}assemble(){let{pivot:e,value:t,groupby:n,limit:r,op:i}=this.transform;return{type:`pivot`,field:e,value:t,...r===void 0?{}:{limit:r},...i===void 0?{}:{op:i},...n===void 0?{}:{groupby:n}}}},Y6=class e extends T3{transform;clone(){return new e(null,f2(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${RZ(this.transform)}`}assemble(){return{type:`sample`,size:this.transform.sample}}},AVe=class e extends I6{facet;child;children;constructor(e,t,n,r){super(e,`facet`,t,n,r,e.resolve),this.child=d2(e.spec,this,this.getName(`child`),void 0,r),this.children=[this.child],this.facet=this.initFacet(e.facet)}initFacet(e){if(!J$(e))return{facet:this.initFacetFieldDef(e,`facet`)};let t=$(e),n={};for(let r of t){if(![_2,v2].includes(r)){Z(o$(r,`facet`));break}let t=e[r];if(t.field===void 0){Z(a$(t,r));break}n[r]=this.initFacetFieldDef(t,r)}return n}initFacetFieldDef(e,t){let n=b1(e,t);return n.header?n.header=KQ(n.header):n.header===null&&(n.header=null),n}channelHasField(e){return X(this.facet,e)}fieldDef(e){return this.facet[e]}parseData(){this.component.data=s2(this),this.child.parseData()}parseLayoutSize(){i2(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection,p2(this.component.selection).some(e=>T0(e))&&l$(g4)}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),nRe(this)}assembleSelectionTopLevelSignals(e){return this.child.assembleSelectionTopLevelSignals(e)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(e){return this.child.assembleSelectionData(e)}getHeaderLayoutMixins(){let e={};for(let t of i4)for(let n of c6){let r=this.component.layoutHeaders[t],i=r[n],{facetFieldDef:a}=r;if(a){let n=P0(`titleOrient`,a.header,this.config,t);if([`right`,`bottom`].includes(n)){let r=N0(t,n);e.titleAnchor??={},e.titleAnchor[r]=`end`}}if(i?.[0]){let i=t===`row`?`height`:`width`,a=n===`header`?`headerBand`:`footerBand`;t!==`facet`&&!this.child.component.layoutSize.get(i)&&(e[a]??={},e[a][t]=.5),r.title&&(e.offset??={},e.offset[t===`row`?`rowTitle`:`columnTitle`]=10)}}return e}assembleDefaultLayout(){let{column:e,row:t}=this.facet,n=e?this.columnDistinctSignal():t?1:void 0,r=`all`;return(!t&&this.component.resolve.scale.x===`independent`||!e&&this.component.resolve.scale.y===`independent`)&&(r=`none`),{...this.getHeaderLayoutMixins(),...n?{columns:n}:{},bounds:`full`,align:r}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof e))return{signal:`length(data('${this.getName(`column_domain`)}'))`}}assembleGroupStyle(){}assembleGroup(t){return this.parent&&this.parent instanceof e?{...this.channelHasField(`column`)?{encode:{update:{columns:{field:d1(this.facet.column,{prefix:`distinct`})}}}}:{},...super.assembleGroup(t)}:super.assembleGroup(t)}getCardinalityAggregateForChild(){let t=[],n=[],r=[];if(this.child instanceof e){if(this.child.channelHasField(`column`)){let e=d1(this.child.facet.column);t.push(e),n.push(`distinct`),r.push(`distinct_${e}`)}}else for(let e of c4){let i=this.child.component.scales[e];if(i&&!i.merged){let a=i.get(`type`),o=i.get(`range`);if(D$(a)&&YQ(o)){let i=Z0(Q0(this.child,e));i?(t.push(i),n.push(`distinct`),r.push(`distinct_${i}`)):Z(i$(e))}}}return{fields:t,ops:n,as:r}}assembleFacet(){let{name:e,data:t}=this.component.data.facetRoot,{row:n,column:r}=this.facet,{fields:i,ops:a,as:o}=this.getCardinalityAggregateForChild(),s=[];for(let e of i4){let t=this.facet[e];if(t){s.push(d1(t));let{bin:c,sort:l}=t;if(VQ(c)&&s.push(d1(t,{binSuffix:`end`})),q$(l)){let{field:e,op:s=Z4}=l,c=o2(t,l);n&&r?(i.push(c),a.push(`max`),o.push(c)):(i.push(e),a.push(s),o.push(c))}else if(W(l)){let n=M0(t,e);i.push(n),a.push(`max`),o.push(n)}}}let c=!!n&&!!r;return{name:e,data:t,groupby:s,...c||i.length>0?{aggregate:{...c?{cross:c}:{},...i.length?{fields:i,ops:a,as:o}:{}}}:{}}}facetSortFields(e){let{facet:t}=this,n=t[e];return n?q$(n.sort)?[o2(n,n.sort,{expr:`datum`})]:W(n.sort)?[M0(n,e,{expr:`datum`})]:[d1(n,{expr:`datum`})]:[]}facetSortOrder(e){let{facet:t}=this,n=t[e];if(n){let{sort:e}=n;return[(q$(e)?e.order:!W(e)&&e)||`ascending`]}return[]}assembleLabelTitle(){let{facet:e,config:t}=this;if(e.facet)return I0(e.facet,`facet`,t);let n={row:[`top`,`bottom`],column:[`left`,`right`]};for(let r of s6)if(e[r]){let i=P0(`labelOrient`,e[r]?.header,t,r);if(n[r].includes(i))return I0(e[r],r,t)}}assembleMarks(){let{child:e}=this,t=this.component.data.facetRoot,n=$Le(t),r=e.assembleGroupEncodeEntry(!1),i=this.assembleLabelTitle()||e.assembleTitle(),a=e.assembleGroupStyle();return[{name:this.getName(`cell`),type:`group`,...i?{title:i}:{},...a?{style:a}:{},from:{facet:this.assembleFacet()},sort:{field:i4.map(e=>this.facetSortFields(e)).flat(),order:i4.map(e=>this.facetSortOrder(e)).flat()},...n.length>0?{data:n}:{},...r?{encode:{update:r}}:{},...e.assembleGroup(PPe(this,[]))}]}getMapping(){return this.facet}},jVe=class extends F6{children;constructor(e,t,n,r){super(e,`concat`,t,n,r,e.resolve),(e.resolve?.axis?.x===`shared`||e.resolve?.axis?.y===`shared`)&&Z(zze),this.children=this.getChildren(e).map((e,t)=>d2(e,this,this.getName(`concat_${t}`),void 0,r))}parseData(){this.component.data=s2(this);for(let e of this.children)e.parseData()}parseSelections(){this.component.selection={};for(let e of this.children){e.parseSelections();for(let t of $(e.component.selection))this.component.selection[t]=e.component.selection[t]}p2(this.component.selection).some(e=>T0(e))&&l$(g4)}parseMarkGroup(){for(let e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){for(let e of this.children)e.parseAxesAndHeaders()}getChildren(e){return z1(e)?e.vconcat:B1(e)?e.hconcat:e.concat}parseLayoutSize(){sRe(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(e){return this.children.reduce((e,t)=>t.assembleSelectionTopLevelSignals(e),e)}assembleSignals(){return this.children.forEach(e=>e.assembleSignals()),[]}assembleLayoutSignals(){let e=L0(this);for(let t of this.children)e.push(...t.assembleLayoutSignals());return e}assembleSelectionData(e){return this.children.reduce((e,t)=>t.assembleSelectionData(e),e)}assembleMarks(){return this.children.map(e=>{let t=e.assembleTitle(),n=e.assembleGroupStyle(),r=e.assembleGroupEncodeEntry(!1);return{type:`group`,name:e.getName(`group`),...t?{title:t}:{},...n?{style:n}:{},...r?{encode:{update:r}}:{},...e.assembleGroup()}})}assembleGroupStyle(){}assembleDefaultLayout(){let e=this.layout.columns;return{...e==null?{}:{columns:e},bounds:`full`,align:`each`}}},X6=$({disable:1,gridScale:1,scale:1,...r3,labelExpr:1,encode:1}),MVe=class e extends C3{explicit;implicit;mainExtracted;constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new e(f2(this.explicit),f2(this.implicit),this.mainExtracted)}hasAxisPart(e){return e===`axis`?!0:e===`grid`||e===`title`?!!this.get(e):!mRe(this.get(e))}hasOrientSignalRef(){return JQ(this.explicit.orient)}},NVe={bottom:`top`,top:`bottom`,left:`right`,right:`left`},PVe=new Set([`grid`,`translate`,`format`,`formatType`,`orient`,`labelExpr`,`tickCount`,`position`,`tickMinStep`]),FVe={vgMark:`arc`,encodeEntry:e=>({...x0(e,{align:`ignore`,baseline:`ignore`,color:`include`,size:`ignore`,orient:`ignore`,theta:`ignore`}),...g0(`x`,e,{defaultPos:`mid`}),...g0(`y`,e,{defaultPos:`mid`}),...b0(e,`radius`),...b0(e,`theta`)})},IVe={vgMark:`area`,encodeEntry:e=>({...x0(e,{align:`ignore`,baseline:`ignore`,color:`include`,orient:`include`,size:`ignore`,theta:`ignore`}),...v0(`x`,e,{defaultPos:`zeroOrMin`,defaultPos2:`zeroOrMin`,range:e.markDef.orient===`horizontal`}),...v0(`y`,e,{defaultPos:`zeroOrMin`,defaultPos2:`zeroOrMin`,range:e.markDef.orient===`vertical`}),...S0(e)})},LVe={vgMark:`rect`,encodeEntry:e=>({...x0(e,{align:`ignore`,baseline:`ignore`,color:`include`,orient:`ignore`,size:`ignore`,theta:`ignore`}),...b0(e,`x`),...b0(e,`y`)})},Z6={vgMark:`shape`,encodeEntry:e=>({...x0(e,{align:`ignore`,baseline:`ignore`,color:`include`,size:`ignore`,orient:`ignore`,theta:`ignore`})}),postEncodingTransform:e=>{let{encoding:t}=e,n=t.shape;return[{type:`geoshape`,projection:e.projectionName(),...n&&Q(n)&&n.type===k4?{field:d1(n,{expr:`datum`})}:{}}]}},RVe={vgMark:`image`,encodeEntry:e=>({...x0(e,{align:`ignore`,baseline:`ignore`,color:`ignore`,orient:`ignore`,size:`ignore`,theta:`ignore`}),...b0(e,`x`),...b0(e,`y`),...f0(e,`url`)})},zVe={vgMark:`line`,encodeEntry:e=>({...x0(e,{align:`ignore`,baseline:`ignore`,color:`include`,size:`ignore`,orient:`ignore`,theta:`ignore`}),...g0(`x`,e,{defaultPos:`mid`}),...g0(`y`,e,{defaultPos:`mid`}),...m0(`size`,e,{vgChannel:`strokeWidth`}),...S0(e)})},BVe={vgMark:`trail`,encodeEntry:e=>({...x0(e,{align:`ignore`,baseline:`ignore`,color:`include`,size:`include`,orient:`ignore`,theta:`ignore`}),...g0(`x`,e,{defaultPos:`mid`}),...g0(`y`,e,{defaultPos:`mid`}),...m0(`size`,e),...S0(e)})},VVe={vgMark:`symbol`,encodeEntry:e=>l2(e)},HVe={vgMark:`symbol`,encodeEntry:e=>l2(e,`circle`)},UVe={vgMark:`symbol`,encodeEntry:e=>l2(e,`square`)},WVe={vgMark:`rect`,encodeEntry:e=>({...x0(e,{align:`ignore`,baseline:`ignore`,color:`include`,orient:`ignore`,size:`ignore`,theta:`ignore`}),...b0(e,`x`),...b0(e,`y`)})},GVe={vgMark:`rule`,encodeEntry:e=>{let{markDef:t}=e,n=t.orient;return!e.encoding.x&&!e.encoding.y&&!e.encoding.latitude&&!e.encoding.longitude?{}:{...x0(e,{align:`ignore`,baseline:`ignore`,color:`include`,orient:`ignore`,size:`ignore`,theta:`ignore`}),...v0(`x`,e,{defaultPos:n===`horizontal`?`zeroOrMax`:`mid`,defaultPos2:`zeroOrMin`,range:n!==`vertical`}),...v0(`y`,e,{defaultPos:n===`vertical`?`zeroOrMax`:`mid`,defaultPos2:`zeroOrMin`,range:n!==`horizontal`}),...m0(`size`,e,{vgChannel:`strokeWidth`})}}},KVe={vgMark:`text`,encodeEntry:e=>{let{config:t,encoding:n}=e;return{...x0(e,{align:`include`,baseline:`include`,color:`include`,size:`ignore`,orient:`ignore`,theta:`include`}),...g0(`x`,e,{defaultPos:`mid`}),...g0(`y`,e,{defaultPos:`mid`}),...f0(e),...m0(`size`,e,{vgChannel:`fontSize`}),...m0(`angle`,e),...lFe(`align`,wRe(e.markDef,n,t)),...lFe(`baseline`,TRe(e.markDef,n,t)),...g0(`radius`,e,{defaultPos:null}),...g0(`theta`,e,{defaultPos:null})}}},Q6={arc:FVe,area:IVe,bar:LVe,circle:HVe,geoshape:Z6,image:RVe,line:zVe,point:VVe,rect:WVe,rule:GVe,square:UVe,text:KVe,tick:{vgMark:`rect`,encodeEntry:e=>{let{config:t,markDef:n}=e,r=n.orient,i=r===`horizontal`?`x`:`y`,a=r===`horizontal`?`y`:`x`,o=r===`horizontal`?`height`:`width`;return{...x0(e,{align:`ignore`,baseline:`ignore`,color:`include`,orient:`ignore`,size:`ignore`,theta:`ignore`}),...b0(e,i),...g0(a,e,{defaultPos:`mid`,vgChannel:a===`y`?`yc`:`xc`}),[o]:QQ(e$(`thickness`,n,t))}}},trail:BVe},$6=`faceted_path_`,e8=`stack_group_`,t8=class extends I6{markDef;encoding;specifiedScales={};stack;specifiedAxes={};specifiedLegends={};specifiedProjection={};selection=[];children=[];constructor(e,t,n,r={},i){super(e,`unit`,t,n,i,void 0,dNe(e)?e.view:void 0);let a=P$(e.mark)?{...e.mark}:{type:e.mark},o=a.type;a.filled===void 0&&(a.filled=jNe(a,i,{graticule:e.data&&a0(e.data)}));let s=this.encoding=BMe(e.encoding||{},o,a.filled,i);this.markDef=ONe(a,s,i),this.size=SRe({encoding:s,size:dNe(e)?{...r,...e.width===void 0?{}:{width:e.width},...e.height===void 0?{}:{height:e.height}}:r}),this.stack=DNe(this.markDef,s),this.specifiedScales=this.initScales(o,s),this.specifiedAxes=this.initAxes(s),this.specifiedLegends=this.initLegends(s),this.specifiedProjection=e.projection,this.selection=(e.params??[]).filter(e=>L1(e)),this.alignStackOrderWithColorDomain()}get hasProjection(){let{encoding:e}=this,t=this.mark===K4,n=e&&RRe.some(t=>o1(e[t]));return t||n}scaleDomain(e){let t=this.specifiedScales[e];return t?t.domain:void 0}axis(e){return this.specifiedAxes[e]}legend(e){return this.specifiedLegends[e]}initScales(e,t){return p4.reduce((e,n)=>{let r=v1(t[n]);return r&&(e[n]=this.initScale(r.scale??{})),e},{})}initScale(e){let{domain:t,range:n}=e,r=KQ(e);return W(t)&&(r.domain=t.map(ZQ)),W(n)&&(r.range=n.map(ZQ)),r}initAxes(e){return c4.reduce((t,n)=>{let r=e[n];if(o1(r)||n===b2&&o1(e.x2)||n===x2&&o1(e.y2)){let e=o1(r)?r.axis:void 0;t[n]=e&&this.initAxis({...e})}return t},{})}initAxis(e){let t=$(e),n={};for(let r of t){let t=e[r];n[r]=T1(t)?Wke(t):ZQ(t)}return n}initLegends(e){return xze.reduce((t,n)=>{let r=v1(e[n]);if(r&&Ike(n)){let e=r.legend;t[n]=e&&KQ(e)}return t},{})}alignStackOrderWithColorDomain(){let{color:e,fill:t,order:n,xOffset:r,yOffset:i}=this.encoding,a=t||e,o=Q(a)?a:void 0,s=o?.field,c=o?.scale,l=o?.type,u=c?.domain,d=r||i,f=Q(d)?d:void 0,p=`_${s}_sort_index`;if(!n&&Array.isArray(u)&&typeof s==`string`&&l===`nominal`)if(f&&!f.sort)f.sort=u;else{if(!this.stack)return;let e=`indexof(${G(u)}, datum['${s}'])`,t=this.markDef?.orient===`horizontal`?`ascending`:`descending`;this.transforms.push({calculate:e,as:p}),this.encoding.order={field:p,type:`quantitative`,sort:t}}}parseData(){this.component.data=s2(this)}parseLayoutSize(){cRe(this)}parseSelections(){this.component.selection=_Fe(this,this.selection)}parseMarkGroup(){this.component.mark=ERe(this)}parseAxesAndHeaders(){this.component.axes=gRe(this)}assembleSelectionTopLevelSignals(e){return FPe(this,e)}assembleSignals(){return[...SFe(this),...NPe(this,[])]}assembleSelectionData(e){return IPe(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return L0(this)}correctDataNames=e=>(e.from?.data&&(e.from.data=this.lookupDataSource(e.from.data),`time`in this.encoding&&(e.from.data=e.from.data+j3)),e.from?.facet?.data&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e);assembleMarks(){let e=this.component.mark??[];return(!this.parent||!r2(this.parent))&&(e=LPe(this,e)),e.map(this.correctDataNames)}assembleGroupStyle(){let{style:e}=this.view||{};return e===void 0?this.encoding.x||this.encoding.y?`cell`:`view`:e}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return D1(this.encoding,e)}fieldDef(e){let t=this.encoding[e];return _1(t)}typedFieldDef(e){let t=this.fieldDef(e);return s1(t)?t:null}},qVe=class e extends F6{children;constructor(t,n,r,i,a){super(t,`layer`,n,r,a,t.resolve,t.view);let o={...i,...t.width?{width:t.width}:{},...t.height?{height:t.height}:{}};this.children=t.layer.map((t,n)=>{if(G1(t))return new e(t,this,this.getName(`layer_${n}`),o,a);if(E1(t))return new t8(t,this,this.getName(`layer_${n}`),o,a);throw Error(r$(t))})}parseData(){this.component.data=s2(this);for(let e of this.children)e.parseData()}parseLayoutSize(){oRe(this)}parseSelections(){this.component.selection={};for(let e of this.children){e.parseSelections();for(let t of $(e.component.selection))this.component.selection[t]=e.component.selection[t]}p2(this.component.selection).some(e=>T0(e))&&l$(g4)}parseMarkGroup(){for(let e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){_Re(this)}assembleSelectionTopLevelSignals(e){return this.children.reduce((e,t)=>t.assembleSelectionTopLevelSignals(e),e)}assembleSignals(){return this.children.reduce((e,t)=>e.concat(t.assembleSignals()),SFe(this))}assembleLayoutSignals(){return this.children.reduce((e,t)=>e.concat(t.assembleLayoutSignals()),L0(this))}assembleSelectionData(e){return this.children.reduce((e,t)=>t.assembleSelectionData(e),e)}assembleGroupStyle(){let e=new Set;for(let t of this.children)for(let n of Qh(t.assembleGroupStyle()))e.add(n);let t=Array.from(e);return t.length>1?t:t.length===1?t[0]:void 0}assembleTitle(){let e=super.assembleTitle();if(e)return e;for(let t of this.children)if(e=t.assembleTitle(),e)return e}assembleLayout(){return null}assembleMarks(){return RPe(this,this.children.flatMap(e=>e.assembleMarks()))}assembleLegends(){return this.children.reduce((e,t)=>e.concat(t.assembleLegends()),oLe(this))}},JVe=IRe.version}));function XVe(e){let[t,n]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:n}}var ZVe=o((()=>{})),QVe=c({carbong10:()=>jHe,carbong100:()=>NHe,carbong90:()=>MHe,carbonwhite:()=>AHe,dark:()=>eHe,excel:()=>tHe,fivethirtyeight:()=>iHe,ggplot2:()=>aHe,googlecharts:()=>_He,latimes:()=>lHe,powerbi:()=>EHe,quartz:()=>uHe,urbaninstitute:()=>gHe,version:()=>PHe,vox:()=>dHe});function n8({theme:e,background:t}){let n=[`white`,`g10`].includes(e)?`light`:`dark`,r=W8.gridBg[e],i=W8.textPrimary[e],a=W8.textSecondary[e],o=n===`dark`?OHe:kHe,s=n===`dark`?`#d4bbff`:`#6929c4`;return{background:t,arc:{fill:s},area:{fill:s},path:{stroke:s},rect:{fill:s},shape:{stroke:s},symbol:{stroke:s},circle:{fill:s},view:{fill:r,stroke:r},group:{fill:r},title:{color:i,anchor:`start`,dy:-15,fontSize:16,font:H8,fontWeight:600},axis:{labelColor:a,labelFontSize:12,labelFont:DHe,labelFontWeight:U8,titleColor:i,titleFontWeight:600,titleFontSize:12,grid:!0,gridColor:W8.layerAccent01[e],labelAngle:0},axisX:{titlePadding:10},axisY:{titlePadding:2.5},style:{"guide-label":{font:H8,fill:a,fontWeight:U8},"guide-title":{font:H8,fill:a,fontWeight:U8}},range:{category:o,diverging:[`#750e13`,`#a2191f`,`#da1e28`,`#fa4d56`,`#ff8389`,`#ffb3b8`,`#ffd7d9`,`#fff1f1`,`#e5f6ff`,`#bae6ff`,`#82cfff`,`#33b1ff`,`#1192e8`,`#0072c3`,`#00539a`,`#003a6d`],heatmap:[`#f6f2ff`,`#e8daff`,`#d4bbff`,`#be95ff`,`#a56eff`,`#8a3ffc`,`#6929c4`,`#491d8b`,`#31135e`,`#1c0f30`]}}}var $Ve,r8,i8,eHe,a8,tHe,o8,s8,nHe,rHe,c8,l8,iHe,u8,aHe,oHe,sHe,d8,f8,cHe,p8,m8,h8,g8,_8,lHe,v8,y8,uHe,b8,dHe,x8,S8,fHe,C8,w8,pHe,mHe,hHe,T8,gHe,E8,D8,O8,_He,k8,A8,j8,M8,N8,P8,F8,I8,L8,vHe,R8,yHe,bHe,xHe,SHe,CHe,wHe,THe,z8,B8,V8,EHe,H8,DHe,U8,W8,OHe,kHe,AHe,jHe,MHe,NHe,PHe,FHe=o((()=>{$Ve={version:`3.0.0`},r8=`#fff`,i8=`#888`,eHe={background:`#333`,view:{stroke:i8},title:{color:r8,subtitleColor:r8},style:{"guide-label":{fill:r8},"guide-title":{fill:r8}},axis:{domainColor:r8,gridColor:i8,tickColor:r8}},a8=`#4572a7`,tHe={background:`#fff`,arc:{fill:a8},area:{fill:a8},line:{stroke:a8,strokeWidth:2},path:{stroke:a8},rect:{fill:a8},shape:{stroke:a8},symbol:{fill:a8,strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:`#000000`,gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:`middle`,labelFontSize:11,symbolSize:50,symbolType:`square`},range:{category:[`#4572a7`,`#aa4643`,`#8aa453`,`#71598e`,`#4598ae`,`#d98445`,`#94aace`,`#d09393`,`#b9cc98`,`#a99cbc`]}},o8=`#30a2da`,s8=`#cbcbcb`,nHe=`#999`,rHe=`#333`,c8=`#f0f0f0`,l8=`#333`,iHe={arc:{fill:o8},area:{fill:o8},axis:{domainColor:s8,grid:!0,gridColor:s8,gridWidth:1,labelColor:nHe,labelFontSize:10,titleColor:rHe,tickColor:s8,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:c8,group:{fill:c8},legend:{labelColor:l8,labelFontSize:11,padding:1,symbolSize:30,symbolType:`square`,titleColor:l8,titleFontSize:14,titlePadding:10},line:{stroke:o8,strokeWidth:2},path:{stroke:o8,strokeWidth:.5},rect:{fill:o8},range:{category:[`#30a2da`,`#fc4f30`,`#e5ae38`,`#6d904f`,`#8b8b8b`,`#b96db8`,`#ff9e27`,`#56cc60`,`#52d2ca`,`#52689e`,`#545454`,`#9fe4f8`],diverging:[`#cc0020`,`#e77866`,`#f6e7e1`,`#d6e8ed`,`#91bfd9`,`#1d78b5`],heatmap:[`#d6e8ed`,`#cee0e5`,`#91bfd9`,`#549cc6`,`#1d78b5`]},point:{filled:!0,shape:`circle`},shape:{stroke:o8},bar:{binSpacing:2,fill:o8,stroke:null},title:{anchor:`start`,fontSize:24,fontWeight:600,offset:20}},u8=`#000`,aHe={group:{fill:`#e5e5e5`},arc:{fill:u8},area:{fill:u8},line:{stroke:u8},path:{stroke:u8},rect:{fill:u8},shape:{stroke:u8},symbol:{fill:u8,size:40},axis:{domain:!1,grid:!0,gridColor:`#FFFFFF`,gridOpacity:1,labelColor:`#7F7F7F`,labelPadding:4,tickColor:`#7F7F7F`,tickSize:5.67,titleFontSize:16,titleFontWeight:`normal`},legend:{labelBaseline:`middle`,labelFontSize:11,symbolSize:40},range:{category:[`#000000`,`#7F7F7F`,`#1A1A1A`,`#999999`,`#333333`,`#B0B0B0`,`#4D4D4D`,`#C9C9C9`,`#666666`,`#DCDCDC`]}},oHe=22,sHe=`normal`,d8=`Benton Gothic, sans-serif`,f8=11.5,cHe=`normal`,p8=`#82c6df`,m8=`Benton Gothic Bold, sans-serif`,h8=`normal`,g8=13,_8={"category-6":[`#ec8431`,`#829eb1`,`#c89d29`,`#3580b1`,`#adc839`,`#ab7fb4`],"fire-7":[`#fbf2c7`,`#f9e39c`,`#f8d36e`,`#f4bb6a`,`#e68a4f`,`#d15a40`,`#ab4232`],"fireandice-6":[`#e68a4f`,`#f4bb6a`,`#f9e39c`,`#dadfe2`,`#a6b7c6`,`#849eae`]},lHe={background:`#ffffff`,title:{anchor:`start`,color:`#000000`,font:m8,fontSize:oHe,fontWeight:sHe},arc:{fill:p8},area:{fill:p8},line:{stroke:p8,strokeWidth:2},path:{stroke:p8},rect:{fill:p8},shape:{stroke:p8},symbol:{fill:p8,size:30},axis:{labelFont:d8,labelFontSize:f8,labelFontWeight:cHe,titleFont:m8,titleFontSize:g8,titleFontWeight:h8},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:`middle`,maxExtent:45,minExtent:45,tickSize:2,titleAlign:`left`,titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:d8,labelFontSize:f8,symbolType:`square`,titleFont:m8,titleFontSize:g8,titleFontWeight:h8},range:{category:_8[`category-6`],diverging:_8[`fireandice-6`],heatmap:_8[`fire-7`],ordinal:_8[`fire-7`],ramp:_8[`fire-7`]}},v8=`#ab5787`,y8=`#979797`,uHe={background:`#f9f9f9`,arc:{fill:v8},area:{fill:v8},line:{stroke:v8},path:{stroke:v8},rect:{fill:v8},shape:{stroke:v8},symbol:{fill:v8,size:30},axis:{domainColor:y8,domainWidth:.5,gridWidth:.2,labelColor:y8,tickColor:y8,tickWidth:.2,titleColor:y8},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:`square`},range:{category:[`#ab5787`,`#51b2e5`,`#703c5c`,`#168dd9`,`#d190b6`,`#00609f`,`#d365ba`,`#154866`,`#666666`,`#c4c4c4`]}},b8=`#3e5c69`,dHe={background:`#fff`,arc:{fill:b8},area:{fill:b8},line:{stroke:b8},path:{stroke:b8},rect:{fill:b8},shape:{stroke:b8},symbol:{fill:b8},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:`normal`},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:`square`},range:{category:[`#3e5c69`,`#6793a6`,`#182429`,`#0570b0`,`#3690c0`,`#74a9cf`,`#a6bddb`,`#e2ddf2`]}},x8=`#1696d2`,S8=`#000000`,fHe=`#FFFFFF`,C8=`Lato`,w8=`Lato`,pHe=`Lato`,mHe=`#DEDDDD`,hHe=18,T8={"shades-blue":[`#CFE8F3`,`#A2D4EC`,`#73BFE2`,`#46ABDB`,`#1696D2`,`#12719E`,`#0A4C6A`,`#062635`],"six-groups-cat-1":[`#1696d2`,`#ec008b`,`#fdbf11`,`#000000`,`#d2d2d2`,`#55b748`],"six-groups-seq":[`#cfe8f3`,`#a2d4ec`,`#73bfe2`,`#46abdb`,`#1696d2`,`#12719e`],"diverging-colors":[`#ca5800`,`#fdbf11`,`#fdd870`,`#fff2cf`,`#cfe8f3`,`#73bfe2`,`#1696d2`,`#0a4c6a`]},gHe={background:fHe,title:{anchor:`start`,fontSize:hHe,font:C8},axisX:{domain:!0,domainColor:S8,domainWidth:1,grid:!1,labelFontSize:12,labelFont:w8,labelAngle:0,tickColor:S8,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:C8},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:mHe,gridWidth:1,labelFontSize:12,labelFont:w8,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:C8,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:w8,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:C8,orient:`right`,offset:10},view:{stroke:`transparent`},range:{category:T8[`six-groups-cat-1`],diverging:T8[`diverging-colors`],heatmap:T8[`diverging-colors`],ordinal:T8[`six-groups-seq`],ramp:T8[`shades-blue`]},area:{fill:x8},rect:{fill:x8},line:{color:x8,stroke:x8,strokeWidth:5},trail:{color:x8,stroke:x8,strokeWidth:0,size:1},path:{stroke:x8,strokeWidth:.5},point:{filled:!0},text:{font:pHe,color:x8,fontSize:11,align:`center`,fontWeight:400,size:11},style:{bar:{fill:x8,stroke:null}},arc:{fill:x8},shape:{stroke:x8},symbol:{fill:x8,size:30}},E8=`#3366CC`,D8=`#ccc`,O8=`Arial, sans-serif`,_He={arc:{fill:E8},area:{fill:E8},path:{stroke:E8},rect:{fill:E8},shape:{stroke:E8},symbol:{stroke:E8},circle:{fill:E8},background:`#fff`,padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:O8,fontSize:12},"guide-title":{font:O8,fontSize:12},"group-title":{font:O8,fontSize:12}},title:{font:O8,fontSize:14,fontWeight:`bold`,dy:-3,anchor:`start`},axis:{gridColor:D8,tickColor:D8,domain:!1,grid:!0},range:{category:[`#4285F4`,`#DB4437`,`#F4B400`,`#0F9D58`,`#AB47BC`,`#00ACC1`,`#FF7043`,`#9E9D24`,`#5C6BC0`,`#F06292`,`#00796B`,`#C2185B`],heatmap:[`#c6dafc`,`#5e97f6`,`#2a56c6`]}},k8=e=>e*1.3333333333333333,A8=k8(9),j8=k8(10),M8=k8(12),N8=`Segoe UI`,P8=`wf_standard-font, helvetica, arial, sans-serif`,F8=`#252423`,I8=`#605E5C`,L8=`transparent`,vHe=`#C8C6C4`,R8=`#118DFF`,yHe=`#12239E`,bHe=`#E66C37`,xHe=`#6B007B`,SHe=`#E044A7`,CHe=`#744EC2`,wHe=`#D9B300`,THe=`#D64550`,z8=R8,B8=`#DEEFFF`,V8=[B8,z8],EHe={view:{stroke:L8},background:L8,font:N8,header:{titleFont:P8,titleFontSize:M8,titleColor:F8,labelFont:N8,labelFontSize:j8,labelColor:I8},axis:{ticks:!1,grid:!1,domain:!1,labelColor:I8,labelFontSize:A8,titleFont:P8,titleColor:F8,titleFontSize:M8,titleFontWeight:`normal`},axisQuantitative:{tickCount:3,grid:!0,gridColor:vHe,gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:R8},line:{stroke:R8,strokeWidth:3,strokeCap:`round`,strokeJoin:`round`},text:{font:N8,fontSize:A8,fill:I8},arc:{fill:R8},area:{fill:R8,line:!0,opacity:.6},path:{stroke:R8},rect:{fill:R8},point:{fill:R8,filled:!0,size:75},shape:{stroke:R8},symbol:{fill:R8,strokeWidth:1.5,size:50},legend:{titleFont:N8,titleFontWeight:`bold`,titleColor:I8,labelFont:N8,labelFontSize:j8,labelColor:I8,symbolType:`circle`,symbolSize:75},range:{category:[R8,yHe,bHe,xHe,SHe,CHe,wHe,THe],diverging:V8,heatmap:V8,ordinal:[B8,`#c7e4ff`,`#b0d9ff`,`#9aceff`,`#83c3ff`,`#6cb9ff`,`#55aeff`,`#3fa3ff`,`#2898ff`,z8]}},H8=`IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif`,DHe=`IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", sans-serif`,U8=400,W8={textPrimary:{g90:`#f4f4f4`,g100:`#f4f4f4`,white:`#161616`,g10:`#161616`},textSecondary:{g90:`#c6c6c6`,g100:`#c6c6c6`,white:`#525252`,g10:`#525252`},layerAccent01:{white:`#e0e0e0`,g10:`#e0e0e0`,g90:`#525252`,g100:`#393939`},gridBg:{white:`#ffffff`,g10:`#ffffff`,g90:`#161616`,g100:`#161616`}},OHe=[`#8a3ffc`,`#33b1ff`,`#007d79`,`#ff7eb6`,`#fa4d56`,`#fff1f1`,`#6fdc8c`,`#4589ff`,`#d12771`,`#d2a106`,`#08bdba`,`#bae6ff`,`#ba4e00`,`#d4bbff`],kHe=[`#6929c4`,`#1192e8`,`#005d5d`,`#9f1853`,`#fa4d56`,`#570408`,`#198038`,`#002d9c`,`#ee538b`,`#b28600`,`#009d9a`,`#012749`,`#8a3800`,`#a56eff`],AHe=n8({theme:`white`,background:`#ffffff`}),jHe=n8({theme:`g10`,background:`#f4f4f4`}),MHe=n8({theme:`g90`,background:`#262626`}),NHe=n8({theme:`g100`,background:`#161616`}),PHe=$Ve.version}));function IHe(e,t,n,r){if(W(e))return`[${e.map(e=>t(vg(e)?e:RHe(e,n))).join(`, `)}]`;if(jh(e)){let i=``,{title:a,image:o,...s}=e;a&&(i+=`

${t(a)}

`),o&&(i+=``);let c=Object.keys(s);if(c.length>0){i+=``;for(let e of c){let r=s[e];r!==void 0&&(jh(r)&&(r=RHe(r,n)),i+=``)}i+=`
${t(e)}${t(r)}
`}return i||`{}`}return t(e)}function LHe(e){let t=[];return function(n,r){if(typeof r!=`object`||!r)return r;let i=t.indexOf(this)+1;return t.length=i,t.length>e?`[Object]`:t.indexOf(r)>=0?`[Circular]`:(t.push(r),r)}}function RHe(e,t){return JSON.stringify(e,LHe(t))}function zHe(e){return String(e).replace(/&/g,`&`).replace(/=0&&e.y>=0&&e.x+t.width<=window.innerWidth&&e.y+t.height<=window.innerHeight}function KHe(e,t,n){return e.clientX>=t.x&&e.clientX<=t.x+n.width&&e.clientY>=t.y&&e.clientY<=t.y+n.height}var qHe,JHe,G8,YHe,XHe,ZHe=o((()=>{Dg(),qHe={version:`1.0.0`},JHe=`#vg-tooltip-element { visibility: hidden; padding: 8px; position: fixed; @@ -255,8 +255,8 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`

An error #vg-tooltip-element.dark-theme td.key { color: #bfbfbf; } -`,q8=`vg-tooltip-element`,KHe={offsetX:10,offsetY:10,id:q8,styleId:`vega-tooltip-style`,theme:`light`,disableDefaultStyle:!1,sanitize:IHe,maxDepth:2,formatTooltip:NHe,baseURL:``,anchor:`cursor`,position:[`top`,`bottom`,`left`,`right`,`top-left`,`top-right`,`bottom-left`,`bottom-right`]},qHe=class{call;options;el;constructor(e){this.options={...KHe,...e};let t=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){let e=document.createElement(`style`);e.setAttribute(`id`,this.options.styleId),e.innerHTML=LHe(t);let n=document.head;n.childNodes.length>0?n.insertBefore(e,n.childNodes[0]):n.appendChild(e)}}tooltipHandler(e,t,n,r){if(this.el=document.getElementById(this.options.id),this.el||(this.el=document.createElement(`div`),this.el.setAttribute(`id`,this.options.id),this.el.classList.add(`vg-tooltip`),(document.fullscreenElement??document.body).appendChild(this.el)),r==null||r===``){this.el.classList.remove(`visible`,`${this.options.theme}-theme`);return}this.el.innerHTML=this.options.formatTooltip(r,this.options.sanitize,this.options.maxDepth,this.options.baseURL),this.el.classList.add(`visible`,`${this.options.theme}-theme`);let{x:i,y:a}=this.options.anchor===`mark`?zHe(e,t,n,this.el.getBoundingClientRect(),this.options):RHe(t,this.el.getBoundingClientRect(),this.options);this.el.style.top=`${a}px`,this.el.style.left=`${i}px`}},WHe.version}));function J8(e,t){return MUe.call(e,t)}function Y8(e){if(Array.isArray(e)){for(var t=Array(e.length),n=0;n=48&&r<=57){t++;continue}return!1}return!0}function Q8(e){return e.indexOf(`/`)===-1&&e.indexOf(`~`)===-1?e:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function YHe(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function $8(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,n=e.length;t0&&s[l-1]==`constructor`))throw TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&d===void 0&&(c[f]===void 0?d=s.slice(0,l).join(`/`):l==u-1&&(d=t.path),d!==void 0&&p(t,0,e,d)),l++,Array.isArray(c)){if(f===`-`)f=c.length;else if(n&&!Z8(f))throw new m5(`Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index`,`OPERATION_PATH_ILLEGAL_ARRAY_INDEX`,a,t,e);else Z8(f)&&(f=~~f);if(l>=u){if(n&&t.op===`add`&&f>c.length)throw new m5(`The specified index MUST NOT be greater than the number of elements in the array`,`OPERATION_VALUE_OUT_OF_BOUNDS`,a,t,e);var o=PUe[t.op].call(t,c,f,e);if(o.test===!1)throw new m5(`Test operation failed`,`TEST_OPERATION_FAILED`,a,t,e);return o}}else if(l>=u){var o=h5[t.op].call(t,c,f,e);if(o.test===!1)throw new m5(`Test operation failed`,`TEST_OPERATION_FAILED`,a,t,e);return o}if(c=c[f],n&&l0)throw new m5('Operation `path` property must start with "/"',`OPERATION_PATH_INVALID`,t,e,n);if((e.op===`move`||e.op===`copy`)&&typeof e.from!=`string`)throw new m5("Operation `from` property is not present (applicable in `move` and `copy` operations)",`OPERATION_FROM_REQUIRED`,t,e,n);if((e.op===`add`||e.op===`replace`||e.op===`test`)&&e.value===void 0)throw new m5("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)",`OPERATION_VALUE_REQUIRED`,t,e,n);if((e.op===`add`||e.op===`replace`||e.op===`test`)&&$8(e.value))throw new m5("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)",`OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED`,t,e,n);if(n){if(e.op==`add`){var i=e.path.split(`/`).length,a=r.split(`/`).length;if(i!==a+1&&i!==a)throw new m5("Cannot perform an `add` operation at the desired path",`OPERATION_PATH_CANNOT_ADD`,t,e,n)}else if(e.op===`replace`||e.op===`remove`||e.op===`_get`){if(e.path!==r)throw new m5(`Cannot perform the operation at a path that does not exist`,`OPERATION_PATH_UNRESOLVABLE`,t,e,n)}else if(e.op===`move`||e.op===`copy`){var o=QHe([{op:`_get`,path:e.from,value:void 0}],n);if(o&&o.name===`OPERATION_PATH_UNRESOLVABLE`)throw new m5(`Cannot perform the operation from a path that does not exist`,`OPERATION_FROM_UNRESOLVABLE`,t,e,n)}}}function QHe(e,t,n){try{if(!Array.isArray(e))throw new m5(`Patch sequence must be an array`,`SEQUENCE_NOT_AN_ARRAY`);if(t)n5(X8(t),X8(e),n||!0);else{n||=r5;for(var r=0;r0&&(e.patches=[],e.callback&&e.callback(r)),r}function o5(e,t,n,r,i){if(t!==e){typeof t.toJSON==`function`&&(t=t.toJSON());for(var a=Y8(t),o=Y8(e),s=!1,c=o.length-1;c>=0;c--){var l=o[c],u=e[l];if(J8(t,l)&&!(t[l]===void 0&&u!==void 0&&Array.isArray(t)===!1)){var d=t[l];typeof u==`object`&&u&&typeof d==`object`&&d&&Array.isArray(u)===Array.isArray(d)?o5(u,d,n,r+`/`+Q8(l),i):u!==d&&(i&&n.push({op:`test`,path:r+`/`+Q8(l),value:X8(u)}),n.push({op:`replace`,path:r+`/`+Q8(l),value:X8(d)}))}else Array.isArray(e)===Array.isArray(t)?(i&&n.push({op:`test`,path:r+`/`+Q8(l),value:X8(u)}),n.push({op:`remove`,path:r+`/`+Q8(l)}),s=!0):(i&&n.push({op:`test`,path:r,value:e}),n.push({op:`replace`,path:r,value:t}))}if(!(!s&&a.length==o.length))for(var c=0;c=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}return _5=e,_5}function s5(){if(zUe)return v5;zUe=1;let e=Object.freeze({loose:!0}),t=Object.freeze({});return v5=n=>n?typeof n==`object`?n:e:t,v5}function c5(){return BUe?b5:(BUe=1,b5={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},b5)}function l5(){return VUe?x5:(VUe=1,x5=typeof process==`object`&&{}.NODE_DEBUG&&/\bsemver\b/i.test({}.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{},x5)}function u5(){return HUe?y5.exports:(HUe=1,(function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=c5(),a=l5();t=e.exports={};let o=t.re=[],s=t.safeRe=[],c=t.src=[],l=t.safeSrc=[],u=t.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),t.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})(y5,y5.exports),y5.exports)}function sUe(){if(UUe)return S5;UUe=1;let e=/^[0-9]+$/,t=(t,n)=>{let r=e.test(t),i=e.test(n);return r&&i&&(t=+t,n=+n),t===n?0:r&&!i?-1:i&&!r?1:tt(n,e)},S5}function d5(){if(WUe)return C5;WUe=1;let e=l5(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:n}=c5(),{safeRe:r,t:i}=u5(),a=s5(),{compareIdentifiers:o}=sUe();class s{constructor(o,c){if(c=a(c),o instanceof s){if(o.loose===!!c.loose&&o.includePrerelease===!!c.includePrerelease)return o;o=o.version}else if(typeof o!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof o}".`);if(o.length>t)throw TypeError(`version is longer than ${t} characters`);e(`SemVer`,o,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=o.trim().match(c.loose?r[i.LOOSE]:r[i.FULL]);if(!l)throw TypeError(`Invalid Version: ${o}`);if(this.raw=o,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>n||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>n||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>n||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),o(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}return C5=s,C5}function f5(){if(GUe)return w5;GUe=1;let e=d5();return w5=(t,n,r)=>new e(t,r).compare(new e(n,r)),w5}function cUe(){if(KUe)return T5;KUe=1;let e=f5();return T5=(t,n,r)=>e(t,n,r)===0,T5}function lUe(){if(qUe)return E5;qUe=1;let e=f5();return E5=(t,n,r)=>e(t,n,r)!==0,E5}function uUe(){if(JUe)return D5;JUe=1;let e=f5();return D5=(t,n,r)=>e(t,n,r)>0,D5}function dUe(){if(YUe)return O5;YUe=1;let e=f5();return O5=(t,n,r)=>e(t,n,r)>=0,O5}function fUe(){if(XUe)return k5;XUe=1;let e=f5();return k5=(t,n,r)=>e(t,n,r)<0,k5}function pUe(){if(ZUe)return A5;ZUe=1;let e=f5();return A5=(t,n,r)=>e(t,n,r)<=0,A5}function mUe(){if(QUe)return j5;QUe=1;let e=cUe(),t=lUe(),n=uUe(),r=dUe(),i=fUe(),a=pUe();return j5=(o,s,c,l)=>{switch(s){case`===`:return typeof o==`object`&&(o=o.version),typeof c==`object`&&(c=c.version),o===c;case`!==`:return typeof o==`object`&&(o=o.version),typeof c==`object`&&(c=c.version),o!==c;case``:case`=`:case`==`:return e(o,c,l);case`!=`:return t(o,c,l);case`>`:return n(o,c,l);case`>=`:return r(o,c,l);case`<`:return i(o,c,l);case`<=`:return a(o,c,l);default:throw TypeError(`Invalid operator: ${s}`)}},j5}function hUe(){if($Ue)return M5;$Ue=1;let e=Symbol(`SemVer ANY`);class t{static get ANY(){return e}constructor(r,i){if(i=n(i),r instanceof t){if(r.loose===!!i.loose)return r;r=r.value}r=r.trim().split(/\s+/).join(` `),o(`comparator`,r,i),this.options=i,this.loose=!!i.loose,this.parse(r),this.semver===e?this.value=``:this.value=this.operator+this.semver.version,o(`comp`,this)}parse(t){let n=this.options.loose?r[i.COMPARATORLOOSE]:r[i.COMPARATOR],a=t.match(n);if(!a)throw TypeError(`Invalid comparator: ${t}`);this.operator=a[1]===void 0?``:a[1],this.operator===`=`&&(this.operator=``),a[2]?this.semver=new s(a[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(o(`Comparator.test`,t,this.options.loose),this.semver===e||t===e)return!0;if(typeof t==`string`)try{t=new s(t,this.options)}catch{return!1}return a(t,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``||new c(e.value,r).test(this.value):e.operator===``?e.value===``||new c(this.value,r).test(e.semver):(r=n(r),r.includePrerelease&&(this.value===`<0.0.0-0`||e.value===`<0.0.0-0`)||!r.includePrerelease&&(this.value.startsWith(`<0.0.0`)||e.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&e.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&e.operator.startsWith(`<`)||this.semver.version===e.semver.version&&this.operator.includes(`=`)&&e.operator.includes(`=`)||a(this.semver,`<`,e.semver,r)&&this.operator.startsWith(`>`)&&e.operator.startsWith(`<`)||a(this.semver,`>`,e.semver,r)&&this.operator.startsWith(`<`)&&e.operator.startsWith(`>`)))}}M5=t;let n=s5(),{safeRe:r,t:i}=u5(),a=mUe(),o=l5(),s=d5(),c=gUe();return M5}function gUe(){if(eWe)return N5;eWe=1;let e=/\s+/g;class t{constructor(n,a){if(a=r(a),n instanceof t)return n.loose===!!a.loose&&n.includePrerelease===!!a.includePrerelease?n:new t(n.raw,a);if(n instanceof i)return this.raw=n.value,this.set=[[n]],this.formatted=void 0,this;if(this.options=a,this.loose=!!a.loose,this.includePrerelease=!!a.includePrerelease,this.raw=n.trim().replace(e,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!m(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&h(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&f)|(this.options.loose&&p))+`:`+e,r=n.get(t);if(r)return r;let o=this.options.loose,h=o?s[c.HYPHENRANGELOOSE]:s[c.HYPHENRANGE];e=e.replace(h,D(this.options.includePrerelease)),a(`hyphen replace`,e),e=e.replace(s[c.COMPARATORTRIM],l),a(`comparator trim`,e),e=e.replace(s[c.TILDETRIM],u),a(`tilde trim`,e),e=e.replace(s[c.CARETTRIM],d),a(`caret trim`,e);let g=e.split(` `).map(e=>_(e,this.options)).join(` `).split(/\s+/).map(e=>E(e,this.options));o&&(g=g.filter(e=>(a(`loose invalid filter`,e,this.options),!!e.match(s[c.COMPARATORLOOSE])))),a(`range list`,g);let v=new Map,y=g.map(e=>new i(e,this.options));for(let e of y){if(m(e))return[e];v.set(e.value,e)}v.size>1&&v.has(``)&&v.delete(``);let b=[...v.values()];return n.set(t,b),b}intersects(e,n){if(!(e instanceof t))throw TypeError(`a Range is required`);return this.set.some(t=>g(t,n)&&e.set.some(e=>g(e,n)&&t.every(t=>e.every(e=>t.intersects(e,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new o(e,this.options)}catch{return!1}for(let t=0;te.value===`<0.0.0-0`,h=e=>e.value===``,g=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},_=(e,t)=>(a(`comp`,e,t),e=x(e,t),a(`caret`,e),e=y(e,t),a(`tildes`,e),e=C(e,t),a(`xrange`,e),e=T(e,t),a(`stars`,e),e),v=e=>!e||e.toLowerCase()===`x`||e===`*`,y=(e,t)=>e.trim().split(/\s+/).map(e=>b(e,t)).join(` `),b=(e,t)=>{let n=t.loose?s[c.TILDELOOSE]:s[c.TILDE];return e.replace(n,(t,n,r,i,o)=>{a(`tilde`,e,t,n,r,i,o);let s;return v(n)?s=``:v(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:v(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:o?(a(`replaceTilde pr`,o),s=`>=${n}.${r}.${i}-${o} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,a(`tilde return`,s),s})},x=(e,t)=>e.trim().split(/\s+/).map(e=>S(e,t)).join(` `),S=(e,t)=>{a(`caret`,e,t);let n=t.loose?s[c.CARETLOOSE]:s[c.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,o,s)=>{a(`caret`,e,t,n,i,o,s);let c;return v(n)?c=``:v(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:v(o)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(a(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${o}-${s} <${n}.${i}.${+o+1}-0`:`>=${n}.${i}.${o}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${o}-${s} <${+n+1}.0.0-0`):(a(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${o}${r} <${n}.${i}.${+o+1}-0`:`>=${n}.${i}.${o}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${o} <${+n+1}.0.0-0`),a(`caret return`,c),c})},C=(e,t)=>(a(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>w(e,t)).join(` `)),w=(e,t)=>{e=e.trim();let n=t.loose?s[c.XRANGELOOSE]:s[c.XRANGE];return e.replace(n,(n,r,i,o,s,c)=>{a(`xRange`,e,n,r,i,o,s,c);let l=v(i),u=l||v(o),d=u||v(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(o=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,o=0,s=0):(o=+o+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:o=+o+1),r===`<`&&(c=`-0`),n=`${r+i}.${o}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),a(`xRange return`,n),n})},T=(e,t)=>(a(`replaceStars`,e,t),e.trim().replace(s[c.STAR],``)),E=(e,t)=>(a(`replaceGTE0`,e,t),e.trim().replace(s[t.includePrerelease?c.GTE0PRE:c.GTE0],``)),D=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=v(r)?``:v(i)?`>=${r}.0.0${e?`-0`:``}`:v(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=v(l)?``:v(u)?`<${+l+1}.0.0-0`:v(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),O=(e,t,n)=>{for(let n=0;n0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0};return N5}function _Ue(){if(tWe)return P5;tWe=1;let e=gUe();return P5=(t,n,r)=>{try{n=new e(n,r)}catch{return!1}return n.test(t)},P5}function vUe(e,t,n){let r=e.open(t),{origin:i}=new URL(t),a=40;function o(t){t.source===r&&(a=0,e.removeEventListener(`message`,o,!1))}e.addEventListener(`message`,o,!1);function s(){a<=0||(r.postMessage(n,i),setTimeout(s,250),--a)}setTimeout(s,250)}function yUe(e,...t){for(let n of t)bUe(e,n);return e}function bUe(e,t){for(let n of Object.keys(t))Ph(e,n,t[n],!0)}function xUe(e){return typeof e==`function`}function SUe(e,t,n,r){let i=`${t}

`,a=`
${n}`,o=window.open(``);o.document.write(i+e+a),o.document.title=`${z5[r]} JSON Source`}function CUe(e,t,n){if(e.$schema){let r=qVe(e.$schema);n&&n!==r.library&&t.warn(`The given visualization spec is written in ${z5[r.library]}, but mode argument sets ${z5[n]??n}.`);let i=r.library;return F5(B5[i],`^${r.version.slice(1)}`)||t.warn(`The input spec uses ${z5[i]} ${r.version}, but the current version of ${z5[i]} is v${B5[i]}.`),i}return`mark`in e||`encoding`in e||`layer`in e||`hconcat`in e||`vconcat`in e||`facet`in e||`repeat`in e?`vega-lite`:`marks`in e||`signals`in e||`scales`in e||`axes`in e?`vega`:n??`vega`}function wUe(e){return!!(e&&`load`in e)}function TUe(e){return wUe(e)?e:I5.loader(e)}function EUe(e){let t=e.usermeta?.embedOptions??{};return vg(t.defaultStyle)&&(t.defaultStyle=!1),t}async function DUe(e,t,n={}){let r,i;vg(t)?(i=TUe(n.loader),r=JSON.parse(await i.load(t))):r=t;let a=EUe(r),o=a.loader;(!i||o)&&(i=TUe(n.loader??o));let s=await OUe(a,i),c=await OUe(n,i),l={...yUe(c,s),config:Nh(c.config??{},s.config??{})};return await AUe(e,r,l,i)}async function OUe(e,t){let n=vg(e.config)?JSON.parse(await t.load(e.config)):e.config??{},r=vg(e.patch)?JSON.parse(await t.load(e.patch)):e.patch;return{...e,...r?{patch:r}:{},...n?{config:n}:{}}}function kUe(e){let t=e.getRootNode?e.getRootNode():document;return t instanceof ShadowRoot?{root:t,rootContainer:t}:{root:document,rootContainer:document.head??document.body}}async function AUe(e,t,n={},r){let i=n.theme?Nh(YVe[n.theme],n.config??{}):n.config,a=mg(n.actions)?n.actions:yUe({},rWe,n.actions??{}),o={...iWe,...n.i18n},s=n.renderer??`svg`,c=n.logger??kh(I5.Warn);n.logLevel!==void 0&&c.level(n.logLevel);let l=n.downloadFileName??`visualization`,u=typeof e==`string`?document.querySelector(e):e;if(!u)throw Error(`${e} does not exist`);if(n.defaultStyle!==!1){let e=`vega-embed-style`,{root:t,rootContainer:r}=kUe(u);if(!t.getElementById(e)){let t=document.createElement(`style`);t.id=e,t.innerHTML=n.defaultStyle===void 0||n.defaultStyle===!0?nWe.toString():n.defaultStyle,r.appendChild(t)}}let d=CUe(t,c,n.mode),f=aWe[d](t,c,i);if(d===`vega-lite`&&f.$schema){let e=qVe(f.$schema);F5(B5.vega,`^${e.version.slice(1)}`)||c.warn(`The compiled spec uses Vega ${e.version}, but current version is v${B5.vega}.`)}u.classList.add(`vega-embed`),a&&u.classList.add(`has-actions`),u.innerHTML=``;let p=u;if(a){let e=document.createElement(`div`);e.classList.add(sWe),u.appendChild(e),p=e}let m=n.patch;if(m&&(f=m instanceof Function?m(f):n5(f,m,!0,!1).newDocument),n.formatLocale&&I5.formatLocale(n.formatLocale),n.timeFormatLocale&&I5.timeFormatLocale(n.timeFormatLocale),n.expressionFunctions)for(let e in n.expressionFunctions){let t=n.expressionFunctions[e];`fn`in t?I5.expressionFunction(e,t.fn,t.visitor):t instanceof Function&&I5.expressionFunction(e,t)}let{ast:h}=n,g=I5.parse(f,d===`vega-lite`?{}:i,{ast:h}),_=new(n.viewClass||I5.View)(g,{loader:r,logger:c,renderer:s,...h?{expr:I5.expressionInterpreter??n.expr??nX}:{}});if(_.addSignalListener(`autosize`,(e,t)=>{let{type:n}=t;n==`fit-x`?(p.classList.add(`fit-x`),p.classList.remove(`fit-y`)):n==`fit-y`?(p.classList.remove(`fit-x`),p.classList.add(`fit-y`)):n==`fit`?p.classList.add(`fit-x`,`fit-y`):p.classList.remove(`fit-x`,`fit-y`)}),n.tooltip!==!1){let{loader:e,tooltip:t}=n,r=e&&!wUe(e)?e?.baseURL:void 0,i=xUe(t)?t:new qHe({baseURL:r,...t===!0?{}:t}).call;_.tooltip(i)}let{hover:v}=n;if(v===void 0&&(v=d===`vega`),v){let{hoverSet:e,updateSet:t}=typeof v==`boolean`?{}:v;_.hover(e,t)}n&&(n.width!=null&&_.width(n.width),n.height!=null&&_.height(n.height),n.padding!=null&&_.padding(n.padding)),await _.initialize(p,n.bind).runAsync();let y;if(a!==!1){let e=u;if(n.defaultStyle!==!1||n.forceActionsMenu){let t=document.createElement(`details`);t.title=o.CLICK_TO_VIEW_ACTIONS,u.append(t),e=t;let n=document.createElement(`summary`);n.innerHTML=oWe,t.append(n),y=e=>{t.contains(e.target)||t.removeAttribute(`open`)},document.addEventListener(`click`,y)}let r=document.createElement(`div`);if(e.append(r),r.classList.add(`vega-actions`),a===!0||a.export!==!1){for(let e of[`svg`,`png`])if(a===!0||a.export===!0||a.export[e]){let t=o[`${e.toUpperCase()}_ACTION`],i=document.createElement(`a`),a=jh(n.scaleFactor)?n.scaleFactor[e]:n.scaleFactor;i.text=t,i.href=`#`,i.target=`_blank`,i.download=`${l}.${e}`,i.addEventListener(`mousedown`,async function(t){t.preventDefault();let n=await _.toImageURL(e,a);this.href=n}),r.append(i)}}if(a===!0||a.source!==!1){let e=document.createElement(`a`);e.text=o.SOURCE_ACTION,e.href=`#`,e.addEventListener(`click`,function(e){SUe(sh(t),n.sourceHeader??``,n.sourceFooter??``,d),e.preventDefault()}),r.append(e)}if(d===`vega-lite`&&(a===!0||a.compiled!==!1)){let e=document.createElement(`a`);e.text=o.COMPILED_ACTION,e.href=`#`,e.addEventListener(`click`,function(e){SUe(sh(f),n.sourceHeader??``,n.sourceFooter??``,`vega`),e.preventDefault()}),r.append(e)}if(a===!0||a.editor!==!1){let e=n.editorUrl??`https://vega.github.io/editor/`,a=document.createElement(`a`);a.text=o.EDITOR_ACTION,a.href=`#`,a.addEventListener(`click`,function(n){vUe(window,e,{config:i,mode:m?`vega`:d,renderer:s,spec:sh(m?f:t)}),n.preventDefault()}),r.append(a)}}function b(){y&&document.removeEventListener(`click`,y),_.finalize()}return{view:_,spec:t,vgSpec:f,finalize:b,embedOptions:n}}var jUe,MUe,p5,m5,NUe,h5,PUe,FUe,g5,IUe,LUe,_5,RUe,v5,zUe,y5,b5,BUe,x5,VUe,HUe,S5,UUe,C5,WUe,w5,GUe,T5,KUe,E5,qUe,D5,JUe,O5,YUe,k5,XUe,A5,ZUe,j5,QUe,M5,$Ue,N5,eWe,P5,tWe,F5,nWe,I5,L5,R5,rWe,iWe,z5,B5,aWe,oWe,sWe,cWe=o((()=>{Yie(),WY(),KOe(),KVe(),JVe(),MHe(),JHe(),jUe=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),MUe=Object.prototype.hasOwnProperty,p5=function(e){jUe(t,e);function t(t,n,r,i,a){var o=this.constructor,s=e.call(this,XHe(t,{name:n,index:r,operation:i,tree:a}))||this;return s.name=n,s.index=r,s.operation=i,s.tree=a,Object.setPrototypeOf(s,o.prototype),s.message=XHe(t,{name:n,index:r,operation:i,tree:a}),s}return t}(Error),m5=p5,NUe=X8,h5={add:function(e,t,n){return e[t]=this.value,{newDocument:n}},remove:function(e,t,n){var r=e[t];return delete e[t],{newDocument:n,removed:r}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:function(e,t,n){var r=e5(n,this.path);r&&=X8(r);var i=t5(n,{op:`remove`,path:this.from}).removed;return t5(n,{op:`add`,path:this.path,value:i}),{newDocument:n,removed:r}},copy:function(e,t,n){var r=e5(n,this.from);return t5(n,{op:`add`,path:this.path,value:X8(r)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:i5(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}},PUe={add:function(e,t,n){return Z8(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:n,index:t}},remove:function(e,t,n){return{newDocument:n,removed:e.splice(t,1)[0]}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:h5.move,copy:h5.copy,test:h5.test,_get:h5._get},FUe=Object.freeze({__proto__:null,JsonPatchError:m5,_areEquals:i5,applyOperation:t5,applyPatch:n5,applyReducer:ZHe,deepClone:NUe,getValueByPointer:e5,validate:QHe,validator:r5}),g5=new WeakMap,IUe=function(){function e(e){this.observers=new Map,this.obj=e}return e}(),LUe=function(){function e(e,t){this.callback=e,this.observer=t}return e}(),Object.assign({},FUe,Object.freeze({__proto__:null,compare:iUe,generate:a5,observe:rUe,unobserve:nUe}),{JsonPatchError:p5,deepClone:X8,escapePathComponent:Q8,unescapePathComponent:YHe}),y5={exports:{}},F5=aUe(_Ue()),nWe=`.vega-embed { +`,G8=`vg-tooltip-element`,YHe={offsetX:10,offsetY:10,id:G8,styleId:`vega-tooltip-style`,theme:`light`,disableDefaultStyle:!1,sanitize:zHe,maxDepth:2,formatTooltip:IHe,baseURL:``,anchor:`cursor`,position:[`top`,`bottom`,`left`,`right`,`top-left`,`top-right`,`bottom-left`,`bottom-right`]},XHe=class{call;options;el;constructor(e){this.options={...YHe,...e};let t=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){let e=document.createElement(`style`);e.setAttribute(`id`,this.options.styleId),e.innerHTML=BHe(t);let n=document.head;n.childNodes.length>0?n.insertBefore(e,n.childNodes[0]):n.appendChild(e)}}tooltipHandler(e,t,n,r){if(this.el=document.getElementById(this.options.id),this.el||(this.el=document.createElement(`div`),this.el.setAttribute(`id`,this.options.id),this.el.classList.add(`vg-tooltip`),(document.fullscreenElement??document.body).appendChild(this.el)),r==null||r===``){this.el.classList.remove(`visible`,`${this.options.theme}-theme`);return}this.el.innerHTML=this.options.formatTooltip(r,this.options.sanitize,this.options.maxDepth,this.options.baseURL),this.el.classList.add(`visible`,`${this.options.theme}-theme`);let{x:i,y:a}=this.options.anchor===`mark`?HHe(e,t,n,this.el.getBoundingClientRect(),this.options):VHe(t,this.el.getBoundingClientRect(),this.options);this.el.style.top=`${a}px`,this.el.style.left=`${i}px`}},qHe.version}));function K8(e,t){return FUe.call(e,t)}function q8(e){if(Array.isArray(e)){for(var t=Array(e.length),n=0;n=48&&r<=57){t++;continue}return!1}return!0}function X8(e){return e.indexOf(`/`)===-1&&e.indexOf(`~`)===-1?e:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function QHe(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function Z8(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,n=e.length;t0&&s[l-1]==`constructor`))throw TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&d===void 0&&(c[f]===void 0?d=s.slice(0,l).join(`/`):l==u-1&&(d=t.path),d!==void 0&&p(t,0,e,d)),l++,Array.isArray(c)){if(f===`-`)f=c.length;else if(n&&!Y8(f))throw new f5(`Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index`,`OPERATION_PATH_ILLEGAL_ARRAY_INDEX`,a,t,e);else Y8(f)&&(f=~~f);if(l>=u){if(n&&t.op===`add`&&f>c.length)throw new f5(`The specified index MUST NOT be greater than the number of elements in the array`,`OPERATION_VALUE_OUT_OF_BOUNDS`,a,t,e);var o=LUe[t.op].call(t,c,f,e);if(o.test===!1)throw new f5(`Test operation failed`,`TEST_OPERATION_FAILED`,a,t,e);return o}}else if(l>=u){var o=p5[t.op].call(t,c,f,e);if(o.test===!1)throw new f5(`Test operation failed`,`TEST_OPERATION_FAILED`,a,t,e);return o}if(c=c[f],n&&l0)throw new f5('Operation `path` property must start with "/"',`OPERATION_PATH_INVALID`,t,e,n);if((e.op===`move`||e.op===`copy`)&&typeof e.from!=`string`)throw new f5("Operation `from` property is not present (applicable in `move` and `copy` operations)",`OPERATION_FROM_REQUIRED`,t,e,n);if((e.op===`add`||e.op===`replace`||e.op===`test`)&&e.value===void 0)throw new f5("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)",`OPERATION_VALUE_REQUIRED`,t,e,n);if((e.op===`add`||e.op===`replace`||e.op===`test`)&&Z8(e.value))throw new f5("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)",`OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED`,t,e,n);if(n){if(e.op==`add`){var i=e.path.split(`/`).length,a=r.split(`/`).length;if(i!==a+1&&i!==a)throw new f5("Cannot perform an `add` operation at the desired path",`OPERATION_PATH_CANNOT_ADD`,t,e,n)}else if(e.op===`replace`||e.op===`remove`||e.op===`_get`){if(e.path!==r)throw new f5(`Cannot perform the operation at a path that does not exist`,`OPERATION_PATH_UNRESOLVABLE`,t,e,n)}else if(e.op===`move`||e.op===`copy`){var o=tUe([{op:`_get`,path:e.from,value:void 0}],n);if(o&&o.name===`OPERATION_PATH_UNRESOLVABLE`)throw new f5(`Cannot perform the operation from a path that does not exist`,`OPERATION_FROM_UNRESOLVABLE`,t,e,n)}}}function tUe(e,t,n){try{if(!Array.isArray(e))throw new f5(`Patch sequence must be an array`,`SEQUENCE_NOT_AN_ARRAY`);if(t)e5(J8(t),J8(e),n||!0);else{n||=t5;for(var r=0;r0&&(e.patches=[],e.callback&&e.callback(r)),r}function i5(e,t,n,r,i){if(t!==e){typeof t.toJSON==`function`&&(t=t.toJSON());for(var a=q8(t),o=q8(e),s=!1,c=o.length-1;c>=0;c--){var l=o[c],u=e[l];if(K8(t,l)&&!(t[l]===void 0&&u!==void 0&&Array.isArray(t)===!1)){var d=t[l];typeof u==`object`&&u&&typeof d==`object`&&d&&Array.isArray(u)===Array.isArray(d)?i5(u,d,n,r+`/`+X8(l),i):u!==d&&(i&&n.push({op:`test`,path:r+`/`+X8(l),value:J8(u)}),n.push({op:`replace`,path:r+`/`+X8(l),value:J8(d)}))}else Array.isArray(e)===Array.isArray(t)?(i&&n.push({op:`test`,path:r+`/`+X8(l),value:J8(u)}),n.push({op:`remove`,path:r+`/`+X8(l)}),s=!0):(i&&n.push({op:`test`,path:r,value:e}),n.push({op:`replace`,path:r,value:t}))}if(!(!s&&a.length==o.length))for(var c=0;c=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}return h5=e,h5}function a5(){if(HUe)return g5;HUe=1;let e=Object.freeze({loose:!0}),t=Object.freeze({});return g5=n=>n?typeof n==`object`?n:e:t,g5}function o5(){return UUe?v5:(UUe=1,v5={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},v5)}function s5(){return WUe?y5:(WUe=1,y5=typeof process==`object`&&{}.NODE_DEBUG&&/\bsemver\b/i.test({}.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{},y5)}function c5(){return GUe?_5.exports:(GUe=1,(function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=o5(),a=s5();t=e.exports={};let o=t.re=[],s=t.safeRe=[],c=t.src=[],l=t.safeSrc=[],u=t.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),t.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})(_5,_5.exports),_5.exports)}function uUe(){if(KUe)return b5;KUe=1;let e=/^[0-9]+$/,t=(t,n)=>{let r=e.test(t),i=e.test(n);return r&&i&&(t=+t,n=+n),t===n?0:r&&!i?-1:i&&!r?1:tt(n,e)},b5}function l5(){if(qUe)return x5;qUe=1;let e=s5(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:n}=o5(),{safeRe:r,t:i}=c5(),a=a5(),{compareIdentifiers:o}=uUe();class s{constructor(o,c){if(c=a(c),o instanceof s){if(o.loose===!!c.loose&&o.includePrerelease===!!c.includePrerelease)return o;o=o.version}else if(typeof o!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof o}".`);if(o.length>t)throw TypeError(`version is longer than ${t} characters`);e(`SemVer`,o,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=o.trim().match(c.loose?r[i.LOOSE]:r[i.FULL]);if(!l)throw TypeError(`Invalid Version: ${o}`);if(this.raw=o,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>n||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>n||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>n||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),o(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}return x5=s,x5}function u5(){if(JUe)return S5;JUe=1;let e=l5();return S5=(t,n,r)=>new e(t,r).compare(new e(n,r)),S5}function dUe(){if(YUe)return C5;YUe=1;let e=u5();return C5=(t,n,r)=>e(t,n,r)===0,C5}function fUe(){if(XUe)return w5;XUe=1;let e=u5();return w5=(t,n,r)=>e(t,n,r)!==0,w5}function pUe(){if(ZUe)return T5;ZUe=1;let e=u5();return T5=(t,n,r)=>e(t,n,r)>0,T5}function mUe(){if(QUe)return E5;QUe=1;let e=u5();return E5=(t,n,r)=>e(t,n,r)>=0,E5}function hUe(){if($Ue)return D5;$Ue=1;let e=u5();return D5=(t,n,r)=>e(t,n,r)<0,D5}function gUe(){if(eWe)return O5;eWe=1;let e=u5();return O5=(t,n,r)=>e(t,n,r)<=0,O5}function _Ue(){if(tWe)return k5;tWe=1;let e=dUe(),t=fUe(),n=pUe(),r=mUe(),i=hUe(),a=gUe();return k5=(o,s,c,l)=>{switch(s){case`===`:return typeof o==`object`&&(o=o.version),typeof c==`object`&&(c=c.version),o===c;case`!==`:return typeof o==`object`&&(o=o.version),typeof c==`object`&&(c=c.version),o!==c;case``:case`=`:case`==`:return e(o,c,l);case`!=`:return t(o,c,l);case`>`:return n(o,c,l);case`>=`:return r(o,c,l);case`<`:return i(o,c,l);case`<=`:return a(o,c,l);default:throw TypeError(`Invalid operator: ${s}`)}},k5}function vUe(){if(nWe)return A5;nWe=1;let e=Symbol(`SemVer ANY`);class t{static get ANY(){return e}constructor(r,i){if(i=n(i),r instanceof t){if(r.loose===!!i.loose)return r;r=r.value}r=r.trim().split(/\s+/).join(` `),o(`comparator`,r,i),this.options=i,this.loose=!!i.loose,this.parse(r),this.semver===e?this.value=``:this.value=this.operator+this.semver.version,o(`comp`,this)}parse(t){let n=this.options.loose?r[i.COMPARATORLOOSE]:r[i.COMPARATOR],a=t.match(n);if(!a)throw TypeError(`Invalid comparator: ${t}`);this.operator=a[1]===void 0?``:a[1],this.operator===`=`&&(this.operator=``),a[2]?this.semver=new s(a[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(o(`Comparator.test`,t,this.options.loose),this.semver===e||t===e)return!0;if(typeof t==`string`)try{t=new s(t,this.options)}catch{return!1}return a(t,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``||new c(e.value,r).test(this.value):e.operator===``?e.value===``||new c(this.value,r).test(e.semver):(r=n(r),r.includePrerelease&&(this.value===`<0.0.0-0`||e.value===`<0.0.0-0`)||!r.includePrerelease&&(this.value.startsWith(`<0.0.0`)||e.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&e.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&e.operator.startsWith(`<`)||this.semver.version===e.semver.version&&this.operator.includes(`=`)&&e.operator.includes(`=`)||a(this.semver,`<`,e.semver,r)&&this.operator.startsWith(`>`)&&e.operator.startsWith(`<`)||a(this.semver,`>`,e.semver,r)&&this.operator.startsWith(`<`)&&e.operator.startsWith(`>`)))}}A5=t;let n=a5(),{safeRe:r,t:i}=c5(),a=_Ue(),o=s5(),s=l5(),c=yUe();return A5}function yUe(){if(rWe)return j5;rWe=1;let e=/\s+/g;class t{constructor(n,a){if(a=r(a),n instanceof t)return n.loose===!!a.loose&&n.includePrerelease===!!a.includePrerelease?n:new t(n.raw,a);if(n instanceof i)return this.raw=n.value,this.set=[[n]],this.formatted=void 0,this;if(this.options=a,this.loose=!!a.loose,this.includePrerelease=!!a.includePrerelease,this.raw=n.trim().replace(e,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!m(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&h(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&f)|(this.options.loose&&p))+`:`+e,r=n.get(t);if(r)return r;let o=this.options.loose,h=o?s[c.HYPHENRANGELOOSE]:s[c.HYPHENRANGE];e=e.replace(h,D(this.options.includePrerelease)),a(`hyphen replace`,e),e=e.replace(s[c.COMPARATORTRIM],l),a(`comparator trim`,e),e=e.replace(s[c.TILDETRIM],u),a(`tilde trim`,e),e=e.replace(s[c.CARETTRIM],d),a(`caret trim`,e);let g=e.split(` `).map(e=>_(e,this.options)).join(` `).split(/\s+/).map(e=>E(e,this.options));o&&(g=g.filter(e=>(a(`loose invalid filter`,e,this.options),!!e.match(s[c.COMPARATORLOOSE])))),a(`range list`,g);let v=new Map,y=g.map(e=>new i(e,this.options));for(let e of y){if(m(e))return[e];v.set(e.value,e)}v.size>1&&v.has(``)&&v.delete(``);let b=[...v.values()];return n.set(t,b),b}intersects(e,n){if(!(e instanceof t))throw TypeError(`a Range is required`);return this.set.some(t=>g(t,n)&&e.set.some(e=>g(e,n)&&t.every(t=>e.every(e=>t.intersects(e,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new o(e,this.options)}catch{return!1}for(let t=0;te.value===`<0.0.0-0`,h=e=>e.value===``,g=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},_=(e,t)=>(a(`comp`,e,t),e=x(e,t),a(`caret`,e),e=y(e,t),a(`tildes`,e),e=C(e,t),a(`xrange`,e),e=T(e,t),a(`stars`,e),e),v=e=>!e||e.toLowerCase()===`x`||e===`*`,y=(e,t)=>e.trim().split(/\s+/).map(e=>b(e,t)).join(` `),b=(e,t)=>{let n=t.loose?s[c.TILDELOOSE]:s[c.TILDE];return e.replace(n,(t,n,r,i,o)=>{a(`tilde`,e,t,n,r,i,o);let s;return v(n)?s=``:v(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:v(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:o?(a(`replaceTilde pr`,o),s=`>=${n}.${r}.${i}-${o} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,a(`tilde return`,s),s})},x=(e,t)=>e.trim().split(/\s+/).map(e=>S(e,t)).join(` `),S=(e,t)=>{a(`caret`,e,t);let n=t.loose?s[c.CARETLOOSE]:s[c.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,o,s)=>{a(`caret`,e,t,n,i,o,s);let c;return v(n)?c=``:v(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:v(o)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(a(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${o}-${s} <${n}.${i}.${+o+1}-0`:`>=${n}.${i}.${o}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${o}-${s} <${+n+1}.0.0-0`):(a(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${o}${r} <${n}.${i}.${+o+1}-0`:`>=${n}.${i}.${o}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${o} <${+n+1}.0.0-0`),a(`caret return`,c),c})},C=(e,t)=>(a(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>w(e,t)).join(` `)),w=(e,t)=>{e=e.trim();let n=t.loose?s[c.XRANGELOOSE]:s[c.XRANGE];return e.replace(n,(n,r,i,o,s,c)=>{a(`xRange`,e,n,r,i,o,s,c);let l=v(i),u=l||v(o),d=u||v(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(o=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,o=0,s=0):(o=+o+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:o=+o+1),r===`<`&&(c=`-0`),n=`${r+i}.${o}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),a(`xRange return`,n),n})},T=(e,t)=>(a(`replaceStars`,e,t),e.trim().replace(s[c.STAR],``)),E=(e,t)=>(a(`replaceGTE0`,e,t),e.trim().replace(s[t.includePrerelease?c.GTE0PRE:c.GTE0],``)),D=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=v(r)?``:v(i)?`>=${r}.0.0${e?`-0`:``}`:v(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=v(l)?``:v(u)?`<${+l+1}.0.0-0`:v(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),O=(e,t,n)=>{for(let n=0;n0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0};return j5}function bUe(){if(iWe)return M5;iWe=1;let e=yUe();return M5=(t,n,r)=>{try{n=new e(n,r)}catch{return!1}return n.test(t)},M5}function xUe(e,t,n){let r=e.open(t),{origin:i}=new URL(t),a=40;function o(t){t.source===r&&(a=0,e.removeEventListener(`message`,o,!1))}e.addEventListener(`message`,o,!1);function s(){a<=0||(r.postMessage(n,i),setTimeout(s,250),--a)}setTimeout(s,250)}function SUe(e,...t){for(let n of t)CUe(e,n);return e}function CUe(e,t){for(let n of Object.keys(t))Ph(e,n,t[n],!0)}function wUe(e){return typeof e==`function`}function TUe(e,t,n,r){let i=`${t}
`,a=`
${n}`,o=window.open(``);o.document.write(i+e+a),o.document.title=`${L5[r]} JSON Source`}function EUe(e,t,n){if(e.$schema){let r=XVe(e.$schema);n&&n!==r.library&&t.warn(`The given visualization spec is written in ${L5[r.library]}, but mode argument sets ${L5[n]??n}.`);let i=r.library;return N5(R5[i],`^${r.version.slice(1)}`)||t.warn(`The input spec uses ${L5[i]} ${r.version}, but the current version of ${L5[i]} is v${R5[i]}.`),i}return`mark`in e||`encoding`in e||`layer`in e||`hconcat`in e||`vconcat`in e||`facet`in e||`repeat`in e?`vega-lite`:`marks`in e||`signals`in e||`scales`in e||`axes`in e?`vega`:n??`vega`}function DUe(e){return!!(e&&`load`in e)}function OUe(e){return DUe(e)?e:P5.loader(e)}function kUe(e){let t=e.usermeta?.embedOptions??{};return vg(t.defaultStyle)&&(t.defaultStyle=!1),t}async function AUe(e,t,n={}){let r,i;vg(t)?(i=OUe(n.loader),r=JSON.parse(await i.load(t))):r=t;let a=kUe(r),o=a.loader;(!i||o)&&(i=OUe(n.loader??o));let s=await jUe(a,i),c=await jUe(n,i),l={...SUe(c,s),config:Nh(c.config??{},s.config??{})};return await NUe(e,r,l,i)}async function jUe(e,t){let n=vg(e.config)?JSON.parse(await t.load(e.config)):e.config??{},r=vg(e.patch)?JSON.parse(await t.load(e.patch)):e.patch;return{...e,...r?{patch:r}:{},...n?{config:n}:{}}}function MUe(e){let t=e.getRootNode?e.getRootNode():document;return t instanceof ShadowRoot?{root:t,rootContainer:t}:{root:document,rootContainer:document.head??document.body}}async function NUe(e,t,n={},r){let i=n.theme?Nh(QVe[n.theme],n.config??{}):n.config,a=mg(n.actions)?n.actions:SUe({},oWe,n.actions??{}),o={...sWe,...n.i18n},s=n.renderer??`svg`,c=n.logger??kh(P5.Warn);n.logLevel!==void 0&&c.level(n.logLevel);let l=n.downloadFileName??`visualization`,u=typeof e==`string`?document.querySelector(e):e;if(!u)throw Error(`${e} does not exist`);if(n.defaultStyle!==!1){let e=`vega-embed-style`,{root:t,rootContainer:r}=MUe(u);if(!t.getElementById(e)){let t=document.createElement(`style`);t.id=e,t.innerHTML=n.defaultStyle===void 0||n.defaultStyle===!0?aWe.toString():n.defaultStyle,r.appendChild(t)}}let d=EUe(t,c,n.mode),f=cWe[d](t,c,i);if(d===`vega-lite`&&f.$schema){let e=XVe(f.$schema);N5(R5.vega,`^${e.version.slice(1)}`)||c.warn(`The compiled spec uses Vega ${e.version}, but current version is v${R5.vega}.`)}u.classList.add(`vega-embed`),a&&u.classList.add(`has-actions`),u.innerHTML=``;let p=u;if(a){let e=document.createElement(`div`);e.classList.add(uWe),u.appendChild(e),p=e}let m=n.patch;if(m&&(f=m instanceof Function?m(f):e5(f,m,!0,!1).newDocument),n.formatLocale&&P5.formatLocale(n.formatLocale),n.timeFormatLocale&&P5.timeFormatLocale(n.timeFormatLocale),n.expressionFunctions)for(let e in n.expressionFunctions){let t=n.expressionFunctions[e];`fn`in t?P5.expressionFunction(e,t.fn,t.visitor):t instanceof Function&&P5.expressionFunction(e,t)}let{ast:h}=n,g=P5.parse(f,d===`vega-lite`?{}:i,{ast:h}),_=new(n.viewClass||P5.View)(g,{loader:r,logger:c,renderer:s,...h?{expr:P5.expressionInterpreter??n.expr??$Y}:{}});if(_.addSignalListener(`autosize`,(e,t)=>{let{type:n}=t;n==`fit-x`?(p.classList.add(`fit-x`),p.classList.remove(`fit-y`)):n==`fit-y`?(p.classList.remove(`fit-x`),p.classList.add(`fit-y`)):n==`fit`?p.classList.add(`fit-x`,`fit-y`):p.classList.remove(`fit-x`,`fit-y`)}),n.tooltip!==!1){let{loader:e,tooltip:t}=n,r=e&&!DUe(e)?e?.baseURL:void 0,i=wUe(t)?t:new XHe({baseURL:r,...t===!0?{}:t}).call;_.tooltip(i)}let{hover:v}=n;if(v===void 0&&(v=d===`vega`),v){let{hoverSet:e,updateSet:t}=typeof v==`boolean`?{}:v;_.hover(e,t)}n&&(n.width!=null&&_.width(n.width),n.height!=null&&_.height(n.height),n.padding!=null&&_.padding(n.padding)),await _.initialize(p,n.bind).runAsync();let y;if(a!==!1){let e=u;if(n.defaultStyle!==!1||n.forceActionsMenu){let t=document.createElement(`details`);t.title=o.CLICK_TO_VIEW_ACTIONS,u.append(t),e=t;let n=document.createElement(`summary`);n.innerHTML=lWe,t.append(n),y=e=>{t.contains(e.target)||t.removeAttribute(`open`)},document.addEventListener(`click`,y)}let r=document.createElement(`div`);if(e.append(r),r.classList.add(`vega-actions`),a===!0||a.export!==!1){for(let e of[`svg`,`png`])if(a===!0||a.export===!0||a.export[e]){let t=o[`${e.toUpperCase()}_ACTION`],i=document.createElement(`a`),a=jh(n.scaleFactor)?n.scaleFactor[e]:n.scaleFactor;i.text=t,i.href=`#`,i.target=`_blank`,i.download=`${l}.${e}`,i.addEventListener(`mousedown`,async function(t){t.preventDefault();let n=await _.toImageURL(e,a);this.href=n}),r.append(i)}}if(a===!0||a.source!==!1){let e=document.createElement(`a`);e.text=o.SOURCE_ACTION,e.href=`#`,e.addEventListener(`click`,function(e){TUe(sh(t),n.sourceHeader??``,n.sourceFooter??``,d),e.preventDefault()}),r.append(e)}if(d===`vega-lite`&&(a===!0||a.compiled!==!1)){let e=document.createElement(`a`);e.text=o.COMPILED_ACTION,e.href=`#`,e.addEventListener(`click`,function(e){TUe(sh(f),n.sourceHeader??``,n.sourceFooter??``,`vega`),e.preventDefault()}),r.append(e)}if(a===!0||a.editor!==!1){let e=n.editorUrl??`https://vega.github.io/editor/`,a=document.createElement(`a`);a.text=o.EDITOR_ACTION,a.href=`#`,a.addEventListener(`click`,function(n){xUe(window,e,{config:i,mode:m?`vega`:d,renderer:s,spec:sh(m?f:t)}),n.preventDefault()}),r.append(a)}}function b(){y&&document.removeEventListener(`click`,y),_.finalize()}return{view:_,spec:t,vgSpec:f,finalize:b,embedOptions:n}}var PUe,FUe,d5,f5,IUe,p5,LUe,RUe,m5,zUe,BUe,h5,VUe,g5,HUe,_5,v5,UUe,y5,WUe,GUe,b5,KUe,x5,qUe,S5,JUe,C5,YUe,w5,XUe,T5,ZUe,E5,QUe,D5,$Ue,O5,eWe,k5,tWe,A5,nWe,j5,rWe,M5,iWe,N5,aWe,P5,F5,I5,oWe,sWe,L5,R5,cWe,lWe,uWe,dWe=o((()=>{Xie(),VY(),XOe(),YVe(),ZVe(),FHe(),ZHe(),PUe=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),FUe=Object.prototype.hasOwnProperty,d5=function(e){PUe(t,e);function t(t,n,r,i,a){var o=this.constructor,s=e.call(this,$He(t,{name:n,index:r,operation:i,tree:a}))||this;return s.name=n,s.index=r,s.operation=i,s.tree=a,Object.setPrototypeOf(s,o.prototype),s.message=$He(t,{name:n,index:r,operation:i,tree:a}),s}return t}(Error),f5=d5,IUe=J8,p5={add:function(e,t,n){return e[t]=this.value,{newDocument:n}},remove:function(e,t,n){var r=e[t];return delete e[t],{newDocument:n,removed:r}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:function(e,t,n){var r=Q8(n,this.path);r&&=J8(r);var i=$8(n,{op:`remove`,path:this.from}).removed;return $8(n,{op:`add`,path:this.path,value:i}),{newDocument:n,removed:r}},copy:function(e,t,n){var r=Q8(n,this.from);return $8(n,{op:`add`,path:this.path,value:J8(r)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:n5(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}},LUe={add:function(e,t,n){return Y8(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:n,index:t}},remove:function(e,t,n){return{newDocument:n,removed:e.splice(t,1)[0]}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:p5.move,copy:p5.copy,test:p5.test,_get:p5._get},RUe=Object.freeze({__proto__:null,JsonPatchError:f5,_areEquals:n5,applyOperation:$8,applyPatch:e5,applyReducer:eUe,deepClone:IUe,getValueByPointer:Q8,validate:tUe,validator:t5}),m5=new WeakMap,zUe=function(){function e(e){this.observers=new Map,this.obj=e}return e}(),BUe=function(){function e(e,t){this.callback=e,this.observer=t}return e}(),Object.assign({},RUe,Object.freeze({__proto__:null,compare:sUe,generate:r5,observe:oUe,unobserve:aUe}),{JsonPatchError:d5,deepClone:J8,escapePathComponent:X8,unescapePathComponent:QHe}),_5={exports:{}},N5=cUe(bUe()),aWe=`.vega-embed { position: relative; display: inline-block; box-sizing: border-box; @@ -374,14 +374,14 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`

An error transform: scale(1); } } -`,{version:`7.1.0`}.version,I5=WOe,L5=wke,R5=typeof window<`u`?window:void 0,L5===void 0&&R5?.vl?.compile&&(L5=R5.vl),rWe={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},iWe={CLICK_TO_VIEW_ACTIONS:`Click to view actions`,COMPILED_ACTION:`View Compiled Vega`,EDITOR_ACTION:`Open in Vega Editor`,PNG_ACTION:`Save as PNG`,SOURCE_ACTION:`View Source`,SVG_ACTION:`Save as SVG`},z5={vega:`Vega`,"vega-lite":`Vega-Lite`},B5={vega:I5.version,"vega-lite":L5?L5.version:`not available`},aWe={vega:e=>e,"vega-lite":(e,t,n)=>L5.compile(e,{config:n,logger:t}).spec},oWe=` +`,{version:`7.1.0`}.version,P5=JOe,F5=Oke,I5=typeof window<`u`?window:void 0,F5===void 0&&I5?.vl?.compile&&(F5=I5.vl),oWe={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},sWe={CLICK_TO_VIEW_ACTIONS:`Click to view actions`,COMPILED_ACTION:`View Compiled Vega`,EDITOR_ACTION:`Open in Vega Editor`,PNG_ACTION:`Save as PNG`,SOURCE_ACTION:`View Source`,SVG_ACTION:`Save as SVG`},L5={vega:`Vega`,"vega-lite":`Vega-Lite`},R5={vega:P5.version,"vega-lite":F5?F5.version:`not available`},cWe={vega:e=>e,"vega-lite":(e,t,n)=>F5.compile(e,{config:n,logger:t}).spec},lWe=` -`,sWe=`chart-wrapper`})),lWe=c({default:()=>uWe});function uWe({spec:e,label:t}){let n=(0,V5.useRef)(null),r=(0,V5.useRef)(null),[i,a]=(0,V5.useState)(``);return(0,V5.useEffect)(()=>{let t=!1;a(``),r.current?.finalize(),r.current=null;let i=n.current;if(i)return i.replaceChildren(),DUe(i,e,{mode:`vega-lite`,actions:!1,renderer:`svg`,tooltip:!0,hover:!0}).then(e=>{t?e.finalize():r.current=e}).catch(()=>{t||a(`This chart could not be rendered.`)}),()=>{t=!0,r.current?.finalize(),r.current=null,i.replaceChildren()}},[e]),(0,H5.jsxs)(`div`,{className:`cg-vega-frame`,role:`img`,"aria-label":t,children:[(0,H5.jsx)(`div`,{ref:n,className:`cg-vega-host`}),i&&(0,H5.jsx)(`div`,{className:`cg-ch-empty`,children:i})]})}var V5,H5,dWe=o((()=>{V5=u(f(),1),cWe(),H5=Hp()}));dWe();var fWe={week:`Weekly`,month:`Monthly`,quarter:`Quarterly`,year:`Yearly`},pWe=[6,12,24,36],U5=72,W5=18;function mWe(){let e={stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`};return(0,H.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,"aria-hidden":!0,children:[(0,H.jsx)(`path`,{d:`M2.5 11.5h4v-4h4v-3h3`,...e}),(0,H.jsx)(`path`,{d:`M2.5 13.5h11`,...e,opacity:`0.45`})]})}function hWe(e){let t={server:[],snapshot:[],refused:[]};for(let n of e){let e=Zm(n);e===`server`?t.server.push(n):e===`snapshot`?t.snapshot.push(n):t.refused.push({field:n,why:kie(n)})}return t}function gWe(e){let t=e.length+1,n=new Set(e.map(e=>e.id));for(;n.has(`tsr_${t}`);)t+=1;return`tsr_${t}`}function _We({scope:e,pids:t,fields:n,rows:r,display:i,onDisplay:a,locked:o,onSheet:s}){let c=(0,z.useMemo)(()=>hWe(n),[n]),l=(0,z.useMemo)(()=>[...c.server,...c.snapshot],[c.server,c.snapshot]),u=(0,z.useMemo)(()=>new Set(c.snapshot.map(e=>e.key)),[c.snapshot]),d=ed.includes(i?.tsBucket??``)?i.tsBucket:Um,f=typeof i?.tsSpan?.lastN==`number`?i.tsSpan.lastN:12,p=(0,z.useMemo)(()=>{let e=(i?.tsFields??[]).filter(e=>l.some(t=>t.key===e));return e.length?e:l.slice(0,1).map(e=>e.key)},[i?.tsFields,l]),m=(0,z.useMemo)(()=>p.filter(e=>!u.has(e)),[p,u]),h=(0,z.useMemo)(()=>p.filter(e=>u.has(e)),[p,u]),g=(0,z.useMemo)(()=>i?.tsRows??[],[i?.tsRows]),_=(0,z.useMemo)(()=>i?.tsDeltas??[],[i?.tsDeltas]),v=i?.tsStyles,y=i?.tsGridlines!==!1,b=i?.tsSparkline===!0,[x,S]=(0,z.useState)(null),[C,w]=(0,z.useState)(`idle`),[T,E]=(0,z.useState)(0),[D,O]=(0,z.useState)(new Set),k=(0,z.useRef)(0),A=Ud();(0,z.useEffect)(()=>{if(A)return;if(!m.length||!t.length){S(null),w(`idle`);return}let n=++k.current;w(`loading`),ef(Wm({pids:t,bucket:d,span:{lastN:f},fields:m}),e).then(({payload:e,status:t})=>{if(n===k.current){if(!e){S(null),E(t),w(`error`);return}S(e),w(`idle`)}})},[A,e,t,d,f,m]);let j=(0,z.useMemo)(()=>Xm(x),[x]),M=(0,z.useMemo)(()=>{if(!h.length||!j.columns.length)return j;let e=new Map(n.map(e=>[e.key,e])),t=h.map(t=>e.get(t)).filter(e=>!!e).map(e=>Aie(e,r??[],j.columns,x?.meta?.today));return{...j,rows:[...j.rows,...t],empty:!1}},[j,h,n,r,x?.meta?.today]),N=(0,z.useMemo)(()=>Bie(M,{customRows:g,deltas:_,bucket:d,today:x?.meta?.today}),[M,g,_,d,x?.meta?.today]);(0,z.useEffect)(()=>{s?.(N)},[N,s]);let P=(0,z.useCallback)(e=>{O(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),F=e=>{e.length&&a?.({tsFields:e.slice(0,12)})},ee=e=>a?.({tsRows:e.length?e.slice(0,12):void 0}),I=e=>{let t=_.includes(e)?_.filter(t=>t!==e):[..._,e];a?.({tsDeltas:t.length?t:void 0})},te=(e,t)=>{let n={...v??{}},r={...th(v,e),...t},i={};r.bold&&(i.bold=!0),r.line&&(i.line=!0),i.bold||i.line?n[e]=i:delete n[e],a?.({tsStyles:Object.keys(n).length?n:void 0})};if(A)return(0,H.jsx)(`div`,{className:`cg-mode-empty`,children:`The time-series view runs in the web app. Open Loopable in a browser tab to see it.`});if(!l.length)return(0,H.jsx)(`div`,{className:`cg-mode-empty`,children:`This table has no number fields to plot. A time series needs either a metric with a period, or a numeric column to snapshot — add one from a column menu, then pick it here.`});let L=l.filter(e=>!p.includes(e.key)),ne=N.columns.length+2+ +!!b,re=h.length>0&&N.columns.length===0&&C!==`loading`;return(0,H.jsxs)(`div`,{className:`cg-ts`,children:[(0,H.jsxs)(`div`,{className:`cg-ts-bar`,children:[(0,H.jsxs)(`label`,{className:`cg-ts-ctl`,children:[(0,H.jsx)(`span`,{className:`cg-ts-ctl-k`,children:`Period`}),(0,H.jsx)(`select`,{className:`cg-select`,value:d,onChange:e=>a?.({tsBucket:e.target.value}),disabled:!a,children:ed.map(e=>(0,H.jsx)(`option`,{value:e,children:fWe[e]},e))})]}),(0,H.jsxs)(`label`,{className:`cg-ts-ctl`,children:[(0,H.jsx)(`span`,{className:`cg-ts-ctl-k`,children:`Span`}),(0,H.jsx)(`select`,{className:`cg-select`,value:String(f),onChange:e=>a?.({tsSpan:{lastN:Number(e.target.value)}}),disabled:!a,children:pWe.map(e=>(0,H.jsxs)(`option`,{value:e,children:[`Last `,e]},e))})]}),(0,H.jsx)(km,{label:_.length?`Compare · ${_.length}`:`Compare`,icon:(0,H.jsx)(mWe,{}),active:_.length>0,children:()=>(0,H.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Compare each period with`}),(0,H.jsx)(`div`,{className:`cg-pop-note`,children:`Each choice adds a sub-row under every metric. A comparison that cannot be answered for a metric says so in the footnotes rather than printing a number.`}),td.map(e=>(0,H.jsxs)(`label`,{className:`cg-check-row`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:_.includes(e),disabled:!a,onChange:()=>I(e)}),(0,H.jsx)(`span`,{className:`cg-check-label`,children:$m[e]})]},e))]})}),(0,H.jsxs)(`span`,{className:`cg-ts-group`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-ts-tog`+(y?` is-on`:``),"aria-pressed":y,disabled:!a,onClick:()=>a?.({tsGridlines:!y&&void 0}),children:`Gridlines`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-ts-tog`+(b?` is-on`:``),"aria-pressed":b,disabled:!a,onClick:()=>a?.({tsSparkline:!b||void 0}),children:`Trend`})]}),(0,H.jsx)(`span`,{className:`cg-ts-pool`,children:o?`This record`:`${N.pool.toLocaleString()} ${N.pool===1?`customer`:`customers`}`})]}),C===`error`&&(0,H.jsx)(`div`,{className:`cg-ts-note cg-ts-error`,children:T===400?`That span is too wide to bucket. Choose a shorter span or a larger period.`:T===403?`None of these records are in your book.`:`The time series could not be loaded. Nothing is shown rather than a guess.`}),re&&(0,H.jsxs)(`div`,{className:`cg-ts-note`,children:[h.length===1?`That column has`:`Those columns have`,` no period of its own, so `,h.length===1?`it is`:`they are`,` shown as a snapshot across the periods on the sheet — and this sheet has no periods yet. Add one metric with a period and `,h.length===1?`it`:`they`,` will appear beside it.`]}),c.refused.length>0&&(0,H.jsxs)(`details`,{className:`cg-ts-refused`,children:[(0,H.jsx)(`summary`,{className:`cg-ts-refsum`,children:c.refused.length===1?`1 column has no period of its own`:`${c.refused.length} columns have no period of their own`}),(0,H.jsx)(`div`,{className:`cg-ts-reflist`,children:c.refused.map(({field:e,why:t})=>(0,H.jsx)(`span`,{className:`cg-ts-refchip`,title:t,children:e.label},e.key))})]}),C===`loading`&&!x&&(0,H.jsx)(`div`,{className:`cg-ts-note`,children:(0,H.jsx)(`span`,{className:`lp-spin`,role:`status`,"aria-label":`Loading`})}),x&&(0,H.jsx)(`div`,{className:`cg-ts-scroll`,children:(0,H.jsxs)(`table`,{className:`cg-ts-table`+(y?``:` is-nogrid`),children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{className:`cg-ts-stick`,children:`Metric`}),N.columns.map(e=>(0,H.jsxs)(`th`,{className:e.partial?`is-partial`:void 0,children:[e.label,e.partial&&(0,H.jsx)(`span`,{className:`cg-ts-partial`,children:` · partial`})]},e.key)),(0,H.jsx)(`th`,{className:`cg-ts-total`,children:`Total`}),b&&(0,H.jsx)(`th`,{className:`cg-ts-sparkhead`,children:`Trend`})]})}),(0,H.jsxs)(`tbody`,{children:[N.rows.map(e=>(0,H.jsx)(yWe,{row:e,sheet:N,style:th(v,e.id),styles:v,sparkline:b,charted:D.has(e.id),editable:!!a,metricRow:M.rows.find(t=>t.field===e.id),onToggleChart:()=>P(e.id),onStyle:t=>te(e.id,t),onRemove:()=>{e.kind===`metric`?F(p.filter(t=>t!==e.id)):ee(g.filter(t=>t.id!==e.id))},onEditRow:t=>ee(g.map(n=>n.id===e.id?{...n,...t}:n))},e.id)),a&&(0,H.jsx)(`tr`,{className:`cg-ts-addrow`,children:(0,H.jsx)(`th`,{className:`cg-ts-stick`,colSpan:ne,children:(0,H.jsxs)(`span`,{className:`cg-ts-addbar`,children:[(0,H.jsx)(sm,{fields:L,value:void 0,onChange:e=>F([...p,e]),className:`cg-select cg-ts-addsel`,ariaLabel:`Add a metric row`,disabled:!L.length||p.length>=12,placeholder:L.length?p.length>=12?`At the 12-metric limit`:`+ Add metric`:`Every metric is on the sheet`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-ts-tog`,disabled:g.length>=12,onClick:()=>ee([...g,{id:gWe(g),kind:`note`,label:``}]),children:`+ Note`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-ts-tog`,disabled:g.length>=12,onClick:()=>ee([...g,{id:gWe(g),kind:`formula`,label:``,expr:``}]),children:`+ Formula`})]})})})]})]})}),x&&N.empty&&(0,H.jsx)(`div`,{className:`cg-ts-note`,children:`No metrics returned a series for this span.`}),N.notes.length>0&&(0,H.jsx)(`ul`,{className:`cg-ts-notes`,children:N.notes.map(e=>(0,H.jsx)(`li`,{children:e},e))})]})}function vWe({style:e,editable:t,onStyle:n,onRemove:r,label:i}){return t?(0,H.jsxs)(`span`,{className:`cg-ts-rowtools`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-ts-rowtool`+(e.bold?` is-on`:``),"aria-pressed":!!e.bold,"aria-label":`Bold ${i}`,title:`Bold`,onClick:()=>n({bold:!e.bold||void 0}),children:`B`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-ts-rowtool`+(e.line?` is-on`:``),"aria-pressed":!!e.line,"aria-label":`Rule above ${i}`,title:`Rule above`,onClick:()=>n({line:!e.line||void 0}),children:`―`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-ts-rowtool`,"aria-label":`Remove ${i}`,title:`Remove row`,onClick:r,children:`×`})]}):null}function yWe({row:e,sheet:t,style:n,styles:r,sparkline:i,charted:a,editable:o,metricRow:s,onToggleChart:c,onStyle:l,onRemove:u,onEditRow:d}){let f=(0,z.useMemo)(()=>{if(!a||!s)return null;let n=rh(s,t.columns);return n.points.length?oh({spec:{id:e.id,kind:`line`,agg:e.agg??`sum`},model:n,yTitle:e.label,formatValue:e=>e.toLocaleString(void 0,{maximumFractionDigits:2})}):null},[a,s,t.columns,e.id,e.agg,e.label]),p=t.columns.length+2+ +!!i,m=(n.line?`is-ruled`:``)+(n.bold?` is-bold`:``)||void 0;return e.kind===`note`?(0,H.jsx)(`tr`,{className:`cg-ts-noterow `+(m??``),children:(0,H.jsx)(`th`,{className:`cg-ts-stick`,colSpan:p,children:(0,H.jsxs)(`span`,{className:`cg-ts-rowhead`,children:[o?(0,H.jsx)(`input`,{className:`cg-ts-rowinput`,value:e.label,maxLength:120,placeholder:`Note — type a heading for this section`,"aria-label":`Note row label`,onChange:e=>d({label:e.target.value})}):(0,H.jsx)(`span`,{className:`cg-ts-rowlabel`,children:e.label}),(0,H.jsx)(vWe,{style:n,editable:o,onStyle:l,onRemove:u,label:e.label||`note row`})]})})}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`tr`,{className:m,children:[(0,H.jsx)(`th`,{scope:`row`,className:`cg-ts-stick`,children:(0,H.jsxs)(`span`,{className:`cg-ts-rowhead`,children:[(0,H.jsxs)(`span`,{className:`cg-ts-rowmain`,children:[e.kind===`formula`?o?(0,H.jsx)(`input`,{className:`cg-ts-rowinput`,value:e.label,maxLength:120,placeholder:`Formula row name`,"aria-label":`Formula row label`,onChange:e=>d({label:e.target.value})}):(0,H.jsx)(`span`,{className:`cg-ts-rowlabel`,children:e.label}):(0,H.jsx)(`button`,{type:`button`,className:`cg-ts-rowbtn`,onClick:c,"aria-pressed":a,title:a?`Show as a row of numbers`:`Show as a line`,children:e.label}),e.sublabel&&(0,H.jsx)(`span`,{className:`cg-ts-rowsub`,children:e.sublabel}),e.kind===`formula`&&(o?(0,H.jsx)(`input`,{className:`cg-ts-rowinput cg-ts-rowexpr`,value:e.expr??``,maxLength:200,spellCheck:!1,placeholder:`= [Sales] - [Returns]`,"aria-label":`Formula`,onChange:e=>d({expr:e.target.value})}):(0,H.jsx)(`span`,{className:`cg-ts-rowsub`,children:e.expr}))]}),(0,H.jsx)(vWe,{style:n,editable:o,onStyle:l,onRemove:u,label:e.label||`row`})]})}),e.cells.map((n,i)=>{let a=t.columns[i],o=th(r,e.id,a?.key);return(0,H.jsx)(`td`,{className:(n.partial?`is-partial`:``)+(o.bold?` is-bold`:``)||void 0,children:wie(n.value,Km)},a?.key??i)}),(0,H.jsx)(`td`,{className:`cg-ts-total`,children:e.total==null?``:Km(e.total)}),i&&(0,H.jsx)(`td`,{className:`cg-ts-spark`,children:(0,H.jsx)(xWe,{values:e.cells.map(e=>e.value),label:e.label})})]}),e.deltas.map(e=>(0,H.jsx)(bWe,{delta:e,sparkline:i},e.kind)),a&&(0,H.jsx)(`tr`,{className:`cg-ts-chartrow`,children:(0,H.jsx)(`td`,{colSpan:p,children:f?(0,H.jsx)(uWe,{spec:f,label:`${e.label} over time`}):(0,H.jsx)(`div`,{className:`cg-ts-note`,children:`Nothing to plot — every period for this metric is unanswered.`})})})]})}function bWe({delta:e,sparkline:t}){return(0,H.jsxs)(`tr`,{className:`cg-ts-delta`,children:[(0,H.jsx)(`th`,{scope:`row`,className:`cg-ts-stick`,children:e.label}),e.values.map((t,n)=>(0,H.jsx)(`td`,{className:t==null?void 0:t>=0?`is-up`:`is-down`,children:e.percent?Ym(t):t==null?`—`:`${t>0?`+`:``}${Km(t)}`},n)),(0,H.jsx)(`td`,{className:`cg-ts-total`}),t&&(0,H.jsx)(`td`,{className:`cg-ts-spark`})]})}function xWe({values:e,label:t}){let n=(0,z.useMemo)(()=>Rie(e,U5,W5),[e]);if(!n.length)return(0,H.jsx)(`span`,{className:`cg-ts-sparkempty`,children:`—`});let r=e.filter(e=>e!=null).length;return(0,H.jsx)(`svg`,{className:`cg-ts-sparksvg`,width:U5,height:W5,viewBox:`0 0 ${U5} ${W5}`,role:`img`,"aria-label":`${t}: trend over ${r} of ${e.length} periods`,children:n.map((e,t)=>(0,H.jsx)(`polyline`,{points:zie(e),fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinejoin:`round`,strokeLinecap:`round`},t))})}function G5(e){return!Number.isFinite(e)||e<0?`—`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(0)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function SWe(e){let t=[];return e.by&&t.push(e.by),e.ts&&t.push(e.ts.slice(0,16).replace(`T`,` `)),t.join(` · `)}function CWe({pid:e,docs:t,docPayload:n,onAdd:r,onFetch:i,onDelete:a}){let o=(0,z.useRef)(null),[s,c]=(0,z.useState)(null),[l,u]=(0,z.useState)(!1),d=(0,z.useRef)(null),[f,p]=(0,z.useState)(null);(0,z.useEffect)(()=>{if(!(!n||d.current==null)&&!(n.pid!==e||n.docId!==d.current)){d.current=null;try{let e=atob(n.data_b64),t=new Uint8Array(e.length);for(let n=0;nURL.revokeObjectURL(r),0)}catch{c(`That file could not be decoded. Nothing was downloaded.`)}}},[n,e]);let m=e=>{if(c(null),!e)return;if(e.size>5242880){c(`${e.name} is ${G5(e.size)}. The limit is ${G5(Ad)}, so it was not uploaded.`),o.current&&(o.current.value=``);return}u(!0);let t=new FileReader;t.onerror=()=>{u(!1),c(`${e.name} could not be read.`)},t.onload=()=>{u(!1);let n=String(t.result??``),i=n.indexOf(`,`);if(i<0){c(`${e.name} could not be encoded.`);return}r({name:e.name,mime:e.type||`application/octet-stream`,size:e.size,data_b64:n.slice(i+1)}),o.current&&(o.current.value=``)},t.readAsDataURL(e)};return(0,H.jsxs)(`section`,{className:`cg-detail-section cg-docs`,children:[(0,H.jsx)(`div`,{className:`cg-detail-section-title`,children:`Documents`}),t.length===0?(0,H.jsx)(`div`,{className:`cg-docs-empty`,children:`No documents on this customer yet.`}):(0,H.jsx)(`ul`,{className:`cg-docs-list`,children:t.map(e=>(0,H.jsxs)(`li`,{className:`cg-docs-row`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn cg-docs-name`,title:`Download ${e.name}`,onClick:()=>{c(null),d.current=e.id,i(e.id)},children:e.name}),(0,H.jsxs)(`span`,{className:`cg-docs-meta`,children:[G5(e.size),SWe(e)?` · ${SWe(e)}`:``]}),e.canDelete!==!1&&(0,H.jsx)(`button`,{type:`button`,className:`cg-docs-del`+(f===e.id?` is-armed`:``),"aria-label":f===e.id?`Delete ${e.name}?`:`Delete ${e.name}`,onClick:()=>{if(f!==e.id){p(e.id);return}p(null),a(e.id)},children:f===e.id?`Delete?`:`×`})]},e.id))}),(0,H.jsxs)(`div`,{className:`cg-docs-add`,children:[(0,H.jsx)(`input`,{ref:o,type:`file`,className:`cg-docs-file`,"aria-label":`Add a document`,disabled:l,onChange:e=>m(e.target.files?.[0])}),(0,H.jsxs)(`span`,{className:`cg-docs-cap`,children:[`Up to `,G5(Ad),` per file.`]})]}),s&&(0,H.jsx)(`div`,{className:`cg-docs-error`,children:s})]})}var wWe=`application/x-cg-field`;function TWe(e,t){let n=new Set(t),r=new Set,i=[];for(let t of e??[])!n.has(t)||r.has(t)||(r.add(t),i.push(t));for(let e of t)r.has(e)||(r.add(e),i.push(e));return i}function EWe(e,t,n){let r=e.indexOf(t),i=e.indexOf(n);if(r<0||i<0||r===i)return e;let a=[...e];return a.splice(r,1),a.splice(i,0,t),a}function DWe(e,t,n){let r=e.indexOf(t),i=r+n;if(r<0||i<0||i>=e.length)return e;let a=[...e];return a.splice(r,1),a.splice(i,0,t),a}function K5(e,t,n=``){return`${jd}/customers/${encodeURIComponent(String(t))}/comments${n}?scope=${encodeURIComponent(e)}`}var OWe=class extends Error{status;constructor(e,t){super(e),this.name=`RecordCommentsError`,this.status=t}};async function q5(e){let t=null;try{t=await e.json()}catch{}if(e.status===401&&Bd(Nd),!e.ok)throw new OWe(t?.error?.message||`The server answered ${e.status}.`,e.status);return t}async function kWe(e,t,n){let r=await q5(await fetch(K5(e,t),{credentials:Md,signal:n}));return Array.isArray(r.comments)?r.comments:[]}async function AWe(e,t,n){return(await q5(await fetch(K5(e,t),{method:`POST`,credentials:Md,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:n})}))).comment}async function jWe(e,t,n){await q5(await fetch(K5(e,t,`/${encodeURIComponent(n)}`),{method:`DELETE`,credentials:Md}))}function MWe(e){return{pid:e,comments:[],draft:``,loading:!0,posting:!1,error:``}}function NWe(e,t){if(t.type===`record`)return MWe(t.pid);if(t.pid!==e.pid)return e;switch(t.type){case`loaded`:return{...e,comments:t.comments,loading:!1,error:``};case`load-failed`:return{...e,loading:!1,error:t.error};case`draft`:return{...e,draft:t.draft};case`posting`:return{...e,posting:!0,error:``};case`posted`:return{...e,comments:[...e.comments,t.comment],draft:``,posting:!1};case`post-failed`:return{...e,posting:!1,error:t.error};case`deleted`:return{...e,comments:e.comments.filter(e=>e.id!==t.commentId)};case`delete-failed`:return{...e,error:t.error}}}function PWe(e){return e.trim().split(/\s+/).slice(0,2).map(e=>e[0]?.toUpperCase()).join(``)||`?`}function FWe(e){let t=new Date(e);return Number.isFinite(t.getTime())?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(t):e}function IWe({scope:e,pid:t,viewer:n}){let[r,i]=(0,z.useReducer)(NWe,t,MWe),{comments:a,draft:o,loading:s,posting:c,error:l}=r,u=(0,z.useRef)(null);(0,z.useEffect)(()=>{let n=new AbortController;return i({type:`record`,pid:t}),kWe(e,t,n.signal).then(e=>i({type:`loaded`,pid:t,comments:e})).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||i({type:`load-failed`,pid:t,error:e instanceof Error?e.message:`Comments could not be loaded.`})}),()=>n.abort()},[e,t]);let d=async n=>{n.preventDefault();let r=o.trim();if(!r||c)return;let a=t;i({type:`posting`,pid:a});try{let n=await AWe(e,a,r);i({type:`posted`,pid:a,comment:n}),a===t&&u.current?.focus()}catch(e){i({type:`post-failed`,pid:a,error:e instanceof Error?e.message:`That comment was not saved.`})}},f=async n=>{let r=t;try{await jWe(e,r,n.id),i({type:`deleted`,pid:r,commentId:n.id})}catch(e){i({type:`delete-failed`,pid:r,error:e instanceof Error?e.message:`That comment was not deleted.`})}};return(0,H.jsxs)(`aside`,{className:`cg-record-comments`,"aria-label":`Record comments`,children:[(0,H.jsxs)(`div`,{className:`cg-record-comments-head`,children:[(0,H.jsx)(`h2`,{children:`Comments`}),(0,H.jsx)(`span`,{children:a.length.toLocaleString()})]}),(0,H.jsxs)(`div`,{className:`cg-record-comment-feed`,"aria-live":`polite`,children:[s&&(0,H.jsx)(`div`,{className:`cg-record-comment-state`,children:(0,H.jsx)(`span`,{className:`lp-spin`,role:`status`,"aria-label":`Loading`})}),!s&&a.length===0&&!l&&(0,H.jsx)(`div`,{className:`cg-record-comment-state`,children:`No comments yet. Add context for the team here.`}),a.map(e=>{let t=n?.isAdmin===!0||n?.name?.trim().toLowerCase()===e.authorKey.toLowerCase();return(0,H.jsxs)(`article`,{className:`cg-record-comment`,children:[(0,H.jsx)(`div`,{className:`cg-record-comment-avatar`,"aria-hidden":!0,children:PWe(e.author)}),(0,H.jsxs)(`div`,{className:`cg-record-comment-content`,children:[(0,H.jsxs)(`div`,{className:`cg-record-comment-meta`,children:[(0,H.jsx)(`strong`,{children:e.author}),(0,H.jsx)(`time`,{dateTime:e.createdAt,children:FWe(e.createdAt)}),t&&(0,H.jsx)(`button`,{type:`button`,className:`cg-record-comment-delete`,"aria-label":`Delete comment by ${e.author}`,title:`Delete comment`,onClick:()=>void f(e),children:`×`})]}),(0,H.jsx)(`p`,{children:e.body})]})]},e.id)}),l&&(0,H.jsx)(`div`,{className:`cg-record-comment-error`,children:l})]}),(0,H.jsxs)(`form`,{className:`cg-record-comment-compose`,onSubmit:e=>void d(e),children:[(0,H.jsx)(`label`,{htmlFor:`cg-comment-${t}`,children:`Add a comment`}),(0,H.jsx)(`textarea`,{ref:u,id:`cg-comment-${t}`,value:o,maxLength:4e3,placeholder:`Share an update or leave context…`,onChange:e=>i({type:`draft`,pid:t,draft:e.target.value}),onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,H.jsxs)(`div`,{className:`cg-record-comment-compose-foot`,children:[(0,H.jsx)(`span`,{children:`Ctrl/⌘ + Enter to post`}),(0,H.jsx)(`button`,{type:`submit`,disabled:c||!o.trim(),children:c?`Posting…`:`Comment`})]})]})]})}function LWe(e,t){let n=t.trim();if(!n)return null;if(e.type===`url`)return/^https?:\/\//i.test(n)?n:/^[\w-]+(\.[\w-]+)+/.test(n)?`https://${n}`:null;if(e.type===`email`)return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)?`mailto:${n}`:null;if(e.type===`phone`){let e=n.replace(/[\s().-]/g,``);return/^\+?\d{5,}$/.test(e)?`tel:${e}`:null}return null}function RWe({value:e,...t}){let n=(0,z.useRef)(null);return(0,z.useLayoutEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{e.style.height=`auto`;let t=window.getComputedStyle(e),n=t.boxSizing===`border-box`?(parseFloat(t.borderTopWidth)||0)+(parseFloat(t.borderBottomWidth)||0):0;e.style.height=`${e.scrollHeight+n}px`};return t(),window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t)},[e]),(0,H.jsx)(`textarea`,{ref:n,value:e,...t})}function zWe({name:e,avatars:t}){let n=t?.[e];if(n&&n.startsWith(`data:image/`))return(0,H.jsx)(`img`,{className:`cg-detail-avatar`,src:n,alt:``,"aria-hidden":!0});let r=vp(e);return(0,H.jsx)(`span`,{className:`cg-detail-avatar cg-detail-avatar--initials`,style:{background:r.bg,color:r.fg},"aria-hidden":!0,children:xie(e)})}function BWe(){return(0,H.jsx)(`svg`,{width:`10`,height:`14`,viewBox:`0 0 10 14`,"aria-hidden":!0,focusable:`false`,children:[3,7,11].map(e=>[3,7].map(t=>(0,H.jsx)(`circle`,{cx:t,cy:e,r:`1.15`,fill:`currentColor`},`${t}-${e}`)))})}function VWe({fields:e,record:t,titleKey:n,positionLabel:r,canPrev:i,canNext:a,onPrev:o,onNext:s,onClose:c,onNotesChange:l,onNotesCommit:u,viewer:d,docs:f,docPayload:p,onDocAdd:m,onDocFetch:h,onDocDelete:g,recordLayout:_,onRecordLayout:v,scope:y,userOptions:b,userAvatars:x}){let S=(0,z.useRef)(null),C=(0,z.useId)(),w=(0,z.useId)(),T=String(t[n]??`Untitled`),E=!Ud()&&y!=null,[D,O]=(0,z.useState)(``),[k,A]=(0,z.useState)(``),j=e.filter(e=>e.source===`overlay`),M=j.filter(e=>!Xu(e.type)&&e.type!==`checkbox`&&e.type!==`rating`),N=j.filter(e=>e.type===`checkbox`),P=j.filter(e=>e.type===`rating`),F=j.filter(e=>Xu(e.type)),ee=e.filter(e=>e.source!==`overlay`&&e.key!==n),I=new Map(e.map(e=>[e.key,e])),te=[...M,...N,...P,...F,...ee].map(e=>e.key),[L,ne]=(0,z.useState)(null);(0,z.useEffect)(()=>{ne(e=>e&&JSON.stringify(e)===JSON.stringify(_??[])?null:e)},[_]);let re=TWe(L??_,te),ie=(0,z.useRef)(null),[ae,oe]=(0,z.useState)(null),[se,ce]=(0,z.useState)(null),le=(0,z.useRef)(new Map),ue=(0,z.useRef)(null);(0,z.useLayoutEffect)(()=>{let e=ue.current;e&&(ue.current=null,le.current.get(e)?.focus())});let[de,fe]=(0,z.useState)(null),pe=de&&re.includes(de)?de:re[0],me=e=>{e!==re&&(ne(e),v?.(e))},[he,ge]=(0,z.useState)(`fields`),_e=y!=null,ve=_e?he:`fields`,[ye,be]=(0,z.useState)({mode:`timeseries`}),xe=(0,z.useMemo)(()=>[Number(t.pid)],[t.pid]),Se=(0,z.useMemo)(()=>[t],[t]),Ce=(e,t)=>(0,H.jsx)(`button`,{type:`button`,className:`cg-detail-grip`,ref:t=>{le.current.set(e.key,t)},draggable:!0,tabIndex:e.key===pe?0:-1,onFocus:()=>fe(e.key),"aria-label":`Reorder ${e.label}, position ${t+1} of ${re.length}`,title:`Drag to reorder — or press the arrow keys`,onDragStart:t=>{ie.current=e.key,oe(e.key),t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(wWe,e.key);let n=t.currentTarget.parentElement;n&&t.dataTransfer.setDragImage(n,14,n.clientHeight/2)},onDragEnd:()=>{ie.current=null,oe(null),ce(null)},onKeyDown:t=>{if(t.key!==`ArrowUp`&&t.key!==`ArrowDown`)return;t.preventDefault();let n=DWe(re,e.key,t.key===`ArrowUp`?-1:1);n!==re&&(ue.current=e.key,me(n))},children:(0,H.jsx)(BWe,{})}),we=(e,n)=>{let r=`cg-ov-${e.key}`,i=Fee(e,d),a=e.type===`user`&&!b?.length,o=i&&!a,s=o&&!Xu(e.type)&&e.type!==`checkbox`&&e.type!==`rating`&&e.type!==`date`&&e.type!==`int`&&e.type!==`currency`&&e.type!==`image`&&e.type!==`pct`,c=o&&!s,f=`cg-detail-field`+(s?` cg-detail-field--edit`:``)+(c?` cg-detail-field--control`:``)+(se===e.key?` is-dropzone`:``)+(ae===e.key?` is-dragging`:``),p;if(s){let n=String(t[e.key]??``),i=LWe(e,n);p=(0,H.jsxs)(`div`,{className:`cg-detail-editwrap`,children:[(0,H.jsx)(RWe,{id:r,className:`cg-detail-textarea`,value:n,placeholder:`Add ${e.label.toLowerCase()}…`,onChange:t=>l(e.key,t.target.value),onBlur:t=>u(e.key,t.target.value)}),i&&(0,H.jsx)(`a`,{className:`cg-detail-action`,href:i,target:e.type===`url`?`_blank`:void 0,rel:e.type===`url`?`noopener noreferrer`:void 0,children:e.type===`url`?`Open link`:e.type===`email`?`Send email`:`Call`})]})}else if(e.source===`overlay`&&e.type===`checkbox`)p=(0,H.jsx)(`input`,{id:r,type:`checkbox`,className:`cg-detail-checkbox`,checked:Dp(t[e.key]),disabled:!o,onChange:t=>u(e.key,t.target.checked?`1`:``)});else if(e.type===`image`){let n=String(t[e.key]??``).trim();p=(0,H.jsxs)(`span`,{className:`cg-detail-value cg-detail-value--live cg-detail-imageslot`,children:[n?(0,H.jsx)(`img`,{className:`cg-detail-image`,src:np(n,`web`),alt:`${e.label} for ${T}`,onError:e=>{e.currentTarget.style.display=`none`}}):(0,H.jsx)(`span`,{className:`cg-detail-imageempty`,"aria-hidden":!0}),(0,H.jsxs)(`span`,{className:`cg-detail-imagemeta`,children:[(0,H.jsx)(`span`,{className:`cg-detail-imageref`,children:n||`No image`}),o&&(0,H.jsxs)(`span`,{className:`cg-detail-imageacts`,children:[(0,H.jsxs)(`label`,{className:`cg-detail-imagebtn`,children:[n?`Replace`:`Upload`,(0,H.jsx)(`input`,{type:`file`,accept:`image/png,image/jpeg`,onChange:t=>{let n=t.target.files?.[0];t.target.value=``,n&&(O(e.key),Xne(n).then(t=>{A(``),u(e.key,t)}).catch(e=>A(e instanceof Error?e.message:`That image was not saved.`)).finally(()=>O(``)))}})]}),n&&(0,H.jsx)(`button`,{type:`button`,className:`cg-detail-imagebtn`,onClick:()=>u(e.key,``),children:`Remove`})]}),D===e.key&&(0,H.jsx)(`span`,{className:`lp-spin`,role:`status`,"aria-label":`Uploading`}),k&&D!==e.key&&(0,H.jsx)(`span`,{className:`cg-detail-imageerr`,children:k})]})]})}else if(c&&e.type===`rating`){let n=$u(e),i=Hm(e,t[e.key]);p=(0,H.jsx)(`span`,{className:`cg-detail-value cg-detail-value--live`,role:`group`,"aria-labelledby":`${r}-lbl`,children:(0,H.jsx)(`span`,{className:`cg-detail-stars`,children:Array.from({length:n},(e,t)=>t+1).map(n=>(0,H.jsx)(`button`,{type:`button`,className:`cg-detail-star`,"aria-pressed":n<=i,"aria-label":n===i?`Clear ${e.label}`:`${n} star${n===1?``:`s`}`,title:n===i?`Click again to clear`:void 0,onClick:()=>u(e.key,bie(e,t[e.key],n)),children:(0,H.jsx)(Im,{on:n<=i})},n))})})}else if(c&&(e.type===`select`||e.type===`user`)){let n=Lm(t[e.key]),i=Bm(e,b,n);p=(0,H.jsxs)(`span`,{className:`cg-detail-value cg-detail-value--live cg-detail-pickslot`,children:[e.type===`user`&&n!==``&&(0,H.jsx)(zWe,{name:n,avatars:x}),(0,H.jsxs)(`select`,{id:r,className:`cg-detail-select`,value:n,onChange:t=>u(e.key,t.target.value),children:[(0,H.jsx)(`option`,{value:``,children:e.type===`user`?`Unassigned`:`None`}),i.map(e=>(0,H.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]})}else if(c&&e.type===`multiselect`){let n=t[e.key],i=zm(n),a=Bm(e,b,n);p=(0,H.jsx)(`span`,{className:`cg-detail-value cg-detail-value--live`,role:`group`,"aria-labelledby":`${r}-lbl`,children:a.length===0?(0,H.jsx)(`span`,{className:`cg-detail-nochoice`,children:`No choices yet. Add them from the column menu.`}):(0,H.jsx)(`span`,{className:`cg-detail-chips`,children:a.map(t=>{let r=i.includes(t.value);return(0,H.jsx)(`button`,{type:`button`,className:`cg-detail-chip`+(r?` is-on`:``),"aria-pressed":r,title:t.stale?`No longer a choice on this field`:void 0,onClick:()=>u(e.key,vie(n,t.value)),children:t.label},t.value)})})})}else if(c&&e.type===`date`){let n=t[e.key],i=mie(n);p=i===null?(0,H.jsxs)(`span`,{className:`cg-detail-value cg-detail-value--live cg-detail-pickslot`,children:[(0,H.jsx)(`input`,{id:r,type:`text`,className:`cg-detail-input`,value:Lm(n),title:`This value is not a date the picker can read — it is shown as stored.`,onChange:t=>l(e.key,t.target.value),onBlur:t=>u(e.key,t.target.value)}),(0,H.jsx)(`span`,{className:`cg-detail-hint`,children:`not a recognised date`})]}):(0,H.jsx)(`span`,{className:`cg-detail-value cg-detail-value--live`,children:(0,H.jsx)(`input`,{id:r,type:`date`,className:`cg-detail-input`,value:i,onChange:t=>u(e.key,gie(n,t.target.value))})})}else if(c&&(e.type===`int`||e.type===`currency`||e.type===`pct`)){let n=e.type===`currency`?`$`:e.type===`pct`?`%`:``;p=(0,H.jsxs)(`span`,{className:`cg-detail-value cg-detail-value--live cg-detail-pickslot`,children:[e.type===`currency`&&(0,H.jsx)(`span`,{className:`cg-detail-unit`,children:n}),(0,H.jsx)(`input`,{id:r,type:`number`,className:`cg-detail-input cg-detail-input--num`,value:Vm(t[e.key]),step:e.type===`int`?1:`any`,placeholder:`—`,onChange:t=>l(e.key,t.target.value),onBlur:n=>{let r=yie(n.target.value);r===null?l(e.key,Vm(t[e.key])):u(e.key,r)}}),e.type===`pct`&&(0,H.jsx)(`span`,{className:`cg-detail-unit`,children:n})]})}else if(e.source===`overlay`&&e.type===`rating`)p=(0,H.jsx)(`span`,{className:`cg-detail-value`,title:a?void 0:`You do not have permission to edit this field`,children:(0,H.jsx)(pie,{value:Hm(e,t[e.key]),max:$u(e)})});else if(e.type===`automation`){let n=Lm(t[e.key]),r=Ap(n);p=(0,H.jsxs)(`span`,{className:`cg-detail-value cg-detail-auto`,title:n||`Not run yet`,children:[(0,H.jsx)(`span`,{className:`cg-detail-auto-chip is-${r}`,children:fre(n)}),jp(n)?(0,H.jsx)(`span`,{className:`cg-detail-auto-detail`,children:jp(n)}):null]})}else{let n=e.source===`overlay`?a?`No assignable people were supplied for this workspace`:`You do not have permission to edit this field`:void 0,r=e.type===`user`&&Lm(t[e.key])!==``;p=(0,H.jsxs)(`span`,{className:`cg-detail-value`+(r?` cg-detail-pickslot`:``),title:n,children:[r&&(0,H.jsx)(zWe,{name:Lm(t[e.key]),avatars:x}),Mp(e,t[e.key])||`—`]})}let m=c&&(e.type===`rating`||e.type===`multiselect`),h=!m&&(s||c||e.source===`overlay`&&e.type===`checkbox`);return(0,H.jsxs)(`div`,{className:f,onDragOver:t=>{ie.current&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,se!==e.key&&ce(e.key))},onDragLeave:t=>{t.currentTarget.contains(t.relatedTarget)||ce(t=>t===e.key?null:t)},onDrop:t=>{t.preventDefault();let n=t.dataTransfer.getData(`application/x-cg-field`)||ie.current;ce(null),n&&me(EWe(re,n,e.key))},children:[Ce(e,n),h?(0,H.jsx)(`label`,{className:`cg-detail-label`,htmlFor:r,children:e.label}):(0,H.jsx)(`span`,{className:`cg-detail-label`,id:m?`${r}-lbl`:void 0,children:e.label}),p]},e.key)};return qp({panelRef:S,onDismiss:c,dismissOnOutside:!0,initialFocus:`[data-overlay-autofocus]`,trapFocus:!0}),(0,H.jsx)(Jp,{children:(0,H.jsx)(`div`,{className:`cg-record-backdrop`,children:(0,H.jsxs)(`div`,{className:`cg-record-modal`+(E?``:` cg-record-modal--single`),ref:S,role:`dialog`,"aria-modal":`true`,"aria-labelledby":C,"data-overlay-kind":`record-detail`,tabIndex:-1,children:[(0,H.jsxs)(`div`,{className:`cg-detail-header`,children:[(0,H.jsxs)(`div`,{className:`cg-detail-nav`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-detail-navbtn`,onClick:o,disabled:!i,"aria-label":`Previous record`,title:`Previous record`,children:`‹`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-detail-navbtn`,onClick:s,disabled:!a,"aria-label":`Next record`,title:`Next record`,children:`›`}),(0,H.jsx)(`span`,{className:`cg-detail-pos`,children:r})]}),(0,H.jsx)(`button`,{type:`button`,className:`cg-detail-close`,"data-overlay-autofocus":!0,onClick:c,"aria-label":`Close panel`,title:`Close`,children:`×`})]}),(0,H.jsxs)(`div`,{className:`cg-record-layout`,children:[(0,H.jsxs)(`main`,{className:`cg-record-main`,children:[(0,H.jsx)(`div`,{className:`cg-detail-titlewrap`,children:(0,H.jsx)(`div`,{className:`cg-detail-title`,id:C,title:T,children:T})}),_e&&(0,H.jsx)(`div`,{className:`cg-record-tabs`,role:`tablist`,"aria-label":`Record view`,children:[`fields`,`insights`].map(e=>(0,H.jsx)(`button`,{type:`button`,role:`tab`,id:`${w}-${e}`,"aria-selected":ve===e,"aria-controls":`${w}-panel`,className:`cg-record-tab`+(ve===e?` is-on`:``),onClick:()=>ge(e),children:e===`fields`?`Fields`:`Insights`},e))}),(0,H.jsx)(`div`,{className:`cg-detail-body`,id:`${w}-panel`,role:_e?`tabpanel`:void 0,"aria-labelledby":_e?`${w}-${ve}`:void 0,children:ve===`insights`&&y?(0,H.jsx)(`div`,{className:`cg-record-insights`,children:(0,H.jsx)(_We,{scope:y,pids:xe,fields:e,rows:Se,display:ye,onDisplay:e=>be(t=>({...t,...e})),locked:!0})}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`section`,{className:`cg-detail-section cg-detail-fieldlist`,children:re.map((e,t)=>{let n=I.get(e);return n?we(n,t):null})}),m&&h&&g&&(0,H.jsx)(CWe,{pid:Number(t.pid),docs:f??[],docPayload:p,onAdd:m,onFetch:h,onDelete:g})]})})]}),E&&y!=null&&(0,H.jsx)(IWe,{scope:y,pid:Number(t.pid),viewer:d},`${y}:${Number(t.pid)}`)]})]})})})}var HWe=[`csv`,`xlsx`,`pdf`,`json`],UWe={csv:`CSV`,xlsx:`Excel`,pdf:`PDF`,json:`JSON`};function WWe(e,t,n){let r=(e.trim()||`export`).replace(/[\\/:*?"<>|]/g,`_`);return t?`${r} - ${t}.${n}`:`${r}.${n}`}function GWe(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function KWe(e,t){let n=[e.map(e=>GWe(e.label)).join(`,`)];for(let r of t)n.push(e.map(e=>GWe(Mp(e,r[e.key]))).join(`,`));return n.join(`\r +`,uWe=`chart-wrapper`})),fWe=c({default:()=>pWe});function pWe({spec:e,label:t}){let n=(0,z5.useRef)(null),r=(0,z5.useRef)(null),[i,a]=(0,z5.useState)(``);return(0,z5.useEffect)(()=>{let t=!1;a(``),r.current?.finalize(),r.current=null;let i=n.current;if(i)return i.replaceChildren(),AUe(i,e,{mode:`vega-lite`,actions:!1,renderer:`svg`,tooltip:!0,hover:!0}).then(e=>{t?e.finalize():r.current=e}).catch(()=>{t||a(`This chart could not be rendered.`)}),()=>{t=!0,r.current?.finalize(),r.current=null,i.replaceChildren()}},[e]),(0,B5.jsxs)(`div`,{className:`cg-vega-frame`,role:`img`,"aria-label":t,children:[(0,B5.jsx)(`div`,{ref:n,className:`cg-vega-host`}),i&&(0,B5.jsx)(`div`,{className:`cg-ch-empty`,children:i})]})}var z5,B5,mWe=o((()=>{z5=u(f(),1),dWe(),B5=Hp()}));mWe();var hWe={week:`Weekly`,month:`Monthly`,quarter:`Quarterly`,year:`Yearly`},gWe=[6,12,24,36],V5=72,H5=18;function _We(){let e={stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`};return(0,H.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,"aria-hidden":!0,children:[(0,H.jsx)(`path`,{d:`M2.5 11.5h4v-4h4v-3h3`,...e}),(0,H.jsx)(`path`,{d:`M2.5 13.5h11`,...e,opacity:`0.45`})]})}function vWe(e){let t={server:[],snapshot:[],refused:[]};for(let n of e){let e=Zm(n);e===`server`?t.server.push(n):e===`snapshot`?t.snapshot.push(n):t.refused.push({field:n,why:Aie(n)})}return t}function yWe(e){let t=e.length+1,n=new Set(e.map(e=>e.id));for(;n.has(`tsr_${t}`);)t+=1;return`tsr_${t}`}function bWe({scope:e,pids:t,fields:n,rows:r,display:i,onDisplay:a,locked:o,onSheet:s}){let c=(0,z.useMemo)(()=>vWe(n),[n]),l=(0,z.useMemo)(()=>[...c.server,...c.snapshot],[c.server,c.snapshot]),u=(0,z.useMemo)(()=>new Set(c.snapshot.map(e=>e.key)),[c.snapshot]),d=ed.includes(i?.tsBucket??``)?i.tsBucket:Um,f=typeof i?.tsSpan?.lastN==`number`?i.tsSpan.lastN:12,p=(0,z.useMemo)(()=>{let e=(i?.tsFields??[]).filter(e=>l.some(t=>t.key===e));return e.length?e:l.slice(0,1).map(e=>e.key)},[i?.tsFields,l]),m=(0,z.useMemo)(()=>p.filter(e=>!u.has(e)),[p,u]),h=(0,z.useMemo)(()=>p.filter(e=>u.has(e)),[p,u]),g=(0,z.useMemo)(()=>i?.tsRows??[],[i?.tsRows]),_=(0,z.useMemo)(()=>i?.tsDeltas??[],[i?.tsDeltas]),v=i?.tsStyles,y=i?.tsGridlines!==!1,b=i?.tsSparkline===!0,[x,S]=(0,z.useState)(null),[C,w]=(0,z.useState)(`idle`),[T,E]=(0,z.useState)(0),[D,O]=(0,z.useState)(new Set),k=(0,z.useRef)(0),A=Ud();(0,z.useEffect)(()=>{if(A)return;if(!m.length||!t.length){S(null),w(`idle`);return}let n=++k.current;w(`loading`),ef(Wm({pids:t,bucket:d,span:{lastN:f},fields:m}),e).then(({payload:e,status:t})=>{if(n===k.current){if(!e){S(null),E(t),w(`error`);return}S(e),w(`idle`)}})},[A,e,t,d,f,m]);let j=(0,z.useMemo)(()=>Xm(x),[x]),M=(0,z.useMemo)(()=>{if(!h.length||!j.columns.length)return j;let e=new Map(n.map(e=>[e.key,e])),t=h.map(t=>e.get(t)).filter(e=>!!e).map(e=>jie(e,r??[],j.columns,x?.meta?.today));return{...j,rows:[...j.rows,...t],empty:!1}},[j,h,n,r,x?.meta?.today]),N=(0,z.useMemo)(()=>Vie(M,{customRows:g,deltas:_,bucket:d,today:x?.meta?.today}),[M,g,_,d,x?.meta?.today]);(0,z.useEffect)(()=>{s?.(N)},[N,s]);let P=(0,z.useCallback)(e=>{O(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),F=e=>{e.length&&a?.({tsFields:e.slice(0,12)})},ee=e=>a?.({tsRows:e.length?e.slice(0,12):void 0}),I=e=>{let t=_.includes(e)?_.filter(t=>t!==e):[..._,e];a?.({tsDeltas:t.length?t:void 0})},te=(e,t)=>{let n={...v??{}},r={...th(v,e),...t},i={};r.bold&&(i.bold=!0),r.line&&(i.line=!0),i.bold||i.line?n[e]=i:delete n[e],a?.({tsStyles:Object.keys(n).length?n:void 0})};if(A)return(0,H.jsx)(`div`,{className:`cg-mode-empty`,children:`The time-series view runs in the web app. Open Loopable in a browser tab to see it.`});if(!l.length)return(0,H.jsx)(`div`,{className:`cg-mode-empty`,children:`This table has no number fields to plot. A time series needs either a metric with a period, or a numeric column to snapshot — add one from a column menu, then pick it here.`});let L=l.filter(e=>!p.includes(e.key)),ne=N.columns.length+2+ +!!b,re=h.length>0&&N.columns.length===0&&C!==`loading`;return(0,H.jsxs)(`div`,{className:`cg-ts`,children:[(0,H.jsxs)(`div`,{className:`cg-ts-bar`,children:[(0,H.jsxs)(`label`,{className:`cg-ts-ctl`,children:[(0,H.jsx)(`span`,{className:`cg-ts-ctl-k`,children:`Period`}),(0,H.jsx)(`select`,{className:`cg-select`,value:d,onChange:e=>a?.({tsBucket:e.target.value}),disabled:!a,children:ed.map(e=>(0,H.jsx)(`option`,{value:e,children:hWe[e]},e))})]}),(0,H.jsxs)(`label`,{className:`cg-ts-ctl`,children:[(0,H.jsx)(`span`,{className:`cg-ts-ctl-k`,children:`Span`}),(0,H.jsx)(`select`,{className:`cg-select`,value:String(f),onChange:e=>a?.({tsSpan:{lastN:Number(e.target.value)}}),disabled:!a,children:gWe.map(e=>(0,H.jsxs)(`option`,{value:e,children:[`Last `,e]},e))})]}),(0,H.jsx)(km,{label:_.length?`Compare · ${_.length}`:`Compare`,icon:(0,H.jsx)(_We,{}),active:_.length>0,children:()=>(0,H.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Compare each period with`}),(0,H.jsx)(`div`,{className:`cg-pop-note`,children:`Each choice adds a sub-row under every metric. A comparison that cannot be answered for a metric says so in the footnotes rather than printing a number.`}),td.map(e=>(0,H.jsxs)(`label`,{className:`cg-check-row`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:_.includes(e),disabled:!a,onChange:()=>I(e)}),(0,H.jsx)(`span`,{className:`cg-check-label`,children:$m[e]})]},e))]})}),(0,H.jsxs)(`span`,{className:`cg-ts-group`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-ts-tog`+(y?` is-on`:``),"aria-pressed":y,disabled:!a,onClick:()=>a?.({tsGridlines:!y&&void 0}),children:`Gridlines`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-ts-tog`+(b?` is-on`:``),"aria-pressed":b,disabled:!a,onClick:()=>a?.({tsSparkline:!b||void 0}),children:`Trend`})]}),(0,H.jsx)(`span`,{className:`cg-ts-pool`,children:o?`This record`:`${N.pool.toLocaleString()} ${N.pool===1?`customer`:`customers`}`})]}),C===`error`&&(0,H.jsx)(`div`,{className:`cg-ts-note cg-ts-error`,children:T===400?`That span is too wide to bucket. Choose a shorter span or a larger period.`:T===403?`None of these records are in your book.`:`The time series could not be loaded. Nothing is shown rather than a guess.`}),re&&(0,H.jsxs)(`div`,{className:`cg-ts-note`,children:[h.length===1?`That column has`:`Those columns have`,` no period of its own, so `,h.length===1?`it is`:`they are`,` shown as a snapshot across the periods on the sheet — and this sheet has no periods yet. Add one metric with a period and `,h.length===1?`it`:`they`,` will appear beside it.`]}),c.refused.length>0&&(0,H.jsxs)(`details`,{className:`cg-ts-refused`,children:[(0,H.jsx)(`summary`,{className:`cg-ts-refsum`,children:c.refused.length===1?`1 column has no period of its own`:`${c.refused.length} columns have no period of their own`}),(0,H.jsx)(`div`,{className:`cg-ts-reflist`,children:c.refused.map(({field:e,why:t})=>(0,H.jsx)(`span`,{className:`cg-ts-refchip`,title:t,children:e.label},e.key))})]}),C===`loading`&&!x&&(0,H.jsx)(`div`,{className:`cg-ts-note`,children:(0,H.jsx)(`span`,{className:`lp-spin`,role:`status`,"aria-label":`Loading`})}),x&&(0,H.jsx)(`div`,{className:`cg-ts-scroll`,children:(0,H.jsxs)(`table`,{className:`cg-ts-table`+(y?``:` is-nogrid`),children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{className:`cg-ts-stick`,children:`Metric`}),N.columns.map(e=>(0,H.jsxs)(`th`,{className:e.partial?`is-partial`:void 0,children:[e.label,e.partial&&(0,H.jsx)(`span`,{className:`cg-ts-partial`,children:` · partial`})]},e.key)),(0,H.jsx)(`th`,{className:`cg-ts-total`,children:`Total`}),b&&(0,H.jsx)(`th`,{className:`cg-ts-sparkhead`,children:`Trend`})]})}),(0,H.jsxs)(`tbody`,{children:[N.rows.map(e=>(0,H.jsx)(SWe,{row:e,sheet:N,style:th(v,e.id),styles:v,sparkline:b,charted:D.has(e.id),editable:!!a,metricRow:M.rows.find(t=>t.field===e.id),onToggleChart:()=>P(e.id),onStyle:t=>te(e.id,t),onRemove:()=>{e.kind===`metric`?F(p.filter(t=>t!==e.id)):ee(g.filter(t=>t.id!==e.id))},onEditRow:t=>ee(g.map(n=>n.id===e.id?{...n,...t}:n))},e.id)),a&&(0,H.jsx)(`tr`,{className:`cg-ts-addrow`,children:(0,H.jsx)(`th`,{className:`cg-ts-stick`,colSpan:ne,children:(0,H.jsxs)(`span`,{className:`cg-ts-addbar`,children:[(0,H.jsx)(sm,{fields:L,value:void 0,onChange:e=>F([...p,e]),className:`cg-select cg-ts-addsel`,ariaLabel:`Add a metric row`,disabled:!L.length||p.length>=12,placeholder:L.length?p.length>=12?`At the 12-metric limit`:`+ Add metric`:`Every metric is on the sheet`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-ts-tog`,disabled:g.length>=12,onClick:()=>ee([...g,{id:yWe(g),kind:`note`,label:``}]),children:`+ Note`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-ts-tog`,disabled:g.length>=12,onClick:()=>ee([...g,{id:yWe(g),kind:`formula`,label:``,expr:``}]),children:`+ Formula`})]})})})]})]})}),x&&N.empty&&(0,H.jsx)(`div`,{className:`cg-ts-note`,children:`No metrics returned a series for this span.`}),N.notes.length>0&&(0,H.jsx)(`ul`,{className:`cg-ts-notes`,children:N.notes.map(e=>(0,H.jsx)(`li`,{children:e},e))})]})}function xWe({style:e,editable:t,onStyle:n,onRemove:r,label:i}){return t?(0,H.jsxs)(`span`,{className:`cg-ts-rowtools`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-ts-rowtool`+(e.bold?` is-on`:``),"aria-pressed":!!e.bold,"aria-label":`Bold ${i}`,title:`Bold`,onClick:()=>n({bold:!e.bold||void 0}),children:`B`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-ts-rowtool`+(e.line?` is-on`:``),"aria-pressed":!!e.line,"aria-label":`Rule above ${i}`,title:`Rule above`,onClick:()=>n({line:!e.line||void 0}),children:`―`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-ts-rowtool`,"aria-label":`Remove ${i}`,title:`Remove row`,onClick:r,children:`×`})]}):null}function SWe({row:e,sheet:t,style:n,styles:r,sparkline:i,charted:a,editable:o,metricRow:s,onToggleChart:c,onStyle:l,onRemove:u,onEditRow:d}){let f=(0,z.useMemo)(()=>{if(!a||!s)return null;let n=rh(s,t.columns);return n.points.length?oh({spec:{id:e.id,kind:`line`,agg:e.agg??`sum`},model:n,yTitle:e.label,formatValue:e=>e.toLocaleString(void 0,{maximumFractionDigits:2})}):null},[a,s,t.columns,e.id,e.agg,e.label]),p=t.columns.length+2+ +!!i,m=(n.line?`is-ruled`:``)+(n.bold?` is-bold`:``)||void 0;return e.kind===`note`?(0,H.jsx)(`tr`,{className:`cg-ts-noterow `+(m??``),children:(0,H.jsx)(`th`,{className:`cg-ts-stick`,colSpan:p,children:(0,H.jsxs)(`span`,{className:`cg-ts-rowhead`,children:[o?(0,H.jsx)(`input`,{className:`cg-ts-rowinput`,value:e.label,maxLength:120,placeholder:`Note — type a heading for this section`,"aria-label":`Note row label`,onChange:e=>d({label:e.target.value})}):(0,H.jsx)(`span`,{className:`cg-ts-rowlabel`,children:e.label}),(0,H.jsx)(xWe,{style:n,editable:o,onStyle:l,onRemove:u,label:e.label||`note row`})]})})}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`tr`,{className:m,children:[(0,H.jsx)(`th`,{scope:`row`,className:`cg-ts-stick`,children:(0,H.jsxs)(`span`,{className:`cg-ts-rowhead`,children:[(0,H.jsxs)(`span`,{className:`cg-ts-rowmain`,children:[e.kind===`formula`?o?(0,H.jsx)(`input`,{className:`cg-ts-rowinput`,value:e.label,maxLength:120,placeholder:`Formula row name`,"aria-label":`Formula row label`,onChange:e=>d({label:e.target.value})}):(0,H.jsx)(`span`,{className:`cg-ts-rowlabel`,children:e.label}):(0,H.jsx)(`button`,{type:`button`,className:`cg-ts-rowbtn`,onClick:c,"aria-pressed":a,title:a?`Show as a row of numbers`:`Show as a line`,children:e.label}),e.sublabel&&(0,H.jsx)(`span`,{className:`cg-ts-rowsub`,children:e.sublabel}),e.kind===`formula`&&(o?(0,H.jsx)(`input`,{className:`cg-ts-rowinput cg-ts-rowexpr`,value:e.expr??``,maxLength:200,spellCheck:!1,placeholder:`= [Sales] - [Returns]`,"aria-label":`Formula`,onChange:e=>d({expr:e.target.value})}):(0,H.jsx)(`span`,{className:`cg-ts-rowsub`,children:e.expr}))]}),(0,H.jsx)(xWe,{style:n,editable:o,onStyle:l,onRemove:u,label:e.label||`row`})]})}),e.cells.map((n,i)=>{let a=t.columns[i],o=th(r,e.id,a?.key);return(0,H.jsx)(`td`,{className:(n.partial?`is-partial`:``)+(o.bold?` is-bold`:``)||void 0,children:Tie(n.value,Km)},a?.key??i)}),(0,H.jsx)(`td`,{className:`cg-ts-total`,children:e.total==null?``:Km(e.total)}),i&&(0,H.jsx)(`td`,{className:`cg-ts-spark`,children:(0,H.jsx)(wWe,{values:e.cells.map(e=>e.value),label:e.label})})]}),e.deltas.map(e=>(0,H.jsx)(CWe,{delta:e,sparkline:i},e.kind)),a&&(0,H.jsx)(`tr`,{className:`cg-ts-chartrow`,children:(0,H.jsx)(`td`,{colSpan:p,children:f?(0,H.jsx)(pWe,{spec:f,label:`${e.label} over time`}):(0,H.jsx)(`div`,{className:`cg-ts-note`,children:`Nothing to plot — every period for this metric is unanswered.`})})})]})}function CWe({delta:e,sparkline:t}){return(0,H.jsxs)(`tr`,{className:`cg-ts-delta`,children:[(0,H.jsx)(`th`,{scope:`row`,className:`cg-ts-stick`,children:e.label}),e.values.map((t,n)=>(0,H.jsx)(`td`,{className:t==null?void 0:t>=0?`is-up`:`is-down`,children:e.percent?Ym(t):t==null?`—`:`${t>0?`+`:``}${Km(t)}`},n)),(0,H.jsx)(`td`,{className:`cg-ts-total`}),t&&(0,H.jsx)(`td`,{className:`cg-ts-spark`})]})}function wWe({values:e,label:t}){let n=(0,z.useMemo)(()=>zie(e,V5,H5),[e]);if(!n.length)return(0,H.jsx)(`span`,{className:`cg-ts-sparkempty`,children:`—`});let r=e.filter(e=>e!=null).length;return(0,H.jsx)(`svg`,{className:`cg-ts-sparksvg`,width:V5,height:H5,viewBox:`0 0 ${V5} ${H5}`,role:`img`,"aria-label":`${t}: trend over ${r} of ${e.length} periods`,children:n.map((e,t)=>(0,H.jsx)(`polyline`,{points:Bie(e),fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinejoin:`round`,strokeLinecap:`round`},t))})}function U5(e){return!Number.isFinite(e)||e<0?`—`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(0)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function TWe(e){let t=[];return e.by&&t.push(e.by),e.ts&&t.push(e.ts.slice(0,16).replace(`T`,` `)),t.join(` · `)}function EWe({pid:e,docs:t,docPayload:n,onAdd:r,onFetch:i,onDelete:a}){let o=(0,z.useRef)(null),[s,c]=(0,z.useState)(null),[l,u]=(0,z.useState)(!1),d=(0,z.useRef)(null),[f,p]=(0,z.useState)(null);(0,z.useEffect)(()=>{if(!(!n||d.current==null)&&!(n.pid!==e||n.docId!==d.current)){d.current=null;try{let e=atob(n.data_b64),t=new Uint8Array(e.length);for(let n=0;nURL.revokeObjectURL(r),0)}catch{c(`That file could not be decoded. Nothing was downloaded.`)}}},[n,e]);let m=e=>{if(c(null),!e)return;if(e.size>5242880){c(`${e.name} is ${U5(e.size)}. The limit is ${U5(Ad)}, so it was not uploaded.`),o.current&&(o.current.value=``);return}u(!0);let t=new FileReader;t.onerror=()=>{u(!1),c(`${e.name} could not be read.`)},t.onload=()=>{u(!1);let n=String(t.result??``),i=n.indexOf(`,`);if(i<0){c(`${e.name} could not be encoded.`);return}r({name:e.name,mime:e.type||`application/octet-stream`,size:e.size,data_b64:n.slice(i+1)}),o.current&&(o.current.value=``)},t.readAsDataURL(e)};return(0,H.jsxs)(`section`,{className:`cg-detail-section cg-docs`,children:[(0,H.jsx)(`div`,{className:`cg-detail-section-title`,children:`Documents`}),t.length===0?(0,H.jsx)(`div`,{className:`cg-docs-empty`,children:`No documents on this customer yet.`}):(0,H.jsx)(`ul`,{className:`cg-docs-list`,children:t.map(e=>(0,H.jsxs)(`li`,{className:`cg-docs-row`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn cg-docs-name`,title:`Download ${e.name}`,onClick:()=>{c(null),d.current=e.id,i(e.id)},children:e.name}),(0,H.jsxs)(`span`,{className:`cg-docs-meta`,children:[U5(e.size),TWe(e)?` · ${TWe(e)}`:``]}),e.canDelete!==!1&&(0,H.jsx)(`button`,{type:`button`,className:`cg-docs-del`+(f===e.id?` is-armed`:``),"aria-label":f===e.id?`Delete ${e.name}?`:`Delete ${e.name}`,onClick:()=>{if(f!==e.id){p(e.id);return}p(null),a(e.id)},children:f===e.id?`Delete?`:`×`})]},e.id))}),(0,H.jsxs)(`div`,{className:`cg-docs-add`,children:[(0,H.jsx)(`input`,{ref:o,type:`file`,className:`cg-docs-file`,"aria-label":`Add a document`,disabled:l,onChange:e=>m(e.target.files?.[0])}),(0,H.jsxs)(`span`,{className:`cg-docs-cap`,children:[`Up to `,U5(Ad),` per file.`]})]}),s&&(0,H.jsx)(`div`,{className:`cg-docs-error`,children:s})]})}var DWe=`application/x-cg-field`;function OWe(e,t){let n=new Set(t),r=new Set,i=[];for(let t of e??[])!n.has(t)||r.has(t)||(r.add(t),i.push(t));for(let e of t)r.has(e)||(r.add(e),i.push(e));return i}function kWe(e,t,n){let r=e.indexOf(t),i=e.indexOf(n);if(r<0||i<0||r===i)return e;let a=[...e];return a.splice(r,1),a.splice(i,0,t),a}function AWe(e,t,n){let r=e.indexOf(t),i=r+n;if(r<0||i<0||i>=e.length)return e;let a=[...e];return a.splice(r,1),a.splice(i,0,t),a}function W5(e,t,n=``){return`${jd}/customers/${encodeURIComponent(String(t))}/comments${n}?scope=${encodeURIComponent(e)}`}var jWe=class extends Error{status;constructor(e,t){super(e),this.name=`RecordCommentsError`,this.status=t}};async function G5(e){let t=null;try{t=await e.json()}catch{}if(e.status===401&&Bd(Nd),!e.ok)throw new jWe(t?.error?.message||`The server answered ${e.status}.`,e.status);return t}async function MWe(e,t,n){let r=await G5(await fetch(W5(e,t),{credentials:Md,signal:n}));return Array.isArray(r.comments)?r.comments:[]}async function NWe(e,t,n){return(await G5(await fetch(W5(e,t),{method:`POST`,credentials:Md,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:n})}))).comment}async function PWe(e,t,n){await G5(await fetch(W5(e,t,`/${encodeURIComponent(n)}`),{method:`DELETE`,credentials:Md}))}function FWe(e){return{pid:e,comments:[],draft:``,loading:!0,posting:!1,error:``}}function IWe(e,t){if(t.type===`record`)return FWe(t.pid);if(t.pid!==e.pid)return e;switch(t.type){case`loaded`:return{...e,comments:t.comments,loading:!1,error:``};case`load-failed`:return{...e,loading:!1,error:t.error};case`draft`:return{...e,draft:t.draft};case`posting`:return{...e,posting:!0,error:``};case`posted`:return{...e,comments:[...e.comments,t.comment],draft:``,posting:!1};case`post-failed`:return{...e,posting:!1,error:t.error};case`deleted`:return{...e,comments:e.comments.filter(e=>e.id!==t.commentId)};case`delete-failed`:return{...e,error:t.error}}}function LWe(e){return e.trim().split(/\s+/).slice(0,2).map(e=>e[0]?.toUpperCase()).join(``)||`?`}function RWe(e){let t=new Date(e);return Number.isFinite(t.getTime())?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(t):e}function zWe({scope:e,pid:t,viewer:n}){let[r,i]=(0,z.useReducer)(IWe,t,FWe),{comments:a,draft:o,loading:s,posting:c,error:l}=r,u=(0,z.useRef)(null);(0,z.useEffect)(()=>{let n=new AbortController;return i({type:`record`,pid:t}),MWe(e,t,n.signal).then(e=>i({type:`loaded`,pid:t,comments:e})).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||i({type:`load-failed`,pid:t,error:e instanceof Error?e.message:`Comments could not be loaded.`})}),()=>n.abort()},[e,t]);let d=async n=>{n.preventDefault();let r=o.trim();if(!r||c)return;let a=t;i({type:`posting`,pid:a});try{let n=await NWe(e,a,r);i({type:`posted`,pid:a,comment:n}),a===t&&u.current?.focus()}catch(e){i({type:`post-failed`,pid:a,error:e instanceof Error?e.message:`That comment was not saved.`})}},f=async n=>{let r=t;try{await PWe(e,r,n.id),i({type:`deleted`,pid:r,commentId:n.id})}catch(e){i({type:`delete-failed`,pid:r,error:e instanceof Error?e.message:`That comment was not deleted.`})}};return(0,H.jsxs)(`aside`,{className:`cg-record-comments`,"aria-label":`Record comments`,children:[(0,H.jsxs)(`div`,{className:`cg-record-comments-head`,children:[(0,H.jsx)(`h2`,{children:`Comments`}),(0,H.jsx)(`span`,{children:a.length.toLocaleString()})]}),(0,H.jsxs)(`div`,{className:`cg-record-comment-feed`,"aria-live":`polite`,children:[s&&(0,H.jsx)(`div`,{className:`cg-record-comment-state`,children:(0,H.jsx)(`span`,{className:`lp-spin`,role:`status`,"aria-label":`Loading`})}),!s&&a.length===0&&!l&&(0,H.jsx)(`div`,{className:`cg-record-comment-state`,children:`No comments yet. Add context for the team here.`}),a.map(e=>{let t=n?.isAdmin===!0||n?.name?.trim().toLowerCase()===e.authorKey.toLowerCase();return(0,H.jsxs)(`article`,{className:`cg-record-comment`,children:[(0,H.jsx)(`div`,{className:`cg-record-comment-avatar`,"aria-hidden":!0,children:LWe(e.author)}),(0,H.jsxs)(`div`,{className:`cg-record-comment-content`,children:[(0,H.jsxs)(`div`,{className:`cg-record-comment-meta`,children:[(0,H.jsx)(`strong`,{children:e.author}),(0,H.jsx)(`time`,{dateTime:e.createdAt,children:RWe(e.createdAt)}),t&&(0,H.jsx)(`button`,{type:`button`,className:`cg-record-comment-delete`,"aria-label":`Delete comment by ${e.author}`,title:`Delete comment`,onClick:()=>void f(e),children:`×`})]}),(0,H.jsx)(`p`,{children:e.body})]})]},e.id)}),l&&(0,H.jsx)(`div`,{className:`cg-record-comment-error`,children:l})]}),(0,H.jsxs)(`form`,{className:`cg-record-comment-compose`,onSubmit:e=>void d(e),children:[(0,H.jsx)(`label`,{htmlFor:`cg-comment-${t}`,children:`Add a comment`}),(0,H.jsx)(`textarea`,{ref:u,id:`cg-comment-${t}`,value:o,maxLength:4e3,placeholder:`Share an update or leave context…`,onChange:e=>i({type:`draft`,pid:t,draft:e.target.value}),onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,H.jsxs)(`div`,{className:`cg-record-comment-compose-foot`,children:[(0,H.jsx)(`span`,{children:`Ctrl/⌘ + Enter to post`}),(0,H.jsx)(`button`,{type:`submit`,disabled:c||!o.trim(),children:c?`Posting…`:`Comment`})]})]})]})}function BWe(e,t){let n=t.trim();if(!n)return null;if(e.type===`url`)return/^https?:\/\//i.test(n)?n:/^[\w-]+(\.[\w-]+)+/.test(n)?`https://${n}`:null;if(e.type===`email`)return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)?`mailto:${n}`:null;if(e.type===`phone`){let e=n.replace(/[\s().-]/g,``);return/^\+?\d{5,}$/.test(e)?`tel:${e}`:null}return null}function VWe({value:e,...t}){let n=(0,z.useRef)(null);return(0,z.useLayoutEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{e.style.height=`auto`;let t=window.getComputedStyle(e),n=t.boxSizing===`border-box`?(parseFloat(t.borderTopWidth)||0)+(parseFloat(t.borderBottomWidth)||0):0;e.style.height=`${e.scrollHeight+n}px`};return t(),window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t)},[e]),(0,H.jsx)(`textarea`,{ref:n,value:e,...t})}function HWe({name:e,avatars:t}){let n=t?.[e];if(n&&n.startsWith(`data:image/`))return(0,H.jsx)(`img`,{className:`cg-detail-avatar`,src:n,alt:``,"aria-hidden":!0});let r=vp(e);return(0,H.jsx)(`span`,{className:`cg-detail-avatar cg-detail-avatar--initials`,style:{background:r.bg,color:r.fg},"aria-hidden":!0,children:Sie(e)})}function UWe(){return(0,H.jsx)(`svg`,{width:`10`,height:`14`,viewBox:`0 0 10 14`,"aria-hidden":!0,focusable:`false`,children:[3,7,11].map(e=>[3,7].map(t=>(0,H.jsx)(`circle`,{cx:t,cy:e,r:`1.15`,fill:`currentColor`},`${t}-${e}`)))})}function WWe({fields:e,record:t,titleKey:n,positionLabel:r,canPrev:i,canNext:a,onPrev:o,onNext:s,onClose:c,onNotesChange:l,onNotesCommit:u,viewer:d,docs:f,docPayload:p,onDocAdd:m,onDocFetch:h,onDocDelete:g,recordLayout:_,onRecordLayout:v,scope:y,userOptions:b,userAvatars:x}){let S=(0,z.useRef)(null),C=(0,z.useId)(),w=(0,z.useId)(),T=String(t[n]??`Untitled`),E=!Ud()&&y!=null,[D,O]=(0,z.useState)(``),[k,A]=(0,z.useState)(``),j=e.filter(e=>e.source===`overlay`),M=j.filter(e=>!Xu(e.type)&&e.type!==`checkbox`&&e.type!==`rating`),N=j.filter(e=>e.type===`checkbox`),P=j.filter(e=>e.type===`rating`),F=j.filter(e=>Xu(e.type)),ee=e.filter(e=>e.source!==`overlay`&&e.key!==n),I=new Map(e.map(e=>[e.key,e])),te=[...M,...N,...P,...F,...ee].map(e=>e.key),[L,ne]=(0,z.useState)(null);(0,z.useEffect)(()=>{ne(e=>e&&JSON.stringify(e)===JSON.stringify(_??[])?null:e)},[_]);let re=OWe(L??_,te),ie=(0,z.useRef)(null),[ae,oe]=(0,z.useState)(null),[se,ce]=(0,z.useState)(null),le=(0,z.useRef)(new Map),ue=(0,z.useRef)(null);(0,z.useLayoutEffect)(()=>{let e=ue.current;e&&(ue.current=null,le.current.get(e)?.focus())});let[de,fe]=(0,z.useState)(null),pe=de&&re.includes(de)?de:re[0],me=e=>{e!==re&&(ne(e),v?.(e))},[he,ge]=(0,z.useState)(`fields`),_e=y!=null,ve=_e?he:`fields`,[ye,be]=(0,z.useState)({mode:`timeseries`}),xe=(0,z.useMemo)(()=>[Number(t.pid)],[t.pid]),Se=(0,z.useMemo)(()=>[t],[t]),Ce=(e,t)=>(0,H.jsx)(`button`,{type:`button`,className:`cg-detail-grip`,ref:t=>{le.current.set(e.key,t)},draggable:!0,tabIndex:e.key===pe?0:-1,onFocus:()=>fe(e.key),"aria-label":`Reorder ${e.label}, position ${t+1} of ${re.length}`,title:`Drag to reorder — or press the arrow keys`,onDragStart:t=>{ie.current=e.key,oe(e.key),t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(DWe,e.key);let n=t.currentTarget.parentElement;n&&t.dataTransfer.setDragImage(n,14,n.clientHeight/2)},onDragEnd:()=>{ie.current=null,oe(null),ce(null)},onKeyDown:t=>{if(t.key!==`ArrowUp`&&t.key!==`ArrowDown`)return;t.preventDefault();let n=AWe(re,e.key,t.key===`ArrowUp`?-1:1);n!==re&&(ue.current=e.key,me(n))},children:(0,H.jsx)(UWe,{})}),we=(e,n)=>{let r=`cg-ov-${e.key}`,i=Fee(e,d),a=e.type===`user`&&!b?.length,o=i&&!a,s=o&&!Xu(e.type)&&e.type!==`checkbox`&&e.type!==`rating`&&e.type!==`date`&&e.type!==`int`&&e.type!==`currency`&&e.type!==`image`&&e.type!==`pct`,c=o&&!s,f=`cg-detail-field`+(s?` cg-detail-field--edit`:``)+(c?` cg-detail-field--control`:``)+(se===e.key?` is-dropzone`:``)+(ae===e.key?` is-dragging`:``),p;if(s){let n=String(t[e.key]??``),i=BWe(e,n);p=(0,H.jsxs)(`div`,{className:`cg-detail-editwrap`,children:[(0,H.jsx)(VWe,{id:r,className:`cg-detail-textarea`,value:n,placeholder:`Add ${e.label.toLowerCase()}…`,onChange:t=>l(e.key,t.target.value),onBlur:t=>u(e.key,t.target.value)}),i&&(0,H.jsx)(`a`,{className:`cg-detail-action`,href:i,target:e.type===`url`?`_blank`:void 0,rel:e.type===`url`?`noopener noreferrer`:void 0,children:e.type===`url`?`Open link`:e.type===`email`?`Send email`:`Call`})]})}else if(e.source===`overlay`&&e.type===`checkbox`)p=(0,H.jsx)(`input`,{id:r,type:`checkbox`,className:`cg-detail-checkbox`,checked:Dp(t[e.key]),disabled:!o,onChange:t=>u(e.key,t.target.checked?`1`:``)});else if(e.type===`image`){let n=String(t[e.key]??``).trim();p=(0,H.jsxs)(`span`,{className:`cg-detail-value cg-detail-value--live cg-detail-imageslot`,children:[n?(0,H.jsx)(`img`,{className:`cg-detail-image`,src:np(n,`web`),alt:`${e.label} for ${T}`,onError:e=>{e.currentTarget.style.display=`none`}}):(0,H.jsx)(`span`,{className:`cg-detail-imageempty`,"aria-hidden":!0}),(0,H.jsxs)(`span`,{className:`cg-detail-imagemeta`,children:[(0,H.jsx)(`span`,{className:`cg-detail-imageref`,children:n||`No image`}),o&&(0,H.jsxs)(`span`,{className:`cg-detail-imageacts`,children:[(0,H.jsxs)(`label`,{className:`cg-detail-imagebtn`,children:[n?`Replace`:`Upload`,(0,H.jsx)(`input`,{type:`file`,accept:`image/png,image/jpeg`,onChange:t=>{let n=t.target.files?.[0];t.target.value=``,n&&(O(e.key),Xne(n).then(t=>{A(``),u(e.key,t)}).catch(e=>A(e instanceof Error?e.message:`That image was not saved.`)).finally(()=>O(``)))}})]}),n&&(0,H.jsx)(`button`,{type:`button`,className:`cg-detail-imagebtn`,onClick:()=>u(e.key,``),children:`Remove`})]}),D===e.key&&(0,H.jsx)(`span`,{className:`lp-spin`,role:`status`,"aria-label":`Uploading`}),k&&D!==e.key&&(0,H.jsx)(`span`,{className:`cg-detail-imageerr`,children:k})]})]})}else if(c&&e.type===`rating`){let n=$u(e),i=Hm(e,t[e.key]);p=(0,H.jsx)(`span`,{className:`cg-detail-value cg-detail-value--live`,role:`group`,"aria-labelledby":`${r}-lbl`,children:(0,H.jsx)(`span`,{className:`cg-detail-stars`,children:Array.from({length:n},(e,t)=>t+1).map(n=>(0,H.jsx)(`button`,{type:`button`,className:`cg-detail-star`,"aria-pressed":n<=i,"aria-label":n===i?`Clear ${e.label}`:`${n} star${n===1?``:`s`}`,title:n===i?`Click again to clear`:void 0,onClick:()=>u(e.key,xie(e,t[e.key],n)),children:(0,H.jsx)(Im,{on:n<=i})},n))})})}else if(c&&(e.type===`select`||e.type===`user`)){let n=Lm(t[e.key]),i=Bm(e,b,n);p=(0,H.jsxs)(`span`,{className:`cg-detail-value cg-detail-value--live cg-detail-pickslot`,children:[e.type===`user`&&n!==``&&(0,H.jsx)(HWe,{name:n,avatars:x}),(0,H.jsxs)(`select`,{id:r,className:`cg-detail-select`,value:n,onChange:t=>u(e.key,t.target.value),children:[(0,H.jsx)(`option`,{value:``,children:e.type===`user`?`Unassigned`:`None`}),i.map(e=>(0,H.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]})}else if(c&&e.type===`multiselect`){let n=t[e.key],i=zm(n),a=Bm(e,b,n);p=(0,H.jsx)(`span`,{className:`cg-detail-value cg-detail-value--live`,role:`group`,"aria-labelledby":`${r}-lbl`,children:a.length===0?(0,H.jsx)(`span`,{className:`cg-detail-nochoice`,children:`No choices yet. Add them from the column menu.`}):(0,H.jsx)(`span`,{className:`cg-detail-chips`,children:a.map(t=>{let r=i.includes(t.value);return(0,H.jsx)(`button`,{type:`button`,className:`cg-detail-chip`+(r?` is-on`:``),"aria-pressed":r,title:t.stale?`No longer a choice on this field`:void 0,onClick:()=>u(e.key,yie(n,t.value)),children:t.label},t.value)})})})}else if(c&&e.type===`date`){let n=t[e.key],i=hie(n);p=i===null?(0,H.jsxs)(`span`,{className:`cg-detail-value cg-detail-value--live cg-detail-pickslot`,children:[(0,H.jsx)(`input`,{id:r,type:`text`,className:`cg-detail-input`,value:Lm(n),title:`This value is not a date the picker can read — it is shown as stored.`,onChange:t=>l(e.key,t.target.value),onBlur:t=>u(e.key,t.target.value)}),(0,H.jsx)(`span`,{className:`cg-detail-hint`,children:`not a recognised date`})]}):(0,H.jsx)(`span`,{className:`cg-detail-value cg-detail-value--live`,children:(0,H.jsx)(`input`,{id:r,type:`date`,className:`cg-detail-input`,value:i,onChange:t=>u(e.key,_ie(n,t.target.value))})})}else if(c&&(e.type===`int`||e.type===`currency`||e.type===`pct`)){let n=e.type===`currency`?`$`:e.type===`pct`?`%`:``;p=(0,H.jsxs)(`span`,{className:`cg-detail-value cg-detail-value--live cg-detail-pickslot`,children:[e.type===`currency`&&(0,H.jsx)(`span`,{className:`cg-detail-unit`,children:n}),(0,H.jsx)(`input`,{id:r,type:`number`,className:`cg-detail-input cg-detail-input--num`,value:Vm(t[e.key]),step:e.type===`int`?1:`any`,placeholder:`—`,onChange:t=>l(e.key,t.target.value),onBlur:n=>{let r=bie(n.target.value);r===null?l(e.key,Vm(t[e.key])):u(e.key,r)}}),e.type===`pct`&&(0,H.jsx)(`span`,{className:`cg-detail-unit`,children:n})]})}else if(e.source===`overlay`&&e.type===`rating`)p=(0,H.jsx)(`span`,{className:`cg-detail-value`,title:a?void 0:`You do not have permission to edit this field`,children:(0,H.jsx)(mie,{value:Hm(e,t[e.key]),max:$u(e)})});else if(e.type===`automation`){let n=Lm(t[e.key]),r=Ap(n);p=(0,H.jsxs)(`span`,{className:`cg-detail-value cg-detail-auto`,title:n||`Not run yet`,children:[(0,H.jsx)(`span`,{className:`cg-detail-auto-chip is-${r}`,children:fre(n)}),jp(n)?(0,H.jsx)(`span`,{className:`cg-detail-auto-detail`,children:jp(n)}):null]})}else{let n=e.source===`overlay`?a?`No assignable people were supplied for this workspace`:`You do not have permission to edit this field`:void 0,r=e.type===`user`&&Lm(t[e.key])!==``;p=(0,H.jsxs)(`span`,{className:`cg-detail-value`+(r?` cg-detail-pickslot`:``),title:n,children:[r&&(0,H.jsx)(HWe,{name:Lm(t[e.key]),avatars:x}),Mp(e,t[e.key])||`—`]})}let m=c&&(e.type===`rating`||e.type===`multiselect`),h=!m&&(s||c||e.source===`overlay`&&e.type===`checkbox`);return(0,H.jsxs)(`div`,{className:f,onDragOver:t=>{ie.current&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,se!==e.key&&ce(e.key))},onDragLeave:t=>{t.currentTarget.contains(t.relatedTarget)||ce(t=>t===e.key?null:t)},onDrop:t=>{t.preventDefault();let n=t.dataTransfer.getData(`application/x-cg-field`)||ie.current;ce(null),n&&me(kWe(re,n,e.key))},children:[Ce(e,n),h?(0,H.jsx)(`label`,{className:`cg-detail-label`,htmlFor:r,children:e.label}):(0,H.jsx)(`span`,{className:`cg-detail-label`,id:m?`${r}-lbl`:void 0,children:e.label}),p]},e.key)};return qp({panelRef:S,onDismiss:c,dismissOnOutside:!0,initialFocus:`[data-overlay-autofocus]`,trapFocus:!0}),(0,H.jsx)(Jp,{children:(0,H.jsx)(`div`,{className:`cg-record-backdrop`,children:(0,H.jsxs)(`div`,{className:`cg-record-modal`+(E?``:` cg-record-modal--single`),ref:S,role:`dialog`,"aria-modal":`true`,"aria-labelledby":C,"data-overlay-kind":`record-detail`,tabIndex:-1,children:[(0,H.jsxs)(`div`,{className:`cg-detail-header`,children:[(0,H.jsxs)(`div`,{className:`cg-detail-nav`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-detail-navbtn`,onClick:o,disabled:!i,"aria-label":`Previous record`,title:`Previous record`,children:`‹`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-detail-navbtn`,onClick:s,disabled:!a,"aria-label":`Next record`,title:`Next record`,children:`›`}),(0,H.jsx)(`span`,{className:`cg-detail-pos`,children:r})]}),(0,H.jsx)(`button`,{type:`button`,className:`cg-detail-close`,"data-overlay-autofocus":!0,onClick:c,"aria-label":`Close panel`,title:`Close`,children:`×`})]}),(0,H.jsxs)(`div`,{className:`cg-record-layout`,children:[(0,H.jsxs)(`main`,{className:`cg-record-main`,children:[(0,H.jsx)(`div`,{className:`cg-detail-titlewrap`,children:(0,H.jsx)(`div`,{className:`cg-detail-title`,id:C,title:T,children:T})}),_e&&(0,H.jsx)(`div`,{className:`cg-record-tabs`,role:`tablist`,"aria-label":`Record view`,children:[`fields`,`insights`].map(e=>(0,H.jsx)(`button`,{type:`button`,role:`tab`,id:`${w}-${e}`,"aria-selected":ve===e,"aria-controls":`${w}-panel`,className:`cg-record-tab`+(ve===e?` is-on`:``),onClick:()=>ge(e),children:e===`fields`?`Fields`:`Insights`},e))}),(0,H.jsx)(`div`,{className:`cg-detail-body`,id:`${w}-panel`,role:_e?`tabpanel`:void 0,"aria-labelledby":_e?`${w}-${ve}`:void 0,children:ve===`insights`&&y?(0,H.jsx)(`div`,{className:`cg-record-insights`,children:(0,H.jsx)(bWe,{scope:y,pids:xe,fields:e,rows:Se,display:ye,onDisplay:e=>be(t=>({...t,...e})),locked:!0})}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`section`,{className:`cg-detail-section cg-detail-fieldlist`,children:re.map((e,t)=>{let n=I.get(e);return n?we(n,t):null})}),m&&h&&g&&(0,H.jsx)(EWe,{pid:Number(t.pid),docs:f??[],docPayload:p,onAdd:m,onFetch:h,onDelete:g})]})})]}),E&&y!=null&&(0,H.jsx)(zWe,{scope:y,pid:Number(t.pid),viewer:d},`${y}:${Number(t.pid)}`)]})]})})})}var GWe=[`csv`,`xlsx`,`pdf`,`json`],KWe={csv:`CSV`,xlsx:`Excel`,pdf:`PDF`,json:`JSON`};function qWe(e,t,n){let r=(e.trim()||`export`).replace(/[\\/:*?"<>|]/g,`_`);return t?`${r} - ${t}.${n}`:`${r}.${n}`}function JWe(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function YWe(e,t){let n=[e.map(e=>JWe(e.label)).join(`,`)];for(let r of t)n.push(e.map(e=>JWe(Mp(e,r[e.key]))).join(`,`));return n.join(`\r `)+`\r -`}function qWe(e,t){return JSON.stringify({fields:e.map(e=>({key:e.key,label:e.label,type:e.type})),rows:t.map(t=>{let n={pid:t.pid};for(let r of e)n[r.key]=t[r.key]??null;return n})},null,1)}var JWe=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t+=1){let n=t;for(let e=0;e<8;e+=1)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function YWe(e){let t=4294967295;for(let n=0;n>>8;return(t^4294967295)>>>0}function XWe(e){let t=e?/^(\d{4})-(\d{2})-(\d{2})/.exec(e):null,n=t?Number(t[1]):2020,r=t?Number(t[2]):1,i=t?Number(t[3]):1;return{date:Math.max(1980,n)-1980<<9|r<<5|i,time:0}}function ZWe(e,t){let n=new TextEncoder,r=XWe(t),i=[],a=[],o=0,s=e=>[e&255,e>>8&255],c=e=>[e&255,e>>8&255,e>>16&255,e>>24&255];for(let t of e){let e=n.encode(t.name),l=YWe(t.data),u=new Uint8Array([...c(67324752),...s(20),...s(2048),...s(0),...s(r.time),...s(r.date),...c(l),...c(t.data.length),...c(t.data.length),...s(e.length),...s(0)]);i.push(u,e,t.data),a.push(new Uint8Array([...c(33639248),...s(20),...s(20),...s(2048),...s(0),...s(r.time),...s(r.date),...c(l),...c(t.data.length),...c(t.data.length),...s(e.length),...s(0),...s(0),...s(0),...s(0),...c(0),...c(o)]),e),o+=u.length+e.length+t.data.length}let l=o,u=0;for(let e of a)u+=e.length;let d=new Uint8Array([...c(101010256),...s(0),...s(0),...s(e.length),...s(e.length),...c(u),...c(l),...s(0)]),f=o+u+d.length,p=new Uint8Array(f),m=0;for(let e of[...i,...a,d])p.set(e,m),m+=e.length;return p}function QWe(e){return e.replace(/&/g,`&`).replace(//g,`>`).replace(/"/g,`"`).replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,``)}function $We(e){return(e.replace(/[[\]:*?/\\]/g,`_`).trim()||`Export`).slice(0,31)}function eGe(e,t,n,r){let i=new TextEncoder,a=e=>`${QWe(e)}`,o=e=>`${e.join(``)}`,s=`${[o(e.map(e=>a(e.label))),...t.map(t=>o(e.map(e=>a(Mp(e,t[e.key])))))].join(``)}`,c=``;return ZWe([{name:`[Content_Types].xml`,data:i.encode(``)},{name:`_rels/.rels`,data:i.encode(``)},{name:`xl/workbook.xml`,data:i.encode(c)},{name:`xl/_rels/workbook.xml.rels`,data:i.encode(``)},{name:`xl/worksheets/sheet1.xml`,data:i.encode(s)}],r)}var J5=792,Y5=612,X5=36,Z5=8,Q5=13,$5=17,e7=Z5*.52,tGe={"…":133,"–":150,"—":151,"‘":145,"’":146,"“":147,"”":148,"·":183,"€":128,"•":149};function t7(e){let t=``;for(let n of e){let e=n.codePointAt(0)??63,r=e<=255?e:tGe[n]??63,i=String.fromCharCode(r);t+=i===`\\`?`\\\\`:i===`(`?`\\(`:i===`)`?`\\)`:i}return t}function n7(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function nGe(e,t,n,r){let i=J5-X5*2,a=t.slice(0,200),o=e.map(e=>{let t=e.label.length;for(let n of a)t=Math.max(t,Mp(e,n[e.key]).length);return Math.min(170,Math.max(42,t*e7+8))}),s=Math.min(1,i/o.reduce((e,t)=>e+t,0)),c=o.map(e=>e*s),l=Math.max(1,Math.floor((Y5-X5*2-26-$5-14)/Q5)),u=Math.max(1,Math.ceil(t.length/l)),d=r?`${n} — ${r}`:n,f=[];for(let n=0;n`${5+t*2} 0 R`).join(` `);p.push(`1 0 obj +`}function XWe(e,t){return JSON.stringify({fields:e.map(e=>({key:e.key,label:e.label,type:e.type})),rows:t.map(t=>{let n={pid:t.pid};for(let r of e)n[r.key]=t[r.key]??null;return n})},null,1)}var ZWe=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t+=1){let n=t;for(let e=0;e<8;e+=1)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function QWe(e){let t=4294967295;for(let n=0;n>>8;return(t^4294967295)>>>0}function $We(e){let t=e?/^(\d{4})-(\d{2})-(\d{2})/.exec(e):null,n=t?Number(t[1]):2020,r=t?Number(t[2]):1,i=t?Number(t[3]):1;return{date:Math.max(1980,n)-1980<<9|r<<5|i,time:0}}function eGe(e,t){let n=new TextEncoder,r=$We(t),i=[],a=[],o=0,s=e=>[e&255,e>>8&255],c=e=>[e&255,e>>8&255,e>>16&255,e>>24&255];for(let t of e){let e=n.encode(t.name),l=QWe(t.data),u=new Uint8Array([...c(67324752),...s(20),...s(2048),...s(0),...s(r.time),...s(r.date),...c(l),...c(t.data.length),...c(t.data.length),...s(e.length),...s(0)]);i.push(u,e,t.data),a.push(new Uint8Array([...c(33639248),...s(20),...s(20),...s(2048),...s(0),...s(r.time),...s(r.date),...c(l),...c(t.data.length),...c(t.data.length),...s(e.length),...s(0),...s(0),...s(0),...s(0),...c(0),...c(o)]),e),o+=u.length+e.length+t.data.length}let l=o,u=0;for(let e of a)u+=e.length;let d=new Uint8Array([...c(101010256),...s(0),...s(0),...s(e.length),...s(e.length),...c(u),...c(l),...s(0)]),f=o+u+d.length,p=new Uint8Array(f),m=0;for(let e of[...i,...a,d])p.set(e,m),m+=e.length;return p}function tGe(e){return e.replace(/&/g,`&`).replace(//g,`>`).replace(/"/g,`"`).replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,``)}function nGe(e){return(e.replace(/[[\]:*?/\\]/g,`_`).trim()||`Export`).slice(0,31)}function rGe(e,t,n,r){let i=new TextEncoder,a=e=>`${tGe(e)}`,o=e=>`${e.join(``)}`,s=`${[o(e.map(e=>a(e.label))),...t.map(t=>o(e.map(e=>a(Mp(e,t[e.key])))))].join(``)}`,c=``;return eGe([{name:`[Content_Types].xml`,data:i.encode(``)},{name:`_rels/.rels`,data:i.encode(``)},{name:`xl/workbook.xml`,data:i.encode(c)},{name:`xl/_rels/workbook.xml.rels`,data:i.encode(``)},{name:`xl/worksheets/sheet1.xml`,data:i.encode(s)}],r)}var K5=792,q5=612,J5=36,Y5=8,X5=13,Z5=17,Q5=Y5*.52,iGe={"…":133,"–":150,"—":151,"‘":145,"’":146,"“":147,"”":148,"·":183,"€":128,"•":149};function $5(e){let t=``;for(let n of e){let e=n.codePointAt(0)??63,r=e<=255?e:iGe[n]??63,i=String.fromCharCode(r);t+=i===`\\`?`\\\\`:i===`(`?`\\(`:i===`)`?`\\)`:i}return t}function e7(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function aGe(e,t,n,r){let i=K5-J5*2,a=t.slice(0,200),o=e.map(e=>{let t=e.label.length;for(let n of a)t=Math.max(t,Mp(e,n[e.key]).length);return Math.min(170,Math.max(42,t*Q5+8))}),s=Math.min(1,i/o.reduce((e,t)=>e+t,0)),c=o.map(e=>e*s),l=Math.max(1,Math.floor((q5-J5*2-26-Z5-14)/X5)),u=Math.max(1,Math.ceil(t.length/l)),d=r?`${n} — ${r}`:n,f=[];for(let n=0;n`${5+t*2} 0 R`).join(` `);p.push(`1 0 obj << /Type /Catalog /Pages 2 0 R >> endobj `),p.push(`2 0 obj\n<< /Type /Pages /Kids [${m}] /Count ${f.length} >>\nendobj\n`),p.push(`3 0 obj @@ -390,14 +390,14 @@ endobj `),p.push(`4 0 obj << /Type /Font /Subtype /Type1 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >> endobj -`),f.forEach((e,t)=>{let n=5+t*2;p.push(`${n} 0 obj\n<< /Type /Page /Parent 2 0 R /MediaBox [0 0 ${J5} ${Y5}] /Resources << /Font << /F1 3 0 R /F2 4 0 R >> >> /Contents ${n+1} 0 R >>\nendobj\n`),p.push(`${n+1} 0 obj\n<< /Length ${e.length} >>\nstream\n${e}endstream\nendobj\n`)});let h=`%PDF-1.4 -`,g=[];for(let e of p)g.push(h.length),h+=e;let _=h.length;h+=`xref\n0 ${p.length+1}\n0000000000 65535 f \n`;for(let e of g)h+=`${String(e).padStart(10,`0`)} 00000 n \n`;h+=`trailer\n<< /Size ${p.length+1} /Root 1 0 R >>\nstartxref\n${_}\n%%EOF\n`;let v=new Uint8Array(h.length);for(let e=0;eURL.revokeObjectURL(n),4e3)}function i7(e,t,n,r,i){let a=WWe(t,n,e);if(e===`csv`){r7(a,new Blob([``,KWe(r,i)],{type:`text/csv;charset=utf-8`}));return}if(e===`json`){r7(a,new Blob([qWe(r,i)],{type:`application/json`}));return}if(e===`xlsx`){r7(a,new Blob([eGe(r,i,t,n).buffer],{type:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`}));return}r7(a,new Blob([nGe(r,i,t,n).buffer],{type:`application/pdf`}))}var a7=(e,t)=>typeof e==`number`&&t-e<=12e4;function rGe(e,t){let n={},r=e=>{if(!e)return;let n=Object.entries(e).filter(([,e])=>a7(e,t));return n.length?Object.fromEntries(n.slice(-64)):void 0},i=e=>{if(!e)return;let n=Object.entries(e).filter(([,e])=>a7(e.at,t));return n.length?Object.fromEntries(n.slice(-64)):void 0},a=r(e?.created),o=i(e?.renamed),s=r(e?.deleted),c=i(e?.moved);return a&&(n.created=a),o&&(n.renamed=o),s&&(n.deleted=s),c&&(n.moved=c),n}function iGe(e,t,n,r){let i=e??[],a=[],o=new Set;for(let e of i){if(a7(n?.deleted?.[e.id],r))continue;o.add(e.id);let t=n?.renamed?.[e.id];a.push(a7(t?.at,r)&&t?{...e,name:t.name}:e)}for(let e of t??[])o.has(e.id)||a7(n?.created?.[e.id],r)&&(a7(n?.deleted?.[e.id],r)||a.push(e));return a.sort((e,t)=>(e.order??0)-(t.order??0)||e.name.localeCompare(t.name))}function aGe(e,t,n,r,i){let a=r?.moved?.[e],o=a7(a?.at,i)&&a?a.folderId:t??null;return o==null?null:n.some(e=>e.id===o)?o:null}function oGe(e,t,n){let r=new Map(t.map(e=>[e.id,[]])),i=[];for(let t of e){let e=n(t),a=e==null?void 0:r.get(e);a?a.push(t):i.push(t)}let a=t.map(e=>({folder:e,items:r.get(e.id)??[]}));return a.push({folder:null,items:i}),a}function sGe(){return`fld_${typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10)}`}function cGe({views:e,activeViewId:t,saveState:n,onSelect:r,onCreate:i,onRename:a,onNote:o,onDuplicate:s,onDelete:c,lists:l=[],onAddToList:u,onCohortLock:d,today:f,onExport:p,folders:m,folderIdOf:h,onFolderCreate:g,onFolderRename:_,onFolderDelete:v,onFolderDuplicate:y,onItemMove:b,folderAddPreview:x,onFolderAddToList:S,viewer:C,onToggleLock:w,userOptions:T=[]}){let[E,D]=(0,z.useState)(null),[O,k]=(0,z.useState)(null),[A,j]=(0,z.useState)(``),[M,N]=(0,z.useState)(`personal`),[P,F]=(0,z.useState)([]),[ee,I]=(0,z.useState)(null),[te,L]=(0,z.useState)(null),[ne,re]=(0,z.useState)(null),[ie,ae]=(0,z.useState)(``),[oe,se]=(0,z.useState)(null),[ce,le]=(0,z.useState)(null),[ue,de]=(0,z.useState)(``),[fe,pe]=(0,z.useState)(null),me=fe?e.find(e=>e.id===fe.viewId):void 0,he=oe?e.find(e=>e.id===oe.viewId):void 0,ge=ee?e.find(e=>e.id===ee.viewId):void 0,_e=!!ge&&Td(ge,C),[ve,ye]=(0,z.useState)(new Set),[be,xe]=(0,z.useState)(null),[Se,Ce]=(0,z.useState)(null),[we,Te]=(0,z.useState)(!1),[Ee,De]=(0,z.useState)(``),[Oe,ke]=(0,z.useState)({shape:Od,tone:kd}),[Ae,je]=(0,z.useState)(null),[Me,Ne]=(0,z.useState)(null),[Pe,Fe]=(0,z.useState)(null),[Ie,Le]=(0,z.useState)(``),[Re,ze]=(0,z.useState)(null),[Be,Ve]=(0,z.useState)(``),[He,Ue]=(0,z.useState)(()=>{try{return localStorage.getItem(`aios-views-rail`)===`1`}catch{return!1}}),We=()=>Ue(e=>{let t=!e;try{localStorage.setItem(`aios-views-rail`,t?`1`:`0`)}catch{}return t}),Ge=Be.trim().toLowerCase(),Ke=Ge?e.filter(e=>(e.name||``).toLowerCase().includes(Ge)):e,qe=!!m&&!!h&&!!b,Je=oGe(Ke,qe?m:[],e=>h?h(e.id):null),Ye=be?m?.find(e=>e.id===be.id):void 0,Xe=Me&&x?x(Me):null,Ze=e=>qe?{onDragOver:t=>{t.preventDefault(),ze(e??`__root__`)},onDragLeave:()=>ze(null),onDrop:t=>{t.preventDefault(),ze(null);let n=t.dataTransfer.getData(`text/plain`);n&&b?.(n,e)}}:{},Qe=ne?e.find(e=>e.id===ne.viewId):void 0,$e=()=>{let e=A.trim();!e||!E||(i(e,E,Qee({edit:M,users:P},`personal`,T)),j(``),N(`personal`),F([]),D(null))},et=()=>{let e=Ee.trim();e&&(g?.(e,ete(Oe)),De(``),ke({shape:Od,tone:kd}),Te(!1))},R=e=>{k(null),Te(!1),D(e)},tt=()=>{k(null),D(null),Te(!0)},nt=e=>{if(![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;let t=[...e.currentTarget.querySelectorAll(`[role="menuitem"]`)];if(!t.length)return;e.preventDefault();let n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:e.key===`ArrowDown`?(n+1)%t.length:(n-1+t.length)%t.length]?.focus()};return(0,H.jsxs)(`aside`,{className:`cg-views`+(He?` is-collapsed`:``),"aria-label":`Customer views`,children:[(0,H.jsx)(`div`,{className:`cg-views-top`,children:(0,H.jsx)(`button`,{type:`button`,className:`cg-rail-toggle`,"aria-label":He?`Expand views`:`Minimize views`,"aria-expanded":!He,title:He?`Expand views`:`Minimize views`,onClick:We,children:(0,H.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M2.5 4.4h11M2.5 8h11M2.5 11.6h11`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`})})})}),(0,H.jsx)(`div`,{className:`cg-sr-only`,"aria-live":`polite`,children:n===`saving`?`Saving changes…`:`All changes saved`}),(0,H.jsx)(`div`,{className:`cg-create-new`,children:(0,H.jsxs)(`button`,{type:`button`,className:`cg-link-btn cg-create-btn`,"aria-haspopup":`menu`,"aria-expanded":!!O,onClick:e=>k(t=>t?null:e.currentTarget),children:[(0,H.jsx)(`span`,{className:`cg-create-icon`,"aria-hidden":`true`,children:`+`}),(0,H.jsx)(`span`,{className:`cg-create-label`,children:`Create new…`})]})}),(0,H.jsxs)(`div`,{className:`cg-find-view`,children:[(0,H.jsxs)(`svg`,{className:`cg-find-view-icon`,width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:[(0,H.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.4`,stroke:`currentColor`,strokeWidth:`1.35`}),(0,H.jsx)(`path`,{d:`m10.4 10.4 3.1 3.1`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`})]}),(0,H.jsx)(`input`,{type:`text`,value:Be,placeholder:`Find a view`,"aria-label":`Find a view`,onChange:e=>Ve(e.target.value),onKeyDown:e=>{e.key===`Escape`&&Ve(``)}})]}),E&&(0,H.jsxs)(`div`,{className:`cg-view-create cg-create-form`,children:[(0,H.jsxs)(`label`,{htmlFor:`cg-new-view`,children:[`New `,kf[E].toLowerCase(),` view`]}),(0,H.jsx)(`input`,{id:`cg-new-view`,className:`cg-input`,autoFocus:!0,value:A,placeholder:`e.g. Florida at risk`,onChange:e=>j(e.target.value),onKeyDown:e=>{e.key===`Enter`&&$e(),e.key===`Escape`&&D(null)}}),(0,H.jsxs)(`div`,{className:`cg-perm`,role:`radiogroup`,"aria-label":`Who can edit this view`,children:[(0,H.jsx)(`span`,{className:`cg-perm-title`,children:`Who can edit`}),wd.map(e=>(0,H.jsxs)(`label`,{className:`cg-radio-row cg-perm-row`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`cg-view-perm`,checked:M===e,onChange:()=>N(e)}),(0,H.jsxs)(`span`,{className:`cg-perm-label`,children:[Xee[e],(0,H.jsx)(`span`,{className:`cg-perm-blurb`,children:Zee[e]})]})]},e)),M===`users`&&(0,H.jsxs)(`div`,{className:`cg-perm-users`,children:[T.length===0?(0,H.jsx)(`span`,{className:`cg-perm-empty`,children:`No other accounts to pick — this will save as Personal.`}):T.map(e=>(0,H.jsxs)(`label`,{className:`cg-perm-user`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:P.includes(e),onChange:t=>F(n=>t.target.checked?[...n,e].slice(0,50):n.filter(t=>t!==e))}),(0,H.jsx)(`span`,{children:e})]},e)),T.length>0&&P.length===0&&(0,H.jsx)(`span`,{className:`cg-perm-empty`,children:`Pick at least one person, or this saves as Personal.`})]})]}),(0,H.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,onClick:$e,disabled:!A.trim(),children:`Create`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>D(null),children:`Cancel`})]})]}),qe&&g&&we&&(0,H.jsxs)(`div`,{className:`cg-view-create cg-create-form cg-fold-form`,children:[(0,H.jsx)(`label`,{htmlFor:`cg-new-folder`,children:`New folder`}),(0,H.jsx)(`input`,{id:`cg-new-folder`,className:`cg-input`,autoFocus:!0,value:Ee,placeholder:`Folder name`,onChange:e=>De(e.target.value),onKeyDown:e=>{e.key===`Enter`&&et(),e.key===`Escape`&&Te(!1)}}),(0,H.jsxs)(`div`,{className:`cg-fold-pick`,role:`group`,"aria-label":`Folder icon`,children:[(0,H.jsx)(`div`,{className:`cg-fold-pick-row`,children:Ed.map(e=>(0,H.jsx)(`button`,{type:`button`,className:`cg-fold-swatch`+(Oe.shape===e?` is-on`:``),"aria-pressed":Oe.shape===e,"aria-label":Of[e],title:Of[e],onClick:()=>ke(t=>({...t,shape:e})),children:(0,H.jsx)(im,{icon:{shape:e,tone:Oe.tone},size:15})},e))}),(0,H.jsx)(`div`,{className:`cg-fold-pick-row`,children:Dd.map(e=>(0,H.jsx)(`button`,{type:`button`,className:`cg-fold-swatch`+(Oe.tone===e?` is-on`:``),"aria-pressed":Oe.tone===e,"aria-label":Df[e],title:Df[e],onClick:()=>ke(t=>({...t,tone:e})),children:(0,H.jsx)(im,{icon:{shape:Oe.shape,tone:e},size:15})},e))})]}),(0,H.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,onClick:et,disabled:!Ee.trim(),children:`Create`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>Te(!1),children:`Cancel`})]})]}),O&&(0,H.jsxs)(Yp,{anchor:O,className:`cg-view-menu cg-create-flyout`,placement:`right-start`,role:`menu`,ariaLabel:`Create new`,onDismiss:()=>k(null),onKeyDown:nt,dataKind:`create-new`,children:[rne.map(e=>(0,H.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`cg-create-row`,onClick:()=>R(e),children:[(0,H.jsx)($p,{mode:e,tone:ine[e],size:16}),(0,H.jsx)(`span`,{children:kf[e]})]},e)),qe&&g&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`cg-menu-sep`,role:`separator`,"aria-hidden":!0}),(0,H.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`cg-create-row`,onClick:()=>tt(),children:[(0,H.jsx)(im,{size:16}),(0,H.jsx)(`span`,{children:`Folder`})]})]})]}),(0,H.jsx)(`div`,{className:`cg-view-list cg-views-scroll`,children:Je.map(e=>{let n=e.folder?.id??null;if(Ge&&e.folder&&e.items.length===0)return null;let i=n===null,o=n!=null&&ve.has(n);return(0,H.jsxs)(`div`,{className:(i?`cg-fold-root`:`cg-fold`)+(Re===(n??`__root__`)?` is-drop`:``),...Ze(n),children:[e.folder&&(0,H.jsxs)(`div`,{className:`cg-fold-head`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`cg-fold-toggle`,"aria-expanded":!o,onClick:()=>ye(t=>{let n=new Set(t);return n.has(e.folder.id)?n.delete(e.folder.id):n.add(e.folder.id),n}),children:[(0,H.jsx)(`span`,{className:`cg-fold-chev`+(o?` is-shut`:``),"aria-hidden":!0,children:`▾`}),(0,H.jsx)(im,{icon:e.folder.icon,size:16}),Se===e.folder.id?(0,H.jsx)(`input`,{className:`cg-input cg-fold-rename`,autoFocus:!0,defaultValue:e.folder.name,onClick:e=>e.stopPropagation(),onBlur:t=>{let n=t.target.value.trim();n&&n!==e.folder.name&&_?.(e.folder.id,n),Ce(null)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&Ce(null)}}):(0,H.jsx)(`span`,{className:`cg-fold-name`,children:e.folder.name}),(0,H.jsx)(`span`,{className:`cg-fold-count`,children:e.items.length})]}),(0,H.jsx)(`button`,{type:`button`,className:`cg-view-more`,"aria-label":`Actions for folder ${e.folder.name}`,"aria-haspopup":`menu`,onClick:t=>xe(n=>n?.id===e.folder.id?null:{id:e.folder.id,anchor:t.currentTarget}),children:`···`})]}),!o&&e.items.map(e=>{let n=e.id===t,i=te===e.id,o=xd(e);return(0,H.jsxs)(`div`,{className:`cg-view-row`+(n?` is-active`:``)+(e.config?.cohortLock?` cg-view-lockset`:``),draggable:qe&&!i&&Td(e,C),onDragStart:t=>t.dataTransfer.setData(`text/plain`,e.id),children:[i?(0,H.jsx)(`input`,{className:`cg-view-rename cg-input`,autoFocus:!0,defaultValue:e.name,onBlur:t=>{let n=t.target.value.trim();n&&n!==e.name&&a(e.id,n),L(null)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&L(null)}}):(0,H.jsxs)(`button`,{type:`button`,className:`cg-view-main`,onClick:()=>r(e.id),title:e.note?`${e.name} — ${e.note}`:e.name,children:[(0,H.jsx)($p,{mode:o,tone:ine[o],size:16}),(0,H.jsxs)(`span`,{className:`cg-view-text`,children:[(0,H.jsx)(`span`,{className:`cg-view-name`,children:e.name}),e.note&&(0,H.jsx)(`span`,{className:`cg-view-desc`,children:e.note})]}),(e.kind===`locked`||Sd(e))&&(0,H.jsx)(`span`,{className:`cg-view-lock`,role:`img`,"aria-label":e.kind===`locked`?`${e.name}, a locked view`:`${kf[o]} view, locked`,title:e.kind===`locked`?`Locked — this view shows only the records locked into it. Filters, sorts and columns still narrow within them.`+(Sd(e)?` It also stays a ${kf[o].toLowerCase()}.`:``):`Locked — this view stays a ${kf[o].toLowerCase()}. Filters, sorts and columns are still editable.`,children:(0,H.jsx)(rm,{})})]}),(0,H.jsx)(`button`,{type:`button`,className:`cg-view-more`,"aria-label":`Actions for ${e.name}`,"aria-haspopup":`menu`,"aria-expanded":ee?.viewId===e.id,onClick:t=>I(n=>n?.viewId===e.id?null:{viewId:e.id,anchor:t.currentTarget}),children:`···`})]},e.id)}),e.folder&&!o&&e.items.length===0&&(0,H.jsx)(`div`,{className:`cg-fold-empty`,children:`Empty — drag a view here.`})]},n??`__root__`)})}),be&&Ye&&(0,H.jsxs)(Yp,{anchor:be.anchor,className:`cg-view-menu`,placement:`bottom-end`,role:`menu`,ariaLabel:`Actions for folder ${Ye.name}`,onDismiss:()=>{xe(null),je(null)},dataKind:`folder-menu`,children:[(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,className:`cg-menu-item`,onClick:()=>{Ce(Ye.id),xe(null)},children:`Rename`}),x&&S&&(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,className:`cg-menu-item`,onClick:()=>{Ne(Ye.id),Fe(be.anchor),Le(f?`${Ye.name} · ${f}`:Ye.name),xe(null)},children:`Add to cohort…`}),y&&(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,className:`cg-menu-item`,onClick:()=>{y(Ye.id),xe(null)},children:`Duplicate folder and its views`}),v&&(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,className:`cg-menu-item cg-menu-item--danger`+(Ae===Ye.id?` is-armed`:``),onClick:()=>{if(Ae!==Ye.id){je(Ye.id);return}v(Ye.id),je(null),xe(null)},children:Ae===Ye.id?`Delete folder? Its views move to the top level.`:`Delete folder`})]}),ce&&d&&(()=>{let t=e.find(e=>e.id===ce.viewId)?.config?.cohortLock;return(0,H.jsxs)(Yp,{anchor:ce.anchor,className:`cg-pop cg-lock-pop`,placement:`bottom-start`,role:`dialog`,ariaLabel:`Lock this view to a locked view`,onDismiss:()=>le(null),dataKind:`view-cohort-lock`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Lock to a locked view`}),(0,H.jsx)(`div`,{className:`cg-pop-note`,children:`This view can then only ever show the records locked into the view you pick. Filters still narrow within it, and the lock cannot be removed as a condition.`}),(l??[]).map(e=>(0,H.jsx)(`button`,{type:`button`,className:`cg-pick-row`+(e.id===t?` is-on`:``),onClick:()=>{d(ce.viewId,e.id),le(null)},children:e.name},e.id)),t&&(0,H.jsx)(`button`,{type:`button`,className:`cg-pick-row cg-lock-clear`,onClick:()=>{d(ce.viewId,null),le(null)},children:`Unlock — show the whole table again`})]})})(),Me&&Pe&&Xe&&S&&(0,H.jsxs)(Yp,{anchor:Pe??void 0,className:`cg-pop cg-fold-addpop`,placement:`bottom-start`,role:`dialog`,ariaLabel:`Add this folder's customers to a locked view`,onDismiss:()=>Ne(null),dataKind:`folder-add-to-list`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Add to cohort`}),(0,H.jsxs)(`div`,{className:`cg-pop-note`,children:[Xe.pids.length.toLocaleString(),` customer`,Xe.pids.length===1?``:`s`,` from `,Xe.counted.toLocaleString(),` `,`view`,Xe.counted===1?``:`s`,` in this folder, counted once each.`]}),Xe.skipped.length>0&&(0,H.jsxs)(`div`,{className:`cg-pop-note cg-fold-skipped`,children:[`Not included:`,Xe.skipped.map(e=>(0,H.jsxs)(`span`,{className:`cg-fold-skip`,children:[e.name,` — `,e.why]},e.name))]}),(l??[]).map(e=>(0,H.jsx)(`button`,{type:`button`,className:`cg-pick-row`,onClick:()=>{S(Me,e.id,e.name),Ne(null)},children:e.name},e.id)),(0,H.jsxs)(`div`,{className:`cg-view-create`,children:[(0,H.jsx)(`label`,{htmlFor:`cg-fold-new-list`,children:`Lock records into a new view`}),(0,H.jsx)(`input`,{id:`cg-fold-new-list`,className:`cg-input`,"data-overlay-autofocus":!0,value:Ie,onChange:e=>Le(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Ie.trim()&&(S(Me,``,Ie.trim()),Ne(null))}}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!Ie.trim()||Xe.pids.length===0,onClick:()=>{S(Me,``,Ie.trim()),Ne(null)},children:`Create and add`})]})]}),ee&&ge&&(0,H.jsxs)(Yp,{anchor:ee.anchor,className:`cg-view-menu`,placement:`bottom-end`,role:`menu`,ariaLabel:`Actions for ${ge.name}`,onDismiss:()=>I(null),onKeyDown:nt,dataKind:`saved-view-menu`,children:[p&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{pe({viewId:ge.id,anchor:ee.anchor}),I(null)},children:(0,H.jsx)(tm,{icon:`download`,text:`Export`})}),(0,H.jsx)(`div`,{className:`cg-menu-sep`,role:`separator`,"aria-hidden":!0})]}),_e&&(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{L(ge.id),I(null)},children:(0,H.jsx)(tm,{icon:`rename`,text:`Rename`})}),_e&&(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{ae(ge.note??``),re({viewId:ge.id,anchor:ee.anchor}),I(null)},children:(0,H.jsx)(tm,{icon:`description`,text:ge.note?`Edit description`:`Add description`})}),(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{s(ge.id),I(null)},children:(0,H.jsx)(tm,{icon:`duplicate`,text:`Duplicate`})}),u&&(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{de(f?`${ge.name} · ${f}`:ge.name),se({viewId:ge.id,anchor:ee.anchor}),I(null)},children:(0,H.jsx)(tm,{icon:`cohortAdd`,text:`Add to locked view`})}),d&&l.length>0&&_e&&ge.kind!==`locked`&&(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{le({viewId:ge.id,anchor:ee.anchor}),I(null)},children:(0,H.jsx)(tm,{icon:`permissions`,text:ge.config?.cohortLock?`Change the lock…`:`Lock to a locked view…`})}),w&&ge.kind!==`system`&&_e&&Cd(ge,C)&&(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{w(ge.id,!Sd(ge)),I(null)},children:(0,H.jsx)(tm,{icon:Sd(ge)?`unlock`:(0,H.jsx)(Qp,{mode:xd(ge),size:16}),text:Sd(ge)?`Unlock view`:`Lock as ${kf[xd(ge)]}`})}),!bd(ge)&&_e&&(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,className:`is-danger`,onClick:()=>{c(ge.id),I(null)},children:(0,H.jsx)(tm,{icon:`trash`,text:`Delete`})})]}),fe&&me&&p&&(0,H.jsxs)(Yp,{anchor:fe.anchor,className:`cg-view-menu`,placement:`bottom-end`,role:`menu`,ariaLabel:`Export ${me.name}`,onDismiss:()=>pe(null),onKeyDown:nt,dataKind:`view-export`,children:[(0,H.jsxs)(`div`,{className:`cg-pop-title cg-export-title`,children:[`Export `,me.name]}),HWe.map(e=>(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{p(me.id,e),pe(null)},children:UWe[e]},e))]}),oe&&he&&u&&(0,H.jsxs)(Yp,{anchor:oe.anchor,className:`cg-pop cg-add-list-pop`,placement:`bottom-end`,role:`dialog`,ariaLabel:`Add ${he.name} to a locked view`,onDismiss:()=>se(null),dataKind:`add-to-list`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Add to cohort`}),(0,H.jsxs)(`div`,{className:`cg-pop-note`,children:[`Adds the customers `,(0,H.jsx)(`strong`,{children:he.name}),` matches right now. The cohort stays fixed as the data changes.`]}),l.map(e=>(0,H.jsx)(`button`,{type:`button`,className:`cg-pick-row`,onClick:()=>{u(he.id,e.id,e.name),se(null)},children:e.name},e.id)),(0,H.jsxs)(`div`,{className:`cg-view-create`,children:[(0,H.jsx)(`label`,{htmlFor:`cg-new-list`,children:`Lock records into a new view`}),(0,H.jsx)(`input`,{id:`cg-new-list`,className:`cg-input`,"data-overlay-autofocus":!0,value:ue,placeholder:`e.g. Q3 call plan`,onChange:e=>de(e.target.value),onKeyDown:e=>{e.key===`Enter`&&ue.trim()&&(u(he.id,``,ue.trim()),se(null))}}),(0,H.jsx)(`div`,{className:`cg-form-actions`,children:(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!ue.trim(),onClick:()=>{u(he.id,``,ue.trim()),se(null)},children:`Create and add`})})]})]}),ne&&Qe&&(0,H.jsxs)(Yp,{anchor:ne.anchor,className:`cg-pop cg-view-note-pop`,placement:`bottom-end`,role:`dialog`,ariaLabel:`Description for ${Qe.name}`,onDismiss:()=>re(null),dataKind:`saved-view-note`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Description`}),(0,H.jsxs)(`label`,{className:`cg-column-note`,children:[(0,H.jsx)(`span`,{children:`Shown under this view's name in the list.`}),(0,H.jsx)(`textarea`,{"data-overlay-autofocus":!0,value:ie,maxLength:2e3,placeholder:`What is this list for?…`,onChange:e=>ae(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:ie===(Qe.note??``),onClick:()=>{o(Qe.id,ie),re(null)},children:`Save description`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>re(null),children:`Cancel`})]})]})]})}var o7=30,lGe={ABS:[1,1],ROUND:[1,2],ROUNDUP:[1,2],ROUNDDOWN:[1,2],INT:[1,1],MOD:[2,2],SQRT:[1,1],POWER:[2,2],EXP:[1,1],LN:[1,1],SUM:[1,o7],AVERAGE:[1,o7],COUNT:[1,o7],COUNTA:[1,o7],MIN:[1,o7],MAX:[1,o7],IF:[2,3],AND:[1,o7],OR:[1,o7],NOT:[1,1],IFERROR:[2,2],ISBLANK:[1,1],CONCATENATE:[1,o7],LEFT:[1,2],RIGHT:[1,2],MID:[3,3],LEN:[1,1],TRIM:[1,1],UPPER:[1,1],LOWER:[1,1],PROPER:[1,1],VALUE:[1,1],TEXT:[2,2],TODAY:[0,0],YEAR:[1,1],MONTH:[1,1],DAY:[1,1],DAYS:[2,2]},uGe={CONCAT:`CONCATENATE`},dGe=new Set([`<`,`<=`,`>`,`>=`,`=`,`!=`]);function fGe(e){let t=[],n=0;for(;n=e.length)return`a text value is missing its closing quote`;if(e[r]===`"`){if(e[r+1]===`"`){i+=`"`,r+=2;continue}break}i+=e[r],r+=1}t.push({t:`str`,v:i}),n=r+1;continue}if(/[0-9]/.test(r)||r===`.`&&/[0-9]/.test(e[n+1]??``)){let r=/^(?:[0-9]+(?:\.[0-9]+)?|\.[0-9]+)/.exec(e.slice(n));if(!r||/^[0-9.]/.test(e[n+r[0].length]??``))return`unreadable number at "${e.slice(n,n+8)}"`;t.push({t:`num`,v:Number(r[0])}),n+=r[0].length;continue}if(/[A-Za-z_]/.test(r)){let r=/^[A-Za-z_][A-Za-z0-9_]*/.exec(e.slice(n));t.push({t:`ident`,v:r[0]}),n+=r[0].length;continue}let i=e.slice(n,n+2);if(i===`<=`||i===`>=`||i===`!=`||i===`==`||i===`<>`){t.push({t:`op`,v:i===`==`?`=`:i===`<>`?`!=`:i}),n+=2;continue}if(`+-*/^&(),<>=`.includes(r)){t.push({t:`op`,v:r}),n+=1;continue}return`unexpected character "${r}"`}return t}function s7(e){if(typeof e!=`string`||e.trim()===``)return{ok:!1,error:`the formula is empty`};if(e.length>500)return{ok:!1,error:`formula longer than 500 characters`};let t=fGe(e);if(typeof t==`string`)return{ok:!1,error:t};if(t.length===0)return{ok:!1,error:`the formula is empty`};if(t.length>200)return{ok:!1,error:`formula has more than 200 tokens`};let n=0,r=()=>t[n],i=e=>{let r=t[n];return r?.t===`op`&&r.v===e},a=null,o=e=>(a===null&&(a=e),null);function s(e){if(e>24)return o(`formula is nested too deeply`);let t=c(e);if(!t)return null;let i=r();if(i?.t===`op`&&dGe.has(i.v)){n+=1;let a=c(e);if(!a)return null;let s=r();return s?.t===`op`&&dGe.has(s.v)?o(`comparisons cannot be chained (a < b < c)`):{t:`cmp`,op:i.v,l:t,r:a}}return t}function c(e){let t=l(e);if(!t)return null;for(;i(`&`);){n+=1;let r=l(e);if(!r)return null;t={t:`bin`,op:`&`,l:t,r}}return t}function l(e){let t=u(e);if(!t)return null;for(;;)if(i(`+`)||i(`-`)){let i=r().v;n+=1;let a=u(e);if(!a)return null;t={t:`bin`,op:i,l:t,r:a}}else return t}function u(e){let t=d(e);if(!t)return null;for(;;)if(i(`*`)||i(`/`)){let i=r().v;n+=1;let a=d(e);if(!a)return null;t={t:`bin`,op:i,l:t,r:a}}else return t}function d(e){if(e>24)return o(`formula is nested too deeply`);let t=f(e);if(!t)return null;if(i(`^`)){n+=1;let r=d(e+1);return r?{t:`bin`,op:`^`,l:t,r}:null}return t}function f(e){if(e>24)return o(`formula is nested too deeply`);if(i(`-`)){n+=1;let t=f(e+1);return t?{t:`neg`,e:t}:null}return p(e)}function p(e){if(e>24)return o(`formula is nested too deeply`);let t=r();if(!t)return o(`the formula ends unexpectedly`);if(t.t===`num`)return n+=1,{t:`num`,v:t.v};if(t.t===`str`)return n+=1,{t:`str`,v:t.v};if(t.t===`ref`)return n+=1,{t:`ref`,k:t.k};if(t.t===`op`&&t.v===`(`){n+=1;let t=s(e+1);return t?i(`)`)?(n+=1,t):o(`missing closing parenthesis`):null}if(t.t===`ident`){let r=t.v.toUpperCase();if(r===`TRUE`||r===`FALSE`)return n+=1,{t:`bool`,v:r===`TRUE`};let a=uGe[r]??r;if(!(a in lGe))return o(`unknown function ${r} — see the formula help for what is available`);if(n+=1,!i(`(`))return o(`${a} must be called with parentheses: ${a}(…)`);n+=1;let c=[];if(!i(`)`))for(;;){let t=s(e+1);if(!t)return null;if(c.push(t),i(`,`)){n+=1;continue}break}if(!i(`)`))return o(`missing closing parenthesis on ${a}(…)`);n+=1;let[l,u]=lGe[a];return c.lengthu?o(l===u?`${a} takes exactly ${l} argument${l===1?``:`s`}`:`${a} takes ${l} to ${u} arguments`):{t:`call`,fn:a,args:c}}return o(`unexpected "${t.t===`op`?t.v:String(t.v)}"`)}let m=s(1);if(!m)return{ok:!1,error:a??`could not parse the formula`};if(n!==t.length){let e=t[n];return{ok:!1,error:`unexpected "${e.t===`op`||e.t===`ident`?e.v:e.t===`ref`?`{${e.k}}`:String(e.v)}" after the formula`}}return{ok:!0,ast:m,refs:pGe(m)}}function pGe(e){let t=[],n=e=>{switch(e.t){case`ref`:t.includes(e.k)||t.push(e.k);return;case`neg`:n(e.e);return;case`bin`:case`cmp`:n(e.l),n(e.r);return;case`call`:e.args.forEach(n);return;default:return}};return n(e),t}function c7(e){if(typeof e==`number`)return Number.isFinite(e)?e:null;if(e==null)return null;if(typeof e==`string`){let t=e.trim();if(t===``)return null;let n=Number(t);return Number.isFinite(n)?n:null}return null}function l7(e){return typeof e==`number`&&Number.isFinite(e)?e:typeof e==`string`?c7(e):null}function u7(e){return e==null?``:typeof e==`string`?e:typeof e==`boolean`?e?`TRUE`:`FALSE`:mGe(e)}function mGe(e){return String(Number.isInteger(e)?e:Number(e.toFixed(10)))}function hGe(e,t){if(!Number.isInteger(t)||t<-10||t>10)return null;let n=10**t,r=Math.sign(e)*Math.round(Math.abs(e)*n)/n;return Number.isFinite(r)?r:null}function d7(e){if(typeof e!=`string`)return null;let t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e.trim());if(!t)return null;let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]);return r<1||r>12||i<1||i>31?null:{y:n,m:r,d:i}}function gGe(e){return Date.UTC(e.y,e.m-1,e.d)/864e5}function _Ge(e,t){let n=/^(\$?)(#,##0|0)(?:\.(0+))?(%?)$/.exec(t.trim());if(!n)return null;let[,r,i,a,o]=n,s=e;o===`%`&&(s*=100);let c=a?a.length:0,l=s<0||Object.is(s,-0)?`-`:``,[u,d]=Math.abs(s).toFixed(c).split(`.`);return i===`#,##0`&&(u=u.replace(/\B(?=(\d{3})+(?!\d))/g,`,`)),l+r+u+(c?`.`+d:``)+(o===`%`?`%`:``)}function f7(e,t){let n=[];for(let r of e){let e=t(r);if(e==null)continue;let i=l7(e);i!=null&&n.push(i)}return n}function vGe(e,t,n){let r=e=>vGe(e,t,n);switch(e.t){case`num`:return e.v;case`str`:return e.v;case`bool`:return e.v;case`ref`:{let n=t(e.k);return typeof n==`string`||typeof n==`number`&&Number.isFinite(n)?n:null}case`neg`:{let t=l7(r(e.e));return t==null?null:-t}case`bin`:{if(e.op===`&`)return u7(r(e.l))+u7(r(e.r));let t=l7(r(e.l));if(t==null)return null;let n=l7(r(e.r));if(n==null)return null;let i;switch(e.op){case`+`:i=t+n;break;case`-`:i=t-n;break;case`*`:i=t*n;break;case`/`:if(n===0)return null;i=t/n;break;case`^`:i=t**+n;break}return Number.isFinite(i)?i:null}case`cmp`:{let t=r(e.l),n=r(e.r),i=typeof t==`number`?t:null,a=typeof n==`number`?n:null,o=i??(typeof t==`string`?c7(t):null),s=a??(typeof n==`string`?c7(n):null);if(o!=null&&s!=null)return yGe(e.op,o,s);if(typeof t==`string`&&typeof n==`string`){let r=t.trim().toLowerCase(),i=n.trim().toLowerCase();return r===``||i===``?null:yGe(e.op,ri),0)}return null}case`call`:switch(e.fn){case`ABS`:{let t=l7(r(e.args[0]));return t==null?null:Math.abs(t)}case`ROUND`:case`ROUNDUP`:case`ROUNDDOWN`:{let t=l7(r(e.args[0]));if(t==null)return null;let n=e.args.length>1?l7(r(e.args[1])):0;if(n==null||!Number.isInteger(n)||n<-10||n>10)return null;if(e.fn===`ROUND`)return hGe(t,n);let i=10**n,a=t*i,o=(e.fn===`ROUNDUP`?Math.sign(a)*Math.ceil(Math.abs(a)):Math.sign(a)*Math.floor(Math.abs(a)))/i;return Number.isFinite(o)?o:null}case`INT`:{let t=l7(r(e.args[0]));return t==null?null:Math.floor(t)}case`MOD`:{let t=l7(r(e.args[0])),n=l7(r(e.args[1]));return t==null||n==null||n===0?null:t-n*Math.floor(t/n)}case`SQRT`:{let t=l7(r(e.args[0]));return t==null||t<0?null:Math.sqrt(t)}case`POWER`:{let t=l7(r(e.args[0])),n=l7(r(e.args[1]));if(t==null||n==null)return null;let i=t**+n;return Number.isFinite(i)?i:null}case`EXP`:{let t=l7(r(e.args[0]));if(t==null)return null;let n=Math.exp(t);return Number.isFinite(n)?n:null}case`LN`:{let t=l7(r(e.args[0]));return t==null||t<=0?null:Math.log(t)}case`SUM`:return f7(e.args,r).reduce((e,t)=>e+t,0);case`AVERAGE`:{let t=f7(e.args,r);return t.length===0?null:t.reduce((e,t)=>e+t,0)/t.length}case`COUNT`:return f7(e.args,r).length;case`COUNTA`:{let t=0;for(let n of e.args){let e=r(n);e!=null&&e!==``&&(t+=1)}return t}case`MIN`:case`MAX`:{let t=f7(e.args,r);return t.length===0?null:e.fn===`MIN`?Math.min(...t):Math.max(...t)}case`IF`:{let t=r(e.args[0]);return typeof t==`boolean`?t?r(e.args[1]):e.args.length>2?r(e.args[2]):null:null}case`AND`:case`OR`:for(let t of e.args){let n=r(t);if(typeof n!=`boolean`)return null;if(e.fn===`AND`&&!n)return!1;if(e.fn===`OR`&&n)return!0}return e.fn===`AND`;case`NOT`:{let t=r(e.args[0]);return typeof t==`boolean`?!t:null}case`IFERROR`:return r(e.args[0])??r(e.args[1]);case`ISBLANK`:{let t=r(e.args[0]);return t==null||t===``}case`CONCATENATE`:return e.args.map(e=>u7(r(e))).join(``);case`LEFT`:case`RIGHT`:{let t=u7(r(e.args[0])),n=e.args.length>1?l7(r(e.args[1])):1;return n==null||!Number.isInteger(n)||n<0?null:e.fn===`LEFT`?t.slice(0,n):n===0?``:t.slice(-n)}case`MID`:{let t=u7(r(e.args[0])),n=l7(r(e.args[1])),i=l7(r(e.args[2]));return n==null||i==null||!Number.isInteger(n)||!Number.isInteger(i)||n<1||i<0?null:t.slice(n-1,n-1+i)}case`LEN`:return u7(r(e.args[0])).length;case`TRIM`:return u7(r(e.args[0])).replace(/\s+/g,` `).trim();case`UPPER`:return u7(r(e.args[0])).toUpperCase();case`LOWER`:return u7(r(e.args[0])).toLowerCase();case`PROPER`:return u7(r(e.args[0])).replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase());case`VALUE`:return l7(r(e.args[0]));case`TEXT`:{let t=l7(r(e.args[0])),n=r(e.args[1]);return t==null||typeof n!=`string`?null:_Ge(t,n)}case`TODAY`:return typeof n.today==`string`&&d7(n.today)?n.today:null;case`YEAR`:case`MONTH`:case`DAY`:{let t=d7(r(e.args[0]));return t?e.fn===`YEAR`?t.y:e.fn===`MONTH`?t.m:t.d:null}case`DAYS`:{let t=d7(r(e.args[0])),n=d7(r(e.args[1]));return!t||!n?null:Math.round(gGe(t)-gGe(n))}}return null;default:return null}}function yGe(e,t,n){switch(e){case`<`:return t`:return t>n;case`>=`:return t>=n;case`=`:return t===n;case`!=`:return t!==n}}function bGe(e,t,n={}){try{let r=vGe(e,t,n);return typeof r==`number`?Number.isFinite(r)?r:null:typeof r==`string`?r:typeof r==`boolean`?r?`TRUE`:`FALSE`:null}catch{return null}}function xGe(e){let t=new Map;for(let[n,r]of e){let i=s7(r);t.set(n,i.ok?i.refs.filter(t=>e.has(t)&&t!==n):[])}let n=[],r=new Map,i=new Set,a=(e,o)=>{let s=r.get(e);if(s===2)return!i.has(e);if(s===1){for(let t=o.lastIndexOf(e);t({value:e,label:Af[e]}));function h7(e){return e===`select`||e===`multiselect`}var g7=[`Not started`,`In progress`,`Blocked`,`Done`],SGe=0;function _7(){return SGe+=1,`choice-${SGe}`}function v7(e,t=void 0){return e.map(e=>({id:_7(),label:e,color:mp(t?.[e])??mp(Sp(e))}))}function y7(e,t){let n=e.map(e=>t===`multiselect`?e.label.replace(/,/g,` `):e.label),r=gee(n.join(` -`)),i=new Map;e.forEach((e,t)=>{let r=n[t].trim();r&&!i.has(r.toLowerCase())&&i.set(r.toLowerCase(),e)});let a={};for(let e of r){let t=mp(i.get(e.toLowerCase())?.color);t&&t!==mp(Sp(e))&&(a[e]=t)}return{options:r,colors:a}}function CGe(e,t){return e.map(e=>`${e}\u0000${mp(t?Object.entries(t).find(([t])=>t.trim().toLowerCase()===e.toLowerCase())?.[1]:void 0)??mp(Sp(e))}`).join(``)}function wGe({value:e,disabled:t,label:n,onPick:r}){let[i,a]=(0,z.useState)(!1),o=(0,z.useRef)(null),s=_p(e);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{ref:o,type:`button`,className:`cg-option-color`,disabled:t,style:{background:s?.bg??mp(e)??`#FFFFFF`},"aria-label":`Colour for ${n}${s?` — ${s.label}`:``}`,"aria-haspopup":`dialog`,"aria-expanded":i,title:`Change option colour`,onClick:()=>a(e=>!e)}),i&&o.current&&(0,H.jsx)(Yp,{anchor:o.current,className:`cg-pop cg-swatch-pop`,onDismiss:()=>a(!1),role:`dialog`,ariaLabel:`Colour for ${n}`,dataKind:`option-colour`,children:(0,H.jsx)(`div`,{className:`cg-swatch-grid`,children:gp.map(e=>(0,H.jsx)(`button`,{type:`button`,className:`cg-swatch`+(s?.id===e.id?` is-on`:``),style:{background:e.bg,color:e.fg},"aria-label":e.label,"aria-pressed":s?.id===e.id,title:e.label,onClick:()=>{r(e.bg),a(!1)},children:s?.id===e.id&&(0,H.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`m3.5 8.5 3 3 6-6.5`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})})},e.id))})})]})}function b7({idPrefix:e,drafts:t,onDrafts:n,colorCode:r,onColorCode:i,type:a}){let o=(e,r)=>n(t.map(t=>t.id===e?{...t,...r}:t)),s=y7(t,a);return(0,H.jsxs)(`div`,{className:`cg-options-editor`,children:[(0,H.jsxs)(`div`,{className:`cg-options-head`,children:[(0,H.jsx)(`strong`,{children:`Options`}),(0,H.jsxs)(`label`,{className:`cg-option-toggle`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:r,onChange:e=>i(e.target.checked)}),(0,H.jsx)(`span`,{children:`Color-code options`})]})]}),(0,H.jsx)(`div`,{className:`cg-option-list`,children:t.map((i,s)=>(0,H.jsxs)(`div`,{className:`cg-option-row`,children:[(0,H.jsx)(wGe,{value:mp(i.color)??pp[s%pp.length].bg,disabled:!r,label:i.label||`option ${s+1}`,onPick:e=>o(i.id,{color:e})}),(0,H.jsx)(`input`,{id:`${e}-${i.id}`,className:`cg-input cg-option-name`,type:`text`,maxLength:120,value:i.label,placeholder:`Option name`,"aria-label":`Option ${s+1}`,onChange:e=>{let t=a===`multiselect`?e.target.value.replace(/,/g,` `):e.target.value;o(i.id,{label:t})},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),n([...t,{id:_7(),label:``,color:pp[t.length%pp.length].bg}]))}}),(0,H.jsx)(`button`,{type:`button`,className:`cg-option-remove`,"aria-label":`Remove ${i.label||`option ${s+1}`}`,title:`Remove option`,onClick:()=>n(t.filter(e=>e.id!==i.id)),children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]},i.id))}),(0,H.jsx)(`button`,{type:`button`,className:`cg-option-add`,onClick:()=>n([...t,{id:_7(),label:``,color:pp[t.length%pp.length].bg}]),children:`Add option`}),(0,H.jsxs)(`span`,{className:`cg-field-hint`,children:[s.options.length,` option`,s.options.length===1?``:`s`,`.`,a===`multiselect`&&` Commas inside an option are not supported.`]})]})}function TGe({value:e,onPick:t,offerMeasure:n,only:r}){let[i,a]=(0,z.useState)(``),o=i.trim().toLowerCase(),s=[...r?m7.filter(e=>r.includes(e.value)):m7,...n?[{value:`measure`,label:`Metric`}]:[]].filter(e=>!o||e.label.toLowerCase().includes(o));return(0,H.jsxs)(`div`,{className:`cg-type-picker`,children:[(0,H.jsxs)(`div`,{className:`cg-type-search`,children:[(0,H.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:[(0,H.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.4`,stroke:`currentColor`,strokeWidth:`1.35`}),(0,H.jsx)(`path`,{d:`m10.4 10.4 3.1 3.1`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`})]}),(0,H.jsx)(`input`,{type:`text`,value:i,placeholder:`Find a field type`,"aria-label":`Find a field type`,onChange:e=>a(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`cg-type-list`,role:`listbox`,"aria-label":`Field type`,children:[s.map(n=>(0,H.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e===n.value,className:`cg-type-row`+(e===n.value?` is-on`:``),onClick:()=>t(n.value),children:[(0,H.jsx)(Zp,{type:n.value===`measure`?`currency`:n.value,size:16}),(0,H.jsx)(`span`,{className:`cg-type-label`,children:n.label}),e===n.value&&(0,H.jsx)(`svg`,{className:`cg-type-check`,width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`m3.5 8.5 3 3 6-6.5`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`})})]},n.value)),s.length===0&&(0,H.jsx)(`div`,{className:`cg-pop-note`,children:`No matching type.`})]})]})}var EGe=`new:`,DGe=Yu.filter(e=>e!==`formula`&&e!==`created_time`&&e!==`automation`),x7=[{key:`instagram_profile`,label:`Instagram profile`,hint:`Reads what is anonymously public about the profile in the chosen URL column, and writes the result here. Runs from the Automation surface — on demand or on a schedule.`}],OGe={kind:`ltm`};function S7({title:e,sub:t,onClose:n}){return(0,H.jsxs)(`div`,{className:`cg-column-head`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`cg-column-title`,children:e}),t&&(0,H.jsx)(`div`,{className:`cg-column-type`,children:t})]}),(0,H.jsx)(`button`,{type:`button`,className:`cg-icon-btn`,onClick:n,"aria-label":`Close column menu`,children:`×`})]})}function kGe({value:e,onValue:t}){return(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Scope`}),(0,H.jsxs)(`select`,{className:`cg-select cg-scope-select`,value:e,"aria-label":`Field scope`,onChange:e=>t(e.target.value),children:[(0,H.jsx)(`option`,{value:`cohort`,disabled:e!==`cohort`,children:`The cohort table only (retired)`}),(0,H.jsx)(`option`,{value:`global`,children:`All customer tables`})]})]})}function C7({kind:e,fields:t,formulaText:n,onFormulaText:r,formulaError:i,maxValue:a,onMaxValue:o,idPrefix:s,showFormulaHelp:c=!0,automationKind:l=`instagram_profile`,onAutomationKind:u,automationUrlField:d=``,onAutomationUrlField:f}){if(e===`formula`){let e=t.filter(e=>e.key!==`__proto__`);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Formula`}),(0,H.jsx)(`textarea`,{className:`cg-input cg-formula-editor`,rows:3,value:n,placeholder:`MAX(0, {revenue_ly} - {revenue_ytd})`,"aria-label":`Formula`,onChange:e=>r(e.target.value)})]}),(0,H.jsx)(`div`,{className:`cg-cond-line cg-formula-insert`,children:(0,H.jsx)(sm,{ariaLabel:`Insert a field reference`,placeholder:`Insert a field reference…`,value:void 0,keepOpen:!0,onChange:e=>r((n+` {`+e+`}`).trimStart()),fields:e.map(e=>({key:e.key,label:e.label,type:e.type}))})}),n.trim()!==``&&i?(0,H.jsx)(`div`,{className:`cg-field-hint cg-formula-error`,children:i}):c?(0,H.jsxs)(`div`,{className:`cg-field-hint`,children:[`Excel-style: numbers, text in quotes, `,`{field}`,` references, + − × ÷ ^ & ( ), IF · AND · OR · SUM · AVERAGE · COUNT · MIN · MAX · ROUND(UP/DOWN) · ABS · MOD · SQRT · CONCATENATE · LEFT · RIGHT · MID · LEN · TRIM · UPPER · LOWER · PROPER · TEXT · VALUE · TODAY · DAYS · YEAR · MONTH · DAY · IFERROR · ISBLANK. Errors show a blank cell.`]}):null]})}if(e===`rating`)return(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Number of stars`}),(0,H.jsx)(`input`,{id:`${s}-rating-max`,className:`cg-input cg-rating-max`,type:`number`,min:2,max:10,value:a,"aria-label":`Number of stars`,onChange:e=>{let t=Math.round(Number(e.target.value));o(Number.isFinite(t)?Math.max(2,Math.min(10,t)):5)}})]});if(e===`created_time`)return(0,H.jsx)(`div`,{className:`cg-field-hint`,children:`Read-only. When the record was created in the source system.`});if(e===`automation`){let e=t.filter(e=>e.type===`url`||e.type===`text`),n=x7.find(e=>e.key===l)??x7[0];return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`What it reads`}),(0,H.jsx)(`select`,{id:`${s}-automation-kind`,className:`cg-input`,value:l,"aria-label":`Automation kind`,onChange:e=>u?.(e.target.value),children:x7.map(e=>(0,H.jsx)(`option`,{value:e.key,children:e.label},e.key))})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`URL column`}),(0,H.jsxs)(`select`,{id:`${s}-automation-url`,className:`cg-input`,value:d,"aria-label":`URL column`,onChange:e=>f?.(e.target.value),children:[(0,H.jsx)(`option`,{value:``,children:`Choose a column…`}),e.map(e=>(0,H.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]}),(0,H.jsx)(`div`,{className:`cg-field-hint`,children:n.hint}),(0,H.jsx)(`div`,{className:`cg-field-hint`,children:`Cells here are written by the run and cannot be typed into — a value you entered would be replaced by the next run without saying so.`}),(0,H.jsx)(`div`,{className:`cg-field-hint`,children:`Runs target a blank database. On a connector-backed table this column can be created but no automation can write to it yet.`})]})}return null}function AGe({state:e,field:t,fields:n,locked:r,viewer:i,sortedDir:a,isFiltered:o,isGrouped:s,groupable:c,onClose:l,onNote:u,onHide:d,onCreate:f,onChangeField:p,onCreateAndSwap:m,onRetype:h,onRename:g,onFormula:_,initialPosition:v,scopeChoice:y=!1,pinnedTo:b=!1,onPinTo:x,onUnpin:S,onPeriod:C,onDelete:w,onDuplicate:T,onPermissions:E,onFormat:D,onSort:O,onClearSort:k,onFilterBy:A,onClearFilter:j,onGroupByField:M,onClearGroup:N,userOptions:P=[],measures:F=[]}){let[ee,I]=(0,z.useState)(`menu`),[te,L]=(0,z.useState)(t.note??``),[ne,re]=(0,z.useState)(v??null),[ie,ae]=(0,z.useState)(!1),[oe,se]=(0,z.useState)(``),[ce,le]=(0,z.useState)(!1),[ue,de]=(0,z.useState)(`text`),[fe,pe]=(0,z.useState)(()=>v7(g7)),[me,he]=(0,z.useState)(!0),[ge,_e]=(0,z.useState)(F[0]?.key??``),[ve,ye]=(0,z.useState)(OGe),[be,xe]=(0,z.useState)(``),[Se,Ce]=(0,z.useState)(5),[we,Te]=(0,z.useState)(x7[0].key),[Ee,De]=(0,z.useState)(()=>n.find(e=>e.type===`url`)?.key??``),[Oe,ke]=(0,z.useState)(``),[Ae,je]=(0,z.useState)(``),[Me,Ne]=(0,z.useState)(()=>v7(g7)),[Pe,Fe]=(0,z.useState)(!0),[Ie,Le]=(0,z.useState)(``),[Re,ze]=(0,z.useState)(5),[Be,Ve]=(0,z.useState)(null),[He,Ue]=(0,z.useState)(t.permissions?.edit??`everyone`),[We,Ge]=(0,z.useState)(()=>({...t.format??{}})),[Ke,qe]=(0,z.useState)(`cohort`),[Je,Ye]=(0,z.useState)(t.label),[Xe,Ze]=(0,z.useState)(t.type),[Qe,$e]=(0,z.useState)(()=>v7(Qu(t).length?Qu(t):g7,t.optionColors)),[et,R]=(0,z.useState)(t.colorCodeOptions!==!1),[tt,nt]=(0,z.useState)(()=>$u(t)),[rt,it]=(0,z.useState)(()=>typeof t.formula==`string`?t.formula:``),[at,ot]=(0,z.useState)(()=>t.automation?.kind??x7[0].key),[st,ct]=(0,z.useState)(()=>t.automation?.urlField??``),lt=Oe.startsWith(EGe)?Oe.slice(4):null,ut=y7(fe,ue),dt=ut.options,ft=lt?y7(Me,lt):{options:[],colors:{}},pt=ft.options,mt=y7(Qe,Xe),ht=mt.options,gt=(0,z.useMemo)(()=>new Set(n.filter(e=>e.type!==`formula`).map(e=>e.key)),[n]),_t=(0,z.useMemo)(()=>{let e=new Map;for(let t of n){if(t.type!==`formula`)continue;let n=typeof t.formula==`string`?t.formula:``;n&&e.set(t.key,n)}return e},[n]),vt=(0,z.useMemo)(()=>be.trim()===``?{ok:!1,error:`Type a formula`,refs:[]}:p7(be,gt,_t),[be,gt,_t]),yt=(0,z.useMemo)(()=>Ie.trim()===``?{ok:!1,error:`Type a formula`,refs:[]}:p7(Ie,gt,_t),[Ie,gt,_t]),bt=F.find(e=>e.key===ge),xt=bt?`${bt.label} · ${qu(ve)}`:``,St=ue===`measure`&&!ce&&!oe.trim()?xt:oe,Ct=St.trim()!==``&&(!h7(ue)||dt.length>0)&&(ue!==`measure`||!!bt)&&(ue!==`formula`||vt.ok)&&(ue!==`automation`||Ee!==``),wt=(e,t,n)=>{if(e===`formula`)return{formula:t.trim()};if(e===`rating`)return{max:n};if(e===`automation`)return{automation:{kind:we,source:`record_url_field`,urlField:Ee}}},Tt=(e,t,n)=>h7(e)?{colorCodeOptions:n,...Object.keys(t).length?{optionColors:t}:{}}:{},Et=e=>y?{...e??{},scope:Ke}:e,Dt=()=>{let e=St.trim();if(!(!e||!ne||!Ct)){if(ue===`measure`){if(!bt)return;f(e,bt.type,ne===`end`?null:t.key,ne,void 0,{key:bt.key,window:ve},Et(void 0)),l();return}f(e,ue,ne===`end`?null:t.key,ne,h7(ue)?dt:void 0,void 0,Et({...wt(ue,be,Se),...Tt(ue,ut.colors,me)})),l()}},Ot=lt!=null&&Ae.trim()!==``&&(!h7(lt)||pt.length>0)&&(lt!==`formula`||yt.ok),kt=()=>{!lt||!Ot||(m(Ae.trim(),lt,h7(lt)?pt:void 0,Et({...wt(lt,Ie,Re),...Tt(lt,ft.colors,Pe)})),l())},At=Je.trim(),jt=!!g&&At!==``&&At!==t.label,Mt=h7(Xe)&&ht.join(` +`),f.forEach((e,t)=>{let n=5+t*2;p.push(`${n} 0 obj\n<< /Type /Page /Parent 2 0 R /MediaBox [0 0 ${K5} ${q5}] /Resources << /Font << /F1 3 0 R /F2 4 0 R >> >> /Contents ${n+1} 0 R >>\nendobj\n`),p.push(`${n+1} 0 obj\n<< /Length ${e.length} >>\nstream\n${e}endstream\nendobj\n`)});let h=`%PDF-1.4 +`,g=[];for(let e of p)g.push(h.length),h+=e;let _=h.length;h+=`xref\n0 ${p.length+1}\n0000000000 65535 f \n`;for(let e of g)h+=`${String(e).padStart(10,`0`)} 00000 n \n`;h+=`trailer\n<< /Size ${p.length+1} /Root 1 0 R >>\nstartxref\n${_}\n%%EOF\n`;let v=new Uint8Array(h.length);for(let e=0;eURL.revokeObjectURL(n),4e3)}function n7(e,t,n,r,i){let a=qWe(t,n,e);if(e===`csv`){t7(a,new Blob([``,YWe(r,i)],{type:`text/csv;charset=utf-8`}));return}if(e===`json`){t7(a,new Blob([XWe(r,i)],{type:`application/json`}));return}if(e===`xlsx`){t7(a,new Blob([rGe(r,i,t,n).buffer],{type:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`}));return}t7(a,new Blob([aGe(r,i,t,n).buffer],{type:`application/pdf`}))}var r7=(e,t)=>typeof e==`number`&&t-e<=12e4;function oGe(e,t){let n={},r=e=>{if(!e)return;let n=Object.entries(e).filter(([,e])=>r7(e,t));return n.length?Object.fromEntries(n.slice(-64)):void 0},i=e=>{if(!e)return;let n=Object.entries(e).filter(([,e])=>r7(e.at,t));return n.length?Object.fromEntries(n.slice(-64)):void 0},a=r(e?.created),o=i(e?.renamed),s=r(e?.deleted),c=i(e?.moved);return a&&(n.created=a),o&&(n.renamed=o),s&&(n.deleted=s),c&&(n.moved=c),n}function sGe(e,t,n,r){let i=e??[],a=[],o=new Set;for(let e of i){if(r7(n?.deleted?.[e.id],r))continue;o.add(e.id);let t=n?.renamed?.[e.id];a.push(r7(t?.at,r)&&t?{...e,name:t.name}:e)}for(let e of t??[])o.has(e.id)||r7(n?.created?.[e.id],r)&&(r7(n?.deleted?.[e.id],r)||a.push(e));return a.sort((e,t)=>(e.order??0)-(t.order??0)||e.name.localeCompare(t.name))}function cGe(e,t,n,r,i){let a=r?.moved?.[e],o=r7(a?.at,i)&&a?a.folderId:t??null;return o==null?null:n.some(e=>e.id===o)?o:null}function lGe(e,t,n){let r=new Map(t.map(e=>[e.id,[]])),i=[];for(let t of e){let e=n(t),a=e==null?void 0:r.get(e);a?a.push(t):i.push(t)}let a=t.map(e=>({folder:e,items:r.get(e.id)??[]}));return a.push({folder:null,items:i}),a}function uGe(){return`fld_${typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10)}`}function dGe({views:e,activeViewId:t,saveState:n,onSelect:r,onCreate:i,onRename:a,onNote:o,onDuplicate:s,onDelete:c,lists:l=[],onAddToList:u,onCohortLock:d,today:f,onExport:p,folders:m,folderIdOf:h,onFolderCreate:g,onFolderRename:_,onFolderDelete:v,onFolderDuplicate:y,onItemMove:b,folderAddPreview:x,onFolderAddToList:S,viewer:C,onToggleLock:w,userOptions:T=[]}){let[E,D]=(0,z.useState)(null),[O,k]=(0,z.useState)(null),[A,j]=(0,z.useState)(``),[M,N]=(0,z.useState)(`personal`),[P,F]=(0,z.useState)([]),[ee,I]=(0,z.useState)(null),[te,L]=(0,z.useState)(null),[ne,re]=(0,z.useState)(null),[ie,ae]=(0,z.useState)(``),[oe,se]=(0,z.useState)(null),[ce,le]=(0,z.useState)(null),[ue,de]=(0,z.useState)(``),[fe,pe]=(0,z.useState)(null),me=fe?e.find(e=>e.id===fe.viewId):void 0,he=oe?e.find(e=>e.id===oe.viewId):void 0,ge=ee?e.find(e=>e.id===ee.viewId):void 0,_e=!!ge&&Td(ge,C),[ve,ye]=(0,z.useState)(new Set),[be,xe]=(0,z.useState)(null),[Se,Ce]=(0,z.useState)(null),[we,Te]=(0,z.useState)(!1),[Ee,De]=(0,z.useState)(``),[Oe,ke]=(0,z.useState)({shape:Od,tone:kd}),[Ae,je]=(0,z.useState)(null),[Me,Ne]=(0,z.useState)(null),[Pe,Fe]=(0,z.useState)(null),[Ie,Le]=(0,z.useState)(``),[Re,ze]=(0,z.useState)(null),[Be,Ve]=(0,z.useState)(``),[He,Ue]=(0,z.useState)(()=>{try{return localStorage.getItem(`aios-views-rail`)===`1`}catch{return!1}}),We=()=>Ue(e=>{let t=!e;try{localStorage.setItem(`aios-views-rail`,t?`1`:`0`)}catch{}return t}),Ge=Be.trim().toLowerCase(),Ke=Ge?e.filter(e=>(e.name||``).toLowerCase().includes(Ge)):e,qe=!!m&&!!h&&!!b,Je=lGe(Ke,qe?m:[],e=>h?h(e.id):null),Ye=be?m?.find(e=>e.id===be.id):void 0,Xe=Me&&x?x(Me):null,Ze=e=>qe?{onDragOver:t=>{t.preventDefault(),ze(e??`__root__`)},onDragLeave:()=>ze(null),onDrop:t=>{t.preventDefault(),ze(null);let n=t.dataTransfer.getData(`text/plain`);n&&b?.(n,e)}}:{},Qe=ne?e.find(e=>e.id===ne.viewId):void 0,$e=()=>{let e=A.trim();!e||!E||(i(e,E,Qee({edit:M,users:P},`personal`,T)),j(``),N(`personal`),F([]),D(null))},et=()=>{let e=Ee.trim();e&&(g?.(e,ete(Oe)),De(``),ke({shape:Od,tone:kd}),Te(!1))},R=e=>{k(null),Te(!1),D(e)},tt=()=>{k(null),D(null),Te(!0)},nt=e=>{if(![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;let t=[...e.currentTarget.querySelectorAll(`[role="menuitem"]`)];if(!t.length)return;e.preventDefault();let n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:e.key===`ArrowDown`?(n+1)%t.length:(n-1+t.length)%t.length]?.focus()};return(0,H.jsxs)(`aside`,{className:`cg-views`+(He?` is-collapsed`:``),"aria-label":`Customer views`,children:[(0,H.jsx)(`div`,{className:`cg-views-top`,children:(0,H.jsx)(`button`,{type:`button`,className:`cg-rail-toggle`,"aria-label":He?`Expand views`:`Minimize views`,"aria-expanded":!He,title:He?`Expand views`:`Minimize views`,onClick:We,children:(0,H.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M2.5 4.4h11M2.5 8h11M2.5 11.6h11`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`})})})}),(0,H.jsx)(`div`,{className:`cg-sr-only`,"aria-live":`polite`,children:n===`saving`?`Saving changes…`:`All changes saved`}),(0,H.jsx)(`div`,{className:`cg-create-new`,children:(0,H.jsxs)(`button`,{type:`button`,className:`cg-link-btn cg-create-btn`,"aria-haspopup":`menu`,"aria-expanded":!!O,onClick:e=>k(t=>t?null:e.currentTarget),children:[(0,H.jsx)(`span`,{className:`cg-create-icon`,"aria-hidden":`true`,children:`+`}),(0,H.jsx)(`span`,{className:`cg-create-label`,children:`Create new…`})]})}),(0,H.jsxs)(`div`,{className:`cg-find-view`,children:[(0,H.jsxs)(`svg`,{className:`cg-find-view-icon`,width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:[(0,H.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.4`,stroke:`currentColor`,strokeWidth:`1.35`}),(0,H.jsx)(`path`,{d:`m10.4 10.4 3.1 3.1`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`})]}),(0,H.jsx)(`input`,{type:`text`,value:Be,placeholder:`Find a view`,"aria-label":`Find a view`,onChange:e=>Ve(e.target.value),onKeyDown:e=>{e.key===`Escape`&&Ve(``)}})]}),E&&(0,H.jsxs)(`div`,{className:`cg-view-create cg-create-form`,children:[(0,H.jsxs)(`label`,{htmlFor:`cg-new-view`,children:[`New `,kf[E].toLowerCase(),` view`]}),(0,H.jsx)(`input`,{id:`cg-new-view`,className:`cg-input`,autoFocus:!0,value:A,placeholder:`e.g. Florida at risk`,onChange:e=>j(e.target.value),onKeyDown:e=>{e.key===`Enter`&&$e(),e.key===`Escape`&&D(null)}}),(0,H.jsxs)(`div`,{className:`cg-perm`,role:`radiogroup`,"aria-label":`Who can edit this view`,children:[(0,H.jsx)(`span`,{className:`cg-perm-title`,children:`Who can edit`}),wd.map(e=>(0,H.jsxs)(`label`,{className:`cg-radio-row cg-perm-row`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`cg-view-perm`,checked:M===e,onChange:()=>N(e)}),(0,H.jsxs)(`span`,{className:`cg-perm-label`,children:[Xee[e],(0,H.jsx)(`span`,{className:`cg-perm-blurb`,children:Zee[e]})]})]},e)),M===`users`&&(0,H.jsxs)(`div`,{className:`cg-perm-users`,children:[T.length===0?(0,H.jsx)(`span`,{className:`cg-perm-empty`,children:`No other accounts to pick — this will save as Personal.`}):T.map(e=>(0,H.jsxs)(`label`,{className:`cg-perm-user`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:P.includes(e),onChange:t=>F(n=>t.target.checked?[...n,e].slice(0,50):n.filter(t=>t!==e))}),(0,H.jsx)(`span`,{children:e})]},e)),T.length>0&&P.length===0&&(0,H.jsx)(`span`,{className:`cg-perm-empty`,children:`Pick at least one person, or this saves as Personal.`})]})]}),(0,H.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,onClick:$e,disabled:!A.trim(),children:`Create`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>D(null),children:`Cancel`})]})]}),qe&&g&&we&&(0,H.jsxs)(`div`,{className:`cg-view-create cg-create-form cg-fold-form`,children:[(0,H.jsx)(`label`,{htmlFor:`cg-new-folder`,children:`New folder`}),(0,H.jsx)(`input`,{id:`cg-new-folder`,className:`cg-input`,autoFocus:!0,value:Ee,placeholder:`Folder name`,onChange:e=>De(e.target.value),onKeyDown:e=>{e.key===`Enter`&&et(),e.key===`Escape`&&Te(!1)}}),(0,H.jsxs)(`div`,{className:`cg-fold-pick`,role:`group`,"aria-label":`Folder icon`,children:[(0,H.jsx)(`div`,{className:`cg-fold-pick-row`,children:Ed.map(e=>(0,H.jsx)(`button`,{type:`button`,className:`cg-fold-swatch`+(Oe.shape===e?` is-on`:``),"aria-pressed":Oe.shape===e,"aria-label":Of[e],title:Of[e],onClick:()=>ke(t=>({...t,shape:e})),children:(0,H.jsx)(im,{icon:{shape:e,tone:Oe.tone},size:15})},e))}),(0,H.jsx)(`div`,{className:`cg-fold-pick-row`,children:Dd.map(e=>(0,H.jsx)(`button`,{type:`button`,className:`cg-fold-swatch`+(Oe.tone===e?` is-on`:``),"aria-pressed":Oe.tone===e,"aria-label":Df[e],title:Df[e],onClick:()=>ke(t=>({...t,tone:e})),children:(0,H.jsx)(im,{icon:{shape:Oe.shape,tone:e},size:15})},e))})]}),(0,H.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,onClick:et,disabled:!Ee.trim(),children:`Create`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>Te(!1),children:`Cancel`})]})]}),O&&(0,H.jsxs)(Yp,{anchor:O,className:`cg-view-menu cg-create-flyout`,placement:`right-start`,role:`menu`,ariaLabel:`Create new`,onDismiss:()=>k(null),onKeyDown:nt,dataKind:`create-new`,children:[rne.map(e=>(0,H.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`cg-create-row`,onClick:()=>R(e),children:[(0,H.jsx)($p,{mode:e,tone:ine[e],size:16}),(0,H.jsx)(`span`,{children:kf[e]})]},e)),qe&&g&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`cg-menu-sep`,role:`separator`,"aria-hidden":!0}),(0,H.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`cg-create-row`,onClick:()=>tt(),children:[(0,H.jsx)(im,{size:16}),(0,H.jsx)(`span`,{children:`Folder`})]})]})]}),(0,H.jsx)(`div`,{className:`cg-view-list cg-views-scroll`,children:Je.map(e=>{let n=e.folder?.id??null;if(Ge&&e.folder&&e.items.length===0)return null;let i=n===null,o=n!=null&&ve.has(n);return(0,H.jsxs)(`div`,{className:(i?`cg-fold-root`:`cg-fold`)+(Re===(n??`__root__`)?` is-drop`:``),...Ze(n),children:[e.folder&&(0,H.jsxs)(`div`,{className:`cg-fold-head`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`cg-fold-toggle`,"aria-expanded":!o,onClick:()=>ye(t=>{let n=new Set(t);return n.has(e.folder.id)?n.delete(e.folder.id):n.add(e.folder.id),n}),children:[(0,H.jsx)(`span`,{className:`cg-fold-chev`+(o?` is-shut`:``),"aria-hidden":!0,children:`▾`}),(0,H.jsx)(im,{icon:e.folder.icon,size:16}),Se===e.folder.id?(0,H.jsx)(`input`,{className:`cg-input cg-fold-rename`,autoFocus:!0,defaultValue:e.folder.name,onClick:e=>e.stopPropagation(),onBlur:t=>{let n=t.target.value.trim();n&&n!==e.folder.name&&_?.(e.folder.id,n),Ce(null)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&Ce(null)}}):(0,H.jsx)(`span`,{className:`cg-fold-name`,children:e.folder.name}),(0,H.jsx)(`span`,{className:`cg-fold-count`,children:e.items.length})]}),(0,H.jsx)(`button`,{type:`button`,className:`cg-view-more`,"aria-label":`Actions for folder ${e.folder.name}`,"aria-haspopup":`menu`,onClick:t=>{let n=t.currentTarget;xe(t=>t?.id===e.folder.id?null:{id:e.folder.id,anchor:n})},children:`···`})]}),!o&&e.items.map(e=>{let n=e.id===t,i=te===e.id,o=xd(e);return(0,H.jsxs)(`div`,{className:`cg-view-row`+(n?` is-active`:``)+(e.config?.cohortLock?` cg-view-lockset`:``),draggable:qe&&!i&&Td(e,C),onDragStart:t=>t.dataTransfer.setData(`text/plain`,e.id),children:[i?(0,H.jsx)(`input`,{className:`cg-view-rename cg-input`,autoFocus:!0,defaultValue:e.name,onBlur:t=>{let n=t.target.value.trim();n&&n!==e.name&&a(e.id,n),L(null)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&L(null)}}):(0,H.jsxs)(`button`,{type:`button`,className:`cg-view-main`,onClick:()=>r(e.id),title:e.note?`${e.name} — ${e.note}`:e.name,children:[(0,H.jsx)($p,{mode:o,tone:ine[o],size:16}),(0,H.jsxs)(`span`,{className:`cg-view-text`,children:[(0,H.jsx)(`span`,{className:`cg-view-name`,children:e.name}),e.note&&(0,H.jsx)(`span`,{className:`cg-view-desc`,children:e.note})]}),(e.kind===`locked`||Sd(e))&&(0,H.jsx)(`span`,{className:`cg-view-lock`,role:`img`,"aria-label":e.kind===`locked`?`${e.name}, a locked view`:`${kf[o]} view, locked`,title:e.kind===`locked`?`Locked — this view shows only the records locked into it. Filters, sorts and columns still narrow within them.`+(Sd(e)?` It also stays a ${kf[o].toLowerCase()}.`:``):`Locked — this view stays a ${kf[o].toLowerCase()}. Filters, sorts and columns are still editable.`,children:(0,H.jsx)(rm,{})})]}),(0,H.jsx)(`button`,{type:`button`,className:`cg-view-more`,"aria-label":`Actions for ${e.name}`,"aria-haspopup":`menu`,"aria-expanded":ee?.viewId===e.id,onClick:t=>{let n=t.currentTarget;I(t=>t?.viewId===e.id?null:{viewId:e.id,anchor:n})},children:`···`})]},e.id)}),e.folder&&!o&&e.items.length===0&&(0,H.jsx)(`div`,{className:`cg-fold-empty`,children:`Empty — drag a view here.`})]},n??`__root__`)})}),be&&Ye&&(0,H.jsxs)(Yp,{anchor:be.anchor,className:`cg-view-menu`,placement:`bottom-end`,role:`menu`,ariaLabel:`Actions for folder ${Ye.name}`,onDismiss:()=>{xe(null),je(null)},dataKind:`folder-menu`,children:[(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,className:`cg-menu-item`,onClick:()=>{Ce(Ye.id),xe(null)},children:`Rename`}),x&&S&&(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,className:`cg-menu-item`,onClick:()=>{Ne(Ye.id),Fe(be.anchor),Le(f?`${Ye.name} · ${f}`:Ye.name),xe(null)},children:`Add to cohort…`}),y&&(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,className:`cg-menu-item`,onClick:()=>{y(Ye.id),xe(null)},children:`Duplicate folder and its views`}),v&&(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,className:`cg-menu-item cg-menu-item--danger`+(Ae===Ye.id?` is-armed`:``),onClick:()=>{if(Ae!==Ye.id){je(Ye.id);return}v(Ye.id),je(null),xe(null)},children:Ae===Ye.id?`Delete folder? Its views move to the top level.`:`Delete folder`})]}),ce&&d&&(()=>{let t=e.find(e=>e.id===ce.viewId)?.config?.cohortLock;return(0,H.jsxs)(Yp,{anchor:ce.anchor,className:`cg-pop cg-lock-pop`,placement:`bottom-start`,role:`dialog`,ariaLabel:`Lock this view to a locked view`,onDismiss:()=>le(null),dataKind:`view-cohort-lock`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Lock to a locked view`}),(0,H.jsx)(`div`,{className:`cg-pop-note`,children:`This view can then only ever show the records locked into the view you pick. Filters still narrow within it, and the lock cannot be removed as a condition.`}),(l??[]).map(e=>(0,H.jsx)(`button`,{type:`button`,className:`cg-pick-row`+(e.id===t?` is-on`:``),onClick:()=>{d(ce.viewId,e.id),le(null)},children:e.name},e.id)),t&&(0,H.jsx)(`button`,{type:`button`,className:`cg-pick-row cg-lock-clear`,onClick:()=>{d(ce.viewId,null),le(null)},children:`Unlock — show the whole table again`})]})})(),Me&&Pe&&Xe&&S&&(0,H.jsxs)(Yp,{anchor:Pe??void 0,className:`cg-pop cg-fold-addpop`,placement:`bottom-start`,role:`dialog`,ariaLabel:`Add this folder's customers to a locked view`,onDismiss:()=>Ne(null),dataKind:`folder-add-to-list`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Add to cohort`}),(0,H.jsxs)(`div`,{className:`cg-pop-note`,children:[Xe.pids.length.toLocaleString(),` customer`,Xe.pids.length===1?``:`s`,` from `,Xe.counted.toLocaleString(),` `,`view`,Xe.counted===1?``:`s`,` in this folder, counted once each.`]}),Xe.skipped.length>0&&(0,H.jsxs)(`div`,{className:`cg-pop-note cg-fold-skipped`,children:[`Not included:`,Xe.skipped.map(e=>(0,H.jsxs)(`span`,{className:`cg-fold-skip`,children:[e.name,` — `,e.why]},e.name))]}),(l??[]).map(e=>(0,H.jsx)(`button`,{type:`button`,className:`cg-pick-row`,onClick:()=>{S(Me,e.id,e.name),Ne(null)},children:e.name},e.id)),(0,H.jsxs)(`div`,{className:`cg-view-create`,children:[(0,H.jsx)(`label`,{htmlFor:`cg-fold-new-list`,children:`Lock records into a new view`}),(0,H.jsx)(`input`,{id:`cg-fold-new-list`,className:`cg-input`,"data-overlay-autofocus":!0,value:Ie,onChange:e=>Le(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Ie.trim()&&(S(Me,``,Ie.trim()),Ne(null))}}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!Ie.trim()||Xe.pids.length===0,onClick:()=>{S(Me,``,Ie.trim()),Ne(null)},children:`Create and add`})]})]}),ee&&ge&&(0,H.jsxs)(Yp,{anchor:ee.anchor,className:`cg-view-menu`,placement:`bottom-end`,role:`menu`,ariaLabel:`Actions for ${ge.name}`,onDismiss:()=>I(null),onKeyDown:nt,dataKind:`saved-view-menu`,children:[p&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{pe({viewId:ge.id,anchor:ee.anchor}),I(null)},children:(0,H.jsx)(tm,{icon:`download`,text:`Export`})}),(0,H.jsx)(`div`,{className:`cg-menu-sep`,role:`separator`,"aria-hidden":!0})]}),_e&&(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{L(ge.id),I(null)},children:(0,H.jsx)(tm,{icon:`rename`,text:`Rename`})}),_e&&(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{ae(ge.note??``),re({viewId:ge.id,anchor:ee.anchor}),I(null)},children:(0,H.jsx)(tm,{icon:`description`,text:ge.note?`Edit description`:`Add description`})}),(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{s(ge.id),I(null)},children:(0,H.jsx)(tm,{icon:`duplicate`,text:`Duplicate`})}),u&&(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{de(f?`${ge.name} · ${f}`:ge.name),se({viewId:ge.id,anchor:ee.anchor}),I(null)},children:(0,H.jsx)(tm,{icon:`cohortAdd`,text:`Add to locked view`})}),d&&l.length>0&&_e&&ge.kind!==`locked`&&(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{le({viewId:ge.id,anchor:ee.anchor}),I(null)},children:(0,H.jsx)(tm,{icon:`permissions`,text:ge.config?.cohortLock?`Change the lock…`:`Lock to a locked view…`})}),w&&ge.kind!==`system`&&_e&&Cd(ge,C)&&(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{w(ge.id,!Sd(ge)),I(null)},children:(0,H.jsx)(tm,{icon:Sd(ge)?`unlock`:(0,H.jsx)(Qp,{mode:xd(ge),size:16}),text:Sd(ge)?`Unlock view`:`Lock as ${kf[xd(ge)]}`})}),!bd(ge)&&_e&&(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,className:`is-danger`,onClick:()=>{c(ge.id),I(null)},children:(0,H.jsx)(tm,{icon:`trash`,text:`Delete`})})]}),fe&&me&&p&&(0,H.jsxs)(Yp,{anchor:fe.anchor,className:`cg-view-menu`,placement:`bottom-end`,role:`menu`,ariaLabel:`Export ${me.name}`,onDismiss:()=>pe(null),onKeyDown:nt,dataKind:`view-export`,children:[(0,H.jsxs)(`div`,{className:`cg-pop-title cg-export-title`,children:[`Export `,me.name]}),GWe.map(e=>(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{p(me.id,e),pe(null)},children:KWe[e]},e))]}),oe&&he&&u&&(0,H.jsxs)(Yp,{anchor:oe.anchor,className:`cg-pop cg-add-list-pop`,placement:`bottom-end`,role:`dialog`,ariaLabel:`Add ${he.name} to a locked view`,onDismiss:()=>se(null),dataKind:`add-to-list`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Add to cohort`}),(0,H.jsxs)(`div`,{className:`cg-pop-note`,children:[`Adds the customers `,(0,H.jsx)(`strong`,{children:he.name}),` matches right now. The cohort stays fixed as the data changes.`]}),l.map(e=>(0,H.jsx)(`button`,{type:`button`,className:`cg-pick-row`,onClick:()=>{u(he.id,e.id,e.name),se(null)},children:e.name},e.id)),(0,H.jsxs)(`div`,{className:`cg-view-create`,children:[(0,H.jsx)(`label`,{htmlFor:`cg-new-list`,children:`Lock records into a new view`}),(0,H.jsx)(`input`,{id:`cg-new-list`,className:`cg-input`,"data-overlay-autofocus":!0,value:ue,placeholder:`e.g. Q3 call plan`,onChange:e=>de(e.target.value),onKeyDown:e=>{e.key===`Enter`&&ue.trim()&&(u(he.id,``,ue.trim()),se(null))}}),(0,H.jsx)(`div`,{className:`cg-form-actions`,children:(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!ue.trim(),onClick:()=>{u(he.id,``,ue.trim()),se(null)},children:`Create and add`})})]})]}),ne&&Qe&&(0,H.jsxs)(Yp,{anchor:ne.anchor,className:`cg-pop cg-view-note-pop`,placement:`bottom-end`,role:`dialog`,ariaLabel:`Description for ${Qe.name}`,onDismiss:()=>re(null),dataKind:`saved-view-note`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Description`}),(0,H.jsxs)(`label`,{className:`cg-column-note`,children:[(0,H.jsx)(`span`,{children:`Shown under this view's name in the list.`}),(0,H.jsx)(`textarea`,{"data-overlay-autofocus":!0,value:ie,maxLength:2e3,placeholder:`What is this list for?…`,onChange:e=>ae(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:ie===(Qe.note??``),onClick:()=>{o(Qe.id,ie),re(null)},children:`Save description`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>re(null),children:`Cancel`})]})]})]})}var i7=30,fGe={ABS:[1,1],ROUND:[1,2],ROUNDUP:[1,2],ROUNDDOWN:[1,2],INT:[1,1],MOD:[2,2],SQRT:[1,1],POWER:[2,2],EXP:[1,1],LN:[1,1],SUM:[1,i7],AVERAGE:[1,i7],COUNT:[1,i7],COUNTA:[1,i7],MIN:[1,i7],MAX:[1,i7],IF:[2,3],AND:[1,i7],OR:[1,i7],NOT:[1,1],IFERROR:[2,2],ISBLANK:[1,1],CONCATENATE:[1,i7],LEFT:[1,2],RIGHT:[1,2],MID:[3,3],LEN:[1,1],TRIM:[1,1],UPPER:[1,1],LOWER:[1,1],PROPER:[1,1],VALUE:[1,1],TEXT:[2,2],TODAY:[0,0],YEAR:[1,1],MONTH:[1,1],DAY:[1,1],DAYS:[2,2]},pGe={CONCAT:`CONCATENATE`},mGe=new Set([`<`,`<=`,`>`,`>=`,`=`,`!=`]);function hGe(e){let t=[],n=0;for(;n=e.length)return`a text value is missing its closing quote`;if(e[r]===`"`){if(e[r+1]===`"`){i+=`"`,r+=2;continue}break}i+=e[r],r+=1}t.push({t:`str`,v:i}),n=r+1;continue}if(/[0-9]/.test(r)||r===`.`&&/[0-9]/.test(e[n+1]??``)){let r=/^(?:[0-9]+(?:\.[0-9]+)?|\.[0-9]+)/.exec(e.slice(n));if(!r||/^[0-9.]/.test(e[n+r[0].length]??``))return`unreadable number at "${e.slice(n,n+8)}"`;t.push({t:`num`,v:Number(r[0])}),n+=r[0].length;continue}if(/[A-Za-z_]/.test(r)){let r=/^[A-Za-z_][A-Za-z0-9_]*/.exec(e.slice(n));t.push({t:`ident`,v:r[0]}),n+=r[0].length;continue}let i=e.slice(n,n+2);if(i===`<=`||i===`>=`||i===`!=`||i===`==`||i===`<>`){t.push({t:`op`,v:i===`==`?`=`:i===`<>`?`!=`:i}),n+=2;continue}if(`+-*/^&(),<>=`.includes(r)){t.push({t:`op`,v:r}),n+=1;continue}return`unexpected character "${r}"`}return t}function a7(e){if(typeof e!=`string`||e.trim()===``)return{ok:!1,error:`the formula is empty`};if(e.length>500)return{ok:!1,error:`formula longer than 500 characters`};let t=hGe(e);if(typeof t==`string`)return{ok:!1,error:t};if(t.length===0)return{ok:!1,error:`the formula is empty`};if(t.length>200)return{ok:!1,error:`formula has more than 200 tokens`};let n=0,r=()=>t[n],i=e=>{let r=t[n];return r?.t===`op`&&r.v===e},a=null,o=e=>(a===null&&(a=e),null);function s(e){if(e>24)return o(`formula is nested too deeply`);let t=c(e);if(!t)return null;let i=r();if(i?.t===`op`&&mGe.has(i.v)){n+=1;let a=c(e);if(!a)return null;let s=r();return s?.t===`op`&&mGe.has(s.v)?o(`comparisons cannot be chained (a < b < c)`):{t:`cmp`,op:i.v,l:t,r:a}}return t}function c(e){let t=l(e);if(!t)return null;for(;i(`&`);){n+=1;let r=l(e);if(!r)return null;t={t:`bin`,op:`&`,l:t,r}}return t}function l(e){let t=u(e);if(!t)return null;for(;;)if(i(`+`)||i(`-`)){let i=r().v;n+=1;let a=u(e);if(!a)return null;t={t:`bin`,op:i,l:t,r:a}}else return t}function u(e){let t=d(e);if(!t)return null;for(;;)if(i(`*`)||i(`/`)){let i=r().v;n+=1;let a=d(e);if(!a)return null;t={t:`bin`,op:i,l:t,r:a}}else return t}function d(e){if(e>24)return o(`formula is nested too deeply`);let t=f(e);if(!t)return null;if(i(`^`)){n+=1;let r=d(e+1);return r?{t:`bin`,op:`^`,l:t,r}:null}return t}function f(e){if(e>24)return o(`formula is nested too deeply`);if(i(`-`)){n+=1;let t=f(e+1);return t?{t:`neg`,e:t}:null}return p(e)}function p(e){if(e>24)return o(`formula is nested too deeply`);let t=r();if(!t)return o(`the formula ends unexpectedly`);if(t.t===`num`)return n+=1,{t:`num`,v:t.v};if(t.t===`str`)return n+=1,{t:`str`,v:t.v};if(t.t===`ref`)return n+=1,{t:`ref`,k:t.k};if(t.t===`op`&&t.v===`(`){n+=1;let t=s(e+1);return t?i(`)`)?(n+=1,t):o(`missing closing parenthesis`):null}if(t.t===`ident`){let r=t.v.toUpperCase();if(r===`TRUE`||r===`FALSE`)return n+=1,{t:`bool`,v:r===`TRUE`};let a=pGe[r]??r;if(!(a in fGe))return o(`unknown function ${r} — see the formula help for what is available`);if(n+=1,!i(`(`))return o(`${a} must be called with parentheses: ${a}(…)`);n+=1;let c=[];if(!i(`)`))for(;;){let t=s(e+1);if(!t)return null;if(c.push(t),i(`,`)){n+=1;continue}break}if(!i(`)`))return o(`missing closing parenthesis on ${a}(…)`);n+=1;let[l,u]=fGe[a];return c.lengthu?o(l===u?`${a} takes exactly ${l} argument${l===1?``:`s`}`:`${a} takes ${l} to ${u} arguments`):{t:`call`,fn:a,args:c}}return o(`unexpected "${t.t===`op`?t.v:String(t.v)}"`)}let m=s(1);if(!m)return{ok:!1,error:a??`could not parse the formula`};if(n!==t.length){let e=t[n];return{ok:!1,error:`unexpected "${e.t===`op`||e.t===`ident`?e.v:e.t===`ref`?`{${e.k}}`:String(e.v)}" after the formula`}}return{ok:!0,ast:m,refs:gGe(m)}}function gGe(e){let t=[],n=e=>{switch(e.t){case`ref`:t.includes(e.k)||t.push(e.k);return;case`neg`:n(e.e);return;case`bin`:case`cmp`:n(e.l),n(e.r);return;case`call`:e.args.forEach(n);return;default:return}};return n(e),t}function o7(e){if(typeof e==`number`)return Number.isFinite(e)?e:null;if(e==null)return null;if(typeof e==`string`){let t=e.trim();if(t===``)return null;let n=Number(t);return Number.isFinite(n)?n:null}return null}function s7(e){return typeof e==`number`&&Number.isFinite(e)?e:typeof e==`string`?o7(e):null}function c7(e){return e==null?``:typeof e==`string`?e:typeof e==`boolean`?e?`TRUE`:`FALSE`:_Ge(e)}function _Ge(e){return String(Number.isInteger(e)?e:Number(e.toFixed(10)))}function vGe(e,t){if(!Number.isInteger(t)||t<-10||t>10)return null;let n=10**t,r=Math.sign(e)*Math.round(Math.abs(e)*n)/n;return Number.isFinite(r)?r:null}function l7(e){if(typeof e!=`string`)return null;let t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e.trim());if(!t)return null;let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]);return r<1||r>12||i<1||i>31?null:{y:n,m:r,d:i}}function yGe(e){return Date.UTC(e.y,e.m-1,e.d)/864e5}function bGe(e,t){let n=/^(\$?)(#,##0|0)(?:\.(0+))?(%?)$/.exec(t.trim());if(!n)return null;let[,r,i,a,o]=n,s=e;o===`%`&&(s*=100);let c=a?a.length:0,l=s<0||Object.is(s,-0)?`-`:``,[u,d]=Math.abs(s).toFixed(c).split(`.`);return i===`#,##0`&&(u=u.replace(/\B(?=(\d{3})+(?!\d))/g,`,`)),l+r+u+(c?`.`+d:``)+(o===`%`?`%`:``)}function u7(e,t){let n=[];for(let r of e){let e=t(r);if(e==null)continue;let i=s7(e);i!=null&&n.push(i)}return n}function xGe(e,t,n){let r=e=>xGe(e,t,n);switch(e.t){case`num`:return e.v;case`str`:return e.v;case`bool`:return e.v;case`ref`:{let n=t(e.k);return typeof n==`string`||typeof n==`number`&&Number.isFinite(n)?n:null}case`neg`:{let t=s7(r(e.e));return t==null?null:-t}case`bin`:{if(e.op===`&`)return c7(r(e.l))+c7(r(e.r));let t=s7(r(e.l));if(t==null)return null;let n=s7(r(e.r));if(n==null)return null;let i;switch(e.op){case`+`:i=t+n;break;case`-`:i=t-n;break;case`*`:i=t*n;break;case`/`:if(n===0)return null;i=t/n;break;case`^`:i=t**+n;break}return Number.isFinite(i)?i:null}case`cmp`:{let t=r(e.l),n=r(e.r),i=typeof t==`number`?t:null,a=typeof n==`number`?n:null,o=i??(typeof t==`string`?o7(t):null),s=a??(typeof n==`string`?o7(n):null);if(o!=null&&s!=null)return SGe(e.op,o,s);if(typeof t==`string`&&typeof n==`string`){let r=t.trim().toLowerCase(),i=n.trim().toLowerCase();return r===``||i===``?null:SGe(e.op,ri),0)}return null}case`call`:switch(e.fn){case`ABS`:{let t=s7(r(e.args[0]));return t==null?null:Math.abs(t)}case`ROUND`:case`ROUNDUP`:case`ROUNDDOWN`:{let t=s7(r(e.args[0]));if(t==null)return null;let n=e.args.length>1?s7(r(e.args[1])):0;if(n==null||!Number.isInteger(n)||n<-10||n>10)return null;if(e.fn===`ROUND`)return vGe(t,n);let i=10**n,a=t*i,o=(e.fn===`ROUNDUP`?Math.sign(a)*Math.ceil(Math.abs(a)):Math.sign(a)*Math.floor(Math.abs(a)))/i;return Number.isFinite(o)?o:null}case`INT`:{let t=s7(r(e.args[0]));return t==null?null:Math.floor(t)}case`MOD`:{let t=s7(r(e.args[0])),n=s7(r(e.args[1]));return t==null||n==null||n===0?null:t-n*Math.floor(t/n)}case`SQRT`:{let t=s7(r(e.args[0]));return t==null||t<0?null:Math.sqrt(t)}case`POWER`:{let t=s7(r(e.args[0])),n=s7(r(e.args[1]));if(t==null||n==null)return null;let i=t**+n;return Number.isFinite(i)?i:null}case`EXP`:{let t=s7(r(e.args[0]));if(t==null)return null;let n=Math.exp(t);return Number.isFinite(n)?n:null}case`LN`:{let t=s7(r(e.args[0]));return t==null||t<=0?null:Math.log(t)}case`SUM`:return u7(e.args,r).reduce((e,t)=>e+t,0);case`AVERAGE`:{let t=u7(e.args,r);return t.length===0?null:t.reduce((e,t)=>e+t,0)/t.length}case`COUNT`:return u7(e.args,r).length;case`COUNTA`:{let t=0;for(let n of e.args){let e=r(n);e!=null&&e!==``&&(t+=1)}return t}case`MIN`:case`MAX`:{let t=u7(e.args,r);return t.length===0?null:e.fn===`MIN`?Math.min(...t):Math.max(...t)}case`IF`:{let t=r(e.args[0]);return typeof t==`boolean`?t?r(e.args[1]):e.args.length>2?r(e.args[2]):null:null}case`AND`:case`OR`:for(let t of e.args){let n=r(t);if(typeof n!=`boolean`)return null;if(e.fn===`AND`&&!n)return!1;if(e.fn===`OR`&&n)return!0}return e.fn===`AND`;case`NOT`:{let t=r(e.args[0]);return typeof t==`boolean`?!t:null}case`IFERROR`:return r(e.args[0])??r(e.args[1]);case`ISBLANK`:{let t=r(e.args[0]);return t==null||t===``}case`CONCATENATE`:return e.args.map(e=>c7(r(e))).join(``);case`LEFT`:case`RIGHT`:{let t=c7(r(e.args[0])),n=e.args.length>1?s7(r(e.args[1])):1;return n==null||!Number.isInteger(n)||n<0?null:e.fn===`LEFT`?t.slice(0,n):n===0?``:t.slice(-n)}case`MID`:{let t=c7(r(e.args[0])),n=s7(r(e.args[1])),i=s7(r(e.args[2]));return n==null||i==null||!Number.isInteger(n)||!Number.isInteger(i)||n<1||i<0?null:t.slice(n-1,n-1+i)}case`LEN`:return c7(r(e.args[0])).length;case`TRIM`:return c7(r(e.args[0])).replace(/\s+/g,` `).trim();case`UPPER`:return c7(r(e.args[0])).toUpperCase();case`LOWER`:return c7(r(e.args[0])).toLowerCase();case`PROPER`:return c7(r(e.args[0])).replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase());case`VALUE`:return s7(r(e.args[0]));case`TEXT`:{let t=s7(r(e.args[0])),n=r(e.args[1]);return t==null||typeof n!=`string`?null:bGe(t,n)}case`TODAY`:return typeof n.today==`string`&&l7(n.today)?n.today:null;case`YEAR`:case`MONTH`:case`DAY`:{let t=l7(r(e.args[0]));return t?e.fn===`YEAR`?t.y:e.fn===`MONTH`?t.m:t.d:null}case`DAYS`:{let t=l7(r(e.args[0])),n=l7(r(e.args[1]));return!t||!n?null:Math.round(yGe(t)-yGe(n))}}return null;default:return null}}function SGe(e,t,n){switch(e){case`<`:return t`:return t>n;case`>=`:return t>=n;case`=`:return t===n;case`!=`:return t!==n}}function CGe(e,t,n={}){try{let r=xGe(e,t,n);return typeof r==`number`?Number.isFinite(r)?r:null:typeof r==`string`?r:typeof r==`boolean`?r?`TRUE`:`FALSE`:null}catch{return null}}function wGe(e){let t=new Map;for(let[n,r]of e){let i=a7(r);t.set(n,i.ok?i.refs.filter(t=>e.has(t)&&t!==n):[])}let n=[],r=new Map,i=new Set,a=(e,o)=>{let s=r.get(e);if(s===2)return!i.has(e);if(s===1){for(let t=o.lastIndexOf(e);t({value:e,label:Af[e]}));function p7(e){return e===`select`||e===`multiselect`}var m7=[`Not started`,`In progress`,`Blocked`,`Done`],TGe=0;function h7(){return TGe+=1,`choice-${TGe}`}function g7(e,t=void 0){return e.map(e=>({id:h7(),label:e,color:mp(t?.[e])??mp(Sp(e))}))}function _7(e,t){let n=e.map(e=>t===`multiselect`?e.label.replace(/,/g,` `):e.label),r=gee(n.join(` +`)),i=new Map;e.forEach((e,t)=>{let r=n[t].trim();r&&!i.has(r.toLowerCase())&&i.set(r.toLowerCase(),e)});let a={};for(let e of r){let t=mp(i.get(e.toLowerCase())?.color);t&&t!==mp(Sp(e))&&(a[e]=t)}return{options:r,colors:a}}function EGe(e,t){return e.map(e=>`${e}\u0000${mp(t?Object.entries(t).find(([t])=>t.trim().toLowerCase()===e.toLowerCase())?.[1]:void 0)??mp(Sp(e))}`).join(``)}function DGe({value:e,disabled:t,label:n,onPick:r}){let[i,a]=(0,z.useState)(!1),o=(0,z.useRef)(null),s=_p(e);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{ref:o,type:`button`,className:`cg-option-color`,disabled:t,style:{background:s?.bg??mp(e)??`#FFFFFF`},"aria-label":`Colour for ${n}${s?` — ${s.label}`:``}`,"aria-haspopup":`dialog`,"aria-expanded":i,title:`Change option colour`,onClick:()=>a(e=>!e)}),i&&o.current&&(0,H.jsx)(Yp,{anchor:o.current,className:`cg-pop cg-swatch-pop`,onDismiss:()=>a(!1),role:`dialog`,ariaLabel:`Colour for ${n}`,dataKind:`option-colour`,children:(0,H.jsx)(`div`,{className:`cg-swatch-grid`,children:gp.map(e=>(0,H.jsx)(`button`,{type:`button`,className:`cg-swatch`+(s?.id===e.id?` is-on`:``),style:{background:e.bg,color:e.fg},"aria-label":e.label,"aria-pressed":s?.id===e.id,title:e.label,onClick:()=>{r(e.bg),a(!1)},children:s?.id===e.id&&(0,H.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`m3.5 8.5 3 3 6-6.5`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})})},e.id))})})]})}function v7({idPrefix:e,drafts:t,onDrafts:n,colorCode:r,onColorCode:i,type:a}){let o=(e,r)=>n(t.map(t=>t.id===e?{...t,...r}:t)),s=_7(t,a);return(0,H.jsxs)(`div`,{className:`cg-options-editor`,children:[(0,H.jsxs)(`div`,{className:`cg-options-head`,children:[(0,H.jsx)(`strong`,{children:`Options`}),(0,H.jsxs)(`label`,{className:`cg-option-toggle`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:r,onChange:e=>i(e.target.checked)}),(0,H.jsx)(`span`,{children:`Color-code options`})]})]}),(0,H.jsx)(`div`,{className:`cg-option-list`,children:t.map((i,s)=>(0,H.jsxs)(`div`,{className:`cg-option-row`,children:[(0,H.jsx)(DGe,{value:mp(i.color)??pp[s%pp.length].bg,disabled:!r,label:i.label||`option ${s+1}`,onPick:e=>o(i.id,{color:e})}),(0,H.jsx)(`input`,{id:`${e}-${i.id}`,className:`cg-input cg-option-name`,type:`text`,maxLength:120,value:i.label,placeholder:`Option name`,"aria-label":`Option ${s+1}`,onChange:e=>{let t=a===`multiselect`?e.target.value.replace(/,/g,` `):e.target.value;o(i.id,{label:t})},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),n([...t,{id:h7(),label:``,color:pp[t.length%pp.length].bg}]))}}),(0,H.jsx)(`button`,{type:`button`,className:`cg-option-remove`,"aria-label":`Remove ${i.label||`option ${s+1}`}`,title:`Remove option`,onClick:()=>n(t.filter(e=>e.id!==i.id)),children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]},i.id))}),(0,H.jsx)(`button`,{type:`button`,className:`cg-option-add`,onClick:()=>n([...t,{id:h7(),label:``,color:pp[t.length%pp.length].bg}]),children:`Add option`}),(0,H.jsxs)(`span`,{className:`cg-field-hint`,children:[s.options.length,` option`,s.options.length===1?``:`s`,`.`,a===`multiselect`&&` Commas inside an option are not supported.`]})]})}function OGe({value:e,onPick:t,offerMeasure:n,only:r}){let[i,a]=(0,z.useState)(``),o=i.trim().toLowerCase(),s=[...r?f7.filter(e=>r.includes(e.value)):f7,...n?[{value:`measure`,label:`Metric`}]:[]].filter(e=>!o||e.label.toLowerCase().includes(o));return(0,H.jsxs)(`div`,{className:`cg-type-picker`,children:[(0,H.jsxs)(`div`,{className:`cg-type-search`,children:[(0,H.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:[(0,H.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.4`,stroke:`currentColor`,strokeWidth:`1.35`}),(0,H.jsx)(`path`,{d:`m10.4 10.4 3.1 3.1`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`})]}),(0,H.jsx)(`input`,{type:`text`,value:i,placeholder:`Find a field type`,"aria-label":`Find a field type`,onChange:e=>a(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`cg-type-list`,role:`listbox`,"aria-label":`Field type`,children:[s.map(n=>(0,H.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e===n.value,className:`cg-type-row`+(e===n.value?` is-on`:``),onClick:()=>t(n.value),children:[(0,H.jsx)(Zp,{type:n.value===`measure`?`currency`:n.value,size:16}),(0,H.jsx)(`span`,{className:`cg-type-label`,children:n.label}),e===n.value&&(0,H.jsx)(`svg`,{className:`cg-type-check`,width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`m3.5 8.5 3 3 6-6.5`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`})})]},n.value)),s.length===0&&(0,H.jsx)(`div`,{className:`cg-pop-note`,children:`No matching type.`})]})]})}var kGe=`new:`,AGe=Yu.filter(e=>e!==`formula`&&e!==`created_time`&&e!==`automation`),y7=[{key:`instagram_profile`,label:`Instagram profile`,hint:`Reads what is anonymously public about the profile in the chosen URL column, and writes the result here. Runs from the Automation surface — on demand or on a schedule.`}],jGe={kind:`ltm`};function b7({title:e,sub:t,onClose:n}){return(0,H.jsxs)(`div`,{className:`cg-column-head`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`cg-column-title`,children:e}),t&&(0,H.jsx)(`div`,{className:`cg-column-type`,children:t})]}),(0,H.jsx)(`button`,{type:`button`,className:`cg-icon-btn`,onClick:n,"aria-label":`Close column menu`,children:`×`})]})}function MGe({value:e,onValue:t}){return(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Scope`}),(0,H.jsxs)(`select`,{className:`cg-select cg-scope-select`,value:e,"aria-label":`Field scope`,onChange:e=>t(e.target.value),children:[(0,H.jsx)(`option`,{value:`cohort`,disabled:e!==`cohort`,children:`The cohort table only (retired)`}),(0,H.jsx)(`option`,{value:`global`,children:`All customer tables`})]})]})}function x7({kind:e,fields:t,formulaText:n,onFormulaText:r,formulaError:i,maxValue:a,onMaxValue:o,idPrefix:s,showFormulaHelp:c=!0,automationKind:l=`instagram_profile`,onAutomationKind:u,automationUrlField:d=``,onAutomationUrlField:f}){if(e===`formula`){let e=t.filter(e=>e.key!==`__proto__`);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Formula`}),(0,H.jsx)(`textarea`,{className:`cg-input cg-formula-editor`,rows:3,value:n,placeholder:`MAX(0, {revenue_ly} - {revenue_ytd})`,"aria-label":`Formula`,onChange:e=>r(e.target.value)})]}),(0,H.jsx)(`div`,{className:`cg-cond-line cg-formula-insert`,children:(0,H.jsx)(sm,{ariaLabel:`Insert a field reference`,placeholder:`Insert a field reference…`,value:void 0,keepOpen:!0,onChange:e=>r((n+` {`+e+`}`).trimStart()),fields:e.map(e=>({key:e.key,label:e.label,type:e.type}))})}),n.trim()!==``&&i?(0,H.jsx)(`div`,{className:`cg-field-hint cg-formula-error`,children:i}):c?(0,H.jsxs)(`div`,{className:`cg-field-hint`,children:[`Excel-style: numbers, text in quotes, `,`{field}`,` references, + − × ÷ ^ & ( ), IF · AND · OR · SUM · AVERAGE · COUNT · MIN · MAX · ROUND(UP/DOWN) · ABS · MOD · SQRT · CONCATENATE · LEFT · RIGHT · MID · LEN · TRIM · UPPER · LOWER · PROPER · TEXT · VALUE · TODAY · DAYS · YEAR · MONTH · DAY · IFERROR · ISBLANK. Errors show a blank cell.`]}):null]})}if(e===`rating`)return(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Number of stars`}),(0,H.jsx)(`input`,{id:`${s}-rating-max`,className:`cg-input cg-rating-max`,type:`number`,min:2,max:10,value:a,"aria-label":`Number of stars`,onChange:e=>{let t=Math.round(Number(e.target.value));o(Number.isFinite(t)?Math.max(2,Math.min(10,t)):5)}})]});if(e===`created_time`)return(0,H.jsx)(`div`,{className:`cg-field-hint`,children:`Read-only. When the record was created in the source system.`});if(e===`automation`){let e=t.filter(e=>e.type===`url`||e.type===`text`),n=y7.find(e=>e.key===l)??y7[0];return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`What it reads`}),(0,H.jsx)(`select`,{id:`${s}-automation-kind`,className:`cg-input`,value:l,"aria-label":`Automation kind`,onChange:e=>u?.(e.target.value),children:y7.map(e=>(0,H.jsx)(`option`,{value:e.key,children:e.label},e.key))})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`URL column`}),(0,H.jsxs)(`select`,{id:`${s}-automation-url`,className:`cg-input`,value:d,"aria-label":`URL column`,onChange:e=>f?.(e.target.value),children:[(0,H.jsx)(`option`,{value:``,children:`Choose a column…`}),e.map(e=>(0,H.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]}),(0,H.jsx)(`div`,{className:`cg-field-hint`,children:n.hint}),(0,H.jsx)(`div`,{className:`cg-field-hint`,children:`Cells here are written by the run and cannot be typed into — a value you entered would be replaced by the next run without saying so.`}),(0,H.jsx)(`div`,{className:`cg-field-hint`,children:`Runs target a blank database. On a connector-backed table this column can be created but no automation can write to it yet.`})]})}return null}function NGe({state:e,field:t,fields:n,locked:r,viewer:i,sortedDir:a,isFiltered:o,isGrouped:s,groupable:c,onClose:l,onNote:u,onHide:d,onCreate:f,onChangeField:p,onCreateAndSwap:m,onRetype:h,onRename:g,onFormula:_,initialPosition:v,scopeChoice:y=!1,pinnedTo:b=!1,onPinTo:x,onUnpin:S,onPeriod:C,onDelete:w,onDuplicate:T,onPermissions:E,onFormat:D,onSort:O,onClearSort:k,onFilterBy:A,onClearFilter:j,onGroupByField:M,onClearGroup:N,userOptions:P=[],measures:F=[]}){let[ee,I]=(0,z.useState)(`menu`),[te,L]=(0,z.useState)(t.note??``),[ne,re]=(0,z.useState)(v??null),[ie,ae]=(0,z.useState)(!1),[oe,se]=(0,z.useState)(``),[ce,le]=(0,z.useState)(!1),[ue,de]=(0,z.useState)(`text`),[fe,pe]=(0,z.useState)(()=>g7(m7)),[me,he]=(0,z.useState)(!0),[ge,_e]=(0,z.useState)(F[0]?.key??``),[ve,ye]=(0,z.useState)(jGe),[be,xe]=(0,z.useState)(``),[Se,Ce]=(0,z.useState)(5),[we,Te]=(0,z.useState)(y7[0].key),[Ee,De]=(0,z.useState)(()=>n.find(e=>e.type===`url`)?.key??``),[Oe,ke]=(0,z.useState)(``),[Ae,je]=(0,z.useState)(``),[Me,Ne]=(0,z.useState)(()=>g7(m7)),[Pe,Fe]=(0,z.useState)(!0),[Ie,Le]=(0,z.useState)(``),[Re,ze]=(0,z.useState)(5),[Be,Ve]=(0,z.useState)(null),[He,Ue]=(0,z.useState)(t.permissions?.edit??`everyone`),[We,Ge]=(0,z.useState)(()=>({...t.format??{}})),[Ke,qe]=(0,z.useState)(`cohort`),[Je,Ye]=(0,z.useState)(t.label),[Xe,Ze]=(0,z.useState)(t.type),[Qe,$e]=(0,z.useState)(()=>g7(Qu(t).length?Qu(t):m7,t.optionColors)),[et,R]=(0,z.useState)(t.colorCodeOptions!==!1),[tt,nt]=(0,z.useState)(()=>$u(t)),[rt,it]=(0,z.useState)(()=>typeof t.formula==`string`?t.formula:``),[at,ot]=(0,z.useState)(()=>t.automation?.kind??y7[0].key),[st,ct]=(0,z.useState)(()=>t.automation?.urlField??``),lt=Oe.startsWith(kGe)?Oe.slice(4):null,ut=_7(fe,ue),dt=ut.options,ft=lt?_7(Me,lt):{options:[],colors:{}},pt=ft.options,mt=_7(Qe,Xe),ht=mt.options,gt=(0,z.useMemo)(()=>new Set(n.filter(e=>e.type!==`formula`).map(e=>e.key)),[n]),_t=(0,z.useMemo)(()=>{let e=new Map;for(let t of n){if(t.type!==`formula`)continue;let n=typeof t.formula==`string`?t.formula:``;n&&e.set(t.key,n)}return e},[n]),vt=(0,z.useMemo)(()=>be.trim()===``?{ok:!1,error:`Type a formula`,refs:[]}:d7(be,gt,_t),[be,gt,_t]),yt=(0,z.useMemo)(()=>Ie.trim()===``?{ok:!1,error:`Type a formula`,refs:[]}:d7(Ie,gt,_t),[Ie,gt,_t]),bt=F.find(e=>e.key===ge),xt=bt?`${bt.label} · ${qu(ve)}`:``,St=ue===`measure`&&!ce&&!oe.trim()?xt:oe,Ct=St.trim()!==``&&(!p7(ue)||dt.length>0)&&(ue!==`measure`||!!bt)&&(ue!==`formula`||vt.ok)&&(ue!==`automation`||Ee!==``),wt=(e,t,n)=>{if(e===`formula`)return{formula:t.trim()};if(e===`rating`)return{max:n};if(e===`automation`)return{automation:{kind:we,source:`record_url_field`,urlField:Ee}}},Tt=(e,t,n)=>p7(e)?{colorCodeOptions:n,...Object.keys(t).length?{optionColors:t}:{}}:{},Et=e=>y?{...e??{},scope:Ke}:e,Dt=()=>{let e=St.trim();if(!(!e||!ne||!Ct)){if(ue===`measure`){if(!bt)return;f(e,bt.type,ne===`end`?null:t.key,ne,void 0,{key:bt.key,window:ve},Et(void 0)),l();return}f(e,ue,ne===`end`?null:t.key,ne,p7(ue)?dt:void 0,void 0,Et({...wt(ue,be,Se),...Tt(ue,ut.colors,me)})),l()}},Ot=lt!=null&&Ae.trim()!==``&&(!p7(lt)||pt.length>0)&&(lt!==`formula`||yt.ok),kt=()=>{!lt||!Ot||(m(Ae.trim(),lt,p7(lt)?pt:void 0,Et({...wt(lt,Ie,Re),...Tt(lt,ft.colors,Pe)})),l())},At=Je.trim(),jt=!!g&&At!==``&&At!==t.label,Mt=p7(Xe)&&ht.join(` `)!==Qu(t).join(` -`),Nt=h7(Xe)&&(et!==(t.colorCodeOptions!==!1)||CGe(ht,mt.colors)!==CGe(Qu(t),t.optionColors)),Pt=Xe===`rating`&&tt!==$u(t),Ft=Xe===`automation`&&t.type===`automation`&&(at!==(t.automation?.kind??x7[0].key)||st!==(t.automation?.urlField??``)),It=h!=null&&(Xe!==t.type||Mt||Nt||Pt||Ft),Lt=(!h7(Xe)||ht.length>0)&&(Xe!==`automation`||st!==``),Rt=(0,z.useMemo)(()=>rt.trim()===``?{ok:!1,error:`Type a formula`,refs:[]}:p7(rt,gt,_t,t.key),[rt,gt,_t,t.key]),zt=!!_&&t.type===`formula`&&rt.trim()!==(typeof t.formula==`string`?t.formula.trim():``),Bt=It&&!Lt||zt&&!Rt.ok,Vt=t.measure?Gu(t.measure.window):null,Ht=Be?Gu(Be):null,Ut=Ht!=null&&JSON.stringify(Ht)!==JSON.stringify(Vt),Wt=!!t.measure&&!!C,Gt=!Bt&&(jt||It||zt||Wt&&Ut),Kt=()=>{Gt&&(It&&h?h(Xe,h7(Xe)?ht:void 0,{...Xe===`rating`?{max:tt}:{},...h7(Xe)?{colorCodeOptions:et,...Object.keys(mt.colors).length?{optionColors:mt.colors}:{}}:{},...Xe===`automation`?{automation:{kind:at,source:`record_url_field`,urlField:st}}:{},...jt?{label:At}:{}}):zt&&_?_(rt.trim(),jt?At:void 0):jt&&g&&g(At),Wt&&Ut&&Ht&&C(Ht),l())},qt=n.filter(e=>e.key!==t.key),Jt=qt.filter(e=>e.source===`odoo`&&!e.custom),Yt=qt.filter(e=>!(e.source===`odoo`&&!e.custom)),Xt=t.measure?`Metric, read-only`:t.type===`formula`?`Formula field, computed`:t.type===`created_time`?`Created time, read-only`:t.derived?`Read-only, derived`:t.source===`odoo`?`Read-only source field`:`Editable overlay field`,Zt=t.scope===`cohort`?`${Xt} · this cohort only`:Xt,Qt=t.type===`int`||t.type===`currency`||t.type===`formula`?`number`:t.type===`date`||t.type===`created_time`?`date`:null;if(ne)return(0,H.jsxs)(Yp,{anchor:e.anchor,className:`cg-column-menu`,onDismiss:l,role:`dialog`,ariaLabel:ne===`end`?`Add field`:`Insert field ${ne} of ${t.label}`,initialFocus:`[data-overlay-autofocus]`,dataKind:`column-menu`,children:[(0,H.jsx)(S7,{title:ne===`end`?`Add field`:ne===`left`?`Insert field left`:`Insert field right`,sub:ne===`end`?`Added as the last column`:`Next to ${t.label}`,onClose:l}),(0,H.jsxs)(`div`,{className:`cg-column-create`,children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Name`}),(0,H.jsx)(`input`,{className:`cg-input`,autoFocus:!0,"data-overlay-autofocus":!0,value:St,onChange:e=>{se(e.target.value),le(!0)},onKeyDown:e=>e.key===`Enter`&&Dt()})]}),(0,H.jsxs)(`div`,{className:`cg-type-block`,children:[(0,H.jsx)(`span`,{className:`cg-type-title`,children:`Field type`}),(0,H.jsx)(TGe,{value:ue,onPick:de,offerMeasure:F.length>0})]}),ue===`measure`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Number`}),(0,H.jsx)(sm,{ariaLabel:`Number to summarise`,placeholder:`Choose a number…`,value:bt?ge:void 0,onChange:_e,fields:F.map(e=>({key:e.key,label:e.label,type:`measure`}))})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Period`}),(0,H.jsx)(`span`,{className:`cg-measure-window`,children:(0,H.jsx)(um,{window:ve,onWindow:ye})})]}),(0,H.jsx)(`div`,{className:`cg-field-hint`,children:`A total, average or count over the period you choose — e.g. Sales, last 90 days. Computed for every customer, and read-only.`})]}),(0,H.jsx)(C7,{kind:ue,fields:n,formulaText:be,onFormulaText:xe,formulaError:vt.ok?null:vt.error??null,maxValue:Se,onMaxValue:Ce,idPrefix:`cg-create`,automationKind:we,onAutomationKind:Te,automationUrlField:Ee,onAutomationUrlField:De}),h7(ue)&&(0,H.jsx)(b7,{idPrefix:`cg-create-option`,drafts:fe,onDrafts:pe,colorCode:me,onColorCode:he,type:ue}),ue===`user`&&(0,H.jsx)(`div`,{className:`cg-field-hint`,children:P.length?`${P.length} people can be assigned, from your user list.`:`No user list yet, so there is no one to assign.`}),y&&(0,H.jsx)(kGe,{value:Ke,onValue:qe}),(0,H.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!Ct,onClick:Dt,children:`Create field`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>v?l():re(null),children:`Cancel`})]})]})]});if(ee===`edit`)return(0,H.jsxs)(Yp,{anchor:e.anchor,className:`cg-column-menu`,onDismiss:l,role:`dialog`,ariaLabel:`Edit field ${t.label}`,initialFocus:`[data-overlay-autofocus]`,dataKind:`column-menu`,children:[(0,H.jsx)(S7,{title:`Edit field`,sub:Zt,onClose:l}),(0,H.jsxs)(`div`,{className:`cg-column-create`,children:[g?(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Name`}),(0,H.jsx)(`input`,{className:`cg-input`,autoFocus:!0,"data-overlay-autofocus":!0,value:Je,onChange:e=>Ye(e.target.value),onKeyDown:e=>e.key===`Enter`&&Kt()})]}):(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Name`}),(0,H.jsx)(`input`,{className:`cg-input`,value:t.label,disabled:!0,"aria-label":`Field name (read-only)`}),(0,H.jsx)(`span`,{className:`cg-field-hint`,children:`A source field keeps its name and type from the data source.`})]}),h&&t.type===`automation`?(0,H.jsxs)(`div`,{className:`cg-type-block`,children:[(0,H.jsx)(`span`,{className:`cg-type-title`,children:`Automation`}),(0,H.jsx)(C7,{kind:`automation`,fields:n,formulaText:rt,onFormulaText:it,formulaError:null,maxValue:tt,onMaxValue:nt,idPrefix:`cg-edit`,automationKind:at,onAutomationKind:ot,automationUrlField:st,onAutomationUrlField:ct})]}):h?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`cg-type-block`,children:[(0,H.jsx)(`span`,{className:`cg-type-title`,children:`Field type`}),(0,H.jsx)(TGe,{value:Xe,onPick:e=>Ze(e),offerMeasure:!1,only:DGe})]}),Xe===`rating`&&(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Number of stars`}),(0,H.jsx)(`input`,{className:`cg-input cg-rating-max`,type:`number`,min:2,max:10,value:tt,"aria-label":`Number of stars`,onChange:e=>{let t=Math.round(Number(e.target.value));nt(Number.isFinite(t)?Math.max(2,Math.min(10,t)):5)}})]}),h7(Xe)&&(0,H.jsx)(b7,{idPrefix:`cg-edit-option`,drafts:Qe,onDrafts:$e,colorCode:et,onColorCode:R,type:Xe}),Xe!==t.type&&(0,H.jsxs)(`div`,{className:`cg-field-hint`,children:[`Changes `,t.label,` into a `,Af[Xe].toLowerCase(),` field, keeping its name and its values as entered. Cells that cannot be read in the new type show blank.`]})]}):null,Wt&&(0,H.jsxs)(`label`,{className:`cg-edit-period`,children:[(0,H.jsx)(`span`,{children:`Period`}),(0,H.jsx)(`span`,{className:`cg-measure-window`,children:(0,H.jsx)(um,{window:Be??t.measure.window,onWindow:Ve})}),(0,H.jsx)(`span`,{className:`cg-field-hint`,children:`The window this number is computed over, for every customer.`})]}),!h&&t.type===`formula`&&_&&(0,H.jsx)(C7,{kind:`formula`,fields:n,formulaText:rt,onFormulaText:it,formulaError:Rt.ok?null:Rt.error??null,maxValue:tt,onMaxValue:nt,idPrefix:`cg-edit`,showFormulaHelp:!1}),(0,H.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!Gt,onClick:Kt,children:`Save`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>I(`menu`),children:`Back`})]}),!r&&qt.length>0&&(0,H.jsxs)(`div`,{className:`cg-edit-swap`,children:[(0,H.jsx)(`span`,{className:`cg-type-title`,children:`Change field`}),(0,H.jsx)(`div`,{className:`cg-field-hint`,children:`Show a different field in this column — the current one is hidden, not lost.`}),(0,H.jsxs)(`div`,{className:`cg-column-swap`,children:[(0,H.jsx)(sm,{className:`cg-swap-select`,ariaLabel:`Change this column to another field`,placeholder:`Choose a field…`,overlayAutofocus:!g,value:Oe||void 0,onChange:ke,fields:[...Jt.map(e=>({key:e.key,label:e.label,type:e.type,group:`Pre-set fields`})),...Yt.map(e=>({key:e.key,label:e.label,type:e.type,group:`Your fields`})),...m7.map(e=>({key:EGe+e.value,label:e.label,type:e.value,group:`New field`}))]}),!lt&&(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!Oe,onClick:()=>{p(Oe),l()},children:`Change`})]}),lt&&(0,H.jsxs)(`div`,{className:`cg-column-create cg-swap-create`,children:[(0,H.jsxs)(`label`,{children:[(0,H.jsxs)(`span`,{children:[`New `,Af[lt].toLowerCase(),` field`]}),(0,H.jsx)(`input`,{className:`cg-input`,autoFocus:!0,value:Ae,placeholder:`Field name`,onChange:e=>je(e.target.value),onKeyDown:e=>e.key===`Enter`&&kt()})]}),(0,H.jsx)(C7,{kind:lt,fields:n,formulaText:Ie,onFormulaText:Le,formulaError:yt.ok?null:yt.error??null,maxValue:Re,onMaxValue:ze,idPrefix:`cg-swap`}),h7(lt)&&(0,H.jsx)(b7,{idPrefix:`cg-swap-option`,drafts:Me,onDrafts:Ne,colorCode:Pe,onColorCode:Fe,type:lt}),lt===`user`&&(0,H.jsx)(`div`,{className:`cg-field-hint`,children:P.length?`${P.length} people can be assigned.`:`No user list was supplied by the host yet.`}),y&&(0,H.jsx)(kGe,{value:Ke,onValue:qe}),(0,H.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!Ot,onClick:kt,children:`Create and change`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>ke(``),children:`Cancel`})]})]})]})]})]});if(ee===`note`)return(0,H.jsxs)(Yp,{anchor:e.anchor,className:`cg-column-menu`,onDismiss:l,role:`dialog`,ariaLabel:`Edit description for ${t.label}`,initialFocus:`[data-overlay-autofocus]`,dataKind:`column-menu`,children:[(0,H.jsx)(S7,{title:`Edit field description`,sub:t.label,onClose:l}),(0,H.jsxs)(`div`,{className:`cg-column-create`,children:[t.description&&(0,H.jsxs)(`div`,{className:`cg-field-hint cg-desc-default`,children:[`Default description: `,t.description]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Your description`}),(0,H.jsx)(`textarea`,{className:`cg-input`,"data-overlay-autofocus":!0,autoFocus:!0,rows:4,value:te,placeholder:t.description?`Write your own to replace the default…`:`Explain how this field should be used…`,onChange:e=>L(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:te===(t.note??``),onClick:()=>{u(te),l()},children:`Save`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>I(`menu`),children:`Back`})]})]})]});if(ee===`permissions`)return(0,H.jsxs)(Yp,{anchor:e.anchor,className:`cg-column-menu`,onDismiss:l,role:`dialog`,ariaLabel:`Edit permissions for ${t.label}`,initialFocus:`[data-overlay-autofocus]`,dataKind:`column-menu`,children:[(0,H.jsx)(S7,{title:`Edit field permissions`,sub:t.label,onClose:l}),(0,H.jsxs)(`div`,{className:`cg-column-create`,children:[(0,H.jsxs)(`div`,{className:`cg-field-hint`,children:[`Who can edit this field's values`,t.createdBy?` (created by ${t.createdBy})`:``,`.`]}),[[`everyone`,`Everyone`],[`creator`,`Only the creator`],[`admins`,`Only admins`]].map(([e,t])=>(0,H.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`cg-perm`,"data-overlay-autofocus":e===`everyone`||void 0,checked:He===e,onChange:()=>Ue(e)}),(0,H.jsx)(`span`,{children:t})]},e)),(0,H.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:He===(t.permissions?.edit??`everyone`),onClick:()=>{E?.(He),l()},children:`Save`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>I(`menu`),children:`Back`})]})]})]});if(ee===`format`&&Qt)return(0,H.jsxs)(Yp,{anchor:e.anchor,className:`cg-column-menu`,onDismiss:l,role:`dialog`,ariaLabel:`Format ${t.label}`,initialFocus:`[data-overlay-autofocus]`,dataKind:`column-menu`,children:[(0,H.jsx)(S7,{title:`Field format`,sub:t.label,onClose:l}),(0,H.jsxs)(`div`,{className:`cg-column-create`,children:[Qt===`number`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,H.jsx)(`input`,{type:`checkbox`,"data-overlay-autofocus":!0,checked:We.thousands!==!1,onChange:e=>Ge(t=>({...t,thousands:e.target.checked}))}),(0,H.jsx)(`span`,{children:`Thousands separator (12,345)`})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Decimal places`}),(0,H.jsxs)(`select`,{className:`cg-select`,value:Number.isInteger(We.decimals)?String(We.decimals):``,"aria-label":`Decimal places`,onChange:e=>Ge(t=>{let n={...t};return e.target.value===``?delete n.decimals:n.decimals=Number(e.target.value),n}),children:[(0,H.jsx)(`option`,{value:``,children:`As entered`}),[0,1,2,3,4].map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))]})]}),(0,H.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:We.abbrev===!0,onChange:e=>Ge(t=>({...t,abbrev:e.target.checked}))}),(0,H.jsx)(`span`,{children:`Abbreviate large numbers (34.0M)`})]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,H.jsx)(`input`,{type:`checkbox`,"data-overlay-autofocus":!0,checked:We.time??t.type===`created_time`,onChange:e=>Ge(t=>({...t,time:e.target.checked}))}),(0,H.jsx)(`span`,{children:`Include the time of day`})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Time zone`}),(0,H.jsxs)(`select`,{className:`cg-select`,value:We.tz===`utc`?`utc`:`local`,"aria-label":`Time zone`,onChange:e=>Ge(t=>({...t,tz:e.target.value})),children:[(0,H.jsx)(`option`,{value:`local`,children:`Your local time`}),(0,H.jsx)(`option`,{value:`utc`,children:`UTC`})]})]})]}),(0,H.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:JSON.stringify(We)===JSON.stringify(t.format??{}),onClick:()=>{D?.(We),l()},children:`Save`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>I(`menu`),children:`Back`})]})]})]});let $t=!!E&&!!i&&(i.isAdmin||t.createdBy!=null&&t.createdBy===i.name);return(0,H.jsxs)(Yp,{anchor:e.anchor,className:`cg-column-menu`,onDismiss:l,role:`dialog`,ariaLabel:`Column settings for ${t.label}`,initialFocus:`[data-overlay-autofocus]`,dataKind:`column-menu`,children:[(0,H.jsx)(S7,{title:t.label,sub:Zt,onClose:l}),Wt&&(0,H.jsxs)(`button`,{type:`button`,className:`cg-column-periodline`,onClick:()=>{Ye(t.label),I(`edit`)},children:[(0,H.jsx)(`span`,{className:`cg-swap-label`,children:`Period`}),(0,H.jsx)(`span`,{className:`cg-column-periodval`,children:qu(t.measure.window)})]}),(0,H.jsxs)(`div`,{className:`cg-column-actions`,children:[(0,H.jsx)(`button`,{type:`button`,"data-overlay-autofocus":!0,onClick:()=>{Ye(t.label),I(`edit`)},children:(0,H.jsx)(tm,{icon:`rename`,text:`Edit field`})}),(0,H.jsx)(`div`,{className:`cg-menu-sep`,role:`separator`,"aria-hidden":!0}),T&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>{T(),l()},children:(0,H.jsx)(tm,{icon:`duplicate`,text:`Duplicate field`})}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>re(`left`),children:(0,H.jsx)(tm,{icon:`insertLeft`,text:`Insert field left`})}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>re(`right`),children:(0,H.jsx)(tm,{icon:`insertRight`,text:`Insert field right`})}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>re(`end`),children:(0,H.jsx)(tm,{icon:`addEnd`,text:`Add field at end`})}),(0,H.jsx)(`div`,{className:`cg-menu-sep`,role:`separator`,"aria-hidden":!0}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>I(`note`),children:(0,H.jsx)(tm,{icon:`description`,text:`Edit field description`})}),$t&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>I(`permissions`),children:(0,H.jsx)(tm,{icon:`permissions`,text:`Edit field permissions`})}),Qt&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>I(`format`),children:(0,H.jsx)(tm,{icon:`format`,text:`Field format`})}),(0,H.jsx)(`div`,{className:`cg-menu-sep`,role:`separator`,"aria-hidden":!0}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>{O(`asc`),l()},children:(0,H.jsx)(tm,{icon:`sortAsc`,text:`Sort ${ad(t.type,`asc`)}`})}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>{O(`desc`),l()},children:(0,H.jsx)(tm,{icon:`sortDesc`,text:`Sort ${ad(t.type,`desc`)}`})}),a!=null&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>{k(),l()},children:(0,H.jsx)(tm,{icon:`off`,text:`Don't sort by this field`})}),(0,H.jsx)(`div`,{className:`cg-menu-sep`,role:`separator`,"aria-hidden":!0}),(t.filterable!==!1||t.measure!=null&&F.length>0)&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>{A(),l()},children:(0,H.jsx)(tm,{icon:`filter`,text:`Filter by this field`})}),o&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>{j(),l()},children:(0,H.jsx)(tm,{icon:`off`,text:`Don't filter by this field`})}),c&&!s&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>{M(),l()},children:(0,H.jsx)(tm,{icon:`group`,text:`Group by this field`})}),s&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>{N(),l()},children:(0,H.jsx)(tm,{icon:`off`,text:`Don't group by this field`})}),x&&!b&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>{x(),l()},children:(0,H.jsx)(tm,{icon:`pin`,text:`Pin up to this field`})}),S&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>{S(),l()},children:(0,H.jsx)(tm,{icon:`unpin`,text:`Unpin all fields`})}),(0,H.jsx)(`div`,{className:`cg-menu-sep`,role:`separator`,"aria-hidden":!0}),(0,H.jsx)(`button`,{type:`button`,disabled:r,title:r?`The primary field stays visible`:void 0,onClick:d,children:(0,H.jsx)(tm,{icon:`hide`,text:`Hide field`})}),w&&(0,H.jsx)(`button`,{type:`button`,className:`is-danger`,title:t.measure?`Removes this formula column from the workspace.`:`Removes this field AND its values on every row.`,onClick:()=>ie?w():ae(!0),children:(0,H.jsx)(tm,{icon:`trash`,text:ie?`Delete permanently?`:`Delete field`})})]})]})}var jGe=[`bar`,`line`,`area`,`donut`,`kpi`,`table`],w7=[`sum`,`avg`,`count`,`min`,`max`],MGe={sum:`Sum of`,avg:`Average of`,count:`Count of records`,min:`Smallest`,max:`Largest`},NGe=[`brand`,`categorical`,`sequential`,`diverging`],PGe=[`auto`,`number`,`currency`,`percent`,`compact`],T7=[1,12],E7=[120,800],D7=[`bar`,`line`,`area`];function O7(e){return!!e&&e.startsWith(`measure_`)}function k7(e){return!!e.bucket&&O7(e.y)&&D7.includes(e.kind)}function FGe(e){let t=String(e??``);return/^\d{4}-\d{2}/.test(t)?t.slice(0,7):null}function IGe(e){let t=Number(e.slice(0,4)),n=Number(e.slice(5,7));return!Number.isFinite(t)||!Number.isFinite(n)?e:new Date(Date.UTC(t,n-1,1)).toLocaleDateString(void 0,{month:`short`,year:`numeric`,timeZone:`UTC`})}function A7(e){if(e==null||e===``)return null;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:null}function j7(e,t,n){if(e===`count`)return n;if(t.length===0)return 0;switch(e){case`sum`:return t.reduce((e,t)=>e+t,0);case`avg`:return t.reduce((e,t)=>e+t,0)/t.length;case`min`:return Math.min(...t);case`max`:return Math.max(...t)}}function LGe(e,t,n){return e===`count`?n:t.length===0?null:j7(e,t,n)}function M7(e,t,n,r){let i={buckets:[],omitted:0,omittedValue:0,blanks:0,missingY:0,rows:t.length},a=e.y?n.get(e.y):void 0;if(e.y&&!a)return{...i,problem:`The field this chart measured no longer exists.`};if(a&&e.agg!==`count`&&!rd(a.type))return{...i,problem:`${a.label} is not a number, so it cannot be ${e.agg===`avg`?`averaged`:e.agg+`med`}.`};if(e.agg!==`count`&&!a)return{...i,problem:`Choose a number field to measure, or switch to Count.`};if(e.kind===`kpi`){let n=[],r=0;for(let e of t){if(!a)continue;let t=A7(e[a.key]);t==null?r+=1:n.push(t)}return{...i,missingY:r,buckets:[{key:``,label:``,value:j7(e.agg,n,t.length),n:t.length}]}}let o=e.x?n.get(e.x):void 0;if(!e.x)return{...i,problem:`Choose a field to group by.`};if(!o)return{...i,problem:`The field this chart grouped by no longer exists.`};let s=id(o.type),c=new Map,l=0,u=0;for(let e of t){let t=e[o.key],n,r;if(s){let e=FGe(t);e==null?(l+=1,n=``,r=`(no date)`):(n=e,r=IGe(e))}else{let e=String(t??``).trim();e===``?(l+=1,n=``,r=`(blank)`):(n=e,r=e)}let i=c.get(n);if(i||(i={label:r,vals:[],n:0},c.set(n,i)),i.n+=1,a){let t=A7(e[a.key]);t==null?u+=1:i.vals.push(t)}}let d=[...c.entries()].map(([t,n])=>({key:t,label:n.label,value:j7(e.agg,n.vals,n.n),n:n.n}));s?d.sort((e,t)=>e.key===``?1:t.key===``?-1:e.key.localeCompare(t.key)):d.sort((e,t)=>t.value-e.value||e.label.localeCompare(t.label));let f=d.filter(e=>e.value<0),p=d.filter(e=>e.value===0).length,m=f.reduce((e,t)=>e+t.value,0),h=0,g=0,_=r?.maxBuckets??12;if(d.length>_){let e=d.slice(0,_),t=d.slice(_);h=t.length,g=t.reduce((e,t)=>e+t.value,0),d=e}return{...i,buckets:d,omitted:h,omittedValue:g,blanks:l,missingY:u,negativeBuckets:f.length,negativeValue:m,zeroBuckets:p}}function RGe(e,t,n){let r=M7({...e,splitBy:void 0},t,n),i={points:[],xOrder:[],seriesOrder:[],omitted:r.omitted,omittedValue:r.omittedValue,omittedSeries:0,omittedSeriesValue:0,nonPositive:0,nonPositiveValue:0,blanks:r.blanks,missingY:r.missingY,rows:r.rows,problem:r.problem};if(r.problem)return i;if(e.kind===`donut`){let e=r.buckets.filter(e=>e.value>0),t=r.negativeBuckets??r.buckets.filter(e=>e.value<0).length,n=t+(r.zeroBuckets??r.buckets.filter(e=>e.value===0).length),a=r.negativeValue??r.buckets.filter(e=>e.value<0).reduce((e,t)=>e+t.value,0);return t>0?{...i,nonPositive:n,nonPositiveValue:a,problem:`A donut cannot represent negative values without misrepresenting the whole. Use a bar or line chart for signed values.`}:r.buckets.length>0&&e.length===0?{...i,nonPositive:n,nonPositiveValue:a,problem:`A donut needs at least one positive value. Zero-value groups cannot be drawn as slices.`}:{...i,points:e.map(e=>({...e,seriesKey:``,seriesLabel:``})),xOrder:e.map(e=>e.key),nonPositive:n,nonPositiveValue:a}}if(!e.splitBy||e.kind===`kpi`)return{...i,points:r.buckets.map(e=>({...e,seriesKey:``,seriesLabel:``})),xOrder:r.buckets.map(e=>e.key)};let a=n.get(e.splitBy),o=e.x?n.get(e.x):void 0;if(!a)return{...i,problem:`The field this chart split into series no longer exists.`};if(!o)return{...i,problem:`The field this chart grouped by no longer exists.`};let s=e=>id(o.type)?FGe(e[o.key])??``:String(e[o.key]??``).trim(),c=e=>String(e[a.key]??``).trim(),l=new Set(r.buckets.map(e=>e.key)),u=new Map;for(let e of t){if(!l.has(s(e)))continue;let t=c(e),n=u.get(t);n?n.push(e):u.set(t,[e])}let d=[...u.entries()].map(([t,r])=>{let i=M7({...e,splitBy:void 0},r,n);return{key:t,label:t||`(blank)`,data:i,weight:i.buckets.reduce((e,t)=>e+Math.abs(t.value),0)}});d.sort((e,t)=>t.weight-e.weight||e.label.localeCompare(t.label));let f=d.slice(0,12),p=Math.max(0,d.length-f.length),m=d.slice(12).reduce((e,t)=>e+t.weight,0),h=r.buckets.map(e=>e.key),g=new Map(r.buckets.map(e=>[e.key,e.label])),_=[];for(let e of f){let t=new Map(e.data.buckets.map(e=>[e.key,e]));for(let n of h){let r=t.get(n);_.push({key:n,label:g.get(n)??n,value:r?.value??0,n:r?.n??0,seriesKey:e.key,seriesLabel:e.label})}}return{...i,points:_,xOrder:h,seriesOrder:f.map(e=>e.key),omittedSeries:p,omittedSeriesValue:m}}function zGe(e,t){return{id:e,kind:`bar`,x:t.find(e=>e.type===`status`||e.type===`select`)?.key,agg:`count`,size:{w:6,h:280}}}function BGe(e){return e.filter(e=>e.type===`status`||e.type===`select`||e.type===`text`||id(e.type))}function VGe(e){return e.filter(e=>rd(e.type))}function N7(e,t,n,r){return!n||n===`auto`?t?Mp(t,e):r(e):n===`compact`?r(e):n===`number`?e.toLocaleString(void 0,{maximumFractionDigits:2}):n===`percent`?`${e.toLocaleString(void 0,{maximumFractionDigits:2})}%`:e.toLocaleString(void 0,{style:`currency`,currency:`USD`,maximumFractionDigits:0})}function HGe(e,[t,n]){return Math.max(t,Math.min(n,e))}function UGe(e){if(!Array.isArray(e))return;let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n,r=typeof e.id==`string`&&e.id?e.id:``,i=e.kind,a=e.agg;if(!r||!jGe.includes(i)||!w7.includes(a))continue;let o={id:r,kind:i,agg:a};if(typeof e.x==`string`&&e.x&&(o.x=e.x),typeof e.y==`string`&&e.y&&(o.y=e.y),typeof e.title==`string`&&e.title&&(o.title=e.title.slice(0,60)),typeof e.splitBy==`string`&&e.splitBy&&e.splitBy!==o.x&&(o.splitBy=e.splitBy),o.splitBy&&(i===`bar`||i===`area`)&&e.stacked===!0&&(o.stacked=!0),NGe.includes(e.palette)&&(o.palette=e.palette),e.axis&&typeof e.axis==`object`&&!Array.isArray(e.axis)){let t=e.axis,n={};for(let e of[`x`,`y`]){let r=t[e];if(!r||typeof r!=`object`||Array.isArray(r))continue;let i=r,a={};typeof i.label==`string`&&i.label.trim()&&(a.label=i.label.trim().slice(0,40)),PGe.includes(i.format)&&(a.format=i.format),(a.label!==void 0||a.format!==void 0)&&(n[e]=a)}(n.x||n.y)&&(o.axis=n)}if(e.size&&typeof e.size==`object`&&!Array.isArray(e.size)){let t=e.size,n={};typeof t.w==`number`&&Number.isFinite(t.w)&&(n.w=HGe(Math.round(t.w),T7)),typeof t.h==`number`&&Number.isFinite(t.h)&&(n.h=HGe(Math.round(t.h),E7)),(n.w!==void 0||n.h!==void 0)&&(o.size=n)}if(typeof e.bucket==`string`&&ed.includes(e.bucket)&&O7(o.y)&&(o.bucket=e.bucket,e.span&&typeof e.span==`object`&&!Array.isArray(e.span))){let t=e.span.lastN;if(typeof t==`number`&&Number.isFinite(t)){let e=Math.round(t);e>=1&&e<=120&&(o.span={lastN:e})}}if(e.compare===`prior_year`&&(o.bucket||i===`kpi`&&o.agg===`sum`&&O7(o.y))&&(o.compare=`prior_year`),t.push(o),t.length>=12)break}return t.length?t:void 0}var WGe={sum:`Total`,avg:`Average`,count:`Count`,min:`Lowest`,max:`Highest`},P7=50;function GGe(){let e={stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`};return(0,H.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,"aria-hidden":!0,children:[(0,H.jsx)(`rect`,{x:`2.5`,y:`3`,width:`11`,height:`10`,rx:`1.5`,...e}),(0,H.jsx)(`path`,{d:`M5 7.5h6M5 10h4`,...e})]})}function KGe({mode:e,onMode:t,locked:n=!1,dateField:r,dateChoices:i,stackField:a,stackChoices:o,colorField:s,colorChoices:c,sizeField:l,sizeChoices:u,onPickField:d,clamped:f=!0,onClamp:p,calendarMode:m=`records`,onCalendarMode:h,calendarMetrics:g=[],metricChoices:_=[],onCalendarMetrics:v}){return(0,H.jsxs)(`span`,{className:`cg-modes`,children:[n?(0,H.jsxs)(`span`,{className:`cg-modes-locked`,title:`This view is locked as ${kf[e]}. Filters, sorts and columns are still editable — its creator or an admin can unlock it from the view menu.`,children:[(0,H.jsx)(Qp,{mode:e}),(0,H.jsxs)(`span`,{children:[`View · `,kf[e]]}),(0,H.jsx)(rm,{})]}):(0,H.jsx)(km,{label:`View · ${kf[e]}`,icon:(0,H.jsx)(Qp,{mode:e}),active:e!==`grid`,children:n=>(0,H.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`View as`}),rne.map(r=>(0,H.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`cg-viewmode`,checked:e===r,onChange:()=>{t(r),n()}}),(0,H.jsx)(Qp,{mode:r}),(0,H.jsx)(`span`,{children:kf[r]})]},r))]})}),e===`calendar`&&i.length>0&&(0,H.jsx)(sm,{className:`cg-mode-field`,ariaLabel:`Calendar date field`,value:r?.key,onChange:e=>d(`dateField`,e),fields:i.map(e=>({key:e.key,label:e.label,type:e.type}))}),e===`kanban`&&o.length>0&&(0,H.jsx)(sm,{className:`cg-mode-field`,ariaLabel:`Kanban stack field`,value:a?.key,onChange:e=>d(`stackField`,e),fields:o.map(e=>({key:e.key,label:e.label,type:e.type}))}),e===`kanban`&&p&&(0,H.jsx)(`button`,{type:`button`,className:`cg-tb-btn cg-mode-field`+(f?` is-on`:``),"aria-pressed":f,onClick:()=>p(!f&&void 0),title:f?`Cards are trimmed to a standard height. Click to let them grow to their content.`:`Cards grow to their content. Click to trim them to a standard height.`,children:f?`Short cards`:`Full cards`}),e===`calendar`&&h&&(0,H.jsx)(km,{label:`Day cells · ${m===`summary`?`Summaries`:`Records`}`,icon:(0,H.jsx)(GGe,{}),active:m===`summary`,children:e=>(0,H.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Each day shows`}),[[`records`,`Records`,`The records that fall on that day, listed.`],[`summary`,`Summaries`,`Totals computed over that day's records.`]].map(([t,n,r])=>(0,H.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`cg-cal-mode`,checked:t===`summary`?m===`summary`:m!==`summary`,onChange:()=>{h(t),e()}}),(0,H.jsxs)(`span`,{className:`cg-check-label`,children:[n,(0,H.jsx)(`span`,{className:`cg-pop-note cg-radio-help`,children:r})]})]},t))]})}),e===`calendar`&&m===`summary`&&v&&(0,H.jsx)(km,{label:`Totals · ${g.length+1}`,icon:(0,H.jsx)(Qp,{mode:`chart`}),active:g.length>0,children:()=>(0,H.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Totals per day`}),(0,H.jsxs)(`div`,{className:`cg-pop-note`,children:[`Records is always counted — every other figure in the cell is computed over it. Up to `,4,` more.`]}),_.length===0&&(0,H.jsx)(`div`,{className:`cg-pop-note`,children:`This table has no numeric fields to total.`}),_.map(e=>{let t=g.find(t=>t.field===e.key),n=g.length>=4;return(0,H.jsxs)(`div`,{className:`cg-cal-pick`,children:[(0,H.jsxs)(`label`,{className:`cg-check-row`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:!!t,disabled:!t&&n,onChange:()=>{v(t?g.filter(t=>t.field!==e.key):[...g,{id:`cm_${e.key}`,field:e.key,agg:`sum`}])}}),(0,H.jsx)(Zp,{type:e.type,size:11}),(0,H.jsx)(`span`,{className:`cg-check-label`,children:e.label})]}),t&&(0,H.jsx)(`select`,{className:`cg-select`,value:t.agg,"aria-label":`How to total ${e.label}`,onChange:t=>v(g.map(n=>n.field===e.key?{...n,agg:t.target.value}:n)),children:w7.filter(e=>e!==`count`).map(e=>(0,H.jsx)(`option`,{value:e,children:WGe[e]},e))})]},e.key)})]})}),e===`map`&&c.length>0&&(0,H.jsx)(sm,{className:`cg-mode-field`,ariaLabel:`Colour pins by`,placeholder:`Colour: none`,value:s?.key??``,onChange:e=>d(`colorField`,e),fields:[{key:``,label:`No colour`,type:void 0},...c.map(e=>({key:e.key,label:`Colour: ${e.label}`,type:e.type}))]}),e===`map`&&u.length>0&&(0,H.jsx)(sm,{className:`cg-mode-field`,ariaLabel:`Size pins by`,placeholder:`Size: none`,value:l?.key??``,onChange:e=>d(`sizeField`,e),fields:[{key:``,label:`No size`,type:void 0},...u.map(e=>({key:e.key,label:`Size: ${e.label}`,type:e.type}))]})]})}var qGe=(0,z.memo)(function({rows:e,fieldByKey:t,visibleKeys:n,titleKey:r,onOpen:i,onToggleGroup:a}){let o=n.filter(e=>e!==r);return(0,H.jsxs)(`div`,{className:`cg-listview`,children:[e.map((e,n)=>{if(e.kind===`group-footer`)return null;if(e.kind===`group-header`)return(0,H.jsxs)(`button`,{type:`button`,className:`cg-lv-group`,onClick:()=>a(e.groupKey),"aria-expanded":!e.collapsed,children:[(0,H.jsx)(`span`,{className:`cg-lv-chev`,children:e.collapsed?`▶`:`▼`}),(0,H.jsx)(`span`,{className:`cg-lv-group-label`,children:e.label}),(0,H.jsx)(`span`,{className:`cg-lv-count`,children:e.count.toLocaleString()})]},`g:${e.groupKey}:${n}`);let s=e.record;return(0,H.jsxs)(`button`,{type:`button`,className:`cg-lv-row`,onClick:()=>i(s.pid),children:[(0,H.jsx)(`span`,{className:`cg-lv-title`,children:String(s[r]??``)}),(0,H.jsx)(`span`,{className:`cg-lv-cells`,children:o.map(e=>{let n=t.get(e);if(!n)return null;let r=Mp(n,s[e]);return r?(0,H.jsxs)(`span`,{className:`cg-lv-cell`,children:[(0,H.jsx)(`span`,{className:`cg-lv-k`,children:n.label}),(0,H.jsx)(`span`,{className:`cg-lv-v`,children:r})]},e):null})})]},`r:${s.pid}:${n}`)}),e.length===0&&(0,H.jsx)(`div`,{className:`cg-mode-empty`,children:`No records match this view.`})]})});function JGe(e,t){let n=Number(e.slice(0,4)),r=Number(e.slice(5,7));return new Date(Date.UTC(n,r-1+t,1)).toISOString().slice(0,7)}function YGe(e){let t=Number(e.slice(0,4)),n=Number(e.slice(5,7));return new Date(Date.UTC(t,n-1,1)).toLocaleDateString(void 0,{month:`long`,year:`numeric`,timeZone:`UTC`})}function XGe(e,t,n,r){let i=e.field?r[e.field.key]:void 0;if(i)return i[t]??null;let a=[];if(e.field)for(let t of n){let n=A7(t.row[e.field.key]);n!=null&&a.push(n)}return LGe(e.agg,a,n.length)}var ZGe=(0,z.memo)(function({rows:e,field:t,today:n,titleKey:r,mode:i=`records`,metrics:a,fieldByKey:o,scope:s=`customer`,onOpen:c,onSheet:l}){let u=(0,z.useMemo)(()=>e.map(e=>({pid:e.pid,title:String(e[r]??``),day:String(e[t.key]??``).slice(0,10),row:e})),[e,t.key,r]),d=(0,z.useMemo)(()=>u.filter(e=>/^\d{4}-\d{2}-\d{2}$/.test(e.day)),[u]),f=u.length-d.length,p=(0,z.useMemo)(()=>{if(n&&/^\d{4}-\d{2}/.test(n))return n.slice(0,7);let e=d.map(e=>e.day.slice(0,7)).sort();return e.length?e[e.length-1]:null},[n,d]),[m,h]=(0,z.useState)(p),g=m??p,_=(0,z.useMemo)(()=>{let e=new Map;if(!g)return e;for(let t of d){if(!t.day.startsWith(g))continue;let n=e.get(t.day)??[];n.push({pid:t.pid,title:t.title,row:t.row}),e.set(t.day,n)}return e},[d,g]),v=(0,z.useMemo)(()=>{let e=[{id:`__count__`,label:`Records`,agg:`count`}];for(let t of a??[]){let n=o?.get(t.field);n&&w7.includes(t.agg)&&e.push({id:t.id,label:n.label,field:n,agg:t.agg})}return e},[a,o]),y=(0,z.useMemo)(()=>v.filter(e=>e.field&&Zm(e.field)===`server`).map(e=>e.field.key),[v]),[b,x]=(0,z.useState)({}),[S,C]=(0,z.useState)({}),w=(0,z.useRef)(0);if((0,z.useEffect)(()=>{if(i!==`summary`||!y.length||_.size===0){x({}),C({});return}let e=[..._.entries()].map(([e,t])=>({key:e,pids:t.map(e=>e.pid)})),t=++w.current;pte({groups:e,fields:y},s).then(({payload:e})=>{t===w.current&&(x(e?.values??{}),C(e?.windows??{}))})},[i,y,_,s]),(0,z.useEffect)(()=>{if(!l)return;if(i!==`summary`||!g){l(null);return}let e=(e,t)=>({key:e,label:t,type:`text`,source:`odoo`}),t=[e(`day`,`Day`),...v.map(t=>e(`m_${t.id}`,t.label))],n=[];for(let e of[..._.keys()].sort()){let t=_.get(e)??[],r={pid:n.length+1,day:e};for(let n of v){let i=XGe(n,e,t,b);r[`m_${n.id}`]=i==null?``:n.field?Mp(n.field,i):i.toLocaleString()}n.push(r)}l({fields:t,rows:n})},[l,i,g,_,v,b]),!g)return(0,H.jsxs)(`div`,{className:`cg-mode-empty`,children:[`No dates to place on a calendar yet.`,f>0&&` ${f.toLocaleString()} record${f===1?``:`s`} carry no date.`]});let T=Number(g.slice(0,4)),E=Number(g.slice(5,7)),D=new Date(Date.UTC(T,E,0)).getUTCDate(),O=(new Date(Date.UTC(T,E-1,1)).getUTCDay()+6)%7,k=[...Array.from({length:O},()=>null),...Array.from({length:D},(e,t)=>t+1)];for(;k.length%7!=0;)k.push(null);let A=[..._.values()].reduce((e,t)=>e+t.length,0);return(0,H.jsxs)(`div`,{className:`cg-calview`,children:[(0,H.jsxs)(`div`,{className:`cg-cal-bar`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-cal-nav`,"aria-label":`Previous month`,onClick:()=>h(JGe(g,-1)),children:`‹`}),(0,H.jsx)(`span`,{className:`cg-cal-title`,children:YGe(g)}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-cal-nav`,"aria-label":`Next month`,onClick:()=>h(JGe(g,1)),children:`›`}),(0,H.jsx)(`span`,{className:`cg-cal-note`,children:i===`summary`?`Totals over ${A.toLocaleString()} record${A===1?``:`s`} placed this month · by ${t.label}`:`${A.toLocaleString()} in this month · by ${t.label}`}),f>0&&(0,H.jsxs)(`span`,{className:`cg-cal-nodate`,title:`${f.toLocaleString()} matching record${f===1?``:`s`} have no ${t.label} and are not on the calendar. They remain in the Grid and List views.`,children:[f.toLocaleString(),` without a date`]}),i===`summary`&&v.filter(e=>e.field&&S[e.field.key]?.label).map(e=>(0,H.jsxs)(`span`,{className:`cg-cal-window`,children:[e.label,` · `,S[e.field.key].label,`, as of each day`]},e.id))]}),(0,H.jsxs)(`div`,{className:`cg-cal-grid`,children:[[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`].map(e=>(0,H.jsx)(`div`,{className:`cg-cal-dow`,children:e},e)),k.map((e,t)=>{let r=e?`${g}-${String(e).padStart(2,`0`)}`:``,a=e?_.get(r)??[]:[];return(0,H.jsxs)(`div`,{className:`cg-cal-cell`+(e?``:` is-blank`)+(r===n?` is-today`:``),children:[e&&(0,H.jsx)(`div`,{className:`cg-cal-day`,children:e}),i===`summary`?e&&a.length>0&&v.map(e=>{let t=XGe(e,r,a,b);return(0,H.jsxs)(`div`,{className:`cg-cal-metric`,children:[(0,H.jsx)(Zp,{type:e.field?e.field.type:`int`,size:11}),(0,H.jsx)(`span`,{className:`cg-cal-metric-k`,children:e.label}),(0,H.jsx)(`span`,{className:`cg-cal-metric-v`,children:t==null?`—`:e.field?Mp(e.field,t):t.toLocaleString()})]},e.id)}):a.map(e=>(0,H.jsx)(`button`,{type:`button`,className:`cg-cal-chip`,title:e.title,onClick:()=>c(e.pid),children:e.title},e.pid))]},t)})]})]})}),QGe=(0,z.memo)(function({rows:e,field:t,fieldByKey:n,cardKeys:r,titleKey:i,canMove:a,readOnlyReason:o,clamped:s=!0,onMove:c,onOpen:l}){let[u,d]=(0,z.useState)(new Set),f=(0,z.useMemo)(()=>{let n=t.type===`select`?[...Qu(t)]:[],r=new Map(n.map(e=>[e,[]])),i=[];for(let a of e){let e=String(a[t.key]??``).trim();if(e===``){i.push(a);continue}let o=r.get(e);o||(o=[],r.set(e,o),n.push(e)),o.push(a)}let o=n.map(e=>({key:e,label:e,rows:r.get(e)}));return(i.length||a)&&o.push({key:``,label:`(empty)`,rows:i}),o},[e,t,a]),p=e=>t=>{t.preventDefault();let n=Number(t.dataTransfer.getData(`text/plain`));Number.isFinite(n)&&n>0&&c(n,e)},m=(0,z.useRef)(!1);return(0,H.jsxs)(`div`,{className:`cg-kbview`+(s?` is-clamped`:``),children:[o&&(0,H.jsx)(`div`,{className:`cg-kb-note`,children:o}),(0,H.jsx)(`div`,{className:`cg-kb-lanes`,children:f.map(e=>{let o=u.has(e.key),s=o?e.rows:e.rows.slice(0,P7),c=e.key?xp(t,e.key):void 0;return(0,H.jsxs)(`div`,{className:`cg-kb-lane`,onDragOver:a?e=>e.preventDefault():void 0,onDrop:a?p(e.key):void 0,children:[(0,H.jsxs)(`div`,{className:`cg-kb-head`,children:[(0,H.jsx)(`span`,{className:`cg-kb-pill`,style:c?{background:c.bg,color:c.fg}:void 0,children:e.label}),(0,H.jsx)(`span`,{className:`cg-kb-count`,children:e.rows.length.toLocaleString()})]}),(0,H.jsxs)(`div`,{className:`cg-kb-cards`,children:[s.map(e=>(0,H.jsxs)(`div`,{className:`cg-kb-card`+(a?` is-draggable`:``),draggable:a,role:`button`,tabIndex:0,"aria-label":`Open ${String(e[i]??`record`)}`,onClick:()=>{m.current||l(e.pid)},onKeyDown:t=>{t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),l(e.pid))},onDragStart:a?t=>{m.current=!0,t.dataTransfer.setData(`text/plain`,String(e.pid))}:void 0,onDragEnd:a?()=>{window.setTimeout(()=>{m.current=!1},0)}:void 0,children:[(0,H.jsx)(`span`,{className:`cg-kb-title`,children:String(e[i]??``)}),r.map(t=>{let r=n.get(t);if(!r)return null;let i=Mp(r,e[t]);return i?(0,H.jsxs)(`div`,{className:`cg-kb-cell`,children:[(0,H.jsx)(`span`,{className:`cg-lv-k`,children:r.label}),(0,H.jsx)(`span`,{className:`cg-lv-v`,children:i})]},t):null})]},e.pid)),e.rows.length>P7&&!o&&(0,H.jsxs)(`button`,{type:`button`,className:`cg-link-btn cg-kb-more`,onClick:()=>d(t=>new Set(t).add(e.key)),children:[`Showing first `,P7,` — show all`,` `,e.rows.length.toLocaleString()]})]})]},e.key||`(empty)`)})})]})});function $Ge(e){let{label:t,value:n}=e,r=e.prior??null,i={label:t,value:n,format:e.format??`auto`,delta:null,prior:r,dir:`off`};if(n===0&&r!=null&&r!==0)return{...i,note:`no orders yet`};if(r==null)return i;if(r===0||!Number.isFinite(r)||!Number.isFinite(n))return{...i,note:`no comparable prior period`};let a=(n-r)/Math.abs(r)*100;return{...i,delta:a,dir:a>0?`up`:a<0?`down`:`flat`,deltaLabel:e.deltaLabel??`vs prior`}}function eKe(e){let{rows:t,fieldByKey:n,groupBy:r,columns:i}=e,a=e.sort??`first-desc`,o={columns:i,rows:[],total:0,shown:0,blanks:0};if(!n.has(r))return{...o,problem:`The field this table grouped by no longer exists.`};if(i.length===0)return{...o,problem:`This table has no columns to aggregate.`};let s=i.map(e=>M7({id:`gt-${e.key}`,kind:`bar`,x:r,y:e.y,agg:e.agg,size:void 0},t,n,{maxBuckets:2**53-1})),c=s.find(e=>e.problem)?.problem;if(c)return{...o,problem:c};let l=s[0],u=s.map(e=>new Map(e.buckets.map(e=>[e.key,e]))),d=l.buckets.map(e=>({key:e.key,label:e.label,n:e.n,values:i.map((t,n)=>u[n].get(e.key)?.value??null)}));d.sort((e,t)=>{if(a===`label`)return e.label.localeCompare(t.label);let n=e.values[0],r=t.values[0];return n==null||r==null?n==null?r==null?0:1:-1:a===`first-asc`?n-r:r-n});let f=e.limit??d.length;return{columns:i,rows:d.slice(0,Math.max(0,f)),total:d.length,shown:Math.min(d.length,Math.max(0,f)),blanks:l.blanks}}function tKe(e,t,n){let r={columns:[],rows:[],total:0,shown:0,blanks:0};if(!e.x)return{...r,problem:`Choose a field to group by.`};let i=e.y?n.get(e.y):void 0;if(e.agg!==`count`&&!e.y)return{...r,problem:`Choose a number field to measure, or switch to Count.`};let a=[];return e.agg!==`count`&&e.y&&a.push({key:`measure`,label:`${MGe[e.agg]} ${i?.label??e.y}`,agg:e.agg,y:e.y,format:e.axis?.y?.format}),a.push({key:`n`,label:`Records`,agg:`count`}),eKe({rows:t,fieldByKey:n,groupBy:e.x,columns:a,sort:`first-desc`,limit:25})}function nKe(e){let{values:t,back:n}=e,r=t.length?t[t.length-1]:null;if(r==null||!Number.isFinite(r))return null;let i=t.length-1-n,a=i>=0?t[i]:null;return $Ge({label:e.label,value:r,prior:a,format:e.format,deltaLabel:`vs last year`})}var rKe=(0,z.lazy)(()=>Tc(()=>Promise.resolve().then(()=>(dWe(),lWe)),void 0,import.meta.url)),F7=6;function I7(e,[t,n]){return Math.max(t,Math.min(n,e))}var iKe={brand:`Brand`,categorical:`Distinct categories`,sequential:`Low to high`,diverging:`Below / above a midpoint`},aKe={auto:`Automatic`,number:`Plain number`,currency:`Currency`,percent:`Percent`,compact:`Compact (1.2k)`};function L7(e,t,n){let r={...e.axis?.[t]??{},...n};r.label?.trim()||delete r.label,r.format===`auto`&&delete r.format;let i={...e.axis??{}};return r.label===void 0&&r.format===void 0?delete i[t]:i[t]=r,{...e,axis:i.x||i.y?i:void 0}}var oKe={bar:`Bar`,line:`Line`,area:`Area`,donut:`Donut`,kpi:`Single number`,table:`Table`},sKe=MGe,cKe={week:`Weekly`,month:`Monthly`,quarter:`Quarterly`,year:`Yearly`},lKe=[6,12,24,36];function uKe(e){let t=e.span?.lastN??12;return e.compare===`prior_year`?t+(Qm[e.bucket]??12):t}function dKe(e){return`${e.bucket}|${uKe(e)}`}var R7=`month`,fKe=Qm.month+1;function pKe(e){return e.kind===`kpi`&&e.compare===`prior_year`&&e.agg===`sum`&&O7(e.y)}function mKe(){return`${R7}|${fKe}`}function z7(e){if(!Number.isFinite(e))return`—`;let t=Math.abs(e);return t>=1e9?(e/1e9).toFixed(1)+`B`:t>=1e6?(e/1e6).toFixed(1)+`M`:t>=1e3?(e/1e3).toFixed(1)+`k`:Number.isInteger(e)?e.toLocaleString():e.toFixed(2)}function hKe({spec:e,data:t,fields:n,yField:r,onChange:i,onRemove:a,canPeriod:o,table:s,kpiCompare:c}){let[l,u]=(0,z.useState)(!1),d=(0,z.useMemo)(()=>BGe(n),[n]),f=(0,z.useMemo)(()=>VGe(n),[n]),p=k7(e)?cKe[e.bucket]:void 0,m=p?`Period`:e.x?n.find(t=>t.key===e.x)?.label:void 0,h=p?`, ${p.toLowerCase()}`:m?` by ${m}`:``,g=e.agg===`count`?`Count of records${h}`:`${sKe[e.agg]} ${r?.label??`…`}${h}`,_=(0,z.useMemo)(()=>oh({spec:e,model:t,xTitle:e.axis?.x?.label??m,yTitle:e.axis?.y?.label??(e.agg===`count`?`Records`:r?.label),formatValue:t=>N7(t,r,e.axis?.y?.format,z7)}),[t,e,m,r]);return(0,H.jsxs)(`div`,{className:`cg-ch-card`,style:{gridColumn:`span ${e.size?.w??F7}`,height:e.size?.h?`${e.size.h}px`:void 0},children:[(0,H.jsxs)(`div`,{className:`cg-ch-head`,children:[(0,H.jsx)(`span`,{className:`cg-ch-title`,title:e.title||g,children:e.title||g}),(0,H.jsx)(`button`,{type:`button`,className:`cg-icon-btn cg-ch-cfg`,"aria-label":`Configure this chart`,"aria-expanded":l,onClick:()=>u(e=>!e),children:(0,H.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M3 4.5h10M3 8h10M3 11.5h10`,stroke:`currentColor`,strokeWidth:1.3,strokeLinecap:`round`})})}),(0,H.jsx)(`button`,{type:`button`,className:`cg-icon-btn cg-ch-del`,"aria-label":`Remove this chart`,onClick:a,children:(0,H.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`,stroke:`currentColor`,strokeWidth:1.3,strokeLinecap:`round`})})})]}),l&&(0,H.jsxs)(`div`,{className:`cg-ch-cfgbody`,children:[(0,H.jsxs)(`div`,{className:`cg-ch-row cg-ch-kindrow`,role:`radiogroup`,"aria-label":`Chart type`,children:[(0,H.jsx)(`span`,{children:`Chart`}),(0,H.jsx)(`div`,{className:`cg-ch-kinds`,children:jGe.map(t=>(0,H.jsxs)(`label`,{className:`cg-ch-kind`+(e.kind===t?` is-on`:``),title:oKe[t],children:[(0,H.jsx)(`input`,{type:`radio`,name:`cg-ch-kind-${e.id}`,checked:e.kind===t,onChange:()=>i({...e,kind:t})}),(0,H.jsx)(Nre,{kind:t}),(0,H.jsx)(`span`,{children:oKe[t]})]},t))})]}),(0,H.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,H.jsx)(`span`,{children:`Show`}),(0,H.jsx)(`select`,{className:`cg-select`,value:e.agg,onChange:t=>{let n=t.target.value;i({...e,agg:n,...e.kind===`kpi`&&n!==`sum`?{compare:void 0}:{}})},children:w7.map(e=>(0,H.jsx)(`option`,{value:e,children:sKe[e]},e))})]}),e.agg!==`count`&&(0,H.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,H.jsx)(`span`,{children:`Which number`}),(0,H.jsxs)(`select`,{className:`cg-select`,value:e.y??``,onChange:t=>i({...e,y:t.target.value||void 0,...O7(t.target.value)?{}:{bucket:void 0,span:void 0,compare:void 0}}),children:[(0,H.jsx)(`option`,{value:``,children:`Choose a number…`}),f.map(e=>(0,H.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]}),o&&O7(e.y)&&D7.includes(e.kind)&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,H.jsx)(`span`,{children:`Over time`}),(0,H.jsxs)(`select`,{className:`cg-select`,value:e.bucket??``,onChange:t=>i({...e,bucket:t.target.value||void 0,span:t.target.value?e.span:void 0,compare:t.target.value?e.compare:void 0}),children:[(0,H.jsx)(`option`,{value:``,children:`No — group by a field`}),ed.map(e=>(0,H.jsx)(`option`,{value:e,children:cKe[e]},e))]})]}),!!e.bucket&&(0,H.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,H.jsx)(`span`,{children:`How far back`}),(0,H.jsx)(`select`,{className:`cg-select`,value:String(e.span?.lastN??12),onChange:t=>i({...e,span:{lastN:Number(t.target.value)}}),children:lKe.map(e=>(0,H.jsxs)(`option`,{value:e,children:[`Last `,e]},e))})]}),!!e.bucket&&(0,H.jsxs)(`label`,{className:`cg-ch-row cg-ch-check`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:e.compare===`prior_year`,onChange:t=>i({...e,compare:t.target.checked?`prior_year`:void 0})}),(0,H.jsx)(`span`,{children:`Compare to the year before`})]})]}),e.kind===`kpi`&&o&&e.agg===`sum`&&O7(e.y)&&(0,H.jsxs)(`label`,{className:`cg-ch-row cg-ch-check`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:e.compare===`prior_year`,onChange:t=>i({...e,compare:t.target.checked?`prior_year`:void 0})}),(0,H.jsx)(`span`,{children:`Compare to the year before`})]}),e.kind!==`kpi`&&!(o&&e.bucket&&D7.includes(e.kind))&&(0,H.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,H.jsx)(`span`,{children:`Grouped by`}),(0,H.jsxs)(`select`,{className:`cg-select`,value:e.x??``,onChange:t=>i({...e,x:t.target.value||void 0}),children:[(0,H.jsx)(`option`,{value:``,children:`Choose a field…`}),d.map(e=>(0,H.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]}),(0,H.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,H.jsx)(`span`,{children:`Title`}),(0,H.jsx)(`input`,{className:`cg-input`,value:e.title??``,placeholder:g,maxLength:60,onChange:t=>i({...e,title:t.target.value||void 0})})]}),e.kind!==`kpi`&&e.kind!==`donut`&&e.kind!==`table`&&!(o&&e.bucket&&D7.includes(e.kind))&&(0,H.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,H.jsx)(`span`,{children:`Break down by`}),(0,H.jsxs)(`select`,{className:`cg-select`,value:e.splitBy??``,onChange:t=>i({...e,splitBy:t.target.value||void 0,stacked:t.target.value?e.stacked:void 0}),children:[(0,H.jsx)(`option`,{value:``,children:`Don't break it down`}),d.filter(t=>t.key!==e.x).map(e=>(0,H.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]}),!!e.splitBy&&(e.kind===`bar`||e.kind===`area`)&&(0,H.jsxs)(`label`,{className:`cg-ch-row cg-ch-check`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:e.stacked===!0,onChange:t=>i({...e,stacked:t.target.checked||void 0})}),(0,H.jsx)(`span`,{children:`Stack them on top of each other`})]}),e.kind!==`table`&&(0,H.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,H.jsx)(`span`,{children:`Colours`}),(0,H.jsxs)(`select`,{className:`cg-select`,value:e.palette??``,onChange:t=>i({...e,palette:t.target.value||void 0}),children:[(0,H.jsx)(`option`,{value:``,children:`Default`}),NGe.map(e=>(0,H.jsx)(`option`,{value:e,children:iKe[e]},e))]})]}),e.kind!==`kpi`&&e.kind!==`table`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,H.jsx)(`span`,{children:`Bottom axis label`}),(0,H.jsx)(`input`,{className:`cg-input`,value:e.axis?.x?.label??``,placeholder:m??`Category`,maxLength:40,onChange:t=>i(L7(e,`x`,{label:t.target.value}))})]}),(0,H.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,H.jsx)(`span`,{children:`Side axis label`}),(0,H.jsx)(`input`,{className:`cg-input`,value:e.axis?.y?.label??``,placeholder:r?.label??`Value`,maxLength:40,onChange:t=>i(L7(e,`y`,{label:t.target.value}))})]})]}),(0,H.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,H.jsx)(`span`,{children:`Number format`}),(0,H.jsx)(`select`,{className:`cg-select`,value:e.axis?.y?.format??`auto`,onChange:t=>i(L7(e,`y`,{format:t.target.value})),children:PGe.map(e=>(0,H.jsx)(`option`,{value:e,children:aKe[e]},e))})]})]}),e.kind===`table`?!s||s.problem?(0,H.jsx)(`div`,{className:`cg-ch-empty`,children:s?.problem??`Choose a field to group by.`}):s.rows.length===0?(0,H.jsx)(`div`,{className:`cg-ch-empty`,children:`No records match this view, so there is nothing to list.`}):(0,H.jsx)(`div`,{className:`cg-ch-viz cg-ch-viz--table`,children:(0,H.jsx)(gKe,{table:s,xLabel:m??`Group`,yField:r})}):t.pending?(0,H.jsx)(`div`,{className:`cg-ch-empty`,children:(0,H.jsx)(`span`,{className:`lp-spin`,role:`status`,"aria-label":`Loading`})}):t.problem?(0,H.jsx)(`div`,{className:`cg-ch-empty`,children:t.problem}):t.points.length===0?(0,H.jsx)(`div`,{className:`cg-ch-empty`,children:`No records match this view, so there is nothing to chart.`}):(0,H.jsx)(`div`,{className:`cg-ch-viz cg-ch-viz--${e.kind}`,children:(0,H.jsx)(z.Suspense,{fallback:(0,H.jsx)(`div`,{className:`cg-ch-loading`,children:(0,H.jsx)(`span`,{className:`lp-spin`,role:`status`,"aria-label":`Loading`})}),children:(0,H.jsx)(rKe,{spec:_,label:e.title||g})})}),e.kind===`kpi`&&c&&(0,H.jsx)(`div`,{className:`cg-ch-kpidelta is-${c.dir}`,title:c.prior==null?void 0:`This period ${N7(c.value,r,e.axis?.y?.format,z7)} · a year earlier ${N7(c.prior,r,e.axis?.y?.format,z7)} (month-end anchored)`,children:c.delta==null?(0,H.jsx)(`span`,{children:c.note}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 14 14`,"aria-hidden":!0,children:c.dir===`up`?(0,H.jsx)(`path`,{d:`M3 9.5l4-5 4 5z`,fill:`currentColor`}):c.dir===`down`?(0,H.jsx)(`path`,{d:`M3 4.5l4 5 4-5z`,fill:`currentColor`}):(0,H.jsx)(`path`,{d:`M3 7h8`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`})}),(0,H.jsxs)(`span`,{children:[Math.abs(c.delta).toFixed(1),`% `,c.deltaLabel]})]})}),(0,H.jsxs)(`div`,{className:`cg-ch-foot`,children:[(0,H.jsxs)(`span`,{children:[t.rows.toLocaleString(),` records`]}),e.kind===`table`&&s&&!s.problem?(0,H.jsxs)(H.Fragment,{children:[s.shown0&&(0,H.jsxs)(`span`,{children:[`· `,s.blanks.toLocaleString(),` with no value grouped as blank`]})]}):(0,H.jsxs)(H.Fragment,{children:[t.omitted>0&&(0,H.jsxs)(`span`,{title:`The ${t.omitted.toLocaleString()} smallest groups are not drawn. Together they account for ${z7(t.omittedValue)}.`,children:[`· top `,12,` of `,(t.xOrder.length+t.omitted).toLocaleString(),` groups shown (+`,z7(t.omittedValue),` not drawn)`]}),t.omittedSeries>0&&(0,H.jsxs)(`span`,{title:`${t.omittedSeries.toLocaleString()} smaller series are not drawn. Together they account for ${z7(t.omittedSeriesValue)}.`,children:[`· `,t.omittedSeries.toLocaleString(),` series not drawn`]}),t.nonPositive>0&&(0,H.jsxs)(`span`,{title:`Donut slices require positive values. These groups have a combined value of ${z7(t.nonPositiveValue)} and are not included in the circle.`,children:[`· `,t.nonPositive.toLocaleString(),` zero/negative group`,t.nonPositive===1?``:`s`,` not drawn`]}),t.blanks>0&&(0,H.jsxs)(`span`,{children:[`· `,t.blanks.toLocaleString(),` with no value grouped as blank`]}),t.missingY>0&&(0,H.jsxs)(`span`,{title:`These records carry no number for the measured field, so they are counted in the group but excluded from the aggregate.`,children:[`· `,t.missingY.toLocaleString(),` not measurable`]})]})]}),(0,H.jsx)(`button`,{type:`button`,className:`cg-ch-resize`,"aria-label":`Resize ${e.title||g}`,title:`Drag to resize · arrow keys also work`,onPointerDown:t=>{t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId);let n=t.currentTarget.parentElement,r=n?.parentElement;if(!n||!r)return;let a=t.clientX,o=t.clientY,s=e.size?.w??F7,c=e.size?.h??n.getBoundingClientRect().height,l=Math.max(1,r.getBoundingClientRect().width/12),u=t=>{let n=I7(Math.round(s+(t.clientX-a)/l),T7),r=I7(Math.round(c+(t.clientY-o)),E7);i({...e,size:{w:n,h:r}})},d=()=>{window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d)};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d)},onKeyDown:t=>{let n=t.key===`ArrowRight`?1:t.key===`ArrowLeft`?-1:0,r=t.key===`ArrowDown`?20:t.key===`ArrowUp`?-20:0;!n&&!r||(t.preventDefault(),i({...e,size:{w:I7((e.size?.w??F7)+n,T7),h:I7((e.size?.h??260)+r,E7)}}))},children:(0,H.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M9 3.5L3.5 9M9 7L7 9`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinecap:`round`})})})]})}function gKe({table:e,xLabel:t,yField:n}){return(0,H.jsx)(`div`,{className:`cg-ch-table`,children:(0,H.jsxs)(`table`,{children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:t}),e.columns.map(e=>(0,H.jsx)(`th`,{className:`cg-ch-td-num`,children:e.label},e.key))]})}),(0,H.jsx)(`tbody`,{children:e.rows.map(t=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{title:t.label,children:t.label}),t.values.map((t,r)=>{let i=e.columns[r];return(0,H.jsx)(`td`,{className:`cg-ch-td-num`,children:t==null?`—`:i.agg===`count`?t.toLocaleString():N7(t,i.y?n:void 0,i.format,z7)},i.key)})]},t.key||`(blank)`))})]})})}function _Ke({rows:e,fields:t,fieldByKey:n,charts:r,onCharts:i,scope:a}){let o=(0,z.useMemo)(()=>r.map(t=>RGe(t,e,n)),[r,e,n]),s=(0,z.useMemo)(()=>r.map(t=>t.kind===`table`?tKe(t,e,n):null),[r,e,n]),c=(0,z.useMemo)(()=>e.map(e=>Number(e.pid)).filter(Number.isFinite),[e]),l=(0,z.useMemo)(()=>r.filter(k7),[r]),u=(0,z.useMemo)(()=>r.filter(pKe),[r]),d=(0,z.useMemo)(()=>{let e=new Map,t=(t,n,r,i)=>{let a=e.get(t)??{bucket:n,lastN:r,fields:[]};i&&!a.fields.includes(i)&&a.fields.push(i),e.set(t,a)};for(let e of l)t(dKe(e),e.bucket,uKe(e),e.y);for(let e of u)t(mKe(),R7,fKe,e.y);return e},[l,u]),f=(0,z.useMemo)(()=>JSON.stringify([...d.entries()].map(([e,t])=>[e,[...t.fields].sort()])),[d]),[p,m]=(0,z.useState)({}),[h,g]=(0,z.useState)(!1),_=(0,z.useRef)(0);(0,z.useEffect)(()=>{if(!a||!d.size||!c.length){m({}),g(!1);return}let e=++_.current;g(!0),Promise.all([...d.entries()].map(([e,t])=>ef(Wm({pids:c,bucket:t.bucket,span:{lastN:t.lastN},fields:t.fields}),a).then(({payload:t})=>[e,t]))).then(t=>{e===_.current&&(m(Object.fromEntries(t)),g(!1))})},[a,f,c,d]);let v=(e,t)=>{if(!k7(e))return t;if(!a)return{...t,points:[],problem:`This chart is a trend over periods, but the host has not said which surface this view is, so it cannot be loaded.`};let n=p[dKe(e)];if(!n)return h?{...t,points:[],pending:!0}:{...t,points:[],problem:`The periods could not be loaded, so nothing is drawn rather than a guess.`};let r=Xm(n),i=r.rows.find(t=>t.field===e.y);return i?e.compare===`prior_year`?Vie(i,r.columns,e.bucket,e.span?.lastN??12):rh(i,r.columns):{...t,points:[],problem:`The server returned no series for this metric — a composite metric has no single aggregate to bucket.`}},y=e=>{if(!pKe(e))return;if(!a)return null;let t=p[mKe()];if(!t)return null;let n=Xm(t).rows.find(t=>t.field===e.y);return n?nKe({label:e.title??``,values:n.cells.map(e=>e.value),back:Qm[R7],format:e.axis?.y?.format}):null};return(0,H.jsxs)(`div`,{className:`cg-dashview`,children:[(0,H.jsxs)(`div`,{className:`cg-dash-bar`,children:[(0,H.jsxs)(`span`,{className:`cg-cal-note`,children:[e.length.toLocaleString(),` records · every chart describes exactly this view's rows, so filters and cohort scope already apply`]}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary cg-dash-add`,disabled:r.length>=12,title:r.length>=12?`A view holds at most 12 charts.`:void 0,onClick:()=>{let e=`ch_${Math.random().toString(36).slice(2,10)}`;i([...r,zGe(e,t)])},children:`+ Add chart`})]}),r.length===0?(0,H.jsx)(`div`,{className:`cg-mode-empty`,children:`No charts on this view yet. "+ Add chart" builds one from the records this view already matches.`}):(0,H.jsx)(`div`,{className:`cg-dash-grid`,children:r.map((e,c)=>(0,H.jsx)(hKe,{spec:e,data:v(e,o[c]),fields:t,yField:e.y?n.get(e.y):void 0,canPeriod:!!a,table:s[c],kpiCompare:y(e),onChange:t=>i(r.map(n=>n.id===e.id?t:n)),onRemove:()=>i(r.filter(t=>t.id!==e.id))},e.id))})]})}var vKe=`M465.85,1189.44l3.99,2.28 0.83,2.79 11.82,12.37 1.25,5.21 -0.42,1.67 0.93,0.27 1.84,-1.87 5.28,-3.59 2.67,-0.04 1.27,-2.84 0.01,-4 1.34,0.06 0.8,-0.54 0.35,-1.18 -0.85,-1.61 4.41,-1.31 5.21,-2.94 2.45,2.22 2.39,2.61 -0.23,3.08 1.45,3.42 5.72,4.51 1.64,4.13 5.42,4.24 4.77,6.42 -0.24,1.6 3.44,5.6 10.1,18.69 -1.2,2.5 3.48,1.11 -0.82,3.54 2.71,1.33 -0.23,1.05 0.6,1.19 0.1,1.96 2.84,-0.18 5.6,4 3.88,1.31 1.05,1.58 1.96,0.68 0.73,2.21 2.26,0.81 1.33,-0.54 0.85,1.93 0.1,1.3 -1.51,6 1.25,7.15 -1.54,3.21 -0.48,2.21 -4.11,5.07 -3.12,-0.75 -2.23,-7.37 0.7,-1.29 2.69,-1.48 -1.23,-0.74 -0.71,-7.66 -2.38,-4.54 -0.15,-0.76 1.23,-1.85 -8.55,4.31 -0.48,0.83 0.26,1.4 -1.61,4.28 -0.44,0.38 -1.54,-0.7 -1.19,-3.05 0.18,-0.65 2.3,-3.58 1.84,-4.69 3.33,-0.95 -3.83,-0.71 -1.53,-2.84 -1.82,-0.84 -1.4,-2.04 -0.6,-2.19 -1.34,-0.49 -0.13,-2.42 -1.73,-0.63 -1.85,-2.05 -0.42,-1.36 0.16,-2 -1.01,0.18 -6.28,-2.61 0.33,-3.47 -1.17,-4.59 -1.25,-1.87 0.52,-1.12 0.56,-0.01 4.97,2.74 -4.53,-4.44 -0.22,-1.24 0.27,-1.01 3.6,0.06 -4.15,-1.01 -1.11,1.79 -0.74,-0.07 -3.52,-4.89 -0.36,-2.99 0.2,-1.69 1.92,-4.97 -0.76,0.43 -2.14,4.75 -0.88,1.01 -3.15,-2.91 -2.02,-0.38 -1.28,-1.5 -1.9,-4.2 -0.49,-2.61 -1.66,-1.7 -0.97,-5.16 -1.29,-3.6 -0.38,-4.03 -0.56,2.26 -0.81,0.22 0.96,2.24 -1.17,0.12 1.33,2.55 0.59,3.93 3.09,12.43 0.14,0.74 -0.46,1.32 -2.41,-0.22 -1.68,-2.6 -1.39,-0.78 -3.7,0.25 0.41,-3.85 -2.1,-4.64 0.03,-0.71 2.47,-1.68 -2.17,0.53 -1.51,-3.85 -0.11,2.24 0.41,1.18 -0.01,1.62 -1.16,1.19 -2.56,-1.78 -1.31,-2.08 -4.81,-2.07 0.47,2.2 -1.27,1.35 2.05,-0.17 3.02,1.59 0.91,1.51 1.41,0.87 -0.84,1.82 2.95,0.33 1.85,3.26 0.07,1.49 -0.29,0.43 -4.34,0.79 -1.65,1.82 -10.66,-7.33 -0.23,-0.97 -3.4,-3.5 -1.86,-3.43 -3.7,-3.22 -2.37,-0.93 0.52,-0.82 -4.21,-1.58 -10.4,-6.91 2.13,-1.44 1.12,-1.97 -0.78,-3.4 0.14,-1.45 0.65,-0.94 0.74,-0.07 1.32,1.81 0.51,6.01 0.75,-4.72 2.64,-0.34 -2.89,-1.31 -2.15,-2.71 -1,-0.11 -4.52,4.8 -3.41,1.78 -2.32,0.36 -4.81,-0.86 -6.43,-3.48 1.34,-2.31 -0.45,-1.79 -0.9,-0.8 -0.01,1.72 -0.42,0.52 -2.54,1.13 -10,-2.64 -4.51,-0.25 -9.78,1.91 -3.89,-0.08 -0.16,-0.67 0.87,-0.39 -0.05,-0.48 -1.1,-1.52 -5.21,-1.69 -2.94,-2.54 0.88,-4.58 1.52,-3.14 -6.34,6.69 -7.41,-2.26 2.55,-4.01 -5.39,-0.22 -0.38,-1.72 -0.78,-0.33 -2.87,1.12 -0.77,-0.66 2.03,-1.91 -2.8,-2.01 0.03,-2.24 0.42,-1.43 3.57,-1.39 -3.39,-0.36 -3.31,2.89 -1.21,0.64 -2.44,-0.45 -1.9,1.93 -2.34,-1.88 -1,2 -1.73,0.56 -0.95,-0.1 -1.14,-1.37 0.23,-1.66 2.49,-4.71 -3.38,3.22 -3.33,0.52 -0.78,1.15 2.29,-0.43 -1.54,4.13 -2.41,0.62 -0.01,0.56 3.42,2.97 -0.55,2.13 -2.33,0.42 -1.48,1.76 5.92,-1.99 0.78,0.19 0.99,1.9 -0.93,1.31 -1.55,0.81 -0.39,1.61 0.21,3.56 -1.54,1.05 -1.11,3.02 -3.64,0.94 -2.89,-0.73 -1.33,-1.22 -1.65,0.81 -1.47,-2.45 -0.42,2.38 -1.33,2.43 -0.55,2.8 -1.32,-3.38 -0.92,1.45 0.14,2.39 -2.54,-0.77 0.44,2.13 -2.63,2.78 -1.59,-0.34 -1.68,1.04 -1.39,-0.63 -0.17,1.88 -0.62,1.18 -2,1.9 -0.93,2.06 -2.82,-1.15 0.13,1.42 -2.22,-0.19 -4.23,1.27 -2.41,-1.7 0.2,-1.73 0.94,-1.42 5.12,-2.47 2.39,-2.72 1.63,-3.03 -0.49,-0.4 -4.11,3.14 -3.57,-1.12 -0.6,-0.47 -0.41,-1.38 1.35,-4.68 3.85,-6.53 0.95,-4.42 -0.48,-4.48 -0.02,-1.47 0.39,-0.46 10.02,-6.56 1.05,0.02 2.69,2.1 5.47,-0.44 6.34,1.76 -0.77,-1.38 -5.12,-1.37 -5.24,-4.17 1.79,-1.43 1.81,-3.12 4.64,-3.19 -1.19,-0.08 -2.98,0.72 -1.46,1.36 -1.73,3.18 -5.64,0.46 -1.09,-1.11 -4.3,2.57 -2.33,2.65 -5.05,2.5 -1.6,1.61 -0.57,1.81 0.39,1.83 -2.8,1.69 -3.12,3.57 -0.39,1.74 0.51,1 -1.24,1.68 -3.24,2.25 -4.22,-1.31 4.09,3.9 0.4,0.95 -0.34,1.97 -1.13,1.74 -5.14,1.77 2.12,1.1 -0.27,1.44 -0.52,0.48 -3.07,1.11 -0.03,-1.58 -0.54,-0.23 -2.71,2.1 -0.21,0.27 0.7,0.45 -1.63,2.36 -3.82,3.28 0.23,0.6 -1.26,4.02 0.56,0.79 5.38,1.8 2.71,1.74 1.04,1.67 -1.26,2.84 -2.04,2.2 -2.79,1.46 -1.79,2.07 -0.75,2.76 -2.32,1.33 0.93,0.34 -0.45,2.79 -3.68,0.9 -0.16,1.34 -4.8,0.85 -1.6,2.88 -5.04,3.16 -0.06,0.7 -2.08,2.82 -2.53,0.49 -0.42,0.39 -0.2,1.67 -2.13,-0.03 -2.2,1.88 -0.49,0.68 0.92,1.84 -0.03,0.75 -0.85,2.09 -1.33,0.84 -0.42,1.15 -1.72,0.09 -4.08,3.74 -3.43,0.75 -1.57,3.23 -3.31,-0.22 -2.38,1.92 1.69,0.65 -5.51,1.75 -1.57,2.53 1.89,0.23 1.25,2.15 -2.28,2.47 -0.53,0.06 -0.22,-1.92 -0.56,-0.37 -1.29,2.89 -0.97,1.14 -8.34,3.59 -0.5,2.32 -1.05,1.4 -0.22,-4.01 -1.05,-0.34 -6.85,4.17 -1.44,1.97 -1.43,-0.31 -1.65,1.39 -1.44,-0.61 -3.2,2.5 -3.25,0.13 -0.15,-1.65 0.72,-1.43 2.41,-0.15 -1.77,-1.38 -1.81,-0.13 -1.57,1.11 -0.99,3.46 -3.78,5.03 -1.06,-0.09 -1.22,1.4 -1.28,0.42 -0.81,-0.51 0.52,-0.58 -0.94,-2.02 -0.54,-0.68 -1,-0.08 0.13,4.14 -0.63,0.83 -2.17,0.84 -1.49,-1.83 -1.41,-0.36 0.22,1.81 -0.35,1.13 -2.32,1.53 0.64,-5.6 1.87,-1.44 2.37,-0.03 8.52,-10.52 5.23,-3.8 5.48,-2.32 0.43,0.14 -0.5,0.76 0.34,0.47 3.34,-0.8 0.24,0.47 -0.28,0.59 -1.21,0.6 0.04,0.5 2.3,2.69 0.65,-0.35 -0.14,-1.68 0.59,-0.32 2,0.14 1.06,0.95 1.66,0.23 0.24,-0.55 -0.43,-0.65 -1.95,-1.44 -0.68,-1.44 2.7,-6.29 5.88,-5.09 5.71,-2.63 4.16,-4.02 0.26,1.37 2.5,0.44 0.16,-5.09 3.87,-5.43 2.13,-1.44 3.28,-3.42 1.23,-0.43 2.3,1.38 0.83,-0.49 -1.24,-0.73 -1.43,-2.94 0.86,-4.61 0.12,-3.34 0.63,-1.92 4.11,-1.17 -3.35,-1.28 -0.4,-3.64 0.71,-1.77 2.65,-3.01 2.89,-2.09 -0.75,-0.8 2.63,-7.98 -1.75,3.22 -2.04,2.45 -11.93,5.78 -1.27,-0.6 -2.28,-4.57 0.88,-3.29 3.92,0.48 -3.89,-2.48 -1.04,0.38 -1.87,3.17 -1.49,-0.99 0.39,1.58 -0.98,4.03 1.02,4.34 -0.19,1.73 -1.85,0.79 -1.5,-1.42 -4.22,-7.06 -2.46,-2.6 -2.85,2.01 -2.64,-1.9 -2.4,-3.2 -5.16,3.96 -4.89,1.58 -0.93,1.23 -0.37,1.62 -4.49,1.26 -4.43,-0.7 3.28,-1.6 1.51,-1.69 -0.64,-2.27 -0.1,-2.63 1.65,-2.06 -1.71,0 -1.1,0.74 -1.02,-1.55 -0.49,-3.06 1.72,-3.22 0.5,-3.6 -3.52,-8.85 -1.19,-4.52 -2.03,-2.42 3.21,-7.62 2.19,-1.64 -2.18,-0.02 -3.76,6.73 -2.46,2.89 1.56,0.87 0.23,0.73 0.31,1.66 -0.8,3.12 -1.85,-0.09 -1.65,1.61 -3.88,1.75 -7.83,0.88 -2.68,-2.04 0.13,-2.21 -3.86,-3.54 -2.18,-3.54 -1.57,-0.08 -2.97,-2.42 0.4,-2.03 -3.73,-0.94 3.84,-4.61 1.33,-3.11 1.07,-0.44 5.54,2.82 0.6,1.08 -1.21,3.09 4.24,-4.05 1.19,0.49 1.88,3.6 2.29,-1.73 1.22,-2.16 -2.3,-1.51 -3.22,-0.74 3.63,-1.15 -1.84,-1.56 -2.79,2.46 -5.09,-0.13 -3.55,-1.43 -4.11,-0.04 -0.69,-0.77 3.49,-3.43 -2.37,0.41 -0.69,-0.84 0.11,-1.47 -0.86,0.93 -1.61,-1.06 1.15,-1.68 -0.34,-0.14 -0.68,0.21 -0.66,1.27 0.12,2.5 -2.1,0.09 -1.43,-4.66 -1.96,-0.85 -0.48,-1.62 1.24,-2.08 -0.55,-1.07 -1.32,-0.35 -1.51,1.05 -0.67,-0.94 -0.17,-2.5 4.08,-1.09 -2.4,-1.25 -0.67,-1.32 5.3,-1.6 -1.28,-2.17 -0.21,-1.27 0.42,-2.16 5.83,-9.12 2.22,-1.49 2.75,0.91 -0.98,-2.08 1.78,-0.67 1.12,-2.5 -2.31,2.13 -0.6,-4.41 0.52,-2.92 1.39,-2.56 3.33,-0.26 0.11,-0.59 -1.71,-1.85 1.32,-2.2 3.43,-1.18 1.87,0.37 2.36,1.37 1.36,1.7 -1.38,2.74 2.65,-2.25 2.47,1.49 3.87,-1.72 1.59,-2.31 2.12,-1.49 3.85,-6.7 1.94,-0.12 0.64,1.6 0.94,0.47 5.33,-0.39 2.72,-0.73 3.86,-4.19 1.14,-1.76 0.55,-2.31 -1.43,-5.49 -0.95,-5.74 -2.65,-3.82 -1.88,-1.14 -1.2,0.16 0.87,-2.45 2.52,0.27 2.97,-1.66 1.09,-2.73 -0.58,-3.03 -2.76,-3.48 -3.83,3.5 -3.33,-0.58 -1.24,1.97 -5.31,3.45 -3.42,4.29 -0.86,1.93 -1.09,0.09 -0.79,-3.75 -3.73,-3.6 -1.12,1.23 1.46,1.93 1.39,0.35 -1.05,2.53 -3.89,-3.33 -2.58,-1.01 -6.72,0.11 -4.42,2.02 -0.83,-0.58 -2.43,2.01 -13.25,-3.42 -2.07,-1.14 -1.78,-2.72 0.04,-1.86 0.79,-0.78 -0.08,-2.67 -1.54,-0.71 -4.29,-5.51 1.88,0.6 2.64,-0.53 0.9,-2.52 3.76,-0.36 -0.41,-0.68 -14.19,-3.72 -6.63,-4 -1.15,-2.48 1.79,-2.5 0.19,1.86 3.8,-2.14 1.99,-2.8 3.77,-0.49 3.71,-4.89 3.97,-2.6 2.1,-0.72 2.34,1.37 4.31,-0.28 0.79,-1 -3.18,-2.2 0.32,-1.23 4.12,-3.45 4.39,-0.79 6.86,-4.3 8.34,-0.8 1.02,1.19 -2.91,-0.03 1.35,1.28 -1.45,4.35 0.1,2.59 -1.59,2.02 3.85,3.71 9.2,-0.44 3.41,1.36 4.24,-0.57 3.19,0.79 1.34,-0.3 2.95,-5.54 1.16,-0.87 2.89,1.75 1.04,-0.57 0.86,1.43 -0.4,-2.99 -0.58,-1.12 -4.83,-2.06 -3.22,1.02 -1.01,-1.16 0.33,-2.31 -3.46,-5.73 -1.44,-1.17 -1.7,-0.06 -1.59,-4.59 2.8,-1.53 1.23,0.83 1.38,3.4 1.3,0.5 -0.38,3.36 1.61,3.09 3.62,2.85 4.96,-1.02 4.22,3.16 1.52,0.32 4.77,-1.34 0.05,-2.51 -0.4,-1.83 -1.12,-1.15 -3.22,0.22 -2.51,-1.89 -2.13,0.52 -3.94,2.89 -5.22,-4.26 -0.25,-2.99 2.92,-5.08 -1.11,-1.2 -2.8,-0.85 -4.84,0.87 -0.21,-2.46 -1.97,2.5 -4.77,-0.26 -6.03,-2.2 -2.15,-2.72 -2.52,-8.33 -2.08,-3.85 -14.35,-13.23 -6.52,-3.36 -3.15,-3.74 -6.26,-2.52 2.74,-2 -1.16,1.56 0.88,0.4 2.16,-1.98 2.26,-11.61 -0.31,-2.78 7.96,0.56 13.73,-2.18 4.95,-3.17 3.78,-4.26 3.76,-7.15 0.5,0.14 0.77,-7.23 1.61,-4.83 12.18,-19.13 1.37,2.5 -3.56,3.22 12.26,-4.8 4.12,-4.81 5.88,-4.94 1.75,0.79 -1.62,3.26 1.14,0.86 -1.02,3.87 2.14,0.06 0.47,1.78 0.58,-7.4 1.5,0.68 3.37,-1.62 -4.09,-0.2 -2.45,-3.55 -1.36,-0.02 4.56,-5.24 4.16,-3.17 1.4,0.65 0.1,0.96 -1.78,1.76 1.01,1.13 2.9,-1.84 4.27,0.09 1.55,-1.45 6.54,-0.67 6.65,-6.25 6.16,-9.85 3.57,-3.16 0.85,0.39 -1.96,1.96 1.11,1.78 9.38,3.85 0.75,2.17 -0.63,2.09 -1.93,2.31 -3.89,2.36 1.19,0.89 0.78,2.09 1.15,0.26 3.33,-2.07 4.7,-7.16 2.53,0.56 3.08,3.36 -1.27,3.24 6.71,3.23 3.15,-2.64 4.79,-0.48 3.01,-1.44 10.61,2.98 0.77,1.26 -2.33,2.66 -0.38,2.74 2.29,1.34 0.19,1.59 0.91,0.4 4.6,-0.12 -2,3.68 8.19,1.13 6.39,-3.1 4.43,2.57 4.59,-2.56 6.84,0.3 6.61,2.88 2.38,3.33 3.82,-1.27 3.11,1.76 1.87,2.9 7.31,1.57 3.62,-0.71 10.49,1.06 7.12,5.06 6.58,0.88 2.3,-1.89 13.63,-2.58 5.81,2.75 4.68,5.44 6.8,3.28 3.31,3.84 4.62,0.09 0,254.4 5.42,1.88 0.83,-1.86 5.46,2.67 3.37,-3.33 6.8,-0.36 0,1.48 -1.21,4.48 1.47,1.87ZM158.04,1032.11l-0.44,0.16 3.71,-3 -3.27,2.84ZM97.13,1101.66l0.17,0.62 6.53,0.56 2.3,-1.92 2.75,-0.77 3.51,2.09 1.19,3.21 4.47,1.56 0.8,1.45 9.54,1.59 -0.52,2.45 -1.03,1.07 -5.83,0.01 -2.22,2.84 -0.13,1.54 -1.2,1.02 -1.62,-4.17 -4.22,-1.87 -0.94,-2.22 -2.9,-2.41 -4.86,-1.87 -6.43,3.07 -3.09,-2.35 -0.31,-2.68 0.82,-4.44 1.13,-0.61 2.09,2.23ZM364.88,1170.44l-1.44,0.19 -0.76,-0.62 0.25,-1.68 0.73,-0.18 0.83,0.56 0.39,1.73ZM82.58,1179l2.46,1.51 1.57,-0.16 1.77,2.29 -4.59,-0.68 -4.99,-3.79 0.3,-1.74 1.41,-0.89 0.72,2.34 1.35,1.12ZM318.34,1181.2l-0.55,0.08 0.74,-1.13 0.51,-2.22 0.68,0.3 0.14,0.41 -1.52,2.56ZM367.98,1179.16l-0.36,1.18 0.34,1.07 -0.82,3 -0.96,0.84 0.12,-1.04 -0.75,0.02 -0.23,-1.6 1.11,-3.69 0.39,0.49 0.81,-1.22 0.35,0.95ZM382.36,1179.17l0.26,0.64 3.06,0.25 -5.61,3.28 -1.22,-2.92 1.62,-1.96 1.89,0.71ZM396.87,1181.77l-0.36,0.56 -1.52,-0.56 1.77,-1.48 0.3,0.3 -0.19,1.18ZM157.75,1180.7l1.04,1.14 2.31,-0.28 1.26,0.73 0.46,2.07 -0.26,3.54 0.93,0.93 0.44,2.62 -4.04,0.53 -1.74,0.91 -0.35,0.68 0.28,1 -0.48,0.26 -1.29,-1.15 -4.16,-1.13 -5.82,-3.27 -3.38,-4.52 2.1,-0.62 4.72,0.38 0.59,-1.82 3.52,-1.98 3.87,-0.02ZM367.09,1193.71l-1.25,0.33 -0.3,-0.67 1.19,-2.61 4.91,-5.51 1.77,-3.97 1.83,0.6 0.71,0.99 -4.11,4.89 -2.05,4.21 -2.7,1.74ZM363.84,1187.99l-0.59,0.7 -2.25,-0.43 0.46,-1.37 1.72,-0.87 1.89,1.35 -1.23,0.62ZM403.16,1193.6l-0.54,0.13 1.92,-3.13 2.38,-1.47 -0.15,0.75 -3.61,3.72ZM217.1,1221.18l-1.72,0.18 -0.7,-2.17 1.65,-1.49 3.09,-1.29 -2.32,4.77ZM313.05,1223.19l-1.72,-1.24 1.98,-1.67 1.08,0.16 0.07,0.88 -1.41,1.87ZM313.83,1225.9l0.42,0.18 0.73,-1.34 1.35,1.1 0.82,-0.24 0.53,1.34 1.19,0.05 -0.09,1.42 -1.44,1.8 -1.82,-1.96 -0.75,0.94 0.29,1.6 -2.6,0.71 -0.38,-1.45 -0.31,0.12 -0.96,2.14 -2.8,1.5 -5.15,-2.01 4.61,-4.53 2.33,0.4 0.03,-1.45 -0.82,-1.54 2.6,-0.64 2.22,1.86ZM515.64,1230.19l5.01,0.39 3.12,5.8 1.62,5.23 -1.16,-0.9 -2.9,-7.28 -0.8,-0.81 -0.64,0.32 0.45,3.21 3.75,6.46 0.19,1.9 -0.6,0.85 0.74,1.75 -0.19,0.67 -1.99,0.78 -1.82,3.22 -1.99,1.88 -1.36,-0.01 -0.67,-1.69 -0.07,-1.2 0.5,-0.77 1.01,-5.27 -1.97,-3.31 -1.38,-9.41 -1.44,-3.99 -0.18,-1.99 0.98,0.75 1.79,3.42ZM519.82,1228.74l-0.08,0.54 -1.55,-0.05 -2.34,-1.83 1.61,-0.9 2.36,2.24ZM503.69,1228.41l1.63,2.11 -0.32,1.92 -0.89,0.41 0.91,1 3.04,-2.85 2.09,0.61 2.37,1.73 0.3,1.35 -0.49,2.9 -1.5,0.5 -1.46,-0.47 -1.22,1 1.01,0.77 3.08,0.18 1.2,2.87 -0.66,2.29 -7.2,-3.93 -0.5,0.34 -0.11,3.61 -0.84,1.28 -2.49,-0.56 -1.89,-4.84 -4.36,-4.24 -1.24,-2.12 0.64,-2.66 1.63,-1.01 0.54,-1.64 2.03,2.6 0.01,-1.2 0.55,-0.95 1.67,-0.17 1.83,-1.35 0.64,0.52ZM308.36,1237.45l0.08,1.17 3.13,-1.71 2.13,0.5 0.11,0.92 -0.76,1.03 0.04,0.66 0.81,1.22 1.99,0.66 0.23,0.8 -2.23,2.59 -6.02,-0.91 -0.64,0.61 2.46,0.33 1.16,2.29 -2.27,0.51 -1.97,1.75 -2.53,0.24 -3.57,3.12 -1.65,0.53 0.98,0.47 0.04,1.44 -1.3,2.14 -2.45,1.74 -0.89,-0.29 -0.22,-0.67 3.16,-3.52 -2.35,-1.26 -1.18,0.6 0.77,-2.11 -2.37,-0.44 -1.56,0.97 1.61,0.2 0.62,1.71 -0.87,1.95 -0.88,-0.19 -1.82,-2.41 -0.81,-3.55 -1.55,-2.73 0.37,-2.33 1.57,-2.4 2.89,-1.67 1.88,-0.28 0.98,0.43 0.4,0.92 -0.15,0.66 0.69,0.56 1.62,3.63 1.34,1.12 -1.26,-2.91 -0.46,-4.09 1.69,-0.1 -0.04,-0.48 -2.42,-2.72 0.74,-1.54 1.66,-0.18 1.94,3 0.42,0 1.11,-1.44 1.97,0.06 0.55,-2.46 -0.65,-1.01 0.74,-0.3 3.53,1.61 -0.54,1.56ZM304.46,1236.89l-0.62,0.44 -2.56,-2.71 0.45,-0.32 1.52,0.82 1.21,1.77ZM512.34,1247.47l1.67,4.1 2.31,9.14 0.11,2.38 -0.53,1.66 0.31,4.54 -0.59,1.77 -1.42,-1.34 -1.98,-4.88 0.16,-1.6 0.95,-1.71 -1.53,0.39 -1.61,-1.35 -0.05,-2.05 -1.38,0.49 -0.52,-0.45 0.17,-2.29 1.32,-1.99 -1.61,-1.13 -0.39,-2.25 -0.91,-1.28 -0.53,0.12 -1.82,4.41 -1.71,0.5 0.51,-1.9 -0.63,-3.78 0.4,-0.78 1.85,-0.78 2.01,-3.8 1.16,0.02 4.28,3.84ZM111.95,1251l-1.18,0.99 -1.07,-0.37 -0.32,-1.02 3.08,-0.82 -0.51,1.22ZM307.12,1252.24l-1.7,0.65 -1.58,1.95 -0.9,-1.07 0.23,-1.68 0.78,-1.11 4.29,0.68 -1.12,0.58ZM530.59,1254.78l0.76,0.65 0.41,-0.68 2.19,0.64 1.33,1.96 -0.06,4.22 -0.51,1.1 -3.7,-4.28 1.96,4.54 0.14,1.71 -0.41,1.12 -4.8,0.21 -0.53,-1.09 -0.36,-5.81 -1.62,-2.64 -1.78,-1.78 0.2,-0.71 1.09,-0.53 5.69,1.37ZM523.5,1258.08l0.73,1.44 1.07,-0.11 1.05,2.71 -0.32,1.04 -1.01,0.37 -0.33,5.97 -0.74,3.36 -0.5,0.55 -0.84,-0.65 -0.63,1.13 -0.76,0.01 -0.63,-2.58 0.56,-4.31 1.27,-0.88 -2.34,-2.55 0.13,-0.77 -1.21,-2.21 0.13,-2.39 1.13,-1.65 1.49,-0.3 1.75,1.82ZM537.64,1264.7l-1.57,0.27 -0.53,-0.25 -0.19,-0.88 1.2,-4.71 2.12,2.28 1,2.25 -2.03,1.04ZM116.56,1262.44l2.33,0.14 0.87,0.71 -1.8,0.99 -1.52,-1.28 0.12,-0.56ZM293.45,1264.92l-1.41,-0.5 0.12,-0.65 1.2,-0.79 1.21,0.12 -0.07,1.22 -1.05,0.6ZM288.05,1266.55l-0.77,0.49 -0.3,-0.58 1.75,-2.5 1.2,-0.81 0.83,0.57 -2.71,2.83ZM544.86,1273.24l-0.24,3.38 -2.68,0.07 -0.59,-0.81 0.16,-1 -0.51,-0.56 -2.37,-0.45 -0.45,-2.45 1.14,-0.88 2.49,-5.29 0.72,0.24 2.84,4.99 -0.51,2.76ZM537.26,1270.42l-1.27,-0.25 -1.66,-2.16 1.54,-1.83 2.94,0.38 -0.03,2.51 -1.52,1.35ZM528.31,1268.53l4.14,0.4 1.38,2.58 -0.17,2.12 3.85,1.94 1.82,2.03 1.91,4.21 2.93,4.15 -3.85,-2.27 -1.37,2.42 2.43,-0.19 2.3,1.99 0.63,1.21 -0.53,1.97 2.3,-0.12 0.32,0.44 -0.27,3.47 0.22,4.54 -0.46,1.55 -1.91,-0.17 -1.73,-3.41 -2.37,-0.89 -0.5,-0.86 -0.33,-2.79 -0.9,0.11 0.21,1.13 -0.24,0.87 -0.89,-0.37 -1.48,-2.78 -2.34,-2.78 0.17,-0.65 1.64,-0.71 -1.4,-2.18 0.56,-1.72 -3.02,-0.34 -0.8,-1.66 -2.1,-0.04 -1.44,-1.9 1.09,-1.04 1.96,0.77 1.94,-2.48 -0.55,-1.99 -0.93,-0.35 -3.56,1.89 -0.66,-0.45 -0.15,-0.7 2.56,-2.98 -0.73,-1.45 -0.05,-2.04 0.37,-0.48ZM557.75,1285.79l-1.18,4.46 -1.2,1.2 -0.84,-0.27 -0.62,-0.97 -1.19,-0.15 -0.34,-0.8 0.33,-1.05 -0.29,-0.8 -0.85,1.35 -1.36,0.84 -1.37,2.66 -0.56,-1.14 -0.4,-3.86 2.26,-3.41 0.26,-4.97 4.05,-2.51 3.09,4.62 0.36,1.17 -0.15,3.63ZM278,1279.1l-0.44,0.64 -0.86,-0.05 -0.65,-0.77 1.64,-1.91 0.31,2.09ZM531.28,1284.7l0.27,0.92 -4.19,4.58 0.17,-2.89 -1.16,-1.67 1.17,-0.85 3.74,-0.09ZM219.76,1289.29l1.51,-1.32 -0.35,1.46 1.09,2.45 -1.38,0.52 -1.06,-0.38 -1.06,0.65 -0.35,-0.57 -0.16,-3.22 1.32,-1.39 0.59,0.5 -0.15,1.3ZM223.81,1288.83l-0.16,1.58 -1.98,-1.5 2.14,-0.08ZM536.32,1297.65l0.28,0.26 0.75,-0.89 1.76,0.67 -0.34,2.69 -0.67,1.42 -1.15,-0.49 -2.3,-2.88 -1.29,-2.28 -1.46,-4.08 -1.9,-0.7 -0.41,-1 0.28,-0.86 1.51,-0.44 2.27,2.23 1.15,2.06 0.16,1.54 1.36,2.75ZM229,1293l-4.03,4.09 0.84,-2.29 -0.21,-1.69 2.16,-1.49 0.7,-1.39 0.56,0.08 -0.31,0.84 0.67,0.78 -0.38,1.07ZM553.65,1293.97l1.22,3.49 -1.98,0.19 -0.45,-0.3 0.16,-1.72 -0.57,-0.77 -1.26,0.19 -0.03,-1.3 0.45,-0.92 -0.26,-2.22 0.75,-0.28 1.23,0.98 0.74,2.66ZM233.07,1292.54l-0.22,1.83 -1.3,-0.29 0.11,-0.99 0.47,-0.03 0.26,-1.83 0.34,-0.17 0.34,1.48ZM234.81,1296.1l-0.67,-0.11 -0.46,-1.6 0.81,0.35 0.32,1.36ZM188.01,1295.94l1.1,3.27 2.78,1.82 0.58,1.06 -3.12,-1.31 -2.56,2.17 -5.58,0.09 -1.84,0.97 -1.92,2.42 -2.13,0.86 -2.64,-0.29 -0.92,-2.46 0.18,-1.24 2.07,-1.66 2.59,-4.24 2.33,0.14 5.31,-2.96 2.27,-0.03 1.5,1.39ZM201.41,1298.58l-1.06,-0.51 -0.49,-1.16 1.93,-1.03 0.35,1.02 -0.73,1.68ZM198.49,1307.34l-0.98,0.43 -1.05,-0.45 -0.9,-0.82 -0.1,-0.98 2,0.64 1.03,1.18ZM164.28,1312.5l-0.61,-0.06 -0.45,-2.21 1.18,-0.61 0.72,1.22 0.91,0.49 -1.75,1.17ZM161.09,1313.78l-2.22,0.46 -0.79,-1.9 0.74,-0.9 1.69,-0.31 2.27,2.08 -1.69,0.57ZM152.29,1317.07l0.49,0.91 0.85,-0.58 1.42,-2.23 1.61,1.28 -2.93,2.84 -0.69,1.63 1.87,-0.38 0.86,0.44 -4.47,3.09 -0.78,1.16 -4.36,1.3 -5.4,2.83 -2.05,-1.22 7.65,-3.87 0.5,-2.1 0.87,-1.2 1.39,0.02 0.85,1.07 0.17,-0.84 0.71,-0.53 -3.75,-1.36 -0.53,-1.72 0.91,-1.34 4.15,-1.23 0.52,0.19 0.14,1.84ZM156.9,1320.49l-0.46,-0.86 1.55,-1.45 -1.09,2.31ZM136.94,1327.73l-3.49,2.04 -2.67,3.69 -6.64,3.99 3.34,-4.02 0.2,-1.97 1,-1.49 3.53,-1.07 -0.19,-2.39 1.24,-1.74 2.44,-1.09 2.79,0.94 0.27,0.44 -0.69,1.86 -1.13,0.81ZM117.28,1337.16l-0.35,1.04 -2.93,-0.26 -0.13,-0.45 1.95,-1.01 1.46,0.68ZM105.43,1342.15l-0.72,0.6 -0.34,-0.96 1.65,-1.81 1.11,0.56 -0.34,1.09 -1.36,0.52ZM60.56,1352.32l-6.1,0.76 -0.93,-0.52 11.25,-3.59 0.54,-0.99 -2.01,-0.89 3.03,-1.92 1.72,1.65 -0.42,1.59 -1.41,0.85 0.66,1.21 -6.33,1.85ZM85.73,1347.92l-1.76,-0.01 1.7,-2.14 1.78,1.09 -1.72,1.06ZM73.35,1350.45l6.03,1.06 -4.98,0.69 -4.27,-0.12 -1.78,-1.39 2.26,0.35 1.56,-0.73 1.18,0.14ZM45.27,1352.93l-0.27,0.54 -1.11,-0.58 -0.48,-0.96 0.33,-0.8 0.89,-0.01 1.16,1.32 -0.52,0.49ZM38.76,1355.43l0.06,0.62 1.71,0.24 -0.17,1.55 -0.66,-0.18 -2.96,2.12 -0.75,-0.84 -1.42,1.32 0.99,-3.43 1.57,-0.91 -0.1,-1 0.54,-1.69 1.15,0.08 0.53,0.69 -0.49,1.43ZM32.45,1358.19l-5.77,0.74 -0.17,-0.45 4.7,-1.91 1.03,-1.93 0.64,-0.35 0.54,0.49 -0.82,1.75 -0.15,1.66ZM24.13,1359.42l-0.53,0.59 -1.51,-1.01 -0.23,-0.34 0.9,-0.48 0.15,-0.86 -2.37,-2.18 0.89,-0.62 1.85,-0.04 1.76,1.44 1.76,0.25 -1.43,0.9 -1.24,2.35ZM45.41,1356.43l-0.96,0.4 -1.26,-0.81 0.12,-0.95 2.1,1.36ZM42.25,1356.81l-0.72,1.08 -0.53,-0.49 -0.2,-1.49 0.4,-0.38 1.05,1.28ZM1052.56,1684.94l-1.51,1.48 -4.36,0.45 2.45,-0.8 -0.76,-1.53 -0.76,-0.55 0.01,-1.48 -1,-1.75 -1.42,4.32 -3,-0.05 -0.99,-20.2 4.57,-41.48 -1.35,-1.27 29.35,0.32 4.81,28.06 2.12,5.82 0.47,1.57 -0.14,0.66 0.73,1.01 -1.29,1.86 -1.01,3.58 -0.01,1.39 0.79,2.73 -0.42,3.69 0.28,2.37 0.69,1.54 -29.43,0.01 -0.09,1.86 2.2,2.9 -0.24,2.16 -0.69,1.33ZM1045.94,1686.59l-2.78,0.16 2.35,-0.44 0.43,0.28ZM1027.36,1608.42l0.18,1.13 -0.85,0.45 -0.18,1.17 -1.31,0.77 -0.56,1 0.2,1.23 -0.47,1.23 -1.12,1.25 -0.48,1.39 0.17,1.55 -0.56,1.24 -1.29,0.94 -0.73,2.05 -1.09,0.66 -0.67,1.26 -0.74,0.45 -0.5,3.1 -0.59,1.24 -1.44,0.79 -0.63,1.44 -1.05,0.87 -0.35,0.83 0.29,1.1 -1.77,1.02 0.37,1 -0.17,1.01 -1.76,2.08 0.4,0.8 -0.48,0.46 0.84,1.97 -0.26,1.97 0.65,1.04 -0.49,2.74 -32.9,0.05 -0.07,-7.38 -1.64,-0.47 -1.89,0.38 -1.44,-1.19 0.51,-24.01 -2.04,-15.66 50.7,0 1,1.83 -0.01,1.06 -2.59,2.78 -0.89,1.5 7.7,-0.12ZM807.28,1672.34l-22.69,0.05 -43.17,-15.87 1.31,-2.92 1.58,-0.14 0.75,-0.51 0.44,-0.94 -0.15,-1.92 -1.79,-1.2 -0.64,-1.33 -0.17,-2.19 0.2,-1.18 1.13,-0.71 0.92,-1.88 0.14,-4.06 2.05,-3.27 2.31,-1.99 -0.37,-0.94 -2.42,-1.84 -0.31,-1.4 -2.42,-4.4 0.23,-6.19 -0.81,-2.69 0.19,-1.2 -0.47,-4.02 -0.62,-1.35 0.82,-1.52 1.86,-0.49 1.13,0.11 1.98,1.64 0.56,0.02 1.6,-2.13 0.03,-11.65 56.81,0.04 -0.01,78.07ZM743.99,1622.54l-0.01,1.16 0.61,1.57 1.81,2.83 0.31,1.4 2.8,2.36 -0.01,0.42 -3.33,3.24 -1.03,2.02 -0.14,4.06 -0.92,1.88 -1.13,0.71 -0.03,3.37 0.64,1.33 1.79,1.2 0.25,0.97 -0.54,1.89 -0.75,0.51 -2.92,0.41 -26.05,2.31 -0.1,-1.56 -0.53,-0.53 -0.68,0.33 -0.22,-3.72 -0.64,-2.19 -1.69,-2.66 -6.97,-5.82 -2.1,-0.5 -0.33,0.63 -1.33,-0.43 0.2,-1.56 -1.29,-2.19 -3.7,-0.09 -3.55,-1.21 -1.05,-0.71 -0.36,-1.29 -3.85,-2.21 -1.22,0.26 -3.87,-0.97 -4.87,-0.03 -1.86,-1.49 0.23,-3.21 -0.44,-1.91 0.34,-1.77 -0.29,-0.63 -2.26,-1.22 -0.31,-0.91 0.28,-1.26 -0.45,-0.83 -1.4,-0.78 -1.31,-1.77 -1.66,-0.97 -0.68,-1.62 -3.65,-5.09 -2.42,-2.5 -0.47,-3.41 1.46,-2.27 -0.2,-1.69 -0.83,-1.24 -3.23,-0.74 -2.62,-3.09 -0.16,-2.37 -1.03,-2.43 -0.17,-3.3 0.78,-0.37 0.7,0.13 0.16,1.91 0.83,0.92 1.49,1.3 1.09,0.33 -3.58,-6.94 0.81,-0.67 2.58,-0.61 6.39,-0.09 -1.14,-0.41 -2.9,0.13 -1.72,-0.7 -1.39,0.84 -2.72,-1.15 -1.03,0.52 -0.13,2.24 0.32,1.67 -0.62,0.17 -4.67,-3.31 -0.76,0.97 0.35,-1.57 -0.11,-1.88 1.14,1.5 -0.35,-1.06 -1.57,-1.57 -0.86,-2.09 -1.91,-1.26 -4.68,-5.42 -0.21,-2.98 -1.15,-3.78 0.48,-2.16 -0.62,-3.85 -3.14,-4.73 -2.45,-2.35 -0.37,-1.78 -0.17,-1.79 1,-3.29 0.34,-0.45 0.38,0.66 0.34,-1.13 -0.33,-0.28 0.98,-2.7 -0.08,-2.81 0.82,-3.45 -0.56,-3.61 -0.52,-1.48 -0.93,-1.05 0.41,-1.54 -0.22,-1.72 48.1,0.01 0.01,44.9 21.32,18.98 40,38.16ZM684,1635.13l2.32,0.7 1.25,-0.33 0.22,0.34 -2.96,0.82 -0.86,-0.37 -0.37,-1 0.4,-0.16ZM679.18,1635.88l-1.54,-0.11 0.84,-0.55 0.7,0.66ZM682.17,1637.34l-1.4,0.01 -0.97,-1.32 2.05,-0.17 1,0.73 -0.68,0.75ZM701.46,1644.62l0.58,1.01 -1.7,-0.07 -0.52,-1.31 -0.76,-0.26 -0.12,-0.44 2.52,1.07ZM689.06,1646.92l-1.2,-0.1 -0.36,-0.73 1.1,0.05 0.46,0.78ZM701.44,1652.2l-1.4,-0.15 -1.33,-2.33 0.37,-0.3 2.36,2.78ZM807.29,1594.27l0,-58.59 79.89,0.01 0.14,58.58 -80.03,0ZM1231.07,1520.32l0.05,7.51 -0.53,2.8 -4.81,0.66 -1.2,-0.31 -1.23,0.55 -5.07,-0.14 -1.13,1.04 -6.9,3.39 -1.05,-1.7 2.71,-1.73 -0.69,-1.16 0.73,-11.58 7.66,0.33 0.01,0.4 0.56,-0.4 10.89,0.34ZM1171.57,1567.03l-1.05,-0.8 0.91,-1 1.26,1.81 -1,1.19 -0.12,-1.2ZM1194.24,1573.35l-7.62,0 -0.88,-18.57 1.23,-1.56 1.89,-0.24 1.02,0.42 -1.9,2.58 0.16,2.42 1.83,2.88 0.23,2.77 0.93,1.85 1.43,2.15 1.1,0.61 -0.46,2.11 -0.66,0.6 1.3,0.19 0.4,1.79ZM1052.56,1684.94l0.69,-1.33 0.24,-2.16 -2.2,-2.9 0.09,-1.86 29.43,-0.01 1.4,3.72 30.08,2.05 0.52,2.28 0.93,0.29 0.94,-1.4 -0.09,-3.36 0.92,-1.09 3.23,0.98 1.93,0.11 0.53,1.2 2.36,11.15 1.65,4.41 2.33,5.31 4.27,7.32 -0.49,0.77 -0.2,2 1.46,4.79 -0.49,-0.44 -1.25,-3.13 0.03,-4.47 -0.29,0.07 -0.69,2.24 -0.44,-1.53 0.49,-1.5 -0.88,-0.7 -0.05,-1.29 -0.77,-0.33 1.02,4.88 5.95,15.1 1.56,2.72 0.54,5.42 -0.97,9.32 -0.37,-0.56 -1.61,3.28 -0.76,3.62 -1.34,1.28 -0.83,-0.04 -2.03,0.96 -1.43,-0.25 -2.83,0.48 -0.64,-1.14 0.35,-1.02 0.44,-0.12 1.5,1.2 0.29,-0.51 -0.46,-0.59 -1.51,-0.7 -2.64,-4.6 -0.22,-1.25 -2.32,-0.77 -1.67,-1.16 -1.09,-2.06 -0.63,-3.67 -1.05,-0.7 1.48,-2.5 -1.04,0.7 -0.57,1.01 -0.79,0 -0.43,-1.93 0.12,-2.39 0.61,-0.89 -1.91,0.31 0.01,1.24 -1.25,-0.4 -1.72,-2.41 -2.04,-4.37 -1.07,-1.26 0.9,-0.32 2.67,-3.99 -0.51,-0.87 -0.6,0.45 -1.56,-1.46 -0.45,0.22 0.89,1.17 -0.16,1.24 -0.57,0.75 -0.62,-0.19 -0.31,0.31 -1.15,-1.76 2.09,-8.26 0.1,-5.21 -1.34,-2.13 -5.93,-5.22 -4.6,-6.21 -3.98,-2.34 -3.02,0.52 -0.52,0.47 -0.31,1.59 -1.9,0.13 -2.85,1.64 -1.01,-0.06 -1.59,0.74 -3.3,0.53 -0.65,-0.19 -0.43,-0.95 0,-0.98 0.88,1.34 0.25,-0.24 0.09,-0.52 -0.53,-1.02 -3.67,-3.23 0.6,0.06 0.15,-0.41 -0.61,-0.54 0.68,-1.29 -1.56,0.56 -0.17,1.02 -4.77,-2.18 -3.18,-0.88 2.44,-0.39 1.32,0.31 -0.47,-0.78 -1.05,-0.38 -2.17,-0.03 -2.63,1.22 -5.94,0.84 0.89,-0.75 1.56,-0.45 0.24,-0.94 -0.37,-0.91 -0.85,0.93 -1.12,-0.51 -0.16,1.12 -1.09,1.51 -2.22,0.6 -0.28,-0.2 0.59,-1.12 -0.47,0.22ZM1081.94,1694.59l-1.15,0.48 -1.23,-0.35 1.32,0.08 3,-1.38 -1.94,1.17ZM1135.65,1725.2l0.19,0.94 -2.34,-5.62 -0.69,-2.67 2.84,7.35ZM1114.07,1734.46l-0.02,0.75 -0.95,-2.64 0.54,0.45 0.43,1.44ZM1114.6,1735.72l-0.41,0.33 -0.82,-0.25 -0.64,-1.29 0.97,1.11 0.9,0.1ZM1133.43,1752.29l-2.26,2.36 1.42,-2.45 1.15,-1.06 0.04,-0.8 1.07,-0.64 -1.42,2.59ZM1130.52,1755.29l-0.31,0.06 0.57,-0.5 -0.26,0.44ZM1125.9,1757.63l-0.52,0.29 -0.54,-0.21 2.35,-0.62 -1.29,0.54ZM1122.59,1758.46l-0.5,0.17 -0.47,-1.42 1.11,0.81 -0.14,0.44ZM1119.95,1759.09l-0.74,0.12 0.6,-0.49 0.19,-0.75 0.34,0.94 -0.39,0.18ZM1117.48,1759.78l-0.31,-0.16 0.83,-0.22 -0.52,0.38ZM1080.81,1676.68l-0.69,-1.54 -0.28,-2.37 0.42,-3.69 -0.79,-2.73 0.01,-1.39 1.01,-3.58 1.29,-1.86 -0.73,-1.01 0.14,-0.66 -0.47,-1.57 -2.12,-5.82 -4.81,-28.06 28.55,0 -2.3,2.71 -0.44,1.35 3.44,2.73 2.34,1.02 2.94,5.77 2.7,2.47 1.63,2.38 2.31,1.92 2.56,4.47 2.3,1.72 1.01,1.8 1.28,4.44 0.99,0.68 1.35,2.39 0.41,2.67 0.69,0.97 2.3,1.07 -0.58,1.14 -2.16,0.89 0.54,1.21 -1.5,1.12 0.32,1.26 -1.02,0.95 0.95,0.1 -1.36,2.14 -0.97,0.24 1.05,1.18 -0.87,1.23 -0.88,-0.37 -0.89,4.32 0.19,1.89 -1.93,-0.11 -3.23,-0.98 -0.92,1.09 0.09,3.36 -0.94,1.4 -0.93,-0.29 -0.52,-2.28 -30.08,-2.05 -1.4,-3.72ZM1121.63,1677.08l-0.5,3.23 -0.24,-2.25 0.74,-0.98ZM234.69,1792.13l-1,0.69 -1.68,-0.41 -2.06,-1.62 0.72,-1.21 1.67,-1.02 2.59,0.04 0.58,1.41 -0.82,2.12ZM225.51,1793.25l-0.23,0.54 -0.39,-0.08 0.15,-1.15 1.37,-1.45 0.59,0.13 -0.36,1.2 -1.13,0.81ZM252.59,1797.96l0.9,-0.02 0.17,0.98 0.8,0.86 -1.86,0.47 -1.17,-0.88 -0.65,0.17 -0.22,-0.63 -0.45,0.13 0.42,0.63 -1.47,-0.03 -1.47,-2.08 -0.39,-1.18 1.71,-0.18 1.17,-1.12 0.66,-0.12 1.85,3ZM259.26,1800.9l5.7,0.74 -0.4,0.63 -1.28,0.57 -1.83,-0.5 -3.06,-0.18 0.46,-1.43 0.41,0.17ZM267.53,1804.35l0.29,0.22 2.09,-0.45 3.27,2.37 -1.33,1.36 -3.43,0.49 -0.34,-0.16 -0.48,-2.23 -0.72,0.14 -0.82,-0.39 -0.93,-1.55 0.46,-0.92 0.82,-0.12 1.12,1.24ZM263.4,1806.3l-0.67,0.34 -0.74,-0.16 -0.88,-1.88 1.24,-0.22 0.7,0.31 0.81,0.9 -0.46,0.71ZM277.83,1827.6l-0.5,0.58 -0.63,-0.04 -2.28,-1.24 -0.28,-0.67 0.17,-3.09 -1.8,-4.44 2.6,-3.19 -0.82,-1.86 0.21,-1.12 0.48,-0.2 7.2,3.42 1.29,1.43 0.22,1.54 0.88,0.2 0.41,1.06 1.69,1.45 -0.52,0.85 -2.31,1.62 -2.92,0.71 -2.57,1.82 -0.52,1.17ZM1007.59,1545.01l-2.73,-2.58 -0.56,-1.09 -45.89,0.34 -1.07,-2.15 0.28,-2.17 -0.14,-2.87 -0.74,-2.5 0.32,-0.64 -0.75,-1.21 0.07,-1.42 -0.44,-0.19 -0.34,-0.98 -0.53,-0.12 -0.32,-4.19 -1.31,-3.29 -1.07,-1.48 -0.69,-1.96 -0.31,-2.42 -1.11,-1.44 -0.66,-2.28 -0.94,-1.1 1.82,-6.22 -0.32,-1.18 -0.84,-0.58 0.33,-1.49 -0.73,-2.5 60.91,-0.08 0.3,1.68 1.16,1.01 0.12,0.83 -0.62,2.74 1.04,4.88 4.34,2.76 1.12,2.55 1.19,0.95 1.58,2.59 2.03,1.76 0.18,1.82 -0.75,2.57 -0.66,0.66 -0.81,2.1 -1.02,1.09 -1.71,1 -4,1.05 -1.25,0.86 -0.38,1.34 0.18,1.13 1.16,1.86 0.12,1.01 -1.69,4 -1.29,1.51 -1.41,0.68 -0.62,1.01 0.04,2.08 -0.59,0.27ZM716.36,1406.78l11.27,0 -0.01,16.97 3.76,5.48 0.32,1.26 -0.23,0.91 0.47,0.93 -0.5,0.86 4.63,3.62 6.29,8.28 1.05,-0.18 0.42,1.12 0.7,0.45 2.57,-0.14 -1.25,7.59 -0.44,0.68 0.08,2.01 0.71,0.87 0.22,1.49 -1.43,1.24 0.3,2.11 -0.38,1.79 2.64,1.43 2.06,-1.48 1.42,-1.86 2.15,1.5 1.2,4.8 2.84,4.46 -0.15,2.01 1.39,1.54 1.19,-0.03 1.06,0.71 0.89,1.61 0.71,2.95 1.66,1.3 1.57,-1.58 3.88,0.44 0.63,-1 1.01,-0.44 8.32,0.25 0.59,-2.66 0.86,-0.56 0.78,0.37 1.63,2.67 1.24,0.91 0.01,39.03 -67.88,0.01 -0.04,-28.16 1.23,-6.11 -0.47,-0.73 -2.12,-0.72 -0.65,-0.85 -0.05,-1.47 3.93,-7.51 0.19,-1.28 3.3,-7.61 0.82,-3 -0.5,-1.32 -3.96,-3.86 -0.7,-1.6 -0.14,-2.89 -1.09,-2.71 0,-43.9ZM1007.59,1545.01l0.59,-0.27 -0.04,-2.08 0.62,-1.01 1.41,-0.68 1.29,-1.51 1.69,-4 -0.12,-1.01 -1.16,-1.86 -0.18,-1.13 0.38,-1.34 1.25,-0.86 4,-1.05 1.71,-1 1.02,-1.09 0.32,-1.18 1.62,-2.66 0.28,-1.49 -0.18,-1.82 -2.03,-1.76 -0.9,-1.7 -2.56,-2.89 41.09,0.31 -2.07,11.23 -3.42,0 -0.13,35.74 -0.89,1.23 -0.04,1.44 -0.37,0.36 1.33,3.81 0.01,2.43 -1.72,3.71 -0.62,0.26 -1.57,2.54 -0.55,-0.04 -0.67,0.7 0.25,1.52 -0.54,0.45 0.18,0.34 -0.62,1.1 0.02,1.11 -0.6,0.88 0.61,1.25 -0.99,1.28 -0.13,1.14 0.37,1.24 -0.94,1 -3.46,1.43 0.55,3.49 -0.29,0.46 -4.56,-1.39 -1.98,0.04 -1,1.15 -0.23,1.57 -1.34,-1.25 -0.32,0.96 -1.29,-1.28 -0.83,-1.58 -0.18,-1.25 0.46,-0.94 0,-0.98 -0.7,-3.02 -3.41,-3.44 -3.98,-2.67 -2.19,-2.68 -0.1,-0.81 0.66,-2.15 2.07,-5.66 -0.97,-0.75 -2.94,-0.73 -1.13,0.56 -0.98,-1.14 -0.84,-2.85 -2.07,-3.01 -5.23,-5.35 -1.4,-5.17 0.03,-1.91 0.65,-2.29ZM1046.28,1582.99l-0.61,-1.25 0.6,-0.88 -0.02,-1.11 0.62,-1.1 -0.18,-0.34 0.54,-0.45 -0.25,-1.52 0.67,-0.7 0.55,0.04 1.57,-2.54 0.62,-0.26 1.72,-3.71 0.13,-1.01 -0.14,-1.42 -1.33,-3.81 0.37,-0.36 0.04,-1.44 0.89,-1.23 0.13,-35.74 31.01,0.02 -0.29,39.88 -0.45,0.76 0.29,0.64 -0.32,0.92 0.84,0.95 -0.12,0.72 -4.2,1.88 -1.56,-0.68 -1.12,0.1 -0.45,0.69 0.23,1.26 -0.39,0.96 -1,0.67 -1.82,2.65 -0.93,0.24 -1.97,3.92 -0.68,0.43 -2.12,-0.75 -1.22,-1.84 -0.53,-0.22 -0.04,0.49 -1.05,0.36 0.1,0.49 -1.72,3.05 -3.07,-1.46 -1.14,0.55 -1.95,1.91 -2.63,-1.7 -1.67,0.03 -0.78,-0.5 -0.64,1.77 -0.81,-0.96 -1.82,-0.23 -0.35,0.2 -0.37,1.56 -1.18,0.07ZM887.32,1594.27l-0.13,-43.63 75.98,0 2.62,1.92 1.5,-0.28 0.62,0.44 0.35,1.78 -1.2,0.73 -0.81,1.39 0.2,1.31 1.2,1.21 1.99,3.42 1.77,1.02 0.05,30.69 -84.14,0ZM1033.62,1594.4l0.23,-1.57 1,-1.15 1.98,-0.04 4.56,1.39 0.29,-0.46 -0.55,-3.49 3.46,-1.43 0.94,-1 -0.37,-1.24 0.13,-1.14 1.22,-1.45 0.95,0.1 0.52,-1.72 2.02,0.19 0.81,0.96 0.64,-1.77 0.78,0.5 0.7,-0.24 3.6,1.91 1.95,-1.91 1.14,-0.55 3.07,1.46 1.72,-3.05 -0.1,-0.49 1.05,-0.36 0.04,-0.49 0.53,0.22 1.22,1.84 2.12,0.75 0.68,-0.43 1.97,-3.92 0.93,-0.24 1.82,-2.65 1,-0.67 0.39,-0.96 -0.23,-1.26 0.45,-0.69 1.12,-0.1 1.56,0.68 4.2,-1.88 0.12,-0.72 -0.84,-0.95 0.32,-0.92 -0.29,-0.64 1.08,-1.25 1.95,0.58 1.87,-0.08 1.59,1.71 0.72,1.6 1.3,0.97 3.24,0.98 1.58,1.19 1.72,-0.73 2.06,1.06 1.75,-0.17 2.31,-1.1 1.36,0.06 1.4,2.46 1.92,1.76 0.12,2.15 -0.45,1.77 2.55,4.64 1.29,2.03 2.02,1.68 1.57,0.44 -4.3,3.48 -3.85,2.27 -0.58,1.28 -1.85,2.02 -1.69,0.86 -1.21,1.19 -6.61,2.49 -31.59,-1.11 -15.15,0.3 -0.34,-0.44 -2.59,-0.26 0.42,2.74 -15.83,0 0.61,-1.25 0.76,-0.4 0.84,0.31 0.61,-0.44 0.83,-2.64 0.08,-1.42 -0.36,-1.15ZM1029.83,1601.34l-0.79,0.03 0.08,-0.73 0.35,-0.03 0.36,0.73ZM978.02,1649.7l32.9,-0.05 0.06,0.67 0.55,0.39 -0.45,2.47 0.49,0.4 -0.65,1.36 0.52,1.82 1.81,2.15 0.08,0.72 -1.56,1.97 -0.2,1.14 -0.73,1.01 -1.48,1.16 -0.98,1.48 -0.98,2.92 -0.53,0.49 -0.27,2.31 -0.33,0.77 -0.68,0.14 -0.14,0.79 0.39,1.43 -0.69,1.44 21.86,0.01 -1.14,3.58 0.18,1.58 1.53,1.97 1.07,3.15 0.8,0.4 -0.77,0.36 -4.16,-1.36 -1.03,-1.09 -2.05,-0.36 -1.22,1.34 -0.92,1.8 2.71,1.47 2.06,-0.4 1.14,-0.88 0.93,0.03 0.85,-0.63 0.79,0.36 0.03,0.36 -1.71,1.44 0.81,1.02 1.28,0.34 0.48,-0.15 0.3,-1.14 0.78,-0.74 1.07,0.16 -0.15,0.47 0.64,1.18 0.03,1.32 -2,0.63 -0.69,0.61 0.36,0.36 -1.4,0.3 -0.43,0.73 0.52,1.06 1.83,1.55 3.79,1.1 0.73,1.14 1.15,0.59 -0.07,0.78 -1,0.58 -0.52,1.06 -0.92,-0.83 -1.59,1.29 0.26,-1.15 -1.02,-1.62 -2.02,-1.41 -1.96,-0.4 -0.29,-1.08 -0.67,-0.55 -3.21,-1.03 0.2,0.75 1.01,0.63 0,1.23 -0.95,2.62 -0.87,0.41 -1.01,-1.97 -0.88,-0.51 -1.41,-0.06 -0.95,0.36 -1.04,1.58 -0.83,0.26 -6.14,-2.06 0.09,-0.42 0.51,-0.13 0.99,0.17 -1.06,-1.82 -0.06,-1.4 -0.93,0.66 -2.09,-0.54 -1.8,-2.5 -1.73,-0.06 -0.78,-1.12 -1.41,0.47 -1.35,1.32 0.87,1.08 -0.28,0.32 -2.01,0.47 -4.67,-0.53 -5.74,-2.38 -5.91,0.12 -1.5,0.58 -0.65,-1.11 0.85,-0.53 0.41,-0.83 -0.24,-0.83 0.95,-1.78 -0.45,-3.06 0.34,-2.82 1.61,-3.51 0.18,-2.4 0.37,-0.55 -0.31,-1.78 -1.23,-1.9 -0.82,-2.55 -0.78,-0.73 -0.44,-3 -2.25,-2.76 0.02,-13.67ZM1032.83,1688.8l0.04,0.61 -1.38,-0.33 1.79,-1.39 -0.45,1.11ZM1037.34,1692.43l-0.32,0.42 0.31,-2 -0.44,-1.69 0.62,1.62 -0.17,1.65ZM1036.64,1693.68l-0.62,0.68 0.81,-1.21 -0.19,0.53ZM1003.59,1696.45l-0.42,0.19 -1.88,-1.14 -0.12,-0.48 1.49,-0.4 1.38,0.97 -0.45,0.86ZM1231.07,1520.32l-10.89,-0.34 -0.56,0.4 -0.01,-0.4 -7.66,-0.33 -0.3,-0.37 2.89,-10.36 21.89,0.77 4.04,-2.62 1.91,-0.08 -0.26,0.8 0.55,1.61 0.52,0.8 1.27,-0.03 0.12,0.75 -2.48,1.09 -2.45,3.41 3.51,1.57 1.37,2.9 -0.44,0.81 1.22,0.74 0.39,2.07 1,0.7 1.49,0.44 3.35,-1.49 -1.24,-3.12 -0.71,-0.5 -0.27,0.43 -0.51,-0.86 1.51,0.2 1.49,1.79 0.5,3.83 -0.17,0.51 -5.19,0.76 -2.87,1.41 -0.11,-2.68 -0.39,-0.07 -3.11,2.53 -1.2,0.16 -1.01,0.74 -0.41,-2.31 0.64,-1.59 -0.97,0.6 -1.22,-1.4 0.04,-1.42 -0.48,-0.17 -0.09,-1.75 -4.7,0.07ZM1245.75,1530.01l-3.13,0.74 -0.5,-0.48 2.43,-1.49 1.03,0.64 0.17,0.59ZM1251.81,1531.68l-0.88,0.25 -2.03,-0.56 1.94,-0.64 0.25,-1.04 0.72,1.99ZM1171.57,1567.03l0.12,1.2 1,-1.19 -1.26,-1.81 -0.91,1 -2.03,-1.61 -2.05,-0.87 -0.29,-0.43 0.31,-1.15 -2.96,-1.96 -0.6,-1.29 0.14,-0.69 -1.05,-1.29 0.19,-0.35 -1.96,-0.47 -0.8,-0.69 -0.95,-0.11 -2.56,0.85 -1.01,1.4 -2.08,-0.24 -1.14,-1.14 -2.2,2.55 -1.18,-0.33 -2.48,2.42 -2.22,1.48 0.12,-7.54 42.02,0.01 0.88,18.57 7.62,0 -0.01,0.42 -0.41,0.88 0.01,-0.64 -0.49,0.05 -0.49,2.2 -0.75,0.18 -1.71,3.14 -2.78,0.38 -0.44,0.65 -2.18,-0.25 0.63,-1.67 -1.51,-1.19 0.73,-1.33 0.06,-1.47 -1.24,1.03 -0.21,-0.59 -0.74,0.76 -1.83,-1.19 -0.95,-1.93 0.35,-1.53 3,-0.03 -2.41,-2.28 -0.75,-0.21 -0.71,0.92 0.46,-1.59 1.51,-0.5 -0.26,-0.92 -0.57,-0.4 -1.02,0.5 0.01,-0.64 0.19,-0.83 1.45,0.27 0.57,-1.34 0.03,-0.6 -0.96,0.87 -0.21,-1.87 0.94,-1.82 0.89,-0.79 2.26,-0.1 -1.45,-0.52 1.48,-1.47 -1.1,0.09 0.13,-1.19 -1.19,0.36 -0.39,1.89 -0.5,0.44 -0.85,0.34 -0.36,-0.87 -0.33,1.71 -0.62,-1.19 -0.32,1.16 -0.53,0.31 -0.17,1.16 -1.7,-0.65 0.92,1.62 0.7,0.48 0.09,0.76 -0.6,0.64 -0.98,-0.51 0.74,1.76 -0.49,2.96 0.41,3.06 1.22,2.37 -0.51,0.11 -1.52,-1.08 -1.2,-2.56 0.1,1.08 0.3,1.21 2.66,2.7 0.86,1.85 -0.09,0.78 -1.29,-1.25 -3.58,-1.3 -1.13,-1.85 -0.24,1.43 -1.27,-2.22 -1.76,0.7 -0.87,-0.16 0.13,-1.94 2.3,-3.45 -0.13,-1.62ZM1192.1,1579.36l-0.31,0.04 1.76,-3.77 -1.45,3.73ZM1262.32,1435.74l0.58,0.98 1.98,0.55 5.14,-1.89 0.22,-0.48 1.39,-0.02 4.88,4.41 0.45,19.11 -0.4,3.25 2.35,1.74 1.86,0.29 0.09,1.18 -0.79,0.91 0.75,1.56 -0.51,1.65 1.79,1.98 0.75,-0.76 1.42,0.5 0.5,2.91 -0.38,0.72 0.08,0.95 1.06,0.28 0.31,0.64 -2.33,2.44 -1.96,-0.34 -2.19,0.83 -0.49,1.09 -0.61,0.23 -2.12,-0.22 -0.77,1.95 -0.63,-0.17 -1.07,1.28 -1.09,-1.88 -1.43,-0.08 -1.09,0.99 -0.88,-1 -0.8,2.03 -0.13,1.94 -0.9,-0.83 -2.28,-0.46 1.16,-1.64 -0.96,-0.19 0.36,-1.86 -0.96,1.37 -1.3,0.82 0.06,1.36 -1.22,2.8 -0.05,1.18 -1.8,1.76 -1.35,-0.23 -2,1.64 -0.41,-1.35 -0.38,1.52 -0.39,0.09 -0.32,-1.79 -0.53,0.62 -0.35,1.62 -0.75,-0.92 -0.14,2.18 -0.73,-0.74 -1.16,0.5 0.1,-1.06 -2.43,1.39 -1.03,1.49 0.76,0.72 -3.62,4.35 -1.38,3.35 -1.04,1 -0.9,-1.46 -0.19,-1.17 -1.03,-1.4 -0.54,-2.03 -1.33,-29.23 1.41,-0.63 0.71,1.14 0.37,-0.13 0.75,-2.17 1.25,-0.38 -0.14,-2 3.19,-3.04 0.15,-1.04 1.27,-1.7 -0.09,-2.48 0.64,-3.18 2.06,-3.13 0.68,-4.44 7.38,-10.71 1.32,-1.89 2.19,0.61 -0.04,2.22ZM1272.18,1484.11l-1.39,0.18 -0.06,1.14 -1.1,-0.71 0.02,-1.11 1.25,-1.47 0.7,0.29 0.58,1.68ZM1267.22,1486.28l-0.89,0.21 -0.02,-0.78 0.3,-0.39 0.61,0.96ZM1029.71,1423.86l2.56,-0.37 7.53,-4.16 2.65,-0.67 2.48,1.33 37.37,22.35 1.1,4.36 2.48,2.98 1.82,-0.96 2.87,-0.45 0.27,0.25 -0.29,1.37 0.71,3.59 1.26,2.33 4.12,-0.53 1.66,2.01 -1.4,2.9 11.85,7.64 4.7,28.32 -3.07,7.79 -0.91,5.18 -0.65,1.77 -3.67,3.7 -2.34,1.31 -0.41,0.76 -0.46,1.67 0.32,2.94 -3.9,3.22 -15.15,0.58 0,-0.89 -27.59,-0.02 2.07,-11.23 -1.32,-12.95 0.15,-5.2 1.24,-6.84 3.62,-12.03 2.03,-3.14 3.09,-2.99 -5.8,-3.65 -3.88,0 -1.47,2.63 -1.99,1.71 -0.46,1.87 -2.2,-0.87 -0.77,-1.95 0.65,-2.08 -2.02,0.17 -0.38,-0.4 0.91,-3.42 -0.16,-1.46 -1.29,-1.21 -2.21,-0.91 0.23,-1.02 -0.63,-1.1 -3.88,-1.11 -3.92,-0.38 -3.21,-1.85 -11.37,-3.16 -1.27,-2.78 -1.26,-0.8 -0.58,0.15 -0.23,-0.6 10.4,-23.7ZM941.79,1406.78l23.48,0.02 0.07,-6.58 2.46,0.36 0.97,0.78 0.58,5.25 1.12,3.36 0.95,1.14 6.44,1.44 2.32,0.89 0.54,1 1.09,0.41 2.78,-0.62 0.98,-0.95 4.34,0.08 5.64,3.03 0.98,2.72 0.75,0 0.57,-0.89 1.44,-0.16 1.9,0.62 1.67,1.78 3.87,2.38 1.49,-0.01 3.91,-2.3 1.45,-0.26 0.86,0.14 1.09,1.64 7.43,-0.23 1.11,1.75 1.06,0.34 4.58,-0.05 -5.23,12.01 -7.92,-0.37 -9.27,6.42 -5.65,3.25 -1.82,-0.55 -1.12,1.52 -0.77,0.17 -0.02,9.51 -4.56,2.87 -2.31,4.09 0.05,1.03 1.54,0.84 0.85,1.79 -0.81,2.52 -0.06,2.69 -0.39,0.63 0.34,2.21 -0.41,2.32 0.34,1.02 1.43,1.29 2.3,0.94 2.29,1.99 2.11,0.99 2.43,3.27 5.22,3.22 0.71,0.86 0.47,2.19 0.38,4.64 -59.26,0.02 0,-28.6 -0.86,-1.2 -1.9,-0.98 -1.76,-3.15 2.69,-2.84 0.66,-2.33 -0.05,-3.21 -0.64,-3.1 -1.29,-2.41 -0.64,-2.9 0.19,-4.51 -0.63,-1.65 -0.38,-9.56 -1.47,-3.92 -0.22,-1.79 -1.35,-4.21 -0.02,-8.71 -1.11,-5.39ZM1027.36,1608.42l-7.7,0.12 0.89,-1.5 2.59,-2.78 0.01,-1.06 -1,-1.83 -50.7,0 -0.04,-37.79 -1.77,-1.02 -1.99,-3.42 -1.2,-1.21 -0.2,-1.31 0.81,-1.39 1.2,-0.73 -0.35,-1.78 -0.62,-0.44 -1.5,0.28 -2.8,-2.05 -0.82,-1.28 -0.33,-1.52 -2.26,-2.45 -1.17,-3.58 45.89,-0.34 0.56,1.09 2.73,2.58 -0.65,2.29 -0.03,1.91 1.4,5.17 5.23,5.35 2.07,3.01 0.84,2.85 0.98,1.14 1.13,-0.56 2.94,0.73 0.97,0.75 -2.07,5.66 -0.66,2.15 0.1,0.81 2.19,2.68 3.98,2.67 3.41,3.44 0.7,3.02 0,0.98 -0.46,0.94 0.18,1.25 1.53,2.53 0.71,0.32 0.2,-0.95 1.34,1.25 0.36,1.15 -0.08,1.42 -0.83,2.64 -0.61,0.44 -0.84,-0.31 -0.76,0.4 -0.85,1.4 -0.54,-0.93 -0.35,0.03 0.11,1.78 -0.81,1.48 0.32,0.71 -1.04,0.72 0.46,0.75 -0.09,0.89 -0.71,1.45ZM1044.78,1622.43l1.01,0.92 -4.57,41.48 0.99,20.2 -3.33,0.2 -2.42,-0.79 -3.63,1.09 -1.1,-0.17 -1.4,1.61 -0.88,0.4 -0.8,-0.4 -1.07,-3.15 -1.53,-1.97 -0.18,-1.58 1.14,-3.58 -21.86,-0.01 0.69,-1.44 -0.39,-1.43 0.14,-0.79 0.68,-0.14 0.33,-0.77 0.27,-2.31 0.53,-0.49 0.98,-2.92 0.98,-1.48 1.48,-1.16 0.73,-1.01 0.2,-1.14 1.56,-1.97 -0.08,-0.72 -1.81,-2.15 -0.52,-1.82 0.63,-0.93 -0.48,-1.55 0.46,-1.75 -0.55,-0.39 -0.1,-1 0.53,-2.41 -0.65,-1.04 0.26,-1.97 -0.84,-1.97 0.48,-0.46 -0.4,-0.8 1.76,-2.08 -0.08,-2.22 1.65,-0.81 -0.29,-1.1 0.35,-0.83 1.05,-0.87 0.63,-1.44 1.44,-0.79 0.59,-1.24 0.5,-3.1 0.74,-0.45 0.67,-1.26 1.09,-0.66 0.43,-0.64 -0.13,-0.78 24.12,0.03ZM750.22,1406.78l114.11,0 0.32,66.64 -80.16,0 -0.01,8.04 -1.24,-0.91 -1.63,-2.67 -0.78,-0.37 -0.86,0.56 -0.59,2.66 -8.32,-0.25 -1.01,0.44 -0.63,1 -3.88,-0.44 -0.81,0.55 -0.5,1.06 -0.9,-0.36 -1.02,-0.97 -0.71,-2.95 -0.89,-1.61 -1.06,-0.71 -1.19,0.03 -1.39,-1.54 0.15,-2.01 -2.84,-4.46 -1.2,-4.8 -2.15,-1.5 -1.42,1.86 -2.06,1.48 -2.64,-1.43 0.38,-1.79 -0.3,-2.11 1.43,-1.24 -0.22,-1.49 -0.71,-0.87 -0.08,-2.01 0.44,-0.68 1.25,-7.59 -2.57,0.14 -0.7,-0.45 -0.42,-1.12 -1.05,0.18 -6.29,-8.28 -4.51,-3.47 0.38,-1.01 -0.47,-0.93 0.23,-0.91 -0.32,-1.26 -3.76,-5.48 0.01,-16.97 22.59,0ZM1102.34,1622.4l-13.77,0.18 0.73,-3.64 2.26,-0.5 0.66,-1.79 1.51,-1.41 4.1,-0.97 4.44,-2.66 1.49,-0.37 1.16,-2.12 0.85,0.06 1.29,-1.16 1.01,-0.25 0.66,1.08 2.94,-2.29 1.28,-0.28 0.93,0.66 0.56,-0.23 1.63,-2.59 1.98,-0.69 0.34,-2.52 0.51,-1.09 64.77,0.84 -0.14,1.73 1.28,2.28 0.53,2.18 -0.72,-0.88 -3.01,-1.46 -0.03,1.88 -1.37,-0.62 0.49,1.04 -1.78,-0.25 -1.08,1.48 -0.92,0.18 -1.36,-0.84 -0.62,-2.17 0.09,3.83 4.18,0.06 1.73,-0.54 1.56,0.3 -0.16,3.92 0.94,-0.44 0.25,-2.44 1.9,-0.84 0.76,2.67 -0.33,1.66 -3.75,3.73 -0.8,0.37 -3.59,-0.6 -0.49,-1.56 -0.51,-0.33 -0.38,0.04 -0.27,1.06 -1.22,0.31 -3.39,-1.34 0.74,0.96 4.31,1.8 0.94,0.82 -1.07,1.64 -0.24,1.11 -1.72,1.15 -0.93,-0.2 -2.38,-2.08 1.09,1.8 0.86,0.76 1.75,0.41 3.28,-0.68 1.08,0.74 -1.76,2.21 -2.17,0.34 -0.29,0.63 -4.56,-0.01 -1.85,1.45 -0.71,-0.24 -0.61,-1.53 -0.01,1.92 0.38,0.9 -4.22,3.34 -1.25,1.86 -0.77,2.88 -0.28,-3.15 -0.2,2.41 -0.49,1.12 -4.46,-0.08 -1.81,0.56 -12.39,-12.67 -12.86,-0.45 -0.1,-1.86 -1.61,-2.09 -1.26,0.66 -0.02,-0.91 -0.46,-0.34 -14.85,-0.77 -4,1.77 -4.22,1.15ZM1184.55,1600.67l0.36,0 1.13,4.54 2.55,5.77 -3.14,-6.36 -0.9,-3.95ZM1187.43,1610.47l-0.17,0.28 -0.75,-1.55 0.77,0.5 0.15,0.77ZM1188.48,1619.08l-1.67,0.26 1.75,-0.8 0.63,-4.1 -0.25,-2.76 0.53,2.87 -0.09,1.62 -0.9,2.91ZM1177.56,1627.37l-0.29,0.15 1.05,-1.72 2.61,-2.53 -3.37,4.1ZM894.67,1406.78l47.12,0 1.11,5.39 0.02,8.71 1.35,4.21 0.22,1.79 1.47,3.92 0.38,9.56 0.63,1.65 -0.19,4.51 0.64,2.9 1.5,3.32 0.43,2.19 0.05,3.21 -84.82,-0.01 -0.25,-51.35 30.34,0ZM887.19,1550.64l-0.01,-14.95 -22.72,-0.01 -0.08,-30.63 63.57,0.01 3.4,2.31 2.03,0.72 0.95,-0.68 2.08,-0.39 5.23,0.22 6.41,3.45 0.48,1.07 0.86,0.68 1.21,0.29 0.77,1.36 0.31,2.42 0.69,1.96 1.07,1.48 1.31,3.29 0.32,4.19 0.53,0.12 0.34,0.98 0.44,0.19 -0.07,1.42 0.65,0.78 -0.17,1.58 0.41,0.36 0.42,4.5 -0.28,2.17 1.98,4.18 0.26,1.55 0.62,1 0.98,0.46 0.66,0.99 0.33,1.52 1,1.41 -75.98,0ZM1234.29,1473.31l1.12,-3.11 1.04,-1.45 1.43,0.49 1.34,-0.55 1.33,29.23 0.54,2.03 1.03,1.4 0.19,1.17 0.9,1.46 -0.5,2.02 -0.33,0.99 -1.91,0.08 -4.04,2.62 -12.94,-0.43 -0.95,-2.43 0.87,-2.36 1.27,-8.57 2.81,-5.97 0.95,-5.31 2.35,-1.17 2.46,-2.23 0.46,-1.49 -0.59,-2.63 1.25,-2.19 -0.08,-1.6ZM1193.82,1550.91l3.86,-2.55 -2.74,-3.75 -0.66,-0.21 -0.72,-1.84 -1.04,-0.79 0.16,-2.69 1.13,-1.22 -0.54,-2.15 2.39,-2.36 1.14,-2.21 1.29,-0.84 8.98,5.51 -1.32,3.55 -1.83,1.63 -0.88,1.79 0.26,1.08 2.18,0.4 0.58,-0.34 0.3,0.78 0.17,1.07 -1.39,8.03 0.17,-3.04 -0.6,0.82 -0.67,3.13 -0.91,1.67 -0.85,1.15 -0.87,-0.19 0.2,0.91 -0.44,1.47 -0.52,0.66 -1.19,0.39 -2.45,4.61 -1.47,0.89 -0.35,-0.13 0.65,-2.87 -1.74,-0.96 -0.98,0.05 -2.47,-1.94 -1.95,-2.22 0.01,-1.64 1.16,-2.78 3.05,-1.2 0.9,-1.67ZM1204.53,1555.39l-1.34,2.24 1.64,-3.21 -0.3,0.97ZM807.28,1672.34l0.01,-78.07 68.79,0 0.01,7.1 -0.48,0.01 -0.27,61.94 -40.99,0.03 1.16,2.43 1.38,0.68 -20.1,-0.14 -0.03,6 -9.48,0.02ZM750.48,1594.23l-0.03,11.65 -1.6,2.13 -0.56,-0.02 -1.98,-1.64 -1.13,-0.11 -1.86,0.49 -0.82,1.52 0.62,1.35 0.47,4.02 -0.19,1.2 0.81,2.69 -0.22,5.03 -40,-38.16 -21.32,-18.98 -0.01,-44.9 67.79,-0.01 0.03,73.74ZM1140.49,1512.22l8.25,-4.08 1.11,-0.95 0.21,-1.11 -1.2,-1.28 -0.46,-1.38 0.08,-2.68 -1.28,-2.95 5.14,-2.49 21.62,-0.06 4.04,-6.77 3.18,-2.92 0.39,-0.98 3.13,-1.8 5.4,-5.68 2.53,-2.04 3.67,-1.68 17.12,-0.02 -0.23,6.54 0.71,2.2 -0.13,3.03 -1.2,3.08 0.59,4.28 -0.47,3.37 0.97,-0.58 0.95,1.16 -0.38,11.54 0.31,0.95 -2.89,10.36 0.3,0.37 -0.73,11.58 0.69,1.16 -2.71,1.73 1.05,1.7 -4.06,3.62 1.31,-4.57 -0.12,-1.75 -0.49,-0.72 -0.5,-0.48 0.59,1.73 0.09,2.16 -8.98,-5.51 -0.65,-1.01 -2.04,-0.77 -1.32,-2.04 -0.02,-2.38 -0.48,-1.02 -1.63,-0.93 -1.28,-1.62 -50.2,-0.04 0.02,-8.27ZM1223,1535.91l-0.81,0.97 0.73,0.1 3.79,-1.99 0.93,0.48 2.26,-0.69 -7.42,3.54 -7.27,2.58 -8.02,1.25 1.14,-1.06 -0.87,-0.15 -0.61,0.79 -0.98,0.26 -0.19,-0.86 1.74,-2.3 2.09,-1.18 0.49,0.49 0.11,-0.65 0.78,-0.58 10.8,-1.09 3.99,-2.43 -2.68,2.52ZM1203.9,1542.86l-0.54,0.07 0.54,-1.44 1.36,-0.52 -0.12,0.94 -1.24,0.95ZM1102.26,1521.27l1.04,1.79 3.87,2.41 2.86,0 13.21,-8.17 8.61,-1.77 0.02,25.48 -1.35,0.65 -0.24,0.6 0.62,1.77 0.03,1.21 -3.08,9.34 -0.02,1.05 -1.01,1.38 -3.41,2.72 -0.8,0.35 -1.21,-0.44 -1.9,1.74 -0.58,0.04 -1.65,2.73 0.25,2.03 -1.32,0.78 -0.61,-1.4 -0.58,-0.32 -0.81,0.71 -1.49,2.84 0.26,1.91 -2.35,2.96 -1.26,0.28 -1.41,-0.52 -2.54,-2.58 -0.41,-1.2 -1.36,-0.06 -2.31,1.1 -1.75,0.17 -2.06,-1.06 -1.72,0.73 -1.58,-1.19 -3.24,-0.98 -1.3,-0.97 -0.72,-1.6 -1.59,-1.71 -2.62,-0.05 -0.53,-0.5 -1.3,0.54 0.29,-38.99 15.15,-0.58 3.9,-3.22ZM971.45,1601.37l2.04,15.66 -0.51,24.01 -2.56,-0.7 -5.76,-3.56 -1.8,1.17 -1.71,-0.17 -0.8,-0.8 -2.16,1.1 -1.79,-0.25 -2.25,0.83 -2,1.52 -3.15,-1.89 -0.17,-0.77 -1.59,0.7 -1.15,-0.39 -0.98,-0.97 -1.48,1.33 -0.63,1.67 -0.83,-0.69 0.07,-1.17 -0.33,-0.37 -2.09,0.91 -1.96,-1.16 -0.8,-1.04 -2.29,1.59 -0.9,-0.04 -0.34,-1.27 -1.34,-0.95 -0.33,-1.44 -2.93,0.05 -1.11,0.87 -1.76,-1.14 -1.39,0.2 -4.86,-1.06 -1.09,-2.27 -1.22,-0.93 -0.51,0.88 -2.58,0.05 -2.67,-2.14 -1.51,-0.6 -0.04,-26.77 -34.1,0 -0.01,-7.1 95.38,0 -0.01,7.1ZM682.66,1520.5l-48.1,-0.01 -1.45,-1.87 -0.74,-3.97 0.16,-3.12 -1.51,-3.55 2.19,-8.24 1.7,-1.28 -1.03,0.22 1.58,-4.43 0.57,-10.16 0.59,-1.46 -0.14,-5.63 1.48,-12.9 -0.36,-4.33 0.16,-4.88 -0.48,-1.29 0.88,0.61 2.71,-0.01 1.73,-0.65 2.27,1.29 2.29,-0.57 0.89,0.31 1.14,0.74 1.13,2.24 1.33,4.97 0.87,0.75 5.09,0.59 1.33,-0.18 2.31,-1.42 2.5,-0.46 2.96,0.1 1.82,0.4 0.66,0.71 1.58,0.07 7.9,-1.4 4.74,-1.84 5.75,-1.57 2.87,-0.18 1.79,-0.91 24.16,-0.02 1.5,2.11 2.77,2.46 0.5,1.32 -0.82,3 -2.14,4.65 -1.35,4.24 -3.93,7.51 0.05,1.47 0.65,0.85 2.12,0.72 0.47,0.73 -1.23,6.11 0.04,28.16 -33.95,0ZM1131.85,1515.53l3.11,-0.64 5.53,-2.67 -0.02,8.27 50.2,0.04 1.28,1.62 1.63,0.93 0.48,1.02 0.02,2.38 0.8,1.53 2.56,1.28 0.65,1.01 -1.29,0.84 -1.14,2.21 -2.39,2.36 0.54,2.15 -1.13,1.22 -0.2,1.28 0.04,1.41 1.04,0.79 0.72,1.84 0.66,0.21 2.74,3.75 -3.28,2.04 -1.7,1.82 -2.82,1.18 -2.43,-0.36 -1.71,1.74 -53.87,-0.01 -0.02,-39.24ZM1230.59,1530.63l0.53,-2.8 -0.05,-7.51 4.7,-0.07 0.09,1.75 0.48,0.17 -0.04,1.42 1.22,1.4 -0.43,0.38 -1.35,-1.74 0.3,1.42 -0.72,1.05 -0.19,2.73 -0.9,1.14 -3.64,0.66ZM1237.43,1528.25l-1.19,0.35 0.75,-2.3 0.55,-0.52 -0.11,2.47ZM1236.02,1528.35l-0.31,0.29 0.1,-1.58 0.33,0.43 -0.12,0.86ZM1127.85,1662.96l-2.3,-1.07 -0.69,-0.97 -0.41,-2.67 -1.35,-2.39 -0.99,-0.68 -1.28,-4.44 -1.01,-1.8 -2.3,-1.72 -2.56,-4.47 -2.31,-1.92 -1.63,-2.38 -2.7,-2.47 -2.94,-5.77 -2.34,-1.02 -3.44,-2.73 0.44,-1.35 2.22,-2.7 4.3,-1.16 4,-1.77 14.85,0.77 0.46,0.34 0.02,0.91 1.26,-0.66 1.61,2.09 0.1,1.86 12.86,0.45 12.39,12.67 -4.05,2.99 -2.48,3.45 -0.63,2.2 -0.51,-0.92 0.14,-1.27 -0.63,1.22 0.6,1.77 -0.53,0.68 -1.64,1.26 -1.9,0.57 -0.32,1.24 -2.16,1.65 -1.46,-0.31 0.45,1.1 -0.54,0.83 -0.92,0.64 -2.37,0.59 -1.51,1.02 -2.38,-0.44 -0.71,0.29 1.82,1.2 -0.13,0.96 -1.06,0.87 -0.33,-0.08 -0.45,-1.39 -0.7,0.8 -1.06,-1.5 0.05,1.14 1.18,1.99 -0.73,0.99 -1.03,0.38 -0.27,1.13ZM950.57,1497.24l-1.65,0.06 0.73,2.5 -0.33,1.49 0.84,0.58 0.32,1.18 -1.88,5.8 1,1.52 0.66,2.28 -1.73,-0.89 -0.48,-1.07 -1.47,-0.98 -4.94,-2.47 -5.23,-0.22 -2.08,0.39 -0.95,0.68 -2.03,-0.72 -3.4,-2.31 -63.57,-0.01 -0.09,-31.63 0.37,-0.2 -0.08,-15.09 84.82,0.01 -0.66,2.33 -2.69,2.84 1.76,3.15 1.9,0.98 0.86,1.2 0,28.6ZM1073.79,1622.4l-29.2,-0.33 0.19,0.36 -24.12,-0.08 1.72,-1.52 0.56,-1.24 -0.17,-1.55 2.07,-3.87 -0.2,-1.23 0.56,-1 1.31,-0.77 0.18,-1.17 0.85,-0.45 -0.23,-0.87 0.85,-2.6 -0.46,-0.75 1.04,-0.72 -0.32,-0.71 0.64,-0.72 -0.02,-1.81 17.04,0.02 -0.42,-2.74 2.59,0.26 0.34,0.44 15.15,-0.3 31.59,1.11 23.57,-0.34 -0.51,1.09 -0.34,2.52 -1.98,0.69 -1.63,2.59 -0.56,0.23 -0.93,-0.66 -1.28,0.28 -2.94,2.29 -0.66,-1.08 -1.01,0.25 -1.29,1.16 -0.85,-0.06 -1.16,2.12 -1.49,0.37 -4.44,2.66 -4.1,0.97 -1.51,1.41 -0.66,1.79 -2.26,0.5 -0.73,3.64 -14.78,-0.18ZM972.98,1641.04l1.44,1.19 1.89,-0.38 1.64,0.47 0.05,21.05 2.25,2.76 0.44,3 0.78,0.73 0.82,2.55 1.23,1.9 0.31,1.78 -0.37,0.55 -0.18,2.4 -1.61,3.51 -0.34,2.82 0.45,3.06 -0.95,1.78 -0.54,-0.04 -1.19,2.17 0.64,1.64 -2.39,0.25 -7.5,3.74 0.1,-0.44 2.55,-1.7 -2.87,0 0.62,-1.4 -0.2,-1.24 -1.03,-0.04 -0.66,1 -1.51,-0.34 0.34,2.25 1.19,2.09 -2.85,2.65 -0.15,1.15 -1.38,1.5 -6.6,4.2 -4.34,1.96 2.55,-1.85 -4.13,-0.32 -0.85,0.81 -1.45,-1.58 -0.73,0.09 1.31,2.86 1.18,0.4 -1.6,1.17 -1.3,0.33 -1.11,-1.04 -0.38,2.61 -0.37,0.33 -0.59,0.48 -0.48,-0.87 -0.93,0.79 -1.6,0.25 0.17,1.07 1.21,-0.42 -0.44,1.39 -1.12,1.37 -0.91,0.32 -1.39,-0.2 -0.65,0.42 1.62,2.15 -1.71,4.39 -0.96,0.18 -2.79,-1.84 0.87,2.18 2.36,0.64 0.1,1.53 -0.9,1.92 1.37,6.14 2.51,5.3 0.72,0.03 0.12,0.45 -0.07,0.87 -1.54,0.25 -0.87,0.9 -2.61,-1.44 -2.43,-0.73 -5.39,-0.88 -1.17,-0.9 -3.57,-1.19 -0.84,-0.82 -3.9,-1.35 -1.39,-4.01 -2.57,-3.76 0.18,-1.45 -0.79,-2.18 0.27,-0.74 -0.22,-1.92 -2.83,-2.34 -4.07,-5.7 -2.1,-2 -0.4,-2.26 -2.48,-4.14 -1.24,-3.21 -1.09,-1.49 -2.98,-2.84 -0.26,-0.78 -3.01,-2.27 -0.87,-1.42 -1.87,-0.54 -0.02,-0.32 -5.06,0.16 -3.16,-0.99 -0.85,0.08 -0.48,0.77 -1.03,0.49 -1.58,0.22 -1.36,1.42 -1.13,2.61 -0.5,1.68 0.14,0.75 -2.56,2.82 -0.89,0.56 -1.01,-0.03 -1.88,-0.91 -4.9,-2.87 -1.55,-0.42 -4.68,-3.27 -2.52,-3.68 -0.67,-1.79 0,-1.89 -2.69,-5.92 -6.78,-5.26 -5.81,-5.55 -1.41,-0.71 -3.28,-4.19 -1.48,-0.73 -1.16,-2.43 40.99,-0.03 0.27,-61.94 34.58,-0.01 0.04,26.77 1.51,0.6 2.06,1.76 0.61,0.38 2.58,-0.05 0.51,-0.88 1.22,0.93 1.09,2.27 4.86,1.06 1.39,-0.2 1.76,1.14 1.11,-0.87 2.93,-0.05 0.33,1.44 1.34,0.95 0.34,1.27 0.9,0.04 2.29,-1.59 0.8,1.04 1.96,1.16 2.32,-0.82 -0.07,1.13 0.63,0.97 0.53,-0.18 0.4,-1.45 1.48,-1.33 0.98,0.97 1.15,0.39 1.59,-0.7 0.17,0.77 3.15,1.89 2,-1.52 2.25,-0.83 1.79,0.25 2.16,-1.1 0.8,0.8 1.71,0.17 1.8,-1.17 5.76,3.56 2.56,0.7ZM966.66,1701.08l-0.57,0.13 3,-2.68 0.67,0.03 -3.1,2.52ZM947.04,1713.96l-0.42,0.05 0.52,-0.69 4,-2.32 -0.11,0.57 -3.99,2.39ZM944.19,1717.19l-0.24,0.04 0.65,-1.48 1.38,-1.54 0.2,0.57 -1.99,2.41ZM940.33,1724.92l-0.35,0.73 1.02,-3.59 1.88,-3.29 0.79,-0.55 -2.17,3.61 -1.17,3.09ZM942.41,1739.45l-0.15,0.59 -2.48,-8.99 0.18,-4.81 0.4,5.05 2.05,8.16ZM807.29,1594.27l-56.81,-0.04 -0.03,-73.74 34.04,0 0.01,15.19 22.79,0 0,58.59ZM1170.52,1566.23l1.05,0.8 -0.18,1.65 -2.44,2.57 -0.61,2.95 0.93,0.82 2.11,-0.24 1.6,2.32 4.06,1.48 0.88,1.2 2.36,1.7 -0.47,2.48 -0.44,0.66 -1.68,-0.1 -3.83,-4.02 -1.27,-1.93 -1.94,-1.02 2.11,1.92 4.28,5.24 2.77,1.4 -0.7,0.6 1.12,0.5 0.06,1.98 -1.56,-0.42 0.09,1.23 -0.7,0.38 -0.96,-0.51 -2.49,-2.81 0.22,0.81 1.45,1.81 3.23,2.48 0.5,1.38 -1.34,0.87 -2.29,-2.16 -0.33,-1.13 -0.83,0.06 -3.45,-1.43 -2.77,-0.16 6.58,2.23 0.44,1.79 1.47,1.23 0.19,0.91 1,0.1 1.77,-0.89 2.79,0.57 1.61,5.14 -65.81,-0.63 -3,-0.33 -0.54,0.29 -19.51,-0.1 5.89,-2.23 1.21,-1.19 1.69,-0.86 1.85,-2.02 0.58,-1.28 3.85,-2.27 4.3,-3.48 -0.07,0.96 1.09,2.05 3.26,1.74 2.72,-1.8 1.95,1.01 2.99,-0.69 0.82,-1.58 1.41,0.3 2.41,-0.98 0.49,0.52 1.06,-0.57 1.43,-2.12 -0.45,-0.81 0.45,-1.07 3.12,-4.25 0.78,-1.95 2.14,-3.24 0.86,-2.44 0.96,0.19 0.57,0.99 1.24,0.53 1.77,-0.32 2.27,-4.56 0.56,-0.44 1.4,0.03 3.27,-2.65 1.66,-2.37 1.29,-4.28 5.53,4.51 1.24,-2.96 2.19,1.19 0.63,0.66 -0.31,1.15 0.29,0.43 2.05,0.87 2.03,1.61ZM1187.17,1580.61l0.44,-0.65 2.78,-0.38 -2.51,5.68 0.11,1.04 -1.27,0.6 -1.29,1.31 -1.39,3.91 -0.72,-1.6 0.25,-1.93 0.99,-3.16 1.92,-2.91 0.69,-1.91ZM1191.79,1579.4l0.31,-0.04 -1.22,2.2 -0.52,0.23 1.43,-2.39ZM1213.42,1473.35l20.87,-0.04 0.08,1.6 -1.25,2.19 0.59,2.63 -0.46,1.49 -2.46,2.23 -2.35,1.17 -0.95,5.31 -2.81,5.97 -1.27,8.57 -0.87,2.36 0.95,2.43 -8.95,-0.34 -0.31,-0.95 0.38,-11.54 -0.95,-1.16 -0.97,0.58 0.47,-3.37 -0.59,-4.28 1.2,-3.08 0.13,-3.03 -0.71,-2.2 0.23,-6.54ZM650.94,1406.78l65.42,0 0,43.9 1.09,2.71 0.24,1.13 -0.3,0.64 0.59,2.01 -24.16,0.02 -1.79,0.91 -2.87,0.18 -5.75,1.57 -4.74,1.84 -7.9,1.4 -1.58,-0.07 -0.66,-0.71 -1.82,-0.4 -2.96,-0.1 -2.5,0.46 -2.31,1.42 -1.33,0.18 -5.09,-0.59 -0.87,-0.75 -1.33,-4.97 -1.13,-2.24 -1.14,-0.74 -0.89,-0.31 -1.14,0.41 -2.78,-1.93 -2.11,0.05 -0.43,-0.52 -2.36,0.52 -0.73,-0.54 -1.28,0.35 0.32,-5.37 1.12,2.85 0.65,-3.77 -2.08,-1.4 -0.46,-1.96 3.06,-1.68 -3.06,-1.2 -0.31,1.35 -0.68,-4.25 -1.25,-3.29 -0.76,-4.28 -0.96,-2.12 -1.83,-2.03 -0.48,-1.19 -0.53,-6.93 8.35,3.62 7.75,0.83 1.51,-0.59 2.14,1.38 2.22,-1.09 1.39,4.36 -1.39,2.42 -0.26,0.05 -0.22,-0.98 -2.61,4.07 -1.01,2.8 0.4,0.63 2.07,-1 -1.65,0.14 0.08,-0.91 0.88,-1.78 1.92,-1.67 2.34,-3 0.26,-1.57 0.6,0.14 0.1,2.55 -1.21,1.3 0.19,1.3 -0.7,0.06 1.34,2.51 -0.23,2.86 -0.81,0.19 -0.67,-0.58 -0.68,1.64 -0.69,-1.98 -1.04,0.78 -1.23,2.53 2.45,-0.12 1.25,0.59 1.12,-0.94 0.7,-1.82 1.39,-0.61 0.76,-1 -0.17,-3.91 -0.48,-0.82 0.31,-1.08 -0.21,-1.15 1.82,-3.84 -1.98,-2.95 0.24,1.7 -1.39,-1.29 -0.04,-1.19 1.33,-0.68 -0.06,-0.42 -1.51,-2.01 -1.45,-0.93 0.47,-0.56 1.49,-0.13 -0.18,-2.82 -0.56,-1.87 -1.04,0.24 -0.37,-0.52 -1.17,-3.44ZM651.01,1412.31l0.15,0.38 -0.78,0.42 -0.74,-0.66 0.12,1.21 -1.26,-0.99 1.2,-1 1.31,0.64ZM648.38,1415.27l0.3,0.56 -1.74,-0.68 -0.25,-1.69 0.54,-0.12 1.15,1.93ZM650.57,1416.46l-1.14,-0.44 0.1,-1.39 0.49,-0.18 0.55,2.01ZM653.39,1421.16l0.56,2.24 0.24,-0.93 1.55,1.61 -0.19,1.05 -1.98,-1.17 -0.74,-2.71 -1.36,-1.26 1.29,-2.72 1.06,1.08 -0.08,0.47 -1.76,1.11 1.13,0.48 0.28,0.75ZM654.25,1430.7l-0.89,-0.42 0.3,-1.43 0.47,0.36 0.12,1.49ZM655.43,1434.05l-0.49,0.68 -0.36,-0.59 -0.47,0.54 0.27,-2.2 1.05,1.57ZM650.2,1437.25l-0.26,0.31 -0.36,-0.67 0.26,-0.81 0.36,1.17ZM1016.6,1512.62l-0.43,-1.5 -4.34,-2.76 -0.55,-1.45 -0.49,-3.43 0.62,-2.74 -0.12,-0.83 -0.7,-0.44 -0.68,-1.27 -0.93,-7.81 -0.71,-0.86 -5.22,-3.22 -2.43,-3.27 -2.11,-0.99 -2.29,-1.99 -2.3,-0.94 -1.43,-1.29 -0.34,-1.02 0.41,-2.32 -0.34,-2.21 0.39,-0.63 -0.08,-2.03 0.95,-3.18 -0.85,-1.79 -1.54,-0.84 -0.05,-1.03 2.31,-4.09 4.56,-2.87 0.02,-9.51 0.77,-0.17 1.12,-1.52 1.82,0.55 5.65,-3.25 9.27,-6.42 7.92,0.37 -5.17,11.69 0.23,0.6 0.58,-0.15 1.26,0.8 1.27,2.78 11.37,3.16 3.21,1.85 3.92,0.38 3.88,1.11 0.63,1.1 -0.23,1.02 2.21,0.91 1.29,1.21 0.16,1.46 -0.91,3.42 0.38,0.4 2.02,-0.17 -0.65,2.08 0.77,1.95 2.2,0.87 0.46,-1.87 1.99,-1.71 1.47,-2.63 3.88,0 5.8,3.65 -3.09,2.99 -2.03,3.14 -3.62,12.03 -1.24,6.84 -0.15,5.2 1.32,12.95 -41.09,-0.31ZM1115.42,1586.57l-1.57,-0.44 -2.02,-1.68 -3.51,-5.95 -0.33,-0.72 0.45,-1.77 -0.39,-2.56 1.31,0.49 2.04,-0.94 0.31,-1.06 1.26,-1.24 -0.26,-1.91 1.49,-2.84 0.81,-0.71 0.58,0.32 0.61,1.4 1.32,-0.78 -0.25,-2.03 1.65,-2.73 0.58,-0.04 1.9,-1.74 1.21,0.44 0.8,-0.35 3.41,-2.72 1.01,-1.38 0.02,-1.05 3.08,-9.34 -0.03,-1.21 -0.62,-1.77 0.24,-0.6 1.35,-0.65 0,13.76 11.85,0 -0.12,7.54 2.22,-1.48 2.48,-2.42 1.18,0.33 2.2,-2.55 1.14,1.14 2.08,0.24 1.01,-1.4 2.56,-0.85 0.95,0.11 0.8,0.69 1.96,0.47 -0.19,0.35 1.05,1.29 -0.14,0.69 0.74,1.4 -1.24,2.96 -5.53,-4.51 -1.29,4.28 -1.66,2.37 -3.27,2.65 -1.4,-0.03 -0.56,0.44 -2.27,4.56 -1.77,0.32 -1.24,-0.53 -0.57,-0.99 -0.96,-0.19 -0.86,2.44 -2.14,3.24 -0.78,1.95 -3.12,4.25 -0.45,1.07 0.45,0.81 -1.43,2.12 -1.06,0.57 -0.49,-0.52 -2.41,0.98 -1.41,-0.3 -0.82,1.58 -2.99,0.69 -1.95,-1.01 -2.72,1.8 -3.26,-1.74 -1.09,-2.05 0.07,-0.96ZM864.46,1535.68l-79.96,0 -0.01,-62.26 79.8,0 0.17,62.26ZM3705.84,1830.6l-0.35,0.45 -0.37,-0.98 0.7,0.2 0.02,0.33ZM3705.88,1859.53l-0.61,0.03 -0.31,-0.5 0.73,-0.02 0.19,0.49ZM3700.79,1885.25l-0.56,0.55 -0.72,-0.62 0.91,-0.3 0.37,0.37ZM3706.62,1838.8l-0.55,0.26 0.89,-1.38 0.32,0.43 -0.66,0.69ZM3706.33,1873.78l-0.03,0.31 -0.74,-0.21 0.33,-1.07 1.24,-0.59 -0.8,1.56ZM3705.31,1875.7l-0.47,0.6 -0.39,-1.31 0.44,-0.35 0.25,0.01 0.17,1.05ZM1310.21,1835.79l-0.86,0.11 -1.17,-0.56 1.53,-0.08 0.5,0.53ZM1312.32,1835.5l-1.46,0.16 0.4,-0.37 1.06,0.21ZM1311.11,1842.2l0.95,0.53 1.16,0 -1.21,0.53 -2.3,0.05 0.05,-0.84 1.35,-0.27ZM3694.84,1895.77l-0.48,0.02 -0.56,-0.65 -0.01,-1.35 1.6,-1.15 0.53,-1.11 0.44,0.09 0.74,0.52 -1.83,1.86 -0.43,1.77ZM105.51,2213.02l-0.48,0.1 -0.59,-0.56 1.5,-0.64 1.37,0.11 -0.82,0.18 -0.98,0.81ZM1295.59,1834.42l0.7,0.2 -0.28,-0.49 0.26,0 5.02,1.05 0.09,1.66 -3.98,3.21 -3.12,0.33 -6,-0.47 -1.45,0.46 -3.38,-0.55 0.28,-2.76 -1.05,-1.68 1.05,-0.85 0.15,-0.77 1.13,-0.27 9.91,0.56 0.67,0.37ZM1303.6,1838.48l-1.47,-0.02 -0.2,-0.36 1.09,-0.33 2.07,0.38 -1.49,0.33ZM1275.76,1839.03l-0.66,-0.32 0,-0.34 0.99,0.05 -0.33,0.61Z`,yKe=`M1102.45,1516.11l0.32,0.17 -0.35,3.14 3.11,1.13 2.15,-0.62 1.52,1.61 0.57,-1.92 0.57,-0.7 6.11,-3.25 -0.14,0.89 0.23,-0.02 1.55,-2.9 3.71,-2.83 4.15,-0.5 10.76,1.79 0.36,-0.12 -4.43,-0.91 2.63,-2.49 1.38,-0.44 8.11,-1.21 3.75,0.28 1.53,-0.95 -1.34,-1.52 -0.3,-1.32 1.95,0.75 -0.33,0.94 0.53,3.08 -3.78,3.78 -5.63,3.93 -7.17,3.98 -10.17,4.13 -5.63,3.95 -4.53,0.28 -4.08,1.44 -1.85,-1.05 -4.38,0.19 3.73,-1.01 -1.49,-0.89 -1.51,0.57 -5.61,-3.05 1.07,-2.1 2.12,-2.58 0.01,-1.5 0.8,-2.15Z(M1149.27,1505.2l0.33,0.06 0.51,-1.02 -1.12,0.03 0.28,0.93Z(M1107.76,1524.37l-0.18,-1.23 -0.35,1.4 0.53,-0.17Z(M1185.72,1481.69l0.12,0.41 -0.64,0.98 -5.92,4.63 0.53,0.99 1.51,-0.57 0.22,0.54 -0.44,0.66 1.39,0.08 -1.46,1.96 -0.43,0.06 0.04,-0.38 -0.59,0.4 0.76,1.76 0.17,2.88 -3.07,1.06 -2.84,2.58 -1.85,0.44 -0.89,0.79 -3.5,-0.48 -2.94,0.42 -3.52,-1.4 -3.83,-0.59 -5.85,0.52 -7.38,2.56 -4.44,-0.86 -0.51,-0.75 2.32,-4.35 3.03,-1.75 2.76,-2.29 15.18,-2.75 0.5,-0.56 1.51,0.31 -0.21,0.28 0.74,0.71 2.77,-0.02 -0.63,0.27 0.54,0.4 0.88,-0.42 -0.21,1.14 1.75,-0.12 2,-0.94 0.1,-0.35 -1.98,0.21 2.06,-2.35 -2.73,0.85 -0.16,-0.52 0.38,-1.09 -0.36,-0.39 -1.78,0.54 -0.28,0.65 -0.4,-0.1 -0.01,-0.78 -2.87,0.93 3.8,-1.49 2.18,-0.26 0.44,0.13 -0.15,0.64 0.27,0.06 1.29,-0.55 -1.89,1.52 0.81,0.27 3.45,-2.28 3.19,-0.7 5.3,-2.36 1.26,-1.27 0.51,0.09Z(M1175.47,1487.21l0.51,-0.98 -1.9,0.94 1.39,0.04Z(M1180.16,1489.25l0.15,0.29 0.36,-0.6 -0.51,0.31Z(M1180.59,1485.7l0.12,-0.34 -2.32,0.43 -0.6,0.77 -0.01,0.8 0.7,0.1 1.06,-1.37 1.05,-0.39Z(M1130.62,1730.2l-1.29,2.42 -0.47,0.08 -1.27,-0.78 -2.11,-2.6 2.4,-2.44 1.27,-0.45 1.18,1.64 0.29,2.13Z(M773.99,1535.66l0.15,0.92 -1.56,0.91 -1.05,1.68 -2.05,1.03 -1.23,-3.65 -0.78,1.57 -0.38,-0.14 -1.69,-2.57 -0.97,-3.09 -1.68,-2.33 -0.6,-3.34 1.93,-0.91 1.17,-0.03 0.39,0.86 -0.34,1 1.52,1.6 0.87,0.16 1.03,3.06 0.8,-0.45 -0.41,-2.78 0.33,-0.38 1.48,0.98 2.04,-0.11 -0.14,0.8 -1.87,0.03 -0.72,0.95 2.52,3.29 1.24,0.94Z(M771.74,1537.58l0.18,-1.21 -0.49,-1.52 -0.43,-0.2 -0.3,0.17 0.15,1.41 0.89,1.35Z(M1083.59,1460.59l-2.49,0.42 0.3,0.38 -0.25,0.6 -1.26,1.65 0,1.6 1.8,1.53 -3.34,0.92 -1.74,1.28 -0.15,3.94 -1.82,4.19 0.63,-3.58 -0.46,0.31 -0.67,2.56 -0.33,0.19 -0.29,-0.54 0.93,-5.94 -0.58,0.22 -2.74,3.73 -0.6,-0.24 -1.67,0.97 -0.78,2.7 -1.51,0.78 0.19,2.37 -0.62,3.51 -2.56,4.38 0.83,2.07 0.12,1.75 -1.19,2.77 2.43,6.47 1.22,5.04 -0.43,5.72 -1.68,4.73 -2.57,4.79 -1.88,1.88 -4.1,2.16 -2.25,0.05 -1.8,-1.18 -2.05,-5.56 -1.17,-1.95 -0.17,-5.1 0.35,-3.26 -1.21,-4.02 -0.16,-3.63 1.15,-4.59 1.15,-2.91 -0.34,-2.01 0.34,-1.98 1.1,-2.35 0.78,-0.78 0.25,-0.89 -0.17,-2.47 2.17,-6.24 -0.94,-1.44 -2.1,0.3 -2.09,3.13 -2.06,1.59 -0.57,-0.3 -0.11,-0.75 0.88,-2.33 1.38,-2.87 2.31,-1.45 0.39,-2.34 5.44,-8.35 1.5,-3.67 -0.11,2.09 0.62,1.46 2.1,-2.6 2.16,-0.38 0.05,1.25 -1.51,1.71 0.02,0.72 0.77,0.56 1.08,-2.13 2,-1.27 0.91,-1.72 1.69,-0.53 2.38,0.45 3.4,-1.29 1.55,-1.43 1.06,-0.02 4.71,1.96 2.44,2.06 -0.06,1.15Z(M1075.29,1461.12l-0.53,-0.25 -0.39,0.61 -0.45,2.1 1.18,-0.25 0.19,-2.21Z(M1068.91,1470.91l0.17,0.87 0.57,0.24 0.09,-0.71 -0.83,-0.4Z(M1058.97,1466.73l-0.46,0.76 0.23,0.36 0.97,-0.1 0,-0.91 -0.74,-0.11Z(M1057.57,1468.55l-2.38,2.66 -1.57,2.96 0.48,1.85 0.84,0.07 1.05,-1.4 0.54,-1.91 0.93,-1 -0.28,-0.83 0.31,0.06 0.03,-1.09 0.71,-0.37 0.06,-0.55 -0.72,-0.45Z(M1087.35,1448.61l1,-0.15 -2.09,1.57 -1.22,-0.76 -2.46,0.21 -2.08,-0.6 0.22,-2.99 0.53,-1.4 -0.53,-0.21 -6.84,1.54 -5.87,0.06 -3.08,1.64 -2.67,2.23 -1.09,-0.61 -2.05,0.11 -1.38,-0.99 -1.55,0.49 -2.13,-0.18 -3.18,-5.01 -1.59,-1.02 -5,-1.06 -1.89,1.28 -0.75,1.22 -0.31,-0.59 0.11,-2.93 -0.88,-1.82 -1.01,-0.76 -0.21,-1.09 -2.03,1.44 -1.35,1.72 -2.35,0.91 -2.28,1.78 -3.87,0.72 -5.22,3.06 -3.58,1.16 -3.05,-1.73 -0.38,0.72 -1.98,0.43 2,-4.8 -0.82,-0.9 -1.2,0.14 -2.07,1.44 -1.02,-0.3 -3.21,1.98 -3.83,1.07 -1.72,0.05 -1.36,-1.05 0.48,-0.94 4.77,-3.85 9.09,-8.99 2.83,-1.73 8.75,-3.61 5.5,-3.74 1.41,-3.24 0.23,-2.4 4.85,-2.27 -1.16,3.46 -0.64,0.79 2.26,-0.84 1.24,-3.68 0.86,-1.02 0.54,-3.02 1.22,-0.21 0.49,0.42 0.33,1.42 -2.77,3.62 -0.2,0.62 0.28,0.78 0.67,-0.35 0.65,-1.6 2.39,-0.63 1.08,-1.48 0.34,-1.61 -1.32,-1.57 -0.44,-1.85 2.2,-0.48 9.63,3.91 4.59,0.05 1.45,-0.61 1.27,0.95 1.69,-0.09 1.71,2.76 2.03,6.65 2.16,3.08 3.41,1.51 8.64,-0.16 -1.81,5.27 0.89,1.67 2.5,1.9 1.38,1.79 -1.42,2.99 -0.63,2.3 1.71,1.36 1.55,-0.36 1.18,0.64 0.03,0.87 -1.17,0.1 -0.78,0.7 0.15,1.8 0.59,-0.77 0.57,0.34 -1.48,2.98 0.77,0.99 0.78,-0.64Z(M1015.4,1441.26l-0.06,0.46 0.6,0.16 -0.54,-0.62Z(M1016.57,1443.54l0.65,-0.68 -2.23,1.6 1.58,-0.92Z(M1017.78,1442.02l0.05,-0.73 -1.23,0.43 1.18,0.3Z(M1019.33,1439.94l-0.42,-0.37 -0.28,0.81 0.7,-0.44Z(M1046.11,1409.48l-0.34,0.5 0.34,1.58 2.74,-0.89 0.58,-1.26 -1.71,-0.41 -1.61,0.48Z(M1036.39,1424.91l3.26,-1.8 0.49,-1.17 1.1,-0.96 -1.18,0.15 -6.35,3.5 -0.61,0.61 0.35,0 -0.29,1.1 2.56,-0.49 0.53,-0.4 -0.36,-0.36 0.5,-0.18Z(M1049.14,1433.78l0.56,-0.37 -1.56,-0.85 -2.64,0.19 -2.39,0.87 -2.75,2.5 -0.61,1.64 2.07,0.87 -0.23,-0.5 0.42,-0.66 0.09,1.01 -0.68,1.4 0.34,0.61 0.42,-0.14 1.88,-2.33 0.17,-0.87 2.81,-2.42 -0.52,-0.63 2.62,-0.32Z(M1050.28,1410.98l0.78,-0.12 -0.05,-0.4 -0.87,-1.06 -0.52,0.12 0.05,1.22 0.61,0.24Z(M1074,1428.2l-0.41,-0.67 -1.41,-0.42 -1.33,0.27 -0.78,0.73 1.05,0.48 2.88,-0.39Z(M1088.35,1448.46l2.03,-0.52 0.9,0.92 -0.06,2.41 7.2,2.03 4.93,0.93 3.49,-0.43 0.92,0.57 3.28,-0.34 1.75,0.97 4.86,0.49 0.04,0.76 1.71,-1.01 0.84,0.74 -1.12,0.56 0.48,0.47 -0.33,0.55 0.34,0.19 1.68,-0.46 2.42,0.33 0.71,-0.68 0.16,1 0.72,0.22 3.17,-0.16 3.5,5.9 0.75,0.09 0.35,-0.58 0.73,3.58 1.96,0.89 0.01,-0.85 1.36,0.36 0.08,1.19 -0.81,1.25 0.82,0.31 0.48,0.82 -0.9,0.71 2.09,2.46 0.84,0.33 0.65,1.88 0.86,-0.9 -0.15,1.35 0.35,0.35 -1.69,0.02 -1.12,-0.72 -0.05,-0.8 -2.03,0.9 1.26,2.47 -0.12,1.29 -0.88,1.31 -4.27,-1.41 -1.51,-0.97 -0.88,-1.41 -1.36,0.42 -1.36,1.33 0.16,-2.62 -0.77,-0.45 -1.9,0.63 1.41,-1.71 0.38,-1.5 -1.15,0.9 -0.68,-0.07 -0.05,-0.8 -1.38,-0.97 -0.61,-2.06 0.32,-1.38 -4.69,-0.16 -0.1,0.45 1.31,0.93 1.59,2.43 1.09,0.61 -0.04,1.06 0.91,1.95 0.01,2.34 -1.42,2.92 -1.85,1.61 -1.63,3.64 -0.27,1.11 0.22,9.24 -0.82,2.3 -4.51,3.78 -2.68,1.05 -0.51,-0.99 -2.29,-12.12 -0.61,-1.34 -1.84,-1.72 -1.32,-0.21 -4.42,2.17 0.34,0.7 -1.32,2.34 -1.19,0.53 -1.07,1.2 -2.05,-0.67 -1.03,-1.16 0.68,-3.55 3.01,-1.52 1.15,-3.37 0.57,0.1 1.5,-1.76 0.36,-6.55 -0.32,-1.34 -1.41,-1.98 0.29,-1.08 1.67,0.2 -0.59,-1.89 -0.74,-0.93 -0.02,-0.84 -0.92,-1.05 -5,-2.39 -1.76,-0.38 -1.93,-2.19 -2.27,-0.52 -3.65,-1.9 0.06,-1.15 0.5,-0.12 -0.13,-1.42 1.06,-1.56 1.26,0.95 6.17,0.54 0.88,-0.32 -0.18,-0.65 -1.41,-1.11 -0.16,-1.16 -2.19,-0.72 0.52,-1.32 -0.6,-2.05 -1.18,-1.6 0.16,-0.44Z(M1099.72,1457.32l-1.05,0.48 -0.49,0.93 1.07,0.62 0.62,-0.19 0.71,-1.09 -0.86,-0.75Z(M1097.63,1456.81l-0.91,-1.19 -0.86,-0.16 0.01,0.8 -0.36,0.33 -1.78,0.33 -0.04,0.42 0.59,0.59 2.67,0.23 1.08,-0.81 -0.4,-0.54Z(M1094.21,1454.78l0.39,-1.1 -0.31,-0.64 -1.69,-0.82 -1.44,0.26 1.35,2.93 0.82,0.2 0.35,-0.84 0.53,0.01Z(M1090.35,1451.87l-0.19,0.74 0.73,0.55 0.02,-0.64 -0.56,-0.65Z(M1090.76,1451.6l-0.35,-1.14 0.24,-2 -0.84,-0.08 -0.66,0.8 0.97,2.1 0.64,0.32Z(M1087.39,1460.36l-1.53,0.05 1.72,1.1 0.42,-0.48 -0.61,-0.67Z(M1104.07,1459.92l7.28,2.45 3.04,1.99 2.67,-2.12 0.7,-0.1 -1.2,1.42 -1.27,0.66 1.08,0.56 1.44,-0.91 1.84,-3.26 -1.04,-0.16 0.23,-1.15 -0.38,-0.36 -1.21,2.46 -0.39,-0.74 -0.02,-1.58 -0.44,-0.12 -0.68,-1.42 -1.32,0.4 -1,1.4 -2.16,-1.84 -2.22,0.7 -0.6,0.71 0.68,0.76 -0.12,0.71 -1.47,-0.88 -1.19,0.02 -0.66,-0.84 -0.25,-1.32 -2.87,0.9 -0.9,-0.55 -0.45,0.59 -0.07,0.5 0.7,0.44 2.25,0.68Z(M1118.29,1464.93l-1.42,0.68 0.56,0.3 0.86,-0.98Z(M1135.81,1476.71l0.02,-1.1 -0.74,0 0.72,1.1Z(M977.9,1400.16l0.05,1.84 -0.81,1.07 0.1,-0.99 -1.27,-2.28 -0.65,-0.24 0.28,-1.11 -4.47,0.46 -1.12,0.62 -0.51,0.98 1.7,-0.01 2.01,2.12 1.25,-0.59 1.3,1.48 1.89,0.45 -1.4,1.03 -1.28,-0.13 -0.16,0.57 -4.43,3.59 -1.2,-0.07 -2.1,-1.67 -2.01,1.17 -1.07,0.18 -0.45,-0.73 0.6,-3.62 3.16,-1.02 0.53,-0.77 -0.06,-1.42 -0.83,-0.82 4.2,-4.12 -1.14,-0.23 -4.12,2.68 -0.36,-0.15 0.26,-1.24 -0.41,-1.4 1.64,-0.22 0.53,0.25 -0.14,0.65 0.54,0.14 0.98,-0.64 -0.34,-0.88 0.54,-0.49 2.67,-0.59 0.32,-0.7 -0.18,-0.77 -1.17,-2.57 0.73,-0.7 0.86,1.08 0.1,1.39 0.9,2.03 1.19,0.23 0.39,0.69 -0.03,1.5 -0.61,0.64 0.76,0.85 1.46,0.32 0.33,1.21 1.05,0.95Z(M970.51,1403.35l-0.98,-0.04 0.64,1.75 0.84,0.04 0.73,0.93 0.74,-0.09 0.93,-2.4 -0.78,-0.62 -2.12,0.43Z(M296.15,1194.71l-6.4,3.19 -0.91,3.96 -12.85,2.61 -1.57,-0.94 -0.37,-1.79 0.77,-1.81 9.71,-3.78 7.56,-1.94 4.06,0.5Z(M683.32,1565.04l-0.26,0.99 -0.77,0.18 -0.54,-0.38 -0.67,-1.75 0.08,-0.77 0.83,-1.15 1.11,-0.48 0.5,0.7 -0.28,2.66Z(M1043.06,1488.32l-0.1,2.04 -1.11,2.06 -0.38,-0.09 -0.62,-3.4 0.39,-1.29 0.76,-1.34 0.68,-0.02 0.42,0.25 -0.04,1.79Z(M1213.18,1487.05l-0.37,1.48 0.43,4.69 -0.95,-5.15 0.08,-1.74 1.02,-1.4 -1.02,-5.68 1.11,-6.11 0.26,-0.17 0.44,1.87 0.92,-1.76 1.14,-0.9 -0.08,1.1 -0.93,0.85 0.23,0.6 -0.47,5.33 -0.56,0.72 0.4,1.54 -1.65,4.73Z(M732.6,1646.14l-0.05,0.7 -0.93,1.15 -1.04,-0.11 -3.1,-3.9 0.09,-0.94 1.19,-0.24 3.84,3.34Z(M749.16,1424.97l-0.49,-1.81 0.74,-0.89 0.99,1.3 0.26,1.38 0.22,2.53 -0.59,1.25 -1.06,-0.06 -0.15,-0.43 0.42,-0.74 -0.25,-0.49 -1.16,-0.41 1.07,-1.63Z(M755.08,1610.82l-1.81,-2.51 -2.21,-2.19 -0.57,0.02 -0.81,1.85 -1.12,0.37 -0.97,-0.34 -0.9,-0.99 -0.89,0.29 -0.6,-0.37 -1.55,0 -1.15,1.3 -0.8,-0.86 -0.05,-0.66 4.37,-1.63 0.51,-3.47 0.58,-0.52 -0.39,4.38 0.86,1.4 0.78,0.85 0.76,-0.38 1.47,-2.37 0.38,0.02 2.5,2.75 1.61,3.06Z(M885.79,1431.15l-1.02,-0.36 -2.19,0.45 1.48,-1.6 -0.42,-1.69 -2.56,-0.48 -0.62,-0.57 -0.42,-1.65 0.44,-1.29 -1.67,-1.56 -3.39,-0.71 -4.56,1.87 -0.69,-0.2 -0.71,-1.18 -1.9,1.35 -0.26,-0.17 0.16,-0.79 1.05,-1.16 1.04,-0.19 1.41,1.47 1.12,-0.15 2.67,-1.62 2.29,0 2.75,1.12 0.87,0.89 0.46,1.45 -0.2,2.1 0.55,0.36 1.35,0.29 0.27,-0.24 -0.35,-2.01 1.79,-0.67 -0.41,1.12 0.62,2.47 0.8,0.62 -0.49,0.88 0.59,0.9 3.15,1.06 7.75,-1.41 0.71,0.65 -2.95,1.69 -2.16,-0.15 -3.73,0.86 -2.62,-1.75Z(M755.08,1610.82l-1.81,-2.51 -2.21,-2.19 -0.57,0.02 -0.81,1.85 -1.12,0.37 -0.97,-0.34 -0.9,-0.99 -0.89,0.29 -0.6,-0.37 -1.55,0 -1.15,1.3 -0.8,-0.86 -0.05,-0.66 4.37,-1.63 0.51,-3.47 0.58,-0.52 -0.39,4.38 0.86,1.4 0.78,0.85 0.76,-0.38 1.47,-2.37 0.38,0.02 2.5,2.75 1.61,3.06Z(M792.26,1581.42l-0.75,2.69 -4.57,6.97 0.49,0.45 1.62,-0.22 -0.3,0.48 -3.63,0.87 -5.44,2.59 -0.64,-1.38 2.17,-0.47 0.95,-1.2 0.51,0.39 0.54,-0.66 2.28,0.21 1.19,-2.63 0.67,-0.25 0.72,-1.13 -0.22,-1.36 0.84,-0.07 1.44,-1.44 1.23,-1.98 0.13,-1.48 0.36,-0.5 0.41,0.12Z(M906.94,1473.16l-0.93,0.46 -0.25,1.49 -0.95,1.63 -1.82,0.71 0.46,2.38 1.22,0.44 -0.18,0.82 1.21,0.83 -0.16,0.82 -2.26,-0.82 -0.82,-3.9 -0.48,-0.28 -1.4,-0.51 -3.88,0.59 2.2,-0.8 0.41,-0.66 1.75,-0.26 0.44,-0.26 -0.13,-0.51 2.49,1.15 0.67,-0.96 0.49,-0.02 0.12,-2.06 1.14,-1.64 0.14,-0.9 0.2,-1.65 -0.33,-0.73 -0.7,-0.71 -2.33,-0.1 3.05,-0.58 -1.03,-1.84 -2.31,-2.58 2.16,0.29 0.65,-1.06 -0.27,-1.6 -2.79,-5.1 -0.1,-0.69 0.85,-2.5 -0.14,-2.89 -0.32,-1.51 -1.52,-1.53 -0.11,-0.69 0.72,0.14 1.47,1.46 0.65,3.82 -0.53,3.28 0.17,1.49 0.76,1.78 1.62,2.19 0.06,2.75 -0.72,1.98 1.44,2.22 0.3,2.99 -0.35,2.49 0.27,0.7 -0.3,0.44Z`.split(`(`),B7=4096,bKe=85.05112878;function V7(e,t){let n=Math.max(-85.05112878,Math.min(bKe,t))*Math.PI/180,r=(e+180)/360,i=.5-Math.log(Math.tan(Math.PI/4+n/2))/(2*Math.PI);return{x:r*B7,y:i*B7}}function xKe(e){let t=.5-e.y/B7,n=2*Math.atan(Math.exp(2*Math.PI*t))-Math.PI/2;return{lon:e.x/B7*360-180,lat:n*180/Math.PI}}function SKe(e,t){return{x:(e.x-t.tx)/t.k,y:(e.y-t.ty)/t.k}}function CKe(e){if(!Number.isFinite(e)||e<=0)return 4;let t=Math.log2(B7*1.08*e/256);return Math.max(0,Math.min(21,Math.round(t)))}function wKe(e,t){return e!=null&&t!=null&&Number.isFinite(e)&&Number.isFinite(t)&&Math.abs(e)<=90&&Math.abs(t)<=180}function TKe(e,t,n){let r=`${e.toFixed(6)},${t.toFixed(6)}`;return n==null?`https://www.google.com/maps/search/?api=1&query=${r}`:`https://www.google.com/maps/@${r},${Math.round(n)}z`}function EKe(e,t){return`https://www.google.com/maps/dir/?api=1&destination=${e.toFixed(6)},${t.toFixed(6)}`}function H7(e,t){return{x:t.tx+e.x*t.k,y:t.ty+e.y*t.k}}function DKe(e,t,n,r=40,i=B7/90){if(e.length===0)return null;let a=1/0,o=-1/0,s=1/0,c=-1/0;for(let t of e)a=Math.min(a,t.x),o=Math.max(o,t.x),s=Math.min(s,t.y),c=Math.max(c,t.y);let l=Math.max(o-a,i),u=Math.max(c-s,i),d=(a+o)/2,f=(s+c)/2;l*=1.16,u*=1.16;let p=Math.min((t-r*2)/l,(n-r*2)/u);return{k:p,tx:t/2-d*p,ty:n/2-f*p}}function OKe(e,t,n,r,i,a){let o=Math.max(i,Math.min(a,e.k*t));return o===e.k?e:{k:o,tx:n-(n-e.tx)*o/e.k,ty:r-(r-e.ty)*o/e.k}}function U7(e,t){return e/t}function kKe(e,t,n){return`${U7(e,n)} ${U7(t,n)}`}function AKe(e,t,n=1/0){let r=t/B7;return{kMin:Math.min(e,Math.max(r,e*.25)),kMax:Math.max(e,Math.min(e*60,n))}}function jKe(e){return Math.max(0,Math.min(1,(1.5-e)/.9))}function MKe(e,t,n,r,i,a,o=14,s=6){let c=t-r-o;return{x:Math.max(s,Math.min(i-n-s,e-n/2)),y:Math.max(s,Math.min(a-r-s,c>=s?c:t+o))}}var NKe=6371.0088,PKe=(e,t)=>{let n=Math.PI/180,r=(t.lat-e.lat)*n,i=(t.lon-e.lon)*n,a=Math.sin(r/2)**2+Math.cos(e.lat*n)*Math.cos(t.lat*n)*Math.sin(i/2)**2;return 2*NKe*Math.asin(Math.min(1,Math.sqrt(a)))};function FKe(e,t,n,r=!1){if(e.length<2)return 0;let i=0;for(let r=1;rn(t[e],t[r]);for(let e=0;e`${e.lat.toFixed(6)},${e.lon.toFixed(6)}`,i=Math.min(e.length,zKe(!!t.coarsePointer,n));for(;;){let t=e.slice(0,i),a=t[0],o=n?a:t[t.length-1],s=n?t.slice(1):t.slice(1,-1),c=`https://www.google.com/maps/dir/?api=1&origin=${r(a)}&destination=${r(o)}`+(s.length?`&waypoints=${s.map(r).join(`|`)}`:``)+`&travelmode=driving`;if(c.length<=2048||i<=2)return{url:c,used:i};--i}}function VKe(e,t,n,r){return{x0:Math.min(e,n),y0:Math.min(t,r),x1:Math.max(e,n),y1:Math.max(t,r)}}function HKe(e,t,n,r,i,a){if(e==null||!Number.isFinite(e))return a;if(!(n>t))return(r+i)/2;let o=Math.max(0,Math.min(1,(e-t)/(n-t)));return Math.sqrt(r*r+o*(i*i-r*r))}var W7=1e3,G7=620,UKe=3.2,WKe=15,GKe=4.5,KKe=2.6,K7=[{fill:`#9DBFF2`,line:`#5F7FB0`},{fill:`#A5D8B4`,line:`#5E9C74`},{fill:`#F5D989`,line:`#B39A46`},{fill:`#F0A8A0`,line:`#B76D65`},{fill:`#7E99C2`,line:`#4A6790`},{fill:`#84AD91`,line:`#4C7A5C`},{fill:`#C4AE6E`,line:`#8C7838`},{fill:`#C0867F`,line:`#8A5049`}],q7={fill:`#D7DBE3`,line:`#8A909C`},J7={fill:`#9DBFF2`,line:`#4F6079`};function qKe(e){if(e==null||e===``)return null;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:null}function JKe(e){if(e==null||e===``)return null;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:null}function YKe({rows:e,field:t,colorField:n,sizeField:r,selectedPids:i,onSelectPids:a,onOpen:o}){let[s,c]=(0,z.useState)(null),[l,u]=(0,z.useState)(!1),[d,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)(null),[h,g]=(0,z.useState)(null),[_,v]=(0,z.useState)(null),[y,b]=(0,z.useState)(null),x=(0,z.useRef)(null),S=(0,z.useRef)(!1),C=(0,z.useRef)(!1),w=(0,z.useMemo)(()=>{let i=[];for(let a of e){let e=qKe(a.lat),o=qKe(a.lon);e==null||o==null||Math.abs(e)>90||Math.abs(o)>180||i.push({pid:a.pid,title:String(a[t.key]??``),p:V7(o,e),lat:e,lon:o,colorKey:n?String(a[n.key]??``).trim():null,size:r?JKe(a[r.key]):null,colorVal:n?a[n.key]:null,sizeVal:r?a[r.key]:null})}return i},[e,t.key,n,r]),T=e.length-w.length,E=(0,z.useMemo)(()=>DKe(w.map(e=>e.p),W7,G7),[w]);(0,z.useEffect)(()=>{E&&(!C.current||h==null)&&g(E)},[E]);let{kMin:D,kMax:O}=(0,z.useMemo)(()=>E?AKe(E.k,G7,32):{kMin:1,kMax:1},[E]),k=(0,z.useMemo)(()=>{if(!n)return null;let e=[],t=new Map;for(let n of w){let r=n.colorKey??``;t.has(r)||(t.set(r,0),e.push(r)),t.set(r,(t.get(r)??0)+1)}let r=e.filter(e=>e!==``),i=new Map;return r.forEach((e,t)=>i.set(e,t{if(!r)return null;let e=1/0,t=-1/0,n=0;for(let r of w){if(r.size==null){n+=1;continue}e=Math.min(e,r.size),t=Math.max(t,r.size)}return Number.isFinite(e)?{min:e,max:t,missing:n,none:!1}:{min:0,max:0,missing:n,none:!0}},[r,w]),j=(0,z.useMemo)(()=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(pointer: coarse)`).matches,[]),M=(0,z.useMemo)(()=>i.size<2?[]:w.filter(e=>i.has(e.pid)&&wKe(e.lat,e.lon)).sort((e,t)=>e.pid-t.pid),[w,i]),N=i.size-M.length,P=(0,z.useMemo)(()=>{if(!l||M.length<2)return null;let e=M.map(e=>({lat:e.lat,lon:e.lon})),t=0;for(let e=1;ee.pid===p);e>=0&&(t=e)}let{order:n,km:r}=RKe(e,PKe,{start:t,roundTrip:d});return{ordered:n.map(e=>M[e]),km:r,link:BKe(n.map(t=>e[t]),{roundTrip:d,coarsePointer:j})}},[l,M,d,p,j]),F=(0,z.useCallback)(e=>{if(!k)return J7;let t=e.colorKey??``;return t===``?q7:k.swatch.get(t)??q7},[k]),ee=(0,z.useCallback)(e=>!r||!A||A.none?GKe:HKe(e.size,A.min,A.max,UKe,WKe,KKe),[r,A]),I=(0,z.useCallback)((e,t)=>{if(!y)return{x:0,y:0};let n=y.getBoundingClientRect();return{x:(e-n.left)/n.width*W7,y:(t-n.top)/n.height*G7}},[y]);(0,z.useEffect)(()=>{if(!y)return;let e=e=>{e.preventDefault();let{x:t,y:n}=I(e.clientX,e.clientY);C.current=!0,g(r=>r&&OKe(r,Math.exp(-e.deltaY*.0016),t,n,D,O))};return y.addEventListener(`wheel`,e,{passive:!1}),()=>y.removeEventListener(`wheel`,e)},[y,I,D,O]);let te=(0,z.useCallback)(e=>{C.current=!0,g(t=>t&&OKe(t,e,W7/2,G7/2,D,O))},[D,O]),L=(0,z.useCallback)(()=>{C.current=!1,g(E)},[E]),ne=(0,z.useCallback)((e,t)=>{C.current=!0,g(n=>n&&{...n,tx:n.tx+e,ty:n.ty+t})},[]),re=(0,z.useCallback)(e=>{let t=e.shiftKey?160:60;switch(e.key){case`ArrowLeft`:ne(t,0);break;case`ArrowRight`:ne(-t,0);break;case`ArrowUp`:ne(0,t);break;case`ArrowDown`:ne(0,-t);break;case`+`:case`=`:te(1.6);break;case`-`:case`_`:te(1/1.6);break;case`0`:L();break;case`Escape`:if(!_)return;v(null);break;default:return}e.preventDefault()},[ne,te,L,_]),ie=(0,z.useCallback)(e=>{if(e.button!==0||!h)return;let{x:t,y:n}=I(e.clientX,e.clientY);S.current=!1,e.currentTarget.setPointerCapture(e.pointerId),e.shiftKey||e.ctrlKey||e.metaKey?v({x0:t,y0:n,x1:t,y1:n}):x.current={x:t,y:n,tx:h.tx,ty:h.ty}},[h,I]),ae=(0,z.useCallback)(e=>{let{x:t,y:n}=I(e.clientX,e.clientY);if(_){S.current=!0,v(e=>e&&{...e,x1:t,y1:n});return}let r=x.current;r&&(Math.abs(t-r.x)+Math.abs(n-r.y)>2&&(S.current=!0),C.current=!0,g(e=>e&&{...e,tx:r.tx+(t-r.x),ty:r.ty+(n-r.y)}))},[_,I]),oe=(0,z.useCallback)(e=>{if(_&&h){let t=VKe(_.x0,_.y0,_.x1,_.y1);if(t.x1-t.x0>3&&t.y1-t.y0>3){let n=[];for(let e of w){let r=H7(e.p,h);r.x>=t.x0&&r.x<=t.x1&&r.y>=t.y0&&r.y<=t.y1&&n.push(e.pid)}a(n,e.altKey?`add`:`replace`)}v(null)}x.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)},[_,h,w,a]);if(!h||!E)return(0,H.jsxs)(`div`,{className:`cg-mode-empty`,children:[`No records with a location to map yet.`,T>0&&` ${T.toLocaleString()} matching record${T===1?``:`s`} have no location.`]});let se=s==null?void 0:w.find(e=>e.pid===s),ce=_?VKe(_.x0,_.y0,_.x1,_.y1):null,le=`translate(${h.tx.toFixed(2)} ${h.ty.toFixed(2)}) scale(${h.k.toFixed(6)})`,ue=e=>U7(e,h.k),de=jKe(h.k),fe=xKe(SKe({x:W7/2,y:G7/2},h)),pe=TKe(fe.lat,fe.lon,CKe(h.k)),me=i.size===1?w.find(e=>i.has(e.pid)):void 0,he=A&&!A.none&&A.max>A.min?[A.min,(A.min+A.max)/2,A.max]:null;return(0,H.jsxs)(`div`,{className:`cg-mapview`,children:[(0,H.jsxs)(`div`,{className:`cg-map-bar`,children:[(0,H.jsxs)(`span`,{className:`cg-cal-note cg-map-count`,children:[(0,H.jsx)(`strong`,{children:w.length.toLocaleString()}),` of`,` `,e.length.toLocaleString(),` mapped · pinned at each customer's address`]}),T>0&&(0,H.jsxs)(`span`,{className:`cg-cal-nodate`,title:`${T.toLocaleString()} matching record${T===1?``:`s`} have no geocoded location and are not on the map. They remain in the Grid and List views.`,children:[T.toLocaleString(),` matching record`,T===1?` has`:`s have`,` no location`]}),me&&(0,H.jsxs)(`span`,{className:`cg-map-go`,children:[(0,H.jsxs)(`a`,{href:TKe(me.lat,me.lon),target:`_blank`,rel:`noopener noreferrer`,title:`Open ${me.title} in Google Maps at ${me.lat.toFixed(5)}, ${me.lon.toFixed(5)} (new tab)`,children:[me.title||`Selected pin`,` in Google Maps`]}),(0,H.jsx)(`a`,{href:EKe(me.lat,me.lon),target:`_blank`,rel:`noopener noreferrer`,title:`Directions to ${me.title} (new tab)`,children:`Directions`})]}),i.size>=2&&(0,H.jsxs)(`span`,{className:`cg-map-route`,children:[l?P&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`cg-map-route-sum`,children:[(0,H.jsx)(`strong`,{children:P.ordered.length.toLocaleString()}),` stops ·`,` `,Math.round(P.km).toLocaleString(),` km`,(0,H.jsx)(`span`,{className:`cg-map-route-note`,children:` straight-line, not driving distance`})]}),(0,H.jsxs)(`label`,{className:`cg-map-route-opt`,children:[`Start`,(0,H.jsx)(`select`,{className:`cg-map-route-start`,value:String(P.ordered[0].pid),onChange:e=>m(Number(e.target.value)),children:M.map(e=>(0,H.jsx)(`option`,{value:e.pid,children:e.title||`#${e.pid}`},e.pid))})]}),(0,H.jsxs)(`label`,{className:`cg-map-route-opt`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked)}),`Return to start`]}),P.link&&(0,H.jsxs)(`a`,{href:P.link.url,target:`_blank`,rel:`noopener noreferrer`,title:`Open this route in Google Maps for driving directions (new tab)`,children:[`Open route in Google Maps`,P.link.used{u(!1),m(null)},children:`Clear`})]}):(0,H.jsxs)(`button`,{type:`button`,className:`cg-map-route-go`,onClick:()=>u(!0),disabled:M.length<2,title:M.length<2?`At least two selected records need a location to plan a route`:`Order these stops into a route`,children:[`Plan route (`,M.length.toLocaleString(),` stops)`]}),N>0&&(0,H.jsxs)(`span`,{className:`cg-cal-nodate`,children:[N.toLocaleString(),` selected record`,N===1?` has`:`s have`,` no location and cannot be routed`]})]}),(0,H.jsx)(`span`,{className:`cg-map-hint`,children:`Scroll to zoom · drag to pan · shift-drag to select`})]}),(0,H.jsxs)(`div`,{className:`cg-map-frame`,tabIndex:0,role:`group`,"aria-label":`Map canvas. Arrow keys pan, plus and minus zoom, zero fits to data.`,onKeyDown:re,children:[(0,H.jsxs)(`svg`,{ref:b,viewBox:`0 0 ${W7} ${G7}`,preserveAspectRatio:`xMidYMid meet`,className:`cg-map-svg`+(_?` is-selecting`:``),role:`img`,"aria-label":`Map of ${w.length.toLocaleString()} customers`,onPointerDown:ie,onPointerMove:ae,onPointerUp:oe,onPointerCancel:oe,children:[(0,H.jsx)(`rect`,{className:`cg-map-water`,x:0,y:0,width:W7,height:G7}),(0,H.jsxs)(`g`,{transform:le,children:[de>.01&&(0,H.jsxs)(`g`,{className:`cg-map-grat`,strokeWidth:ue(.6),opacity:de,children:[Array.from({length:17},(e,t)=>{let n=V7(0,-80+t*10).y;return(0,H.jsx)(`line`,{x1:0,y1:n,x2:4096,y2:n},`p${t}`)}),Array.from({length:19},(e,t)=>{let n=V7(-180+t*20,0).x;return(0,H.jsx)(`line`,{x1:n,y1:0,x2:n,y2:4096},`m${t}`)})]}),(0,H.jsx)(`path`,{className:`cg-map-land`,d:vKe,strokeWidth:ue(.9)}),yKe.map((e,t)=>(0,H.jsx)(`path`,{className:`cg-map-lake`,d:e,strokeWidth:ue(.8)},t)),P&&P.ordered.length>1&&(0,H.jsx)(`polyline`,{className:`cg-map-route-line`,strokeWidth:ue(1.8),strokeDasharray:kKe(5,4,h.k),points:P.ordered.map(e=>`${e.p.x},${e.p.y}`).join(` `)+(d?` ${P.ordered[0].p.x},${P.ordered[0].p.y}`:``)}),w.map(e=>{let t=F(e),n=i.has(e.pid),r=ee(e)/h.k;return(0,H.jsx)(`circle`,{className:`cg-map-pin`+(s===e.pid?` is-hover`:``)+(n?` is-selected`:``),cx:e.p.x,cy:e.p.y,r:s===e.pid?r*1.28:r,fill:t.fill,stroke:n?`#202433`:t.line,strokeWidth:ue(n?2:1),role:`button`,tabIndex:0,"aria-label":`Open ${e.title}`,onMouseEnter:()=>c(e.pid),onMouseLeave:()=>c(t=>t===e.pid?null:t),onFocus:()=>c(e.pid),onBlur:()=>c(t=>t===e.pid?null:t),onClick:()=>{S.current||o(e.pid)},onKeyDown:t=>{t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),o(e.pid))},children:(0,H.jsx)(`title`,{children:e.title})},e.pid)})]}),P&&P.ordered.map((e,t)=>{let n=H7(e.p,h);return(0,H.jsxs)(`g`,{className:`cg-map-stopno`,transform:`translate(${n.x.toFixed(2)} ${(n.y-13).toFixed(2)})`,children:[(0,H.jsx)(`circle`,{r:7.5}),(0,H.jsx)(`text`,{textAnchor:`middle`,dy:`3.4`,children:t+1})]},e.pid)}),se&&(()=>{let e=H7(se.p,h),t=[];n&&t.push(`${n.label}: ${Mp(n,se.colorVal)||`—`}`),r&&t.push(`${r.label}: ${Mp(r,se.sizeVal)||`—`}`);let i=se.title||`(untitled)`,a=Math.max(i.length,...t.map(e=>e.length))*6.2+20,o=21+t.length*14,s=MKe(e.x,e.y,a,o,W7,G7);return(0,H.jsxs)(`g`,{className:`cg-map-card`,"aria-hidden":`true`,children:[(0,H.jsx)(`rect`,{x:s.x,y:s.y,width:a,height:o,rx:5}),(0,H.jsx)(`text`,{className:`cg-map-card-t`,x:s.x+10,y:s.y+15,children:i}),t.map((e,t)=>(0,H.jsx)(`text`,{className:`cg-map-card-l`,x:s.x+10,y:s.y+15+14*(t+1),children:e},t))]})})(),ce&&(0,H.jsx)(`rect`,{className:`cg-map-marquee`,x:ce.x0,y:ce.y0,width:ce.x1-ce.x0,height:ce.y1-ce.y0})]}),(0,H.jsxs)(`div`,{className:`cg-map-ctl`,role:`group`,"aria-label":`Map camera`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-map-ctl-b`,title:h.k>=O*.999999999?`Zoom in — at the limit. The basemap's detail ends here; use Open in Google Maps for street level.`:`Zoom in (+)`,"aria-label":`Zoom in`,disabled:h.k>=O*.999999999,onClick:()=>te(1.6),children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M8 3.6v8.8M3.6 8h8.8`})})}),(0,H.jsx)(`button`,{type:`button`,className:`cg-map-ctl-b`,title:`Zoom out (−)`,"aria-label":`Zoom out`,disabled:h.k<=D*1.000000001,onClick:()=>te(1/1.6),children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M3.6 8h8.8`})})}),(0,H.jsx)(`button`,{type:`button`,className:`cg-map-ctl-b`,title:`Fit to data (0)`,"aria-label":`Fit to data`,onClick:L,children:(0,H.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,H.jsx)(`path`,{d:`M2.6 5.8V2.6h3.2M10.2 2.6h3.2v3.2M13.4 10.2v3.2h-3.2M5.8 13.4H2.6v-3.2`}),(0,H.jsx)(`path`,{d:`M6.6 8h2.8M8 6.6v2.8`})]})}),(0,H.jsx)(`a`,{className:`cg-map-ctl-b`,href:pe,target:`_blank`,rel:`noopener noreferrer`,title:`Open this area in Google Maps (new tab)`,"aria-label":`Open this area in Google Maps`,children:(0,H.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,H.jsx)(`path`,{d:`M7 3.8H4.3a.9.9 0 0 0-.9.9v6.9a.9.9 0 0 0 .9.9h6.9a.9.9 0 0 0 .9-.9V9.2`}),(0,H.jsx)(`path`,{d:`M8.6 3.4h4v4M12.6 3.4 7.4 8.6`})]})})]}),(k||he)&&(0,H.jsxs)(`div`,{className:`cg-map-legends`,children:[n&&k&&(0,H.jsxs)(`div`,{className:`cg-map-legend`,children:[(0,H.jsx)(`div`,{className:`cg-map-legend-t`,children:n.label}),k.order.slice(0,K7.length+1).map(e=>{let t=e===``?q7:k.swatch.get(e)??q7;return(0,H.jsxs)(`div`,{className:`cg-map-legend-row`,children:[(0,H.jsx)(`span`,{className:`cg-map-swatch`,style:{background:t.fill,borderColor:t.line}}),(0,H.jsx)(`span`,{className:`cg-map-legend-k`,children:e===``?`(blank)`:e}),(0,H.jsx)(`span`,{className:`cg-map-legend-n`,children:(k.counts.get(e)??0).toLocaleString()})]},e||`(blank)`)}),k.overflow>0&&(0,H.jsxs)(`div`,{className:`cg-map-legend-note`,children:[k.overflow.toLocaleString(),` further value`,k.overflow===1?` is`:`s are`,` drawn grey — the palette holds `,K7.length,` colours and reusing one would make two values look like the same value.`]})]}),r&&A&&(0,H.jsxs)(`div`,{className:`cg-map-legend`,children:[(0,H.jsx)(`div`,{className:`cg-map-legend-t`,children:r.label}),he?(0,H.jsx)(`div`,{className:`cg-map-sizerow`,children:he.map((e,t)=>(0,H.jsxs)(`span`,{className:`cg-map-sizeitem`,children:[(0,H.jsx)(`svg`,{width:32,height:32,"aria-hidden":!0,children:(0,H.jsx)(`circle`,{cx:16,cy:16,r:HKe(e,A.min,A.max,UKe,WKe,KKe),fill:J7.fill,stroke:J7.line})}),(0,H.jsx)(`span`,{className:`cg-map-legend-k`,children:Mp(r,e)})]},t))}):(0,H.jsxs)(`div`,{className:`cg-map-legend-note`,children:[`Every mapped record has the same `,r.label.toLowerCase(),`, so the bubbles cannot differ in size.`]}),A.missing>0&&(0,H.jsxs)(`div`,{className:`cg-map-legend-note`,children:[A.missing.toLocaleString(),` mapped record`,A.missing===1?` has`:`s have`,` no value — drawn at the smallest dot, never removed from the map.`]})]})]})]})]})}var XKe=`cg-cat-print-style`,Y7=`cg-cat-printing`;function ZKe(e){let t=ap(e.paper,e.orientation),n=op(t.w,t.unit),r=op(t.h,t.unit),i=`html.${Y7}`;return[`@page { size: ${n} ${r}; margin: 0; }`,`@media print {`,` ${i}, ${i} body {`,` width: ${n}; margin: 0; padding: 0; background: #fff;`,` -webkit-print-color-adjust: exact; print-color-adjust: exact;`,` }`,` ${i} .cg-cat-page {`,` width: ${n}; height: ${r};`,` margin: 0; box-shadow: none; border: 0; border-radius: 0;`,` transform: none; break-after: page; break-inside: avoid;`,` }`,` ${i} .cg-cat-page:last-child { break-after: auto; }`,`}`].join(` -`)}function QKe(e,t=document){let n=t.getElementById(XKe);return n||(n=t.createElement(`style`),n.id=XKe,t.head.appendChild(n)),n.textContent=ZKe(e),()=>{n?.parentNode?.removeChild(n)}}async function $Ke(e,t=2e4){if(!e)return;let n=Array.from(e.querySelectorAll(`img`));if(!n.length)return;let r=Promise.all(n.map(e=>e.decode?e.decode().catch(()=>void 0):new Promise(t=>{if(e.complete)return t();e.addEventListener(`load`,()=>t(),{once:!0}),e.addEventListener(`error`,()=>t(),{once:!0})}))).then(()=>void 0);await Promise.race([r,new Promise(e=>setTimeout(e,t))])}function eqe(e=document,t){let n=e.defaultView,r=e.documentElement;return new Promise(e=>{let i=!1,a,o=n?.matchMedia?n.matchMedia(`print`):null,s=e=>{e.matches||c()};function c(){i||(i=!0,r.classList.remove(Y7),n?.removeEventListener(`afterprint`,c),o?.removeEventListener?.(`change`,s),a!==void 0&&clearTimeout(a),e())}r.classList.add(Y7),n?.addEventListener(`afterprint`,c),o?.addEventListener?.(`change`,s),a=setTimeout(c,12e4);try{t?t():n?.print()}catch{c()}})}var X7={stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`};function Z7(){return(0,H.jsx)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 16 16`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M8 3.4v9.2M3.4 8h9.2`,...X7})})}function tqe(){return(0,H.jsx)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 16 16`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M3.4 4.6h9.2M6.4 4.6V3.2h3.2v1.4M4.8 4.6l.6 8h5.2l.6-8`,...X7})})}function nqe(){return(0,H.jsx)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 16 16`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M4.4 9.6L8 6l3.6 3.6`,...X7})})}function rqe(){return(0,H.jsx)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 16 16`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M4.4 6.4L8 10l3.6-3.6`,...X7})})}function iqe(){return(0,H.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,"aria-hidden":!0,children:[(0,H.jsx)(`path`,{d:`M4.6 6.4V2.8h6.8v3.6`,...X7}),(0,H.jsx)(`path`,{d:`M2.8 6.4h10.4v4.4H11v2.4H5v-2.4H2.8z`,...X7}),(0,H.jsx)(`path`,{d:`M5 10.8h6`,...X7})]})}function Q7({className:e}){return(0,H.jsxs)(`svg`,{className:e,viewBox:`0 0 44 26`,"aria-hidden":!0,children:[(0,H.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinejoin:`round`,children:[(0,H.jsx)(`path`,{d:`M11 4.5l6.5 6.5L11 17.5 4.5 11z`}),(0,H.jsx)(`path`,{d:`M22 2.5l7.5 7.5L22 17.5 14.5 10z`}),(0,H.jsx)(`path`,{d:`M33 4.5L39.5 11 33 17.5 26.5 11z`})]}),(0,H.jsx)(`rect`,{x:`4`,y:`20`,width:`36`,height:`2.6`,fill:`currentColor`})]})}function $7({code:e,quality:t,missing:n,cover:r}){return e?n?(0,H.jsx)(`div`,{className:`cg-cat-shot cg-cat-shot-empty`,children:(0,H.jsx)(`span`,{children:tp(e)===null?`No master for ${e}`:`No editorial image named ${tp(e)}`})}):(0,H.jsx)(`div`,{className:r?`cg-cat-shot cg-cat-shot-cover`:`cg-cat-shot`,children:(0,H.jsx)(`img`,{src:np(e,t),alt:``,loading:`eager`})}):(0,H.jsx)(`div`,{className:`cg-cat-shot cg-cat-shot-empty`,children:(0,H.jsx)(`span`,{children:`No image`})})}function aqe({item:e,quality:t,layout:n,hasAsset:r}){let i=r(e.image);return(0,H.jsxs)(`div`,{className:`cg-cat-card`,children:[(0,H.jsx)($7,{code:e.image,quality:t,missing:i===!1}),(0,H.jsx)(`div`,{className:`cg-cat-desc`,children:e.name??(e.known?``:`Not in this table`)}),n.showPack&&e.pack?(0,H.jsx)(`div`,{className:`cg-cat-pill`,children:e.pack}):null,(0,H.jsxs)(`div`,{className:`cg-cat-meta`,children:[(0,H.jsx)(`span`,{className:`cg-cat-sku`,children:e.code}),n.showColor&&e.color?(0,H.jsx)(`span`,{className:`cg-cat-color`,children:e.color}):null]}),n.showPrice&&e.price?(0,H.jsx)(`div`,{className:`cg-cat-price`,children:e.price}):null]})}function e9({folio:e,light:t,mark:n=!0}){return(0,H.jsxs)(`div`,{className:t?`cg-cat-foot cg-cat-foot-light`:`cg-cat-foot`,children:[n?(0,H.jsx)(Q7,{className:`cg-cat-foot-mark`}):null,(0,H.jsx)(`span`,{className:`cg-cat-folio`,children:e})]})}var oqe=(0,z.memo)(function({cat:e,page:t,index:n,items:r,quality:i,hasAsset:a}){let o=ap(e.paper,e.orientation),s=o.unit===`in`?96:96/25.4,c=e.brand??{},l=c.primary??sp.primary,u=c.accent??sp.accent,d=c.company??sp.company,f={"--cat-w":`${o.w*s}px`,"--cat-h":`${o.h*s}px`,"--cat-primary":l,"--cat-accent":u},p=n+1,m=c.logo?a(c.logo):null,h=(0,H.jsxs)(`div`,{className:`cg-cat-mark`,children:[c.logo&&m!==!1?(0,H.jsx)(`img`,{src:np(c.logo,i),alt:``}):(0,H.jsx)(Q7,{className:`cg-cat-mark-crown`}),(0,H.jsx)(`span`,{className:`cg-cat-mark-co`,children:d})]});if(t.kind===`cover`){let e=t.imageCode?a(t.imageCode):null;return(0,H.jsxs)(`div`,{className:`cg-cat-page cg-cat-p-cover`,style:f,"data-kind":`cover`,children:[(0,H.jsx)($7,{code:t.imageCode,quality:i,missing:e===!1,cover:!0}),(0,H.jsx)(`div`,{className:`cg-cat-cover-scrim`}),h,(0,H.jsxs)(`div`,{className:`cg-cat-cover-ttl`,children:[(0,H.jsx)(`span`,{className:`cg-cat-cover-a`,children:t.title}),t.body?(0,H.jsx)(`span`,{className:`cg-cat-cover-b`,children:t.body}):null]})]})}if(t.kind===`intro`)return(0,H.jsxs)(`div`,{className:`cg-cat-page cg-cat-p-intro`,style:f,"data-kind":`intro`,children:[(0,H.jsx)(`div`,{className:`cg-cat-intro-field`,children:(0,H.jsx)(`svg`,{className:`cg-cat-lattice`,viewBox:`0 0 200 260`,"aria-hidden":!0,children:(0,H.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:`7`,children:[(0,H.jsx)(`path`,{d:`M-40 130l60-60 60 60-60 60z`}),(0,H.jsx)(`path`,{d:`M40 190l60-60 60 60-60 60z`}),(0,H.jsx)(`path`,{d:`M100 130l40 40 40-90`})]})})}),(0,H.jsxs)(`div`,{className:`cg-cat-intro-body`,children:[(0,H.jsx)(`h2`,{className:`cg-cat-intro-ttl`,children:t.title}),(t.body??``).split(/\n{2,}/).map((e,t)=>e.trim()?(0,H.jsx)(`p`,{className:`cg-cat-intro-p`,children:e.trim()},t):null),(0,H.jsxs)(`div`,{className:`cg-cat-intro-sign`,children:[`The `,d,` Team`]})]}),(0,H.jsx)(e9,{folio:p,light:!0,mark:!1})]});if(t.kind===`gallery`){let e=t.imageCode?a(t.imageCode):null;return(0,H.jsxs)(`div`,{className:`cg-cat-page cg-cat-p-gallery`,style:f,"data-kind":`gallery`,children:[(0,H.jsx)($7,{code:t.imageCode,quality:i,missing:e===!1,cover:!0}),(0,H.jsx)(`div`,{className:`cg-cat-gal-wash`}),t.title?(0,H.jsx)(`div`,{className:`cg-cat-gal-ttl`,children:t.title}):null,(0,H.jsx)(e9,{folio:p,light:!0})]})}let g=fp(t),_=t.imageCode?a(t.imageCode):null;return(0,H.jsxs)(`div`,{className:`cg-cat-page cg-cat-p-section${t.imageCode?` has-strip`:``}`,style:f,"data-kind":`section`,children:[(0,H.jsx)(`h2`,{className:`cg-cat-sec-ttl`,children:t.title}),(0,H.jsx)(`div`,{className:`cg-cat-grid`,style:{"--cat-cols":g.cols},children:r.map(e=>(0,H.jsx)(aqe,{item:e,quality:i,layout:g,hasAsset:a},e.code))}),t.imageCode?(0,H.jsx)(`div`,{className:`cg-cat-strip`,children:(0,H.jsx)($7,{code:t.imageCode,quality:i,missing:_===!1,cover:!0})}):null,(0,H.jsx)(e9,{folio:p})]})});function sqe({cat:e,itemsFor:t,quality:n,hasAsset:r,scale:i,selectedId:a,onSelect:o}){let s=ap(e.paper,e.orientation),c=s.unit===`in`?96:96/25.4;return(0,H.jsx)(H.Fragment,{children:e.pages.map((l,u)=>{let d=(0,H.jsx)(oqe,{cat:e,page:l,index:u,items:t(l),quality:n,hasAsset:r});return i===void 0?(0,H.jsx)(`div`,{children:d},l.id):(0,H.jsx)(`div`,{className:`cg-cat-slot${a===l.id?` is-sel`:``}`,style:{width:s.w*c*i,height:s.h*c*i,"--cat-scale":i},onMouseDown:()=>o?.(l.id),children:d},l.id)})})}var cqe=(0,z.memo)(function({catalogs:e,onCatalogs:t,fields:n,fieldByKey:r,poolRows:i,filteredCodes:a}){let[o,s]=(0,z.useState)(e[0]?.id??null),[c,l]=(0,z.useState)(null),[u,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(()=>new Set),[m,h]=(0,z.useState)(null),[g,_]=(0,z.useState)(null),v=(0,z.useRef)(null),[y,b]=(0,z.useState)(null),[x,S]=(0,z.useState)(null),C=(0,z.useRef)(null),w=(0,z.useRef)(null),[T,E]=(0,z.useState)(0),D=e.find(e=>e.id===o)??null,O=D?.pages.find(e=>e.id===c)??null;(0,z.useEffect)(()=>{let e=!0;return Kne().then(t=>{e&&h(t)}),ip().then(t=>{e&&_(t)}),()=>{e=!1}},[]);let k=(0,z.useCallback)(e=>{let t=tp(e);return t===null?e.startsWith(`rec:`)?null:m?m.has(e):null:g?g.has(t):null},[m,g]);(0,z.useLayoutEffect)(()=>{let e=C.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>E(e.clientWidth));return t.observe(e),E(e.clientWidth),()=>t.disconnect()},[]);let A=(0,z.useMemo)(()=>Vne(i),[i]),j=(0,z.useCallback)(e=>Une(e.products??[],A,D?.fields,Mp,r),[A,D?.fields,r]),M=(0,z.useMemo)(()=>{if(!D||!T)return .5;let e=ap(D.paper,D.orientation),t=e.unit===`in`?96:96/25.4;return Math.min(1,Math.max(.2,(T-56)/(e.w*t)))},[D,T]),N=(0,z.useCallback)(e=>{t(e)},[t]),P=(0,z.useCallback)((t,n)=>{N(e.map(e=>e.id===t?{...e,...n}:e))},[e,N]),F=(0,z.useCallback)((t,n,r)=>{N(e.map(e=>e.id===t?{...e,pages:e.pages.map(e=>e.id===n?{...e,...r}:e)}:e))},[e,N]),ee=()=>{if(e.length>=12)return;let t=nre(`Catalog ${e.length+1}`,n);N([...e,t]),s(t.id),l(t.pages[0]?.id??null)},I=e=>{if(!D||D.pages.length>=40)return;let t=up(e);P(D.id,{pages:[...D.pages,t]}),l(t.id)},te=e=>{if(!D||!O)return;let t=D.pages.findIndex(e=>e.id===O.id),n=t+e;if(t<0||n<0||n>=D.pages.length)return;let r=[...D.pages];[r[t],r[n]]=[r[n],r[t]],P(D.id,{pages:r})},L=(0,z.useMemo)(()=>{if(!D)return[];let e=u.trim().toLowerCase(),t=D.fields?.name,n=[];for(let a of i){let i=a[$f];if(typeof i!=`string`||!i)continue;let o=t?r.get(t):void 0,s=o?Mp(o,a[t]):``;if(!(e&&!i.toLowerCase().includes(e)&&!s.toLowerCase().includes(e))&&(n.push({code:i,label:s}),n.length>=200))break}return n},[D,i,u,r]),ne=e=>{if(!D||!O)return;let t=ire(D,O.id,e);if(P(D.id,{pages:t.pages}),p(new Set),t.skippedCap||t.skippedDuplicate){let e=[];t.skippedDuplicate&&e.push(`${t.skippedDuplicate} already on the page`),t.skippedCap&&e.push(`${t.skippedCap} over the 500-product catalog limit`),ie(`Added ${t.added}. Skipped ${e.join(`; `)}.`)}else ie(`Added ${t.added}.`)},[re,ie]=(0,z.useState)(``),ae=async e=>{let t=Zne(e.name);if(!t){ie(`That filename does not reduce to a usable name — rename the file first.`);return}ie(`Uploading ${t}…`);try{let n=await qne(t,e);_(await ip()),D&&O&&F(D.id,O.id,{imageCode:`ed:${n}`}),ie(`Editorial image "${n}" stored and bound to this page.`)}catch(e){ie(e instanceof Error?e.message:`The upload failed.`)}};if((0,z.useEffect)(()=>{if(!y)return;let e=!1;return(async()=>{if(await new Promise(e=>requestAnimationFrame(()=>e())),await $Ke(w.current),e)return;let t=QKe(y.cat);await eqe(),t(),e||b(null)})(),()=>{e=!0}},[y]),!e.length)return(0,H.jsx)(`div`,{className:`cg-cat cg-cat-blank`,children:(0,H.jsxs)(`div`,{className:`cg-cat-blank-in`,children:[(0,H.jsx)(Q7,{className:`cg-cat-blank-mark`}),(0,H.jsx)(`h3`,{children:`No catalogs yet`}),(0,H.jsx)(`p`,{children:`A catalog is a printable document built from this table’s products — cover, introduction, product sections and full-page images. Print it to PDF from the browser when it is ready.`}),(0,H.jsxs)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,onClick:ee,children:[(0,H.jsx)(Z7,{}),` New catalog`]})]})});let oe=D?dp(D):0;return(0,H.jsxs)(`div`,{className:`cg-cat`,children:[(0,H.jsxs)(`aside`,{className:`cg-cat-rail`,children:[(0,H.jsxs)(`div`,{className:`cg-cat-rail-head`,children:[(0,H.jsx)(`span`,{children:`Catalogs`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-cat-icon-btn`,title:e.length>=12?`A view holds 12 catalogs.`:`New catalog`,"aria-label":`New catalog`,disabled:e.length>=12,onClick:ee,children:(0,H.jsx)(Z7,{})})]}),(0,H.jsx)(`ul`,{className:`cg-cat-list`,children:e.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,className:`cg-cat-item${e.id===o?` is-open`:``}`,onClick:()=>{s(e.id),l(e.pages[0]?.id??null)},children:[(0,H.jsx)(`span`,{className:`cg-cat-item-name`,children:e.name||`Untitled catalog`}),(0,H.jsxs)(`span`,{className:`cg-cat-item-meta`,children:[e.pages.length,` `,e.pages.length===1?`page`:`pages`]})]})},e.id))}),D?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`cg-cat-rail-head cg-cat-rail-sub`,children:[(0,H.jsx)(`span`,{children:`Pages`}),(0,H.jsxs)(`span`,{className:`cg-cat-count`,children:[D.pages.length,`/`,40]})]}),(0,H.jsx)(`ul`,{className:`cg-cat-pagelist`,children:D.pages.map((e,t)=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,className:`cg-cat-pageitem${e.id===c?` is-sel`:``}`,onClick:()=>l(e.id),children:[(0,H.jsx)(`span`,{className:`cg-cat-pageno`,children:t+1}),(0,H.jsx)(`span`,{className:`cg-cat-pagettl`,children:e.title||lp[e.kind]}),(0,H.jsx)(`span`,{className:`cg-cat-pagekind`,children:lp[e.kind]})]})},e.id))}),(0,H.jsx)(`div`,{className:`cg-cat-addrow`,children:Tee.map(e=>(0,H.jsxs)(`button`,{type:`button`,className:`cg-btn`,disabled:D.pages.length>=40,onClick:()=>I(e),children:[(0,H.jsx)(Z7,{}),` `,lp[e]]},e))})]}):null]}),(0,H.jsx)(`div`,{className:`cg-cat-stage`,ref:C,children:D?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`cg-cat-bar`,children:[(0,H.jsx)(`input`,{className:`cg-input cg-cat-name`,value:D.name,maxLength:80,"aria-label":`Catalog name`,onChange:e=>P(D.id,{name:e.target.value})}),(0,H.jsx)(`select`,{className:`cg-select`,"aria-label":`Paper size`,value:D.paper,onChange:e=>P(D.id,{paper:e.target.value}),children:See.map(e=>(0,H.jsx)(`option`,{value:e,children:$ne[e]},e))}),(0,H.jsx)(`select`,{className:`cg-select`,"aria-label":`Orientation`,value:D.orientation,onChange:e=>P(D.id,{orientation:e.target.value}),children:Cee.map(e=>(0,H.jsx)(`option`,{value:e,children:e===`portrait`?`Portrait`:`Landscape`},e))}),(0,H.jsxs)(`span`,{className:`cg-cat-budget`,title:`Products placed across this catalog's pages`,children:[oe,`/`,500,` products`]}),(0,H.jsxs)(`button`,{type:`button`,className:`cg-btn cg-btn--primary cg-cat-print`,onClick:()=>S(D),children:[(0,H.jsx)(iqe,{}),` Print`]})]}),(0,H.jsx)(`div`,{className:`cg-cat-scroll`,children:(0,H.jsx)(sqe,{cat:D,itemsFor:j,quality:`web`,hasAsset:k,scale:M,selectedId:c??void 0,onSelect:l})})]}):(0,H.jsx)(`div`,{className:`cg-mode-empty`,children:`Pick a catalog to open it.`})}),(0,H.jsx)(`aside`,{className:`cg-cat-insp`,children:D&&O?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`cg-cat-insp-head`,children:[(0,H.jsx)(`span`,{children:lp[O.kind]}),(0,H.jsxs)(`span`,{className:`cg-cat-insp-tools`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-cat-icon-btn`,"aria-label":`Move page up`,onClick:()=>te(-1),children:(0,H.jsx)(nqe,{})}),(0,H.jsx)(`button`,{type:`button`,className:`cg-cat-icon-btn`,"aria-label":`Move page down`,onClick:()=>te(1),children:(0,H.jsx)(rqe,{})}),(0,H.jsx)(`button`,{type:`button`,className:`cg-cat-icon-btn cg-cat-del`,"aria-label":`Delete page`,onClick:()=>P(D.id,{pages:D.pages.filter(e=>e.id!==O.id)}),children:(0,H.jsx)(tqe,{})})]})]}),(0,H.jsxs)(`label`,{className:`cg-cat-fld`,children:[(0,H.jsx)(`span`,{children:`Title`}),(0,H.jsx)(`input`,{className:`cg-input`,value:O.title??``,onChange:e=>F(D.id,O.id,{title:e.target.value})})]}),O.kind===`cover`||O.kind===`intro`?(0,H.jsxs)(`label`,{className:`cg-cat-fld`,children:[(0,H.jsx)(`span`,{children:O.kind===`cover`?`Second line`:`Body`}),(0,H.jsx)(`textarea`,{className:`cg-input cg-cat-area`,rows:O.kind===`cover`?2:9,value:O.body??``,onChange:e=>F(D.id,O.id,{body:e.target.value})})]}):null,O.kind===`intro`?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{className:`cg-cat-fld`,children:[(0,H.jsx)(`span`,{children:O.kind===`section`?`Footer image (code)`:`Image (code)`}),(0,H.jsx)(`input`,{className:`cg-input`,value:O.imageCode??``,placeholder:`e.g. CRY-2003 or ed:showroom`,onChange:e=>F(D.id,O.id,{imageCode:e.target.value})}),O.imageCode&&k(O.imageCode)===!1?(0,H.jsx)(`em`,{className:`cg-cat-warn`,children:tp(O.imageCode)===null?`No image is archived under this code — the page will print an empty frame.`:`No editorial image is stored under this name — the page will print an empty frame.`}):(0,H.jsx)(`em`,{className:`cg-cat-hint`,children:`Fills the width edge to edge, so a wide photograph reads best here. A cut-out product render will be cropped and enlarged to fill it.`})]}),(0,H.jsxs)(`label`,{className:`cg-cat-fld`,children:[(0,H.jsx)(`span`,{children:`Editorial library`}),(0,H.jsxs)(`select`,{className:`cg-select`,value:tp(O.imageCode??``)??``,onChange:e=>F(D.id,O.id,{imageCode:e.target.value?`ed:${e.target.value}`:``}),children:[(0,H.jsx)(`option`,{value:``,children:`(use a product code above)`}),[...g??[]].sort().map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))]}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>v.current?.click(),children:`Upload a photograph…`}),(0,H.jsx)(`input`,{ref:v,type:`file`,accept:`image/png,image/jpeg`,style:{display:`none`},onChange:e=>{let t=e.target.files?.[0];t&&ae(t),e.target.value=``}}),(0,H.jsx)(`em`,{className:`cg-cat-hint`,children:`Lifestyle photography without a SKU lives here. Storing a new one needs an admin login; everyone can pick from the library.`})]})]}),O.kind===`section`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`cg-cat-insp-sub`,children:`Layout`}),(0,H.jsx)(`div`,{className:`cg-cat-row`,children:(0,H.jsxs)(`label`,{className:`cg-cat-fld cg-cat-fld-inline`,children:[(0,H.jsx)(`span`,{children:`Columns`}),(0,H.jsx)(`select`,{className:`cg-select`,value:fp(O).cols,onChange:e=>F(D.id,O.id,{layout:{...O.layout,cols:Number(e.target.value)}}),children:Eee.map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))})]})}),[[`showPack`,`Pack line`,!1],[`showColor`,`Colour`,!1],[`showPrice`,`Price`,!0]].map(([e,t,n])=>{let r=fp(O),i=e===`showPrice`?r.showPrice:e===`showPack`?r.showPack:r.showColor;return(0,H.jsxs)(`label`,{className:`cg-check-row`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:i,onChange:()=>{let t={...O.layout};n?i?delete t.showPrice:t.showPrice=!0:e===`showPack`?i?t.showPack=!1:delete t.showPack:i?t.showColor=!1:delete t.showColor,F(D.id,O.id,{layout:Object.keys(t).length?t:void 0})}}),(0,H.jsx)(`span`,{children:t})]},e)}),(0,H.jsxs)(`div`,{className:`cg-cat-insp-sub`,children:[`Products`,(0,H.jsxs)(`span`,{className:`cg-cat-count`,children:[O.products?.length??0,` on this page`]})]}),(0,H.jsx)(`div`,{className:`cg-cat-picked`,children:(O.products??[]).map(e=>(0,H.jsxs)(`span`,{className:`cg-cat-chip`,children:[e,(0,H.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e}`,onClick:()=>F(D.id,O.id,{products:(O.products??[]).filter(t=>t!==e)}),children:`×`})]},e))}),(0,H.jsxs)(`button`,{type:`button`,className:`cg-btn cg-cat-addfiltered`,disabled:!a.length,onClick:()=>ne(a),children:[(0,H.jsx)(Z7,{}),` Add the `,a.length,` products this view shows`]}),(0,H.jsx)(`input`,{className:`cg-input`,placeholder:`Search products by SKU or name`,value:u,onChange:e=>d(e.target.value)}),(0,H.jsxs)(`div`,{className:`cg-cat-results`,children:[L.map(e=>(0,H.jsxs)(`label`,{className:`cg-check-row`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:f.has(e.code),onChange:()=>p(t=>{let n=new Set(t);return n.has(e.code)?n.delete(e.code):n.add(e.code),n})}),(0,H.jsx)(`span`,{className:`cg-cat-res-code`,children:e.code}),(0,H.jsx)(`span`,{className:`cg-cat-res-name`,children:e.label})]},e.code)),L.length>=200?(0,H.jsx)(`div`,{className:`cg-cat-more`,children:`Showing the first 200 matches — narrow the search to see the rest.`}):null]}),(0,H.jsxs)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!f.size,onClick:()=>ne([...f]),children:[`Add `,f.size,` selected`]}),re?(0,H.jsx)(`div`,{className:`cg-cat-note`,children:re}):null]}):null,(0,H.jsx)(`div`,{className:`cg-cat-insp-sub`,children:`Brand`}),(0,H.jsxs)(`div`,{className:`cg-cat-row`,children:[(0,H.jsxs)(`label`,{className:`cg-cat-fld cg-cat-fld-inline`,children:[(0,H.jsx)(`span`,{children:`Primary`}),(0,H.jsx)(`input`,{type:`color`,className:`cg-cat-swatch`,value:D.brand?.primary??sp.primary,onChange:e=>P(D.id,{brand:{...D.brand,primary:e.target.value}})})]}),(0,H.jsxs)(`label`,{className:`cg-cat-fld cg-cat-fld-inline`,children:[(0,H.jsx)(`span`,{children:`Accent`}),(0,H.jsx)(`input`,{type:`color`,className:`cg-cat-swatch`,value:D.brand?.accent??sp.accent,onChange:e=>P(D.id,{brand:{...D.brand,accent:e.target.value}})})]})]}),(0,H.jsxs)(`label`,{className:`cg-cat-fld`,children:[(0,H.jsx)(`span`,{children:`Company`}),(0,H.jsx)(`input`,{className:`cg-input`,value:D.brand?.company??``,placeholder:sp.company,onChange:e=>P(D.id,{brand:{...D.brand,company:e.target.value}})})]}),(0,H.jsx)(`div`,{className:`cg-cat-insp-sub`,children:`Listing columns`}),[[`name`,`Description`],[`pack`,`Pack line`],[`color`,`Colour`],[`price`,`Price`]].map(([e,t])=>(0,H.jsxs)(`label`,{className:`cg-cat-fld cg-cat-fld-inline`,children:[(0,H.jsx)(`span`,{children:t}),(0,H.jsxs)(`select`,{className:`cg-select`,value:D.fields?.[e]??``,onChange:t=>{let n={...D.fields};t.target.value?n[e]=t.target.value:delete n[e],P(D.id,{fields:Object.keys(n).length?n:void 0})},children:[(0,H.jsx)(`option`,{value:``,children:`Not shown`}),n.map(e=>(0,H.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]},e)),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>{let e=ep(n);P(D.id,{fields:Object.keys(e).length?e:void 0})},children:`Guess from this table`}),(0,H.jsx)(`div`,{className:`cg-cat-insp-foot`,children:(0,H.jsxs)(`button`,{type:`button`,className:`cg-btn cg-btn--danger`,onClick:()=>{let t=e.filter(e=>e.id!==D.id);N(t),s(t[0]?.id??null),l(null)},children:[(0,H.jsx)(tqe,{}),` Delete this catalog`]})})]}):(0,H.jsx)(`div`,{className:`cg-cat-insp-blank`,children:`Select a page to edit it.`})}),x?(0,H.jsx)(`div`,{className:`cg-cat-modal-wrap`,role:`dialog`,"aria-modal":`true`,"aria-label":`Print quality`,children:(0,H.jsxs)(`div`,{className:`cg-cat-modal`,children:[(0,H.jsxs)(`h3`,{children:[`Print “`,x.name||`Untitled catalog`,`”`]}),(0,H.jsx)(`p`,{children:`Your browser’s print dialog opens next — choose “Save as PDF” there. Pick the image quality first.`}),(0,H.jsxs)(`button`,{type:`button`,className:`cg-cat-choice`,onClick:()=>{b({cat:x,quality:`print`}),S(null)},children:[(0,H.jsx)(`strong`,{children:`High quality`}),(0,H.jsx)(`em`,{children:`Original master images. Slower, and a much larger PDF — use this for print.`})]}),(0,H.jsxs)(`button`,{type:`button`,className:`cg-cat-choice`,onClick:()=>{b({cat:x,quality:`web`}),S(null)},children:[(0,H.jsx)(`strong`,{children:`Standard`}),(0,H.jsx)(`em`,{children:`The same images you see here. Fast, small file — fine for a proof or email.`})]}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>S(null),children:`Cancel`})]})}):null,y?(0,Up.createPortal)((0,H.jsx)(`div`,{className:`cg-cat-print-portal`,ref:w,children:(0,H.jsx)(sqe,{cat:y.cat,itemsFor:j,quality:y.quality,hasAsset:k})}),document.body):null]})});function lqe(e,t){let n=e.trim().toLowerCase();return t.find(e=>e.trim().toLowerCase()===n)}function uqe(e){let t=e.trim().replace(/[$,%\s]/g,``);if(t===``)return``;let n=Number(t);return Number.isFinite(n)?String(n):void 0}function dqe(e,t,n=Qu(e)){let r=t.replace(/\r/g,``),i=r.trim();switch(e.type){case`formula`:case`created_time`:case`status`:case`automation`:return;case`checkbox`:{if(i===``)return``;let e=i.toLowerCase();return[`1`,`true`,`yes`,`y`,`on`,`checked`,`x`].includes(e)?`1`:[`0`,`false`,`no`,`n`,`off`,`unchecked`].includes(e)?``:void 0}case`int`:case`currency`:case`pct`:return uqe(r);case`rating`:{if(i===``)return``;let t=Number(i);return Number.isInteger(t)&&t>=1&&t<=$u(e)?String(t):void 0}case`select`:case`user`:return i===``?``:lqe(i,n);case`multiselect`:{if(i===``)return``;let e=[],t=new Set;for(let i of r.split(/[,\n]/)){if(!i.trim())continue;let r=lqe(i,n);if(!r)return;let a=r.toLowerCase();t.has(a)||(t.add(a),e.push(r))}return e.length?e.join(`,`):``}case`date`:return i===``||!Number.isNaN(Date.parse(i))?i:void 0;default:return r}}function fqe(e){return e.length>0&&e.every(e=>e.length===1)}var t9={fieldKey:null,armedUntil:0};function pqe(e,t){return{fieldKey:e,armedUntil:t+1e3}}function mqe(e,t){return t<=e.armedUntil?{...e,armedUntil:0}:t9}function hqe(e,t,n){return e<=0?0:!t||t.width!==1||t.x!==n.col||t.y!==n.row?e:Math.max(e,t.height)}function gqe({field:e,sourceFieldKey:t,editable:n,values:r,targetPids:i,allowedChoices:a}){if(!n||!fqe(r)||t&&t!==e.key||i.lengthe==null))return null;let o=[];for(let t=0;t1e4?48:e>1e3?44:e>100?36:32}var s9=null;function Dqe(){if(s9!==null)return s9;if(typeof document>`u`)return 0;let e=document.createElement(`div`);return e.style.cssText=`position:absolute;top:-9999px;width:100px;height:100px;overflow:scroll`,document.body.append(e),s9=e.offsetWidth-e.clientWidth,e.remove(),s9}function c9(e,t){return JSON.stringify(e)===JSON.stringify(t)}function l9(e,t){let n=Nf(t);return{...n,...e,filters:Array.isArray(e?.filters)?e.filters:[],filterConj:e?.filterConj===`or`?`or`:`and`,sorts:Array.isArray(e?.sorts)?e.sorts:[],order:Array.isArray(e?.order)&&e.order.length?e.order:n.order,visible:Array.isArray(e?.visible)&&e.visible.length?e.visible:n.visible,widths:e?.widths&&typeof e.widths==`object`?e.widths:{},memberPids:Array.isArray(e?.memberPids)?e.memberPids:[],display:nd(e?.display),frozenCount:Pee(e?.frozenCount)}}function Oqe(e){return{id:r9,name:`All customers`,kind:`system`,locked:!0,config:Nf(e)}}function kqe(e){try{let t=localStorage.getItem(`aios-grid:${e}`);return t?JSON.parse(t):null}catch{return null}}function Aqe(e,t){try{localStorage.setItem(`aios-grid:${e}`,JSON.stringify(t))}catch{}}function jqe(){return`view_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function Mqe(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e!==``)}function Nqe(e,t){for(let n of e)if(hd(n)){if(Nqe(n.children,t))return!0}else if(n.colId===t)return!0;return!1}function Pqe(e,t){let n=[];for(let r of e)if(hd(r)){let e=Pqe(r.children,t);e.length&&n.push({...r,children:e})}else r.colId!==t&&n.push(r);return n}function u9(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_|_$/g,``).slice(0,28)||`field`}function Fqe(e,t,n,r){let i=`custom_${u9(e)}_${Math.random().toString(36).slice(2,7)}`;return t===`formula`||t===`created_time`?{key:i,label:e,type:t,source:`odoo`,derived:!0,filterable:!0,default:!0,custom:!0,...t===`formula`?{agg:`sum`,...r?.formula?{formula:r.formula}:{}}:{}}:{key:i,label:e,type:t,source:`overlay`,default:!0,custom:!0,agg:[`currency`,`int`].includes(t)?`sum`:void 0,...(t===`select`||t===`multiselect`)&&n?.length?{options:n}:{},...t===`select`||t===`multiselect`?{colorCodeOptions:r?.colorCodeOptions!==!1,...r?.optionColors&&Object.keys(r.optionColors).length?{optionColors:r.optionColors}:{}}:{},...t===`multiselect`?{multi:!0}:{},...t===`rating`?{max:r?.max??5}:{}}}function Iqe({scope:e=`customer`}={}){let t=yd(e),{fields:n,rawRows:r,payload:i,loading:a,overlayEdits:o,setOverlayEdits:s,patchOverlay:c}=Pte(e),[l,u]=(0,z.useState)([]),[d,f]=(0,z.useState)([]),[p,m]=(0,z.useState)(r9),[h,g]=(0,z.useState)(()=>Nf([])),[_,v]=(0,z.useState)(!1),[y,b]=(0,z.useState)(`saved`),[x,S]=(0,z.useState)(``),[C,w]=(0,z.useState)(new Set),[T,E]=(0,z.useState)(void 0),[D,O]=(0,z.useState)(null),[k,A]=(0,z.useState)(null),[j,M]=(0,z.useState)(null),[N,P]=(0,z.useState)(null),F=(0,z.useCallback)(()=>{P(null),requestAnimationFrame(()=>we.current?.focus())},[]),[ee,I]=(0,z.useState)(!1),[te,L]=(0,z.useState)(``),ne=(0,z.useRef)(null),[re,ie]=(0,z.useState)(null),[ae,oe]=(0,z.useState)(!1),[se,ce]=(0,z.useState)(``),[le,ue]=(0,z.useState)(new Set),de=(0,z.useRef)(null),[fe,pe]=(0,z.useState)(null),[me,he]=(0,z.useState)(null),ge=(0,z.useRef)({edited:{},deleted:{}}),[_e,ve]=(0,z.useState)(null),[ye,be]=(0,z.useState)(null),xe=(0,z.useRef)({}),Se=(0,z.useRef)(null),Ce=(0,z.useRef)(null),we=(0,z.useRef)(null),Te=(0,z.useRef)(null),Ee=(0,z.useRef)(t9);(0,z.useEffect)(()=>{let e=()=>{Ee.current=mqe(Ee.current,Date.now())},t=()=>{Ee.current=t9};return document.addEventListener(`copy`,e,!0),window.addEventListener(`blur`,t),()=>{document.removeEventListener(`copy`,e,!0),window.removeEventListener(`blur`,t)}},[]);let[De,Oe]=(0,z.useState)({width:800,height:600}),ke=i?.workspace?.storageKey??`customer-grid-standalone`;(0,z.useEffect)(()=>{if(!i||n.length===0||Se.current===ke)return;let e=kqe(ke),t=of(e?.fieldStamps,Date.now());ge.current={edited:{...t.edited??{}},deleted:{...t.deleted??{}}};let r=Cte(n,e?.fields??[],t,Date.now(),i.workspace!=null),a=i.workspace?.views??[],o=new Map;o.set(r9,Oqe(r));for(let t of e?.views??[])o.set(t.id,t);let s=new Map;for(let t of a){let n=xte(t,o.get(t.id),e?.savedAt,Date.now()),r=bte(n,t,e?.reemitted?.[t.id]);r!==null&&s.set(t.id,r),o.set(t.id,n)}let c=[...o.values()].map(e=>({...e,config:l9(e.config,r)})),l=e?.activeViewId??i.workspace?.activeViewId??r9,d=c.find(e=>e.id===l)??c[0];if(u(r),f(c),m(d.id),g(d.config),v(!0),Se.current=ke,s.size>0){let t={...e?.reemitted??{}};for(let e of c){let n=s.get(e.id);n!==void 0&&(Kd({id:qd(`view`),type:`view_upsert`,view:e}),t[e.id]=n)}xe.current=t}else xe.current={...e?.reemitted??{}}},[i,n,ke]),(0,z.useEffect)(()=>{_&&Aqe(ke,{fields:l,views:d,activeViewId:p,savedAt:Date.now(),fieldStamps:of(ge.current,Date.now()),reemitted:xe.current})},[_,ke,l,d,p]);let Ae=(0,z.useCallback)(e=>{let t=of(ge.current,Date.now());ge.current={edited:{...t.edited??{},[e]:Date.now()},deleted:{...t.deleted??{}}}},[]),je=(0,z.useCallback)(e=>{let t=of(ge.current,Date.now()),n={...t.edited??{}};delete n[e],ge.current={edited:n,deleted:{...t.deleted??{},[e]:Date.now()}}},[]),Me=(0,z.useCallback)(e=>{e.groupBy!==h.groupBy&&w(new Set),g(e)},[h.groupBy]),{visibleCols:Ne,fieldByKey:Pe,order:Fe,visible:Ie,lockedKey:Le,onColumnResize:Re,onColumnMoved:ze,onColumnProposeMove:Be,setColumnVisible:Ve,insertColumn:He}=Dne(l,h,Me);(0,z.useEffect)(()=>{if(!_)return;let e=d.find(e=>e.id===p);if(!e||c9(e.config,h)){b(`saved`);return}return b(`saving`),Ce.current!==null&&window.clearTimeout(Ce.current),Ce.current=window.setTimeout(()=>{let t={...e,config:h};f(e=>e.map(e=>e.id===t.id?t:e)),Kd({id:qd(`view`),type:`view_upsert`,view:t}),b(`saved`),Ce.current=null},420),()=>{Ce.current!==null&&window.clearTimeout(Ce.current)}},[_,p,h,d]),(0,z.useLayoutEffect)(()=>{let e=Te.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect();t.width>0&&t.height>0&&Oe({width:Math.floor(t.width),height:Math.floor(t.height)})};t();let n=new ResizeObserver(t);return n.observe(e),window.addEventListener(`resize`,t),()=>{n.disconnect(),window.removeEventListener(`resize`,t)}},[_]);let Ue=tte(i?.counts)===`server-windowed`,We=i?.workspace?.hideViews===!0,Ge=nd(h.display),Ke=Ue?`grid`:Ge?.mode??`grid`,qe=(0,z.useMemo)(()=>i?.measures??[],[i?.measures]),Je=(0,z.useRef)({}),Ye=(0,z.useMemo)(()=>{let e=i?.measureSets;if(e){let t={};for(let[n,r]of Object.entries(e))t[n]=new Set(r);Je.current=t}return Je.current},[i?.measureSets]),Xe=(0,z.useMemo)(()=>Jf(h.filters,Ye),[h.filters,Ye]),Ze=(0,z.useMemo)(()=>Yf(h.filters).join(`,`),[h.filters]),Qe=(0,z.useMemo)(()=>Object.keys(Ye).join(`,`),[Ye]),$e=(0,z.useMemo)(()=>i?.workspace?.lists??[],[i?.workspace?.lists]),et=(0,z.useMemo)(()=>{let e={};for(let t of $e)t.pids&&(e[t.id]=new Set(t.pids));return e},[$e]),tt=i?.today,nt=i?.viewer,rt=(0,z.useCallback)(e=>Fee(e,nt),[nt]),it=(0,z.useMemo)(()=>Xf(h.filters,{cohortSets:et,today:tt}),[h.filters,et,tt]),at=(0,z.useMemo)(()=>{let e=new Map;for(let t of l){if(t.type!==`formula`)continue;let n=vee(t);n&&e.set(t.key,n)}let{order:t,cyclic:n}=xGe(e),r=[];for(let i of t){if(n.has(i))continue;let t=s7(e.get(i));t.ok&&r.push({key:i,ast:t.ast})}return r},[l]),ot=(0,z.useMemo)(()=>l.filter(e=>e.type===`created_time`).map(e=>e.key),[l]),st=(0,z.useMemo)(()=>{if(at.length===0&&ot.length===0)return r;let e={today:i?.today};return r.map(t=>{let n=o[t.pid],r=n?{...t,...n}:{...t},i={...t};for(let e of ot)i[e]=t._created??null,r[e]=i[e];for(let{key:t,ast:n}of at){let a=bGe(n,e=>r[e],e);i[t]=a,r[t]=a}return i})},[r,o,at,ot,i?.today]),ct=i?.workspace?.cohortMode===!0;(0,z.useEffect)(()=>{ct&&(re&&$e.some(e=>e.id===re)||ie($e[0]?.id??null))},[ct,$e,re]);let lt=ct?$e.find(e=>e.id===re)??null:null,ut=(0,z.useMemo)(()=>new Set(lt?.pids??[]),[lt]),{visibleRows:dt,pidToIndex:ft}=Bne((0,z.useMemo)(()=>ct?st.filter(e=>ut.has(e.pid)):st,[ct,st,ut]),l,h.filters,x,h.sorts,Ue?null:h.groupBy,C,h.memberPids,h.filterConj,Ue,Ye,et,tt,h.cohortLock),[pt,mt]=(0,z.useState)(wqe),ht=dt.length>pt,gt=(0,z.useMemo)(()=>ht?dt.slice(0,pt):dt,[ht,dt,pt]),_t=(0,z.useMemo)(()=>{if(!ht)return ft;let e=new Map;return gt.forEach((t,n)=>{t.kind===`data`&&!e.has(t.record.pid)&&e.set(t.record.pid,n)}),e},[ht,gt,ft]),[vt,yt]=(0,z.useState)(0);(0,z.useEffect)(()=>(Fp(()=>yt(e=>e+1)),()=>Fp(void 0)),[]);let bt=i?.workspace?.userAvatars,xt=(0,z.useMemo)(()=>{if(!h.groupBy)return null;let e=Math.min(vqe(h),Ne.length),t=0;for(let n=0;n{let e=new Set;for(let t of l)t.editRequestId&&t.key.startsWith(`measure_`)&&e.add(t.key);return e},[l]),[Ct,wt]=(0,z.useState)(0),[Tt,Et]=(0,z.useState)(!1);(0,z.useEffect)(()=>{if(Et(!1),St.size===0)return;let e=0,t=window.setInterval(()=>{if(e+=1,e>bqe){window.clearInterval(t),Et(!0);return}wt(e=>e+1)},yqe);return()=>window.clearInterval(t)},[St]);let Dt=Ere(gt,Ne,Pe,o,rt,bt,vt,xt,Cqe,Tt?xqe:St,Ct),{gridSelection:Ot,selectedPids:kt,onGridSelectionChange:At,selectPids:jt,togglePid:Mt,setActiveCell:Nt,clearSelection:Pt}=Dre(gt,_t,Ne.length),Ft=(0,z.useMemo)(()=>Fe.map(e=>Pe.get(e)).filter(e=>!!e),[Fe,Pe]),It=Ot.current?.cell[1],Lt=(0,z.useMemo)(()=>{let e={};for(let t of l){if(t.type===`select`||t.type===`multiselect`){e[t.key]=Qu(t);continue}if(t.type===`user`){e[t.key]=i?.userOptions??[];continue}t.type===`status`&&(e[t.key]=[...new Set(r.map(e=>e[t.key]).filter(e=>e!=null&&e!==``).map(String))].sort())}return e},[l,r,i?.userOptions]),Rt=_qe[h.rowHeightMode],zt=ft.size,Bt=_t.size,Vt=(0,z.useCallback)(e=>{let t=gt[e];if(!(!t||t.kind!==`data`))return e===T?h.colorBy?qte[String(t.record[h.colorBy]??``).toLowerCase()]??Yte:Yte:h.colorBy?Kte[String(t.record[h.colorBy]??``).toLowerCase()]:e===It?Xte:void 0},[gt,h.colorBy,T,It]),Ht=(0,z.useCallback)(e=>{let t=e.kind===`cell`?e.location[1]:void 0;E(e=>e===t?e:t);let n=t===void 0?void 0:gt[t];if(e.kind===`cell`&&n?.kind===`data`&&t!==void 0){let e=n.record.pid,r=we.current?.getBounds(0,t),i=r?_ne(r,Te.current?.getBoundingClientRect()):null;O(t=>i?t&&t.pid===e&&t.x===i.x&&t.y===i.y?t:{pid:e,x:i.x,y:i.y,size:i.size}:null)}if(e.kind===`header`){let t=Ne[e.location[0]],n=t?Pe.get(t.id):void 0,r=n?n.note||n.description:void 0,i=n&&t&&t.title!==n.label&&n?r?`${n.label} — ${r}`:n.label:r,a=e.bounds;if(i&&a){ve(e=>e&&e.text===i&&e.x===a.x?e:{text:i,x:a.x,y:a.y+a.height+4});return}}if(ve(e=>e===null?e:null),e.kind===`cell`&&t!==void 0){let n=gt[t],r=Ne[e.location[0]];if(n?.kind===`data`&&r){let t=Pe.get(r.id),i=t?Mp(t,n.record[t.key]):``,a=e.bounds,o=a?lne(i,Sqe(i),a.width):null;if(o&&a){let e=une(a.x,window.innerWidth,Sqe(o)+20),t=a.y+a.height+4;be(n=>n&&n.text===o&&n.x===e&&n.y===t?n:{text:o,x:e,y:t});return}}}be(e=>e===null?e:null)},[Ne,Pe,gt]),Ut=(0,z.useMemo)(()=>h.groupBy?e=>gt[e]?.kind===`group-header`?32:Rt:Rt,[h.groupBy,Rt,gt]),Wt=(0,z.useMemo)(()=>{let e=Dqe(),t=Eqe(gt.length);for(let e of Ne)t+=e.width??0;let n=o9;if(typeof Ut==`number`)n+=gt.length*Ut;else for(let e=0;eDe.height,i=t>De.width;r&&!i&&(i=t>De.width-e),i&&!r&&(r=n>De.height-e);let a=De.width-(r?e:0),o=De.height-(i?e:0);return{clientW:a,clientH:o,below:n{k!==null&&qt===void 0&&A(null)},[k,qt]);let Jt=(0,z.useMemo)(()=>{if(qt===void 0)return null;let e=Kt[qt];return!e||e.kind!==`data`?null:o[e.record.pid]?{...e.record,...o[e.record.pid]}:e.record},[qt,Kt,o]),Yt=(0,z.useMemo)(()=>qt===void 0?0:Kt.slice(0,qt+1).filter(e=>e.kind===`data`).length,[qt,Kt]),Xt=(0,z.useCallback)(e=>{if(qt===void 0)return!1;for(let t=qt+e;t>=0&&t{if(qt!==void 0)for(let t=qt+e;t>=0&&t{let n=e.column.id?Pe.get(e.column.id):void 0;if(e.ctx.font=`${e.theme.headerFontStyle} ${e.theme.fontFamily}`,t(),!n)return;let r=!!(n.note||n.description),i=n.source===`overlay`,a=pne(e.rect,e.menuBounds.width,mne(r,i));if(!a)return;let o=0;if(r){let t=a[o++];e.spriteManager.drawSprite(`aiosInfo`,`normal`,e.ctx,t.x,t.y,t.size,e.theme)}if(i){let t=a[o++],n=e.ctx;n.save(),n.beginPath(),n.arc(t.x+t.size/2,t.y+t.size/2,t.size/2,0,Math.PI*2),n.fillStyle=Qte,n.fill(),n.restore()}},[Pe]),$t=(0,z.useCallback)((e,t)=>{let n=gt[e[1]];if(!n)return;if(Bd(Rd),n.kind===`group-header`){t.preventDefault(),w(e=>{let t=new Set(e);return t.has(n.groupKey)?t.delete(n.groupKey):t.add(n.groupKey),t});return}let r=Ne[e[0]],i=r?Pe.get(r.id):void 0;if(n.kind===`data`&&i&&rt(i)&&(Xu(i.type)||i.type===`rating`)){t.preventDefault(),Nt(e[0],e[1]);let r=t.bounds;P({pid:n.record.pid,fieldKey:i.key,anchor:{left:r.x,top:r.y,right:r.x+r.width,bottom:r.y+r.height,width:r.width,height:r.height}});return}if(n.kind===`data`&&i?.type===`url`){let e=String(o[n.record.pid]?.[i.key]??n.record[i.key]??``).trim();if(e){let n=/^https?:\/\//i.test(e)?e:/^[\w-]+(\.[\w-]+)+/.test(e)?`https://${e}`:null;if(n){t.preventDefault(),window.open(n,`_blank`,`noopener`);return}}}n.kind===`data`&&i&&i.key===Le&&Mt(n.record.pid)},[gt,Ne,Pe,rt,o,Le,Mt,Nt]),en=(0,z.useCallback)(e=>{let t=gt[e[1]],n=Ne[e[0]],r=n?Pe.get(n.id):void 0;t?.kind===`data`&&r?.source!==`overlay`&&A(t.record.pid)},[gt,Ne,Pe]),tn=(0,z.useCallback)((e,t)=>{let n=gt[e[1]],r=Ne[e[0]],i=r?Pe.get(r.id):void 0;if(!(!n||n.kind!==`data`||!i||!rt(i))){if(t.kind===R.Boolean&&i.type===`checkbox`){c(n.record.pid,{[i.key]:t.data?`1`:``});return}if(t.kind===R.Uri){c(n.record.pid,{[i.key]:t.data??``});return}(t.kind===R.Text||t.kind===R.Number)&&c(n.record.pid,{[i.key]:t.data})}},[gt,Ne,Pe,c,rt]),nn=(0,z.useCallback)(e=>{let t=gt[e[1]],n=Ne[e[0]],r=n?Pe.get(n.id):void 0;return!!t&&t.kind===`data`&&!!r&&rt(r)&&!Xu(r.type)&&r.type!==`rating`&&r.type!==`status`},[gt,Ne,Pe,rt]),B=(0,z.useCallback)((e,t)=>{let n=Ne[e[0]],r=n?Pe.get(n.id):void 0;if(!r)return!1;let i=hqe(t.length,Ot.current?.range,{col:e[0],row:e[1]}),a=Array.from({length:i},(t,n)=>{let r=gt[e[1]+n];return r?.kind===`data`?r.record.pid:null}),o=gqe({field:r,sourceFieldKey:Ee.current.fieldKey,editable:rt(r),values:t,targetPids:a,allowedChoices:Lt[r.key]??Qu(r)});if(!o)return!1;for(let e of o)c(e.pid,{[r.key]:e.value});return!1},[Ne,Pe,rt,Lt,gt,c,Ot.current]),rn=(0,z.useCallback)((e,t)=>{let n=Ne[e];n?.id&&M({fieldKey:n.id,anchor:{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height,width:t.width,height:t.height}})},[Ne]),an=(0,z.useCallback)((e,t)=>{t.isEdge||(t.preventDefault(),rn(e,t.bounds))},[rn]),on=(0,z.useCallback)(e=>{if(e.key.toLowerCase()===`c`&&(e.ctrlKey||e.metaKey)&&!e.altKey){let e=Ot.current?.range,t=e?.width===1?Ne[e.x]:void 0;Ee.current=pqe(t?.id??null,Date.now());return}if(e.key===`Enter`&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let t=Ot.current?.cell;if(t){e.preventDefault(),e.stopPropagation(),e.cancel();let n=gt[t[1]],r=Ne[t[0]],i=r?Pe.get(r.id):void 0;if(!e.shiftKey&&n?.kind===`data`&&i&&rt(i)&&(Xu(i.type)||i.type===`rating`)){let e=we.current?.getBounds(t[0],t[1]);if(e){P({pid:n.record.pid,fieldKey:i.key,anchor:{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height,width:e.width,height:e.height}});return}}let a=e.shiftKey?-1:1,o=t[1]+a;for(;o>=0&&o=0&&o0?e.location[0]-1:void 0,r=Ot.current?.cell[0]??n;if(!t||r===void 0||!e.bounds)return;let i=Te.current?.getBoundingClientRect()?.top??e.bounds.y;e.preventDefault(),e.stopPropagation(),e.cancel(),rn(r,{x:e.bounds.x,y:i,width:e.bounds.width,height:36})},[Ot.current,rn,gt,Nt,Ne,Pe,rt]),sn=(0,z.useCallback)(e=>{f(t=>t.some(t=>t.id===e.id)?t.map(t=>t.id===e.id?e:t):[...t,e]),Kd({id:qd(`view`),type:`view_upsert`,view:e})},[]),cn=(0,z.useCallback)((e,t)=>{let n=d.find(t=>t.id===e);if(!n)return;let r={...n.config};t?r.cohortLock=t:delete r.cohortLock,sn({...n,config:r}),e===p&&g(e=>{let n={...e};return t?n.cohortLock=t:delete n.cohortLock,n})},[d,p,sn]),ln=(0,z.useCallback)(e=>{let t=d.find(e=>e.id===p);t&&!c9(t.config,h)&&sn({...t,config:h});let n=d.find(t=>t.id===e);n&&(m(e),g(l9(n.config,l)),w(new Set),S(``),A(null),mt(wqe),Kd({id:qd(`view`),type:`view_select`,viewId:e}),Bd(Rd))},[d,p,h,sn,l]),un=(0,z.useCallback)((e,t,n)=>{let r=Zu(e,d.map(e=>e.name)),i={...h,display:nd({...h.display??{},mode:t})},a={id:jqe(),name:r,kind:`custom`,config:i,permissions:n};sn(a),m(a.id),g(i),b(`saved`)},[h,sn,d]),dn=(0,z.useCallback)((e,t)=>{let n=d.find(t=>t.id===e);if(n){let r=Zu(t,d.filter(t=>t.id!==e).map(e=>e.name));sn({...n,name:r})}},[d,sn]),V=(0,z.useCallback)((e,t)=>{let n=d.find(t=>t.id===e);!n||!Cd(n,nt)||sn({...n,locked:t})},[d,sn,nt]),fn=(0,z.useCallback)((e,t)=>{let n=d.find(t=>t.id===e);n&&sn({...n,note:t.slice(0,2e3)})},[d,sn]),pn=(0,z.useCallback)(e=>{let t=d.find(t=>t.id===e);if(!t)return;let n={...t,id:jqe(),name:Zu(`${t.name} copy`,d.map(e=>e.name)),kind:`custom`,locked:!1,permissions:{edit:`personal`},createdBy:void 0,config:{...t.config}};sn(n),m(n.id),g(n.config)},[d,sn]),mn=(0,z.useCallback)(e=>{let t=d.find(t=>t.id===e);if(!(!t||bd(t)||!Td(t,nt))&&(f(t=>t.filter(t=>t.id!==e)),Kd({id:qd(`view-delete`),type:`view_delete`,viewId:e}),p===e)){let e=d.find(e=>e.id===r9)??Oqe(l);m(e.id),g(e.config)}},[d,p,l,nt]);(0,z.useEffect)(()=>{if(!ct||!_||!re)return;let e=`cohort:${re}`;if(p===e)return;let t=d.find(e=>e.id===p);t&&!c9(t.config,h)&&sn({...t,config:h});let n=d.find(t=>t.id===e),r=n??{id:e,name:$e.find(e=>e.id===re)?.name??`Cohort`,kind:`custom`,config:Nf(l)};n||f(e=>[...e,r]),m(e),g(l9(r.config,l)),w(new Set),S(``)},[ct,_,re,p,d,h,l,$e,sn]);let hn=(0,z.useCallback)((e,t,n)=>{if(Ue)return;let r=d.find(t=>t.id===e);if(!r||Jf(r.config.filters,Ye)>0)return;let{visibleRows:i}=Qf({rawRows:st,fields:l,filters:r.config.filters,search:``,sorts:r.config.sorts,groupBy:null,collapsed:new Set,memberPids:r.config.memberPids,filterConj:r.config.filterConj??`and`,measureSets:Ye,cohortSets:et,today:tt}),a=i.filter(e=>e.kind===`data`).map(e=>e.record.pid);Kd({id:qd(`addlist`),type:`add_to_list`,viewId:e,cohortId:t,name:n,pids:a})},[d,st,l,Ue,Ye,et,tt]),[gn,_n]=(0,z.useState)({}),[vn,yn]=(0,z.useState)([]),bn=i?.workspace?.folders,xn=(0,z.useMemo)(()=>iGe(bn,vn,gn,Date.now()),[bn,vn,gn]),Sn=(0,z.useCallback)(e=>aGe(e,d.find(t=>t.id===e)?.folderId??null,xn,gn,Date.now()),[d,xn,gn]),Cn=(0,z.useCallback)(e=>{_n(t=>rGe(e(t),Date.now()))},[]),wn=(0,z.useCallback)(e=>{let t=new Set,n=[],r=0;for(let i of d){if(Sn(i.id)!==e)continue;if(Ue){n.push({name:i.name,why:`this table loads one page at a time`});continue}if(Jf(i.config.filters,Ye)>0){n.push({name:i.name,why:`a metric condition has no answer yet`});continue}r+=1;let{visibleRows:a}=Qf({rawRows:st,fields:l,filters:i.config.filters,search:``,sorts:i.config.sorts,groupBy:null,collapsed:new Set,memberPids:i.config.memberPids,filterConj:i.config.filterConj??`and`,measureSets:Ye,cohortSets:et,today:tt});for(let e of a)e.kind===`data`&&t.add(e.record.pid)}return{pids:[...t],counted:r,skipped:n}},[d,Sn,Ue,st,l,Ye,et,tt]),Tn=(0,z.useCallback)((e,t,n)=>{let{pids:r}=wn(e);r.length&&Kd({id:qd(`addlist`),type:`add_to_list`,viewId:``,cohortId:t,name:n,pids:r})},[wn]),En=(0,z.useCallback)((e,t,n,r)=>{if(Ue||Jf(t.filters,Ye)>0)return;let{visibleRows:i}=Qf({rawRows:n,fields:l,filters:t.filters,search:``,sorts:t.sorts,groupBy:null,collapsed:new Set,memberPids:t.memberPids,filterConj:t.filterConj??`and`,measureSets:Ye,cohortSets:et,today:tt}),a=i.filter(e=>e.kind===`data`).map(e=>o[e.record.pid]?{...e.record,...o[e.record.pid]}:e.record),s=new Set(t.order),c=[...t.order,...l.map(e=>e.key).filter(e=>!s.has(e))],u=new Set(t.visible),d=c.filter(e=>u.has(e)).map(e=>Pe.get(e)).filter(e=>!!e);i7(r,e,tt,d,a)},[Ue,l,Pe,Ye,et,tt,o]),Dn=(0,z.useRef)(null),On=(0,z.useCallback)(e=>{Dn.current=e},[]),kn=(0,z.useRef)(null),An=(0,z.useCallback)(e=>{kn.current=e},[]),jn=(0,z.useCallback)((e,t)=>{let n=d.find(t=>t.id===e);if(!n)return;let r=l9(n.config,l),i=nd(r.display),a=e===p,o=e=>Bd(Fd,`Open "${n.name}" first: ${e} is exported from what it draws on screen.`);if(i?.mode===`timeseries`){let e=a?Dn.current:null;if(!e)return o(`a time series`);if(e.empty){Bd(Fd,`"${n.name}" has no metrics on its sheet yet — add one, then export.`);return}if(t===`csv`)r7(WWe(n.name,tt,t),new Blob([``+Hie(e)],{type:`text/csv;charset=utf-8`}));else{let{fields:r,rows:i}=Uie(e);i7(t,n.name,tt,r,i)}return}if(i?.mode===`catalog`){Bd(Fd,`"${n.name}" is a catalog — open it and use Print to save it as a PDF. A spreadsheet of its products is not what it draws.`);return}if(i?.mode===`calendar`&&i.calendarMode===`summary`){let e=a?kn.current:null;if(!e)return o(`a calendar summary`);i7(t,n.name,tt,e.fields,e.rows);return}En(n.name,r,st,t)},[d,l,st,En,p,tt]),Mn=(0,z.useCallback)((e,t)=>{let n=[...kt];!n.length||Ue||(Kd({id:qd(`addlist`),type:`add_to_list`,viewId:p,cohortId:e,name:t,pids:n}),I(!1),L(``),Pt())},[kt,Ue,p,Pt]),Nn=i?.workspace?.scopeChoice===!0,Pn=h.cohortLock,Fn=(0,z.useMemo)(()=>{let e=Pn;if(!e)return;let t=$e.find(t=>t.id===e);return t?{name:t.name,count:t.pids?.length??0}:{}},[Pn,$e]),In=i?.workspace?.recordLayout?.order,Ln=(0,z.useCallback)(e=>{Kd({id:qd(`rlayout`),type:`record_layout`,order:e})},[]),Rn=(0,z.useCallback)((e,t)=>{let n=qd(`field`),r={...e,label:Zu(e.label,l.filter(t=>t.key!==e.key).map(e=>e.label)),editRequestId:n};delete r.labelCorrectedFrom,delete r.labelCorrectionId,Ae(r.key),u(e=>e.some(e=>e.key===r.key)?e.map(e=>e.key===r.key?r:e):[...e,r]),Kd({id:n,type:`field_upsert`,field:r,...t?{scope:t}:{}})},[Ae,l]),zn=(0,z.useCallback)((e,t,n,r,i,a,o)=>{let s=Nn?o?.scope:void 0,c=s===`cohort`?{scope:`cohort`}:{};if(a){let i={key:`measure_${u9(e)}_${Math.random().toString(36).slice(2,7)}`,label:e,type:t,source:`odoo`,default:!0,custom:!0,derived:!0,filterable:!1,agg:[`currency`,`int`].includes(t)?`sum`:void 0,measure:a,...c};Rn(i,s),He(i.key,n,r);return}let l={...Fqe(e,t,i,o),...c};Rn(l,s),He(l.key,n,r)},[He,Rn,Nn]),Bn=(0,z.useCallback)((e,t)=>{if(e===Le||e===t||!Pe.has(t))return;let n=Fe.filter(e=>e!==t),r=n.indexOf(e);if(r<0)return;n.splice(r,0,t);let i=new Set(Ie);i.delete(e),i.add(t),Me({...h,order:n,visible:[...i]})},[h,Me,Fe,Ie,Pe,Le]),Vn=(0,z.useCallback)(e=>{if(!Pe.get(e)?.custom||e===Le)return;u(t=>t.filter(t=>t.key!==e));let t={...h.widths??{}};delete t[e],Me({...h,order:Fe.filter(t=>t!==e),visible:[...Ie].filter(t=>t!==e),widths:t,sorts:(h.sorts??[]).filter(t=>t.colId!==e),groupBy:h.groupBy===e?null:h.groupBy,colorBy:h.colorBy===e?null:h.colorBy}),je(e),Kd({id:qd(`fielddel`),type:`field_delete`,key:e})},[h,Me,Fe,Ie,Pe,Le,je]),Hn=(0,z.useCallback)((e,t,n,r,i)=>{let a=Nn?i?.scope:void 0,o={...Fqe(t,n,r,i),...a===`cohort`?{scope:`cohort`}:{}};Rn(o,a),Bn(e,o.key)},[Rn,Bn,Nn]),Un=(0,z.useCallback)((e,t,n,r)=>{let i=Pe.get(e);if(!i?.custom||i.source!==`overlay`||t===`formula`||t===`created_time`)return;let a=e=>e===`int`||e===`currency`,o=i.format&&(a(i.type)&&a(t)||i.type===t),s={key:e,label:r?.label?.trim()||i.label,type:t,source:`overlay`,default:i.default,custom:!0,agg:[`currency`,`int`].includes(t)?`sum`:void 0,...i.note?{note:i.note}:{},...i.description?{description:i.description}:{},...i.scope?{scope:i.scope}:{},...i.createdBy?{createdBy:i.createdBy}:{},...i.permissions?{permissions:i.permissions}:{},...o?{format:i.format}:{},...(t===`select`||t===`multiselect`)&&n?.length?{options:n}:{},...t===`select`||t===`multiselect`?{colorCodeOptions:r?.colorCodeOptions!==!1,...r?.optionColors&&Object.keys(r.optionColors).length?{optionColors:r.optionColors}:{}}:{},...t===`multiselect`?{multi:!0}:{},...t===`rating`?{max:r?.max??5}:{}};Rn(s)},[Pe,Rn]),Wn=(0,z.useCallback)(e=>{let t=e.key.startsWith(`measure_`)?`measure_`:`custom_`,n=Zu(`${e.label} copy`,l.map(e=>e.label)),r=`${t}${u9(n)}_${Math.random().toString(36).slice(2,7)}`,i=qd(`fielddup`),a={...e,key:r,label:n,editRequestId:i};delete a.createdBy,delete a.permissions,delete a.labelCorrectedFrom,delete a.labelCorrectionId,Ae(r),u(e=>[...e,a]),Kd({id:i,type:`field_duplicate`,sourceKey:e.key,key:r,label:n,...Nn&&e.scope===`cohort`?{scope:`cohort`}:{}}),He(r,e.key,`right`)},[He,Nn,Ae,l]),Gn=(0,z.useCallback)((e,t)=>{let n=Pe.get(e);if(!n?.measure)return;let r=qe.find(e=>e.key===n.measure?.key),i=r?`${r.label} · ${qu(n.measure.window)}`:null,a=r&&i&&n.label===i?`${r.label} · ${qu(t)}`:n.label;Rn({...n,label:a,measure:{...n.measure,window:t}})},[Pe,qe,Rn]),Kn=(0,z.useCallback)(()=>{if(!re)return;let e=[...kt].filter(e=>ut.has(e));e.length&&(Kd({id:qd(`cohortrm`),type:`cohort_remove`,cohortId:re,pids:e}),Pt())},[re,kt,ut,Pt]),qn=(0,z.useCallback)(()=>{!re||le.size===0||(Kd({id:qd(`cohortadd`),type:`cohort_add`,cohortId:re,pids:[...le]}),ue(new Set),ce(``),oe(!1))},[re,le]),Jn=(0,z.useMemo)(()=>{if(!ae)return[];let e=se.trim().toLowerCase(),t=[];for(let n of r){if(ut.has(n.pid))continue;let r=String(n[Le]??``);e&&!r.toLowerCase().includes(e)||t.push({pid:n.pid,name:r})}return t},[ae,se,r,ut,Le]),Yn=(0,z.useMemo)(()=>Fe.filter(e=>Ie.has(e)),[Fe,Ie]),Xn=vqe(h),Zn=(0,z.useCallback)(e=>{let t=Yn.indexOf(e);if(t<0)return;if(t<8){Me({...h,frozenCount:Pee(t+1)});return}let n=Yn.filter(t=>t!==e);n.splice(7,0,e);let r=0,i=Fe.map(e=>Ie.has(e)?n[r++]:e);Me({...h,order:i,frozenCount:8})},[Yn,Fe,Ie,h,Me]),Qn=(0,z.useCallback)(()=>Me({...h,frozenCount:void 0}),[h,Me]),$n=(0,z.useCallback)(e=>{let t=d.find(e=>e.id===p);if(t&&Sd(t))return;let n=nd(h.display);if(e===`grid`){Me({...h,display:n?nd({...n,mode:`grid`}):void 0});return}Me({...h,display:{...n??{},mode:e}})},[h,Me,d,p]),er=(0,z.useCallback)((e,t)=>{let n=nd(h.display);if(!n)return;let r={...n,[e]:t};t||delete r[e],Me({...h,display:r})},[h,Me]),tr=(0,z.useCallback)(e=>{let t=nd(h.display);if(!t)return;let n={...t};e===!1?n.kanbanClamp=!1:delete n.kanbanClamp,Me({...h,display:n})},[h,Me]),nr=(0,z.useCallback)(e=>{let t=nd(h.display);if(!t)return;let n={...t},r=e.slice(0,4);r.length?n.calendarMetrics=r:delete n.calendarMetrics,Me({...h,display:n})},[h,Me]),rr=(0,z.useCallback)(e=>{let t=nd(h.display);if(!t)return;let n={...t};e===`summary`?n.calendarMode=`summary`:delete n.calendarMode,Me({...h,display:n})},[h,Me]),ir=(0,z.useMemo)(()=>l.filter(e=>id(e.type)),[l]),ar=(0,z.useMemo)(()=>l.filter(e=>e.type===`status`||e.type===`select`),[l]),or=(e,t,n)=>(e?t.find(t=>t.key===e):void 0)||((n?t.find(e=>e.key===n):void 0)??t[0]),sr=(0,z.useMemo)(()=>UGe(Ge?.charts)??[],[Ge?.charts]),cr=(0,z.useCallback)(e=>{let t=nd(h.display);if(!t)return;let n={...t,charts:e};e.length||delete n.charts,Me({...h,display:n})},[h,Me]),lr=(0,z.useMemo)(()=>l.filter(e=>e.type===`status`||e.type===`select`),[l]),ur=(0,z.useMemo)(()=>l.filter(e=>rd(e.type)),[l]),dr=Ge?.colorField?lr.find(e=>e.key===Ge.colorField):void 0,fr=Ge?.sizeField?ur.find(e=>e.key===Ge.sizeField):void 0,pr=or(Ge?.dateField,ir,`last_order`),mr=or(Ge?.stackField,ar),hr=(0,z.useMemo)(()=>{if(Ke!==`calendar`&&Ke!==`kanban`&&Ke!==`map`&&Ke!==`chart`&&Ke!==`timeseries`&&Ke!==`catalog`)return[];let e=new Set,t=[];for(let n of dt){if(n.kind!==`data`||e.has(n.record.pid))continue;e.add(n.record.pid);let r=o[n.record.pid];t.push(r?{...n.record,...r}:n.record)}return t},[Ke,dt,o]),gr=(0,z.useMemo)(()=>mr?Yn.filter(e=>e!==Le&&e!==mr.key).slice(0,3):[],[Yn,Le,mr]),_r=(0,z.useCallback)((e,t)=>{mr&&c(e,{[mr.key]:t})},[mr,c]),vr=(0,z.useCallback)(e=>{w(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),yr=(0,z.useMemo)(()=>Ke===`timeseries`?hr.map(e=>e.pid):[],[Ke,hr]),br=(0,z.useMemo)(()=>Ke===`catalog`?Ge?.catalogs??[]:[],[Ke,Ge]),xr=(0,z.useMemo)(()=>Ke===`catalog`?hr.map(e=>e[$f]).filter(e=>typeof e==`string`&&!!e):[],[Ke,hr]),Sr=(0,z.useCallback)(e=>{let t=nd(h.display)??{mode:`catalog`};Me({...h,display:{...t,catalogs:e}})},[h,Me]),Cr=(0,z.useCallback)(e=>{let t=nd(h.display)??{mode:`timeseries`};Me({...h,display:{...t,...e}})},[h,Me]),wr=!!mr&&mr.type===`select`&&rt(mr),Tr=mr?mr.type===`status`?`Stacked by ${mr.label} — read-only, computed from the source system.`:rt(mr)?null:`You do not have permission to edit this field, so cards cannot be moved.`:null;if(a||!_)return(0,H.jsx)(`div`,{className:`cg-loading`,children:(0,H.jsx)(`span`,{className:`lp-spin lp-spin--lg`,role:`status`,"aria-label":`Loading`})});let Er=d.find(e=>e.id===p),Dr=ct?(0,H.jsx)(`button`,{type:`button`,className:`cg-tb-btn cg-tb-addcust`,ref:de,disabled:!re,onClick:()=>oe(e=>!e),"aria-expanded":ae,"aria-haspopup":`dialog`,children:`+ Add customers`}):void 0,Or=new Set(l.filter(e=>e.custom&&e.key!==Le).map(e=>e.key)),kr=j?Pe.get(j.fieldKey):void 0,Ar=kr?h.sorts.find(e=>e.colId===kr.key)?.dir??null:null,jr=kr?Nqe(h.filters,kr.key):!1,Mr=kr?Yn.indexOf(kr.key):-1,Nr=Mr>=0&&Xn>1&&Mr+1===Xn,Pr=Ue?void 0:(0,H.jsx)(KGe,{mode:Ke,onMode:$n,locked:!!Er&&Sd(Er),dateField:pr,dateChoices:ir,stackField:mr,stackChoices:ar,colorField:dr,colorChoices:lr,sizeField:fr,sizeChoices:ur,onPickField:er,clamped:Ge?.kanbanClamp!==!1,onClamp:tr,calendarMode:Ge?.calendarMode??`records`,onCalendarMode:rr,calendarMetrics:Ge?.calendarMetrics,metricChoices:ur,onCalendarMetrics:nr}),Fr=N?Pe.get(N.fieldKey):void 0,Ir=Fr?Fr.type===`user`?i?.userOptions??[]:Qu(Fr):[],Lr=N?r.find(e=>e.pid===N.pid):void 0,Rr=String((N&&o[N.pid]?.[N.fieldKey])??(Fr&&Lr?Lr[Fr.key]:``)??``),zr=Fr?.type===`multiselect`,Br=zr?Mqe(Rr):[],Vr=Ir.length?zr?Br.find(e=>Ir.includes(e))??Ir[0]:Ir.includes(Rr)?Rr:Ir[0]:null;return(0,H.jsxs)(`div`,{className:`cg-shell`,"data-today":tt??``,"data-measure-rules":Ze,"data-measure-sets":Qe,children:[!We&&(0,H.jsx)(cGe,{onCohortLock:cn,views:d,activeViewId:p,saveState:y,onSelect:ln,onCreate:un,onRename:dn,onNote:fn,onDuplicate:pn,onDelete:mn,lists:$e,onAddToList:Ue?void 0:hn,today:tt,onExport:Ue?void 0:jn,folders:xn,folderIdOf:Sn,onFolderCreate:(e,t)=>{let n=sGe();yn(r=>[...r.slice(-31),{id:n,name:e,order:9999,icon:t}]),Cn(e=>({...e,created:{...e.created,[n]:Date.now()}})),Kd({id:qd(`foldnew`),type:`folder_create`,surface:`views`,folderId:n,name:e,icon:t})},onFolderRename:(e,t)=>{Cn(n=>({...n,renamed:{...n.renamed,[e]:{at:Date.now(),name:t}}})),Kd({id:qd(`foldren`),type:`folder_rename`,surface:`views`,folderId:e,name:t})},onFolderDelete:e=>{Cn(t=>({...t,deleted:{...t.deleted,[e]:Date.now()}})),Kd({id:qd(`folddel`),type:`folder_delete`,surface:`views`,folderId:e})},onFolderDuplicate:e=>{let t=sGe(),n=xn.find(t=>t.id===e);yn(e=>[...e.slice(-31),{id:t,name:`${n?.name??`Folder`} copy`,order:9999}]),Cn(e=>({...e,created:{...e.created,[t]:Date.now()}})),Kd({id:qd(`folddup`),type:`folder_duplicate`,surface:`views`,folderId:e,newId:t})},onItemMove:(e,t)=>{Cn(n=>({...n,moved:{...n.moved,[e]:{at:Date.now(),folderId:t}}})),Kd({id:qd(`itemmove`),type:`item_move`,surface:`views`,itemId:e,folderId:t})},folderAddPreview:Ue?void 0:wn,onFolderAddToList:Ue?void 0:Tn,viewer:nt,onToggleLock:V,userOptions:i?.userOptions}),(0,H.jsxs)(`main`,{className:`cg-main`,children:[(0,H.jsx)(fie,{nouns:t.nouns,cohortLock:Fn,copyViews:d.filter(e=>e.id!==p),onCopyConfig:e=>Me({...h,...e}),fields:l,visible:Ie,lockedKey:Le,onColumnVisible:Ve,onColumnsVisible:e=>Me({...h,visible:[...new Set([Le,...e])]}),orderedFields:Ft,onFieldOrder:e=>Me({...h,order:e}),deletableKeys:Or,onDeleteField:Vn,colorOn:h.colorBy!==null,onToggleColor:e=>Me({...h,colorBy:e?l.find(e=>e.type===`status`)?.key??null:null}),rowHeightMode:h.rowHeightMode,onRowHeightMode:e=>Me({...h,rowHeightMode:e}),filters:h.filters,onFilters:e=>Me({...h,filters:e}),filterConj:h.filterConj??`and`,onFilterConj:e=>Me({...h,filterConj:e}),sorts:h.sorts,onSorts:e=>Me({...h,sorts:e}),groupBy:Ue?null:h.groupBy,onGroupBy:e=>Me({...h,groupBy:e}),statusValues:Lt,measures:qe,unresolvedCount:it,lists:$e,pendingMeasureCount:Xe,search:x,onSearch:S,recordCount:zt,scopeCounts:i?.counts,pool:i?.workspace?.pool,serverWindowed:Ue,cohortAction:Dr,filterSeed:fe,modeControl:Pr}),(0,H.jsxs)(`div`,{className:`cg-grid-box`,ref:Te,onMouseLeave:()=>O(e=>e===null?e:null),children:[Ke===`grid`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(dee,{ref:we,columns:Ne,getCellContent:Dt,rows:gt.length,theme:bf,freezeColumns:Xn,rowHeight:Ut,headerHeight:36,rowMarkers:`both`,rowMarkerWidth:Eqe(gt.length),gridSelection:Ot,onGridSelectionChange:At,getRowThemeOverride:Vt,onItemHovered:Ht,onCellClicked:$t,onCellActivated:en,onCellEdited:tn,onPaste:B,validateCell:nn,onColumnResize:Re,onColumnMoved:ze,onColumnProposeMove:Be,drawHeader:Qt,onHeaderMenuClick:(e,t)=>rn(e,t),onHeaderClicked:an,onHeaderContextMenu:an,onKeyDown:on,maxColumnWidth:600,getCellsForSelection:!0,rowSelectionMode:`multi`,smoothScrollX:!0,smoothScrollY:!0,width:De.width,height:De.height,customRenderers:[bre,_re,yre],headerIcons:cne,rightElement:(0,H.jsx)(`button`,{type:`button`,className:`cg-add-field-btn`,"aria-label":`Add field`,title:`Add a field`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();he({left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:t.width,height:t.height})},children:`+`}),rightElementProps:{sticky:!0,fill:!1}}),Wt.below!==null&&(0,H.jsx)(`div`,{className:`cg-grid-void`,"aria-hidden":!0,style:{top:Wt.below,left:0,width:Wt.clientW,height:Wt.clientH-Wt.below}}),Wt.right!==null&&(0,H.jsx)(`div`,{className:`cg-grid-void`,"aria-hidden":!0,style:{top:o9,left:Wt.right,width:Wt.clientW-Wt.right,height:Wt.clientH-o9}})]}),Ke===`list`&&(0,H.jsx)(qGe,{rows:gt,fieldByKey:Pe,visibleKeys:Yn,titleKey:Le,onOpen:A,onToggleGroup:vr}),Ke===`calendar`&&(pr?(0,H.jsx)(ZGe,{rows:hr,field:pr,today:tt,titleKey:Le,mode:Ge?.calendarMode??`records`,metrics:Ge?.calendarMetrics,fieldByKey:Pe,scope:e,onOpen:A,onSheet:An}):(0,H.jsx)(`div`,{className:`cg-mode-empty`,children:`This table has no date field to place records by.`})),Ke===`kanban`&&(mr?(0,H.jsx)(QGe,{rows:hr,field:mr,fieldByKey:Pe,cardKeys:gr,titleKey:Le,canMove:wr,readOnlyReason:Tr,clamped:Ge?.kanbanClamp!==!1,onMove:_r,onOpen:A}):(0,H.jsx)(`div`,{className:`cg-mode-empty`,children:`This table has no status or single-select field to stack by.`})),Ke===`chart`&&(0,H.jsx)(_Ke,{rows:hr,fields:l,fieldByKey:Pe,charts:sr,onCharts:cr}),Ke===`timeseries`&&(0,H.jsx)(_We,{scope:e,pids:yr,fields:l,rows:hr,display:Ge,onDisplay:Cr,onSheet:On}),Ke===`catalog`&&(e===`product`?(0,H.jsx)(cqe,{catalogs:br,onCatalogs:Sr,fields:l,fieldByKey:Pe,poolRows:r,filteredCodes:xr}):(0,H.jsx)(`div`,{className:`cg-mode-empty`,children:`A catalog prints products. Open the Products table to build one.`})),Ke===`map`&&Pe.get(Le)&&(0,H.jsx)(YKe,{rows:hr,field:Pe.get(Le),colorField:dr,sizeField:fr,selectedPids:kt,onSelectPids:jt,onOpen:A}),Ke===`grid`&&D&&(0,H.jsx)(`button`,{type:`button`,className:`cg-row-expand`,style:{left:D.x,top:D.y,width:D.size,height:D.size},title:`Expand record`,"aria-label":`Expand record`,onMouseDown:e=>e.preventDefault(),onClick:()=>A(D.pid),children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`13`,height:`13`,"aria-hidden":!0,focusable:`false`,children:(0,H.jsx)(`path`,{d:`M9.5 2.5H13.5V6.5M6.5 13.5H2.5V9.5M13.5 2.5L9 7M2.5 13.5L7 9`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}),_e&&(0,H.jsx)(`div`,{className:`cg-header-tip`,style:{left:_e.x,top:_e.y},"aria-hidden":!0,children:_e.text}),ye&&(0,H.jsx)(`div`,{className:`cg-header-tip cg-cell-tip`,style:{left:ye.x,top:ye.y},"aria-hidden":!0,children:ye.text}),kt.size>0&&!Ue&&(Ke===`grid`||Ke===`map`)&&(0,H.jsxs)(`div`,{className:`cg-selbar`,children:[(0,H.jsxs)(`span`,{className:`cg-selbar-count`,children:[kt.size.toLocaleString(),` selected`]}),ct?(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--danger cg-selbar-remove`,style:n9,onClick:Kn,children:`Remove from cohort`}):(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary cg-selbar-add`,style:n9,ref:ne,onClick:()=>{if(!ee){let e=Er?.name??`Customers`;L(tt?`${e} · ${tt}`:e)}I(!ee)},"aria-expanded":ee,"aria-haspopup":`dialog`,children:`Add to cohort`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,style:n9,onClick:Pt,children:`Clear`})]})]}),ht&&(Ke===`grid`||Ke===`list`)&&(0,H.jsxs)(`div`,{className:`cg-more`,children:[(0,H.jsxs)(`span`,{className:`cg-more-note`,children:[`Showing first `,Bt.toLocaleString(),` of`,` `,zt.toLocaleString()]}),(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>mt(e=>e+Tqe),children:`See more`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>mt(dt.length),children:`Show all`})]})]}),kr&&j&&(0,H.jsx)(AGe,{state:j,field:kr,fields:l,locked:kr.key===Le,viewer:nt,sortedDir:Ar,isFiltered:jr,isGrouped:h.groupBy===kr.key,groupable:Iee(kr,Le),onClose:()=>M(null),onNote:e=>Rn({...kr,note:e}),onHide:()=>{Ve(kr.key,!1),M(null)},onCreate:zn,onChangeField:e=>Bn(kr.key,e),onCreateAndSwap:(e,t,n,r)=>Hn(kr.key,e,t,n,r),onRetype:kr.custom&&kr.source===`overlay`?(e,t,n)=>Un(kr.key,e,t,n):void 0,onRename:kr.custom?e=>Rn({...kr,label:e}):void 0,onFormula:kr.custom&&kr.type===`formula`?(e,t)=>Rn({...kr,formula:e,...t?{label:t}:{}}):void 0,onPeriod:kr.measure?e=>Gn(kr.key,e):void 0,onDelete:kr.custom&&kr.key!==Le?()=>{Vn(kr.key),M(null)}:void 0,onDuplicate:kr.custom?()=>Wn(kr):void 0,onPermissions:kr.custom?e=>Rn({...kr,permissions:{edit:e}}):void 0,onFormat:e=>Rn({...kr,format:e}),onSort:e=>Me({...h,sorts:[{colId:kr.key,dir:e}]}),onClearSort:()=>Me({...h,sorts:h.sorts.filter(e=>e.colId!==kr.key)}),onFilterBy:()=>pe(e=>({n:(e?.n??0)+1,...kr.measure?{measure:{key:kr.measure.key,window:kr.measure.window}}:{key:kr.key}})),pinnedTo:Nr,onPinTo:Mr>0&&!Nr?()=>Zn(kr.key):void 0,onUnpin:Xn>1?Qn:void 0,scopeChoice:Nn,onClearFilter:()=>Me({...h,filters:Pqe(h.filters,kr.key)}),onGroupByField:()=>Me({...h,groupBy:kr.key}),onClearGroup:()=>Me({...h,groupBy:null}),userOptions:i?.userOptions??[],measures:qe},kr.key),me&&Pe.get(Le)&&(0,H.jsx)(AGe,{state:{fieldKey:Le,anchor:me},field:Pe.get(Le),fields:l,locked:!0,viewer:nt,sortedDir:null,isFiltered:!1,isGrouped:!1,groupable:!1,initialPosition:`end`,onClose:()=>he(null),onNote:()=>void 0,onHide:()=>void 0,onCreate:zn,onChangeField:()=>void 0,onCreateAndSwap:()=>void 0,onSort:()=>void 0,onClearSort:()=>void 0,onFilterBy:()=>void 0,onClearFilter:()=>void 0,onGroupByField:()=>void 0,onClearGroup:()=>void 0,scopeChoice:Nn,userOptions:i?.userOptions??[],measures:qe},`__add-at-end__`),ee&&ne.current&&kt.size>0&&(0,H.jsxs)(Yp,{anchor:ne.current,className:`cg-pop cg-add-list-pop`,placement:`bottom-start`,role:`dialog`,ariaLabel:`Add selected customers to a locked view`,onDismiss:()=>I(!1),dataKind:`selection-add-to-list`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Add to locked view`}),(0,H.jsxs)(`div`,{className:`cg-pop-note`,children:[`Adds the `,kt.size.toLocaleString(),` checked customer`,kt.size===1?``:`s`,`. The cohort stays fixed as the data changes.`]}),$e.map(e=>(0,H.jsx)(`button`,{type:`button`,className:`cg-pick-row`,onClick:()=>Mn(e.id,e.name),children:e.name},e.id)),(0,H.jsxs)(`div`,{className:`cg-view-create`,children:[(0,H.jsx)(`label`,{htmlFor:`cg-sel-new-list`,children:`Lock records into a new view`}),(0,H.jsx)(`input`,{id:`cg-sel-new-list`,className:`cg-input`,"data-overlay-autofocus":!0,value:te,placeholder:`e.g. Q3 call plan`,onChange:e=>L(e.target.value),onKeyDown:e=>{e.key===`Enter`&&te.trim()&&Mn(``,te.trim())}}),(0,H.jsx)(`div`,{className:`cg-form-actions`,children:(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,style:n9,disabled:!te.trim(),onClick:()=>Mn(``,te.trim()),children:`Create and add`})})]})]}),ct&&ae&&de.current&&re&&(0,H.jsxs)(Yp,{anchor:de.current,className:`cg-pop cg-addcust-pop`,placement:`bottom-start`,role:`dialog`,ariaLabel:`Add customers to this locked view`,onDismiss:()=>oe(!1),dataKind:`cohort-add-customers`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Add customers`}),(0,H.jsxs)(`div`,{className:`cg-pop-note`,children:[`Search your customer pool and tick who to add to`,` `,(0,H.jsx)(`strong`,{children:lt?.name??`this locked view`}),`.`]}),(0,H.jsx)(`input`,{type:`text`,className:`cg-input cg-addcust-search`,"data-overlay-autofocus":!0,placeholder:`Search customers…`,"aria-label":`Search customers`,value:se,onChange:e=>ce(e.target.value)}),(0,H.jsxs)(`div`,{className:`cg-pick-list cg-addcust-list`,children:[Jn.slice(0,50).map(e=>(0,H.jsxs)(`label`,{className:`cg-check-row`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:le.has(e.pid),onChange:()=>ue(t=>{let n=new Set(t);return n.has(e.pid)?n.delete(e.pid):n.add(e.pid),n})}),(0,H.jsx)(`span`,{className:`cg-check-label`,children:e.name})]},e.pid)),Jn.length===0&&(0,H.jsx)(`div`,{className:`cg-pop-note`,children:se.trim()?`No customer outside this locked view matches your search.`:`Every customer in your pool is already in this locked view.`})]}),Jn.length>50&&(0,H.jsxs)(`div`,{className:`cg-field-hint`,children:[`Showing the first 50 of `,Jn.length.toLocaleString(),` matches — keep typing to narrow.`]}),(0,H.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,style:n9,disabled:le.size===0,onClick:qn,children:le.size===0?`Add customers`:`Add ${le.size.toLocaleString()} customer${le.size===1?``:`s`}`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,style:n9,onClick:()=>oe(!1),children:`Cancel`})]})]}),Fr&&N&&(0,H.jsxs)(Yp,{anchor:N.anchor,className:`cg-pop cg-pick-pop`,placement:`bottom-start`,role:`listbox`,ariaLabel:`Choose ${Fr.label}`,onDismiss:F,dataKind:`cell-picker`,initialFocus:`[data-overlay-autofocus]`,onKeyDown:e=>{let t=e.key===`ArrowDown`||e.key===`ArrowRight`,n=e.key===`ArrowUp`||e.key===`ArrowLeft`;if(!t&&!n)return;let r=Array.from(e.currentTarget.querySelectorAll(`.cg-pick-row, .cg-star-btn`));if(!r.length)return;e.preventDefault();let i=r.indexOf(document.activeElement);r[t?(i+1)%r.length:(i-1+r.length)%r.length]?.focus()},children:[Fr.type===`rating`&&(0,H.jsx)(`div`,{className:`cg-stars`,role:`radiogroup`,"aria-label":`Set ${Fr.label}`,children:Array.from({length:$u(Fr)},(e,t)=>t+1).map(e=>(0,H.jsx)(`button`,{type:`button`,className:`cg-star-btn`,role:`radio`,"aria-checked":Number(Rr)===e,"data-overlay-autofocus":Number(Rr)===e||!Rr&&e===1||void 0,"aria-label":`${e} star${e===1?``:`s`}`,onClick:()=>{c(N.pid,{[Fr.key]:String(e)}),F()},children:(0,H.jsx)(Im,{on:Number(Rr)>=e})},e))}),Fr.type!==`rating`&&Ir.length===0&&(0,H.jsx)(`div`,{className:`cg-pop-note`,children:Fr.type===`user`?`No assignable people were supplied for this workspace.`:`This field has no choices yet. Add them from the column menu.`}),(0,H.jsx)(`div`,{className:`cg-pick-list`,"aria-multiselectable":zr||void 0,children:Ir.map(e=>{let t=xp(Fr,e),n=zr?Br.includes(e):Rr===e;return(0,H.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n,"data-overlay-autofocus":e===Vr||void 0,className:`cg-pick-row`+(n?` is-on`:``),onClick:()=>{if(zr){let t=n?Br.filter(t=>t!==e):[...Br,e];c(N.pid,{[Fr.key]:t.join(`,`)});return}c(N.pid,{[Fr.key]:e}),F()},children:[Fr.type===`user`&&(0,H.jsxs)(`span`,{className:`cg-pick-avatar`,"aria-hidden":`true`,style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,flex:`0 0 auto`,width:20,height:20,borderRadius:`50%`,overflow:`hidden`,marginRight:8,fontSize:9,fontWeight:600,lineHeight:1,position:`relative`,background:vp(e).bg,color:vp(e).fg},children:[Cp(e),bt?.[e]&&(0,H.jsx)(`img`,{src:bt[e],alt:``,onError:e=>{e.currentTarget.style.visibility=`hidden`},style:{position:`absolute`,inset:0,width:`100%`,height:`100%`,objectFit:`cover`}})]}),(0,H.jsx)(`span`,{className:`cg-pick-pill`,style:t?{background:t.bg,color:t.fg}:void 0,children:e})]},e)})}),zr&&(0,H.jsx)(`div`,{className:`cg-form-actions`,children:(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,style:n9,onClick:F,children:`Done`})}),Rr!==``&&(0,H.jsx)(`button`,{type:`button`,className:`cg-pick-row cg-pick-clear`,"data-overlay-autofocus":Ir.length===0||void 0,onClick:()=>{c(N.pid,{[Fr.key]:``}),F()},children:`Clear`})]}),Jt&&k!==null&&(0,H.jsx)(VWe,{fields:l,record:Jt,titleKey:Le,positionLabel:`Record ${Yt.toLocaleString()} of ${zt.toLocaleString()}`,canPrev:Xt(-1),canNext:Xt(1),onPrev:()=>Zt(-1),onNext:()=>Zt(1),onClose:()=>A(null),recordLayout:In,onRecordLayout:Ln,scope:e,docs:i?.docs?.[String(k)]??[],docPayload:i?.docPayload,onDocAdd:i?.docs?e=>Kd({id:qd(`docadd`),type:`doc_add`,pid:k,docId:`doc_${qd(`d`).slice(2,14).replace(/[^a-z0-9]/gi,``)}`,...e}):void 0,onDocFetch:i?.docs?e=>Kd({id:qd(`docget`),type:`doc_fetch`,pid:k,docId:e}):void 0,onDocDelete:i?.docs?e=>Kd({id:qd(`docdel`),type:`doc_delete`,pid:k,docId:e}):void 0,onNotesChange:(e,t)=>s(n=>({...n,[k]:{...n[k],[e]:t}})),onNotesCommit:(e,t)=>c(k,{[e]:t}),viewer:nt,userOptions:i?.userOptions??[],userAvatars:bt})]})}var Lqe=(0,z.memo)(Iqe),d9=class extends Error{status;constructor(e,t){super(e),this.name=`AutomationError`,this.status=t}};async function Rqe(e){let t=null;try{t=await e.json()}catch{}if(e.status===401&&Bd(Nd),!e.ok)throw new d9(t?.error?.message||`The server answered ${e.status}.`,e.status);return t}function f9(e,t){return fetch(`${jd}${e}`,{credentials:Md,headers:t?.body?{"Content-Type":`application/json`}:void 0,...t}).then(e=>Rqe(e))}function zqe(e){return f9(`/automations`,{signal:e})}function Bqe(e){return f9(`/automations/tables`,{signal:e})}function Vqe(e){return f9(`/automations`,{method:`POST`,body:JSON.stringify(e)})}function Hqe(e,t){return f9(`/automations/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)})}function Uqe(e){return f9(`/automations/${encodeURIComponent(e)}`,{method:`DELETE`})}function Wqe(e){return f9(`/automations/${encodeURIComponent(e)}/run`,{method:`POST`})}function Gqe(e,t){return f9(`/automations/${encodeURIComponent(e)}/nodes/${encodeURIComponent(t)}/toggle`,{method:`POST`})}function Kqe(e){return f9(`/automations/${encodeURIComponent(e)}/rows`)}function qqe(e,t,n){return f9(`/automations/preview`,{method:`POST`,body:JSON.stringify({url:e,extract:t,tableIndex:n})})}function p9(e){return(e||``).toLowerCase().replace(/[^a-z0-9_]+/g,`_`).replace(/^_+|_+$/g,``).slice(0,60)}function Jqe(e){return e.running?`running`:e.status?.state||`idle`}var Yqe=[[`inserted`,`New`],[`updated`,`Updated`],[`unchanged`,`Unchanged`],[`orphans`,`No longer on the page (kept)`],[`duplicates`,`Duplicate keys`],[`skipped`,`Skipped (no key)`],[`capped`,`Not written — the database is full`],[`source_rows`,`Rows read`],[`profiles`,`Profiles`],[`ok`,`Read in full`],[`partial`,`Profile only`],[`blocked`,`Blocked`],[`error`,`Errors`],[`paid`,`Exact via HikerAPI`],[`posts`,`Posts`],[`new_posts`,`New posts`]];function Xqe({kinds:e,onCreated:t,onCancel:n}){let[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(`scrape_db`),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(``),[d,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)(``),[h,g]=(0,z.useState)(`table`),[_,v]=(0,z.useState)(0),[y,b]=(0,z.useState)(``),[x,S]=(0,z.useState)(null),[C,w]=(0,z.useState)(!1),[T,E]=(0,z.useState)([]),[D,O]=(0,z.useState)(``),[k,A]=(0,z.useState)([]),[j,M]=(0,z.useState)(``),[N,P]=(0,z.useState)(``),[F,ee]=(0,z.useState)(``);(0,z.useEffect)(()=>{let e=new AbortController;return Bqe(e.signal).then(e=>A(e.tables)).catch(()=>A([])),()=>e.abort()},[]);let I=k.find(e=>e.key===j)||null,te=(0,z.useCallback)(async()=>{w(!0),c(``);try{let e=await qqe(p,h,_);if(S(e),!e.ok){c(e.note||`That page answered ${e.status}.`);return}E(e.columns.map(e=>({column:e,include:!0,key:p9(e)}))),O(p9(e.columns[0]||``)),y||b(e.title||`Scraped table`),u(`Read ${e.rowCount} rows and ${e.columns.length} columns`+(e.tableCount&&e.tableCount>1?` (of ${e.tableCount} tables on the page)`:``))}catch(e){c(e instanceof d9?e.message:`That page could not be read.`)}finally{w(!1)}},[p,h,_,y]),L=async()=>{f(!0),c(``);try{let e={};for(let t of T)t.include&&t.key&&(e[t.column]=t.key);await t((await Vqe({name:r,kind:a,schedule:{cron:`0 6 * * *`,enabled:!1},config:a===`scrape_db`?{url:p,extract:h,tableIndex:_,fieldMap:e,keyField:D,targetLabel:y}:{targetTable:j,fieldKey:N,urlField:F,maxPosts:24,tier:`anonymous`}})).automation.id)}catch(e){c(e instanceof d9?e.message:`That could not be created.`)}finally{f(!1)}},ne=!!r.trim()&&(a===`scrape_db`?!!p.trim()&&T.some(e=>e.include&&e.key===D):!!j&&!!N);return(0,H.jsx)(`div`,{className:`auto-create-pane`,children:(0,H.jsxs)(`div`,{className:`auto-create-card`,children:[(0,H.jsx)(`h1`,{children:`New automation`}),(0,H.jsx)(`p`,{className:`auto-hint`,children:`Pick what it does. Once it exists you configure it on the canvas, one step at a time.`}),s?(0,H.jsx)(`div`,{className:`auto-banner is-error`,role:`alert`,children:s}):null,l?(0,H.jsx)(`div`,{className:`auto-banner is-ok`,role:`status`,children:l}):null,(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-new-name`,children:`Name`}),(0,H.jsx)(`input`,{id:`auto-new-name`,className:`auto-input`,value:r,placeholder:`S&P 500 companies`,onChange:e=>i(e.target.value)})]}),(0,H.jsx)(`div`,{className:`auto-kinds`,children:e.map(e=>(0,H.jsxs)(`label`,{className:`auto-kind`+(a===e.key?` is-on`:``),children:[(0,H.jsx)(`input`,{type:`radio`,name:`auto-kind`,checked:a===e.key,onChange:()=>o(e.key)}),(0,H.jsx)(`span`,{children:e.label})]},e.key))}),a===`scrape_db`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-new-url`,children:`Page URL`}),(0,H.jsxs)(`div`,{className:`auto-row-inline`,children:[(0,H.jsx)(`input`,{id:`auto-new-url`,className:`auto-input`,value:p,placeholder:`https://en.wikipedia.org/wiki/List_of_S%26P_500_companies`,onChange:e=>m(e.target.value)}),(0,H.jsx)(`button`,{type:`button`,className:`auto-btn`,disabled:!p.trim()||C,onClick:()=>void te(),children:C?`Reading…`:`Read the page`})]}),(0,H.jsx)(`p`,{className:`auto-hint`,children:`Public web pages only. Private, loopback and link-local addresses are refused — including a public URL that redirects to one.`})]}),(0,H.jsxs)(`div`,{className:`auto-field-row`,children:[(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-new-extract`,children:`Read`}),(0,H.jsxs)(`select`,{id:`auto-new-extract`,className:`auto-input`,value:h,onChange:e=>g(e.target.value),children:[(0,H.jsx)(`option`,{value:`table`,children:`An HTML table`}),(0,H.jsx)(`option`,{value:`jsonld`,children:`Structured data (JSON-LD)`})]})]}),h===`table`?(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-new-tidx`,children:`Which table`}),(0,H.jsx)(`input`,{id:`auto-new-tidx`,className:`auto-input`,type:`number`,min:0,value:_,onChange:e=>v(Number(e.target.value)||0)})]}):null,(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-new-tlabel`,children:`Database name`}),(0,H.jsx)(`input`,{id:`auto-new-tlabel`,className:`auto-input`,value:y,placeholder:`S&P 500 companies`,onChange:e=>b(e.target.value)})]})]}),T.length?(0,H.jsxs)(`div`,{className:`auto-map`,children:[(0,H.jsx)(`h3`,{children:`Columns`}),(0,H.jsx)(`p`,{className:`auto-hint`,children:`Pick the key — the column that identifies a row. On every re-run, a row whose key already exists is updated; a new key is inserted; a key that has stopped appearing is counted and kept.`}),(0,H.jsx)(`div`,{className:`auto-drill-scroll`,children:(0,H.jsxs)(`table`,{className:`auto-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Use`}),(0,H.jsx)(`th`,{children:`Source column`}),(0,H.jsx)(`th`,{children:`Field key`}),(0,H.jsx)(`th`,{children:`Key`}),x?.sample?.length?(0,H.jsx)(`th`,{children:`First value`}):null]})}),(0,H.jsx)(`tbody`,{children:T.map((e,t)=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`input`,{type:`checkbox`,checked:e.include,"aria-label":`Include ${e.column}`,onChange:e=>E(n=>n.map((n,r)=>r===t?{...n,include:e.target.checked}:n))})}),(0,H.jsx)(`td`,{className:`auto-cell-name`,children:e.column}),(0,H.jsx)(`td`,{children:(0,H.jsx)(`input`,{className:`auto-input is-small`,value:e.key,"aria-label":`Field key for ${e.column}`,onChange:e=>E(n=>n.map((n,r)=>r===t?{...n,key:p9(e.target.value)}:n))})}),(0,H.jsx)(`td`,{children:(0,H.jsx)(`input`,{type:`radio`,name:`auto-new-keyfield`,checked:D===e.key&&e.include,disabled:!e.include,"aria-label":`Use ${e.column} as the key`,onChange:()=>O(e.key)})}),x?.sample?.length?(0,H.jsx)(`td`,{className:`auto-cell-sample`,children:String(x.sample[0]?.[e.column]??``)}):null]},e.column))})]})})]}):(0,H.jsx)(`p`,{className:`auto-note`,children:`Read the page to see what columns it offers.`})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`auto-field-row`,children:[(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-new-table`,children:`Database`}),(0,H.jsxs)(`select`,{id:`auto-new-table`,className:`auto-input`,value:j,onChange:e=>{M(e.target.value),P(``),ee(``)},children:[(0,H.jsx)(`option`,{value:``,children:`Choose a database…`}),k.map(e=>(0,H.jsxs)(`option`,{value:e.key,children:[e.label,` (`,e.rowCount,` `,e.rowCount===1?`row`:`rows`,`)`]},e.key))]})]}),(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-new-fieldkey`,children:`Automation column`}),(0,H.jsxs)(`select`,{id:`auto-new-fieldkey`,className:`auto-input`,value:N,onChange:e=>P(e.target.value),children:[(0,H.jsx)(`option`,{value:``,children:`Choose a column…`}),(I?.fields||[]).filter(e=>e.type===`automation`).map(e=>(0,H.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]}),(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-new-urlfield`,children:`Profile URL column`}),(0,H.jsxs)(`select`,{id:`auto-new-urlfield`,className:`auto-input`,value:F,onChange:e=>ee(e.target.value),children:[(0,H.jsx)(`option`,{value:``,children:`The column the field is bound to`}),(I?.fields||[]).map(e=>(0,H.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]})]}),(0,H.jsx)(`p`,{className:`auto-hint`,children:`It starts on the free anonymous rung. The canvas’s HikerAPI step turns on the paid one, which returns exact counts and full post data and works from a datacenter.`}),I&&!(I.fields||[]).some(e=>e.type===`automation`)?(0,H.jsx)(`p`,{className:`auto-note`,children:`That database has no automation column yet. Add one from the grid’s column menu, then choose it here.`}):null]}),(0,H.jsxs)(`div`,{className:`auto-head-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`auto-btn is-primary`,disabled:!ne||d,onClick:()=>void L(),children:d?`Creating…`:`Create`}),(0,H.jsx)(`button`,{type:`button`,className:`auto-btn`,onClick:n,children:`Cancel`})]})]})})}var Zqe=.35,Qqe={x:0,y:0,k:1};function $qe(e){return e.map(e=>({...e,x:e.col*312,y:e.row*132}))}function eJe(e){if(!e.length)return{minX:0,minY:0,maxX:208,maxY:96,w:208,h:96};let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y)),r=Math.max(...e.map(e=>e.x+208)),i=Math.max(...e.map(e=>e.y+96));return{minX:t,minY:n,maxX:r,maxY:i,w:r-t,h:i-n}}function m9(e){return Math.min(2,Math.max(Zqe,e))}function tJe(e,t,n){let r=eJe(e);if(t<=0||n<=0)return Qqe;let i=m9(Math.min(1,(t-112)/r.w,(n-112)/r.h));return{k:i,x:(t-r.w*i)/2-r.minX*i,y:(n-r.h*i)/2-r.minY*i}}function nJe(e,t,n,r){let i=m9(t),a=i/e.k;return{k:i,x:n-(n-e.x)*a,y:r-(r-e.y)*a}}function rJe(e){return[e.x+208,e.y+96/2]}function iJe(e){return[e.x,e.y+96/2]}function aJe(e,t){let[n,r]=rJe(e),[i,a]=iJe(t),o=Math.max(36,Math.abs(i-n)*.45);return`M ${n} ${r} C ${n+o} ${r}, ${i-o} ${a}, ${i} ${a}`}function oJe(e,t){let[n,r]=rJe(e),[i,a]=iJe(t);return[(n+i)/2,(r+a)/2-8]}function sJe(e,t){let n=new Map(t.map(e=>[e.id,e])),r=[];for(let t of e.edges||[]){let e=n.get(t.from),i=n.get(t.to);!e||!i||r.push({...t,d:aJe(e,i),mid:oJe(e,i),dim:!e.enabled||!i.enabled})}return r}var cJe=4,h9=260;function lJe({kind:e}){let t={width:15,height:15,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:1.4,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0};return e===`trigger`?(0,H.jsxs)(`svg`,{...t,children:[(0,H.jsx)(`circle`,{cx:`8`,cy:`8`,r:`5.6`}),(0,H.jsx)(`path`,{d:`M8 5.2V8l2 1.4`})]}):e===`source`?(0,H.jsxs)(`svg`,{...t,children:[(0,H.jsx)(`circle`,{cx:`8`,cy:`8`,r:`5.6`}),(0,H.jsx)(`path`,{d:`M2.6 8h10.8M8 2.4c1.5 1.7 2.2 3.6 2.2 5.6S9.5 12.3 8 13.6C6.5 12.3 5.8 10 5.8 8s.7-3.9 2.2-5.6z`})]}):e===`branch`?(0,H.jsxs)(`svg`,{...t,children:[(0,H.jsx)(`path`,{d:`M2.6 8h3.2l2.6-3.6h5M8.4 11.6H5.8m2.6 0h5`}),(0,H.jsx)(`path`,{d:`M11.6 2.6 13.4 4.4 11.6 6.2M11.6 9.8l1.8 1.8-1.8 1.8`})]}):e===`write`?(0,H.jsxs)(`svg`,{...t,children:[(0,H.jsx)(`ellipse`,{cx:`8`,cy:`4.2`,rx:`4.8`,ry:`1.9`}),(0,H.jsx)(`path`,{d:`M3.2 4.2v7.6c0 1 2.1 1.9 4.8 1.9s4.8-.9 4.8-1.9V4.2M3.2 8c0 1 2.1 1.9 4.8 1.9s4.8-.9 4.8-1.9`})]}):(0,H.jsx)(`svg`,{...t,children:(0,H.jsx)(`path`,{d:`M8 2.6v7.2M5.2 7l2.8 2.8L10.8 7M3 12.4h10`})})}function uJe({graph:e,selected:t,onSelect:n,onToggle:r,busyNode:i,nextRunAt:a}){let o=(0,z.useRef)(null),[s,c]=(0,z.useState)(Qqe),l=(0,z.useRef)(null),u=(0,z.useMemo)(()=>$qe(e?.nodes||[]),[e]),d=(0,z.useMemo)(()=>sJe(e,u),[e,u]),f=(0,z.useMemo)(()=>eJe(u),[u]),p=(0,z.useCallback)(()=>{let e=o.current;if(!e)return;let t=e.getBoundingClientRect();c(tJe(u,t.width,t.height))},[u]);(0,z.useLayoutEffect)(()=>{p()},[u.map(e=>`${e.id}:${e.col}:${e.row}`).join(`|`)]),(0,z.useEffect)(()=>{let e=o.current;if(!e||typeof ResizeObserver>`u`)return;let t=e.getBoundingClientRect().width>0,n=new ResizeObserver(()=>{let n=e.getBoundingClientRect().width>0;n&&!t&&p(),t=n});return n.observe(e),()=>n.disconnect()},[p]),(0,z.useEffect)(()=>{let e=o.current;if(!e)return;let t=t=>{t.preventDefault();let n=e.getBoundingClientRect();c(e=>nJe(e,e.k*(t.deltaY<0?1.12:1/1.12),t.clientX-n.left,t.clientY-n.top))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]);let m=e=>{e.button===0&&(e.currentTarget.setPointerCapture(e.pointerId),l.current={px:e.clientX,py:e.clientY,vx:s.x,vy:s.y,moved:!1})},h=e=>{let t=l.current;if(!t)return;let n=e.clientX-t.px,r=e.clientY-t.py;!t.moved&&Math.abs(n)+Math.abs(r)({...e,x:t.vx+n,y:t.vy+r})))},g=e=>{if(l.current)try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}window.setTimeout(()=>{l.current=null},0)},_=()=>l.current?.moved===!0,v=e=>{let t=o.current;if(!t)return;let n=t.getBoundingClientRect();c(t=>nJe(t,t.k*e,n.width/2,n.height/2))};return(0,H.jsxs)(`div`,{className:`auto-canvas-wrap`,children:[(0,H.jsx)(`div`,{className:`auto-canvas`,ref:o,role:`group`,"aria-label":`Automation flow`,onPointerDown:m,onPointerMove:h,onPointerUp:g,onPointerCancel:g,children:(0,H.jsxs)(`div`,{className:`auto-scene`,style:{transform:`translate(${s.x}px, ${s.y}px) scale(${s.k})`},children:[(0,H.jsx)(`svg`,{className:`auto-wires`,style:{left:f.minX-h9,top:f.minY-h9,width:f.w+h9*2,height:f.h+h9*2},"aria-hidden":`true`,children:(0,H.jsx)(`g`,{transform:`translate(${h9-f.minX}, ${h9-f.minY})`,children:d.map(e=>(0,H.jsxs)(`g`,{className:`auto-wire`+(e.dim?` is-dim`:``),children:[(0,H.jsx)(`path`,{d:e.d}),e.label?(0,H.jsx)(`text`,{x:e.mid[0],y:e.mid[1],textAnchor:`middle`,children:e.label}):null]},`${e.from}->${e.to}`))})}),u.map((e,o)=>(0,H.jsxs)(`div`,{className:`auto-node`+(e.id===t?` is-selected`:``)+(e.enabled?``:` is-off`)+` is-${e.kind}`,style:{left:e.x,top:e.y,width:208,height:96},children:[(0,H.jsxs)(`button`,{type:`button`,className:`auto-node-hit`,"aria-pressed":e.id===t,title:`${e.title} — ${e.subtitle}`,onClick:()=>{_()||n(e.id)},children:[(0,H.jsxs)(`span`,{className:`auto-node-head`,children:[(0,H.jsx)(`span`,{className:`auto-node-mark`,children:(0,H.jsx)(lJe,{kind:e.kind})}),(0,H.jsx)(`span`,{className:`auto-node-title`,children:e.title})]}),(0,H.jsx)(`span`,{className:`auto-node-sub`,children:e.subtitle}),(0,H.jsx)(`span`,{className:`auto-node-detail`,children:e.id===`trigger`&&a&&e.enabled?`Next ${a}`:e.detail}),(0,H.jsxs)(`span`,{className:`auto-node-foot`,children:[(0,H.jsx)(`span`,{className:`auto-node-step`,children:o+1}),(0,H.jsx)(`span`,{className:`auto-dot is-${e.status}`,title:`Last run: ${e.status}`,"aria-label":`Last run: ${e.status}`})]})]}),e.toggle&&r?(0,H.jsx)(`button`,{type:`button`,className:`auto-node-switch`+(e.enabled?` is-on`:``),disabled:i===e.id,"aria-pressed":e.enabled,"aria-label":`${e.enabled?`Turn off`:`Turn on`} ${e.title}`,title:`${e.enabled?`Turn off`:`Turn on`} ${e.title}`,onClick:t=>{t.stopPropagation(),!_()&&r(e.id)},children:(0,H.jsx)(`span`,{className:`auto-node-switch-knob`})}):(0,H.jsx)(`span`,{className:`auto-node-always`,title:`This step is what the automation is`,children:`Always`})]},e.id))]})}),(0,H.jsxs)(`div`,{className:`auto-zoom`,role:`group`,"aria-label":`Canvas zoom`,children:[(0,H.jsx)(`button`,{type:`button`,className:`auto-zoom-btn`,title:`Fit the flow`,onClick:p,children:(0,H.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M2.6 5.8V2.6h3.2M13.4 5.8V2.6h-3.2M2.6 10.2v3.2h3.2M13.4 10.2v3.2h-3.2`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`})})}),(0,H.jsx)(`button`,{type:`button`,className:`auto-zoom-btn`,title:`Zoom out`,"aria-label":`Zoom out`,disabled:s.k<=Zqe+.001,onClick:()=>v(1/1.2),children:(0,H.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M3.6 8h8.8`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`})})}),(0,H.jsxs)(`button`,{type:`button`,className:`auto-zoom-pct`,title:`Back to 100%`,onClick:()=>c(e=>({...e,k:m9(1)})),children:[Math.round(s.k*100),`%`]}),(0,H.jsx)(`button`,{type:`button`,className:`auto-zoom-btn`,title:`Zoom in`,"aria-label":`Zoom in`,disabled:s.k>=1.999,onClick:()=>v(1.2),children:(0,H.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M8 3.6v8.8M3.6 8h8.8`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`})})})]})]})}function dJe({automation:e,kinds:t,cronPresets:n,hikerReady:r,onSaved:i,onDeleted:a}){let o=e.config||{},s=e.kind,[c,l]=(0,z.useState)(e.name||``),[u,d]=(0,z.useState)(e.schedule?.cron||`0 6 * * *`),[f,p]=(0,z.useState)(``),[m,h]=(0,z.useState)(``),[g,_]=(0,z.useState)(!1),[v,y]=(0,z.useState)(!1),[b,x]=(0,z.useState)(``),[S,C]=(0,z.useState)(``),[w,T]=(0,z.useState)(String(o.url||``)),[E,D]=(0,z.useState)(String(o.extract||`table`)),[O,k]=(0,z.useState)(Number(o.tableIndex||0)),[A,j]=(0,z.useState)(String(o.targetLabel||``)),[M,N]=(0,z.useState)(null),[P,F]=(0,z.useState)(!1),[ee,I]=(0,z.useState)(()=>Object.entries(e.config?.fieldMap||{}).map(([e,t])=>({column:e,include:!0,key:t}))),[te,L]=(0,z.useState)(String(o.keyField||``)),[ne,re]=(0,z.useState)([]),[ie,ae]=(0,z.useState)(String(o.targetTable||``)),[oe,se]=(0,z.useState)(String(o.fieldKey||``)),[ce,le]=(0,z.useState)(String(o.urlField||``)),[ue,de]=(0,z.useState)(Number(o.maxPosts||24)),[fe,pe]=(0,z.useState)(null),[me,he]=(0,z.useState)(``);(0,z.useEffect)(()=>{let e=new AbortController;return Bqe(e.signal).then(e=>re(e.tables)).catch(()=>re([])),()=>e.abort()},[]);let ge=ne.find(e=>e.key===ie)||null,_e=(e.graph?.nodes||[]).find(e=>e.id===S)||null,ve=e=>t=>{y(!0),e(t)},ye=(0,z.useCallback)(async()=>{F(!0),h(``);try{let e=await qqe(w,E,O);if(N(e),!e.ok){h(e.note||`That page answered ${e.status}.`);return}I(t=>{let n=new Map(t.map(e=>[e.column,e]));return e.columns.map(e=>{let t=n.get(e);return{column:e,include:!t||t.include,key:t?t.key:p9(e)}})}),L(t=>t&&e.columns.some(e=>p9(e)===t)?t:p9(e.columns[0]||``)),A||j(e.title||`Scraped table`),y(!0),p(`Read ${e.rowCount} rows and ${e.columns.length} columns`+(e.tableCount&&e.tableCount>1?` (of ${e.tableCount} tables on the page)`:``))}catch(e){h(e instanceof d9?e.message:`That page could not be read.`)}finally{F(!1)}},[w,E,O,A]),be=()=>{if(s===`scrape_db`){let e={};for(let t of ee)t.include&&t.key&&(e[t.column]=t.key);return{url:w,extract:E,tableIndex:O,fieldMap:e,keyField:te,targetTable:String(o.targetTable||``),targetLabel:A}}return{targetTable:ie,fieldKey:oe,urlField:ce,maxPosts:ue}},xe=async(t=!0)=>{let n=await Hqe(e.id,{name:c,kind:s,config:be(),schedule:{cron:u,enabled:!!e.schedule?.enabled}});return y(!1),t&&p(`Saved.`),n.automation.id},Se=async()=>{_(!0),h(``),p(``);try{await i(await xe())}catch(e){h(e instanceof d9?e.message:`That could not be saved.`)}finally{_(!1)}},Ce=async t=>{x(t),h(``),p(``);try{v&&await xe(!1),await Gqe(e.id,t),await i(e.id)}catch(e){h(e instanceof d9?e.message:`That step was not changed.`)}finally{x(``)}},we=async()=>{h(``);try{await Wqe(e.id),p(`Started. The node dots follow it.`),await i(e.id)}catch(e){h(e instanceof d9?e.message:`It did not start.`)}},Te=async()=>{h(``);try{await Uqe(e.id),await a()}catch(e){h(e instanceof d9?e.message:`It was not deleted.`)}},Ee=async t=>{if(me===t.ts){pe(null),he(``);return}try{let n=await Kqe(e.id);pe(n),he(t.ts)}catch(e){h(e instanceof d9?e.message:`Those rows could not be read.`)}},De=(0,z.useMemo)(()=>n.find(e=>e.cron===u)?.cron||``,[n,u]),Oe=e.running?`running`:e.status?.state||`idle`;return(0,H.jsxs)(`div`,{className:`auto-detail`,children:[(0,H.jsxs)(`header`,{className:`auto-head`,children:[(0,H.jsxs)(`div`,{className:`auto-head-title`,children:[(0,H.jsx)(`input`,{className:`auto-name`,value:c,placeholder:`Name this automation`,"aria-label":`Automation name`,onChange:e=>ve(l)(e.target.value)}),(0,H.jsx)(`span`,{className:`auto-chip is-${Oe}`,children:e.running?`Running`:Oe}),(0,H.jsx)(`span`,{className:`auto-kindtag`,children:t.find(e=>e.key===s)?.label||s})]}),(0,H.jsxs)(`div`,{className:`auto-head-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`auto-btn`,disabled:!!e.running,onClick:()=>void we(),children:e.running?`Running…`:`Run now`}),(0,H.jsx)(`button`,{type:`button`,className:`auto-btn is-primary`,disabled:g||!c.trim(),onClick:()=>void Se(),children:g?`Saving…`:`Save`}),(0,H.jsx)(`button`,{type:`button`,className:`auto-btn is-danger`,onClick:()=>void Te(),children:`Delete`})]})]}),m?(0,H.jsx)(`div`,{className:`auto-banner is-error`,role:`alert`,children:m}):null,f?(0,H.jsx)(`div`,{className:`auto-banner is-ok`,role:`status`,children:f}):null,(0,H.jsxs)(`div`,{className:`auto-work`,children:[(0,H.jsx)(uJe,{graph:e.graph,selected:S,onSelect:C,onToggle:e=>void Ce(e),busyNode:b,nextRunAt:e.nextRunAt}),(0,H.jsx)(`aside`,{className:`auto-panel`,"aria-label":_e?`${_e.title} settings`:`Run history`,children:_e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`auto-panel-head`,children:[(0,H.jsx)(`h2`,{children:_e.title}),(0,H.jsx)(`button`,{type:`button`,className:`auto-panel-close`,"aria-label":`Back to run history`,title:`Back to run history`,onClick:()=>C(``),children:(0,H.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`})})})]}),_e.enabled?null:(0,H.jsx)(`p`,{className:`auto-note is-off`,children:`This step is switched off. Its card on the canvas carries the switch that turns it back on.`}),_e.panel===`schedule`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-preset`,children:`Schedule`}),(0,H.jsxs)(`select`,{id:`auto-preset`,className:`auto-input`,value:De,onChange:e=>e.target.value&&ve(d)(e.target.value),children:[(0,H.jsx)(`option`,{value:``,children:`Custom…`}),n.map(e=>(0,H.jsx)(`option`,{value:e.cron,children:e.label},e.cron))]})]}),(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-cron`,children:`Cron (minute hour day month weekday)`}),(0,H.jsx)(`input`,{id:`auto-cron`,className:`auto-input is-mono`,value:u,onChange:e=>ve(d)(e.target.value)})]}),(0,H.jsx)(`p`,{className:`auto-hint`,children:e.nextRunAt?`Next run ${e.nextRunAt}.`:e.schedule?.enabled?`Schedules start from the moment they are switched on — turning on a daily job after today's time does not fire it immediately.`:`Not scheduled. It still runs when you press Run now, and the node's switch turns the schedule on.`})]}):null,_e.panel===`source`&&s===`scrape_db`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-url`,children:`Page URL`}),(0,H.jsx)(`input`,{id:`auto-url`,className:`auto-input`,value:w,placeholder:`https://en.wikipedia.org/wiki/List_of_S%26P_500_companies`,onChange:e=>ve(T)(e.target.value)})]}),(0,H.jsx)(`button`,{type:`button`,className:`auto-btn`,disabled:!w.trim()||P,onClick:()=>void ye(),children:P?`Reading…`:`Read the page`}),(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-extract`,children:`Read`}),(0,H.jsxs)(`select`,{id:`auto-extract`,className:`auto-input`,value:E,onChange:e=>ve(D)(e.target.value),children:[(0,H.jsx)(`option`,{value:`table`,children:`An HTML table`}),(0,H.jsx)(`option`,{value:`jsonld`,children:`Structured data (JSON-LD)`})]})]}),E===`table`?(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-tidx`,children:`Which table`}),(0,H.jsx)(`input`,{id:`auto-tidx`,className:`auto-input`,type:`number`,min:0,value:O,onChange:e=>ve(k)(Number(e.target.value)||0)})]}):null,(0,H.jsx)(`p`,{className:`auto-hint`,children:`Public web pages only. Private, loopback and link-local addresses are refused — including a public URL that redirects to one.`})]}):null,_e.panel===`columns`?ee.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`auto-hint`,children:`Pick the key — the column that identifies a row. On every re-run, a row whose key already exists is updated; a new key is inserted; a key that has stopped appearing is counted and kept.`}),(0,H.jsx)(`div`,{className:`auto-panel-scroll`,children:(0,H.jsxs)(`table`,{className:`auto-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Use`}),(0,H.jsx)(`th`,{children:`Source column`}),(0,H.jsx)(`th`,{children:`Field key`}),(0,H.jsx)(`th`,{children:`Key`})]})}),(0,H.jsx)(`tbody`,{children:ee.map((e,t)=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`input`,{type:`checkbox`,checked:e.include,"aria-label":`Include ${e.column}`,onChange:e=>ve(I)(ee.map((n,r)=>r===t?{...n,include:e.target.checked}:n))})}),(0,H.jsx)(`td`,{className:`auto-cell-name`,children:e.column}),(0,H.jsx)(`td`,{children:(0,H.jsx)(`input`,{className:`auto-input is-small`,value:e.key,"aria-label":`Field key for ${e.column}`,onChange:e=>ve(I)(ee.map((n,r)=>r===t?{...n,key:p9(e.target.value)}:n))})}),(0,H.jsx)(`td`,{children:(0,H.jsx)(`input`,{type:`radio`,name:`auto-keyfield`,checked:te===e.key&&e.include,disabled:!e.include,"aria-label":`Use ${e.column} as the key`,onChange:()=>ve(L)(e.key)})})]},e.column))})]})}),M?.sample?.length?(0,H.jsxs)(`p`,{className:`auto-hint`,children:[`First row read: `,Object.values(M.sample[0]).slice(0,4).join(` · `)]}):null]}):(0,H.jsx)(`p`,{className:`auto-note`,children:`Open the Fetch step and read the page to see what columns it offers.`}):null,_e.panel===`source`&&s===`field_instagram`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-table`,children:`Database`}),(0,H.jsxs)(`select`,{id:`auto-table`,className:`auto-input`,value:ie,onChange:e=>{ve(ae)(e.target.value),se(``),le(``)},children:[(0,H.jsx)(`option`,{value:``,children:`Choose a database…`}),ne.map(e=>(0,H.jsxs)(`option`,{value:e.key,children:[e.label,` (`,e.rowCount,` `,e.rowCount===1?`row`:`rows`,`)`]},e.key))]})]}),(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-urlfield`,children:`Profile URL column`}),(0,H.jsxs)(`select`,{id:`auto-urlfield`,className:`auto-input`,value:ce,onChange:e=>ve(le)(e.target.value),children:[(0,H.jsx)(`option`,{value:``,children:`The column the field is bound to`}),(ge?.fields||[]).map(e=>(0,H.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]}),(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-fieldkey`,children:`Automation column`}),(0,H.jsxs)(`select`,{id:`auto-fieldkey`,className:`auto-input`,value:oe,onChange:e=>ve(se)(e.target.value),children:[(0,H.jsx)(`option`,{value:``,children:`Choose a column…`}),(ge?.fields||[]).filter(e=>e.type===`automation`).map(e=>(0,H.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]}),ge&&!(ge.fields||[]).some(e=>e.type===`automation`)?(0,H.jsx)(`p`,{className:`auto-note`,children:`That database has no automation column yet. Add one from the grid’s column menu, then choose it here.`}):null]}):null,_e.panel===`capture`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-maxposts`,children:`Posts per pull`}),(0,H.jsx)(`input`,{id:`auto-maxposts`,className:`auto-input`,type:`number`,min:1,max:200,value:ue,onChange:e=>ve(de)(Number(e.target.value)||24)})]}),(0,H.jsx)(`h3`,{children:`HikerAPI — the paid rung`}),(0,H.jsxs)(`p`,{className:`auto-hint`,children:[`Exact follower counts and post-level data, and it works from a datacenter. Roughly $0.0006 a request. Its node’s switch turns it on.`,r?` A key is configured on this deployment.`:` No key is configured on this deployment yet, so it will report itself blocked and the anonymous rung will answer instead.`]}),(0,H.jsx)(`h3`,{children:`Anonymous — the free rung`}),(0,H.jsxs)(`p`,{className:`auto-hint`,children:[`No login and no credentials. Instagram blocks datacenter addresses and has closed most of its anonymous surface, so this rung is honest rather than reliable: counts come from the page’s own abbreviations (204K, not 204,312) and are marked approximate. Turning it off means`,` `,(0,H.jsx)(`strong`,{children:`exact numbers or nothing`}),` — a run reports blocked rather than quietly writing a rounded number.`]}),(0,H.jsxs)(`p`,{className:`auto-hint`,children:[`A pull reports what it actually got: `,(0,H.jsx)(`strong`,{children:`ok`}),` (profile and posts),`,` `,(0,H.jsx)(`strong`,{children:`partial`}),` (profile only), or `,(0,H.jsx)(`strong`,{children:`blocked`}),`. It never reports success on nothing.`]})]}):null,_e.panel===`write`?(0,H.jsxs)(H.Fragment,{children:[s===`scrape_db`?(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-tlabel`,children:`Database name`}),(0,H.jsx)(`input`,{id:`auto-tlabel`,className:`auto-input`,value:A,placeholder:`S&P 500 companies`,onChange:e=>ve(j)(e.target.value)})]}):(0,H.jsxs)(`p`,{className:`auto-hint`,children:[`Each pull appends a timestamped row to `,(0,H.jsx)(`code`,{children:`ut_ig_snapshots`}),` and, for every post, to `,(0,H.jsx)(`code`,{children:`ut_ig_post_snapshots`}),` — so the history is a time series you can filter by date rather than a single current value.`,` `,(0,H.jsx)(`code`,{children:`ut_ig_posts`}),` holds one row per post, ever.`]}),(0,H.jsxs)(`p`,{className:`auto-hint`,children:[`Turning this step off makes the automation a `,(0,H.jsx)(`strong`,{children:`dry run`}),`: it reads everything and reports exactly what it would have written, without creating or changing a single row.`]}),(0,H.jsx)(`p`,{className:`auto-hint`,children:`A row that stops appearing at the source is counted and kept, never deleted.`})]}):null]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`auto-panel-head`,children:(0,H.jsx)(`h2`,{children:`Run history`})}),e.runs?.length?(0,H.jsx)(`ol`,{className:`auto-runs`,children:e.runs.map(e=>(0,H.jsxs)(`li`,{className:`auto-run is-`+(e.ok?`ok`:`error`),children:[(0,H.jsxs)(`button`,{type:`button`,className:`auto-run-head`,onClick:()=>void Ee(e),"aria-expanded":me===e.ts,children:[(0,H.jsx)(`span`,{className:`auto-run-ts`,children:e.ts.replace(`T`,` `)}),(0,H.jsx)(`span`,{className:`auto-run-summary`,children:e.summary})]}),(0,H.jsx)(`div`,{className:`auto-counts`,children:Yqe.filter(([t])=>typeof e.counts?.[t]==`number`).map(([t,n])=>(0,H.jsxs)(`span`,{className:`auto-count`+(t===`capped`&&e.counts[t]?` is-warn`:``),children:[(0,H.jsx)(`b`,{children:e.counts[t]}),` `,n]},t))}),me===e.ts&&fe?(0,H.jsxs)(`div`,{className:`auto-drill`,children:[(0,H.jsxs)(`p`,{className:`auto-hint`,children:[`The rows this run touched in `,fe.label,fe.truncated?` (first 200)`:``,`.`]}),(0,H.jsx)(`div`,{className:`auto-drill-scroll`,children:(0,H.jsxs)(`table`,{className:`auto-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsx)(`tr`,{children:fe.fields.map(e=>(0,H.jsx)(`th`,{children:e.label},e.key))})}),(0,H.jsx)(`tbody`,{children:fe.rows.slice(0,50).map(e=>(0,H.jsx)(`tr`,{children:fe.fields.map(t=>(0,H.jsx)(`td`,{children:String(e[t.key]??``)},t.key))},String(e.id)))})]})})]}):null]},e.ts))}):(0,H.jsx)(`p`,{className:`auto-note`,children:`It has not run yet. Press Run now, or switch on the Trigger step.`}),(0,H.jsx)(`p`,{className:`auto-hint`,children:`Click any step on the canvas to see and change what it does.`})]})})]})]})}function fJe(e){let t=Jqe(e);return t===`running`?`Running now`:t===`ok`?`Last run succeeded — ${e.status?.lastSummary||``}`:t===`partial`?`Last run was partial — ${e.status?.lastSummary||``}`:t===`error`?`Last run failed — ${e.status?.lastSummary||``}`:`Has not run yet`}function pJe(e){if(e.schedule?.enabled)return e.nextRunAt?`Next ${e.nextRunAt}`:`Scheduled`;let t=e.status?.lastRunAt?e.status.lastRunAt.replace(`T`,` `).slice(0,16):``;return t?`Last run ${t}`:`Manual only`}function mJe(){let[e,t]=(0,z.useState)(null),[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(!1),[u,d]=(0,z.useState)(``),f=(0,z.useRef)(null),p=(0,z.useCallback)(async e=>{try{let n=await zqe(e);return t(n),r(``),n}catch(e){return e?.name===`AbortError`||r(e instanceof d9?e.message:`The automation service did not answer.`),null}},[]);(0,z.useEffect)(()=>{let e=new AbortController;return p(e.signal),()=>e.abort()},[p]);let m=(e?.automations||[]).some(e=>e.running);(0,z.useEffect)(()=>{if(!m)return;let e=window.setInterval(()=>void p(),2500);return()=>window.clearInterval(e)},[m,p]);let h=e?.automations||[],g=h.find(e=>e.id===i)||null,_=async e=>{d(e.id);try{await Hqe(e.id,{schedule:{cron:e.schedule.cron,enabled:!e.schedule.enabled}}),await p()}catch(e){r(e instanceof d9?e.message:`That change was not saved.`)}finally{d(``)}};return(0,H.jsxs)(`div`,{className:`auto-surface`,children:[(0,H.jsxs)(`aside`,{className:`auto-rail`+(c?` is-collapsed`:``),"aria-label":`Automations`,children:[(0,H.jsx)(`div`,{className:`auto-rail-top`,children:(0,H.jsx)(`button`,{type:`button`,className:`cg-rail-toggle`,"aria-label":c?`Expand automations`:`Minimize automations`,"aria-expanded":!c,title:c?`Expand automations`:`Minimize automations`,onClick:()=>l(e=>!e),children:(0,H.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M2.5 4.4h11M2.5 8h11M2.5 11.6h11`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`})})})}),(0,H.jsx)(`div`,{className:`auto-create`,children:(0,H.jsxs)(`button`,{type:`button`,className:`auto-create-btn`,onClick:()=>{s(!0),a(``)},children:[(0,H.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M8 3.4v9.2M3.4 8h9.2`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`})}),`New automation`]})}),(0,H.jsxs)(`div`,{className:`auto-list`,ref:f,onKeyDown:e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let t=Array.from(f.current?.querySelectorAll(`.auto-row-main`)||[]);if(!t.length)return;e.preventDefault();let n=t.indexOf(document.activeElement),r=e.key===`ArrowDown`?(n+1)%t.length:(n-1+t.length)%t.length;t[r<0?0:r]?.focus()},children:[h.map(e=>{let t=Jqe(e);return(0,H.jsxs)(`div`,{className:`auto-row`+(e.id===i?` is-active`:``),children:[(0,H.jsxs)(`button`,{type:`button`,className:`auto-row-main`,onClick:()=>{a(e.id),s(!1)},children:[(0,H.jsx)(`span`,{className:`auto-dot is-${t}`,title:fJe(e),"aria-label":fJe(e)}),(0,H.jsxs)(`span`,{className:`auto-row-text`,children:[(0,H.jsx)(`span`,{className:`auto-row-name`,children:e.name}),(0,H.jsx)(`span`,{className:`auto-row-desc`,children:pJe(e)})]})]}),(0,H.jsx)(`button`,{type:`button`,className:`auto-row-switch`+(e.schedule?.enabled?` is-on`:``),disabled:u===e.id,"aria-pressed":!!e.schedule?.enabled,title:e.schedule?.enabled?`Scheduled: ${e.schedule.cron}. Click to pause.`:`Not scheduled. Click to enable.`,onClick:()=>void _(e),children:(0,H.jsx)(`span`,{className:`auto-row-switch-knob`})})]},e.id)}),!h.length&&!n?(0,H.jsx)(`p`,{className:`auto-rail-empty`,children:`No automations yet. One reads a public web page into a database on a schedule; the other fills an automation column from a public profile.`}):null]})]}),(0,H.jsxs)(`section`,{className:`auto-main`,children:[n?(0,H.jsx)(`div`,{className:`auto-banner is-error`,role:`alert`,children:n}):null,e&&!e.storeAvailable?(0,H.jsx)(`div`,{className:`auto-banner is-warn`,role:`status`,children:`The tenant store is unavailable, so nothing can be saved right now.`}):null,o?(0,H.jsx)(Xqe,{kinds:e?.kinds||[],onCreated:async e=>{s(!1);let t=await p();e&&t&&a(e)},onCancel:()=>s(!1)}):g?(0,H.jsx)(dJe,{automation:g,kinds:e?.kinds||[],cronPresets:e?.cronPresets||[],hikerReady:!!e?.hikerReady,onSaved:async e=>{let t=await p();e&&t&&a(e)},onDeleted:async()=>{a(``),await p()}},g.id):(0,H.jsxs)(`div`,{className:`auto-empty`,children:[(0,H.jsx)(`h1`,{children:`Automations`}),(0,H.jsx)(`p`,{children:`An automation is a job this workspace runs for you — on demand, or on a schedule. Each one is a flow: a trigger, the steps it walks, and the database it writes. Pick one on the left, or create a new one.`}),(0,H.jsxs)(`ul`,{className:`auto-empty-kinds`,children:[(0,H.jsxs)(`li`,{children:[(0,H.jsx)(`strong`,{children:`Web page to database.`}),` Read a public page, map its columns to fields, and keep a database in step with it. Re-runs update matched rows by key and insert new ones; a row that stops appearing is counted and kept, never deleted.`]}),(0,H.jsxs)(`li`,{children:[(0,H.jsx)(`strong`,{children:`Instagram profile column.`}),` For every record carrying a public profile URL, read the profile — exactly, through HikerAPI, or approximately on the free anonymous rung — and append a timestamped row per pull, so followers and post engagement become a series you can filter by date rather than a single current number.`]})]})]})]})]})}function g9(e){if(e==null||e===``)return null;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:null}function _9(e,t){let n=g9(e);if(n==null)return`—`;let r=t??+(Math.abs(n)<10&&!Number.isInteger(n));return n.toLocaleString(void 0,{minimumFractionDigits:r,maximumFractionDigits:r})}function hJe(e,t){let n=g9(e);return n==null?`—`:n<0?`-$${_9(Math.abs(n),t)}`:`$${_9(n,t)}`}function v9(e){let t=g9(e);return t==null?`—`:Math.round(t).toLocaleString()}function gJe(e,t={}){let n=g9(e);return n==null?`—`:n>=999?`+${(1+n/100).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0})}×`:`${t.signed&&n>=0?`+`:``}${_9(n,t.dp)}%`}var _Je=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function vJe(e){if(e==null||e===``)return`—`;let t=String(e),n=/^(\d{4})-(\d{2})$/.exec(t);if(n){let e=Number(n[2]);if(e>=1&&e<=12)return`${_Je[e-1]} ${n[1].slice(2)}`}let r=t.includes(` `)?t.replace(` `,`T`):t,i=/T\d{2}:\d{2}/.test(r)&&!/(?:[zZ]|[+-]\d{2}:?\d{2})$/.test(r)?`${r}Z`:r,a=new Date(i);return Number.isNaN(a.getTime())?t:a.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`,timeZone:`UTC`})}var y9={money:hJe,num:_9,pct:gJe,int:v9,date:vJe};function b9(e,t,n){if(t==null||t===``)return e==null||e===``?`—`:String(e);switch(t){case`money`:return hJe(e);case`num`:return _9(e);case`pct`:return gJe(e,n);case`int`:return v9(e);case`date`:return vJe(e);default:return e==null||e===``?`—`:String(e)}}function yJe(e){return!!e&&e.kind===`decomp`}function bJe(e,t){return typeof e!=`number`||typeof t!=`number`||!Number.isFinite(e)||!Number.isFinite(t)?null:{text:`Showing ${v9(e)} of ${v9(t)}`,capped:t>e}}function xJe(e,t){if(!t)return;if(yJe(t)){let n=e[t.row_key];if(!n||typeof n!=`object`)return;let r=n;return r.kind!==`decomp`||!r.date_from||!r.date_to?void 0:r}let n=e[t.id_key];if(n==null||n===``)return;let r=t.label_key?e[t.label_key]:void 0;return{kind:t.kind,id:n,label:String(r??n)}}function SJe(e){return(e??``).trim()||`Nothing matched this scope.`}function x9({d:e,size:t,className:n}){return(0,H.jsx)(`svg`,{className:n,width:t,height:t,viewBox:`0 0 24 24`,"aria-hidden":`true`,focusable:`false`,children:(0,H.jsx)(`path`,{d:e,fill:`currentColor`})})}function CJe({size:e=15}){return(0,H.jsx)(x9,{className:`pg-icon`,size:e,d:`M12 15.6 6.8 10.4l1.4-1.4 2.8 2.8V3h2v8.8l2.8-2.8 1.4 1.4zM5 20a2 2 0 0 1-2-2v-3h2v3h14v-3h2v3a2 2 0 0 1-2 2z`})}function wJe({size:e=14}){return(0,H.jsx)(x9,{className:`pg-icon`,size:e,d:`M9.6 17.6 4 12l1.4-1.4 4.2 4.2 9-9L20 7.2z`})}function TJe({size:e=14}){return(0,H.jsx)(x9,{className:`pg-icon`,size:e,d:`M11 15h2v2h-2zm0-10h2v8h-2z`})}function EJe({title:e,asOf:t,subtitle:n,controls:r,onControl:i,busy:a}){return(0,H.jsxs)(`header`,{className:`pg-header`,children:[(0,H.jsxs)(`div`,{className:`pg-title-row`,children:[(0,H.jsx)(`h1`,{className:`pg-title`,children:e}),r&&r.length>0?(0,H.jsx)(`div`,{className:`pg-controls`,children:r.map(e=>(0,H.jsxs)(`label`,{className:`pg-control`,children:[(0,H.jsx)(`span`,{className:`pg-control-label`,children:e.label}),(0,H.jsx)(`select`,{className:`pg-select`,value:String(e.value),disabled:a||!i,onChange:t=>i?.(e.key,t.target.value),children:e.options.map(e=>(0,H.jsx)(`option`,{value:String(e.value),children:e.label},String(e.value)))})]},e.key))}):null]}),(0,H.jsx)(`div`,{className:`pg-rule`}),n?(0,H.jsx)(`p`,{className:`pg-subtitle`,children:n}):null,t?(0,H.jsxs)(`p`,{className:`pg-asof`,children:[`Data pulled `,(0,H.jsx)(`time`,{dateTime:t,children:y9.date(t)})]}):null]})}function DJe({label:e,note:t,children:n}){return(0,H.jsxs)(`section`,{className:`pg-section`,children:[(0,H.jsx)(`h2`,{className:`pg-section-label`,children:e}),t?(0,H.jsx)(`p`,{className:`pg-section-note`,children:t}):null,n]})}function OJe({items:e,onOpen:t}){return e.length?(0,H.jsx)(`div`,{className:`pg-kpis`,children:e.map((e,n)=>{let r=b9(e.value,e.fmt),i=e.delta!=null,a=i?b9(e.delta,e.delta_fmt??`pct`,{signed:!0}):``,o=e.delta_dir??(i?`flat`:`off`),s=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`pg-kpi-label`,children:e.label}),(0,H.jsx)(`span`,{className:`pg-kpi-value`,children:r}),a||e.delta_label?(0,H.jsxs)(`span`,{className:`pg-kpi-delta is-${o}`,children:[a,a&&e.delta_label?` `:``,e.delta_label??``]}):null]}),c=e.key??`${e.label}-${n}`;return e.drill&&t?(0,H.jsx)(`button`,{type:`button`,className:`pg-kpi is-clickable`,onClick:()=>t(e.drill),children:s},c):(0,H.jsx)(`div`,{className:`pg-kpi`,children:s},c)})}):null}function kJe({rows:e,columns:t,filename:n,note:r}){return(0,H.jsxs)(`a`,{className:`pg-download`,href:(0,z.useMemo)(()=>{let n=e=>/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e,r=``+[t.map(e=>n(e.label)).join(`,`),...e.map(e=>t.map(t=>n(b9(e[t.key],t.fmt))).join(`,`))].join(`\r -`);return URL.createObjectURL(new Blob([r],{type:`text/csv;charset=utf-8`}))},[e,t]),download:`${n}.csv`,children:[(0,H.jsx)(CJe,{}),(0,H.jsx)(`span`,{children:`Download CSV`}),r?(0,H.jsx)(`span`,{className:`pg-download-note`,children:r}):null]})}function AJe({columns:e,rows:t,drill:n,shown:r,total:i,onOpen:a,empty:o,download:s}){let c=bJe(r,i),l=c?.capped??!1;return t.length?(0,H.jsxs)(`div`,{className:`pg-table-wrap`,children:[(0,H.jsxs)(`table`,{className:`pg-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsx)(`tr`,{children:e.map(e=>(0,H.jsx)(`th`,{className:e.align===`right`?`is-right`:e.align===`center`?`is-center`:``,scope:`col`,children:e.label},e.key))})}),(0,H.jsx)(`tbody`,{children:t.map((t,r)=>{let i=xJe(t,n);return(0,H.jsx)(`tr`,{className:i&&a?`is-clickable`:``,children:e.map((e,n)=>{let r=b9(t[e.key],e.fmt);return(0,H.jsx)(`td`,{className:e.align===`right`?`is-right`:e.align===`center`?`is-center`:``,children:n===0&&i&&a?(0,H.jsx)(`button`,{type:`button`,className:`pg-cell-link`,onClick:()=>a(i),children:r}):r},e.key)})},String(t[e[0]?.key]??r))})})]}),(0,H.jsxs)(`div`,{className:`pg-table-foot`,children:[c?(0,H.jsx)(`span`,{className:c.capped?`pg-shown is-capped`:`pg-shown`,children:c.text}):null,s?(0,H.jsx)(kJe,{rows:t,columns:e,filename:s.filename,note:l?`the rows shown`:void 0}):null]})]}):(0,H.jsx)(`p`,{className:`pg-empty`,children:SJe(o)})}function jJe({checks:e}){if(!e.length)return null;let t=e.filter(e=>!e.ok).length;return(0,H.jsxs)(`details`,{className:`pg-validation`,open:t>0,children:[(0,H.jsxs)(`summary`,{className:t?`is-failed`:`is-ok`,children:[t?(0,H.jsx)(TJe,{}):(0,H.jsx)(wJe,{}),(0,H.jsx)(`span`,{children:t?`${y9.int(t)} of ${y9.int(e.length)} reconciliation checks did not tie`:`All ${y9.int(e.length)} reconciliation checks tie to Odoo`})]}),(0,H.jsxs)(`table`,{className:`pg-table pg-validation-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{scope:`col`,children:`Check`}),(0,H.jsx)(`th`,{scope:`col`,className:`is-right`,children:`Expected`}),(0,H.jsx)(`th`,{scope:`col`,className:`is-right`,children:`Actual`}),(0,H.jsx)(`th`,{scope:`col`,children:`Note`})]})}),(0,H.jsx)(`tbody`,{children:e.map(e=>(0,H.jsxs)(`tr`,{className:e.ok?``:`is-failed`,children:[(0,H.jsx)(`td`,{children:e.name}),(0,H.jsx)(`td`,{className:`is-right`,children:b9(e.expected,e.fmt)}),(0,H.jsx)(`td`,{className:`is-right`,children:b9(e.actual,e.fmt)}),(0,H.jsx)(`td`,{children:e.note??``})]},e.name))})]})]})}var MJe={customer:`Customer`,sku:`Product`,rep:`Salesperson`,bu:`Business Unit`};function S9({label:e,value:t}){return(0,H.jsxs)(`div`,{className:`pg-drill-row`,children:[(0,H.jsx)(`span`,{className:`pg-drill-key`,children:e}),(0,H.jsx)(`span`,{className:`pg-drill-val`,children:t})]})}function NJe({drill:e,onClose:t}){let n=e.kind===`decomp`,r=e,i=e;return(0,H.jsxs)(`aside`,{className:`pg-drill`,role:`dialog`,"aria-label":e.label,children:[(0,H.jsxs)(`header`,{className:`pg-drill-head`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`pg-drill-kind`,children:n?`Period`:MJe[e.kind]??e.kind}),(0,H.jsx)(`h2`,{className:`pg-drill-title`,children:e.label})]}),(0,H.jsx)(`button`,{type:`button`,className:`pg-drill-close`,onClick:t,"aria-label":`Close`,children:`×`})]}),(0,H.jsxs)(`div`,{className:`pg-drill-body`,children:[n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(S9,{label:`Window`,value:`${y9.date(r.date_from)} – ${y9.date(r.date_to)}`}),r.cmp_from&&r.cmp_to?(0,H.jsx)(S9,{label:`Compared with`,value:`${y9.date(r.cmp_from)} – ${y9.date(r.cmp_to)}`}):null,(0,H.jsx)(S9,{label:`Scope`,value:r.scope_value==null?r.scope_type:`${r.scope_type} · ${r.scope_value}`})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(S9,{label:MJe[e.kind]??`Record`,value:i.label}),(0,H.jsx)(S9,{label:`Identifier`,value:String(i.id)})]}),(0,H.jsxs)(`p`,{className:`pg-drill-note`,children:[`This wave ships the drill as a complete `,(0,H.jsx)(`em`,{children:`declaration`}),`: the exact scope above is what the number was computed over, and you can check it. The row-level breakdown behind it opens in the next release — until then, use the same view in the current application.`]})]})]})}var PJe=new Set([`text`,`status`,`currency`,`int`,`date`,`pct`,`select`,`user`,`multiselect`,`checkbox`,`phone`,`email`,`url`,`rating`,`created_time`,`formula`,`automation`,`image`]);function FJe(e){return e.map(e=>({key:e.key,label:e.label,type:PJe.has(e.type)?e.type:`text`,source:e.source===`overlay`?`overlay`:`odoo`}))}function IJe(e,t){if(!t||t.length===0)return e;let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>(n.get(e.key)??2**53-1)-(n.get(t.key)??2**53-1))}var C9=720,w9=230,T9=52,E9=10,D9=12,LJe=34;function O9(e){if(!Number.isFinite(e))return`—`;let t=Math.abs(e);return t>=1e9?(e/1e9).toFixed(1)+`B`:t>=1e6?(e/1e6).toFixed(1)+`M`:t>=1e3?(e/1e3).toFixed(1)+`k`:Number.isInteger(e)?e.toLocaleString():e.toFixed(2)}function RJe(e){let t=e>0?`+`:e<0?`−`:``,n=Math.abs(e);return n>=999?`${t}${Math.round(n/100)}×`:`${t}${n.toFixed(+(n<10))}%`}function zJe({spec:e,series:t,fields:n,rows:r,xOrder:i,deltaByKey:a,onPick:o,pickable:s}){let c=(0,z.useMemo)(()=>FJe(n),[n]),l=(0,z.useMemo)(()=>new Map(c.map(e=>[e.key,e])),[c]),u=(0,z.useMemo)(()=>t.map(t=>({def:t,data:M7({...e,y:t.y},r,l)})),[t,e,r,l]),d=(0,z.useMemo)(()=>{let e=new Map;for(let t of u)for(let n of t.data.buckets)e.has(n.key)||e.set(n.key,n.label);return IJe([...e].map(([e,t])=>({key:e,label:t,value:0,n:0})),i)},[u,i]),f=u.find(e=>e.data.problem)?.data.problem;if(f)return(0,H.jsx)(`p`,{className:`pg-empty`,children:f});if(!d.length)return(0,H.jsx)(`p`,{className:`pg-empty`,children:`No periods in this scope yet, so there is nothing to plot.`});let p=u.map(e=>({def:e.def,data:e.data,lookup:new Map(e.data.buckets.map(e=>[e.key,e]))})),m=Math.max(0,...p.flatMap(e=>e.data.buckets.map(e=>e.value))),h=m>0?(w9-D9-LJe)/m:0,g=(C9-T9-E9)/d.length,_=Math.max(2,g*.72/Math.max(1,p.length)),v=Math.max(1,Math.ceil(d.length/12)),y=w9-LJe,b=p[0]?.data.rows??0,x=p.reduce((e,t)=>e+t.data.missingY,0),S=p[0]?.data.omitted??0,C=p[0]?.data.omittedValue??0;return(0,H.jsxs)(`div`,{className:`pg-charts`,children:[(0,H.jsx)(`div`,{className:`pg-legend`,children:p.map((e,t)=>(0,H.jsxs)(`span`,{className:`pg-legend-key`,children:[(0,H.jsx)(`span`,{className:`pg-legend-swatch pg-ser-${t%4}`}),e.def.label]},e.def.y))}),(0,H.jsxs)(`svg`,{className:`pg-chart-svg`,viewBox:`0 0 ${C9} ${w9}`,role:`img`,"aria-label":e.title??`Chart`,children:[(0,H.jsx)(`line`,{className:`pg-ax`,x1:T9,y1:y,x2:C9-E9,y2:y}),(0,H.jsx)(`line`,{className:`pg-ax pg-ax-soft`,x1:T9,y1:D9,x2:C9-E9,y2:D9}),(0,H.jsx)(`text`,{className:`pg-ax-lab`,x:T9-6,y:16,textAnchor:`end`,children:O9(m)}),(0,H.jsx)(`text`,{className:`pg-ax-lab`,x:T9-6,y,textAnchor:`end`,children:`0`}),d.map((e,t)=>{let n=T9+t*g,r=_*p.length,i=n+(g-r)/2;return(0,H.jsxs)(`g`,{children:[s&&o?(0,H.jsx)(`rect`,{className:`pg-slot`,x:n,y:D9,width:g,height:y-D9,onClick:()=>o(e.key),children:(0,H.jsx)(`title`,{children:`Open ${e.label}`})}):null,p.map((t,n)=>{let r=t.lookup.get(e.key)?.value??0,a=Math.max(+(r>0),r*h);return(0,H.jsx)(`rect`,{className:`pg-bar pg-ser-${n%4}`,x:i+n*_,y:y-a,width:Math.max(1,_-1.5),height:a,children:(0,H.jsx)(`title`,{children:`${e.label} · ${t.def.label}: ${O9(r)}`})},t.def.y)}),(()=>{let t=a?.get(e.key);if(t==null)return null;let r=Math.max(0,...p.map(t=>{let n=t.lookup.get(e.key)?.value??0;return Math.max(+(n>0),n*h)}));return(0,H.jsx)(`text`,{className:`pg-bar-delta ${t>0?`is-up`:t<0?`is-down`:``}`,x:n+g/2,y:Math.max(8,y-r-4),textAnchor:`middle`,children:RJe(t)})})(),t%v===0?(0,H.jsx)(`text`,{className:`pg-ax-lab`,x:n+g/2,y:210,textAnchor:`middle`,children:e.label}):null]},e.key||`(blank)-${t}`)})]}),(0,H.jsxs)(`p`,{className:`pg-chart-note`,children:[`${b.toLocaleString()} period${b===1?``:`s`} plotted`,S>0?` · ${S} more not drawn, worth ${O9(C)}`:``,x>0?` · ${x} value${x===1?``:`s`} the measure could not use`:``,s?` · click a period to decompose it`:``]})]})}function BJe(e){let t=[],n={body:[]};for(let r of e)r.type===`section`?((n.head||n.body.length)&&t.push(n),n={head:r,body:[]}):n.body.push(r);return(n.head||n.body.length)&&t.push(n),t}function VJe({block:e,onOpen:t}){let n=e.drill,r=new Map;if(yJe(n)){let t=e.spec.x;for(let i of e.rows){let e=i[n.row_key],a=t?i[t]:void 0;a!=null&&e&&typeof e==`object`&&e.kind===`decomp`&&r.set(String(a),e)}}let i=new Map;if(e.delta_key){let t=e.spec.x;for(let n of e.rows){let r=t?n[t]:void 0,a=n[e.delta_key];r!=null&&typeof a==`number`&&Number.isFinite(a)&&i.set(String(r),a)}}let a=!!t&&r.size>0;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(zJe,{spec:e.spec,series:e.series??[],fields:e.fields,rows:e.rows,xOrder:e.x_order,deltaByKey:i.size?i:void 0,pickable:a,onPick:e=>{let n=r.get(e);n&&t&&t(n)}}),e.shown!=null&&e.total!=null&&e.total>e.shown?(0,H.jsxs)(`p`,{className:`pg-shown is-capped`,children:[`Showing `,e.shown,` of `,e.total,` periods`]}):null]})}function HJe({block:e,onOpen:t}){switch(e.type){case`kpis`:return(0,H.jsx)(OJe,{items:e.items,onOpen:t});case`table`:{let n=e;return(0,H.jsx)(AJe,{columns:n.columns,rows:n.rows,drill:n.drill,shown:n.shown,total:n.total,empty:n.empty,download:n.download,onOpen:t})}case`chart`:return(0,H.jsx)(VJe,{block:e,onOpen:t});case`validation`:return(0,H.jsx)(jJe,{checks:e.checks});default:return null}}function UJe({page:e,onControl:t,onOpen:n,busy:r}){let i=BJe(e.blocks);return(0,H.jsxs)(`div`,{className:`pg-page`,children:[(0,H.jsx)(EJe,{title:e.title,asOf:e.as_of,subtitle:e.subtitle,controls:e.controls,onControl:t,busy:r}),i.map((e,t)=>e.head?(0,H.jsx)(DJe,{label:e.head.label,note:e.head.note,children:e.body.map((e,t)=>(0,H.jsx)(HJe,{block:e,onOpen:n},e.key??`b${t}`))},e.head.key??`s${t}`):(0,H.jsx)(`div`,{children:e.body.map((e,t)=>(0,H.jsx)(HJe,{block:e,onOpen:n},e.key??`b${t}`))},`g${t}`))]})}async function WJe(e){let t=``,n=``;try{let r=await e.json();t=String(r?.error?.code??``),n=String(r?.error?.message??``)}catch{}if(e.status>=500)return{ok:!1,status:e.status,code:t||`server_error`,message:`Something went wrong on our side. Try again in a moment.`};let r=e.status===401?`Your session has ended. Sign in again.`:e.status===403?`This account does not have access to that.`:e.status===404?`That page does not exist.`:`That request could not be completed.`;return{ok:!1,status:e.status,code:t||String(e.status),message:n||r}}async function GJe(e,t={}){let n=new URLSearchParams(t).toString(),r=`${jd}/pages/${encodeURIComponent(e)}${n?`?${n}`:``}`;try{let e=await fetch(r,{credentials:Md});if(!e.ok)return WJe(e);let t=await e.json();return!t||typeof t!=`object`||!Array.isArray(t.blocks)?{ok:!1,status:200,code:`bad_envelope`,message:`The server sent a page this client could not read.`}:{ok:!0,page:t}}catch{return{ok:!1,status:0,code:`offline`,message:`The server could not be reached.`}}}function KJe({pageKey:e,label:t}){let[n,r]=(0,z.useState)({phase:`loading`}),[i,a]=(0,z.useState)({}),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(null),u=JSON.stringify(i);(0,z.useEffect)(()=>{let t=!1;return s(!0),GJe(e,JSON.parse(u)).then(e=>{if(!t){if(s(!1),e.ok){r({phase:`ready`,page:e.page});return}if(e.status===401){Bd(Nd);return}r({phase:`error`,message:e.message})}}),()=>{t=!0}},[e,u]);let d=(0,z.useCallback)((e,t)=>{l(null),a(n=>({...n,[e]:t}))},[]);return n.phase===`loading`?(0,H.jsxs)(`div`,{className:`pg-state`,children:[(0,H.jsx)(`h1`,{children:t}),(0,H.jsx)(`span`,{className:`lp-spin lp-spin--lg`,role:`status`,"aria-label":`Loading`})]}):n.phase===`error`?(0,H.jsxs)(`div`,{className:`pg-state pg-error`,children:[(0,H.jsx)(`h1`,{children:t}),(0,H.jsx)(`p`,{children:n.message}),(0,H.jsx)(`button`,{className:`login-submit shell-retry`,type:`button`,onClick:()=>a(e=>({...e})),children:`Try again`})]}):(0,H.jsxs)(`div`,{className:o?`pg-host is-busy`:`pg-host`,children:[(0,H.jsx)(UJe,{page:n.page,onControl:d,onOpen:l,busy:o}),c?(0,H.jsx)(NJe,{drill:c,onClose:()=>l(null)}):null]})}function qJe(e){return e?.role===`admin`}function JJe(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=typeof t.username==`string`?t.username.trim():``;return n?{username:n,name:typeof t.name==`string`&&t.name.trim()!==``?t.name.trim():n,role:typeof t.role==`string`?t.role:``,bus:Array.isArray(t.bus)?t.bus.filter(e=>typeof e==`string`):[],modules:t.modules===`all`?`all`:Array.isArray(t.modules)?t.modules.filter(e=>typeof e==`string`):[],avatar:typeof t.avatar==`string`&&t.avatar.startsWith(`data:image/`)?t.avatar:null}:null}function k9(e){return!e||typeof e!=`object`?null:JJe(e.user)}var YJe=`Incorrect username or password.`,A9=`Sign-in is unavailable right now. Try again in a moment.`,XJe=`Cannot reach the server. Check your connection and try again.`;function ZJe(e,t){if(e===0)return XJe;if(e>=500)return A9;let n=t?.error;return(typeof n?.message==`string`?n.message.trim():``)||(e===401?YJe:A9)}async function QJe(e){try{return await e.json()}catch{return null}}async function $Je(e,t){let n;try{n=await fetch(`${jd}/auth/login`,{method:`POST`,credentials:Md,headers:{"Content-Type":`application/json`},body:JSON.stringify({username:e,password:t})})}catch{return{ok:!1,message:ZJe(0,null)}}let r=await QJe(n);if(!n.ok)return{ok:!1,message:ZJe(n.status,r)};let i=k9(r);return i?{ok:!0,user:i}:{ok:!1,message:A9}}async function eYe(){try{let e=await fetch(`${jd}/auth/me`,{credentials:Md});return e.ok?k9(await QJe(e)):null}catch{return null}}async function tYe(){try{await fetch(`${jd}/auth/logout`,{method:`POST`,credentials:Md})}catch{}}async function j9(e,t){try{let n=await fetch(`${jd}${e}`,{credentials:Md,headers:t?.body?{"Content-Type":`application/json`}:void 0,...t});if(n.status===204)return{ok:!0,data:void 0};let r=null;try{r=await n.json()}catch{}if(!n.ok){let e=r?.error,t=n.status>=500?`Something went wrong on our side. Try again in a moment.`:e?.message||(n.status===403?`Administrators only.`:n.status===409?`That username already exists. Edit the existing account instead.`:`That change could not be saved.`);return{ok:!1,status:n.status,message:t}}return{ok:!0,data:r}}catch{return{ok:!1,status:0,message:`The server could not be reached.`}}}function nYe(){return j9(`/settings`)}function rYe(){return j9(`/admin/users`)}function iYe(e){return j9(`/admin/users`,{method:`POST`,body:JSON.stringify(e)})}function aYe(e,t){return j9(`/admin/users/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)})}function oYe(e,t){return j9(`/admin/users/${encodeURIComponent(e)}/password`,{method:`POST`,body:JSON.stringify({password:t})})}function sYe(e){return j9(`/admin/users/${encodeURIComponent(e)}/perms`)}function cYe(e,t){return j9(`/admin/users/${encodeURIComponent(e)}/perms`,{method:`PUT`,body:JSON.stringify(t)})}function lYe(e){return j9(`/auth/me/avatar`,{method:`POST`,body:JSON.stringify({dataUrl:e})})}function uYe(){return j9(`/auth/me/avatar`,{method:`DELETE`})}function dYe(){return j9(`/admin/keychain`)}function fYe(e,t,n){return j9(`/admin/keychain`,{method:`POST`,body:JSON.stringify({label:e,type:t,fields:n})})}function pYe(e){return j9(`/admin/keychain/${encodeURIComponent(e)}`,{method:`DELETE`})}function mYe(e){return j9(`/admin/keychain/${encodeURIComponent(e)}/test`,{method:`POST`})}function hYe(){return j9(`/admin/connectors`)}function gYe(e,t){return j9(`/admin/connectors/${encodeURIComponent(e)}/pause`,{method:`POST`,body:JSON.stringify({paused:t})})}function _Ye(e,t){return(e===`users`||e===`keychains`||e===`connectors`)&&!t?`account`:e}var vYe=new Set(Object.keys({text:!0,status:!0,currency:!0,int:!0,date:!0,pct:!0,select:!0,user:!0,multiselect:!0,checkbox:!0,phone:!0,email:!0,url:!0,rating:!0,created_time:!0,formula:!0,automation:!0,image:!0}));function yYe(e){return typeof e==`string`&&vYe.has(e)?e:`text`}function bYe(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function xYe(e){if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.key!=`string`||t.key===``)return null;let n=typeof t.label==`string`&&t.label!==``?t.label:t.key,r=bYe(t.options);return{key:t.key,label:n,type:yYe(t.type),source:t.source===`overlay`?`overlay`:`odoo`,...t.pinned===!0?{pinned:!0}:{},...r.length?{options:r}:{},...typeof t.note==`string`?{note:t.note}:{},...typeof t.description==`string`&&t.description!==``?{note:t.description}:{}}}function SYe(e,t,n){let r=[];for(let e of Array.isArray(n)?n:[]){let t=xYe(e);t&&r.push(t)}return{key:e,label:t||e,fields:r}}function CYe(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e;if(!Array.isArray(t.nodes))return null;let n=t.conj===`or`?`or`:t.conj===`and`?`and`:void 0;return{...n?{conj:n}:{},nodes:t.nodes}}function wYe(e){if(!e||typeof e!=`object`||Array.isArray(e))return{access:!1,filter:null,hiddenFields:[]};let t=e;return{access:t.access===!0,filter:CYe(t.filter),hiddenFields:M9(bYe(t.hiddenFields))}}function M9(e){return[...new Set(e)].sort()}function N9(e){return e.find(e=>e.pinned)?.key??e[0]?.key??``}function TYe(e){let t=N9(e);return e.filter(e=>e.key!==t).map(e=>e.key)}function EYe(e){if(!e||typeof e!=`object`)return null;let t=e,n=t.fields_by_module&&typeof t.fields_by_module==`object`?t.fields_by_module:{},r=t.perms&&typeof t.perms==`object`&&!Array.isArray(t.perms)?t.perms:{},i=(Array.isArray(t.modules)?t.modules.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return typeof t.key==`string`&&t.key?[{key:t.key,label:typeof t.label==`string`?t.label:t.key}]:[]}):Object.keys(n).map(e=>({key:e,label:e}))).map(e=>SYe(e.key,e.label,n[e.key])),a={};for(let e of i)a[e.key]=wYe(r[e.key]);return{modules:i,entries:a,orphanModules:Object.keys(r).filter(e=>!(e in a)).sort(),migrated:typeof t.perms_v==`number`&&t.perms_v>=1,isAdmin:t.is_admin===!0}}function P9(e,t,n){let r=e[t]??{access:!1,filter:null,hiddenFields:[]};return{...e,[t]:{...r,...n}}}function DYe(e,t,n){return P9(e,t,{access:n})}function OYe(e,t,n){return P9(e,t,{filter:!n||n.nodes.length===0?null:n})}function F9(e,t,n){return P9(e,t,{hiddenFields:M9(n)})}function kYe(e,t,n){let r=e[t]?.hiddenFields??[];return F9(e,t,r.includes(n)?r.filter(e=>e!==n):[...r,n])}function AYe(e,t){return new Set(e[t]?.hiddenFields??[])}function jYe(e,t){return e[t]?.filter??{nodes:[]}}function I9(e,t){let n={};for(let r of e.modules){let e=t[r.key]??{access:!1,filter:null,hiddenFields:[]},i=N9(r.fields);n[r.key]=r.fields.length?{access:e.access,filter:e.filter,hiddenFields:M9(e.hiddenFields.filter(e=>e!==i))}:{access:e.access,filter:null,hiddenFields:[]}}return{perms:n}}function MYe(e,t,n){if(n.kind===`all`){let n={};for(let r of e.modules)n[r.key]=t[r.key]??{access:!1,filter:null,hiddenFields:[]};return n}return{...e.entries,[n.key]:t[n.key]??{access:!1,filter:null,hiddenFields:[]}}}function NYe(e,t,n){let r=new Set(e.modules.map(e=>e.key));return(n.kind===`all`?Object.keys(t):[n.key]).filter(e=>!r.has(e)).sort()}function PYe(e,t,n){return JSON.stringify(I9(e,t))!==JSON.stringify(I9(e,n))}function FYe(e){if(!e)return 0;let t=0,n=e=>{for(let r of e)r&&typeof r==`object`&&Array.isArray(r.children)?n(r.children):t+=1};return n(e.nodes),t}function L9(e,t=!1){if(!e||!e.access)return`No access`;if(t)return`Full access`;let n=FYe(e.filter),r=e.hiddenFields.length;if(!n&&!r)return`Full access`;let i=[];return n&&i.push(`${n} condition${n===1?``:`s`}`),r&&i.push(`${r} field${r===1?``:`s`} hidden`),i.join(`, `)}function R9(e,t){if(!e||e.modules.length===0)return``;let n=e.modules.filter(e=>t[e.key]?.access);if(n.length===0)return`No access`;let r=n.filter(e=>e.fields.length>0&&((t[e.key]?.filter?.nodes.length??0)>0||(t[e.key]?.hiddenFields.length??0)>0)).length,i=n.length===e.modules.length?`All ${n.length} module${n.length===1?``:`s`}`:`${n.length} of ${e.modules.length} modules`;return r?`${i}, ${r} restricted`:i}function z9(e){return e.length<=1?e[0]??``:`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`}function B9(e){return e.kind===`all`?`this account's whole access`:`${e.label} access`}function IYe({user:e,userOptions:t,copyTargets:n,onBack:r,onSaved:i}){let a=e.name||e.username,o=e.username,[s,c]=(0,z.useState)({phase:`loading`}),[l,u]=(0,z.useState)({}),[d,f]=(0,z.useState)({}),[p,m]=(0,z.useState)(null),[h,g]=(0,z.useState)(null),[_,v]=(0,z.useState)(!1),[y,b]=(0,z.useState)(``),[x,S]=(0,z.useState)(``),[C,w]=(0,z.useState)(e.name??``),[T,E]=(0,z.useState)(e.role??`user`),[D,O]=(0,z.useState)(``);(0,z.useEffect)(()=>{let e=!1;return c({phase:`loading`}),sYe(o).then(t=>{if(e)return;if(!t.ok){c({phase:`error`,message:t.message});return}let n=EYe(t.data);if(!n){c({phase:`error`,message:`The permission record could not be read. Close and try again.`});return}u(n.entries),f(n.entries),c({phase:`ready`,payload:n})}),()=>{e=!0}},[o]);let k=s.phase===`ready`?s.payload:null,A=k?PYe(k,l,d):!1,j=e.role===`admin`||k?.isAdmin===!0,M=C.trim()!==(e.name??``).trim()||T!==(e.role??`user`),N=A||M,P=(0,z.useCallback)(()=>{N?m({kind:`discard`}):r()},[N,r]),F=(0,z.useRef)(N);F.current=N;let ee=(0,z.useRef)(p);ee.current=p;let I=(0,z.useRef)(h);I.current=h,(0,z.useEffect)(()=>{let e=e=>{if(e.key===`Escape`){if(I.current){e.stopPropagation(),I.current.phase!==`writing`&&g(null);return}if(ee.current){e.stopPropagation(),m(null);return}F.current&&(e.stopPropagation(),m({kind:`discard`}))}};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[]);let te=(0,z.useRef)(null);(0,z.useEffect)(()=>{!p&&!h||(te.current?.scrollIntoView({block:`center`}),te.current?.querySelector(`button`)?.focus())},[p,h]);let L=(0,z.useCallback)(()=>{if(!k)return;v(!0),b(``);let e=I9(k,d);cYe(o,e).then(t=>{v(!1),m(null),t.ok?(u(e.perms),S(`Saved access for ${o}.`),i(`Saved access for ${o}.`)):b(t.message)})},[k,d,o,i]),ne=(0,z.useCallback)((e,t)=>{v(!0),b(``),aYe(o,e).then(e=>{v(!1),e.ok?(S(t),i(t)):b(e.message)})},[o,i]),re=(0,z.useCallback)(async(e,t)=>{g({phase:`preparing`,scope:e});let r=[],i=[];for(let a of n??[]){if(!t.includes(a.username))continue;let n=await sYe(a.username);if(!n.ok){i.push({username:a.username,why:n.message});continue}let o=EYe(n.data);if(!o){i.push({username:a.username,why:`its permission record could not be read`});continue}let s=[];o.isAdmin&&s.push(`is an administrator — the rules will be stored but stay inert until the account is changed to Member`),o.migrated||s.push(`still uses the previous access model — this write moves it to the per-module model`),o.orphanModules.length&&s.push(`has rules for ${o.orphanModules.join(`, `)}, which this deployment no longer offers — those are removed`);let c=NYe(o,l,e);if(c.length){let e=c.map(e=>k?.modules.find(t=>t.key===e)?.label??e);s.push(`does not offer ${e.join(`, `)}, so that part of this copy cannot be written at all`)}r.push({user:a,payload:o,before:e.kind===`all`?R9(o,o.entries)||`No access`:L9(o.entries[e.key],(o.modules.find(t=>t.key===e.key)?.fields.length??0)===0),notes:s})}g({phase:`confirm`,scope:e,plans:r,refused:i})},[n,l,k]),ie=(0,z.useCallback)(async(e,t)=>{g({phase:`writing`,scope:e}),b(``);let n=[],r=[],a=new Set;for(let i of t){let t=MYe(i.payload,l,e);for(let t of NYe(i.payload,l,e))a.add(t);let o=await cYe(i.user.username,I9(i.payload,t));o.ok?n.push(i.user.username):r.push(`${i.user.username} (${o.message})`)}if(g(null),n.length){let t=`Copied ${B9(e)} to ${z9(n)}.`;S(t),i(t)}let o=[];if(r.length&&o.push(`Not copied to ${z9(r)}.`),a.size){let e=z9([...a].sort());o.push(`${e} could not be copied — the accounts you picked do not offer ${a.size===1?`it`:`them`}.`)}o.length&&b(o.join(` `))},[l,i]),ae=(n?.length??0)>0&&!!k&&!A,oe=(0,z.useCallback)(e=>{m(null),b(``),S(``),g({phase:`pick`,scope:e,picked:new Set})},[]);return(0,H.jsxs)(`div`,{className:`set-pane set-perms`,children:[(0,H.jsxs)(`div`,{className:`set-perm-head`,children:[(0,H.jsx)(`button`,{type:`button`,className:`set-secondary`,onClick:P,children:`Back to accounts`}),(0,H.jsxs)(`div`,{className:`set-perm-who`,children:[(0,H.jsx)(`h3`,{className:`set-h set-perm-title`,children:a}),(0,H.jsx)(`span`,{className:`set-username`,children:o})]}),(0,H.jsx)(`span`,{className:T===`admin`?`set-chip set-chip--admin`:`set-chip`,children:T===`admin`?`Admin`:`Member`}),e.active?null:(0,H.jsx)(`span`,{className:`set-chip set-chip--off`,children:`Deactivated`})]}),y?(0,H.jsx)(`p`,{className:`set-error`,children:y}):null,x?(0,H.jsx)(`p`,{className:`set-notice`,children:x}):null,(0,H.jsxs)(`section`,{className:`set-card`,children:[(0,H.jsx)(`h4`,{className:`set-h4`,children:`Account`}),(0,H.jsxs)(`div`,{className:`set-grid2`,children:[(0,H.jsxs)(`div`,{className:`set-field`,children:[(0,H.jsx)(`label`,{className:`set-label`,htmlFor:`set-name`,children:`Display name`}),(0,H.jsx)(`input`,{id:`set-name`,className:`set-input`,value:C,onChange:e=>w(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`set-field`,children:[(0,H.jsx)(`label`,{className:`set-label`,htmlFor:`set-role`,children:`Role`}),(0,H.jsxs)(`select`,{id:`set-role`,className:`pg-select`,value:T,onChange:e=>E(e.target.value),children:[(0,H.jsx)(`option`,{value:`user`,children:`Member`}),(0,H.jsx)(`option`,{value:`admin`,children:`Admin`})]})]})]}),T===`admin`&&(e.role??`user`)!==`admin`?(0,H.jsx)(`p`,{className:`set-help`,children:`Saving this makes the account an administrator, which bypasses every access rule set below.`}):null,(0,H.jsxs)(`div`,{className:`set-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`set-primary`,disabled:_||!M,onClick:()=>ne({name:C,role:T},`Saved ${o}.`),children:`Save account`}),(0,H.jsx)(`button`,{type:`button`,className:`set-secondary`,disabled:_,onClick:()=>ne({active:!e.active},`${e.active?`Deactivated`:`Reactivated`} ${o}.`),children:e.active?`Deactivate account`:`Reactivate account`})]}),(0,H.jsxs)(`div`,{className:`set-danger set-grid2`,children:[(0,H.jsxs)(`div`,{className:`set-field`,children:[(0,H.jsx)(`label`,{className:`set-label`,htmlFor:`set-pw`,children:`Set a new password`}),(0,H.jsx)(`input`,{id:`set-pw`,className:`set-input`,type:`password`,value:D,autoComplete:`new-password`,onChange:e=>O(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`set-pw-side`,children:[(0,H.jsxs)(`p`,{className:`set-help`,children:[`This signs `,o,` out everywhere immediately.`]}),(0,H.jsx)(`button`,{type:`button`,className:`set-secondary`,disabled:_||D.length===0,onClick:()=>{b(``),oYe(o,D).then(e=>{e.ok?(O(``),S(`Password reset; ${o} was signed out.`)):b(e.message)})},children:`Reset password`})]})]})]}),s.phase===`loading`?(0,H.jsx)(`div`,{className:`set-loading`,children:(0,H.jsx)(`span`,{className:`lp-spin lp-spin--lg`,role:`status`,"aria-label":`Loading`})}):null,s.phase===`error`?(0,H.jsx)(`p`,{className:`set-error`,children:s.message}):null,k?(0,H.jsxs)(H.Fragment,{children:[j?(0,H.jsx)(`p`,{className:`set-notice set-perm-banner`,children:`This is an administrator account. Administrators see everything, so nothing set here applies to them — these rules take effect only if the account is changed to Member.`}):null,!k.migrated&&!j?(0,H.jsx)(`p`,{className:`set-notice set-perm-banner`,children:`This account still uses the previous access model, so the rules below are not in force yet. Saving moves it to the per-module model — set every module deliberately before you do.`}):null,k.orphanModules.length?(0,H.jsxs)(`p`,{className:`set-error set-perm-banner`,children:[`This account has rules for `,k.orphanModules.join(`, `),`, which this deployment no longer offers. Saving removes them.`]}):null,(0,H.jsxs)(`div`,{className:`set-perm-sect`,children:[(0,H.jsx)(`h4`,{className:`set-h4`,children:`Access`}),n?.length?(0,H.jsx)(`button`,{type:`button`,className:`set-secondary set-copy-door`,disabled:!ae||_,title:A?`Save this account's access first — a copy sends what is stored, not what is on screen.`:void 0,onClick:()=>oe({kind:`all`}),children:`Apply this access to…`}):null]}),(0,H.jsxs)(`p`,{className:`set-help set-perm-intro`,children:[R9(k,d),`. Each module can be turned off entirely, narrowed to the records a condition describes, or shown with fields hidden. Restrictions apply everywhere the account looks — the tables, the exports and every number computed from them.`]}),A&&n?.length?(0,H.jsx)(`p`,{className:`set-help set-copy-why`,children:`Copying is unavailable while there are unsaved changes — a copy sends what is stored, not what is on screen.`}):null,k.modules.length===0?(0,H.jsx)(`p`,{className:`pg-empty`,children:`This deployment declares no modules that can be restricted.`}):null,k.modules.map(e=>{let r=d[e.key],i=r?.access===!0,a=e.fields.length===0;return(0,H.jsxs)(`section`,{className:`set-card set-perm-mod`,children:[(0,H.jsxs)(`div`,{className:`set-perm-modhead`,children:[(0,H.jsxs)(`label`,{className:`set-check set-perm-toggle`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:i,onChange:t=>f(n=>DYe(n,e.key,t.target.checked))}),(0,H.jsx)(`span`,{className:`set-perm-modname`,children:e.label})]}),(0,H.jsx)(`span`,{className:`set-perm-sum`,children:L9(r,a)}),n?.length?(0,H.jsx)(`button`,{type:`button`,className:`set-secondary set-copy-door`,disabled:!ae||_,onClick:()=>oe({kind:`module`,key:e.key,label:e.label}),children:`Copy to…`}):null]}),i&&a?(0,H.jsx)(`p`,{className:`set-help`,children:`No field list is available for this module, so access is all this editor can set for it. Conditions and hidden fields need a schema.`}):null,i&&!a?(0,H.jsxs)(`div`,{className:`set-perm-panels`,children:[(0,H.jsx)(`div`,{className:`cg-pop set-perm-pop`,children:(0,H.jsx)(Dm,{fields:e.fields,filters:jYe(d,e.key),onChange:t=>f(n=>OYe(n,e.key,t)),userOptions:t})}),(0,H.jsx)(`div`,{className:`cg-pop set-perm-pop`,children:(0,H.jsx)(Om,{fields:e.fields,hidden:AYe(d,e.key),onToggle:t=>f(n=>kYe(n,e.key,t)),lockedKey:N9(e.fields),onHideAll:()=>f(t=>F9(t,e.key,TYe(e.fields))),onShowAll:()=>f(t=>F9(t,e.key,[]))})})]}):null]},e.key)}),(0,H.jsxs)(`div`,{className:`set-actions set-perm-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`set-primary`,disabled:_||!A,onClick:()=>m({kind:`save`}),children:`Save access`}),(0,H.jsx)(`button`,{type:`button`,className:`set-secondary`,disabled:_,onClick:P,children:`Cancel`}),A?(0,H.jsx)(`span`,{className:`set-help set-perm-dirty`,children:`Unsaved changes`}):null]})]}):null,p?(0,H.jsx)(`div`,{className:`set-confirm-wrap`,children:(0,H.jsxs)(`div`,{ref:te,className:`set-confirm`,role:`alertdialog`,"aria-modal":`true`,"aria-label":p.kind===`save`?`Confirm access change`:`Discard changes`,children:[p.kind===`save`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`h4`,{className:`set-h4`,children:[`Change what `,a,` can see?`]}),(0,H.jsxs)(`p`,{className:`set-help`,children:[`This takes effect the next time they load a page. `,LYe(k,d)]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h4`,{className:`set-h4`,children:`Discard these changes?`}),(0,H.jsxs)(`p`,{className:`set-help`,children:[RYe(A,M),` for `,a,` stay as they were.`]})]}),(0,H.jsxs)(`div`,{className:`set-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`set-primary`,disabled:_,onClick:()=>p.kind===`save`?L():(m(null),r()),children:p.kind===`save`?`Save access`:`Discard`}),(0,H.jsx)(`button`,{type:`button`,className:`set-secondary`,disabled:_,onClick:()=>m(null),children:`Keep editing`})]})]})}):null,h?(0,H.jsx)(`div`,{className:`set-confirm-wrap`,children:(0,H.jsxs)(`div`,{ref:te,className:`set-confirm set-copy`,role:`alertdialog`,"aria-modal":`true`,"aria-label":`Copy ${B9(h.scope)}`,children:[h.phase===`pick`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`h4`,{className:`set-h4`,children:[`Copy `,B9(h.scope),` to…`]}),(0,H.jsx)(`p`,{className:`set-help`,children:h.scope.kind===`all`?`Every account you pick has its whole access record replaced with ${a}'s.`:`Every account you pick has its ${h.scope.label} access replaced with ${a}'s. Their other modules are left alone.`}),(0,H.jsx)(`div`,{className:`set-copy-list`,children:(n??[]).map(e=>(0,H.jsxs)(`label`,{className:`set-check set-copy-row`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:h.picked.has(e.username),onChange:t=>{let n=new Set(h.picked);t.target.checked?n.add(e.username):n.delete(e.username),g({...h,picked:n})}}),(0,H.jsx)(`span`,{className:`set-copy-name`,children:e.name||e.username}),(0,H.jsx)(`span`,{className:`set-username set-copy-user`,children:e.username}),e.role===`admin`?(0,H.jsx)(`span`,{className:`set-chip set-chip--admin`,children:`Admin`}):null,e.active?null:(0,H.jsx)(`span`,{className:`set-chip set-chip--off`,children:`Deactivated`})]},e.username))}),(0,H.jsxs)(`div`,{className:`set-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`set-primary`,disabled:h.picked.size===0,onClick:()=>void re(h.scope,[...h.picked]),children:`Continue`}),(0,H.jsx)(`button`,{type:`button`,className:`set-secondary`,onClick:()=>g(null),children:`Cancel`})]})]}):null,h.phase===`preparing`||h.phase===`writing`?(0,H.jsx)(`div`,{className:`set-loading`,children:(0,H.jsx)(`span`,{className:`lp-spin lp-spin--lg`,role:`status`,"aria-label":`Loading`})}):null,h.phase===`confirm`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`h4`,{className:`set-h4`,children:[`Replace `,B9(h.scope),` for `,h.plans.length,` account`,h.plans.length===1?``:`s`,`?`]}),h.plans.length===0?(0,H.jsx)(`p`,{className:`set-help`,children:`None of the accounts picked could be read, so there is nothing to write.`}):(0,H.jsx)(`ul`,{className:`set-copy-plans`,children:h.plans.map(e=>(0,H.jsxs)(`li`,{children:[(0,H.jsx)(`span`,{className:`set-copy-name`,children:e.user.name||e.user.username}),` `,(0,H.jsxs)(`span`,{className:`set-copy-before`,children:[`now: `,e.before]}),e.notes.map(t=>(0,H.jsxs)(`span`,{className:`set-copy-note`,children:[e.user.username,` `,t]},t))]},e.user.username))}),h.refused.length?(0,H.jsxs)(`p`,{className:`set-error`,children:[z9(h.refused.map(e=>`${e.username} (${e.why.replace(/\.\s*$/,``)})`)),` `,`could not be read and will not be changed.`]}):null,(0,H.jsxs)(`div`,{className:`set-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`set-primary`,disabled:h.plans.length===0,onClick:()=>void ie(h.scope,h.plans),children:`Replace access`}),(0,H.jsx)(`button`,{type:`button`,className:`set-secondary`,onClick:()=>g(null),children:`Cancel`})]})]}):null]})}):null]})}function LYe(e,t){let n=R9(e,t);return n?`${n} after this change.`:``}function RYe(e,t){return e&&t?`The account details and access rules`:t?`The account details`:`The access rules`}async function V9(e){try{let t=await fetch(`${jd}/platform-admin${e}`,{credentials:Md}),n=null;try{n=await t.json()}catch{}if(!t.ok){let e=n?.error,r=t.status>=500?`Something went wrong on our side. Try again in a moment.`:e?.message||(t.status===403?`This surface is not available to your account.`:`That could not be loaded.`);return{ok:!1,status:t.status,message:r}}return{ok:!0,data:n}}catch{return{ok:!1,status:0,message:`The server could not be reached.`}}}function zYe(){return V9(`/overview`)}var H9=e=>e?`?tenant=${encodeURIComponent(e)}`:``;function BYe(e){return V9(`/users${H9(e)}`)}function VYe(e){return V9(`/databases${H9(e)}`)}function HYe(e){return V9(`/connectors${H9(e)}`)}function UYe(e){return V9(`/automations${H9(e)}`)}function WYe(e=7){return V9(`/aws?days=${encodeURIComponent(String(e))}`)}var U9=e=>e.toLocaleString();function GYe({n:e,why:t}){return e==null?(0,H.jsx)(`span`,{className:`padmin-unknown`,title:t||`This could not be read just now`,children:`—`}):(0,H.jsx)(H.Fragment,{children:U9(e)})}function W9(e){if(!e)return`never`;let t=Date.parse(e.includes(`T`)?e:e.replace(` `,`T`));if(Number.isNaN(t))return e;let n=Math.floor((Date.now()-t)/6e4);if(n<2)return`just now`;if(n<60)return`${n} minutes ago`;let r=Math.floor(n/60);if(r<24)return`${r} hour${r===1?``:`s`} ago`;let i=Math.floor(r/24);return i<60?`${i} day${i===1?``:`s`} ago`:`${Math.floor(i/30)} months ago`}var KYe={users:`People`,databases:`Databases`,connectors:`Data sources`,automations:`Automations`};function qYe({rows:e=3}){return(0,H.jsx)(`div`,{className:`padmin-skel`,"aria-hidden":`true`,children:Array.from({length:e},(e,t)=>(0,H.jsx)(`div`,{className:`padmin-skel-row`},t))})}function JYe({user:e}){let[t,n]=(0,z.useState)(null),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(null),[s,c]=(0,z.useState)(null),[l,u]=(0,z.useState)(null),[d,f]=(0,z.useState)(``),[p,m]=(0,z.useState)(null),[h,g]=(0,z.useState)(!1),_=(0,z.useCallback)(()=>{n(null),zYe().then(e=>{e.ok?(n(e.data),i(``)):i(e.message)}),UYe().then(e=>{e.ok&&o({rows:e.data.automations,cost:e.data.cost})})},[]);(0,z.useEffect)(_,[_]);let v=(0,z.useCallback)((e,t)=>{c({kind:e,tenant:t}),u(null),f(``),(e===`users`?BYe:e===`databases`?VYe:e===`connectors`?HYe:UYe)(t||void 0).then(t=>{if(!t.ok){u([]),f(t.message);return}let n=t.data;u(n[e]??[]);let r=n.errors??{},i=Object.entries(r).map(([e,t])=>`${e}: ${t}`);f([typeof n.stampsNote==`string`?n.stampsNote:``,...i].filter(Boolean).join(` · `))})},[]),y=(0,z.useCallback)(()=>{g(!0),WYe(7).then(e=>{g(!1),e.ok?m(e.data.report):m({text:``,note:e.message,available:!1})})},[]);return(0,H.jsxs)(`div`,{className:`set-pane`,children:[(0,H.jsx)(`h3`,{className:`set-h`,children:`Loopable admin`}),(0,H.jsxs)(`p`,{className:`set-help set-pane-intro`,children:[`Every workspace on the platform, signed in as `,e.name,`. Counts open the rows they were computed from; anything that could not be read shows a dash and says why, rather than a zero.`]}),r?(0,H.jsx)(`p`,{className:`set-error`,children:r}):null,t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`padmin-totals`,children:[(0,H.jsx)(G9,{label:`Workspaces`,value:U9(t.totals.tenants)}),(0,H.jsx)(G9,{label:`People`,value:U9(t.totals.users)}),(0,H.jsx)(G9,{label:`Databases`,value:U9(t.totals.databases)}),(0,H.jsx)(G9,{label:`Records`,value:U9(t.totals.rows)}),(0,H.jsx)(G9,{label:`Automation cost`,value:a?`$${a.cost.usd.toFixed(2)}`:`—`,hint:a?.cost.basis})]}),t.totals.unknownTenants>0?(0,H.jsxs)(`p`,{className:`set-help padmin-caveat`,children:[t.totals.unknownTenants,` workspace`,t.totals.unknownTenants===1?``:`s`,` could not be read, so the totals above exclude `,t.totals.unknownTenants===1?`it`:`them`,`.`]}):null,(0,H.jsx)(`div`,{className:`padmin-tablewrap`,children:(0,H.jsxs)(`table`,{className:`padmin-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Workspace`}),(0,H.jsx)(`th`,{children:`Storage`}),(0,H.jsx)(`th`,{className:`padmin-num`,children:`People`}),(0,H.jsx)(`th`,{className:`padmin-num`,children:`Databases`}),(0,H.jsx)(`th`,{className:`padmin-num`,children:`Records`}),(0,H.jsx)(`th`,{className:`padmin-num`,children:`Sources`}),(0,H.jsx)(`th`,{className:`padmin-num`,children:`Automations`})]})}),(0,H.jsx)(`tbody`,{children:t.tenants.map(e=>(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`span`,{className:`padmin-name`,children:e.name}),(0,H.jsxs)(`span`,{className:`padmin-meta`,children:[e.slug,e.status===`active`?``:` · ${e.status}`,e.errors&&e.errors.length?` · ${e.errors[0]}`:``]})]}),(0,H.jsx)(`td`,{children:(0,H.jsxs)(`span`,{className:`padmin-meta`,children:[e.storeRepo&&e.storeRepo.includes(`/`)?`own repository`:e.storePrefix?`shared repository`:`tenant #0 repository`,e.keychainLocked?` · keychain locked`:``]})}),(0,H.jsx)(K9,{n:e.users,onOpen:()=>v(`users`,e.slug),title:`${e.admins} administrator${e.admins===1?``:`s`}`}),(0,H.jsx)(K9,{n:e.databases,onOpen:()=>v(`databases`,e.slug),why:e.errors?.[0]}),(0,H.jsx)(K9,{n:e.rows,onOpen:()=>v(`databases`,e.slug),why:e.errors?.[0]}),(0,H.jsx)(K9,{n:e.connectors,onOpen:()=>v(`connectors`,e.slug),why:e.errors?.[0],title:e.connectorsPaused?`${e.connectorsPaused} paused`:`none paused`}),(0,H.jsx)(K9,{n:e.automations,onOpen:()=>v(`automations`,e.slug),why:e.errors?.[0],title:e.automationsEnabled==null?void 0:`${e.automationsEnabled} scheduled`})]},e.slug))})]})}),(0,H.jsxs)(`p`,{className:`set-help padmin-caveat`,children:[`Read `,W9(t.generatedAt),` in `,t.tookMs,` ms.`,` `,t.totals.orphanUsers>0?`${t.totals.orphanUsers} account${t.totals.orphanUsers===1?``:`s`} belong to a workspace this deployment no longer knows. `:``,(0,H.jsx)(`button`,{type:`button`,className:`padmin-link`,onClick:_,children:`Refresh`})]}),s?(0,H.jsxs)(`section`,{className:`padmin-drill`,children:[(0,H.jsxs)(`div`,{className:`padmin-drill-head`,children:[(0,H.jsxs)(`h4`,{className:`padmin-h4`,children:[KYe[s.kind],s.tenant?` — ${s.tenant}`:``]}),(0,H.jsx)(`button`,{type:`button`,className:`padmin-link`,onClick:()=>c(null),children:`Close`})]}),l===null?(0,H.jsx)(qYe,{rows:2}):l.length===0?(0,H.jsx)(`p`,{className:`set-help`,children:`Nothing here yet.`}):(0,H.jsx)(YYe,{kind:s.kind,rows:l}),d?(0,H.jsx)(`p`,{className:`set-help padmin-caveat`,children:d}):null]}):null,a?(0,H.jsxs)(`section`,{className:`padmin-block`,children:[(0,H.jsx)(`h4`,{className:`padmin-h4`,children:`Automation cost`}),(0,H.jsxs)(`p`,{className:`set-help`,children:[a.rows.filter(e=>e.enabled).length,` scheduled of `,a.rows.length,a.cost.fleetRunsPerDay?`, about ${a.cost.fleetRunsPerDay} runs a day`:``,a.cost.unknownCadence?` (${a.cost.unknownCadence} on a custom cadence, not counted)`:``,`. `,a.cost.basis]})]}):null,(0,H.jsxs)(`section`,{className:`padmin-block`,children:[(0,H.jsx)(`h4`,{className:`padmin-h4`,children:`AWS cron`}),p?p.available?(0,H.jsx)(`pre`,{className:`padmin-pre`,children:p.text}):(0,H.jsx)(`p`,{className:`set-help`,children:p.note}):(0,H.jsxs)(`p`,{className:`set-help`,children:[`The external tick that wakes this app on schedule. Reading its usage runs a live CloudWatch query and takes a few seconds.`,` `,(0,H.jsx)(`button`,{type:`button`,className:`padmin-link`,onClick:y,disabled:h,children:h?`Reading…`:`Check usage`})]})]})]}):(0,H.jsx)(qYe,{rows:4})]})}function G9({label:e,value:t,hint:n}){return(0,H.jsxs)(`div`,{className:`padmin-total`+(n?` has-hint`:``),title:n||void 0,children:[(0,H.jsx)(`span`,{className:`padmin-total-label`,children:e}),(0,H.jsx)(`span`,{className:`padmin-total-value`,children:t})]})}function K9({n:e,onOpen:t,why:n,title:r}){return e==null?(0,H.jsx)(`td`,{className:`padmin-num`,children:(0,H.jsx)(GYe,{n:e,why:n})}):(0,H.jsx)(`td`,{className:`padmin-num`,children:(0,H.jsx)(`button`,{type:`button`,className:`padmin-drill-btn`,onClick:t,title:r,children:U9(e)})})}function YYe({kind:e,rows:t}){return e===`users`?(0,H.jsx)(`div`,{className:`padmin-tablewrap`,children:(0,H.jsxs)(`table`,{className:`padmin-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Person`}),(0,H.jsx)(`th`,{children:`Workspace`}),(0,H.jsx)(`th`,{children:`Role`}),(0,H.jsx)(`th`,{children:`Last sign-in`}),(0,H.jsx)(`th`,{children:`Last active`})]})}),(0,H.jsx)(`tbody`,{children:t.map(e=>(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`span`,{className:`padmin-name`,children:e.name}),(0,H.jsxs)(`span`,{className:`padmin-meta`,children:[e.username,e.email?` · ${e.email}`:``,e.active?``:` · deactivated`]})]}),(0,H.jsx)(`td`,{children:e.tenant}),(0,H.jsxs)(`td`,{children:[e.role,e.platformAdmin?` · platform`:``]}),(0,H.jsx)(`td`,{children:W9(e.lastLogin)}),(0,H.jsx)(`td`,{children:W9(e.lastActive)})]},`${e.tenant}/${e.username}`))})]})}):e===`databases`?(0,H.jsx)(`div`,{className:`padmin-tablewrap`,children:(0,H.jsxs)(`table`,{className:`padmin-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Database`}),(0,H.jsx)(`th`,{children:`Workspace`}),(0,H.jsx)(`th`,{children:`Built from`}),(0,H.jsx)(`th`,{className:`padmin-num`,children:`Fields`}),(0,H.jsx)(`th`,{className:`padmin-num`,children:`Records`})]})}),(0,H.jsx)(`tbody`,{children:t.map(e=>(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`span`,{className:`padmin-name`,children:e.label}),(0,H.jsxs)(`span`,{className:`padmin-meta`,children:[e.key,e.createdBy?` · ${e.createdBy}`:``]})]}),(0,H.jsx)(`td`,{children:e.tenant}),(0,H.jsx)(`td`,{children:e.source}),(0,H.jsx)(`td`,{className:`padmin-num`,children:U9(e.fields)}),(0,H.jsx)(`td`,{className:`padmin-num`,children:U9(e.rowCount)})]},`${e.tenant}/${e.key}`))})]})}):e===`connectors`?(0,H.jsx)(`div`,{className:`padmin-tablewrap`,children:(0,H.jsxs)(`table`,{className:`padmin-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Source`}),(0,H.jsx)(`th`,{children:`Workspace`}),(0,H.jsx)(`th`,{children:`Kind`}),(0,H.jsx)(`th`,{children:`Status`})]})}),(0,H.jsx)(`tbody`,{children:t.map(e=>(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`span`,{className:`padmin-name`,children:e.label}),(0,H.jsx)(`span`,{className:`padmin-meta`,children:e.source===`env`?`environment credentials`:`keychain`})]}),(0,H.jsx)(`td`,{children:e.tenant}),(0,H.jsx)(`td`,{children:e.type}),(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`span`,{className:`padmin-dot `+(e.paused?`is-paused`:e.active?`is-live`:`is-idle`)}),e.paused?`paused`:e.active?`serving`:`stored`]})]},`${e.tenant}/${e.key}`))})]})}):(0,H.jsx)(`div`,{className:`padmin-tablewrap`,children:(0,H.jsxs)(`table`,{className:`padmin-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Automation`}),(0,H.jsx)(`th`,{children:`Workspace`}),(0,H.jsx)(`th`,{children:`Schedule`}),(0,H.jsx)(`th`,{className:`padmin-num`,children:`Runs a day`}),(0,H.jsx)(`th`,{children:`Last run`})]})}),(0,H.jsx)(`tbody`,{children:t.map(e=>(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`span`,{className:`padmin-name`,children:e.name}),(0,H.jsxs)(`span`,{className:`padmin-meta`,children:[e.kind,e.failedRetained?` · ${e.failedRetained} of the last ${e.runsRetained} runs failed`:``]})]}),(0,H.jsx)(`td`,{children:e.tenant}),(0,H.jsx)(`td`,{children:e.enabled?e.cron||`scheduled`:`paused`}),(0,H.jsx)(`td`,{className:`padmin-num`,children:e.enabled?e.runsPerDay===null?`custom`:e.runsPerDay:`—`}),(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`span`,{className:`padmin-dot `+(e.state===`error`?`is-error`:e.state===`ok`?`is-live`:`is-idle`)}),e.lastRunAt?e.lastRunAt.replace(`T`,` `):`never`]})]},`${e.tenant}/${e.id}`))})]})})}function XYe(e){return e===`all`||!Array.isArray(e)||e.length===0?`All modules`:`${e.length} module${e.length===1?``:`s`}: ${e.join(`, `)}`}function ZYe(){return(0,H.jsx)(`svg`,{className:`set-acct-chev`,viewBox:`0 0 12 12`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M4.4 2.4 8 6l-3.6 3.6`})})}function q9({children:e}){return(0,H.jsx)(`svg`,{className:`set-rail-icon`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:e})}var QYe=(0,H.jsxs)(q9,{children:[(0,H.jsx)(`circle`,{cx:`8`,cy:`5.6`,r:`2.7`}),(0,H.jsx)(`path`,{d:`M2.9 13.4c0-2.5 2.3-4.1 5.1-4.1s5.1 1.6 5.1 4.1`})]}),$Ye=(0,H.jsxs)(q9,{children:[(0,H.jsx)(`rect`,{x:`3.3`,y:`7.1`,width:`9.4`,height:`6.3`,rx:`1.3`}),(0,H.jsx)(`path`,{d:`M5.6 7.1V5.3a2.4 2.4 0 0 1 4.8 0v1.8`})]}),eXe=(0,H.jsxs)(q9,{children:[(0,H.jsx)(`circle`,{cx:`6.2`,cy:`5.9`,r:`2.3`}),(0,H.jsx)(`path`,{d:`M1.9 13.2c0-2.2 1.9-3.5 4.3-3.5s4.3 1.3 4.3 3.5`}),(0,H.jsx)(`path`,{d:`M10.7 4.1a2.3 2.3 0 0 1 0 4.3M11.6 9.9c1.5.4 2.5 1.5 2.5 3.3`})]}),tXe=(0,H.jsxs)(q9,{children:[(0,H.jsx)(`circle`,{cx:`5.4`,cy:`10.6`,r:`2.6`}),(0,H.jsx)(`path`,{d:`M7.3 8.8 13.1 3M11 5.1l1.5 1.5M9.4 6.7l1.4 1.4`})]}),nXe=(0,H.jsxs)(q9,{children:[(0,H.jsx)(`path`,{d:`M6.6 9.4 4.5 11.5a2.6 2.6 0 0 1-3.7-3.7l2.1-2.1`}),(0,H.jsx)(`path`,{d:`M9.4 6.6l2.1-2.1a2.6 2.6 0 0 1 3.7 3.7l-2.1 2.1`}),(0,H.jsx)(`path`,{d:`M6.2 9.8l3.6-3.6`})]}),rXe=(0,H.jsxs)(q9,{children:[(0,H.jsx)(`path`,{d:`M8 1.9 14.3 5 8 8.1 1.7 5z`}),(0,H.jsx)(`path`,{d:`M2.4 8.1 8 10.9l5.6-2.8M2.4 11.2 8 14l5.6-2.8`})]});function iXe(){let[e,t]=(0,z.useState)(null),[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(null),c=(0,z.useCallback)(()=>{rYe().then(e=>{e.ok?(t(e.data.users??[]),r(``)):(t([]),r(e.message))})},[]);if((0,z.useEffect)(c,[c]),e===null)return(0,H.jsx)(`div`,{className:`set-loading`,children:(0,H.jsx)(`span`,{className:`lp-spin lp-spin--lg`,role:`status`,"aria-label":`Loading`})});if(o){let t=e.find(e=>e.username===o);return t?(0,H.jsx)(IYe,{user:t,userOptions:e.map(e=>e.name||e.username),copyTargets:e.filter(e=>e.username!==t.username),onBack:()=>s(null),onSaved:e=>{a(e),r(``),c()}},t.username):(0,H.jsx)(`div`,{className:`set-pane`,children:(0,H.jsxs)(`section`,{className:`set-card`,children:[(0,H.jsx)(`h4`,{className:`set-h4`,children:`That account is no longer listed`}),(0,H.jsx)(`p`,{className:`set-help`,children:`It may have been removed since this list was loaded.`}),(0,H.jsx)(`div`,{className:`set-actions`,children:(0,H.jsx)(`button`,{type:`button`,className:`set-secondary`,onClick:()=>s(null),children:`Back to accounts`})})]})})}return(0,H.jsxs)(`div`,{className:`set-pane`,children:[(0,H.jsx)(`h3`,{className:`set-h`,children:`Manage users`}),n?(0,H.jsx)(`p`,{className:`set-error`,children:n}):null,i?(0,H.jsx)(`p`,{className:`set-notice`,children:i}):null,e.length===0&&!n?(0,H.jsx)(`p`,{className:`pg-empty`,children:`No accounts are configured on this deployment yet.`}):(0,H.jsx)(`ul`,{className:`set-acctlist`,children:e.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,className:`set-acct`+(e.active?``:` is-inactive`),onClick:()=>s(e.username),children:[(0,H.jsx)(lXe,{name:e.name||e.username}),(0,H.jsxs)(`span`,{className:`set-acct-body`,children:[(0,H.jsxs)(`span`,{className:`set-acct-top`,children:[(0,H.jsx)(`span`,{className:`set-acct-name`,children:e.name||e.username}),(0,H.jsx)(uXe,{admin:e.role===`admin`}),e.active?null:(0,H.jsx)(`span`,{className:`set-chip set-chip--off`,children:`Deactivated`})]}),(0,H.jsx)(`span`,{className:`set-acct-sub`,children:e.username}),(0,H.jsx)(`span`,{className:`set-acct-access`,children:e.role===`admin`?`Everything (admin)`:e.accessSummary??XYe(e.modules)})]}),(0,H.jsxs)(`span`,{className:`set-acct-go`,children:[`Edit`,(0,H.jsx)(ZYe,{})]})]})},e.username))}),(0,H.jsx)(aXe,{onCreated:e=>{a(e),r(``),c()},onError:r})]})}function aXe({onCreated:e,onError:t}){let[n,r]=(0,z.useState)(!1),[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(`user`),[u,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(!1);if(!n)return(0,H.jsx)(`button`,{type:`button`,className:`set-primary set-add`,onClick:()=>r(!0),children:`Add an account`});let m=i.trim().length>0&&u.length>0;return(0,H.jsxs)(`section`,{className:`set-card`,children:[(0,H.jsx)(`h4`,{className:`set-h4`,children:`New account`}),(0,H.jsxs)(`div`,{className:`set-field`,children:[(0,H.jsx)(`label`,{className:`set-label`,htmlFor:`set-new-user`,children:`Username`}),(0,H.jsx)(`input`,{id:`set-new-user`,className:`set-input`,value:i,autoComplete:`off`,onChange:e=>a(e.target.value)}),(0,H.jsx)(`p`,{className:`set-help`,children:`Must be new. To change an existing account, edit it above — re-creating one would revive sessions that were revoked.`})]}),(0,H.jsxs)(`div`,{className:`set-field`,children:[(0,H.jsx)(`label`,{className:`set-label`,htmlFor:`set-new-name`,children:`Display name`}),(0,H.jsx)(`input`,{id:`set-new-name`,className:`set-input`,value:o,onChange:e=>s(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`set-field`,children:[(0,H.jsx)(`label`,{className:`set-label`,htmlFor:`set-new-role`,children:`Role`}),(0,H.jsxs)(`select`,{id:`set-new-role`,className:`pg-select`,value:c,onChange:e=>l(e.target.value),children:[(0,H.jsx)(`option`,{value:`user`,children:`Member`}),(0,H.jsx)(`option`,{value:`admin`,children:`Admin`})]})]}),(0,H.jsxs)(`div`,{className:`set-field`,children:[(0,H.jsx)(`label`,{className:`set-label`,htmlFor:`set-new-pw`,children:`Password`}),(0,H.jsx)(`input`,{id:`set-new-pw`,className:`set-input`,type:`password`,value:u,autoComplete:`new-password`,onChange:e=>d(e.target.value)}),(0,H.jsx)(`p`,{className:`set-help`,children:`A new account starts with access to everything this deployment shows. Open it from the list afterwards to set what they may see.`})]}),(0,H.jsxs)(`div`,{className:`set-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`set-primary`,disabled:f||!m,onClick:()=>{p(!0),iYe({username:i.trim().toLowerCase(),name:o||i.trim(),role:c,modules:`all`,password:u}).then(n=>{p(!1),n.ok?(e(`Created ${i.trim().toLowerCase()}.`),r(!1),a(``),s(``),d(``)):t(n.message)})},children:`Create account`}),(0,H.jsx)(`button`,{type:`button`,className:`set-secondary`,onClick:()=>r(!1),children:`Cancel`})]})]})}async function oXe(e){let t=URL.createObjectURL(e);try{let e=new Image;if(await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(`unreadable image`)),e.src=t}),!e.width||!e.height)return null;let n=Math.min(128,Math.max(e.width,e.height)),r=document.createElement(`canvas`);r.width=n,r.height=n;let i=r.getContext(`2d`);if(!i)return null;let a=Math.min(e.width,e.height);return i.drawImage(e,(e.width-a)/2,(e.height-a)/2,a,a,0,0,n,n),r.toDataURL(`image/jpeg`,.85)}catch{return null}finally{URL.revokeObjectURL(t)}}function sXe(e){return(e.match(/[\p{L}\p{N}]/u)?.[0]??`?`).toUpperCase()}function cXe({user:e,large:t}){let n=t?`set-avatar set-avatar--lg`:`set-avatar`;return e.avatar?(0,H.jsx)(`img`,{className:n,src:e.avatar,alt:``,"aria-hidden":`true`}):(0,H.jsx)(`span`,{className:n,"aria-hidden":`true`,children:sXe(e.name)})}function lXe({name:e}){return(0,H.jsx)(`span`,{className:`set-avatar`,"aria-hidden":`true`,children:sXe(e)})}function uXe({admin:e}){return(0,H.jsx)(`span`,{className:e?`set-chip set-chip--admin`:`set-chip`,children:e?`Admin`:`Member`})}function dXe({user:e,admin:t,onUser:n}){let[r,i]=(0,z.useState)(!1),[a,o]=(0,z.useState)(``),s=(0,z.useRef)(null),c=(0,z.useCallback)(async e=>{i(!0),o(``);let t=await oXe(e);if(!t){i(!1),o(`That file could not be read as an image.`);return}let r=await lYe(t);if(i(!1),r.ok){let e=k9(r.data);e&&n?.(e)}else o(r.message)},[n]),l=(0,z.useCallback)(async()=>{i(!0),o(``);let e=await uYe();if(i(!1),e.ok){let t=k9(e.data);t&&n?.(t)}else o(e.message)},[n]);return(0,H.jsxs)(`div`,{className:`set-identity`,children:[(0,H.jsx)(cXe,{user:e,large:!0}),(0,H.jsxs)(`div`,{className:`set-identity-body`,children:[(0,H.jsxs)(`div`,{className:`set-identity-head`,children:[(0,H.jsx)(`span`,{className:`set-identity-name`,children:e.name}),(0,H.jsx)(uXe,{admin:t})]}),(0,H.jsx)(`div`,{className:`set-identity-sub`,children:e.username}),(0,H.jsxs)(`div`,{className:`set-identity-acts`,children:[(0,H.jsx)(`input`,{ref:s,type:`file`,accept:`image/png,image/jpeg`,className:`set-filepick`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&c(t)}}),(0,H.jsx)(`button`,{type:`button`,className:`set-secondary`,disabled:r,onClick:()=>s.current?.click(),children:e.avatar?`Change photo`:`Upload photo`}),e.avatar?(0,H.jsx)(`button`,{type:`button`,className:`set-secondary`,disabled:r,onClick:l,children:`Remove`}):null]}),a?(0,H.jsx)(`p`,{className:`set-error set-identity-err`,children:a}):null]})]})}function fXe({user:e,section:t,onSection:n,onClose:r,onUser:i,moduleLabels:a}){let[o,s]=(0,z.useState)(null),c=qJe(e),l=o?.platformAdmin===!0;(0,z.useEffect)(()=>{nYe().then(e=>{e.ok&&s(e.data)})},[]),(0,z.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let u=[[`account`,`Account`,QYe],[`scope`,`Your access`,$Ye],...c?[[`users`,`Manage users`,eXe],[`keychains`,`Keychains`,tXe],[`connectors`,`Connectors`,nXe]]:[],...l?[[`padmin`,`Loopable admin`,rXe]]:[]],d=t===`padmin`&&!l?`account`:_Ye(t,c);return(0,H.jsx)(`div`,{className:`set-backdrop`,onMouseDown:e=>{e.target===e.currentTarget&&r()},children:(0,H.jsxs)(`div`,{className:`set-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":`Settings`,children:[(0,H.jsxs)(`nav`,{className:`set-rail`,children:[(0,H.jsx)(`span`,{className:`set-rail-cap`,children:`Settings`}),u.map(([e,t,r])=>(0,H.jsxs)(`button`,{type:`button`,className:`set-rail-item`+(d===e?` is-active`:``),onClick:()=>n(e),children:[r,t]},e))]}),(0,H.jsxs)(`div`,{className:`set-body`,children:[(0,H.jsx)(`button`,{type:`button`,className:`set-close`,onClick:r,"aria-label":`Close settings`,children:`×`}),d===`keychains`?(0,H.jsx)(pXe,{}):null,d===`connectors`?(0,H.jsx)(mXe,{}):null,d===`padmin`?(0,H.jsx)(JYe,{user:e}):null,d===`account`?(0,H.jsxs)(`div`,{className:`set-pane`,children:[(0,H.jsx)(`h3`,{className:`set-h`,children:`Account`}),(0,H.jsx)(dXe,{user:e,admin:c,onUser:i})]}):null,d===`scope`?(0,H.jsxs)(`div`,{className:`set-pane`,children:[(0,H.jsx)(`h3`,{className:`set-h`,children:`Your access`}),(0,H.jsx)(`p`,{className:`set-help set-pane-intro`,children:`What this account may open, and anything that narrows it. Only an administrator can change this.`}),(0,H.jsxs)(`section`,{className:`set-card set-card--rows`,children:[(0,H.jsxs)(`div`,{className:`pg-drill-row`,children:[(0,H.jsx)(`span`,{className:`pg-drill-key`,children:`Modules`}),(0,H.jsx)(`span`,{className:`pg-drill-val`,children:XYe(o?.scope.modules??e.modules)})]}),c?(0,H.jsxs)(`div`,{className:`pg-drill-row`,children:[(0,H.jsx)(`span`,{className:`pg-drill-key`,children:`Restrictions`}),(0,H.jsx)(`span`,{className:`pg-drill-val`,children:`None apply — administrators bypass every rule`})]}):null,c?null:Object.entries(o?.scope.perms??{}).map(([e,t])=>{let n=L9(wYe(t));return n===`Full access`?null:(0,H.jsxs)(`div`,{className:`pg-drill-row`,children:[(0,H.jsx)(`span`,{className:`pg-drill-key`,children:a?.[e]??e}),(0,H.jsx)(`span`,{className:`pg-drill-val`,children:n})]},e)})]})]}):null,d===`users`?(0,H.jsx)(iXe,{}):null]})]})})}function pXe(){let[e,t]=(0,z.useState)([]),[n,r]=(0,z.useState)(!1),[i,a]=(0,z.useState)(!1),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(null),[u,d]=(0,z.useState)({}),f=(0,z.useCallback)(async()=>{let e=await dYe();e.ok?(t(e.data.entries),r(e.data.locked),s(``)):s(e.message),a(!0)},[]);(0,z.useEffect)(()=>{f()},[f]);let p=async()=>{if(!c||c.busy)return;l({...c,busy:!0});let e=Object.fromEntries(Object.entries(c.fields).filter(([,e])=>e.trim()!==``)),t=await fYe(c.label,c.type,e);t.ok?(l(null),f()):(s(t.message),l({...c,busy:!1}))};return(0,H.jsxs)(`div`,{className:`set-pane`,children:[(0,H.jsx)(`h3`,{className:`set-h`,children:`Keychains`}),(0,H.jsx)(`p`,{className:`set-help set-pane-intro`,children:`Credentials for this workspace's data sources, encrypted at rest. A stored secret is never shown again — only its last four characters identify it.`}),n?(0,H.jsx)(`p`,{className:`set-error`,children:`The keychain is locked: the platform's AIOS_KEYCHAIN_KEY is not configured on this server. Entries can be listed but nothing can be added or decrypted.`}):null,o?(0,H.jsx)(`p`,{className:`set-error`,children:o}):null,i?e.length===0?(0,H.jsx)(`p`,{className:`set-help`,children:`No keys stored yet.`}):(0,H.jsx)(`div`,{className:`set-card`,children:e.map(e=>(0,H.jsxs)(`div`,{className:`set-kv-row kc-row`,children:[(0,H.jsxs)(`div`,{className:`kc-main`,children:[(0,H.jsx)(`strong`,{children:e.label}),(0,H.jsxs)(`span`,{className:`kc-meta`,children:[e.type,e.preview?` · `+e.preview:``,` · added by `,e.createdBy||`?`]}),u[e.id]?(0,H.jsx)(`span`,{className:`kc-test`,children:u[e.id]}):null]}),(0,H.jsxs)(`div`,{className:`kc-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`set-btn`,onClick:async()=>{d(t=>({...t,[e.id]:`Testing…`}));let t=await mYe(e.id);d(n=>({...n,[e.id]:t.ok?(t.data.ok?`OK — `:`Failed — `)+t.data.message:t.message}))},children:`Test`}),(0,H.jsx)(`button`,{type:`button`,className:`set-btn kc-danger`,onClick:async()=>{if(!window.confirm(`Delete the key "`+e.label+`"? This cannot be undone.`))return;let t=await pYe(e.id);t.ok?f():s(t.message)},children:`Delete`})]})]},e.id))}):(0,H.jsx)(`p`,{className:`set-help`,children:`Loading…`}),c?(0,H.jsxs)(`div`,{className:`set-card kc-form`,children:[(0,H.jsxs)(`div`,{className:`set-field`,children:[(0,H.jsx)(`label`,{children:`Type`}),(0,H.jsxs)(`select`,{value:c.type,onChange:e=>l({...c,type:e.target.value,fields:{}}),children:[(0,H.jsx)(`option`,{value:`odoo`,children:`Odoo`}),(0,H.jsx)(`option`,{value:`generic`,children:`Generic secret`})]})]}),(0,H.jsxs)(`div`,{className:`set-field`,children:[(0,H.jsx)(`label`,{children:`Label`}),(0,H.jsx)(`input`,{value:c.label,maxLength:80,placeholder:c.type===`odoo`?`Production Odoo`:`e.g. Shipping API`,onChange:e=>l({...c,label:e.target.value})})]}),(c.type===`odoo`?[[`url`,`Server URL (https://...)`],[`db`,`Database`],[`user`,`API user`],[`api_key`,`API key`]]:[[`name`,`Name`],[`value`,`Secret value`]]).map(([e,t])=>(0,H.jsxs)(`div`,{className:`set-field`,children:[(0,H.jsx)(`label`,{children:t}),(0,H.jsx)(`input`,{value:c.fields[e]??``,type:e===`api_key`||e===`value`?`password`:`text`,onChange:t=>l({...c,fields:{...c.fields,[e]:t.target.value}})})]},e)),(0,H.jsxs)(`div`,{className:`set-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`set-btn`,onClick:()=>l(null),children:`Cancel`}),(0,H.jsx)(`button`,{type:`button`,className:`set-btn set-btn-primary`,disabled:c.busy||!c.label.trim()||n,onClick:()=>void p(),children:c.busy?`Saving…`:`Save key`})]})]}):(0,H.jsx)(`button`,{type:`button`,className:`set-btn set-btn-primary`,disabled:n,onClick:()=>l({type:`odoo`,label:``,fields:{},busy:!1}),children:`Add a key`})]})}function mXe(){let[e,t]=(0,z.useState)([]),[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(null),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(!1),[u,d]=(0,z.useState)(``),f=(0,z.useCallback)(async()=>{let e=await hYe();e.ok?(t(e.data.connectors),r(e.data.pausedNote||``),a(e.data.unsynced??null),d(``)):d(e.message),l(!0)},[]);return(0,z.useEffect)(()=>{f()},[f]),(0,H.jsxs)(`div`,{className:`set-pane`,children:[(0,H.jsx)(`h3`,{className:`set-h`,children:`Connectors`}),(0,H.jsx)(`p`,{className:`set-help set-pane-intro`,children:`Where this workspace's data comes from. Add credentials under Keychains; sources appear here with their status.`}),u?(0,H.jsx)(`p`,{className:`set-error`,children:u}):null,c?e.length===0?(0,H.jsx)(`p`,{className:`set-help`,children:`No connectors yet. Store a key under Keychains to register a source — nothing syncs until a later step turns it on.`}):(0,H.jsx)(`div`,{className:`set-card`,children:e.map(e=>(0,H.jsxs)(`div`,{className:`set-kv-row kc-row`,children:[(0,H.jsxs)(`div`,{className:`kc-main`,children:[(0,H.jsx)(`strong`,{children:e.label}),(0,H.jsxs)(`span`,{className:`kc-meta`,children:[e.type,` · `,e.source===`env`?`environment credentials`:`keychain`,e.paused?` · paused`:` · active`]})]}),(0,H.jsx)(`div`,{className:`kc-actions`,children:(0,H.jsx)(`button`,{type:`button`,className:`set-btn`,onClick:async()=>{let t=await gYe(e.key,!e.paused);t.ok?f():d(t.message)},children:e.paused?`Resume`:`Pause`})})]},e.key))}):(0,H.jsx)(`p`,{className:`set-help`,children:`Loading…`}),n?(0,H.jsx)(`p`,{className:`set-help kc-note`,children:n}):null,i?(0,H.jsxs)(`div`,{className:`set-card kc-unsynced`,children:[(0,H.jsx)(`strong`,{children:`Unsynced records`}),i.known?i.count===0?(0,H.jsx)(`p`,{className:`set-help`,children:`None — every record holding notes or custom-field data matches a row the connector currently serves.`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`p`,{className:`set-help`,children:[i.count,` record`,i.count===1?``:`s`,` carry saved data (notes, custom fields) but no longer match a synced row. Nothing is deleted — they reattach by ID if the source serves them again.`]}),(0,H.jsx)(`button`,{type:`button`,className:`set-btn`,onClick:()=>s(e=>!e),children:o?`Hide`:`Show `+String(i.shown??i.rows.length)}),o?(0,H.jsx)(`ul`,{className:`kc-orphans`,children:i.rows.map(e=>(0,H.jsxs)(`li`,{children:[`#`,e.pid,` — `,e.fields,` saved field`,e.fields===1?``:`s`,e.hint?` · `+e.hint:``]},String(e.pid)))}):null]}):(0,H.jsxs)(`p`,{className:`set-help`,children:[`Count unavailable right now`,i.note?` (`+i.note+`)`:``,` — the pool could not be consulted; nothing was assumed.`]})]}):null]})}var hXe=`./favicon.svg`;function gXe({size:e}){return(0,H.jsx)(`img`,{className:`lp-mark`,src:hXe,width:e,height:e,alt:``,"aria-hidden":`true`,draggable:!1})}function J9({size:e,className:t}){return(0,H.jsxs)(`div`,{className:t,children:[(0,H.jsx)(gXe,{size:e}),(0,H.jsx)(`span`,{className:`lp-wordmark`,children:`Loopable`})]})}function _Xe({off:e}){return(0,H.jsxs)(`svg`,{viewBox:`0 0 20 20`,"aria-hidden":`true`,children:[(0,H.jsx)(`path`,{d:`M2.2 10s2.8-4.6 7.8-4.6S17.8 10 17.8 10 15 14.6 10 14.6 2.2 10 2.2 10z`}),(0,H.jsx)(`circle`,{cx:`10`,cy:`10`,r:`2.3`}),e?(0,H.jsx)(`path`,{d:`M4 16 16 4`}):null]})}function vXe({onSignedIn:e}){let[t,n]=(0,z.useState)(``),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(!1);async function d(n){if(n.preventDefault(),s)return;c(!0),o(``);let a=await $Je(t,r);if(a.ok){e(a.user);return}c(!1),o(a.message),i(``)}function f(e){return t=>{a&&o(``),e(t.target.value)}}return(0,H.jsx)(`div`,{className:`login-root`,children:(0,H.jsxs)(`div`,{className:`login-card`,children:[(0,H.jsx)(J9,{size:44,className:`login-brand`}),(0,H.jsxs)(`form`,{className:`login-form`,onSubmit:d,noValidate:!0,children:[(0,H.jsx)(`label`,{className:`lp-sr-only`,htmlFor:`login-username`,children:`Username`}),(0,H.jsx)(`input`,{id:`login-username`,className:`login-input`,name:`username`,type:`text`,autoComplete:`username`,placeholder:`Username`,value:t,onChange:f(n),disabled:s,"aria-invalid":a?!0:void 0}),(0,H.jsx)(`label`,{className:`lp-sr-only`,htmlFor:`login-password`,children:`Password`}),(0,H.jsxs)(`div`,{className:`login-field`,children:[(0,H.jsx)(`input`,{id:`login-password`,className:`login-input`,name:`password`,type:l?`text`:`password`,autoComplete:`current-password`,placeholder:`Password`,value:r,onChange:f(i),disabled:s,"aria-invalid":a?!0:void 0}),(0,H.jsx)(`button`,{type:`button`,className:`login-eye`,"aria-label":l?`Hide password`:`Show password`,onClick:()=>u(e=>!e),disabled:s,tabIndex:-1,children:(0,H.jsx)(_Xe,{off:l})})]}),(0,H.jsx)(`button`,{className:`login-submit`,type:`submit`,disabled:s,children:s?`Signing in…`:`Log in`})]}),(0,H.jsx)(`p`,{className:`login-msg`,role:`status`,"aria-live":`polite`,children:a})]})})}function yXe(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e;if(Ed.includes(String(t.shape))&&Dd.includes(String(t.tone)))return{shape:t.shape,tone:t.tone}}function bXe(e){let t=e?.pages;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=e,r=typeof t.key==`string`?t.key.trim():``,i=typeof t.label==`string`?t.label.trim():``;!r||!i||n.push({key:r,label:i,...typeof t.source==`string`&&t.source?{source:t.source}:{},...typeof t.parent==`string`&&t.parent?{parent:t.parent}:{},...t.group_only===!0?{group_only:!0}:{},...t.chrome===`main`||t.chrome===`utility`?{chrome:t.chrome}:{},...yXe(t.icon)?{icon:yXe(t.icon)}:{},...t.manage===!0?{manage:!0}:{}})}return n}function xXe(e){let t=[],n=[];for(let r of e)(r.chrome===`utility`?n:t).push(r);return{main:t,utility:n}}async function SXe(){try{let e=await fetch(`${jd}/nav`,{credentials:Md});if(!e.ok)return{ok:!1,status:e.status};let t=await e.json(),n=typeof t?.empty==`string`?t.empty:void 0;return{ok:!0,pages:bXe(t),...n?{empty:n}:{}}}catch{return{ok:!1,status:0}}}var Y9={folders:[],placement:{}};function CXe(e){let t=e?.prefs??e;if(!t||typeof t!=`object`)return Y9;let n=t,r=[],i=new Set;if(Array.isArray(n.folders))for(let e of n.folders.slice(0,16)){if(!e||typeof e!=`object`)continue;let t=String(e.id??``).trim().slice(0,40),n=String(e.name??``).trim().replace(/\s+/g,` `).slice(0,40);!t||i.has(t)||!n||(i.add(t),r.push({id:t,name:n}))}let a={};if(n.placement&&typeof n.placement==`object`)for(let[e,t]of Object.entries(n.placement)){let n=String(t??``).slice(0,40);e&&i.has(n)&&(a[e.slice(0,60)]=n)}return{folders:r,placement:a}}async function wXe(){try{let e=await fetch(`${jd}/nav/prefs`,{credentials:Md});return e.ok?CXe(await e.json()):Y9}catch{return Y9}}async function TXe(e){try{return(await fetch(`${jd}/nav/prefs`,{method:`POST`,credentials:Md,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})).ok}catch{return!1}}async function EXe(e,t){try{return(await fetch(`${jd}/nav/meta`,{method:`POST`,credentials:Md,headers:{"Content-Type":`application/json`},body:JSON.stringify({key:e,...t})})).ok}catch{return!1}}function DXe(e,t,n){let r=[];for(let t of e)t.depth>0&&r.length>0?r[r.length-1].children.push(t):r.push({head:t,children:[]});let i=new Map,a=[],o=new Set(t.folders.map(e=>e.id));for(let e of r){let n=t.placement[e.head.key];if(n&&o.has(n)){let t=i.get(n);t?t.push(e):i.set(n,[e])}else a.push(e)}let s=[],c=(e,t)=>{s.push({kind:`entry`,entry:e.head,...t?{folderId:t}:{}});for(let n of e.children)s.push({kind:`entry`,entry:n,...t?{folderId:t}:{}})};for(let e of t.folders){let t=i.get(e.id)??[],r=!n.has(e.id);if(s.push({kind:`folder`,folder:e,count:t.length,open:r}),r)for(let n of t)c(n,e.id)}for(let e of a)c(e);return s}function OXe(e){if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.key!=`string`||typeof t.label!=`string`)return null;let n=[];if(Array.isArray(t.fields))for(let e of t.fields){if(!e||typeof e!=`object`)continue;let t=e;typeof t.key!=`string`||typeof t.label!=`string`||n.push({key:t.key,label:t.label,type:String(t.type??``),source:String(t.source??``),description:String(t.description??``),...Array.isArray(t.options)?{options:t.options.map(String)}:{}})}let r=[];if(Array.isArray(t.measures))for(let e of t.measures){if(!e||typeof e!=`object`)continue;let t=e;typeof t.key!=`string`||!t.key||r.push({key:t.key,label:String(t.label??t.key),type:String(t.type??``)})}return{key:t.key,label:t.label,source:String(t.source??``),fields:n,measures:r,...typeof t.note==`string`&&t.note?{note:t.note}:{}}}async function kXe(e){try{let t=await fetch(`${jd}/nav/schema/${encodeURIComponent(e)}`,{credentials:Md});return t.ok?OXe(await t.json()):null}catch{return null}}var AXe=new Set([`customer_data`,`product_data`,`automation`]),jXe=new Set([]);function MXe(e,t){return`${e}/?page=${encodeURIComponent(t)}`}function NXe(e,t){let n=new Set(e.map(e=>e.key)),r=new Map;for(let t of e){if(!t.parent||!n.has(t.parent))continue;let e=r.get(t.parent);e?e.push(t):r.set(t.parent,[t])}let i=(e,n)=>{let i=AXe.has(e.key)||e.key.startsWith(`ut_`),a=i?`native`:e.group_only||r.has(e.key)?`group`:`handoff`;return{key:e.key,label:e.label,...e.source?{source:e.source}:{},...e.icon?{icon:e.icon}:{},...e.manage?{manage:!0}:{},kind:a,depth:n,...a===`group`?{}:{href:i?`#/${e.key}`:MXe(t,e.key)}}},a=[];for(let t of e){if(t.parent&&n.has(t.parent))continue;let e=i(t,0),o=r.get(t.key)??[];if(!(e.kind===`group`&&o.length===0)){a.push(e);for(let e of o)a.push(i(e,1))}}return a}var PXe=[`customer_data`];function FXe(e){for(let t of PXe){let n=e.find(e=>e.key===t&&e.kind===`native`);if(n)return n.key}return e.find(e=>e.kind===`native`)?.key??e.find(e=>e.kind!==`group`)?.key??``}function IXe(e,t){let n=e.findIndex(e=>e.key===t);if(n>=0){let t=e[n];if(t.kind!==`group`)return t;for(let r of e.slice(n+1)){if(r.depth<=t.depth)break;if(r.kind!==`group`)return r}}let r=FXe(e);return e.find(e=>e.key===r)}function LXe(){return(0,H.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`shell-dots-icon`,children:[(0,H.jsx)(`circle`,{cx:`8`,cy:`3.2`,r:`1.35`}),(0,H.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.35`}),(0,H.jsx)(`circle`,{cx:`8`,cy:`12.8`,r:`1.35`})]})}function RXe(){return(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`shell-nav-icon`,children:(0,H.jsx)(`path`,{d:`M2.2 4.4c0-.66.54-1.2 1.2-1.2h3l1.4 1.6h4.8c.66 0 1.2.54 1.2 1.2v6c0 .66-.54 1.2-1.2 1.2H3.4c-.66 0-1.2-.54-1.2-1.2z`})})}function X9(){let[e,t]=(0,z.useState)(null),n=(0,z.useRef)(null);return(0,z.useEffect)(()=>{if(!e)return;let r=e=>{n.current&&!n.current.contains(e.target)&&t(null)},i=e=>{e.key===`Escape`&&t(null)};return document.addEventListener(`mousedown`,r,!0),document.addEventListener(`keydown`,i,!0),()=>{document.removeEventListener(`mousedown`,r,!0),document.removeEventListener(`keydown`,i,!0)}},[e]),{at:e,ref:n,openFrom:e=>{let n=e.getBoundingClientRect();t({x:Math.round(n.right+4),y:Math.round(n.top)})},close:()=>t(null)}}function Z9({at:e,menuRef:t,children:n}){return(0,H.jsx)(`div`,{className:`shell-navmenu`,style:{left:Math.min(e.x,Math.max(8,window.innerWidth-248)),top:Math.min(e.y,Math.max(8,window.innerHeight-260))},ref:t,role:`menu`,children:n})}function zXe({value:e,onPick:t,onClear:n}){let r=e?.shape??`folder`,i=e?.tone??`neutral`;return(0,H.jsxs)(`div`,{className:`shell-navmenu-pick`,role:`group`,"aria-label":`Database icon`,children:[(0,H.jsx)(`div`,{className:`shell-navmenu-pickrow`,children:Ed.map(n=>(0,H.jsx)(`button`,{type:`button`,className:`shell-navmenu-swatch`+(e&&r===n?` is-on`:``),"aria-pressed":!!e&&r===n,"aria-label":Of[n],title:Of[n],onClick:()=>t({shape:n,tone:i}),children:(0,H.jsx)(im,{icon:{shape:n,tone:i},size:15})},n))}),(0,H.jsx)(`div`,{className:`shell-navmenu-pickrow`,children:Dd.map(n=>(0,H.jsx)(`button`,{type:`button`,className:`shell-navmenu-swatch`+(e&&i===n?` is-on`:``),"aria-pressed":!!e&&i===n,"aria-label":Df[n],title:Df[n],onClick:()=>t({shape:r,tone:n}),children:(0,H.jsx)(im,{icon:{shape:r,tone:n},size:15})},n))}),n?(0,H.jsx)(`button`,{type:`button`,className:`shell-navmenu-item is-quiet`,onClick:n,children:`Use the default icon`}):null]})}function BXe({entryLabel:e,canSchema:t,onSchema:n,canRename:r,onRename:i,canIcon:a,icon:o,onIcon:s,onIconClear:c}){let{at:l,ref:u,openFrom:d,close:f}=X9(),[p,m]=(0,z.useState)(`menu`),[h,g]=(0,z.useState)(e),_=!!r&&!!i,v=!!a&&!!s;if(!t&&!_&&!v)return null;let y=()=>{let t=h.trim().replace(/\s+/g,` `);t&&t!==e&&i?.(t),f()};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,className:`shell-dots`,"aria-label":`Options for ${e}`,"aria-haspopup":`menu`,onClick:t=>{t.preventDefault(),t.stopPropagation(),m(`menu`),g(e),d(t.currentTarget)},children:(0,H.jsx)(LXe,{})}),l&&(0,H.jsx)(Z9,{at:l,menuRef:u,children:p===`rename`&&_?(0,H.jsxs)(`form`,{className:`shell-navmenu-form`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,H.jsx)(`input`,{className:`shell-navmenu-input`,autoFocus:!0,maxLength:60,value:h,"aria-label":`Rename ${e}`,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Escape`&&f()}}),(0,H.jsx)(`button`,{type:`submit`,className:`shell-navmenu-go`,disabled:!h.trim(),children:`Save`})]}):p===`icon`&&v?(0,H.jsx)(zXe,{value:o,onPick:e=>s?.(e),...o&&c?{onClear:()=>{f(),c()}}:{}}):(0,H.jsxs)(H.Fragment,{children:[_?(0,H.jsx)(`button`,{type:`button`,className:`shell-navmenu-item`,onClick:()=>m(`rename`),children:`Rename`}):null,v?(0,H.jsx)(`button`,{type:`button`,className:`shell-navmenu-item`,onClick:()=>m(`icon`),children:`Change icon`}):null,t?(0,H.jsx)(`button`,{type:`button`,className:`shell-navmenu-item`,onClick:()=>{f(),n()},children:`View schema`}):null]})})]})}function VXe(){return(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`shell-newthing-plus`,children:(0,H.jsx)(`path`,{d:`M8 3.4v9.2M3.4 8h9.2`})})}function HXe({collapsed:e,onExpand:t,onCreateFolder:n,onNewDatabase:r,canFolder:i}){let{at:a,ref:o,openFrom:s,close:c}=X9(),[l,u]=(0,z.useState)(!1),[d,f]=(0,z.useState)(``),p=()=>{let e=d.trim().replace(/\s+/g,` `);e&&(n(e),f(``),u(!1))};return e?(0,H.jsx)(`button`,{type:`button`,className:`shell-newfolder is-collapsed`,"aria-label":`Create new`,title:`Create new`,onClick:t,children:(0,H.jsx)(VXe,{})}):l?(0,H.jsxs)(`form`,{className:`shell-navmenu-form shell-newfolder-form`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,H.jsx)(`input`,{className:`shell-navmenu-input`,autoFocus:!0,maxLength:40,placeholder:`Folder name`,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(f(``),u(!1))}}),(0,H.jsx)(`button`,{type:`submit`,className:`shell-navmenu-go`,disabled:!d.trim(),children:`Add`})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,className:`shell-newfolder`,...i?{"aria-haspopup":`menu`}:{},onClick:e=>{if(!i){r();return}s(e.currentTarget)},children:i?`+ Create new…`:`+ New database`}),a&&(0,H.jsxs)(Z9,{at:a,menuRef:o,children:[(0,H.jsx)(`button`,{type:`button`,className:`shell-navmenu-item`,onClick:()=>{c(),u(!0)},children:`New folder`}),(0,H.jsx)(`button`,{type:`button`,className:`shell-navmenu-item`,onClick:()=>{c(),r()},children:`New database`})]})]})}function UXe({folder:e,count:t,open:n,collapsed:r,onToggle:i,onRename:a,onDelete:o,isDrop:s,dropProps:c}){let{at:l,ref:u,openFrom:d,close:f}=X9(),[p,m]=(0,z.useState)(!1),[h,g]=(0,z.useState)(e.name),_=()=>{let t=h.trim().replace(/\s+/g,` `);t&&t!==e.name&&a(t),m(!1),f()};return r?null:(0,H.jsxs)(`div`,{className:`shell-nav-folder`+(s?` is-drop`:``),...c??{},children:[(0,H.jsxs)(`button`,{type:`button`,className:`shell-nav-folderbtn`,"aria-expanded":n,onClick:i,children:[(0,H.jsx)(RXe,{}),(0,H.jsx)(`span`,{className:`shell-nav-label`,children:e.name}),(0,H.jsx)(`span`,{className:`shell-nav-foldercount`,children:t})]}),(0,H.jsx)(`button`,{type:`button`,className:`shell-dots`,"aria-label":`Options for folder ${e.name}`,"aria-haspopup":`menu`,onClick:t=>{t.stopPropagation(),g(e.name),m(!1),d(t.currentTarget)},children:(0,H.jsx)(LXe,{})}),l&&(0,H.jsxs)(Z9,{at:l,menuRef:u,children:[p?(0,H.jsxs)(`form`,{className:`shell-navmenu-form`,onSubmit:e=>{e.preventDefault(),_()},children:[(0,H.jsx)(`input`,{className:`shell-navmenu-input`,autoFocus:!0,maxLength:40,value:h,onChange:e=>g(e.target.value)}),(0,H.jsx)(`button`,{type:`submit`,className:`shell-navmenu-go`,disabled:!h.trim(),children:`Save`})]}):(0,H.jsx)(`button`,{type:`button`,className:`shell-navmenu-item`,onClick:()=>m(!0),children:`Rename folder`}),(0,H.jsx)(`button`,{type:`button`,className:`shell-navmenu-item is-danger`,onClick:()=>{f(),o()},children:`Delete folder`})]})]})}function WXe({schemaKey:e,onClose:t}){let[n,r]=(0,z.useState)({phase:`loading`});return(0,z.useEffect)(()=>{let t=!1;return r({phase:`loading`}),kXe(e).then(e=>{t||r(e?{phase:`ready`,schema:e}:{phase:`error`})}),()=>{t=!0}},[e]),(0,z.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[t]),(0,H.jsx)(`div`,{className:`shell-schema-backdrop`,onMouseDown:t,children:(0,H.jsxs)(`aside`,{className:`shell-schema`,role:`dialog`,"aria-label":`Database schema`,onMouseDown:e=>e.stopPropagation(),children:[n.phase===`loading`&&(0,H.jsx)(`div`,{className:`shell-schema-empty is-spin`,children:(0,H.jsx)(`span`,{className:`lp-spin lp-spin--lg`,role:`status`,"aria-label":`Loading`})}),n.phase===`error`&&(0,H.jsx)(`div`,{className:`shell-schema-empty`,children:`The schema could not be loaded. Close this panel and try again.`}),n.phase===`ready`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`header`,{className:`shell-schema-head`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`shell-schema-title`,children:n.schema.label}),n.schema.source&&(0,H.jsxs)(`div`,{className:`shell-schema-sub`,children:[`Source · `,n.schema.source]})]}),(0,H.jsx)(`button`,{type:`button`,className:`shell-schema-close`,"aria-label":`Close schema`,onClick:t,children:`×`})]}),(0,H.jsxs)(`div`,{className:`shell-schema-body`,children:[n.schema.note&&(0,H.jsx)(`div`,{className:`shell-schema-note`,children:n.schema.note}),n.schema.fields.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`shell-schema-kicker`,children:[`Fields · `,n.schema.fields.length]}),(0,H.jsxs)(`table`,{className:`shell-schema-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Field`}),(0,H.jsx)(`th`,{children:`Type`}),(0,H.jsx)(`th`,{children:`Source`})]})}),(0,H.jsx)(`tbody`,{children:n.schema.fields.map(e=>(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`div`,{className:`shell-schema-fname`,children:e.label}),e.description&&(0,H.jsx)(`div`,{className:`shell-schema-fdesc`,children:e.description}),e.options&&(0,H.jsxs)(`div`,{className:`shell-schema-fdesc`,children:[`Choices: `,e.options.join(` · `)]})]}),(0,H.jsx)(`td`,{className:`shell-schema-type`,children:e.type}),(0,H.jsx)(`td`,{className:`shell-schema-type`,children:e.source})]},e.key))})]})]}),n.schema.measures.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`shell-schema-kicker`,children:[`Semantic measures · `,n.schema.measures.length]}),(0,H.jsx)(`div`,{className:`shell-schema-measures`,children:n.schema.measures.map(e=>(0,H.jsxs)(`div`,{className:`shell-schema-measure`,children:[(0,H.jsx)(`span`,{className:`shell-schema-fname`,children:e.label}),(0,H.jsx)(`span`,{className:`shell-schema-type`,children:e.type})]},e.key))})]})]})]})]})})}var GXe=`https://royal-imports-cfo-os.hf.space`,Q9=`login`,$9=`application/x-loopable-nav`,KXe=[],qXe=[];function JXe(){let e=()=>window.location.hash.replace(/^#\/?/,``),[t,n]=(0,z.useState)(e);return(0,z.useEffect)(()=>{let t=()=>n(e());return window.addEventListener(`hashchange`,t),()=>window.removeEventListener(`hashchange`,t)},[]),t}function YXe({entry:e}){return(0,H.jsxs)(`div`,{className:`shell-placeholder`,children:[(0,H.jsx)(`h1`,{children:e.label}),(0,H.jsx)(`p`,{children:`This surface runs in the current application.`}),(0,H.jsxs)(`a`,{className:`shell-link`,href:e.href,target:`_blank`,rel:`noreferrer`,children:[`Open `,e.label]})]})}function XXe(){return(0,H.jsxs)(`svg`,{className:`shell-nav-icon`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,H.jsx)(`ellipse`,{cx:`8`,cy:`3.6`,rx:`5.3`,ry:`2.1`}),(0,H.jsx)(`path`,{d:`M2.7 3.6v8.8c0 1.16 2.37 2.1 5.3 2.1s5.3-.94 5.3-2.1V3.6`}),(0,H.jsx)(`path`,{d:`M2.7 8c0 1.16 2.37 2.1 5.3 2.1S13.3 9.16 13.3 8`})]})}function ZXe(){return(0,H.jsxs)(`svg`,{className:`shell-nav-icon is-spark`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,H.jsx)(`path`,{d:`M6.2 2.2 7.5 5.5l3.3 1.3-3.3 1.3-1.3 3.3-1.3-3.3-3.3-1.3 3.3-1.3z`}),(0,H.jsx)(`path`,{d:`M12.2 9.4l.8 2 2 .8-2 .8-.8 2-.8-2-2-.8 2-.8z`})]})}function QXe(){return(0,H.jsx)(`svg`,{className:`shell-nav-open`,viewBox:`0 0 12 12`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M4.6 3h4.4v4.4M8.8 3.2 3.2 8.8`})})}function $Xe(){return(0,H.jsxs)(`svg`,{className:`shell-account-dots`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,H.jsx)(`circle`,{cx:`3.5`,cy:`8`,r:`1.25`}),(0,H.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.25`}),(0,H.jsx)(`circle`,{cx:`12.5`,cy:`8`,r:`1.25`})]})}function eZe(){return(0,H.jsxs)(`svg`,{className:`shell-menu-icon`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,H.jsx)(`circle`,{cx:`8`,cy:`8`,r:`2.15`}),(0,H.jsx)(`path`,{d:`M8 1.9l.9 1.5 1.7-.4.5 1.7 1.7.5-.4 1.7 1.2 1.1-1.2 1.1.4 1.7-1.7.5-.5 1.7-1.7-.4-.9 1.5-.9-1.5-1.7.4-.5-1.7-1.7-.5.4-1.7L1.7 8l1.2-1.1-.4-1.7 1.7-.5.5-1.7 1.7.4z`})]})}function tZe(){return(0,H.jsxs)(`svg`,{className:`shell-nav-icon`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,H.jsx)(`rect`,{x:`1.9`,y:`5.4`,width:`4.6`,height:`5.2`,rx:`1.1`}),(0,H.jsx)(`rect`,{x:`9.5`,y:`5.4`,width:`4.6`,height:`5.2`,rx:`1.1`}),(0,H.jsx)(`path`,{d:`M6.5 8h3`})]})}function nZe(){return(0,H.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M2.5 4.4h11M2.5 8h11M2.5 11.6h11`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`})})}function rZe({user:e,utility:t,onSignOut:n,onSettings:r}){let[i,a]=(0,z.useState)(!1),o=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!i)return;let e=e=>{o.current&&!o.current.contains(e.target)&&a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let s=(e.name.match(/[\p{L}\p{N}]/u)?.[0]??``).toUpperCase(),c=t.filter(e=>e.key!==`analyst`);return(0,H.jsxs)(`div`,{className:`shell-account-wrap`,ref:o,children:[i?(0,H.jsxs)(`div`,{className:`shell-menu`,role:`menu`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`shell-menu-item`,role:`menuitem`,onClick:()=>{a(!1),r(`account`)},children:[(0,H.jsx)(eZe,{}),`Settings`]}),c.length?(0,H.jsx)(`div`,{className:`shell-menu-rule`,role:`separator`}):null,c.map(e=>(0,H.jsxs)(`a`,{className:`shell-menu-item`,role:`menuitem`,href:MXe(GXe,e.key),target:`_blank`,rel:`noreferrer`,onClick:()=>a(!1),children:[e.label,(0,H.jsx)(QXe,{})]},e.key)),(0,H.jsx)(`div`,{className:`shell-menu-rule`,role:`separator`}),(0,H.jsx)(`button`,{type:`button`,className:`shell-menu-item is-signout`,role:`menuitem`,onClick:()=>{a(!1),n()},children:`Sign out`})]}):null,(0,H.jsxs)(`button`,{type:`button`,className:`shell-account`,"aria-haspopup":`menu`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[e.avatar?(0,H.jsx)(`img`,{className:`shell-avatar`,src:e.avatar,alt:``,"aria-hidden":`true`,style:{objectFit:`cover`,padding:0}}):(0,H.jsx)(`span`,{className:`shell-avatar`,"aria-hidden":`true`,children:s}),(0,H.jsxs)(`span`,{className:`shell-account-who`,children:[(0,H.jsx)(`span`,{className:`shell-account-name`,children:e.name}),(0,H.jsx)(`span`,{className:`shell-account-role`,children:qJe(e)?`Admin`:`Member`})]}),(0,H.jsx)($Xe,{})]})]})}function iZe(){let[e,t]=(0,z.useState)({phase:`checking`}),[n,r]=(0,z.useState)({phase:`idle`}),[i,a]=(0,z.useState)(0),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(null),f=JXe(),[p,m]=(0,z.useState)(()=>{try{return localStorage.getItem(`aios-nav-collapsed`)===`1`}catch{return!1}});(0,z.useEffect)(()=>{try{localStorage.setItem(`aios-nav-collapsed`,p?`1`:`0`)}catch{}},[p]);let[h,g]=(0,z.useState)(null);(0,z.useEffect)(()=>{p||g(null)},[p]);let _=(0,z.useCallback)(e=>t=>{let n=t.currentTarget.getBoundingClientRect();g({label:e,y:n.top+n.height/2})},[]),v=(0,z.useCallback)(()=>g(null),[]);(0,z.useEffect)(()=>{let e=()=>t({phase:`anon`}),n=e=>s(String(e.detail??``)||`The data could not be loaded.`),r=e=>l(String(e.detail??``)),i=()=>m(!0);return window.addEventListener(Nd,e),window.addEventListener(Pd,n),window.addEventListener(Fd,r),window.addEventListener(Rd,i),()=>{window.removeEventListener(Nd,e),window.removeEventListener(Pd,n),window.removeEventListener(Fd,r),window.removeEventListener(Rd,i)}},[]),(0,z.useEffect)(()=>{if(!c)return;let e=setTimeout(()=>l(``),6e3);return()=>clearTimeout(e)},[c]),(0,z.useEffect)(()=>{let e=!1;return eYe().then(n=>{e||t(n?{phase:`authed`,user:n}:{phase:`anon`})}),()=>{e=!0}},[]);let y=e.phase===`authed`?e.user.username:null;(0,z.useEffect)(()=>{if(y===null){r({phase:`idle`});return}let e=!1;return r(e=>e.phase===`ready`?e:{phase:`loading`}),s(``),l(``),SXe().then(n=>{if(!e)if(n.ok){let{main:e,utility:t}=xXe(n.pages);r({phase:`ready`,entries:NXe(e,GXe),utility:t,...n.empty?{empty:n.empty}:{}})}else n.status===401?t({phase:`anon`}):r({phase:`error`})}),()=>{e=!0}},[y,i]);let b=n.phase===`ready`?n.entries:KXe,x=n.phase===`ready`&&b.length===0&&n.empty===`no_databases`,[S,C]=(0,z.useState)(Y9),w=(0,z.useRef)(S);w.current=S;let[T,E]=(0,z.useState)(new Set),[D,O]=(0,z.useState)(null);(0,z.useEffect)(()=>{if(y===null){C(Y9),O(null);return}let e=!1;return wXe().then(t=>{e||C(t)}),()=>{e=!0}},[y]);let k=(0,z.useCallback)(e=>{let t=w.current;C(e),TXe(e).then(e=>{e||(C(t),l(`The folder change was not saved — the store refused the write.`))})},[]),A=(0,z.useCallback)((e,t)=>{let n=w.current,r={...n.placement};t?r[e]=t:delete r[e],k({folders:n.folders,placement:r})},[k]),j=(0,z.useCallback)((e,t)=>{let n=w.current;k({folders:n.folders.map(n=>n.id===e?{...n,name:t}:n),placement:n.placement})},[k]),M=(0,z.useCallback)(e=>{let t=w.current;k({folders:t.folders.filter(t=>t.id!==e),placement:Object.fromEntries(Object.entries(t.placement).filter(([,t])=>t!==e))})},[k]),N=(0,z.useCallback)(e=>{E(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),[P,F]=(0,z.useState)(null),[ee,I]=(0,z.useState)(null),te=(0,z.useCallback)(e=>{let t=w.current;if(t.folders.length>=16){l(`At most 16 folders.`);return}let n=`nf_${Date.now().toString(36)}${Math.floor(Math.random()*1e6).toString(36)}`;k({folders:[...t.folders,{id:n,name:e}],placement:t.placement})},[k]),L=(0,z.useCallback)(async(e,t)=>{await EXe(e,t)?a(e=>e+1):l(`That change was not saved — the store refused the write.`)},[]);(0,z.useEffect)(()=>{e.phase===`anon`&&f!==Q9?window.location.hash=`#/${Q9}`:e.phase===`authed`&&f===Q9&&b.length&&(window.location.hash=`#/${FXe(b)}`)},[e.phase,f,b]);let ne=(0,z.useCallback)(()=>{Qd(),tYe().then(()=>t({phase:`anon`}))},[]),[re,ie]=(0,z.useState)(!1);(0,z.useEffect)(()=>{if(!re&&!se.current)return;let e=e=>{e.key===`Escape`&&(ie(!1),oe(e=>e&&e.busy?e:null))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)});let[ae,oe]=(0,z.useState)(null),se=(0,z.useRef)(!1);se.current=ae!==null;let[ce,le]=(0,z.useState)(!1),ue=(0,z.useCallback)(async()=>{oe(e=>{if(!e||e.busy||!e.name.trim())return e;let t=e.name;return(async()=>{try{let e=await fetch(`${jd}/tables`,{method:`POST`,credentials:Md,headers:{"Content-Type":`application/json`},body:JSON.stringify({label:t.trim()})}),n=await e.json().catch(()=>null);if(!e.ok||!n?.key){oe({name:t,busy:!1,err:n?.error?.message||`The server answered ${e.status}.`});return}oe(null),a(e=>e+1),window.location.hash=`#/${n.key}`}catch{oe({name:t,busy:!1,err:`Cannot reach the server.`})}})(),{...e,busy:!0,err:``}})},[]),de=(0,z.useCallback)(async e=>{le(!0);try{let t=await fetch(`${jd}/tables/${encodeURIComponent(e)}/rows`,{method:`POST`,credentials:Md,headers:{"Content-Type":`application/json`},body:JSON.stringify({values:{}})});if(t.ok)Qd(),window.dispatchEvent(new Event(zd));else{let e=await t.json().catch(()=>null);l(e?.error?.message||`The row was not added.`)}}catch{l(`Cannot reach the server.`)}finally{le(!1)}},[]);if(e.phase===`checking`)return(0,H.jsx)(`div`,{className:`shell-boot`,children:(0,H.jsx)(J9,{size:44,className:`login-brand`})});if(e.phase===`anon`)return(0,H.jsx)(vXe,{onSignedIn:e=>{Qd(),t({phase:`authed`,user:e})}});let fe=IXe(b,f),pe=n.phase===`ready`?n.utility:qXe,me=pe.find(e=>e.key===`analyst`),he=b.find(e=>e.key===`automation`&&e.kind===`native`),ge=he?b.filter(e=>e.key!==`automation`):b;return(0,H.jsxs)(`div`,{className:`shell-root`,children:[(0,H.jsxs)(`aside`,{className:`shell-side`+(p?` is-collapsed`:``),children:[(0,H.jsxs)(`div`,{className:`shell-side-head`,children:[(0,H.jsx)(`button`,{type:`button`,className:`shell-brand-btn`,disabled:!p,"aria-label":p?`Expand navigation`:void 0,onMouseEnter:p?_(`Expand navigation`):void 0,onMouseLeave:p?v:void 0,onClick:()=>m(!1),children:(0,H.jsx)(J9,{size:26,className:`shell-brand`})}),(0,H.jsx)(`button`,{type:`button`,className:`shell-rail-toggle`,"aria-label":`Minimize navigation`,"aria-expanded":!p,title:`Minimize navigation`,onClick:()=>m(!0),children:(0,H.jsx)(nZe,{})})]}),(0,H.jsxs)(`nav`,{className:`shell-nav`,children:[me?(0,H.jsxs)(`button`,{type:`button`,className:`shell-nav-item shell-nav-assist`,onClick:()=>ie(!0),onMouseEnter:p?_(`AI assistant`):void 0,onMouseLeave:p?v:void 0,children:[(0,H.jsx)(ZXe,{}),(0,H.jsx)(`span`,{className:`shell-nav-label`,children:`AI assistant`})]}):null,he?(0,H.jsxs)(`a`,{className:`shell-nav-item shell-nav-auto`+(fe&&fe.key===he.key?` is-active`:``),href:he.href,onMouseEnter:p?_(he.label):void 0,onMouseLeave:p?v:void 0,children:[he.icon?(0,H.jsx)(`span`,{className:`shell-nav-mark`,"aria-hidden":`true`,children:(0,H.jsx)(im,{icon:he.icon,size:16})}):(0,H.jsx)(tZe,{}),(0,H.jsx)(`span`,{className:`shell-nav-label`,children:he.label})]}):null,(0,H.jsxs)(`div`,{className:`shell-nav-list`+(ee===`__root__`?` is-drop-root`:``),onDragOver:e=>{e.dataTransfer.types.includes($9)&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,I(`__root__`))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||I(null)},onDrop:e=>{let t=e.dataTransfer.getData($9);I(null),F(null),t&&(e.preventDefault(),A(t,null))},children:[DXe(ge,p?Y9:S,T).map(e=>{if(e.kind===`folder`)return(0,H.jsx)(UXe,{folder:e.folder,count:e.count,open:e.open,collapsed:p,onToggle:()=>N(e.folder.id),onRename:t=>j(e.folder.id,t),onDelete:()=>M(e.folder.id),isDrop:ee===e.folder.id,dropProps:{onDragOver:t=>{t.dataTransfer.types.includes($9)&&(t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect=`move`,I(e.folder.id))},onDrop:t=>{let n=t.dataTransfer.getData($9);I(null),F(null),n&&(t.preventDefault(),t.stopPropagation(),A(n,e.folder.id))}}},`folder:${e.folder.id}`);let t=e.entry,n=!!fe&&fe.key===t.key,r=`shell-nav-item`+(t.depth>0?` is-child`:``)+(n?` is-active`:``),i=(0,H.jsxs)(H.Fragment,{children:[t.icon?(0,H.jsx)(`span`,{className:`shell-nav-mark`,"aria-hidden":`true`,children:(0,H.jsx)(im,{icon:t.icon,size:16})}):(0,H.jsx)(XXe,{}),(0,H.jsx)(`span`,{className:`shell-nav-label`,children:t.label}),t.kind===`handoff`?(0,H.jsx)(QXe,{}):null]});if(t.kind===`group`)return(0,H.jsx)(`div`,{className:`shell-nav-group`,children:i},t.key);let a=p?{onMouseEnter:_(t.label),onMouseLeave:v}:{},o=t.kind===`native`?(0,H.jsx)(`a`,{className:r,href:t.href,...a,children:i}):(0,H.jsx)(`a`,{className:r,href:t.href,target:`_blank`,rel:`noreferrer`,...a,children:i});return(0,H.jsxs)(`div`,{className:`shell-nav-row`+(n?` is-active`:``)+(e.folderId?` is-foldered`:``)+(P===t.key?` is-dragging`:``),draggable:!p&&t.depth===0,onDragStart:e=>{e.dataTransfer.setData($9,t.key),e.dataTransfer.effectAllowed=`move`,F(t.key)},onDragEnd:()=>{F(null),I(null)},children:[o,!p&&t.depth===0&&(0,H.jsx)(BXe,{entryLabel:t.label,canSchema:!0,onSchema:()=>O(t.key),canRename:!!t.manage&&t.key.startsWith(`ut_`),onRename:e=>void L(t.key,{name:e}),canIcon:!!t.manage,...t.icon?{icon:t.icon}:{},onIcon:e=>void L(t.key,{icon:e}),onIconClear:()=>void L(t.key,{icon:null})})]},t.key)}),n.phase===`ready`?(0,H.jsx)(HXe,{collapsed:p,onExpand:()=>m(!1),onCreateFolder:te,onNewDatabase:()=>oe({name:``,busy:!1,err:``}),canFolder:b.length>0}):null]}),n.phase===`loading`?(0,H.jsx)(`div`,{className:`shell-nav-note is-spin`,children:(0,H.jsx)(`span`,{className:`lp-spin`,role:`status`,"aria-label":`Loading`})}):null,n.phase===`error`?(0,H.jsx)(`div`,{className:`shell-nav-note`,children:`Navigation unavailable. Reload to retry.`}):null,n.phase===`ready`&&b.length===0&&!x?(0,H.jsx)(`div`,{className:`shell-nav-note`,children:`No surfaces are available to this account.`}):null]}),(0,H.jsx)(`div`,{className:`shell-side-bottom`,onClickCapture:p?e=>{e.preventDefault(),e.stopPropagation(),m(!1)}:void 0,onMouseEnter:p?_(e.user.name):void 0,onMouseLeave:p?v:void 0,children:(0,H.jsx)(rZe,{user:e.user,utility:pe,onSignOut:ne,onSettings:d})})]}),h?(0,H.jsx)(`div`,{className:`shell-nav-tip`,style:{top:h.y},role:`tooltip`,"aria-hidden":`true`,children:h.label}):null,(0,H.jsx)(`main`,{className:`shell-main`,children:o&&fe?.kind===`native`?(0,H.jsxs)(`div`,{className:`shell-placeholder`,children:[(0,H.jsx)(`h1`,{children:fe.label}),(0,H.jsx)(`p`,{children:o}),(0,H.jsx)(`button`,{className:`login-submit shell-retry`,type:`button`,onClick:()=>window.location.reload(),children:`Retry`})]}):fe?.kind===`native`&&jXe.has(fe.key)?(0,H.jsx)(KJe,{pageKey:fe.key,label:fe.label},fe.key):fe?.kind===`native`&&fe.key===`automation`?(0,H.jsx)(mJe,{}):fe?.kind===`native`?(0,H.jsxs)(`div`,{className:fe.key.startsWith(`ut_`)?`shell-ut-frame`:`shell-grid-host`,children:[fe.key.startsWith(`ut_`)?(0,H.jsxs)(`div`,{className:`shell-ut-bar`,children:[(0,H.jsx)(`span`,{className:`shell-ut-name`,children:fe.label}),(0,H.jsx)(`button`,{type:`button`,className:`shell-ut-add`,onClick:()=>void de(fe.key),disabled:ce,children:ce?`Adding…`:`Add record`})]}):null,(0,H.jsx)(`div`,{className:`shell-grid-host`,children:(0,H.jsx)(Kp,{children:(0,H.jsx)(Lqe,{scope:fe.key===`product_data`?`product`:fe.key.startsWith(`ut_`)?fe.key:`customer`},fe.key)})})]}):fe?(0,H.jsx)(YXe,{entry:fe}):n.phase===`ready`||n.phase===`error`?n.phase===`ready`?(0,H.jsxs)(`div`,{className:`shell-placeholder shell-tenant-hero`,children:[(0,H.jsx)(`h1`,{children:`Welcome`}),(0,H.jsx)(`p`,{children:`This workspace has no databases yet. Create your first one below, or store a data source's keys under Settings → Keychains to connect one later.`}),(0,H.jsx)(`button`,{className:`login-submit shell-hero-create`,type:`button`,onClick:()=>oe({name:``,busy:!1,err:``}),children:`Create your first database`})]}):(0,H.jsxs)(`div`,{className:`shell-placeholder`,children:[(0,H.jsx)(`h1`,{children:`Nothing to show`}),(0,H.jsx)(`p`,{children:`The navigation service did not answer. Reload to retry.`})]}):(0,H.jsx)(`div`,{className:`shell-loading`,children:(0,H.jsx)(`span`,{className:`lp-spin lp-spin--lg`,role:`status`,"aria-label":`Loading`})})}),re?(0,H.jsx)(`div`,{className:`shell-newdb-scrim`,onClick:()=>ie(!1),children:(0,H.jsxs)(`div`,{className:`shell-newdb shell-assist-note`,role:`dialog`,"aria-label":`AI assistant`,onClick:e=>e.stopPropagation(),children:[(0,H.jsxs)(`h2`,{children:[(0,H.jsx)(ZXe,{}),` AI assistant`]}),(0,H.jsx)(`p`,{className:`shell-newdb-sub`,children:`Under construction. The assistant is being trained on this workspace's data model and will open here in a later release.`}),(0,H.jsx)(`div`,{className:`shell-newdb-actions`,children:(0,H.jsx)(`button`,{type:`button`,className:`login-submit`,onClick:()=>ie(!1),children:`Close`})})]})}):null,ae?(0,H.jsx)(`div`,{className:`shell-newdb-scrim`,onClick:()=>{ae.busy||oe(null)},children:(0,H.jsxs)(`div`,{className:`shell-newdb`,role:`dialog`,"aria-label":`New database`,onClick:e=>e.stopPropagation(),children:[(0,H.jsx)(`h2`,{children:`New database`}),(0,H.jsx)(`p`,{className:`shell-newdb-sub`,children:`A blank database in this workspace. Add fields and records once it opens — nothing here connects to a source.`}),(0,H.jsx)(`input`,{autoFocus:!0,className:`shell-newdb-input`,placeholder:`Database name`,value:ae.name,maxLength:60,disabled:ae.busy,onChange:e=>oe({...ae,name:e.target.value}),onKeyDown:e=>{e.key===`Enter`&&ue(),e.key===`Escape`&&!ae.busy&&oe(null)}}),ae.err?(0,H.jsx)(`p`,{className:`shell-newdb-err`,children:ae.err}):null,(0,H.jsxs)(`div`,{className:`shell-newdb-actions`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>oe(null),disabled:ae.busy,children:`Cancel`}),(0,H.jsx)(`button`,{type:`button`,className:`login-submit`,onClick:()=>void ue(),disabled:ae.busy||!ae.name.trim(),children:ae.busy?`Creating…`:`Create database`})]})]})}):null,u?(0,H.jsx)(fXe,{user:e.user,section:u,onSection:d,onClose:()=>d(null),onUser:e=>t({phase:`authed`,user:e}),moduleLabels:Object.fromEntries(b.map(e=>[e.key,e.label]))}):null,D?(0,H.jsx)(WXe,{schemaKey:D,onClose:()=>O(null)}):null,c?(0,H.jsx)(`div`,{className:`shell-toast`,role:`status`,"aria-live":`polite`,children:c}):null]})}var aZe=Ud()||window.__AIOS_GRID__!==void 0;function oZe(){return aZe?(0,H.jsx)(`div`,{style:{width:`100%`,height:`100%`,overflow:`hidden`},children:(0,H.jsx)(Kp,{children:(0,H.jsx)(Lqe,{})})}):(0,H.jsx)(iZe,{})}ote(),aZe||vte(),(0,y.createRoot)(document.getElementById(`root`)).render((0,H.jsx)(z.StrictMode,{children:(0,H.jsx)(oZe,{})})); +`),Nt=p7(Xe)&&(et!==(t.colorCodeOptions!==!1)||EGe(ht,mt.colors)!==EGe(Qu(t),t.optionColors)),Pt=Xe===`rating`&&tt!==$u(t),Ft=Xe===`automation`&&t.type===`automation`&&(at!==(t.automation?.kind??y7[0].key)||st!==(t.automation?.urlField??``)),It=h!=null&&(Xe!==t.type||Mt||Nt||Pt||Ft),Lt=(!p7(Xe)||ht.length>0)&&(Xe!==`automation`||st!==``),Rt=(0,z.useMemo)(()=>rt.trim()===``?{ok:!1,error:`Type a formula`,refs:[]}:d7(rt,gt,_t,t.key),[rt,gt,_t,t.key]),zt=!!_&&t.type===`formula`&&rt.trim()!==(typeof t.formula==`string`?t.formula.trim():``),Bt=It&&!Lt||zt&&!Rt.ok,Vt=t.measure?Gu(t.measure.window):null,Ht=Be?Gu(Be):null,Ut=Ht!=null&&JSON.stringify(Ht)!==JSON.stringify(Vt),Wt=!!t.measure&&!!C,Gt=!Bt&&(jt||It||zt||Wt&&Ut),Kt=()=>{Gt&&(It&&h?h(Xe,p7(Xe)?ht:void 0,{...Xe===`rating`?{max:tt}:{},...p7(Xe)?{colorCodeOptions:et,...Object.keys(mt.colors).length?{optionColors:mt.colors}:{}}:{},...Xe===`automation`?{automation:{kind:at,source:`record_url_field`,urlField:st}}:{},...jt?{label:At}:{}}):zt&&_?_(rt.trim(),jt?At:void 0):jt&&g&&g(At),Wt&&Ut&&Ht&&C(Ht),l())},qt=n.filter(e=>e.key!==t.key),Jt=qt.filter(e=>e.source===`odoo`&&!e.custom),Yt=qt.filter(e=>!(e.source===`odoo`&&!e.custom)),Xt=t.measure?`Metric, read-only`:t.type===`formula`?`Formula field, computed`:t.type===`created_time`?`Created time, read-only`:t.derived?`Read-only, derived`:t.source===`odoo`?`Read-only source field`:`Editable overlay field`,Zt=t.scope===`cohort`?`${Xt} · this cohort only`:Xt,Qt=t.type===`int`||t.type===`currency`||t.type===`formula`?`number`:t.type===`date`||t.type===`created_time`?`date`:null;if(ne)return(0,H.jsxs)(Yp,{anchor:e.anchor,className:`cg-column-menu`,onDismiss:l,role:`dialog`,ariaLabel:ne===`end`?`Add field`:`Insert field ${ne} of ${t.label}`,initialFocus:`[data-overlay-autofocus]`,dataKind:`column-menu`,children:[(0,H.jsx)(b7,{title:ne===`end`?`Add field`:ne===`left`?`Insert field left`:`Insert field right`,sub:ne===`end`?`Added as the last column`:`Next to ${t.label}`,onClose:l}),(0,H.jsxs)(`div`,{className:`cg-column-create`,children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Name`}),(0,H.jsx)(`input`,{className:`cg-input`,autoFocus:!0,"data-overlay-autofocus":!0,value:St,onChange:e=>{se(e.target.value),le(!0)},onKeyDown:e=>e.key===`Enter`&&Dt()})]}),(0,H.jsxs)(`div`,{className:`cg-type-block`,children:[(0,H.jsx)(`span`,{className:`cg-type-title`,children:`Field type`}),(0,H.jsx)(OGe,{value:ue,onPick:de,offerMeasure:F.length>0})]}),ue===`measure`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Number`}),(0,H.jsx)(sm,{ariaLabel:`Number to summarise`,placeholder:`Choose a number…`,value:bt?ge:void 0,onChange:_e,fields:F.map(e=>({key:e.key,label:e.label,type:`measure`}))})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Period`}),(0,H.jsx)(`span`,{className:`cg-measure-window`,children:(0,H.jsx)(um,{window:ve,onWindow:ye})})]}),(0,H.jsx)(`div`,{className:`cg-field-hint`,children:`A total, average or count over the period you choose — e.g. Sales, last 90 days. Computed for every customer, and read-only.`})]}),(0,H.jsx)(x7,{kind:ue,fields:n,formulaText:be,onFormulaText:xe,formulaError:vt.ok?null:vt.error??null,maxValue:Se,onMaxValue:Ce,idPrefix:`cg-create`,automationKind:we,onAutomationKind:Te,automationUrlField:Ee,onAutomationUrlField:De}),p7(ue)&&(0,H.jsx)(v7,{idPrefix:`cg-create-option`,drafts:fe,onDrafts:pe,colorCode:me,onColorCode:he,type:ue}),ue===`user`&&(0,H.jsx)(`div`,{className:`cg-field-hint`,children:P.length?`${P.length} people can be assigned, from your user list.`:`No user list yet, so there is no one to assign.`}),y&&(0,H.jsx)(MGe,{value:Ke,onValue:qe}),(0,H.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!Ct,onClick:Dt,children:`Create field`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>v?l():re(null),children:`Cancel`})]})]})]});if(ee===`edit`)return(0,H.jsxs)(Yp,{anchor:e.anchor,className:`cg-column-menu`,onDismiss:l,role:`dialog`,ariaLabel:`Edit field ${t.label}`,initialFocus:`[data-overlay-autofocus]`,dataKind:`column-menu`,children:[(0,H.jsx)(b7,{title:`Edit field`,sub:Zt,onClose:l}),(0,H.jsxs)(`div`,{className:`cg-column-create`,children:[g?(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Name`}),(0,H.jsx)(`input`,{className:`cg-input`,autoFocus:!0,"data-overlay-autofocus":!0,value:Je,onChange:e=>Ye(e.target.value),onKeyDown:e=>e.key===`Enter`&&Kt()})]}):(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Name`}),(0,H.jsx)(`input`,{className:`cg-input`,value:t.label,disabled:!0,"aria-label":`Field name (read-only)`}),(0,H.jsx)(`span`,{className:`cg-field-hint`,children:`A source field keeps its name and type from the data source.`})]}),h&&t.type===`automation`?(0,H.jsxs)(`div`,{className:`cg-type-block`,children:[(0,H.jsx)(`span`,{className:`cg-type-title`,children:`Automation`}),(0,H.jsx)(x7,{kind:`automation`,fields:n,formulaText:rt,onFormulaText:it,formulaError:null,maxValue:tt,onMaxValue:nt,idPrefix:`cg-edit`,automationKind:at,onAutomationKind:ot,automationUrlField:st,onAutomationUrlField:ct})]}):h?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`cg-type-block`,children:[(0,H.jsx)(`span`,{className:`cg-type-title`,children:`Field type`}),(0,H.jsx)(OGe,{value:Xe,onPick:e=>Ze(e),offerMeasure:!1,only:AGe})]}),Xe===`rating`&&(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Number of stars`}),(0,H.jsx)(`input`,{className:`cg-input cg-rating-max`,type:`number`,min:2,max:10,value:tt,"aria-label":`Number of stars`,onChange:e=>{let t=Math.round(Number(e.target.value));nt(Number.isFinite(t)?Math.max(2,Math.min(10,t)):5)}})]}),p7(Xe)&&(0,H.jsx)(v7,{idPrefix:`cg-edit-option`,drafts:Qe,onDrafts:$e,colorCode:et,onColorCode:R,type:Xe}),Xe!==t.type&&(0,H.jsxs)(`div`,{className:`cg-field-hint`,children:[`Changes `,t.label,` into a `,Af[Xe].toLowerCase(),` field, keeping its name and its values as entered. Cells that cannot be read in the new type show blank.`]})]}):null,Wt&&(0,H.jsxs)(`label`,{className:`cg-edit-period`,children:[(0,H.jsx)(`span`,{children:`Period`}),(0,H.jsx)(`span`,{className:`cg-measure-window`,children:(0,H.jsx)(um,{window:Be??t.measure.window,onWindow:Ve})}),(0,H.jsx)(`span`,{className:`cg-field-hint`,children:`The window this number is computed over, for every customer.`})]}),!h&&t.type===`formula`&&_&&(0,H.jsx)(x7,{kind:`formula`,fields:n,formulaText:rt,onFormulaText:it,formulaError:Rt.ok?null:Rt.error??null,maxValue:tt,onMaxValue:nt,idPrefix:`cg-edit`,showFormulaHelp:!1}),(0,H.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!Gt,onClick:Kt,children:`Save`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>I(`menu`),children:`Back`})]}),!r&&qt.length>0&&(0,H.jsxs)(`div`,{className:`cg-edit-swap`,children:[(0,H.jsx)(`span`,{className:`cg-type-title`,children:`Change field`}),(0,H.jsx)(`div`,{className:`cg-field-hint`,children:`Show a different field in this column — the current one is hidden, not lost.`}),(0,H.jsxs)(`div`,{className:`cg-column-swap`,children:[(0,H.jsx)(sm,{className:`cg-swap-select`,ariaLabel:`Change this column to another field`,placeholder:`Choose a field…`,overlayAutofocus:!g,value:Oe||void 0,onChange:ke,fields:[...Jt.map(e=>({key:e.key,label:e.label,type:e.type,group:`Pre-set fields`})),...Yt.map(e=>({key:e.key,label:e.label,type:e.type,group:`Your fields`})),...f7.map(e=>({key:kGe+e.value,label:e.label,type:e.value,group:`New field`}))]}),!lt&&(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!Oe,onClick:()=>{p(Oe),l()},children:`Change`})]}),lt&&(0,H.jsxs)(`div`,{className:`cg-column-create cg-swap-create`,children:[(0,H.jsxs)(`label`,{children:[(0,H.jsxs)(`span`,{children:[`New `,Af[lt].toLowerCase(),` field`]}),(0,H.jsx)(`input`,{className:`cg-input`,autoFocus:!0,value:Ae,placeholder:`Field name`,onChange:e=>je(e.target.value),onKeyDown:e=>e.key===`Enter`&&kt()})]}),(0,H.jsx)(x7,{kind:lt,fields:n,formulaText:Ie,onFormulaText:Le,formulaError:yt.ok?null:yt.error??null,maxValue:Re,onMaxValue:ze,idPrefix:`cg-swap`}),p7(lt)&&(0,H.jsx)(v7,{idPrefix:`cg-swap-option`,drafts:Me,onDrafts:Ne,colorCode:Pe,onColorCode:Fe,type:lt}),lt===`user`&&(0,H.jsx)(`div`,{className:`cg-field-hint`,children:P.length?`${P.length} people can be assigned.`:`No user list was supplied by the host yet.`}),y&&(0,H.jsx)(MGe,{value:Ke,onValue:qe}),(0,H.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!Ot,onClick:kt,children:`Create and change`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>ke(``),children:`Cancel`})]})]})]})]})]});if(ee===`note`)return(0,H.jsxs)(Yp,{anchor:e.anchor,className:`cg-column-menu`,onDismiss:l,role:`dialog`,ariaLabel:`Edit description for ${t.label}`,initialFocus:`[data-overlay-autofocus]`,dataKind:`column-menu`,children:[(0,H.jsx)(b7,{title:`Edit field description`,sub:t.label,onClose:l}),(0,H.jsxs)(`div`,{className:`cg-column-create`,children:[t.description&&(0,H.jsxs)(`div`,{className:`cg-field-hint cg-desc-default`,children:[`Default description: `,t.description]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Your description`}),(0,H.jsx)(`textarea`,{className:`cg-input`,"data-overlay-autofocus":!0,autoFocus:!0,rows:4,value:te,placeholder:t.description?`Write your own to replace the default…`:`Explain how this field should be used…`,onChange:e=>L(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:te===(t.note??``),onClick:()=>{u(te),l()},children:`Save`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>I(`menu`),children:`Back`})]})]})]});if(ee===`permissions`)return(0,H.jsxs)(Yp,{anchor:e.anchor,className:`cg-column-menu`,onDismiss:l,role:`dialog`,ariaLabel:`Edit permissions for ${t.label}`,initialFocus:`[data-overlay-autofocus]`,dataKind:`column-menu`,children:[(0,H.jsx)(b7,{title:`Edit field permissions`,sub:t.label,onClose:l}),(0,H.jsxs)(`div`,{className:`cg-column-create`,children:[(0,H.jsxs)(`div`,{className:`cg-field-hint`,children:[`Who can edit this field's values`,t.createdBy?` (created by ${t.createdBy})`:``,`.`]}),[[`everyone`,`Everyone`],[`creator`,`Only the creator`],[`admins`,`Only admins`]].map(([e,t])=>(0,H.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`cg-perm`,"data-overlay-autofocus":e===`everyone`||void 0,checked:He===e,onChange:()=>Ue(e)}),(0,H.jsx)(`span`,{children:t})]},e)),(0,H.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:He===(t.permissions?.edit??`everyone`),onClick:()=>{E?.(He),l()},children:`Save`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>I(`menu`),children:`Back`})]})]})]});if(ee===`format`&&Qt)return(0,H.jsxs)(Yp,{anchor:e.anchor,className:`cg-column-menu`,onDismiss:l,role:`dialog`,ariaLabel:`Format ${t.label}`,initialFocus:`[data-overlay-autofocus]`,dataKind:`column-menu`,children:[(0,H.jsx)(b7,{title:`Field format`,sub:t.label,onClose:l}),(0,H.jsxs)(`div`,{className:`cg-column-create`,children:[Qt===`number`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,H.jsx)(`input`,{type:`checkbox`,"data-overlay-autofocus":!0,checked:We.thousands!==!1,onChange:e=>Ge(t=>({...t,thousands:e.target.checked}))}),(0,H.jsx)(`span`,{children:`Thousands separator (12,345)`})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Decimal places`}),(0,H.jsxs)(`select`,{className:`cg-select`,value:Number.isInteger(We.decimals)?String(We.decimals):``,"aria-label":`Decimal places`,onChange:e=>Ge(t=>{let n={...t};return e.target.value===``?delete n.decimals:n.decimals=Number(e.target.value),n}),children:[(0,H.jsx)(`option`,{value:``,children:`As entered`}),[0,1,2,3,4].map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))]})]}),(0,H.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:We.abbrev===!0,onChange:e=>Ge(t=>({...t,abbrev:e.target.checked}))}),(0,H.jsx)(`span`,{children:`Abbreviate large numbers (34.0M)`})]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,H.jsx)(`input`,{type:`checkbox`,"data-overlay-autofocus":!0,checked:We.time??t.type===`created_time`,onChange:e=>Ge(t=>({...t,time:e.target.checked}))}),(0,H.jsx)(`span`,{children:`Include the time of day`})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:`Time zone`}),(0,H.jsxs)(`select`,{className:`cg-select`,value:We.tz===`utc`?`utc`:`local`,"aria-label":`Time zone`,onChange:e=>Ge(t=>({...t,tz:e.target.value})),children:[(0,H.jsx)(`option`,{value:`local`,children:`Your local time`}),(0,H.jsx)(`option`,{value:`utc`,children:`UTC`})]})]})]}),(0,H.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:JSON.stringify(We)===JSON.stringify(t.format??{}),onClick:()=>{D?.(We),l()},children:`Save`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>I(`menu`),children:`Back`})]})]})]});let $t=!!E&&!!i&&(i.isAdmin||t.createdBy!=null&&t.createdBy===i.name);return(0,H.jsxs)(Yp,{anchor:e.anchor,className:`cg-column-menu`,onDismiss:l,role:`dialog`,ariaLabel:`Column settings for ${t.label}`,initialFocus:`[data-overlay-autofocus]`,dataKind:`column-menu`,children:[(0,H.jsx)(b7,{title:t.label,sub:Zt,onClose:l}),Wt&&(0,H.jsxs)(`button`,{type:`button`,className:`cg-column-periodline`,onClick:()=>{Ye(t.label),I(`edit`)},children:[(0,H.jsx)(`span`,{className:`cg-swap-label`,children:`Period`}),(0,H.jsx)(`span`,{className:`cg-column-periodval`,children:qu(t.measure.window)})]}),(0,H.jsxs)(`div`,{className:`cg-column-actions`,children:[(0,H.jsx)(`button`,{type:`button`,"data-overlay-autofocus":!0,onClick:()=>{Ye(t.label),I(`edit`)},children:(0,H.jsx)(tm,{icon:`rename`,text:`Edit field`})}),(0,H.jsx)(`div`,{className:`cg-menu-sep`,role:`separator`,"aria-hidden":!0}),T&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>{T(),l()},children:(0,H.jsx)(tm,{icon:`duplicate`,text:`Duplicate field`})}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>re(`left`),children:(0,H.jsx)(tm,{icon:`insertLeft`,text:`Insert field left`})}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>re(`right`),children:(0,H.jsx)(tm,{icon:`insertRight`,text:`Insert field right`})}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>re(`end`),children:(0,H.jsx)(tm,{icon:`addEnd`,text:`Add field at end`})}),(0,H.jsx)(`div`,{className:`cg-menu-sep`,role:`separator`,"aria-hidden":!0}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>I(`note`),children:(0,H.jsx)(tm,{icon:`description`,text:`Edit field description`})}),$t&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>I(`permissions`),children:(0,H.jsx)(tm,{icon:`permissions`,text:`Edit field permissions`})}),Qt&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>I(`format`),children:(0,H.jsx)(tm,{icon:`format`,text:`Field format`})}),(0,H.jsx)(`div`,{className:`cg-menu-sep`,role:`separator`,"aria-hidden":!0}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>{O(`asc`),l()},children:(0,H.jsx)(tm,{icon:`sortAsc`,text:`Sort ${ad(t.type,`asc`)}`})}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>{O(`desc`),l()},children:(0,H.jsx)(tm,{icon:`sortDesc`,text:`Sort ${ad(t.type,`desc`)}`})}),a!=null&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>{k(),l()},children:(0,H.jsx)(tm,{icon:`off`,text:`Don't sort by this field`})}),(0,H.jsx)(`div`,{className:`cg-menu-sep`,role:`separator`,"aria-hidden":!0}),(t.filterable!==!1||t.measure!=null&&F.length>0)&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>{A(),l()},children:(0,H.jsx)(tm,{icon:`filter`,text:`Filter by this field`})}),o&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>{j(),l()},children:(0,H.jsx)(tm,{icon:`off`,text:`Don't filter by this field`})}),c&&!s&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>{M(),l()},children:(0,H.jsx)(tm,{icon:`group`,text:`Group by this field`})}),s&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>{N(),l()},children:(0,H.jsx)(tm,{icon:`off`,text:`Don't group by this field`})}),x&&!b&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>{x(),l()},children:(0,H.jsx)(tm,{icon:`pin`,text:`Pin up to this field`})}),S&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>{S(),l()},children:(0,H.jsx)(tm,{icon:`unpin`,text:`Unpin all fields`})}),(0,H.jsx)(`div`,{className:`cg-menu-sep`,role:`separator`,"aria-hidden":!0}),(0,H.jsx)(`button`,{type:`button`,disabled:r,title:r?`The primary field stays visible`:void 0,onClick:d,children:(0,H.jsx)(tm,{icon:`hide`,text:`Hide field`})}),w&&(0,H.jsx)(`button`,{type:`button`,className:`is-danger`,title:t.measure?`Removes this formula column from the workspace.`:`Removes this field AND its values on every row.`,onClick:()=>ie?w():ae(!0),children:(0,H.jsx)(tm,{icon:`trash`,text:ie?`Delete permanently?`:`Delete field`})})]})]})}var S7=(e,t)=>typeof e==`number`&&t-e<=12e4;function C7(e,t){let n=Object.entries(e??{}).filter(([,e])=>typeof e==`number`&&S7(e,t));return Object.fromEntries(n.slice(-64))}function PGe(e,t,n){return C7({...e??{},[t]:n},n)}function FGe(e,t,n,r,i){if(!Array.isArray(t)||t.length===0)return e;let a=new Set(e.map(e=>e.id)),o=[];for(let e of t)!e||typeof e.id!=`string`||e.id===``||a.has(e.id)||S7(n?.[e.id],r)||(a.add(e.id),o.push({...e,config:i(e.config)}));return o.length===0?e:[...e,...o]}function IGe(e,t,n,r){if(!Array.isArray(t)||t.length===0)return e;let i=new Set(e.map(e=>e.key)),a=[];for(let e of t)!e||typeof e.key!=`string`||e.key===``||i.has(e.key)||S7(n?.[e.key],r)||(i.add(e.key),a.push(e));return a.length===0?e:[...e,...a]}var LGe=[`bar`,`line`,`area`,`donut`,`kpi`,`table`],w7=[`sum`,`avg`,`count`,`min`,`max`],RGe={sum:`Sum of`,avg:`Average of`,count:`Count of records`,min:`Smallest`,max:`Largest`},zGe=[`brand`,`categorical`,`sequential`,`diverging`],BGe=[`auto`,`number`,`currency`,`percent`,`compact`],T7=[1,12],E7=[120,800],D7=[`bar`,`line`,`area`];function O7(e){return!!e&&e.startsWith(`measure_`)}function k7(e){return!!e.bucket&&O7(e.y)&&D7.includes(e.kind)}function VGe(e){let t=String(e??``);return/^\d{4}-\d{2}/.test(t)?t.slice(0,7):null}function HGe(e){let t=Number(e.slice(0,4)),n=Number(e.slice(5,7));return!Number.isFinite(t)||!Number.isFinite(n)?e:new Date(Date.UTC(t,n-1,1)).toLocaleDateString(void 0,{month:`short`,year:`numeric`,timeZone:`UTC`})}function A7(e){if(e==null||e===``)return null;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:null}function j7(e,t,n){if(e===`count`)return n;if(t.length===0)return 0;switch(e){case`sum`:return t.reduce((e,t)=>e+t,0);case`avg`:return t.reduce((e,t)=>e+t,0)/t.length;case`min`:return Math.min(...t);case`max`:return Math.max(...t)}}function UGe(e,t,n){return e===`count`?n:t.length===0?null:j7(e,t,n)}function M7(e,t,n,r){let i={buckets:[],omitted:0,omittedValue:0,blanks:0,missingY:0,rows:t.length},a=e.y?n.get(e.y):void 0;if(e.y&&!a)return{...i,problem:`The field this chart measured no longer exists.`};if(a&&e.agg!==`count`&&!rd(a.type))return{...i,problem:`${a.label} is not a number, so it cannot be ${e.agg===`avg`?`averaged`:e.agg+`med`}.`};if(e.agg!==`count`&&!a)return{...i,problem:`Choose a number field to measure, or switch to Count.`};if(e.kind===`kpi`){let n=[],r=0;for(let e of t){if(!a)continue;let t=A7(e[a.key]);t==null?r+=1:n.push(t)}return{...i,missingY:r,buckets:[{key:``,label:``,value:j7(e.agg,n,t.length),n:t.length}]}}let o=e.x?n.get(e.x):void 0;if(!e.x)return{...i,problem:`Choose a field to group by.`};if(!o)return{...i,problem:`The field this chart grouped by no longer exists.`};let s=id(o.type),c=new Map,l=0,u=0;for(let e of t){let t=e[o.key],n,r;if(s){let e=VGe(t);e==null?(l+=1,n=``,r=`(no date)`):(n=e,r=HGe(e))}else{let e=String(t??``).trim();e===``?(l+=1,n=``,r=`(blank)`):(n=e,r=e)}let i=c.get(n);if(i||(i={label:r,vals:[],n:0},c.set(n,i)),i.n+=1,a){let t=A7(e[a.key]);t==null?u+=1:i.vals.push(t)}}let d=[...c.entries()].map(([t,n])=>({key:t,label:n.label,value:j7(e.agg,n.vals,n.n),n:n.n}));s?d.sort((e,t)=>e.key===``?1:t.key===``?-1:e.key.localeCompare(t.key)):d.sort((e,t)=>t.value-e.value||e.label.localeCompare(t.label));let f=d.filter(e=>e.value<0),p=d.filter(e=>e.value===0).length,m=f.reduce((e,t)=>e+t.value,0),h=0,g=0,_=r?.maxBuckets??12;if(d.length>_){let e=d.slice(0,_),t=d.slice(_);h=t.length,g=t.reduce((e,t)=>e+t.value,0),d=e}return{...i,buckets:d,omitted:h,omittedValue:g,blanks:l,missingY:u,negativeBuckets:f.length,negativeValue:m,zeroBuckets:p}}function WGe(e,t,n){let r=M7({...e,splitBy:void 0},t,n),i={points:[],xOrder:[],seriesOrder:[],omitted:r.omitted,omittedValue:r.omittedValue,omittedSeries:0,omittedSeriesValue:0,nonPositive:0,nonPositiveValue:0,blanks:r.blanks,missingY:r.missingY,rows:r.rows,problem:r.problem};if(r.problem)return i;if(e.kind===`donut`){let e=r.buckets.filter(e=>e.value>0),t=r.negativeBuckets??r.buckets.filter(e=>e.value<0).length,n=t+(r.zeroBuckets??r.buckets.filter(e=>e.value===0).length),a=r.negativeValue??r.buckets.filter(e=>e.value<0).reduce((e,t)=>e+t.value,0);return t>0?{...i,nonPositive:n,nonPositiveValue:a,problem:`A donut cannot represent negative values without misrepresenting the whole. Use a bar or line chart for signed values.`}:r.buckets.length>0&&e.length===0?{...i,nonPositive:n,nonPositiveValue:a,problem:`A donut needs at least one positive value. Zero-value groups cannot be drawn as slices.`}:{...i,points:e.map(e=>({...e,seriesKey:``,seriesLabel:``})),xOrder:e.map(e=>e.key),nonPositive:n,nonPositiveValue:a}}if(!e.splitBy||e.kind===`kpi`)return{...i,points:r.buckets.map(e=>({...e,seriesKey:``,seriesLabel:``})),xOrder:r.buckets.map(e=>e.key)};let a=n.get(e.splitBy),o=e.x?n.get(e.x):void 0;if(!a)return{...i,problem:`The field this chart split into series no longer exists.`};if(!o)return{...i,problem:`The field this chart grouped by no longer exists.`};let s=e=>id(o.type)?VGe(e[o.key])??``:String(e[o.key]??``).trim(),c=e=>String(e[a.key]??``).trim(),l=new Set(r.buckets.map(e=>e.key)),u=new Map;for(let e of t){if(!l.has(s(e)))continue;let t=c(e),n=u.get(t);n?n.push(e):u.set(t,[e])}let d=[...u.entries()].map(([t,r])=>{let i=M7({...e,splitBy:void 0},r,n);return{key:t,label:t||`(blank)`,data:i,weight:i.buckets.reduce((e,t)=>e+Math.abs(t.value),0)}});d.sort((e,t)=>t.weight-e.weight||e.label.localeCompare(t.label));let f=d.slice(0,12),p=Math.max(0,d.length-f.length),m=d.slice(12).reduce((e,t)=>e+t.weight,0),h=r.buckets.map(e=>e.key),g=new Map(r.buckets.map(e=>[e.key,e.label])),_=[];for(let e of f){let t=new Map(e.data.buckets.map(e=>[e.key,e]));for(let n of h){let r=t.get(n);_.push({key:n,label:g.get(n)??n,value:r?.value??0,n:r?.n??0,seriesKey:e.key,seriesLabel:e.label})}}return{...i,points:_,xOrder:h,seriesOrder:f.map(e=>e.key),omittedSeries:p,omittedSeriesValue:m}}function GGe(e,t){return{id:e,kind:`bar`,x:t.find(e=>e.type===`status`||e.type===`select`)?.key,agg:`count`,size:{w:6,h:280}}}function KGe(e){return e.filter(e=>e.type===`status`||e.type===`select`||e.type===`text`||id(e.type))}function qGe(e){return e.filter(e=>rd(e.type))}function N7(e,t,n,r){return!n||n===`auto`?t?Mp(t,e):r(e):n===`compact`?r(e):n===`number`?e.toLocaleString(void 0,{maximumFractionDigits:2}):n===`percent`?`${e.toLocaleString(void 0,{maximumFractionDigits:2})}%`:e.toLocaleString(void 0,{style:`currency`,currency:`USD`,maximumFractionDigits:0})}function JGe(e,[t,n]){return Math.max(t,Math.min(n,e))}function YGe(e){if(!Array.isArray(e))return;let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n,r=typeof e.id==`string`&&e.id?e.id:``,i=e.kind,a=e.agg;if(!r||!LGe.includes(i)||!w7.includes(a))continue;let o={id:r,kind:i,agg:a};if(typeof e.x==`string`&&e.x&&(o.x=e.x),typeof e.y==`string`&&e.y&&(o.y=e.y),typeof e.title==`string`&&e.title&&(o.title=e.title.slice(0,60)),typeof e.splitBy==`string`&&e.splitBy&&e.splitBy!==o.x&&(o.splitBy=e.splitBy),o.splitBy&&(i===`bar`||i===`area`)&&e.stacked===!0&&(o.stacked=!0),zGe.includes(e.palette)&&(o.palette=e.palette),e.axis&&typeof e.axis==`object`&&!Array.isArray(e.axis)){let t=e.axis,n={};for(let e of[`x`,`y`]){let r=t[e];if(!r||typeof r!=`object`||Array.isArray(r))continue;let i=r,a={};typeof i.label==`string`&&i.label.trim()&&(a.label=i.label.trim().slice(0,40)),BGe.includes(i.format)&&(a.format=i.format),(a.label!==void 0||a.format!==void 0)&&(n[e]=a)}(n.x||n.y)&&(o.axis=n)}if(e.size&&typeof e.size==`object`&&!Array.isArray(e.size)){let t=e.size,n={};typeof t.w==`number`&&Number.isFinite(t.w)&&(n.w=JGe(Math.round(t.w),T7)),typeof t.h==`number`&&Number.isFinite(t.h)&&(n.h=JGe(Math.round(t.h),E7)),(n.w!==void 0||n.h!==void 0)&&(o.size=n)}if(typeof e.bucket==`string`&&ed.includes(e.bucket)&&O7(o.y)&&(o.bucket=e.bucket,e.span&&typeof e.span==`object`&&!Array.isArray(e.span))){let t=e.span.lastN;if(typeof t==`number`&&Number.isFinite(t)){let e=Math.round(t);e>=1&&e<=120&&(o.span={lastN:e})}}if(e.compare===`prior_year`&&(o.bucket||i===`kpi`&&o.agg===`sum`&&O7(o.y))&&(o.compare=`prior_year`),t.push(o),t.length>=12)break}return t.length?t:void 0}var XGe={sum:`Total`,avg:`Average`,count:`Count`,min:`Lowest`,max:`Highest`},P7=50;function ZGe(){let e={stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`};return(0,H.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,"aria-hidden":!0,children:[(0,H.jsx)(`rect`,{x:`2.5`,y:`3`,width:`11`,height:`10`,rx:`1.5`,...e}),(0,H.jsx)(`path`,{d:`M5 7.5h6M5 10h4`,...e})]})}function QGe({mode:e,onMode:t,locked:n=!1,dateField:r,dateChoices:i,stackField:a,stackChoices:o,colorField:s,colorChoices:c,sizeField:l,sizeChoices:u,onPickField:d,clamped:f=!0,onClamp:p,calendarMode:m=`records`,onCalendarMode:h,calendarMetrics:g=[],metricChoices:_=[],onCalendarMetrics:v}){return(0,H.jsxs)(`span`,{className:`cg-modes`,children:[n?(0,H.jsxs)(`span`,{className:`cg-modes-locked`,title:`This view is locked as ${kf[e]}. Filters, sorts and columns are still editable — its creator or an admin can unlock it from the view menu.`,children:[(0,H.jsx)(Qp,{mode:e}),(0,H.jsxs)(`span`,{children:[`View · `,kf[e]]}),(0,H.jsx)(rm,{})]}):(0,H.jsx)(km,{label:`View · ${kf[e]}`,icon:(0,H.jsx)(Qp,{mode:e}),active:e!==`grid`,children:n=>(0,H.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`View as`}),rne.map(r=>(0,H.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`cg-viewmode`,checked:e===r,onChange:()=>{t(r),n()}}),(0,H.jsx)(Qp,{mode:r}),(0,H.jsx)(`span`,{children:kf[r]})]},r))]})}),e===`calendar`&&i.length>0&&(0,H.jsx)(sm,{className:`cg-mode-field`,ariaLabel:`Calendar date field`,value:r?.key,onChange:e=>d(`dateField`,e),fields:i.map(e=>({key:e.key,label:e.label,type:e.type}))}),e===`kanban`&&o.length>0&&(0,H.jsx)(sm,{className:`cg-mode-field`,ariaLabel:`Kanban stack field`,value:a?.key,onChange:e=>d(`stackField`,e),fields:o.map(e=>({key:e.key,label:e.label,type:e.type}))}),e===`kanban`&&p&&(0,H.jsx)(`button`,{type:`button`,className:`cg-tb-btn cg-mode-field`+(f?` is-on`:``),"aria-pressed":f,onClick:()=>p(!f&&void 0),title:f?`Cards are trimmed to a standard height. Click to let them grow to their content.`:`Cards grow to their content. Click to trim them to a standard height.`,children:f?`Short cards`:`Full cards`}),e===`calendar`&&h&&(0,H.jsx)(km,{label:`Day cells · ${m===`summary`?`Summaries`:`Records`}`,icon:(0,H.jsx)(ZGe,{}),active:m===`summary`,children:e=>(0,H.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Each day shows`}),[[`records`,`Records`,`The records that fall on that day, listed.`],[`summary`,`Summaries`,`Totals computed over that day's records.`]].map(([t,n,r])=>(0,H.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`cg-cal-mode`,checked:t===`summary`?m===`summary`:m!==`summary`,onChange:()=>{h(t),e()}}),(0,H.jsxs)(`span`,{className:`cg-check-label`,children:[n,(0,H.jsx)(`span`,{className:`cg-pop-note cg-radio-help`,children:r})]})]},t))]})}),e===`calendar`&&m===`summary`&&v&&(0,H.jsx)(km,{label:`Totals · ${g.length+1}`,icon:(0,H.jsx)(Qp,{mode:`chart`}),active:g.length>0,children:()=>(0,H.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Totals per day`}),(0,H.jsxs)(`div`,{className:`cg-pop-note`,children:[`Records is always counted — every other figure in the cell is computed over it. Up to `,4,` more.`]}),_.length===0&&(0,H.jsx)(`div`,{className:`cg-pop-note`,children:`This table has no numeric fields to total.`}),_.map(e=>{let t=g.find(t=>t.field===e.key),n=g.length>=4;return(0,H.jsxs)(`div`,{className:`cg-cal-pick`,children:[(0,H.jsxs)(`label`,{className:`cg-check-row`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:!!t,disabled:!t&&n,onChange:()=>{v(t?g.filter(t=>t.field!==e.key):[...g,{id:`cm_${e.key}`,field:e.key,agg:`sum`}])}}),(0,H.jsx)(Zp,{type:e.type,size:11}),(0,H.jsx)(`span`,{className:`cg-check-label`,children:e.label})]}),t&&(0,H.jsx)(`select`,{className:`cg-select`,value:t.agg,"aria-label":`How to total ${e.label}`,onChange:t=>v(g.map(n=>n.field===e.key?{...n,agg:t.target.value}:n)),children:w7.filter(e=>e!==`count`).map(e=>(0,H.jsx)(`option`,{value:e,children:XGe[e]},e))})]},e.key)})]})}),e===`map`&&c.length>0&&(0,H.jsx)(sm,{className:`cg-mode-field`,ariaLabel:`Colour pins by`,placeholder:`Colour: none`,value:s?.key??``,onChange:e=>d(`colorField`,e),fields:[{key:``,label:`No colour`,type:void 0},...c.map(e=>({key:e.key,label:`Colour: ${e.label}`,type:e.type}))]}),e===`map`&&u.length>0&&(0,H.jsx)(sm,{className:`cg-mode-field`,ariaLabel:`Size pins by`,placeholder:`Size: none`,value:l?.key??``,onChange:e=>d(`sizeField`,e),fields:[{key:``,label:`No size`,type:void 0},...u.map(e=>({key:e.key,label:`Size: ${e.label}`,type:e.type}))]})]})}var $Ge=(0,z.memo)(function({rows:e,fieldByKey:t,visibleKeys:n,titleKey:r,onOpen:i,onToggleGroup:a}){let o=n.filter(e=>e!==r);return(0,H.jsxs)(`div`,{className:`cg-listview`,children:[e.map((e,n)=>{if(e.kind===`group-footer`)return null;if(e.kind===`group-header`)return(0,H.jsxs)(`button`,{type:`button`,className:`cg-lv-group`,onClick:()=>a(e.groupKey),"aria-expanded":!e.collapsed,children:[(0,H.jsx)(`span`,{className:`cg-lv-chev`,children:e.collapsed?`▶`:`▼`}),(0,H.jsx)(`span`,{className:`cg-lv-group-label`,children:e.label}),(0,H.jsx)(`span`,{className:`cg-lv-count`,children:e.count.toLocaleString()})]},`g:${e.groupKey}:${n}`);let s=e.record;return(0,H.jsxs)(`button`,{type:`button`,className:`cg-lv-row`,onClick:()=>i(s.pid),children:[(0,H.jsx)(`span`,{className:`cg-lv-title`,children:String(s[r]??``)}),(0,H.jsx)(`span`,{className:`cg-lv-cells`,children:o.map(e=>{let n=t.get(e);if(!n)return null;let r=Mp(n,s[e]);return r?(0,H.jsxs)(`span`,{className:`cg-lv-cell`,children:[(0,H.jsx)(`span`,{className:`cg-lv-k`,children:n.label}),(0,H.jsx)(`span`,{className:`cg-lv-v`,children:r})]},e):null})})]},`r:${s.pid}:${n}`)}),e.length===0&&(0,H.jsx)(`div`,{className:`cg-mode-empty`,children:`No records match this view.`})]})});function eKe(e,t){let n=Number(e.slice(0,4)),r=Number(e.slice(5,7));return new Date(Date.UTC(n,r-1+t,1)).toISOString().slice(0,7)}function tKe(e){let t=Number(e.slice(0,4)),n=Number(e.slice(5,7));return new Date(Date.UTC(t,n-1,1)).toLocaleDateString(void 0,{month:`long`,year:`numeric`,timeZone:`UTC`})}function nKe(e,t,n,r){let i=e.field?r[e.field.key]:void 0;if(i)return i[t]??null;let a=[];if(e.field)for(let t of n){let n=A7(t.row[e.field.key]);n!=null&&a.push(n)}return UGe(e.agg,a,n.length)}var rKe=(0,z.memo)(function({rows:e,field:t,today:n,titleKey:r,mode:i=`records`,metrics:a,fieldByKey:o,scope:s=`customer`,onOpen:c,onSheet:l}){let u=(0,z.useMemo)(()=>e.map(e=>({pid:e.pid,title:String(e[r]??``),day:String(e[t.key]??``).slice(0,10),row:e})),[e,t.key,r]),d=(0,z.useMemo)(()=>u.filter(e=>/^\d{4}-\d{2}-\d{2}$/.test(e.day)),[u]),f=u.length-d.length,p=(0,z.useMemo)(()=>{if(n&&/^\d{4}-\d{2}/.test(n))return n.slice(0,7);let e=d.map(e=>e.day.slice(0,7)).sort();return e.length?e[e.length-1]:null},[n,d]),[m,h]=(0,z.useState)(p),g=m??p,_=(0,z.useMemo)(()=>{let e=new Map;if(!g)return e;for(let t of d){if(!t.day.startsWith(g))continue;let n=e.get(t.day)??[];n.push({pid:t.pid,title:t.title,row:t.row}),e.set(t.day,n)}return e},[d,g]),v=(0,z.useMemo)(()=>{let e=[{id:`__count__`,label:`Records`,agg:`count`}];for(let t of a??[]){let n=o?.get(t.field);n&&w7.includes(t.agg)&&e.push({id:t.id,label:n.label,field:n,agg:t.agg})}return e},[a,o]),y=(0,z.useMemo)(()=>v.filter(e=>e.field&&Zm(e.field)===`server`).map(e=>e.field.key),[v]),[b,x]=(0,z.useState)({}),[S,C]=(0,z.useState)({}),w=(0,z.useRef)(0);if((0,z.useEffect)(()=>{if(i!==`summary`||!y.length||_.size===0){x({}),C({});return}let e=[..._.entries()].map(([e,t])=>({key:e,pids:t.map(e=>e.pid)})),t=++w.current;pte({groups:e,fields:y},s).then(({payload:e})=>{t===w.current&&(x(e?.values??{}),C(e?.windows??{}))})},[i,y,_,s]),(0,z.useEffect)(()=>{if(!l)return;if(i!==`summary`||!g){l(null);return}let e=(e,t)=>({key:e,label:t,type:`text`,source:`odoo`}),t=[e(`day`,`Day`),...v.map(t=>e(`m_${t.id}`,t.label))],n=[];for(let e of[..._.keys()].sort()){let t=_.get(e)??[],r={pid:n.length+1,day:e};for(let n of v){let i=nKe(n,e,t,b);r[`m_${n.id}`]=i==null?``:n.field?Mp(n.field,i):i.toLocaleString()}n.push(r)}l({fields:t,rows:n})},[l,i,g,_,v,b]),!g)return(0,H.jsxs)(`div`,{className:`cg-mode-empty`,children:[`No dates to place on a calendar yet.`,f>0&&` ${f.toLocaleString()} record${f===1?``:`s`} carry no date.`]});let T=Number(g.slice(0,4)),E=Number(g.slice(5,7)),D=new Date(Date.UTC(T,E,0)).getUTCDate(),O=(new Date(Date.UTC(T,E-1,1)).getUTCDay()+6)%7,k=[...Array.from({length:O},()=>null),...Array.from({length:D},(e,t)=>t+1)];for(;k.length%7!=0;)k.push(null);let A=[..._.values()].reduce((e,t)=>e+t.length,0);return(0,H.jsxs)(`div`,{className:`cg-calview`,children:[(0,H.jsxs)(`div`,{className:`cg-cal-bar`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-cal-nav`,"aria-label":`Previous month`,onClick:()=>h(eKe(g,-1)),children:`‹`}),(0,H.jsx)(`span`,{className:`cg-cal-title`,children:tKe(g)}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-cal-nav`,"aria-label":`Next month`,onClick:()=>h(eKe(g,1)),children:`›`}),(0,H.jsx)(`span`,{className:`cg-cal-note`,children:i===`summary`?`Totals over ${A.toLocaleString()} record${A===1?``:`s`} placed this month · by ${t.label}`:`${A.toLocaleString()} in this month · by ${t.label}`}),f>0&&(0,H.jsxs)(`span`,{className:`cg-cal-nodate`,title:`${f.toLocaleString()} matching record${f===1?``:`s`} have no ${t.label} and are not on the calendar. They remain in the Grid and List views.`,children:[f.toLocaleString(),` without a date`]}),i===`summary`&&v.filter(e=>e.field&&S[e.field.key]?.label).map(e=>(0,H.jsxs)(`span`,{className:`cg-cal-window`,children:[e.label,` · `,S[e.field.key].label,`, as of each day`]},e.id))]}),(0,H.jsxs)(`div`,{className:`cg-cal-grid`,children:[[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`].map(e=>(0,H.jsx)(`div`,{className:`cg-cal-dow`,children:e},e)),k.map((e,t)=>{let r=e?`${g}-${String(e).padStart(2,`0`)}`:``,a=e?_.get(r)??[]:[];return(0,H.jsxs)(`div`,{className:`cg-cal-cell`+(e?``:` is-blank`)+(r===n?` is-today`:``),children:[e&&(0,H.jsx)(`div`,{className:`cg-cal-day`,children:e}),i===`summary`?e&&a.length>0&&v.map(e=>{let t=nKe(e,r,a,b);return(0,H.jsxs)(`div`,{className:`cg-cal-metric`,children:[(0,H.jsx)(Zp,{type:e.field?e.field.type:`int`,size:11}),(0,H.jsx)(`span`,{className:`cg-cal-metric-k`,children:e.label}),(0,H.jsx)(`span`,{className:`cg-cal-metric-v`,children:t==null?`—`:e.field?Mp(e.field,t):t.toLocaleString()})]},e.id)}):a.map(e=>(0,H.jsx)(`button`,{type:`button`,className:`cg-cal-chip`,title:e.title,onClick:()=>c(e.pid),children:e.title},e.pid))]},t)})]})]})}),iKe=(0,z.memo)(function({rows:e,field:t,fieldByKey:n,cardKeys:r,titleKey:i,canMove:a,readOnlyReason:o,clamped:s=!0,onMove:c,onOpen:l}){let[u,d]=(0,z.useState)(new Set),f=(0,z.useMemo)(()=>{let n=t.type===`select`?[...Qu(t)]:[],r=new Map(n.map(e=>[e,[]])),i=[];for(let a of e){let e=String(a[t.key]??``).trim();if(e===``){i.push(a);continue}let o=r.get(e);o||(o=[],r.set(e,o),n.push(e)),o.push(a)}let o=n.map(e=>({key:e,label:e,rows:r.get(e)}));return(i.length||a)&&o.push({key:``,label:`(empty)`,rows:i}),o},[e,t,a]),p=e=>t=>{t.preventDefault();let n=Number(t.dataTransfer.getData(`text/plain`));Number.isFinite(n)&&n>0&&c(n,e)},m=(0,z.useRef)(!1);return(0,H.jsxs)(`div`,{className:`cg-kbview`+(s?` is-clamped`:``),children:[o&&(0,H.jsx)(`div`,{className:`cg-kb-note`,children:o}),(0,H.jsx)(`div`,{className:`cg-kb-lanes`,children:f.map(e=>{let o=u.has(e.key),s=o?e.rows:e.rows.slice(0,P7),c=e.key?xp(t,e.key):void 0;return(0,H.jsxs)(`div`,{className:`cg-kb-lane`,onDragOver:a?e=>e.preventDefault():void 0,onDrop:a?p(e.key):void 0,children:[(0,H.jsxs)(`div`,{className:`cg-kb-head`,children:[(0,H.jsx)(`span`,{className:`cg-kb-pill`,style:c?{background:c.bg,color:c.fg}:void 0,children:e.label}),(0,H.jsx)(`span`,{className:`cg-kb-count`,children:e.rows.length.toLocaleString()})]}),(0,H.jsxs)(`div`,{className:`cg-kb-cards`,children:[s.map(e=>(0,H.jsxs)(`div`,{className:`cg-kb-card`+(a?` is-draggable`:``),draggable:a,role:`button`,tabIndex:0,"aria-label":`Open ${String(e[i]??`record`)}`,onClick:()=>{m.current||l(e.pid)},onKeyDown:t=>{t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),l(e.pid))},onDragStart:a?t=>{m.current=!0,t.dataTransfer.setData(`text/plain`,String(e.pid))}:void 0,onDragEnd:a?()=>{window.setTimeout(()=>{m.current=!1},0)}:void 0,children:[(0,H.jsx)(`span`,{className:`cg-kb-title`,children:String(e[i]??``)}),r.map(t=>{let r=n.get(t);if(!r)return null;let i=Mp(r,e[t]);return i?(0,H.jsxs)(`div`,{className:`cg-kb-cell`,children:[(0,H.jsx)(`span`,{className:`cg-lv-k`,children:r.label}),(0,H.jsx)(`span`,{className:`cg-lv-v`,children:i})]},t):null})]},e.pid)),e.rows.length>P7&&!o&&(0,H.jsxs)(`button`,{type:`button`,className:`cg-link-btn cg-kb-more`,onClick:()=>d(t=>new Set(t).add(e.key)),children:[`Showing first `,P7,` — show all`,` `,e.rows.length.toLocaleString()]})]})]},e.key||`(empty)`)})})]})});function aKe(e){let{label:t,value:n}=e,r=e.prior??null,i={label:t,value:n,format:e.format??`auto`,delta:null,prior:r,dir:`off`};if(n===0&&r!=null&&r!==0)return{...i,note:`no orders yet`};if(r==null)return i;if(r===0||!Number.isFinite(r)||!Number.isFinite(n))return{...i,note:`no comparable prior period`};let a=(n-r)/Math.abs(r)*100;return{...i,delta:a,dir:a>0?`up`:a<0?`down`:`flat`,deltaLabel:e.deltaLabel??`vs prior`}}function oKe(e){let{rows:t,fieldByKey:n,groupBy:r,columns:i}=e,a=e.sort??`first-desc`,o={columns:i,rows:[],total:0,shown:0,blanks:0};if(!n.has(r))return{...o,problem:`The field this table grouped by no longer exists.`};if(i.length===0)return{...o,problem:`This table has no columns to aggregate.`};let s=i.map(e=>M7({id:`gt-${e.key}`,kind:`bar`,x:r,y:e.y,agg:e.agg,size:void 0},t,n,{maxBuckets:2**53-1})),c=s.find(e=>e.problem)?.problem;if(c)return{...o,problem:c};let l=s[0],u=s.map(e=>new Map(e.buckets.map(e=>[e.key,e]))),d=l.buckets.map(e=>({key:e.key,label:e.label,n:e.n,values:i.map((t,n)=>u[n].get(e.key)?.value??null)}));d.sort((e,t)=>{if(a===`label`)return e.label.localeCompare(t.label);let n=e.values[0],r=t.values[0];return n==null||r==null?n==null?r==null?0:1:-1:a===`first-asc`?n-r:r-n});let f=e.limit??d.length;return{columns:i,rows:d.slice(0,Math.max(0,f)),total:d.length,shown:Math.min(d.length,Math.max(0,f)),blanks:l.blanks}}function sKe(e,t,n){let r={columns:[],rows:[],total:0,shown:0,blanks:0};if(!e.x)return{...r,problem:`Choose a field to group by.`};let i=e.y?n.get(e.y):void 0;if(e.agg!==`count`&&!e.y)return{...r,problem:`Choose a number field to measure, or switch to Count.`};let a=[];return e.agg!==`count`&&e.y&&a.push({key:`measure`,label:`${RGe[e.agg]} ${i?.label??e.y}`,agg:e.agg,y:e.y,format:e.axis?.y?.format}),a.push({key:`n`,label:`Records`,agg:`count`}),oKe({rows:t,fieldByKey:n,groupBy:e.x,columns:a,sort:`first-desc`,limit:25})}function cKe(e){let{values:t,back:n}=e,r=t.length?t[t.length-1]:null;if(r==null||!Number.isFinite(r))return null;let i=t.length-1-n,a=i>=0?t[i]:null;return aKe({label:e.label,value:r,prior:a,format:e.format,deltaLabel:`vs last year`})}var lKe=(0,z.lazy)(()=>Tc(()=>Promise.resolve().then(()=>(mWe(),fWe)),void 0,import.meta.url)),F7=6;function I7(e,[t,n]){return Math.max(t,Math.min(n,e))}var uKe={brand:`Brand`,categorical:`Distinct categories`,sequential:`Low to high`,diverging:`Below / above a midpoint`},dKe={auto:`Automatic`,number:`Plain number`,currency:`Currency`,percent:`Percent`,compact:`Compact (1.2k)`};function L7(e,t,n){let r={...e.axis?.[t]??{},...n};r.label?.trim()||delete r.label,r.format===`auto`&&delete r.format;let i={...e.axis??{}};return r.label===void 0&&r.format===void 0?delete i[t]:i[t]=r,{...e,axis:i.x||i.y?i:void 0}}var fKe={bar:`Bar`,line:`Line`,area:`Area`,donut:`Donut`,kpi:`Single number`,table:`Table`},pKe=RGe,mKe={week:`Weekly`,month:`Monthly`,quarter:`Quarterly`,year:`Yearly`},hKe=[6,12,24,36];function gKe(e){let t=e.span?.lastN??12;return e.compare===`prior_year`?t+(Qm[e.bucket]??12):t}function _Ke(e){return`${e.bucket}|${gKe(e)}`}var R7=`month`,vKe=Qm.month+1;function yKe(e){return e.kind===`kpi`&&e.compare===`prior_year`&&e.agg===`sum`&&O7(e.y)}function bKe(){return`${R7}|${vKe}`}function z7(e){if(!Number.isFinite(e))return`—`;let t=Math.abs(e);return t>=1e9?(e/1e9).toFixed(1)+`B`:t>=1e6?(e/1e6).toFixed(1)+`M`:t>=1e3?(e/1e3).toFixed(1)+`k`:Number.isInteger(e)?e.toLocaleString():e.toFixed(2)}function xKe({spec:e,data:t,fields:n,yField:r,onChange:i,onRemove:a,canPeriod:o,table:s,kpiCompare:c}){let[l,u]=(0,z.useState)(!1),d=(0,z.useMemo)(()=>KGe(n),[n]),f=(0,z.useMemo)(()=>qGe(n),[n]),p=k7(e)?mKe[e.bucket]:void 0,m=p?`Period`:e.x?n.find(t=>t.key===e.x)?.label:void 0,h=p?`, ${p.toLowerCase()}`:m?` by ${m}`:``,g=e.agg===`count`?`Count of records${h}`:`${pKe[e.agg]} ${r?.label??`…`}${h}`,_=(0,z.useMemo)(()=>oh({spec:e,model:t,xTitle:e.axis?.x?.label??m,yTitle:e.axis?.y?.label??(e.agg===`count`?`Records`:r?.label),formatValue:t=>N7(t,r,e.axis?.y?.format,z7)}),[t,e,m,r]);return(0,H.jsxs)(`div`,{className:`cg-ch-card`,style:{gridColumn:`span ${e.size?.w??F7}`,height:e.size?.h?`${e.size.h}px`:void 0},children:[(0,H.jsxs)(`div`,{className:`cg-ch-head`,children:[(0,H.jsx)(`span`,{className:`cg-ch-title`,title:e.title||g,children:e.title||g}),(0,H.jsx)(`button`,{type:`button`,className:`cg-icon-btn cg-ch-cfg`,"aria-label":`Configure this chart`,"aria-expanded":l,onClick:()=>u(e=>!e),children:(0,H.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M3 4.5h10M3 8h10M3 11.5h10`,stroke:`currentColor`,strokeWidth:1.3,strokeLinecap:`round`})})}),(0,H.jsx)(`button`,{type:`button`,className:`cg-icon-btn cg-ch-del`,"aria-label":`Remove this chart`,onClick:a,children:(0,H.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`,stroke:`currentColor`,strokeWidth:1.3,strokeLinecap:`round`})})})]}),l&&(0,H.jsxs)(`div`,{className:`cg-ch-cfgbody`,children:[(0,H.jsxs)(`div`,{className:`cg-ch-row cg-ch-kindrow`,role:`radiogroup`,"aria-label":`Chart type`,children:[(0,H.jsx)(`span`,{children:`Chart`}),(0,H.jsx)(`div`,{className:`cg-ch-kinds`,children:LGe.map(t=>(0,H.jsxs)(`label`,{className:`cg-ch-kind`+(e.kind===t?` is-on`:``),title:fKe[t],children:[(0,H.jsx)(`input`,{type:`radio`,name:`cg-ch-kind-${e.id}`,checked:e.kind===t,onChange:()=>i({...e,kind:t})}),(0,H.jsx)(Pre,{kind:t}),(0,H.jsx)(`span`,{children:fKe[t]})]},t))})]}),(0,H.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,H.jsx)(`span`,{children:`Show`}),(0,H.jsx)(`select`,{className:`cg-select`,value:e.agg,onChange:t=>{let n=t.target.value;i({...e,agg:n,...e.kind===`kpi`&&n!==`sum`?{compare:void 0}:{}})},children:w7.map(e=>(0,H.jsx)(`option`,{value:e,children:pKe[e]},e))})]}),e.agg!==`count`&&(0,H.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,H.jsx)(`span`,{children:`Which number`}),(0,H.jsxs)(`select`,{className:`cg-select`,value:e.y??``,onChange:t=>i({...e,y:t.target.value||void 0,...O7(t.target.value)?{}:{bucket:void 0,span:void 0,compare:void 0}}),children:[(0,H.jsx)(`option`,{value:``,children:`Choose a number…`}),f.map(e=>(0,H.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]}),o&&O7(e.y)&&D7.includes(e.kind)&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,H.jsx)(`span`,{children:`Over time`}),(0,H.jsxs)(`select`,{className:`cg-select`,value:e.bucket??``,onChange:t=>i({...e,bucket:t.target.value||void 0,span:t.target.value?e.span:void 0,compare:t.target.value?e.compare:void 0}),children:[(0,H.jsx)(`option`,{value:``,children:`No — group by a field`}),ed.map(e=>(0,H.jsx)(`option`,{value:e,children:mKe[e]},e))]})]}),!!e.bucket&&(0,H.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,H.jsx)(`span`,{children:`How far back`}),(0,H.jsx)(`select`,{className:`cg-select`,value:String(e.span?.lastN??12),onChange:t=>i({...e,span:{lastN:Number(t.target.value)}}),children:hKe.map(e=>(0,H.jsxs)(`option`,{value:e,children:[`Last `,e]},e))})]}),!!e.bucket&&(0,H.jsxs)(`label`,{className:`cg-ch-row cg-ch-check`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:e.compare===`prior_year`,onChange:t=>i({...e,compare:t.target.checked?`prior_year`:void 0})}),(0,H.jsx)(`span`,{children:`Compare to the year before`})]})]}),e.kind===`kpi`&&o&&e.agg===`sum`&&O7(e.y)&&(0,H.jsxs)(`label`,{className:`cg-ch-row cg-ch-check`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:e.compare===`prior_year`,onChange:t=>i({...e,compare:t.target.checked?`prior_year`:void 0})}),(0,H.jsx)(`span`,{children:`Compare to the year before`})]}),e.kind!==`kpi`&&!(o&&e.bucket&&D7.includes(e.kind))&&(0,H.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,H.jsx)(`span`,{children:`Grouped by`}),(0,H.jsxs)(`select`,{className:`cg-select`,value:e.x??``,onChange:t=>i({...e,x:t.target.value||void 0}),children:[(0,H.jsx)(`option`,{value:``,children:`Choose a field…`}),d.map(e=>(0,H.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]}),(0,H.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,H.jsx)(`span`,{children:`Title`}),(0,H.jsx)(`input`,{className:`cg-input`,value:e.title??``,placeholder:g,maxLength:60,onChange:t=>i({...e,title:t.target.value||void 0})})]}),e.kind!==`kpi`&&e.kind!==`donut`&&e.kind!==`table`&&!(o&&e.bucket&&D7.includes(e.kind))&&(0,H.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,H.jsx)(`span`,{children:`Break down by`}),(0,H.jsxs)(`select`,{className:`cg-select`,value:e.splitBy??``,onChange:t=>i({...e,splitBy:t.target.value||void 0,stacked:t.target.value?e.stacked:void 0}),children:[(0,H.jsx)(`option`,{value:``,children:`Don't break it down`}),d.filter(t=>t.key!==e.x).map(e=>(0,H.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]}),!!e.splitBy&&(e.kind===`bar`||e.kind===`area`)&&(0,H.jsxs)(`label`,{className:`cg-ch-row cg-ch-check`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:e.stacked===!0,onChange:t=>i({...e,stacked:t.target.checked||void 0})}),(0,H.jsx)(`span`,{children:`Stack them on top of each other`})]}),e.kind!==`table`&&(0,H.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,H.jsx)(`span`,{children:`Colours`}),(0,H.jsxs)(`select`,{className:`cg-select`,value:e.palette??``,onChange:t=>i({...e,palette:t.target.value||void 0}),children:[(0,H.jsx)(`option`,{value:``,children:`Default`}),zGe.map(e=>(0,H.jsx)(`option`,{value:e,children:uKe[e]},e))]})]}),e.kind!==`kpi`&&e.kind!==`table`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,H.jsx)(`span`,{children:`Bottom axis label`}),(0,H.jsx)(`input`,{className:`cg-input`,value:e.axis?.x?.label??``,placeholder:m??`Category`,maxLength:40,onChange:t=>i(L7(e,`x`,{label:t.target.value}))})]}),(0,H.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,H.jsx)(`span`,{children:`Side axis label`}),(0,H.jsx)(`input`,{className:`cg-input`,value:e.axis?.y?.label??``,placeholder:r?.label??`Value`,maxLength:40,onChange:t=>i(L7(e,`y`,{label:t.target.value}))})]})]}),(0,H.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,H.jsx)(`span`,{children:`Number format`}),(0,H.jsx)(`select`,{className:`cg-select`,value:e.axis?.y?.format??`auto`,onChange:t=>i(L7(e,`y`,{format:t.target.value})),children:BGe.map(e=>(0,H.jsx)(`option`,{value:e,children:dKe[e]},e))})]})]}),e.kind===`table`?!s||s.problem?(0,H.jsx)(`div`,{className:`cg-ch-empty`,children:s?.problem??`Choose a field to group by.`}):s.rows.length===0?(0,H.jsx)(`div`,{className:`cg-ch-empty`,children:`No records match this view, so there is nothing to list.`}):(0,H.jsx)(`div`,{className:`cg-ch-viz cg-ch-viz--table`,children:(0,H.jsx)(SKe,{table:s,xLabel:m??`Group`,yField:r})}):t.pending?(0,H.jsx)(`div`,{className:`cg-ch-empty`,children:(0,H.jsx)(`span`,{className:`lp-spin`,role:`status`,"aria-label":`Loading`})}):t.problem?(0,H.jsx)(`div`,{className:`cg-ch-empty`,children:t.problem}):t.points.length===0?(0,H.jsx)(`div`,{className:`cg-ch-empty`,children:`No records match this view, so there is nothing to chart.`}):(0,H.jsx)(`div`,{className:`cg-ch-viz cg-ch-viz--${e.kind}`,children:(0,H.jsx)(z.Suspense,{fallback:(0,H.jsx)(`div`,{className:`cg-ch-loading`,children:(0,H.jsx)(`span`,{className:`lp-spin`,role:`status`,"aria-label":`Loading`})}),children:(0,H.jsx)(lKe,{spec:_,label:e.title||g})})}),e.kind===`kpi`&&c&&(0,H.jsx)(`div`,{className:`cg-ch-kpidelta is-${c.dir}`,title:c.prior==null?void 0:`This period ${N7(c.value,r,e.axis?.y?.format,z7)} · a year earlier ${N7(c.prior,r,e.axis?.y?.format,z7)} (month-end anchored)`,children:c.delta==null?(0,H.jsx)(`span`,{children:c.note}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 14 14`,"aria-hidden":!0,children:c.dir===`up`?(0,H.jsx)(`path`,{d:`M3 9.5l4-5 4 5z`,fill:`currentColor`}):c.dir===`down`?(0,H.jsx)(`path`,{d:`M3 4.5l4 5 4-5z`,fill:`currentColor`}):(0,H.jsx)(`path`,{d:`M3 7h8`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`})}),(0,H.jsxs)(`span`,{children:[Math.abs(c.delta).toFixed(1),`% `,c.deltaLabel]})]})}),(0,H.jsxs)(`div`,{className:`cg-ch-foot`,children:[(0,H.jsxs)(`span`,{children:[t.rows.toLocaleString(),` records`]}),e.kind===`table`&&s&&!s.problem?(0,H.jsxs)(H.Fragment,{children:[s.shown0&&(0,H.jsxs)(`span`,{children:[`· `,s.blanks.toLocaleString(),` with no value grouped as blank`]})]}):(0,H.jsxs)(H.Fragment,{children:[t.omitted>0&&(0,H.jsxs)(`span`,{title:`The ${t.omitted.toLocaleString()} smallest groups are not drawn. Together they account for ${z7(t.omittedValue)}.`,children:[`· top `,12,` of `,(t.xOrder.length+t.omitted).toLocaleString(),` groups shown (+`,z7(t.omittedValue),` not drawn)`]}),t.omittedSeries>0&&(0,H.jsxs)(`span`,{title:`${t.omittedSeries.toLocaleString()} smaller series are not drawn. Together they account for ${z7(t.omittedSeriesValue)}.`,children:[`· `,t.omittedSeries.toLocaleString(),` series not drawn`]}),t.nonPositive>0&&(0,H.jsxs)(`span`,{title:`Donut slices require positive values. These groups have a combined value of ${z7(t.nonPositiveValue)} and are not included in the circle.`,children:[`· `,t.nonPositive.toLocaleString(),` zero/negative group`,t.nonPositive===1?``:`s`,` not drawn`]}),t.blanks>0&&(0,H.jsxs)(`span`,{children:[`· `,t.blanks.toLocaleString(),` with no value grouped as blank`]}),t.missingY>0&&(0,H.jsxs)(`span`,{title:`These records carry no number for the measured field, so they are counted in the group but excluded from the aggregate.`,children:[`· `,t.missingY.toLocaleString(),` not measurable`]})]})]}),(0,H.jsx)(`button`,{type:`button`,className:`cg-ch-resize`,"aria-label":`Resize ${e.title||g}`,title:`Drag to resize · arrow keys also work`,onPointerDown:t=>{t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId);let n=t.currentTarget.parentElement,r=n?.parentElement;if(!n||!r)return;let a=t.clientX,o=t.clientY,s=e.size?.w??F7,c=e.size?.h??n.getBoundingClientRect().height,l=Math.max(1,r.getBoundingClientRect().width/12),u=t=>{let n=I7(Math.round(s+(t.clientX-a)/l),T7),r=I7(Math.round(c+(t.clientY-o)),E7);i({...e,size:{w:n,h:r}})},d=()=>{window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d)};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d)},onKeyDown:t=>{let n=t.key===`ArrowRight`?1:t.key===`ArrowLeft`?-1:0,r=t.key===`ArrowDown`?20:t.key===`ArrowUp`?-20:0;!n&&!r||(t.preventDefault(),i({...e,size:{w:I7((e.size?.w??F7)+n,T7),h:I7((e.size?.h??260)+r,E7)}}))},children:(0,H.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M9 3.5L3.5 9M9 7L7 9`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinecap:`round`})})})]})}function SKe({table:e,xLabel:t,yField:n}){return(0,H.jsx)(`div`,{className:`cg-ch-table`,children:(0,H.jsxs)(`table`,{children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:t}),e.columns.map(e=>(0,H.jsx)(`th`,{className:`cg-ch-td-num`,children:e.label},e.key))]})}),(0,H.jsx)(`tbody`,{children:e.rows.map(t=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{title:t.label,children:t.label}),t.values.map((t,r)=>{let i=e.columns[r];return(0,H.jsx)(`td`,{className:`cg-ch-td-num`,children:t==null?`—`:i.agg===`count`?t.toLocaleString():N7(t,i.y?n:void 0,i.format,z7)},i.key)})]},t.key||`(blank)`))})]})})}function CKe({rows:e,fields:t,fieldByKey:n,charts:r,onCharts:i,scope:a}){let o=(0,z.useMemo)(()=>r.map(t=>WGe(t,e,n)),[r,e,n]),s=(0,z.useMemo)(()=>r.map(t=>t.kind===`table`?sKe(t,e,n):null),[r,e,n]),c=(0,z.useMemo)(()=>e.map(e=>Number(e.pid)).filter(Number.isFinite),[e]),l=(0,z.useMemo)(()=>r.filter(k7),[r]),u=(0,z.useMemo)(()=>r.filter(yKe),[r]),d=(0,z.useMemo)(()=>{let e=new Map,t=(t,n,r,i)=>{let a=e.get(t)??{bucket:n,lastN:r,fields:[]};i&&!a.fields.includes(i)&&a.fields.push(i),e.set(t,a)};for(let e of l)t(_Ke(e),e.bucket,gKe(e),e.y);for(let e of u)t(bKe(),R7,vKe,e.y);return e},[l,u]),f=(0,z.useMemo)(()=>JSON.stringify([...d.entries()].map(([e,t])=>[e,[...t.fields].sort()])),[d]),[p,m]=(0,z.useState)({}),[h,g]=(0,z.useState)(!1),_=(0,z.useRef)(0);(0,z.useEffect)(()=>{if(!a||!d.size||!c.length){m({}),g(!1);return}let e=++_.current;g(!0),Promise.all([...d.entries()].map(([e,t])=>ef(Wm({pids:c,bucket:t.bucket,span:{lastN:t.lastN},fields:t.fields}),a).then(({payload:t})=>[e,t]))).then(t=>{e===_.current&&(m(Object.fromEntries(t)),g(!1))})},[a,f,c,d]);let v=(e,t)=>{if(!k7(e))return t;if(!a)return{...t,points:[],problem:`This chart is a trend over periods, but the host has not said which surface this view is, so it cannot be loaded.`};let n=p[_Ke(e)];if(!n)return h?{...t,points:[],pending:!0}:{...t,points:[],problem:`The periods could not be loaded, so nothing is drawn rather than a guess.`};let r=Xm(n),i=r.rows.find(t=>t.field===e.y);return i?e.compare===`prior_year`?Hie(i,r.columns,e.bucket,e.span?.lastN??12):rh(i,r.columns):{...t,points:[],problem:`The server returned no series for this metric — a composite metric has no single aggregate to bucket.`}},y=e=>{if(!yKe(e))return;if(!a)return null;let t=p[bKe()];if(!t)return null;let n=Xm(t).rows.find(t=>t.field===e.y);return n?cKe({label:e.title??``,values:n.cells.map(e=>e.value),back:Qm[R7],format:e.axis?.y?.format}):null};return(0,H.jsxs)(`div`,{className:`cg-dashview`,children:[(0,H.jsxs)(`div`,{className:`cg-dash-bar`,children:[(0,H.jsxs)(`span`,{className:`cg-cal-note`,children:[e.length.toLocaleString(),` records · every chart describes exactly this view's rows, so filters and cohort scope already apply`]}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary cg-dash-add`,disabled:r.length>=12,title:r.length>=12?`A view holds at most 12 charts.`:void 0,onClick:()=>{let e=`ch_${Math.random().toString(36).slice(2,10)}`;i([...r,GGe(e,t)])},children:`+ Add chart`})]}),r.length===0?(0,H.jsx)(`div`,{className:`cg-mode-empty`,children:`No charts on this view yet. "+ Add chart" builds one from the records this view already matches.`}):(0,H.jsx)(`div`,{className:`cg-dash-grid`,children:r.map((e,c)=>(0,H.jsx)(xKe,{spec:e,data:v(e,o[c]),fields:t,yField:e.y?n.get(e.y):void 0,canPeriod:!!a,table:s[c],kpiCompare:y(e),onChange:t=>i(r.map(n=>n.id===e.id?t:n)),onRemove:()=>i(r.filter(t=>t.id!==e.id))},e.id))})]})}var wKe=`M465.85,1189.44l3.99,2.28 0.83,2.79 11.82,12.37 1.25,5.21 -0.42,1.67 0.93,0.27 1.84,-1.87 5.28,-3.59 2.67,-0.04 1.27,-2.84 0.01,-4 1.34,0.06 0.8,-0.54 0.35,-1.18 -0.85,-1.61 4.41,-1.31 5.21,-2.94 2.45,2.22 2.39,2.61 -0.23,3.08 1.45,3.42 5.72,4.51 1.64,4.13 5.42,4.24 4.77,6.42 -0.24,1.6 3.44,5.6 10.1,18.69 -1.2,2.5 3.48,1.11 -0.82,3.54 2.71,1.33 -0.23,1.05 0.6,1.19 0.1,1.96 2.84,-0.18 5.6,4 3.88,1.31 1.05,1.58 1.96,0.68 0.73,2.21 2.26,0.81 1.33,-0.54 0.85,1.93 0.1,1.3 -1.51,6 1.25,7.15 -1.54,3.21 -0.48,2.21 -4.11,5.07 -3.12,-0.75 -2.23,-7.37 0.7,-1.29 2.69,-1.48 -1.23,-0.74 -0.71,-7.66 -2.38,-4.54 -0.15,-0.76 1.23,-1.85 -8.55,4.31 -0.48,0.83 0.26,1.4 -1.61,4.28 -0.44,0.38 -1.54,-0.7 -1.19,-3.05 0.18,-0.65 2.3,-3.58 1.84,-4.69 3.33,-0.95 -3.83,-0.71 -1.53,-2.84 -1.82,-0.84 -1.4,-2.04 -0.6,-2.19 -1.34,-0.49 -0.13,-2.42 -1.73,-0.63 -1.85,-2.05 -0.42,-1.36 0.16,-2 -1.01,0.18 -6.28,-2.61 0.33,-3.47 -1.17,-4.59 -1.25,-1.87 0.52,-1.12 0.56,-0.01 4.97,2.74 -4.53,-4.44 -0.22,-1.24 0.27,-1.01 3.6,0.06 -4.15,-1.01 -1.11,1.79 -0.74,-0.07 -3.52,-4.89 -0.36,-2.99 0.2,-1.69 1.92,-4.97 -0.76,0.43 -2.14,4.75 -0.88,1.01 -3.15,-2.91 -2.02,-0.38 -1.28,-1.5 -1.9,-4.2 -0.49,-2.61 -1.66,-1.7 -0.97,-5.16 -1.29,-3.6 -0.38,-4.03 -0.56,2.26 -0.81,0.22 0.96,2.24 -1.17,0.12 1.33,2.55 0.59,3.93 3.09,12.43 0.14,0.74 -0.46,1.32 -2.41,-0.22 -1.68,-2.6 -1.39,-0.78 -3.7,0.25 0.41,-3.85 -2.1,-4.64 0.03,-0.71 2.47,-1.68 -2.17,0.53 -1.51,-3.85 -0.11,2.24 0.41,1.18 -0.01,1.62 -1.16,1.19 -2.56,-1.78 -1.31,-2.08 -4.81,-2.07 0.47,2.2 -1.27,1.35 2.05,-0.17 3.02,1.59 0.91,1.51 1.41,0.87 -0.84,1.82 2.95,0.33 1.85,3.26 0.07,1.49 -0.29,0.43 -4.34,0.79 -1.65,1.82 -10.66,-7.33 -0.23,-0.97 -3.4,-3.5 -1.86,-3.43 -3.7,-3.22 -2.37,-0.93 0.52,-0.82 -4.21,-1.58 -10.4,-6.91 2.13,-1.44 1.12,-1.97 -0.78,-3.4 0.14,-1.45 0.65,-0.94 0.74,-0.07 1.32,1.81 0.51,6.01 0.75,-4.72 2.64,-0.34 -2.89,-1.31 -2.15,-2.71 -1,-0.11 -4.52,4.8 -3.41,1.78 -2.32,0.36 -4.81,-0.86 -6.43,-3.48 1.34,-2.31 -0.45,-1.79 -0.9,-0.8 -0.01,1.72 -0.42,0.52 -2.54,1.13 -10,-2.64 -4.51,-0.25 -9.78,1.91 -3.89,-0.08 -0.16,-0.67 0.87,-0.39 -0.05,-0.48 -1.1,-1.52 -5.21,-1.69 -2.94,-2.54 0.88,-4.58 1.52,-3.14 -6.34,6.69 -7.41,-2.26 2.55,-4.01 -5.39,-0.22 -0.38,-1.72 -0.78,-0.33 -2.87,1.12 -0.77,-0.66 2.03,-1.91 -2.8,-2.01 0.03,-2.24 0.42,-1.43 3.57,-1.39 -3.39,-0.36 -3.31,2.89 -1.21,0.64 -2.44,-0.45 -1.9,1.93 -2.34,-1.88 -1,2 -1.73,0.56 -0.95,-0.1 -1.14,-1.37 0.23,-1.66 2.49,-4.71 -3.38,3.22 -3.33,0.52 -0.78,1.15 2.29,-0.43 -1.54,4.13 -2.41,0.62 -0.01,0.56 3.42,2.97 -0.55,2.13 -2.33,0.42 -1.48,1.76 5.92,-1.99 0.78,0.19 0.99,1.9 -0.93,1.31 -1.55,0.81 -0.39,1.61 0.21,3.56 -1.54,1.05 -1.11,3.02 -3.64,0.94 -2.89,-0.73 -1.33,-1.22 -1.65,0.81 -1.47,-2.45 -0.42,2.38 -1.33,2.43 -0.55,2.8 -1.32,-3.38 -0.92,1.45 0.14,2.39 -2.54,-0.77 0.44,2.13 -2.63,2.78 -1.59,-0.34 -1.68,1.04 -1.39,-0.63 -0.17,1.88 -0.62,1.18 -2,1.9 -0.93,2.06 -2.82,-1.15 0.13,1.42 -2.22,-0.19 -4.23,1.27 -2.41,-1.7 0.2,-1.73 0.94,-1.42 5.12,-2.47 2.39,-2.72 1.63,-3.03 -0.49,-0.4 -4.11,3.14 -3.57,-1.12 -0.6,-0.47 -0.41,-1.38 1.35,-4.68 3.85,-6.53 0.95,-4.42 -0.48,-4.48 -0.02,-1.47 0.39,-0.46 10.02,-6.56 1.05,0.02 2.69,2.1 5.47,-0.44 6.34,1.76 -0.77,-1.38 -5.12,-1.37 -5.24,-4.17 1.79,-1.43 1.81,-3.12 4.64,-3.19 -1.19,-0.08 -2.98,0.72 -1.46,1.36 -1.73,3.18 -5.64,0.46 -1.09,-1.11 -4.3,2.57 -2.33,2.65 -5.05,2.5 -1.6,1.61 -0.57,1.81 0.39,1.83 -2.8,1.69 -3.12,3.57 -0.39,1.74 0.51,1 -1.24,1.68 -3.24,2.25 -4.22,-1.31 4.09,3.9 0.4,0.95 -0.34,1.97 -1.13,1.74 -5.14,1.77 2.12,1.1 -0.27,1.44 -0.52,0.48 -3.07,1.11 -0.03,-1.58 -0.54,-0.23 -2.71,2.1 -0.21,0.27 0.7,0.45 -1.63,2.36 -3.82,3.28 0.23,0.6 -1.26,4.02 0.56,0.79 5.38,1.8 2.71,1.74 1.04,1.67 -1.26,2.84 -2.04,2.2 -2.79,1.46 -1.79,2.07 -0.75,2.76 -2.32,1.33 0.93,0.34 -0.45,2.79 -3.68,0.9 -0.16,1.34 -4.8,0.85 -1.6,2.88 -5.04,3.16 -0.06,0.7 -2.08,2.82 -2.53,0.49 -0.42,0.39 -0.2,1.67 -2.13,-0.03 -2.2,1.88 -0.49,0.68 0.92,1.84 -0.03,0.75 -0.85,2.09 -1.33,0.84 -0.42,1.15 -1.72,0.09 -4.08,3.74 -3.43,0.75 -1.57,3.23 -3.31,-0.22 -2.38,1.92 1.69,0.65 -5.51,1.75 -1.57,2.53 1.89,0.23 1.25,2.15 -2.28,2.47 -0.53,0.06 -0.22,-1.92 -0.56,-0.37 -1.29,2.89 -0.97,1.14 -8.34,3.59 -0.5,2.32 -1.05,1.4 -0.22,-4.01 -1.05,-0.34 -6.85,4.17 -1.44,1.97 -1.43,-0.31 -1.65,1.39 -1.44,-0.61 -3.2,2.5 -3.25,0.13 -0.15,-1.65 0.72,-1.43 2.41,-0.15 -1.77,-1.38 -1.81,-0.13 -1.57,1.11 -0.99,3.46 -3.78,5.03 -1.06,-0.09 -1.22,1.4 -1.28,0.42 -0.81,-0.51 0.52,-0.58 -0.94,-2.02 -0.54,-0.68 -1,-0.08 0.13,4.14 -0.63,0.83 -2.17,0.84 -1.49,-1.83 -1.41,-0.36 0.22,1.81 -0.35,1.13 -2.32,1.53 0.64,-5.6 1.87,-1.44 2.37,-0.03 8.52,-10.52 5.23,-3.8 5.48,-2.32 0.43,0.14 -0.5,0.76 0.34,0.47 3.34,-0.8 0.24,0.47 -0.28,0.59 -1.21,0.6 0.04,0.5 2.3,2.69 0.65,-0.35 -0.14,-1.68 0.59,-0.32 2,0.14 1.06,0.95 1.66,0.23 0.24,-0.55 -0.43,-0.65 -1.95,-1.44 -0.68,-1.44 2.7,-6.29 5.88,-5.09 5.71,-2.63 4.16,-4.02 0.26,1.37 2.5,0.44 0.16,-5.09 3.87,-5.43 2.13,-1.44 3.28,-3.42 1.23,-0.43 2.3,1.38 0.83,-0.49 -1.24,-0.73 -1.43,-2.94 0.86,-4.61 0.12,-3.34 0.63,-1.92 4.11,-1.17 -3.35,-1.28 -0.4,-3.64 0.71,-1.77 2.65,-3.01 2.89,-2.09 -0.75,-0.8 2.63,-7.98 -1.75,3.22 -2.04,2.45 -11.93,5.78 -1.27,-0.6 -2.28,-4.57 0.88,-3.29 3.92,0.48 -3.89,-2.48 -1.04,0.38 -1.87,3.17 -1.49,-0.99 0.39,1.58 -0.98,4.03 1.02,4.34 -0.19,1.73 -1.85,0.79 -1.5,-1.42 -4.22,-7.06 -2.46,-2.6 -2.85,2.01 -2.64,-1.9 -2.4,-3.2 -5.16,3.96 -4.89,1.58 -0.93,1.23 -0.37,1.62 -4.49,1.26 -4.43,-0.7 3.28,-1.6 1.51,-1.69 -0.64,-2.27 -0.1,-2.63 1.65,-2.06 -1.71,0 -1.1,0.74 -1.02,-1.55 -0.49,-3.06 1.72,-3.22 0.5,-3.6 -3.52,-8.85 -1.19,-4.52 -2.03,-2.42 3.21,-7.62 2.19,-1.64 -2.18,-0.02 -3.76,6.73 -2.46,2.89 1.56,0.87 0.23,0.73 0.31,1.66 -0.8,3.12 -1.85,-0.09 -1.65,1.61 -3.88,1.75 -7.83,0.88 -2.68,-2.04 0.13,-2.21 -3.86,-3.54 -2.18,-3.54 -1.57,-0.08 -2.97,-2.42 0.4,-2.03 -3.73,-0.94 3.84,-4.61 1.33,-3.11 1.07,-0.44 5.54,2.82 0.6,1.08 -1.21,3.09 4.24,-4.05 1.19,0.49 1.88,3.6 2.29,-1.73 1.22,-2.16 -2.3,-1.51 -3.22,-0.74 3.63,-1.15 -1.84,-1.56 -2.79,2.46 -5.09,-0.13 -3.55,-1.43 -4.11,-0.04 -0.69,-0.77 3.49,-3.43 -2.37,0.41 -0.69,-0.84 0.11,-1.47 -0.86,0.93 -1.61,-1.06 1.15,-1.68 -0.34,-0.14 -0.68,0.21 -0.66,1.27 0.12,2.5 -2.1,0.09 -1.43,-4.66 -1.96,-0.85 -0.48,-1.62 1.24,-2.08 -0.55,-1.07 -1.32,-0.35 -1.51,1.05 -0.67,-0.94 -0.17,-2.5 4.08,-1.09 -2.4,-1.25 -0.67,-1.32 5.3,-1.6 -1.28,-2.17 -0.21,-1.27 0.42,-2.16 5.83,-9.12 2.22,-1.49 2.75,0.91 -0.98,-2.08 1.78,-0.67 1.12,-2.5 -2.31,2.13 -0.6,-4.41 0.52,-2.92 1.39,-2.56 3.33,-0.26 0.11,-0.59 -1.71,-1.85 1.32,-2.2 3.43,-1.18 1.87,0.37 2.36,1.37 1.36,1.7 -1.38,2.74 2.65,-2.25 2.47,1.49 3.87,-1.72 1.59,-2.31 2.12,-1.49 3.85,-6.7 1.94,-0.12 0.64,1.6 0.94,0.47 5.33,-0.39 2.72,-0.73 3.86,-4.19 1.14,-1.76 0.55,-2.31 -1.43,-5.49 -0.95,-5.74 -2.65,-3.82 -1.88,-1.14 -1.2,0.16 0.87,-2.45 2.52,0.27 2.97,-1.66 1.09,-2.73 -0.58,-3.03 -2.76,-3.48 -3.83,3.5 -3.33,-0.58 -1.24,1.97 -5.31,3.45 -3.42,4.29 -0.86,1.93 -1.09,0.09 -0.79,-3.75 -3.73,-3.6 -1.12,1.23 1.46,1.93 1.39,0.35 -1.05,2.53 -3.89,-3.33 -2.58,-1.01 -6.72,0.11 -4.42,2.02 -0.83,-0.58 -2.43,2.01 -13.25,-3.42 -2.07,-1.14 -1.78,-2.72 0.04,-1.86 0.79,-0.78 -0.08,-2.67 -1.54,-0.71 -4.29,-5.51 1.88,0.6 2.64,-0.53 0.9,-2.52 3.76,-0.36 -0.41,-0.68 -14.19,-3.72 -6.63,-4 -1.15,-2.48 1.79,-2.5 0.19,1.86 3.8,-2.14 1.99,-2.8 3.77,-0.49 3.71,-4.89 3.97,-2.6 2.1,-0.72 2.34,1.37 4.31,-0.28 0.79,-1 -3.18,-2.2 0.32,-1.23 4.12,-3.45 4.39,-0.79 6.86,-4.3 8.34,-0.8 1.02,1.19 -2.91,-0.03 1.35,1.28 -1.45,4.35 0.1,2.59 -1.59,2.02 3.85,3.71 9.2,-0.44 3.41,1.36 4.24,-0.57 3.19,0.79 1.34,-0.3 2.95,-5.54 1.16,-0.87 2.89,1.75 1.04,-0.57 0.86,1.43 -0.4,-2.99 -0.58,-1.12 -4.83,-2.06 -3.22,1.02 -1.01,-1.16 0.33,-2.31 -3.46,-5.73 -1.44,-1.17 -1.7,-0.06 -1.59,-4.59 2.8,-1.53 1.23,0.83 1.38,3.4 1.3,0.5 -0.38,3.36 1.61,3.09 3.62,2.85 4.96,-1.02 4.22,3.16 1.52,0.32 4.77,-1.34 0.05,-2.51 -0.4,-1.83 -1.12,-1.15 -3.22,0.22 -2.51,-1.89 -2.13,0.52 -3.94,2.89 -5.22,-4.26 -0.25,-2.99 2.92,-5.08 -1.11,-1.2 -2.8,-0.85 -4.84,0.87 -0.21,-2.46 -1.97,2.5 -4.77,-0.26 -6.03,-2.2 -2.15,-2.72 -2.52,-8.33 -2.08,-3.85 -14.35,-13.23 -6.52,-3.36 -3.15,-3.74 -6.26,-2.52 2.74,-2 -1.16,1.56 0.88,0.4 2.16,-1.98 2.26,-11.61 -0.31,-2.78 7.96,0.56 13.73,-2.18 4.95,-3.17 3.78,-4.26 3.76,-7.15 0.5,0.14 0.77,-7.23 1.61,-4.83 12.18,-19.13 1.37,2.5 -3.56,3.22 12.26,-4.8 4.12,-4.81 5.88,-4.94 1.75,0.79 -1.62,3.26 1.14,0.86 -1.02,3.87 2.14,0.06 0.47,1.78 0.58,-7.4 1.5,0.68 3.37,-1.62 -4.09,-0.2 -2.45,-3.55 -1.36,-0.02 4.56,-5.24 4.16,-3.17 1.4,0.65 0.1,0.96 -1.78,1.76 1.01,1.13 2.9,-1.84 4.27,0.09 1.55,-1.45 6.54,-0.67 6.65,-6.25 6.16,-9.85 3.57,-3.16 0.85,0.39 -1.96,1.96 1.11,1.78 9.38,3.85 0.75,2.17 -0.63,2.09 -1.93,2.31 -3.89,2.36 1.19,0.89 0.78,2.09 1.15,0.26 3.33,-2.07 4.7,-7.16 2.53,0.56 3.08,3.36 -1.27,3.24 6.71,3.23 3.15,-2.64 4.79,-0.48 3.01,-1.44 10.61,2.98 0.77,1.26 -2.33,2.66 -0.38,2.74 2.29,1.34 0.19,1.59 0.91,0.4 4.6,-0.12 -2,3.68 8.19,1.13 6.39,-3.1 4.43,2.57 4.59,-2.56 6.84,0.3 6.61,2.88 2.38,3.33 3.82,-1.27 3.11,1.76 1.87,2.9 7.31,1.57 3.62,-0.71 10.49,1.06 7.12,5.06 6.58,0.88 2.3,-1.89 13.63,-2.58 5.81,2.75 4.68,5.44 6.8,3.28 3.31,3.84 4.62,0.09 0,254.4 5.42,1.88 0.83,-1.86 5.46,2.67 3.37,-3.33 6.8,-0.36 0,1.48 -1.21,4.48 1.47,1.87ZM158.04,1032.11l-0.44,0.16 3.71,-3 -3.27,2.84ZM97.13,1101.66l0.17,0.62 6.53,0.56 2.3,-1.92 2.75,-0.77 3.51,2.09 1.19,3.21 4.47,1.56 0.8,1.45 9.54,1.59 -0.52,2.45 -1.03,1.07 -5.83,0.01 -2.22,2.84 -0.13,1.54 -1.2,1.02 -1.62,-4.17 -4.22,-1.87 -0.94,-2.22 -2.9,-2.41 -4.86,-1.87 -6.43,3.07 -3.09,-2.35 -0.31,-2.68 0.82,-4.44 1.13,-0.61 2.09,2.23ZM364.88,1170.44l-1.44,0.19 -0.76,-0.62 0.25,-1.68 0.73,-0.18 0.83,0.56 0.39,1.73ZM82.58,1179l2.46,1.51 1.57,-0.16 1.77,2.29 -4.59,-0.68 -4.99,-3.79 0.3,-1.74 1.41,-0.89 0.72,2.34 1.35,1.12ZM318.34,1181.2l-0.55,0.08 0.74,-1.13 0.51,-2.22 0.68,0.3 0.14,0.41 -1.52,2.56ZM367.98,1179.16l-0.36,1.18 0.34,1.07 -0.82,3 -0.96,0.84 0.12,-1.04 -0.75,0.02 -0.23,-1.6 1.11,-3.69 0.39,0.49 0.81,-1.22 0.35,0.95ZM382.36,1179.17l0.26,0.64 3.06,0.25 -5.61,3.28 -1.22,-2.92 1.62,-1.96 1.89,0.71ZM396.87,1181.77l-0.36,0.56 -1.52,-0.56 1.77,-1.48 0.3,0.3 -0.19,1.18ZM157.75,1180.7l1.04,1.14 2.31,-0.28 1.26,0.73 0.46,2.07 -0.26,3.54 0.93,0.93 0.44,2.62 -4.04,0.53 -1.74,0.91 -0.35,0.68 0.28,1 -0.48,0.26 -1.29,-1.15 -4.16,-1.13 -5.82,-3.27 -3.38,-4.52 2.1,-0.62 4.72,0.38 0.59,-1.82 3.52,-1.98 3.87,-0.02ZM367.09,1193.71l-1.25,0.33 -0.3,-0.67 1.19,-2.61 4.91,-5.51 1.77,-3.97 1.83,0.6 0.71,0.99 -4.11,4.89 -2.05,4.21 -2.7,1.74ZM363.84,1187.99l-0.59,0.7 -2.25,-0.43 0.46,-1.37 1.72,-0.87 1.89,1.35 -1.23,0.62ZM403.16,1193.6l-0.54,0.13 1.92,-3.13 2.38,-1.47 -0.15,0.75 -3.61,3.72ZM217.1,1221.18l-1.72,0.18 -0.7,-2.17 1.65,-1.49 3.09,-1.29 -2.32,4.77ZM313.05,1223.19l-1.72,-1.24 1.98,-1.67 1.08,0.16 0.07,0.88 -1.41,1.87ZM313.83,1225.9l0.42,0.18 0.73,-1.34 1.35,1.1 0.82,-0.24 0.53,1.34 1.19,0.05 -0.09,1.42 -1.44,1.8 -1.82,-1.96 -0.75,0.94 0.29,1.6 -2.6,0.71 -0.38,-1.45 -0.31,0.12 -0.96,2.14 -2.8,1.5 -5.15,-2.01 4.61,-4.53 2.33,0.4 0.03,-1.45 -0.82,-1.54 2.6,-0.64 2.22,1.86ZM515.64,1230.19l5.01,0.39 3.12,5.8 1.62,5.23 -1.16,-0.9 -2.9,-7.28 -0.8,-0.81 -0.64,0.32 0.45,3.21 3.75,6.46 0.19,1.9 -0.6,0.85 0.74,1.75 -0.19,0.67 -1.99,0.78 -1.82,3.22 -1.99,1.88 -1.36,-0.01 -0.67,-1.69 -0.07,-1.2 0.5,-0.77 1.01,-5.27 -1.97,-3.31 -1.38,-9.41 -1.44,-3.99 -0.18,-1.99 0.98,0.75 1.79,3.42ZM519.82,1228.74l-0.08,0.54 -1.55,-0.05 -2.34,-1.83 1.61,-0.9 2.36,2.24ZM503.69,1228.41l1.63,2.11 -0.32,1.92 -0.89,0.41 0.91,1 3.04,-2.85 2.09,0.61 2.37,1.73 0.3,1.35 -0.49,2.9 -1.5,0.5 -1.46,-0.47 -1.22,1 1.01,0.77 3.08,0.18 1.2,2.87 -0.66,2.29 -7.2,-3.93 -0.5,0.34 -0.11,3.61 -0.84,1.28 -2.49,-0.56 -1.89,-4.84 -4.36,-4.24 -1.24,-2.12 0.64,-2.66 1.63,-1.01 0.54,-1.64 2.03,2.6 0.01,-1.2 0.55,-0.95 1.67,-0.17 1.83,-1.35 0.64,0.52ZM308.36,1237.45l0.08,1.17 3.13,-1.71 2.13,0.5 0.11,0.92 -0.76,1.03 0.04,0.66 0.81,1.22 1.99,0.66 0.23,0.8 -2.23,2.59 -6.02,-0.91 -0.64,0.61 2.46,0.33 1.16,2.29 -2.27,0.51 -1.97,1.75 -2.53,0.24 -3.57,3.12 -1.65,0.53 0.98,0.47 0.04,1.44 -1.3,2.14 -2.45,1.74 -0.89,-0.29 -0.22,-0.67 3.16,-3.52 -2.35,-1.26 -1.18,0.6 0.77,-2.11 -2.37,-0.44 -1.56,0.97 1.61,0.2 0.62,1.71 -0.87,1.95 -0.88,-0.19 -1.82,-2.41 -0.81,-3.55 -1.55,-2.73 0.37,-2.33 1.57,-2.4 2.89,-1.67 1.88,-0.28 0.98,0.43 0.4,0.92 -0.15,0.66 0.69,0.56 1.62,3.63 1.34,1.12 -1.26,-2.91 -0.46,-4.09 1.69,-0.1 -0.04,-0.48 -2.42,-2.72 0.74,-1.54 1.66,-0.18 1.94,3 0.42,0 1.11,-1.44 1.97,0.06 0.55,-2.46 -0.65,-1.01 0.74,-0.3 3.53,1.61 -0.54,1.56ZM304.46,1236.89l-0.62,0.44 -2.56,-2.71 0.45,-0.32 1.52,0.82 1.21,1.77ZM512.34,1247.47l1.67,4.1 2.31,9.14 0.11,2.38 -0.53,1.66 0.31,4.54 -0.59,1.77 -1.42,-1.34 -1.98,-4.88 0.16,-1.6 0.95,-1.71 -1.53,0.39 -1.61,-1.35 -0.05,-2.05 -1.38,0.49 -0.52,-0.45 0.17,-2.29 1.32,-1.99 -1.61,-1.13 -0.39,-2.25 -0.91,-1.28 -0.53,0.12 -1.82,4.41 -1.71,0.5 0.51,-1.9 -0.63,-3.78 0.4,-0.78 1.85,-0.78 2.01,-3.8 1.16,0.02 4.28,3.84ZM111.95,1251l-1.18,0.99 -1.07,-0.37 -0.32,-1.02 3.08,-0.82 -0.51,1.22ZM307.12,1252.24l-1.7,0.65 -1.58,1.95 -0.9,-1.07 0.23,-1.68 0.78,-1.11 4.29,0.68 -1.12,0.58ZM530.59,1254.78l0.76,0.65 0.41,-0.68 2.19,0.64 1.33,1.96 -0.06,4.22 -0.51,1.1 -3.7,-4.28 1.96,4.54 0.14,1.71 -0.41,1.12 -4.8,0.21 -0.53,-1.09 -0.36,-5.81 -1.62,-2.64 -1.78,-1.78 0.2,-0.71 1.09,-0.53 5.69,1.37ZM523.5,1258.08l0.73,1.44 1.07,-0.11 1.05,2.71 -0.32,1.04 -1.01,0.37 -0.33,5.97 -0.74,3.36 -0.5,0.55 -0.84,-0.65 -0.63,1.13 -0.76,0.01 -0.63,-2.58 0.56,-4.31 1.27,-0.88 -2.34,-2.55 0.13,-0.77 -1.21,-2.21 0.13,-2.39 1.13,-1.65 1.49,-0.3 1.75,1.82ZM537.64,1264.7l-1.57,0.27 -0.53,-0.25 -0.19,-0.88 1.2,-4.71 2.12,2.28 1,2.25 -2.03,1.04ZM116.56,1262.44l2.33,0.14 0.87,0.71 -1.8,0.99 -1.52,-1.28 0.12,-0.56ZM293.45,1264.92l-1.41,-0.5 0.12,-0.65 1.2,-0.79 1.21,0.12 -0.07,1.22 -1.05,0.6ZM288.05,1266.55l-0.77,0.49 -0.3,-0.58 1.75,-2.5 1.2,-0.81 0.83,0.57 -2.71,2.83ZM544.86,1273.24l-0.24,3.38 -2.68,0.07 -0.59,-0.81 0.16,-1 -0.51,-0.56 -2.37,-0.45 -0.45,-2.45 1.14,-0.88 2.49,-5.29 0.72,0.24 2.84,4.99 -0.51,2.76ZM537.26,1270.42l-1.27,-0.25 -1.66,-2.16 1.54,-1.83 2.94,0.38 -0.03,2.51 -1.52,1.35ZM528.31,1268.53l4.14,0.4 1.38,2.58 -0.17,2.12 3.85,1.94 1.82,2.03 1.91,4.21 2.93,4.15 -3.85,-2.27 -1.37,2.42 2.43,-0.19 2.3,1.99 0.63,1.21 -0.53,1.97 2.3,-0.12 0.32,0.44 -0.27,3.47 0.22,4.54 -0.46,1.55 -1.91,-0.17 -1.73,-3.41 -2.37,-0.89 -0.5,-0.86 -0.33,-2.79 -0.9,0.11 0.21,1.13 -0.24,0.87 -0.89,-0.37 -1.48,-2.78 -2.34,-2.78 0.17,-0.65 1.64,-0.71 -1.4,-2.18 0.56,-1.72 -3.02,-0.34 -0.8,-1.66 -2.1,-0.04 -1.44,-1.9 1.09,-1.04 1.96,0.77 1.94,-2.48 -0.55,-1.99 -0.93,-0.35 -3.56,1.89 -0.66,-0.45 -0.15,-0.7 2.56,-2.98 -0.73,-1.45 -0.05,-2.04 0.37,-0.48ZM557.75,1285.79l-1.18,4.46 -1.2,1.2 -0.84,-0.27 -0.62,-0.97 -1.19,-0.15 -0.34,-0.8 0.33,-1.05 -0.29,-0.8 -0.85,1.35 -1.36,0.84 -1.37,2.66 -0.56,-1.14 -0.4,-3.86 2.26,-3.41 0.26,-4.97 4.05,-2.51 3.09,4.62 0.36,1.17 -0.15,3.63ZM278,1279.1l-0.44,0.64 -0.86,-0.05 -0.65,-0.77 1.64,-1.91 0.31,2.09ZM531.28,1284.7l0.27,0.92 -4.19,4.58 0.17,-2.89 -1.16,-1.67 1.17,-0.85 3.74,-0.09ZM219.76,1289.29l1.51,-1.32 -0.35,1.46 1.09,2.45 -1.38,0.52 -1.06,-0.38 -1.06,0.65 -0.35,-0.57 -0.16,-3.22 1.32,-1.39 0.59,0.5 -0.15,1.3ZM223.81,1288.83l-0.16,1.58 -1.98,-1.5 2.14,-0.08ZM536.32,1297.65l0.28,0.26 0.75,-0.89 1.76,0.67 -0.34,2.69 -0.67,1.42 -1.15,-0.49 -2.3,-2.88 -1.29,-2.28 -1.46,-4.08 -1.9,-0.7 -0.41,-1 0.28,-0.86 1.51,-0.44 2.27,2.23 1.15,2.06 0.16,1.54 1.36,2.75ZM229,1293l-4.03,4.09 0.84,-2.29 -0.21,-1.69 2.16,-1.49 0.7,-1.39 0.56,0.08 -0.31,0.84 0.67,0.78 -0.38,1.07ZM553.65,1293.97l1.22,3.49 -1.98,0.19 -0.45,-0.3 0.16,-1.72 -0.57,-0.77 -1.26,0.19 -0.03,-1.3 0.45,-0.92 -0.26,-2.22 0.75,-0.28 1.23,0.98 0.74,2.66ZM233.07,1292.54l-0.22,1.83 -1.3,-0.29 0.11,-0.99 0.47,-0.03 0.26,-1.83 0.34,-0.17 0.34,1.48ZM234.81,1296.1l-0.67,-0.11 -0.46,-1.6 0.81,0.35 0.32,1.36ZM188.01,1295.94l1.1,3.27 2.78,1.82 0.58,1.06 -3.12,-1.31 -2.56,2.17 -5.58,0.09 -1.84,0.97 -1.92,2.42 -2.13,0.86 -2.64,-0.29 -0.92,-2.46 0.18,-1.24 2.07,-1.66 2.59,-4.24 2.33,0.14 5.31,-2.96 2.27,-0.03 1.5,1.39ZM201.41,1298.58l-1.06,-0.51 -0.49,-1.16 1.93,-1.03 0.35,1.02 -0.73,1.68ZM198.49,1307.34l-0.98,0.43 -1.05,-0.45 -0.9,-0.82 -0.1,-0.98 2,0.64 1.03,1.18ZM164.28,1312.5l-0.61,-0.06 -0.45,-2.21 1.18,-0.61 0.72,1.22 0.91,0.49 -1.75,1.17ZM161.09,1313.78l-2.22,0.46 -0.79,-1.9 0.74,-0.9 1.69,-0.31 2.27,2.08 -1.69,0.57ZM152.29,1317.07l0.49,0.91 0.85,-0.58 1.42,-2.23 1.61,1.28 -2.93,2.84 -0.69,1.63 1.87,-0.38 0.86,0.44 -4.47,3.09 -0.78,1.16 -4.36,1.3 -5.4,2.83 -2.05,-1.22 7.65,-3.87 0.5,-2.1 0.87,-1.2 1.39,0.02 0.85,1.07 0.17,-0.84 0.71,-0.53 -3.75,-1.36 -0.53,-1.72 0.91,-1.34 4.15,-1.23 0.52,0.19 0.14,1.84ZM156.9,1320.49l-0.46,-0.86 1.55,-1.45 -1.09,2.31ZM136.94,1327.73l-3.49,2.04 -2.67,3.69 -6.64,3.99 3.34,-4.02 0.2,-1.97 1,-1.49 3.53,-1.07 -0.19,-2.39 1.24,-1.74 2.44,-1.09 2.79,0.94 0.27,0.44 -0.69,1.86 -1.13,0.81ZM117.28,1337.16l-0.35,1.04 -2.93,-0.26 -0.13,-0.45 1.95,-1.01 1.46,0.68ZM105.43,1342.15l-0.72,0.6 -0.34,-0.96 1.65,-1.81 1.11,0.56 -0.34,1.09 -1.36,0.52ZM60.56,1352.32l-6.1,0.76 -0.93,-0.52 11.25,-3.59 0.54,-0.99 -2.01,-0.89 3.03,-1.92 1.72,1.65 -0.42,1.59 -1.41,0.85 0.66,1.21 -6.33,1.85ZM85.73,1347.92l-1.76,-0.01 1.7,-2.14 1.78,1.09 -1.72,1.06ZM73.35,1350.45l6.03,1.06 -4.98,0.69 -4.27,-0.12 -1.78,-1.39 2.26,0.35 1.56,-0.73 1.18,0.14ZM45.27,1352.93l-0.27,0.54 -1.11,-0.58 -0.48,-0.96 0.33,-0.8 0.89,-0.01 1.16,1.32 -0.52,0.49ZM38.76,1355.43l0.06,0.62 1.71,0.24 -0.17,1.55 -0.66,-0.18 -2.96,2.12 -0.75,-0.84 -1.42,1.32 0.99,-3.43 1.57,-0.91 -0.1,-1 0.54,-1.69 1.15,0.08 0.53,0.69 -0.49,1.43ZM32.45,1358.19l-5.77,0.74 -0.17,-0.45 4.7,-1.91 1.03,-1.93 0.64,-0.35 0.54,0.49 -0.82,1.75 -0.15,1.66ZM24.13,1359.42l-0.53,0.59 -1.51,-1.01 -0.23,-0.34 0.9,-0.48 0.15,-0.86 -2.37,-2.18 0.89,-0.62 1.85,-0.04 1.76,1.44 1.76,0.25 -1.43,0.9 -1.24,2.35ZM45.41,1356.43l-0.96,0.4 -1.26,-0.81 0.12,-0.95 2.1,1.36ZM42.25,1356.81l-0.72,1.08 -0.53,-0.49 -0.2,-1.49 0.4,-0.38 1.05,1.28ZM1052.56,1684.94l-1.51,1.48 -4.36,0.45 2.45,-0.8 -0.76,-1.53 -0.76,-0.55 0.01,-1.48 -1,-1.75 -1.42,4.32 -3,-0.05 -0.99,-20.2 4.57,-41.48 -1.35,-1.27 29.35,0.32 4.81,28.06 2.12,5.82 0.47,1.57 -0.14,0.66 0.73,1.01 -1.29,1.86 -1.01,3.58 -0.01,1.39 0.79,2.73 -0.42,3.69 0.28,2.37 0.69,1.54 -29.43,0.01 -0.09,1.86 2.2,2.9 -0.24,2.16 -0.69,1.33ZM1045.94,1686.59l-2.78,0.16 2.35,-0.44 0.43,0.28ZM1027.36,1608.42l0.18,1.13 -0.85,0.45 -0.18,1.17 -1.31,0.77 -0.56,1 0.2,1.23 -0.47,1.23 -1.12,1.25 -0.48,1.39 0.17,1.55 -0.56,1.24 -1.29,0.94 -0.73,2.05 -1.09,0.66 -0.67,1.26 -0.74,0.45 -0.5,3.1 -0.59,1.24 -1.44,0.79 -0.63,1.44 -1.05,0.87 -0.35,0.83 0.29,1.1 -1.77,1.02 0.37,1 -0.17,1.01 -1.76,2.08 0.4,0.8 -0.48,0.46 0.84,1.97 -0.26,1.97 0.65,1.04 -0.49,2.74 -32.9,0.05 -0.07,-7.38 -1.64,-0.47 -1.89,0.38 -1.44,-1.19 0.51,-24.01 -2.04,-15.66 50.7,0 1,1.83 -0.01,1.06 -2.59,2.78 -0.89,1.5 7.7,-0.12ZM807.28,1672.34l-22.69,0.05 -43.17,-15.87 1.31,-2.92 1.58,-0.14 0.75,-0.51 0.44,-0.94 -0.15,-1.92 -1.79,-1.2 -0.64,-1.33 -0.17,-2.19 0.2,-1.18 1.13,-0.71 0.92,-1.88 0.14,-4.06 2.05,-3.27 2.31,-1.99 -0.37,-0.94 -2.42,-1.84 -0.31,-1.4 -2.42,-4.4 0.23,-6.19 -0.81,-2.69 0.19,-1.2 -0.47,-4.02 -0.62,-1.35 0.82,-1.52 1.86,-0.49 1.13,0.11 1.98,1.64 0.56,0.02 1.6,-2.13 0.03,-11.65 56.81,0.04 -0.01,78.07ZM743.99,1622.54l-0.01,1.16 0.61,1.57 1.81,2.83 0.31,1.4 2.8,2.36 -0.01,0.42 -3.33,3.24 -1.03,2.02 -0.14,4.06 -0.92,1.88 -1.13,0.71 -0.03,3.37 0.64,1.33 1.79,1.2 0.25,0.97 -0.54,1.89 -0.75,0.51 -2.92,0.41 -26.05,2.31 -0.1,-1.56 -0.53,-0.53 -0.68,0.33 -0.22,-3.72 -0.64,-2.19 -1.69,-2.66 -6.97,-5.82 -2.1,-0.5 -0.33,0.63 -1.33,-0.43 0.2,-1.56 -1.29,-2.19 -3.7,-0.09 -3.55,-1.21 -1.05,-0.71 -0.36,-1.29 -3.85,-2.21 -1.22,0.26 -3.87,-0.97 -4.87,-0.03 -1.86,-1.49 0.23,-3.21 -0.44,-1.91 0.34,-1.77 -0.29,-0.63 -2.26,-1.22 -0.31,-0.91 0.28,-1.26 -0.45,-0.83 -1.4,-0.78 -1.31,-1.77 -1.66,-0.97 -0.68,-1.62 -3.65,-5.09 -2.42,-2.5 -0.47,-3.41 1.46,-2.27 -0.2,-1.69 -0.83,-1.24 -3.23,-0.74 -2.62,-3.09 -0.16,-2.37 -1.03,-2.43 -0.17,-3.3 0.78,-0.37 0.7,0.13 0.16,1.91 0.83,0.92 1.49,1.3 1.09,0.33 -3.58,-6.94 0.81,-0.67 2.58,-0.61 6.39,-0.09 -1.14,-0.41 -2.9,0.13 -1.72,-0.7 -1.39,0.84 -2.72,-1.15 -1.03,0.52 -0.13,2.24 0.32,1.67 -0.62,0.17 -4.67,-3.31 -0.76,0.97 0.35,-1.57 -0.11,-1.88 1.14,1.5 -0.35,-1.06 -1.57,-1.57 -0.86,-2.09 -1.91,-1.26 -4.68,-5.42 -0.21,-2.98 -1.15,-3.78 0.48,-2.16 -0.62,-3.85 -3.14,-4.73 -2.45,-2.35 -0.37,-1.78 -0.17,-1.79 1,-3.29 0.34,-0.45 0.38,0.66 0.34,-1.13 -0.33,-0.28 0.98,-2.7 -0.08,-2.81 0.82,-3.45 -0.56,-3.61 -0.52,-1.48 -0.93,-1.05 0.41,-1.54 -0.22,-1.72 48.1,0.01 0.01,44.9 21.32,18.98 40,38.16ZM684,1635.13l2.32,0.7 1.25,-0.33 0.22,0.34 -2.96,0.82 -0.86,-0.37 -0.37,-1 0.4,-0.16ZM679.18,1635.88l-1.54,-0.11 0.84,-0.55 0.7,0.66ZM682.17,1637.34l-1.4,0.01 -0.97,-1.32 2.05,-0.17 1,0.73 -0.68,0.75ZM701.46,1644.62l0.58,1.01 -1.7,-0.07 -0.52,-1.31 -0.76,-0.26 -0.12,-0.44 2.52,1.07ZM689.06,1646.92l-1.2,-0.1 -0.36,-0.73 1.1,0.05 0.46,0.78ZM701.44,1652.2l-1.4,-0.15 -1.33,-2.33 0.37,-0.3 2.36,2.78ZM807.29,1594.27l0,-58.59 79.89,0.01 0.14,58.58 -80.03,0ZM1231.07,1520.32l0.05,7.51 -0.53,2.8 -4.81,0.66 -1.2,-0.31 -1.23,0.55 -5.07,-0.14 -1.13,1.04 -6.9,3.39 -1.05,-1.7 2.71,-1.73 -0.69,-1.16 0.73,-11.58 7.66,0.33 0.01,0.4 0.56,-0.4 10.89,0.34ZM1171.57,1567.03l-1.05,-0.8 0.91,-1 1.26,1.81 -1,1.19 -0.12,-1.2ZM1194.24,1573.35l-7.62,0 -0.88,-18.57 1.23,-1.56 1.89,-0.24 1.02,0.42 -1.9,2.58 0.16,2.42 1.83,2.88 0.23,2.77 0.93,1.85 1.43,2.15 1.1,0.61 -0.46,2.11 -0.66,0.6 1.3,0.19 0.4,1.79ZM1052.56,1684.94l0.69,-1.33 0.24,-2.16 -2.2,-2.9 0.09,-1.86 29.43,-0.01 1.4,3.72 30.08,2.05 0.52,2.28 0.93,0.29 0.94,-1.4 -0.09,-3.36 0.92,-1.09 3.23,0.98 1.93,0.11 0.53,1.2 2.36,11.15 1.65,4.41 2.33,5.31 4.27,7.32 -0.49,0.77 -0.2,2 1.46,4.79 -0.49,-0.44 -1.25,-3.13 0.03,-4.47 -0.29,0.07 -0.69,2.24 -0.44,-1.53 0.49,-1.5 -0.88,-0.7 -0.05,-1.29 -0.77,-0.33 1.02,4.88 5.95,15.1 1.56,2.72 0.54,5.42 -0.97,9.32 -0.37,-0.56 -1.61,3.28 -0.76,3.62 -1.34,1.28 -0.83,-0.04 -2.03,0.96 -1.43,-0.25 -2.83,0.48 -0.64,-1.14 0.35,-1.02 0.44,-0.12 1.5,1.2 0.29,-0.51 -0.46,-0.59 -1.51,-0.7 -2.64,-4.6 -0.22,-1.25 -2.32,-0.77 -1.67,-1.16 -1.09,-2.06 -0.63,-3.67 -1.05,-0.7 1.48,-2.5 -1.04,0.7 -0.57,1.01 -0.79,0 -0.43,-1.93 0.12,-2.39 0.61,-0.89 -1.91,0.31 0.01,1.24 -1.25,-0.4 -1.72,-2.41 -2.04,-4.37 -1.07,-1.26 0.9,-0.32 2.67,-3.99 -0.51,-0.87 -0.6,0.45 -1.56,-1.46 -0.45,0.22 0.89,1.17 -0.16,1.24 -0.57,0.75 -0.62,-0.19 -0.31,0.31 -1.15,-1.76 2.09,-8.26 0.1,-5.21 -1.34,-2.13 -5.93,-5.22 -4.6,-6.21 -3.98,-2.34 -3.02,0.52 -0.52,0.47 -0.31,1.59 -1.9,0.13 -2.85,1.64 -1.01,-0.06 -1.59,0.74 -3.3,0.53 -0.65,-0.19 -0.43,-0.95 0,-0.98 0.88,1.34 0.25,-0.24 0.09,-0.52 -0.53,-1.02 -3.67,-3.23 0.6,0.06 0.15,-0.41 -0.61,-0.54 0.68,-1.29 -1.56,0.56 -0.17,1.02 -4.77,-2.18 -3.18,-0.88 2.44,-0.39 1.32,0.31 -0.47,-0.78 -1.05,-0.38 -2.17,-0.03 -2.63,1.22 -5.94,0.84 0.89,-0.75 1.56,-0.45 0.24,-0.94 -0.37,-0.91 -0.85,0.93 -1.12,-0.51 -0.16,1.12 -1.09,1.51 -2.22,0.6 -0.28,-0.2 0.59,-1.12 -0.47,0.22ZM1081.94,1694.59l-1.15,0.48 -1.23,-0.35 1.32,0.08 3,-1.38 -1.94,1.17ZM1135.65,1725.2l0.19,0.94 -2.34,-5.62 -0.69,-2.67 2.84,7.35ZM1114.07,1734.46l-0.02,0.75 -0.95,-2.64 0.54,0.45 0.43,1.44ZM1114.6,1735.72l-0.41,0.33 -0.82,-0.25 -0.64,-1.29 0.97,1.11 0.9,0.1ZM1133.43,1752.29l-2.26,2.36 1.42,-2.45 1.15,-1.06 0.04,-0.8 1.07,-0.64 -1.42,2.59ZM1130.52,1755.29l-0.31,0.06 0.57,-0.5 -0.26,0.44ZM1125.9,1757.63l-0.52,0.29 -0.54,-0.21 2.35,-0.62 -1.29,0.54ZM1122.59,1758.46l-0.5,0.17 -0.47,-1.42 1.11,0.81 -0.14,0.44ZM1119.95,1759.09l-0.74,0.12 0.6,-0.49 0.19,-0.75 0.34,0.94 -0.39,0.18ZM1117.48,1759.78l-0.31,-0.16 0.83,-0.22 -0.52,0.38ZM1080.81,1676.68l-0.69,-1.54 -0.28,-2.37 0.42,-3.69 -0.79,-2.73 0.01,-1.39 1.01,-3.58 1.29,-1.86 -0.73,-1.01 0.14,-0.66 -0.47,-1.57 -2.12,-5.82 -4.81,-28.06 28.55,0 -2.3,2.71 -0.44,1.35 3.44,2.73 2.34,1.02 2.94,5.77 2.7,2.47 1.63,2.38 2.31,1.92 2.56,4.47 2.3,1.72 1.01,1.8 1.28,4.44 0.99,0.68 1.35,2.39 0.41,2.67 0.69,0.97 2.3,1.07 -0.58,1.14 -2.16,0.89 0.54,1.21 -1.5,1.12 0.32,1.26 -1.02,0.95 0.95,0.1 -1.36,2.14 -0.97,0.24 1.05,1.18 -0.87,1.23 -0.88,-0.37 -0.89,4.32 0.19,1.89 -1.93,-0.11 -3.23,-0.98 -0.92,1.09 0.09,3.36 -0.94,1.4 -0.93,-0.29 -0.52,-2.28 -30.08,-2.05 -1.4,-3.72ZM1121.63,1677.08l-0.5,3.23 -0.24,-2.25 0.74,-0.98ZM234.69,1792.13l-1,0.69 -1.68,-0.41 -2.06,-1.62 0.72,-1.21 1.67,-1.02 2.59,0.04 0.58,1.41 -0.82,2.12ZM225.51,1793.25l-0.23,0.54 -0.39,-0.08 0.15,-1.15 1.37,-1.45 0.59,0.13 -0.36,1.2 -1.13,0.81ZM252.59,1797.96l0.9,-0.02 0.17,0.98 0.8,0.86 -1.86,0.47 -1.17,-0.88 -0.65,0.17 -0.22,-0.63 -0.45,0.13 0.42,0.63 -1.47,-0.03 -1.47,-2.08 -0.39,-1.18 1.71,-0.18 1.17,-1.12 0.66,-0.12 1.85,3ZM259.26,1800.9l5.7,0.74 -0.4,0.63 -1.28,0.57 -1.83,-0.5 -3.06,-0.18 0.46,-1.43 0.41,0.17ZM267.53,1804.35l0.29,0.22 2.09,-0.45 3.27,2.37 -1.33,1.36 -3.43,0.49 -0.34,-0.16 -0.48,-2.23 -0.72,0.14 -0.82,-0.39 -0.93,-1.55 0.46,-0.92 0.82,-0.12 1.12,1.24ZM263.4,1806.3l-0.67,0.34 -0.74,-0.16 -0.88,-1.88 1.24,-0.22 0.7,0.31 0.81,0.9 -0.46,0.71ZM277.83,1827.6l-0.5,0.58 -0.63,-0.04 -2.28,-1.24 -0.28,-0.67 0.17,-3.09 -1.8,-4.44 2.6,-3.19 -0.82,-1.86 0.21,-1.12 0.48,-0.2 7.2,3.42 1.29,1.43 0.22,1.54 0.88,0.2 0.41,1.06 1.69,1.45 -0.52,0.85 -2.31,1.62 -2.92,0.71 -2.57,1.82 -0.52,1.17ZM1007.59,1545.01l-2.73,-2.58 -0.56,-1.09 -45.89,0.34 -1.07,-2.15 0.28,-2.17 -0.14,-2.87 -0.74,-2.5 0.32,-0.64 -0.75,-1.21 0.07,-1.42 -0.44,-0.19 -0.34,-0.98 -0.53,-0.12 -0.32,-4.19 -1.31,-3.29 -1.07,-1.48 -0.69,-1.96 -0.31,-2.42 -1.11,-1.44 -0.66,-2.28 -0.94,-1.1 1.82,-6.22 -0.32,-1.18 -0.84,-0.58 0.33,-1.49 -0.73,-2.5 60.91,-0.08 0.3,1.68 1.16,1.01 0.12,0.83 -0.62,2.74 1.04,4.88 4.34,2.76 1.12,2.55 1.19,0.95 1.58,2.59 2.03,1.76 0.18,1.82 -0.75,2.57 -0.66,0.66 -0.81,2.1 -1.02,1.09 -1.71,1 -4,1.05 -1.25,0.86 -0.38,1.34 0.18,1.13 1.16,1.86 0.12,1.01 -1.69,4 -1.29,1.51 -1.41,0.68 -0.62,1.01 0.04,2.08 -0.59,0.27ZM716.36,1406.78l11.27,0 -0.01,16.97 3.76,5.48 0.32,1.26 -0.23,0.91 0.47,0.93 -0.5,0.86 4.63,3.62 6.29,8.28 1.05,-0.18 0.42,1.12 0.7,0.45 2.57,-0.14 -1.25,7.59 -0.44,0.68 0.08,2.01 0.71,0.87 0.22,1.49 -1.43,1.24 0.3,2.11 -0.38,1.79 2.64,1.43 2.06,-1.48 1.42,-1.86 2.15,1.5 1.2,4.8 2.84,4.46 -0.15,2.01 1.39,1.54 1.19,-0.03 1.06,0.71 0.89,1.61 0.71,2.95 1.66,1.3 1.57,-1.58 3.88,0.44 0.63,-1 1.01,-0.44 8.32,0.25 0.59,-2.66 0.86,-0.56 0.78,0.37 1.63,2.67 1.24,0.91 0.01,39.03 -67.88,0.01 -0.04,-28.16 1.23,-6.11 -0.47,-0.73 -2.12,-0.72 -0.65,-0.85 -0.05,-1.47 3.93,-7.51 0.19,-1.28 3.3,-7.61 0.82,-3 -0.5,-1.32 -3.96,-3.86 -0.7,-1.6 -0.14,-2.89 -1.09,-2.71 0,-43.9ZM1007.59,1545.01l0.59,-0.27 -0.04,-2.08 0.62,-1.01 1.41,-0.68 1.29,-1.51 1.69,-4 -0.12,-1.01 -1.16,-1.86 -0.18,-1.13 0.38,-1.34 1.25,-0.86 4,-1.05 1.71,-1 1.02,-1.09 0.32,-1.18 1.62,-2.66 0.28,-1.49 -0.18,-1.82 -2.03,-1.76 -0.9,-1.7 -2.56,-2.89 41.09,0.31 -2.07,11.23 -3.42,0 -0.13,35.74 -0.89,1.23 -0.04,1.44 -0.37,0.36 1.33,3.81 0.01,2.43 -1.72,3.71 -0.62,0.26 -1.57,2.54 -0.55,-0.04 -0.67,0.7 0.25,1.52 -0.54,0.45 0.18,0.34 -0.62,1.1 0.02,1.11 -0.6,0.88 0.61,1.25 -0.99,1.28 -0.13,1.14 0.37,1.24 -0.94,1 -3.46,1.43 0.55,3.49 -0.29,0.46 -4.56,-1.39 -1.98,0.04 -1,1.15 -0.23,1.57 -1.34,-1.25 -0.32,0.96 -1.29,-1.28 -0.83,-1.58 -0.18,-1.25 0.46,-0.94 0,-0.98 -0.7,-3.02 -3.41,-3.44 -3.98,-2.67 -2.19,-2.68 -0.1,-0.81 0.66,-2.15 2.07,-5.66 -0.97,-0.75 -2.94,-0.73 -1.13,0.56 -0.98,-1.14 -0.84,-2.85 -2.07,-3.01 -5.23,-5.35 -1.4,-5.17 0.03,-1.91 0.65,-2.29ZM1046.28,1582.99l-0.61,-1.25 0.6,-0.88 -0.02,-1.11 0.62,-1.1 -0.18,-0.34 0.54,-0.45 -0.25,-1.52 0.67,-0.7 0.55,0.04 1.57,-2.54 0.62,-0.26 1.72,-3.71 0.13,-1.01 -0.14,-1.42 -1.33,-3.81 0.37,-0.36 0.04,-1.44 0.89,-1.23 0.13,-35.74 31.01,0.02 -0.29,39.88 -0.45,0.76 0.29,0.64 -0.32,0.92 0.84,0.95 -0.12,0.72 -4.2,1.88 -1.56,-0.68 -1.12,0.1 -0.45,0.69 0.23,1.26 -0.39,0.96 -1,0.67 -1.82,2.65 -0.93,0.24 -1.97,3.92 -0.68,0.43 -2.12,-0.75 -1.22,-1.84 -0.53,-0.22 -0.04,0.49 -1.05,0.36 0.1,0.49 -1.72,3.05 -3.07,-1.46 -1.14,0.55 -1.95,1.91 -2.63,-1.7 -1.67,0.03 -0.78,-0.5 -0.64,1.77 -0.81,-0.96 -1.82,-0.23 -0.35,0.2 -0.37,1.56 -1.18,0.07ZM887.32,1594.27l-0.13,-43.63 75.98,0 2.62,1.92 1.5,-0.28 0.62,0.44 0.35,1.78 -1.2,0.73 -0.81,1.39 0.2,1.31 1.2,1.21 1.99,3.42 1.77,1.02 0.05,30.69 -84.14,0ZM1033.62,1594.4l0.23,-1.57 1,-1.15 1.98,-0.04 4.56,1.39 0.29,-0.46 -0.55,-3.49 3.46,-1.43 0.94,-1 -0.37,-1.24 0.13,-1.14 1.22,-1.45 0.95,0.1 0.52,-1.72 2.02,0.19 0.81,0.96 0.64,-1.77 0.78,0.5 0.7,-0.24 3.6,1.91 1.95,-1.91 1.14,-0.55 3.07,1.46 1.72,-3.05 -0.1,-0.49 1.05,-0.36 0.04,-0.49 0.53,0.22 1.22,1.84 2.12,0.75 0.68,-0.43 1.97,-3.92 0.93,-0.24 1.82,-2.65 1,-0.67 0.39,-0.96 -0.23,-1.26 0.45,-0.69 1.12,-0.1 1.56,0.68 4.2,-1.88 0.12,-0.72 -0.84,-0.95 0.32,-0.92 -0.29,-0.64 1.08,-1.25 1.95,0.58 1.87,-0.08 1.59,1.71 0.72,1.6 1.3,0.97 3.24,0.98 1.58,1.19 1.72,-0.73 2.06,1.06 1.75,-0.17 2.31,-1.1 1.36,0.06 1.4,2.46 1.92,1.76 0.12,2.15 -0.45,1.77 2.55,4.64 1.29,2.03 2.02,1.68 1.57,0.44 -4.3,3.48 -3.85,2.27 -0.58,1.28 -1.85,2.02 -1.69,0.86 -1.21,1.19 -6.61,2.49 -31.59,-1.11 -15.15,0.3 -0.34,-0.44 -2.59,-0.26 0.42,2.74 -15.83,0 0.61,-1.25 0.76,-0.4 0.84,0.31 0.61,-0.44 0.83,-2.64 0.08,-1.42 -0.36,-1.15ZM1029.83,1601.34l-0.79,0.03 0.08,-0.73 0.35,-0.03 0.36,0.73ZM978.02,1649.7l32.9,-0.05 0.06,0.67 0.55,0.39 -0.45,2.47 0.49,0.4 -0.65,1.36 0.52,1.82 1.81,2.15 0.08,0.72 -1.56,1.97 -0.2,1.14 -0.73,1.01 -1.48,1.16 -0.98,1.48 -0.98,2.92 -0.53,0.49 -0.27,2.31 -0.33,0.77 -0.68,0.14 -0.14,0.79 0.39,1.43 -0.69,1.44 21.86,0.01 -1.14,3.58 0.18,1.58 1.53,1.97 1.07,3.15 0.8,0.4 -0.77,0.36 -4.16,-1.36 -1.03,-1.09 -2.05,-0.36 -1.22,1.34 -0.92,1.8 2.71,1.47 2.06,-0.4 1.14,-0.88 0.93,0.03 0.85,-0.63 0.79,0.36 0.03,0.36 -1.71,1.44 0.81,1.02 1.28,0.34 0.48,-0.15 0.3,-1.14 0.78,-0.74 1.07,0.16 -0.15,0.47 0.64,1.18 0.03,1.32 -2,0.63 -0.69,0.61 0.36,0.36 -1.4,0.3 -0.43,0.73 0.52,1.06 1.83,1.55 3.79,1.1 0.73,1.14 1.15,0.59 -0.07,0.78 -1,0.58 -0.52,1.06 -0.92,-0.83 -1.59,1.29 0.26,-1.15 -1.02,-1.62 -2.02,-1.41 -1.96,-0.4 -0.29,-1.08 -0.67,-0.55 -3.21,-1.03 0.2,0.75 1.01,0.63 0,1.23 -0.95,2.62 -0.87,0.41 -1.01,-1.97 -0.88,-0.51 -1.41,-0.06 -0.95,0.36 -1.04,1.58 -0.83,0.26 -6.14,-2.06 0.09,-0.42 0.51,-0.13 0.99,0.17 -1.06,-1.82 -0.06,-1.4 -0.93,0.66 -2.09,-0.54 -1.8,-2.5 -1.73,-0.06 -0.78,-1.12 -1.41,0.47 -1.35,1.32 0.87,1.08 -0.28,0.32 -2.01,0.47 -4.67,-0.53 -5.74,-2.38 -5.91,0.12 -1.5,0.58 -0.65,-1.11 0.85,-0.53 0.41,-0.83 -0.24,-0.83 0.95,-1.78 -0.45,-3.06 0.34,-2.82 1.61,-3.51 0.18,-2.4 0.37,-0.55 -0.31,-1.78 -1.23,-1.9 -0.82,-2.55 -0.78,-0.73 -0.44,-3 -2.25,-2.76 0.02,-13.67ZM1032.83,1688.8l0.04,0.61 -1.38,-0.33 1.79,-1.39 -0.45,1.11ZM1037.34,1692.43l-0.32,0.42 0.31,-2 -0.44,-1.69 0.62,1.62 -0.17,1.65ZM1036.64,1693.68l-0.62,0.68 0.81,-1.21 -0.19,0.53ZM1003.59,1696.45l-0.42,0.19 -1.88,-1.14 -0.12,-0.48 1.49,-0.4 1.38,0.97 -0.45,0.86ZM1231.07,1520.32l-10.89,-0.34 -0.56,0.4 -0.01,-0.4 -7.66,-0.33 -0.3,-0.37 2.89,-10.36 21.89,0.77 4.04,-2.62 1.91,-0.08 -0.26,0.8 0.55,1.61 0.52,0.8 1.27,-0.03 0.12,0.75 -2.48,1.09 -2.45,3.41 3.51,1.57 1.37,2.9 -0.44,0.81 1.22,0.74 0.39,2.07 1,0.7 1.49,0.44 3.35,-1.49 -1.24,-3.12 -0.71,-0.5 -0.27,0.43 -0.51,-0.86 1.51,0.2 1.49,1.79 0.5,3.83 -0.17,0.51 -5.19,0.76 -2.87,1.41 -0.11,-2.68 -0.39,-0.07 -3.11,2.53 -1.2,0.16 -1.01,0.74 -0.41,-2.31 0.64,-1.59 -0.97,0.6 -1.22,-1.4 0.04,-1.42 -0.48,-0.17 -0.09,-1.75 -4.7,0.07ZM1245.75,1530.01l-3.13,0.74 -0.5,-0.48 2.43,-1.49 1.03,0.64 0.17,0.59ZM1251.81,1531.68l-0.88,0.25 -2.03,-0.56 1.94,-0.64 0.25,-1.04 0.72,1.99ZM1171.57,1567.03l0.12,1.2 1,-1.19 -1.26,-1.81 -0.91,1 -2.03,-1.61 -2.05,-0.87 -0.29,-0.43 0.31,-1.15 -2.96,-1.96 -0.6,-1.29 0.14,-0.69 -1.05,-1.29 0.19,-0.35 -1.96,-0.47 -0.8,-0.69 -0.95,-0.11 -2.56,0.85 -1.01,1.4 -2.08,-0.24 -1.14,-1.14 -2.2,2.55 -1.18,-0.33 -2.48,2.42 -2.22,1.48 0.12,-7.54 42.02,0.01 0.88,18.57 7.62,0 -0.01,0.42 -0.41,0.88 0.01,-0.64 -0.49,0.05 -0.49,2.2 -0.75,0.18 -1.71,3.14 -2.78,0.38 -0.44,0.65 -2.18,-0.25 0.63,-1.67 -1.51,-1.19 0.73,-1.33 0.06,-1.47 -1.24,1.03 -0.21,-0.59 -0.74,0.76 -1.83,-1.19 -0.95,-1.93 0.35,-1.53 3,-0.03 -2.41,-2.28 -0.75,-0.21 -0.71,0.92 0.46,-1.59 1.51,-0.5 -0.26,-0.92 -0.57,-0.4 -1.02,0.5 0.01,-0.64 0.19,-0.83 1.45,0.27 0.57,-1.34 0.03,-0.6 -0.96,0.87 -0.21,-1.87 0.94,-1.82 0.89,-0.79 2.26,-0.1 -1.45,-0.52 1.48,-1.47 -1.1,0.09 0.13,-1.19 -1.19,0.36 -0.39,1.89 -0.5,0.44 -0.85,0.34 -0.36,-0.87 -0.33,1.71 -0.62,-1.19 -0.32,1.16 -0.53,0.31 -0.17,1.16 -1.7,-0.65 0.92,1.62 0.7,0.48 0.09,0.76 -0.6,0.64 -0.98,-0.51 0.74,1.76 -0.49,2.96 0.41,3.06 1.22,2.37 -0.51,0.11 -1.52,-1.08 -1.2,-2.56 0.1,1.08 0.3,1.21 2.66,2.7 0.86,1.85 -0.09,0.78 -1.29,-1.25 -3.58,-1.3 -1.13,-1.85 -0.24,1.43 -1.27,-2.22 -1.76,0.7 -0.87,-0.16 0.13,-1.94 2.3,-3.45 -0.13,-1.62ZM1192.1,1579.36l-0.31,0.04 1.76,-3.77 -1.45,3.73ZM1262.32,1435.74l0.58,0.98 1.98,0.55 5.14,-1.89 0.22,-0.48 1.39,-0.02 4.88,4.41 0.45,19.11 -0.4,3.25 2.35,1.74 1.86,0.29 0.09,1.18 -0.79,0.91 0.75,1.56 -0.51,1.65 1.79,1.98 0.75,-0.76 1.42,0.5 0.5,2.91 -0.38,0.72 0.08,0.95 1.06,0.28 0.31,0.64 -2.33,2.44 -1.96,-0.34 -2.19,0.83 -0.49,1.09 -0.61,0.23 -2.12,-0.22 -0.77,1.95 -0.63,-0.17 -1.07,1.28 -1.09,-1.88 -1.43,-0.08 -1.09,0.99 -0.88,-1 -0.8,2.03 -0.13,1.94 -0.9,-0.83 -2.28,-0.46 1.16,-1.64 -0.96,-0.19 0.36,-1.86 -0.96,1.37 -1.3,0.82 0.06,1.36 -1.22,2.8 -0.05,1.18 -1.8,1.76 -1.35,-0.23 -2,1.64 -0.41,-1.35 -0.38,1.52 -0.39,0.09 -0.32,-1.79 -0.53,0.62 -0.35,1.62 -0.75,-0.92 -0.14,2.18 -0.73,-0.74 -1.16,0.5 0.1,-1.06 -2.43,1.39 -1.03,1.49 0.76,0.72 -3.62,4.35 -1.38,3.35 -1.04,1 -0.9,-1.46 -0.19,-1.17 -1.03,-1.4 -0.54,-2.03 -1.33,-29.23 1.41,-0.63 0.71,1.14 0.37,-0.13 0.75,-2.17 1.25,-0.38 -0.14,-2 3.19,-3.04 0.15,-1.04 1.27,-1.7 -0.09,-2.48 0.64,-3.18 2.06,-3.13 0.68,-4.44 7.38,-10.71 1.32,-1.89 2.19,0.61 -0.04,2.22ZM1272.18,1484.11l-1.39,0.18 -0.06,1.14 -1.1,-0.71 0.02,-1.11 1.25,-1.47 0.7,0.29 0.58,1.68ZM1267.22,1486.28l-0.89,0.21 -0.02,-0.78 0.3,-0.39 0.61,0.96ZM1029.71,1423.86l2.56,-0.37 7.53,-4.16 2.65,-0.67 2.48,1.33 37.37,22.35 1.1,4.36 2.48,2.98 1.82,-0.96 2.87,-0.45 0.27,0.25 -0.29,1.37 0.71,3.59 1.26,2.33 4.12,-0.53 1.66,2.01 -1.4,2.9 11.85,7.64 4.7,28.32 -3.07,7.79 -0.91,5.18 -0.65,1.77 -3.67,3.7 -2.34,1.31 -0.41,0.76 -0.46,1.67 0.32,2.94 -3.9,3.22 -15.15,0.58 0,-0.89 -27.59,-0.02 2.07,-11.23 -1.32,-12.95 0.15,-5.2 1.24,-6.84 3.62,-12.03 2.03,-3.14 3.09,-2.99 -5.8,-3.65 -3.88,0 -1.47,2.63 -1.99,1.71 -0.46,1.87 -2.2,-0.87 -0.77,-1.95 0.65,-2.08 -2.02,0.17 -0.38,-0.4 0.91,-3.42 -0.16,-1.46 -1.29,-1.21 -2.21,-0.91 0.23,-1.02 -0.63,-1.1 -3.88,-1.11 -3.92,-0.38 -3.21,-1.85 -11.37,-3.16 -1.27,-2.78 -1.26,-0.8 -0.58,0.15 -0.23,-0.6 10.4,-23.7ZM941.79,1406.78l23.48,0.02 0.07,-6.58 2.46,0.36 0.97,0.78 0.58,5.25 1.12,3.36 0.95,1.14 6.44,1.44 2.32,0.89 0.54,1 1.09,0.41 2.78,-0.62 0.98,-0.95 4.34,0.08 5.64,3.03 0.98,2.72 0.75,0 0.57,-0.89 1.44,-0.16 1.9,0.62 1.67,1.78 3.87,2.38 1.49,-0.01 3.91,-2.3 1.45,-0.26 0.86,0.14 1.09,1.64 7.43,-0.23 1.11,1.75 1.06,0.34 4.58,-0.05 -5.23,12.01 -7.92,-0.37 -9.27,6.42 -5.65,3.25 -1.82,-0.55 -1.12,1.52 -0.77,0.17 -0.02,9.51 -4.56,2.87 -2.31,4.09 0.05,1.03 1.54,0.84 0.85,1.79 -0.81,2.52 -0.06,2.69 -0.39,0.63 0.34,2.21 -0.41,2.32 0.34,1.02 1.43,1.29 2.3,0.94 2.29,1.99 2.11,0.99 2.43,3.27 5.22,3.22 0.71,0.86 0.47,2.19 0.38,4.64 -59.26,0.02 0,-28.6 -0.86,-1.2 -1.9,-0.98 -1.76,-3.15 2.69,-2.84 0.66,-2.33 -0.05,-3.21 -0.64,-3.1 -1.29,-2.41 -0.64,-2.9 0.19,-4.51 -0.63,-1.65 -0.38,-9.56 -1.47,-3.92 -0.22,-1.79 -1.35,-4.21 -0.02,-8.71 -1.11,-5.39ZM1027.36,1608.42l-7.7,0.12 0.89,-1.5 2.59,-2.78 0.01,-1.06 -1,-1.83 -50.7,0 -0.04,-37.79 -1.77,-1.02 -1.99,-3.42 -1.2,-1.21 -0.2,-1.31 0.81,-1.39 1.2,-0.73 -0.35,-1.78 -0.62,-0.44 -1.5,0.28 -2.8,-2.05 -0.82,-1.28 -0.33,-1.52 -2.26,-2.45 -1.17,-3.58 45.89,-0.34 0.56,1.09 2.73,2.58 -0.65,2.29 -0.03,1.91 1.4,5.17 5.23,5.35 2.07,3.01 0.84,2.85 0.98,1.14 1.13,-0.56 2.94,0.73 0.97,0.75 -2.07,5.66 -0.66,2.15 0.1,0.81 2.19,2.68 3.98,2.67 3.41,3.44 0.7,3.02 0,0.98 -0.46,0.94 0.18,1.25 1.53,2.53 0.71,0.32 0.2,-0.95 1.34,1.25 0.36,1.15 -0.08,1.42 -0.83,2.64 -0.61,0.44 -0.84,-0.31 -0.76,0.4 -0.85,1.4 -0.54,-0.93 -0.35,0.03 0.11,1.78 -0.81,1.48 0.32,0.71 -1.04,0.72 0.46,0.75 -0.09,0.89 -0.71,1.45ZM1044.78,1622.43l1.01,0.92 -4.57,41.48 0.99,20.2 -3.33,0.2 -2.42,-0.79 -3.63,1.09 -1.1,-0.17 -1.4,1.61 -0.88,0.4 -0.8,-0.4 -1.07,-3.15 -1.53,-1.97 -0.18,-1.58 1.14,-3.58 -21.86,-0.01 0.69,-1.44 -0.39,-1.43 0.14,-0.79 0.68,-0.14 0.33,-0.77 0.27,-2.31 0.53,-0.49 0.98,-2.92 0.98,-1.48 1.48,-1.16 0.73,-1.01 0.2,-1.14 1.56,-1.97 -0.08,-0.72 -1.81,-2.15 -0.52,-1.82 0.63,-0.93 -0.48,-1.55 0.46,-1.75 -0.55,-0.39 -0.1,-1 0.53,-2.41 -0.65,-1.04 0.26,-1.97 -0.84,-1.97 0.48,-0.46 -0.4,-0.8 1.76,-2.08 -0.08,-2.22 1.65,-0.81 -0.29,-1.1 0.35,-0.83 1.05,-0.87 0.63,-1.44 1.44,-0.79 0.59,-1.24 0.5,-3.1 0.74,-0.45 0.67,-1.26 1.09,-0.66 0.43,-0.64 -0.13,-0.78 24.12,0.03ZM750.22,1406.78l114.11,0 0.32,66.64 -80.16,0 -0.01,8.04 -1.24,-0.91 -1.63,-2.67 -0.78,-0.37 -0.86,0.56 -0.59,2.66 -8.32,-0.25 -1.01,0.44 -0.63,1 -3.88,-0.44 -0.81,0.55 -0.5,1.06 -0.9,-0.36 -1.02,-0.97 -0.71,-2.95 -0.89,-1.61 -1.06,-0.71 -1.19,0.03 -1.39,-1.54 0.15,-2.01 -2.84,-4.46 -1.2,-4.8 -2.15,-1.5 -1.42,1.86 -2.06,1.48 -2.64,-1.43 0.38,-1.79 -0.3,-2.11 1.43,-1.24 -0.22,-1.49 -0.71,-0.87 -0.08,-2.01 0.44,-0.68 1.25,-7.59 -2.57,0.14 -0.7,-0.45 -0.42,-1.12 -1.05,0.18 -6.29,-8.28 -4.51,-3.47 0.38,-1.01 -0.47,-0.93 0.23,-0.91 -0.32,-1.26 -3.76,-5.48 0.01,-16.97 22.59,0ZM1102.34,1622.4l-13.77,0.18 0.73,-3.64 2.26,-0.5 0.66,-1.79 1.51,-1.41 4.1,-0.97 4.44,-2.66 1.49,-0.37 1.16,-2.12 0.85,0.06 1.29,-1.16 1.01,-0.25 0.66,1.08 2.94,-2.29 1.28,-0.28 0.93,0.66 0.56,-0.23 1.63,-2.59 1.98,-0.69 0.34,-2.52 0.51,-1.09 64.77,0.84 -0.14,1.73 1.28,2.28 0.53,2.18 -0.72,-0.88 -3.01,-1.46 -0.03,1.88 -1.37,-0.62 0.49,1.04 -1.78,-0.25 -1.08,1.48 -0.92,0.18 -1.36,-0.84 -0.62,-2.17 0.09,3.83 4.18,0.06 1.73,-0.54 1.56,0.3 -0.16,3.92 0.94,-0.44 0.25,-2.44 1.9,-0.84 0.76,2.67 -0.33,1.66 -3.75,3.73 -0.8,0.37 -3.59,-0.6 -0.49,-1.56 -0.51,-0.33 -0.38,0.04 -0.27,1.06 -1.22,0.31 -3.39,-1.34 0.74,0.96 4.31,1.8 0.94,0.82 -1.07,1.64 -0.24,1.11 -1.72,1.15 -0.93,-0.2 -2.38,-2.08 1.09,1.8 0.86,0.76 1.75,0.41 3.28,-0.68 1.08,0.74 -1.76,2.21 -2.17,0.34 -0.29,0.63 -4.56,-0.01 -1.85,1.45 -0.71,-0.24 -0.61,-1.53 -0.01,1.92 0.38,0.9 -4.22,3.34 -1.25,1.86 -0.77,2.88 -0.28,-3.15 -0.2,2.41 -0.49,1.12 -4.46,-0.08 -1.81,0.56 -12.39,-12.67 -12.86,-0.45 -0.1,-1.86 -1.61,-2.09 -1.26,0.66 -0.02,-0.91 -0.46,-0.34 -14.85,-0.77 -4,1.77 -4.22,1.15ZM1184.55,1600.67l0.36,0 1.13,4.54 2.55,5.77 -3.14,-6.36 -0.9,-3.95ZM1187.43,1610.47l-0.17,0.28 -0.75,-1.55 0.77,0.5 0.15,0.77ZM1188.48,1619.08l-1.67,0.26 1.75,-0.8 0.63,-4.1 -0.25,-2.76 0.53,2.87 -0.09,1.62 -0.9,2.91ZM1177.56,1627.37l-0.29,0.15 1.05,-1.72 2.61,-2.53 -3.37,4.1ZM894.67,1406.78l47.12,0 1.11,5.39 0.02,8.71 1.35,4.21 0.22,1.79 1.47,3.92 0.38,9.56 0.63,1.65 -0.19,4.51 0.64,2.9 1.5,3.32 0.43,2.19 0.05,3.21 -84.82,-0.01 -0.25,-51.35 30.34,0ZM887.19,1550.64l-0.01,-14.95 -22.72,-0.01 -0.08,-30.63 63.57,0.01 3.4,2.31 2.03,0.72 0.95,-0.68 2.08,-0.39 5.23,0.22 6.41,3.45 0.48,1.07 0.86,0.68 1.21,0.29 0.77,1.36 0.31,2.42 0.69,1.96 1.07,1.48 1.31,3.29 0.32,4.19 0.53,0.12 0.34,0.98 0.44,0.19 -0.07,1.42 0.65,0.78 -0.17,1.58 0.41,0.36 0.42,4.5 -0.28,2.17 1.98,4.18 0.26,1.55 0.62,1 0.98,0.46 0.66,0.99 0.33,1.52 1,1.41 -75.98,0ZM1234.29,1473.31l1.12,-3.11 1.04,-1.45 1.43,0.49 1.34,-0.55 1.33,29.23 0.54,2.03 1.03,1.4 0.19,1.17 0.9,1.46 -0.5,2.02 -0.33,0.99 -1.91,0.08 -4.04,2.62 -12.94,-0.43 -0.95,-2.43 0.87,-2.36 1.27,-8.57 2.81,-5.97 0.95,-5.31 2.35,-1.17 2.46,-2.23 0.46,-1.49 -0.59,-2.63 1.25,-2.19 -0.08,-1.6ZM1193.82,1550.91l3.86,-2.55 -2.74,-3.75 -0.66,-0.21 -0.72,-1.84 -1.04,-0.79 0.16,-2.69 1.13,-1.22 -0.54,-2.15 2.39,-2.36 1.14,-2.21 1.29,-0.84 8.98,5.51 -1.32,3.55 -1.83,1.63 -0.88,1.79 0.26,1.08 2.18,0.4 0.58,-0.34 0.3,0.78 0.17,1.07 -1.39,8.03 0.17,-3.04 -0.6,0.82 -0.67,3.13 -0.91,1.67 -0.85,1.15 -0.87,-0.19 0.2,0.91 -0.44,1.47 -0.52,0.66 -1.19,0.39 -2.45,4.61 -1.47,0.89 -0.35,-0.13 0.65,-2.87 -1.74,-0.96 -0.98,0.05 -2.47,-1.94 -1.95,-2.22 0.01,-1.64 1.16,-2.78 3.05,-1.2 0.9,-1.67ZM1204.53,1555.39l-1.34,2.24 1.64,-3.21 -0.3,0.97ZM807.28,1672.34l0.01,-78.07 68.79,0 0.01,7.1 -0.48,0.01 -0.27,61.94 -40.99,0.03 1.16,2.43 1.38,0.68 -20.1,-0.14 -0.03,6 -9.48,0.02ZM750.48,1594.23l-0.03,11.65 -1.6,2.13 -0.56,-0.02 -1.98,-1.64 -1.13,-0.11 -1.86,0.49 -0.82,1.52 0.62,1.35 0.47,4.02 -0.19,1.2 0.81,2.69 -0.22,5.03 -40,-38.16 -21.32,-18.98 -0.01,-44.9 67.79,-0.01 0.03,73.74ZM1140.49,1512.22l8.25,-4.08 1.11,-0.95 0.21,-1.11 -1.2,-1.28 -0.46,-1.38 0.08,-2.68 -1.28,-2.95 5.14,-2.49 21.62,-0.06 4.04,-6.77 3.18,-2.92 0.39,-0.98 3.13,-1.8 5.4,-5.68 2.53,-2.04 3.67,-1.68 17.12,-0.02 -0.23,6.54 0.71,2.2 -0.13,3.03 -1.2,3.08 0.59,4.28 -0.47,3.37 0.97,-0.58 0.95,1.16 -0.38,11.54 0.31,0.95 -2.89,10.36 0.3,0.37 -0.73,11.58 0.69,1.16 -2.71,1.73 1.05,1.7 -4.06,3.62 1.31,-4.57 -0.12,-1.75 -0.49,-0.72 -0.5,-0.48 0.59,1.73 0.09,2.16 -8.98,-5.51 -0.65,-1.01 -2.04,-0.77 -1.32,-2.04 -0.02,-2.38 -0.48,-1.02 -1.63,-0.93 -1.28,-1.62 -50.2,-0.04 0.02,-8.27ZM1223,1535.91l-0.81,0.97 0.73,0.1 3.79,-1.99 0.93,0.48 2.26,-0.69 -7.42,3.54 -7.27,2.58 -8.02,1.25 1.14,-1.06 -0.87,-0.15 -0.61,0.79 -0.98,0.26 -0.19,-0.86 1.74,-2.3 2.09,-1.18 0.49,0.49 0.11,-0.65 0.78,-0.58 10.8,-1.09 3.99,-2.43 -2.68,2.52ZM1203.9,1542.86l-0.54,0.07 0.54,-1.44 1.36,-0.52 -0.12,0.94 -1.24,0.95ZM1102.26,1521.27l1.04,1.79 3.87,2.41 2.86,0 13.21,-8.17 8.61,-1.77 0.02,25.48 -1.35,0.65 -0.24,0.6 0.62,1.77 0.03,1.21 -3.08,9.34 -0.02,1.05 -1.01,1.38 -3.41,2.72 -0.8,0.35 -1.21,-0.44 -1.9,1.74 -0.58,0.04 -1.65,2.73 0.25,2.03 -1.32,0.78 -0.61,-1.4 -0.58,-0.32 -0.81,0.71 -1.49,2.84 0.26,1.91 -2.35,2.96 -1.26,0.28 -1.41,-0.52 -2.54,-2.58 -0.41,-1.2 -1.36,-0.06 -2.31,1.1 -1.75,0.17 -2.06,-1.06 -1.72,0.73 -1.58,-1.19 -3.24,-0.98 -1.3,-0.97 -0.72,-1.6 -1.59,-1.71 -2.62,-0.05 -0.53,-0.5 -1.3,0.54 0.29,-38.99 15.15,-0.58 3.9,-3.22ZM971.45,1601.37l2.04,15.66 -0.51,24.01 -2.56,-0.7 -5.76,-3.56 -1.8,1.17 -1.71,-0.17 -0.8,-0.8 -2.16,1.1 -1.79,-0.25 -2.25,0.83 -2,1.52 -3.15,-1.89 -0.17,-0.77 -1.59,0.7 -1.15,-0.39 -0.98,-0.97 -1.48,1.33 -0.63,1.67 -0.83,-0.69 0.07,-1.17 -0.33,-0.37 -2.09,0.91 -1.96,-1.16 -0.8,-1.04 -2.29,1.59 -0.9,-0.04 -0.34,-1.27 -1.34,-0.95 -0.33,-1.44 -2.93,0.05 -1.11,0.87 -1.76,-1.14 -1.39,0.2 -4.86,-1.06 -1.09,-2.27 -1.22,-0.93 -0.51,0.88 -2.58,0.05 -2.67,-2.14 -1.51,-0.6 -0.04,-26.77 -34.1,0 -0.01,-7.1 95.38,0 -0.01,7.1ZM682.66,1520.5l-48.1,-0.01 -1.45,-1.87 -0.74,-3.97 0.16,-3.12 -1.51,-3.55 2.19,-8.24 1.7,-1.28 -1.03,0.22 1.58,-4.43 0.57,-10.16 0.59,-1.46 -0.14,-5.63 1.48,-12.9 -0.36,-4.33 0.16,-4.88 -0.48,-1.29 0.88,0.61 2.71,-0.01 1.73,-0.65 2.27,1.29 2.29,-0.57 0.89,0.31 1.14,0.74 1.13,2.24 1.33,4.97 0.87,0.75 5.09,0.59 1.33,-0.18 2.31,-1.42 2.5,-0.46 2.96,0.1 1.82,0.4 0.66,0.71 1.58,0.07 7.9,-1.4 4.74,-1.84 5.75,-1.57 2.87,-0.18 1.79,-0.91 24.16,-0.02 1.5,2.11 2.77,2.46 0.5,1.32 -0.82,3 -2.14,4.65 -1.35,4.24 -3.93,7.51 0.05,1.47 0.65,0.85 2.12,0.72 0.47,0.73 -1.23,6.11 0.04,28.16 -33.95,0ZM1131.85,1515.53l3.11,-0.64 5.53,-2.67 -0.02,8.27 50.2,0.04 1.28,1.62 1.63,0.93 0.48,1.02 0.02,2.38 0.8,1.53 2.56,1.28 0.65,1.01 -1.29,0.84 -1.14,2.21 -2.39,2.36 0.54,2.15 -1.13,1.22 -0.2,1.28 0.04,1.41 1.04,0.79 0.72,1.84 0.66,0.21 2.74,3.75 -3.28,2.04 -1.7,1.82 -2.82,1.18 -2.43,-0.36 -1.71,1.74 -53.87,-0.01 -0.02,-39.24ZM1230.59,1530.63l0.53,-2.8 -0.05,-7.51 4.7,-0.07 0.09,1.75 0.48,0.17 -0.04,1.42 1.22,1.4 -0.43,0.38 -1.35,-1.74 0.3,1.42 -0.72,1.05 -0.19,2.73 -0.9,1.14 -3.64,0.66ZM1237.43,1528.25l-1.19,0.35 0.75,-2.3 0.55,-0.52 -0.11,2.47ZM1236.02,1528.35l-0.31,0.29 0.1,-1.58 0.33,0.43 -0.12,0.86ZM1127.85,1662.96l-2.3,-1.07 -0.69,-0.97 -0.41,-2.67 -1.35,-2.39 -0.99,-0.68 -1.28,-4.44 -1.01,-1.8 -2.3,-1.72 -2.56,-4.47 -2.31,-1.92 -1.63,-2.38 -2.7,-2.47 -2.94,-5.77 -2.34,-1.02 -3.44,-2.73 0.44,-1.35 2.22,-2.7 4.3,-1.16 4,-1.77 14.85,0.77 0.46,0.34 0.02,0.91 1.26,-0.66 1.61,2.09 0.1,1.86 12.86,0.45 12.39,12.67 -4.05,2.99 -2.48,3.45 -0.63,2.2 -0.51,-0.92 0.14,-1.27 -0.63,1.22 0.6,1.77 -0.53,0.68 -1.64,1.26 -1.9,0.57 -0.32,1.24 -2.16,1.65 -1.46,-0.31 0.45,1.1 -0.54,0.83 -0.92,0.64 -2.37,0.59 -1.51,1.02 -2.38,-0.44 -0.71,0.29 1.82,1.2 -0.13,0.96 -1.06,0.87 -0.33,-0.08 -0.45,-1.39 -0.7,0.8 -1.06,-1.5 0.05,1.14 1.18,1.99 -0.73,0.99 -1.03,0.38 -0.27,1.13ZM950.57,1497.24l-1.65,0.06 0.73,2.5 -0.33,1.49 0.84,0.58 0.32,1.18 -1.88,5.8 1,1.52 0.66,2.28 -1.73,-0.89 -0.48,-1.07 -1.47,-0.98 -4.94,-2.47 -5.23,-0.22 -2.08,0.39 -0.95,0.68 -2.03,-0.72 -3.4,-2.31 -63.57,-0.01 -0.09,-31.63 0.37,-0.2 -0.08,-15.09 84.82,0.01 -0.66,2.33 -2.69,2.84 1.76,3.15 1.9,0.98 0.86,1.2 0,28.6ZM1073.79,1622.4l-29.2,-0.33 0.19,0.36 -24.12,-0.08 1.72,-1.52 0.56,-1.24 -0.17,-1.55 2.07,-3.87 -0.2,-1.23 0.56,-1 1.31,-0.77 0.18,-1.17 0.85,-0.45 -0.23,-0.87 0.85,-2.6 -0.46,-0.75 1.04,-0.72 -0.32,-0.71 0.64,-0.72 -0.02,-1.81 17.04,0.02 -0.42,-2.74 2.59,0.26 0.34,0.44 15.15,-0.3 31.59,1.11 23.57,-0.34 -0.51,1.09 -0.34,2.52 -1.98,0.69 -1.63,2.59 -0.56,0.23 -0.93,-0.66 -1.28,0.28 -2.94,2.29 -0.66,-1.08 -1.01,0.25 -1.29,1.16 -0.85,-0.06 -1.16,2.12 -1.49,0.37 -4.44,2.66 -4.1,0.97 -1.51,1.41 -0.66,1.79 -2.26,0.5 -0.73,3.64 -14.78,-0.18ZM972.98,1641.04l1.44,1.19 1.89,-0.38 1.64,0.47 0.05,21.05 2.25,2.76 0.44,3 0.78,0.73 0.82,2.55 1.23,1.9 0.31,1.78 -0.37,0.55 -0.18,2.4 -1.61,3.51 -0.34,2.82 0.45,3.06 -0.95,1.78 -0.54,-0.04 -1.19,2.17 0.64,1.64 -2.39,0.25 -7.5,3.74 0.1,-0.44 2.55,-1.7 -2.87,0 0.62,-1.4 -0.2,-1.24 -1.03,-0.04 -0.66,1 -1.51,-0.34 0.34,2.25 1.19,2.09 -2.85,2.65 -0.15,1.15 -1.38,1.5 -6.6,4.2 -4.34,1.96 2.55,-1.85 -4.13,-0.32 -0.85,0.81 -1.45,-1.58 -0.73,0.09 1.31,2.86 1.18,0.4 -1.6,1.17 -1.3,0.33 -1.11,-1.04 -0.38,2.61 -0.37,0.33 -0.59,0.48 -0.48,-0.87 -0.93,0.79 -1.6,0.25 0.17,1.07 1.21,-0.42 -0.44,1.39 -1.12,1.37 -0.91,0.32 -1.39,-0.2 -0.65,0.42 1.62,2.15 -1.71,4.39 -0.96,0.18 -2.79,-1.84 0.87,2.18 2.36,0.64 0.1,1.53 -0.9,1.92 1.37,6.14 2.51,5.3 0.72,0.03 0.12,0.45 -0.07,0.87 -1.54,0.25 -0.87,0.9 -2.61,-1.44 -2.43,-0.73 -5.39,-0.88 -1.17,-0.9 -3.57,-1.19 -0.84,-0.82 -3.9,-1.35 -1.39,-4.01 -2.57,-3.76 0.18,-1.45 -0.79,-2.18 0.27,-0.74 -0.22,-1.92 -2.83,-2.34 -4.07,-5.7 -2.1,-2 -0.4,-2.26 -2.48,-4.14 -1.24,-3.21 -1.09,-1.49 -2.98,-2.84 -0.26,-0.78 -3.01,-2.27 -0.87,-1.42 -1.87,-0.54 -0.02,-0.32 -5.06,0.16 -3.16,-0.99 -0.85,0.08 -0.48,0.77 -1.03,0.49 -1.58,0.22 -1.36,1.42 -1.13,2.61 -0.5,1.68 0.14,0.75 -2.56,2.82 -0.89,0.56 -1.01,-0.03 -1.88,-0.91 -4.9,-2.87 -1.55,-0.42 -4.68,-3.27 -2.52,-3.68 -0.67,-1.79 0,-1.89 -2.69,-5.92 -6.78,-5.26 -5.81,-5.55 -1.41,-0.71 -3.28,-4.19 -1.48,-0.73 -1.16,-2.43 40.99,-0.03 0.27,-61.94 34.58,-0.01 0.04,26.77 1.51,0.6 2.06,1.76 0.61,0.38 2.58,-0.05 0.51,-0.88 1.22,0.93 1.09,2.27 4.86,1.06 1.39,-0.2 1.76,1.14 1.11,-0.87 2.93,-0.05 0.33,1.44 1.34,0.95 0.34,1.27 0.9,0.04 2.29,-1.59 0.8,1.04 1.96,1.16 2.32,-0.82 -0.07,1.13 0.63,0.97 0.53,-0.18 0.4,-1.45 1.48,-1.33 0.98,0.97 1.15,0.39 1.59,-0.7 0.17,0.77 3.15,1.89 2,-1.52 2.25,-0.83 1.79,0.25 2.16,-1.1 0.8,0.8 1.71,0.17 1.8,-1.17 5.76,3.56 2.56,0.7ZM966.66,1701.08l-0.57,0.13 3,-2.68 0.67,0.03 -3.1,2.52ZM947.04,1713.96l-0.42,0.05 0.52,-0.69 4,-2.32 -0.11,0.57 -3.99,2.39ZM944.19,1717.19l-0.24,0.04 0.65,-1.48 1.38,-1.54 0.2,0.57 -1.99,2.41ZM940.33,1724.92l-0.35,0.73 1.02,-3.59 1.88,-3.29 0.79,-0.55 -2.17,3.61 -1.17,3.09ZM942.41,1739.45l-0.15,0.59 -2.48,-8.99 0.18,-4.81 0.4,5.05 2.05,8.16ZM807.29,1594.27l-56.81,-0.04 -0.03,-73.74 34.04,0 0.01,15.19 22.79,0 0,58.59ZM1170.52,1566.23l1.05,0.8 -0.18,1.65 -2.44,2.57 -0.61,2.95 0.93,0.82 2.11,-0.24 1.6,2.32 4.06,1.48 0.88,1.2 2.36,1.7 -0.47,2.48 -0.44,0.66 -1.68,-0.1 -3.83,-4.02 -1.27,-1.93 -1.94,-1.02 2.11,1.92 4.28,5.24 2.77,1.4 -0.7,0.6 1.12,0.5 0.06,1.98 -1.56,-0.42 0.09,1.23 -0.7,0.38 -0.96,-0.51 -2.49,-2.81 0.22,0.81 1.45,1.81 3.23,2.48 0.5,1.38 -1.34,0.87 -2.29,-2.16 -0.33,-1.13 -0.83,0.06 -3.45,-1.43 -2.77,-0.16 6.58,2.23 0.44,1.79 1.47,1.23 0.19,0.91 1,0.1 1.77,-0.89 2.79,0.57 1.61,5.14 -65.81,-0.63 -3,-0.33 -0.54,0.29 -19.51,-0.1 5.89,-2.23 1.21,-1.19 1.69,-0.86 1.85,-2.02 0.58,-1.28 3.85,-2.27 4.3,-3.48 -0.07,0.96 1.09,2.05 3.26,1.74 2.72,-1.8 1.95,1.01 2.99,-0.69 0.82,-1.58 1.41,0.3 2.41,-0.98 0.49,0.52 1.06,-0.57 1.43,-2.12 -0.45,-0.81 0.45,-1.07 3.12,-4.25 0.78,-1.95 2.14,-3.24 0.86,-2.44 0.96,0.19 0.57,0.99 1.24,0.53 1.77,-0.32 2.27,-4.56 0.56,-0.44 1.4,0.03 3.27,-2.65 1.66,-2.37 1.29,-4.28 5.53,4.51 1.24,-2.96 2.19,1.19 0.63,0.66 -0.31,1.15 0.29,0.43 2.05,0.87 2.03,1.61ZM1187.17,1580.61l0.44,-0.65 2.78,-0.38 -2.51,5.68 0.11,1.04 -1.27,0.6 -1.29,1.31 -1.39,3.91 -0.72,-1.6 0.25,-1.93 0.99,-3.16 1.92,-2.91 0.69,-1.91ZM1191.79,1579.4l0.31,-0.04 -1.22,2.2 -0.52,0.23 1.43,-2.39ZM1213.42,1473.35l20.87,-0.04 0.08,1.6 -1.25,2.19 0.59,2.63 -0.46,1.49 -2.46,2.23 -2.35,1.17 -0.95,5.31 -2.81,5.97 -1.27,8.57 -0.87,2.36 0.95,2.43 -8.95,-0.34 -0.31,-0.95 0.38,-11.54 -0.95,-1.16 -0.97,0.58 0.47,-3.37 -0.59,-4.28 1.2,-3.08 0.13,-3.03 -0.71,-2.2 0.23,-6.54ZM650.94,1406.78l65.42,0 0,43.9 1.09,2.71 0.24,1.13 -0.3,0.64 0.59,2.01 -24.16,0.02 -1.79,0.91 -2.87,0.18 -5.75,1.57 -4.74,1.84 -7.9,1.4 -1.58,-0.07 -0.66,-0.71 -1.82,-0.4 -2.96,-0.1 -2.5,0.46 -2.31,1.42 -1.33,0.18 -5.09,-0.59 -0.87,-0.75 -1.33,-4.97 -1.13,-2.24 -1.14,-0.74 -0.89,-0.31 -1.14,0.41 -2.78,-1.93 -2.11,0.05 -0.43,-0.52 -2.36,0.52 -0.73,-0.54 -1.28,0.35 0.32,-5.37 1.12,2.85 0.65,-3.77 -2.08,-1.4 -0.46,-1.96 3.06,-1.68 -3.06,-1.2 -0.31,1.35 -0.68,-4.25 -1.25,-3.29 -0.76,-4.28 -0.96,-2.12 -1.83,-2.03 -0.48,-1.19 -0.53,-6.93 8.35,3.62 7.75,0.83 1.51,-0.59 2.14,1.38 2.22,-1.09 1.39,4.36 -1.39,2.42 -0.26,0.05 -0.22,-0.98 -2.61,4.07 -1.01,2.8 0.4,0.63 2.07,-1 -1.65,0.14 0.08,-0.91 0.88,-1.78 1.92,-1.67 2.34,-3 0.26,-1.57 0.6,0.14 0.1,2.55 -1.21,1.3 0.19,1.3 -0.7,0.06 1.34,2.51 -0.23,2.86 -0.81,0.19 -0.67,-0.58 -0.68,1.64 -0.69,-1.98 -1.04,0.78 -1.23,2.53 2.45,-0.12 1.25,0.59 1.12,-0.94 0.7,-1.82 1.39,-0.61 0.76,-1 -0.17,-3.91 -0.48,-0.82 0.31,-1.08 -0.21,-1.15 1.82,-3.84 -1.98,-2.95 0.24,1.7 -1.39,-1.29 -0.04,-1.19 1.33,-0.68 -0.06,-0.42 -1.51,-2.01 -1.45,-0.93 0.47,-0.56 1.49,-0.13 -0.18,-2.82 -0.56,-1.87 -1.04,0.24 -0.37,-0.52 -1.17,-3.44ZM651.01,1412.31l0.15,0.38 -0.78,0.42 -0.74,-0.66 0.12,1.21 -1.26,-0.99 1.2,-1 1.31,0.64ZM648.38,1415.27l0.3,0.56 -1.74,-0.68 -0.25,-1.69 0.54,-0.12 1.15,1.93ZM650.57,1416.46l-1.14,-0.44 0.1,-1.39 0.49,-0.18 0.55,2.01ZM653.39,1421.16l0.56,2.24 0.24,-0.93 1.55,1.61 -0.19,1.05 -1.98,-1.17 -0.74,-2.71 -1.36,-1.26 1.29,-2.72 1.06,1.08 -0.08,0.47 -1.76,1.11 1.13,0.48 0.28,0.75ZM654.25,1430.7l-0.89,-0.42 0.3,-1.43 0.47,0.36 0.12,1.49ZM655.43,1434.05l-0.49,0.68 -0.36,-0.59 -0.47,0.54 0.27,-2.2 1.05,1.57ZM650.2,1437.25l-0.26,0.31 -0.36,-0.67 0.26,-0.81 0.36,1.17ZM1016.6,1512.62l-0.43,-1.5 -4.34,-2.76 -0.55,-1.45 -0.49,-3.43 0.62,-2.74 -0.12,-0.83 -0.7,-0.44 -0.68,-1.27 -0.93,-7.81 -0.71,-0.86 -5.22,-3.22 -2.43,-3.27 -2.11,-0.99 -2.29,-1.99 -2.3,-0.94 -1.43,-1.29 -0.34,-1.02 0.41,-2.32 -0.34,-2.21 0.39,-0.63 -0.08,-2.03 0.95,-3.18 -0.85,-1.79 -1.54,-0.84 -0.05,-1.03 2.31,-4.09 4.56,-2.87 0.02,-9.51 0.77,-0.17 1.12,-1.52 1.82,0.55 5.65,-3.25 9.27,-6.42 7.92,0.37 -5.17,11.69 0.23,0.6 0.58,-0.15 1.26,0.8 1.27,2.78 11.37,3.16 3.21,1.85 3.92,0.38 3.88,1.11 0.63,1.1 -0.23,1.02 2.21,0.91 1.29,1.21 0.16,1.46 -0.91,3.42 0.38,0.4 2.02,-0.17 -0.65,2.08 0.77,1.95 2.2,0.87 0.46,-1.87 1.99,-1.71 1.47,-2.63 3.88,0 5.8,3.65 -3.09,2.99 -2.03,3.14 -3.62,12.03 -1.24,6.84 -0.15,5.2 1.32,12.95 -41.09,-0.31ZM1115.42,1586.57l-1.57,-0.44 -2.02,-1.68 -3.51,-5.95 -0.33,-0.72 0.45,-1.77 -0.39,-2.56 1.31,0.49 2.04,-0.94 0.31,-1.06 1.26,-1.24 -0.26,-1.91 1.49,-2.84 0.81,-0.71 0.58,0.32 0.61,1.4 1.32,-0.78 -0.25,-2.03 1.65,-2.73 0.58,-0.04 1.9,-1.74 1.21,0.44 0.8,-0.35 3.41,-2.72 1.01,-1.38 0.02,-1.05 3.08,-9.34 -0.03,-1.21 -0.62,-1.77 0.24,-0.6 1.35,-0.65 0,13.76 11.85,0 -0.12,7.54 2.22,-1.48 2.48,-2.42 1.18,0.33 2.2,-2.55 1.14,1.14 2.08,0.24 1.01,-1.4 2.56,-0.85 0.95,0.11 0.8,0.69 1.96,0.47 -0.19,0.35 1.05,1.29 -0.14,0.69 0.74,1.4 -1.24,2.96 -5.53,-4.51 -1.29,4.28 -1.66,2.37 -3.27,2.65 -1.4,-0.03 -0.56,0.44 -2.27,4.56 -1.77,0.32 -1.24,-0.53 -0.57,-0.99 -0.96,-0.19 -0.86,2.44 -2.14,3.24 -0.78,1.95 -3.12,4.25 -0.45,1.07 0.45,0.81 -1.43,2.12 -1.06,0.57 -0.49,-0.52 -2.41,0.98 -1.41,-0.3 -0.82,1.58 -2.99,0.69 -1.95,-1.01 -2.72,1.8 -3.26,-1.74 -1.09,-2.05 0.07,-0.96ZM864.46,1535.68l-79.96,0 -0.01,-62.26 79.8,0 0.17,62.26ZM3705.84,1830.6l-0.35,0.45 -0.37,-0.98 0.7,0.2 0.02,0.33ZM3705.88,1859.53l-0.61,0.03 -0.31,-0.5 0.73,-0.02 0.19,0.49ZM3700.79,1885.25l-0.56,0.55 -0.72,-0.62 0.91,-0.3 0.37,0.37ZM3706.62,1838.8l-0.55,0.26 0.89,-1.38 0.32,0.43 -0.66,0.69ZM3706.33,1873.78l-0.03,0.31 -0.74,-0.21 0.33,-1.07 1.24,-0.59 -0.8,1.56ZM3705.31,1875.7l-0.47,0.6 -0.39,-1.31 0.44,-0.35 0.25,0.01 0.17,1.05ZM1310.21,1835.79l-0.86,0.11 -1.17,-0.56 1.53,-0.08 0.5,0.53ZM1312.32,1835.5l-1.46,0.16 0.4,-0.37 1.06,0.21ZM1311.11,1842.2l0.95,0.53 1.16,0 -1.21,0.53 -2.3,0.05 0.05,-0.84 1.35,-0.27ZM3694.84,1895.77l-0.48,0.02 -0.56,-0.65 -0.01,-1.35 1.6,-1.15 0.53,-1.11 0.44,0.09 0.74,0.52 -1.83,1.86 -0.43,1.77ZM105.51,2213.02l-0.48,0.1 -0.59,-0.56 1.5,-0.64 1.37,0.11 -0.82,0.18 -0.98,0.81ZM1295.59,1834.42l0.7,0.2 -0.28,-0.49 0.26,0 5.02,1.05 0.09,1.66 -3.98,3.21 -3.12,0.33 -6,-0.47 -1.45,0.46 -3.38,-0.55 0.28,-2.76 -1.05,-1.68 1.05,-0.85 0.15,-0.77 1.13,-0.27 9.91,0.56 0.67,0.37ZM1303.6,1838.48l-1.47,-0.02 -0.2,-0.36 1.09,-0.33 2.07,0.38 -1.49,0.33ZM1275.76,1839.03l-0.66,-0.32 0,-0.34 0.99,0.05 -0.33,0.61Z`,TKe=`M1102.45,1516.11l0.32,0.17 -0.35,3.14 3.11,1.13 2.15,-0.62 1.52,1.61 0.57,-1.92 0.57,-0.7 6.11,-3.25 -0.14,0.89 0.23,-0.02 1.55,-2.9 3.71,-2.83 4.15,-0.5 10.76,1.79 0.36,-0.12 -4.43,-0.91 2.63,-2.49 1.38,-0.44 8.11,-1.21 3.75,0.28 1.53,-0.95 -1.34,-1.52 -0.3,-1.32 1.95,0.75 -0.33,0.94 0.53,3.08 -3.78,3.78 -5.63,3.93 -7.17,3.98 -10.17,4.13 -5.63,3.95 -4.53,0.28 -4.08,1.44 -1.85,-1.05 -4.38,0.19 3.73,-1.01 -1.49,-0.89 -1.51,0.57 -5.61,-3.05 1.07,-2.1 2.12,-2.58 0.01,-1.5 0.8,-2.15Z(M1149.27,1505.2l0.33,0.06 0.51,-1.02 -1.12,0.03 0.28,0.93Z(M1107.76,1524.37l-0.18,-1.23 -0.35,1.4 0.53,-0.17Z(M1185.72,1481.69l0.12,0.41 -0.64,0.98 -5.92,4.63 0.53,0.99 1.51,-0.57 0.22,0.54 -0.44,0.66 1.39,0.08 -1.46,1.96 -0.43,0.06 0.04,-0.38 -0.59,0.4 0.76,1.76 0.17,2.88 -3.07,1.06 -2.84,2.58 -1.85,0.44 -0.89,0.79 -3.5,-0.48 -2.94,0.42 -3.52,-1.4 -3.83,-0.59 -5.85,0.52 -7.38,2.56 -4.44,-0.86 -0.51,-0.75 2.32,-4.35 3.03,-1.75 2.76,-2.29 15.18,-2.75 0.5,-0.56 1.51,0.31 -0.21,0.28 0.74,0.71 2.77,-0.02 -0.63,0.27 0.54,0.4 0.88,-0.42 -0.21,1.14 1.75,-0.12 2,-0.94 0.1,-0.35 -1.98,0.21 2.06,-2.35 -2.73,0.85 -0.16,-0.52 0.38,-1.09 -0.36,-0.39 -1.78,0.54 -0.28,0.65 -0.4,-0.1 -0.01,-0.78 -2.87,0.93 3.8,-1.49 2.18,-0.26 0.44,0.13 -0.15,0.64 0.27,0.06 1.29,-0.55 -1.89,1.52 0.81,0.27 3.45,-2.28 3.19,-0.7 5.3,-2.36 1.26,-1.27 0.51,0.09Z(M1175.47,1487.21l0.51,-0.98 -1.9,0.94 1.39,0.04Z(M1180.16,1489.25l0.15,0.29 0.36,-0.6 -0.51,0.31Z(M1180.59,1485.7l0.12,-0.34 -2.32,0.43 -0.6,0.77 -0.01,0.8 0.7,0.1 1.06,-1.37 1.05,-0.39Z(M1130.62,1730.2l-1.29,2.42 -0.47,0.08 -1.27,-0.78 -2.11,-2.6 2.4,-2.44 1.27,-0.45 1.18,1.64 0.29,2.13Z(M773.99,1535.66l0.15,0.92 -1.56,0.91 -1.05,1.68 -2.05,1.03 -1.23,-3.65 -0.78,1.57 -0.38,-0.14 -1.69,-2.57 -0.97,-3.09 -1.68,-2.33 -0.6,-3.34 1.93,-0.91 1.17,-0.03 0.39,0.86 -0.34,1 1.52,1.6 0.87,0.16 1.03,3.06 0.8,-0.45 -0.41,-2.78 0.33,-0.38 1.48,0.98 2.04,-0.11 -0.14,0.8 -1.87,0.03 -0.72,0.95 2.52,3.29 1.24,0.94Z(M771.74,1537.58l0.18,-1.21 -0.49,-1.52 -0.43,-0.2 -0.3,0.17 0.15,1.41 0.89,1.35Z(M1083.59,1460.59l-2.49,0.42 0.3,0.38 -0.25,0.6 -1.26,1.65 0,1.6 1.8,1.53 -3.34,0.92 -1.74,1.28 -0.15,3.94 -1.82,4.19 0.63,-3.58 -0.46,0.31 -0.67,2.56 -0.33,0.19 -0.29,-0.54 0.93,-5.94 -0.58,0.22 -2.74,3.73 -0.6,-0.24 -1.67,0.97 -0.78,2.7 -1.51,0.78 0.19,2.37 -0.62,3.51 -2.56,4.38 0.83,2.07 0.12,1.75 -1.19,2.77 2.43,6.47 1.22,5.04 -0.43,5.72 -1.68,4.73 -2.57,4.79 -1.88,1.88 -4.1,2.16 -2.25,0.05 -1.8,-1.18 -2.05,-5.56 -1.17,-1.95 -0.17,-5.1 0.35,-3.26 -1.21,-4.02 -0.16,-3.63 1.15,-4.59 1.15,-2.91 -0.34,-2.01 0.34,-1.98 1.1,-2.35 0.78,-0.78 0.25,-0.89 -0.17,-2.47 2.17,-6.24 -0.94,-1.44 -2.1,0.3 -2.09,3.13 -2.06,1.59 -0.57,-0.3 -0.11,-0.75 0.88,-2.33 1.38,-2.87 2.31,-1.45 0.39,-2.34 5.44,-8.35 1.5,-3.67 -0.11,2.09 0.62,1.46 2.1,-2.6 2.16,-0.38 0.05,1.25 -1.51,1.71 0.02,0.72 0.77,0.56 1.08,-2.13 2,-1.27 0.91,-1.72 1.69,-0.53 2.38,0.45 3.4,-1.29 1.55,-1.43 1.06,-0.02 4.71,1.96 2.44,2.06 -0.06,1.15Z(M1075.29,1461.12l-0.53,-0.25 -0.39,0.61 -0.45,2.1 1.18,-0.25 0.19,-2.21Z(M1068.91,1470.91l0.17,0.87 0.57,0.24 0.09,-0.71 -0.83,-0.4Z(M1058.97,1466.73l-0.46,0.76 0.23,0.36 0.97,-0.1 0,-0.91 -0.74,-0.11Z(M1057.57,1468.55l-2.38,2.66 -1.57,2.96 0.48,1.85 0.84,0.07 1.05,-1.4 0.54,-1.91 0.93,-1 -0.28,-0.83 0.31,0.06 0.03,-1.09 0.71,-0.37 0.06,-0.55 -0.72,-0.45Z(M1087.35,1448.61l1,-0.15 -2.09,1.57 -1.22,-0.76 -2.46,0.21 -2.08,-0.6 0.22,-2.99 0.53,-1.4 -0.53,-0.21 -6.84,1.54 -5.87,0.06 -3.08,1.64 -2.67,2.23 -1.09,-0.61 -2.05,0.11 -1.38,-0.99 -1.55,0.49 -2.13,-0.18 -3.18,-5.01 -1.59,-1.02 -5,-1.06 -1.89,1.28 -0.75,1.22 -0.31,-0.59 0.11,-2.93 -0.88,-1.82 -1.01,-0.76 -0.21,-1.09 -2.03,1.44 -1.35,1.72 -2.35,0.91 -2.28,1.78 -3.87,0.72 -5.22,3.06 -3.58,1.16 -3.05,-1.73 -0.38,0.72 -1.98,0.43 2,-4.8 -0.82,-0.9 -1.2,0.14 -2.07,1.44 -1.02,-0.3 -3.21,1.98 -3.83,1.07 -1.72,0.05 -1.36,-1.05 0.48,-0.94 4.77,-3.85 9.09,-8.99 2.83,-1.73 8.75,-3.61 5.5,-3.74 1.41,-3.24 0.23,-2.4 4.85,-2.27 -1.16,3.46 -0.64,0.79 2.26,-0.84 1.24,-3.68 0.86,-1.02 0.54,-3.02 1.22,-0.21 0.49,0.42 0.33,1.42 -2.77,3.62 -0.2,0.62 0.28,0.78 0.67,-0.35 0.65,-1.6 2.39,-0.63 1.08,-1.48 0.34,-1.61 -1.32,-1.57 -0.44,-1.85 2.2,-0.48 9.63,3.91 4.59,0.05 1.45,-0.61 1.27,0.95 1.69,-0.09 1.71,2.76 2.03,6.65 2.16,3.08 3.41,1.51 8.64,-0.16 -1.81,5.27 0.89,1.67 2.5,1.9 1.38,1.79 -1.42,2.99 -0.63,2.3 1.71,1.36 1.55,-0.36 1.18,0.64 0.03,0.87 -1.17,0.1 -0.78,0.7 0.15,1.8 0.59,-0.77 0.57,0.34 -1.48,2.98 0.77,0.99 0.78,-0.64Z(M1015.4,1441.26l-0.06,0.46 0.6,0.16 -0.54,-0.62Z(M1016.57,1443.54l0.65,-0.68 -2.23,1.6 1.58,-0.92Z(M1017.78,1442.02l0.05,-0.73 -1.23,0.43 1.18,0.3Z(M1019.33,1439.94l-0.42,-0.37 -0.28,0.81 0.7,-0.44Z(M1046.11,1409.48l-0.34,0.5 0.34,1.58 2.74,-0.89 0.58,-1.26 -1.71,-0.41 -1.61,0.48Z(M1036.39,1424.91l3.26,-1.8 0.49,-1.17 1.1,-0.96 -1.18,0.15 -6.35,3.5 -0.61,0.61 0.35,0 -0.29,1.1 2.56,-0.49 0.53,-0.4 -0.36,-0.36 0.5,-0.18Z(M1049.14,1433.78l0.56,-0.37 -1.56,-0.85 -2.64,0.19 -2.39,0.87 -2.75,2.5 -0.61,1.64 2.07,0.87 -0.23,-0.5 0.42,-0.66 0.09,1.01 -0.68,1.4 0.34,0.61 0.42,-0.14 1.88,-2.33 0.17,-0.87 2.81,-2.42 -0.52,-0.63 2.62,-0.32Z(M1050.28,1410.98l0.78,-0.12 -0.05,-0.4 -0.87,-1.06 -0.52,0.12 0.05,1.22 0.61,0.24Z(M1074,1428.2l-0.41,-0.67 -1.41,-0.42 -1.33,0.27 -0.78,0.73 1.05,0.48 2.88,-0.39Z(M1088.35,1448.46l2.03,-0.52 0.9,0.92 -0.06,2.41 7.2,2.03 4.93,0.93 3.49,-0.43 0.92,0.57 3.28,-0.34 1.75,0.97 4.86,0.49 0.04,0.76 1.71,-1.01 0.84,0.74 -1.12,0.56 0.48,0.47 -0.33,0.55 0.34,0.19 1.68,-0.46 2.42,0.33 0.71,-0.68 0.16,1 0.72,0.22 3.17,-0.16 3.5,5.9 0.75,0.09 0.35,-0.58 0.73,3.58 1.96,0.89 0.01,-0.85 1.36,0.36 0.08,1.19 -0.81,1.25 0.82,0.31 0.48,0.82 -0.9,0.71 2.09,2.46 0.84,0.33 0.65,1.88 0.86,-0.9 -0.15,1.35 0.35,0.35 -1.69,0.02 -1.12,-0.72 -0.05,-0.8 -2.03,0.9 1.26,2.47 -0.12,1.29 -0.88,1.31 -4.27,-1.41 -1.51,-0.97 -0.88,-1.41 -1.36,0.42 -1.36,1.33 0.16,-2.62 -0.77,-0.45 -1.9,0.63 1.41,-1.71 0.38,-1.5 -1.15,0.9 -0.68,-0.07 -0.05,-0.8 -1.38,-0.97 -0.61,-2.06 0.32,-1.38 -4.69,-0.16 -0.1,0.45 1.31,0.93 1.59,2.43 1.09,0.61 -0.04,1.06 0.91,1.95 0.01,2.34 -1.42,2.92 -1.85,1.61 -1.63,3.64 -0.27,1.11 0.22,9.24 -0.82,2.3 -4.51,3.78 -2.68,1.05 -0.51,-0.99 -2.29,-12.12 -0.61,-1.34 -1.84,-1.72 -1.32,-0.21 -4.42,2.17 0.34,0.7 -1.32,2.34 -1.19,0.53 -1.07,1.2 -2.05,-0.67 -1.03,-1.16 0.68,-3.55 3.01,-1.52 1.15,-3.37 0.57,0.1 1.5,-1.76 0.36,-6.55 -0.32,-1.34 -1.41,-1.98 0.29,-1.08 1.67,0.2 -0.59,-1.89 -0.74,-0.93 -0.02,-0.84 -0.92,-1.05 -5,-2.39 -1.76,-0.38 -1.93,-2.19 -2.27,-0.52 -3.65,-1.9 0.06,-1.15 0.5,-0.12 -0.13,-1.42 1.06,-1.56 1.26,0.95 6.17,0.54 0.88,-0.32 -0.18,-0.65 -1.41,-1.11 -0.16,-1.16 -2.19,-0.72 0.52,-1.32 -0.6,-2.05 -1.18,-1.6 0.16,-0.44Z(M1099.72,1457.32l-1.05,0.48 -0.49,0.93 1.07,0.62 0.62,-0.19 0.71,-1.09 -0.86,-0.75Z(M1097.63,1456.81l-0.91,-1.19 -0.86,-0.16 0.01,0.8 -0.36,0.33 -1.78,0.33 -0.04,0.42 0.59,0.59 2.67,0.23 1.08,-0.81 -0.4,-0.54Z(M1094.21,1454.78l0.39,-1.1 -0.31,-0.64 -1.69,-0.82 -1.44,0.26 1.35,2.93 0.82,0.2 0.35,-0.84 0.53,0.01Z(M1090.35,1451.87l-0.19,0.74 0.73,0.55 0.02,-0.64 -0.56,-0.65Z(M1090.76,1451.6l-0.35,-1.14 0.24,-2 -0.84,-0.08 -0.66,0.8 0.97,2.1 0.64,0.32Z(M1087.39,1460.36l-1.53,0.05 1.72,1.1 0.42,-0.48 -0.61,-0.67Z(M1104.07,1459.92l7.28,2.45 3.04,1.99 2.67,-2.12 0.7,-0.1 -1.2,1.42 -1.27,0.66 1.08,0.56 1.44,-0.91 1.84,-3.26 -1.04,-0.16 0.23,-1.15 -0.38,-0.36 -1.21,2.46 -0.39,-0.74 -0.02,-1.58 -0.44,-0.12 -0.68,-1.42 -1.32,0.4 -1,1.4 -2.16,-1.84 -2.22,0.7 -0.6,0.71 0.68,0.76 -0.12,0.71 -1.47,-0.88 -1.19,0.02 -0.66,-0.84 -0.25,-1.32 -2.87,0.9 -0.9,-0.55 -0.45,0.59 -0.07,0.5 0.7,0.44 2.25,0.68Z(M1118.29,1464.93l-1.42,0.68 0.56,0.3 0.86,-0.98Z(M1135.81,1476.71l0.02,-1.1 -0.74,0 0.72,1.1Z(M977.9,1400.16l0.05,1.84 -0.81,1.07 0.1,-0.99 -1.27,-2.28 -0.65,-0.24 0.28,-1.11 -4.47,0.46 -1.12,0.62 -0.51,0.98 1.7,-0.01 2.01,2.12 1.25,-0.59 1.3,1.48 1.89,0.45 -1.4,1.03 -1.28,-0.13 -0.16,0.57 -4.43,3.59 -1.2,-0.07 -2.1,-1.67 -2.01,1.17 -1.07,0.18 -0.45,-0.73 0.6,-3.62 3.16,-1.02 0.53,-0.77 -0.06,-1.42 -0.83,-0.82 4.2,-4.12 -1.14,-0.23 -4.12,2.68 -0.36,-0.15 0.26,-1.24 -0.41,-1.4 1.64,-0.22 0.53,0.25 -0.14,0.65 0.54,0.14 0.98,-0.64 -0.34,-0.88 0.54,-0.49 2.67,-0.59 0.32,-0.7 -0.18,-0.77 -1.17,-2.57 0.73,-0.7 0.86,1.08 0.1,1.39 0.9,2.03 1.19,0.23 0.39,0.69 -0.03,1.5 -0.61,0.64 0.76,0.85 1.46,0.32 0.33,1.21 1.05,0.95Z(M970.51,1403.35l-0.98,-0.04 0.64,1.75 0.84,0.04 0.73,0.93 0.74,-0.09 0.93,-2.4 -0.78,-0.62 -2.12,0.43Z(M296.15,1194.71l-6.4,3.19 -0.91,3.96 -12.85,2.61 -1.57,-0.94 -0.37,-1.79 0.77,-1.81 9.71,-3.78 7.56,-1.94 4.06,0.5Z(M683.32,1565.04l-0.26,0.99 -0.77,0.18 -0.54,-0.38 -0.67,-1.75 0.08,-0.77 0.83,-1.15 1.11,-0.48 0.5,0.7 -0.28,2.66Z(M1043.06,1488.32l-0.1,2.04 -1.11,2.06 -0.38,-0.09 -0.62,-3.4 0.39,-1.29 0.76,-1.34 0.68,-0.02 0.42,0.25 -0.04,1.79Z(M1213.18,1487.05l-0.37,1.48 0.43,4.69 -0.95,-5.15 0.08,-1.74 1.02,-1.4 -1.02,-5.68 1.11,-6.11 0.26,-0.17 0.44,1.87 0.92,-1.76 1.14,-0.9 -0.08,1.1 -0.93,0.85 0.23,0.6 -0.47,5.33 -0.56,0.72 0.4,1.54 -1.65,4.73Z(M732.6,1646.14l-0.05,0.7 -0.93,1.15 -1.04,-0.11 -3.1,-3.9 0.09,-0.94 1.19,-0.24 3.84,3.34Z(M749.16,1424.97l-0.49,-1.81 0.74,-0.89 0.99,1.3 0.26,1.38 0.22,2.53 -0.59,1.25 -1.06,-0.06 -0.15,-0.43 0.42,-0.74 -0.25,-0.49 -1.16,-0.41 1.07,-1.63Z(M755.08,1610.82l-1.81,-2.51 -2.21,-2.19 -0.57,0.02 -0.81,1.85 -1.12,0.37 -0.97,-0.34 -0.9,-0.99 -0.89,0.29 -0.6,-0.37 -1.55,0 -1.15,1.3 -0.8,-0.86 -0.05,-0.66 4.37,-1.63 0.51,-3.47 0.58,-0.52 -0.39,4.38 0.86,1.4 0.78,0.85 0.76,-0.38 1.47,-2.37 0.38,0.02 2.5,2.75 1.61,3.06Z(M885.79,1431.15l-1.02,-0.36 -2.19,0.45 1.48,-1.6 -0.42,-1.69 -2.56,-0.48 -0.62,-0.57 -0.42,-1.65 0.44,-1.29 -1.67,-1.56 -3.39,-0.71 -4.56,1.87 -0.69,-0.2 -0.71,-1.18 -1.9,1.35 -0.26,-0.17 0.16,-0.79 1.05,-1.16 1.04,-0.19 1.41,1.47 1.12,-0.15 2.67,-1.62 2.29,0 2.75,1.12 0.87,0.89 0.46,1.45 -0.2,2.1 0.55,0.36 1.35,0.29 0.27,-0.24 -0.35,-2.01 1.79,-0.67 -0.41,1.12 0.62,2.47 0.8,0.62 -0.49,0.88 0.59,0.9 3.15,1.06 7.75,-1.41 0.71,0.65 -2.95,1.69 -2.16,-0.15 -3.73,0.86 -2.62,-1.75Z(M755.08,1610.82l-1.81,-2.51 -2.21,-2.19 -0.57,0.02 -0.81,1.85 -1.12,0.37 -0.97,-0.34 -0.9,-0.99 -0.89,0.29 -0.6,-0.37 -1.55,0 -1.15,1.3 -0.8,-0.86 -0.05,-0.66 4.37,-1.63 0.51,-3.47 0.58,-0.52 -0.39,4.38 0.86,1.4 0.78,0.85 0.76,-0.38 1.47,-2.37 0.38,0.02 2.5,2.75 1.61,3.06Z(M792.26,1581.42l-0.75,2.69 -4.57,6.97 0.49,0.45 1.62,-0.22 -0.3,0.48 -3.63,0.87 -5.44,2.59 -0.64,-1.38 2.17,-0.47 0.95,-1.2 0.51,0.39 0.54,-0.66 2.28,0.21 1.19,-2.63 0.67,-0.25 0.72,-1.13 -0.22,-1.36 0.84,-0.07 1.44,-1.44 1.23,-1.98 0.13,-1.48 0.36,-0.5 0.41,0.12Z(M906.94,1473.16l-0.93,0.46 -0.25,1.49 -0.95,1.63 -1.82,0.71 0.46,2.38 1.22,0.44 -0.18,0.82 1.21,0.83 -0.16,0.82 -2.26,-0.82 -0.82,-3.9 -0.48,-0.28 -1.4,-0.51 -3.88,0.59 2.2,-0.8 0.41,-0.66 1.75,-0.26 0.44,-0.26 -0.13,-0.51 2.49,1.15 0.67,-0.96 0.49,-0.02 0.12,-2.06 1.14,-1.64 0.14,-0.9 0.2,-1.65 -0.33,-0.73 -0.7,-0.71 -2.33,-0.1 3.05,-0.58 -1.03,-1.84 -2.31,-2.58 2.16,0.29 0.65,-1.06 -0.27,-1.6 -2.79,-5.1 -0.1,-0.69 0.85,-2.5 -0.14,-2.89 -0.32,-1.51 -1.52,-1.53 -0.11,-0.69 0.72,0.14 1.47,1.46 0.65,3.82 -0.53,3.28 0.17,1.49 0.76,1.78 1.62,2.19 0.06,2.75 -0.72,1.98 1.44,2.22 0.3,2.99 -0.35,2.49 0.27,0.7 -0.3,0.44Z`.split(`(`),B7=4096,EKe=85.05112878;function V7(e,t){let n=Math.max(-85.05112878,Math.min(EKe,t))*Math.PI/180,r=(e+180)/360,i=.5-Math.log(Math.tan(Math.PI/4+n/2))/(2*Math.PI);return{x:r*B7,y:i*B7}}function DKe(e){let t=.5-e.y/B7,n=2*Math.atan(Math.exp(2*Math.PI*t))-Math.PI/2;return{lon:e.x/B7*360-180,lat:n*180/Math.PI}}function OKe(e,t){return{x:(e.x-t.tx)/t.k,y:(e.y-t.ty)/t.k}}function kKe(e){if(!Number.isFinite(e)||e<=0)return 4;let t=Math.log2(B7*1.08*e/256);return Math.max(0,Math.min(21,Math.round(t)))}function AKe(e,t){return e!=null&&t!=null&&Number.isFinite(e)&&Number.isFinite(t)&&Math.abs(e)<=90&&Math.abs(t)<=180}function jKe(e,t,n){let r=`${e.toFixed(6)},${t.toFixed(6)}`;return n==null?`https://www.google.com/maps/search/?api=1&query=${r}`:`https://www.google.com/maps/@${r},${Math.round(n)}z`}function MKe(e,t){return`https://www.google.com/maps/dir/?api=1&destination=${e.toFixed(6)},${t.toFixed(6)}`}function H7(e,t){return{x:t.tx+e.x*t.k,y:t.ty+e.y*t.k}}function NKe(e,t,n,r=40,i=B7/90){if(e.length===0)return null;let a=1/0,o=-1/0,s=1/0,c=-1/0;for(let t of e)a=Math.min(a,t.x),o=Math.max(o,t.x),s=Math.min(s,t.y),c=Math.max(c,t.y);let l=Math.max(o-a,i),u=Math.max(c-s,i),d=(a+o)/2,f=(s+c)/2;l*=1.16,u*=1.16;let p=Math.min((t-r*2)/l,(n-r*2)/u);return{k:p,tx:t/2-d*p,ty:n/2-f*p}}function PKe(e,t,n,r,i,a){let o=Math.max(i,Math.min(a,e.k*t));return o===e.k?e:{k:o,tx:n-(n-e.tx)*o/e.k,ty:r-(r-e.ty)*o/e.k}}function U7(e,t){return e/t}function FKe(e,t,n){return`${U7(e,n)} ${U7(t,n)}`}function IKe(e,t,n=1/0){let r=t/B7;return{kMin:Math.min(e,Math.max(r,e*.25)),kMax:Math.max(e,Math.min(e*60,n))}}function LKe(e){return Math.max(0,Math.min(1,(1.5-e)/.9))}function RKe(e,t,n,r,i,a,o=14,s=6){let c=t-r-o;return{x:Math.max(s,Math.min(i-n-s,e-n/2)),y:Math.max(s,Math.min(a-r-s,c>=s?c:t+o))}}var zKe=6371.0088,BKe=(e,t)=>{let n=Math.PI/180,r=(t.lat-e.lat)*n,i=(t.lon-e.lon)*n,a=Math.sin(r/2)**2+Math.cos(e.lat*n)*Math.cos(t.lat*n)*Math.sin(i/2)**2;return 2*zKe*Math.asin(Math.min(1,Math.sqrt(a)))};function VKe(e,t,n,r=!1){if(e.length<2)return 0;let i=0;for(let r=1;rn(t[e],t[r]);for(let e=0;e`${e.lat.toFixed(6)},${e.lon.toFixed(6)}`,i=Math.min(e.length,GKe(!!t.coarsePointer,n));for(;;){let t=e.slice(0,i),a=t[0],o=n?a:t[t.length-1],s=n?t.slice(1):t.slice(1,-1),c=`https://www.google.com/maps/dir/?api=1&origin=${r(a)}&destination=${r(o)}`+(s.length?`&waypoints=${s.map(r).join(`|`)}`:``)+`&travelmode=driving`;if(c.length<=2048||i<=2)return{url:c,used:i};--i}}function qKe(e,t,n,r){return{x0:Math.min(e,n),y0:Math.min(t,r),x1:Math.max(e,n),y1:Math.max(t,r)}}function JKe(e,t,n,r,i,a){if(e==null||!Number.isFinite(e))return a;if(!(n>t))return(r+i)/2;let o=Math.max(0,Math.min(1,(e-t)/(n-t)));return Math.sqrt(r*r+o*(i*i-r*r))}var W7=1e3,G7=620,YKe=3.2,XKe=15,ZKe=4.5,QKe=2.6,K7=[{fill:`#9DBFF2`,line:`#5F7FB0`},{fill:`#A5D8B4`,line:`#5E9C74`},{fill:`#F5D989`,line:`#B39A46`},{fill:`#F0A8A0`,line:`#B76D65`},{fill:`#7E99C2`,line:`#4A6790`},{fill:`#84AD91`,line:`#4C7A5C`},{fill:`#C4AE6E`,line:`#8C7838`},{fill:`#C0867F`,line:`#8A5049`}],q7={fill:`#D7DBE3`,line:`#8A909C`},J7={fill:`#9DBFF2`,line:`#4F6079`};function $Ke(e){if(e==null||e===``)return null;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:null}function eqe(e){if(e==null||e===``)return null;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:null}function tqe({rows:e,field:t,colorField:n,sizeField:r,selectedPids:i,onSelectPids:a,onOpen:o}){let[s,c]=(0,z.useState)(null),[l,u]=(0,z.useState)(!1),[d,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)(null),[h,g]=(0,z.useState)(null),[_,v]=(0,z.useState)(null),[y,b]=(0,z.useState)(null),x=(0,z.useRef)(null),S=(0,z.useRef)(!1),C=(0,z.useRef)(!1),w=(0,z.useMemo)(()=>{let i=[];for(let a of e){let e=$Ke(a.lat),o=$Ke(a.lon);e==null||o==null||Math.abs(e)>90||Math.abs(o)>180||i.push({pid:a.pid,title:String(a[t.key]??``),p:V7(o,e),lat:e,lon:o,colorKey:n?String(a[n.key]??``).trim():null,size:r?eqe(a[r.key]):null,colorVal:n?a[n.key]:null,sizeVal:r?a[r.key]:null})}return i},[e,t.key,n,r]),T=e.length-w.length,E=(0,z.useMemo)(()=>NKe(w.map(e=>e.p),W7,G7),[w]);(0,z.useEffect)(()=>{E&&(!C.current||h==null)&&g(E)},[E]);let{kMin:D,kMax:O}=(0,z.useMemo)(()=>E?IKe(E.k,G7,32):{kMin:1,kMax:1},[E]),k=(0,z.useMemo)(()=>{if(!n)return null;let e=[],t=new Map;for(let n of w){let r=n.colorKey??``;t.has(r)||(t.set(r,0),e.push(r)),t.set(r,(t.get(r)??0)+1)}let r=e.filter(e=>e!==``),i=new Map;return r.forEach((e,t)=>i.set(e,t{if(!r)return null;let e=1/0,t=-1/0,n=0;for(let r of w){if(r.size==null){n+=1;continue}e=Math.min(e,r.size),t=Math.max(t,r.size)}return Number.isFinite(e)?{min:e,max:t,missing:n,none:!1}:{min:0,max:0,missing:n,none:!0}},[r,w]),j=(0,z.useMemo)(()=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(pointer: coarse)`).matches,[]),M=(0,z.useMemo)(()=>i.size<2?[]:w.filter(e=>i.has(e.pid)&&AKe(e.lat,e.lon)).sort((e,t)=>e.pid-t.pid),[w,i]),N=i.size-M.length,P=(0,z.useMemo)(()=>{if(!l||M.length<2)return null;let e=M.map(e=>({lat:e.lat,lon:e.lon})),t=0;for(let e=1;ee.pid===p);e>=0&&(t=e)}let{order:n,km:r}=WKe(e,BKe,{start:t,roundTrip:d});return{ordered:n.map(e=>M[e]),km:r,link:KKe(n.map(t=>e[t]),{roundTrip:d,coarsePointer:j})}},[l,M,d,p,j]),F=(0,z.useCallback)(e=>{if(!k)return J7;let t=e.colorKey??``;return t===``?q7:k.swatch.get(t)??q7},[k]),ee=(0,z.useCallback)(e=>!r||!A||A.none?ZKe:JKe(e.size,A.min,A.max,YKe,XKe,QKe),[r,A]),I=(0,z.useCallback)((e,t)=>{if(!y)return{x:0,y:0};let n=y.getBoundingClientRect();return{x:(e-n.left)/n.width*W7,y:(t-n.top)/n.height*G7}},[y]);(0,z.useEffect)(()=>{if(!y)return;let e=e=>{e.preventDefault();let{x:t,y:n}=I(e.clientX,e.clientY);C.current=!0,g(r=>r&&PKe(r,Math.exp(-e.deltaY*.0016),t,n,D,O))};return y.addEventListener(`wheel`,e,{passive:!1}),()=>y.removeEventListener(`wheel`,e)},[y,I,D,O]);let te=(0,z.useCallback)(e=>{C.current=!0,g(t=>t&&PKe(t,e,W7/2,G7/2,D,O))},[D,O]),L=(0,z.useCallback)(()=>{C.current=!1,g(E)},[E]),ne=(0,z.useCallback)((e,t)=>{C.current=!0,g(n=>n&&{...n,tx:n.tx+e,ty:n.ty+t})},[]),re=(0,z.useCallback)(e=>{let t=e.shiftKey?160:60;switch(e.key){case`ArrowLeft`:ne(t,0);break;case`ArrowRight`:ne(-t,0);break;case`ArrowUp`:ne(0,t);break;case`ArrowDown`:ne(0,-t);break;case`+`:case`=`:te(1.6);break;case`-`:case`_`:te(1/1.6);break;case`0`:L();break;case`Escape`:if(!_)return;v(null);break;default:return}e.preventDefault()},[ne,te,L,_]),ie=(0,z.useCallback)(e=>{if(e.button!==0||!h)return;let{x:t,y:n}=I(e.clientX,e.clientY);S.current=!1,e.currentTarget.setPointerCapture(e.pointerId),e.shiftKey||e.ctrlKey||e.metaKey?v({x0:t,y0:n,x1:t,y1:n}):x.current={x:t,y:n,tx:h.tx,ty:h.ty}},[h,I]),ae=(0,z.useCallback)(e=>{let{x:t,y:n}=I(e.clientX,e.clientY);if(_){S.current=!0,v(e=>e&&{...e,x1:t,y1:n});return}let r=x.current;r&&(Math.abs(t-r.x)+Math.abs(n-r.y)>2&&(S.current=!0),C.current=!0,g(e=>e&&{...e,tx:r.tx+(t-r.x),ty:r.ty+(n-r.y)}))},[_,I]),oe=(0,z.useCallback)(e=>{if(_&&h){let t=qKe(_.x0,_.y0,_.x1,_.y1);if(t.x1-t.x0>3&&t.y1-t.y0>3){let n=[];for(let e of w){let r=H7(e.p,h);r.x>=t.x0&&r.x<=t.x1&&r.y>=t.y0&&r.y<=t.y1&&n.push(e.pid)}a(n,e.altKey?`add`:`replace`)}v(null)}x.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)},[_,h,w,a]);if(!h||!E)return(0,H.jsxs)(`div`,{className:`cg-mode-empty`,children:[`No records with a location to map yet.`,T>0&&` ${T.toLocaleString()} matching record${T===1?``:`s`} have no location.`]});let se=s==null?void 0:w.find(e=>e.pid===s),ce=_?qKe(_.x0,_.y0,_.x1,_.y1):null,le=`translate(${h.tx.toFixed(2)} ${h.ty.toFixed(2)}) scale(${h.k.toFixed(6)})`,ue=e=>U7(e,h.k),de=LKe(h.k),fe=DKe(OKe({x:W7/2,y:G7/2},h)),pe=jKe(fe.lat,fe.lon,kKe(h.k)),me=i.size===1?w.find(e=>i.has(e.pid)):void 0,he=A&&!A.none&&A.max>A.min?[A.min,(A.min+A.max)/2,A.max]:null;return(0,H.jsxs)(`div`,{className:`cg-mapview`,children:[(0,H.jsxs)(`div`,{className:`cg-map-bar`,children:[(0,H.jsxs)(`span`,{className:`cg-cal-note cg-map-count`,children:[(0,H.jsx)(`strong`,{children:w.length.toLocaleString()}),` of`,` `,e.length.toLocaleString(),` mapped · pinned at each customer's address`]}),T>0&&(0,H.jsxs)(`span`,{className:`cg-cal-nodate`,title:`${T.toLocaleString()} matching record${T===1?``:`s`} have no geocoded location and are not on the map. They remain in the Grid and List views.`,children:[T.toLocaleString(),` matching record`,T===1?` has`:`s have`,` no location`]}),me&&(0,H.jsxs)(`span`,{className:`cg-map-go`,children:[(0,H.jsxs)(`a`,{href:jKe(me.lat,me.lon),target:`_blank`,rel:`noopener noreferrer`,title:`Open ${me.title} in Google Maps at ${me.lat.toFixed(5)}, ${me.lon.toFixed(5)} (new tab)`,children:[me.title||`Selected pin`,` in Google Maps`]}),(0,H.jsx)(`a`,{href:MKe(me.lat,me.lon),target:`_blank`,rel:`noopener noreferrer`,title:`Directions to ${me.title} (new tab)`,children:`Directions`})]}),i.size>=2&&(0,H.jsxs)(`span`,{className:`cg-map-route`,children:[l?P&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`cg-map-route-sum`,children:[(0,H.jsx)(`strong`,{children:P.ordered.length.toLocaleString()}),` stops ·`,` `,Math.round(P.km).toLocaleString(),` km`,(0,H.jsx)(`span`,{className:`cg-map-route-note`,children:` straight-line, not driving distance`})]}),(0,H.jsxs)(`label`,{className:`cg-map-route-opt`,children:[`Start`,(0,H.jsx)(`select`,{className:`cg-map-route-start`,value:String(P.ordered[0].pid),onChange:e=>m(Number(e.target.value)),children:M.map(e=>(0,H.jsx)(`option`,{value:e.pid,children:e.title||`#${e.pid}`},e.pid))})]}),(0,H.jsxs)(`label`,{className:`cg-map-route-opt`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked)}),`Return to start`]}),P.link&&(0,H.jsxs)(`a`,{href:P.link.url,target:`_blank`,rel:`noopener noreferrer`,title:`Open this route in Google Maps for driving directions (new tab)`,children:[`Open route in Google Maps`,P.link.used{u(!1),m(null)},children:`Clear`})]}):(0,H.jsxs)(`button`,{type:`button`,className:`cg-map-route-go`,onClick:()=>u(!0),disabled:M.length<2,title:M.length<2?`At least two selected records need a location to plan a route`:`Order these stops into a route`,children:[`Plan route (`,M.length.toLocaleString(),` stops)`]}),N>0&&(0,H.jsxs)(`span`,{className:`cg-cal-nodate`,children:[N.toLocaleString(),` selected record`,N===1?` has`:`s have`,` no location and cannot be routed`]})]}),(0,H.jsx)(`span`,{className:`cg-map-hint`,children:`Scroll to zoom · drag to pan · shift-drag to select`})]}),(0,H.jsxs)(`div`,{className:`cg-map-frame`,tabIndex:0,role:`group`,"aria-label":`Map canvas. Arrow keys pan, plus and minus zoom, zero fits to data.`,onKeyDown:re,children:[(0,H.jsxs)(`svg`,{ref:b,viewBox:`0 0 ${W7} ${G7}`,preserveAspectRatio:`xMidYMid meet`,className:`cg-map-svg`+(_?` is-selecting`:``),role:`img`,"aria-label":`Map of ${w.length.toLocaleString()} customers`,onPointerDown:ie,onPointerMove:ae,onPointerUp:oe,onPointerCancel:oe,children:[(0,H.jsx)(`rect`,{className:`cg-map-water`,x:0,y:0,width:W7,height:G7}),(0,H.jsxs)(`g`,{transform:le,children:[de>.01&&(0,H.jsxs)(`g`,{className:`cg-map-grat`,strokeWidth:ue(.6),opacity:de,children:[Array.from({length:17},(e,t)=>{let n=V7(0,-80+t*10).y;return(0,H.jsx)(`line`,{x1:0,y1:n,x2:4096,y2:n},`p${t}`)}),Array.from({length:19},(e,t)=>{let n=V7(-180+t*20,0).x;return(0,H.jsx)(`line`,{x1:n,y1:0,x2:n,y2:4096},`m${t}`)})]}),(0,H.jsx)(`path`,{className:`cg-map-land`,d:wKe,strokeWidth:ue(.9)}),TKe.map((e,t)=>(0,H.jsx)(`path`,{className:`cg-map-lake`,d:e,strokeWidth:ue(.8)},t)),P&&P.ordered.length>1&&(0,H.jsx)(`polyline`,{className:`cg-map-route-line`,strokeWidth:ue(1.8),strokeDasharray:FKe(5,4,h.k),points:P.ordered.map(e=>`${e.p.x},${e.p.y}`).join(` `)+(d?` ${P.ordered[0].p.x},${P.ordered[0].p.y}`:``)}),w.map(e=>{let t=F(e),n=i.has(e.pid),r=ee(e)/h.k;return(0,H.jsx)(`circle`,{className:`cg-map-pin`+(s===e.pid?` is-hover`:``)+(n?` is-selected`:``),cx:e.p.x,cy:e.p.y,r:s===e.pid?r*1.28:r,fill:t.fill,stroke:n?`#202433`:t.line,strokeWidth:ue(n?2:1),role:`button`,tabIndex:0,"aria-label":`Open ${e.title}`,onMouseEnter:()=>c(e.pid),onMouseLeave:()=>c(t=>t===e.pid?null:t),onFocus:()=>c(e.pid),onBlur:()=>c(t=>t===e.pid?null:t),onClick:()=>{S.current||o(e.pid)},onKeyDown:t=>{t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),o(e.pid))},children:(0,H.jsx)(`title`,{children:e.title})},e.pid)})]}),P&&P.ordered.map((e,t)=>{let n=H7(e.p,h);return(0,H.jsxs)(`g`,{className:`cg-map-stopno`,transform:`translate(${n.x.toFixed(2)} ${(n.y-13).toFixed(2)})`,children:[(0,H.jsx)(`circle`,{r:7.5}),(0,H.jsx)(`text`,{textAnchor:`middle`,dy:`3.4`,children:t+1})]},e.pid)}),se&&(()=>{let e=H7(se.p,h),t=[];n&&t.push(`${n.label}: ${Mp(n,se.colorVal)||`—`}`),r&&t.push(`${r.label}: ${Mp(r,se.sizeVal)||`—`}`);let i=se.title||`(untitled)`,a=Math.max(i.length,...t.map(e=>e.length))*6.2+20,o=21+t.length*14,s=RKe(e.x,e.y,a,o,W7,G7);return(0,H.jsxs)(`g`,{className:`cg-map-card`,"aria-hidden":`true`,children:[(0,H.jsx)(`rect`,{x:s.x,y:s.y,width:a,height:o,rx:5}),(0,H.jsx)(`text`,{className:`cg-map-card-t`,x:s.x+10,y:s.y+15,children:i}),t.map((e,t)=>(0,H.jsx)(`text`,{className:`cg-map-card-l`,x:s.x+10,y:s.y+15+14*(t+1),children:e},t))]})})(),ce&&(0,H.jsx)(`rect`,{className:`cg-map-marquee`,x:ce.x0,y:ce.y0,width:ce.x1-ce.x0,height:ce.y1-ce.y0})]}),(0,H.jsxs)(`div`,{className:`cg-map-ctl`,role:`group`,"aria-label":`Map camera`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-map-ctl-b`,title:h.k>=O*.999999999?`Zoom in — at the limit. The basemap's detail ends here; use Open in Google Maps for street level.`:`Zoom in (+)`,"aria-label":`Zoom in`,disabled:h.k>=O*.999999999,onClick:()=>te(1.6),children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M8 3.6v8.8M3.6 8h8.8`})})}),(0,H.jsx)(`button`,{type:`button`,className:`cg-map-ctl-b`,title:`Zoom out (−)`,"aria-label":`Zoom out`,disabled:h.k<=D*1.000000001,onClick:()=>te(1/1.6),children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M3.6 8h8.8`})})}),(0,H.jsx)(`button`,{type:`button`,className:`cg-map-ctl-b`,title:`Fit to data (0)`,"aria-label":`Fit to data`,onClick:L,children:(0,H.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,H.jsx)(`path`,{d:`M2.6 5.8V2.6h3.2M10.2 2.6h3.2v3.2M13.4 10.2v3.2h-3.2M5.8 13.4H2.6v-3.2`}),(0,H.jsx)(`path`,{d:`M6.6 8h2.8M8 6.6v2.8`})]})}),(0,H.jsx)(`a`,{className:`cg-map-ctl-b`,href:pe,target:`_blank`,rel:`noopener noreferrer`,title:`Open this area in Google Maps (new tab)`,"aria-label":`Open this area in Google Maps`,children:(0,H.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,H.jsx)(`path`,{d:`M7 3.8H4.3a.9.9 0 0 0-.9.9v6.9a.9.9 0 0 0 .9.9h6.9a.9.9 0 0 0 .9-.9V9.2`}),(0,H.jsx)(`path`,{d:`M8.6 3.4h4v4M12.6 3.4 7.4 8.6`})]})})]}),(k||he)&&(0,H.jsxs)(`div`,{className:`cg-map-legends`,children:[n&&k&&(0,H.jsxs)(`div`,{className:`cg-map-legend`,children:[(0,H.jsx)(`div`,{className:`cg-map-legend-t`,children:n.label}),k.order.slice(0,K7.length+1).map(e=>{let t=e===``?q7:k.swatch.get(e)??q7;return(0,H.jsxs)(`div`,{className:`cg-map-legend-row`,children:[(0,H.jsx)(`span`,{className:`cg-map-swatch`,style:{background:t.fill,borderColor:t.line}}),(0,H.jsx)(`span`,{className:`cg-map-legend-k`,children:e===``?`(blank)`:e}),(0,H.jsx)(`span`,{className:`cg-map-legend-n`,children:(k.counts.get(e)??0).toLocaleString()})]},e||`(blank)`)}),k.overflow>0&&(0,H.jsxs)(`div`,{className:`cg-map-legend-note`,children:[k.overflow.toLocaleString(),` further value`,k.overflow===1?` is`:`s are`,` drawn grey — the palette holds `,K7.length,` colours and reusing one would make two values look like the same value.`]})]}),r&&A&&(0,H.jsxs)(`div`,{className:`cg-map-legend`,children:[(0,H.jsx)(`div`,{className:`cg-map-legend-t`,children:r.label}),he?(0,H.jsx)(`div`,{className:`cg-map-sizerow`,children:he.map((e,t)=>(0,H.jsxs)(`span`,{className:`cg-map-sizeitem`,children:[(0,H.jsx)(`svg`,{width:32,height:32,"aria-hidden":!0,children:(0,H.jsx)(`circle`,{cx:16,cy:16,r:JKe(e,A.min,A.max,YKe,XKe,QKe),fill:J7.fill,stroke:J7.line})}),(0,H.jsx)(`span`,{className:`cg-map-legend-k`,children:Mp(r,e)})]},t))}):(0,H.jsxs)(`div`,{className:`cg-map-legend-note`,children:[`Every mapped record has the same `,r.label.toLowerCase(),`, so the bubbles cannot differ in size.`]}),A.missing>0&&(0,H.jsxs)(`div`,{className:`cg-map-legend-note`,children:[A.missing.toLocaleString(),` mapped record`,A.missing===1?` has`:`s have`,` no value — drawn at the smallest dot, never removed from the map.`]})]})]})]})]})}var nqe=`cg-cat-print-style`,Y7=`cg-cat-printing`;function rqe(e){let t=ap(e.paper,e.orientation),n=op(t.w,t.unit),r=op(t.h,t.unit),i=`html.${Y7}`;return[`@page { size: ${n} ${r}; margin: 0; }`,`@media print {`,` ${i}, ${i} body {`,` width: ${n}; margin: 0; padding: 0; background: #fff;`,` -webkit-print-color-adjust: exact; print-color-adjust: exact;`,` }`,` ${i} .cg-cat-page {`,` width: ${n}; height: ${r};`,` margin: 0; box-shadow: none; border: 0; border-radius: 0;`,` transform: none; break-after: page; break-inside: avoid;`,` }`,` ${i} .cg-cat-page:last-child { break-after: auto; }`,`}`].join(` +`)}function iqe(e,t=document){let n=t.getElementById(nqe);return n||(n=t.createElement(`style`),n.id=nqe,t.head.appendChild(n)),n.textContent=rqe(e),()=>{n?.parentNode?.removeChild(n)}}async function aqe(e,t=2e4){if(!e)return;let n=Array.from(e.querySelectorAll(`img`));if(!n.length)return;let r=Promise.all(n.map(e=>e.decode?e.decode().catch(()=>void 0):new Promise(t=>{if(e.complete)return t();e.addEventListener(`load`,()=>t(),{once:!0}),e.addEventListener(`error`,()=>t(),{once:!0})}))).then(()=>void 0);await Promise.race([r,new Promise(e=>setTimeout(e,t))])}function oqe(e=document,t){let n=e.defaultView,r=e.documentElement;return new Promise(e=>{let i=!1,a,o=n?.matchMedia?n.matchMedia(`print`):null,s=e=>{e.matches||c()};function c(){i||(i=!0,r.classList.remove(Y7),n?.removeEventListener(`afterprint`,c),o?.removeEventListener?.(`change`,s),a!==void 0&&clearTimeout(a),e())}r.classList.add(Y7),n?.addEventListener(`afterprint`,c),o?.addEventListener?.(`change`,s),a=setTimeout(c,12e4);try{t?t():n?.print()}catch{c()}})}var X7={stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`};function Z7(){return(0,H.jsx)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 16 16`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M8 3.4v9.2M3.4 8h9.2`,...X7})})}function sqe(){return(0,H.jsx)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 16 16`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M3.4 4.6h9.2M6.4 4.6V3.2h3.2v1.4M4.8 4.6l.6 8h5.2l.6-8`,...X7})})}function cqe(){return(0,H.jsx)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 16 16`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M4.4 9.6L8 6l3.6 3.6`,...X7})})}function lqe(){return(0,H.jsx)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 16 16`,"aria-hidden":!0,children:(0,H.jsx)(`path`,{d:`M4.4 6.4L8 10l3.6-3.6`,...X7})})}function uqe(){return(0,H.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,"aria-hidden":!0,children:[(0,H.jsx)(`path`,{d:`M4.6 6.4V2.8h6.8v3.6`,...X7}),(0,H.jsx)(`path`,{d:`M2.8 6.4h10.4v4.4H11v2.4H5v-2.4H2.8z`,...X7}),(0,H.jsx)(`path`,{d:`M5 10.8h6`,...X7})]})}function Q7({className:e}){return(0,H.jsxs)(`svg`,{className:e,viewBox:`0 0 44 26`,"aria-hidden":!0,children:[(0,H.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinejoin:`round`,children:[(0,H.jsx)(`path`,{d:`M11 4.5l6.5 6.5L11 17.5 4.5 11z`}),(0,H.jsx)(`path`,{d:`M22 2.5l7.5 7.5L22 17.5 14.5 10z`}),(0,H.jsx)(`path`,{d:`M33 4.5L39.5 11 33 17.5 26.5 11z`})]}),(0,H.jsx)(`rect`,{x:`4`,y:`20`,width:`36`,height:`2.6`,fill:`currentColor`})]})}function $7({code:e,quality:t,missing:n,cover:r}){return e?n?(0,H.jsx)(`div`,{className:`cg-cat-shot cg-cat-shot-empty`,children:(0,H.jsx)(`span`,{children:tp(e)===null?`No master for ${e}`:`No editorial image named ${tp(e)}`})}):(0,H.jsx)(`div`,{className:r?`cg-cat-shot cg-cat-shot-cover`:`cg-cat-shot`,children:(0,H.jsx)(`img`,{src:np(e,t),alt:``,loading:`eager`})}):(0,H.jsx)(`div`,{className:`cg-cat-shot cg-cat-shot-empty`,children:(0,H.jsx)(`span`,{children:`No image`})})}function dqe({item:e,quality:t,layout:n,hasAsset:r}){let i=r(e.image);return(0,H.jsxs)(`div`,{className:`cg-cat-card`,children:[(0,H.jsx)($7,{code:e.image,quality:t,missing:i===!1}),(0,H.jsx)(`div`,{className:`cg-cat-desc`,children:e.name??(e.known?``:`Not in this table`)}),n.showPack&&e.pack?(0,H.jsx)(`div`,{className:`cg-cat-pill`,children:e.pack}):null,(0,H.jsxs)(`div`,{className:`cg-cat-meta`,children:[(0,H.jsx)(`span`,{className:`cg-cat-sku`,children:e.code}),n.showColor&&e.color?(0,H.jsx)(`span`,{className:`cg-cat-color`,children:e.color}):null]}),n.showPrice&&e.price?(0,H.jsx)(`div`,{className:`cg-cat-price`,children:e.price}):null]})}function e9({folio:e,light:t,mark:n=!0}){return(0,H.jsxs)(`div`,{className:t?`cg-cat-foot cg-cat-foot-light`:`cg-cat-foot`,children:[n?(0,H.jsx)(Q7,{className:`cg-cat-foot-mark`}):null,(0,H.jsx)(`span`,{className:`cg-cat-folio`,children:e})]})}var fqe=(0,z.memo)(function({cat:e,page:t,index:n,items:r,quality:i,hasAsset:a}){let o=ap(e.paper,e.orientation),s=o.unit===`in`?96:96/25.4,c=e.brand??{},l=c.primary??sp.primary,u=c.accent??sp.accent,d=c.company??sp.company,f={"--cat-w":`${o.w*s}px`,"--cat-h":`${o.h*s}px`,"--cat-primary":l,"--cat-accent":u},p=n+1,m=c.logo?a(c.logo):null,h=(0,H.jsxs)(`div`,{className:`cg-cat-mark`,children:[c.logo&&m!==!1?(0,H.jsx)(`img`,{src:np(c.logo,i),alt:``}):(0,H.jsx)(Q7,{className:`cg-cat-mark-crown`}),(0,H.jsx)(`span`,{className:`cg-cat-mark-co`,children:d})]});if(t.kind===`cover`){let e=t.imageCode?a(t.imageCode):null;return(0,H.jsxs)(`div`,{className:`cg-cat-page cg-cat-p-cover`,style:f,"data-kind":`cover`,children:[(0,H.jsx)($7,{code:t.imageCode,quality:i,missing:e===!1,cover:!0}),(0,H.jsx)(`div`,{className:`cg-cat-cover-scrim`}),h,(0,H.jsxs)(`div`,{className:`cg-cat-cover-ttl`,children:[(0,H.jsx)(`span`,{className:`cg-cat-cover-a`,children:t.title}),t.body?(0,H.jsx)(`span`,{className:`cg-cat-cover-b`,children:t.body}):null]})]})}if(t.kind===`intro`)return(0,H.jsxs)(`div`,{className:`cg-cat-page cg-cat-p-intro`,style:f,"data-kind":`intro`,children:[(0,H.jsx)(`div`,{className:`cg-cat-intro-field`,children:(0,H.jsx)(`svg`,{className:`cg-cat-lattice`,viewBox:`0 0 200 260`,"aria-hidden":!0,children:(0,H.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:`7`,children:[(0,H.jsx)(`path`,{d:`M-40 130l60-60 60 60-60 60z`}),(0,H.jsx)(`path`,{d:`M40 190l60-60 60 60-60 60z`}),(0,H.jsx)(`path`,{d:`M100 130l40 40 40-90`})]})})}),(0,H.jsxs)(`div`,{className:`cg-cat-intro-body`,children:[(0,H.jsx)(`h2`,{className:`cg-cat-intro-ttl`,children:t.title}),(t.body??``).split(/\n{2,}/).map((e,t)=>e.trim()?(0,H.jsx)(`p`,{className:`cg-cat-intro-p`,children:e.trim()},t):null),(0,H.jsxs)(`div`,{className:`cg-cat-intro-sign`,children:[`The `,d,` Team`]})]}),(0,H.jsx)(e9,{folio:p,light:!0,mark:!1})]});if(t.kind===`gallery`){let e=t.imageCode?a(t.imageCode):null;return(0,H.jsxs)(`div`,{className:`cg-cat-page cg-cat-p-gallery`,style:f,"data-kind":`gallery`,children:[(0,H.jsx)($7,{code:t.imageCode,quality:i,missing:e===!1,cover:!0}),(0,H.jsx)(`div`,{className:`cg-cat-gal-wash`}),t.title?(0,H.jsx)(`div`,{className:`cg-cat-gal-ttl`,children:t.title}):null,(0,H.jsx)(e9,{folio:p,light:!0})]})}let g=fp(t),_=t.imageCode?a(t.imageCode):null;return(0,H.jsxs)(`div`,{className:`cg-cat-page cg-cat-p-section${t.imageCode?` has-strip`:``}`,style:f,"data-kind":`section`,children:[(0,H.jsx)(`h2`,{className:`cg-cat-sec-ttl`,children:t.title}),(0,H.jsx)(`div`,{className:`cg-cat-grid`,style:{"--cat-cols":g.cols},children:r.map(e=>(0,H.jsx)(dqe,{item:e,quality:i,layout:g,hasAsset:a},e.code))}),t.imageCode?(0,H.jsx)(`div`,{className:`cg-cat-strip`,children:(0,H.jsx)($7,{code:t.imageCode,quality:i,missing:_===!1,cover:!0})}):null,(0,H.jsx)(e9,{folio:p})]})});function pqe({cat:e,itemsFor:t,quality:n,hasAsset:r,scale:i,selectedId:a,onSelect:o}){let s=ap(e.paper,e.orientation),c=s.unit===`in`?96:96/25.4;return(0,H.jsx)(H.Fragment,{children:e.pages.map((l,u)=>{let d=(0,H.jsx)(fqe,{cat:e,page:l,index:u,items:t(l),quality:n,hasAsset:r});return i===void 0?(0,H.jsx)(`div`,{children:d},l.id):(0,H.jsx)(`div`,{className:`cg-cat-slot${a===l.id?` is-sel`:``}`,style:{width:s.w*c*i,height:s.h*c*i,"--cat-scale":i},onMouseDown:()=>o?.(l.id),children:d},l.id)})})}var mqe=(0,z.memo)(function({catalogs:e,onCatalogs:t,fields:n,fieldByKey:r,poolRows:i,filteredCodes:a}){let[o,s]=(0,z.useState)(e[0]?.id??null),[c,l]=(0,z.useState)(null),[u,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(()=>new Set),[m,h]=(0,z.useState)(null),[g,_]=(0,z.useState)(null),v=(0,z.useRef)(null),[y,b]=(0,z.useState)(null),[x,S]=(0,z.useState)(null),C=(0,z.useRef)(null),w=(0,z.useRef)(null),[T,E]=(0,z.useState)(0),D=e.find(e=>e.id===o)??null,O=D?.pages.find(e=>e.id===c)??null;(0,z.useEffect)(()=>{let e=!0;return Kne().then(t=>{e&&h(t)}),ip().then(t=>{e&&_(t)}),()=>{e=!1}},[]);let k=(0,z.useCallback)(e=>{let t=tp(e);return t===null?e.startsWith(`rec:`)?null:m?m.has(e):null:g?g.has(t):null},[m,g]);(0,z.useLayoutEffect)(()=>{let e=C.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>E(e.clientWidth));return t.observe(e),E(e.clientWidth),()=>t.disconnect()},[]);let A=(0,z.useMemo)(()=>Vne(i),[i]),j=(0,z.useCallback)(e=>Une(e.products??[],A,D?.fields,Mp,r),[A,D?.fields,r]),M=(0,z.useMemo)(()=>{if(!D||!T)return .5;let e=ap(D.paper,D.orientation),t=e.unit===`in`?96:96/25.4;return Math.min(1,Math.max(.2,(T-56)/(e.w*t)))},[D,T]),N=(0,z.useCallback)(e=>{t(e)},[t]),P=(0,z.useCallback)((t,n)=>{N(e.map(e=>e.id===t?{...e,...n}:e))},[e,N]),F=(0,z.useCallback)((t,n,r)=>{N(e.map(e=>e.id===t?{...e,pages:e.pages.map(e=>e.id===n?{...e,...r}:e)}:e))},[e,N]),ee=()=>{if(e.length>=12)return;let t=nre(`Catalog ${e.length+1}`,n);N([...e,t]),s(t.id),l(t.pages[0]?.id??null)},I=e=>{if(!D||D.pages.length>=40)return;let t=up(e);P(D.id,{pages:[...D.pages,t]}),l(t.id)},te=e=>{if(!D||!O)return;let t=D.pages.findIndex(e=>e.id===O.id),n=t+e;if(t<0||n<0||n>=D.pages.length)return;let r=[...D.pages];[r[t],r[n]]=[r[n],r[t]],P(D.id,{pages:r})},L=(0,z.useMemo)(()=>{if(!D)return[];let e=u.trim().toLowerCase(),t=D.fields?.name,n=[];for(let a of i){let i=a[$f];if(typeof i!=`string`||!i)continue;let o=t?r.get(t):void 0,s=o?Mp(o,a[t]):``;if(!(e&&!i.toLowerCase().includes(e)&&!s.toLowerCase().includes(e))&&(n.push({code:i,label:s}),n.length>=200))break}return n},[D,i,u,r]),ne=e=>{if(!D||!O)return;let t=ire(D,O.id,e);if(P(D.id,{pages:t.pages}),p(new Set),t.skippedCap||t.skippedDuplicate){let e=[];t.skippedDuplicate&&e.push(`${t.skippedDuplicate} already on the page`),t.skippedCap&&e.push(`${t.skippedCap} over the 500-product catalog limit`),ie(`Added ${t.added}. Skipped ${e.join(`; `)}.`)}else ie(`Added ${t.added}.`)},[re,ie]=(0,z.useState)(``),ae=async e=>{let t=Zne(e.name);if(!t){ie(`That filename does not reduce to a usable name — rename the file first.`);return}ie(`Uploading ${t}…`);try{let n=await qne(t,e);_(await ip()),D&&O&&F(D.id,O.id,{imageCode:`ed:${n}`}),ie(`Editorial image "${n}" stored and bound to this page.`)}catch(e){ie(e instanceof Error?e.message:`The upload failed.`)}};if((0,z.useEffect)(()=>{if(!y)return;let e=!1;return(async()=>{if(await new Promise(e=>requestAnimationFrame(()=>e())),await aqe(w.current),e)return;let t=iqe(y.cat);await oqe(),t(),e||b(null)})(),()=>{e=!0}},[y]),!e.length)return(0,H.jsx)(`div`,{className:`cg-cat cg-cat-blank`,children:(0,H.jsxs)(`div`,{className:`cg-cat-blank-in`,children:[(0,H.jsx)(Q7,{className:`cg-cat-blank-mark`}),(0,H.jsx)(`h3`,{children:`No catalogs yet`}),(0,H.jsx)(`p`,{children:`A catalog is a printable document built from this table’s products — cover, introduction, product sections and full-page images. Print it to PDF from the browser when it is ready.`}),(0,H.jsxs)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,onClick:ee,children:[(0,H.jsx)(Z7,{}),` New catalog`]})]})});let oe=D?dp(D):0;return(0,H.jsxs)(`div`,{className:`cg-cat`,children:[(0,H.jsxs)(`aside`,{className:`cg-cat-rail`,children:[(0,H.jsxs)(`div`,{className:`cg-cat-rail-head`,children:[(0,H.jsx)(`span`,{children:`Catalogs`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-cat-icon-btn`,title:e.length>=12?`A view holds 12 catalogs.`:`New catalog`,"aria-label":`New catalog`,disabled:e.length>=12,onClick:ee,children:(0,H.jsx)(Z7,{})})]}),(0,H.jsx)(`ul`,{className:`cg-cat-list`,children:e.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,className:`cg-cat-item${e.id===o?` is-open`:``}`,onClick:()=>{s(e.id),l(e.pages[0]?.id??null)},children:[(0,H.jsx)(`span`,{className:`cg-cat-item-name`,children:e.name||`Untitled catalog`}),(0,H.jsxs)(`span`,{className:`cg-cat-item-meta`,children:[e.pages.length,` `,e.pages.length===1?`page`:`pages`]})]})},e.id))}),D?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`cg-cat-rail-head cg-cat-rail-sub`,children:[(0,H.jsx)(`span`,{children:`Pages`}),(0,H.jsxs)(`span`,{className:`cg-cat-count`,children:[D.pages.length,`/`,40]})]}),(0,H.jsx)(`ul`,{className:`cg-cat-pagelist`,children:D.pages.map((e,t)=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,className:`cg-cat-pageitem${e.id===c?` is-sel`:``}`,onClick:()=>l(e.id),children:[(0,H.jsx)(`span`,{className:`cg-cat-pageno`,children:t+1}),(0,H.jsx)(`span`,{className:`cg-cat-pagettl`,children:e.title||lp[e.kind]}),(0,H.jsx)(`span`,{className:`cg-cat-pagekind`,children:lp[e.kind]})]})},e.id))}),(0,H.jsx)(`div`,{className:`cg-cat-addrow`,children:Tee.map(e=>(0,H.jsxs)(`button`,{type:`button`,className:`cg-btn`,disabled:D.pages.length>=40,onClick:()=>I(e),children:[(0,H.jsx)(Z7,{}),` `,lp[e]]},e))})]}):null]}),(0,H.jsx)(`div`,{className:`cg-cat-stage`,ref:C,children:D?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`cg-cat-bar`,children:[(0,H.jsx)(`input`,{className:`cg-input cg-cat-name`,value:D.name,maxLength:80,"aria-label":`Catalog name`,onChange:e=>P(D.id,{name:e.target.value})}),(0,H.jsx)(`select`,{className:`cg-select`,"aria-label":`Paper size`,value:D.paper,onChange:e=>P(D.id,{paper:e.target.value}),children:See.map(e=>(0,H.jsx)(`option`,{value:e,children:$ne[e]},e))}),(0,H.jsx)(`select`,{className:`cg-select`,"aria-label":`Orientation`,value:D.orientation,onChange:e=>P(D.id,{orientation:e.target.value}),children:Cee.map(e=>(0,H.jsx)(`option`,{value:e,children:e===`portrait`?`Portrait`:`Landscape`},e))}),(0,H.jsxs)(`span`,{className:`cg-cat-budget`,title:`Products placed across this catalog's pages`,children:[oe,`/`,500,` products`]}),(0,H.jsxs)(`button`,{type:`button`,className:`cg-btn cg-btn--primary cg-cat-print`,onClick:()=>S(D),children:[(0,H.jsx)(uqe,{}),` Print`]})]}),(0,H.jsx)(`div`,{className:`cg-cat-scroll`,children:(0,H.jsx)(pqe,{cat:D,itemsFor:j,quality:`web`,hasAsset:k,scale:M,selectedId:c??void 0,onSelect:l})})]}):(0,H.jsx)(`div`,{className:`cg-mode-empty`,children:`Pick a catalog to open it.`})}),(0,H.jsx)(`aside`,{className:`cg-cat-insp`,children:D&&O?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`cg-cat-insp-head`,children:[(0,H.jsx)(`span`,{children:lp[O.kind]}),(0,H.jsxs)(`span`,{className:`cg-cat-insp-tools`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-cat-icon-btn`,"aria-label":`Move page up`,onClick:()=>te(-1),children:(0,H.jsx)(cqe,{})}),(0,H.jsx)(`button`,{type:`button`,className:`cg-cat-icon-btn`,"aria-label":`Move page down`,onClick:()=>te(1),children:(0,H.jsx)(lqe,{})}),(0,H.jsx)(`button`,{type:`button`,className:`cg-cat-icon-btn cg-cat-del`,"aria-label":`Delete page`,onClick:()=>P(D.id,{pages:D.pages.filter(e=>e.id!==O.id)}),children:(0,H.jsx)(sqe,{})})]})]}),(0,H.jsxs)(`label`,{className:`cg-cat-fld`,children:[(0,H.jsx)(`span`,{children:`Title`}),(0,H.jsx)(`input`,{className:`cg-input`,value:O.title??``,onChange:e=>F(D.id,O.id,{title:e.target.value})})]}),O.kind===`cover`||O.kind===`intro`?(0,H.jsxs)(`label`,{className:`cg-cat-fld`,children:[(0,H.jsx)(`span`,{children:O.kind===`cover`?`Second line`:`Body`}),(0,H.jsx)(`textarea`,{className:`cg-input cg-cat-area`,rows:O.kind===`cover`?2:9,value:O.body??``,onChange:e=>F(D.id,O.id,{body:e.target.value})})]}):null,O.kind===`intro`?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{className:`cg-cat-fld`,children:[(0,H.jsx)(`span`,{children:O.kind===`section`?`Footer image (code)`:`Image (code)`}),(0,H.jsx)(`input`,{className:`cg-input`,value:O.imageCode??``,placeholder:`e.g. CRY-2003 or ed:showroom`,onChange:e=>F(D.id,O.id,{imageCode:e.target.value})}),O.imageCode&&k(O.imageCode)===!1?(0,H.jsx)(`em`,{className:`cg-cat-warn`,children:tp(O.imageCode)===null?`No image is archived under this code — the page will print an empty frame.`:`No editorial image is stored under this name — the page will print an empty frame.`}):(0,H.jsx)(`em`,{className:`cg-cat-hint`,children:`Fills the width edge to edge, so a wide photograph reads best here. A cut-out product render will be cropped and enlarged to fill it.`})]}),(0,H.jsxs)(`label`,{className:`cg-cat-fld`,children:[(0,H.jsx)(`span`,{children:`Editorial library`}),(0,H.jsxs)(`select`,{className:`cg-select`,value:tp(O.imageCode??``)??``,onChange:e=>F(D.id,O.id,{imageCode:e.target.value?`ed:${e.target.value}`:``}),children:[(0,H.jsx)(`option`,{value:``,children:`(use a product code above)`}),[...g??[]].sort().map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))]}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>v.current?.click(),children:`Upload a photograph…`}),(0,H.jsx)(`input`,{ref:v,type:`file`,accept:`image/png,image/jpeg`,style:{display:`none`},onChange:e=>{let t=e.target.files?.[0];t&&ae(t),e.target.value=``}}),(0,H.jsx)(`em`,{className:`cg-cat-hint`,children:`Lifestyle photography without a SKU lives here. Storing a new one needs an admin login; everyone can pick from the library.`})]})]}),O.kind===`section`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`cg-cat-insp-sub`,children:`Layout`}),(0,H.jsx)(`div`,{className:`cg-cat-row`,children:(0,H.jsxs)(`label`,{className:`cg-cat-fld cg-cat-fld-inline`,children:[(0,H.jsx)(`span`,{children:`Columns`}),(0,H.jsx)(`select`,{className:`cg-select`,value:fp(O).cols,onChange:e=>F(D.id,O.id,{layout:{...O.layout,cols:Number(e.target.value)}}),children:Eee.map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))})]})}),[[`showPack`,`Pack line`,!1],[`showColor`,`Colour`,!1],[`showPrice`,`Price`,!0]].map(([e,t,n])=>{let r=fp(O),i=e===`showPrice`?r.showPrice:e===`showPack`?r.showPack:r.showColor;return(0,H.jsxs)(`label`,{className:`cg-check-row`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:i,onChange:()=>{let t={...O.layout};n?i?delete t.showPrice:t.showPrice=!0:e===`showPack`?i?t.showPack=!1:delete t.showPack:i?t.showColor=!1:delete t.showColor,F(D.id,O.id,{layout:Object.keys(t).length?t:void 0})}}),(0,H.jsx)(`span`,{children:t})]},e)}),(0,H.jsxs)(`div`,{className:`cg-cat-insp-sub`,children:[`Products`,(0,H.jsxs)(`span`,{className:`cg-cat-count`,children:[O.products?.length??0,` on this page`]})]}),(0,H.jsx)(`div`,{className:`cg-cat-picked`,children:(O.products??[]).map(e=>(0,H.jsxs)(`span`,{className:`cg-cat-chip`,children:[e,(0,H.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e}`,onClick:()=>F(D.id,O.id,{products:(O.products??[]).filter(t=>t!==e)}),children:`×`})]},e))}),(0,H.jsxs)(`button`,{type:`button`,className:`cg-btn cg-cat-addfiltered`,disabled:!a.length,onClick:()=>ne(a),children:[(0,H.jsx)(Z7,{}),` Add the `,a.length,` products this view shows`]}),(0,H.jsx)(`input`,{className:`cg-input`,placeholder:`Search products by SKU or name`,value:u,onChange:e=>d(e.target.value)}),(0,H.jsxs)(`div`,{className:`cg-cat-results`,children:[L.map(e=>(0,H.jsxs)(`label`,{className:`cg-check-row`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:f.has(e.code),onChange:()=>p(t=>{let n=new Set(t);return n.has(e.code)?n.delete(e.code):n.add(e.code),n})}),(0,H.jsx)(`span`,{className:`cg-cat-res-code`,children:e.code}),(0,H.jsx)(`span`,{className:`cg-cat-res-name`,children:e.label})]},e.code)),L.length>=200?(0,H.jsx)(`div`,{className:`cg-cat-more`,children:`Showing the first 200 matches — narrow the search to see the rest.`}):null]}),(0,H.jsxs)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!f.size,onClick:()=>ne([...f]),children:[`Add `,f.size,` selected`]}),re?(0,H.jsx)(`div`,{className:`cg-cat-note`,children:re}):null]}):null,(0,H.jsx)(`div`,{className:`cg-cat-insp-sub`,children:`Brand`}),(0,H.jsxs)(`div`,{className:`cg-cat-row`,children:[(0,H.jsxs)(`label`,{className:`cg-cat-fld cg-cat-fld-inline`,children:[(0,H.jsx)(`span`,{children:`Primary`}),(0,H.jsx)(`input`,{type:`color`,className:`cg-cat-swatch`,value:D.brand?.primary??sp.primary,onChange:e=>P(D.id,{brand:{...D.brand,primary:e.target.value}})})]}),(0,H.jsxs)(`label`,{className:`cg-cat-fld cg-cat-fld-inline`,children:[(0,H.jsx)(`span`,{children:`Accent`}),(0,H.jsx)(`input`,{type:`color`,className:`cg-cat-swatch`,value:D.brand?.accent??sp.accent,onChange:e=>P(D.id,{brand:{...D.brand,accent:e.target.value}})})]})]}),(0,H.jsxs)(`label`,{className:`cg-cat-fld`,children:[(0,H.jsx)(`span`,{children:`Company`}),(0,H.jsx)(`input`,{className:`cg-input`,value:D.brand?.company??``,placeholder:sp.company,onChange:e=>P(D.id,{brand:{...D.brand,company:e.target.value}})})]}),(0,H.jsx)(`div`,{className:`cg-cat-insp-sub`,children:`Listing columns`}),[[`name`,`Description`],[`pack`,`Pack line`],[`color`,`Colour`],[`price`,`Price`]].map(([e,t])=>(0,H.jsxs)(`label`,{className:`cg-cat-fld cg-cat-fld-inline`,children:[(0,H.jsx)(`span`,{children:t}),(0,H.jsxs)(`select`,{className:`cg-select`,value:D.fields?.[e]??``,onChange:t=>{let n={...D.fields};t.target.value?n[e]=t.target.value:delete n[e],P(D.id,{fields:Object.keys(n).length?n:void 0})},children:[(0,H.jsx)(`option`,{value:``,children:`Not shown`}),n.map(e=>(0,H.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]},e)),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>{let e=ep(n);P(D.id,{fields:Object.keys(e).length?e:void 0})},children:`Guess from this table`}),(0,H.jsx)(`div`,{className:`cg-cat-insp-foot`,children:(0,H.jsxs)(`button`,{type:`button`,className:`cg-btn cg-btn--danger`,onClick:()=>{let t=e.filter(e=>e.id!==D.id);N(t),s(t[0]?.id??null),l(null)},children:[(0,H.jsx)(sqe,{}),` Delete this catalog`]})})]}):(0,H.jsx)(`div`,{className:`cg-cat-insp-blank`,children:`Select a page to edit it.`})}),x?(0,H.jsx)(`div`,{className:`cg-cat-modal-wrap`,role:`dialog`,"aria-modal":`true`,"aria-label":`Print quality`,children:(0,H.jsxs)(`div`,{className:`cg-cat-modal`,children:[(0,H.jsxs)(`h3`,{children:[`Print “`,x.name||`Untitled catalog`,`”`]}),(0,H.jsx)(`p`,{children:`Your browser’s print dialog opens next — choose “Save as PDF” there. Pick the image quality first.`}),(0,H.jsxs)(`button`,{type:`button`,className:`cg-cat-choice`,onClick:()=>{b({cat:x,quality:`print`}),S(null)},children:[(0,H.jsx)(`strong`,{children:`High quality`}),(0,H.jsx)(`em`,{children:`Original master images. Slower, and a much larger PDF — use this for print.`})]}),(0,H.jsxs)(`button`,{type:`button`,className:`cg-cat-choice`,onClick:()=>{b({cat:x,quality:`web`}),S(null)},children:[(0,H.jsx)(`strong`,{children:`Standard`}),(0,H.jsx)(`em`,{children:`The same images you see here. Fast, small file — fine for a proof or email.`})]}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>S(null),children:`Cancel`})]})}):null,y?(0,Up.createPortal)((0,H.jsx)(`div`,{className:`cg-cat-print-portal`,ref:w,children:(0,H.jsx)(pqe,{cat:y.cat,itemsFor:j,quality:y.quality,hasAsset:k})}),document.body):null]})});function hqe(e,t){let n=e.trim().toLowerCase();return t.find(e=>e.trim().toLowerCase()===n)}function gqe(e){let t=e.trim().replace(/[$,%\s]/g,``);if(t===``)return``;let n=Number(t);return Number.isFinite(n)?String(n):void 0}function _qe(e,t,n=Qu(e)){let r=t.replace(/\r/g,``),i=r.trim();switch(e.type){case`formula`:case`created_time`:case`status`:case`automation`:return;case`checkbox`:{if(i===``)return``;let e=i.toLowerCase();return[`1`,`true`,`yes`,`y`,`on`,`checked`,`x`].includes(e)?`1`:[`0`,`false`,`no`,`n`,`off`,`unchecked`].includes(e)?``:void 0}case`int`:case`currency`:case`pct`:return gqe(r);case`rating`:{if(i===``)return``;let t=Number(i);return Number.isInteger(t)&&t>=1&&t<=$u(e)?String(t):void 0}case`select`:case`user`:return i===``?``:hqe(i,n);case`multiselect`:{if(i===``)return``;let e=[],t=new Set;for(let i of r.split(/[,\n]/)){if(!i.trim())continue;let r=hqe(i,n);if(!r)return;let a=r.toLowerCase();t.has(a)||(t.add(a),e.push(r))}return e.length?e.join(`,`):``}case`date`:return i===``||!Number.isNaN(Date.parse(i))?i:void 0;default:return r}}function vqe(e){return e.length>0&&e.every(e=>e.length===1)}var t9={fieldKey:null,armedUntil:0};function yqe(e,t){return{fieldKey:e,armedUntil:t+1e3}}function bqe(e,t){return t<=e.armedUntil?{...e,armedUntil:0}:t9}function xqe(e,t,n){return e<=0?0:!t||t.width!==1||t.x!==n.col||t.y!==n.row?e:Math.max(e,t.height)}function Sqe({field:e,sourceFieldKey:t,editable:n,values:r,targetPids:i,allowedChoices:a}){if(!n||!vqe(r)||t&&t!==e.key||i.lengthe==null))return null;let o=[];for(let t=0;t1e4?48:e>1e3?44:e>100?36:32}var s9=null;function Nqe(){if(s9!==null)return s9;if(typeof document>`u`)return 0;let e=document.createElement(`div`);return e.style.cssText=`position:absolute;top:-9999px;width:100px;height:100px;overflow:scroll`,document.body.append(e),s9=e.offsetWidth-e.clientWidth,e.remove(),s9}function c9(e,t){return JSON.stringify(e)===JSON.stringify(t)}function l9(e,t){let n=Nf(t);return{...n,...e,filters:Array.isArray(e?.filters)?e.filters:[],filterConj:e?.filterConj===`or`?`or`:`and`,sorts:Array.isArray(e?.sorts)?e.sorts:[],order:Array.isArray(e?.order)&&e.order.length?e.order:n.order,visible:Array.isArray(e?.visible)&&e.visible.length?e.visible:n.visible,widths:e?.widths&&typeof e.widths==`object`?e.widths:{},memberPids:Array.isArray(e?.memberPids)?e.memberPids:[],display:nd(e?.display),frozenCount:Pee(e?.frozenCount)}}function Pqe(e){return{id:r9,name:`All customers`,kind:`system`,locked:!0,config:Nf(e)}}function Fqe(e){try{let t=localStorage.getItem(`aios-grid:${e}`);return t?JSON.parse(t):null}catch{return null}}function Iqe(e,t){try{localStorage.setItem(`aios-grid:${e}`,JSON.stringify(t))}catch{}}function Lqe(){return`view_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function Rqe(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e!==``)}function zqe(e,t){for(let n of e)if(hd(n)){if(zqe(n.children,t))return!0}else if(n.colId===t)return!0;return!1}function Bqe(e,t){let n=[];for(let r of e)if(hd(r)){let e=Bqe(r.children,t);e.length&&n.push({...r,children:e})}else r.colId!==t&&n.push(r);return n}function u9(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_|_$/g,``).slice(0,28)||`field`}function Vqe(e,t,n,r){let i=`custom_${u9(e)}_${Math.random().toString(36).slice(2,7)}`;return t===`formula`||t===`created_time`?{key:i,label:e,type:t,source:`odoo`,derived:!0,filterable:!0,default:!0,custom:!0,...t===`formula`?{agg:`sum`,...r?.formula?{formula:r.formula}:{}}:{}}:{key:i,label:e,type:t,source:`overlay`,default:!0,custom:!0,agg:[`currency`,`int`].includes(t)?`sum`:void 0,...(t===`select`||t===`multiselect`)&&n?.length?{options:n}:{},...t===`select`||t===`multiselect`?{colorCodeOptions:r?.colorCodeOptions!==!1,...r?.optionColors&&Object.keys(r.optionColors).length?{optionColors:r.optionColors}:{}}:{},...t===`multiselect`?{multi:!0}:{},...t===`rating`?{max:r?.max??5}:{}}}function Hqe({scope:e=`customer`}={}){let t=yd(e),{fields:n,rawRows:r,payload:i,loading:a,overlayEdits:o,setOverlayEdits:s,patchOverlay:c}=Pte(e),[l,u]=(0,z.useState)([]),[d,f]=(0,z.useState)([]),[p,m]=(0,z.useState)(r9),[h,g]=(0,z.useState)(()=>Nf([])),[_,v]=(0,z.useState)(!1),[y,b]=(0,z.useState)(`saved`),[x,S]=(0,z.useState)(``),[C,w]=(0,z.useState)(new Set),[T,E]=(0,z.useState)(void 0),[D,O]=(0,z.useState)(null),[k,A]=(0,z.useState)(null),[j,M]=(0,z.useState)(null),[N,P]=(0,z.useState)(null),F=(0,z.useCallback)(()=>{P(null),requestAnimationFrame(()=>Te.current?.focus())},[]),[ee,I]=(0,z.useState)(!1),[te,L]=(0,z.useState)(``),ne=(0,z.useRef)(null),[re,ie]=(0,z.useState)(null),[ae,oe]=(0,z.useState)(!1),[se,ce]=(0,z.useState)(``),[le,ue]=(0,z.useState)(new Set),de=(0,z.useRef)(null),[fe,pe]=(0,z.useState)(null),[me,he]=(0,z.useState)(null),ge=(0,z.useRef)({edited:{},deleted:{}}),[_e,ve]=(0,z.useState)(null),[ye,be]=(0,z.useState)(null),xe=(0,z.useRef)({}),Se=(0,z.useRef)({}),Ce=(0,z.useRef)(null),we=(0,z.useRef)(null),Te=(0,z.useRef)(null),Ee=(0,z.useRef)(null),De=(0,z.useRef)(t9);(0,z.useEffect)(()=>{let e=()=>{De.current=bqe(De.current,Date.now())},t=()=>{De.current=t9};return document.addEventListener(`copy`,e,!0),window.addEventListener(`blur`,t),()=>{document.removeEventListener(`copy`,e,!0),window.removeEventListener(`blur`,t)}},[]);let[Oe,ke]=(0,z.useState)({width:800,height:600}),Ae=i?.workspace?.storageKey??`customer-grid-standalone`;(0,z.useEffect)(()=>{if(!i||n.length===0||Ce.current===Ae)return;let e=Fqe(Ae),t=of(e?.fieldStamps,Date.now());ge.current={edited:{...t.edited??{}},deleted:{...t.deleted??{}}};let r=Cte(n,e?.fields??[],t,Date.now(),i.workspace!=null),a=i.workspace?.views??[],o=new Map;o.set(r9,Pqe(r));for(let t of e?.views??[])o.set(t.id,t);let s=new Map,c=C7(e?.viewTombstones,Date.now());Se.current=c;for(let t of a){if(c[t.id]!==void 0){o.delete(t.id);continue}let n=xte(t,o.get(t.id),e?.savedAt,Date.now()),r=bte(n,t,e?.reemitted?.[t.id]);r!==null&&s.set(t.id,r),o.set(t.id,n)}let l=[...o.values()].map(e=>({...e,config:l9(e.config,r)})),d=e?.activeViewId??i.workspace?.activeViewId??r9,p=l.find(e=>e.id===d)??l[0];if(u(r),f(l),m(p.id),g(p.config),v(!0),Ce.current=Ae,s.size>0){let t={...e?.reemitted??{}};for(let e of l){let n=s.get(e.id);n!==void 0&&(Kd({id:qd(`view`),type:`view_upsert`,view:e}),t[e.id]=n)}xe.current=t}else xe.current={...e?.reemitted??{}}},[i,n,Ae]),(0,z.useEffect)(()=>{_&&Iqe(Ae,{fields:l,views:d,activeViewId:p,savedAt:Date.now(),fieldStamps:of(ge.current,Date.now()),reemitted:xe.current,viewTombstones:C7(Se.current,Date.now())})},[_,Ae,l,d,p]);let je=i?.workspace?.views;(0,z.useEffect)(()=>{if(!_)return;let e=Date.now(),t=IGe(l,n,ge.current.deleted,e);t!==l&&u(t),f(n=>FGe(n,je,Se.current,e,e=>l9(e,t)))},[_,je,n,l]);let Me=(0,z.useCallback)(e=>{let t=of(ge.current,Date.now());ge.current={edited:{...t.edited??{},[e]:Date.now()},deleted:{...t.deleted??{}}}},[]),Ne=(0,z.useCallback)(e=>{let t=of(ge.current,Date.now()),n={...t.edited??{}};delete n[e],ge.current={edited:n,deleted:{...t.deleted??{},[e]:Date.now()}}},[]),Pe=(0,z.useCallback)(e=>{e.groupBy!==h.groupBy&&w(new Set),g(e)},[h.groupBy]),{visibleCols:Fe,fieldByKey:Ie,order:Le,visible:Re,lockedKey:ze,onColumnResize:Be,onColumnMoved:Ve,onColumnProposeMove:He,setColumnVisible:Ue,insertColumn:We}=Dne(l,h,Pe);(0,z.useEffect)(()=>{if(!_)return;let e=d.find(e=>e.id===p);if(!e||c9(e.config,h)){b(`saved`);return}return b(`saving`),we.current!==null&&window.clearTimeout(we.current),we.current=window.setTimeout(()=>{let t={...e,config:h};f(e=>e.map(e=>e.id===t.id?t:e)),Kd({id:qd(`view`),type:`view_upsert`,view:t}),b(`saved`),we.current=null},420),()=>{we.current!==null&&window.clearTimeout(we.current)}},[_,p,h,d]),(0,z.useLayoutEffect)(()=>{let e=Ee.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect();t.width>0&&t.height>0&&ke({width:Math.floor(t.width),height:Math.floor(t.height)})};t();let n=new ResizeObserver(t);return n.observe(e),window.addEventListener(`resize`,t),()=>{n.disconnect(),window.removeEventListener(`resize`,t)}},[_]);let Ge=tte(i?.counts)===`server-windowed`,Ke=i?.workspace?.hideViews===!0,qe=nd(h.display),Je=Ge?`grid`:qe?.mode??`grid`,Ye=(0,z.useMemo)(()=>i?.measures??[],[i?.measures]),Xe=(0,z.useRef)({}),Ze=(0,z.useMemo)(()=>{let e=i?.measureSets;if(e){let t={};for(let[n,r]of Object.entries(e))t[n]=new Set(r);Xe.current=t}return Xe.current},[i?.measureSets]),Qe=(0,z.useMemo)(()=>Jf(h.filters,Ze),[h.filters,Ze]),$e=(0,z.useMemo)(()=>Yf(h.filters).join(`,`),[h.filters]),et=(0,z.useMemo)(()=>Object.keys(Ze).join(`,`),[Ze]),tt=(0,z.useMemo)(()=>i?.workspace?.lists??[],[i?.workspace?.lists]),nt=(0,z.useMemo)(()=>{let e={};for(let t of tt)t.pids&&(e[t.id]=new Set(t.pids));return e},[tt]),rt=i?.today,it=i?.viewer,at=(0,z.useCallback)(e=>Fee(e,it),[it]),ot=(0,z.useMemo)(()=>Xf(h.filters,{cohortSets:nt,today:rt}),[h.filters,nt,rt]),st=(0,z.useMemo)(()=>{let e=new Map;for(let t of l){if(t.type!==`formula`)continue;let n=vee(t);n&&e.set(t.key,n)}let{order:t,cyclic:n}=wGe(e),r=[];for(let i of t){if(n.has(i))continue;let t=a7(e.get(i));t.ok&&r.push({key:i,ast:t.ast})}return r},[l]),ct=(0,z.useMemo)(()=>l.filter(e=>e.type===`created_time`).map(e=>e.key),[l]),lt=(0,z.useMemo)(()=>{if(st.length===0&&ct.length===0)return r;let e={today:i?.today};return r.map(t=>{let n=o[t.pid],r=n?{...t,...n}:{...t},i={...t};for(let e of ct)i[e]=t._created??null,r[e]=i[e];for(let{key:t,ast:n}of st){let a=CGe(n,e=>r[e],e);i[t]=a,r[t]=a}return i})},[r,o,st,ct,i?.today]),ut=i?.workspace?.cohortMode===!0;(0,z.useEffect)(()=>{ut&&(re&&tt.some(e=>e.id===re)||ie(tt[0]?.id??null))},[ut,tt,re]);let dt=ut?tt.find(e=>e.id===re)??null:null,ft=(0,z.useMemo)(()=>new Set(dt?.pids??[]),[dt]),{visibleRows:pt,pidToIndex:mt}=Bne((0,z.useMemo)(()=>ut?lt.filter(e=>ft.has(e.pid)):lt,[ut,lt,ft]),l,h.filters,x,h.sorts,Ge?null:h.groupBy,C,h.memberPids,h.filterConj,Ge,Ze,nt,rt,h.cohortLock),[ht,gt]=(0,z.useState)(Aqe),_t=pt.length>ht,vt=(0,z.useMemo)(()=>_t?pt.slice(0,ht):pt,[_t,pt,ht]),yt=(0,z.useMemo)(()=>{if(!_t)return mt;let e=new Map;return vt.forEach((t,n)=>{t.kind===`data`&&!e.has(t.record.pid)&&e.set(t.record.pid,n)}),e},[_t,vt,mt]),[bt,xt]=(0,z.useState)(0);(0,z.useEffect)(()=>(Fp(()=>xt(e=>e+1)),()=>Fp(void 0)),[]);let St=i?.workspace?.userAvatars,Ct=(0,z.useMemo)(()=>{if(!h.groupBy)return null;let e=Math.min(wqe(h),Fe.length),t=0;for(let n=0;n{let e=new Set;for(let t of l)t.editRequestId&&t.key.startsWith(`measure_`)&&e.add(t.key);return e},[l]),[Tt,Et]=(0,z.useState)(0),[Dt,Ot]=(0,z.useState)(!1);(0,z.useEffect)(()=>{if(Ot(!1),wt.size===0)return;let e=0,t=window.setInterval(()=>{if(e+=1,e>Eqe){window.clearInterval(t),Ot(!0);return}Et(e=>e+1)},Tqe);return()=>window.clearInterval(t)},[wt]);let kt=Ere(vt,Fe,Ie,o,at,St,bt,Ct,kqe,Dt?Dqe:wt,Tt),{gridSelection:At,selectedPids:jt,onGridSelectionChange:Mt,selectPids:Nt,togglePid:Pt,setActiveCell:Ft,clearSelection:It}=Dre(vt,yt,Fe.length),Lt=(0,z.useMemo)(()=>Le.map(e=>Ie.get(e)).filter(e=>!!e),[Le,Ie]),Rt=At.current?.cell[1],zt=(0,z.useMemo)(()=>{let e={};for(let t of l){if(t.type===`select`||t.type===`multiselect`){e[t.key]=Qu(t);continue}if(t.type===`user`){e[t.key]=i?.userOptions??[];continue}t.type===`status`&&(e[t.key]=[...new Set(r.map(e=>e[t.key]).filter(e=>e!=null&&e!==``).map(String))].sort())}return e},[l,r,i?.userOptions]),Bt=Cqe[h.rowHeightMode],Vt=mt.size,Ht=yt.size,Ut=(0,z.useCallback)(e=>{let t=vt[e];if(!(!t||t.kind!==`data`))return e===T?h.colorBy?qte[String(t.record[h.colorBy]??``).toLowerCase()]??Yte:Yte:h.colorBy?Kte[String(t.record[h.colorBy]??``).toLowerCase()]:e===Rt?Xte:void 0},[vt,h.colorBy,T,Rt]),Wt=(0,z.useCallback)(e=>{let t=e.kind===`cell`?e.location[1]:void 0;E(e=>e===t?e:t);let n=t===void 0?void 0:vt[t];if(e.kind===`cell`&&n?.kind===`data`&&t!==void 0){let e=n.record.pid,r=Te.current?.getBounds(0,t),i=r?_ne(r,Ee.current?.getBoundingClientRect()):null;O(t=>i?t&&t.pid===e&&t.x===i.x&&t.y===i.y?t:{pid:e,x:i.x,y:i.y,size:i.size}:null)}if(e.kind===`header`){let t=Fe[e.location[0]],n=t?Ie.get(t.id):void 0,r=n?n.note||n.description:void 0,i=n&&t&&t.title!==n.label&&n?r?`${n.label} — ${r}`:n.label:r,a=e.bounds;if(i&&a){ve(e=>e&&e.text===i&&e.x===a.x?e:{text:i,x:a.x,y:a.y+a.height+4});return}}if(ve(e=>e===null?e:null),e.kind===`cell`&&t!==void 0){let n=vt[t],r=Fe[e.location[0]];if(n?.kind===`data`&&r){let t=Ie.get(r.id),i=t?Mp(t,n.record[t.key]):``,a=e.bounds,o=a?lne(i,Oqe(i),a.width):null;if(o&&a){let e=une(a.x,window.innerWidth,Oqe(o)+20),t=a.y+a.height+4;be(n=>n&&n.text===o&&n.x===e&&n.y===t?n:{text:o,x:e,y:t});return}}}be(e=>e===null?e:null)},[Fe,Ie,vt]),Gt=(0,z.useMemo)(()=>h.groupBy?e=>vt[e]?.kind===`group-header`?32:Bt:Bt,[h.groupBy,Bt,vt]),Kt=(0,z.useMemo)(()=>{let e=Nqe(),t=Mqe(vt.length);for(let e of Fe)t+=e.width??0;let n=o9;if(typeof Gt==`number`)n+=vt.length*Gt;else for(let e=0;eOe.height,i=t>Oe.width;r&&!i&&(i=t>Oe.width-e),i&&!r&&(r=n>Oe.height-e);let a=Oe.width-(r?e:0),o=Oe.height-(i?e:0);return{clientW:a,clientH:o,below:n{k!==null&&Yt===void 0&&A(null)},[k,Yt]);let Xt=(0,z.useMemo)(()=>{if(Yt===void 0)return null;let e=Jt[Yt];return!e||e.kind!==`data`?null:o[e.record.pid]?{...e.record,...o[e.record.pid]}:e.record},[Yt,Jt,o]),Zt=(0,z.useMemo)(()=>Yt===void 0?0:Jt.slice(0,Yt+1).filter(e=>e.kind===`data`).length,[Yt,Jt]),Qt=(0,z.useCallback)(e=>{if(Yt===void 0)return!1;for(let t=Yt+e;t>=0&&t{if(Yt!==void 0)for(let t=Yt+e;t>=0&&t{let n=e.column.id?Ie.get(e.column.id):void 0;if(e.ctx.font=`${e.theme.headerFontStyle} ${e.theme.fontFamily}`,t(),!n)return;let r=!!(n.note||n.description),i=n.source===`overlay`,a=pne(e.rect,e.menuBounds.width,mne(r,i));if(!a)return;let o=0;if(r){let t=a[o++];e.spriteManager.drawSprite(`aiosInfo`,`normal`,e.ctx,t.x,t.y,t.size,e.theme)}if(i){let t=a[o++],n=e.ctx;n.save(),n.beginPath(),n.arc(t.x+t.size/2,t.y+t.size/2,t.size/2,0,Math.PI*2),n.fillStyle=Qte,n.fill(),n.restore()}},[Ie]),tn=(0,z.useCallback)((e,t)=>{let n=vt[e[1]];if(!n)return;if(Bd(Rd),n.kind===`group-header`){t.preventDefault(),w(e=>{let t=new Set(e);return t.has(n.groupKey)?t.delete(n.groupKey):t.add(n.groupKey),t});return}let r=Fe[e[0]],i=r?Ie.get(r.id):void 0;if(n.kind===`data`&&i&&at(i)&&(Xu(i.type)||i.type===`rating`)){t.preventDefault(),Ft(e[0],e[1]);let r=t.bounds;P({pid:n.record.pid,fieldKey:i.key,anchor:{left:r.x,top:r.y,right:r.x+r.width,bottom:r.y+r.height,width:r.width,height:r.height}});return}if(n.kind===`data`&&i?.type===`url`){let e=String(o[n.record.pid]?.[i.key]??n.record[i.key]??``).trim();if(e){let n=/^https?:\/\//i.test(e)?e:/^[\w-]+(\.[\w-]+)+/.test(e)?`https://${e}`:null;if(n){t.preventDefault(),window.open(n,`_blank`,`noopener`);return}}}n.kind===`data`&&i&&i.key===ze&&Pt(n.record.pid)},[vt,Fe,Ie,at,o,ze,Pt,Ft]),nn=(0,z.useCallback)(e=>{let t=vt[e[1]],n=Fe[e[0]],r=n?Ie.get(n.id):void 0;t?.kind===`data`&&r?.source!==`overlay`&&A(t.record.pid)},[vt,Fe,Ie]),B=(0,z.useCallback)((e,t)=>{let n=vt[e[1]],r=Fe[e[0]],i=r?Ie.get(r.id):void 0;if(!(!n||n.kind!==`data`||!i||!at(i))){if(t.kind===R.Boolean&&i.type===`checkbox`){c(n.record.pid,{[i.key]:t.data?`1`:``});return}if(t.kind===R.Uri){c(n.record.pid,{[i.key]:t.data??``});return}(t.kind===R.Text||t.kind===R.Number)&&c(n.record.pid,{[i.key]:t.data})}},[vt,Fe,Ie,c,at]),rn=(0,z.useCallback)(e=>{let t=vt[e[1]],n=Fe[e[0]],r=n?Ie.get(n.id):void 0;return!!t&&t.kind===`data`&&!!r&&at(r)&&!Xu(r.type)&&r.type!==`rating`&&r.type!==`status`},[vt,Fe,Ie,at]),an=(0,z.useCallback)((e,t)=>{let n=Fe[e[0]],r=n?Ie.get(n.id):void 0;if(!r)return!1;let i=xqe(t.length,At.current?.range,{col:e[0],row:e[1]}),a=Array.from({length:i},(t,n)=>{let r=vt[e[1]+n];return r?.kind===`data`?r.record.pid:null}),o=Sqe({field:r,sourceFieldKey:De.current.fieldKey,editable:at(r),values:t,targetPids:a,allowedChoices:zt[r.key]??Qu(r)});if(!o)return!1;for(let e of o)c(e.pid,{[r.key]:e.value});return!1},[Fe,Ie,at,zt,vt,c,At.current]),on=(0,z.useCallback)((e,t)=>{let n=Fe[e];n?.id&&M({fieldKey:n.id,anchor:{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height,width:t.width,height:t.height}})},[Fe]),sn=(0,z.useCallback)((e,t)=>{t.isEdge||(t.preventDefault(),on(e,t.bounds))},[on]),cn=(0,z.useCallback)(e=>{if(e.key.toLowerCase()===`c`&&(e.ctrlKey||e.metaKey)&&!e.altKey){let e=At.current?.range,t=e?.width===1?Fe[e.x]:void 0;De.current=yqe(t?.id??null,Date.now());return}if(e.key===`Enter`&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let t=At.current?.cell;if(t){e.preventDefault(),e.stopPropagation(),e.cancel();let n=vt[t[1]],r=Fe[t[0]],i=r?Ie.get(r.id):void 0;if(!e.shiftKey&&n?.kind===`data`&&i&&at(i)&&(Xu(i.type)||i.type===`rating`)){let e=Te.current?.getBounds(t[0],t[1]);if(e){P({pid:n.record.pid,fieldKey:i.key,anchor:{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height,width:e.width,height:e.height}});return}}let a=e.shiftKey?-1:1,o=t[1]+a;for(;o>=0&&o=0&&o0?e.location[0]-1:void 0,r=At.current?.cell[0]??n;if(!t||r===void 0||!e.bounds)return;let i=Ee.current?.getBoundingClientRect()?.top??e.bounds.y;e.preventDefault(),e.stopPropagation(),e.cancel(),on(r,{x:e.bounds.x,y:i,width:e.bounds.width,height:36})},[At.current,on,vt,Ft,Fe,Ie,at]),ln=(0,z.useCallback)(e=>{f(t=>t.some(t=>t.id===e.id)?t.map(t=>t.id===e.id?e:t):[...t,e]),Kd({id:qd(`view`),type:`view_upsert`,view:e})},[]),un=(0,z.useCallback)((e,t)=>{let n=d.find(t=>t.id===e);if(!n)return;let r={...n.config};t?r.cohortLock=t:delete r.cohortLock,ln({...n,config:r}),e===p&&g(e=>{let n={...e};return t?n.cohortLock=t:delete n.cohortLock,n})},[d,p,ln]),dn=(0,z.useCallback)(e=>{let t=d.find(e=>e.id===p);t&&!c9(t.config,h)&&ln({...t,config:h});let n=d.find(t=>t.id===e);n&&(m(e),g(l9(n.config,l)),w(new Set),S(``),A(null),gt(Aqe),Kd({id:qd(`view`),type:`view_select`,viewId:e}),Bd(Rd))},[d,p,h,ln,l]),V=(0,z.useCallback)((e,t,n)=>{let r=Zu(e,d.map(e=>e.name)),i={...h,display:nd({...h.display??{},mode:t})},a={id:Lqe(),name:r,kind:`custom`,config:i,permissions:n};ln(a),m(a.id),g(i),b(`saved`)},[h,ln,d]),fn=(0,z.useCallback)((e,t)=>{let n=d.find(t=>t.id===e);if(n){let r=Zu(t,d.filter(t=>t.id!==e).map(e=>e.name));ln({...n,name:r})}},[d,ln]),pn=(0,z.useCallback)((e,t)=>{let n=d.find(t=>t.id===e);!n||!Cd(n,it)||ln({...n,locked:t})},[d,ln,it]),mn=(0,z.useCallback)((e,t)=>{let n=d.find(t=>t.id===e);n&&ln({...n,note:t.slice(0,2e3)})},[d,ln]),hn=(0,z.useCallback)(e=>{let t=d.find(t=>t.id===e);if(!t)return;let n={...t,id:Lqe(),name:Zu(`${t.name} copy`,d.map(e=>e.name)),kind:`custom`,locked:!1,permissions:{edit:`personal`},createdBy:void 0,config:{...t.config}};ln(n),m(n.id),g(n.config)},[d,ln]),gn=(0,z.useCallback)(e=>{let t=d.find(t=>t.id===e);if(!(!t||bd(t)||!Td(t,it))&&(Se.current=PGe(Se.current,e,Date.now()),f(t=>t.filter(t=>t.id!==e)),Kd({id:qd(`view-delete`),type:`view_delete`,viewId:e}),p===e)){let e=d.find(e=>e.id===r9)??Pqe(l);m(e.id),g(e.config)}},[d,p,l,it]);(0,z.useEffect)(()=>{if(!ut||!_||!re)return;let e=`cohort:${re}`;if(p===e)return;let t=d.find(e=>e.id===p);t&&!c9(t.config,h)&&ln({...t,config:h});let n=d.find(t=>t.id===e),r=n??{id:e,name:tt.find(e=>e.id===re)?.name??`Cohort`,kind:`custom`,config:Nf(l)};n||f(e=>[...e,r]),m(e),g(l9(r.config,l)),w(new Set),S(``)},[ut,_,re,p,d,h,l,tt,ln]);let _n=(0,z.useCallback)((e,t,n)=>{if(Ge)return;let r=d.find(t=>t.id===e);if(!r||Jf(r.config.filters,Ze)>0)return;let{visibleRows:i}=Qf({rawRows:lt,fields:l,filters:r.config.filters,search:``,sorts:r.config.sorts,groupBy:null,collapsed:new Set,memberPids:r.config.memberPids,filterConj:r.config.filterConj??`and`,measureSets:Ze,cohortSets:nt,today:rt}),a=i.filter(e=>e.kind===`data`).map(e=>e.record.pid);Kd({id:qd(`addlist`),type:`add_to_list`,viewId:e,cohortId:t,name:n,pids:a})},[d,lt,l,Ge,Ze,nt,rt]),[vn,yn]=(0,z.useState)({}),[bn,xn]=(0,z.useState)([]),Sn=i?.workspace?.folders,Cn=(0,z.useMemo)(()=>sGe(Sn,bn,vn,Date.now()),[Sn,bn,vn]),wn=(0,z.useCallback)(e=>cGe(e,d.find(t=>t.id===e)?.folderId??null,Cn,vn,Date.now()),[d,Cn,vn]),Tn=(0,z.useCallback)(e=>{yn(t=>oGe(e(t),Date.now()))},[]),En=(0,z.useCallback)(e=>{let t=new Set,n=[],r=0;for(let i of d){if(wn(i.id)!==e)continue;if(Ge){n.push({name:i.name,why:`this table loads one page at a time`});continue}if(Jf(i.config.filters,Ze)>0){n.push({name:i.name,why:`a metric condition has no answer yet`});continue}r+=1;let{visibleRows:a}=Qf({rawRows:lt,fields:l,filters:i.config.filters,search:``,sorts:i.config.sorts,groupBy:null,collapsed:new Set,memberPids:i.config.memberPids,filterConj:i.config.filterConj??`and`,measureSets:Ze,cohortSets:nt,today:rt});for(let e of a)e.kind===`data`&&t.add(e.record.pid)}return{pids:[...t],counted:r,skipped:n}},[d,wn,Ge,lt,l,Ze,nt,rt]),Dn=(0,z.useCallback)((e,t,n)=>{let{pids:r}=En(e);r.length&&Kd({id:qd(`addlist`),type:`add_to_list`,viewId:``,cohortId:t,name:n,pids:r})},[En]),On=(0,z.useCallback)((e,t,n,r)=>{if(Ge||Jf(t.filters,Ze)>0)return;let{visibleRows:i}=Qf({rawRows:n,fields:l,filters:t.filters,search:``,sorts:t.sorts,groupBy:null,collapsed:new Set,memberPids:t.memberPids,filterConj:t.filterConj??`and`,measureSets:Ze,cohortSets:nt,today:rt}),a=i.filter(e=>e.kind===`data`).map(e=>o[e.record.pid]?{...e.record,...o[e.record.pid]}:e.record),s=new Set(t.order),c=[...t.order,...l.map(e=>e.key).filter(e=>!s.has(e))],u=new Set(t.visible),d=c.filter(e=>u.has(e)).map(e=>Ie.get(e)).filter(e=>!!e);n7(r,e,rt,d,a)},[Ge,l,Ie,Ze,nt,rt,o]),kn=(0,z.useRef)(null),An=(0,z.useCallback)(e=>{kn.current=e},[]),jn=(0,z.useRef)(null),Mn=(0,z.useCallback)(e=>{jn.current=e},[]),Nn=(0,z.useCallback)((e,t)=>{let n=d.find(t=>t.id===e);if(!n)return;let r=l9(n.config,l),i=nd(r.display),a=e===p,o=e=>Bd(Fd,`Open "${n.name}" first: ${e} is exported from what it draws on screen.`);if(i?.mode===`timeseries`){let e=a?kn.current:null;if(!e)return o(`a time series`);if(e.empty){Bd(Fd,`"${n.name}" has no metrics on its sheet yet — add one, then export.`);return}if(t===`csv`)t7(qWe(n.name,rt,t),new Blob([``+Uie(e)],{type:`text/csv;charset=utf-8`}));else{let{fields:r,rows:i}=Wie(e);n7(t,n.name,rt,r,i)}return}if(i?.mode===`catalog`){Bd(Fd,`"${n.name}" is a catalog — open it and use Print to save it as a PDF. A spreadsheet of its products is not what it draws.`);return}if(i?.mode===`calendar`&&i.calendarMode===`summary`){let e=a?jn.current:null;if(!e)return o(`a calendar summary`);n7(t,n.name,rt,e.fields,e.rows);return}On(n.name,r,lt,t)},[d,l,lt,On,p,rt]),Pn=(0,z.useCallback)((e,t)=>{let n=[...jt];!n.length||Ge||(Kd({id:qd(`addlist`),type:`add_to_list`,viewId:p,cohortId:e,name:t,pids:n}),I(!1),L(``),It())},[jt,Ge,p,It]),Fn=i?.workspace?.scopeChoice===!0,In=h.cohortLock,Ln=(0,z.useMemo)(()=>{let e=In;if(!e)return;let t=tt.find(t=>t.id===e);return t?{name:t.name,count:t.pids?.length??0}:{}},[In,tt]),Rn=i?.workspace?.recordLayout?.order,zn=(0,z.useCallback)(e=>{Kd({id:qd(`rlayout`),type:`record_layout`,order:e})},[]),Bn=(0,z.useCallback)((e,t)=>{let n=qd(`field`),r={...e,label:Zu(e.label,l.filter(t=>t.key!==e.key).map(e=>e.label)),editRequestId:n};delete r.labelCorrectedFrom,delete r.labelCorrectionId,Me(r.key),u(e=>e.some(e=>e.key===r.key)?e.map(e=>e.key===r.key?r:e):[...e,r]),Kd({id:n,type:`field_upsert`,field:r,...t?{scope:t}:{}})},[Me,l]),Vn=(0,z.useCallback)((e,t,n,r,i,a,o)=>{let s=Fn?o?.scope:void 0,c=s===`cohort`?{scope:`cohort`}:{};if(a){let i={key:`measure_${u9(e)}_${Math.random().toString(36).slice(2,7)}`,label:e,type:t,source:`odoo`,default:!0,custom:!0,derived:!0,filterable:!1,agg:[`currency`,`int`].includes(t)?`sum`:void 0,measure:a,...c};Bn(i,s),We(i.key,n,r);return}let l={...Vqe(e,t,i,o),...c};Bn(l,s),We(l.key,n,r)},[We,Bn,Fn]),Hn=(0,z.useCallback)((e,t)=>{if(e===ze||e===t||!Ie.has(t))return;let n=Le.filter(e=>e!==t),r=n.indexOf(e);if(r<0)return;n.splice(r,0,t);let i=new Set(Re);i.delete(e),i.add(t),Pe({...h,order:n,visible:[...i]})},[h,Pe,Le,Re,Ie,ze]),Un=(0,z.useCallback)(e=>{if(!Ie.get(e)?.custom||e===ze)return;u(t=>t.filter(t=>t.key!==e));let t={...h.widths??{}};delete t[e],Pe({...h,order:Le.filter(t=>t!==e),visible:[...Re].filter(t=>t!==e),widths:t,sorts:(h.sorts??[]).filter(t=>t.colId!==e),groupBy:h.groupBy===e?null:h.groupBy,colorBy:h.colorBy===e?null:h.colorBy}),Ne(e),Kd({id:qd(`fielddel`),type:`field_delete`,key:e})},[h,Pe,Le,Re,Ie,ze,Ne]),Wn=(0,z.useCallback)((e,t,n,r,i)=>{let a=Fn?i?.scope:void 0,o={...Vqe(t,n,r,i),...a===`cohort`?{scope:`cohort`}:{}};Bn(o,a),Hn(e,o.key)},[Bn,Hn,Fn]),Gn=(0,z.useCallback)((e,t,n,r)=>{let i=Ie.get(e);if(!i?.custom||i.source!==`overlay`||t===`formula`||t===`created_time`)return;let a=e=>e===`int`||e===`currency`,o=i.format&&(a(i.type)&&a(t)||i.type===t),s={key:e,label:r?.label?.trim()||i.label,type:t,source:`overlay`,default:i.default,custom:!0,agg:[`currency`,`int`].includes(t)?`sum`:void 0,...i.note?{note:i.note}:{},...i.description?{description:i.description}:{},...i.scope?{scope:i.scope}:{},...i.createdBy?{createdBy:i.createdBy}:{},...i.permissions?{permissions:i.permissions}:{},...o?{format:i.format}:{},...(t===`select`||t===`multiselect`)&&n?.length?{options:n}:{},...t===`select`||t===`multiselect`?{colorCodeOptions:r?.colorCodeOptions!==!1,...r?.optionColors&&Object.keys(r.optionColors).length?{optionColors:r.optionColors}:{}}:{},...t===`multiselect`?{multi:!0}:{},...t===`rating`?{max:r?.max??5}:{}};Bn(s)},[Ie,Bn]),Kn=(0,z.useCallback)(e=>{let t=e.key.startsWith(`measure_`)?`measure_`:`custom_`,n=Zu(`${e.label} copy`,l.map(e=>e.label)),r=`${t}${u9(n)}_${Math.random().toString(36).slice(2,7)}`,i=qd(`fielddup`),a={...e,key:r,label:n,editRequestId:i};delete a.createdBy,delete a.permissions,delete a.labelCorrectedFrom,delete a.labelCorrectionId,Me(r),u(e=>[...e,a]),Kd({id:i,type:`field_duplicate`,sourceKey:e.key,key:r,label:n,...Fn&&e.scope===`cohort`?{scope:`cohort`}:{}}),We(r,e.key,`right`)},[We,Fn,Me,l]),qn=(0,z.useCallback)((e,t)=>{let n=Ie.get(e);if(!n?.measure)return;let r=Ye.find(e=>e.key===n.measure?.key),i=r?`${r.label} · ${qu(n.measure.window)}`:null,a=r&&i&&n.label===i?`${r.label} · ${qu(t)}`:n.label;Bn({...n,label:a,measure:{...n.measure,window:t}})},[Ie,Ye,Bn]),Jn=(0,z.useCallback)(()=>{if(!re)return;let e=[...jt].filter(e=>ft.has(e));e.length&&(Kd({id:qd(`cohortrm`),type:`cohort_remove`,cohortId:re,pids:e}),It())},[re,jt,ft,It]),Yn=(0,z.useCallback)(()=>{!re||le.size===0||(Kd({id:qd(`cohortadd`),type:`cohort_add`,cohortId:re,pids:[...le]}),ue(new Set),ce(``),oe(!1))},[re,le]),Xn=(0,z.useMemo)(()=>{if(!ae)return[];let e=se.trim().toLowerCase(),t=[];for(let n of r){if(ft.has(n.pid))continue;let r=String(n[ze]??``);e&&!r.toLowerCase().includes(e)||t.push({pid:n.pid,name:r})}return t},[ae,se,r,ft,ze]),Zn=(0,z.useMemo)(()=>Le.filter(e=>Re.has(e)),[Le,Re]),Qn=wqe(h),$n=(0,z.useCallback)(e=>{let t=Zn.indexOf(e);if(t<0)return;if(t<8){Pe({...h,frozenCount:Pee(t+1)});return}let n=Zn.filter(t=>t!==e);n.splice(7,0,e);let r=0,i=Le.map(e=>Re.has(e)?n[r++]:e);Pe({...h,order:i,frozenCount:8})},[Zn,Le,Re,h,Pe]),er=(0,z.useCallback)(()=>Pe({...h,frozenCount:void 0}),[h,Pe]),tr=(0,z.useCallback)(e=>{let t=d.find(e=>e.id===p);if(t&&Sd(t))return;let n=nd(h.display);if(e===`grid`){Pe({...h,display:n?nd({...n,mode:`grid`}):void 0});return}Pe({...h,display:{...n??{},mode:e}})},[h,Pe,d,p]),nr=(0,z.useCallback)((e,t)=>{let n=nd(h.display);if(!n)return;let r={...n,[e]:t};t||delete r[e],Pe({...h,display:r})},[h,Pe]),rr=(0,z.useCallback)(e=>{let t=nd(h.display);if(!t)return;let n={...t};e===!1?n.kanbanClamp=!1:delete n.kanbanClamp,Pe({...h,display:n})},[h,Pe]),ir=(0,z.useCallback)(e=>{let t=nd(h.display);if(!t)return;let n={...t},r=e.slice(0,4);r.length?n.calendarMetrics=r:delete n.calendarMetrics,Pe({...h,display:n})},[h,Pe]),ar=(0,z.useCallback)(e=>{let t=nd(h.display);if(!t)return;let n={...t};e===`summary`?n.calendarMode=`summary`:delete n.calendarMode,Pe({...h,display:n})},[h,Pe]),or=(0,z.useMemo)(()=>l.filter(e=>id(e.type)),[l]),sr=(0,z.useMemo)(()=>l.filter(e=>e.type===`status`||e.type===`select`),[l]),cr=(e,t,n)=>(e?t.find(t=>t.key===e):void 0)||((n?t.find(e=>e.key===n):void 0)??t[0]),lr=(0,z.useMemo)(()=>YGe(qe?.charts)??[],[qe?.charts]),ur=(0,z.useCallback)(e=>{let t=nd(h.display);if(!t)return;let n={...t,charts:e};e.length||delete n.charts,Pe({...h,display:n})},[h,Pe]),dr=(0,z.useMemo)(()=>l.filter(e=>e.type===`status`||e.type===`select`),[l]),fr=(0,z.useMemo)(()=>l.filter(e=>rd(e.type)),[l]),pr=qe?.colorField?dr.find(e=>e.key===qe.colorField):void 0,mr=qe?.sizeField?fr.find(e=>e.key===qe.sizeField):void 0,hr=cr(qe?.dateField,or,`last_order`),gr=cr(qe?.stackField,sr),_r=(0,z.useMemo)(()=>{if(Je!==`calendar`&&Je!==`kanban`&&Je!==`map`&&Je!==`chart`&&Je!==`timeseries`&&Je!==`catalog`)return[];let e=new Set,t=[];for(let n of pt){if(n.kind!==`data`||e.has(n.record.pid))continue;e.add(n.record.pid);let r=o[n.record.pid];t.push(r?{...n.record,...r}:n.record)}return t},[Je,pt,o]),vr=(0,z.useMemo)(()=>gr?Zn.filter(e=>e!==ze&&e!==gr.key).slice(0,3):[],[Zn,ze,gr]),yr=(0,z.useCallback)((e,t)=>{gr&&c(e,{[gr.key]:t})},[gr,c]),br=(0,z.useCallback)(e=>{w(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),xr=(0,z.useMemo)(()=>Je===`timeseries`?_r.map(e=>e.pid):[],[Je,_r]),Sr=(0,z.useMemo)(()=>Je===`catalog`?qe?.catalogs??[]:[],[Je,qe]),Cr=(0,z.useMemo)(()=>Je===`catalog`?_r.map(e=>e[$f]).filter(e=>typeof e==`string`&&!!e):[],[Je,_r]),wr=(0,z.useCallback)(e=>{let t=nd(h.display)??{mode:`catalog`};Pe({...h,display:{...t,catalogs:e}})},[h,Pe]),Tr=(0,z.useCallback)(e=>{let t=nd(h.display)??{mode:`timeseries`};Pe({...h,display:{...t,...e}})},[h,Pe]),Er=!!gr&&gr.type===`select`&&at(gr),Dr=gr?gr.type===`status`?`Stacked by ${gr.label} — read-only, computed from the source system.`:at(gr)?null:`You do not have permission to edit this field, so cards cannot be moved.`:null;if(a||!_)return(0,H.jsx)(`div`,{className:`cg-loading`,children:(0,H.jsx)(`span`,{className:`lp-spin lp-spin--lg`,role:`status`,"aria-label":`Loading`})});let Or=d.find(e=>e.id===p),kr=ut?(0,H.jsx)(`button`,{type:`button`,className:`cg-tb-btn cg-tb-addcust`,ref:de,disabled:!re,onClick:()=>oe(e=>!e),"aria-expanded":ae,"aria-haspopup":`dialog`,children:`+ Add customers`}):void 0,Ar=new Set(l.filter(e=>e.custom&&e.key!==ze).map(e=>e.key)),jr=j?Ie.get(j.fieldKey):void 0,Mr=jr?h.sorts.find(e=>e.colId===jr.key)?.dir??null:null,Nr=jr?zqe(h.filters,jr.key):!1,Pr=jr?Zn.indexOf(jr.key):-1,Fr=Pr>=0&&Qn>1&&Pr+1===Qn,Ir=Ge?void 0:(0,H.jsx)(QGe,{mode:Je,onMode:tr,locked:!!Or&&Sd(Or),dateField:hr,dateChoices:or,stackField:gr,stackChoices:sr,colorField:pr,colorChoices:dr,sizeField:mr,sizeChoices:fr,onPickField:nr,clamped:qe?.kanbanClamp!==!1,onClamp:rr,calendarMode:qe?.calendarMode??`records`,onCalendarMode:ar,calendarMetrics:qe?.calendarMetrics,metricChoices:fr,onCalendarMetrics:ir}),Lr=N?Ie.get(N.fieldKey):void 0,Rr=Lr?Lr.type===`user`?i?.userOptions??[]:Qu(Lr):[],zr=N?r.find(e=>e.pid===N.pid):void 0,Br=String((N&&o[N.pid]?.[N.fieldKey])??(Lr&&zr?zr[Lr.key]:``)??``),Vr=Lr?.type===`multiselect`,Hr=Vr?Rqe(Br):[],Ur=Rr.length?Vr?Hr.find(e=>Rr.includes(e))??Rr[0]:Rr.includes(Br)?Br:Rr[0]:null;return(0,H.jsxs)(`div`,{className:`cg-shell`,"data-today":rt??``,"data-measure-rules":$e,"data-measure-sets":et,children:[!Ke&&(0,H.jsx)(dGe,{onCohortLock:un,views:d,activeViewId:p,saveState:y,onSelect:dn,onCreate:V,onRename:fn,onNote:mn,onDuplicate:hn,onDelete:gn,lists:tt,onAddToList:Ge?void 0:_n,today:rt,onExport:Ge?void 0:Nn,folders:Cn,folderIdOf:wn,onFolderCreate:(e,t)=>{let n=uGe();xn(r=>[...r.slice(-31),{id:n,name:e,order:9999,icon:t}]),Tn(e=>({...e,created:{...e.created,[n]:Date.now()}})),Kd({id:qd(`foldnew`),type:`folder_create`,surface:`views`,folderId:n,name:e,icon:t})},onFolderRename:(e,t)=>{Tn(n=>({...n,renamed:{...n.renamed,[e]:{at:Date.now(),name:t}}})),Kd({id:qd(`foldren`),type:`folder_rename`,surface:`views`,folderId:e,name:t})},onFolderDelete:e=>{Tn(t=>({...t,deleted:{...t.deleted,[e]:Date.now()}})),Kd({id:qd(`folddel`),type:`folder_delete`,surface:`views`,folderId:e})},onFolderDuplicate:e=>{let t=uGe(),n=Cn.find(t=>t.id===e);xn(e=>[...e.slice(-31),{id:t,name:`${n?.name??`Folder`} copy`,order:9999}]),Tn(e=>({...e,created:{...e.created,[t]:Date.now()}})),Kd({id:qd(`folddup`),type:`folder_duplicate`,surface:`views`,folderId:e,newId:t})},onItemMove:(e,t)=>{Tn(n=>({...n,moved:{...n.moved,[e]:{at:Date.now(),folderId:t}}})),Kd({id:qd(`itemmove`),type:`item_move`,surface:`views`,itemId:e,folderId:t})},folderAddPreview:Ge?void 0:En,onFolderAddToList:Ge?void 0:Dn,viewer:it,onToggleLock:pn,userOptions:i?.userOptions}),(0,H.jsxs)(`main`,{className:`cg-main`,children:[(0,H.jsx)(pie,{nouns:t.nouns,cohortLock:Ln,copyViews:d.filter(e=>e.id!==p),onCopyConfig:e=>Pe({...h,...e}),fields:l,visible:Re,lockedKey:ze,onColumnVisible:Ue,onColumnsVisible:e=>Pe({...h,visible:[...new Set([ze,...e])]}),orderedFields:Lt,onFieldOrder:e=>Pe({...h,order:e}),deletableKeys:Ar,onDeleteField:Un,colorOn:h.colorBy!==null,onToggleColor:e=>Pe({...h,colorBy:e?l.find(e=>e.type===`status`)?.key??null:null}),rowHeightMode:h.rowHeightMode,onRowHeightMode:e=>Pe({...h,rowHeightMode:e}),filters:h.filters,onFilters:e=>Pe({...h,filters:e}),filterConj:h.filterConj??`and`,onFilterConj:e=>Pe({...h,filterConj:e}),sorts:h.sorts,onSorts:e=>Pe({...h,sorts:e}),groupBy:Ge?null:h.groupBy,onGroupBy:e=>Pe({...h,groupBy:e}),statusValues:zt,measures:Ye,unresolvedCount:ot,lists:tt,pendingMeasureCount:Qe,search:x,onSearch:S,recordCount:Vt,scopeCounts:i?.counts,pool:i?.workspace?.pool,serverWindowed:Ge,cohortAction:kr,filterSeed:fe,modeControl:Ir}),(0,H.jsxs)(`div`,{className:`cg-grid-box`,ref:Ee,onMouseLeave:()=>O(e=>e===null?e:null),children:[Je===`grid`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(dee,{ref:Te,columns:Fe,getCellContent:kt,rows:vt.length,theme:bf,freezeColumns:Qn,rowHeight:Gt,headerHeight:36,rowMarkers:`both`,rowMarkerWidth:Mqe(vt.length),gridSelection:At,onGridSelectionChange:Mt,getRowThemeOverride:Ut,onItemHovered:Wt,onCellClicked:tn,onCellActivated:nn,onCellEdited:B,onPaste:an,validateCell:rn,onColumnResize:Be,onColumnMoved:Ve,onColumnProposeMove:He,drawHeader:en,onHeaderMenuClick:(e,t)=>on(e,t),onHeaderClicked:sn,onHeaderContextMenu:sn,onKeyDown:cn,maxColumnWidth:600,getCellsForSelection:!0,rowSelectionMode:`multi`,smoothScrollX:!0,smoothScrollY:!0,width:Oe.width,height:Oe.height,customRenderers:[bre,_re,yre],headerIcons:cne,rightElement:(0,H.jsx)(`button`,{type:`button`,className:`cg-add-field-btn`,"aria-label":`Add field`,title:`Add a field`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();he({left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:t.width,height:t.height})},children:`+`}),rightElementProps:{sticky:!0,fill:!1}}),Kt.below!==null&&(0,H.jsx)(`div`,{className:`cg-grid-void`,"aria-hidden":!0,style:{top:Kt.below,left:0,width:Kt.clientW,height:Kt.clientH-Kt.below}}),Kt.right!==null&&(0,H.jsx)(`div`,{className:`cg-grid-void`,"aria-hidden":!0,style:{top:o9,left:Kt.right,width:Kt.clientW-Kt.right,height:Kt.clientH-o9}})]}),Je===`list`&&(0,H.jsx)($Ge,{rows:vt,fieldByKey:Ie,visibleKeys:Zn,titleKey:ze,onOpen:A,onToggleGroup:br}),Je===`calendar`&&(hr?(0,H.jsx)(rKe,{rows:_r,field:hr,today:rt,titleKey:ze,mode:qe?.calendarMode??`records`,metrics:qe?.calendarMetrics,fieldByKey:Ie,scope:e,onOpen:A,onSheet:Mn}):(0,H.jsx)(`div`,{className:`cg-mode-empty`,children:`This table has no date field to place records by.`})),Je===`kanban`&&(gr?(0,H.jsx)(iKe,{rows:_r,field:gr,fieldByKey:Ie,cardKeys:vr,titleKey:ze,canMove:Er,readOnlyReason:Dr,clamped:qe?.kanbanClamp!==!1,onMove:yr,onOpen:A}):(0,H.jsx)(`div`,{className:`cg-mode-empty`,children:`This table has no status or single-select field to stack by.`})),Je===`chart`&&(0,H.jsx)(CKe,{rows:_r,fields:l,fieldByKey:Ie,charts:lr,onCharts:ur}),Je===`timeseries`&&(0,H.jsx)(bWe,{scope:e,pids:xr,fields:l,rows:_r,display:qe,onDisplay:Tr,onSheet:An}),Je===`catalog`&&(e===`product`?(0,H.jsx)(mqe,{catalogs:Sr,onCatalogs:wr,fields:l,fieldByKey:Ie,poolRows:r,filteredCodes:Cr}):(0,H.jsx)(`div`,{className:`cg-mode-empty`,children:`A catalog prints products. Open the Products table to build one.`})),Je===`map`&&Ie.get(ze)&&(0,H.jsx)(tqe,{rows:_r,field:Ie.get(ze),colorField:pr,sizeField:mr,selectedPids:jt,onSelectPids:Nt,onOpen:A}),Je===`grid`&&D&&(0,H.jsx)(`button`,{type:`button`,className:`cg-row-expand`,style:{left:D.x,top:D.y,width:D.size,height:D.size},title:`Expand record`,"aria-label":`Expand record`,onMouseDown:e=>e.preventDefault(),onClick:()=>A(D.pid),children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`13`,height:`13`,"aria-hidden":!0,focusable:`false`,children:(0,H.jsx)(`path`,{d:`M9.5 2.5H13.5V6.5M6.5 13.5H2.5V9.5M13.5 2.5L9 7M2.5 13.5L7 9`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}),_e&&(0,H.jsx)(`div`,{className:`cg-header-tip`,style:{left:_e.x,top:_e.y},"aria-hidden":!0,children:_e.text}),ye&&(0,H.jsx)(`div`,{className:`cg-header-tip cg-cell-tip`,style:{left:ye.x,top:ye.y},"aria-hidden":!0,children:ye.text}),jt.size>0&&!Ge&&(Je===`grid`||Je===`map`)&&(0,H.jsxs)(`div`,{className:`cg-selbar`,children:[(0,H.jsxs)(`span`,{className:`cg-selbar-count`,children:[jt.size.toLocaleString(),` selected`]}),ut?(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--danger cg-selbar-remove`,style:n9,onClick:Jn,children:`Remove from cohort`}):(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary cg-selbar-add`,style:n9,ref:ne,onClick:()=>{if(!ee){let e=Or?.name??`Customers`;L(rt?`${e} · ${rt}`:e)}I(!ee)},"aria-expanded":ee,"aria-haspopup":`dialog`,children:`Add to cohort`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,style:n9,onClick:It,children:`Clear`})]})]}),_t&&(Je===`grid`||Je===`list`)&&(0,H.jsxs)(`div`,{className:`cg-more`,children:[(0,H.jsxs)(`span`,{className:`cg-more-note`,children:[`Showing first `,Ht.toLocaleString(),` of`,` `,Vt.toLocaleString()]}),(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>gt(e=>e+jqe),children:`See more`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>gt(pt.length),children:`Show all`})]})]}),jr&&j&&(0,H.jsx)(NGe,{state:j,field:jr,fields:l,locked:jr.key===ze,viewer:it,sortedDir:Mr,isFiltered:Nr,isGrouped:h.groupBy===jr.key,groupable:Iee(jr,ze),onClose:()=>M(null),onNote:e=>Bn({...jr,note:e}),onHide:()=>{Ue(jr.key,!1),M(null)},onCreate:Vn,onChangeField:e=>Hn(jr.key,e),onCreateAndSwap:(e,t,n,r)=>Wn(jr.key,e,t,n,r),onRetype:jr.custom&&jr.source===`overlay`?(e,t,n)=>Gn(jr.key,e,t,n):void 0,onRename:jr.custom?e=>Bn({...jr,label:e}):void 0,onFormula:jr.custom&&jr.type===`formula`?(e,t)=>Bn({...jr,formula:e,...t?{label:t}:{}}):void 0,onPeriod:jr.measure?e=>qn(jr.key,e):void 0,onDelete:jr.custom&&jr.key!==ze?()=>{Un(jr.key),M(null)}:void 0,onDuplicate:jr.custom?()=>Kn(jr):void 0,onPermissions:jr.custom?e=>Bn({...jr,permissions:{edit:e}}):void 0,onFormat:e=>Bn({...jr,format:e}),onSort:e=>Pe({...h,sorts:[{colId:jr.key,dir:e}]}),onClearSort:()=>Pe({...h,sorts:h.sorts.filter(e=>e.colId!==jr.key)}),onFilterBy:()=>pe(e=>({n:(e?.n??0)+1,...jr.measure?{measure:{key:jr.measure.key,window:jr.measure.window}}:{key:jr.key}})),pinnedTo:Fr,onPinTo:Pr>0&&!Fr?()=>$n(jr.key):void 0,onUnpin:Qn>1?er:void 0,scopeChoice:Fn,onClearFilter:()=>Pe({...h,filters:Bqe(h.filters,jr.key)}),onGroupByField:()=>Pe({...h,groupBy:jr.key}),onClearGroup:()=>Pe({...h,groupBy:null}),userOptions:i?.userOptions??[],measures:Ye},jr.key),me&&Ie.get(ze)&&(0,H.jsx)(NGe,{state:{fieldKey:ze,anchor:me},field:Ie.get(ze),fields:l,locked:!0,viewer:it,sortedDir:null,isFiltered:!1,isGrouped:!1,groupable:!1,initialPosition:`end`,onClose:()=>he(null),onNote:()=>void 0,onHide:()=>void 0,onCreate:Vn,onChangeField:()=>void 0,onCreateAndSwap:()=>void 0,onSort:()=>void 0,onClearSort:()=>void 0,onFilterBy:()=>void 0,onClearFilter:()=>void 0,onGroupByField:()=>void 0,onClearGroup:()=>void 0,scopeChoice:Fn,userOptions:i?.userOptions??[],measures:Ye},`__add-at-end__`),ee&&ne.current&&jt.size>0&&(0,H.jsxs)(Yp,{anchor:ne.current,className:`cg-pop cg-add-list-pop`,placement:`bottom-start`,role:`dialog`,ariaLabel:`Add selected customers to a locked view`,onDismiss:()=>I(!1),dataKind:`selection-add-to-list`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Add to locked view`}),(0,H.jsxs)(`div`,{className:`cg-pop-note`,children:[`Adds the `,jt.size.toLocaleString(),` checked customer`,jt.size===1?``:`s`,`. The cohort stays fixed as the data changes.`]}),tt.map(e=>(0,H.jsx)(`button`,{type:`button`,className:`cg-pick-row`,onClick:()=>Pn(e.id,e.name),children:e.name},e.id)),(0,H.jsxs)(`div`,{className:`cg-view-create`,children:[(0,H.jsx)(`label`,{htmlFor:`cg-sel-new-list`,children:`Lock records into a new view`}),(0,H.jsx)(`input`,{id:`cg-sel-new-list`,className:`cg-input`,"data-overlay-autofocus":!0,value:te,placeholder:`e.g. Q3 call plan`,onChange:e=>L(e.target.value),onKeyDown:e=>{e.key===`Enter`&&te.trim()&&Pn(``,te.trim())}}),(0,H.jsx)(`div`,{className:`cg-form-actions`,children:(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,style:n9,disabled:!te.trim(),onClick:()=>Pn(``,te.trim()),children:`Create and add`})})]})]}),ut&&ae&&de.current&&re&&(0,H.jsxs)(Yp,{anchor:de.current,className:`cg-pop cg-addcust-pop`,placement:`bottom-start`,role:`dialog`,ariaLabel:`Add customers to this locked view`,onDismiss:()=>oe(!1),dataKind:`cohort-add-customers`,children:[(0,H.jsx)(`div`,{className:`cg-pop-title`,children:`Add customers`}),(0,H.jsxs)(`div`,{className:`cg-pop-note`,children:[`Search your customer pool and tick who to add to`,` `,(0,H.jsx)(`strong`,{children:dt?.name??`this locked view`}),`.`]}),(0,H.jsx)(`input`,{type:`text`,className:`cg-input cg-addcust-search`,"data-overlay-autofocus":!0,placeholder:`Search customers…`,"aria-label":`Search customers`,value:se,onChange:e=>ce(e.target.value)}),(0,H.jsxs)(`div`,{className:`cg-pick-list cg-addcust-list`,children:[Xn.slice(0,50).map(e=>(0,H.jsxs)(`label`,{className:`cg-check-row`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:le.has(e.pid),onChange:()=>ue(t=>{let n=new Set(t);return n.has(e.pid)?n.delete(e.pid):n.add(e.pid),n})}),(0,H.jsx)(`span`,{className:`cg-check-label`,children:e.name})]},e.pid)),Xn.length===0&&(0,H.jsx)(`div`,{className:`cg-pop-note`,children:se.trim()?`No customer outside this locked view matches your search.`:`Every customer in your pool is already in this locked view.`})]}),Xn.length>50&&(0,H.jsxs)(`div`,{className:`cg-field-hint`,children:[`Showing the first 50 of `,Xn.length.toLocaleString(),` matches — keep typing to narrow.`]}),(0,H.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,style:n9,disabled:le.size===0,onClick:Yn,children:le.size===0?`Add customers`:`Add ${le.size.toLocaleString()} customer${le.size===1?``:`s`}`}),(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,style:n9,onClick:()=>oe(!1),children:`Cancel`})]})]}),Lr&&N&&(0,H.jsxs)(Yp,{anchor:N.anchor,className:`cg-pop cg-pick-pop`,placement:`bottom-start`,role:`listbox`,ariaLabel:`Choose ${Lr.label}`,onDismiss:F,dataKind:`cell-picker`,initialFocus:`[data-overlay-autofocus]`,onKeyDown:e=>{let t=e.key===`ArrowDown`||e.key===`ArrowRight`,n=e.key===`ArrowUp`||e.key===`ArrowLeft`;if(!t&&!n)return;let r=Array.from(e.currentTarget.querySelectorAll(`.cg-pick-row, .cg-star-btn`));if(!r.length)return;e.preventDefault();let i=r.indexOf(document.activeElement);r[t?(i+1)%r.length:(i-1+r.length)%r.length]?.focus()},children:[Lr.type===`rating`&&(0,H.jsx)(`div`,{className:`cg-stars`,role:`radiogroup`,"aria-label":`Set ${Lr.label}`,children:Array.from({length:$u(Lr)},(e,t)=>t+1).map(e=>(0,H.jsx)(`button`,{type:`button`,className:`cg-star-btn`,role:`radio`,"aria-checked":Number(Br)===e,"data-overlay-autofocus":Number(Br)===e||!Br&&e===1||void 0,"aria-label":`${e} star${e===1?``:`s`}`,onClick:()=>{c(N.pid,{[Lr.key]:String(e)}),F()},children:(0,H.jsx)(Im,{on:Number(Br)>=e})},e))}),Lr.type!==`rating`&&Rr.length===0&&(0,H.jsx)(`div`,{className:`cg-pop-note`,children:Lr.type===`user`?`No assignable people were supplied for this workspace.`:`This field has no choices yet. Add them from the column menu.`}),(0,H.jsx)(`div`,{className:`cg-pick-list`,"aria-multiselectable":Vr||void 0,children:Rr.map(e=>{let t=xp(Lr,e),n=Vr?Hr.includes(e):Br===e;return(0,H.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n,"data-overlay-autofocus":e===Ur||void 0,className:`cg-pick-row`+(n?` is-on`:``),onClick:()=>{if(Vr){let t=n?Hr.filter(t=>t!==e):[...Hr,e];c(N.pid,{[Lr.key]:t.join(`,`)});return}c(N.pid,{[Lr.key]:e}),F()},children:[Lr.type===`user`&&(0,H.jsxs)(`span`,{className:`cg-pick-avatar`,"aria-hidden":`true`,style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,flex:`0 0 auto`,width:20,height:20,borderRadius:`50%`,overflow:`hidden`,marginRight:8,fontSize:9,fontWeight:600,lineHeight:1,position:`relative`,background:vp(e).bg,color:vp(e).fg},children:[Cp(e),St?.[e]&&(0,H.jsx)(`img`,{src:St[e],alt:``,onError:e=>{e.currentTarget.style.visibility=`hidden`},style:{position:`absolute`,inset:0,width:`100%`,height:`100%`,objectFit:`cover`}})]}),(0,H.jsx)(`span`,{className:`cg-pick-pill`,style:t?{background:t.bg,color:t.fg}:void 0,children:e})]},e)})}),Vr&&(0,H.jsx)(`div`,{className:`cg-form-actions`,children:(0,H.jsx)(`button`,{type:`button`,className:`cg-btn`,style:n9,onClick:F,children:`Done`})}),Br!==``&&(0,H.jsx)(`button`,{type:`button`,className:`cg-pick-row cg-pick-clear`,"data-overlay-autofocus":Rr.length===0||void 0,onClick:()=>{c(N.pid,{[Lr.key]:``}),F()},children:`Clear`})]}),Xt&&k!==null&&(0,H.jsx)(WWe,{fields:l,record:Xt,titleKey:ze,positionLabel:`Record ${Zt.toLocaleString()} of ${Vt.toLocaleString()}`,canPrev:Qt(-1),canNext:Qt(1),onPrev:()=>$t(-1),onNext:()=>$t(1),onClose:()=>A(null),recordLayout:Rn,onRecordLayout:zn,scope:e,docs:i?.docs?.[String(k)]??[],docPayload:i?.docPayload,onDocAdd:i?.docs?e=>Kd({id:qd(`docadd`),type:`doc_add`,pid:k,docId:`doc_${qd(`d`).slice(2,14).replace(/[^a-z0-9]/gi,``)}`,...e}):void 0,onDocFetch:i?.docs?e=>Kd({id:qd(`docget`),type:`doc_fetch`,pid:k,docId:e}):void 0,onDocDelete:i?.docs?e=>Kd({id:qd(`docdel`),type:`doc_delete`,pid:k,docId:e}):void 0,onNotesChange:(e,t)=>s(n=>({...n,[k]:{...n[k],[e]:t}})),onNotesCommit:(e,t)=>c(k,{[e]:t}),viewer:it,userOptions:i?.userOptions??[],userAvatars:St})]})}var Uqe=(0,z.memo)(Hqe),d9=class extends Error{status;constructor(e,t){super(e),this.name=`AutomationError`,this.status=t}};async function Wqe(e){let t=null;try{t=await e.json()}catch{}if(e.status===401&&Bd(Nd),!e.ok)throw new d9(t?.error?.message||`The server answered ${e.status}.`,e.status);return t}function f9(e,t){return fetch(`${jd}${e}`,{credentials:Md,headers:t?.body?{"Content-Type":`application/json`}:void 0,...t}).then(e=>Wqe(e))}function Gqe(e){return f9(`/automations`,{signal:e})}function Kqe(e){return f9(`/automations/tables`,{signal:e})}function qqe(e){return f9(`/automations`,{method:`POST`,body:JSON.stringify(e)})}function Jqe(e,t){return f9(`/automations/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)})}function Yqe(e){return f9(`/automations/${encodeURIComponent(e)}`,{method:`DELETE`})}function Xqe(e){return f9(`/automations/${encodeURIComponent(e)}/run`,{method:`POST`})}function Zqe(e,t){return f9(`/automations/${encodeURIComponent(e)}/nodes/${encodeURIComponent(t)}/toggle`,{method:`POST`})}function Qqe(e){return f9(`/automations/${encodeURIComponent(e)}/rows`)}function $qe(e,t,n){return f9(`/automations/preview`,{method:`POST`,body:JSON.stringify({url:e,extract:t,tableIndex:n})})}function p9(e){return(e||``).toLowerCase().replace(/[^a-z0-9_]+/g,`_`).replace(/^_+|_+$/g,``).slice(0,60)}function eJe(e){return e.running?`running`:e.status?.state||`idle`}var tJe=[[`inserted`,`New`],[`updated`,`Updated`],[`unchanged`,`Unchanged`],[`orphans`,`No longer on the page (kept)`],[`duplicates`,`Duplicate keys`],[`skipped`,`Skipped (no key)`],[`capped`,`Not written — the database is full`],[`source_rows`,`Rows read`],[`profiles`,`Profiles`],[`ok`,`Read in full`],[`partial`,`Profile only`],[`blocked`,`Blocked`],[`error`,`Errors`],[`paid`,`Exact via HikerAPI`],[`posts`,`Posts`],[`new_posts`,`New posts`]];function nJe({kinds:e,onCreated:t,onCancel:n}){let[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(`scrape_db`),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(``),[d,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)(``),[h,g]=(0,z.useState)(`table`),[_,v]=(0,z.useState)(0),[y,b]=(0,z.useState)(``),[x,S]=(0,z.useState)(null),[C,w]=(0,z.useState)(!1),[T,E]=(0,z.useState)([]),[D,O]=(0,z.useState)(``),[k,A]=(0,z.useState)([]),[j,M]=(0,z.useState)(``),[N,P]=(0,z.useState)(``),[F,ee]=(0,z.useState)(``);(0,z.useEffect)(()=>{let e=new AbortController;return Kqe(e.signal).then(e=>A(e.tables)).catch(()=>A([])),()=>e.abort()},[]);let I=k.find(e=>e.key===j)||null,te=(0,z.useCallback)(async()=>{w(!0),c(``);try{let e=await $qe(p,h,_);if(S(e),!e.ok){c(e.note||`That page answered ${e.status}.`);return}E(e.columns.map(e=>({column:e,include:!0,key:p9(e)}))),O(p9(e.columns[0]||``)),y||b(e.title||`Scraped table`),u(`Read ${e.rowCount} rows and ${e.columns.length} columns`+(e.tableCount&&e.tableCount>1?` (of ${e.tableCount} tables on the page)`:``))}catch(e){c(e instanceof d9?e.message:`That page could not be read.`)}finally{w(!1)}},[p,h,_,y]),L=async()=>{f(!0),c(``);try{let e={};for(let t of T)t.include&&t.key&&(e[t.column]=t.key);await t((await qqe({name:r,kind:a,schedule:{cron:`0 6 * * *`,enabled:!1},config:a===`scrape_db`?{url:p,extract:h,tableIndex:_,fieldMap:e,keyField:D,targetLabel:y}:{targetTable:j,fieldKey:N,urlField:F,maxPosts:24,tier:`anonymous`}})).automation.id)}catch(e){c(e instanceof d9?e.message:`That could not be created.`)}finally{f(!1)}},ne=!!r.trim()&&(a===`scrape_db`?!!p.trim()&&T.some(e=>e.include&&e.key===D):!!j&&!!N);return(0,H.jsx)(`div`,{className:`auto-create-pane`,children:(0,H.jsxs)(`div`,{className:`auto-create-card`,children:[(0,H.jsx)(`h1`,{children:`New automation`}),(0,H.jsx)(`p`,{className:`auto-hint`,children:`Pick what it does. Once it exists you configure it on the canvas, one step at a time.`}),s?(0,H.jsx)(`div`,{className:`auto-banner is-error`,role:`alert`,children:s}):null,l?(0,H.jsx)(`div`,{className:`auto-banner is-ok`,role:`status`,children:l}):null,(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-new-name`,children:`Name`}),(0,H.jsx)(`input`,{id:`auto-new-name`,className:`auto-input`,value:r,placeholder:`S&P 500 companies`,onChange:e=>i(e.target.value)})]}),(0,H.jsx)(`div`,{className:`auto-kinds`,children:e.map(e=>(0,H.jsxs)(`label`,{className:`auto-kind`+(a===e.key?` is-on`:``),children:[(0,H.jsx)(`input`,{type:`radio`,name:`auto-kind`,checked:a===e.key,onChange:()=>o(e.key)}),(0,H.jsx)(`span`,{children:e.label})]},e.key))}),a===`scrape_db`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-new-url`,children:`Page URL`}),(0,H.jsxs)(`div`,{className:`auto-row-inline`,children:[(0,H.jsx)(`input`,{id:`auto-new-url`,className:`auto-input`,value:p,placeholder:`https://en.wikipedia.org/wiki/List_of_S%26P_500_companies`,onChange:e=>m(e.target.value)}),(0,H.jsx)(`button`,{type:`button`,className:`auto-btn`,disabled:!p.trim()||C,onClick:()=>void te(),children:C?`Reading…`:`Read the page`})]}),(0,H.jsx)(`p`,{className:`auto-hint`,children:`Public web pages only. Private, loopback and link-local addresses are refused — including a public URL that redirects to one.`})]}),(0,H.jsxs)(`div`,{className:`auto-field-row`,children:[(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-new-extract`,children:`Read`}),(0,H.jsxs)(`select`,{id:`auto-new-extract`,className:`auto-input`,value:h,onChange:e=>g(e.target.value),children:[(0,H.jsx)(`option`,{value:`table`,children:`An HTML table`}),(0,H.jsx)(`option`,{value:`jsonld`,children:`Structured data (JSON-LD)`})]})]}),h===`table`?(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-new-tidx`,children:`Which table`}),(0,H.jsx)(`input`,{id:`auto-new-tidx`,className:`auto-input`,type:`number`,min:0,value:_,onChange:e=>v(Number(e.target.value)||0)})]}):null,(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-new-tlabel`,children:`Database name`}),(0,H.jsx)(`input`,{id:`auto-new-tlabel`,className:`auto-input`,value:y,placeholder:`S&P 500 companies`,onChange:e=>b(e.target.value)})]})]}),T.length?(0,H.jsxs)(`div`,{className:`auto-map`,children:[(0,H.jsx)(`h3`,{children:`Columns`}),(0,H.jsx)(`p`,{className:`auto-hint`,children:`Pick the key — the column that identifies a row. On every re-run, a row whose key already exists is updated; a new key is inserted; a key that has stopped appearing is counted and kept.`}),(0,H.jsx)(`div`,{className:`auto-drill-scroll`,children:(0,H.jsxs)(`table`,{className:`auto-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Use`}),(0,H.jsx)(`th`,{children:`Source column`}),(0,H.jsx)(`th`,{children:`Field key`}),(0,H.jsx)(`th`,{children:`Key`}),x?.sample?.length?(0,H.jsx)(`th`,{children:`First value`}):null]})}),(0,H.jsx)(`tbody`,{children:T.map((e,t)=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`input`,{type:`checkbox`,checked:e.include,"aria-label":`Include ${e.column}`,onChange:e=>E(n=>n.map((n,r)=>r===t?{...n,include:e.target.checked}:n))})}),(0,H.jsx)(`td`,{className:`auto-cell-name`,children:e.column}),(0,H.jsx)(`td`,{children:(0,H.jsx)(`input`,{className:`auto-input is-small`,value:e.key,"aria-label":`Field key for ${e.column}`,onChange:e=>E(n=>n.map((n,r)=>r===t?{...n,key:p9(e.target.value)}:n))})}),(0,H.jsx)(`td`,{children:(0,H.jsx)(`input`,{type:`radio`,name:`auto-new-keyfield`,checked:D===e.key&&e.include,disabled:!e.include,"aria-label":`Use ${e.column} as the key`,onChange:()=>O(e.key)})}),x?.sample?.length?(0,H.jsx)(`td`,{className:`auto-cell-sample`,children:String(x.sample[0]?.[e.column]??``)}):null]},e.column))})]})})]}):(0,H.jsx)(`p`,{className:`auto-note`,children:`Read the page to see what columns it offers.`})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`auto-field-row`,children:[(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-new-table`,children:`Database`}),(0,H.jsxs)(`select`,{id:`auto-new-table`,className:`auto-input`,value:j,onChange:e=>{M(e.target.value),P(``),ee(``)},children:[(0,H.jsx)(`option`,{value:``,children:`Choose a database…`}),k.map(e=>(0,H.jsxs)(`option`,{value:e.key,children:[e.label,` (`,e.rowCount,` `,e.rowCount===1?`row`:`rows`,`)`]},e.key))]})]}),(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-new-fieldkey`,children:`Automation column`}),(0,H.jsxs)(`select`,{id:`auto-new-fieldkey`,className:`auto-input`,value:N,onChange:e=>P(e.target.value),children:[(0,H.jsx)(`option`,{value:``,children:`Choose a column…`}),(I?.fields||[]).filter(e=>e.type===`automation`).map(e=>(0,H.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]}),(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-new-urlfield`,children:`Profile URL column`}),(0,H.jsxs)(`select`,{id:`auto-new-urlfield`,className:`auto-input`,value:F,onChange:e=>ee(e.target.value),children:[(0,H.jsx)(`option`,{value:``,children:`The column the field is bound to`}),(I?.fields||[]).map(e=>(0,H.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]})]}),(0,H.jsx)(`p`,{className:`auto-hint`,children:`It starts on the free anonymous rung. The canvas’s HikerAPI step turns on the paid one, which returns exact counts and full post data and works from a datacenter.`}),I&&!(I.fields||[]).some(e=>e.type===`automation`)?(0,H.jsx)(`p`,{className:`auto-note`,children:`That database has no automation column yet. Add one from the grid’s column menu, then choose it here.`}):null]}),(0,H.jsxs)(`div`,{className:`auto-head-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`auto-btn is-primary`,disabled:!ne||d,onClick:()=>void L(),children:d?`Creating…`:`Create`}),(0,H.jsx)(`button`,{type:`button`,className:`auto-btn`,onClick:n,children:`Cancel`})]})]})})}var rJe=.35,iJe={x:0,y:0,k:1};function aJe(e){return e.map(e=>({...e,x:e.col*312,y:e.row*132}))}function oJe(e){if(!e.length)return{minX:0,minY:0,maxX:208,maxY:96,w:208,h:96};let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y)),r=Math.max(...e.map(e=>e.x+208)),i=Math.max(...e.map(e=>e.y+96));return{minX:t,minY:n,maxX:r,maxY:i,w:r-t,h:i-n}}function m9(e){return Math.min(2,Math.max(rJe,e))}function sJe(e,t,n){let r=oJe(e);if(t<=0||n<=0)return iJe;let i=m9(Math.min(1,(t-112)/r.w,(n-112)/r.h));return{k:i,x:(t-r.w*i)/2-r.minX*i,y:(n-r.h*i)/2-r.minY*i}}function cJe(e,t,n,r){let i=m9(t),a=i/e.k;return{k:i,x:n-(n-e.x)*a,y:r-(r-e.y)*a}}function lJe(e){return[e.x+208,e.y+96/2]}function uJe(e){return[e.x,e.y+96/2]}function dJe(e,t){let[n,r]=lJe(e),[i,a]=uJe(t),o=Math.max(36,Math.abs(i-n)*.45);return`M ${n} ${r} C ${n+o} ${r}, ${i-o} ${a}, ${i} ${a}`}function fJe(e,t){let[n,r]=lJe(e),[i,a]=uJe(t);return[(n+i)/2,(r+a)/2-8]}function pJe(e,t){let n=new Map(t.map(e=>[e.id,e])),r=[];for(let t of e.edges||[]){let e=n.get(t.from),i=n.get(t.to);!e||!i||r.push({...t,d:dJe(e,i),mid:fJe(e,i),dim:!e.enabled||!i.enabled})}return r}var mJe=4,h9=260;function hJe({kind:e}){let t={width:15,height:15,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:1.4,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0};return e===`trigger`?(0,H.jsxs)(`svg`,{...t,children:[(0,H.jsx)(`circle`,{cx:`8`,cy:`8`,r:`5.6`}),(0,H.jsx)(`path`,{d:`M8 5.2V8l2 1.4`})]}):e===`source`?(0,H.jsxs)(`svg`,{...t,children:[(0,H.jsx)(`circle`,{cx:`8`,cy:`8`,r:`5.6`}),(0,H.jsx)(`path`,{d:`M2.6 8h10.8M8 2.4c1.5 1.7 2.2 3.6 2.2 5.6S9.5 12.3 8 13.6C6.5 12.3 5.8 10 5.8 8s.7-3.9 2.2-5.6z`})]}):e===`branch`?(0,H.jsxs)(`svg`,{...t,children:[(0,H.jsx)(`path`,{d:`M2.6 8h3.2l2.6-3.6h5M8.4 11.6H5.8m2.6 0h5`}),(0,H.jsx)(`path`,{d:`M11.6 2.6 13.4 4.4 11.6 6.2M11.6 9.8l1.8 1.8-1.8 1.8`})]}):e===`write`?(0,H.jsxs)(`svg`,{...t,children:[(0,H.jsx)(`ellipse`,{cx:`8`,cy:`4.2`,rx:`4.8`,ry:`1.9`}),(0,H.jsx)(`path`,{d:`M3.2 4.2v7.6c0 1 2.1 1.9 4.8 1.9s4.8-.9 4.8-1.9V4.2M3.2 8c0 1 2.1 1.9 4.8 1.9s4.8-.9 4.8-1.9`})]}):(0,H.jsx)(`svg`,{...t,children:(0,H.jsx)(`path`,{d:`M8 2.6v7.2M5.2 7l2.8 2.8L10.8 7M3 12.4h10`})})}function gJe({graph:e,selected:t,onSelect:n,onToggle:r,busyNode:i,nextRunAt:a}){let o=(0,z.useRef)(null),[s,c]=(0,z.useState)(iJe),l=(0,z.useRef)(null),u=(0,z.useMemo)(()=>aJe(e?.nodes||[]),[e]),d=(0,z.useMemo)(()=>pJe(e,u),[e,u]),f=(0,z.useMemo)(()=>oJe(u),[u]),p=(0,z.useCallback)(()=>{let e=o.current;if(!e)return;let t=e.getBoundingClientRect();c(sJe(u,t.width,t.height))},[u]);(0,z.useLayoutEffect)(()=>{p()},[u.map(e=>`${e.id}:${e.col}:${e.row}`).join(`|`)]),(0,z.useEffect)(()=>{let e=o.current;if(!e||typeof ResizeObserver>`u`)return;let t=e.getBoundingClientRect().width>0,n=new ResizeObserver(()=>{let n=e.getBoundingClientRect().width>0;n&&!t&&p(),t=n});return n.observe(e),()=>n.disconnect()},[p]),(0,z.useEffect)(()=>{let e=o.current;if(!e)return;let t=t=>{t.preventDefault();let n=e.getBoundingClientRect();c(e=>cJe(e,e.k*(t.deltaY<0?1.12:1/1.12),t.clientX-n.left,t.clientY-n.top))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]);let m=e=>{e.button===0&&(e.currentTarget.setPointerCapture(e.pointerId),l.current={px:e.clientX,py:e.clientY,vx:s.x,vy:s.y,moved:!1})},h=e=>{let t=l.current;if(!t)return;let n=e.clientX-t.px,r=e.clientY-t.py;!t.moved&&Math.abs(n)+Math.abs(r)({...e,x:t.vx+n,y:t.vy+r})))},g=e=>{if(l.current)try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}window.setTimeout(()=>{l.current=null},0)},_=()=>l.current?.moved===!0,v=e=>{let t=o.current;if(!t)return;let n=t.getBoundingClientRect();c(t=>cJe(t,t.k*e,n.width/2,n.height/2))};return(0,H.jsxs)(`div`,{className:`auto-canvas-wrap`,children:[(0,H.jsx)(`div`,{className:`auto-canvas`,ref:o,role:`group`,"aria-label":`Automation flow`,onPointerDown:m,onPointerMove:h,onPointerUp:g,onPointerCancel:g,children:(0,H.jsxs)(`div`,{className:`auto-scene`,style:{transform:`translate(${s.x}px, ${s.y}px) scale(${s.k})`},children:[(0,H.jsx)(`svg`,{className:`auto-wires`,style:{left:f.minX-h9,top:f.minY-h9,width:f.w+h9*2,height:f.h+h9*2},"aria-hidden":`true`,children:(0,H.jsx)(`g`,{transform:`translate(${h9-f.minX}, ${h9-f.minY})`,children:d.map(e=>(0,H.jsxs)(`g`,{className:`auto-wire`+(e.dim?` is-dim`:``),children:[(0,H.jsx)(`path`,{d:e.d}),e.label?(0,H.jsx)(`text`,{x:e.mid[0],y:e.mid[1],textAnchor:`middle`,children:e.label}):null]},`${e.from}->${e.to}`))})}),u.map((e,o)=>(0,H.jsxs)(`div`,{className:`auto-node`+(e.id===t?` is-selected`:``)+(e.enabled?``:` is-off`)+` is-${e.kind}`,style:{left:e.x,top:e.y,width:208,height:96},children:[(0,H.jsxs)(`button`,{type:`button`,className:`auto-node-hit`,"aria-pressed":e.id===t,title:`${e.title} — ${e.subtitle}`,onClick:()=>{_()||n(e.id)},children:[(0,H.jsxs)(`span`,{className:`auto-node-head`,children:[(0,H.jsx)(`span`,{className:`auto-node-mark`,children:(0,H.jsx)(hJe,{kind:e.kind})}),(0,H.jsx)(`span`,{className:`auto-node-title`,children:e.title})]}),(0,H.jsx)(`span`,{className:`auto-node-sub`,children:e.subtitle}),(0,H.jsx)(`span`,{className:`auto-node-detail`,children:e.id===`trigger`&&a&&e.enabled?`Next ${a}`:e.detail}),(0,H.jsxs)(`span`,{className:`auto-node-foot`,children:[(0,H.jsx)(`span`,{className:`auto-node-step`,children:o+1}),(0,H.jsx)(`span`,{className:`auto-dot is-${e.status}`,title:`Last run: ${e.status}`,"aria-label":`Last run: ${e.status}`})]})]}),e.toggle&&r?(0,H.jsx)(`button`,{type:`button`,className:`auto-node-switch`+(e.enabled?` is-on`:``),disabled:i===e.id,"aria-pressed":e.enabled,"aria-label":`${e.enabled?`Turn off`:`Turn on`} ${e.title}`,title:`${e.enabled?`Turn off`:`Turn on`} ${e.title}`,onClick:t=>{t.stopPropagation(),!_()&&r(e.id)},children:(0,H.jsx)(`span`,{className:`auto-node-switch-knob`})}):(0,H.jsx)(`span`,{className:`auto-node-always`,title:`This step is what the automation is`,children:`Always`})]},e.id))]})}),(0,H.jsxs)(`div`,{className:`auto-zoom`,role:`group`,"aria-label":`Canvas zoom`,children:[(0,H.jsx)(`button`,{type:`button`,className:`auto-zoom-btn`,title:`Fit the flow`,onClick:p,children:(0,H.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M2.6 5.8V2.6h3.2M13.4 5.8V2.6h-3.2M2.6 10.2v3.2h3.2M13.4 10.2v3.2h-3.2`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`})})}),(0,H.jsx)(`button`,{type:`button`,className:`auto-zoom-btn`,title:`Zoom out`,"aria-label":`Zoom out`,disabled:s.k<=rJe+.001,onClick:()=>v(1/1.2),children:(0,H.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M3.6 8h8.8`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`})})}),(0,H.jsxs)(`button`,{type:`button`,className:`auto-zoom-pct`,title:`Back to 100%`,onClick:()=>c(e=>({...e,k:m9(1)})),children:[Math.round(s.k*100),`%`]}),(0,H.jsx)(`button`,{type:`button`,className:`auto-zoom-btn`,title:`Zoom in`,"aria-label":`Zoom in`,disabled:s.k>=1.999,onClick:()=>v(1.2),children:(0,H.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M8 3.6v8.8M3.6 8h8.8`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`})})})]})]})}function _Je({automation:e,kinds:t,cronPresets:n,hikerReady:r,onSaved:i,onDeleted:a}){let o=e.config||{},s=e.kind,[c,l]=(0,z.useState)(e.name||``),[u,d]=(0,z.useState)(e.schedule?.cron||`0 6 * * *`),[f,p]=(0,z.useState)(``),[m,h]=(0,z.useState)(``),[g,_]=(0,z.useState)(!1),[v,y]=(0,z.useState)(!1),[b,x]=(0,z.useState)(``),[S,C]=(0,z.useState)(``),[w,T]=(0,z.useState)(String(o.url||``)),[E,D]=(0,z.useState)(String(o.extract||`table`)),[O,k]=(0,z.useState)(Number(o.tableIndex||0)),[A,j]=(0,z.useState)(String(o.targetLabel||``)),[M,N]=(0,z.useState)(null),[P,F]=(0,z.useState)(!1),[ee,I]=(0,z.useState)(()=>Object.entries(e.config?.fieldMap||{}).map(([e,t])=>({column:e,include:!0,key:t}))),[te,L]=(0,z.useState)(String(o.keyField||``)),[ne,re]=(0,z.useState)([]),[ie,ae]=(0,z.useState)(String(o.targetTable||``)),[oe,se]=(0,z.useState)(String(o.fieldKey||``)),[ce,le]=(0,z.useState)(String(o.urlField||``)),[ue,de]=(0,z.useState)(Number(o.maxPosts||24)),[fe,pe]=(0,z.useState)(null),[me,he]=(0,z.useState)(``);(0,z.useEffect)(()=>{let e=new AbortController;return Kqe(e.signal).then(e=>re(e.tables)).catch(()=>re([])),()=>e.abort()},[]);let ge=ne.find(e=>e.key===ie)||null,_e=(e.graph?.nodes||[]).find(e=>e.id===S)||null,ve=e=>t=>{y(!0),e(t)},ye=(0,z.useCallback)(async()=>{F(!0),h(``);try{let e=await $qe(w,E,O);if(N(e),!e.ok){h(e.note||`That page answered ${e.status}.`);return}I(t=>{let n=new Map(t.map(e=>[e.column,e]));return e.columns.map(e=>{let t=n.get(e);return{column:e,include:!t||t.include,key:t?t.key:p9(e)}})}),L(t=>t&&e.columns.some(e=>p9(e)===t)?t:p9(e.columns[0]||``)),A||j(e.title||`Scraped table`),y(!0),p(`Read ${e.rowCount} rows and ${e.columns.length} columns`+(e.tableCount&&e.tableCount>1?` (of ${e.tableCount} tables on the page)`:``))}catch(e){h(e instanceof d9?e.message:`That page could not be read.`)}finally{F(!1)}},[w,E,O,A]),be=()=>{if(s===`scrape_db`){let e={};for(let t of ee)t.include&&t.key&&(e[t.column]=t.key);return{url:w,extract:E,tableIndex:O,fieldMap:e,keyField:te,targetTable:String(o.targetTable||``),targetLabel:A}}return{targetTable:ie,fieldKey:oe,urlField:ce,maxPosts:ue}},xe=async(t=!0)=>{let n=await Jqe(e.id,{name:c,kind:s,config:be(),schedule:{cron:u,enabled:!!e.schedule?.enabled}});return y(!1),t&&p(`Saved.`),n.automation.id},Se=async()=>{_(!0),h(``),p(``);try{await i(await xe())}catch(e){h(e instanceof d9?e.message:`That could not be saved.`)}finally{_(!1)}},Ce=async t=>{x(t),h(``),p(``);try{v&&await xe(!1),await Zqe(e.id,t),await i(e.id)}catch(e){h(e instanceof d9?e.message:`That step was not changed.`)}finally{x(``)}},we=async()=>{h(``);try{await Xqe(e.id),p(`Started. The node dots follow it.`),await i(e.id)}catch(e){h(e instanceof d9?e.message:`It did not start.`)}},Te=async()=>{h(``);try{await Yqe(e.id),await a()}catch(e){h(e instanceof d9?e.message:`It was not deleted.`)}},Ee=async t=>{if(me===t.ts){pe(null),he(``);return}try{let n=await Qqe(e.id);pe(n),he(t.ts)}catch(e){h(e instanceof d9?e.message:`Those rows could not be read.`)}},De=(0,z.useMemo)(()=>n.find(e=>e.cron===u)?.cron||``,[n,u]),Oe=e.running?`running`:e.status?.state||`idle`;return(0,H.jsxs)(`div`,{className:`auto-detail`,children:[(0,H.jsxs)(`header`,{className:`auto-head`,children:[(0,H.jsxs)(`div`,{className:`auto-head-title`,children:[(0,H.jsx)(`input`,{className:`auto-name`,value:c,placeholder:`Name this automation`,"aria-label":`Automation name`,onChange:e=>ve(l)(e.target.value)}),(0,H.jsx)(`span`,{className:`auto-chip is-${Oe}`,children:e.running?`Running`:Oe}),(0,H.jsx)(`span`,{className:`auto-kindtag`,children:t.find(e=>e.key===s)?.label||s})]}),(0,H.jsxs)(`div`,{className:`auto-head-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`auto-btn`,disabled:!!e.running,onClick:()=>void we(),children:e.running?`Running…`:`Run now`}),(0,H.jsx)(`button`,{type:`button`,className:`auto-btn is-primary`,disabled:g||!c.trim(),onClick:()=>void Se(),children:g?`Saving…`:`Save`}),(0,H.jsx)(`button`,{type:`button`,className:`auto-btn is-danger`,onClick:()=>void Te(),children:`Delete`})]})]}),m?(0,H.jsx)(`div`,{className:`auto-banner is-error`,role:`alert`,children:m}):null,f?(0,H.jsx)(`div`,{className:`auto-banner is-ok`,role:`status`,children:f}):null,(0,H.jsxs)(`div`,{className:`auto-work`,children:[(0,H.jsx)(gJe,{graph:e.graph,selected:S,onSelect:C,onToggle:e=>void Ce(e),busyNode:b,nextRunAt:e.nextRunAt}),(0,H.jsx)(`aside`,{className:`auto-panel`,"aria-label":_e?`${_e.title} settings`:`Run history`,children:_e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`auto-panel-head`,children:[(0,H.jsx)(`h2`,{children:_e.title}),(0,H.jsx)(`button`,{type:`button`,className:`auto-panel-close`,"aria-label":`Back to run history`,title:`Back to run history`,onClick:()=>C(``),children:(0,H.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`})})})]}),_e.enabled?null:(0,H.jsx)(`p`,{className:`auto-note is-off`,children:`This step is switched off. Its card on the canvas carries the switch that turns it back on.`}),_e.panel===`schedule`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-preset`,children:`Schedule`}),(0,H.jsxs)(`select`,{id:`auto-preset`,className:`auto-input`,value:De,onChange:e=>e.target.value&&ve(d)(e.target.value),children:[(0,H.jsx)(`option`,{value:``,children:`Custom…`}),n.map(e=>(0,H.jsx)(`option`,{value:e.cron,children:e.label},e.cron))]})]}),(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-cron`,children:`Cron (minute hour day month weekday)`}),(0,H.jsx)(`input`,{id:`auto-cron`,className:`auto-input is-mono`,value:u,onChange:e=>ve(d)(e.target.value)})]}),(0,H.jsx)(`p`,{className:`auto-hint`,children:e.nextRunAt?`Next run ${e.nextRunAt}.`:e.schedule?.enabled?`Schedules start from the moment they are switched on — turning on a daily job after today's time does not fire it immediately.`:`Not scheduled. It still runs when you press Run now, and the node's switch turns the schedule on.`})]}):null,_e.panel===`source`&&s===`scrape_db`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-url`,children:`Page URL`}),(0,H.jsx)(`input`,{id:`auto-url`,className:`auto-input`,value:w,placeholder:`https://en.wikipedia.org/wiki/List_of_S%26P_500_companies`,onChange:e=>ve(T)(e.target.value)})]}),(0,H.jsx)(`button`,{type:`button`,className:`auto-btn`,disabled:!w.trim()||P,onClick:()=>void ye(),children:P?`Reading…`:`Read the page`}),(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-extract`,children:`Read`}),(0,H.jsxs)(`select`,{id:`auto-extract`,className:`auto-input`,value:E,onChange:e=>ve(D)(e.target.value),children:[(0,H.jsx)(`option`,{value:`table`,children:`An HTML table`}),(0,H.jsx)(`option`,{value:`jsonld`,children:`Structured data (JSON-LD)`})]})]}),E===`table`?(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-tidx`,children:`Which table`}),(0,H.jsx)(`input`,{id:`auto-tidx`,className:`auto-input`,type:`number`,min:0,value:O,onChange:e=>ve(k)(Number(e.target.value)||0)})]}):null,(0,H.jsx)(`p`,{className:`auto-hint`,children:`Public web pages only. Private, loopback and link-local addresses are refused — including a public URL that redirects to one.`})]}):null,_e.panel===`columns`?ee.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`auto-hint`,children:`Pick the key — the column that identifies a row. On every re-run, a row whose key already exists is updated; a new key is inserted; a key that has stopped appearing is counted and kept.`}),(0,H.jsx)(`div`,{className:`auto-panel-scroll`,children:(0,H.jsxs)(`table`,{className:`auto-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Use`}),(0,H.jsx)(`th`,{children:`Source column`}),(0,H.jsx)(`th`,{children:`Field key`}),(0,H.jsx)(`th`,{children:`Key`})]})}),(0,H.jsx)(`tbody`,{children:ee.map((e,t)=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`input`,{type:`checkbox`,checked:e.include,"aria-label":`Include ${e.column}`,onChange:e=>ve(I)(ee.map((n,r)=>r===t?{...n,include:e.target.checked}:n))})}),(0,H.jsx)(`td`,{className:`auto-cell-name`,children:e.column}),(0,H.jsx)(`td`,{children:(0,H.jsx)(`input`,{className:`auto-input is-small`,value:e.key,"aria-label":`Field key for ${e.column}`,onChange:e=>ve(I)(ee.map((n,r)=>r===t?{...n,key:p9(e.target.value)}:n))})}),(0,H.jsx)(`td`,{children:(0,H.jsx)(`input`,{type:`radio`,name:`auto-keyfield`,checked:te===e.key&&e.include,disabled:!e.include,"aria-label":`Use ${e.column} as the key`,onChange:()=>ve(L)(e.key)})})]},e.column))})]})}),M?.sample?.length?(0,H.jsxs)(`p`,{className:`auto-hint`,children:[`First row read: `,Object.values(M.sample[0]).slice(0,4).join(` · `)]}):null]}):(0,H.jsx)(`p`,{className:`auto-note`,children:`Open the Fetch step and read the page to see what columns it offers.`}):null,_e.panel===`source`&&s===`field_instagram`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-table`,children:`Database`}),(0,H.jsxs)(`select`,{id:`auto-table`,className:`auto-input`,value:ie,onChange:e=>{ve(ae)(e.target.value),se(``),le(``)},children:[(0,H.jsx)(`option`,{value:``,children:`Choose a database…`}),ne.map(e=>(0,H.jsxs)(`option`,{value:e.key,children:[e.label,` (`,e.rowCount,` `,e.rowCount===1?`row`:`rows`,`)`]},e.key))]})]}),(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-urlfield`,children:`Profile URL column`}),(0,H.jsxs)(`select`,{id:`auto-urlfield`,className:`auto-input`,value:ce,onChange:e=>ve(le)(e.target.value),children:[(0,H.jsx)(`option`,{value:``,children:`The column the field is bound to`}),(ge?.fields||[]).map(e=>(0,H.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]}),(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-fieldkey`,children:`Automation column`}),(0,H.jsxs)(`select`,{id:`auto-fieldkey`,className:`auto-input`,value:oe,onChange:e=>ve(se)(e.target.value),children:[(0,H.jsx)(`option`,{value:``,children:`Choose a column…`}),(ge?.fields||[]).filter(e=>e.type===`automation`).map(e=>(0,H.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]}),ge&&!(ge.fields||[]).some(e=>e.type===`automation`)?(0,H.jsx)(`p`,{className:`auto-note`,children:`That database has no automation column yet. Add one from the grid’s column menu, then choose it here.`}):null]}):null,_e.panel===`capture`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-maxposts`,children:`Posts per pull`}),(0,H.jsx)(`input`,{id:`auto-maxposts`,className:`auto-input`,type:`number`,min:1,max:200,value:ue,onChange:e=>ve(de)(Number(e.target.value)||24)})]}),(0,H.jsx)(`h3`,{children:`HikerAPI — the paid rung`}),(0,H.jsxs)(`p`,{className:`auto-hint`,children:[`Exact follower counts and post-level data, and it works from a datacenter. Roughly $0.0006 a request. Its node’s switch turns it on.`,r?` A key is configured on this deployment.`:` No key is configured on this deployment yet, so it will report itself blocked and the anonymous rung will answer instead.`]}),(0,H.jsx)(`h3`,{children:`Anonymous — the free rung`}),(0,H.jsxs)(`p`,{className:`auto-hint`,children:[`No login and no credentials. Instagram blocks datacenter addresses and has closed most of its anonymous surface, so this rung is honest rather than reliable: counts come from the page’s own abbreviations (204K, not 204,312) and are marked approximate. Turning it off means`,` `,(0,H.jsx)(`strong`,{children:`exact numbers or nothing`}),` — a run reports blocked rather than quietly writing a rounded number.`]}),(0,H.jsxs)(`p`,{className:`auto-hint`,children:[`A pull reports what it actually got: `,(0,H.jsx)(`strong`,{children:`ok`}),` (profile and posts),`,` `,(0,H.jsx)(`strong`,{children:`partial`}),` (profile only), or `,(0,H.jsx)(`strong`,{children:`blocked`}),`. It never reports success on nothing.`]})]}):null,_e.panel===`write`?(0,H.jsxs)(H.Fragment,{children:[s===`scrape_db`?(0,H.jsxs)(`div`,{className:`auto-field`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-tlabel`,children:`Database name`}),(0,H.jsx)(`input`,{id:`auto-tlabel`,className:`auto-input`,value:A,placeholder:`S&P 500 companies`,onChange:e=>ve(j)(e.target.value)})]}):(0,H.jsxs)(`p`,{className:`auto-hint`,children:[`Each pull appends a timestamped row to `,(0,H.jsx)(`code`,{children:`ut_ig_snapshots`}),` and, for every post, to `,(0,H.jsx)(`code`,{children:`ut_ig_post_snapshots`}),` — so the history is a time series you can filter by date rather than a single current value.`,` `,(0,H.jsx)(`code`,{children:`ut_ig_posts`}),` holds one row per post, ever.`]}),(0,H.jsxs)(`p`,{className:`auto-hint`,children:[`Turning this step off makes the automation a `,(0,H.jsx)(`strong`,{children:`dry run`}),`: it reads everything and reports exactly what it would have written, without creating or changing a single row.`]}),(0,H.jsx)(`p`,{className:`auto-hint`,children:`A row that stops appearing at the source is counted and kept, never deleted.`})]}):null]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`auto-panel-head`,children:(0,H.jsx)(`h2`,{children:`Run history`})}),e.runs?.length?(0,H.jsx)(`ol`,{className:`auto-runs`,children:e.runs.map(e=>(0,H.jsxs)(`li`,{className:`auto-run is-`+(e.ok?`ok`:`error`),children:[(0,H.jsxs)(`button`,{type:`button`,className:`auto-run-head`,onClick:()=>void Ee(e),"aria-expanded":me===e.ts,children:[(0,H.jsx)(`span`,{className:`auto-run-ts`,children:e.ts.replace(`T`,` `)}),(0,H.jsx)(`span`,{className:`auto-run-summary`,children:e.summary})]}),(0,H.jsx)(`div`,{className:`auto-counts`,children:tJe.filter(([t])=>typeof e.counts?.[t]==`number`).map(([t,n])=>(0,H.jsxs)(`span`,{className:`auto-count`+(t===`capped`&&e.counts[t]?` is-warn`:``),children:[(0,H.jsx)(`b`,{children:e.counts[t]}),` `,n]},t))}),me===e.ts&&fe?(0,H.jsxs)(`div`,{className:`auto-drill`,children:[(0,H.jsxs)(`p`,{className:`auto-hint`,children:[`The rows this run touched in `,fe.label,fe.truncated?` (first 200)`:``,`.`]}),(0,H.jsx)(`div`,{className:`auto-drill-scroll`,children:(0,H.jsxs)(`table`,{className:`auto-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsx)(`tr`,{children:fe.fields.map(e=>(0,H.jsx)(`th`,{children:e.label},e.key))})}),(0,H.jsx)(`tbody`,{children:fe.rows.slice(0,50).map(e=>(0,H.jsx)(`tr`,{children:fe.fields.map(t=>(0,H.jsx)(`td`,{children:String(e[t.key]??``)},t.key))},String(e.id)))})]})})]}):null]},e.ts))}):(0,H.jsx)(`p`,{className:`auto-note`,children:`It has not run yet. Press Run now, or switch on the Trigger step.`}),(0,H.jsx)(`p`,{className:`auto-hint`,children:`Click any step on the canvas to see and change what it does.`})]})})]})]})}function vJe(e){let t=eJe(e);return t===`running`?`Running now`:t===`ok`?`Last run succeeded — ${e.status?.lastSummary||``}`:t===`partial`?`Last run was partial — ${e.status?.lastSummary||``}`:t===`error`?`Last run failed — ${e.status?.lastSummary||``}`:`Has not run yet`}function yJe(e){if(e.schedule?.enabled)return e.nextRunAt?`Next ${e.nextRunAt}`:`Scheduled`;let t=e.status?.lastRunAt?e.status.lastRunAt.replace(`T`,` `).slice(0,16):``;return t?`Last run ${t}`:`Manual only`}function bJe(){let[e,t]=(0,z.useState)(null),[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(!1),[u,d]=(0,z.useState)(``),f=(0,z.useRef)(null),p=(0,z.useCallback)(async e=>{try{let n=await Gqe(e);return t(n),r(``),n}catch(e){return e?.name===`AbortError`||r(e instanceof d9?e.message:`The automation service did not answer.`),null}},[]);(0,z.useEffect)(()=>{let e=new AbortController;return p(e.signal),()=>e.abort()},[p]);let m=(e?.automations||[]).some(e=>e.running);(0,z.useEffect)(()=>{if(!m)return;let e=window.setInterval(()=>void p(),2500);return()=>window.clearInterval(e)},[m,p]);let h=e?.automations||[],g=h.find(e=>e.id===i)||null,_=async e=>{d(e.id);try{await Jqe(e.id,{schedule:{cron:e.schedule.cron,enabled:!e.schedule.enabled}}),await p()}catch(e){r(e instanceof d9?e.message:`That change was not saved.`)}finally{d(``)}};return(0,H.jsxs)(`div`,{className:`auto-surface`,children:[(0,H.jsxs)(`aside`,{className:`auto-rail`+(c?` is-collapsed`:``),"aria-label":`Automations`,children:[(0,H.jsx)(`div`,{className:`auto-rail-top`,children:(0,H.jsx)(`button`,{type:`button`,className:`cg-rail-toggle`,"aria-label":c?`Expand automations`:`Minimize automations`,"aria-expanded":!c,title:c?`Expand automations`:`Minimize automations`,onClick:()=>l(e=>!e),children:(0,H.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M2.5 4.4h11M2.5 8h11M2.5 11.6h11`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`})})})}),(0,H.jsx)(`div`,{className:`auto-create`,children:(0,H.jsxs)(`button`,{type:`button`,className:`auto-create-btn`,onClick:()=>{s(!0),a(``)},children:[(0,H.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M8 3.4v9.2M3.4 8h9.2`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`})}),`New automation`]})}),(0,H.jsxs)(`div`,{className:`auto-list`,ref:f,onKeyDown:e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let t=Array.from(f.current?.querySelectorAll(`.auto-row-main`)||[]);if(!t.length)return;e.preventDefault();let n=t.indexOf(document.activeElement),r=e.key===`ArrowDown`?(n+1)%t.length:(n-1+t.length)%t.length;t[r<0?0:r]?.focus()},children:[h.map(e=>{let t=eJe(e);return(0,H.jsxs)(`div`,{className:`auto-row`+(e.id===i?` is-active`:``),children:[(0,H.jsxs)(`button`,{type:`button`,className:`auto-row-main`,onClick:()=>{a(e.id),s(!1)},children:[(0,H.jsx)(`span`,{className:`auto-dot is-${t}`,title:vJe(e),"aria-label":vJe(e)}),(0,H.jsxs)(`span`,{className:`auto-row-text`,children:[(0,H.jsx)(`span`,{className:`auto-row-name`,children:e.name}),(0,H.jsx)(`span`,{className:`auto-row-desc`,children:yJe(e)})]})]}),(0,H.jsx)(`button`,{type:`button`,className:`auto-row-switch`+(e.schedule?.enabled?` is-on`:``),disabled:u===e.id,"aria-pressed":!!e.schedule?.enabled,title:e.schedule?.enabled?`Scheduled: ${e.schedule.cron}. Click to pause.`:`Not scheduled. Click to enable.`,onClick:()=>void _(e),children:(0,H.jsx)(`span`,{className:`auto-row-switch-knob`})})]},e.id)}),!h.length&&!n?(0,H.jsx)(`p`,{className:`auto-rail-empty`,children:`No automations yet. One reads a public web page into a database on a schedule; the other fills an automation column from a public profile.`}):null]})]}),(0,H.jsxs)(`section`,{className:`auto-main`,children:[n?(0,H.jsx)(`div`,{className:`auto-banner is-error`,role:`alert`,children:n}):null,e&&!e.storeAvailable?(0,H.jsx)(`div`,{className:`auto-banner is-warn`,role:`status`,children:`The tenant store is unavailable, so nothing can be saved right now.`}):null,o?(0,H.jsx)(nJe,{kinds:e?.kinds||[],onCreated:async e=>{s(!1);let t=await p();e&&t&&a(e)},onCancel:()=>s(!1)}):g?(0,H.jsx)(_Je,{automation:g,kinds:e?.kinds||[],cronPresets:e?.cronPresets||[],hikerReady:!!e?.hikerReady,onSaved:async e=>{let t=await p();e&&t&&a(e)},onDeleted:async()=>{a(``),await p()}},g.id):(0,H.jsxs)(`div`,{className:`auto-empty`,children:[(0,H.jsx)(`h1`,{children:`Automations`}),(0,H.jsx)(`p`,{children:`An automation is a job this workspace runs for you — on demand, or on a schedule. Each one is a flow: a trigger, the steps it walks, and the database it writes. Pick one on the left, or create a new one.`}),(0,H.jsxs)(`ul`,{className:`auto-empty-kinds`,children:[(0,H.jsxs)(`li`,{children:[(0,H.jsx)(`strong`,{children:`Web page to database.`}),` Read a public page, map its columns to fields, and keep a database in step with it. Re-runs update matched rows by key and insert new ones; a row that stops appearing is counted and kept, never deleted.`]}),(0,H.jsxs)(`li`,{children:[(0,H.jsx)(`strong`,{children:`Instagram profile column.`}),` For every record carrying a public profile URL, read the profile — exactly, through HikerAPI, or approximately on the free anonymous rung — and append a timestamped row per pull, so followers and post engagement become a series you can filter by date rather than a single current number.`]})]})]})]})]})}function g9(e){if(e==null||e===``)return null;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:null}function _9(e,t){let n=g9(e);if(n==null)return`—`;let r=t??+(Math.abs(n)<10&&!Number.isInteger(n));return n.toLocaleString(void 0,{minimumFractionDigits:r,maximumFractionDigits:r})}function xJe(e,t){let n=g9(e);return n==null?`—`:n<0?`-$${_9(Math.abs(n),t)}`:`$${_9(n,t)}`}function v9(e){let t=g9(e);return t==null?`—`:Math.round(t).toLocaleString()}function SJe(e,t={}){let n=g9(e);return n==null?`—`:n>=999?`+${(1+n/100).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0})}×`:`${t.signed&&n>=0?`+`:``}${_9(n,t.dp)}%`}var CJe=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function wJe(e){if(e==null||e===``)return`—`;let t=String(e),n=/^(\d{4})-(\d{2})$/.exec(t);if(n){let e=Number(n[2]);if(e>=1&&e<=12)return`${CJe[e-1]} ${n[1].slice(2)}`}let r=t.includes(` `)?t.replace(` `,`T`):t,i=/T\d{2}:\d{2}/.test(r)&&!/(?:[zZ]|[+-]\d{2}:?\d{2})$/.test(r)?`${r}Z`:r,a=new Date(i);return Number.isNaN(a.getTime())?t:a.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`,timeZone:`UTC`})}var y9={money:xJe,num:_9,pct:SJe,int:v9,date:wJe};function b9(e,t,n){if(t==null||t===``)return e==null||e===``?`—`:String(e);switch(t){case`money`:return xJe(e);case`num`:return _9(e);case`pct`:return SJe(e,n);case`int`:return v9(e);case`date`:return wJe(e);default:return e==null||e===``?`—`:String(e)}}function TJe(e){return!!e&&e.kind===`decomp`}function EJe(e,t){return typeof e!=`number`||typeof t!=`number`||!Number.isFinite(e)||!Number.isFinite(t)?null:{text:`Showing ${v9(e)} of ${v9(t)}`,capped:t>e}}function DJe(e,t){if(!t)return;if(TJe(t)){let n=e[t.row_key];if(!n||typeof n!=`object`)return;let r=n;return r.kind!==`decomp`||!r.date_from||!r.date_to?void 0:r}let n=e[t.id_key];if(n==null||n===``)return;let r=t.label_key?e[t.label_key]:void 0;return{kind:t.kind,id:n,label:String(r??n)}}function OJe(e){return(e??``).trim()||`Nothing matched this scope.`}function x9({d:e,size:t,className:n}){return(0,H.jsx)(`svg`,{className:n,width:t,height:t,viewBox:`0 0 24 24`,"aria-hidden":`true`,focusable:`false`,children:(0,H.jsx)(`path`,{d:e,fill:`currentColor`})})}function kJe({size:e=15}){return(0,H.jsx)(x9,{className:`pg-icon`,size:e,d:`M12 15.6 6.8 10.4l1.4-1.4 2.8 2.8V3h2v8.8l2.8-2.8 1.4 1.4zM5 20a2 2 0 0 1-2-2v-3h2v3h14v-3h2v3a2 2 0 0 1-2 2z`})}function AJe({size:e=14}){return(0,H.jsx)(x9,{className:`pg-icon`,size:e,d:`M9.6 17.6 4 12l1.4-1.4 4.2 4.2 9-9L20 7.2z`})}function jJe({size:e=14}){return(0,H.jsx)(x9,{className:`pg-icon`,size:e,d:`M11 15h2v2h-2zm0-10h2v8h-2z`})}function MJe({title:e,asOf:t,subtitle:n,controls:r,onControl:i,busy:a}){return(0,H.jsxs)(`header`,{className:`pg-header`,children:[(0,H.jsxs)(`div`,{className:`pg-title-row`,children:[(0,H.jsx)(`h1`,{className:`pg-title`,children:e}),r&&r.length>0?(0,H.jsx)(`div`,{className:`pg-controls`,children:r.map(e=>(0,H.jsxs)(`label`,{className:`pg-control`,children:[(0,H.jsx)(`span`,{className:`pg-control-label`,children:e.label}),(0,H.jsx)(`select`,{className:`pg-select`,value:String(e.value),disabled:a||!i,onChange:t=>i?.(e.key,t.target.value),children:e.options.map(e=>(0,H.jsx)(`option`,{value:String(e.value),children:e.label},String(e.value)))})]},e.key))}):null]}),(0,H.jsx)(`div`,{className:`pg-rule`}),n?(0,H.jsx)(`p`,{className:`pg-subtitle`,children:n}):null,t?(0,H.jsxs)(`p`,{className:`pg-asof`,children:[`Data pulled `,(0,H.jsx)(`time`,{dateTime:t,children:y9.date(t)})]}):null]})}function NJe({label:e,note:t,children:n}){return(0,H.jsxs)(`section`,{className:`pg-section`,children:[(0,H.jsx)(`h2`,{className:`pg-section-label`,children:e}),t?(0,H.jsx)(`p`,{className:`pg-section-note`,children:t}):null,n]})}function PJe({items:e,onOpen:t}){return e.length?(0,H.jsx)(`div`,{className:`pg-kpis`,children:e.map((e,n)=>{let r=b9(e.value,e.fmt),i=e.delta!=null,a=i?b9(e.delta,e.delta_fmt??`pct`,{signed:!0}):``,o=e.delta_dir??(i?`flat`:`off`),s=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`pg-kpi-label`,children:e.label}),(0,H.jsx)(`span`,{className:`pg-kpi-value`,children:r}),a||e.delta_label?(0,H.jsxs)(`span`,{className:`pg-kpi-delta is-${o}`,children:[a,a&&e.delta_label?` `:``,e.delta_label??``]}):null]}),c=e.key??`${e.label}-${n}`;return e.drill&&t?(0,H.jsx)(`button`,{type:`button`,className:`pg-kpi is-clickable`,onClick:()=>t(e.drill),children:s},c):(0,H.jsx)(`div`,{className:`pg-kpi`,children:s},c)})}):null}function FJe({rows:e,columns:t,filename:n,note:r}){return(0,H.jsxs)(`a`,{className:`pg-download`,href:(0,z.useMemo)(()=>{let n=e=>/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e,r=``+[t.map(e=>n(e.label)).join(`,`),...e.map(e=>t.map(t=>n(b9(e[t.key],t.fmt))).join(`,`))].join(`\r +`);return URL.createObjectURL(new Blob([r],{type:`text/csv;charset=utf-8`}))},[e,t]),download:`${n}.csv`,children:[(0,H.jsx)(kJe,{}),(0,H.jsx)(`span`,{children:`Download CSV`}),r?(0,H.jsx)(`span`,{className:`pg-download-note`,children:r}):null]})}function IJe({columns:e,rows:t,drill:n,shown:r,total:i,onOpen:a,empty:o,download:s}){let c=EJe(r,i),l=c?.capped??!1;return t.length?(0,H.jsxs)(`div`,{className:`pg-table-wrap`,children:[(0,H.jsxs)(`table`,{className:`pg-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsx)(`tr`,{children:e.map(e=>(0,H.jsx)(`th`,{className:e.align===`right`?`is-right`:e.align===`center`?`is-center`:``,scope:`col`,children:e.label},e.key))})}),(0,H.jsx)(`tbody`,{children:t.map((t,r)=>{let i=DJe(t,n);return(0,H.jsx)(`tr`,{className:i&&a?`is-clickable`:``,children:e.map((e,n)=>{let r=b9(t[e.key],e.fmt);return(0,H.jsx)(`td`,{className:e.align===`right`?`is-right`:e.align===`center`?`is-center`:``,children:n===0&&i&&a?(0,H.jsx)(`button`,{type:`button`,className:`pg-cell-link`,onClick:()=>a(i),children:r}):r},e.key)})},String(t[e[0]?.key]??r))})})]}),(0,H.jsxs)(`div`,{className:`pg-table-foot`,children:[c?(0,H.jsx)(`span`,{className:c.capped?`pg-shown is-capped`:`pg-shown`,children:c.text}):null,s?(0,H.jsx)(FJe,{rows:t,columns:e,filename:s.filename,note:l?`the rows shown`:void 0}):null]})]}):(0,H.jsx)(`p`,{className:`pg-empty`,children:OJe(o)})}function LJe({checks:e}){if(!e.length)return null;let t=e.filter(e=>!e.ok).length;return(0,H.jsxs)(`details`,{className:`pg-validation`,open:t>0,children:[(0,H.jsxs)(`summary`,{className:t?`is-failed`:`is-ok`,children:[t?(0,H.jsx)(jJe,{}):(0,H.jsx)(AJe,{}),(0,H.jsx)(`span`,{children:t?`${y9.int(t)} of ${y9.int(e.length)} reconciliation checks did not tie`:`All ${y9.int(e.length)} reconciliation checks tie to Odoo`})]}),(0,H.jsxs)(`table`,{className:`pg-table pg-validation-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{scope:`col`,children:`Check`}),(0,H.jsx)(`th`,{scope:`col`,className:`is-right`,children:`Expected`}),(0,H.jsx)(`th`,{scope:`col`,className:`is-right`,children:`Actual`}),(0,H.jsx)(`th`,{scope:`col`,children:`Note`})]})}),(0,H.jsx)(`tbody`,{children:e.map(e=>(0,H.jsxs)(`tr`,{className:e.ok?``:`is-failed`,children:[(0,H.jsx)(`td`,{children:e.name}),(0,H.jsx)(`td`,{className:`is-right`,children:b9(e.expected,e.fmt)}),(0,H.jsx)(`td`,{className:`is-right`,children:b9(e.actual,e.fmt)}),(0,H.jsx)(`td`,{children:e.note??``})]},e.name))})]})]})}var RJe={customer:`Customer`,sku:`Product`,rep:`Salesperson`,bu:`Business Unit`};function S9({label:e,value:t}){return(0,H.jsxs)(`div`,{className:`pg-drill-row`,children:[(0,H.jsx)(`span`,{className:`pg-drill-key`,children:e}),(0,H.jsx)(`span`,{className:`pg-drill-val`,children:t})]})}function zJe({drill:e,onClose:t}){let n=e.kind===`decomp`,r=e,i=e;return(0,H.jsxs)(`aside`,{className:`pg-drill`,role:`dialog`,"aria-label":e.label,children:[(0,H.jsxs)(`header`,{className:`pg-drill-head`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`pg-drill-kind`,children:n?`Period`:RJe[e.kind]??e.kind}),(0,H.jsx)(`h2`,{className:`pg-drill-title`,children:e.label})]}),(0,H.jsx)(`button`,{type:`button`,className:`pg-drill-close`,onClick:t,"aria-label":`Close`,children:`×`})]}),(0,H.jsxs)(`div`,{className:`pg-drill-body`,children:[n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(S9,{label:`Window`,value:`${y9.date(r.date_from)} – ${y9.date(r.date_to)}`}),r.cmp_from&&r.cmp_to?(0,H.jsx)(S9,{label:`Compared with`,value:`${y9.date(r.cmp_from)} – ${y9.date(r.cmp_to)}`}):null,(0,H.jsx)(S9,{label:`Scope`,value:r.scope_value==null?r.scope_type:`${r.scope_type} · ${r.scope_value}`})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(S9,{label:RJe[e.kind]??`Record`,value:i.label}),(0,H.jsx)(S9,{label:`Identifier`,value:String(i.id)})]}),(0,H.jsxs)(`p`,{className:`pg-drill-note`,children:[`This wave ships the drill as a complete `,(0,H.jsx)(`em`,{children:`declaration`}),`: the exact scope above is what the number was computed over, and you can check it. The row-level breakdown behind it opens in the next release — until then, use the same view in the current application.`]})]})]})}var BJe=new Set([`text`,`status`,`currency`,`int`,`date`,`pct`,`select`,`user`,`multiselect`,`checkbox`,`phone`,`email`,`url`,`rating`,`created_time`,`formula`,`automation`,`image`]);function VJe(e){return e.map(e=>({key:e.key,label:e.label,type:BJe.has(e.type)?e.type:`text`,source:e.source===`overlay`?`overlay`:`odoo`}))}function HJe(e,t){if(!t||t.length===0)return e;let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>(n.get(e.key)??2**53-1)-(n.get(t.key)??2**53-1))}var C9=720,w9=230,T9=52,E9=10,D9=12,UJe=34;function O9(e){if(!Number.isFinite(e))return`—`;let t=Math.abs(e);return t>=1e9?(e/1e9).toFixed(1)+`B`:t>=1e6?(e/1e6).toFixed(1)+`M`:t>=1e3?(e/1e3).toFixed(1)+`k`:Number.isInteger(e)?e.toLocaleString():e.toFixed(2)}function WJe(e){let t=e>0?`+`:e<0?`−`:``,n=Math.abs(e);return n>=999?`${t}${Math.round(n/100)}×`:`${t}${n.toFixed(+(n<10))}%`}function GJe({spec:e,series:t,fields:n,rows:r,xOrder:i,deltaByKey:a,onPick:o,pickable:s}){let c=(0,z.useMemo)(()=>VJe(n),[n]),l=(0,z.useMemo)(()=>new Map(c.map(e=>[e.key,e])),[c]),u=(0,z.useMemo)(()=>t.map(t=>({def:t,data:M7({...e,y:t.y},r,l)})),[t,e,r,l]),d=(0,z.useMemo)(()=>{let e=new Map;for(let t of u)for(let n of t.data.buckets)e.has(n.key)||e.set(n.key,n.label);return HJe([...e].map(([e,t])=>({key:e,label:t,value:0,n:0})),i)},[u,i]),f=u.find(e=>e.data.problem)?.data.problem;if(f)return(0,H.jsx)(`p`,{className:`pg-empty`,children:f});if(!d.length)return(0,H.jsx)(`p`,{className:`pg-empty`,children:`No periods in this scope yet, so there is nothing to plot.`});let p=u.map(e=>({def:e.def,data:e.data,lookup:new Map(e.data.buckets.map(e=>[e.key,e]))})),m=Math.max(0,...p.flatMap(e=>e.data.buckets.map(e=>e.value))),h=m>0?(w9-D9-UJe)/m:0,g=(C9-T9-E9)/d.length,_=Math.max(2,g*.72/Math.max(1,p.length)),v=Math.max(1,Math.ceil(d.length/12)),y=w9-UJe,b=p[0]?.data.rows??0,x=p.reduce((e,t)=>e+t.data.missingY,0),S=p[0]?.data.omitted??0,C=p[0]?.data.omittedValue??0;return(0,H.jsxs)(`div`,{className:`pg-charts`,children:[(0,H.jsx)(`div`,{className:`pg-legend`,children:p.map((e,t)=>(0,H.jsxs)(`span`,{className:`pg-legend-key`,children:[(0,H.jsx)(`span`,{className:`pg-legend-swatch pg-ser-${t%4}`}),e.def.label]},e.def.y))}),(0,H.jsxs)(`svg`,{className:`pg-chart-svg`,viewBox:`0 0 ${C9} ${w9}`,role:`img`,"aria-label":e.title??`Chart`,children:[(0,H.jsx)(`line`,{className:`pg-ax`,x1:T9,y1:y,x2:C9-E9,y2:y}),(0,H.jsx)(`line`,{className:`pg-ax pg-ax-soft`,x1:T9,y1:D9,x2:C9-E9,y2:D9}),(0,H.jsx)(`text`,{className:`pg-ax-lab`,x:T9-6,y:16,textAnchor:`end`,children:O9(m)}),(0,H.jsx)(`text`,{className:`pg-ax-lab`,x:T9-6,y,textAnchor:`end`,children:`0`}),d.map((e,t)=>{let n=T9+t*g,r=_*p.length,i=n+(g-r)/2;return(0,H.jsxs)(`g`,{children:[s&&o?(0,H.jsx)(`rect`,{className:`pg-slot`,x:n,y:D9,width:g,height:y-D9,onClick:()=>o(e.key),children:(0,H.jsx)(`title`,{children:`Open ${e.label}`})}):null,p.map((t,n)=>{let r=t.lookup.get(e.key)?.value??0,a=Math.max(+(r>0),r*h);return(0,H.jsx)(`rect`,{className:`pg-bar pg-ser-${n%4}`,x:i+n*_,y:y-a,width:Math.max(1,_-1.5),height:a,children:(0,H.jsx)(`title`,{children:`${e.label} · ${t.def.label}: ${O9(r)}`})},t.def.y)}),(()=>{let t=a?.get(e.key);if(t==null)return null;let r=Math.max(0,...p.map(t=>{let n=t.lookup.get(e.key)?.value??0;return Math.max(+(n>0),n*h)}));return(0,H.jsx)(`text`,{className:`pg-bar-delta ${t>0?`is-up`:t<0?`is-down`:``}`,x:n+g/2,y:Math.max(8,y-r-4),textAnchor:`middle`,children:WJe(t)})})(),t%v===0?(0,H.jsx)(`text`,{className:`pg-ax-lab`,x:n+g/2,y:210,textAnchor:`middle`,children:e.label}):null]},e.key||`(blank)-${t}`)})]}),(0,H.jsxs)(`p`,{className:`pg-chart-note`,children:[`${b.toLocaleString()} period${b===1?``:`s`} plotted`,S>0?` · ${S} more not drawn, worth ${O9(C)}`:``,x>0?` · ${x} value${x===1?``:`s`} the measure could not use`:``,s?` · click a period to decompose it`:``]})]})}function KJe(e){let t=[],n={body:[]};for(let r of e)r.type===`section`?((n.head||n.body.length)&&t.push(n),n={head:r,body:[]}):n.body.push(r);return(n.head||n.body.length)&&t.push(n),t}function qJe({block:e,onOpen:t}){let n=e.drill,r=new Map;if(TJe(n)){let t=e.spec.x;for(let i of e.rows){let e=i[n.row_key],a=t?i[t]:void 0;a!=null&&e&&typeof e==`object`&&e.kind===`decomp`&&r.set(String(a),e)}}let i=new Map;if(e.delta_key){let t=e.spec.x;for(let n of e.rows){let r=t?n[t]:void 0,a=n[e.delta_key];r!=null&&typeof a==`number`&&Number.isFinite(a)&&i.set(String(r),a)}}let a=!!t&&r.size>0;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(GJe,{spec:e.spec,series:e.series??[],fields:e.fields,rows:e.rows,xOrder:e.x_order,deltaByKey:i.size?i:void 0,pickable:a,onPick:e=>{let n=r.get(e);n&&t&&t(n)}}),e.shown!=null&&e.total!=null&&e.total>e.shown?(0,H.jsxs)(`p`,{className:`pg-shown is-capped`,children:[`Showing `,e.shown,` of `,e.total,` periods`]}):null]})}function JJe({block:e,onOpen:t}){switch(e.type){case`kpis`:return(0,H.jsx)(PJe,{items:e.items,onOpen:t});case`table`:{let n=e;return(0,H.jsx)(IJe,{columns:n.columns,rows:n.rows,drill:n.drill,shown:n.shown,total:n.total,empty:n.empty,download:n.download,onOpen:t})}case`chart`:return(0,H.jsx)(qJe,{block:e,onOpen:t});case`validation`:return(0,H.jsx)(LJe,{checks:e.checks});default:return null}}function YJe({page:e,onControl:t,onOpen:n,busy:r}){let i=KJe(e.blocks);return(0,H.jsxs)(`div`,{className:`pg-page`,children:[(0,H.jsx)(MJe,{title:e.title,asOf:e.as_of,subtitle:e.subtitle,controls:e.controls,onControl:t,busy:r}),i.map((e,t)=>e.head?(0,H.jsx)(NJe,{label:e.head.label,note:e.head.note,children:e.body.map((e,t)=>(0,H.jsx)(JJe,{block:e,onOpen:n},e.key??`b${t}`))},e.head.key??`s${t}`):(0,H.jsx)(`div`,{children:e.body.map((e,t)=>(0,H.jsx)(JJe,{block:e,onOpen:n},e.key??`b${t}`))},`g${t}`))]})}async function XJe(e){let t=``,n=``;try{let r=await e.json();t=String(r?.error?.code??``),n=String(r?.error?.message??``)}catch{}if(e.status>=500)return{ok:!1,status:e.status,code:t||`server_error`,message:`Something went wrong on our side. Try again in a moment.`};let r=e.status===401?`Your session has ended. Sign in again.`:e.status===403?`This account does not have access to that.`:e.status===404?`That page does not exist.`:`That request could not be completed.`;return{ok:!1,status:e.status,code:t||String(e.status),message:n||r}}async function ZJe(e,t={}){let n=new URLSearchParams(t).toString(),r=`${jd}/pages/${encodeURIComponent(e)}${n?`?${n}`:``}`;try{let e=await fetch(r,{credentials:Md});if(!e.ok)return XJe(e);let t=await e.json();return!t||typeof t!=`object`||!Array.isArray(t.blocks)?{ok:!1,status:200,code:`bad_envelope`,message:`The server sent a page this client could not read.`}:{ok:!0,page:t}}catch{return{ok:!1,status:0,code:`offline`,message:`The server could not be reached.`}}}function QJe({pageKey:e,label:t}){let[n,r]=(0,z.useState)({phase:`loading`}),[i,a]=(0,z.useState)({}),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(null),u=JSON.stringify(i);(0,z.useEffect)(()=>{let t=!1;return s(!0),ZJe(e,JSON.parse(u)).then(e=>{if(!t){if(s(!1),e.ok){r({phase:`ready`,page:e.page});return}if(e.status===401){Bd(Nd);return}r({phase:`error`,message:e.message})}}),()=>{t=!0}},[e,u]);let d=(0,z.useCallback)((e,t)=>{l(null),a(n=>({...n,[e]:t}))},[]);return n.phase===`loading`?(0,H.jsxs)(`div`,{className:`pg-state`,children:[(0,H.jsx)(`h1`,{children:t}),(0,H.jsx)(`span`,{className:`lp-spin lp-spin--lg`,role:`status`,"aria-label":`Loading`})]}):n.phase===`error`?(0,H.jsxs)(`div`,{className:`pg-state pg-error`,children:[(0,H.jsx)(`h1`,{children:t}),(0,H.jsx)(`p`,{children:n.message}),(0,H.jsx)(`button`,{className:`login-submit shell-retry`,type:`button`,onClick:()=>a(e=>({...e})),children:`Try again`})]}):(0,H.jsxs)(`div`,{className:o?`pg-host is-busy`:`pg-host`,children:[(0,H.jsx)(YJe,{page:n.page,onControl:d,onOpen:l,busy:o}),c?(0,H.jsx)(zJe,{drill:c,onClose:()=>l(null)}):null]})}function $Je(e){return e?.role===`admin`}function eYe(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=typeof t.username==`string`?t.username.trim():``;return n?{username:n,name:typeof t.name==`string`&&t.name.trim()!==``?t.name.trim():n,role:typeof t.role==`string`?t.role:``,bus:Array.isArray(t.bus)?t.bus.filter(e=>typeof e==`string`):[],modules:t.modules===`all`?`all`:Array.isArray(t.modules)?t.modules.filter(e=>typeof e==`string`):[],avatar:typeof t.avatar==`string`&&t.avatar.startsWith(`data:image/`)?t.avatar:null}:null}function k9(e){return!e||typeof e!=`object`?null:eYe(e.user)}var tYe=`Incorrect username or password.`,A9=`Sign-in is unavailable right now. Try again in a moment.`,nYe=`Cannot reach the server. Check your connection and try again.`;function rYe(e,t){if(e===0)return nYe;if(e>=500)return A9;let n=t?.error;return(typeof n?.message==`string`?n.message.trim():``)||(e===401?tYe:A9)}async function iYe(e){try{return await e.json()}catch{return null}}async function aYe(e,t){let n;try{n=await fetch(`${jd}/auth/login`,{method:`POST`,credentials:Md,headers:{"Content-Type":`application/json`},body:JSON.stringify({username:e,password:t})})}catch{return{ok:!1,message:rYe(0,null)}}let r=await iYe(n);if(!n.ok)return{ok:!1,message:rYe(n.status,r)};let i=k9(r);return i?{ok:!0,user:i}:{ok:!1,message:A9}}async function oYe(){try{let e=await fetch(`${jd}/auth/me`,{credentials:Md});return e.ok?k9(await iYe(e)):null}catch{return null}}async function sYe(){try{await fetch(`${jd}/auth/logout`,{method:`POST`,credentials:Md})}catch{}}async function j9(e,t){try{let n=await fetch(`${jd}${e}`,{credentials:Md,headers:t?.body?{"Content-Type":`application/json`}:void 0,...t});if(n.status===204)return{ok:!0,data:void 0};let r=null;try{r=await n.json()}catch{}if(!n.ok){let e=r?.error,t=n.status>=500?`Something went wrong on our side. Try again in a moment.`:e?.message||(n.status===403?`Administrators only.`:n.status===409?`That username already exists. Edit the existing account instead.`:`That change could not be saved.`);return{ok:!1,status:n.status,message:t}}return{ok:!0,data:r}}catch{return{ok:!1,status:0,message:`The server could not be reached.`}}}function cYe(){return j9(`/settings`)}function lYe(){return j9(`/admin/users`)}function uYe(e){return j9(`/admin/users`,{method:`POST`,body:JSON.stringify(e)})}function dYe(e,t){return j9(`/admin/users/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)})}function fYe(e,t){return j9(`/admin/users/${encodeURIComponent(e)}/password`,{method:`POST`,body:JSON.stringify({password:t})})}function pYe(e){return j9(`/admin/users/${encodeURIComponent(e)}/perms`)}function mYe(e,t){return j9(`/admin/users/${encodeURIComponent(e)}/perms`,{method:`PUT`,body:JSON.stringify(t)})}function hYe(e){return j9(`/auth/me/avatar`,{method:`POST`,body:JSON.stringify({dataUrl:e})})}function gYe(){return j9(`/auth/me/avatar`,{method:`DELETE`})}function _Ye(){return j9(`/admin/keychain`)}function vYe(e,t,n){return j9(`/admin/keychain`,{method:`POST`,body:JSON.stringify({label:e,type:t,fields:n})})}function yYe(e){return j9(`/admin/keychain/${encodeURIComponent(e)}`,{method:`DELETE`})}function bYe(e){return j9(`/admin/keychain/${encodeURIComponent(e)}/test`,{method:`POST`})}function xYe(){return j9(`/admin/connectors`)}function SYe(e,t){return j9(`/admin/connectors/${encodeURIComponent(e)}/pause`,{method:`POST`,body:JSON.stringify({paused:t})})}function CYe(e,t){return(e===`users`||e===`keychains`||e===`connectors`)&&!t?`account`:e}var wYe=new Set(Object.keys({text:!0,status:!0,currency:!0,int:!0,date:!0,pct:!0,select:!0,user:!0,multiselect:!0,checkbox:!0,phone:!0,email:!0,url:!0,rating:!0,created_time:!0,formula:!0,automation:!0,image:!0}));function TYe(e){return typeof e==`string`&&wYe.has(e)?e:`text`}function EYe(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function DYe(e){if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.key!=`string`||t.key===``)return null;let n=typeof t.label==`string`&&t.label!==``?t.label:t.key,r=EYe(t.options);return{key:t.key,label:n,type:TYe(t.type),source:t.source===`overlay`?`overlay`:`odoo`,...t.pinned===!0?{pinned:!0}:{},...r.length?{options:r}:{},...typeof t.note==`string`?{note:t.note}:{},...typeof t.description==`string`&&t.description!==``?{note:t.description}:{}}}function OYe(e,t,n){let r=[];for(let e of Array.isArray(n)?n:[]){let t=DYe(e);t&&r.push(t)}return{key:e,label:t||e,fields:r}}function kYe(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e;if(!Array.isArray(t.nodes))return null;let n=t.conj===`or`?`or`:t.conj===`and`?`and`:void 0;return{...n?{conj:n}:{},nodes:t.nodes}}function AYe(e){if(!e||typeof e!=`object`||Array.isArray(e))return{access:!1,filter:null,hiddenFields:[]};let t=e;return{access:t.access===!0,filter:kYe(t.filter),hiddenFields:M9(EYe(t.hiddenFields))}}function M9(e){return[...new Set(e)].sort()}function N9(e){return e.find(e=>e.pinned)?.key??e[0]?.key??``}function jYe(e){let t=N9(e);return e.filter(e=>e.key!==t).map(e=>e.key)}function MYe(e){if(!e||typeof e!=`object`)return null;let t=e,n=t.fields_by_module&&typeof t.fields_by_module==`object`?t.fields_by_module:{},r=t.perms&&typeof t.perms==`object`&&!Array.isArray(t.perms)?t.perms:{},i=(Array.isArray(t.modules)?t.modules.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return typeof t.key==`string`&&t.key?[{key:t.key,label:typeof t.label==`string`?t.label:t.key}]:[]}):Object.keys(n).map(e=>({key:e,label:e}))).map(e=>OYe(e.key,e.label,n[e.key])),a={};for(let e of i)a[e.key]=AYe(r[e.key]);return{modules:i,entries:a,orphanModules:Object.keys(r).filter(e=>!(e in a)).sort(),migrated:typeof t.perms_v==`number`&&t.perms_v>=1,isAdmin:t.is_admin===!0}}function P9(e,t,n){let r=e[t]??{access:!1,filter:null,hiddenFields:[]};return{...e,[t]:{...r,...n}}}function NYe(e,t,n){return P9(e,t,{access:n})}function PYe(e,t,n){return P9(e,t,{filter:!n||n.nodes.length===0?null:n})}function F9(e,t,n){return P9(e,t,{hiddenFields:M9(n)})}function FYe(e,t,n){let r=e[t]?.hiddenFields??[];return F9(e,t,r.includes(n)?r.filter(e=>e!==n):[...r,n])}function IYe(e,t){return new Set(e[t]?.hiddenFields??[])}function LYe(e,t){return e[t]?.filter??{nodes:[]}}function I9(e,t){let n={};for(let r of e.modules){let e=t[r.key]??{access:!1,filter:null,hiddenFields:[]},i=N9(r.fields);n[r.key]=r.fields.length?{access:e.access,filter:e.filter,hiddenFields:M9(e.hiddenFields.filter(e=>e!==i))}:{access:e.access,filter:null,hiddenFields:[]}}return{perms:n}}function RYe(e,t,n){if(n.kind===`all`){let n={};for(let r of e.modules)n[r.key]=t[r.key]??{access:!1,filter:null,hiddenFields:[]};return n}return{...e.entries,[n.key]:t[n.key]??{access:!1,filter:null,hiddenFields:[]}}}function zYe(e,t,n){let r=new Set(e.modules.map(e=>e.key));return(n.kind===`all`?Object.keys(t):[n.key]).filter(e=>!r.has(e)).sort()}function BYe(e,t,n){return JSON.stringify(I9(e,t))!==JSON.stringify(I9(e,n))}function VYe(e){if(!e)return 0;let t=0,n=e=>{for(let r of e)r&&typeof r==`object`&&Array.isArray(r.children)?n(r.children):t+=1};return n(e.nodes),t}function L9(e,t=!1){if(!e||!e.access)return`No access`;if(t)return`Full access`;let n=VYe(e.filter),r=e.hiddenFields.length;if(!n&&!r)return`Full access`;let i=[];return n&&i.push(`${n} condition${n===1?``:`s`}`),r&&i.push(`${r} field${r===1?``:`s`} hidden`),i.join(`, `)}function R9(e,t){if(!e||e.modules.length===0)return``;let n=e.modules.filter(e=>t[e.key]?.access);if(n.length===0)return`No access`;let r=n.filter(e=>e.fields.length>0&&((t[e.key]?.filter?.nodes.length??0)>0||(t[e.key]?.hiddenFields.length??0)>0)).length,i=n.length===e.modules.length?`All ${n.length} module${n.length===1?``:`s`}`:`${n.length} of ${e.modules.length} modules`;return r?`${i}, ${r} restricted`:i}function z9(e){return e.length<=1?e[0]??``:`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`}function B9(e){return e.kind===`all`?`this account's whole access`:`${e.label} access`}function HYe({user:e,userOptions:t,copyTargets:n,onBack:r,onSaved:i}){let a=e.name||e.username,o=e.username,[s,c]=(0,z.useState)({phase:`loading`}),[l,u]=(0,z.useState)({}),[d,f]=(0,z.useState)({}),[p,m]=(0,z.useState)(null),[h,g]=(0,z.useState)(null),[_,v]=(0,z.useState)(!1),[y,b]=(0,z.useState)(``),[x,S]=(0,z.useState)(``),[C,w]=(0,z.useState)(e.name??``),[T,E]=(0,z.useState)(e.role??`user`),[D,O]=(0,z.useState)(``);(0,z.useEffect)(()=>{let e=!1;return c({phase:`loading`}),pYe(o).then(t=>{if(e)return;if(!t.ok){c({phase:`error`,message:t.message});return}let n=MYe(t.data);if(!n){c({phase:`error`,message:`The permission record could not be read. Close and try again.`});return}u(n.entries),f(n.entries),c({phase:`ready`,payload:n})}),()=>{e=!0}},[o]);let k=s.phase===`ready`?s.payload:null,A=k?BYe(k,l,d):!1,j=e.role===`admin`||k?.isAdmin===!0,M=C.trim()!==(e.name??``).trim()||T!==(e.role??`user`),N=A||M,P=(0,z.useCallback)(()=>{N?m({kind:`discard`}):r()},[N,r]),F=(0,z.useRef)(N);F.current=N;let ee=(0,z.useRef)(p);ee.current=p;let I=(0,z.useRef)(h);I.current=h,(0,z.useEffect)(()=>{let e=e=>{if(e.key===`Escape`){if(I.current){e.stopPropagation(),I.current.phase!==`writing`&&g(null);return}if(ee.current){e.stopPropagation(),m(null);return}F.current&&(e.stopPropagation(),m({kind:`discard`}))}};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[]);let te=(0,z.useRef)(null);(0,z.useEffect)(()=>{!p&&!h||(te.current?.scrollIntoView({block:`center`}),te.current?.querySelector(`button`)?.focus())},[p,h]);let L=(0,z.useCallback)(()=>{if(!k)return;v(!0),b(``);let e=I9(k,d);mYe(o,e).then(t=>{v(!1),m(null),t.ok?(u(e.perms),S(`Saved access for ${o}.`),i(`Saved access for ${o}.`)):b(t.message)})},[k,d,o,i]),ne=(0,z.useCallback)((e,t)=>{v(!0),b(``),dYe(o,e).then(e=>{v(!1),e.ok?(S(t),i(t)):b(e.message)})},[o,i]),re=(0,z.useCallback)(async(e,t)=>{g({phase:`preparing`,scope:e});let r=[],i=[];for(let a of n??[]){if(!t.includes(a.username))continue;let n=await pYe(a.username);if(!n.ok){i.push({username:a.username,why:n.message});continue}let o=MYe(n.data);if(!o){i.push({username:a.username,why:`its permission record could not be read`});continue}let s=[];o.isAdmin&&s.push(`is an administrator — the rules will be stored but stay inert until the account is changed to Member`),o.migrated||s.push(`still uses the previous access model — this write moves it to the per-module model`),o.orphanModules.length&&s.push(`has rules for ${o.orphanModules.join(`, `)}, which this deployment no longer offers — those are removed`);let c=zYe(o,l,e);if(c.length){let e=c.map(e=>k?.modules.find(t=>t.key===e)?.label??e);s.push(`does not offer ${e.join(`, `)}, so that part of this copy cannot be written at all`)}r.push({user:a,payload:o,before:e.kind===`all`?R9(o,o.entries)||`No access`:L9(o.entries[e.key],(o.modules.find(t=>t.key===e.key)?.fields.length??0)===0),notes:s})}g({phase:`confirm`,scope:e,plans:r,refused:i})},[n,l,k]),ie=(0,z.useCallback)(async(e,t)=>{g({phase:`writing`,scope:e}),b(``);let n=[],r=[],a=new Set;for(let i of t){let t=RYe(i.payload,l,e);for(let t of zYe(i.payload,l,e))a.add(t);let o=await mYe(i.user.username,I9(i.payload,t));o.ok?n.push(i.user.username):r.push(`${i.user.username} (${o.message})`)}if(g(null),n.length){let t=`Copied ${B9(e)} to ${z9(n)}.`;S(t),i(t)}let o=[];if(r.length&&o.push(`Not copied to ${z9(r)}.`),a.size){let e=z9([...a].sort());o.push(`${e} could not be copied — the accounts you picked do not offer ${a.size===1?`it`:`them`}.`)}o.length&&b(o.join(` `))},[l,i]),ae=(n?.length??0)>0&&!!k&&!A,oe=(0,z.useCallback)(e=>{m(null),b(``),S(``),g({phase:`pick`,scope:e,picked:new Set})},[]);return(0,H.jsxs)(`div`,{className:`set-pane set-perms`,children:[(0,H.jsxs)(`div`,{className:`set-perm-head`,children:[(0,H.jsx)(`button`,{type:`button`,className:`set-secondary`,onClick:P,children:`Back to accounts`}),(0,H.jsxs)(`div`,{className:`set-perm-who`,children:[(0,H.jsx)(`h3`,{className:`set-h set-perm-title`,children:a}),(0,H.jsx)(`span`,{className:`set-username`,children:o})]}),(0,H.jsx)(`span`,{className:T===`admin`?`set-chip set-chip--admin`:`set-chip`,children:T===`admin`?`Admin`:`Member`}),e.active?null:(0,H.jsx)(`span`,{className:`set-chip set-chip--off`,children:`Deactivated`})]}),y?(0,H.jsx)(`p`,{className:`set-error`,children:y}):null,x?(0,H.jsx)(`p`,{className:`set-notice`,children:x}):null,(0,H.jsxs)(`section`,{className:`set-card`,children:[(0,H.jsx)(`h4`,{className:`set-h4`,children:`Account`}),(0,H.jsxs)(`div`,{className:`set-grid2`,children:[(0,H.jsxs)(`div`,{className:`set-field`,children:[(0,H.jsx)(`label`,{className:`set-label`,htmlFor:`set-name`,children:`Display name`}),(0,H.jsx)(`input`,{id:`set-name`,className:`set-input`,value:C,onChange:e=>w(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`set-field`,children:[(0,H.jsx)(`label`,{className:`set-label`,htmlFor:`set-role`,children:`Role`}),(0,H.jsxs)(`select`,{id:`set-role`,className:`pg-select`,value:T,onChange:e=>E(e.target.value),children:[(0,H.jsx)(`option`,{value:`user`,children:`Member`}),(0,H.jsx)(`option`,{value:`admin`,children:`Admin`})]})]})]}),T===`admin`&&(e.role??`user`)!==`admin`?(0,H.jsx)(`p`,{className:`set-help`,children:`Saving this makes the account an administrator, which bypasses every access rule set below.`}):null,(0,H.jsxs)(`div`,{className:`set-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`set-primary`,disabled:_||!M,onClick:()=>ne({name:C,role:T},`Saved ${o}.`),children:`Save account`}),(0,H.jsx)(`button`,{type:`button`,className:`set-secondary`,disabled:_,onClick:()=>ne({active:!e.active},`${e.active?`Deactivated`:`Reactivated`} ${o}.`),children:e.active?`Deactivate account`:`Reactivate account`})]}),(0,H.jsxs)(`div`,{className:`set-danger set-grid2`,children:[(0,H.jsxs)(`div`,{className:`set-field`,children:[(0,H.jsx)(`label`,{className:`set-label`,htmlFor:`set-pw`,children:`Set a new password`}),(0,H.jsx)(`input`,{id:`set-pw`,className:`set-input`,type:`password`,value:D,autoComplete:`new-password`,onChange:e=>O(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`set-pw-side`,children:[(0,H.jsxs)(`p`,{className:`set-help`,children:[`This signs `,o,` out everywhere immediately.`]}),(0,H.jsx)(`button`,{type:`button`,className:`set-secondary`,disabled:_||D.length===0,onClick:()=>{b(``),fYe(o,D).then(e=>{e.ok?(O(``),S(`Password reset; ${o} was signed out.`)):b(e.message)})},children:`Reset password`})]})]})]}),s.phase===`loading`?(0,H.jsx)(`div`,{className:`set-loading`,children:(0,H.jsx)(`span`,{className:`lp-spin lp-spin--lg`,role:`status`,"aria-label":`Loading`})}):null,s.phase===`error`?(0,H.jsx)(`p`,{className:`set-error`,children:s.message}):null,k?(0,H.jsxs)(H.Fragment,{children:[j?(0,H.jsx)(`p`,{className:`set-notice set-perm-banner`,children:`This is an administrator account. Administrators see everything, so nothing set here applies to them — these rules take effect only if the account is changed to Member.`}):null,!k.migrated&&!j?(0,H.jsx)(`p`,{className:`set-notice set-perm-banner`,children:`This account still uses the previous access model, so the rules below are not in force yet. Saving moves it to the per-module model — set every module deliberately before you do.`}):null,k.orphanModules.length?(0,H.jsxs)(`p`,{className:`set-error set-perm-banner`,children:[`This account has rules for `,k.orphanModules.join(`, `),`, which this deployment no longer offers. Saving removes them.`]}):null,(0,H.jsxs)(`div`,{className:`set-perm-sect`,children:[(0,H.jsx)(`h4`,{className:`set-h4`,children:`Access`}),n?.length?(0,H.jsx)(`button`,{type:`button`,className:`set-secondary set-copy-door`,disabled:!ae||_,title:A?`Save this account's access first — a copy sends what is stored, not what is on screen.`:void 0,onClick:()=>oe({kind:`all`}),children:`Apply this access to…`}):null]}),(0,H.jsxs)(`p`,{className:`set-help set-perm-intro`,children:[R9(k,d),`. Each module can be turned off entirely, narrowed to the records a condition describes, or shown with fields hidden. Restrictions apply everywhere the account looks — the tables, the exports and every number computed from them.`]}),A&&n?.length?(0,H.jsx)(`p`,{className:`set-help set-copy-why`,children:`Copying is unavailable while there are unsaved changes — a copy sends what is stored, not what is on screen.`}):null,k.modules.length===0?(0,H.jsx)(`p`,{className:`pg-empty`,children:`This deployment declares no modules that can be restricted.`}):null,k.modules.map(e=>{let r=d[e.key],i=r?.access===!0,a=e.fields.length===0;return(0,H.jsxs)(`section`,{className:`set-card set-perm-mod`,children:[(0,H.jsxs)(`div`,{className:`set-perm-modhead`,children:[(0,H.jsxs)(`label`,{className:`set-check set-perm-toggle`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:i,onChange:t=>f(n=>NYe(n,e.key,t.target.checked))}),(0,H.jsx)(`span`,{className:`set-perm-modname`,children:e.label})]}),(0,H.jsx)(`span`,{className:`set-perm-sum`,children:L9(r,a)}),n?.length?(0,H.jsx)(`button`,{type:`button`,className:`set-secondary set-copy-door`,disabled:!ae||_,onClick:()=>oe({kind:`module`,key:e.key,label:e.label}),children:`Copy to…`}):null]}),i&&a?(0,H.jsx)(`p`,{className:`set-help`,children:`No field list is available for this module, so access is all this editor can set for it. Conditions and hidden fields need a schema.`}):null,i&&!a?(0,H.jsxs)(`div`,{className:`set-perm-panels`,children:[(0,H.jsx)(`div`,{className:`cg-pop set-perm-pop`,children:(0,H.jsx)(Dm,{fields:e.fields,filters:LYe(d,e.key),onChange:t=>f(n=>PYe(n,e.key,t)),userOptions:t})}),(0,H.jsx)(`div`,{className:`cg-pop set-perm-pop`,children:(0,H.jsx)(Om,{fields:e.fields,hidden:IYe(d,e.key),onToggle:t=>f(n=>FYe(n,e.key,t)),lockedKey:N9(e.fields),onHideAll:()=>f(t=>F9(t,e.key,jYe(e.fields))),onShowAll:()=>f(t=>F9(t,e.key,[]))})})]}):null]},e.key)}),(0,H.jsxs)(`div`,{className:`set-actions set-perm-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`set-primary`,disabled:_||!A,onClick:()=>m({kind:`save`}),children:`Save access`}),(0,H.jsx)(`button`,{type:`button`,className:`set-secondary`,disabled:_,onClick:P,children:`Cancel`}),A?(0,H.jsx)(`span`,{className:`set-help set-perm-dirty`,children:`Unsaved changes`}):null]})]}):null,p?(0,H.jsx)(`div`,{className:`set-confirm-wrap`,children:(0,H.jsxs)(`div`,{ref:te,className:`set-confirm`,role:`alertdialog`,"aria-modal":`true`,"aria-label":p.kind===`save`?`Confirm access change`:`Discard changes`,children:[p.kind===`save`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`h4`,{className:`set-h4`,children:[`Change what `,a,` can see?`]}),(0,H.jsxs)(`p`,{className:`set-help`,children:[`This takes effect the next time they load a page. `,UYe(k,d)]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h4`,{className:`set-h4`,children:`Discard these changes?`}),(0,H.jsxs)(`p`,{className:`set-help`,children:[WYe(A,M),` for `,a,` stay as they were.`]})]}),(0,H.jsxs)(`div`,{className:`set-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`set-primary`,disabled:_,onClick:()=>p.kind===`save`?L():(m(null),r()),children:p.kind===`save`?`Save access`:`Discard`}),(0,H.jsx)(`button`,{type:`button`,className:`set-secondary`,disabled:_,onClick:()=>m(null),children:`Keep editing`})]})]})}):null,h?(0,H.jsx)(`div`,{className:`set-confirm-wrap`,children:(0,H.jsxs)(`div`,{ref:te,className:`set-confirm set-copy`,role:`alertdialog`,"aria-modal":`true`,"aria-label":`Copy ${B9(h.scope)}`,children:[h.phase===`pick`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`h4`,{className:`set-h4`,children:[`Copy `,B9(h.scope),` to…`]}),(0,H.jsx)(`p`,{className:`set-help`,children:h.scope.kind===`all`?`Every account you pick has its whole access record replaced with ${a}'s.`:`Every account you pick has its ${h.scope.label} access replaced with ${a}'s. Their other modules are left alone.`}),(0,H.jsx)(`div`,{className:`set-copy-list`,children:(n??[]).map(e=>(0,H.jsxs)(`label`,{className:`set-check set-copy-row`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:h.picked.has(e.username),onChange:t=>{let n=new Set(h.picked);t.target.checked?n.add(e.username):n.delete(e.username),g({...h,picked:n})}}),(0,H.jsx)(`span`,{className:`set-copy-name`,children:e.name||e.username}),(0,H.jsx)(`span`,{className:`set-username set-copy-user`,children:e.username}),e.role===`admin`?(0,H.jsx)(`span`,{className:`set-chip set-chip--admin`,children:`Admin`}):null,e.active?null:(0,H.jsx)(`span`,{className:`set-chip set-chip--off`,children:`Deactivated`})]},e.username))}),(0,H.jsxs)(`div`,{className:`set-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`set-primary`,disabled:h.picked.size===0,onClick:()=>void re(h.scope,[...h.picked]),children:`Continue`}),(0,H.jsx)(`button`,{type:`button`,className:`set-secondary`,onClick:()=>g(null),children:`Cancel`})]})]}):null,h.phase===`preparing`||h.phase===`writing`?(0,H.jsx)(`div`,{className:`set-loading`,children:(0,H.jsx)(`span`,{className:`lp-spin lp-spin--lg`,role:`status`,"aria-label":`Loading`})}):null,h.phase===`confirm`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`h4`,{className:`set-h4`,children:[`Replace `,B9(h.scope),` for `,h.plans.length,` account`,h.plans.length===1?``:`s`,`?`]}),h.plans.length===0?(0,H.jsx)(`p`,{className:`set-help`,children:`None of the accounts picked could be read, so there is nothing to write.`}):(0,H.jsx)(`ul`,{className:`set-copy-plans`,children:h.plans.map(e=>(0,H.jsxs)(`li`,{children:[(0,H.jsx)(`span`,{className:`set-copy-name`,children:e.user.name||e.user.username}),` `,(0,H.jsxs)(`span`,{className:`set-copy-before`,children:[`now: `,e.before]}),e.notes.map(t=>(0,H.jsxs)(`span`,{className:`set-copy-note`,children:[e.user.username,` `,t]},t))]},e.user.username))}),h.refused.length?(0,H.jsxs)(`p`,{className:`set-error`,children:[z9(h.refused.map(e=>`${e.username} (${e.why.replace(/\.\s*$/,``)})`)),` `,`could not be read and will not be changed.`]}):null,(0,H.jsxs)(`div`,{className:`set-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`set-primary`,disabled:h.plans.length===0,onClick:()=>void ie(h.scope,h.plans),children:`Replace access`}),(0,H.jsx)(`button`,{type:`button`,className:`set-secondary`,onClick:()=>g(null),children:`Cancel`})]})]}):null]})}):null]})}function UYe(e,t){let n=R9(e,t);return n?`${n} after this change.`:``}function WYe(e,t){return e&&t?`The account details and access rules`:t?`The account details`:`The access rules`}async function V9(e){try{let t=await fetch(`${jd}/platform-admin${e}`,{credentials:Md}),n=null;try{n=await t.json()}catch{}if(!t.ok){let e=n?.error,r=t.status>=500?`Something went wrong on our side. Try again in a moment.`:e?.message||(t.status===403?`This surface is not available to your account.`:`That could not be loaded.`);return{ok:!1,status:t.status,message:r}}return{ok:!0,data:n}}catch{return{ok:!1,status:0,message:`The server could not be reached.`}}}function GYe(){return V9(`/overview`)}var H9=e=>e?`?tenant=${encodeURIComponent(e)}`:``;function KYe(e){return V9(`/users${H9(e)}`)}function qYe(e){return V9(`/databases${H9(e)}`)}function JYe(e){return V9(`/connectors${H9(e)}`)}function YYe(e){return V9(`/automations${H9(e)}`)}function XYe(e=7){return V9(`/aws?days=${encodeURIComponent(String(e))}`)}var U9=e=>e.toLocaleString();function ZYe({n:e,why:t}){return e==null?(0,H.jsx)(`span`,{className:`padmin-unknown`,title:t||`This could not be read just now`,children:`—`}):(0,H.jsx)(H.Fragment,{children:U9(e)})}function W9(e){if(!e)return`never`;let t=Date.parse(e.includes(`T`)?e:e.replace(` `,`T`));if(Number.isNaN(t))return e;let n=Math.floor((Date.now()-t)/6e4);if(n<2)return`just now`;if(n<60)return`${n} minutes ago`;let r=Math.floor(n/60);if(r<24)return`${r} hour${r===1?``:`s`} ago`;let i=Math.floor(r/24);return i<60?`${i} day${i===1?``:`s`} ago`:`${Math.floor(i/30)} months ago`}var QYe={users:`People`,databases:`Databases`,connectors:`Data sources`,automations:`Automations`};function $Ye({rows:e=3}){return(0,H.jsx)(`div`,{className:`padmin-skel`,"aria-hidden":`true`,children:Array.from({length:e},(e,t)=>(0,H.jsx)(`div`,{className:`padmin-skel-row`},t))})}function eXe({user:e}){let[t,n]=(0,z.useState)(null),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(null),[s,c]=(0,z.useState)(null),[l,u]=(0,z.useState)(null),[d,f]=(0,z.useState)(``),[p,m]=(0,z.useState)(null),[h,g]=(0,z.useState)(!1),_=(0,z.useCallback)(()=>{n(null),GYe().then(e=>{e.ok?(n(e.data),i(``)):i(e.message)}),YYe().then(e=>{e.ok&&o({rows:e.data.automations,cost:e.data.cost})})},[]);(0,z.useEffect)(_,[_]);let v=(0,z.useCallback)((e,t)=>{c({kind:e,tenant:t}),u(null),f(``),(e===`users`?KYe:e===`databases`?qYe:e===`connectors`?JYe:YYe)(t||void 0).then(t=>{if(!t.ok){u([]),f(t.message);return}let n=t.data;u(n[e]??[]);let r=n.errors??{},i=Object.entries(r).map(([e,t])=>`${e}: ${t}`);f([typeof n.stampsNote==`string`?n.stampsNote:``,...i].filter(Boolean).join(` · `))})},[]),y=(0,z.useCallback)(()=>{g(!0),XYe(7).then(e=>{g(!1),e.ok?m(e.data.report):m({text:``,note:e.message,available:!1})})},[]);return(0,H.jsxs)(`div`,{className:`set-pane`,children:[(0,H.jsx)(`h3`,{className:`set-h`,children:`Loopable admin`}),(0,H.jsxs)(`p`,{className:`set-help set-pane-intro`,children:[`Every workspace on the platform, signed in as `,e.name,`. Counts open the rows they were computed from; anything that could not be read shows a dash and says why, rather than a zero.`]}),r?(0,H.jsx)(`p`,{className:`set-error`,children:r}):null,t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`padmin-totals`,children:[(0,H.jsx)(G9,{label:`Workspaces`,value:U9(t.totals.tenants)}),(0,H.jsx)(G9,{label:`People`,value:U9(t.totals.users)}),(0,H.jsx)(G9,{label:`Databases`,value:U9(t.totals.databases)}),(0,H.jsx)(G9,{label:`Records`,value:U9(t.totals.rows)}),(0,H.jsx)(G9,{label:`Automation cost`,value:a?`$${a.cost.usd.toFixed(2)}`:`—`,hint:a?.cost.basis})]}),t.totals.unknownTenants>0?(0,H.jsxs)(`p`,{className:`set-help padmin-caveat`,children:[t.totals.unknownTenants,` workspace`,t.totals.unknownTenants===1?``:`s`,` could not be read, so the totals above exclude `,t.totals.unknownTenants===1?`it`:`them`,`.`]}):null,(0,H.jsx)(`div`,{className:`padmin-tablewrap`,children:(0,H.jsxs)(`table`,{className:`padmin-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Workspace`}),(0,H.jsx)(`th`,{children:`Storage`}),(0,H.jsx)(`th`,{className:`padmin-num`,children:`People`}),(0,H.jsx)(`th`,{className:`padmin-num`,children:`Databases`}),(0,H.jsx)(`th`,{className:`padmin-num`,children:`Records`}),(0,H.jsx)(`th`,{className:`padmin-num`,children:`Sources`}),(0,H.jsx)(`th`,{className:`padmin-num`,children:`Automations`})]})}),(0,H.jsx)(`tbody`,{children:t.tenants.map(e=>(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`span`,{className:`padmin-name`,children:e.name}),(0,H.jsxs)(`span`,{className:`padmin-meta`,children:[e.slug,e.status===`active`?``:` · ${e.status}`,e.errors&&e.errors.length?` · ${e.errors[0]}`:``]})]}),(0,H.jsx)(`td`,{children:(0,H.jsxs)(`span`,{className:`padmin-meta`,children:[e.storeRepo&&e.storeRepo.includes(`/`)?`own repository`:e.storePrefix?`shared repository`:`tenant #0 repository`,e.keychainLocked?` · keychain locked`:``]})}),(0,H.jsx)(K9,{n:e.users,onOpen:()=>v(`users`,e.slug),title:`${e.admins} administrator${e.admins===1?``:`s`}`}),(0,H.jsx)(K9,{n:e.databases,onOpen:()=>v(`databases`,e.slug),why:e.errors?.[0]}),(0,H.jsx)(K9,{n:e.rows,onOpen:()=>v(`databases`,e.slug),why:e.errors?.[0]}),(0,H.jsx)(K9,{n:e.connectors,onOpen:()=>v(`connectors`,e.slug),why:e.errors?.[0],title:e.connectorsPaused?`${e.connectorsPaused} paused`:`none paused`}),(0,H.jsx)(K9,{n:e.automations,onOpen:()=>v(`automations`,e.slug),why:e.errors?.[0],title:e.automationsEnabled==null?void 0:`${e.automationsEnabled} scheduled`})]},e.slug))})]})}),(0,H.jsxs)(`p`,{className:`set-help padmin-caveat`,children:[`Read `,W9(t.generatedAt),` in `,t.tookMs,` ms.`,` `,t.totals.orphanUsers>0?`${t.totals.orphanUsers} account${t.totals.orphanUsers===1?``:`s`} belong to a workspace this deployment no longer knows. `:``,(0,H.jsx)(`button`,{type:`button`,className:`padmin-link`,onClick:_,children:`Refresh`})]}),s?(0,H.jsxs)(`section`,{className:`padmin-drill`,children:[(0,H.jsxs)(`div`,{className:`padmin-drill-head`,children:[(0,H.jsxs)(`h4`,{className:`padmin-h4`,children:[QYe[s.kind],s.tenant?` — ${s.tenant}`:``]}),(0,H.jsx)(`button`,{type:`button`,className:`padmin-link`,onClick:()=>c(null),children:`Close`})]}),l===null?(0,H.jsx)($Ye,{rows:2}):l.length===0?(0,H.jsx)(`p`,{className:`set-help`,children:`Nothing here yet.`}):(0,H.jsx)(tXe,{kind:s.kind,rows:l}),d?(0,H.jsx)(`p`,{className:`set-help padmin-caveat`,children:d}):null]}):null,a?(0,H.jsxs)(`section`,{className:`padmin-block`,children:[(0,H.jsx)(`h4`,{className:`padmin-h4`,children:`Automation cost`}),(0,H.jsxs)(`p`,{className:`set-help`,children:[a.rows.filter(e=>e.enabled).length,` scheduled of `,a.rows.length,a.cost.fleetRunsPerDay?`, about ${a.cost.fleetRunsPerDay} runs a day`:``,a.cost.unknownCadence?` (${a.cost.unknownCadence} on a custom cadence, not counted)`:``,`. `,a.cost.basis]})]}):null,(0,H.jsxs)(`section`,{className:`padmin-block`,children:[(0,H.jsx)(`h4`,{className:`padmin-h4`,children:`AWS cron`}),p?p.available?(0,H.jsx)(`pre`,{className:`padmin-pre`,children:p.text}):(0,H.jsx)(`p`,{className:`set-help`,children:p.note}):(0,H.jsxs)(`p`,{className:`set-help`,children:[`The external tick that wakes this app on schedule. Reading its usage runs a live CloudWatch query and takes a few seconds.`,` `,(0,H.jsx)(`button`,{type:`button`,className:`padmin-link`,onClick:y,disabled:h,children:h?`Reading…`:`Check usage`})]})]})]}):(0,H.jsx)($Ye,{rows:4})]})}function G9({label:e,value:t,hint:n}){return(0,H.jsxs)(`div`,{className:`padmin-total`+(n?` has-hint`:``),title:n||void 0,children:[(0,H.jsx)(`span`,{className:`padmin-total-label`,children:e}),(0,H.jsx)(`span`,{className:`padmin-total-value`,children:t})]})}function K9({n:e,onOpen:t,why:n,title:r}){return e==null?(0,H.jsx)(`td`,{className:`padmin-num`,children:(0,H.jsx)(ZYe,{n:e,why:n})}):(0,H.jsx)(`td`,{className:`padmin-num`,children:(0,H.jsx)(`button`,{type:`button`,className:`padmin-drill-btn`,onClick:t,title:r,children:U9(e)})})}function tXe({kind:e,rows:t}){return e===`users`?(0,H.jsx)(`div`,{className:`padmin-tablewrap`,children:(0,H.jsxs)(`table`,{className:`padmin-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Person`}),(0,H.jsx)(`th`,{children:`Workspace`}),(0,H.jsx)(`th`,{children:`Role`}),(0,H.jsx)(`th`,{children:`Last sign-in`}),(0,H.jsx)(`th`,{children:`Last active`})]})}),(0,H.jsx)(`tbody`,{children:t.map(e=>(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`span`,{className:`padmin-name`,children:e.name}),(0,H.jsxs)(`span`,{className:`padmin-meta`,children:[e.username,e.email?` · ${e.email}`:``,e.active?``:` · deactivated`]})]}),(0,H.jsx)(`td`,{children:e.tenant}),(0,H.jsxs)(`td`,{children:[e.role,e.platformAdmin?` · platform`:``]}),(0,H.jsx)(`td`,{children:W9(e.lastLogin)}),(0,H.jsx)(`td`,{children:W9(e.lastActive)})]},`${e.tenant}/${e.username}`))})]})}):e===`databases`?(0,H.jsx)(`div`,{className:`padmin-tablewrap`,children:(0,H.jsxs)(`table`,{className:`padmin-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Database`}),(0,H.jsx)(`th`,{children:`Workspace`}),(0,H.jsx)(`th`,{children:`Built from`}),(0,H.jsx)(`th`,{className:`padmin-num`,children:`Fields`}),(0,H.jsx)(`th`,{className:`padmin-num`,children:`Records`})]})}),(0,H.jsx)(`tbody`,{children:t.map(e=>(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`span`,{className:`padmin-name`,children:e.label}),(0,H.jsxs)(`span`,{className:`padmin-meta`,children:[e.key,e.createdBy?` · ${e.createdBy}`:``]})]}),(0,H.jsx)(`td`,{children:e.tenant}),(0,H.jsx)(`td`,{children:e.source}),(0,H.jsx)(`td`,{className:`padmin-num`,children:U9(e.fields)}),(0,H.jsx)(`td`,{className:`padmin-num`,children:U9(e.rowCount)})]},`${e.tenant}/${e.key}`))})]})}):e===`connectors`?(0,H.jsx)(`div`,{className:`padmin-tablewrap`,children:(0,H.jsxs)(`table`,{className:`padmin-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Source`}),(0,H.jsx)(`th`,{children:`Workspace`}),(0,H.jsx)(`th`,{children:`Kind`}),(0,H.jsx)(`th`,{children:`Status`})]})}),(0,H.jsx)(`tbody`,{children:t.map(e=>(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`span`,{className:`padmin-name`,children:e.label}),(0,H.jsx)(`span`,{className:`padmin-meta`,children:e.source===`env`?`environment credentials`:`keychain`})]}),(0,H.jsx)(`td`,{children:e.tenant}),(0,H.jsx)(`td`,{children:e.type}),(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`span`,{className:`padmin-dot `+(e.paused?`is-paused`:e.active?`is-live`:`is-idle`)}),e.paused?`paused`:e.active?`serving`:`stored`]})]},`${e.tenant}/${e.key}`))})]})}):(0,H.jsx)(`div`,{className:`padmin-tablewrap`,children:(0,H.jsxs)(`table`,{className:`padmin-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Automation`}),(0,H.jsx)(`th`,{children:`Workspace`}),(0,H.jsx)(`th`,{children:`Schedule`}),(0,H.jsx)(`th`,{className:`padmin-num`,children:`Runs a day`}),(0,H.jsx)(`th`,{children:`Last run`})]})}),(0,H.jsx)(`tbody`,{children:t.map(e=>(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`span`,{className:`padmin-name`,children:e.name}),(0,H.jsxs)(`span`,{className:`padmin-meta`,children:[e.kind,e.failedRetained?` · ${e.failedRetained} of the last ${e.runsRetained} runs failed`:``]})]}),(0,H.jsx)(`td`,{children:e.tenant}),(0,H.jsx)(`td`,{children:e.enabled?e.cron||`scheduled`:`paused`}),(0,H.jsx)(`td`,{className:`padmin-num`,children:e.enabled?e.runsPerDay===null?`custom`:e.runsPerDay:`—`}),(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`span`,{className:`padmin-dot `+(e.state===`error`?`is-error`:e.state===`ok`?`is-live`:`is-idle`)}),e.lastRunAt?e.lastRunAt.replace(`T`,` `):`never`]})]},`${e.tenant}/${e.id}`))})]})})}function nXe(e){return e===`all`||!Array.isArray(e)||e.length===0?`All modules`:`${e.length} module${e.length===1?``:`s`}: ${e.join(`, `)}`}function rXe(){return(0,H.jsx)(`svg`,{className:`set-acct-chev`,viewBox:`0 0 12 12`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M4.4 2.4 8 6l-3.6 3.6`})})}function q9({children:e}){return(0,H.jsx)(`svg`,{className:`set-rail-icon`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:e})}var iXe=(0,H.jsxs)(q9,{children:[(0,H.jsx)(`circle`,{cx:`8`,cy:`5.6`,r:`2.7`}),(0,H.jsx)(`path`,{d:`M2.9 13.4c0-2.5 2.3-4.1 5.1-4.1s5.1 1.6 5.1 4.1`})]}),aXe=(0,H.jsxs)(q9,{children:[(0,H.jsx)(`rect`,{x:`3.3`,y:`7.1`,width:`9.4`,height:`6.3`,rx:`1.3`}),(0,H.jsx)(`path`,{d:`M5.6 7.1V5.3a2.4 2.4 0 0 1 4.8 0v1.8`})]}),oXe=(0,H.jsxs)(q9,{children:[(0,H.jsx)(`circle`,{cx:`6.2`,cy:`5.9`,r:`2.3`}),(0,H.jsx)(`path`,{d:`M1.9 13.2c0-2.2 1.9-3.5 4.3-3.5s4.3 1.3 4.3 3.5`}),(0,H.jsx)(`path`,{d:`M10.7 4.1a2.3 2.3 0 0 1 0 4.3M11.6 9.9c1.5.4 2.5 1.5 2.5 3.3`})]}),sXe=(0,H.jsxs)(q9,{children:[(0,H.jsx)(`circle`,{cx:`5.4`,cy:`10.6`,r:`2.6`}),(0,H.jsx)(`path`,{d:`M7.3 8.8 13.1 3M11 5.1l1.5 1.5M9.4 6.7l1.4 1.4`})]}),cXe=(0,H.jsxs)(q9,{children:[(0,H.jsx)(`path`,{d:`M6.6 9.4 4.5 11.5a2.6 2.6 0 0 1-3.7-3.7l2.1-2.1`}),(0,H.jsx)(`path`,{d:`M9.4 6.6l2.1-2.1a2.6 2.6 0 0 1 3.7 3.7l-2.1 2.1`}),(0,H.jsx)(`path`,{d:`M6.2 9.8l3.6-3.6`})]}),lXe=(0,H.jsxs)(q9,{children:[(0,H.jsx)(`path`,{d:`M8 1.9 14.3 5 8 8.1 1.7 5z`}),(0,H.jsx)(`path`,{d:`M2.4 8.1 8 10.9l5.6-2.8M2.4 11.2 8 14l5.6-2.8`})]});function uXe(){let[e,t]=(0,z.useState)(null),[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(null),c=(0,z.useCallback)(()=>{lYe().then(e=>{e.ok?(t(e.data.users??[]),r(``)):(t([]),r(e.message))})},[]);if((0,z.useEffect)(c,[c]),e===null)return(0,H.jsx)(`div`,{className:`set-loading`,children:(0,H.jsx)(`span`,{className:`lp-spin lp-spin--lg`,role:`status`,"aria-label":`Loading`})});if(o){let t=e.find(e=>e.username===o);return t?(0,H.jsx)(HYe,{user:t,userOptions:e.map(e=>e.name||e.username),copyTargets:e.filter(e=>e.username!==t.username),onBack:()=>s(null),onSaved:e=>{a(e),r(``),c()}},t.username):(0,H.jsx)(`div`,{className:`set-pane`,children:(0,H.jsxs)(`section`,{className:`set-card`,children:[(0,H.jsx)(`h4`,{className:`set-h4`,children:`That account is no longer listed`}),(0,H.jsx)(`p`,{className:`set-help`,children:`It may have been removed since this list was loaded.`}),(0,H.jsx)(`div`,{className:`set-actions`,children:(0,H.jsx)(`button`,{type:`button`,className:`set-secondary`,onClick:()=>s(null),children:`Back to accounts`})})]})})}return(0,H.jsxs)(`div`,{className:`set-pane`,children:[(0,H.jsx)(`h3`,{className:`set-h`,children:`Manage users`}),n?(0,H.jsx)(`p`,{className:`set-error`,children:n}):null,i?(0,H.jsx)(`p`,{className:`set-notice`,children:i}):null,e.length===0&&!n?(0,H.jsx)(`p`,{className:`pg-empty`,children:`No accounts are configured on this deployment yet.`}):(0,H.jsx)(`ul`,{className:`set-acctlist`,children:e.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,className:`set-acct`+(e.active?``:` is-inactive`),onClick:()=>s(e.username),children:[(0,H.jsx)(hXe,{name:e.name||e.username}),(0,H.jsxs)(`span`,{className:`set-acct-body`,children:[(0,H.jsxs)(`span`,{className:`set-acct-top`,children:[(0,H.jsx)(`span`,{className:`set-acct-name`,children:e.name||e.username}),(0,H.jsx)(gXe,{admin:e.role===`admin`}),e.active?null:(0,H.jsx)(`span`,{className:`set-chip set-chip--off`,children:`Deactivated`})]}),(0,H.jsx)(`span`,{className:`set-acct-sub`,children:e.username}),(0,H.jsx)(`span`,{className:`set-acct-access`,children:e.role===`admin`?`Everything (admin)`:e.accessSummary??nXe(e.modules)})]}),(0,H.jsxs)(`span`,{className:`set-acct-go`,children:[`Edit`,(0,H.jsx)(rXe,{})]})]})},e.username))}),(0,H.jsx)(dXe,{onCreated:e=>{a(e),r(``),c()},onError:r})]})}function dXe({onCreated:e,onError:t}){let[n,r]=(0,z.useState)(!1),[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(`user`),[u,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(!1);if(!n)return(0,H.jsx)(`button`,{type:`button`,className:`set-primary set-add`,onClick:()=>r(!0),children:`Add an account`});let m=i.trim().length>0&&u.length>0;return(0,H.jsxs)(`section`,{className:`set-card`,children:[(0,H.jsx)(`h4`,{className:`set-h4`,children:`New account`}),(0,H.jsxs)(`div`,{className:`set-field`,children:[(0,H.jsx)(`label`,{className:`set-label`,htmlFor:`set-new-user`,children:`Username`}),(0,H.jsx)(`input`,{id:`set-new-user`,className:`set-input`,value:i,autoComplete:`off`,onChange:e=>a(e.target.value)}),(0,H.jsx)(`p`,{className:`set-help`,children:`Must be new. To change an existing account, edit it above — re-creating one would revive sessions that were revoked.`})]}),(0,H.jsxs)(`div`,{className:`set-field`,children:[(0,H.jsx)(`label`,{className:`set-label`,htmlFor:`set-new-name`,children:`Display name`}),(0,H.jsx)(`input`,{id:`set-new-name`,className:`set-input`,value:o,onChange:e=>s(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`set-field`,children:[(0,H.jsx)(`label`,{className:`set-label`,htmlFor:`set-new-role`,children:`Role`}),(0,H.jsxs)(`select`,{id:`set-new-role`,className:`pg-select`,value:c,onChange:e=>l(e.target.value),children:[(0,H.jsx)(`option`,{value:`user`,children:`Member`}),(0,H.jsx)(`option`,{value:`admin`,children:`Admin`})]})]}),(0,H.jsxs)(`div`,{className:`set-field`,children:[(0,H.jsx)(`label`,{className:`set-label`,htmlFor:`set-new-pw`,children:`Password`}),(0,H.jsx)(`input`,{id:`set-new-pw`,className:`set-input`,type:`password`,value:u,autoComplete:`new-password`,onChange:e=>d(e.target.value)}),(0,H.jsx)(`p`,{className:`set-help`,children:`A new account starts with access to everything this deployment shows. Open it from the list afterwards to set what they may see.`})]}),(0,H.jsxs)(`div`,{className:`set-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`set-primary`,disabled:f||!m,onClick:()=>{p(!0),uYe({username:i.trim().toLowerCase(),name:o||i.trim(),role:c,modules:`all`,password:u}).then(n=>{p(!1),n.ok?(e(`Created ${i.trim().toLowerCase()}.`),r(!1),a(``),s(``),d(``)):t(n.message)})},children:`Create account`}),(0,H.jsx)(`button`,{type:`button`,className:`set-secondary`,onClick:()=>r(!1),children:`Cancel`})]})]})}async function fXe(e){let t=URL.createObjectURL(e);try{let e=new Image;if(await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(`unreadable image`)),e.src=t}),!e.width||!e.height)return null;let n=Math.min(128,Math.max(e.width,e.height)),r=document.createElement(`canvas`);r.width=n,r.height=n;let i=r.getContext(`2d`);if(!i)return null;let a=Math.min(e.width,e.height);return i.drawImage(e,(e.width-a)/2,(e.height-a)/2,a,a,0,0,n,n),r.toDataURL(`image/jpeg`,.85)}catch{return null}finally{URL.revokeObjectURL(t)}}function pXe(e){return(e.match(/[\p{L}\p{N}]/u)?.[0]??`?`).toUpperCase()}function mXe({user:e,large:t}){let n=t?`set-avatar set-avatar--lg`:`set-avatar`;return e.avatar?(0,H.jsx)(`img`,{className:n,src:e.avatar,alt:``,"aria-hidden":`true`}):(0,H.jsx)(`span`,{className:n,"aria-hidden":`true`,children:pXe(e.name)})}function hXe({name:e}){return(0,H.jsx)(`span`,{className:`set-avatar`,"aria-hidden":`true`,children:pXe(e)})}function gXe({admin:e}){return(0,H.jsx)(`span`,{className:e?`set-chip set-chip--admin`:`set-chip`,children:e?`Admin`:`Member`})}function _Xe({user:e,admin:t,onUser:n}){let[r,i]=(0,z.useState)(!1),[a,o]=(0,z.useState)(``),s=(0,z.useRef)(null),c=(0,z.useCallback)(async e=>{i(!0),o(``);let t=await fXe(e);if(!t){i(!1),o(`That file could not be read as an image.`);return}let r=await hYe(t);if(i(!1),r.ok){let e=k9(r.data);e&&n?.(e)}else o(r.message)},[n]),l=(0,z.useCallback)(async()=>{i(!0),o(``);let e=await gYe();if(i(!1),e.ok){let t=k9(e.data);t&&n?.(t)}else o(e.message)},[n]);return(0,H.jsxs)(`div`,{className:`set-identity`,children:[(0,H.jsx)(mXe,{user:e,large:!0}),(0,H.jsxs)(`div`,{className:`set-identity-body`,children:[(0,H.jsxs)(`div`,{className:`set-identity-head`,children:[(0,H.jsx)(`span`,{className:`set-identity-name`,children:e.name}),(0,H.jsx)(gXe,{admin:t})]}),(0,H.jsx)(`div`,{className:`set-identity-sub`,children:e.username}),(0,H.jsxs)(`div`,{className:`set-identity-acts`,children:[(0,H.jsx)(`input`,{ref:s,type:`file`,accept:`image/png,image/jpeg`,className:`set-filepick`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&c(t)}}),(0,H.jsx)(`button`,{type:`button`,className:`set-secondary`,disabled:r,onClick:()=>s.current?.click(),children:e.avatar?`Change photo`:`Upload photo`}),e.avatar?(0,H.jsx)(`button`,{type:`button`,className:`set-secondary`,disabled:r,onClick:l,children:`Remove`}):null]}),a?(0,H.jsx)(`p`,{className:`set-error set-identity-err`,children:a}):null]})]})}function vXe({user:e,section:t,onSection:n,onClose:r,onUser:i,moduleLabels:a}){let[o,s]=(0,z.useState)(null),c=$Je(e),l=o?.platformAdmin===!0;(0,z.useEffect)(()=>{cYe().then(e=>{e.ok&&s(e.data)})},[]),(0,z.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let u=[[`account`,`Account`,iXe],[`scope`,`Your access`,aXe],...c?[[`users`,`Manage users`,oXe],[`keychains`,`Keychains`,sXe],[`connectors`,`Connectors`,cXe]]:[],...l?[[`padmin`,`Loopable admin`,lXe]]:[]],d=t===`padmin`&&!l?`account`:CYe(t,c);return(0,H.jsx)(`div`,{className:`set-backdrop`,onMouseDown:e=>{e.target===e.currentTarget&&r()},children:(0,H.jsxs)(`div`,{className:`set-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":`Settings`,children:[(0,H.jsxs)(`nav`,{className:`set-rail`,children:[(0,H.jsx)(`span`,{className:`set-rail-cap`,children:`Settings`}),u.map(([e,t,r])=>(0,H.jsxs)(`button`,{type:`button`,className:`set-rail-item`+(d===e?` is-active`:``),onClick:()=>n(e),children:[r,t]},e))]}),(0,H.jsxs)(`div`,{className:`set-body`,children:[(0,H.jsx)(`button`,{type:`button`,className:`set-close`,onClick:r,"aria-label":`Close settings`,children:`×`}),d===`keychains`?(0,H.jsx)(yXe,{}):null,d===`connectors`?(0,H.jsx)(bXe,{}):null,d===`padmin`?(0,H.jsx)(eXe,{user:e}):null,d===`account`?(0,H.jsxs)(`div`,{className:`set-pane`,children:[(0,H.jsx)(`h3`,{className:`set-h`,children:`Account`}),(0,H.jsx)(_Xe,{user:e,admin:c,onUser:i})]}):null,d===`scope`?(0,H.jsxs)(`div`,{className:`set-pane`,children:[(0,H.jsx)(`h3`,{className:`set-h`,children:`Your access`}),(0,H.jsx)(`p`,{className:`set-help set-pane-intro`,children:`What this account may open, and anything that narrows it. Only an administrator can change this.`}),(0,H.jsxs)(`section`,{className:`set-card set-card--rows`,children:[(0,H.jsxs)(`div`,{className:`pg-drill-row`,children:[(0,H.jsx)(`span`,{className:`pg-drill-key`,children:`Modules`}),(0,H.jsx)(`span`,{className:`pg-drill-val`,children:nXe(o?.scope.modules??e.modules)})]}),c?(0,H.jsxs)(`div`,{className:`pg-drill-row`,children:[(0,H.jsx)(`span`,{className:`pg-drill-key`,children:`Restrictions`}),(0,H.jsx)(`span`,{className:`pg-drill-val`,children:`None apply — administrators bypass every rule`})]}):null,c?null:Object.entries(o?.scope.perms??{}).map(([e,t])=>{let n=L9(AYe(t));return n===`Full access`?null:(0,H.jsxs)(`div`,{className:`pg-drill-row`,children:[(0,H.jsx)(`span`,{className:`pg-drill-key`,children:a?.[e]??e}),(0,H.jsx)(`span`,{className:`pg-drill-val`,children:n})]},e)})]})]}):null,d===`users`?(0,H.jsx)(uXe,{}):null]})]})})}function yXe(){let[e,t]=(0,z.useState)([]),[n,r]=(0,z.useState)(!1),[i,a]=(0,z.useState)(!1),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(null),[u,d]=(0,z.useState)({}),f=(0,z.useCallback)(async()=>{let e=await _Ye();e.ok?(t(e.data.entries),r(e.data.locked),s(``)):s(e.message),a(!0)},[]);(0,z.useEffect)(()=>{f()},[f]);let p=async()=>{if(!c||c.busy)return;l({...c,busy:!0});let e=Object.fromEntries(Object.entries(c.fields).filter(([,e])=>e.trim()!==``)),t=await vYe(c.label,c.type,e);t.ok?(l(null),f()):(s(t.message),l({...c,busy:!1}))};return(0,H.jsxs)(`div`,{className:`set-pane`,children:[(0,H.jsx)(`h3`,{className:`set-h`,children:`Keychains`}),(0,H.jsx)(`p`,{className:`set-help set-pane-intro`,children:`Credentials for this workspace's data sources, encrypted at rest. A stored secret is never shown again — only its last four characters identify it.`}),n?(0,H.jsx)(`p`,{className:`set-error`,children:`The keychain is locked: the platform's AIOS_KEYCHAIN_KEY is not configured on this server. Entries can be listed but nothing can be added or decrypted.`}):null,o?(0,H.jsx)(`p`,{className:`set-error`,children:o}):null,i?e.length===0?(0,H.jsx)(`p`,{className:`set-help`,children:`No keys stored yet.`}):(0,H.jsx)(`div`,{className:`set-card`,children:e.map(e=>(0,H.jsxs)(`div`,{className:`set-kv-row kc-row`,children:[(0,H.jsxs)(`div`,{className:`kc-main`,children:[(0,H.jsx)(`strong`,{children:e.label}),(0,H.jsxs)(`span`,{className:`kc-meta`,children:[e.type,e.preview?` · `+e.preview:``,` · added by `,e.createdBy||`?`]}),u[e.id]?(0,H.jsx)(`span`,{className:`kc-test`,children:u[e.id]}):null]}),(0,H.jsxs)(`div`,{className:`kc-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`set-btn`,onClick:async()=>{d(t=>({...t,[e.id]:`Testing…`}));let t=await bYe(e.id);d(n=>({...n,[e.id]:t.ok?(t.data.ok?`OK — `:`Failed — `)+t.data.message:t.message}))},children:`Test`}),(0,H.jsx)(`button`,{type:`button`,className:`set-btn kc-danger`,onClick:async()=>{if(!window.confirm(`Delete the key "`+e.label+`"? This cannot be undone.`))return;let t=await yYe(e.id);t.ok?f():s(t.message)},children:`Delete`})]})]},e.id))}):(0,H.jsx)(`p`,{className:`set-help`,children:`Loading…`}),c?(0,H.jsxs)(`div`,{className:`set-card kc-form`,children:[(0,H.jsxs)(`div`,{className:`set-field`,children:[(0,H.jsx)(`label`,{children:`Type`}),(0,H.jsxs)(`select`,{value:c.type,onChange:e=>l({...c,type:e.target.value,fields:{}}),children:[(0,H.jsx)(`option`,{value:`odoo`,children:`Odoo`}),(0,H.jsx)(`option`,{value:`generic`,children:`Generic secret`})]})]}),(0,H.jsxs)(`div`,{className:`set-field`,children:[(0,H.jsx)(`label`,{children:`Label`}),(0,H.jsx)(`input`,{value:c.label,maxLength:80,placeholder:c.type===`odoo`?`Production Odoo`:`e.g. Shipping API`,onChange:e=>l({...c,label:e.target.value})})]}),(c.type===`odoo`?[[`url`,`Server URL (https://...)`],[`db`,`Database`],[`user`,`API user`],[`api_key`,`API key`]]:[[`name`,`Name`],[`value`,`Secret value`]]).map(([e,t])=>(0,H.jsxs)(`div`,{className:`set-field`,children:[(0,H.jsx)(`label`,{children:t}),(0,H.jsx)(`input`,{value:c.fields[e]??``,type:e===`api_key`||e===`value`?`password`:`text`,onChange:t=>l({...c,fields:{...c.fields,[e]:t.target.value}})})]},e)),(0,H.jsxs)(`div`,{className:`set-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`set-btn`,onClick:()=>l(null),children:`Cancel`}),(0,H.jsx)(`button`,{type:`button`,className:`set-btn set-btn-primary`,disabled:c.busy||!c.label.trim()||n,onClick:()=>void p(),children:c.busy?`Saving…`:`Save key`})]})]}):(0,H.jsx)(`button`,{type:`button`,className:`set-btn set-btn-primary`,disabled:n,onClick:()=>l({type:`odoo`,label:``,fields:{},busy:!1}),children:`Add a key`})]})}function bXe(){let[e,t]=(0,z.useState)([]),[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(null),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(!1),[u,d]=(0,z.useState)(``),f=(0,z.useCallback)(async()=>{let e=await xYe();e.ok?(t(e.data.connectors),r(e.data.pausedNote||``),a(e.data.unsynced??null),d(``)):d(e.message),l(!0)},[]);return(0,z.useEffect)(()=>{f()},[f]),(0,H.jsxs)(`div`,{className:`set-pane`,children:[(0,H.jsx)(`h3`,{className:`set-h`,children:`Connectors`}),(0,H.jsx)(`p`,{className:`set-help set-pane-intro`,children:`Where this workspace's data comes from. Add credentials under Keychains; sources appear here with their status.`}),u?(0,H.jsx)(`p`,{className:`set-error`,children:u}):null,c?e.length===0?(0,H.jsx)(`p`,{className:`set-help`,children:`No connectors yet. Store a key under Keychains to register a source — nothing syncs until a later step turns it on.`}):(0,H.jsx)(`div`,{className:`set-card`,children:e.map(e=>(0,H.jsxs)(`div`,{className:`set-kv-row kc-row`,children:[(0,H.jsxs)(`div`,{className:`kc-main`,children:[(0,H.jsx)(`strong`,{children:e.label}),(0,H.jsxs)(`span`,{className:`kc-meta`,children:[e.type,` · `,e.source===`env`?`environment credentials`:`keychain`,e.paused?` · paused`:` · active`]})]}),(0,H.jsx)(`div`,{className:`kc-actions`,children:(0,H.jsx)(`button`,{type:`button`,className:`set-btn`,onClick:async()=>{let t=await SYe(e.key,!e.paused);t.ok?f():d(t.message)},children:e.paused?`Resume`:`Pause`})})]},e.key))}):(0,H.jsx)(`p`,{className:`set-help`,children:`Loading…`}),n?(0,H.jsx)(`p`,{className:`set-help kc-note`,children:n}):null,i?(0,H.jsxs)(`div`,{className:`set-card kc-unsynced`,children:[(0,H.jsx)(`strong`,{children:`Unsynced records`}),i.known?i.count===0?(0,H.jsx)(`p`,{className:`set-help`,children:`None — every record holding notes or custom-field data matches a row the connector currently serves.`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`p`,{className:`set-help`,children:[i.count,` record`,i.count===1?``:`s`,` carry saved data (notes, custom fields) but no longer match a synced row. Nothing is deleted — they reattach by ID if the source serves them again.`]}),(0,H.jsx)(`button`,{type:`button`,className:`set-btn`,onClick:()=>s(e=>!e),children:o?`Hide`:`Show `+String(i.shown??i.rows.length)}),o?(0,H.jsx)(`ul`,{className:`kc-orphans`,children:i.rows.map(e=>(0,H.jsxs)(`li`,{children:[`#`,e.pid,` — `,e.fields,` saved field`,e.fields===1?``:`s`,e.hint?` · `+e.hint:``]},String(e.pid)))}):null]}):(0,H.jsxs)(`p`,{className:`set-help`,children:[`Count unavailable right now`,i.note?` (`+i.note+`)`:``,` — the pool could not be consulted; nothing was assumed.`]})]}):null]})}var xXe=`./favicon.svg`;function SXe({size:e}){return(0,H.jsx)(`img`,{className:`lp-mark`,src:xXe,width:e,height:e,alt:``,"aria-hidden":`true`,draggable:!1})}function J9({size:e,className:t}){return(0,H.jsxs)(`div`,{className:t,children:[(0,H.jsx)(SXe,{size:e}),(0,H.jsx)(`span`,{className:`lp-wordmark`,children:`Loopable`})]})}function CXe({off:e}){return(0,H.jsxs)(`svg`,{viewBox:`0 0 20 20`,"aria-hidden":`true`,children:[(0,H.jsx)(`path`,{d:`M2.2 10s2.8-4.6 7.8-4.6S17.8 10 17.8 10 15 14.6 10 14.6 2.2 10 2.2 10z`}),(0,H.jsx)(`circle`,{cx:`10`,cy:`10`,r:`2.3`}),e?(0,H.jsx)(`path`,{d:`M4 16 16 4`}):null]})}function wXe({onSignedIn:e}){let[t,n]=(0,z.useState)(``),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(!1);async function d(n){if(n.preventDefault(),s)return;c(!0),o(``);let a=await aYe(t,r);if(a.ok){e(a.user);return}c(!1),o(a.message),i(``)}function f(e){return t=>{a&&o(``),e(t.target.value)}}return(0,H.jsx)(`div`,{className:`login-root`,children:(0,H.jsxs)(`div`,{className:`login-card`,children:[(0,H.jsx)(J9,{size:44,className:`login-brand`}),(0,H.jsxs)(`form`,{className:`login-form`,onSubmit:d,noValidate:!0,children:[(0,H.jsx)(`label`,{className:`lp-sr-only`,htmlFor:`login-username`,children:`Username`}),(0,H.jsx)(`input`,{id:`login-username`,className:`login-input`,name:`username`,type:`text`,autoComplete:`username`,placeholder:`Username`,value:t,onChange:f(n),disabled:s,"aria-invalid":a?!0:void 0}),(0,H.jsx)(`label`,{className:`lp-sr-only`,htmlFor:`login-password`,children:`Password`}),(0,H.jsxs)(`div`,{className:`login-field`,children:[(0,H.jsx)(`input`,{id:`login-password`,className:`login-input`,name:`password`,type:l?`text`:`password`,autoComplete:`current-password`,placeholder:`Password`,value:r,onChange:f(i),disabled:s,"aria-invalid":a?!0:void 0}),(0,H.jsx)(`button`,{type:`button`,className:`login-eye`,"aria-label":l?`Hide password`:`Show password`,onClick:()=>u(e=>!e),disabled:s,tabIndex:-1,children:(0,H.jsx)(CXe,{off:l})})]}),(0,H.jsx)(`button`,{className:`login-submit`,type:`submit`,disabled:s,children:s?`Signing in…`:`Log in`})]}),(0,H.jsx)(`p`,{className:`login-msg`,role:`status`,"aria-live":`polite`,children:a})]})})}function TXe(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e;if(Ed.includes(String(t.shape))&&Dd.includes(String(t.tone)))return{shape:t.shape,tone:t.tone}}function EXe(e){let t=e?.pages;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=e,r=typeof t.key==`string`?t.key.trim():``,i=typeof t.label==`string`?t.label.trim():``;!r||!i||n.push({key:r,label:i,...typeof t.source==`string`&&t.source?{source:t.source}:{},...typeof t.parent==`string`&&t.parent?{parent:t.parent}:{},...t.group_only===!0?{group_only:!0}:{},...t.chrome===`main`||t.chrome===`utility`?{chrome:t.chrome}:{},...TXe(t.icon)?{icon:TXe(t.icon)}:{},...t.manage===!0?{manage:!0}:{}})}return n}function DXe(e){let t=[],n=[];for(let r of e)(r.chrome===`utility`?n:t).push(r);return{main:t,utility:n}}async function OXe(){try{let e=await fetch(`${jd}/nav`,{credentials:Md});if(!e.ok)return{ok:!1,status:e.status};let t=await e.json(),n=typeof t?.empty==`string`?t.empty:void 0;return{ok:!0,pages:EXe(t),...n?{empty:n}:{}}}catch{return{ok:!1,status:0}}}var Y9={folders:[],placement:{}};function kXe(e){let t=e?.prefs??e;if(!t||typeof t!=`object`)return Y9;let n=t,r=[],i=new Set;if(Array.isArray(n.folders))for(let e of n.folders.slice(0,16)){if(!e||typeof e!=`object`)continue;let t=String(e.id??``).trim().slice(0,40),n=String(e.name??``).trim().replace(/\s+/g,` `).slice(0,40);!t||i.has(t)||!n||(i.add(t),r.push({id:t,name:n}))}let a={};if(n.placement&&typeof n.placement==`object`)for(let[e,t]of Object.entries(n.placement)){let n=String(t??``).slice(0,40);e&&i.has(n)&&(a[e.slice(0,60)]=n)}return{folders:r,placement:a}}async function AXe(){try{let e=await fetch(`${jd}/nav/prefs`,{credentials:Md});return e.ok?kXe(await e.json()):Y9}catch{return Y9}}async function jXe(e){try{return(await fetch(`${jd}/nav/prefs`,{method:`POST`,credentials:Md,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})).ok}catch{return!1}}async function MXe(e,t){try{return(await fetch(`${jd}/nav/meta`,{method:`POST`,credentials:Md,headers:{"Content-Type":`application/json`},body:JSON.stringify({key:e,...t})})).ok}catch{return!1}}function NXe(e,t,n){let r=[];for(let t of e)t.depth>0&&r.length>0?r[r.length-1].children.push(t):r.push({head:t,children:[]});let i=new Map,a=[],o=new Set(t.folders.map(e=>e.id));for(let e of r){let n=t.placement[e.head.key];if(n&&o.has(n)){let t=i.get(n);t?t.push(e):i.set(n,[e])}else a.push(e)}let s=[],c=(e,t)=>{s.push({kind:`entry`,entry:e.head,...t?{folderId:t}:{}});for(let n of e.children)s.push({kind:`entry`,entry:n,...t?{folderId:t}:{}})};for(let e of t.folders){let t=i.get(e.id)??[],r=!n.has(e.id);if(s.push({kind:`folder`,folder:e,count:t.length,open:r}),r)for(let n of t)c(n,e.id)}for(let e of a)c(e);return s}function PXe(e){if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.key!=`string`||typeof t.label!=`string`)return null;let n=[];if(Array.isArray(t.fields))for(let e of t.fields){if(!e||typeof e!=`object`)continue;let t=e;typeof t.key!=`string`||typeof t.label!=`string`||n.push({key:t.key,label:t.label,type:String(t.type??``),source:String(t.source??``),description:String(t.description??``),...Array.isArray(t.options)?{options:t.options.map(String)}:{}})}let r=[];if(Array.isArray(t.measures))for(let e of t.measures){if(!e||typeof e!=`object`)continue;let t=e;typeof t.key!=`string`||!t.key||r.push({key:t.key,label:String(t.label??t.key),type:String(t.type??``)})}return{key:t.key,label:t.label,source:String(t.source??``),fields:n,measures:r,...typeof t.note==`string`&&t.note?{note:t.note}:{}}}async function FXe(e){try{let t=await fetch(`${jd}/nav/schema/${encodeURIComponent(e)}`,{credentials:Md});return t.ok?PXe(await t.json()):null}catch{return null}}var IXe=new Set([`customer_data`,`product_data`,`automation`]),LXe=new Set([]);function RXe(e,t){return`${e}/?page=${encodeURIComponent(t)}`}function zXe(e,t){let n=new Set(e.map(e=>e.key)),r=new Map;for(let t of e){if(!t.parent||!n.has(t.parent))continue;let e=r.get(t.parent);e?e.push(t):r.set(t.parent,[t])}let i=(e,n)=>{let i=IXe.has(e.key)||e.key.startsWith(`ut_`),a=i?`native`:e.group_only||r.has(e.key)?`group`:`handoff`;return{key:e.key,label:e.label,...e.source?{source:e.source}:{},...e.icon?{icon:e.icon}:{},...e.manage?{manage:!0}:{},kind:a,depth:n,...a===`group`?{}:{href:i?`#/${e.key}`:RXe(t,e.key)}}},a=[];for(let t of e){if(t.parent&&n.has(t.parent))continue;let e=i(t,0),o=r.get(t.key)??[];if(!(e.kind===`group`&&o.length===0)){a.push(e);for(let e of o)a.push(i(e,1))}}return a}var BXe=[`customer_data`];function VXe(e){for(let t of BXe){let n=e.find(e=>e.key===t&&e.kind===`native`);if(n)return n.key}return e.find(e=>e.kind===`native`)?.key??e.find(e=>e.kind!==`group`)?.key??``}function HXe(e,t){let n=e.findIndex(e=>e.key===t);if(n>=0){let t=e[n];if(t.kind!==`group`)return t;for(let r of e.slice(n+1)){if(r.depth<=t.depth)break;if(r.kind!==`group`)return r}}let r=VXe(e);return e.find(e=>e.key===r)}function UXe(){return(0,H.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`shell-dots-icon`,children:[(0,H.jsx)(`circle`,{cx:`8`,cy:`3.2`,r:`1.35`}),(0,H.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.35`}),(0,H.jsx)(`circle`,{cx:`8`,cy:`12.8`,r:`1.35`})]})}function WXe(){return(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`shell-nav-icon`,children:(0,H.jsx)(`path`,{d:`M2.2 4.4c0-.66.54-1.2 1.2-1.2h3l1.4 1.6h4.8c.66 0 1.2.54 1.2 1.2v6c0 .66-.54 1.2-1.2 1.2H3.4c-.66 0-1.2-.54-1.2-1.2z`})})}function X9(){let[e,t]=(0,z.useState)(null),n=(0,z.useRef)(null);return(0,z.useEffect)(()=>{if(!e)return;let r=e=>{n.current&&!n.current.contains(e.target)&&t(null)},i=e=>{e.key===`Escape`&&t(null)};return document.addEventListener(`mousedown`,r,!0),document.addEventListener(`keydown`,i,!0),()=>{document.removeEventListener(`mousedown`,r,!0),document.removeEventListener(`keydown`,i,!0)}},[e]),{at:e,ref:n,openFrom:e=>{let n=e.getBoundingClientRect();t({x:Math.round(n.right+4),y:Math.round(n.top)})},close:()=>t(null)}}function Z9({at:e,menuRef:t,children:n}){return(0,H.jsx)(`div`,{className:`shell-navmenu`,style:{left:Math.min(e.x,Math.max(8,window.innerWidth-248)),top:Math.min(e.y,Math.max(8,window.innerHeight-260))},ref:t,role:`menu`,children:n})}function GXe({value:e,onPick:t,onClear:n}){let r=e?.shape??`folder`,i=e?.tone??`neutral`;return(0,H.jsxs)(`div`,{className:`shell-navmenu-pick`,role:`group`,"aria-label":`Database icon`,children:[(0,H.jsx)(`div`,{className:`shell-navmenu-pickrow`,children:Ed.map(n=>(0,H.jsx)(`button`,{type:`button`,className:`shell-navmenu-swatch`+(e&&r===n?` is-on`:``),"aria-pressed":!!e&&r===n,"aria-label":Of[n],title:Of[n],onClick:()=>t({shape:n,tone:i}),children:(0,H.jsx)(im,{icon:{shape:n,tone:i},size:15})},n))}),(0,H.jsx)(`div`,{className:`shell-navmenu-pickrow`,children:Dd.map(n=>(0,H.jsx)(`button`,{type:`button`,className:`shell-navmenu-swatch`+(e&&i===n?` is-on`:``),"aria-pressed":!!e&&i===n,"aria-label":Df[n],title:Df[n],onClick:()=>t({shape:r,tone:n}),children:(0,H.jsx)(im,{icon:{shape:r,tone:n},size:15})},n))}),n?(0,H.jsx)(`button`,{type:`button`,className:`shell-navmenu-item is-quiet`,onClick:n,children:`Use the default icon`}):null]})}function KXe({entryLabel:e,canSchema:t,onSchema:n,canRename:r,onRename:i,canIcon:a,icon:o,onIcon:s,onIconClear:c}){let{at:l,ref:u,openFrom:d,close:f}=X9(),[p,m]=(0,z.useState)(`menu`),[h,g]=(0,z.useState)(e),_=!!r&&!!i,v=!!a&&!!s;if(!t&&!_&&!v)return null;let y=()=>{let t=h.trim().replace(/\s+/g,` `);t&&t!==e&&i?.(t),f()};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,className:`shell-dots`,"aria-label":`Options for ${e}`,"aria-haspopup":`menu`,onClick:t=>{t.preventDefault(),t.stopPropagation(),m(`menu`),g(e),d(t.currentTarget)},children:(0,H.jsx)(UXe,{})}),l&&(0,H.jsx)(Z9,{at:l,menuRef:u,children:p===`rename`&&_?(0,H.jsxs)(`form`,{className:`shell-navmenu-form`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,H.jsx)(`input`,{className:`shell-navmenu-input`,autoFocus:!0,maxLength:60,value:h,"aria-label":`Rename ${e}`,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Escape`&&f()}}),(0,H.jsx)(`button`,{type:`submit`,className:`shell-navmenu-go`,disabled:!h.trim(),children:`Save`})]}):p===`icon`&&v?(0,H.jsx)(GXe,{value:o,onPick:e=>s?.(e),...o&&c?{onClear:()=>{f(),c()}}:{}}):(0,H.jsxs)(H.Fragment,{children:[_?(0,H.jsx)(`button`,{type:`button`,className:`shell-navmenu-item`,onClick:()=>m(`rename`),children:`Rename`}):null,v?(0,H.jsx)(`button`,{type:`button`,className:`shell-navmenu-item`,onClick:()=>m(`icon`),children:`Change icon`}):null,t?(0,H.jsx)(`button`,{type:`button`,className:`shell-navmenu-item`,onClick:()=>{f(),n()},children:`View schema`}):null]})})]})}function qXe(){return(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`shell-newthing-plus`,children:(0,H.jsx)(`path`,{d:`M8 3.4v9.2M3.4 8h9.2`})})}function JXe({collapsed:e,onExpand:t,onCreateFolder:n,onNewDatabase:r,canFolder:i}){let{at:a,ref:o,openFrom:s,close:c}=X9(),[l,u]=(0,z.useState)(!1),[d,f]=(0,z.useState)(``),p=()=>{let e=d.trim().replace(/\s+/g,` `);e&&(n(e),f(``),u(!1))};return e?(0,H.jsx)(`button`,{type:`button`,className:`shell-newfolder is-collapsed`,"aria-label":`Create new`,title:`Create new`,onClick:t,children:(0,H.jsx)(qXe,{})}):l?(0,H.jsxs)(`form`,{className:`shell-navmenu-form shell-newfolder-form`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,H.jsx)(`input`,{className:`shell-navmenu-input`,autoFocus:!0,maxLength:40,placeholder:`Folder name`,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(f(``),u(!1))}}),(0,H.jsx)(`button`,{type:`submit`,className:`shell-navmenu-go`,disabled:!d.trim(),children:`Add`})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,className:`shell-newfolder`,...i?{"aria-haspopup":`menu`}:{},onClick:e=>{if(!i){r();return}s(e.currentTarget)},children:i?`+ Create new…`:`+ New database`}),a&&(0,H.jsxs)(Z9,{at:a,menuRef:o,children:[(0,H.jsx)(`button`,{type:`button`,className:`shell-navmenu-item`,onClick:()=>{c(),u(!0)},children:`New folder`}),(0,H.jsx)(`button`,{type:`button`,className:`shell-navmenu-item`,onClick:()=>{c(),r()},children:`New database`})]})]})}function YXe({folder:e,count:t,open:n,collapsed:r,onToggle:i,onRename:a,onDelete:o,isDrop:s,dropProps:c}){let{at:l,ref:u,openFrom:d,close:f}=X9(),[p,m]=(0,z.useState)(!1),[h,g]=(0,z.useState)(e.name),_=()=>{let t=h.trim().replace(/\s+/g,` `);t&&t!==e.name&&a(t),m(!1),f()};return r?null:(0,H.jsxs)(`div`,{className:`shell-nav-folder`+(s?` is-drop`:``),...c??{},children:[(0,H.jsxs)(`button`,{type:`button`,className:`shell-nav-folderbtn`,"aria-expanded":n,onClick:i,children:[(0,H.jsx)(WXe,{}),(0,H.jsx)(`span`,{className:`shell-nav-label`,children:e.name}),(0,H.jsx)(`span`,{className:`shell-nav-foldercount`,children:t})]}),(0,H.jsx)(`button`,{type:`button`,className:`shell-dots`,"aria-label":`Options for folder ${e.name}`,"aria-haspopup":`menu`,onClick:t=>{t.stopPropagation(),g(e.name),m(!1),d(t.currentTarget)},children:(0,H.jsx)(UXe,{})}),l&&(0,H.jsxs)(Z9,{at:l,menuRef:u,children:[p?(0,H.jsxs)(`form`,{className:`shell-navmenu-form`,onSubmit:e=>{e.preventDefault(),_()},children:[(0,H.jsx)(`input`,{className:`shell-navmenu-input`,autoFocus:!0,maxLength:40,value:h,onChange:e=>g(e.target.value)}),(0,H.jsx)(`button`,{type:`submit`,className:`shell-navmenu-go`,disabled:!h.trim(),children:`Save`})]}):(0,H.jsx)(`button`,{type:`button`,className:`shell-navmenu-item`,onClick:()=>m(!0),children:`Rename folder`}),(0,H.jsx)(`button`,{type:`button`,className:`shell-navmenu-item is-danger`,onClick:()=>{f(),o()},children:`Delete folder`})]})]})}function XXe({schemaKey:e,onClose:t}){let[n,r]=(0,z.useState)({phase:`loading`});return(0,z.useEffect)(()=>{let t=!1;return r({phase:`loading`}),FXe(e).then(e=>{t||r(e?{phase:`ready`,schema:e}:{phase:`error`})}),()=>{t=!0}},[e]),(0,z.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[t]),(0,H.jsx)(`div`,{className:`shell-schema-backdrop`,onMouseDown:t,children:(0,H.jsxs)(`aside`,{className:`shell-schema`,role:`dialog`,"aria-label":`Database schema`,onMouseDown:e=>e.stopPropagation(),children:[n.phase===`loading`&&(0,H.jsx)(`div`,{className:`shell-schema-empty is-spin`,children:(0,H.jsx)(`span`,{className:`lp-spin lp-spin--lg`,role:`status`,"aria-label":`Loading`})}),n.phase===`error`&&(0,H.jsx)(`div`,{className:`shell-schema-empty`,children:`The schema could not be loaded. Close this panel and try again.`}),n.phase===`ready`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`header`,{className:`shell-schema-head`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`shell-schema-title`,children:n.schema.label}),n.schema.source&&(0,H.jsxs)(`div`,{className:`shell-schema-sub`,children:[`Source · `,n.schema.source]})]}),(0,H.jsx)(`button`,{type:`button`,className:`shell-schema-close`,"aria-label":`Close schema`,onClick:t,children:`×`})]}),(0,H.jsxs)(`div`,{className:`shell-schema-body`,children:[n.schema.note&&(0,H.jsx)(`div`,{className:`shell-schema-note`,children:n.schema.note}),n.schema.fields.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`shell-schema-kicker`,children:[`Fields · `,n.schema.fields.length]}),(0,H.jsxs)(`table`,{className:`shell-schema-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Field`}),(0,H.jsx)(`th`,{children:`Type`}),(0,H.jsx)(`th`,{children:`Source`})]})}),(0,H.jsx)(`tbody`,{children:n.schema.fields.map(e=>(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`div`,{className:`shell-schema-fname`,children:e.label}),e.description&&(0,H.jsx)(`div`,{className:`shell-schema-fdesc`,children:e.description}),e.options&&(0,H.jsxs)(`div`,{className:`shell-schema-fdesc`,children:[`Choices: `,e.options.join(` · `)]})]}),(0,H.jsx)(`td`,{className:`shell-schema-type`,children:e.type}),(0,H.jsx)(`td`,{className:`shell-schema-type`,children:e.source})]},e.key))})]})]}),n.schema.measures.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`shell-schema-kicker`,children:[`Semantic measures · `,n.schema.measures.length]}),(0,H.jsx)(`div`,{className:`shell-schema-measures`,children:n.schema.measures.map(e=>(0,H.jsxs)(`div`,{className:`shell-schema-measure`,children:[(0,H.jsx)(`span`,{className:`shell-schema-fname`,children:e.label}),(0,H.jsx)(`span`,{className:`shell-schema-type`,children:e.type})]},e.key))})]})]})]})]})})}var ZXe=`https://royal-imports-cfo-os.hf.space`,Q9=`login`,$9=`application/x-loopable-nav`,QXe=[],$Xe=[];function eZe(){let e=()=>window.location.hash.replace(/^#\/?/,``),[t,n]=(0,z.useState)(e);return(0,z.useEffect)(()=>{let t=()=>n(e());return window.addEventListener(`hashchange`,t),()=>window.removeEventListener(`hashchange`,t)},[]),t}function tZe({entry:e}){return(0,H.jsxs)(`div`,{className:`shell-placeholder`,children:[(0,H.jsx)(`h1`,{children:e.label}),(0,H.jsx)(`p`,{children:`This surface runs in the current application.`}),(0,H.jsxs)(`a`,{className:`shell-link`,href:e.href,target:`_blank`,rel:`noreferrer`,children:[`Open `,e.label]})]})}function nZe(){return(0,H.jsxs)(`svg`,{className:`shell-nav-icon`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,H.jsx)(`ellipse`,{cx:`8`,cy:`3.6`,rx:`5.3`,ry:`2.1`}),(0,H.jsx)(`path`,{d:`M2.7 3.6v8.8c0 1.16 2.37 2.1 5.3 2.1s5.3-.94 5.3-2.1V3.6`}),(0,H.jsx)(`path`,{d:`M2.7 8c0 1.16 2.37 2.1 5.3 2.1S13.3 9.16 13.3 8`})]})}function rZe(){return(0,H.jsxs)(`svg`,{className:`shell-nav-icon is-spark`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,H.jsx)(`path`,{d:`M6.2 2.2 7.5 5.5l3.3 1.3-3.3 1.3-1.3 3.3-1.3-3.3-3.3-1.3 3.3-1.3z`}),(0,H.jsx)(`path`,{d:`M12.2 9.4l.8 2 2 .8-2 .8-.8 2-.8-2-2-.8 2-.8z`})]})}function iZe(){return(0,H.jsx)(`svg`,{className:`shell-nav-open`,viewBox:`0 0 12 12`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M4.6 3h4.4v4.4M8.8 3.2 3.2 8.8`})})}function aZe(){return(0,H.jsxs)(`svg`,{className:`shell-account-dots`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,H.jsx)(`circle`,{cx:`3.5`,cy:`8`,r:`1.25`}),(0,H.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.25`}),(0,H.jsx)(`circle`,{cx:`12.5`,cy:`8`,r:`1.25`})]})}function oZe(){return(0,H.jsxs)(`svg`,{className:`shell-menu-icon`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,H.jsx)(`circle`,{cx:`8`,cy:`8`,r:`2.15`}),(0,H.jsx)(`path`,{d:`M8 1.9l.9 1.5 1.7-.4.5 1.7 1.7.5-.4 1.7 1.2 1.1-1.2 1.1.4 1.7-1.7.5-.5 1.7-1.7-.4-.9 1.5-.9-1.5-1.7.4-.5-1.7-1.7-.5.4-1.7L1.7 8l1.2-1.1-.4-1.7 1.7-.5.5-1.7 1.7.4z`})]})}function sZe(){return(0,H.jsxs)(`svg`,{className:`shell-nav-icon`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,H.jsx)(`rect`,{x:`1.9`,y:`5.4`,width:`4.6`,height:`5.2`,rx:`1.1`}),(0,H.jsx)(`rect`,{x:`9.5`,y:`5.4`,width:`4.6`,height:`5.2`,rx:`1.1`}),(0,H.jsx)(`path`,{d:`M6.5 8h3`})]})}function cZe(){return(0,H.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M2.5 4.4h11M2.5 8h11M2.5 11.6h11`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`})})}function lZe({user:e,utility:t,onSignOut:n,onSettings:r}){let[i,a]=(0,z.useState)(!1),o=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!i)return;let e=e=>{o.current&&!o.current.contains(e.target)&&a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let s=(e.name.match(/[\p{L}\p{N}]/u)?.[0]??``).toUpperCase(),c=t.filter(e=>e.key!==`analyst`);return(0,H.jsxs)(`div`,{className:`shell-account-wrap`,ref:o,children:[i?(0,H.jsxs)(`div`,{className:`shell-menu`,role:`menu`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`shell-menu-item`,role:`menuitem`,onClick:()=>{a(!1),r(`account`)},children:[(0,H.jsx)(oZe,{}),`Settings`]}),c.length?(0,H.jsx)(`div`,{className:`shell-menu-rule`,role:`separator`}):null,c.map(e=>(0,H.jsxs)(`a`,{className:`shell-menu-item`,role:`menuitem`,href:RXe(ZXe,e.key),target:`_blank`,rel:`noreferrer`,onClick:()=>a(!1),children:[e.label,(0,H.jsx)(iZe,{})]},e.key)),(0,H.jsx)(`div`,{className:`shell-menu-rule`,role:`separator`}),(0,H.jsx)(`button`,{type:`button`,className:`shell-menu-item is-signout`,role:`menuitem`,onClick:()=>{a(!1),n()},children:`Sign out`})]}):null,(0,H.jsxs)(`button`,{type:`button`,className:`shell-account`,"aria-haspopup":`menu`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[e.avatar?(0,H.jsx)(`img`,{className:`shell-avatar`,src:e.avatar,alt:``,"aria-hidden":`true`,style:{objectFit:`cover`,padding:0}}):(0,H.jsx)(`span`,{className:`shell-avatar`,"aria-hidden":`true`,children:s}),(0,H.jsxs)(`span`,{className:`shell-account-who`,children:[(0,H.jsx)(`span`,{className:`shell-account-name`,children:e.name}),(0,H.jsx)(`span`,{className:`shell-account-role`,children:$Je(e)?`Admin`:`Member`})]}),(0,H.jsx)(aZe,{})]})]})}function uZe(){let[e,t]=(0,z.useState)({phase:`checking`}),[n,r]=(0,z.useState)({phase:`idle`}),[i,a]=(0,z.useState)(0),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(null),f=eZe(),[p,m]=(0,z.useState)(()=>{try{return localStorage.getItem(`aios-nav-collapsed`)===`1`}catch{return!1}});(0,z.useEffect)(()=>{try{localStorage.setItem(`aios-nav-collapsed`,p?`1`:`0`)}catch{}},[p]);let[h,g]=(0,z.useState)(null);(0,z.useEffect)(()=>{p||g(null)},[p]);let _=(0,z.useCallback)(e=>t=>{let n=t.currentTarget.getBoundingClientRect();g({label:e,y:n.top+n.height/2})},[]),v=(0,z.useCallback)(()=>g(null),[]);(0,z.useEffect)(()=>{let e=()=>t({phase:`anon`}),n=e=>s(String(e.detail??``)||`The data could not be loaded.`),r=e=>l(String(e.detail??``)),i=()=>m(!0);return window.addEventListener(Nd,e),window.addEventListener(Pd,n),window.addEventListener(Fd,r),window.addEventListener(Rd,i),()=>{window.removeEventListener(Nd,e),window.removeEventListener(Pd,n),window.removeEventListener(Fd,r),window.removeEventListener(Rd,i)}},[]),(0,z.useEffect)(()=>{if(!c)return;let e=setTimeout(()=>l(``),6e3);return()=>clearTimeout(e)},[c]),(0,z.useEffect)(()=>{let e=!1;return oYe().then(n=>{e||t(n?{phase:`authed`,user:n}:{phase:`anon`})}),()=>{e=!0}},[]);let y=e.phase===`authed`?e.user.username:null;(0,z.useEffect)(()=>{if(y===null){r({phase:`idle`});return}let e=!1;return r(e=>e.phase===`ready`?e:{phase:`loading`}),s(``),l(``),OXe().then(n=>{if(!e)if(n.ok){let{main:e,utility:t}=DXe(n.pages);r({phase:`ready`,entries:zXe(e,ZXe),utility:t,...n.empty?{empty:n.empty}:{}})}else n.status===401?t({phase:`anon`}):r({phase:`error`})}),()=>{e=!0}},[y,i]);let b=n.phase===`ready`?n.entries:QXe,x=n.phase===`ready`&&b.length===0&&n.empty===`no_databases`,[S,C]=(0,z.useState)(Y9),w=(0,z.useRef)(S);w.current=S;let[T,E]=(0,z.useState)(new Set),[D,O]=(0,z.useState)(null);(0,z.useEffect)(()=>{if(y===null){C(Y9),O(null);return}let e=!1;return AXe().then(t=>{e||C(t)}),()=>{e=!0}},[y]);let k=(0,z.useCallback)(e=>{let t=w.current;C(e),jXe(e).then(e=>{e||(C(t),l(`The folder change was not saved — the store refused the write.`))})},[]),A=(0,z.useCallback)((e,t)=>{let n=w.current,r={...n.placement};t?r[e]=t:delete r[e],k({folders:n.folders,placement:r})},[k]),j=(0,z.useCallback)((e,t)=>{let n=w.current;k({folders:n.folders.map(n=>n.id===e?{...n,name:t}:n),placement:n.placement})},[k]),M=(0,z.useCallback)(e=>{let t=w.current;k({folders:t.folders.filter(t=>t.id!==e),placement:Object.fromEntries(Object.entries(t.placement).filter(([,t])=>t!==e))})},[k]),N=(0,z.useCallback)(e=>{E(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),[P,F]=(0,z.useState)(null),[ee,I]=(0,z.useState)(null),te=(0,z.useCallback)(e=>{let t=w.current;if(t.folders.length>=16){l(`At most 16 folders.`);return}let n=`nf_${Date.now().toString(36)}${Math.floor(Math.random()*1e6).toString(36)}`;k({folders:[...t.folders,{id:n,name:e}],placement:t.placement})},[k]),L=(0,z.useCallback)(async(e,t)=>{await MXe(e,t)?a(e=>e+1):l(`That change was not saved — the store refused the write.`)},[]);(0,z.useEffect)(()=>{e.phase===`anon`&&f!==Q9?window.location.hash=`#/${Q9}`:e.phase===`authed`&&f===Q9&&b.length&&(window.location.hash=`#/${VXe(b)}`)},[e.phase,f,b]);let ne=(0,z.useCallback)(()=>{Qd(),sYe().then(()=>t({phase:`anon`}))},[]),[re,ie]=(0,z.useState)(!1);(0,z.useEffect)(()=>{if(!re&&!se.current)return;let e=e=>{e.key===`Escape`&&(ie(!1),oe(e=>e&&e.busy?e:null))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)});let[ae,oe]=(0,z.useState)(null),se=(0,z.useRef)(!1);se.current=ae!==null;let[ce,le]=(0,z.useState)(!1),ue=(0,z.useCallback)(async()=>{oe(e=>{if(!e||e.busy||!e.name.trim())return e;let t=e.name;return(async()=>{try{let e=await fetch(`${jd}/tables`,{method:`POST`,credentials:Md,headers:{"Content-Type":`application/json`},body:JSON.stringify({label:t.trim()})}),n=await e.json().catch(()=>null);if(!e.ok||!n?.key){oe({name:t,busy:!1,err:n?.error?.message||`The server answered ${e.status}.`});return}oe(null),a(e=>e+1),window.location.hash=`#/${n.key}`}catch{oe({name:t,busy:!1,err:`Cannot reach the server.`})}})(),{...e,busy:!0,err:``}})},[]),de=(0,z.useCallback)(async e=>{le(!0);try{let t=await fetch(`${jd}/tables/${encodeURIComponent(e)}/rows`,{method:`POST`,credentials:Md,headers:{"Content-Type":`application/json`},body:JSON.stringify({values:{}})});if(t.ok)Qd(),window.dispatchEvent(new Event(zd));else{let e=await t.json().catch(()=>null);l(e?.error?.message||`The row was not added.`)}}catch{l(`Cannot reach the server.`)}finally{le(!1)}},[]);if(e.phase===`checking`)return(0,H.jsx)(`div`,{className:`shell-boot`,children:(0,H.jsx)(J9,{size:44,className:`login-brand`})});if(e.phase===`anon`)return(0,H.jsx)(wXe,{onSignedIn:e=>{Qd(),t({phase:`authed`,user:e})}});let fe=HXe(b,f),pe=n.phase===`ready`?n.utility:$Xe,me=pe.find(e=>e.key===`analyst`),he=b.find(e=>e.key===`automation`&&e.kind===`native`),ge=he?b.filter(e=>e.key!==`automation`):b;return(0,H.jsxs)(`div`,{className:`shell-root`,children:[(0,H.jsxs)(`aside`,{className:`shell-side`+(p?` is-collapsed`:``),children:[(0,H.jsxs)(`div`,{className:`shell-side-head`,children:[(0,H.jsx)(`button`,{type:`button`,className:`shell-brand-btn`,disabled:!p,"aria-label":p?`Expand navigation`:void 0,onMouseEnter:p?_(`Expand navigation`):void 0,onMouseLeave:p?v:void 0,onClick:()=>m(!1),children:(0,H.jsx)(J9,{size:26,className:`shell-brand`})}),(0,H.jsx)(`button`,{type:`button`,className:`shell-rail-toggle`,"aria-label":`Minimize navigation`,"aria-expanded":!p,title:`Minimize navigation`,onClick:()=>m(!0),children:(0,H.jsx)(cZe,{})})]}),(0,H.jsxs)(`nav`,{className:`shell-nav`,children:[me?(0,H.jsxs)(`button`,{type:`button`,className:`shell-nav-item shell-nav-assist`,onClick:()=>ie(!0),onMouseEnter:p?_(`AI assistant`):void 0,onMouseLeave:p?v:void 0,children:[(0,H.jsx)(rZe,{}),(0,H.jsx)(`span`,{className:`shell-nav-label`,children:`AI assistant`})]}):null,he?(0,H.jsxs)(`a`,{className:`shell-nav-item shell-nav-auto`+(fe&&fe.key===he.key?` is-active`:``),href:he.href,onMouseEnter:p?_(he.label):void 0,onMouseLeave:p?v:void 0,children:[he.icon?(0,H.jsx)(`span`,{className:`shell-nav-mark`,"aria-hidden":`true`,children:(0,H.jsx)(im,{icon:he.icon,size:16})}):(0,H.jsx)(sZe,{}),(0,H.jsx)(`span`,{className:`shell-nav-label`,children:he.label})]}):null,(0,H.jsxs)(`div`,{className:`shell-nav-list`+(ee===`__root__`?` is-drop-root`:``),onDragOver:e=>{e.dataTransfer.types.includes($9)&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,I(`__root__`))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||I(null)},onDrop:e=>{let t=e.dataTransfer.getData($9);I(null),F(null),t&&(e.preventDefault(),A(t,null))},children:[NXe(ge,p?Y9:S,T).map(e=>{if(e.kind===`folder`)return(0,H.jsx)(YXe,{folder:e.folder,count:e.count,open:e.open,collapsed:p,onToggle:()=>N(e.folder.id),onRename:t=>j(e.folder.id,t),onDelete:()=>M(e.folder.id),isDrop:ee===e.folder.id,dropProps:{onDragOver:t=>{t.dataTransfer.types.includes($9)&&(t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect=`move`,I(e.folder.id))},onDrop:t=>{let n=t.dataTransfer.getData($9);I(null),F(null),n&&(t.preventDefault(),t.stopPropagation(),A(n,e.folder.id))}}},`folder:${e.folder.id}`);let t=e.entry,n=!!fe&&fe.key===t.key,r=`shell-nav-item`+(t.depth>0?` is-child`:``)+(n?` is-active`:``),i=(0,H.jsxs)(H.Fragment,{children:[t.icon?(0,H.jsx)(`span`,{className:`shell-nav-mark`,"aria-hidden":`true`,children:(0,H.jsx)(im,{icon:t.icon,size:16})}):(0,H.jsx)(nZe,{}),(0,H.jsx)(`span`,{className:`shell-nav-label`,children:t.label}),t.kind===`handoff`?(0,H.jsx)(iZe,{}):null]});if(t.kind===`group`)return(0,H.jsx)(`div`,{className:`shell-nav-group`,children:i},t.key);let a=p?{onMouseEnter:_(t.label),onMouseLeave:v}:{},o=t.kind===`native`?(0,H.jsx)(`a`,{className:r,href:t.href,...a,children:i}):(0,H.jsx)(`a`,{className:r,href:t.href,target:`_blank`,rel:`noreferrer`,...a,children:i});return(0,H.jsxs)(`div`,{className:`shell-nav-row`+(n?` is-active`:``)+(e.folderId?` is-foldered`:``)+(P===t.key?` is-dragging`:``),draggable:!p&&t.depth===0,onDragStart:e=>{e.dataTransfer.setData($9,t.key),e.dataTransfer.effectAllowed=`move`,F(t.key)},onDragEnd:()=>{F(null),I(null)},children:[o,!p&&t.depth===0&&(0,H.jsx)(KXe,{entryLabel:t.label,canSchema:!0,onSchema:()=>O(t.key),canRename:!!t.manage&&t.key.startsWith(`ut_`),onRename:e=>void L(t.key,{name:e}),canIcon:!!t.manage,...t.icon?{icon:t.icon}:{},onIcon:e=>void L(t.key,{icon:e}),onIconClear:()=>void L(t.key,{icon:null})})]},t.key)}),n.phase===`ready`?(0,H.jsx)(JXe,{collapsed:p,onExpand:()=>m(!1),onCreateFolder:te,onNewDatabase:()=>oe({name:``,busy:!1,err:``}),canFolder:b.length>0}):null]}),n.phase===`loading`?(0,H.jsx)(`div`,{className:`shell-nav-note is-spin`,children:(0,H.jsx)(`span`,{className:`lp-spin`,role:`status`,"aria-label":`Loading`})}):null,n.phase===`error`?(0,H.jsx)(`div`,{className:`shell-nav-note`,children:`Navigation unavailable. Reload to retry.`}):null,n.phase===`ready`&&b.length===0&&!x?(0,H.jsx)(`div`,{className:`shell-nav-note`,children:`No surfaces are available to this account.`}):null]}),(0,H.jsx)(`div`,{className:`shell-side-bottom`,onClickCapture:p?e=>{e.preventDefault(),e.stopPropagation(),m(!1)}:void 0,onMouseEnter:p?_(e.user.name):void 0,onMouseLeave:p?v:void 0,children:(0,H.jsx)(lZe,{user:e.user,utility:pe,onSignOut:ne,onSettings:d})})]}),h?(0,H.jsx)(`div`,{className:`shell-nav-tip`,style:{top:h.y},role:`tooltip`,"aria-hidden":`true`,children:h.label}):null,(0,H.jsx)(`main`,{className:`shell-main`,children:o&&fe?.kind===`native`?(0,H.jsxs)(`div`,{className:`shell-placeholder`,children:[(0,H.jsx)(`h1`,{children:fe.label}),(0,H.jsx)(`p`,{children:o}),(0,H.jsx)(`button`,{className:`login-submit shell-retry`,type:`button`,onClick:()=>window.location.reload(),children:`Retry`})]}):fe?.kind===`native`&&LXe.has(fe.key)?(0,H.jsx)(QJe,{pageKey:fe.key,label:fe.label},fe.key):fe?.kind===`native`&&fe.key===`automation`?(0,H.jsx)(bJe,{}):fe?.kind===`native`?(0,H.jsxs)(`div`,{className:fe.key.startsWith(`ut_`)?`shell-ut-frame`:`shell-grid-host`,children:[fe.key.startsWith(`ut_`)?(0,H.jsxs)(`div`,{className:`shell-ut-bar`,children:[(0,H.jsx)(`span`,{className:`shell-ut-name`,children:fe.label}),(0,H.jsx)(`button`,{type:`button`,className:`shell-ut-add`,onClick:()=>void de(fe.key),disabled:ce,children:ce?`Adding…`:`Add record`})]}):null,(0,H.jsx)(`div`,{className:`shell-grid-host`,children:(0,H.jsx)(Kp,{children:(0,H.jsx)(Uqe,{scope:fe.key===`product_data`?`product`:fe.key.startsWith(`ut_`)?fe.key:`customer`},fe.key)})})]}):fe?(0,H.jsx)(tZe,{entry:fe}):n.phase===`ready`||n.phase===`error`?n.phase===`ready`?(0,H.jsxs)(`div`,{className:`shell-placeholder shell-tenant-hero`,children:[(0,H.jsx)(`h1`,{children:`Welcome`}),(0,H.jsx)(`p`,{children:`This workspace has no databases yet. Create your first one below, or store a data source's keys under Settings → Keychains to connect one later.`}),(0,H.jsx)(`button`,{className:`login-submit shell-hero-create`,type:`button`,onClick:()=>oe({name:``,busy:!1,err:``}),children:`Create your first database`})]}):(0,H.jsxs)(`div`,{className:`shell-placeholder`,children:[(0,H.jsx)(`h1`,{children:`Nothing to show`}),(0,H.jsx)(`p`,{children:`The navigation service did not answer. Reload to retry.`})]}):(0,H.jsx)(`div`,{className:`shell-loading`,children:(0,H.jsx)(`span`,{className:`lp-spin lp-spin--lg`,role:`status`,"aria-label":`Loading`})})}),re?(0,H.jsx)(`div`,{className:`shell-newdb-scrim`,onClick:()=>ie(!1),children:(0,H.jsxs)(`div`,{className:`shell-newdb shell-assist-note`,role:`dialog`,"aria-label":`AI assistant`,onClick:e=>e.stopPropagation(),children:[(0,H.jsxs)(`h2`,{children:[(0,H.jsx)(rZe,{}),` AI assistant`]}),(0,H.jsx)(`p`,{className:`shell-newdb-sub`,children:`Under construction. The assistant is being trained on this workspace's data model and will open here in a later release.`}),(0,H.jsx)(`div`,{className:`shell-newdb-actions`,children:(0,H.jsx)(`button`,{type:`button`,className:`login-submit`,onClick:()=>ie(!1),children:`Close`})})]})}):null,ae?(0,H.jsx)(`div`,{className:`shell-newdb-scrim`,onClick:()=>{ae.busy||oe(null)},children:(0,H.jsxs)(`div`,{className:`shell-newdb`,role:`dialog`,"aria-label":`New database`,onClick:e=>e.stopPropagation(),children:[(0,H.jsx)(`h2`,{children:`New database`}),(0,H.jsx)(`p`,{className:`shell-newdb-sub`,children:`A blank database in this workspace. Add fields and records once it opens — nothing here connects to a source.`}),(0,H.jsx)(`input`,{autoFocus:!0,className:`shell-newdb-input`,placeholder:`Database name`,value:ae.name,maxLength:60,disabled:ae.busy,onChange:e=>oe({...ae,name:e.target.value}),onKeyDown:e=>{e.key===`Enter`&&ue(),e.key===`Escape`&&!ae.busy&&oe(null)}}),ae.err?(0,H.jsx)(`p`,{className:`shell-newdb-err`,children:ae.err}):null,(0,H.jsxs)(`div`,{className:`shell-newdb-actions`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>oe(null),disabled:ae.busy,children:`Cancel`}),(0,H.jsx)(`button`,{type:`button`,className:`login-submit`,onClick:()=>void ue(),disabled:ae.busy||!ae.name.trim(),children:ae.busy?`Creating…`:`Create database`})]})]})}):null,u?(0,H.jsx)(vXe,{user:e.user,section:u,onSection:d,onClose:()=>d(null),onUser:e=>t({phase:`authed`,user:e}),moduleLabels:Object.fromEntries(b.map(e=>[e.key,e.label]))}):null,D?(0,H.jsx)(XXe,{schemaKey:D,onClose:()=>O(null)}):null,c?(0,H.jsx)(`div`,{className:`shell-toast`,role:`status`,"aria-live":`polite`,children:c}):null]})}var dZe=Ud()||window.__AIOS_GRID__!==void 0;function fZe(){return dZe?(0,H.jsx)(`div`,{style:{width:`100%`,height:`100%`,overflow:`hidden`},children:(0,H.jsx)(Kp,{children:(0,H.jsx)(Uqe,{})})}):(0,H.jsx)(uZe,{})}ote(),dZe||vte(),(0,y.createRoot)(document.getElementById(`root`)).render((0,H.jsx)(z.StrictMode,{children:(0,H.jsx)(fZe,{})}));