@datawheel/bespoke 0.7.15-rc.23 → 0.7.15-rc.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cms.js CHANGED
@@ -102,7 +102,7 @@ return {
102
102
  font-weight: bold;
103
103
  color: hsl(`+Math.max(0,Math.min(120-120*m,120))+"deg 100% 31%);",o?.key);}return o==null||o.onChange==null||o.onChange(i),i}}function Eu(e,t){if(e===void 0)throw new Error("Unexpected undefined"+(t?": "+t:""));return e}var rT,nT=M(()=>{p();rT=function(t,o){return Math.abs(t-o)<1};});function N_(e){for(var t=e.measurements,o=e.outerSize,r=e.scrollOffset,n=t.length-1,i=function(u){return t[u].start},a=cT(0,n,i,r),s=a;s<n&&t[s].end<r+o;)s++;return {startIndex:a,endIndex:s}}var D_,Rl,iT,aT,__,sT,lT,cT,cf=M(()=>{p();oT();nT();D_=function(t){return t},Rl=function(t){for(var o=Math.max(t.startIndex-t.overscan,0),r=Math.min(t.endIndex+t.overscan,t.count-1),n=[],i=o;i<=r;i++)n.push(i);return n},iT=function(t,o){var r=t.scrollElement;if(r){var n=function(s){var l=s.width,u=s.height;o({width:Math.round(l),height:Math.round(u)});};n(r.getBoundingClientRect());var i=new ResizeObserver(function(a){var s=a[0];if(s!=null&&s.borderBoxSize){var l=s.borderBoxSize[0];if(l){n({width:l.inlineSize,height:l.blockSize});return}}n(r.getBoundingClientRect());});return i.observe(r,{box:"border-box"}),function(){i.unobserve(r);}}},aT=function(t,o){var r=t.scrollElement;if(r){var n=function(){o(r[t.options.horizontal?"scrollLeft":"scrollTop"]);};return n(),r.addEventListener("scroll",n,{passive:!0}),function(){r.removeEventListener("scroll",n);}}},__=function(t,o,r){if(o!=null&&o.borderBoxSize){var n=o.borderBoxSize[0];if(n){var i=Math.round(n[r.options.horizontal?"inlineSize":"blockSize"]);return i}}return Math.round(t.getBoundingClientRect()[r.options.horizontal?"width":"height"])},sT=function(t,o,r){var n,i,a=o.adjustments,s=a===void 0?0:a,l=o.behavior,u=t+s;(n=r.scrollElement)==null||n.scrollTo==null||n.scrollTo((i={},i[r.options.horizontal?"left":"top"]=u,i.behavior=l,i));},lT=function(t){var o=this;this.unsubs=[],this.scrollElement=null,this.isScrolling=!1,this.isScrollingTimeoutId=null,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollDirection=null,this.scrollAdjustments=0,this.measureElementCache=new Map,this.observer=function(){var r=null,n=function(){return r||(typeof ResizeObserver<"u"?r=new ResizeObserver(function(a){a.forEach(function(s){o._measureElement(s.target,s);});}):null)};return {disconnect:function(){var a;return (a=n())==null?void 0:a.disconnect()},observe:function(a){var s;return (s=n())==null?void 0:s.observe(a,{box:"border-box"})},unobserve:function(a){var s;return (s=n())==null?void 0:s.unobserve(a)}}}(),this.range={startIndex:0,endIndex:0},this.setOptions=function(r){Object.entries(r).forEach(function(n){var i=n[0],a=n[1];typeof a>"u"&&delete r[i];}),o.options=wl({debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:D_,rangeExtractor:Rl,onChange:function(){},measureElement:__,initialRect:{width:0,height:0},scrollMargin:0,scrollingDelay:150,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1},r);},this.notify=function(){o.options.onChange==null||o.options.onChange(o);},this.cleanup=function(){o.unsubs.filter(Boolean).forEach(function(r){return r()}),o.unsubs=[],o.scrollElement=null;},this._didMount=function(){return o.measureElementCache.forEach(o.observer.observe),function(){o.observer.disconnect(),o.cleanup();}},this._willUpdate=function(){var r=o.options.getScrollElement();o.scrollElement!==r&&(o.cleanup(),o.scrollElement=r,o._scrollToOffset(o.scrollOffset,{adjustments:void 0,behavior:void 0}),o.unsubs.push(o.options.observeElementRect(o,function(n){var i=o.scrollRect;o.scrollRect=n,(o.options.horizontal?n.width!==i.width:n.height!==i.height)&&o.maybeNotify();})),o.unsubs.push(o.options.observeElementOffset(o,function(n){o.scrollAdjustments=0,o.scrollOffset!==n&&(o.isScrollingTimeoutId!==null&&(clearTimeout(o.isScrollingTimeoutId),o.isScrollingTimeoutId=null),o.isScrolling=!0,o.scrollDirection=o.scrollOffset<n?"forward":"backward",o.scrollOffset=n,o.maybeNotify(),o.isScrollingTimeoutId=setTimeout(function(){o.isScrollingTimeoutId=null,o.isScrolling=!1,o.scrollDirection=null,o.maybeNotify();},o.options.scrollingDelay));})));},this.getSize=function(){return o.scrollRect[o.options.horizontal?"width":"height"]},this.memoOptions=Di(function(){return [o.options.count,o.options.paddingStart,o.options.scrollMargin,o.options.getItemKey]},function(r,n,i,a){return o.pendingMeasuredCacheIndexes=[],{count:r,paddingStart:n,scrollMargin:i,getItemKey:a}},{key:!1}),this.getFurthestMeasurement=function(r,n){for(var i=new Map,a=new Map,s=n-1;s>=0;s--){var l=r[s];if(!i.has(l.lane)){var u=a.get(l.lane);if(u==null||l.end>u.end?a.set(l.lane,l):l.end<u.end&&i.set(l.lane,!0),i.size===o.options.lanes)break}}return a.size===o.options.lanes?Array.from(a.values()).sort(function(c,d){return c.end-d.end})[0]:void 0},this.getMeasurements=Di(function(){return [o.memoOptions(),o.itemSizeCache]},function(r,n){var i=r.count,a=r.paddingStart,s=r.scrollMargin,l=r.getItemKey,u=o.pendingMeasuredCacheIndexes.length>0?Math.min.apply(Math,o.pendingMeasuredCacheIndexes):0;o.pendingMeasuredCacheIndexes=[];for(var c=o.measurementsCache.slice(0,u),d=u;d<i;d++){var m=l(d),g=o.options.lanes===1?c[d-1]:o.getFurthestMeasurement(c,d),f=g?g.end:a+s,h=n.get(m),b=typeof h=="number"?h:o.options.estimateSize(d),x=f+b,T=g?g.lane:d%o.options.lanes;c[d]={index:d,start:f,size:b,end:x,key:m,lane:T};}return o.measurementsCache=c,c},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:function(){return o.options.debug}}),this.calculateRange=Di(function(){return [o.getMeasurements(),o.getSize(),o.scrollOffset]},function(r,n,i){return o.range=N_({measurements:r,outerSize:n,scrollOffset:i})},{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:function(){return o.options.debug}}),this.maybeNotify=Di(function(){var r=o.calculateRange();return [r.startIndex,r.endIndex,o.isScrolling]},function(){o.notify();},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:function(){return o.options.debug},initialDeps:[this.range.startIndex,this.range.endIndex,this.isScrolling]}),this.getIndexes=Di(function(){return [o.options.rangeExtractor,o.calculateRange(),o.options.overscan,o.options.count,o.getSize()]},function(r,n,i,a,s){return s===0?[]:r(wl({},n,{overscan:i,count:a}))},{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:function(){return o.options.debug}}),this.indexFromElement=function(r){var n=o.options.indexAttribute,i=r.getAttribute(n);return i?parseInt(i,10):(console.warn("Missing attribute name '"+n+"={index}' on measured element."),-1)},this._measureElement=function(r,n){var i=o.measurementsCache[o.indexFromElement(r)];if(!i||!r.isConnected){o.measureElementCache.forEach(function(l,u){l===r&&(o.observer.unobserve(r),o.measureElementCache.delete(u));});return}var a=o.measureElementCache.get(i.key);a!==r&&(a&&o.observer.unobserve(a),o.observer.observe(r),o.measureElementCache.set(i.key,r));var s=o.options.measureElement(r,n,o);o.resizeItem(i,s);},this.resizeItem=function(r,n){var i,a=(i=o.itemSizeCache.get(r.key))!=null?i:r.size,s=n-a;s!==0&&(r.start<o.scrollOffset&&(process.env.NODE_ENV!=="production"&&o.options.debug&&console.info("correction",s),o._scrollToOffset(o.scrollOffset,{adjustments:o.scrollAdjustments+=s,behavior:void 0})),o.pendingMeasuredCacheIndexes.push(r.index),o.itemSizeCache=new Map(o.itemSizeCache.set(r.key,n)),o.notify());},this.measureElement=function(r){r&&o._measureElement(r,void 0);},this.getVirtualItems=Di(function(){return [o.getIndexes(),o.getMeasurements()]},function(r,n){for(var i=[],a=0,s=r.length;a<s;a++){var l=r[a],u=n[l];i.push(u);}return i},{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:function(){return o.options.debug}}),this.getVirtualItemForOffset=function(r){var n=o.getMeasurements();return Eu(n[cT(0,n.length-1,function(i){return Eu(n[i]).start},r)])},this.getOffsetForAlignment=function(r,n){var i=o.getSize();n==="auto"&&(r<=o.scrollOffset?n="start":r>=o.scrollOffset+i?n="end":n="start"),n==="start"?r=r:n==="end"?r=r-i:n==="center"&&(r=r-i/2);var a=o.options.horizontal?"scrollWidth":"scrollHeight",s=o.scrollElement?"document"in o.scrollElement?o.scrollElement.document.documentElement[a]:o.scrollElement[a]:0,l=s-o.getSize();return Math.max(Math.min(l,r),0)},this.getOffsetForIndex=function(r,n){n===void 0&&(n="auto"),r=Math.max(0,Math.min(r,o.options.count-1));var i=Eu(o.getMeasurements()[r]);if(n==="auto")if(i.end>=o.scrollOffset+o.getSize()-o.options.scrollPaddingEnd)n="end";else if(i.start<=o.scrollOffset+o.options.scrollPaddingStart)n="start";else return [o.scrollOffset,n];var a=n==="end"?i.end+o.options.scrollPaddingEnd:i.start-o.options.scrollPaddingStart;return [o.getOffsetForAlignment(a,n),n]},this.isDynamicMode=function(){return o.measureElementCache.size>0},this.cancelScrollToIndex=function(){o.scrollToIndexTimeoutId!==null&&(clearTimeout(o.scrollToIndexTimeoutId),o.scrollToIndexTimeoutId=null);},this.scrollToOffset=function(r,n){var i=n===void 0?{}:n,a=i.align,s=a===void 0?"start":a,l=i.behavior;o.cancelScrollToIndex(),l==="smooth"&&o.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),o._scrollToOffset(o.getOffsetForAlignment(r,s),{adjustments:void 0,behavior:l});},this.scrollToIndex=function(r,n){var i=n===void 0?{}:n,a=i.align,s=a===void 0?"auto":a,l=i.behavior;r=Math.max(0,Math.min(r,o.options.count-1)),o.cancelScrollToIndex(),l==="smooth"&&o.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");var u=o.getOffsetForIndex(r,s),c=u[0],d=u[1];o._scrollToOffset(c,{adjustments:void 0,behavior:l}),l!=="smooth"&&o.isDynamicMode()&&(o.scrollToIndexTimeoutId=setTimeout(function(){o.scrollToIndexTimeoutId=null;var m=o.measureElementCache.has(o.options.getItemKey(r));if(m){var g=o.getOffsetForIndex(r,d),f=g[0];rT(f,o.scrollOffset)||o.scrollToIndex(r,{align:d,behavior:l});}else o.scrollToIndex(r,{align:d,behavior:l});}));},this.scrollBy=function(r,n){var i=n===void 0?{}:n,a=i.behavior;o.cancelScrollToIndex(),a==="smooth"&&o.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),o._scrollToOffset(o.scrollOffset+r,{adjustments:void 0,behavior:a});},this.getTotalSize=function(){var r;return (((r=o.getMeasurements()[o.options.count-1])==null?void 0:r.end)||o.options.paddingStart)-o.options.scrollMargin+o.options.paddingEnd},this._scrollToOffset=function(r,n){var i=n.adjustments,a=n.behavior;o.options.scrollToFn(r,{behavior:a,adjustments:i},o);},this.measure=function(){o.itemSizeCache=new Map,o.notify();},this.setOptions(t),this.scrollRect=this.options.initialRect,this.scrollOffset=this.options.initialOffset,this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(function(r){o.itemSizeCache.set(r.key,r.size);}),this.maybeNotify();},cT=function(t,o,r,n){for(;t<=o;){var i=(t+o)/2|0,a=r(i);if(a<n)t=i+1;else if(a>n)o=i-1;else return i}return t>0?t-1:0};});function z_(e){var t=on.useReducer(function(){return {}},{})[1],o=El({},e,{onChange:function(a){t(),e.onChange==null||e.onChange(a);}}),r=on.useState(function(){return new lT(o)}),n=r[0];return n.setOptions(o),on.useEffect(function(){return n._didMount()},[]),F_(function(){return n._willUpdate()}),n}function wu(e){return z_(El({observeElementRect:iT,observeElementOffset:aT,scrollToFn:sT},e))}var F_,uf=M(()=>{p();tT();cf();cf();F_=typeof document<"u"?on.useLayoutEffect:on.useEffect;});function pf(e,t,o,r,n=!1){let i=useRouter(),{query:a,locale:s}=i,l=$(P=>P),u=useDispatch(),c=sr(),d=$(P=>r&&c.variables?c?.variables?.attributes:P.variables.attributes),m=Ei(l),g=Na(l),f=Cn(g,s),h=qe(e,r&&c.active?c?.variables.variables:void 0,r&&c.active?c?.variables.attributes:void 0),b=$(P=>r?c.variables.variables:P.variables.variables),x=$(P=>r?c.variables.status:P.variables.status),T=Ar(),{sectionVariables:E,resetSectionVariables:y}=ot(t),{addRunConsumersRunning:A,removeRunConsumersRunning:C}=rl(),w=r&&c.active?`${o}-valueCompare`:`${o}-value`,B=r&&c.active?`${o}-typeCompare`:`${o}-type`,L=r&&c.active?Object.fromEntries(Object.entries(a).filter(([P])=>P.match(G_)).map(([P,_])=>[P.replace("Compare",""),_])):Object.fromEntries(Object.entries(a).filter(([P])=>P.match(H_)).map(([P,_])=>[P.replace("Compare",""),_]));return useCallback((P,_)=>{let R={locale:s,query:{...L,[`${o}-type`]:_,[`${o}-value`]:P},variables:h},O=new URLSearchParams(window.location.search);P&&_?(O.set(w,P.join(",")),O.set(B,_)):(O.delete(w),O.delete(B)),window.history.replaceState(null,null,`?${O.toString()}`),A([t]),wn(m,void 0,e,f,R,{variables:b,status:x},T,"report").then(I=>{n&&E&&y(),c.active&&r?c.setComparisonVariables({attributes:d,variables:I.variables,status:I.status}):u(di.setVariableChange({attributes:d,variables:I.variables,status:I.status})),C([t]);});},[r,d,e,m,c,u,f,x,b,s,L,T,o,B,w,h,E,n,y])}var G_,H_,uT=M(()=>{p();Mn();Bi();Yr();ce();Se();kn();Jr();Sa();G_=/\w*Compare\b/,H_=/multihierarchySelector\d+(id|-(type|value))/;});function ff(e){let{allLabel:t,asComparison:o,colorKey:r,data:n,defaultValue:i,defaultValueType:a,hideLabel:s,resetSectionVars:l,iconKey:u,id:c,levels:d,limit:m,placeholder:g,searchIndexKey:f,searchIndexSeparator:h,section:b,settings:x}=e,{print:T}=zo(),E=nN(c),y=pf(c,b,E,o,l==="true"),A=o?`${E}-valueCompare`:`${E}-value`,C=o?`${E}-typeCompare`:`${E}-type`,w=useMantineTheme(),[B,L]=useState(!1),[D,P]=useState(!0),[_,R]=useState(""),[O,I]=useState(!1),[N,U]=useState([""].slice(1)),[G,Z]=useState([]),[H,ee]=useState(""),ie=useMemo(()=>T?Array.from(new Set(n.filter(F=>G.includes(F[`${H} ID`])))).map(F=>F?.[H]).join(", "):"",[T]),z=s==="true"||!e.label?jsx(Fragment,{}):jsx(Ce,{component:"div",html:e.label,size:"sm",style:x}),j=useRef(null),J=useRef(!1),V=useRef(!!m&&m<G.length),q=N.length,le=d[q],W=N.filter(Boolean);N.length>0&&W.length===0&&W.push(`${t} ${le?.label}`),useEffect(()=>{let Y=new URLSearchParams(window.location.search),F=Y.get(A)||i,X=Y.get(C)||a;F&&X?(Z(iN(F,i)),ee(X)):(Z([]),ee(""));},[window.location.search,i,a]),useEffect(()=>{let Y=()=>{P(!0);};return window.addEventListener("touchmove",Y),()=>{window.removeEventListener("touchmove",Y);}},[]);let te=useMemo(()=>tN(n,d,r,u,f,h),[r,n,u,d,f,h]),ne=useMemo(()=>{let Y=oN(_),F=Array.from(rN(te,Y)).reverse();return O?F:N.reduce((X,me)=>X.filter(ge=>!me||ge.searchindex.indexOf(me)>-1),F.filter(X=>X.type===le?.value))},[le,te,_,O,N]),pe=useRef(null),ve=wu({count:B?ne.length:0,estimateSize:()=>30,getScrollElement:useCallback(()=>pe.current,[]),overscan:10,rangeExtractor:useCallback(Y=>Rl(Y),[])}),[K,re]=useState(-1),fe=Math.min(K,ne.length-1),De=useCallback(Y=>{let F=N.concat(Y);O&&I(!1),U(F);},[O,N]),Oe=useCallback(()=>{let Y=N.slice(0,q-1);O&&I(!1),U(Y);},[O,N,q]),We=useCallback(Y=>{R(Y.currentTarget.value),!V.current&&n.length>0&&L(!0);},[n,R,V,L]),Tt=useCallback(()=>{R(""),y([],""),j.current?.focus(),m&&(V.current=!1);},[R,y,j,m,V]),Bt=useCallback(Y=>{let F=G.filter(X=>X!==Y);F.length>0?y(F,H):y([],""),m&&F.length<m&&(V.current=!1);},[G,H,y,m,V]),Xo=useCallback(Y=>{H!==Y.type?y([Y.value],Y.type):G.includes(Y.value)?Bt(Y.value):m?(G.length<m&&y([...G,Y.value],H),G.length===m&&y([...G.slice(1),Y.value],H)):y([...G,Y.value],H),R("");},[y,H,G,Bt,m]),Jo=useCallback(()=>{G.length>0&&_.length===0&&(y(G.slice(0,-1),H),L(!0),m&&(V.current=!1)),_.length>0&&R(_.slice(0,-1));},[y,G,H,_,R,L,m,V]),Hr=useCallback(()=>{P(Y=>Y&&(J.current=Y,!Y)),re(Y=>Y+1>=ne.length?Y:Y+1);},[re,ne]),yn=useCallback(()=>{let Y=ne[fe];Y&&Xo(Y);},[ne,fe,Xo]),vn=useCallback(()=>{L(!1);},[L]),Sn=useCallback(()=>{Oe(),re(0);},[re,Oe]),xn=useCallback(()=>{let Y=ne[fe];!O&&Y&&Y.type!==d[d.length-1]?.value&&(De(Y.name),re(0));},[ne,fe,O,d,re,De]),Ns=useCallback(()=>{P(Y=>Y&&(J.current=Y,!Y)),re(Y=>Y-1<0?0:Y-1);},[re]),Fs=({label:Y,onRemove:F,...X})=>jsxs("div",{style:{alignItems:"center",backgroundColor:w.colorScheme==="dark"?w.colors.dark[7]:w.colors.gray[1],borderRadius:w.radius.sm,cursor:"default",color:w.colorScheme==="dark"?w.colors.dark[0]:w.colors.gray[7],display:"flex",fontSize:rem(12),fontWeight:500,height:rem(22),margin:`calc(${w.spacing.xs} / 2 - ${rem(2)}) calc(${w.spacing.xs} / 2)`,maxWidth:`calc(100% - ${rem(10)})`,paddingLeft:`calc(${w.spacing.sm} / 1.5)`,paddingRight:0,userSelect:"none"},...X,children:[jsx("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Y}),jsx(CloseButton,{"aria-hidden":!0,iconSize:"70%",onMouseDown:F,radius:2,size:"sm",sx:{color:w.colorScheme==="dark"?w.colors.dark[0]:w.colors.gray[7],marginLeft:`calc(${w.spacing.sm} / 6)`},tabIndex:-1})]}),oe=useMemo(()=>G.map(Y=>te.find(F=>F.value===Y)).filter(Y=>!!Y).map((Y,F)=>createElement(Fs,{...Y,index:F,label:Y.label,key:Y.value,onRemove:X=>{X.preventDefault(),X.stopPropagation(),Bt(Y.value);}})),[G]),Re=forwardRef(function({color:F,icon:X,label:me,value:ge,...Ee},Ct){return jsx("div",{ref:Ct,style:{cursor:"pointer",width:"100%"},...Ee,children:jsxs(Group,{align:"center",noWrap:!0,spacing:"xs",w:"100%",children:[X&&jsx(Box,{bg:F??"transparent",component:"img",w:20,h:20,src:X}),jsx(Text,{lineClamp:1,size:"sm",children:me||ge})]})})});return jsxs(Fragment,{children:[jsx(MediaQuery,{query:"print",styles:{display:"none"},children:jsx(Input.Wrapper,{label:z,children:jsxs(Popover,{closeOnClickOutside:!0,keepMounted:!0,opened:B,onChange:L,onClose:()=>{re(0),R("");},onOpen:()=>{ne.length>0&&ve.scrollToIndex(0);},shadow:"sm",width:"target",withinPortal:!0,children:[jsx(Popover.Target,{children:jsxs(Box,{"aria-haspopup":"listbox",component:"div",onMouseLeave:()=>re(0),sx:{position:"relative","& .defaultValue":{backgroundColor:w.colorScheme==="dark"?w.colors.dark[5]:w.colors.gray[3],color:w.colorScheme==="dark"?w.colors.dark[1]:w.colors.gray[7]}},tabIndex:-1,children:[jsx("input",{type:"hidden",value:G.join(",")}),jsx(Input,{component:"div",multiline:!0,onMouseDown:Y=>{Y.preventDefault(),!V.current&&n.length>0&&L(!B),j.current?.focus();},rightSection:G.length>0?jsx(CloseButton,{onClick:Tt,onMouseDown:Y=>Y.preventDefault(),variant:"transparent"}):jsx(IconSelector,{color:w.colors.gray[6],size:18,stroke:1.5}),style:{overflow:"hidden"},w:"100%",children:jsxs(Box,{component:"div","data-clearable":!0,sx:{alignItems:"center",boxSizing:"border-box",display:"flex",flexWrap:"wrap",marginLeft:`calc(-${w.spacing.xs} / 2)`,minHeight:`calc(${rem(36)} - ${rem(2)})`,"&[data-clearable]":{marginRight:rem(36)},"&::placeholder":{color:w.colorScheme==="dark"?w.colors.dark[3]:w.colors.gray[5],opacity:1}},children:[oe,jsx("input",{autoComplete:"off","data-mantine-stop-propagation":B,onChange:We,onKeyDown:getHotkeyHandler([["ArrowDown",Hr],["ArrowLeft",Sn],["ArrowRight",xn],["ArrowUp",Ns],["Backspace",Jo],["Enter",yn],["Escape",vn]]),placeholder:G.length===0&&g||"",ref:j,readOnly:V.current,style:{appearance:"none",backgroundColor:"transparent",border:0,color:"inherit",flex:1,fontSize:w.fontSizes.sm,marginLeft:`calc(${w.spacing.xs} / 2)`,maxHeight:rem(22),minWidth:rem(60),outline:0,padding:0},type:"search",value:_})]})})]})}),jsx(Popover.Dropdown,{onMouseDown:Y=>Y.preventDefault(),p:0,children:jsx("div",{style:{display:"flex",maxHeight:rem(300)},children:jsx(Box,{component:"div","data-combobox-popover":!0,onMouseDown:Y=>Y.preventDefault(),role:"listbox",sx:{width:"100%"},tabIndex:-1,children:jsxs(Stack,{h:"100%",py:"xs",spacing:"xs",w:"100%",children:[d.length>1&&jsxs(Stack,{spacing:"xs",children:[jsxs(Group,{onClick:Y=>{Y.stopPropagation();},px:"xs",position:"center",spacing:"xs",children:[jsx(Button,{onClick:()=>{re(0),I(!0),U([]),ne.length>0&&ve.scrollToIndex(0);},size:"xs",variant:O?"filled":"outline",children:t}),d.map((Y,F)=>jsx(Button,{onClick:()=>{O&&I(!1);let X=[""].slice(1),me=F;for(;me--;)X[me]=N[me]||"";re(0),U(X),ne.length>0&&ve.scrollToIndex(0);},size:"xs",variant:!O&&N.length===d.findIndex(X=>X.value===Y?.value)?"filled":"outline",children:Y?.label},Y?.value))]}),jsx(Divider,{})]}),q>0&&jsxs(Group,{align:"center",noWrap:!0,px:"xs",children:[jsx(ActionIcon,{onClick:Oe,size:"sm",children:jsx(IconChevronLeft,{})}),jsx("div",{children:W.map(Y=>jsx(Text,{lineClamp:1,size:"xs",children:Y},`${Y}`))})]}),jsx(ScrollArea,{mah:250,onWheel:()=>P(!0),px:"xs",style:{overflow:"auto",width:"100%"},viewportRef:pe,viewportProps:{tabIndex:-1},w:"100%",children:jsx("div",{style:{height:`${ve.getTotalSize()}px`,position:"relative",width:"100%"},children:ve.getVirtualItems().map(Y=>{let F=ne[Y.index],X=fe===Y.index,me=G.includes(F.value);return ne.length>0&&X&&!D&&ve.scrollToIndex(fe),jsxs(Group,{"aria-selected":X,align:"center","data-hovered":X||void 0,"data-index":Y.index,"data-selected":me,id:F.vale,noWrap:!0,onMouseEnter:ge=>{ge.preventDefault(),ge.stopPropagation(),D&&(re(Y.index),P(!1));},onMouseMove:ge=>{ge.preventDefault(),ge.stopPropagation(),P(!0);},onMouseDown:ge=>{ge.preventDefault(),Xo(F);},position:"apart",ref:ve.measureElement,role:"option",spacing:"xs",sx:ge=>({borderRadius:ge.radius.xs,padding:"15px 5px 15px",paddingLeft:O&&10*d.findIndex(Ee=>Ee?.value===F.type)||5,position:"absolute",top:0,left:0,height:`${Y.size}px`,transform:`translateY(${Y.start}px)`,width:"100%","&[data-hovered]":{backgroundColor:ge.colorScheme==="dark"?ge.colors.dark[4]:ge.colors.gray[1]},"&:hover":{backgroundColor:ge.colorScheme==="dark"?ge.colors.dark[4]:ge.colors.gray[1]}}),tabIndex:-1,children:[jsx(Re,{index:Y.index,...F}),!O&&F.type!==d[d.length-1]?.value&&jsx(ActionIcon,{onMouseDown:ge=>{ge.preventDefault(),ge.stopPropagation(),De(F.name);},size:"sm",tabIndex:-1,children:jsx(IconChevronRight,{})})]},F.value)})})})]})})})})]})})}),T&&jsxs(Text,{children:[z,": ",ie]})]})}var tN,oN,rN,nN,iN,yT=M(()=>{p();uf();bt();Bn();uT();tN=(e=[],t=[],o="",r="",n="",i="|")=>{let a=t.map(h=>h.value).slice(),s=`${a.pop()}`,l=h=>h[o],u=h=>h[r],c=h=>{if(h[n])return typeof h[n]=="string"?h[n].split(i):h[n]},d=new Set,m=[],g=[],f=nest().rollup(h=>{let b=h[0],x=L=>L&&L.value&&!d.has(L.value),T=a.map(L=>b[`${L} ID`]),E=a.map(L=>b[L]),y=a.map((L,D)=>{if(g[D]!==E[D]){g[D]=E[D];let P=l[D]||l[l.length-1]||l,_=u[D]||u[u.length-1]||u,R=c[D]||c[c.length-1]||c;return {color:P(b,L)||void 0,icon:_(b,L)||void 0,value:`${T[D]}`,label:E[D],name:E[D],type:L,searchindex:E.slice(0,D+1).concat(R(b,L)).join("|")}}return {}}).filter(x);y.forEach(L=>d.add(L.value));let A=l[l.length-1]||l,C=u[u.length-1]||u,w=c[c.length-1]||c,B=h.map(L=>({color:A(L,s)||void 0,icon:C(L,s)||void 0,value:`${L[`${s} ID`]}`,label:L[s],name:L[s],type:s,searchindex:E.concat(L[s]).concat(w(L,s)).join("|")}));m.push(...y.concat(B));});return a.forEach(h=>{f.key(b=>`${b[`${h} ID`]}|${b[h]}`);}),f.entries(e),m},oN=e=>{if(!e)return /./i;let t=e.normalize("NFD").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"[^|]+");return RegExp(t,"i")},rN=(e,t)=>{let o=e.length,r,n=s=>r&&r.searchindex.includes(s.searchindex),a={next:()=>{for(let s=o-1;s>-1;s--){let l=e[s];if(t.test(`${l.value} ${l.label} ${l.searchindex}`)||n(l))return r=l,o=s,{done:!1,value:l}}return {done:!0,value:void 0}},[Symbol.iterator]:()=>a};return a},nN=e=>`multihierarchySelector${e}`,iN=(e,t)=>e&&typeof e=="string"?e.split(","):t;});var vT=M(()=>{p();ce();Jr();Jr();kn();Ys();Yr();ce();Sa();Bi();Se();});var gf=M(()=>{p();});var ST=M(()=>{p();vT();of();gf();lm();});function Ou(){let e=useContext(pN);if(e===void 0)throw new Error("usePdf must be used within a PdfProvider");return e}var uN,pN,hf=M(()=>{p();ce();uN={active:!1,pdfParam:!1,position:"DEFAULT",XlsxVizActive:!1},pN=createContext(uN);});function bf(e,t){let o=$(l=>t?l.records.entities[e][t]:null),r=o?.settings,[n,i]=useSetState(o?.settings||{}),a=se(),s=useCallback((l,u)=>{o&&(i({[l]:u}),a(Q.updateEntity(e,{id:o.id,settings:{...o.settings,[l]:u}})));},[a,o]);return useEffect(()=>{r&&i(r);},[r,i]),{settings:n,updateSettings:s}}var rn,Lu,_i=M(()=>{p();ce();rn=e=>bf("section",e),Lu=e=>bf("report",e);});function Co({target:e,dropdown:t}){let[o,{open:r,close:n}]=useDisclosure(!1),i=useRef(!0),a=()=>{setTimeout(()=>{i.current&&n();},1e3);},s=()=>{i.current=!1;},l=()=>{i.current=!0,n();};return jsxs(Group,{children:[e,jsxs(Popover,{opened:o,trapFocus:!0,children:[jsx(Popover.Target,{children:jsx(ActionIcon,{variant:"subtle",color:"blue",onMouseEnter:r,onMouseLeave:a,children:jsx(IconInfoCircle,{})})}),jsx(Popover.Dropdown,{maw:350,onMouseEnter:s,onMouseLeave:l,children:jsxs(Group,{align:"flex-start",noWrap:!0,children:[jsx("div",{children:jsx(ThemeIcon,{variant:"outline",sx:{border:"none"},children:jsx(IconInfoCircle,{})})}),jsx("div",{children:t})]})})]})]})}var Mu=M(()=>{p();});function Sf(e,t){return e===t}function xf(){let e=so(),t=Number.parseInt(e.params[0]),o=Ht(t).data,{settings:r,updateSettings:n}=Lu(t),{handlers:i}=io("reportEditor"),a=o?.dimensions&&o.dimensions.length>0;return jsx(Fragment,{children:jsxs(Stack,{children:[jsx(Button,{variant:"outline",radius:0,onClick:i.open,children:"Edit Report"}),a&&jsxs(Accordion,{children:[jsxs(Accordion.Item,{value:"comparison",children:[jsx(Accordion.Control,{children:"Profile Comparison"}),jsxs(Accordion.Panel,{children:[jsx(Co,{target:jsx(Switch,{label:"Enable comparison",checked:!!r.comparison,onChange:s=>n("comparison",s.currentTarget.checked)}),dropdown:jsxs(Fragment,{children:[jsx(Text,{fw:700,children:"Comparisons"}),jsx(Text,{fw:400,children:"This feature will allow user visiting this profile to compare it side by side to another choosen profile"})]})}),r.comparison&&jsx(Co,{target:jsx(Switch,{label:"With different levels",checked:!!r.compareLevels,onChange:s=>n("compareLevels",s.currentTarget.checked)}),dropdown:jsxs(Fragment,{children:[jsx(Text,{fw:700,children:"Compare with different Levels"}),jsx(Text,{fw:400,children:"Allow users to compare profiles from differet Levels."})]})})]})]}),jsxs(Accordion.Item,{value:"pdf",children:[jsx(Accordion.Control,{children:"PDF Export"}),jsx(Accordion.Panel,{children:jsx(Co,{target:jsx(Switch,{label:"Enable PDF export",checked:!!r.pdf,onChange:s=>n("pdf",s.currentTarget.checked)}),dropdown:jsxs(Fragment,{children:[jsx(Text,{fw:700,children:"PDF Exports"}),jsx(Text,{fw:400,children:"This feature will allow user to download the PDF version of the report with a single click."})]})})})]}),jsxs(Accordion.Item,{value:"xlsx",children:[jsx(Accordion.Control,{children:"XLSX Export"}),jsx(Accordion.Panel,{children:jsx(Co,{target:jsx(Switch,{label:"Enable XLSX export",checked:!!r.XlsxViz,onChange:s=>n("XlsxViz",s.currentTarget.checked)}),dropdown:jsxs(Fragment,{children:[jsx(Text,{fw:700,children:"Xlsx Exports"}),jsx(Text,{fw:400,children:"This feature will allow user to download the XlSX version of the report visualizations."})]})})})]})]})]})})}var Du=M(()=>{p();Se();_i();Mu();wi();});var ET,Tf,wT,Nu=M(()=>{p();ET=(e,t,o,r=null)=>{let[n,i]=useState(!1),[a,s]=useState(null);return {print:u=>{i(!0),s(null);let c=process.env.NEXT_PUBLIC_REPORTS_BASE_URL,d=new URLSearchParams(window.location.search),m=u?"&transparent=true":"",g=r?`/embeds/${t}/${o}?section=${e}&block=${r}${d.toString()?"&"+d.toString():""}`:`/embeds/${t}/${o}?section=${e}${d.toString()?"&"+d.toString():""}`,f=encodeURIComponent(`${c}${g}&print=true`);Vc.get(`${process.env.NEXT_PUBLIC_PDF_API_URL}/screenshot?url=${f}${m}`,{responseType:"blob"}).then(h=>{let b=r?`section${e}_block${r}.png`:`section${e}.png`;saveAs(h.data,b);}).catch(h=>{s(h.response?.data?.message||"Failed to download image. Please try again.");}).finally(()=>{i(!1);});},downloadLoading:n,error:a}},Tf=()=>{let{asPath:e}=useRouter(),[t,o]=useState(!1),[r,n]=useState(null);return {printReport:()=>{o(!0),n(null);let a=process.env.NEXT_PUBLIC_REPORTS_BASE_URL,s=e.replace(/[&?]printBtn=[^&]+/,""),l=s.includes("?")?"&":"?",u=encodeURIComponent(`${a}${s}${l}print=true`);return Vc.get(`${process.env.NEXT_PUBLIC_PDF_API_URL}/pdf?url=${u}`,{responseType:"blob"}).then(c=>{let m=c.headers["content-disposition"]?.match(/filename[^;=\n]*=(['"]?)(.*?)\1/),g=m&&m[2]?m[2]:"report.pdf";saveAs(c.data,g);}).catch(c=>{n(c.response?.data?.message||"Failed to generate PDF. Please try again.");}).finally(()=>{o(!1);})},error:r,setError:n,downloadLoading:t}},wT=()=>!!process.env.NEXT_PUBLIC_PDF_API_URL;});function OT({contentOutline:e=[]}){return jsx(Menu,{children:LT(e)})}function LT(e,t=!0){return e.map((o,r)=>t?jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${o.id}`,children:jsx(Group,{children:jsx(Text,{dangerouslySetInnerHTML:{__html:o.label}})})})}),o.children.length?jsx(Box,{ml:"md",children:LT(o.children,!1)}):null]},r):jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${o.id}`,children:jsx(Text,{dangerouslySetInnerHTML:{__html:o.label}})})},r))}function kf({headings:e,settings:t,type:o}){let{min:r="1",max:n="6",icons:i="yes"}=t||{},a=Fa(parseInt(r,10),parseInt(n,10),e),s=i==="yes",u=`(max-width: ${useMantineTheme().breakpoints.md})`,c=useMediaQuery(u),d=Ja(t&&t.align?String(t.align):"left");return c?jsx(ON,{contentOutline:a,showIcons:s}):o==="multilevel"?jsx(LN,{contentOutline:a,showIcons:s,align:d}):jsx(PN,{contentOutline:a,showIcons:s,align:d})}var IT,PN,MT,ON,LN,BT=M(()=>{p();ST();Oi();$t();hf();Du();Nu();IT=e=>t=>({display:"flex",gap:t.spacing.md,justifyContent:e,listStyleType:"none"});PN=({contentOutline:e,showIcons:t,align:o})=>{let{active:r,position:n,pdfParam:i}=Ou(),{downloadLoading:a,printReport:s}=Tf(),[l,u]=useState(null);if(useEffect(()=>{let d=()=>{let m=document.querySelector(".bespoke-nav");if(!m)return;let g=m.getBoundingClientRect(),f=!1;e.forEach(h=>{let b=document.getElementById(`bespoke-title-${h.id}`);b&&b.getBoundingClientRect().top<=g.bottom&&(u(h.id),f=!0);}),f||u(null);};return window.addEventListener("scroll",d),()=>{window.removeEventListener("scroll",d);}},[e]),r&&i)return jsx(OT,{contentOutline:e});let c=d=>!d||!d?.length?null:jsx(Fragment,{children:d.map(m=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${m.id}`,children:jsxs(Group,{spacing:"sm",children:[t&&jsx(nt,{...m.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:m.label}})]})})}),jsx(Box,{pl:"xs",children:c(m.children)})]},m.id))});return jsxs(Box,{component:"nav",className:"bespoke-nav",children:[jsx(List,{sx:d=>({display:"flex",gap:d.spacing.md,justifyContent:o,listStyleType:"none"}),children:e?.map(d=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${d.id}`,"data-active":d.id===l,children:jsxs(Group,{spacing:"sm",children:[t&&jsx(nt,{...d.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:d.label}})]})})}),d?.children?.length?jsx(Menu.Dropdown,{children:c(d.children)}):null]})},d.id))}),Sf(n,"NAV")&&r&&e.length>=1&&jsx(List.Item,{children:jsx(Button,{variant:"outline",onClick:s,children:a?"Downloading":"Download PDF"})})]})},MT=({contentOutline:e,closeNav:t,showIcons:o})=>{let[r,n]=useState(null);return jsx(Stack,{children:e.map(i=>i.children.length?jsxs(Fragment,{children:[jsxs(Group,{spacing:0,noWrap:!0,children:[jsx(UnstyledButton,{w:"100%",component:"a",onClick:t,href:`#bespoke-title-${i.id}`,children:jsxs(Group,{spacing:"sm",noWrap:!0,children:[o&&jsx(nt,{...i.iconProps,iconSize:"sm",iconPadding:"2"}),jsx(Text,{dangerouslySetInnerHTML:{__html:i.label}})]})},i.id),jsx(ActionIcon,{component:"a",size:"lg",onClick:()=>n(a=>a===i.id?null:i.id),children:jsx(IconChevronDown,{style:{transition:"transform 0.2s",transform:r===i.id?"rotate(-180deg)":"none"},stroke:1})})]},i.id),jsx(Collapse,{in:r===i.id,pl:"sm",transitionTimingFunction:"linear",transitionDuration:200,children:jsx(MT,{contentOutline:i.children,closeNav:t,showIcons:o})})]}):jsx(Group,{noWrap:!0,children:jsx(UnstyledButton,{display:"flex",w:"100%",component:"a",href:`#bespoke-title-${i.id}`,children:jsxs(Group,{spacing:"sm",children:[o&&jsx(nt,{...i.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:i.label}})]})},i.id)},i.id))})},ON=({contentOutline:e,showIcons:t})=>{let[o,{toggle:r}]=useDisclosure(!1),n=o?"Close content outline":"Open content outline",{active:i,pdfParam:a}=Ou();return i&&a?jsx(OT,{contentOutline:e}):jsxs(Box,{component:"nav",children:[jsx(Group,{children:jsx(Burger,{opened:o,onClick:r,"aria-label":n,size:"md"})}),jsx(Collapse,{in:o,mt:"md",children:jsx(MT,{contentOutline:e,closeNav:r,showIcons:t})})]})},LN=({contentOutline:e,showIcons:t,align:o})=>{let[r,n]=useState(null),[i,a]=useState(null);useEffect(()=>{let l=()=>{let u=document.querySelector(".bespoke-nav");if(!u)return;let c=u.getBoundingClientRect(),d=!1;e.forEach(m=>{let g=document.getElementById(`bespoke-title-${m.id}`);g&&(g.getBoundingClientRect().top<=c.bottom&&(n(m.id),a(null),d=!0),m.children.forEach(h=>{let b=document.getElementById(`bespoke-title-${h.id}`);b&&b.getBoundingClientRect().top<=c.bottom&&(a(h.id),n(m.id),d=!0);}));}),d||(n(null),a(null));};return window.addEventListener("scroll",l),()=>{window.removeEventListener("scroll",l);}},[e]);let s=l=>!l||!l?.length?null:jsx(Fragment,{children:l.map(u=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${u.id}`,children:jsxs(Group,{spacing:"sm",children:[t&&jsx(nt,{...u.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:u.label}})]})})}),jsx(Box,{pl:"xs",children:s(u.children)})]},u.id))});return jsxs(Box,{component:"nav",className:"bespoke-nav",children:[jsx(List,{className:"bespoke-nav-level1",sx:IT(o),children:e?.map(l=>jsx(List.Item,{children:jsx(Anchor,{href:`#bespoke-title-${l.id}`,"data-active":r===l.id,onClick:()=>n(l.id),children:jsxs(Group,{spacing:"sm",children:[t&&jsx(nt,{...l.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:l.label}})]})})},l.id))}),r&&e.find(l=>l.id===r)?.children.length>0&&jsx(List,{className:"bespoke-nav-level2",sx:IT(o),children:e.find(l=>l.id===r)?.children.map(l=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${l.id}`,"data-active":l.id===i,children:jsxs(Group,{spacing:"sm",children:[t&&jsx(nt,{...l.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:l.label}})]})})}),l?.children?.length?jsx(Menu.Dropdown,{children:s(l.children)}):null]})},l.id))})]})};});function Rf(e){let{related_reports:t,settings:o}=e,r=$(m=>m.status.currentLocale),n=$(m=>m.status.localeDefault),i=Aa(),a=useRouter(),{components:s}=No();if(!t?.length)return;let l=r===n?"":`/${r}`,u=m=>{a.push(`${m}`);},c=s?.ReportTile?s.ReportTile:qm,d=kr(o&&o.align?String(o.align):"center");return jsx(Grid,{justify:d,children:t.map(m=>{let g=`${l}${i}${m.link}`,f=m.entities.map(E=>({original_id:E.id,name:E.name,id:E.content_id,variant:E.variant_name,variant_id:E.variant_id,dimension:E.dimension_name,dimension_id:E.dimension_id,image:{src:`/api/cms/member/image?member=${E.content_id}&size=thumb`,alt:E.name}})),h=m.entities.map(E=>E.id).join("-"),b=m.entities.map(E=>E.name).join(" & "),x=m.entities[0]?m.entities[0].report_id:null,T=E=>{E.preventDefault(),u(g);};return jsx(Grid.Col,{xs:12,sm:6,md:4,lg:4,xl:3,children:jsx(c,{reportId:x,reportName:b,members:f,href:g,onClick:T})},h)})})}var _T=M(()=>{p();ce();Se();Ym();Li();$t();});function If({id:e,label:t,settings:o,showIcon:r,fullWidth:n,showWhenDisabled:i}){let a=Ke(e).data,{sectionVariables:s,resetSectionVariables:l}=ot(a?.section_id),u=!!Object.keys(s).length,c=kr(o&&o.align?o.align:"left");return !u&&!i?null:jsx(Button,{onClick:()=>l(),disabled:!u,fullWidth:n,sx:{justifySelf:c},children:jsxs(Group,{align:"center",children:[t,r&&jsx(IconRefresh,{})]})})}var FT=M(()=>{p();Se();Se();$t();});function Af({settings:e,label:t,removeLabel:o,showIcon:r,position:n="center",asComparison:i=!1}){let a=$(E=>E.records.entities.report),s=$(E=>E.variables.attributes),l=e&&e.search?e.search:"inline",u=Object.values(a)[0].settings,c=useRouter(),{comparisonLoaded:d,loading:m}=sr(),g=Object.keys(c.query).includes("compare"),h=d&&g?jsx(Button,{onClick:()=>{let E={...c.query};delete E.compare,c.push({pathname:c.pathname,query:E},void 0,{shallow:!0});},rightIcon:jsx(IconX,{}),children:o||"Remove Comparison"}):jsx(Button,{loading:m,children:jsxs(Group,{align:"center",children:[t||"Add Comparison",r&&jsx(IconPlus,{})]})}),b={searchReportParams:{report:[Number(Object.keys(a)[0])],variant:u.compareLevels?[]:[s.variant_id1]}},T=Cl(h,l,E=>{c.push({pathname:c.pathname,query:{...c.query,compare:E.reportPath}});},b);return i?null:jsx(Group,{position:n,children:g?h:T})}var $T=M(()=>{p();Zm();ce();Mn();});function Of({columns:e=[],data:t=[],tableProps:o={},sectionId:r=null}){let[n,i]=useState(!1),[a,s]=useState({}),l=useMemo(()=>e.map(m=>m.accessorKey),[e]),u=useMemo(()=>t.filter(m=>typeof m=="object"&&m!==null&&!Array.isArray(m)&&Object.keys(m).some(g=>l.includes(g))),[l,t]),c=useMemo(()=>e.map(m=>({...m,Cell:({renderedCellValue:g})=>jsx(Ce,{html:`${g}`}),filterFn:"contains"})),[e]),{locale:d}=useRouter();return useEffect(()=>{(async()=>{try{let g=d||"en",f=`${g.toUpperCase()}`,h=await import(`mantine-react-table/locales/${g}.js`);s(h[`MRT_Localization_${f}`]);}catch(g){console.error("Error loading translations:",g);}})();},[d]),jsx(MantineReactTable,{...o,autoResetPageIndex:!1,columns:c,data:u,enableColumnFilterModes:!0,enableFilterMatchHighlighting:!1,globalFilterFn:"contains",layoutMode:"grid",localization:a,onIsFullScreenChange:m=>{let g=document.getElementById(`section-${r}`);g&&(m?g.style.zIndex="10":g.style.zIndex="1"),i(m);},state:{...o.state,isFullScreen:n}})}var HT=M(()=>{p();bt();});function Lf({label:e,url:t,settings:o}){let{align:r}=o;return e?jsx(Group,{position:r,grow:r==="justify",children:jsx(Button,{component:"a",target:"_blank",href:t||"",children:e||"Button"})}):null}var WT=M(()=>{p();});function JN({block:e}){let{id:t}=e;return jsxs(Stack,{align:"center",spacing:"sm",children:[jsx(ThemeIcon,{radius:"md",size:100,children:jsx(IconCircleKey,{size:100})}),jsxs(Title,{order:5,children:["Private content (Block ",t,")"]}),jsx(Text,{children:"Sorry, you do not have sufficient permissions to view this block."}),jsx(Text,{children:"Contact your account manager to check your access role."})]})}function Mf(e){let t=QN();return jsx(t,{block:e})}var QN,YT=M(()=>{p();Li();QN=()=>{let{components:e}=No(),t=JN;return e?.CustomFallback&&(t=e.CustomFallback),t};});var e1,t1,XT,o1,zi,Ol=M(()=>{p();Ic();e1=process.env.NEXT_PUBLIC_REPORTS_LOCALE_DEFAULT||"en",t1="Error Rendering Visualization",XT={data:[],dataFormat:e=>e,type:"Treemap",noDataHTML:`<p style="font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;">
104
104
  <strong>${t1}</strong>
105
- </p>`},o1=(e,t,o={},r=e1,n=null,i={},a={})=>{let s;try{s=pa({vars:["variables"],logic:e},t,r,i,a)(o);}catch(m){return console.error(`Parsing Error in propify (ID: ${n})`),console.error(`Error message: ${m.message}`),{error:`${m}`,config:XT}}if(typeof s!="object")return {error:"Visualization JS code must return an object",config:XT};let l=s.dataFormat?s.dataFormat:m=>{let f=Array.isArray(s.data)&&s.data.length>1&&s.data.some(h=>typeof h=="string")?m:[m];return dataConcat(f,"data")};delete s.dataFormat;let u=s.linksFormat||void 0;delete s.linksFormat;let c=s.nodesFormat||void 0;delete s.nodesFormat;let d=s.topojsonFormat||void 0;return delete s.topojsonFormat,{config:s,dataFormat:l,linksFormat:u,nodesFormat:c,topojsonFormat:d}},zi=o1;});var an,zu=M(()=>{p();an=class extends on__default.Component{constructor(t){super(t),this.state={hasError:!1};}static getDerivedStateFromError(t){return {hasError:!0}}componentDidCatch(t,o){console.log("Error information:",o.componentStack),notifications.show({autoClose:!1,color:"red",id:"revalidate-error",message:"Check the console for more details",title:t.message});}render(){return this.state.hasError?this.props.fallback:this.props.children}};});function Ll({config:e}){return !e||!e.html?null:jsx("div",{className:"bespoke-html",dangerouslySetInnerHTML:{__html:e.html}})}var Bf=M(()=>{p();});var ZT={};pd(ZT,{default:()=>QT});function QT(e){let{print:t}=zo(),{block:o,active:r,locale:n,variables:i,configOverride:a={}}=e,s=ro(o),l=no(n),u={variables:i},c=useRouter(),{sectionVariables:d,setSectionVariables:m,resetSectionVariables:g}=ot(o.section_id),f=JSON.stringify(d),h=useMemo(()=>{if(!s?.logic)return {error:"Add a Configuration"};let A=er({logic:s.logic},l,u).logic,C={router:c,section:{variables:d,setVariables:m,resetVariables:g}};return zi(A,l,i,n,o.id,{},C)},[o,r,i,f]),{type:b}=h.config||{},x=b&&Df[b]?b:"Treemap";Df[b]||(h.config={error:`"${b}" is not a valid Visualization Type`});let T=Df[x],E=useMemo(()=>{let{_data:A,...C}=h.config;return l1(C,t)},[h,t]),y={locale:n,variables:i,...E,...a};return jsx("div",{className:"bespoke-Viz",children:jsx("div",{style:{display:"flex",flex:"1 1 100%",minHeight:b==="HTML"?void 0:400},children:jsx(an,{fallback:jsx("p",{children:"Error in d3plus viz config."}),children:jsx(T,{style:{flex:1},dataFormat:A=>{h.data&&Array.isArray(h.data)&&h.data.length>1&&h.data.some(L=>typeof L=="string")?A:[A];let B;try{B=h.dataFormat(A);}catch(L){console.log("Error in dataFormat: ",L),B=[];}return B},linksFormat:h.linksFormat,nodesFormat:h.nodesFormat,topojsonFormat:h.topojsonFormat,config:{...y,sectionVariables:f}},"viz-key")})})})}var Df,l1,eC=M(()=>{p();ho();Ol();ci();Se();Se();zu();Bn();Bf();Df={...a1,HTML:Ll},l1=(e,t)=>{let o={...e};return t&&(o.detectResize=!1,o.detectResizeDelay=0,o.detectVisible=!1,o.detectVisibleInterval=0,o.duration=0,o.shapeConfig={...o.shapeConfig,duration:0}),o};});var u1,tC=M(()=>{p();ye();sx();cx();px();qx();Qx();Zx();eT();yT();BT();_T();FT();$T();HT();WT();YT();u1=c1(()=>Promise.resolve().then(()=>(eC(),ZT)),{ssr:!1}),{[k.PARAGRAPH]:Gm,[k.STAT]:jm,[k.SUBTITLE]:Wm,[k.TITLE]:tf,[k.SELECTOR]:sf,[k.VIZ]:u1,[k.GENERATOR]:ku,[k.SECTION_FLAG]:ku,[k.IMAGE]:lf,[k.NAV]:kf,[k.RELATED]:Rf,[k.RESET_BUTTON]:If,[k.COMPARISON_BUTTON]:Af,[k.TABLE]:Of,[k.BUTTON]:Lf,[k.MULTIHIERARCHY_SELECTOR]:ff,[k.FALLBACK]:Mf};});var oC=M(()=>{p();ye();tC();Bl();ho();Se();ya();li();Ys();kd();wd();Mn();});var Vi,p1,Vu,Dl=M(()=>{p();Vi={margin:{label:"Content Margin",defaultValue:"md",options:[{label:"None",value:"0px"},{label:"Small",value:"sm"},{label:"Medium",value:"md"},{label:"Large",value:"lg"}]},columnGutter:{label:"Column Gutter",defaultValue:"md",options:[{label:"None",value:"0px"},{label:"Small",value:"sm"},{label:"Medium",value:"md"},{label:"Large",value:"lg"}]},width:{label:"Width",defaultValue:"full",options:[{label:"Full Width",value:"full"},{label:"Center",value:"center"}]},position:{label:"Position",defaultValue:"normal",options:[{label:"Normal",value:"normal"},{label:"Sticky",value:"sticky"}]},style:{label:"Style",defaultValue:"none",options:[{label:"None",value:"none"},{label:"Card",value:"card"}]}},p1=Object.keys(Vi).reduce((e,t)=>(e[t]=Vi[t].defaultValue,e),{}),{memberImageBg:!1,optionsMenu:!1,optionData:!0,optionImage:!0,optionShare:!0,showAnchor:!1,...p1},Vu=e=>({data:typeof e.optionData=="boolean"?e.optionData:!0,image:typeof e.optionImage=="boolean"?e.optionImage:!0,share:typeof e.optionShare=="boolean"?e.optionShare:!0});});function Nf({previews:e}){let t=e.map((o,r)=>({key:o?`bg-${o.content_id}`:`bg-${r}`,src:o?`/api/cms/member/image?member=${o.content_id}&size=splash`:""}));return jsxs(Fragment,{children:[jsx(Group,{className:"cms-section-bg",grow:!0,spacing:0,style:{position:"absolute",width:"100%",height:"100%"},children:t.map(o=>jsx("div",{className:"cms-section-member-bg",style:{backgroundImage:`url(${o.src})`,backgroundSize:"cover",backgroundPosition:"center center",height:"100%",width:"100%"}},o.key))}),jsx("div",{className:"cms-section-gradient-bg",style:{background:"white",position:"absolute",width:"100%",height:"100%",opacity:.33}})]})}var Ff=M(()=>{p();});function $u({data:e}){let r=(e&&Array.isArray(e)&&e[0]?Object.keys(e[0]):[]).filter(n=>!n.startsWith("_")).map(n=>({accessorKey:n,header:n,enableSorting:!0,mantineTableBodyCellProps:{sx:{textWrap:"wrap"}}}));return jsx(MantineReactTable,{columns:r,data:e,enableBottomToolbar:!1,enableColumnActions:!1,enablePagination:!1,enableSorting:!0,enableTopToolbar:!1,initialState:{density:"xs"},layoutMode:"grid",mantineTableContainerProps:{sx:{minHeight:100,maxHeight:350}}})}var zf=M(()=>{p();});function lC(e){let{section:t}=e,o=Ar(),r=useRouter(),n=$(V=>V.status.isCMS),i=$(V=>V.status.currentLocale),a=r.locale,s=n?i:a,l=50,u=no(s),c=Yt("options"),d={...sC,...c.data_tab},[m,g]=useState([]),[f,h]=useState([]),[b,x]=useState(),[T,E]=useState(),[y,A]=useState(!1),[C,w]=useState({}),[B,L]=useState(!0),[D,P]=useState(!0),{sectionVariables:_,setSectionVariables:R,resetSectionVariables:O}=ot(t.id),I=t.blocks||[],N=$(V=>V),U=useMemo(()=>I.reduce((V,q)=>{let le=N.records.entities.block[q],W=N.variables.variables[q],te=N.variables.status[q];return (k.GENERATOR===le.type&&W._downloadEnabled===!0&&te.allowed||k.VIZ===le.type&&te.allowed)&&(V[q]={entity:le,variables:N.variables.variables[q],status:N.variables.status[q],inputVariablesFlat:le.inputs.reduce((ne,pe)=>({...ne,...N.variables.variables[pe]}),N.variables.attributes)}),V},{}),[I]),G=V=>{h(q=>q.includes(V)?q:[...q,V]);},Z=V=>{g(q=>(q.find(W=>W.ix===V.ix)?q:[...q,V]).sort((W,te)=>W.ix>te.ix?1:-1));};function H(V){!b&&V[0]&&ee(V[0]);}function ee(V){x(V),E("0");}useEffect(()=>{let V=async(q,le,W)=>{let te=dataLoad.bind({});return new Promise((ne,pe)=>{te(le,null,null,(ve,K)=>{if(ve)pe(ve);else {let re=W instanceof Function?W(K):K;q.data.unshift(re),Z(q),ne(K);}});})};if(m.length===0&&f.length===0){let q=0;for(let le of Object.values(U)){let W=le.entity;if([k.GENERATOR,k.SECTION_FLAG].includes(W.type)){let te=le.variables._downloadData||le.variables._downloadUrl||le.status.api;if(te){let ne=[];typeof te=="string"?ne=te.split(Kr):ne=[te];let pe=le.variables._downloadTitle||`${d.data_source} ${q+1}`,ve=le.variables._downloadFileName||pe;Z({ix:q,id:W.id,title:jt(pe),fileName:ve,data:Array.isArray(ne)?ne:[ne],loading:!1,type:k.GENERATOR}),G(q),q++;}}else if(W.type===k.VIZ){let te=ro(W),ne=le.inputVariablesFlat,pe={variables:ne},ve=er({logic:te.logic},u,pe).logic,K={router:r,section:{variables:_,setVariables:R,resetVariables:O}},re=zi(ve,u,ne,s,W.id,{},K),fe=re.config._downloadTitle||re.config.title||`${d.viz_source} ${q+1}`,De=re.config._downloadFileName||fe;if(re.config._downloadEnabled!==!1)try{let Oe=re.config._downloadUrl||re.config.data,We=typeof Oe=="string"?[Oe]:Oe,Tt=re.dataFormat instanceof Function?re.dataFormat:!1,Bt=re.config._downloadDataFormat instanceof Function?re.config._downloadDataFormat:!1;V({ix:q,id:W.id,title:jt(fe),fileName:De,data:We,loading:!1,type:k.VIZ},Oe,Bt||Tt),G(q),q++;}catch(Oe){console.error("DataLoad catch",Oe);}}}P(!1);}},[U]),useEffect(()=>{m.length===f.length&&H(m);},[m]),useEffect(()=>{if(b&&T){let V=parseInt(T,10);if(b.data[V]&&(!C[b.ix]||!C[b.ix][T])){L(!0);let q=b.data[T];typeof q=="string"?Ad(q,o,s).then(le=>{let W=F1(le);w({...C,[b.ix]:{...C[b.ix],[V]:W}});}).catch(le=>{console.error(le);}).finally(()=>{L(!1);}):(w({...C,[b.ix]:{...C[b.ix],[V]:q}}),L(!1));}}},[T,b]);let ie=(V,q)=>{let le=V===q?"":`-${V}`.toLowerCase();if(b){let W=b.data.length>1&&T?`-${parseInt(T,10)+1}`:"";return `${lo(b.fileName)}${le}${W}.${q.toLowerCase()}`}return `${le}.${q}`},z=async V=>{if(b){A(!0);let q=new k1,le=ie(V,V);try{switch(V){case Gu.json.extension:q.file(le,JSON.stringify(j));break;case Gu.csv.extension:q.file(le,csvFormat(j));break;case Gu.xlsx.extension:let{utils:W,write:te}=await import('xlsx'),ne=W.book_new();W.book_append_sheet(ne,W.json_to_sheet(j),le.substring(0,30));let pe=te(ne,{bookType:"xlsx",bookSST:!0,type:"binary"});q.file(le,pe,{binary:!0});break;default:break}q.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:9}}).then(W=>{A(!1),saveAs(W,ie(V,"zip"));});}catch(W){console.error(d.error_generating,W),A(!1);}}},j=useMemo(()=>b&&C[b.ix]&&C[b.ix][T]?C[b.ix][T]:[],[C,b,T]),J=useMemo(()=>m&&m.length>0&&m.length===f.length&&m.map((V,q)=>jsx(Button,{leftIcon:jsx(IconDatabase,{size:16}),onClick:()=>ee(V),variant:b?.ix===q?"filled":"default",loading:V.loading,disabled:V.loading,children:V.title},`source-${V.id}-${q}`)),[m,b,f]);return jsxs(Stack,{className:"cms-section-options-data",children:[jsx(Space,{h:"xs"}),jsx(LoadingOverlay,{visible:D,overlayBlur:2}),m.length===0&&!D&&jsxs(Alert,{icon:jsx(IconAlertCircle,{size:"1rem"}),title:"Oops!",children:[d.no_data_src," awa"]}),m.length>1&&m.length===f.length&&!D&&jsx(Input.Wrapper,{label:`${d.choose_data_src}:`,children:jsx(Group,{spacing:"xs",children:J})}),b&&T&&jsx(Stack,{spacing:"xs",children:jsx(Input.Wrapper,{label:`${d.preview}
105
+ </p>`},o1=(e,t,o={},r=e1,n=null,i={},a={})=>{let s;try{s=pa({vars:["variables"],logic:e},t,r,i,a)(o);}catch(m){return console.error(`Parsing Error in propify (ID: ${n})`),console.error(`Error message: ${m.message}`),{error:`${m}`,config:XT}}if(typeof s!="object")return {error:"Visualization JS code must return an object",config:XT};let l=s.dataFormat?s.dataFormat:m=>{let f=Array.isArray(s.data)&&s.data.length>1&&s.data.some(h=>typeof h=="string")?m:[m];return dataConcat(f,"data")};delete s.dataFormat;let u=s.linksFormat||void 0;delete s.linksFormat;let c=s.nodesFormat||void 0;delete s.nodesFormat;let d=s.topojsonFormat||void 0;return delete s.topojsonFormat,{config:s,dataFormat:l,linksFormat:u,nodesFormat:c,topojsonFormat:d}},zi=o1;});var an,zu=M(()=>{p();an=class extends on__default.Component{constructor(t){super(t),this.state={hasError:!1};}static getDerivedStateFromError(t){return {hasError:!0}}componentDidCatch(t,o){console.log("Error information:",o.componentStack),notifications.show({autoClose:!1,color:"red",id:"revalidate-error",message:"Check the console for more details",title:t.message});}render(){return this.state.hasError?this.props.fallback:this.props.children}};});function Ll({config:e}){return !e||!e.html?null:jsx("div",{className:"bespoke-html",dangerouslySetInnerHTML:{__html:e.html}})}var Bf=M(()=>{p();});var ZT={};pd(ZT,{default:()=>QT});function QT(e){let{print:t}=zo(),{block:o,active:r,locale:n,variables:i,configOverride:a={}}=e,s=ro(o),l=no(n),u={variables:i},c=useRouter(),{sectionVariables:d,setSectionVariables:m,resetSectionVariables:g}=ot(o.section_id),f=JSON.stringify(d),h=useMemo(()=>{if(!s?.logic)return {error:"Add a Configuration"};let A=er({logic:s.logic},l,u).logic,C={router:c,section:{variables:d,setVariables:m,resetVariables:g}};return zi(A,l,i,n,o.id,{},C)},[o,r,i,f]),{type:b}=h.config||{},x=b&&Df[b]?b:"Treemap";Df[b]||(h.config={error:`"${b}" is not a valid Visualization Type`});let T=Df[x],E=useMemo(()=>{let{_data:A,...C}=h.config;return l1(C,t)},[h,t]),y={locale:n,variables:i,...E,...a};return console.log("vizConfig",y._printIgnore),jsx("div",{className:"bespoke-Viz","data-ignore-print":y._printIgnore?"true":void 0,children:jsx("div",{style:{display:"flex",flex:"1 1 100%",minHeight:b==="HTML"?void 0:400},children:jsx(an,{fallback:jsx("p",{children:"Error in d3plus viz config."}),children:jsx(T,{style:{flex:1},dataFormat:A=>{h.data&&Array.isArray(h.data)&&h.data.length>1&&h.data.some(L=>typeof L=="string")?A:[A];let B;try{B=h.dataFormat(A);}catch(L){console.log("Error in dataFormat: ",L),B=[];}return B},linksFormat:h.linksFormat,nodesFormat:h.nodesFormat,topojsonFormat:h.topojsonFormat,config:{...y,sectionVariables:f}},"viz-key")})})})}var Df,l1,eC=M(()=>{p();ho();Ol();ci();Se();Se();zu();Bn();Bf();Df={...a1,HTML:Ll},l1=(e,t)=>{let o={...e};return t&&(o.detectResize=!1,o.detectResizeDelay=0,o.detectVisible=!1,o.detectVisibleInterval=0,o.duration=0,o.shapeConfig={...o.shapeConfig,duration:0}),o};});var u1,tC=M(()=>{p();ye();sx();cx();px();qx();Qx();Zx();eT();yT();BT();_T();FT();$T();HT();WT();YT();u1=c1(()=>Promise.resolve().then(()=>(eC(),ZT)),{ssr:!1}),{[k.PARAGRAPH]:Gm,[k.STAT]:jm,[k.SUBTITLE]:Wm,[k.TITLE]:tf,[k.SELECTOR]:sf,[k.VIZ]:u1,[k.GENERATOR]:ku,[k.SECTION_FLAG]:ku,[k.IMAGE]:lf,[k.NAV]:kf,[k.RELATED]:Rf,[k.RESET_BUTTON]:If,[k.COMPARISON_BUTTON]:Af,[k.TABLE]:Of,[k.BUTTON]:Lf,[k.MULTIHIERARCHY_SELECTOR]:ff,[k.FALLBACK]:Mf};});var oC=M(()=>{p();ye();tC();Bl();ho();Se();ya();li();Ys();kd();wd();Mn();});var Vi,p1,Vu,Dl=M(()=>{p();Vi={margin:{label:"Content Margin",defaultValue:"md",options:[{label:"None",value:"0px"},{label:"Small",value:"sm"},{label:"Medium",value:"md"},{label:"Large",value:"lg"}]},columnGutter:{label:"Column Gutter",defaultValue:"md",options:[{label:"None",value:"0px"},{label:"Small",value:"sm"},{label:"Medium",value:"md"},{label:"Large",value:"lg"}]},width:{label:"Width",defaultValue:"full",options:[{label:"Full Width",value:"full"},{label:"Center",value:"center"}]},position:{label:"Position",defaultValue:"normal",options:[{label:"Normal",value:"normal"},{label:"Sticky",value:"sticky"}]},style:{label:"Style",defaultValue:"none",options:[{label:"None",value:"none"},{label:"Card",value:"card"}]}},p1=Object.keys(Vi).reduce((e,t)=>(e[t]=Vi[t].defaultValue,e),{}),{memberImageBg:!1,optionsMenu:!1,optionData:!0,optionImage:!0,optionShare:!0,showAnchor:!1,...p1},Vu=e=>({data:typeof e.optionData=="boolean"?e.optionData:!0,image:typeof e.optionImage=="boolean"?e.optionImage:!0,share:typeof e.optionShare=="boolean"?e.optionShare:!0});});function Nf({previews:e}){let t=e.map((o,r)=>({key:o?`bg-${o.content_id}`:`bg-${r}`,src:o?`/api/cms/member/image?member=${o.content_id}&size=splash`:""}));return jsxs(Fragment,{children:[jsx(Group,{className:"cms-section-bg",grow:!0,spacing:0,style:{position:"absolute",width:"100%",height:"100%"},children:t.map(o=>jsx("div",{className:"cms-section-member-bg",style:{backgroundImage:`url(${o.src})`,backgroundSize:"cover",backgroundPosition:"center center",height:"100%",width:"100%"}},o.key))}),jsx("div",{className:"cms-section-gradient-bg",style:{background:"white",position:"absolute",width:"100%",height:"100%",opacity:.33}})]})}var Ff=M(()=>{p();});function $u({data:e}){let r=(e&&Array.isArray(e)&&e[0]?Object.keys(e[0]):[]).filter(n=>!n.startsWith("_")).map(n=>({accessorKey:n,header:n,enableSorting:!0,mantineTableBodyCellProps:{sx:{textWrap:"wrap"}}}));return jsx(MantineReactTable,{columns:r,data:e,enableBottomToolbar:!1,enableColumnActions:!1,enablePagination:!1,enableSorting:!0,enableTopToolbar:!1,initialState:{density:"xs"},layoutMode:"grid",mantineTableContainerProps:{sx:{minHeight:100,maxHeight:350}}})}var zf=M(()=>{p();});function lC(e){let{section:t}=e,o=Ar(),r=useRouter(),n=$(V=>V.status.isCMS),i=$(V=>V.status.currentLocale),a=r.locale,s=n?i:a,l=50,u=no(s),c=Yt("options"),d={...sC,...c.data_tab},[m,g]=useState([]),[f,h]=useState([]),[b,x]=useState(),[T,E]=useState(),[y,A]=useState(!1),[C,w]=useState({}),[B,L]=useState(!0),[D,P]=useState(!0),{sectionVariables:_,setSectionVariables:R,resetSectionVariables:O}=ot(t.id),I=t.blocks||[],N=$(V=>V),U=useMemo(()=>I.reduce((V,q)=>{let le=N.records.entities.block[q],W=N.variables.variables[q],te=N.variables.status[q];return (k.GENERATOR===le.type&&W._downloadEnabled===!0&&te.allowed||k.VIZ===le.type&&te.allowed)&&(V[q]={entity:le,variables:N.variables.variables[q],status:N.variables.status[q],inputVariablesFlat:le.inputs.reduce((ne,pe)=>({...ne,...N.variables.variables[pe]}),N.variables.attributes)}),V},{}),[I]),G=V=>{h(q=>q.includes(V)?q:[...q,V]);},Z=V=>{g(q=>(q.find(W=>W.ix===V.ix)?q:[...q,V]).sort((W,te)=>W.ix>te.ix?1:-1));};function H(V){!b&&V[0]&&ee(V[0]);}function ee(V){x(V),E("0");}useEffect(()=>{let V=async(q,le,W)=>{let te=dataLoad.bind({});return new Promise((ne,pe)=>{te(le,null,null,(ve,K)=>{if(ve)pe(ve);else {let re=W instanceof Function?W(K):K;q.data.unshift(re),Z(q),ne(K);}});})};if(m.length===0&&f.length===0){let q=0;for(let le of Object.values(U)){let W=le.entity;if([k.GENERATOR,k.SECTION_FLAG].includes(W.type)){let te=le.variables._downloadData||le.variables._downloadUrl||le.status.api;if(te){let ne=[];typeof te=="string"?ne=te.split(Kr):ne=[te];let pe=le.variables._downloadTitle||`${d.data_source} ${q+1}`,ve=le.variables._downloadFileName||pe;Z({ix:q,id:W.id,title:jt(pe),fileName:ve,data:Array.isArray(ne)?ne:[ne],loading:!1,type:k.GENERATOR}),G(q),q++;}}else if(W.type===k.VIZ){let te=ro(W),ne=le.inputVariablesFlat,pe={variables:ne},ve=er({logic:te.logic},u,pe).logic,K={router:r,section:{variables:_,setVariables:R,resetVariables:O}},re=zi(ve,u,ne,s,W.id,{},K),fe=re.config._downloadTitle||re.config.title||`${d.viz_source} ${q+1}`,De=re.config._downloadFileName||fe;if(re.config._downloadEnabled!==!1)try{let Oe=re.config._downloadUrl||re.config.data,We=typeof Oe=="string"?[Oe]:Oe,Tt=re.dataFormat instanceof Function?re.dataFormat:!1,Bt=re.config._downloadDataFormat instanceof Function?re.config._downloadDataFormat:!1;V({ix:q,id:W.id,title:jt(fe),fileName:De,data:We,loading:!1,type:k.VIZ},Oe,Bt||Tt),G(q),q++;}catch(Oe){console.error("DataLoad catch",Oe);}}}P(!1);}},[U]),useEffect(()=>{m.length===f.length&&H(m);},[m]),useEffect(()=>{if(b&&T){let V=parseInt(T,10);if(b.data[V]&&(!C[b.ix]||!C[b.ix][T])){L(!0);let q=b.data[T];typeof q=="string"?Ad(q,o,s).then(le=>{let W=F1(le);w({...C,[b.ix]:{...C[b.ix],[V]:W}});}).catch(le=>{console.error(le);}).finally(()=>{L(!1);}):(w({...C,[b.ix]:{...C[b.ix],[V]:q}}),L(!1));}}},[T,b]);let ie=(V,q)=>{let le=V===q?"":`-${V}`.toLowerCase();if(b){let W=b.data.length>1&&T?`-${parseInt(T,10)+1}`:"";return `${lo(b.fileName)}${le}${W}.${q.toLowerCase()}`}return `${le}.${q}`},z=async V=>{if(b){A(!0);let q=new k1,le=ie(V,V);try{switch(V){case Gu.json.extension:q.file(le,JSON.stringify(j));break;case Gu.csv.extension:q.file(le,csvFormat(j));break;case Gu.xlsx.extension:let{utils:W,write:te}=await import('xlsx'),ne=W.book_new();W.book_append_sheet(ne,W.json_to_sheet(j),le.substring(0,30));let pe=te(ne,{bookType:"xlsx",bookSST:!0,type:"binary"});q.file(le,pe,{binary:!0});break;default:break}q.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:9}}).then(W=>{A(!1),saveAs(W,ie(V,"zip"));});}catch(W){console.error(d.error_generating,W),A(!1);}}},j=useMemo(()=>b&&C[b.ix]&&C[b.ix][T]?C[b.ix][T]:[],[C,b,T]),J=useMemo(()=>m&&m.length>0&&m.length===f.length&&m.map((V,q)=>jsx(Button,{leftIcon:jsx(IconDatabase,{size:16}),onClick:()=>ee(V),variant:b?.ix===q?"filled":"default",loading:V.loading,disabled:V.loading,children:V.title},`source-${V.id}-${q}`)),[m,b,f]);return jsxs(Stack,{className:"cms-section-options-data",children:[jsx(Space,{h:"xs"}),jsx(LoadingOverlay,{visible:D,overlayBlur:2}),m.length===0&&!D&&jsxs(Alert,{icon:jsx(IconAlertCircle,{size:"1rem"}),title:"Oops!",children:[d.no_data_src," awa"]}),m.length>1&&m.length===f.length&&!D&&jsx(Input.Wrapper,{label:`${d.choose_data_src}:`,children:jsx(Group,{spacing:"xs",children:J})}),b&&T&&jsx(Stack,{spacing:"xs",children:jsx(Input.Wrapper,{label:`${d.preview}
106
106
  ${j.length>l?d.rows_preview.replace("{nrows}",l):""}:`,children:jsxs(Group,{spacing:"xs",children:[jsx(Select,{disabled:!(b.data.length>1),style:{flex:"1"},value:T,onChange:V=>E(V),data:b.data.map((V,q)=>({value:`${q}`,group:typeof V=="string"?d.raw_group:d.formatted_group,label:typeof V=="string"?V:d.formatted_src.replace("{src}",b.title)})),icon:typeof b.data[T]=="string"?jsx(IconLink,{}):jsx(IconSparkles,{})}),jsx(CopyButton,{value:typeof b.data[T]=="string"?b.data[T]:"",timeout:2e3,children:({copied:V,copy:q})=>jsx(Tooltip,{label:V?d.copied:d.copy,withArrow:!0,position:"top",children:jsx(ActionIcon,{variant:V?"filled":"subtle",onClick:q,disabled:typeof b.data[T]!="string",children:V?jsx(IconClipboardCheck,{size:16}):jsx(IconClipboardCopy,{size:16})})})})]})})}),b&&!B&&j.length===0&&jsx(Alert,{icon:jsx(IconAlertCircle,{size:"1rem"}),title:"Oops!",children:d.error_preview}),b&&T&&!B&&j.length===0&&jsx("a",{href:b.data[T],target:"_blank",rel:"noreferrer",children:jsx(Button,{leftIcon:jsx(IconExternalLink,{size:16}),fullWidth:!0,children:d.open_in_window.replace("{src}",b.title)})}),jsxs(Stack,{pos:"relative",mih:"430px",children:[jsx(LoadingOverlay,{visible:B&&m.length>0,overlayBlur:2}),b&&!B&&j.length>0&&jsxs(Fragment,{children:[jsx(Box,{h:"350px",children:jsx($u,{data:j.slice(0,l)})}),jsx(Input.Wrapper,{label:`${d.download}:`,children:jsx(Button.Group,{children:Object.values(Gu).map(V=>jsx(Button,{leftIcon:jsx(V.icon,{size:24}),onClick:()=>z(V.extension),loading:y,fullWidth:!0,children:V.extension},`format-${V.extension}`))})})]})]})]})}var Gu,sC,F1,Hf=M(()=>{p();ce();zf();ye();Ol();An();ll();ho();Se();ci();Yr();Bi();qr();wr();Gu={csv:{extension:"CSV",icon:IconFileTypeCsv},json:{extension:"JSON",icon:IconFileTypeJs},xlsx:{extension:"XLSX",icon:IconFileTypeXls}},sC={data_source:"Data Source",no_data_src:"No data sources defined",viz_source:"Visualization Source",error_generating:"Error generating file.",choose_data_src:"Choose data source",original_src:"Original {src}",loading:"Loading...",error_preview:`Sorry. We could not generate the data preview as a table.
107
107
  Try to open the source and check the data directly.`,open_in_window:"Open {src} response in a new window",formatted_src:"Formatted {src}",formatted_group:"Formatted Data",raw_group:"Raw Data",rows_preview:"(First {nrows} rows as preview)",choose_format:"Choose format",processing_file:"Processing file...",download:"Download data as",preview:"Preview",copy:"Click to copy",copied:"Copied!"},F1=e=>{let t=[];return e&&e.data&&(e.data&&Array.isArray(e.data)?t=e.data:e.data&&e.data.data&&Array.isArray(e.data.data)?t=e.data.data:e.data&&e.data.data&&e.data.data.results&&Array.isArray(e.data.data.results)?t=e.data.data.results:e.data&&e.data.results&&Array.isArray(e.data.results)&&(t=e.data.results)),t};});function dC(e){let{section:t}=e,o=t.blocks||[],r=$(W=>o.map(te=>W.records.entities.block[te]).filter(te=>te.type===k.VIZ&&W.variables.status[te.id].allowed)),{variant_slug1:n,slug1:i}=$(W=>W.variables.attributes),a=wT(),[s,l]=useState(ur.section),[u,c]=useState(pr.png),[d,m]=useState(!1),[g,f]=useState(!1),[h,b]=useState([]),[x,T]=useState(r.length>0?r[0].id:null),E=s!==ur.section,{print:y,downloadLoading:A,error:C}=ET(t.id,n,i,E?x:null),[w,B]=useState(!0),[L,D]=useState(!1),P=Yt("options"),_={...nF,...P.image_tab},{siteProps:R}=Ba(),O=R?.logoSrc&&typeof R.logoSrc=="string",I=t?.settings?.name||`section-${t.id}`,N=`#${I}`,U=useMantineTheme(),G=()=>{let W=ee(x);return select(W).select("svg").size()===1},Z=()=>`${lo(I)}`,H=()=>{let W=document.getElementById(I);return select(W).select(".bespoke-section-content").node()},ee=W=>{let te=H();return select(te).select(`#bespoke-visualization-${W}.bespoke-block-area`).node()},ie=()=>new Promise(W=>{let te;s===ur.section?te=H():s===ur.viz&&(te=ee(x));let ne=document.createElement("div");ne.style.display="flex",ne.style.justifyContent="space-between",ne.classList.add("bespoke-Viz-source"),ne.style.padding=U.spacing.xs,ne.style.width="100%";let pe=document.createElement("div");if(pe.innerText=_.source.replace("{src}",`${window.location}${N}`),pe.style.fontSize=U.fontSizes.xs,ne.appendChild(pe),O){let ve=document.createElement("img");ve.src=R.logoSrc,ve.style.height="30px",ve.onload=()=>W(te),ve.onerror=()=>{ve.remove(),W(te);},ne.appendChild(ve),te.appendChild(ne);}else te.appendChild(ne),W(te);}),z=W=>{if(w)return "transparent";let te=select(W).style("background-color");return te!=="rgba(0, 0, 0, 0)"&&te!=="transparent"?te:W===document.body?"white":z(W.parentNode)},j=async(W,te)=>{let{toPng:ne}=await import('html-to-image');ne(W,{backgroundColor:te.background,cacheBust:!0,filter:pe=>pe&&pe.classList?!te.exclusionClasses.some(ve=>pe.classList.contains(ve)):!0}).then(pe=>{let ve=document.createElement("a");ve.download=`${te.filename}.png`,ve.href=pe,ve.click(),rF(),m(!1);}).catch(pe=>{console.log(pe);});},J=(W,te)=>{saveElement(W,{filename:te.filename,type:"svg",callback:()=>m(!1)},{background:te.background});},V=async()=>{m(!0);let W=await ie(),te={background:z(W),exclusionClasses:["export-hidden"],filename:Z()},ne=u===pr.png?j:J;try{if(W)ne(W,te);else throw new Error(_.wrong_node)}catch{m(!1);}},q=async()=>{let{toCanvas:W}=await import('html-to-image');Promise.all(r.map(te=>{let ne=ee(te.id),pe=ne.querySelector("g.d3plus-geomap-tileGroup");return pe.style.display="none",W(ne).then(ve=>(pe.style.display="block",ve))})).then(te=>{b(te.map(ne=>ne.toDataURL())),D(!1);});};useEffect(()=>{s===ur.viz&&r.length>0?(T(r[0].id),D(!0),q()):s===ur.section&&b([]);},[s]),useEffect(()=>{x&&(G()?f(!0):(f(!1),c(pr.png)));},[x]);useRouter();return jsxs(Stack,{className:"cms-section-options-image",children:[jsx(Space,{h:"xs"}),r.length>0?jsx(Input.Wrapper,{label:`${_.choose_area}:`,children:jsx(SegmentedControl,{fullWidth:!0,value:s,data:[{value:ur.section,label:jsxs(Center,{children:[jsx(IconTemplate,{size:"1rem"}),jsx(Box,{ml:10,children:_.entire_section})]})},{value:ur.viz,label:jsxs(Center,{children:[jsx(IconChartBar,{size:"1rem"}),jsx(Box,{ml:10,children:_.viz_only})]})}],onChange:W=>{l(W),W===ur.section&&c(pr.png);}})}):jsx(Text,{fw:"700",color:"gray.7",children:`${_.entire_section}:`}),s===ur.viz&&r.length>0&&jsxs(Input.Wrapper,{label:`${_.choose_viz}:`,style:{minHeight:"161px",position:"relative"},children:[!L&&h.length>0&&jsx(ScrollArea,{style:{height:250},children:jsx(SimpleGrid,{cols:3,children:r.map((W,te)=>jsx(Image,{alt:`Viz ${W.id}`,onClick:()=>{T(W.id);},style:{cursor:"pointer",border:x===W.id?"4px solid #228be6":"4px solid #eee"},radius:0,src:h[te],withPlaceholder:!0},`viz-option-${W.id}`))})}),jsx(LoadingOverlay,{visible:L})]}),g&&s!==ur.section&&jsx(Input.Wrapper,{label:`${_.choose_format}:`,children:jsxs(Button.Group,{children:[jsx(Button,{leftIcon:jsx(IconPolaroid,{size:16}),onClick:()=>c(pr.png),variant:u===pr.png?"filled":"default",fullWidth:!0,children:pr.png}),jsx(Button,{leftIcon:jsx(IconCode,{size:16}),onClick:()=>c(pr.svg),variant:u===pr.svg?"filled":"default",fullWidth:!0,children:pr.svg})]})}),jsx(Checkbox,{checked:w,label:`${_.transparent_bg}`,onChange:()=>B(!w),radius:"xl"}),jsx(Button,{leftIcon:jsx(IconDownload,{size:16}),loading:d||A,onClick:a&&u!==pr.svg?()=>y(w):V,fullWidth:!0,children:jsx("span",{children:d||A?_.processing:_.download.replace("{imageFormat}",u)})})]})}var ur,pr,rF,nF,mC=M(()=>{p();An();ce();wr();Et();Nu();ye();ur={viz:"viz",section:"section"},pr={png:"PNG",svg:"SVG"},rF=()=>{let e=document.getElementsByClassName("bespoke-Viz-source");Array.from(e).forEach(t=>t.remove());},nF={wrong_node:"Wrong node in export",choose_area:"Choose image area",choose_viz:"Choose visualization",choose_format:"Choose format",transparent_bg:"Transparent background",processing:"Processing image...",download:"Download {imageFormat}",entire_section:"Entire section",viz_only:"Visualization only",source:"Source: {src}"};});function gC(e){let{title:t,url:o,disabled:r=!1}=e,n=r?IconCode:IconLink;return jsx(Input.Wrapper,{label:t,children:jsx(Input,{icon:jsx(n,{}),value:o,disabled:r,readOnly:!0,rightSection:jsx(CopyButton,{value:o,timeout:2e3,children:({copied:i,copy:a})=>jsx(Tooltip,{label:i?"Copied":"Copy",withArrow:!0,position:"right",children:jsx(ActionIcon,{variant:i?"filled":"subtle",onClick:a,disabled:r,children:i?jsx(IconClipboardCheck,{size:16}):jsx(IconClipboardCopy,{size:16})})})})})})}var hC=M(()=>{p();});function yC(e){let{section:t}=e,[o,r]=useState(""),[n,i]=useState(""),[a,s]=useState(!0),l=Yt("options"),u={...OF,...l.share_tab};return useEffect(()=>{i(document.title);let{origin:c,pathname:d}=window.location,m=`${c}${d}`,g=a?t.settings?.name?.length?`#${lo(t.settings.name)}`:`#section-${t.id}`:"";r(`${m}${g}`);},[a]),jsxs(Stack,{className:"cms-section-options-share",children:[jsx(Space,{h:"xs"}),jsx(gC,{title:`${u.title}: ${n}`,url:o}),jsx(Checkbox,{checked:a,label:u.include_section,onChange:()=>s(!a),radius:"xl"}),jsxs(Group,{position:"center",children:[jsx(FacebookShareButton,{url:o,quote:n,children:jsx(FacebookIcon,{size:32,round:!0})}),jsx(TwitterShareButton,{url:o,title:n,children:jsx(TwitterIcon,{size:32,round:!0})}),jsx(TelegramShareButton,{url:o,title:n,children:jsx(TelegramIcon,{size:32,round:!0})}),jsx(WhatsappShareButton,{url:o,title:n,separator:":: ",children:jsx(WhatsappIcon,{size:32,round:!0})}),jsx(LinkedinShareButton,{url:o,children:jsx(LinkedinIcon,{size:32,round:!0})}),jsx(RedditShareButton,{url:o,title:n,windowWidth:660,windowHeight:460,children:jsx(RedditIcon,{size:32,round:!0})}),jsx(EmailShareButton,{url:o,subject:n,children:jsx(EmailIcon,{size:32,round:!0})})]})]})}var OF,vC=M(()=>{p();hC();wr();An();OF={title:"Title",include_section:"Include Section"};});function TC(e){let{section:t,initialMode:o,onEnds:r,open:n,title:i}=e,a=Vu(t.settings),s=useMemo(()=>DF.filter(g=>a[g]),[a]),[l,u]=useState(o||s[0]||"data"),c=Yt("options");useEffect(()=>{o!==l&&u(o);},[o]);let d={...Kf,...c},m=useMemo(()=>jsxs(Fragment,{children:[jsxs(Tabs.List,{children:[a.data&&jsx(Tabs.Tab,{value:"data",children:d.download_title}),a.image&&jsx(Tabs.Tab,{value:"image",children:d.image_title}),a.share&&jsx(Tabs.Tab,{value:"share",children:d.share_title})]}),a.data&&jsx(Tabs.Panel,{value:"data",children:jsx(lC,{section:t})}),a.image&&jsx(Tabs.Panel,{value:"image",children:jsx(dC,{section:t})}),a.share&&jsx(Tabs.Panel,{value:"share",children:jsx(yC,{section:t})})]}),[a,t,d]);return jsx("div",{className:"cms-section-options-modal",children:n&&jsx(Modal,{className:"bespoke-options-modal",opened:!0,onClose:()=>r(),size:"xl",title:i,children:jsx(Tabs,{onTabChange:u,value:l,keepMounted:!1,children:m})})})}var Kf,DF,CC=M(()=>{p();Hf();mC();vC();wr();Dl();Kf={download_title:"Download Data",image_title:"Save Image",share_title:"Share Link"},DF=["data","image","share"];});function qf(e){let{sectionId:t,disabled:o=!1}=e,[r,n]=useState(!1),[i,a]=useState("data"),s=ir(t),l=Yt("options"),u={...Kf,...l},c=Vu(s.isSuccess?s.data.settings:{}),d=g=>{a(g),n(!0);},m=()=>{n(!1);};return jsxs("div",{className:"cms-section-options",children:[jsxs(Button.Group,{children:[c.data&&jsx(Button,{variant:"default",size:"xs",compact:!0,onClick:()=>d("data"),"aria-label":u.download_title,disabled:o,children:jsx(IconTable,{size:16})}),c.image&&jsx(Button,{variant:"default",size:"xs",compact:!0,onClick:()=>d("image"),"aria-label":u.image_title,disabled:o,children:jsx(IconCamera,{size:16})}),c.share&&jsx(Button,{variant:"default",size:"xs",compact:!0,onClick:()=>d("share"),"aria-label":u.share_title,disabled:o,children:jsx(IconShare,{size:16})})]}),s.isSuccess&&jsx(TC,{section:s.data,initialMode:i,open:r,onEnds:m})]})}var Yf=M(()=>{p();CC();ce();wr();Dl();});function jF({children:e,containerProps:t},o){return jsx(Flex,{ref:o,className:"bespoke-section-content",pos:"relative",align:"stretch",p:0,direction:{base:"column",md:"row"},wrap:"wrap",...t,children:e})}var Xf,IC,Jf,Qf=M(()=>{p();ce();_i();Xf=on__default.forwardRef(function({children:t,column:o,basis:r,columnSettings:n={},sx:i={},...a},s){let l=Object.values(o).some(m=>m.settings?.display==="inline"),u=n?.width?`${n.width}px`:r,c=n?.width?`${n?.width}px`:"100%",d=n?.full?"100%":c;return jsx(Flex,{ref:s,className:"bespoke-section-col",align:"flex-start",direction:l?"row":"column",wrap:l?"wrap":"nowrap",maw:{base:"100%",md:d},miw:{base:"none",md:300},p:0,pos:"relative",sx:[{flexGrow:1,flexShrink:n?.full?0:1,flexBasis:n?.full?"100%":u},...packSx(i)],...a,children:t})}),IC=({sectionId:e,columnIndex:t})=>{let o=se(),r=ir(e).data,{settings:n,updateSettings:i}=rn(e);if(!r)return null;let{columnSettings:a={}}=n,{width:s=void 0}=a[t]?a[t]:{},l=d=>{r&&i("columnSettings",{...a,[t]:{width:parseInt(d.target.value,10)}});},u=()=>{r&&o(Q.updateEntity("section",{id:e,settings:{...r.settings,columnSettings:{...a,[t]:{width:void 0}}}}));};return jsxs(Group,{className:"bespoke-resize-col",pos:"absolute",top:-12,left:"50%",sx:{borderRadius:"4px",transform:"translate(-50%, 0%)",zIndex:20},py:0,px:"xs",maw:180,bg:"white",noWrap:!0,children:[jsx(Checkbox,{label:"100%",size:"xs",onChange:d=>{i("columnSettings",{...a,[t]:{...a[t]||{},full:d.currentTarget.checked}});},checked:a[t]?.full}),jsx(Input,{placeholder:"auto",w:"fit-content",miw:"none",variant:"filled",type:"number",value:s||"auto",maw:110,onChange:l,size:"xs",p:0,rightSection:jsx(IconX,{onClick:u,size:8})})]})},Jf=on__default.forwardRef(jF);});var Un,Ku=M(()=>{p();Un={backgroundColor:"#fafafa",block:{padding:10},column:{padding:12},section:{backgroundColor:"white",borderRadius:10,boxShadow:"0px 6px 10px rgba(12, 32, 50, 0.14), 0px 1px 15px rgba(12, 32, 50, 0.12), 0px 3px 5px rgba(12, 32, 50, 0.15)",margin:8,padding:32}};});var AC=M(()=>{p();Bn();});var PC=M(()=>{p();});var OC=M(()=>{p();ce();Jr();oC();Dl();Qo();Ff();Yf();Li();ye();Qf();yl();Ku();Bn();wr();AC();Mn();An();Et();PC();});var LC=M(()=>{p();Te();ae({name:"abbreviate",description:"Abbreviates a number into a smaller more human-readable number.",logicFactory(e){return t=>e.d3plus.formatAbbreviate(t)},inputType:"number",testValue:"123456",type:"formatter"});});var MC=M(()=>{p();Te();ae({name:"abs",description:"Simple Absolute Value.",logicFactory(e){return t=>Math.abs(t)},inputType:"number",testValue:"-123",type:"formatter"});});var YF,BC=M(()=>{p();Te();YF=()=>function(t){let r=new RegExp(/([\$0-9\,]+)[A-z\-\s\&]*([\$0-9\,]*)/g).exec(t);return r?(r=r.slice(1).filter(n=>n.length).map(n=>(n.includes(",")&&(n.indexOf(",")===n.length-4?n=n.replace(/,000$/g,"k").replace(/([0-9]+)(,999$)/g,i=>`${parseInt(i)+1}k`):n.indexOf(",")===n.length-8&&(n=n.replace(/,000,000$/g,"M").replace(/([0-9]+)(,999,999$)/g,i=>`${parseInt(i)+1}M`))),n)),r.length===2?r.join(" - "):t.toLowerCase().match(/under|less|\</g)?`< ${r[0]}`:t.toLowerCase().match(/over|more|\+|\>/g)?`${r[0]}+`:`${r[0]}`):"None"},ae({name:"bucket",description:"Sanitizes bucket strings to '< n', 'n1 - n2', and 'n+'",logicFactory:YF,inputType:"number",testValue:"1234",type:"formatter"});});var DC=M(()=>{p();Te();ae({name:"commas",description:"* Rounds to nearest whole number and adds commas.",logicFactory(e){return t=>e.d3.format(",")(Math.round(t))},inputType:"number",testValue:"1234.6",type:"formatter"});});var _C=M(()=>{p();Te();ae({name:"date",description:"Formats a date into '%B %d, %Y' format.",logicFactory(e){return t=>(typeof t=="string"&&(t=e.d3plus.date(t)),e.d3.timeFormat("%B %d, %Y")(t))},inputType:"date",testValue:"2022-01-01",type:"formatter"});});var NC=M(()=>{p();Te();ae({name:"dollar",description:"Adds a US dollar sign to the beginning of a String or Number.",logicFactory(e){return t=>(typeof t=="number"&&(t=e.d3plus.formatAbbreviate(t)),t.charAt(0)==="-"?t.replace("-","-$"):`$${t}`)},inputType:"number",testValue:"123",type:"formatter"});});var FC=M(()=>{p();Te();ae({name:"formatFieldName",description:"Based on field name returns a string",logicFactory(e){return t=>{if(t.contentType.toLowerCase()==="stat"){if(t.field==="title")return "Stat label";if(t.field==="value")return "Stat value";if(t.field==="subtitle")return "Stat subtitle";if(t.field==="tooltip")return "Tooltip text"}return t.contentType.toLowerCase()==="section"&&t.field==="short"?"Short title":t.contentType.toLowerCase()==="description"&&t.field==="description"?"Paragraph":t.field}},inputType:"object",testValue:'{"field":"title","contentType":"stat"}',type:"formatter"});});var zC=M(()=>{p();Te();ae({name:"grewTo",description:"Returns the text with grow direction: 'declined from', 'grew to' o 'stayed at'",logicFactory(e){return t=>t<0?"declined from":t>0?"grew to":"stayed at"},inputType:"number",testValue:"-1234",type:"formatter"});});var VC=M(()=>{p();Te();ae({name:"grewWord",description:"Returns either 'grew', 'declined', or 'stayed' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"declined":t>0?"grew":"stayed"},inputType:"number",testValue:"-1234",type:"formatter"});});var $C=M(()=>{p();Te();ae({name:"growing",description:"Returns either 'declining', 'growing' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"declining":"growing"},inputType:"number",testValue:"-1234",type:"formatter"});});var nz,UC=M(()=>{p();Te();nz=()=>function(t){let{curr:o,currMoe:r=0,prev:n,prevMoe:i=0}=t,a;if(r||i){let s=(-n/o**2)**2*r**2,l=(1/o)**2*i**2;a=Math.sqrt(s+l);}else a=(o-n)/n;return a*100},ae({name:"growth",description:"Calculates the growth percentage between two numbers provided the following object format: {curr, prev}. Also supports calculating the growth between two margin of errors using this format: {curr, currMoe, prev, prevMoe}",logicFactory:nz,inputType:"object",testValue:'{"curr":10,"currMoe":0,"prev":13,"prevMoe":0}',type:"formatter"});});var GC=M(()=>{p();Te();ae({name:"growthPct",description:"Abbreviates a growth value, turns it absolute, and adds a percent sign.",logicFactory(e){return t=>`${e.d3plus.formatAbbreviate(Math.abs(t))}%`},inputType:"number",testValue:"12345",type:"formatter"});});var HC=M(()=>{p();Te();ae({name:"growthWord",description:"Returns either 'growth' or 'decline' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"decline":"growth"},inputType:"number",testValue:"-1234",type:"formatter"});});var jC=M(()=>{p();Te();ae({name:"highWord",description:"Returns either 'higher than', 'lower than', or 'approximately the same as' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"lower than":t>0?"higher than":"approximately the same as"},inputType:"number",testValue:"0",type:"formatter"});});var WC=M(()=>{p();Te();ae({name:"increaseWord",description:"Returns either 'increase', 'decrease', or 'change' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"decrease":t>0?"increase":"change"},inputType:"number",testValue:"1234",type:"formatter"});});var KC=M(()=>{p();Te();ae({name:"increasedWord",description:"Returns either 'increased', 'decreased', or 'remained the same' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"decreased":t>0?"increased":"remained the same"},inputType:"number",testValue:"0",type:"formatter"});});var qC=M(()=>{p();Te();ae({name:"increasing",description:"Returns either 'decreasing', 'increasing' or 'maintaining' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"decreasing":t>0?"increasing":"maintaining"},inputType:"number",testValue:"-1234",type:"formatter"});});var YC=M(()=>{p();Te();ae({name:"largerThan",description:"Returns either 'higher than', 'lower than', or 'approximately the same as' depending on the provided number's sign",logicFactory(e){return t=>t<0?"smaller than":t>0?"larger than":"the same as"},inputType:"number",testValue:"-1234",type:"formatter"});});var XC=M(()=>{p();Te();ae({name:"list",description:"Joins an array of strings together, adding commas and 'and' when necessary.",logicFactory(e){return t=>t.reduce((o,r,n)=>(n?n===t.length-1&&n===1?o+=` and ${r}`:n===t.length-1?o+=`, and ${r}`:o+=`, ${r}`:o+=r,o),"")},inputType:"object",testValue:'["foo","bar","bee"]',type:"formatter"});});var JC=M(()=>{p();Te();ae({name:"longWord",description:"",logicFactory(e){return t=>t<0?"shorter":t>0?"longer":"similar"},inputType:"number",testValue:"5",type:"formatter"});});var QC=M(()=>{p();Te();ae({name:"lowerCaseFirst",description:"Converts the first letter of a string to lowercase",logicFactory(e){return t=>typeof t=="string"?t.charAt(0).toLowerCase()+t.slice(1):t},inputType:"string",testValue:"foo",type:"formatter"});});var ZC=M(()=>{p();Te();ae({name:"moreFewerWord",description:"",logicFactory(e){return t=>t<0?"fewer":"more"},inputType:"number",testValue:"-5",type:"formatter"});});var ek=M(()=>{p();Te();ae({name:"moreLess",description:"Returns either 'more' or 'less' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"less":"more"},inputType:"number",testValue:"-5",type:"formatter"});});var tk=M(()=>{p();Te();ae({name:"moreLess",description:"Returns either 'more than', 'less than', or 'approximately the same' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"less than":t>0?"more than":"approximately the same"},inputType:"number",testValue:"-5",type:"formatter"});});var ok=M(()=>{p();Te();ae({name:"olderWord",description:"",logicFactory(e){return t=>t<0?"getting younger":t>0?"getting older":"staying the same age"},inputType:"number",testValue:"-5",type:"formatter"});});var rk=M(()=>{p();Te();ae({name:"olderYounger",description:"",logicFactory(e){return t=>t<0?"younger than":t>0?"older than":"the same age as"},inputType:"number",testValue:"-5",type:"formatter"});});var nk=M(()=>{p();Te();ae({name:"plural",description:"Pluralizes a word.",logicFactory(e){return t=>t.replace(/\w$/g,o=>o==="y"?"ies":`${o}s`)},inputType:"string",testValue:"Foo",type:"formatter"});});var ik=M(()=>{p();Te();ae({name:"pxToInt",description:"Takes a pixel value and converts it to an integer",logicFactory(e){return t=>parseInt(t.replace(/\D+/g,""),10)},inputType:"string",testValue:"12px",type:"formatter"});});var ak=M(()=>{p();Te();ae({name:"salary",description:"Displays salary values with proper precision (ie. '$74,200' instead of '$74.2k')",logicFactory(e){return t=>{let o;return t<1e6?o=e.d3.format(",")(t.toFixed(0)):o=e.d3plus.formatAbbreviate(t),`$${o}`}},inputType:"number",testValue:"1000000",type:"formatter"});});var sk=M(()=>{p();Te();ae({name:"stripEntities",description:"Removes non breaking spaces & other html entities from a string",logicFactory(e){return t=>typeof t=="string"?String(t).replace(/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});/ig," "):t},inputType:"string",testValue:"<b>MyText</b>",type:"formatter"});});var ck=M(()=>{p();Te();ae({name:"stripHTML",description:"Converts html tags to spaces, then removes redundant spaces",logicFactory(e){return t=>{let o={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'","&#x60;":"`","&nbsp;":""},r=`(?:${Object.keys(o).join("|")})`,n=RegExp(r),i=RegExp(r,"g"),a=String(t).replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();return n.test(a)?a.replace(i,s=>o[s]):a}},inputType:"string",testValue:"<b>My text</b>",type:"formatter"});});var uk=M(()=>{p();Te();ae({name:"stripOL",description:"Removes ordered list wrapper tags from a string.",logicFactory(e){return t=>t.replace(/<ol>/g,"").replace(/<\/ol>/g,"")},inputType:"string",testValue:"<ol><li>My list</li></ol>",type:"formatter"});});var pk=M(()=>{p();Te();ae({name:"stripP",description:"Removes all paragraph tags from a string.",logicFactory(e){return t=>t.replace(/<p>/g,"").replace(/<\/p>/g,"")},inputType:"string",testValue:"<p>My p</p>",type:"formatter"});});var dk=M(()=>{p();Te();ae({name:"stripUL",description:"Removes unordered list wrapper tags from a string.",logicFactory(e){return t=>t.replace(/<ul>/g,"").replace(/<\/ul>/g,"")},inputType:"string",testValue:"<ul><li>My list</li></ul>",type:"formatter"});});var mk=M(()=>{p();Te();ae({name:"toKebabCase",description:"Takes a camelCase or PascalCase string and converts it to kebab-case.",logicFactory(e){return t=>typeof t=="string"?(t=t.charAt(0).toLowerCase()+t.substring(1),t.replace(/([A-Z])/g,"-$1").toLowerCase()):"invalid string passed to toKebabCase()"},inputType:"string",testValue:"camelCaseText",type:"formatter"});});var fk=M(()=>{p();Te();ae({name:"toSpacedCase",description:"Takes a camelCase or PascalCase string and adds spaces (I know Spaced Case isn't a thing, deal with it).",logicFactory(e){return t=>typeof t=="string"?t.replace(/([A-Z])/g," $1").toLowerCase().trim():"invalid string passed to toSpacedCase()"},inputType:"string",testValue:"camelCaseText",type:"formatter"});});var gk=M(()=>{p();Te();ae({name:"upperCaseFirst",description:"Converts the first letter of a string to uppercase",logicFactory(e){return t=>t.charAt(0).toUpperCase()+t.slice(1)},inputType:"string",testValue:"my name",type:"formatter"});});var hk=M(()=>{p();LC();MC();BC();DC();_C();NC();FC();zC();VC();$C();UC();GC();HC();jC();WC();KC();qC();YC();XC();JC();QC();ZC();ek();tk();ok();rk();nk();ik();ak();sk();ck();uk();pk();dk();mk();fk();gk();});var bk=M(()=>{"use client";p();wr();});var vk=M(()=>{p();});function zo(){let e=useContext(Mz);if(e===void 0)throw new Error("usePrint must be used within a PrintContext");return e}var Mz,Bn=M(()=>{p();ce();Qo();OC();Mn();hf();gf();Nu();Du();ye();ho();ci();Se();Ol();hk();wr();bk();vk();Hf();Mz=createContext({print:!1,isEmbed:!1});});function It(e){let{content:t,style:o={}}=e,{print:r}=zo(),n=jsx(Ce,{component:"span",html:t,isPreview:!0}),i=useMemo(()=>r?jsx("div",{className:"bespoke-inner-tooltip-notification",children:jsx(Notification,{icon:jsx(IconInfoCircle,{size:"1.1rem"}),withCloseButton:!1,withBorder:!0,styles:{root:{boxShadow:"none"}},children:n})},"tooltip-notification"):jsx("div",{className:"bespoke-inner-tooltip",style:o,children:jsx(Tooltip,{label:n,withArrow:!0,withinPortal:!0,multiline:!0,maw:220,children:jsx(ActionIcon,{size:"1.5rem",children:jsx(IconInfoCircle,{})})})},"tooltip"),[r,t,o]);return jsx(Fragment,{children:i})}var tn=M(()=>{p();Bn();bt();});function eg({paragraph:e,tooltip:t,settings:o}){return jsx(Ce,{component:"p",html:e||`Lorem ipsum dolor sit amet,
108
108
  consectetur adipiscing elit. Etiam justo purus, placerat ac turpis at,
package/dist/report.js CHANGED
@@ -52,14 +52,14 @@ var Zf=Object.defineProperty;var v=(e,t)=>()=>(e&&(t=e(e=0)),t);var Aa=(e,t)=>{f
52
52
  font-weight: bold;
53
53
  color: hsl(`+Math.max(0,Math.min(120-120*m,120))+"deg 100% 31%);",r?.key);}return r==null||r.onChange==null||r.onChange(a),a}}function Un(e,t){if(e===void 0)throw new Error("Unexpected undefined"+(t?": "+t:""));return e}var Xu,Qu=v(()=>{c();Xu=function(t,r){return Math.abs(t-r)<1};});function Av(e){for(var t=e.measurements,r=e.outerSize,o=e.scrollOffset,n=t.length-1,a=function(u){return t[u].start},s=rp(0,n,a,o),i=s;i<n&&t[i].end<o+r;)i++;return {startIndex:s,endIndex:i}}var Cv,Yo,Zu,Ju,Pv,ep,tp,rp,$s=v(()=>{c();Yu();Qu();Cv=function(t){return t},Yo=function(t){for(var r=Math.max(t.startIndex-t.overscan,0),o=Math.min(t.endIndex+t.overscan,t.count-1),n=[],a=r;a<=o;a++)n.push(a);return n},Zu=function(t,r){var o=t.scrollElement;if(o){var n=function(i){var l=i.width,u=i.height;r({width:Math.round(l),height:Math.round(u)});};n(o.getBoundingClientRect());var a=new ResizeObserver(function(s){var i=s[0];if(i!=null&&i.borderBoxSize){var l=i.borderBoxSize[0];if(l){n({width:l.inlineSize,height:l.blockSize});return}}n(o.getBoundingClientRect());});return a.observe(o,{box:"border-box"}),function(){a.unobserve(o);}}},Ju=function(t,r){var o=t.scrollElement;if(o){var n=function(){r(o[t.options.horizontal?"scrollLeft":"scrollTop"]);};return n(),o.addEventListener("scroll",n,{passive:!0}),function(){o.removeEventListener("scroll",n);}}},Pv=function(t,r,o){if(r!=null&&r.borderBoxSize){var n=r.borderBoxSize[0];if(n){var a=Math.round(n[o.options.horizontal?"inlineSize":"blockSize"]);return a}}return Math.round(t.getBoundingClientRect()[o.options.horizontal?"width":"height"])},ep=function(t,r,o){var n,a,s=r.adjustments,i=s===void 0?0:s,l=r.behavior,u=t+i;(n=o.scrollElement)==null||n.scrollTo==null||n.scrollTo((a={},a[o.options.horizontal?"left":"top"]=u,a.behavior=l,a));},tp=function(t){var r=this;this.unsubs=[],this.scrollElement=null,this.isScrolling=!1,this.isScrollingTimeoutId=null,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollDirection=null,this.scrollAdjustments=0,this.measureElementCache=new Map,this.observer=function(){var o=null,n=function(){return o||(typeof ResizeObserver<"u"?o=new ResizeObserver(function(s){s.forEach(function(i){r._measureElement(i.target,i);});}):null)};return {disconnect:function(){var s;return (s=n())==null?void 0:s.disconnect()},observe:function(s){var i;return (i=n())==null?void 0:i.observe(s,{box:"border-box"})},unobserve:function(s){var i;return (i=n())==null?void 0:i.unobserve(s)}}}(),this.range={startIndex:0,endIndex:0},this.setOptions=function(o){Object.entries(o).forEach(function(n){var a=n[0],s=n[1];typeof s>"u"&&delete o[a];}),r.options=Ko({debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Cv,rangeExtractor:Yo,onChange:function(){},measureElement:Pv,initialRect:{width:0,height:0},scrollMargin:0,scrollingDelay:150,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1},o);},this.notify=function(){r.options.onChange==null||r.options.onChange(r);},this.cleanup=function(){r.unsubs.filter(Boolean).forEach(function(o){return o()}),r.unsubs=[],r.scrollElement=null;},this._didMount=function(){return r.measureElementCache.forEach(r.observer.observe),function(){r.observer.disconnect(),r.cleanup();}},this._willUpdate=function(){var o=r.options.getScrollElement();r.scrollElement!==o&&(r.cleanup(),r.scrollElement=o,r._scrollToOffset(r.scrollOffset,{adjustments:void 0,behavior:void 0}),r.unsubs.push(r.options.observeElementRect(r,function(n){var a=r.scrollRect;r.scrollRect=n,(r.options.horizontal?n.width!==a.width:n.height!==a.height)&&r.maybeNotify();})),r.unsubs.push(r.options.observeElementOffset(r,function(n){r.scrollAdjustments=0,r.scrollOffset!==n&&(r.isScrollingTimeoutId!==null&&(clearTimeout(r.isScrollingTimeoutId),r.isScrollingTimeoutId=null),r.isScrolling=!0,r.scrollDirection=r.scrollOffset<n?"forward":"backward",r.scrollOffset=n,r.maybeNotify(),r.isScrollingTimeoutId=setTimeout(function(){r.isScrollingTimeoutId=null,r.isScrolling=!1,r.scrollDirection=null,r.maybeNotify();},r.options.scrollingDelay));})));},this.getSize=function(){return r.scrollRect[r.options.horizontal?"width":"height"]},this.memoOptions=Br(function(){return [r.options.count,r.options.paddingStart,r.options.scrollMargin,r.options.getItemKey]},function(o,n,a,s){return r.pendingMeasuredCacheIndexes=[],{count:o,paddingStart:n,scrollMargin:a,getItemKey:s}},{key:!1}),this.getFurthestMeasurement=function(o,n){for(var a=new Map,s=new Map,i=n-1;i>=0;i--){var l=o[i];if(!a.has(l.lane)){var u=s.get(l.lane);if(u==null||l.end>u.end?s.set(l.lane,l):l.end<u.end&&a.set(l.lane,!0),a.size===r.options.lanes)break}}return s.size===r.options.lanes?Array.from(s.values()).sort(function(p,d){return p.end-d.end})[0]:void 0},this.getMeasurements=Br(function(){return [r.memoOptions(),r.itemSizeCache]},function(o,n){var a=o.count,s=o.paddingStart,i=o.scrollMargin,l=o.getItemKey,u=r.pendingMeasuredCacheIndexes.length>0?Math.min.apply(Math,r.pendingMeasuredCacheIndexes):0;r.pendingMeasuredCacheIndexes=[];for(var p=r.measurementsCache.slice(0,u),d=u;d<a;d++){var m=l(d),b=r.options.lanes===1?p[d-1]:r.getFurthestMeasurement(p,d),f=b?b.end:s+i,y=n.get(m),h=typeof y=="number"?y:r.options.estimateSize(d),w=f+h,L=b?b.lane:d%r.options.lanes;p[d]={index:d,start:f,size:h,end:w,key:m,lane:L};}return r.measurementsCache=p,p},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:function(){return r.options.debug}}),this.calculateRange=Br(function(){return [r.getMeasurements(),r.getSize(),r.scrollOffset]},function(o,n,a){return r.range=Av({measurements:o,outerSize:n,scrollOffset:a})},{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:function(){return r.options.debug}}),this.maybeNotify=Br(function(){var o=r.calculateRange();return [o.startIndex,o.endIndex,r.isScrolling]},function(){r.notify();},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:function(){return r.options.debug},initialDeps:[this.range.startIndex,this.range.endIndex,this.isScrolling]}),this.getIndexes=Br(function(){return [r.options.rangeExtractor,r.calculateRange(),r.options.overscan,r.options.count,r.getSize()]},function(o,n,a,s,i){return i===0?[]:o(Ko({},n,{overscan:a,count:s}))},{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:function(){return r.options.debug}}),this.indexFromElement=function(o){var n=r.options.indexAttribute,a=o.getAttribute(n);return a?parseInt(a,10):(console.warn("Missing attribute name '"+n+"={index}' on measured element."),-1)},this._measureElement=function(o,n){var a=r.measurementsCache[r.indexFromElement(o)];if(!a||!o.isConnected){r.measureElementCache.forEach(function(l,u){l===o&&(r.observer.unobserve(o),r.measureElementCache.delete(u));});return}var s=r.measureElementCache.get(a.key);s!==o&&(s&&r.observer.unobserve(s),r.observer.observe(o),r.measureElementCache.set(a.key,o));var i=r.options.measureElement(o,n,r);r.resizeItem(a,i);},this.resizeItem=function(o,n){var a,s=(a=r.itemSizeCache.get(o.key))!=null?a:o.size,i=n-s;i!==0&&(o.start<r.scrollOffset&&(process.env.NODE_ENV!=="production"&&r.options.debug&&console.info("correction",i),r._scrollToOffset(r.scrollOffset,{adjustments:r.scrollAdjustments+=i,behavior:void 0})),r.pendingMeasuredCacheIndexes.push(o.index),r.itemSizeCache=new Map(r.itemSizeCache.set(o.key,n)),r.notify());},this.measureElement=function(o){o&&r._measureElement(o,void 0);},this.getVirtualItems=Br(function(){return [r.getIndexes(),r.getMeasurements()]},function(o,n){for(var a=[],s=0,i=o.length;s<i;s++){var l=o[s],u=n[l];a.push(u);}return a},{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:function(){return r.options.debug}}),this.getVirtualItemForOffset=function(o){var n=r.getMeasurements();return Un(n[rp(0,n.length-1,function(a){return Un(n[a]).start},o)])},this.getOffsetForAlignment=function(o,n){var a=r.getSize();n==="auto"&&(o<=r.scrollOffset?n="start":o>=r.scrollOffset+a?n="end":n="start"),n==="start"?o=o:n==="end"?o=o-a:n==="center"&&(o=o-a/2);var s=r.options.horizontal?"scrollWidth":"scrollHeight",i=r.scrollElement?"document"in r.scrollElement?r.scrollElement.document.documentElement[s]:r.scrollElement[s]:0,l=i-r.getSize();return Math.max(Math.min(l,o),0)},this.getOffsetForIndex=function(o,n){n===void 0&&(n="auto"),o=Math.max(0,Math.min(o,r.options.count-1));var a=Un(r.getMeasurements()[o]);if(n==="auto")if(a.end>=r.scrollOffset+r.getSize()-r.options.scrollPaddingEnd)n="end";else if(a.start<=r.scrollOffset+r.options.scrollPaddingStart)n="start";else return [r.scrollOffset,n];var s=n==="end"?a.end+r.options.scrollPaddingEnd:a.start-r.options.scrollPaddingStart;return [r.getOffsetForAlignment(s,n),n]},this.isDynamicMode=function(){return r.measureElementCache.size>0},this.cancelScrollToIndex=function(){r.scrollToIndexTimeoutId!==null&&(clearTimeout(r.scrollToIndexTimeoutId),r.scrollToIndexTimeoutId=null);},this.scrollToOffset=function(o,n){var a=n===void 0?{}:n,s=a.align,i=s===void 0?"start":s,l=a.behavior;r.cancelScrollToIndex(),l==="smooth"&&r.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),r._scrollToOffset(r.getOffsetForAlignment(o,i),{adjustments:void 0,behavior:l});},this.scrollToIndex=function(o,n){var a=n===void 0?{}:n,s=a.align,i=s===void 0?"auto":s,l=a.behavior;o=Math.max(0,Math.min(o,r.options.count-1)),r.cancelScrollToIndex(),l==="smooth"&&r.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");var u=r.getOffsetForIndex(o,i),p=u[0],d=u[1];r._scrollToOffset(p,{adjustments:void 0,behavior:l}),l!=="smooth"&&r.isDynamicMode()&&(r.scrollToIndexTimeoutId=setTimeout(function(){r.scrollToIndexTimeoutId=null;var m=r.measureElementCache.has(r.options.getItemKey(o));if(m){var b=r.getOffsetForIndex(o,d),f=b[0];Xu(f,r.scrollOffset)||r.scrollToIndex(o,{align:d,behavior:l});}else r.scrollToIndex(o,{align:d,behavior:l});}));},this.scrollBy=function(o,n){var a=n===void 0?{}:n,s=a.behavior;r.cancelScrollToIndex(),s==="smooth"&&r.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),r._scrollToOffset(r.scrollOffset+o,{adjustments:void 0,behavior:s});},this.getTotalSize=function(){var o;return (((o=r.getMeasurements()[r.options.count-1])==null?void 0:o.end)||r.options.paddingStart)-r.options.scrollMargin+r.options.paddingEnd},this._scrollToOffset=function(o,n){var a=n.adjustments,s=n.behavior;r.options.scrollToFn(o,{behavior:s,adjustments:a},r);},this.measure=function(){r.itemSizeCache=new Map,r.notify();},this.setOptions(t),this.scrollRect=this.options.initialRect,this.scrollOffset=this.options.initialOffset,this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(function(o){r.itemSizeCache.set(o.key,o.size);}),this.maybeNotify();},rp=function(t,r,o,n){for(;t<=r;){var a=(t+r)/2|0,s=o(a);if(s<n)t=a+1;else if(s>n)r=a-1;else return a}return t>0?t-1:0};});function Iv(e){var t=Kt.useReducer(function(){return {}},{})[1],r=Wo({},e,{onChange:function(s){t(),e.onChange==null||e.onChange(s);}}),o=Kt.useState(function(){return new tp(r)}),n=o[0];return n.setOptions(r),Kt.useEffect(function(){return n._didMount()},[]),wv(function(){return n._willUpdate()}),n}function Gn(e){return Iv(Wo({observeElementRect:Zu,observeElementOffset:Ju,scrollToFn:ep},e))}var wv,Us=v(()=>{c();Ku();$s();$s();wv=typeof document<"u"?Kt.useLayoutEffect:Kt.useEffect;});function Gs(e,t,r,o,n=!1){let a=useRouter(),{query:s,locale:i}=a,l=Q(x=>x),u=useDispatch(),p=Ze(),d=Q(x=>o&&p.variables?p?.variables?.attributes:x.variables.attributes),m=wt(l),b=rr(l),f=Et(b,i),y=oo(e,o&&p.active?p?.variables.variables:void 0,o&&p.active?p?.variables.attributes:void 0),h=Q(x=>o?p.variables.variables:x.variables.variables),w=Q(x=>o?p.variables.status:x.variables.status),L=_t(),{sectionVariables:k,resetSectionVariables:A}=Ae(t),{addRunConsumersRunning:N,removeRunConsumersRunning:z}=no(),E=o&&p.active?`${r}-valueCompare`:`${r}-value`,F=o&&p.active?`${r}-typeCompare`:`${r}-type`,C=o&&p.active?Object.fromEntries(Object.entries(s).filter(([x])=>x.match(Bv)).map(([x,O])=>[x.replace("Compare",""),O])):Object.fromEntries(Object.entries(s).filter(([x])=>x.match(Mv)).map(([x,O])=>[x.replace("Compare",""),O]));return useCallback((x,O)=>{let D={locale:i,query:{...C,[`${r}-type`]:O,[`${r}-value`]:x},variables:y},I=new URLSearchParams(window.location.search);x&&O?(I.set(E,x.join(",")),I.set(F,O)):(I.delete(E),I.delete(F)),window.history.replaceState(null,null,`?${I.toString()}`),N([t]),kt(m,void 0,e,f,D,{variables:h,status:w},L,"report").then(P=>{n&&k&&A(),p.active&&o?p.setComparisonVariables({attributes:d,variables:P.variables,status:P.status}):u(er.setVariableChange({attributes:d,variables:P.variables,status:P.status})),z([t]);});},[o,d,e,m,p,u,f,w,h,i,C,L,r,F,E,y,k,n,A])}var Bv,Mv,op=v(()=>{c();Wt();po();Sr();he();Se();Jt();or();Qr();Bv=/\w*Compare\b/,Mv=/multihierarchySelector\d+(id|-(type|value))/;});function js(e){let{allLabel:t,asComparison:r,colorKey:o,data:n,defaultValue:a,defaultValueType:s,hideLabel:i,resetSectionVars:l,iconKey:u,id:p,levels:d,limit:m,placeholder:b,searchIndexKey:f,searchIndexSeparator:y,section:h,settings:w}=e,{print:L}=Ue(),k=Yv(p),A=Gs(p,h,k,r,l==="true"),N=r?`${k}-valueCompare`:`${k}-value`,z=r?`${k}-typeCompare`:`${k}-type`,E=useMantineTheme(),[F,C]=useState(!1),[R,x]=useState(!0),[O,D]=useState(""),[I,P]=useState(!1),[Y,j]=useState([""].slice(1)),[H,ee]=useState([]),[oe,ce]=useState(""),K=useMemo(()=>L?Array.from(new Set(n.filter(ne=>H.includes(ne[`${oe} ID`])))).map(ne=>ne?.[oe]).join(", "):"",[L]),q=i==="true"||!e.label?jsx(Fragment,{}):jsx(ie,{component:"div",html:e.label,size:"sm",style:w}),G=useRef(null),$=useRef(!1),M=useRef(!!m&&m<H.length),_=Y.length,te=d[_],U=Y.filter(Boolean);Y.length>0&&U.length===0&&U.push(`${t} ${te?.label}`),useEffect(()=>{let B=new URLSearchParams(window.location.search),ne=B.get(N)||a,re=B.get(z)||s;ne&&re?(ee(Xv(ne,a)),ce(re)):(ee([]),ce(""));},[window.location.search,a,s]),useEffect(()=>{let B=()=>{x(!0);};return window.addEventListener("touchmove",B),()=>{window.removeEventListener("touchmove",B);}},[]);let Z=useMemo(()=>jv(n,d,o,u,f,y),[o,n,u,d,f,y]),X=useMemo(()=>{let B=Wv(O),ne=Array.from(Kv(Z,B)).reverse();return I?ne:Y.reduce((re,Ke)=>re.filter(be=>!Ke||be.searchindex.indexOf(Ke)>-1),ne.filter(re=>re.type===te?.value))},[te,Z,O,I,Y]),ae=useRef(null),le=Gn({count:F?X.length:0,estimateSize:()=>30,getScrollElement:useCallback(()=>ae.current,[]),overscan:10,rangeExtractor:useCallback(B=>Yo(B),[])}),[qe,ue]=useState(-1),je=Math.min(qe,X.length-1),$e=useCallback(B=>{let ne=Y.concat(B);I&&P(!1),j(ne);},[I,Y]),We=useCallback(()=>{let B=Y.slice(0,_-1);I&&P(!1),j(B);},[I,Y,_]),Eo=useCallback(B=>{D(B.currentTarget.value),!M.current&&n.length>0&&C(!0);},[n,D,M,C]),ko=useCallback(()=>{D(""),A([],""),G.current?.focus(),m&&(M.current=!1);},[D,A,G,m,M]),mr=useCallback(B=>{let ne=H.filter(re=>re!==B);ne.length>0?A(ne,oe):A([],""),m&&ne.length<m&&(M.current=!1);},[H,oe,A,m,M]),Co=useCallback(B=>{oe!==B.type?A([B.value],B.type):H.includes(B.value)?mr(B.value):m?(H.length<m&&A([...H,B.value],oe),H.length===m&&A([...H.slice(1),B.value],oe)):A([...H,B.value],oe),D("");},[A,oe,H,mr,m]),va=useCallback(()=>{H.length>0&&O.length===0&&(A(H.slice(0,-1),oe),C(!0),m&&(M.current=!1)),O.length>0&&D(O.slice(0,-1));},[A,H,oe,O,D,C,m,M]),Sa=useCallback(()=>{x(B=>B&&($.current=B,!B)),ue(B=>B+1>=X.length?B:B+1);},[ue,X]),Ta=useCallback(()=>{let B=X[je];B&&Co(B);},[X,je,Co]),xa=useCallback(()=>{C(!1);},[C]),Ra=useCallback(()=>{We(),ue(0);},[ue,We]),Ea=useCallback(()=>{let B=X[je];!I&&B&&B.type!==d[d.length-1]?.value&&($e(B.name),ue(0));},[X,je,I,d,ue,$e]),ka=useCallback(()=>{x(B=>B&&($.current=B,!B)),ue(B=>B-1<0?0:B-1);},[ue]),Ca=({label:B,onRemove:ne,...re})=>jsxs("div",{style:{alignItems:"center",backgroundColor:E.colorScheme==="dark"?E.colors.dark[7]:E.colors.gray[1],borderRadius:E.radius.sm,cursor:"default",color:E.colorScheme==="dark"?E.colors.dark[0]:E.colors.gray[7],display:"flex",fontSize:rem(12),fontWeight:500,height:rem(22),margin:`calc(${E.spacing.xs} / 2 - ${rem(2)}) calc(${E.spacing.xs} / 2)`,maxWidth:`calc(100% - ${rem(10)})`,paddingLeft:`calc(${E.spacing.sm} / 1.5)`,paddingRight:0,userSelect:"none"},...re,children:[jsx("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:B}),jsx(CloseButton,{"aria-hidden":!0,iconSize:"70%",onMouseDown:ne,radius:2,size:"sm",sx:{color:E.colorScheme==="dark"?E.colors.dark[0]:E.colors.gray[7],marginLeft:`calc(${E.spacing.sm} / 6)`},tabIndex:-1})]}),V=useMemo(()=>H.map(B=>Z.find(ne=>ne.value===B)).filter(B=>!!B).map((B,ne)=>createElement(Ca,{...B,index:ne,label:B.label,key:B.value,onRemove:re=>{re.preventDefault(),re.stopPropagation(),mr(B.value);}})),[H]),pe=forwardRef(function({color:ne,icon:re,label:Ke,value:be,...Pa},Qf){return jsx("div",{ref:Qf,style:{cursor:"pointer",width:"100%"},...Pa,children:jsxs(Group,{align:"center",noWrap:!0,spacing:"xs",w:"100%",children:[re&&jsx(Box,{bg:ne??"transparent",component:"img",w:20,h:20,src:re}),jsx(Text,{lineClamp:1,size:"sm",children:Ke||be})]})})});return jsxs(Fragment,{children:[jsx(MediaQuery,{query:"print",styles:{display:"none"},children:jsx(Input.Wrapper,{label:q,children:jsxs(Popover,{closeOnClickOutside:!0,keepMounted:!0,opened:F,onChange:C,onClose:()=>{ue(0),D("");},onOpen:()=>{X.length>0&&le.scrollToIndex(0);},shadow:"sm",width:"target",withinPortal:!0,children:[jsx(Popover.Target,{children:jsxs(Box,{"aria-haspopup":"listbox",component:"div",onMouseLeave:()=>ue(0),sx:{position:"relative","& .defaultValue":{backgroundColor:E.colorScheme==="dark"?E.colors.dark[5]:E.colors.gray[3],color:E.colorScheme==="dark"?E.colors.dark[1]:E.colors.gray[7]}},tabIndex:-1,children:[jsx("input",{type:"hidden",value:H.join(",")}),jsx(Input,{component:"div",multiline:!0,onMouseDown:B=>{B.preventDefault(),!M.current&&n.length>0&&C(!F),G.current?.focus();},rightSection:H.length>0?jsx(CloseButton,{onClick:ko,onMouseDown:B=>B.preventDefault(),variant:"transparent"}):jsx(IconSelector,{color:E.colors.gray[6],size:18,stroke:1.5}),style:{overflow:"hidden"},w:"100%",children:jsxs(Box,{component:"div","data-clearable":!0,sx:{alignItems:"center",boxSizing:"border-box",display:"flex",flexWrap:"wrap",marginLeft:`calc(-${E.spacing.xs} / 2)`,minHeight:`calc(${rem(36)} - ${rem(2)})`,"&[data-clearable]":{marginRight:rem(36)},"&::placeholder":{color:E.colorScheme==="dark"?E.colors.dark[3]:E.colors.gray[5],opacity:1}},children:[V,jsx("input",{autoComplete:"off","data-mantine-stop-propagation":F,onChange:Eo,onKeyDown:getHotkeyHandler([["ArrowDown",Sa],["ArrowLeft",Ra],["ArrowRight",Ea],["ArrowUp",ka],["Backspace",va],["Enter",Ta],["Escape",xa]]),placeholder:H.length===0&&b||"",ref:G,readOnly:M.current,style:{appearance:"none",backgroundColor:"transparent",border:0,color:"inherit",flex:1,fontSize:E.fontSizes.sm,marginLeft:`calc(${E.spacing.xs} / 2)`,maxHeight:rem(22),minWidth:rem(60),outline:0,padding:0},type:"search",value:O})]})})]})}),jsx(Popover.Dropdown,{onMouseDown:B=>B.preventDefault(),p:0,children:jsx("div",{style:{display:"flex",maxHeight:rem(300)},children:jsx(Box,{component:"div","data-combobox-popover":!0,onMouseDown:B=>B.preventDefault(),role:"listbox",sx:{width:"100%"},tabIndex:-1,children:jsxs(Stack,{h:"100%",py:"xs",spacing:"xs",w:"100%",children:[d.length>1&&jsxs(Stack,{spacing:"xs",children:[jsxs(Group,{onClick:B=>{B.stopPropagation();},px:"xs",position:"center",spacing:"xs",children:[jsx(Button,{onClick:()=>{ue(0),P(!0),j([]),X.length>0&&le.scrollToIndex(0);},size:"xs",variant:I?"filled":"outline",children:t}),d.map((B,ne)=>jsx(Button,{onClick:()=>{I&&P(!1);let re=[""].slice(1),Ke=ne;for(;Ke--;)re[Ke]=Y[Ke]||"";ue(0),j(re),X.length>0&&le.scrollToIndex(0);},size:"xs",variant:!I&&Y.length===d.findIndex(re=>re.value===B?.value)?"filled":"outline",children:B?.label},B?.value))]}),jsx(Divider,{})]}),_>0&&jsxs(Group,{align:"center",noWrap:!0,px:"xs",children:[jsx(ActionIcon,{onClick:We,size:"sm",children:jsx(IconChevronLeft,{})}),jsx("div",{children:U.map(B=>jsx(Text,{lineClamp:1,size:"xs",children:B},`${B}`))})]}),jsx(ScrollArea,{mah:250,onWheel:()=>x(!0),px:"xs",style:{overflow:"auto",width:"100%"},viewportRef:ae,viewportProps:{tabIndex:-1},w:"100%",children:jsx("div",{style:{height:`${le.getTotalSize()}px`,position:"relative",width:"100%"},children:le.getVirtualItems().map(B=>{let ne=X[B.index],re=je===B.index,Ke=H.includes(ne.value);return X.length>0&&re&&!R&&le.scrollToIndex(je),jsxs(Group,{"aria-selected":re,align:"center","data-hovered":re||void 0,"data-index":B.index,"data-selected":Ke,id:ne.vale,noWrap:!0,onMouseEnter:be=>{be.preventDefault(),be.stopPropagation(),R&&(ue(B.index),x(!1));},onMouseMove:be=>{be.preventDefault(),be.stopPropagation(),x(!0);},onMouseDown:be=>{be.preventDefault(),Co(ne);},position:"apart",ref:le.measureElement,role:"option",spacing:"xs",sx:be=>({borderRadius:be.radius.xs,padding:"15px 5px 15px",paddingLeft:I&&10*d.findIndex(Pa=>Pa?.value===ne.type)||5,position:"absolute",top:0,left:0,height:`${B.size}px`,transform:`translateY(${B.start}px)`,width:"100%","&[data-hovered]":{backgroundColor:be.colorScheme==="dark"?be.colors.dark[4]:be.colors.gray[1]},"&:hover":{backgroundColor:be.colorScheme==="dark"?be.colors.dark[4]:be.colors.gray[1]}}),tabIndex:-1,children:[jsx(pe,{index:B.index,...ne}),!I&&ne.type!==d[d.length-1]?.value&&jsx(ActionIcon,{onMouseDown:be=>{be.preventDefault(),be.stopPropagation(),$e(ne.name);},size:"sm",tabIndex:-1,children:jsx(IconChevronRight,{})})]},ne.value)})})})]})})})})]})})}),L&&jsxs(Text,{children:[q,": ",K]})]})}var jv,Wv,Kv,Yv,Xv,pp=v(()=>{c();Us();we();jt();op();jv=(e=[],t=[],r="",o="",n="",a="|")=>{let s=t.map(y=>y.value).slice(),i=`${s.pop()}`,l=y=>y[r],u=y=>y[o],p=y=>{if(y[n])return typeof y[n]=="string"?y[n].split(a):y[n]},d=new Set,m=[],b=[],f=nest().rollup(y=>{let h=y[0],w=C=>C&&C.value&&!d.has(C.value),L=s.map(C=>h[`${C} ID`]),k=s.map(C=>h[C]),A=s.map((C,R)=>{if(b[R]!==k[R]){b[R]=k[R];let x=l[R]||l[l.length-1]||l,O=u[R]||u[u.length-1]||u,D=p[R]||p[p.length-1]||p;return {color:x(h,C)||void 0,icon:O(h,C)||void 0,value:`${L[R]}`,label:k[R],name:k[R],type:C,searchindex:k.slice(0,R+1).concat(D(h,C)).join("|")}}return {}}).filter(w);A.forEach(C=>d.add(C.value));let N=l[l.length-1]||l,z=u[u.length-1]||u,E=p[p.length-1]||p,F=y.map(C=>({color:N(C,i)||void 0,icon:z(C,i)||void 0,value:`${C[`${i} ID`]}`,label:C[i],name:C[i],type:i,searchindex:k.concat(C[i]).concat(E(C,i)).join("|")}));m.push(...A.concat(F));});return s.forEach(y=>{f.key(h=>`${h[`${y} ID`]}|${h[y]}`);}),f.entries(e),m},Wv=e=>{if(!e)return /./i;let t=e.normalize("NFD").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"[^|]+");return RegExp(t,"i")},Kv=(e,t)=>{let r=e.length,o,n=i=>o&&o.searchindex.includes(i.searchindex),s={next:()=>{for(let i=r-1;i>-1;i--){let l=e[i];if(t.test(`${l.value} ${l.label} ${l.searchindex}`)||n(l))return o=l,r=i,{done:!1,value:l}}return {done:!0,value:void 0}},[Symbol.iterator]:()=>s};return s},Yv=e=>`multihierarchySelector${e}`,Xv=(e,t)=>e&&typeof e=="string"?e.split(","):t;});function Kn(e){let{asPath:t,locale:r,defaultLocale:o}=useRouter(),[n,a]=useState(!0),{user:s,isLoading:i}=useUser(),[l,u]=useState({resolved:!1,blocks:[]}),p=Xe(),[,d]=t.split("?"),m=d?Object.fromEntries(new URLSearchParams(`?${d}`)):{},b=Q(R=>R),f=gs().data,y=f&&f[0].id,h=Q(R=>R.variables.attributes),w=wt(b),L=rr(b),k=Et(L,r),A=Q(R=>R.variables.variables),N=Q(R=>R.variables.status),z=_t(),{addRunConsumersRunning:E,removeRunConsumersRunning:F}=no(),C=useMemo(()=>Object.keys(h).filter(R=>R.startsWith("id")).map(R=>h[R]).join("-"),[h]);return useEffect(()=>{if(l.blocks.length>0&&u({resolved:!1,blocks:[]}),!i&&s&&y){let R=Object.keys(Object.values(w).reduce((x,O)=>(O.type!=="fallback"&&(x[O.section_id]=!0),x),{})).map(x=>parseInt(x,10));p(it.readPrivateBlocks({report_id:y,locale:r||o||"en",section_id:R})).then(x=>{if(x.data&&x.data.length){let O=x.data.reduce((D,I)=>({...D,[I.id]:I}),[]);p(it.addBlockToState(O)).then(()=>{u({resolved:!0,blocks:x.data.map(D=>D.id)});});}u({resolved:!0,blocks:[]}),a(!1);}).catch(()=>{u({resolved:!0,blocks:[]}),a(!1);});}!i&&!s&&(u({resolved:!0,blocks:[]}),a(!1));},[C,s,i]),useEffect(()=>{if((Object.keys(m).some(x=>x!==e)||l.blocks.length>0)&&l.resolved){let x=Object.keys(m).map(ee=>Number(ee.match(/\d+/))).filter(ee=>w[ee]),O=Array.from(new Set(x.filter(ee=>ee!==0).concat(l.blocks))),D={...b.variables},I=[],P=[];O.forEach(ee=>{let oe=w[ee];Rn(oe,w,ee,I,!0,!0,P);});let Y={},j=O.filter(ee=>(Y[w[ee].section_id]=!0,!P.includes(ee))),H=Object.keys(Y).map(ee=>parseInt(ee,10));E(H),Promise.all(j.map(ee=>{let ce=w[ee].consumers.reduce((q,G)=>({...q,...A[G]}),{}),K={locale:mt,query:m,variables:{...ce,...h}};return kt(w,void 0,ee,k,K,{variables:A,status:N},z,"report")})).then(ee=>(ee.forEach((oe,ce)=>{let K=j[ce],q=w[K],G=[],$=[];Rn(q,w,K,G,!0,!0,$);let M={},_={};$.forEach(te=>{M[te]=oe.status[te],_[te]=oe.variables[te];}),D.status={...D.status,...M,[K]:{...oe.status[K]}},D.variables={...D.variables,..._,[K]:{...oe.variables[K]}};}),D)).then(ee=>{p(er.setVariableChange({...ee,attributes:h})),F(H);});}},[l.resolved]),n||!l.resolved}var fp=v(()=>{c();he();or();or();Jt();kn();Sr();he();Qr();po();Se();});function Yn(){let e=useRouter(),t=useRef(!1),r=500;useEffect(()=>{let o=()=>{let{asPath:a}=e;if(!t.current&&a.includes("#")){let s=a.split("#")[1],i=document.getElementById(s);i&&(t.current=!0,setTimeout(()=>{i.scrollIntoView({behavior:"smooth"}),t.current=!1;},r));}};o();let n=()=>{o();};return e.events.on("hashChangeComplete",n),()=>{e.events.off("hashChangeComplete",n);}},[e]);}var Ws=v(()=>{c();});function aS(e,t){let r=[],o={},n=1/0;for(let a of e){let s=parseInt(a.settings.order);s<n&&(n=s);}for(let a of e){let{id:s,settings:i}=a,l=parseInt(i.order),u=t[s]?t[s]:!1,p=nS(u,s),d={id:s,order:l,label:t[s]?t[s][`title${s}title`]:`Title ${s}`,iconProps:p,children:[]};if(o[s]=d,l===n)r.push(d);else {let m=l-1,b;for(let f=e.indexOf(a)-1;f>=0;f--){let y=e[f],h=parseInt(y.settings.order);if(h===m){b=o[y.id];break}else if(h<m){b=o[y.id];break}}b?b.children.push(d):r.push(d);}}return r}function mo(e=1,t=6,r=[]){let o=Q(m=>m),n=Q(m=>m.variables.variables),a=Q(m=>m.variables.status),s=zo(),i=Fc(o).filter(m=>m.type===g.TITLE&&r.includes(m.id)),l=Object.fromEntries(i.map(m=>[m.id,m])),u=Object.fromEntries(i.map(m=>[m.id,n[m.id]])),p=Object.fromEntries(i.map(m=>[m.id,a[m.id]])),d=useMemo(()=>{if(s.isSuccess&&l){let m=[];return s.data.sort(Ye).forEach(b=>{let f=b.blocks.reduce((y,h)=>l[h]&&l[h].type===g.TITLE?y.concat([l[h]]):y,[]);m=m.concat(f.sort((y,h)=>Ye(y,h,"blockrow")));}),Object.keys(a).length?m.filter(b=>{let f=parseInt(b.settings.order||"1",10);return f>=e&&f<=t&&p[b.id]?.allowed&&!p[b.id]?.hiddenByCascade}):[]}},[r,s,l,p]);return useMemo(()=>d&&d?.length>0?aS(d,u):[],[d,u])}var nS,Ks=v(()=>{c();he();or();zr();ye();nS=(e,t)=>({iconType:e[`title${t}_iconType`],icon:e[`title${t}_icon`],iconSize:e[`title${t}_iconSize`],iconVariant:e[`title${t}_iconVariant`],iconRadius:e[`title${t}_iconRadius`]});});var Ys=v(()=>{c();fp();Ms();Ws();Ks();});function Xo(){let e=useContext(hp);if(e===void 0)throw new Error("usePdf must be used within a PdfProvider");return e}function Xs({children:e}){let{query:t}=useRouter(),o=Q(a=>Object.values(a.records.entities.report)[0]).settings,n=Ig(t.print)??!1;return jsx(hp.Provider,{value:{active:o.pdf||!1,pdfParam:n,position:o.position||"DEFAULT",XlsxVizActive:o.XlsxViz||!1},children:e})}var uS,hp,Xn=v(()=>{c();he();uS={active:!1,pdfParam:!1,position:"DEFAULT",XlsxVizActive:!1},hp=createContext(uS);});var Qs=v(()=>{c();he();});var yp=v(()=>{c();});var Zs=v(()=>{c();Ut();});var vp=v(()=>{c();he();Zs();});var Js=v(()=>{c();Zs();vp();Ks();});function Qn(e,t){return e===t}var ei=v(()=>{c();Se();Qs();yp();Js();});var xp,Jn,Rp,ea=v(()=>{c();xp=(e,t,r,o=null)=>{let[n,a]=useState(!1),[s,i]=useState(null);return {print:u=>{a(!0),i(null);let p=process.env.NEXT_PUBLIC_REPORTS_BASE_URL,d=new URLSearchParams(window.location.search),m=u?"&transparent=true":"",b=o?`/embeds/${t}/${r}?section=${e}&block=${o}${d.toString()?"&"+d.toString():""}`:`/embeds/${t}/${r}?section=${e}${d.toString()?"&"+d.toString():""}`,f=encodeURIComponent(`${p}${b}&print=true`);xn.get(`${process.env.NEXT_PUBLIC_PDF_API_URL}/screenshot?url=${f}${m}`,{responseType:"blob"}).then(y=>{let h=o?`section${e}_block${o}.png`:`section${e}.png`;saveAs(y.data,h);}).catch(y=>{i(y.response?.data?.message||"Failed to download image. Please try again.");}).finally(()=>{a(!1);});},downloadLoading:n,error:s}},Jn=()=>{let{asPath:e}=useRouter(),[t,r]=useState(!1),[o,n]=useState(null);return {printReport:()=>{r(!0),n(null);let s=process.env.NEXT_PUBLIC_REPORTS_BASE_URL,i=e.replace(/[&?]printBtn=[^&]+/,""),l=i.includes("?")?"&":"?",u=encodeURIComponent(`${s}${i}${l}print=true`);return xn.get(`${process.env.NEXT_PUBLIC_PDF_API_URL}/pdf?url=${u}`,{responseType:"blob"}).then(p=>{let m=p.headers["content-disposition"]?.match(/filename[^;=\n]*=(['"]?)(.*?)\1/),b=m&&m[2]?m[2]:"report.pdf";saveAs(p.data,b);}).catch(p=>{n(p.response?.data?.message||"Failed to generate PDF. Please try again.");}).finally(()=>{r(!1);})},error:o,setError:n,downloadLoading:t}},Rp=()=>!!process.env.NEXT_PUBLIC_PDF_API_URL;});function Ap({contentOutline:e=[]}){return jsx(Menu,{children:wp(e)})}function wp(e,t=!0){return e.map((r,o)=>t?jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${r.id}`,children:jsx(Group,{children:jsx(Text,{dangerouslySetInnerHTML:{__html:r.label}})})})}),r.children.length?jsx(Box,{ml:"md",children:wp(r.children,!1)}):null]},o):jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${r.id}`,children:jsx(Text,{dangerouslySetInnerHTML:{__html:r.label}})})},o))}function ri({headings:e,settings:t,type:r}){let{min:o="1",max:n="6",icons:a="yes"}=t||{},s=mo(parseInt(o,10),parseInt(n,10),e),i=a==="yes",u=`(max-width: ${useMantineTheme().breakpoints.md})`,p=useMediaQuery(u),d=lo(t&&t.align?String(t.align):"left");return p?jsx(xS,{contentOutline:s,showIcons:i}):r==="multilevel"?jsx(RS,{contentOutline:s,showIcons:i,align:d}):jsx(TS,{contentOutline:s,showIcons:i,align:d})}var kp,TS,Ip,xS,RS,Lp=v(()=>{c();Ys();Lr();ze();Xn();ei();ea();kp=e=>t=>({display:"flex",gap:t.spacing.md,justifyContent:e,listStyleType:"none"});TS=({contentOutline:e,showIcons:t,align:r})=>{let{active:o,position:n,pdfParam:a}=Xo(),{downloadLoading:s,printReport:i}=Jn(),[l,u]=useState(null);if(useEffect(()=>{let d=()=>{let m=document.querySelector(".bespoke-nav");if(!m)return;let b=m.getBoundingClientRect(),f=!1;e.forEach(y=>{let h=document.getElementById(`bespoke-title-${y.id}`);h&&h.getBoundingClientRect().top<=b.bottom&&(u(y.id),f=!0);}),f||u(null);};return window.addEventListener("scroll",d),()=>{window.removeEventListener("scroll",d);}},[e]),o&&a)return jsx(Ap,{contentOutline:e});let p=d=>!d||!d?.length?null:jsx(Fragment,{children:d.map(m=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${m.id}`,children:jsxs(Group,{spacing:"sm",children:[t&&jsx(Re,{...m.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:m.label}})]})})}),jsx(Box,{pl:"xs",children:p(m.children)})]},m.id))});return jsxs(Box,{component:"nav",className:"bespoke-nav",children:[jsx(List,{sx:d=>({display:"flex",gap:d.spacing.md,justifyContent:r,listStyleType:"none"}),children:e?.map(d=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${d.id}`,"data-active":d.id===l,children:jsxs(Group,{spacing:"sm",children:[t&&jsx(Re,{...d.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:d.label}})]})})}),d?.children?.length?jsx(Menu.Dropdown,{children:p(d.children)}):null]})},d.id))}),Qn(n,"NAV")&&o&&e.length>=1&&jsx(List.Item,{children:jsx(Button,{variant:"outline",onClick:i,children:s?"Downloading":"Download PDF"})})]})},Ip=({contentOutline:e,closeNav:t,showIcons:r})=>{let[o,n]=useState(null);return jsx(Stack,{children:e.map(a=>a.children.length?jsxs(Fragment,{children:[jsxs(Group,{spacing:0,noWrap:!0,children:[jsx(UnstyledButton,{w:"100%",component:"a",onClick:t,href:`#bespoke-title-${a.id}`,children:jsxs(Group,{spacing:"sm",noWrap:!0,children:[r&&jsx(Re,{...a.iconProps,iconSize:"sm",iconPadding:"2"}),jsx(Text,{dangerouslySetInnerHTML:{__html:a.label}})]})},a.id),jsx(ActionIcon,{component:"a",size:"lg",onClick:()=>n(s=>s===a.id?null:a.id),children:jsx(IconChevronDown,{style:{transition:"transform 0.2s",transform:o===a.id?"rotate(-180deg)":"none"},stroke:1})})]},a.id),jsx(Collapse,{in:o===a.id,pl:"sm",transitionTimingFunction:"linear",transitionDuration:200,children:jsx(Ip,{contentOutline:a.children,closeNav:t,showIcons:r})})]}):jsx(Group,{noWrap:!0,children:jsx(UnstyledButton,{display:"flex",w:"100%",component:"a",href:`#bespoke-title-${a.id}`,children:jsxs(Group,{spacing:"sm",children:[r&&jsx(Re,{...a.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:a.label}})]})},a.id)},a.id))})},xS=({contentOutline:e,showIcons:t})=>{let[r,{toggle:o}]=useDisclosure(!1),n=r?"Close content outline":"Open content outline",{active:a,pdfParam:s}=Xo();return a&&s?jsx(Ap,{contentOutline:e}):jsxs(Box,{component:"nav",children:[jsx(Group,{children:jsx(Burger,{opened:r,onClick:o,"aria-label":n,size:"md"})}),jsx(Collapse,{in:r,mt:"md",children:jsx(Ip,{contentOutline:e,closeNav:o,showIcons:t})})]})},RS=({contentOutline:e,showIcons:t,align:r})=>{let[o,n]=useState(null),[a,s]=useState(null);useEffect(()=>{let l=()=>{let u=document.querySelector(".bespoke-nav");if(!u)return;let p=u.getBoundingClientRect(),d=!1;e.forEach(m=>{let b=document.getElementById(`bespoke-title-${m.id}`);b&&(b.getBoundingClientRect().top<=p.bottom&&(n(m.id),s(null),d=!0),m.children.forEach(y=>{let h=document.getElementById(`bespoke-title-${y.id}`);h&&h.getBoundingClientRect().top<=p.bottom&&(s(y.id),n(m.id),d=!0);}));}),d||(n(null),s(null));};return window.addEventListener("scroll",l),()=>{window.removeEventListener("scroll",l);}},[e]);let i=l=>!l||!l?.length?null:jsx(Fragment,{children:l.map(u=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${u.id}`,children:jsxs(Group,{spacing:"sm",children:[t&&jsx(Re,{...u.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:u.label}})]})})}),jsx(Box,{pl:"xs",children:i(u.children)})]},u.id))});return jsxs(Box,{component:"nav",className:"bespoke-nav",children:[jsx(List,{className:"bespoke-nav-level1",sx:kp(r),children:e?.map(l=>jsx(List.Item,{children:jsx(Anchor,{href:`#bespoke-title-${l.id}`,"data-active":o===l.id,onClick:()=>n(l.id),children:jsxs(Group,{spacing:"sm",children:[t&&jsx(Re,{...l.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:l.label}})]})})},l.id))}),o&&e.find(l=>l.id===o)?.children.length>0&&jsx(List,{className:"bespoke-nav-level2",sx:kp(r),children:e.find(l=>l.id===o)?.children.map(l=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${l.id}`,"data-active":l.id===a,children:jsxs(Group,{spacing:"sm",children:[t&&jsx(Re,{...l.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:l.label}})]})})}),l?.children?.length?jsx(Menu.Dropdown,{children:i(l.children)}):null]})},l.id))})]})};});function ai(e){let{related_reports:t,settings:r}=e,o=Q(m=>m.status.currentLocale),n=Q(m=>m.status.localeDefault),a=Nn(),s=useRouter(),{components:i}=ot();if(!t?.length)return;let l=o===n?"":`/${o}`,u=m=>{s.push(`${m}`);},p=i?.ReportTile?i.ReportTile:ks,d=It(r&&r.align?String(r.align):"center");return jsx(Grid,{justify:d,children:t.map(m=>{let b=`${l}${a}${m.link}`,f=m.entities.map(k=>({original_id:k.id,name:k.name,id:k.content_id,variant:k.variant_name,variant_id:k.variant_id,dimension:k.dimension_name,dimension_id:k.dimension_id,image:{src:`/api/cms/member/image?member=${k.content_id}&size=thumb`,alt:k.name}})),y=m.entities.map(k=>k.id).join("-"),h=m.entities.map(k=>k.name).join(" & "),w=m.entities[0]?m.entities[0].report_id:null,L=k=>{k.preventDefault(),u(b);};return jsx(Grid.Col,{xs:12,sm:6,md:4,lg:4,xl:3,children:jsx(p,{reportId:w,reportName:h,members:f,href:b,onClick:L})},y)})})}var _p=v(()=>{c();he();Se();Cs();Or();ze();});function si({id:e,label:t,settings:r,showIcon:o,fullWidth:n,showWhenDisabled:a}){let s=gt(e).data,{sectionVariables:i,resetSectionVariables:l}=Ae(s?.section_id),u=!!Object.keys(i).length,p=It(r&&r.align?r.align:"left");return !u&&!a?null:jsx(Button,{onClick:()=>l(),disabled:!u,fullWidth:n,sx:{justifySelf:p},children:jsxs(Group,{align:"center",children:[t,o&&jsx(IconRefresh,{})]})})}var Mp=v(()=>{c();Se();Se();ze();});function ii({settings:e,label:t,removeLabel:r,showIcon:o,position:n="center",asComparison:a=!1}){let s=Q(k=>k.records.entities.report),i=Q(k=>k.variables.attributes),l=e&&e.search?e.search:"inline",u=Object.values(s)[0].settings,p=useRouter(),{comparisonLoaded:d,loading:m}=Ze(),b=Object.keys(p.query).includes("compare"),y=d&&b?jsx(Button,{onClick:()=>{let k={...p.query};delete k.compare,p.push({pathname:p.pathname,query:k},void 0,{shallow:!0});},rightIcon:jsx(IconX,{}),children:r||"Remove Comparison"}):jsx(Button,{loading:m,children:jsxs(Group,{align:"center",children:[t||"Add Comparison",o&&jsx(IconPlus,{})]})}),h={searchReportParams:{report:[Number(Object.keys(s)[0])],variant:u.compareLevels?[]:[i.variant_id1]}},L=Ho(y,l,k=>{p.push({pathname:p.pathname,query:{...p.query,compare:k.reportPath}});},h);return a?null:jsx(Group,{position:n,children:b?y:L})}var Dp=v(()=>{c();Is();he();Wt();});function ci({columns:e=[],data:t=[],tableProps:r={},sectionId:o=null}){let[n,a]=useState(!1),[s,i]=useState({}),l=useMemo(()=>e.map(m=>m.accessorKey),[e]),u=useMemo(()=>t.filter(m=>typeof m=="object"&&m!==null&&!Array.isArray(m)&&Object.keys(m).some(b=>l.includes(b))),[l,t]),p=useMemo(()=>e.map(m=>({...m,Cell:({renderedCellValue:b})=>jsx(ie,{html:`${b}`}),filterFn:"contains"})),[e]),{locale:d}=useRouter();return useEffect(()=>{(async()=>{try{let b=d||"en",f=`${b.toUpperCase()}`,y=await import(`mantine-react-table/locales/${b}.js`);i(y[`MRT_Localization_${f}`]);}catch(b){console.error("Error loading translations:",b);}})();},[d]),jsx(MantineReactTable,{...r,autoResetPageIndex:!1,columns:p,data:u,enableColumnFilterModes:!0,enableFilterMatchHighlighting:!1,globalFilterFn:"contains",layoutMode:"grid",localization:s,onIsFullScreenChange:m=>{let b=document.getElementById(`section-${o}`);b&&(m?b.style.zIndex="10":b.style.zIndex="1"),a(m);},state:{...r.state,isFullScreen:n}})}var $p=v(()=>{c();we();});function ui({label:e,url:t,settings:r}){let{align:o}=r;return e?jsx(Group,{position:o,grow:o==="justify",children:jsx(Button,{component:"a",target:"_blank",href:t||"",children:e||"Button"})}):null}var Gp=v(()=>{c();});function US({block:e}){let{id:t}=e;return jsxs(Stack,{align:"center",spacing:"sm",children:[jsx(ThemeIcon,{radius:"md",size:100,children:jsx(IconCircleKey,{size:100})}),jsxs(Title,{order:5,children:["Private content (Block ",t,")"]}),jsx(Text,{children:"Sorry, you do not have sufficient permissions to view this block."}),jsx(Text,{children:"Contact your account manager to check your access role."})]})}function pi(e){let t=GS();return jsx(t,{block:e})}var GS,jp=v(()=>{c();Or();GS=()=>{let{components:e}=ot(),t=US;return e?.CustomFallback&&(t=e.CustomFallback),t};});var qS,jS,Wp,WS,ir,Jo=v(()=>{c();La();qS=process.env.NEXT_PUBLIC_REPORTS_LOCALE_DEFAULT||"en",jS="Error Rendering Visualization",Wp={data:[],dataFormat:e=>e,type:"Treemap",noDataHTML:`<p style="font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;">
54
54
  <strong>${jS}</strong>
55
- </p>`},WS=(e,t,r={},o=qS,n=null,a={},s={})=>{let i;try{i=fn({vars:["variables"],logic:e},t,o,a,s)(r);}catch(m){return console.error(`Parsing Error in propify (ID: ${n})`),console.error(`Error message: ${m.message}`),{error:`${m}`,config:Wp}}if(typeof i!="object")return {error:"Visualization JS code must return an object",config:Wp};let l=i.dataFormat?i.dataFormat:m=>{let f=Array.isArray(i.data)&&i.data.length>1&&i.data.some(y=>typeof y=="string")?m:[m];return dataConcat(f,"data")};delete i.dataFormat;let u=i.linksFormat||void 0;delete i.linksFormat;let p=i.nodesFormat||void 0;delete i.nodesFormat;let d=i.topojsonFormat||void 0;return delete i.topojsonFormat,{config:i,dataFormat:l,linksFormat:u,nodesFormat:p,topojsonFormat:d}},ir=WS;});var Fr,di=v(()=>{c();Fr=class extends Kt__default.Component{constructor(t){super(t),this.state={hasError:!1};}static getDerivedStateFromError(t){return {hasError:!0}}componentDidCatch(t,r){console.log("Error information:",r.componentStack),notifications.show({autoClose:!1,color:"red",id:"revalidate-error",message:"Check the console for more details",title:t.message});}render(){return this.state.hasError?this.props.fallback:this.props.children}};});function en({config:e}){return !e||!e.html?null:jsx("div",{className:"bespoke-html",dangerouslySetInnerHTML:{__html:e.html}})}var mi=v(()=>{c();});var Xp={};Aa(Xp,{default:()=>Yp});function Yp(e){let{print:t}=Ue(),{block:r,active:o,locale:n,variables:a,configOverride:s={}}=e,i=Oe(r),l=At(n),u={variables:a},p=useRouter(),{sectionVariables:d,setSectionVariables:m,resetSectionVariables:b}=Ae(r.section_id),f=JSON.stringify(d),y=useMemo(()=>{if(!i?.logic)return {error:"Add a Configuration"};let N=st({logic:i.logic},l,u).logic,z={router:p,section:{variables:d,setVariables:m,resetVariables:b}};return ir(N,l,a,n,r.id,{},z)},[r,o,a,f]),{type:h}=y.config||{},w=h&&fi[h]?h:"Treemap";fi[h]||(y.config={error:`"${h}" is not a valid Visualization Type`});let L=fi[w],k=useMemo(()=>{let{_data:N,...z}=y.config;return JS(z,t)},[y,t]),A={locale:n,variables:a,...k,...s};return jsx("div",{className:"bespoke-Viz",children:jsx("div",{style:{display:"flex",flex:"1 1 100%",minHeight:h==="HTML"?void 0:400},children:jsx(Fr,{fallback:jsx("p",{children:"Error in d3plus viz config."}),children:jsx(L,{style:{flex:1},dataFormat:N=>{y.data&&Array.isArray(y.data)&&y.data.length>1&&y.data.some(C=>typeof C=="string")?N:[N];let F;try{F=y.dataFormat(N);}catch(C){console.log("Error in dataFormat: ",C),F=[];}return F},linksFormat:y.linksFormat,nodesFormat:y.nodesFormat,topojsonFormat:y.topojsonFormat,config:{...A,sectionVariables:f}},"viz-key")})})})}var fi,JS,Qp=v(()=>{c();br();Jo();hr();Se();Se();di();jt();mi();fi={...QS,HTML:en},JS=(e,t)=>{let r={...e};return t&&(r.detectResize=!1,r.detectResizeDelay=0,r.detectVisible=!1,r.detectVisibleInterval=0,r.duration=0,r.shapeConfig={...r.shapeConfig,duration:0}),r};});var tT,rT,Zp,Jp=v(()=>{c();ye();$c();Wc();Yc();$u();qu();ju();Wu();pp();Lp();_p();Mp();Dp();$p();Gp();jp();tT=eT(()=>Promise.resolve().then(()=>(Qp(),Xp)),{ssr:!1}),rT={[g.PARAGRAPH]:bs,[g.STAT]:Ss,[g.SUBTITLE]:Ts,[g.TITLE]:Bs,[g.SELECTOR]:Vs,[g.VIZ]:tT,[g.GENERATOR]:$n,[g.SECTION_FLAG]:$n,[g.IMAGE]:zs,[g.NAV]:ri,[g.RELATED]:ai,[g.RESET_BUTTON]:si,[g.COMPARISON_BUTTON]:ii,[g.TABLE]:ci,[g.BUTTON]:ui,[g.MULTIHIERARCHY_SELECTOR]:js,[g.FALLBACK]:pi},Zp=rT;});var oT,ed,td=v(()=>{c();oT=(e,t)=>{let r=e.allLabel||"All",o=e.colorKey||"",n=e.data||[],a=e.hideLabel||"false",s=e.resetSectionVars||"false",i=e.iconKey||"",l=e.label||"Unlabeled Multihierarchy Selector",u=e.levels||[],p=e.limit||void 0,d=e.placeholder||"",m=e.searchIndexKey||"",b=e.searchIndexSeparator||"",f,y;return e.defaultValue&&e.defaultValueType&&(f=e.defaultValue,y=e.defaultValueType),(!f||!y)&&(f=[],y=""),{allLabel:r,colorKey:o,data:n,defaultValue:f,defaultValueType:y,hideLabel:a,resetSectionVars:s,iconKey:i,id:t,label:l,levels:u,limit:p,placeholder:d,searchIndexKey:m,searchIndexSeparator:b}},ed=oT;});var nT,rd,aT,od,nd=v(()=>{c();ye();vn();nT=e=>Array.isArray(e)?e.map(t=>typeof t=="string"?{id:t,label:t}:t):[],rd=(e,t)=>t===ke.MULTI&&!Array.isArray(e)?[e]:e,aT=(e,t)=>{let r=e.type||ke.SINGLE,o=e.component||"Selector",n=e.hideLabel||"false",a=e.resetSectionVars||"false",s=e.name||"Unlabeled Selector",i=nT(e.options||[]),l;if(e.defaultValue){let u=rd(e.defaultValue,r);yr(r,u,i)&&(l=u);}if(!l){let u=i&&i[0]&&i[0].id||i[0]||"";l=rd(u,r);}return {id:t,name:s,type:r,options:i,component:o,defaultValue:l,hideLabel:n,resetSectionVars:a}},od=aT;});var sT,rn,ad=v(()=>{c();ye();td();nd();sT={[g.SELECTOR]:od,[g.MULTIHIERARCHY_SELECTOR]:ed},rn=sT;});function hi({paragraph:e,tooltip:t,settings:r}){return jsx(ie,{component:"p",html:e||`Lorem ipsum dolor sit amet,
55
+ </p>`},WS=(e,t,r={},o=qS,n=null,a={},s={})=>{let i;try{i=fn({vars:["variables"],logic:e},t,o,a,s)(r);}catch(m){return console.error(`Parsing Error in propify (ID: ${n})`),console.error(`Error message: ${m.message}`),{error:`${m}`,config:Wp}}if(typeof i!="object")return {error:"Visualization JS code must return an object",config:Wp};let l=i.dataFormat?i.dataFormat:m=>{let f=Array.isArray(i.data)&&i.data.length>1&&i.data.some(y=>typeof y=="string")?m:[m];return dataConcat(f,"data")};delete i.dataFormat;let u=i.linksFormat||void 0;delete i.linksFormat;let p=i.nodesFormat||void 0;delete i.nodesFormat;let d=i.topojsonFormat||void 0;return delete i.topojsonFormat,{config:i,dataFormat:l,linksFormat:u,nodesFormat:p,topojsonFormat:d}},ir=WS;});var Fr,di=v(()=>{c();Fr=class extends Kt__default.Component{constructor(t){super(t),this.state={hasError:!1};}static getDerivedStateFromError(t){return {hasError:!0}}componentDidCatch(t,r){console.log("Error information:",r.componentStack),notifications.show({autoClose:!1,color:"red",id:"revalidate-error",message:"Check the console for more details",title:t.message});}render(){return this.state.hasError?this.props.fallback:this.props.children}};});function en({config:e}){return !e||!e.html?null:jsx("div",{className:"bespoke-html",dangerouslySetInnerHTML:{__html:e.html}})}var mi=v(()=>{c();});var Xp={};Aa(Xp,{default:()=>Yp});function Yp(e){let{print:t}=Ue(),{block:r,active:o,locale:n,variables:a,configOverride:s={}}=e,i=Oe(r),l=At(n),u={variables:a},p=useRouter(),{sectionVariables:d,setSectionVariables:m,resetSectionVariables:b}=Ae(r.section_id),f=JSON.stringify(d),y=useMemo(()=>{if(!i?.logic)return {error:"Add a Configuration"};let N=st({logic:i.logic},l,u).logic,z={router:p,section:{variables:d,setVariables:m,resetVariables:b}};return ir(N,l,a,n,r.id,{},z)},[r,o,a,f]),{type:h}=y.config||{},w=h&&fi[h]?h:"Treemap";fi[h]||(y.config={error:`"${h}" is not a valid Visualization Type`});let L=fi[w],k=useMemo(()=>{let{_data:N,...z}=y.config;return JS(z,t)},[y,t]),A={locale:n,variables:a,...k,...s};return console.log("vizConfig",A._printIgnore),jsx("div",{className:"bespoke-Viz","data-ignore-print":A._printIgnore?"true":void 0,children:jsx("div",{style:{display:"flex",flex:"1 1 100%",minHeight:h==="HTML"?void 0:400},children:jsx(Fr,{fallback:jsx("p",{children:"Error in d3plus viz config."}),children:jsx(L,{style:{flex:1},dataFormat:N=>{y.data&&Array.isArray(y.data)&&y.data.length>1&&y.data.some(C=>typeof C=="string")?N:[N];let F;try{F=y.dataFormat(N);}catch(C){console.log("Error in dataFormat: ",C),F=[];}return F},linksFormat:y.linksFormat,nodesFormat:y.nodesFormat,topojsonFormat:y.topojsonFormat,config:{...A,sectionVariables:f}},"viz-key")})})})}var fi,JS,Qp=v(()=>{c();br();Jo();hr();Se();Se();di();jt();mi();fi={...QS,HTML:en},JS=(e,t)=>{let r={...e};return t&&(r.detectResize=!1,r.detectResizeDelay=0,r.detectVisible=!1,r.detectVisibleInterval=0,r.duration=0,r.shapeConfig={...r.shapeConfig,duration:0}),r};});var tT,rT,Zp,Jp=v(()=>{c();ye();$c();Wc();Yc();$u();qu();ju();Wu();pp();Lp();_p();Mp();Dp();$p();Gp();jp();tT=eT(()=>Promise.resolve().then(()=>(Qp(),Xp)),{ssr:!1}),rT={[g.PARAGRAPH]:bs,[g.STAT]:Ss,[g.SUBTITLE]:Ts,[g.TITLE]:Bs,[g.SELECTOR]:Vs,[g.VIZ]:tT,[g.GENERATOR]:$n,[g.SECTION_FLAG]:$n,[g.IMAGE]:zs,[g.NAV]:ri,[g.RELATED]:ai,[g.RESET_BUTTON]:si,[g.COMPARISON_BUTTON]:ii,[g.TABLE]:ci,[g.BUTTON]:ui,[g.MULTIHIERARCHY_SELECTOR]:js,[g.FALLBACK]:pi},Zp=rT;});var oT,ed,td=v(()=>{c();oT=(e,t)=>{let r=e.allLabel||"All",o=e.colorKey||"",n=e.data||[],a=e.hideLabel||"false",s=e.resetSectionVars||"false",i=e.iconKey||"",l=e.label||"Unlabeled Multihierarchy Selector",u=e.levels||[],p=e.limit||void 0,d=e.placeholder||"",m=e.searchIndexKey||"",b=e.searchIndexSeparator||"",f,y;return e.defaultValue&&e.defaultValueType&&(f=e.defaultValue,y=e.defaultValueType),(!f||!y)&&(f=[],y=""),{allLabel:r,colorKey:o,data:n,defaultValue:f,defaultValueType:y,hideLabel:a,resetSectionVars:s,iconKey:i,id:t,label:l,levels:u,limit:p,placeholder:d,searchIndexKey:m,searchIndexSeparator:b}},ed=oT;});var nT,rd,aT,od,nd=v(()=>{c();ye();vn();nT=e=>Array.isArray(e)?e.map(t=>typeof t=="string"?{id:t,label:t}:t):[],rd=(e,t)=>t===ke.MULTI&&!Array.isArray(e)?[e]:e,aT=(e,t)=>{let r=e.type||ke.SINGLE,o=e.component||"Selector",n=e.hideLabel||"false",a=e.resetSectionVars||"false",s=e.name||"Unlabeled Selector",i=nT(e.options||[]),l;if(e.defaultValue){let u=rd(e.defaultValue,r);yr(r,u,i)&&(l=u);}if(!l){let u=i&&i[0]&&i[0].id||i[0]||"";l=rd(u,r);}return {id:t,name:s,type:r,options:i,component:o,defaultValue:l,hideLabel:n,resetSectionVars:a}},od=aT;});var sT,rn,ad=v(()=>{c();ye();td();nd();sT={[g.SELECTOR]:od,[g.MULTIHIERARCHY_SELECTOR]:ed},rn=sT;});function hi({paragraph:e,tooltip:t,settings:r}){return jsx(ie,{component:"p",html:e||`Lorem ipsum dolor sit amet,
56
56
  consectetur adipiscing elit. Etiam justo purus, placerat ac turpis at,
57
57
  dignissim interdum eros. Curabitur non tincidunt libero.
58
58
  Suspendisse quis nibh in massa tincidunt feugiat sit amet vitae nisl.
59
59
  In pulvinar sapien ut tincidunt volutpat. Donec auctor tellus eu augue feugiat,
60
60
  a viverra sapien pulvinar.`,style:r,append:t?jsx(Be,{content:t,style:{display:"inline-block",verticalAlign:"bottom"}}):jsx(Fragment,{}),isPreview:!0})}var sd=v(()=>{c();qt();we();});function yi({subtitle:e,title:t,value:r,tooltip:o,settings:n,_iconType:a,_iconVariant:s,_icon:i,_iconRadius:l,_iconSize:u,_iconPadding:p}){let d=t||"<span class='cr-block-placeholder'>Title</span>",m=r||"<span class='cr-block-placeholder'>Big Stat</span>",b=e||"<span class='cr-block-placeholder'>Subtitle</span>",f=n&&n.align||"left";return jsx("div",{className:"bespoke-Stat-root",children:jsxs(Group,{className:"bespoke-StatGroup-wrapper",position:lt(f),children:[a!=="none"&&a&&jsx(Re,{blockType:"stat",iconType:a,iconVariant:s,iconRadius:l,iconSize:u,icon:i,iconPadding:p}),jsxs("div",{className:"bespoke-Stat-wrapper",children:[jsx(ie,{component:"div",size:"md",html:d,style:n,isPreview:!0}),jsx(ie,{component:"div",size:"xl",html:m,style:n,isPreview:!0}),jsx(ie,{component:"div",size:"sm",html:b,style:n,isPreview:!0})]},"stat"),o&&jsx(Be,{content:o})]})})}var ld=v(()=>{c();qt();Lr();we();ze();});function bi({subtitle:e,tooltip:t,settings:r}){let o=Ve(e)||"<span class='cr-block-placeholder'>Small subtitle.</span>",n=r&&r.align?r.align:"left";return jsxs(Group,{spacing:"sm",position:lt(n),children:[jsx(ie,{size:"sm",html:o,isPreview:!0}),t&&jsx(Be,{content:t,style:{display:"inline-flex"}})]})}var ud=v(()=>{c();qt();wr();we();ze();});function vi({title:e,tooltip:t,_iconType:r,_iconVariant:o,_icon:n,settings:a,_iconRadius:s,_iconSize:i,_iconPadding:l}){let u=Ve(e)||"Title",p=a&&a.order?parseInt(a.order,10):1,d=p<=6?p:1,m=!!(a&&a.search&&a.search!=="off"),b=a&&a.search?a.search:"",f=a&&a.align?a.align:"left";return jsxs(Group,{spacing:"sm",position:lt(f),children:[r!=="none"&&r&&jsx(Re,{blockType:"title",iconType:r,iconVariant:o,iconRadius:s,iconSize:i,icon:n,iconPadding:l}),jsx(ie,{component:"h",order:d,style:a,html:u,isPreview:!0}),m&&jsx(Tooltip,{label:`Click will open '${b}' report search`,children:jsx(ActionIcon,{variant:"light",children:jsx(IconSearch,{size:20})})}),t&&jsx(Be,{content:t})]})}var pd=v(()=>{c();qt();wr();Lr();we();ze();});function xi(e){let{id:t,type:r,defaultValue:o,options:n,name:a,settings:s,hideLabel:i,component:l,resetSectionVars:u,section:p}=e,d=useDispatch(),m=useContext($t),b=Q(x=>x.status.query),{sectionVariables:f,resetSectionVariables:y}=Ae(p),h=kT(t),w=useMemo(()=>b[h]||o,[b[h],r,o]),L=useMemo(()=>CT(b[h],o),[b[h],r,o]),[k,A]=useState(n?.map(x=>({value:x.id,label:x.label,imageUrl:x.imageUrl}))||[]),[N,z]=useState((n||[]).map(x=>x.id).join("-"));useEffect(()=>{let x=n.map(I=>`${I.label}|${I.id}`).join("-");if(N===x)return;z(x);let O=n.map(I=>({value:I.id,label:I.label}));A(O);let D=r===ke.SINGLE?w:L;yr(r,D,n)||d(fs(m,h));},[JSON.stringify(n),t]);let E=()=>{u==="true"&&f&&y();},F=x=>{d(Pr(m,h,x)),E();},C=x=>{d(Pr(m,h,x.join())),E();},R=i==="true"?jsx(Fragment,{}):jsx(ie,{component:"div",html:a,size:"sm",style:s,isPreview:!0});return k.length===0?jsx(Text,{c:"dimmed",size:"xs",children:"No options defined yet. Selector hidden in report."}):k.length===1?jsxs(Text,{c:"dimmed",size:"xs",children:["Only one option defined. Selector hidden in report. ",JSON.stringify(k)]}):{[ke.SINGLE]:l===yn.SEGMENTED_CONTROL?jsxs("div",{children:[R,jsx(SegmentedControl,{data:k,value:k.map(x=>x.value).includes(w)?w:"",onChange:F,fullWidth:!0})]}):jsx(Select,{label:R,data:k,value:w,onChange:F,itemComponent:PT,styles:{label:{display:i==="true"?"none":"block"}}}),[ke.MULTI]:jsx(MultiSelect,{label:R,data:k,value:L,onChange:C,styles:{label:{display:i==="true"?"none":"block"}}})}[r]}var kT,CT,PT,fd=v(()=>{c();Vo();vn();ye();he();Ut();we();Se();kT=e=>`selector${e}id`,CT=(e,t)=>e&&typeof e=="string"?e.split(","):t,PT=forwardRef(function({imageUrl:t,label:r,...o},n){return jsx("div",{ref:n,...o,children:jsxs(Group,{noWrap:!0,children:[t&&jsx(Box,{component:"img",w:25,h:25,src:t}),jsx("div",{children:jsx(Text,{size:"sm",children:r})})]})})});});var gd=v(()=>{});function Ci({dimmed:e=!1,label:t,root:r=!0,value:o,parentIsArray:n=!1,level:a=0}){let s=useMantineTheme();if(a===ki)return null;let i=jsx(Text,{lineClamp:1,size:"xs",variant:"dimmed",p:5,children:"[Max depth hitted for preview]"}),l=Ei(o),u=o,p=JSON.stringify(o),d=!!(p&&p.length>50),m=!!(p&&p.length>1e3),b=10,f={control:{padding:"5px 0px 5px 5px"},label:{padding:"5px 0px"},content:{paddingTop:0,paddingBottom:0,paddingRight:0}};if(l==="object")return jsx(Accordion,{className:"cr-variable-accordion",variant:"contained",styles:f,children:jsxs(Accordion.Item,{value:"label",children:[jsx(Accordion.Control,{children:jsx(Text,{lineClamp:1,size:"xs",weight:700,color:e?"dimmed":s.primaryColor,children:r?`{{${t}}}`:n?`[${t}]`:t})}),jsx(Accordion.Panel,{children:a+1<ki?Object.keys(o).sort((y,h)=>{let w=Ei(o[y]),L=Ei(o[h]);return w!==L?hd.indexOf(w)-hd.indexOf(L):y.localeCompare(h)}).map(y=>jsx(Ci,{root:!1,label:y,value:o[y],level:a+1},y)):i})]})});if(l==="array"){let y=o.length>b,h=y?o.slice(0,b):o,w=y?o.length-b:0;return jsx(Accordion,{className:"cr-variable-accordion",variant:"contained",styles:f,children:jsxs(Accordion.Item,{value:"label",children:[jsx(Accordion.Control,{children:jsx(Text,{lineClamp:1,size:"xs",weight:700,p:0,color:e?"dimmed":s.primaryColor,children:r?`{{${t}}}`:n?`[${t}]`:t})}),jsxs(Accordion.Panel,{children:[a+1<ki?h.map((L,k)=>jsx(Ci,{root:!1,label:k,value:L,level:a+1,parentIsArray:!0},k)):i,y&&jsxs(Text,{lineClamp:1,size:"xs",variant:"dimmed",p:5,children:["[+ ",w," other elements]"]})]})]})})}return l==="string"?u=m?`"${u.substring(0,1e3)} ... "`:`"${u}"`:l==="error"?u=`Error: ${u.message}`:l==="undefined"?u=l:u.toString&&(u=u.toString()),jsxs(Group,{noWrap:!0,spacing:0,children:[jsx(Text,{color:e?"dimmed":s.primaryColor,lineClamp:1,size:"xs",pl:5,style:{overflow:"visible",wordBreak:"keep-all",whiteSpace:"nowrap"},weight:700,children:r?`{{${t}}}`:n?`[${t}]`:t}),jsx(Prism,{className:"cr-variable",language:"jsx",noCopy:!0,scrollAreaComponent:"div",styles:{root:{flex:"1 1 100%",textAlign:"right",overflow:"hidden"},code:{padding:"5px 0 5px 5px"},scrollArea:{marginLeft:"5px"},line:{paddingRight:"5px"}},children:u}),d&&jsxs(HoverCard,{width:400,shadow:"md",withinPortal:!0,children:[jsx(HoverCard.Target,{children:jsx(ActionIcon,{children:jsx(IconCodePlus,{})})}),jsx(HoverCard.Dropdown,{children:jsx(Text,{size:"sm",children:JSON.stringify(o).substring(0,5e3)})})]})]})}var Ei,hd,ki,yd,bd=v(()=>{c();gd();Ei=e=>{let t=typeof e;if(t==="object"){if(e===null)return "undefined";Array.isArray(e)?t="array":["Error","EvalError","ReferenceError","SyntaxError"].includes(e.constructor.name)&&(t="error");}return t},hd=["object","array","string","number"],ki=5;yd=Ci;});var vd,Sd=v(()=>{c();vd=e=>t=>t.replace(new RegExp(`^${e}`),"").startsWith("_");});function NT({reserved:e=[],id:t,variables:r={},showInternal:o=!1}){let a=gt(t==="attributes"?null:t).data,s=a?a.type:"block",i=a?.type&&a?.id?`${a.type}${a.id}`:"",l=Object.keys(r).filter(o?()=>!0:u=>!vd(i)(u));return jsx(Stack,{spacing:0,children:l.length?l.map(u=>jsx(yd,{dimmed:e.includes(u),label:u,value:r[u]},u)):jsx(Text,{color:"dimmed",size:"xs",children:jsx("i",{children:`empty ${s}`})})})}var Td,xd=v(()=>{c();bd();he();Sd();Td=NT;});function qT({outputVariables:e,status:t,hasAPI:r=!1,debug:o,type:n}){let[a,s]=useState(!1),i=r&&!Object.keys(e).length&&!t.error,l=Object.keys(e).some(p=>p.startsWith("_"));return o?i?jsxs(Stack,{align:"center",children:[jsx(Loader,{}),jsxs(Text,{size:"sm",children:["Loading ",n]})]}):jsxs(Fragment,{children:[jsx(Divider,{label:"Output Variables",labelPosition:"center"}),l&&jsx(Switch,{label:"Show internal variables",mb:"xs",size:"xs",checked:a,onChange:p=>s(p.currentTarget.checked)}),jsx(Td,{variables:e,showInternal:a})]}):jsx(Center,{children:jsx(Badge,{color:"gray",variant:"outline",children:n.toUpperCase()},"type")})}var Ai,Rd=v(()=>{c();xd();Ai=qT;});function wi(e){let{alt:t,src:r,desc:o,title:n,settings:a,...s}=e,i=Ve(t),l=Ve(r),u=Ve(o),p=jsx("img",{src:l,alt:i,style:s}),d=a&&a.align?String(a.align):"left";return (u&&u.length||n&&n.length)&&(p=jsxs(Stack,{className:"bespoke-Image-wrapper",align:It(d),spacing:"sm",children:[n&&jsx(ie,{component:"p",html:n,style:a,isPreview:!0}),p,o&&jsx(ie,{component:"p",size:"sm",html:o,style:a,isPreview:!0})]})),l&&i?p:jsx(Center,{mih:100,bg:"white",children:jsx(Badge,{color:"gray",variant:"outline",children:"IMAGE"},"type")})}var Ed=v(()=>{c();wr();we();ze();});function Oi({headings:e,settings:t}){let{min:r="1",max:o="6",icons:n="yes"}=t||{},a=mo(parseInt(r,10),parseInt(o,10),e),s=n==="yes",i=lo(t&&t.align?String(t.align):"left"),l=u=>!u||!u?.length?null:jsx(Fragment,{children:u.map(p=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${p.id}`,children:jsxs(Group,{spacing:"sm",children:[s&&jsx(Re,{...p.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:p.label}})]})})},p.id),jsx(Box,{pl:"xs",children:l(p.children)})]},p.id))});return jsx(Box,{pos:"relative",children:jsxs(List,{sx:u=>({display:"flex",gap:u.spacing.md,justifyContent:i,listStyleType:"none"}),children:[a?.map(u=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:400,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${u.id}`,children:jsxs(Group,{spacing:"sm",noWrap:!0,children:[s&&jsx(Re,{blockType:"nav",...u.iconProps,iconSize:"sm",iconPadding:"2"}),jsx(Text,{dangerouslySetInnerHTML:{__html:u.label}})]})})}),u?.children?.length?jsx(Menu.Dropdown,{children:l(u.children)}):null]})},u.id)),!a||a.length===0&&jsx(List.Item,{children:jsx(Text,{color:"dimmed",children:"- Include some titles as inputs to see the Nav component -"})})]})})}var Ad=v(()=>{c();Js();Lr();ze();});function Bi(e){let{related_reports:t,settings:r}=e;if(!t?.length)return jsx(Text,{children:"There are no available members related to your current selection and report."});let o=lo(r&&r.align?String(r.align):"left");return jsx(List,{sx:()=>({display:"flex",justifyContent:o,"& li":{marginRight:"1rem"}}),children:t.map(n=>jsx(List.Item,{children:n.entities.map(a=>a.name).join(" & ")},n.link))})}var Id=v(()=>{c();ze();});function Ni({id:e,label:t,settings:r,showIcon:o,fullWidth:n,showWhenDisabled:a}){let s=gt(e).data,{sectionVariables:i,resetSectionVariables:l}=Ae(s?.section_id),u=!!Object.keys(i).length,p=It(r&&r.align?r.align:"left");return jsxs(Stack,{align:p,children:[!u&&!a&&jsx(Text,{size:"xs",ta:r?.align||"left",children:"Reset button will not be shown on its disabled state"}),jsx(Button,{onClick:()=>l(),disabled:!u,fullWidth:n,children:jsxs(Group,{align:"center",children:[t,o&&jsx(IconRefresh,{})]})})]})}var Od=v(()=>{c();Se();Se();ze();});function Fi({settings:e,label:t,showIcon:r,position:o="center"}){let n=e&&e.search?e.search:"";return jsxs(Group,{position:o,children:[jsx(Tooltip,{label:`Click will open '${n}' report search`,children:jsx(Button,{children:jsxs(Group,{align:"center",children:[t||"Comparison Button",r&&jsx(IconPlus,{})]})})}),jsx(ActionIcon,{variant:"light",children:jsx(IconSearch,{size:20})})]})}var Md=v(()=>{c();});function Vi({columns:e=[],id:t,data:r=[],tableProps:o={}}){let[n,a]=useState({}),{initialState:s}=o,i=s?.pagination?.pageIndex,l=s?.pagination?.pageSize,u=`table-${[t,i,l].filter(f=>f).join("-")}`,p=useMemo(()=>e.map(f=>f.accessorKey),[e]),d=useMemo(()=>r.filter(f=>typeof f=="object"&&f!==null&&!Array.isArray(f)&&Object.keys(f).some(y=>p.includes(y))),[p,r]),m=useMemo(()=>e.map(f=>({...f,Cell:({renderedCellValue:y})=>jsx(ie,{html:`${y}`,isPreview:!0}),filterFn:"contains"})),[e]),b=Ic();return useEffect(()=>{(async()=>{try{let y=b||"en",h=`${y.toUpperCase()}`,w=await import(`mantine-react-table/locales/${y}.js`);a(w[`MRT_Localization_${h}`]);}catch(y){console.error("Error loading translations:",y);}})();},[b]),createElement(MantineReactTable,{...o,autoResetPageIndex:!1,columns:m,data:d,enableColumnFilterModes:!0,enableFilterMatchHighlighting:!1,globalFilterFn:"contains",key:u,layoutMode:"grid",localization:n,state:{...o.state,isFullScreen:!1}})}var Nd=v(()=>{c();we();Se();});function zi({label:e,url:t,settings:r}){let{align:o}=r;return jsx(Group,{position:o,grow:o==="justify",children:jsx(Button,{component:"a",target:"_blank",href:t||"",children:e||"Button"})})}var Dd=v(()=>{c();});function Ui(e){let t=useDispatch(),r=useContext($t),o=Q(V=>V.status.query),n=Ox(e.id),a=useMantineTheme(),{allLabel:s,colorKey:i,data:l,defaultValue:u,defaultValueType:p,iconKey:d,levels:m,limit:b,placeholder:f,searchIndexKey:y,searchIndexSeparator:h,resetSectionVars:w,section:L}=e,[k,A]=useState(!1),[N,z]=useState(!0),[E,F]=useState(""),[C,R]=useState(!1),[x,O]=useState([""].slice(1)),{sectionVariables:D,resetSectionVariables:I}=Ae(L),P=useMemo(()=>_x(o[`${n}-value`],u),[o,u,n]),Y=useMemo(()=>o[`${n}-type`]||p,[o,p,n]),j=useCallback(()=>{w==="true"&&D&&I();},[w,D,I]),H=useCallback(V=>{j(),t(Pr(r,`${n}-value`,V.join()));},[t,r,n,j]),ee=useCallback(V=>{j(),t(Pr(r,`${n}-type`,V));},[t,r,n,j]),oe=useRef(null),ce=useRef(!1),K=useRef(!!b&&b<P.length),q=x.length,G=m[q],$=x.filter(Boolean);x.length>0&&$.length===0&&$.push(`${s} ${G?.label}`),useEffect(()=>{let V=()=>{z(!0);};return window.addEventListener("touchmove",V),()=>{window.removeEventListener("touchmove",V);}},[]);let M=useMemo(()=>wx(l,m,i,d,y,h),[i,l,d,m,y,h]),_=useMemo(()=>{let V=Ix(E),pe=Array.from(Lx(M,V)).reverse();return C?pe:x.reduce((B,ne)=>B.filter(re=>!ne||re.searchindex.indexOf(ne)>-1),pe.filter(B=>B.type===G?.value))},[G,M,E,C,x]),te=useRef(null),U=Gn({count:k?_.length:0,estimateSize:()=>30,getScrollElement:useCallback(()=>te.current,[]),overscan:10,rangeExtractor:useCallback(V=>Yo(V),[])}),[Z,X]=useState(-1),ae=Math.min(Z,_.length-1),le=useCallback(V=>{let pe=x.concat(V);C&&R(!1),O(pe);},[C,x]),qe=useCallback(()=>{let V=x.slice(0,q-1);C&&R(!1),O(V);},[C,x,q]),ue=useCallback(V=>{F(V.currentTarget.value),!K.current&&l.length>0&&A(!0);},[l,F,K,A]),je=useCallback(()=>{F(""),H([]),oe.current?.focus(),b&&(K.current=!1);},[F,H,oe,b,K]),$e=useCallback(V=>{let pe=P.filter(B=>B!==V);H(pe),b&&pe.length<b&&(K.current=!1);},[P,H,b,K]),We=useCallback(V=>{Y||ee(V.type),Y!==V.type?(ee(V.type),H([V.value])):P.includes(V.value)?$e(V.value):b?(P.length<b&&H([...P,V.value]),P.length===b&&H([...P.slice(1),V.value])):H([...P,V.value]),F("");},[Y,ee,H,P,$e,b]),Eo=useCallback(()=>{P.length>0&&E.length===0&&(H(P.slice(0,-1)),A(!0),b&&(K.current=!1)),E.length>0&&F(E.slice(0,-1));},[P,E,H,F,A,b,K]),ko=useCallback(()=>{z(V=>V&&(ce.current=V,!V)),X(V=>V+1>=_.length?V:V+1);},[X,_]),mr=useCallback(()=>{let V=_[ae];V&&We(V);},[_,ae,We]),Co=useCallback(()=>{A(!1);},[A]),va=useCallback(()=>{qe(),X(0);},[X,qe]),Sa=useCallback(()=>{let V=_[ae];!C&&V&&V.type!==m[m.length-1]?.value&&(le(V.name),X(0));},[_,ae,C,m,X,le]),Ta=useCallback(()=>{z(V=>V&&(ce.current=V,!V)),X(V=>V-1<0?0:V-1);},[X]),xa=({label:V,onRemove:pe,...B})=>jsxs("div",{style:{alignItems:"center",backgroundColor:a.colorScheme==="dark"?a.colors.dark[7]:a.colors.gray[1],borderRadius:a.radius.sm,cursor:"default",color:a.colorScheme==="dark"?a.colors.dark[0]:a.colors.gray[7],display:"flex",fontSize:rem(12),fontWeight:500,height:rem(22),margin:`calc(${a.spacing.xs} / 2 - ${rem(2)}) calc(${a.spacing.xs} / 2)`,maxWidth:`calc(100% - ${rem(10)})`,paddingLeft:`calc(${a.spacing.sm} / 1.5)`,paddingRight:0,userSelect:"none"},...B,children:[jsx("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:V}),jsx(CloseButton,{"aria-hidden":!0,iconSize:"70%",onMouseDown:pe,radius:2,size:"sm",sx:{color:a.colorScheme==="dark"?a.colors.dark[0]:a.colors.gray[7],marginLeft:`calc(${a.spacing.sm} / 6)`},tabIndex:-1})]}),Ra=useMemo(()=>P.map(V=>M.find(pe=>pe.value===V)).filter(V=>!!V).map((V,pe)=>createElement(xa,{...V,index:pe,key:V.value,onRemove:B=>{B.preventDefault(),B.stopPropagation(),$e(V.value);}})),[P]),Ea=forwardRef(function({color:pe,icon:B,label:ne,value:re,...Ke},be){return jsx("div",{ref:be,style:{cursor:"pointer",width:"100%"},...Ke,children:jsxs(Group,{align:"center",noWrap:!0,spacing:"xs",w:"100%",children:[B&&jsx(Box,{bg:pe??"transparent",component:"img",w:20,h:20,src:B}),jsx(Text,{lineClamp:1,size:"sm",children:ne||re})]})})}),{settings:ka}=e,Ca=e.hideLabel==="true"||!e.label?jsx(Fragment,{}):jsx(ie,{component:"div",html:e.label,size:"sm",style:ka,isPreview:!0});return jsx(Input.Wrapper,{label:Ca,children:jsxs(Popover,{closeOnClickOutside:!0,keepMounted:!0,opened:k,onChange:A,onClose:()=>{X(0),F("");},onOpen:()=>{U.scrollToIndex(0);},shadow:"sm",width:"target",withinPortal:!0,children:[jsx(Popover.Target,{children:jsxs(Box,{"aria-haspopup":"listbox",component:"div",onMouseLeave:()=>X(0),sx:{position:"relative","& .defaultValue":{backgroundColor:a.colorScheme==="dark"?a.colors.dark[5]:a.colors.gray[3],color:a.colorScheme==="dark"?a.colors.dark[1]:a.colors.gray[7]}},tabIndex:-1,children:[jsx("input",{type:"hidden",value:P.join(",")}),jsx(Input,{component:"div",multiline:!0,onMouseDown:V=>{V.preventDefault(),!K.current&&l.length>0&&A(!k),oe.current?.focus();},rightSection:P.length>0?jsx(CloseButton,{onClick:je,onMouseDown:V=>V.preventDefault(),variant:"transparent"}):jsx(IconSelector,{color:a.colors.gray[6],size:18,stroke:1.5}),style:{overflow:"hidden"},w:"100%",children:jsxs(Box,{component:"div","data-clearable":!0,sx:{alignItems:"center",boxSizing:"border-box",display:"flex",flexWrap:"wrap",marginLeft:`calc(-${a.spacing.xs} / 2)`,minHeight:`calc(${rem(36)} - ${rem(2)})`,"&[data-clearable]":{marginRight:rem(36)},"&::placeholder":{color:a.colorScheme==="dark"?a.colors.dark[3]:a.colors.gray[5],opacity:1}},children:[Ra,jsx("input",{autoComplete:"off","data-mantine-stop-propagation":k,onChange:ue,onKeyDown:getHotkeyHandler([["ArrowDown",ko],["ArrowLeft",va],["ArrowRight",Sa],["ArrowUp",Ta],["Backspace",Eo],["Enter",mr],["Escape",Co]]),placeholder:P.length===0?f:void 0,ref:oe,readOnly:K.current,style:{appearance:"none",backgroundColor:"transparent",border:0,color:"inherit",flex:1,fontSize:a.fontSizes.sm,marginLeft:`calc(${a.spacing.xs} / 2)`,maxHeight:rem(22),minWidth:rem(60),outline:0,padding:0},type:"search",value:E})]})})]})}),jsx(Popover.Dropdown,{onMouseDown:V=>V.preventDefault(),p:0,children:jsx("div",{style:{display:"flex",maxHeight:rem(300)},children:jsx(Box,{component:"div","data-combobox-popover":!0,onMouseDown:V=>V.preventDefault(),role:"listbox",sx:{width:"100%"},tabIndex:-1,children:jsxs(Stack,{h:"100%",py:"xs",spacing:"xs",w:"100%",children:[m.length>1&&jsxs(Stack,{spacing:"xs",children:[jsxs(Group,{onClick:V=>{V.stopPropagation();},px:"xs",position:"center",spacing:"xs",children:[jsx(Button,{onClick:()=>{X(0),R(!0),O([]),_.length>0&&U.scrollToIndex(0);},size:"xs",variant:C?"filled":"outline",children:s}),m.map((V,pe)=>jsx(Button,{onClick:()=>{C&&R(!1);let B=[""].slice(1),ne=pe;for(;ne--;)B[ne]=x[ne]||"";X(0),O(B),_.length>0&&U.scrollToIndex(0);},size:"xs",variant:!C&&x.length===m.findIndex(B=>B.value===V?.value)?"filled":"outline",children:V?.label},V?.value))]}),jsx(Divider,{})]}),q>0&&jsxs(Group,{align:"center",noWrap:!0,px:"xs",children:[jsx(ActionIcon,{onClick:qe,size:"sm",children:jsx(IconChevronLeft,{})}),jsx("div",{children:$.map(V=>jsx(Text,{lineClamp:1,size:"xs",children:V},`${V}`))})]}),jsx(ScrollArea,{mah:250,onWheel:()=>z(!0),px:"xs",style:{overflow:"auto",width:"100%"},viewportRef:te,viewportProps:{tabIndex:-1},w:"100%",children:jsx("div",{style:{height:`${U.getTotalSize()}px`,position:"relative",width:"100%"},children:U.getVirtualItems().map(V=>{let pe=_[V.index],B=ae===V.index,ne=P.includes(pe.value);return _.length>0&&B&&!N&&U.scrollToIndex(ae),jsxs(Group,{"aria-selected":B,align:"center","data-hovered":B||void 0,"data-index":V.index,"data-selected":ne,id:pe.vale,noWrap:!0,onMouseEnter:re=>{re.preventDefault(),re.stopPropagation(),N&&(X(V.index),z(!1));},onMouseMove:re=>{re.preventDefault(),re.stopPropagation(),z(!0);},onMouseDown:re=>{re.preventDefault(),We(pe);},position:"apart",ref:U.measureElement,role:"option",spacing:"xs",sx:re=>({borderRadius:re.radius.xs,padding:"15px 5px 15px",paddingLeft:C&&10*m.findIndex(Ke=>Ke?.value===pe.type)||5,position:"absolute",top:0,left:0,height:`${V.size}px`,transform:`translateY(${V.start}px)`,width:"100%","&[data-hovered]":{backgroundColor:re.colorScheme==="dark"?re.colors.dark[4]:re.colors.gray[1]},"&:hover":{backgroundColor:re.colorScheme==="dark"?re.colors.dark[4]:re.colors.gray[1]}}),tabIndex:-1,children:[jsx(Ea,{index:V.index,...pe}),!C&&pe.type!==m[m.length-1]?.value&&jsx(ActionIcon,{onMouseDown:re=>{re.preventDefault(),re.stopPropagation(),le(pe.name);},size:"sm",tabIndex:-1,children:jsx(IconChevronRight,{})})]},pe.value)})})})]})})})})]})})}var wx,Ix,Lx,Ox,_x,qd=v(()=>{c();Us();we();Ut();he();Se();Vo();wx=(e=[],t=[],r="",o="",n="",a="|")=>{let s=t.map(y=>y.value).slice(),i=`${s.pop()}`,l=y=>y[r],u=y=>y[o],p=y=>{if(y[n])return typeof y[n]=="string"?y[n].split(a):y[n]},d=new Set,m=[],b=[],f=nest().rollup(y=>{let h=y[0],w=C=>C&&C.value&&!d.has(C.value),L=s.map(C=>h[`${C} ID`]),k=s.map(C=>h[C]),A=s.map((C,R)=>{if(b[R]!==k[R]){b[R]=k[R];let x=l[R]||l[l.length-1]||l,O=u[R]||u[u.length-1]||u,D=p[R]||p[p.length-1]||p;return {color:x(h,C)||void 0,icon:O(h,C)||void 0,value:`${L[R]}`,label:k[R],name:k[R],type:C,searchindex:k.slice(0,R+1).concat(D(h,C)).join("|")}}return {}}).filter(w);A.forEach(C=>d.add(C.value));let N=l[l.length-1]||l,z=u[u.length-1]||u,E=p[p.length-1]||p,F=y.map(C=>({color:N(C,i)||void 0,icon:z(C,i)||void 0,value:`${C[`${i} ID`]}`,label:C[i],name:C[i],type:i,searchindex:k.concat(C[i]).concat(E(C,i)).join("|")}));m.push(...A.concat(F));});return s.forEach(y=>{f.key(h=>`${h[`${y} ID`]}|${h[y]}`);}),f.entries(e),m},Ix=e=>{if(!e)return /./i;let t=e.normalize("NFD").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"[^|]+");return RegExp(t,"i")},Lx=(e,t)=>{let r=e.length,o,n=i=>o&&o.searchindex.includes(i.searchindex),s={next:()=>{for(let i=r-1;i>-1;i--){let l=e[i];if(t.test(`${l.value} ${l.label} ${l.searchindex}`)||n(l))return o=l,r=i,{done:!1,value:l}}return {done:!0,value:void 0}},[Symbol.iterator]:()=>s};return s},Ox=e=>`multihierarchySelector${e}`,_x=(e,t)=>e&&typeof e=="string"?e.split(","):t;});var Wd={};Aa(Wd,{default:()=>Hx});function Gx({block:e,active:t,locale:r,variables:o,debug:n,configOverride:a={}}){let s=$x(),i=Oe(e),l=At(r),u={variables:o},p=useRouter(),{sectionVariables:d,setSectionVariables:m,resetSectionVariables:b}=Ae(e.section_id),f=useMemo(()=>{if(!t)return {error:"Activate to View"};if(!i?.logic)return {error:"Add a Configuration"};let C=st({logic:i.logic},l,u).logic,R={router:p,section:{variables:d,setVariables:m,resetVariables:b}};return ir(C,l,o,r,e.id,{},R)},[i?.logic,t,o,d]);useMemo(()=>{if(!t||!i?.logic)return {};let{logic:C}=i,{vars:R}=at("variables",o,C,l,void 0,u);return R},[e,t]);let {type:h}=f.config||{},w=h&&Gi[h]?h:"Treemap";h||(f.config={error:'Visualization missing "type"'}),Gi[h]||(f.config={error:`"${h}" is not a valid Visualization Type`});let L=Gi[w],k=f.error||f.config?.error||!1;if(k)return jsx(Center,{style:{height:"100%"},children:jsx(Badge,{color:"gray",variant:"outline",children:k},"type")});let{_data:A,...N}=f.config,z={locale:r,variables:o,...N,...a};console.log(s.print,"print aca viz"),s.print&&(z.detectVisible=!1);!s.print&&h!=="Graphic"&&h!=="HTML";return jsx("div",{style:{display:"flex",flex:"1 1 100%"},children:jsx(Fr,{fallback:jsx("p",{children:"Error in d3plus viz config."}),children:jsx(L,{style:{flex:1},dataFormat:C=>{f.data&&Array.isArray(f.data)&&f.data.length>1&&f.data.some(D=>typeof D=="string")?C:[C];let O;try{O=f.dataFormat(C);}catch(D){console.log("Error in dataFormat: ",D),O=[];}return O},linksFormat:f.linksFormat,nodesFormat:f.nodesFormat,topojsonFormat:f.topojsonFormat,config:{...z}},"viz-key")})})}var $x,Ux,Gi,Hx,Kd=v(()=>{c();hr();Wr();mi();Jo();br();Se();di();$x=()=>({}),Ux={},Gi={HTML:en,...QS,...Ux};Hx=memo(Gx,(e,t)=>e.block.contentByLocale.logic.content===t.block.contentByLocale.logic.content&&e.active===t.active&&e.locale===t.locale&&JSON.stringify(e.variables)===JSON.stringify(t.variables)&&JSON.stringify(e.configOverride)===JSON.stringify(t.configOverride));});var jx,Fe,Yd=v(()=>{c();ye();sd();ld();ud();pd();fd();Rd();Ed();Ad();Id();Od();Md();Nd();Dd();qd();jx=eT(()=>Promise.resolve().then(()=>(Kd(),Wd)),{ssr:!1}),Fe={[g.PARAGRAPH]:hi,[g.STAT]:yi,[g.SUBTITLE]:bi,[g.TITLE]:vi,[g.SELECTOR]:xi,[g.VIZ]:jx,[g.GENERATOR]:Ai,[g.SECTION_FLAG]:Ai,[g.IMAGE]:wi,[g.NAV]:Oi,[g.RELATED]:Bi,[g.RESET_BUTTON]:Ni,[g.COMPARISON_BUTTON]:Fi,[g.TABLE]:Vi,[g.BUTTON]:zi,[g.MULTIHIERARCHY_SELECTOR]:Ui};});var Xd=v(()=>{c();ye();({[g.TITLE]:IconHeading,[g.GENERATOR]:IconApi,[g.SECTION_FLAG]:IconFlag,[g.STAT]:IconPercentage,[g.VIZ]:IconChartBar,[g.PARAGRAPH]:IconAlignLeft,[g.SELECTOR]:IconSelector,[g.IMAGE]:IconPhoto,[g.TABLE]:IconTable,[g.MULTIHIERARCHY_SELECTOR]:IconListTree});});var Qd=v(()=>{c();ye();({[g.TITLE]:"Title",[g.GENERATOR]:"Data",[g.STAT]:"Stat",[g.VIZ]:"Visualization",[g.PARAGRAPH]:"Paragraph",[g.SELECTOR]:"Selector",[g.SUBTITLE]:"Subtitle",[g.RESET_BUTTON]:"Reset Button",[g.COMPARISON_BUTTON]:"Comparison Button",[g.RELATED]:"Related Reports",[g.NAV]:"Navigation",[g.IMAGE]:"Image",[g.TABLE]:"Table",[g.BUTTON]:"Button",[g.FALLBACK]:"Fallback",[g.SECTION_FLAG]:"Section Flag",[g.MULTIHIERARCHY_SELECTOR]:"Multihierarchy Selector"});});var oR,Hi,Zd=v(()=>{c();ye();ad();Yd();Xd();Qd();oR={[g.GENERATOR]:{type:g.GENERATOR,renderer:Fe[g.GENERATOR],renderPreviewOnEdit:!1},[g.SECTION_FLAG]:{type:g.SECTION_FLAG,renderer:Fe[g.SECTION_FLAG],renderPreviewOnEdit:!1},[g.IMAGE]:{type:g.IMAGE,renderer:Fe[g.IMAGE],renderPreviewOnEdit:!1},[g.PARAGRAPH]:{type:g.PARAGRAPH,renderer:Fe[g.PARAGRAPH],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[g.RELATED]:{type:g.RELATED,renderer:Fe[g.RELATED],renderPreviewOnEdit:!1,evalWhenNonActive:!1},[g.SELECTOR]:{type:g.SELECTOR,renderer:Fe[g.SELECTOR],adapter:rn[g.SELECTOR],nonActiveAdapter:()=>rn[g.SELECTOR]({name:"Selector Preview"}),renderPreviewOnEdit:!1},[g.STAT]:{type:g.STAT,renderer:Fe[g.STAT],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[g.SUBTITLE]:{type:g.SUBTITLE,renderer:Fe[g.SUBTITLE],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[g.TITLE]:{type:g.TITLE,renderer:Fe[g.TITLE],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[g.VIZ]:{type:g.VIZ,renderer:Fe[g.VIZ],renderPreviewOnEdit:!1},[g.NAV]:{type:g.NAV,renderer:Fe[g.NAV],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[g.RESET_BUTTON]:{type:g.RESET_BUTTON,renderer:Fe[g.RESET_BUTTON],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[g.COMPARISON_BUTTON]:{type:g.COMPARISON_BUTTON,renderer:Fe[g.COMPARISON_BUTTON],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[g.TABLE]:{type:g.TABLE,renderer:Fe[g.TABLE],renderPreviewOnEdit:!1,evalWhenNonActive:!1},[g.BUTTON]:{type:g.BUTTON,renderer:Fe[g.BUTTON],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[g.MULTIHIERARCHY_SELECTOR]:{type:g.MULTIHIERARCHY_SELECTOR,renderer:Fe[g.MULTIHIERARCHY_SELECTOR],adapter:rn[g.MULTIHIERARCHY_SELECTOR],nonActiveAdapter:()=>rn[g.MULTIHIERARCHY_SELECTOR]({label:"Multihierarchy Selector Preview"}),renderPreviewOnEdit:!1}},Hi=oR;});function ia({blockId:e,active:t=!0,asComparison:r=!1}){let{query:o,locale:n=mt}=useRouter(),a=Ze(),s=gt(e).data,i=oo(e,r&&a.active?a?.variables.variables:void 0,r&&a.active?a?.variables.attributes:void 0),l=Oe(s,n),u=At(n),p={variables:i,query:o,locale:n},d=Q(w=>w.variables.variables[s.id]||{}),m=Q(w=>w.variables.status[s.id]||{}),[b,f]=useState(()=>{if(![g.GENERATOR,g.VIZ,g.NAV].includes(s.type)){if(s?.type===g.SELECTOR){let k=Oe(s,n),{config:A}=Kr(s.id,k?.logic,u,p);return {...A,id:s.id,section:s.section_id}}if(s?.type===g.MULTIHIERARCHY_SELECTOR){let k=Oe(s,n),{config:A}=Yr(s.id,k.logic,u,p);return {...A,id:s.id,section:s.section_id}}let w=Vt(l?.logic,u,p),{vars:L}=at("variables",i,w,u,void 0,p);return L}return null});useEffect(()=>{(async()=>{if(!s||s.type===g.GENERATOR)return;if(s.type===g.VIZ){f({block:s,locale:n,variables:i,active:t});return}if(!t&&!Hi[s.type].evalWhenNonActive){let{nonActiveAdapter:A}=Hi[s.type],N=A&&typeof A=="function"?A():{};f(N);return}if(s.type===g.GENERATOR){f({outputVariables:d});return}if(g.SELECTOR===s.type){let A=Oe(s,n),{config:N}=Kr(s.id,A.logic,u,p);f({...N,id:s.id,section:s.section_id});return}if(g.MULTIHIERARCHY_SELECTOR===s.type){let A=Oe(s,n),{config:N}=Yr(s.id,A.logic,u,p);f({...N,id:s.id,section:s.section_id});return}if(s.type===g.NAV){let A=Oe(s,n).simple;f({id:s.id,headings:s.inputs,type:A?.type,section:s.section_id,settings:s.settings});return}if(s.type===g.RELATED){let{related_reports:A}=d;f({related_reports:A});return}if(s.type===g.RESET_BUTTON){f({id:s.id,...l.simple});return}if(s.type===g.COMPARISON_BUTTON){f({id:s.id,...l.simple});return}if(s.type===g.FALLBACK){f({id:s.id,type:s.original_type,roles:s.settings.access});return}let L=Vt(l?.logic,u,p),{vars:k}=at("variables",i,L,u,void 0,p);if(s.type===g.TABLE){f({sectionId:s.section_id,...k});return}f(k);})();},[l,i]);let y=m.allowed||s?.type===g.NAV;if(!s||!b||!y)return null;let h=Zp[s.type];return jsx("div",{id:`bespoke-${s.type}-${s.id}`,className:`cms-block-wrapper bespoke-block-area cms-block-${e}`,children:jsx(h,{...b,settings:s.settings,asComparison:r})})}var em=v(()=>{c();ye();Jp();Zd();br();Se();bn();Wr();kn();Da();za();Wt();});var tm,iR,rm,la,ca=v(()=>{c();tm={margin:{label:"Content Margin",defaultValue:"md",options:[{label:"None",value:"0px"},{label:"Small",value:"sm"},{label:"Medium",value:"md"},{label:"Large",value:"lg"}]},columnGutter:{label:"Column Gutter",defaultValue:"md",options:[{label:"None",value:"0px"},{label:"Small",value:"sm"},{label:"Medium",value:"md"},{label:"Large",value:"lg"}]},width:{label:"Width",defaultValue:"full",options:[{label:"Full Width",value:"full"},{label:"Center",value:"center"}]},position:{label:"Position",defaultValue:"normal",options:[{label:"Normal",value:"normal"},{label:"Sticky",value:"sticky"}]},style:{label:"Style",defaultValue:"none",options:[{label:"None",value:"none"},{label:"Card",value:"card"}]}},iR=Object.keys(tm).reduce((e,t)=>(e[t]=tm[t].defaultValue,e),{}),rm={memberImageBg:!1,optionsMenu:!1,optionData:!0,optionImage:!0,optionShare:!0,showAnchor:!1,...iR},la=e=>({data:typeof e.optionData=="boolean"?e.optionData:!0,image:typeof e.optionImage=="boolean"?e.optionImage:!0,share:typeof e.optionShare=="boolean"?e.optionShare:!0});});function om({previews:e}){let t=e.map((r,o)=>({key:r?`bg-${r.content_id}`:`bg-${o}`,src:r?`/api/cms/member/image?member=${r.content_id}&size=splash`:""}));return jsxs(Fragment,{children:[jsx(Group,{className:"cms-section-bg",grow:!0,spacing:0,style:{position:"absolute",width:"100%",height:"100%"},children:t.map(r=>jsx("div",{className:"cms-section-member-bg",style:{backgroundImage:`url(${r.src})`,backgroundSize:"cover",backgroundPosition:"center center",height:"100%",width:"100%"}},r.key))}),jsx("div",{className:"cms-section-gradient-bg",style:{background:"white",position:"absolute",width:"100%",height:"100%",opacity:.33}})]})}var nm=v(()=>{c();});function am({data:e}){let o=(e&&Array.isArray(e)&&e[0]?Object.keys(e[0]):[]).filter(n=>!n.startsWith("_")).map(n=>({accessorKey:n,header:n,enableSorting:!0,mantineTableBodyCellProps:{sx:{textWrap:"wrap"}}}));return jsx(MantineReactTable,{columns:o,data:e,enableBottomToolbar:!1,enableColumnActions:!1,enablePagination:!1,enableSorting:!0,enableTopToolbar:!1,initialState:{density:"xs"},layoutMode:"grid",mantineTableContainerProps:{sx:{minHeight:100,maxHeight:350}}})}var sm=v(()=>{c();});function xo(e){let t={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'","&#x60;":"`","&nbsp;":""},r=`(?:${Object.keys(t).join("|")})`,o=RegExp(r),n=RegExp(r,"g"),a=String(e).replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();return o.test(a)?a.replace(n,s=>t[s]):a}var ji=v(()=>{c();});function Wi(e){return typeof e=="string"?String(e).replace(/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});/ig," "):e}var im=v(()=>{c();});function fR(e){return e?mR(Wi(xo(e)),{replacement:"-",remove:/[*+~.()'"!:@]/g,lower:!0,strict:!0,trim:!0}):""}var Xt,ln=v(()=>{c();ji();im();Xt=fR;});function dm(e){let{section:t}=e,r=_t(),o=useRouter(),n=Q(M=>M.status.isCMS),a=Q(M=>M.status.currentLocale),s=o.locale,i=n?a:s,l=50,u=At(i),p=Ie("options"),d={...Zi,...p.data_tab},[m,b]=useState([]),[f,y]=useState([]),[h,w]=useState(),[L,k]=useState(),[A,N]=useState(!1),[z,E]=useState({}),[F,C]=useState(!0),[R,x]=useState(!0),{sectionVariables:O,setSectionVariables:D,resetSectionVariables:I}=Ae(t.id),P=t.blocks||[],Y=Q(M=>M),j=useMemo(()=>P.reduce((M,_)=>{let te=Y.records.entities.block[_],U=Y.variables.variables[_],Z=Y.variables.status[_];return (g.GENERATOR===te.type&&U._downloadEnabled===!0&&Z.allowed||g.VIZ===te.type&&Z.allowed)&&(M[_]={entity:te,variables:Y.variables.variables[_],status:Y.variables.status[_],inputVariablesFlat:te.inputs.reduce((X,ae)=>({...X,...Y.variables.variables[ae]}),Y.variables.attributes)}),M},{}),[P]),H=M=>{y(_=>_.includes(M)?_:[..._,M]);},ee=M=>{b(_=>(_.find(U=>U.ix===M.ix)?_:[..._,M]).sort((U,Z)=>U.ix>Z.ix?1:-1));};function oe(M){!h&&M[0]&&ce(M[0]);}function ce(M){w(M),k("0");}useEffect(()=>{let M=async(_,te,U)=>{let Z=dataLoad.bind({});return new Promise((X,ae)=>{Z(te,null,null,(le,qe)=>{if(le)ae(le);else {let ue=U instanceof Function?U(qe):qe;_.data.unshift(ue),ee(_),X(qe);}});})};if(m.length===0&&f.length===0){let _=0;for(let te of Object.values(j)){let U=te.entity;if([g.GENERATOR,g.SECTION_FLAG].includes(U.type)){let Z=te.variables._downloadData||te.variables._downloadUrl||te.status.api;if(Z){let X=[];typeof Z=="string"?X=Z.split(Sn):X=[Z];let ae=te.variables._downloadTitle||`${d.data_source} ${_+1}`,le=te.variables._downloadFileName||ae;ee({ix:_,id:U.id,title:xo(ae),fileName:le,data:Array.isArray(X)?X:[X],loading:!1,type:g.GENERATOR}),H(_),_++;}}else if(U.type===g.VIZ){let Z=Oe(U),X=te.inputVariablesFlat,ae={variables:X},le=st({logic:Z.logic},u,ae).logic,qe={router:o,section:{variables:O,setVariables:D,resetVariables:I}},ue=ir(le,u,X,i,U.id,{},qe),je=ue.config._downloadTitle||ue.config.title||`${d.viz_source} ${_+1}`,$e=ue.config._downloadFileName||je;if(ue.config._downloadEnabled!==!1)try{let We=ue.config._downloadUrl||ue.config.data,Eo=typeof We=="string"?[We]:We,ko=ue.dataFormat instanceof Function?ue.dataFormat:!1,mr=ue.config._downloadDataFormat instanceof Function?ue.config._downloadDataFormat:!1;M({ix:_,id:U.id,title:xo(je),fileName:$e,data:Eo,loading:!1,type:g.VIZ},We,mr||ko),H(_),_++;}catch(We){console.error("DataLoad catch",We);}}}x(!1);}},[j]),useEffect(()=>{m.length===f.length&&oe(m);},[m]),useEffect(()=>{if(h&&L){let M=parseInt(L,10);if(h.data[M]&&(!z[h.ix]||!z[h.ix][L])){C(!0);let _=h.data[L];typeof _=="string"?Ha(_,r,i).then(te=>{let U=MR(te);E({...z,[h.ix]:{...z[h.ix],[M]:U}});}).catch(te=>{console.error(te);}).finally(()=>{C(!1);}):(E({...z,[h.ix]:{...z[h.ix],[M]:_}}),C(!1));}}},[L,h]);let K=(M,_)=>{let te=M===_?"":`-${M}`.toLowerCase();if(h){let U=h.data.length>1&&L?`-${parseInt(L,10)+1}`:"";return `${Xt(h.fileName)}${te}${U}.${_.toLowerCase()}`}return `${te}.${_}`},q=async M=>{if(h){N(!0);let _=new TR,te=K(M,M);try{switch(M){case pa.json.extension:_.file(te,JSON.stringify(G));break;case pa.csv.extension:_.file(te,csvFormat(G));break;case pa.xlsx.extension:let{utils:U,write:Z}=await import('xlsx'),X=U.book_new();U.book_append_sheet(X,U.json_to_sheet(G),te.substring(0,30));let ae=Z(X,{bookType:"xlsx",bookSST:!0,type:"binary"});_.file(te,ae,{binary:!0});break;default:break}_.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:9}}).then(U=>{N(!1),saveAs(U,K(M,"zip"));});}catch(U){console.error(d.error_generating,U),N(!1);}}},G=useMemo(()=>h&&z[h.ix]&&z[h.ix][L]?z[h.ix][L]:[],[z,h,L]),$=useMemo(()=>m&&m.length>0&&m.length===f.length&&m.map((M,_)=>jsx(Button,{leftIcon:jsx(IconDatabase,{size:16}),onClick:()=>ce(M),variant:h?.ix===_?"filled":"default",loading:M.loading,disabled:M.loading,children:M.title},`source-${M.id}-${_}`)),[m,h,f]);return jsxs(Stack,{className:"cms-section-options-data",children:[jsx(Space,{h:"xs"}),jsx(LoadingOverlay,{visible:R,overlayBlur:2}),m.length===0&&!R&&jsxs(Alert,{icon:jsx(IconAlertCircle,{size:"1rem"}),title:"Oops!",children:[d.no_data_src," awa"]}),m.length>1&&m.length===f.length&&!R&&jsx(Input.Wrapper,{label:`${d.choose_data_src}:`,children:jsx(Group,{spacing:"xs",children:$})}),h&&L&&jsx(Stack,{spacing:"xs",children:jsx(Input.Wrapper,{label:`${d.preview}
61
61
  ${G.length>l?d.rows_preview.replace("{nrows}",l):""}:`,children:jsxs(Group,{spacing:"xs",children:[jsx(Select,{disabled:!(h.data.length>1),style:{flex:"1"},value:L,onChange:M=>k(M),data:h.data.map((M,_)=>({value:`${_}`,group:typeof M=="string"?d.raw_group:d.formatted_group,label:typeof M=="string"?M:d.formatted_src.replace("{src}",h.title)})),icon:typeof h.data[L]=="string"?jsx(IconLink,{}):jsx(IconSparkles,{})}),jsx(CopyButton,{value:typeof h.data[L]=="string"?h.data[L]:"",timeout:2e3,children:({copied:M,copy:_})=>jsx(Tooltip,{label:M?d.copied:d.copy,withArrow:!0,position:"top",children:jsx(ActionIcon,{variant:M?"filled":"subtle",onClick:_,disabled:typeof h.data[L]!="string",children:M?jsx(IconClipboardCheck,{size:16}):jsx(IconClipboardCopy,{size:16})})})})]})})}),h&&!F&&G.length===0&&jsx(Alert,{icon:jsx(IconAlertCircle,{size:"1rem"}),title:"Oops!",children:d.error_preview}),h&&L&&!F&&G.length===0&&jsx("a",{href:h.data[L],target:"_blank",rel:"noreferrer",children:jsx(Button,{leftIcon:jsx(IconExternalLink,{size:16}),fullWidth:!0,children:d.open_in_window.replace("{src}",h.title)})}),jsxs(Stack,{pos:"relative",mih:"430px",children:[jsx(LoadingOverlay,{visible:F&&m.length>0,overlayBlur:2}),h&&!F&&G.length>0&&jsxs(Fragment,{children:[jsx(Box,{h:"350px",children:jsx(am,{data:G.slice(0,l)})}),jsx(Input.Wrapper,{label:`${d.download}:`,children:jsx(Button.Group,{children:Object.values(pa).map(M=>jsx(Button,{leftIcon:jsx(M.icon,{size:24}),onClick:()=>q(M.extension),loading:A,fullWidth:!0,children:M.extension},`format-${M.extension}`))})})]})]})]})}var pa,Zi,MR,Ji=v(()=>{c();he();sm();ye();Jo();ln();ji();br();Se();hr();Sr();po();$a();ht();pa={csv:{extension:"CSV",icon:IconFileTypeCsv},json:{extension:"JSON",icon:IconFileTypeJs},xlsx:{extension:"XLSX",icon:IconFileTypeXls}},Zi={data_source:"Data Source",no_data_src:"No data sources defined",viz_source:"Visualization Source",error_generating:"Error generating file.",choose_data_src:"Choose data source",original_src:"Original {src}",loading:"Loading...",error_preview:`Sorry. We could not generate the data preview as a table.
62
- Try to open the source and check the data directly.`,open_in_window:"Open {src} response in a new window",formatted_src:"Formatted {src}",formatted_group:"Formatted Data",raw_group:"Raw Data",rows_preview:"(First {nrows} rows as preview)",choose_format:"Choose format",processing_file:"Processing file...",download:"Download data as",preview:"Preview",copy:"Click to copy",copied:"Copied!"},MR=e=>{let t=[];return e&&e.data&&(e.data&&Array.isArray(e.data)?t=e.data:e.data&&e.data.data&&Array.isArray(e.data.data)?t=e.data.data:e.data&&e.data.data&&e.data.data.results&&Array.isArray(e.data.data.results)?t=e.data.data.results:e.data&&e.data.results&&Array.isArray(e.data.results)&&(t=e.data.results)),t};});function hm(e){let{section:t}=e,r=t.blocks||[],o=Q(U=>r.map(Z=>U.records.entities.block[Z]).filter(Z=>Z.type===g.VIZ&&U.variables.status[Z.id].allowed)),{variant_slug1:n,slug1:a}=Q(U=>U.variables.attributes),s=Rp(),[i,l]=useState(St.section),[u,p]=useState(Tt.png),[d,m]=useState(!1),[b,f]=useState(!1),[y,h]=useState([]),[w,L]=useState(o.length>0?o[0].id:null),k=i!==St.section,{print:A,downloadLoading:N,error:z}=xp(t.id,n,a,k?w:null),[E,F]=useState(!0),[C,R]=useState(!1),x=Ie("options"),O={...tE,...x.image_tab},{siteProps:D}=Ar(),I=D?.logoSrc&&typeof D.logoSrc=="string",P=t?.settings?.name||`section-${t.id}`,Y=`#${P}`,j=useMantineTheme(),H=()=>{let U=ce(w);return select(U).select("svg").size()===1},ee=()=>`${Xt(P)}`,oe=()=>{let U=document.getElementById(P);return select(U).select(".bespoke-section-content").node()},ce=U=>{let Z=oe();return select(Z).select(`#bespoke-visualization-${U}.bespoke-block-area`).node()},K=()=>new Promise(U=>{let Z;i===St.section?Z=oe():i===St.viz&&(Z=ce(w));let X=document.createElement("div");X.style.display="flex",X.style.justifyContent="space-between",X.classList.add("bespoke-Viz-source"),X.style.padding=j.spacing.xs,X.style.width="100%";let ae=document.createElement("div");if(ae.innerText=O.source.replace("{src}",`${window.location}${Y}`),ae.style.fontSize=j.fontSizes.xs,X.appendChild(ae),I){let le=document.createElement("img");le.src=D.logoSrc,le.style.height="30px",le.onload=()=>U(Z),le.onerror=()=>{le.remove(),U(Z);},X.appendChild(le),Z.appendChild(X);}else Z.appendChild(X),U(Z);}),q=U=>{if(E)return "transparent";let Z=select(U).style("background-color");return Z!=="rgba(0, 0, 0, 0)"&&Z!=="transparent"?Z:U===document.body?"white":q(U.parentNode)},G=async(U,Z)=>{let{toPng:X}=await import('html-to-image');X(U,{backgroundColor:Z.background,cacheBust:!0,filter:ae=>ae&&ae.classList?!Z.exclusionClasses.some(le=>ae.classList.contains(le)):!0}).then(ae=>{let le=document.createElement("a");le.download=`${Z.filename}.png`,le.href=ae,le.click(),eE(),m(!1);}).catch(ae=>{console.log(ae);});},$=(U,Z)=>{saveElement(U,{filename:Z.filename,type:"svg",callback:()=>m(!1)},{background:Z.background});},M=async()=>{m(!0);let U=await K(),Z={background:q(U),exclusionClasses:["export-hidden"],filename:ee()},X=u===Tt.png?G:$;try{if(U)X(U,Z);else throw new Error(O.wrong_node)}catch{m(!1);}},_=async()=>{let{toCanvas:U}=await import('html-to-image');Promise.all(o.map(Z=>{let X=ce(Z.id),ae=X.querySelector("g.d3plus-geomap-tileGroup");return ae.style.display="none",U(X).then(le=>(ae.style.display="block",le))})).then(Z=>{h(Z.map(X=>X.toDataURL())),R(!1);});};useEffect(()=>{i===St.viz&&o.length>0?(L(o[0].id),R(!0),_()):i===St.section&&h([]);},[i]),useEffect(()=>{w&&(H()?f(!0):(f(!1),p(Tt.png)));},[w]);useRouter();return jsxs(Stack,{className:"cms-section-options-image",children:[jsx(Space,{h:"xs"}),o.length>0?jsx(Input.Wrapper,{label:`${O.choose_area}:`,children:jsx(SegmentedControl,{fullWidth:!0,value:i,data:[{value:St.section,label:jsxs(Center,{children:[jsx(IconTemplate,{size:"1rem"}),jsx(Box,{ml:10,children:O.entire_section})]})},{value:St.viz,label:jsxs(Center,{children:[jsx(IconChartBar,{size:"1rem"}),jsx(Box,{ml:10,children:O.viz_only})]})}],onChange:U=>{l(U),U===St.section&&p(Tt.png);}})}):jsx(Text,{fw:"700",color:"gray.7",children:`${O.entire_section}:`}),i===St.viz&&o.length>0&&jsxs(Input.Wrapper,{label:`${O.choose_viz}:`,style:{minHeight:"161px",position:"relative"},children:[!C&&y.length>0&&jsx(ScrollArea,{style:{height:250},children:jsx(SimpleGrid,{cols:3,children:o.map((U,Z)=>jsx(Image,{alt:`Viz ${U.id}`,onClick:()=>{L(U.id);},style:{cursor:"pointer",border:w===U.id?"4px solid #228be6":"4px solid #eee"},radius:0,src:y[Z],withPlaceholder:!0},`viz-option-${U.id}`))})}),jsx(LoadingOverlay,{visible:C})]}),b&&i!==St.section&&jsx(Input.Wrapper,{label:`${O.choose_format}:`,children:jsxs(Button.Group,{children:[jsx(Button,{leftIcon:jsx(IconPolaroid,{size:16}),onClick:()=>p(Tt.png),variant:u===Tt.png?"filled":"default",fullWidth:!0,children:Tt.png}),jsx(Button,{leftIcon:jsx(IconCode,{size:16}),onClick:()=>p(Tt.svg),variant:u===Tt.svg?"filled":"default",fullWidth:!0,children:Tt.svg})]})}),jsx(Checkbox,{checked:E,label:`${O.transparent_bg}`,onChange:()=>F(!E),radius:"xl"}),jsx(Button,{leftIcon:jsx(IconDownload,{size:16}),loading:d||N,onClick:s&&u!==Tt.svg?()=>A(E):M,fullWidth:!0,children:jsx("span",{children:d||N?O.processing:O.download.replace("{imageFormat}",u)})})]})}var St,Tt,eE,tE,ym=v(()=>{c();ln();he();ht();Ut();ea();ye();St={viz:"viz",section:"section"},Tt={png:"PNG",svg:"SVG"},eE=()=>{let e=document.getElementsByClassName("bespoke-Viz-source");Array.from(e).forEach(t=>t.remove());},tE={wrong_node:"Wrong node in export",choose_area:"Choose image area",choose_viz:"Choose visualization",choose_format:"Choose format",transparent_bg:"Transparent background",processing:"Processing image...",download:"Download {imageFormat}",entire_section:"Entire section",viz_only:"Visualization only",source:"Source: {src}"};});function vm(e){let{title:t,url:r,disabled:o=!1}=e,n=o?IconCode:IconLink;return jsx(Input.Wrapper,{label:t,children:jsx(Input,{icon:jsx(n,{}),value:r,disabled:o,readOnly:!0,rightSection:jsx(CopyButton,{value:r,timeout:2e3,children:({copied:a,copy:s})=>jsx(Tooltip,{label:a?"Copied":"Copy",withArrow:!0,position:"right",children:jsx(ActionIcon,{variant:a?"filled":"subtle",onClick:s,disabled:o,children:a?jsx(IconClipboardCheck,{size:16}):jsx(IconClipboardCopy,{size:16})})})})})})}var Sm=v(()=>{c();});function xm(e){let{section:t}=e,[r,o]=useState(""),[n,a]=useState(""),[s,i]=useState(!0),l=Ie("options"),u={...AE,...l.share_tab};return useEffect(()=>{a(document.title);let{origin:p,pathname:d}=window.location,m=`${p}${d}`,b=s?t.settings?.name?.length?`#${Xt(t.settings.name)}`:`#section-${t.id}`:"";o(`${m}${b}`);},[s]),jsxs(Stack,{className:"cms-section-options-share",children:[jsx(Space,{h:"xs"}),jsx(vm,{title:`${u.title}: ${n}`,url:r}),jsx(Checkbox,{checked:s,label:u.include_section,onChange:()=>i(!s),radius:"xl"}),jsxs(Group,{position:"center",children:[jsx(FacebookShareButton,{url:r,quote:n,children:jsx(FacebookIcon,{size:32,round:!0})}),jsx(TwitterShareButton,{url:r,title:n,children:jsx(TwitterIcon,{size:32,round:!0})}),jsx(TelegramShareButton,{url:r,title:n,children:jsx(TelegramIcon,{size:32,round:!0})}),jsx(WhatsappShareButton,{url:r,title:n,separator:":: ",children:jsx(WhatsappIcon,{size:32,round:!0})}),jsx(LinkedinShareButton,{url:r,children:jsx(LinkedinIcon,{size:32,round:!0})}),jsx(RedditShareButton,{url:r,title:n,windowWidth:660,windowHeight:460,children:jsx(RedditIcon,{size:32,round:!0})}),jsx(EmailShareButton,{url:r,subject:n,children:jsx(EmailIcon,{size:32,round:!0})})]})]})}var AE,Rm=v(()=>{c();Sm();ht();ln();AE={title:"Title",include_section:"Include Section"};});function Cm(e){let{section:t,initialMode:r,onEnds:o,open:n,title:a}=e,s=la(t.settings),i=useMemo(()=>OE.filter(b=>s[b]),[s]),[l,u]=useState(r||i[0]||"data"),p=Ie("options");useEffect(()=>{r!==l&&u(r);},[r]);let d={...rl,...p},m=useMemo(()=>jsxs(Fragment,{children:[jsxs(Tabs.List,{children:[s.data&&jsx(Tabs.Tab,{value:"data",children:d.download_title}),s.image&&jsx(Tabs.Tab,{value:"image",children:d.image_title}),s.share&&jsx(Tabs.Tab,{value:"share",children:d.share_title})]}),s.data&&jsx(Tabs.Panel,{value:"data",children:jsx(dm,{section:t})}),s.image&&jsx(Tabs.Panel,{value:"image",children:jsx(hm,{section:t})}),s.share&&jsx(Tabs.Panel,{value:"share",children:jsx(xm,{section:t})})]}),[s,t,d]);return jsx("div",{className:"cms-section-options-modal",children:n&&jsx(Modal,{className:"bespoke-options-modal",opened:!0,onClose:()=>o(),size:"xl",title:a,children:jsx(Tabs,{onTabChange:u,value:l,keepMounted:!1,children:m})})})}var rl,OE,Pm=v(()=>{c();Ji();ym();Rm();ht();ca();rl={download_title:"Download Data",image_title:"Save Image",share_title:"Share Link"},OE=["data","image","share"];});function Im(e){let{sectionId:t,disabled:r=!1}=e,[o,n]=useState(!1),[a,s]=useState("data"),i=Mn(t),l=Ie("options"),u={...rl,...l},p=la(i.isSuccess?i.data.settings:{}),d=b=>{s(b),n(!0);},m=()=>{n(!1);};return jsxs("div",{className:"cms-section-options",children:[jsxs(Button.Group,{children:[p.data&&jsx(Button,{variant:"default",size:"xs",compact:!0,onClick:()=>d("data"),"aria-label":u.download_title,disabled:r,children:jsx(IconTable,{size:16})}),p.image&&jsx(Button,{variant:"default",size:"xs",compact:!0,onClick:()=>d("image"),"aria-label":u.image_title,disabled:r,children:jsx(IconCamera,{size:16})}),p.share&&jsx(Button,{variant:"default",size:"xs",compact:!0,onClick:()=>d("share"),"aria-label":u.share_title,disabled:r,children:jsx(IconShare,{size:16})})]}),i.isSuccess&&jsx(Cm,{section:i.data,initialMode:a,open:o,onEnds:m})]})}var Lm=v(()=>{c();Pm();he();ht();ca();});function DE({children:e,containerProps:t},r){return jsx(Flex,{ref:r,className:"bespoke-section-content",pos:"relative",align:"stretch",p:0,direction:{base:"column",md:"row"},wrap:"wrap",...t,children:e})}var ga,Bm,Nm=v(()=>{c();he();Qs();ga=Kt__default.forwardRef(function({children:t,column:r,basis:o,columnSettings:n={},sx:a={},...s},i){let l=Object.values(r).some(m=>m.settings?.display==="inline"),u=n?.width?`${n.width}px`:o,p=n?.width?`${n?.width}px`:"100%",d=n?.full?"100%":p;return jsx(Flex,{ref:i,className:"bespoke-section-col",align:"flex-start",direction:l?"row":"column",wrap:l?"wrap":"nowrap",maw:{base:"100%",md:d},miw:{base:"none",md:300},p:0,pos:"relative",sx:[{flexGrow:1,flexShrink:n?.full?0:1,flexBasis:n?.full?"100%":u},...packSx(a)],...s,children:t})}),Bm=Kt__default.forwardRef(DE);});var Fm=v(()=>{c();});var pn,Dm=v(()=>{c();ze();he();Fm();ye();pn={px:e=>Number.isNaN(parseFloat(e))?"px":`${e}px`.replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"),"%":e=>Number.isNaN(parseFloat(e))?"%":`${e}%`.replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")},{px:{defaultValue:400,min:25,step:5,formatter:pn.px},"%":{defaultValue:50,min:20,max:100,step:5,formatter:pn["%"]}};});var ol,Vm=v(()=>{c();ol={backgroundColor:"#fafafa",block:{padding:10},column:{padding:12},section:{backgroundColor:"white",borderRadius:10,boxShadow:"0px 6px 10px rgba(12, 32, 50, 0.14), 0px 1px 15px rgba(12, 32, 50, 0.12), 0px 3px 5px rgba(12, 32, 50, 0.15)",margin:8,padding:32}};});function al({previews:e,translations:t}){let{print:r}=Ue(),o=useMemo(()=>e.map(({image:n,name:a},s)=>(n?.author||n?.url)&&jsxs(Stack,{spacing:0,children:[n.author&&jsxs(Text,{size:"xs",children:[a," ",t.image_by," ",jsx("strong",{children:n.author})]}),n.url&&jsxs(Text,{size:"xs",children:["URL: "," ",jsx(Anchor,{href:n.url,target:"_blank",children:n.url})]}),s+1<e.length&&jsx(Divider,{})]},n.id)),[e]);return jsx(Fragment,{children:r?jsx(Fragment,{children:o}):jsxs(Popover,{position:"right",children:[jsx(Popover.Target,{children:jsx(ActionIcon,{variant:"light",radius:"xl",children:jsx(IconPhoto,{size:20})})}),jsx(Popover.Dropdown,{children:o})]})})}var Um=v(()=>{c();jt();});function Gm(){let{locales:e}=useRouter(),t=location&&location.pathname.split("/").filter(r=>r.length>0)[0];return e?.includes(t)}var Hm=v(()=>{c();});function JE({name:e,children:t,id:r,sectionSettings:o,sectionStyles:n,previews:a,translations:s}){let{print:i}=Ue(),l=o.memberImageBg&&a.some(({image:p})=>p&&(p.url||p.author)),u=useMemo(()=>o.showAnchor&&o.optionsMenu?"apart":!o.showAnchor&&o.optionsMenu?"right":o.showAnchor&&!o.optionsMenu?"left":"right",[o.showAnchor,o.optionsMenu]);return jsxs(XE,{className:`bespoke-Section-${r} bespoke-Section-root `,settings:o,styles:n?.root||void 0,print:i,children:[o.memberImageBg&&jsx(om,{previews:a}),jsxs(QE,{className:`bespoke-Section-${r} bespoke-Section-container `,settings:o,styles:n?.container,id:e?.length?Xt(e):`section-${r}`,pos:"relative",children:[!i&&jsxs(Group,{position:u,mb:"xs",children:[o.showAnchor&&jsxs(Anchor,{className:"cms-section-anchor",href:`#${o.name?Xt(o.name):"section-"+r}`,sx:{"&:hover .cms-section-name":{visibility:"visible",opacity:1}},children:[jsx(Text,{span:!0,size:"small",children:"#"}),jsx(Text,{span:!0,size:"small",className:"cms-section-name",sx:{visibility:"hidden",opacity:0,transition:"visibility 0s, opacity 0.2s ease-in-out"},children:o.name||"section-"+r})]}),o.optionsMenu&&jsx(Im,{sectionId:r,disabled:!1})]}),jsxs(ZE,{print:i,className:`bespoke-Section-${r} bespoke-Section-container`,settings:o,styles:n?.content,children:[t,l&&jsx(al,{previews:a,translations:s})]})]})]})}function tk({section:e,sectionLoader:t}){let{isEmbed:r}=Ue(),{id:o,settings:n}=e,a={...rm,...n},s=Ze(),i=Q(E=>E),l=Q(E=>E.variables.status),{previews:u,isRunConsumersRunning:p}=Q(E=>E.status),d=s.active&&s.status?u.concat(s.status?.previews||[]):u,m=ot().Section,b=wt(i),f=Object.values(b||{}).filter(E=>E.section_id===o),y=Ie("sections"),h={...YE,...y},w=f.some(E=>{try{return l[E.id].allowed&&![g.GENERATOR,g.SECTION_FLAG].includes(E.type)||E.type===g.NAV}catch{return E.settings.allowed==="always"}}),L=f.filter(E=>![g.GENERATOR,g.SECTION_FLAG].includes(E.type)).reduce((E,F)=>(E[F.blockcol]?E[F.blockcol][F.blockrow]=F:E[F.blockcol]={[F.blockrow]:F},E),{}),k=Object.keys(f).length>0&&!n.hidden&&w,A=Object.keys(L).length;if(!k||s.active&&n.comparisonHide)return null;let N=(E,F=!1)=>{let C=Array.from(new Set(E.map(x=>x.blockcol))).map(x=>({blockcol:x})).sort((x,O)=>Ye(x,O,"blockcol")),R=[];return C.forEach(({blockcol:x})=>{let O=E.filter(D=>D.blockcol===x).sort((D,I)=>Ye(D,I,"blockrow")).map(D=>{if(!D.id||!l[D.id]?.allowed&&D.type!==g.NAV)return null;let{settings:I,type:P}=b[D.id],Y=I.width&&!I.width.stretch&&I.width.unit?pn[I.width.unit](I.width.value):I.display==="inline"?"auto":"100%",j={alignSelf:P===g.VIZ?"stretch":"flex-start",flexGrow:0,margin:"0",width:Y,minWidth:300};return jsx(Box,{className:"bespoke-Block-wrapper",id:`bespoke-Block-${D.id}`,sx:j,py:ol.block.padding,children:jsx(ia,{blockId:D.id,asComparison:F},D.id)},D.id)});R.push(O);}),R.flat()},z=[];if(s.active&&!n.comparisonMerge){let E=f.filter(F=>![g.GENERATOR,g.SECTION_FLAG].includes(F.type)).reduce((F,C)=>({...F,[C.id]:C}),{});z=[jsx(ga,{column:E,basis:"50%",children:N(Object.values(f.filter(F=>![g.GENERATOR,g.SECTION_FLAG].includes(F.type))))},"original"),jsx(ga,{column:E,basis:"50%",children:N(Object.values(f.filter(F=>![g.GENERATOR,g.SECTION_FLAG].includes(F.type))),!0)},"comparison")];}else z=Object.keys(L).sort((E,F)=>-wa(E,F)).map(E=>{let F=L[E],C=n.columnSettings?n.columnSettings[E]:{},R=Object.values(F).sort((x,O)=>Ye(x,O,"blockrow"));return R.some(x=>!l[x.id]||l[x.id].allowed||x.type===g.NAV)?jsx(ga,{column:F,columnSettings:C,basis:`calc(${100/A}% - (10px * ${A}))`,children:R.map(x=>{if(!x.id||!l[x.id]?.allowed&&x.type!==g.NAV)return null;let{settings:O,type:D}=b[x.id],I=O.width&&!O.width.stretch&&O.width.unit?pn[O.width.unit](O.width.value):O.display==="inline"?"auto":"100%",P={alignSelf:D===g.VIZ?"stretch":"flex-start",flexGrow:0,margin:"0",width:I,minWidth:300};return jsx(Box,{className:`bespoke-Block-wrapper bespoke-${x.type}-wrapper`,id:`bespoke-Block-${x.id}`,sx:P,py:ol.block.padding,children:jsx(ia,{blockId:x.id},x.id)},x.id)})},E):null});return jsxs(JE,{id:o,name:e?.settings?.name,previews:d,sectionSettings:a,sectionStyles:m,translations:h,children:[p.includes(o)&&t,jsx(Bm,{containerProps:{gap:a.columnGutter||"md",wrap:s.active?"nowrap":"wrap",sx:{zIndex:20}},children:z}),r&&jsx(ek,{})]})}var YE,sl,XE,QE,ZE,ek,Xm,Qm=v(()=>{c();he();or();em();ca();zr();nm();Lm();Or();ye();Nm();Dm();Vm();jt();ht();Um();Wt();ln();Ut();Hm();YE={image_by:"image by"},sl=(e,t)=>r=>e?e(r,t):{},XE=({settings:e,styles:t,print:r,children:o,...n})=>{let{position:a,shouldBreak:s}=e,i={normal:{position:"relative",backgroundColor:r?"transparent":"initial",borderRadius:0},sticky:{position:"sticky",zIndex:2,top:0,borderRadius:0,borderTop:r?"none":"initial",borderLeft:r?"none":"initial",borderRight:r?"none":"initial"}},l={normal:{radius:0},sticky:{radius:0,withBorder:!0}},u=[i[a],sl(t,e),s?{pageBreakBefore:"always"}:{}];return jsx(Paper,{component:"section",sx:u,...l[a],...n,children:o})},QE=({settings:e,styles:t,children:r,...o})=>{let{width:n}=e,a={center:{zIndex:1},full:{zIndex:1}},s={center:{size:"lg",p:"sm",fluid:!1},full:{fluid:!0,p:"md"}},i=[a[n],sl(t,e)];return jsx(Container,{sx:i,...s[n],...o,children:r})},ZE=({settings:e,styles:t,print:r,children:o,...n})=>{let{style:a}=e,s={none:{},card:{boxShadow:r?"none":"initial"}},i={none:{bg:"transparent"},card:{shadow:r?"none":"lg",p:"md",radius:"md"}},l=[s[a],sl(t,e)];return jsx(Paper,{sx:l,...i[a],...n,"data-screenshot-target":"true",children:o})};ek=()=>{let e=useRouter(),{query:t,locale:r}=e,{siteProps:o={logoSrc:""},profilePrefix:n,pathSegment:a}=Ar(),s=t[a],i=Array.isArray(s)?s.join("/"):[],u=Gm()?`/${r}`:"";u+=`${n}/${i}/`;let p=new URL(u,window.location.href).href;return jsxs(Group,{position:"apart",noWrap:!0,sx:{flexGrow:1},children:[jsx(Anchor,{href:p,target:"_blank",children:p}),jsx("img",{src:o.logoSrc,height:40,width:"auto",alt:"Site Logo"})]})};Xm=tk;});var Zm=v(()=>{c();se();W({name:"abbreviate",description:"Abbreviates a number into a smaller more human-readable number.",logicFactory(e){return t=>e.d3plus.formatAbbreviate(t)},inputType:"number",testValue:"123456",type:"formatter"});});var Jm=v(()=>{c();se();W({name:"abs",description:"Simple Absolute Value.",logicFactory(e){return t=>Math.abs(t)},inputType:"number",testValue:"-123",type:"formatter"});});var nk,ef=v(()=>{c();se();nk=()=>function(t){let o=new RegExp(/([\$0-9\,]+)[A-z\-\s\&]*([\$0-9\,]*)/g).exec(t);return o?(o=o.slice(1).filter(n=>n.length).map(n=>(n.includes(",")&&(n.indexOf(",")===n.length-4?n=n.replace(/,000$/g,"k").replace(/([0-9]+)(,999$)/g,a=>`${parseInt(a)+1}k`):n.indexOf(",")===n.length-8&&(n=n.replace(/,000,000$/g,"M").replace(/([0-9]+)(,999,999$)/g,a=>`${parseInt(a)+1}M`))),n)),o.length===2?o.join(" - "):t.toLowerCase().match(/under|less|\</g)?`< ${o[0]}`:t.toLowerCase().match(/over|more|\+|\>/g)?`${o[0]}+`:`${o[0]}`):"None"},W({name:"bucket",description:"Sanitizes bucket strings to '< n', 'n1 - n2', and 'n+'",logicFactory:nk,inputType:"number",testValue:"1234",type:"formatter"});});var tf=v(()=>{c();se();W({name:"commas",description:"* Rounds to nearest whole number and adds commas.",logicFactory(e){return t=>e.d3.format(",")(Math.round(t))},inputType:"number",testValue:"1234.6",type:"formatter"});});var rf=v(()=>{c();se();W({name:"date",description:"Formats a date into '%B %d, %Y' format.",logicFactory(e){return t=>(typeof t=="string"&&(t=e.d3plus.date(t)),e.d3.timeFormat("%B %d, %Y")(t))},inputType:"date",testValue:"2022-01-01",type:"formatter"});});var of=v(()=>{c();se();W({name:"dollar",description:"Adds a US dollar sign to the beginning of a String or Number.",logicFactory(e){return t=>(typeof t=="number"&&(t=e.d3plus.formatAbbreviate(t)),t.charAt(0)==="-"?t.replace("-","-$"):`$${t}`)},inputType:"number",testValue:"123",type:"formatter"});});var nf=v(()=>{c();se();W({name:"formatFieldName",description:"Based on field name returns a string",logicFactory(e){return t=>{if(t.contentType.toLowerCase()==="stat"){if(t.field==="title")return "Stat label";if(t.field==="value")return "Stat value";if(t.field==="subtitle")return "Stat subtitle";if(t.field==="tooltip")return "Tooltip text"}return t.contentType.toLowerCase()==="section"&&t.field==="short"?"Short title":t.contentType.toLowerCase()==="description"&&t.field==="description"?"Paragraph":t.field}},inputType:"object",testValue:'{"field":"title","contentType":"stat"}',type:"formatter"});});var af=v(()=>{c();se();W({name:"grewTo",description:"Returns the text with grow direction: 'declined from', 'grew to' o 'stayed at'",logicFactory(e){return t=>t<0?"declined from":t>0?"grew to":"stayed at"},inputType:"number",testValue:"-1234",type:"formatter"});});var sf=v(()=>{c();se();W({name:"grewWord",description:"Returns either 'grew', 'declined', or 'stayed' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"declined":t>0?"grew":"stayed"},inputType:"number",testValue:"-1234",type:"formatter"});});var lf=v(()=>{c();se();W({name:"growing",description:"Returns either 'declining', 'growing' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"declining":"growing"},inputType:"number",testValue:"-1234",type:"formatter"});});var mk,cf=v(()=>{c();se();mk=()=>function(t){let{curr:r,currMoe:o=0,prev:n,prevMoe:a=0}=t,s;if(o||a){let i=(-n/r**2)**2*o**2,l=(1/r)**2*a**2;s=Math.sqrt(i+l);}else s=(r-n)/n;return s*100},W({name:"growth",description:"Calculates the growth percentage between two numbers provided the following object format: {curr, prev}. Also supports calculating the growth between two margin of errors using this format: {curr, currMoe, prev, prevMoe}",logicFactory:mk,inputType:"object",testValue:'{"curr":10,"currMoe":0,"prev":13,"prevMoe":0}',type:"formatter"});});var uf=v(()=>{c();se();W({name:"growthPct",description:"Abbreviates a growth value, turns it absolute, and adds a percent sign.",logicFactory(e){return t=>`${e.d3plus.formatAbbreviate(Math.abs(t))}%`},inputType:"number",testValue:"12345",type:"formatter"});});var pf=v(()=>{c();se();W({name:"growthWord",description:"Returns either 'growth' or 'decline' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"decline":"growth"},inputType:"number",testValue:"-1234",type:"formatter"});});var df=v(()=>{c();se();W({name:"highWord",description:"Returns either 'higher than', 'lower than', or 'approximately the same as' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"lower than":t>0?"higher than":"approximately the same as"},inputType:"number",testValue:"0",type:"formatter"});});var mf=v(()=>{c();se();W({name:"increaseWord",description:"Returns either 'increase', 'decrease', or 'change' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"decrease":t>0?"increase":"change"},inputType:"number",testValue:"1234",type:"formatter"});});var ff=v(()=>{c();se();W({name:"increasedWord",description:"Returns either 'increased', 'decreased', or 'remained the same' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"decreased":t>0?"increased":"remained the same"},inputType:"number",testValue:"0",type:"formatter"});});var gf=v(()=>{c();se();W({name:"increasing",description:"Returns either 'decreasing', 'increasing' or 'maintaining' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"decreasing":t>0?"increasing":"maintaining"},inputType:"number",testValue:"-1234",type:"formatter"});});var hf=v(()=>{c();se();W({name:"largerThan",description:"Returns either 'higher than', 'lower than', or 'approximately the same as' depending on the provided number's sign",logicFactory(e){return t=>t<0?"smaller than":t>0?"larger than":"the same as"},inputType:"number",testValue:"-1234",type:"formatter"});});var yf=v(()=>{c();se();W({name:"list",description:"Joins an array of strings together, adding commas and 'and' when necessary.",logicFactory(e){return t=>t.reduce((r,o,n)=>(n?n===t.length-1&&n===1?r+=` and ${o}`:n===t.length-1?r+=`, and ${o}`:r+=`, ${o}`:r+=o,r),"")},inputType:"object",testValue:'["foo","bar","bee"]',type:"formatter"});});var bf=v(()=>{c();se();W({name:"longWord",description:"",logicFactory(e){return t=>t<0?"shorter":t>0?"longer":"similar"},inputType:"number",testValue:"5",type:"formatter"});});var vf=v(()=>{c();se();W({name:"lowerCaseFirst",description:"Converts the first letter of a string to lowercase",logicFactory(e){return t=>typeof t=="string"?t.charAt(0).toLowerCase()+t.slice(1):t},inputType:"string",testValue:"foo",type:"formatter"});});var Sf=v(()=>{c();se();W({name:"moreFewerWord",description:"",logicFactory(e){return t=>t<0?"fewer":"more"},inputType:"number",testValue:"-5",type:"formatter"});});var Tf=v(()=>{c();se();W({name:"moreLess",description:"Returns either 'more' or 'less' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"less":"more"},inputType:"number",testValue:"-5",type:"formatter"});});var xf=v(()=>{c();se();W({name:"moreLess",description:"Returns either 'more than', 'less than', or 'approximately the same' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"less than":t>0?"more than":"approximately the same"},inputType:"number",testValue:"-5",type:"formatter"});});var Rf=v(()=>{c();se();W({name:"olderWord",description:"",logicFactory(e){return t=>t<0?"getting younger":t>0?"getting older":"staying the same age"},inputType:"number",testValue:"-5",type:"formatter"});});var Ef=v(()=>{c();se();W({name:"olderYounger",description:"",logicFactory(e){return t=>t<0?"younger than":t>0?"older than":"the same age as"},inputType:"number",testValue:"-5",type:"formatter"});});var kf=v(()=>{c();se();W({name:"plural",description:"Pluralizes a word.",logicFactory(e){return t=>t.replace(/\w$/g,r=>r==="y"?"ies":`${r}s`)},inputType:"string",testValue:"Foo",type:"formatter"});});var Cf=v(()=>{c();se();W({name:"pxToInt",description:"Takes a pixel value and converts it to an integer",logicFactory(e){return t=>parseInt(t.replace(/\D+/g,""),10)},inputType:"string",testValue:"12px",type:"formatter"});});var Pf=v(()=>{c();se();W({name:"salary",description:"Displays salary values with proper precision (ie. '$74,200' instead of '$74.2k')",logicFactory(e){return t=>{let r;return t<1e6?r=e.d3.format(",")(t.toFixed(0)):r=e.d3plus.formatAbbreviate(t),`$${r}`}},inputType:"number",testValue:"1000000",type:"formatter"});});var Af=v(()=>{c();se();W({name:"stripEntities",description:"Removes non breaking spaces & other html entities from a string",logicFactory(e){return t=>typeof t=="string"?String(t).replace(/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});/ig," "):t},inputType:"string",testValue:"<b>MyText</b>",type:"formatter"});});var il,wf=v(()=>{c();se();il=W({name:"stripHTML",description:"Converts html tags to spaces, then removes redundant spaces",logicFactory(e){return t=>{let r={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'","&#x60;":"`","&nbsp;":""},o=`(?:${Object.keys(r).join("|")})`,n=RegExp(o),a=RegExp(o,"g"),s=String(t).replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();return n.test(s)?s.replace(a,i=>r[i]):s}},inputType:"string",testValue:"<b>My text</b>",type:"formatter"});});var If=v(()=>{c();se();W({name:"stripOL",description:"Removes ordered list wrapper tags from a string.",logicFactory(e){return t=>t.replace(/<ol>/g,"").replace(/<\/ol>/g,"")},inputType:"string",testValue:"<ol><li>My list</li></ol>",type:"formatter"});});var Lf=v(()=>{c();se();W({name:"stripP",description:"Removes all paragraph tags from a string.",logicFactory(e){return t=>t.replace(/<p>/g,"").replace(/<\/p>/g,"")},inputType:"string",testValue:"<p>My p</p>",type:"formatter"});});var Of=v(()=>{c();se();W({name:"stripUL",description:"Removes unordered list wrapper tags from a string.",logicFactory(e){return t=>t.replace(/<ul>/g,"").replace(/<\/ul>/g,"")},inputType:"string",testValue:"<ul><li>My list</li></ul>",type:"formatter"});});var _f=v(()=>{c();se();W({name:"toKebabCase",description:"Takes a camelCase or PascalCase string and converts it to kebab-case.",logicFactory(e){return t=>typeof t=="string"?(t=t.charAt(0).toLowerCase()+t.substring(1),t.replace(/([A-Z])/g,"-$1").toLowerCase()):"invalid string passed to toKebabCase()"},inputType:"string",testValue:"camelCaseText",type:"formatter"});});var Bf=v(()=>{c();se();W({name:"toSpacedCase",description:"Takes a camelCase or PascalCase string and adds spaces (I know Spaced Case isn't a thing, deal with it).",logicFactory(e){return t=>typeof t=="string"?t.replace(/([A-Z])/g," $1").toLowerCase().trim():"invalid string passed to toSpacedCase()"},inputType:"string",testValue:"camelCaseText",type:"formatter"});});var Mf=v(()=>{c();se();W({name:"upperCaseFirst",description:"Converts the first letter of a string to uppercase",logicFactory(e){return t=>t.charAt(0).toUpperCase()+t.slice(1)},inputType:"string",testValue:"my name",type:"formatter"});});var Nf=v(()=>{c();Zm();Jm();ef();tf();rf();of();nf();af();sf();lf();cf();uf();pf();df();mf();ff();gf();hf();yf();bf();vf();Sf();Tf();xf();Rf();Ef();kf();Cf();Pf();Af();wf();If();Lf();Of();_f();Bf();Mf();});function zf({onDownloadPDF:e,onDownloadCSV:t}){let[r,o]=useState(!1),[n,a]=useState(!1),[s,i]=useState(!1),l=useMediaQuery("(max-width: 768px)"),u=Ie("export"),p={...Wk,...u},d=async()=>{if(e){o(!0);try{await e();}finally{o(!1),i(!1);}}},m=async()=>{if(t){a(!0);try{await t();}finally{a(!1),i(!1);}}},b=(h,w,L,k,A,N)=>jsx(Button,{id:N,size:"sm",onClick:h,disabled:w,fullWidth:!0,variant:"subtle",h:"auto",px:"xs",w:"100%",styles:z=>({inner:{width:"100%",display:"block"}}),children:jsxs(Group,{noWrap:!0,position:"left",spacing:"xs",w:"100%",children:[w?jsx(Loader,{size:"1.75rem"}):L,jsxs(Stack,{spacing:0,w:"100%",py:"0.5rem",className:"bespoke-report-download-btn-text-container",children:[jsx(Text,{w:"100%",size:"sm",lineClamp:1,className:"bespoke-report-download-btn-text-container-cta",children:k}),A&&jsx(Text,{size:"xs",w:"100%",lineClamp:2,maw:"100%",style:{wordWrap:"break-word",whiteSpace:"normal"},variant:"dimmed",lh:"0.9rem",h:"1.9rem",className:"bespoke-report-download-btn-text-desc",children:A})]})]})}),f=e&&b(d,r,jsx(IconFileTypePdf,{size:"1.75rem"}),p.pdf.label,p.pdf.desc,"bespoke-download-pdf-btn"),y=t&&b(m,n,jsx(IconFileTypeXls,{size:"1.75rem"}),p.xlsx.label,p.xlsx.desc,"bespoke-download-xlsx-btn");return e||t?jsx(Affix,{position:{bottom:l?rem(0):rem(20),right:l?rem(0):rem(20)},id:"bespoke-report-download-affix",style:{width:l?"100%":"auto",boxShadow:l?"0px -2px 6px rgba(0, 0, 0, 0.1)":"0px 2px 6px rgba(0, 0, 0, 0.1)",borderRadius:"0.25rem",background:"white"},p:"xs",children:jsxs(Popover,{opened:s,onChange:i,position:"top",shadow:"md",width:l?"100%":250,id:"bespoke-report-download-popover",children:[jsx(Popover.Target,{children:jsx(Button,{id:"bespoke-report-download-btn",size:"sm",onClick:()=>i(h=>!h),leftIcon:jsx(IconDownload,{size:"1.2rem"}),variant:"subtle",loading:r||n,fullWidth:l,children:p.export})}),jsx(Popover.Dropdown,{p:"0.5rem",children:jsxs(Stack,{spacing:"xs",children:[f,y]})})]})}):null}var Wk,$f=v(()=>{"use client";c();ht();Wk={export:"Export",pdf:{label:"Download PDF",desc:"Generates a printable version of the report page in PDF format."},xlsx:{label:"Download XLSX",desc:"Creates a downloadable spreadsheet of the report page data."}};});function Qk(e,t){let r=e.replace(/[:\\/?*[\]]/g,"");return r.trim().length===0&&(r=`Sheet${t+1}`),r.slice(0,31)}function Zk(e){let t=new ArrayBuffer(e.length),r=new Uint8Array(t);for(let o=0;o<e.length;o++)r[o]=e.charCodeAt(o)&255;return t}function Uf(e){return `data_export_${new Date().toISOString()}`}var Xk,Jk,Gf,Hf=v(()=>{c();Xk=e=>new Promise((t,r)=>{let o="xlsx";if(!e||e.length===0){r(new Error("No data provided"));return}try{let n=Ro.utils.book_new();e.forEach((l,u)=>{if(l.data&&l.data.length>0){let p=l.data[0],d=Ro.utils.json_to_sheet(p),m=Qk(l.fileName||`Sheet${u+1}`,u),b=1;for(;n.SheetNames.includes(m);){let f=` (${b})`;m=`${m.slice(0,31-f.length)}${f}`,b++;}Ro.utils.book_append_sheet(n,d,m);}});let a=Ro.write(n,{bookType:"xlsx",type:"binary"}),s=new Blob([Zk(a)],{type:"application/octet-stream"}),i=new TR;i.file(`${Uf(o)}.xlsx`,s),i.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:9}}).then(l=>{t(l);}).catch(r);}catch(n){r(n);}});Jk=async e=>{try{let t=await Xk(e);saveAs(t,`${Uf("xlsx")}.zip`);}catch(t){console.error("Error generating file:",t);}},Gf=Jk;});function Ue(){let e=useContext(Kf);if(e===void 0)throw new Error("usePrint must be used within a PrintContext");return e}function cC(e){return useMemo(()=>e.data.reduce((r,o)=>(o.blocks&&o.blocks.forEach(n=>{r[n]=o.id;}),r),{}),[e.data])}function uC({pathSegmentsKey:e="bespoke",sectionLoader:t,mode:r}){let{query:o}=useRouter(),n=zo(),a=Ze(),s=Xo(),i=Ig(o.print)??!1,l=r==="embed",{printReport:u,error:p,setError:d}=Jn();Yn();let m=jf.locale,b=At(m),f=useMemo(()=>n.data?.sort(Ye).filter(R=>R.settings?.hidden!==!0).reduce((R,x)=>(x.blocks&&x.blocks.length>0&&R.push(...x.blocks),R),[]),[n.data]),y=cC({data:n.data||[]}),{sectionsVariables:h,resetSectionVariables:w,setSectionVariables:L}=wc(n.data?.map(R=>R.id)||[]),k=Q(R=>R),A=Ie("options"),N={...Zi,...A.data_tab},z=useMemo(()=>f.reduce((R,x)=>{let O=k.records.entities.block[x],D=k.variables.status[x];return g.VIZ===O?.type&&D.allowed&&R.push({id:x,entity:O,variables:k.variables.variables[x],status:k.variables.status[x],inputVariablesFlat:O.inputs.reduce((I,P)=>({...I,...k.variables.variables[P]}),k.variables.attributes)}),R},[]),[f,k.records.entities.block,k.variables.attributes,k.variables.status,k.variables.variables]);function E(R){return R=R.replace(/<p>/g,""),R=R.replace(/<\/p>/g,""),R}let F=async(R,x,O)=>{let D=dataLoad.bind({});return new Promise((I,P)=>{D(x,null,null,(Y,j)=>{if(Y)P(Y);else try{R||(R={data:[]}),Array.isArray(R.data)||(R.data=[]);let H=O instanceof Function?O(j):j;R.data.unshift(H),R.rawData=j,I(R);}catch(H){P(H);}});})},C=async()=>{if(!s.XlsxVizActive)return;let R=[],x=[],O=0,D=1;for(let Y of z){let j=Y.entity,H=Oe(j),ee=Y.inputVariablesFlat,oe={variables:ee},ce=st({logic:H.logic},b,oe).logic,K={router:jf,section:{variables:h[y[j.id]],setVariables:L(h[y[j.id]]),resetVariables:w(h[y[j.id]])}},q=ir(ce,b,ee,m,j.id,{},K),G=q.config._downloadTitle||q.config.title||`${N.viz_source} ${O+1}`,$=q.config._downloadFileName||G;if(q.config._downloadEnabled!==!1){let M=q.config._downloadUrl||q.config.data;if(!M){console.error("API is undefined for block:",j.id);continue}let _=typeof M=="string"?[M]:M,te=q.dataFormat instanceof Function?q.dataFormat:!1,U=q.config._downloadDataFormat instanceof Function?q.config._downloadDataFormat:!1,Z=q.config._downloadSectionName,X=q.config._downloadSource;try{let ae=await F({ix:O,id:j.id,title:il(G),fileName:X?Z?`${D} ${E(Z)}`:`${D} ${$}`:Z?E(Z):$,data:_,loading:!1,type:g.VIZ},M,U||te);if(X){let le=Array.isArray(ae.rawData)?ae.rawData:[ae.rawData],qe=new Set;le.forEach((ue,je)=>{let $e=X(ue);qe.has($e.link)||(qe.add($e.link),x.push({Name:Z?`${D} ${E(Z)} - ${$}${le.length>1?` (${je+1})`:""}`:`${D} ${$}${le.length>1?` (${je+1})`:""}`,Source:`${$e.name} - ${$e.description} (${$e.link})`}),D++);});}R.push(ae),O++;}catch(ae){console.error(`Error loading data for block ${j.id}:`,ae);}}}let I=R,P={fileName:"Metadata",data:x.length>0?[x]:[]};return I.unshift(P),I};return jsxs(Kf.Provider,{value:{print:i,isEmbed:l},children:[jsxs(Container,{id:"bespoke-report",className:a.comparisonLoaded?"compare":"",p:0,pos:"relative",fluid:!0,children:[n.isSuccess&&n.data.sort(Ye).map(R=>jsx(Xm,{section:R,sectionLoader:t},R.id)),pC({pdf:s,print:i,printReport:u,downloadCSV:Gf,isPosition:Qn,handleLoadData:C})]}),p&&jsx(Affix,{position:{bottom:rem(80),right:rem(20)},children:jsx(Notification,{title:"Error",color:"red",onClose:()=>d(null),icon:jsx(IconX,{size:"1.1rem"}),children:p})})]})}function pC({pdf:e,print:t,printReport:r,downloadCSV:o,isPosition:n,handleLoadData:a}){return t||!n(e.position,"DEFAULT")?null:e.active||e.XlsxVizActive?jsx(zf,{onDownloadPDF:e.active?r:void 0,onDownloadCSV:e.XlsxVizActive?async()=>{let s=await a();s&&s.length>0?await o(s):console.error("No data loaded for CSV download");}:void 0}):null}var Kf,Yf,jt=v(()=>{c();he();zr();Qm();Wt();Xn();Ws();ea();ei();ye();br();hr();Se();Jo();Nf();ht();$f();Hf();Ji();Kf=createContext({print:!1,isEmbed:!1});Yf=uC;});c();c();Ut();jt();Ys();ht();Wt();Xn();co();function mC({pathSegmentsKey:e="bespoke",translations:t,bespokeStyles:r,buildTime:o,siteProps:n,profilePrefix:a="/defaultPath",loader:s=jsx(LoadingOverlay,{visible:!0}),sectionLoader:i=jsx(LoadingOverlay,{visible:!0}),mantineProviderProps:l={},mode:u}){return Kn(e)?jsx(Fragment,{children:s}):jsx(MantineProvider,{...l,theme:{other:{bespokeStyles:r}},inherit:!0,children:jsxs(Nc,{pathSegment:"bespoke",profilePrefix:a,siteProps:n,children:[jsx(xs,{translations:t,children:jsx(Os,{children:jsx(Xs,{children:jsx(tu,{pageSize:12,children:jsx(Yf,{sectionLoader:i||s,mode:u})})})})}),jsx("small",{className:"bespoke-timestamp",children:o})]})})}/*! Bundled license information:
62
+ Try to open the source and check the data directly.`,open_in_window:"Open {src} response in a new window",formatted_src:"Formatted {src}",formatted_group:"Formatted Data",raw_group:"Raw Data",rows_preview:"(First {nrows} rows as preview)",choose_format:"Choose format",processing_file:"Processing file...",download:"Download data as",preview:"Preview",copy:"Click to copy",copied:"Copied!"},MR=e=>{let t=[];return e&&e.data&&(e.data&&Array.isArray(e.data)?t=e.data:e.data&&e.data.data&&Array.isArray(e.data.data)?t=e.data.data:e.data&&e.data.data&&e.data.data.results&&Array.isArray(e.data.data.results)?t=e.data.data.results:e.data&&e.data.results&&Array.isArray(e.data.results)&&(t=e.data.results)),t};});function hm(e){let{section:t}=e,r=t.blocks||[],o=Q(U=>r.map(Z=>U.records.entities.block[Z]).filter(Z=>Z.type===g.VIZ&&U.variables.status[Z.id].allowed)),{variant_slug1:n,slug1:a}=Q(U=>U.variables.attributes),s=Rp(),[i,l]=useState(St.section),[u,p]=useState(Tt.png),[d,m]=useState(!1),[b,f]=useState(!1),[y,h]=useState([]),[w,L]=useState(o.length>0?o[0].id:null),k=i!==St.section,{print:A,downloadLoading:N,error:z}=xp(t.id,n,a,k?w:null),[E,F]=useState(!0),[C,R]=useState(!1),x=Ie("options"),O={...tE,...x.image_tab},{siteProps:D}=Ar(),I=D?.logoSrc&&typeof D.logoSrc=="string",P=t?.settings?.name||`section-${t.id}`,Y=`#${P}`,j=useMantineTheme(),H=()=>{let U=ce(w);return select(U).select("svg").size()===1},ee=()=>`${Xt(P)}`,oe=()=>{let U=document.getElementById(P);return select(U).select(".bespoke-section-content").node()},ce=U=>{let Z=oe();return select(Z).select(`#bespoke-visualization-${U}.bespoke-block-area`).node()},K=()=>new Promise(U=>{let Z;i===St.section?Z=oe():i===St.viz&&(Z=ce(w));let X=document.createElement("div");X.style.display="flex",X.style.justifyContent="space-between",X.classList.add("bespoke-Viz-source"),X.style.padding=j.spacing.xs,X.style.width="100%";let ae=document.createElement("div");if(ae.innerText=O.source.replace("{src}",`${window.location}${Y}`),ae.style.fontSize=j.fontSizes.xs,X.appendChild(ae),I){let le=document.createElement("img");le.src=D.logoSrc,le.style.height="30px",le.onload=()=>U(Z),le.onerror=()=>{le.remove(),U(Z);},X.appendChild(le),Z.appendChild(X);}else Z.appendChild(X),U(Z);}),q=U=>{if(E)return "transparent";let Z=select(U).style("background-color");return Z!=="rgba(0, 0, 0, 0)"&&Z!=="transparent"?Z:U===document.body?"white":q(U.parentNode)},G=async(U,Z)=>{let{toPng:X}=await import('html-to-image');X(U,{backgroundColor:Z.background,cacheBust:!0,filter:ae=>ae&&ae.classList?!Z.exclusionClasses.some(le=>ae.classList.contains(le)):!0}).then(ae=>{let le=document.createElement("a");le.download=`${Z.filename}.png`,le.href=ae,le.click(),eE(),m(!1);}).catch(ae=>{console.log(ae);});},$=(U,Z)=>{saveElement(U,{filename:Z.filename,type:"svg",callback:()=>m(!1)},{background:Z.background});},M=async()=>{m(!0);let U=await K(),Z={background:q(U),exclusionClasses:["export-hidden"],filename:ee()},X=u===Tt.png?G:$;try{if(U)X(U,Z);else throw new Error(O.wrong_node)}catch{m(!1);}},_=async()=>{let{toCanvas:U}=await import('html-to-image');Promise.all(o.map(Z=>{let X=ce(Z.id),ae=X.querySelector("g.d3plus-geomap-tileGroup");return ae.style.display="none",U(X).then(le=>(ae.style.display="block",le))})).then(Z=>{h(Z.map(X=>X.toDataURL())),R(!1);});};useEffect(()=>{i===St.viz&&o.length>0?(L(o[0].id),R(!0),_()):i===St.section&&h([]);},[i]),useEffect(()=>{w&&(H()?f(!0):(f(!1),p(Tt.png)));},[w]);useRouter();return jsxs(Stack,{className:"cms-section-options-image",children:[jsx(Space,{h:"xs"}),o.length>0?jsx(Input.Wrapper,{label:`${O.choose_area}:`,children:jsx(SegmentedControl,{fullWidth:!0,value:i,data:[{value:St.section,label:jsxs(Center,{children:[jsx(IconTemplate,{size:"1rem"}),jsx(Box,{ml:10,children:O.entire_section})]})},{value:St.viz,label:jsxs(Center,{children:[jsx(IconChartBar,{size:"1rem"}),jsx(Box,{ml:10,children:O.viz_only})]})}],onChange:U=>{l(U),U===St.section&&p(Tt.png);}})}):jsx(Text,{fw:"700",color:"gray.7",children:`${O.entire_section}:`}),i===St.viz&&o.length>0&&jsxs(Input.Wrapper,{label:`${O.choose_viz}:`,style:{minHeight:"161px",position:"relative"},children:[!C&&y.length>0&&jsx(ScrollArea,{style:{height:250},children:jsx(SimpleGrid,{cols:3,children:o.map((U,Z)=>jsx(Image,{alt:`Viz ${U.id}`,onClick:()=>{L(U.id);},style:{cursor:"pointer",border:w===U.id?"4px solid #228be6":"4px solid #eee"},radius:0,src:y[Z],withPlaceholder:!0},`viz-option-${U.id}`))})}),jsx(LoadingOverlay,{visible:C})]}),b&&i!==St.section&&jsx(Input.Wrapper,{label:`${O.choose_format}:`,children:jsxs(Button.Group,{children:[jsx(Button,{leftIcon:jsx(IconPolaroid,{size:16}),onClick:()=>p(Tt.png),variant:u===Tt.png?"filled":"default",fullWidth:!0,children:Tt.png}),jsx(Button,{leftIcon:jsx(IconCode,{size:16}),onClick:()=>p(Tt.svg),variant:u===Tt.svg?"filled":"default",fullWidth:!0,children:Tt.svg})]})}),jsx(Checkbox,{checked:E,label:`${O.transparent_bg}`,onChange:()=>F(!E),radius:"xl"}),jsx(Button,{leftIcon:jsx(IconDownload,{size:16}),loading:d||N,onClick:s&&u!==Tt.svg?()=>A(E):M,fullWidth:!0,children:jsx("span",{children:d||N?O.processing:O.download.replace("{imageFormat}",u)})})]})}var St,Tt,eE,tE,ym=v(()=>{c();ln();he();ht();Ut();ea();ye();St={viz:"viz",section:"section"},Tt={png:"PNG",svg:"SVG"},eE=()=>{let e=document.getElementsByClassName("bespoke-Viz-source");Array.from(e).forEach(t=>t.remove());},tE={wrong_node:"Wrong node in export",choose_area:"Choose image area",choose_viz:"Choose visualization",choose_format:"Choose format",transparent_bg:"Transparent background",processing:"Processing image...",download:"Download {imageFormat}",entire_section:"Entire section",viz_only:"Visualization only",source:"Source: {src}"};});function vm(e){let{title:t,url:r,disabled:o=!1}=e,n=o?IconCode:IconLink;return jsx(Input.Wrapper,{label:t,children:jsx(Input,{icon:jsx(n,{}),value:r,disabled:o,readOnly:!0,rightSection:jsx(CopyButton,{value:r,timeout:2e3,children:({copied:a,copy:s})=>jsx(Tooltip,{label:a?"Copied":"Copy",withArrow:!0,position:"right",children:jsx(ActionIcon,{variant:a?"filled":"subtle",onClick:s,disabled:o,children:a?jsx(IconClipboardCheck,{size:16}):jsx(IconClipboardCopy,{size:16})})})})})})}var Sm=v(()=>{c();});function xm(e){let{section:t}=e,[r,o]=useState(""),[n,a]=useState(""),[s,i]=useState(!0),l=Ie("options"),u={...AE,...l.share_tab};return useEffect(()=>{a(document.title);let{origin:p,pathname:d}=window.location,m=`${p}${d}`,b=s?t.settings?.name?.length?`#${Xt(t.settings.name)}`:`#section-${t.id}`:"";o(`${m}${b}`);},[s]),jsxs(Stack,{className:"cms-section-options-share",children:[jsx(Space,{h:"xs"}),jsx(vm,{title:`${u.title}: ${n}`,url:r}),jsx(Checkbox,{checked:s,label:u.include_section,onChange:()=>i(!s),radius:"xl"}),jsxs(Group,{position:"center",children:[jsx(FacebookShareButton,{url:r,quote:n,children:jsx(FacebookIcon,{size:32,round:!0})}),jsx(TwitterShareButton,{url:r,title:n,children:jsx(TwitterIcon,{size:32,round:!0})}),jsx(TelegramShareButton,{url:r,title:n,children:jsx(TelegramIcon,{size:32,round:!0})}),jsx(WhatsappShareButton,{url:r,title:n,separator:":: ",children:jsx(WhatsappIcon,{size:32,round:!0})}),jsx(LinkedinShareButton,{url:r,children:jsx(LinkedinIcon,{size:32,round:!0})}),jsx(RedditShareButton,{url:r,title:n,windowWidth:660,windowHeight:460,children:jsx(RedditIcon,{size:32,round:!0})}),jsx(EmailShareButton,{url:r,subject:n,children:jsx(EmailIcon,{size:32,round:!0})})]})]})}var AE,Rm=v(()=>{c();Sm();ht();ln();AE={title:"Title",include_section:"Include Section"};});function Cm(e){let{section:t,initialMode:r,onEnds:o,open:n,title:a}=e,s=la(t.settings),i=useMemo(()=>OE.filter(b=>s[b]),[s]),[l,u]=useState(r||i[0]||"data"),p=Ie("options");useEffect(()=>{r!==l&&u(r);},[r]);let d={...rl,...p},m=useMemo(()=>jsxs(Fragment,{children:[jsxs(Tabs.List,{children:[s.data&&jsx(Tabs.Tab,{value:"data",children:d.download_title}),s.image&&jsx(Tabs.Tab,{value:"image",children:d.image_title}),s.share&&jsx(Tabs.Tab,{value:"share",children:d.share_title})]}),s.data&&jsx(Tabs.Panel,{value:"data",children:jsx(dm,{section:t})}),s.image&&jsx(Tabs.Panel,{value:"image",children:jsx(hm,{section:t})}),s.share&&jsx(Tabs.Panel,{value:"share",children:jsx(xm,{section:t})})]}),[s,t,d]);return jsx("div",{className:"cms-section-options-modal",children:n&&jsx(Modal,{className:"bespoke-options-modal",opened:!0,onClose:()=>o(),size:"xl",title:a,children:jsx(Tabs,{onTabChange:u,value:l,keepMounted:!1,children:m})})})}var rl,OE,Pm=v(()=>{c();Ji();ym();Rm();ht();ca();rl={download_title:"Download Data",image_title:"Save Image",share_title:"Share Link"},OE=["data","image","share"];});function Im(e){let{sectionId:t,disabled:r=!1}=e,[o,n]=useState(!1),[a,s]=useState("data"),i=Mn(t),l=Ie("options"),u={...rl,...l},p=la(i.isSuccess?i.data.settings:{}),d=b=>{s(b),n(!0);},m=()=>{n(!1);};return jsxs("div",{className:"cms-section-options",children:[jsxs(Button.Group,{children:[p.data&&jsx(Button,{variant:"default",size:"xs",compact:!0,onClick:()=>d("data"),"aria-label":u.download_title,disabled:r,children:jsx(IconTable,{size:16})}),p.image&&jsx(Button,{variant:"default",size:"xs",compact:!0,onClick:()=>d("image"),"aria-label":u.image_title,disabled:r,children:jsx(IconCamera,{size:16})}),p.share&&jsx(Button,{variant:"default",size:"xs",compact:!0,onClick:()=>d("share"),"aria-label":u.share_title,disabled:r,children:jsx(IconShare,{size:16})})]}),i.isSuccess&&jsx(Cm,{section:i.data,initialMode:a,open:o,onEnds:m})]})}var Lm=v(()=>{c();Pm();he();ht();ca();});function DE({children:e,containerProps:t},r){return jsx(Flex,{ref:r,className:"bespoke-section-content",pos:"relative",align:"stretch",p:0,direction:{base:"column",md:"row"},wrap:"wrap",...t,children:e})}var ga,Bm,Nm=v(()=>{c();he();Qs();ga=Kt__default.forwardRef(function({children:t,column:r,basis:o,columnSettings:n={},sx:a={},...s},i){let l=Object.values(r).some(m=>m.settings?.display==="inline"),u=n?.width?`${n.width}px`:o,p=n?.width?`${n?.width}px`:"100%",d=n?.full?"100%":p;return jsx(Flex,{ref:i,className:"bespoke-section-col",align:"flex-start",direction:l?"row":"column",wrap:l?"wrap":"nowrap",maw:{base:"100%",md:d},miw:{base:"none",md:300},p:0,pos:"relative",sx:[{flexGrow:1,flexShrink:n?.full?0:1,flexBasis:n?.full?"100%":u},...packSx(a)],...s,children:t})}),Bm=Kt__default.forwardRef(DE);});var Fm=v(()=>{c();});var pn,Dm=v(()=>{c();ze();he();Fm();ye();pn={px:e=>Number.isNaN(parseFloat(e))?"px":`${e}px`.replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"),"%":e=>Number.isNaN(parseFloat(e))?"%":`${e}%`.replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")},{px:{defaultValue:400,min:25,step:5,formatter:pn.px},"%":{defaultValue:50,min:20,max:100,step:5,formatter:pn["%"]}};});var ol,Vm=v(()=>{c();ol={backgroundColor:"#fafafa",block:{padding:10},column:{padding:12},section:{backgroundColor:"white",borderRadius:10,boxShadow:"0px 6px 10px rgba(12, 32, 50, 0.14), 0px 1px 15px rgba(12, 32, 50, 0.12), 0px 3px 5px rgba(12, 32, 50, 0.15)",margin:8,padding:32}};});function al({previews:e,translations:t}){let{print:r}=Ue(),o=useMemo(()=>e.map(({image:n,name:a},s)=>(n?.author||n?.url)&&jsxs(Stack,{spacing:0,children:[n.author&&jsxs(Text,{size:"xs",children:[a," ",t.image_by," ",jsx("strong",{children:n.author})]}),n.url&&jsxs(Text,{size:"xs",children:["URL: "," ",jsx(Anchor,{href:n.url,target:"_blank",children:n.url})]}),s+1<e.length&&jsx(Divider,{})]},n.id)),[e]);return jsx(Fragment,{children:r?jsx(Fragment,{children:o}):jsxs(Popover,{position:"right",children:[jsx(Popover.Target,{children:jsx(ActionIcon,{variant:"light",radius:"xl",children:jsx(IconPhoto,{size:20})})}),jsx(Popover.Dropdown,{children:o})]})})}var Um=v(()=>{c();jt();});function Gm(){let{locales:e}=useRouter(),t=location&&location.pathname.split("/").filter(r=>r.length>0)[0];return e?.includes(t)}var Hm=v(()=>{c();});function JE({name:e,children:t,id:r,sectionSettings:o,sectionStyles:n,previews:a,translations:s}){let{print:i}=Ue(),l=o.memberImageBg&&a.some(({image:p})=>p&&(p.url||p.author)),u=useMemo(()=>o.showAnchor&&o.optionsMenu?"apart":!o.showAnchor&&o.optionsMenu?"right":o.showAnchor&&!o.optionsMenu?"left":"right",[o.showAnchor,o.optionsMenu]);return jsxs(XE,{className:`bespoke-Section-${r} bespoke-Section-root `,settings:o,styles:n?.root||void 0,print:i,children:[o.memberImageBg&&jsx(om,{previews:a}),jsxs(QE,{className:`bespoke-Section-${r} bespoke-Section-container `,settings:o,styles:n?.container,id:e?.length?Xt(e):`section-${r}`,pos:"relative",children:[!i&&jsxs(Group,{position:u,mb:"xs",children:[o.showAnchor&&jsxs(Anchor,{className:"cms-section-anchor",href:`#${o.name?Xt(o.name):"section-"+r}`,sx:{"&:hover .cms-section-name":{visibility:"visible",opacity:1}},children:[jsx(Text,{span:!0,size:"small",children:"#"}),jsx(Text,{span:!0,size:"small",className:"cms-section-name",sx:{visibility:"hidden",opacity:0,transition:"visibility 0s, opacity 0.2s ease-in-out"},children:o.name||"section-"+r})]}),o.optionsMenu&&jsx(Im,{sectionId:r,disabled:!1})]}),jsxs(ZE,{print:i,className:`bespoke-Section-${r} bespoke-Section-container`,settings:o,styles:n?.content,children:[t,l&&jsx(al,{previews:a,translations:s})]})]})]})}function tk({section:e,sectionLoader:t}){let{isEmbed:r}=Ue(),{id:o,settings:n}=e,a={...rm,...n},s=Ze(),i=Q(E=>E),l=Q(E=>E.variables.status),{previews:u,isRunConsumersRunning:p}=Q(E=>E.status),d=s.active&&s.status?u.concat(s.status?.previews||[]):u,m=ot().Section,b=wt(i),f=Object.values(b||{}).filter(E=>E.section_id===o),y=Ie("sections"),h={...YE,...y},w=f.some(E=>{try{return l[E.id].allowed&&![g.GENERATOR,g.SECTION_FLAG].includes(E.type)||E.type===g.NAV}catch{return E.settings.allowed==="always"}}),L=f.filter(E=>![g.GENERATOR,g.SECTION_FLAG].includes(E.type)).reduce((E,F)=>(E[F.blockcol]?E[F.blockcol][F.blockrow]=F:E[F.blockcol]={[F.blockrow]:F},E),{}),k=Object.keys(f).length>0&&!n.hidden&&w,A=Object.keys(L).length;if(!k||s.active&&n.comparisonHide)return null;let N=(E,F=!1)=>{let C=Array.from(new Set(E.map(x=>x.blockcol))).map(x=>({blockcol:x})).sort((x,O)=>Ye(x,O,"blockcol")),R=[];return C.forEach(({blockcol:x})=>{let O=E.filter(D=>D.blockcol===x).sort((D,I)=>Ye(D,I,"blockrow")).map(D=>{if(!D.id||!l[D.id]?.allowed&&D.type!==g.NAV)return null;let{settings:I,type:P}=b[D.id],Y=I.width&&!I.width.stretch&&I.width.unit?pn[I.width.unit](I.width.value):I.display==="inline"?"auto":"100%",j={alignSelf:P===g.VIZ?"stretch":"flex-start",flexGrow:0,margin:"0",width:Y,minWidth:300};return jsx(Box,{className:"bespoke-Block-wrapper",id:`bespoke-Block-${D.id}`,sx:j,py:ol.block.padding,children:jsx(ia,{blockId:D.id,asComparison:F},D.id)},D.id)});R.push(O);}),R.flat()},z=[];if(s.active&&!n.comparisonMerge){let E=f.filter(F=>![g.GENERATOR,g.SECTION_FLAG].includes(F.type)).reduce((F,C)=>({...F,[C.id]:C}),{});z=[jsx(ga,{column:E,basis:"50%",children:N(Object.values(f.filter(F=>![g.GENERATOR,g.SECTION_FLAG].includes(F.type))))},"original"),jsx(ga,{column:E,basis:"50%",children:N(Object.values(f.filter(F=>![g.GENERATOR,g.SECTION_FLAG].includes(F.type))),!0)},"comparison")];}else z=Object.keys(L).sort((E,F)=>-wa(E,F)).map(E=>{let F=L[E],C=n.columnSettings?n.columnSettings[E]:{},R=Object.values(F).sort((x,O)=>Ye(x,O,"blockrow"));return R.some(x=>!l[x.id]||l[x.id].allowed||x.type===g.NAV)?jsx(ga,{column:F,columnSettings:C,basis:`calc(${100/A}% - (10px * ${A}))`,children:R.map(x=>{if(!x.id||!l[x.id]?.allowed&&x.type!==g.NAV)return null;let{settings:O,type:D}=b[x.id],I=O.width&&!O.width.stretch&&O.width.unit?pn[O.width.unit](O.width.value):O.display==="inline"?"auto":"100%",P={alignSelf:D===g.VIZ?"stretch":"flex-start",flexGrow:0,margin:"0",width:I,minWidth:300};return jsx(Box,{className:`bespoke-Block-wrapper bespoke-${x.type}-wrapper`,id:`bespoke-Block-${x.id}`,sx:P,py:ol.block.padding,children:jsx(ia,{blockId:x.id},x.id)},x.id)})},E):null});return jsxs(JE,{id:o,name:e?.settings?.name,previews:d,sectionSettings:a,sectionStyles:m,translations:h,children:[p.includes(o)&&t,jsx(Bm,{containerProps:{gap:a.columnGutter||"md",wrap:s.active?"nowrap":"wrap",sx:{zIndex:20}},children:z}),r&&jsx(ek,{})]})}var YE,sl,XE,QE,ZE,ek,Xm,Qm=v(()=>{c();he();or();em();ca();zr();nm();Lm();Or();ye();Nm();Dm();Vm();jt();ht();Um();Wt();ln();Ut();Hm();YE={image_by:"image by"},sl=(e,t)=>r=>e?e(r,t):{},XE=({settings:e,styles:t,print:r,children:o,...n})=>{let{position:a,shouldBreak:s}=e,i={normal:{position:"relative",backgroundColor:r?"transparent":"initial",borderRadius:0},sticky:{position:"sticky",zIndex:2,top:0,borderRadius:0,borderTop:r?"none":"initial",borderLeft:r?"none":"initial",borderRight:r?"none":"initial"}},l={normal:{radius:0},sticky:{radius:0,withBorder:!0}},u=[i[a],sl(t,e),s?{pageBreakBefore:"always"}:{}];return jsx(Paper,{component:"section",sx:u,...l[a],...n,children:o})},QE=({settings:e,styles:t,children:r,...o})=>{let{width:n}=e,a={center:{zIndex:1},full:{zIndex:1}},s={center:{size:"lg",p:"sm",fluid:!1},full:{fluid:!0,p:"md"}},i=[a[n],sl(t,e)];return jsx(Container,{sx:i,...s[n],...o,children:r})},ZE=({settings:e,styles:t,print:r,children:o,...n})=>{let{style:a}=e,s={none:{},card:{boxShadow:r?"none":"initial"}},i={none:{bg:"transparent"},card:{shadow:r?"none":"lg",p:"md",radius:"md"}},l=[s[a],sl(t,e)];return jsx(Paper,{sx:l,...i[a],...n,"data-screenshot-target":"true",children:o})};ek=()=>{let e=useRouter(),{query:t,locale:r}=e,{siteProps:o={logoSrc:""},profilePrefix:n,pathSegment:a}=Ar(),s=t[a],i=Array.isArray(s)?s.join("/"):[],u=Gm()?`/${r}`:"";u+=`${n}/${i}/`;let p=new URL(u,window.location.href).href;return jsxs(Group,{position:"apart",noWrap:!0,sx:{flexGrow:1},children:[jsx(Anchor,{href:p,target:"_blank",children:p}),jsx("img",{src:o.logoSrc,height:40,width:"auto",alt:"Site Logo"})]})};Xm=tk;});var Zm=v(()=>{c();se();W({name:"abbreviate",description:"Abbreviates a number into a smaller more human-readable number.",logicFactory(e){return t=>e.d3plus.formatAbbreviate(t)},inputType:"number",testValue:"123456",type:"formatter"});});var Jm=v(()=>{c();se();W({name:"abs",description:"Simple Absolute Value.",logicFactory(e){return t=>Math.abs(t)},inputType:"number",testValue:"-123",type:"formatter"});});var nk,ef=v(()=>{c();se();nk=()=>function(t){let o=new RegExp(/([\$0-9\,]+)[A-z\-\s\&]*([\$0-9\,]*)/g).exec(t);return o?(o=o.slice(1).filter(n=>n.length).map(n=>(n.includes(",")&&(n.indexOf(",")===n.length-4?n=n.replace(/,000$/g,"k").replace(/([0-9]+)(,999$)/g,a=>`${parseInt(a)+1}k`):n.indexOf(",")===n.length-8&&(n=n.replace(/,000,000$/g,"M").replace(/([0-9]+)(,999,999$)/g,a=>`${parseInt(a)+1}M`))),n)),o.length===2?o.join(" - "):t.toLowerCase().match(/under|less|\</g)?`< ${o[0]}`:t.toLowerCase().match(/over|more|\+|\>/g)?`${o[0]}+`:`${o[0]}`):"None"},W({name:"bucket",description:"Sanitizes bucket strings to '< n', 'n1 - n2', and 'n+'",logicFactory:nk,inputType:"number",testValue:"1234",type:"formatter"});});var tf=v(()=>{c();se();W({name:"commas",description:"* Rounds to nearest whole number and adds commas.",logicFactory(e){return t=>e.d3.format(",")(Math.round(t))},inputType:"number",testValue:"1234.6",type:"formatter"});});var rf=v(()=>{c();se();W({name:"date",description:"Formats a date into '%B %d, %Y' format.",logicFactory(e){return t=>(typeof t=="string"&&(t=e.d3plus.date(t)),e.d3.timeFormat("%B %d, %Y")(t))},inputType:"date",testValue:"2022-01-01",type:"formatter"});});var of=v(()=>{c();se();W({name:"dollar",description:"Adds a US dollar sign to the beginning of a String or Number.",logicFactory(e){return t=>(typeof t=="number"&&(t=e.d3plus.formatAbbreviate(t)),t.charAt(0)==="-"?t.replace("-","-$"):`$${t}`)},inputType:"number",testValue:"123",type:"formatter"});});var nf=v(()=>{c();se();W({name:"formatFieldName",description:"Based on field name returns a string",logicFactory(e){return t=>{if(t.contentType.toLowerCase()==="stat"){if(t.field==="title")return "Stat label";if(t.field==="value")return "Stat value";if(t.field==="subtitle")return "Stat subtitle";if(t.field==="tooltip")return "Tooltip text"}return t.contentType.toLowerCase()==="section"&&t.field==="short"?"Short title":t.contentType.toLowerCase()==="description"&&t.field==="description"?"Paragraph":t.field}},inputType:"object",testValue:'{"field":"title","contentType":"stat"}',type:"formatter"});});var af=v(()=>{c();se();W({name:"grewTo",description:"Returns the text with grow direction: 'declined from', 'grew to' o 'stayed at'",logicFactory(e){return t=>t<0?"declined from":t>0?"grew to":"stayed at"},inputType:"number",testValue:"-1234",type:"formatter"});});var sf=v(()=>{c();se();W({name:"grewWord",description:"Returns either 'grew', 'declined', or 'stayed' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"declined":t>0?"grew":"stayed"},inputType:"number",testValue:"-1234",type:"formatter"});});var lf=v(()=>{c();se();W({name:"growing",description:"Returns either 'declining', 'growing' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"declining":"growing"},inputType:"number",testValue:"-1234",type:"formatter"});});var mk,cf=v(()=>{c();se();mk=()=>function(t){let{curr:r,currMoe:o=0,prev:n,prevMoe:a=0}=t,s;if(o||a){let i=(-n/r**2)**2*o**2,l=(1/r)**2*a**2;s=Math.sqrt(i+l);}else s=(r-n)/n;return s*100},W({name:"growth",description:"Calculates the growth percentage between two numbers provided the following object format: {curr, prev}. Also supports calculating the growth between two margin of errors using this format: {curr, currMoe, prev, prevMoe}",logicFactory:mk,inputType:"object",testValue:'{"curr":10,"currMoe":0,"prev":13,"prevMoe":0}',type:"formatter"});});var uf=v(()=>{c();se();W({name:"growthPct",description:"Abbreviates a growth value, turns it absolute, and adds a percent sign.",logicFactory(e){return t=>`${e.d3plus.formatAbbreviate(Math.abs(t))}%`},inputType:"number",testValue:"12345",type:"formatter"});});var pf=v(()=>{c();se();W({name:"growthWord",description:"Returns either 'growth' or 'decline' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"decline":"growth"},inputType:"number",testValue:"-1234",type:"formatter"});});var df=v(()=>{c();se();W({name:"highWord",description:"Returns either 'higher than', 'lower than', or 'approximately the same as' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"lower than":t>0?"higher than":"approximately the same as"},inputType:"number",testValue:"0",type:"formatter"});});var mf=v(()=>{c();se();W({name:"increaseWord",description:"Returns either 'increase', 'decrease', or 'change' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"decrease":t>0?"increase":"change"},inputType:"number",testValue:"1234",type:"formatter"});});var ff=v(()=>{c();se();W({name:"increasedWord",description:"Returns either 'increased', 'decreased', or 'remained the same' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"decreased":t>0?"increased":"remained the same"},inputType:"number",testValue:"0",type:"formatter"});});var gf=v(()=>{c();se();W({name:"increasing",description:"Returns either 'decreasing', 'increasing' or 'maintaining' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"decreasing":t>0?"increasing":"maintaining"},inputType:"number",testValue:"-1234",type:"formatter"});});var hf=v(()=>{c();se();W({name:"largerThan",description:"Returns either 'higher than', 'lower than', or 'approximately the same as' depending on the provided number's sign",logicFactory(e){return t=>t<0?"smaller than":t>0?"larger than":"the same as"},inputType:"number",testValue:"-1234",type:"formatter"});});var yf=v(()=>{c();se();W({name:"list",description:"Joins an array of strings together, adding commas and 'and' when necessary.",logicFactory(e){return t=>t.reduce((r,o,n)=>(n?n===t.length-1&&n===1?r+=` and ${o}`:n===t.length-1?r+=`, and ${o}`:r+=`, ${o}`:r+=o,r),"")},inputType:"object",testValue:'["foo","bar","bee"]',type:"formatter"});});var bf=v(()=>{c();se();W({name:"longWord",description:"",logicFactory(e){return t=>t<0?"shorter":t>0?"longer":"similar"},inputType:"number",testValue:"5",type:"formatter"});});var vf=v(()=>{c();se();W({name:"lowerCaseFirst",description:"Converts the first letter of a string to lowercase",logicFactory(e){return t=>typeof t=="string"?t.charAt(0).toLowerCase()+t.slice(1):t},inputType:"string",testValue:"foo",type:"formatter"});});var Sf=v(()=>{c();se();W({name:"moreFewerWord",description:"",logicFactory(e){return t=>t<0?"fewer":"more"},inputType:"number",testValue:"-5",type:"formatter"});});var Tf=v(()=>{c();se();W({name:"moreLess",description:"Returns either 'more' or 'less' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"less":"more"},inputType:"number",testValue:"-5",type:"formatter"});});var xf=v(()=>{c();se();W({name:"moreLess",description:"Returns either 'more than', 'less than', or 'approximately the same' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"less than":t>0?"more than":"approximately the same"},inputType:"number",testValue:"-5",type:"formatter"});});var Rf=v(()=>{c();se();W({name:"olderWord",description:"",logicFactory(e){return t=>t<0?"getting younger":t>0?"getting older":"staying the same age"},inputType:"number",testValue:"-5",type:"formatter"});});var Ef=v(()=>{c();se();W({name:"olderYounger",description:"",logicFactory(e){return t=>t<0?"younger than":t>0?"older than":"the same age as"},inputType:"number",testValue:"-5",type:"formatter"});});var kf=v(()=>{c();se();W({name:"plural",description:"Pluralizes a word.",logicFactory(e){return t=>t.replace(/\w$/g,r=>r==="y"?"ies":`${r}s`)},inputType:"string",testValue:"Foo",type:"formatter"});});var Cf=v(()=>{c();se();W({name:"pxToInt",description:"Takes a pixel value and converts it to an integer",logicFactory(e){return t=>parseInt(t.replace(/\D+/g,""),10)},inputType:"string",testValue:"12px",type:"formatter"});});var Pf=v(()=>{c();se();W({name:"salary",description:"Displays salary values with proper precision (ie. '$74,200' instead of '$74.2k')",logicFactory(e){return t=>{let r;return t<1e6?r=e.d3.format(",")(t.toFixed(0)):r=e.d3plus.formatAbbreviate(t),`$${r}`}},inputType:"number",testValue:"1000000",type:"formatter"});});var Af=v(()=>{c();se();W({name:"stripEntities",description:"Removes non breaking spaces & other html entities from a string",logicFactory(e){return t=>typeof t=="string"?String(t).replace(/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});/ig," "):t},inputType:"string",testValue:"<b>MyText</b>",type:"formatter"});});var il,wf=v(()=>{c();se();il=W({name:"stripHTML",description:"Converts html tags to spaces, then removes redundant spaces",logicFactory(e){return t=>{let r={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'","&#x60;":"`","&nbsp;":""},o=`(?:${Object.keys(r).join("|")})`,n=RegExp(o),a=RegExp(o,"g"),s=String(t).replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();return n.test(s)?s.replace(a,i=>r[i]):s}},inputType:"string",testValue:"<b>My text</b>",type:"formatter"});});var If=v(()=>{c();se();W({name:"stripOL",description:"Removes ordered list wrapper tags from a string.",logicFactory(e){return t=>t.replace(/<ol>/g,"").replace(/<\/ol>/g,"")},inputType:"string",testValue:"<ol><li>My list</li></ol>",type:"formatter"});});var Lf=v(()=>{c();se();W({name:"stripP",description:"Removes all paragraph tags from a string.",logicFactory(e){return t=>t.replace(/<p>/g,"").replace(/<\/p>/g,"")},inputType:"string",testValue:"<p>My p</p>",type:"formatter"});});var Of=v(()=>{c();se();W({name:"stripUL",description:"Removes unordered list wrapper tags from a string.",logicFactory(e){return t=>t.replace(/<ul>/g,"").replace(/<\/ul>/g,"")},inputType:"string",testValue:"<ul><li>My list</li></ul>",type:"formatter"});});var _f=v(()=>{c();se();W({name:"toKebabCase",description:"Takes a camelCase or PascalCase string and converts it to kebab-case.",logicFactory(e){return t=>typeof t=="string"?(t=t.charAt(0).toLowerCase()+t.substring(1),t.replace(/([A-Z])/g,"-$1").toLowerCase()):"invalid string passed to toKebabCase()"},inputType:"string",testValue:"camelCaseText",type:"formatter"});});var Bf=v(()=>{c();se();W({name:"toSpacedCase",description:"Takes a camelCase or PascalCase string and adds spaces (I know Spaced Case isn't a thing, deal with it).",logicFactory(e){return t=>typeof t=="string"?t.replace(/([A-Z])/g," $1").toLowerCase().trim():"invalid string passed to toSpacedCase()"},inputType:"string",testValue:"camelCaseText",type:"formatter"});});var Mf=v(()=>{c();se();W({name:"upperCaseFirst",description:"Converts the first letter of a string to uppercase",logicFactory(e){return t=>t.charAt(0).toUpperCase()+t.slice(1)},inputType:"string",testValue:"my name",type:"formatter"});});var Nf=v(()=>{c();Zm();Jm();ef();tf();rf();of();nf();af();sf();lf();cf();uf();pf();df();mf();ff();gf();hf();yf();bf();vf();Sf();Tf();xf();Rf();Ef();kf();Cf();Pf();Af();wf();If();Lf();Of();_f();Bf();Mf();});function zf({onDownloadPDF:e,onDownloadCSV:t}){let[r,o]=useState(!1),[n,a]=useState(!1),[s,i]=useState(!1),l=useMediaQuery("(max-width: 768px)"),u=Ie("export"),p={...Wk,...u},d=async()=>{if(e){o(!0);try{await e();}finally{o(!1),i(!1);}}},m=async()=>{if(t){a(!0);try{await t();}finally{a(!1),i(!1);}}},b=(h,w,L,k,A,N)=>jsx(Button,{id:N,size:"sm",onClick:h,disabled:w,fullWidth:!0,variant:"subtle",h:"auto",px:"xs",w:"100%",styles:z=>({inner:{width:"100%",display:"block"}}),children:jsxs(Group,{noWrap:!0,position:"left",spacing:"xs",w:"100%",children:[w?jsx(Loader,{size:"1.75rem"}):L,jsxs(Stack,{spacing:0,w:"100%",py:"0.5rem",className:"bespoke-report-download-btn-text-container",children:[jsx(Text,{w:"100%",size:"sm",lineClamp:1,className:"bespoke-report-download-btn-text-container-cta",children:k}),A&&jsx(Text,{size:"xs",w:"100%",lineClamp:2,maw:"100%",style:{wordWrap:"break-word",whiteSpace:"normal"},variant:"dimmed",lh:"0.9rem",h:"1.9rem",className:"bespoke-report-download-btn-text-desc",children:A})]})]})}),f=e&&b(d,r,jsx(IconFileTypePdf,{size:"1.75rem"}),p.pdf.label,p.pdf.desc,"bespoke-download-pdf-btn"),y=t&&b(m,n,jsx(IconFileTypeXls,{size:"1.75rem"}),p.xlsx.label,p.xlsx.desc,"bespoke-download-xlsx-btn");return e||t?jsx(Affix,{position:{bottom:l?rem(0):rem(20),right:l?rem(0):rem(20)},id:"bespoke-report-download-affix",style:{width:l?"100%":"auto",boxShadow:l?"0px -2px 6px rgba(0, 0, 0, 0.1)":"0px 2px 6px rgba(0, 0, 0, 0.1)",borderRadius:"0.25rem",background:"white"},p:"xs",children:jsxs(Popover,{opened:s,onChange:i,position:"top",shadow:"md",width:l?"100%":250,id:"bespoke-report-download-popover",children:[jsx(Popover.Target,{children:jsx(Button,{id:"bespoke-report-download-btn",size:"sm",onClick:()=>i(h=>!h),leftIcon:jsx(IconDownload,{size:"1.2rem"}),variant:"subtle",loading:r||n,fullWidth:l,children:p.export})}),jsx(Popover.Dropdown,{p:"0.5rem",children:jsxs(Stack,{spacing:"xs",children:[f,y]})})]})}):null}var Wk,$f=v(()=>{"use client";c();ht();Wk={export:"Export",pdf:{label:"Download PDF",desc:"Generates a printable version of the report page in PDF format."},xlsx:{label:"Download XLSX",desc:"Creates a downloadable spreadsheet of the report page data."}};});function Qk(e,t){let r=e.replace(/[:\\/?*[\]]/g,"");return r.trim().length===0&&(r=`Sheet${t+1}`),r.slice(0,31)}function Zk(e){let t=new ArrayBuffer(e.length),r=new Uint8Array(t);for(let o=0;o<e.length;o++)r[o]=e.charCodeAt(o)&255;return t}function Uf(e){return `data_export_${new Date().toISOString()}`}var Xk,Jk,Gf,Hf=v(()=>{c();Xk=e=>new Promise((t,r)=>{let o="xlsx";if(!e||e.length===0){r(new Error("No data provided"));return}try{let n=Ro.utils.book_new();e.forEach((l,u)=>{if(l.data&&l.data.length>0){let p=l.data[0],d=Ro.utils.json_to_sheet(p),m=Qk(l.fileName||`Sheet${u+1}`,u),b=1;for(;n.SheetNames.includes(m);){let f=` (${b})`;m=`${m.slice(0,31-f.length)}${f}`,b++;}Ro.utils.book_append_sheet(n,d,m);}});let a=Ro.write(n,{bookType:"xlsx",type:"binary"}),s=new Blob([Zk(a)],{type:"application/octet-stream"}),i=new TR;i.file(`${Uf(o)}.xlsx`,s),i.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:9}}).then(l=>{t(l);}).catch(r);}catch(n){r(n);}});Jk=async e=>{try{let t=await Xk(e);saveAs(t,`${Uf("xlsx")}.zip`);}catch(t){console.error("Error generating file:",t);}},Gf=Jk;});function Ue(){let e=useContext(Kf);if(e===void 0)throw new Error("usePrint must be used within a PrintContext");return e}function cC(e){return useMemo(()=>e.data.reduce((r,o)=>(o.blocks&&o.blocks.forEach(n=>{r[n]=o.id;}),r),{}),[e.data])}function uC({pathSegmentsKey:e="bespoke",sectionLoader:t,mode:r}){let{query:o}=useRouter(),n=zo(),a=Ze(),s=Xo(),i=Ig(o.print)??!1,l=r==="embed",{printReport:u,error:p,setError:d}=Jn();Yn();let m=jf.locale,b=At(m),f=useMemo(()=>n.data?.sort(Ye).filter(R=>R.settings?.hidden!==!0).reduce((R,x)=>(x.blocks&&x.blocks.length>0&&R.push(...x.blocks),R),[]),[n.data]),y=cC({data:n.data||[]}),{sectionsVariables:h,resetSectionVariables:w,setSectionVariables:L}=wc(n.data?.map(R=>R.id)||[]),k=Q(R=>R),A=Ie("options"),N={...Zi,...A.data_tab},z=useMemo(()=>f.reduce((R,x)=>{let O=k.records.entities.block[x],D=k.variables.status[x];return g.VIZ===O?.type&&D.allowed&&R.push({id:x,entity:O,variables:k.variables.variables[x],status:k.variables.status[x],inputVariablesFlat:O.inputs.reduce((I,P)=>({...I,...k.variables.variables[P]}),k.variables.attributes)}),R},[]),[f,k.records.entities.block,k.variables.attributes,k.variables.status,k.variables.variables]);function E(R){return R=R.replace(/<p>/g,""),R=R.replace(/<\/p>/g,""),R}let F=async(R,x,O)=>{let D=dataLoad.bind({});return new Promise((I,P)=>{D(x,null,null,(Y,j)=>{if(Y)P(Y);else try{R||(R={data:[]}),Array.isArray(R.data)||(R.data=[]);let H=O instanceof Function?O(j):j;R.data.unshift(H),R.rawData=j,I(R);}catch(H){P(H);}});})},C=async()=>{if(!s.XlsxVizActive)return;let R=[],x=[],O=0,D=1;for(let Y of z){let j=Y.entity,H=Oe(j),ee=Y.inputVariablesFlat,oe={variables:ee},ce=st({logic:H.logic},b,oe).logic,K={router:jf,section:{variables:h[y[j.id]],setVariables:L(h[y[j.id]]),resetVariables:w(h[y[j.id]])}},q=ir(ce,b,ee,m,j.id,{},K),G=q.config._downloadTitle||q.config.title||`${N.viz_source} ${O+1}`,$=q.config._downloadFileName||G;if(q.config._downloadEnabled!==!1){let M=q.config._downloadUrl||q.config.data;if(!M){console.error("API is undefined for block:",j.id);continue}let _=typeof M=="string"?[M]:M,te=q.dataFormat instanceof Function?q.dataFormat:!1,U=q.config._downloadDataFormat instanceof Function?q.config._downloadDataFormat:!1,Z=q.config._downloadSectionName,X=q.config._downloadSource;try{let ae=await F({ix:O,id:j.id,title:il(G),fileName:X?Z?`${D} ${E(Z)}`:`${D} ${$}`:Z?E(Z):$,data:_,loading:!1,type:g.VIZ},M,U||te);if(X){let le=Array.isArray(ae.rawData)?ae.rawData:[ae.rawData],qe=new Set;le.forEach((ue,je)=>{let $e=X(ue);qe.has($e.link)||(qe.add($e.link),x.push({"Sheet Number":D,Name:Z?`${E(Z)} - ${$}${le.length>1?` (${je+1})`:""}`:`${$}${le.length>1?` (${je+1})`:""}`,Source:`${$e.name} - ${$e.description} (${$e.link})`}),D++);});}R.push(ae),O++;}catch(ae){console.error(`Error loading data for block ${j.id}:`,ae);}}}let I=R,P={fileName:"Metadata",data:x.length>0?[x]:[]};return I.unshift(P),I};return jsxs(Kf.Provider,{value:{print:i,isEmbed:l},children:[jsxs(Container,{id:"bespoke-report",className:a.comparisonLoaded?"compare":"",p:0,pos:"relative",fluid:!0,children:[n.isSuccess&&n.data.sort(Ye).map(R=>jsx(Xm,{section:R,sectionLoader:t},R.id)),pC({pdf:s,print:i,printReport:u,downloadCSV:Gf,isPosition:Qn,handleLoadData:C})]}),p&&jsx(Affix,{position:{bottom:rem(80),right:rem(20)},children:jsx(Notification,{title:"Error",color:"red",onClose:()=>d(null),icon:jsx(IconX,{size:"1.1rem"}),children:p})})]})}function pC({pdf:e,print:t,printReport:r,downloadCSV:o,isPosition:n,handleLoadData:a}){return t||!n(e.position,"DEFAULT")?null:e.active||e.XlsxVizActive?jsx(zf,{onDownloadPDF:e.active?r:void 0,onDownloadCSV:e.XlsxVizActive?async()=>{let s=await a();s&&s.length>0?await o(s):console.error("No data loaded for CSV download");}:void 0}):null}var Kf,Yf,jt=v(()=>{c();he();zr();Qm();Wt();Xn();Ws();ea();ei();ye();br();hr();Se();Jo();Nf();ht();$f();Hf();Ji();Kf=createContext({print:!1,isEmbed:!1});Yf=uC;});c();c();Ut();jt();Ys();ht();Wt();Xn();co();function mC({pathSegmentsKey:e="bespoke",translations:t,bespokeStyles:r,buildTime:o,siteProps:n,profilePrefix:a="/defaultPath",loader:s=jsx(LoadingOverlay,{visible:!0}),sectionLoader:i=jsx(LoadingOverlay,{visible:!0}),mantineProviderProps:l={},mode:u}){return Kn(e)?jsx(Fragment,{children:s}):jsx(MantineProvider,{...l,theme:{other:{bespokeStyles:r}},inherit:!0,children:jsxs(Nc,{pathSegment:"bespoke",profilePrefix:a,siteProps:n,children:[jsx(xs,{translations:t,children:jsx(Os,{children:jsx(Xs,{children:jsx(tu,{pageSize:12,children:jsx(Yf,{sectionLoader:i||s,mode:u})})})})}),jsx("small",{className:"bespoke-timestamp",children:o})]})})}/*! Bundled license information:
63
63
 
64
64
  @tanstack/react-virtual/build/lib/_virtual/_rollupPluginBabelHelpers.mjs:
65
65
  (**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datawheel/bespoke",
3
- "version": "0.7.15-rc.23",
3
+ "version": "0.7.15-rc.25",
4
4
  "description": "Content management system for creating automated data reports",
5
5
  "exports": {
6
6
  ".": {