@datawheel/bespoke 0.9.9-rc.2 → 0.9.9-rc.3

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/explore.js CHANGED
@@ -1,20 +1,20 @@
1
- import'path';import'url';import*as eo from'react';import eo__default,{useState,useCallback,useEffect,useMemo,createContext,useContext,forwardRef,useRef,createElement,memo,Fragment as Fragment$1}from'react';import {useDebouncedValue,useClickOutside,getHotkeyHandler,useMediaQuery,useDisclosure}from'@mantine/hooks';import {useRouter}from'next/router';import On from'axios';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {ActionIcon,Group,Tooltip,Modal,Stack,Text,Badge,Autocomplete,Loader,Container,TextInput,LoadingOverlay,Alert,Paper,Anchor,Flex,packSx,Button,Divider,Popover,Tabs,Box,useMantineTheme,MediaQuery,Input,rem,CloseButton,ScrollArea,Grid,Center,MultiSelect,SegmentedControl,Select,CopyButton,SimpleGrid,Image,Checkbox,Card,ThemeIcon,Notification,List,Menu,Switch,Title,Collapse,UnstyledButton,Skeleton,clsx,Pagination,Accordion,HoverCard}from'@mantine/core';import*as Rg from'd3-format';import {format as format$1}from'd3-format';import {IconSearch,IconX,IconTrash,IconTable,IconCamera,IconShare,IconPhoto,IconSelector,IconChevronLeft,IconChevronRight,IconPlus,IconRefresh,IconListTree,IconAlignLeft,IconChartBar,IconPercentage,IconFlag,IconApi,IconHeading,IconDatabase,IconAlertCircle,IconLink,IconSparkles,IconClipboardCheck,IconClipboardCopy,IconExternalLink,IconTemplate,IconPolaroid,IconCode,IconDownload,IconInfoCircle,IconArrowLeft,IconArrowRight,IconFileTypeXls,IconFileTypeJs,IconFileTypeCsv,IconChevronUp,IconChevronDown,IconCircleKey,IconCodePlus}from'@tabler/icons-react';import*as xg from'd3-array';import*as Tg from'd3-collection';import {nest}from'd3-collection';import*as Eg from'd3-time-format';import {formatAbbreviate}from'd3plus-format';import {date}from'd3plus-axis';import {isObject,merge,closest,assign}from'd3plus-common';import {titleCase,strip}from'd3plus-text';import Bg from'yn';import {format}from'pretty-format';import jg from'jsonwebtoken';import Kg from'next/config';import lc from'axios-retry';import Qg from'toposort';import {csvParse,csvFormat}from'd3-dsv';import {schema,normalize}from'normalizr';import {createSlice,configureStore}from'@reduxjs/toolkit';import {HYDRATE,createWrapper}from'next-redux-wrapper';import {notifications}from'@mantine/notifications';import {useSession}from'next-auth/react';import {useDispatch,useSelector}from'react-redux';import {saveAs}from'file-saver';import {dataConcat,dataLoad}from'd3plus-viz';import {MantineReactTable}from'mantine-react-table';import Gy from'slugify';import Yy from'jszip';import mp,{Element,domToReact,Text as Text$1}from'html-react-parser';import*as ex from'd3plus-react';import rx from'next/dynamic';import {Prism}from'@mantine/prism';import {select}from'd3-selection';import {saveElement}from'd3plus-export';import {FacebookShareButton,FacebookIcon,TwitterShareButton,TwitterIcon,TelegramShareButton,TelegramIcon,WhatsappShareButton,WhatsappIcon,LinkedinShareButton,LinkedinIcon,RedditShareButton,RedditIcon,EmailShareButton,EmailIcon}from'react-share';import'xlsx';var Yf=Object.defineProperty;var h=(e,t)=>()=>(e&&(t=e(e=0)),t);var Os=(e,t)=>{for(var o in t)Yf(e,o,{get:t[o],enumerable:true});};var l=h(()=>{});function tg({children:e,pageSize:t=10,sort:o=void 0}){let r={profile:void 0,variant:void 0},[n,s]=useState([]),[a,i]=useState(false),[c,u]=useState(false),[p,m]=useState({}),[f,g]=useState({}),[d,v]=useState(1),[x,C]=useState(r),[R,k]=useState(""),[A]=useDebouncedValue(R,750),[U,G]=useState([]),[F,B]=useState(_s),[E,O]=useState(false),{locale:P}=useRouter(),w=async()=>{try{u(!0),On.get("/api/cms/read/metadata").then(j=>{if(j&&j.data&&j.data.data&&j.data.data.data){let ee=j.data.data.data.reduce((re,oe)=>(oe.dimensions&&oe.dimensions.forEach(_=>{_.variants&&_.variants.forEach(T=>{re[T.id]=T.members_count||0;});}),re),{});s(j.data.data.data),m(ee),g(ee);}u(!1),O(!0);}).catch(j=>{console.error(j);});}catch(j){console.error("Error fetching metadata:",j),s([]),u(false),m({}),g({});}},N=j=>{m(j||f);},Z=useCallback(async(j,ee,re)=>{!E&&n.length===0&&await w(),C({profile:j,variant:ee}),re!==""&&k(re);},[]);useEffect(()=>{let j=false;return E&&(i(true),v(1),W(j,0)),()=>{j=false;}},[A,x,E]),useEffect(()=>{if(E){i(true);let j=(d-1)*t;W(false,j);}},[d]);let W=async(j,ee)=>{let re=x.profile&&!Number.isNaN(x.profile)?[x.profile]:[],oe=x.variant?typeof x.variant=="string"&&x.variant.includes(",")?x.variant.split(",").map(T=>parseInt(T,10)):[parseInt(x.variant,10)]:[],_={query:A,format:"profiles",locale:P,limit:t,offset:ee,visible:true,includes:true,noImage:false,variant:oe,dimension:[],report:re,all:false,origin:"typesense"};o&&(_.sort=o),On.get("/api/cms/search/reports",{params:_}).then(T=>{if(T&&T.data&&T.data.data&&T.data.data.results&&!j){let L=T.data.data.results;G(L),m(!R||R===""?false:T.data.data.meta.variantCount);}i(false);}).catch(T=>{console.error(T),i(false);});},$=p||f,J={id:void 0,name:F.filters_all||"ALL"},M=j=>{let ee=j.reduce((oe,_)=>oe.reduce((T,L)=>T.concat(_.map(q=>[].concat(L,q))),[])).map(oe=>{let _;return Array.isArray(oe)?_={id:oe.map(T=>T.id).join(","),name:oe.map(T=>T.name).join(" / "),members_count:oe.reduce((T,L)=>T*($[L.id]||1),1),ordering:oe.reduce((T,L)=>T+L.ordering,0)}:(oe.members_count=$[oe.id]||0,_={...oe,members_count:$[oe.id]||0}),_}),re=ee.reduce((oe,_)=>oe+(_.members_count||0),0);return [{...J,members_count:re},...ee]},z=n.length>1,V=useMemo(()=>{let j=[];if(!c&&n.length>0&&$){let ee=n.filter(re=>re.dimensions.length>0).map(re=>{let oe=false,_=M(re.dimensions.map(T=>T.variants));return _&&_.length>2&&(oe=true),{id:re.id,name:re.dimensions.map(T=>T.name).join(" / "),variants:_,members_count:_.filter(T=>T.id).reduce((T,L)=>T+(L.members_count||0),0),show:oe}});j=[{...J,members_count:ee.reduce((re,oe)=>re+(oe.members_count||0),0)},...ee];}return j},[c,$,n,J]),Y=useMemo(()=>{let j;return V&&(x.profile?x.profile&&(j=V.find(ee=>ee.id===x.profile),j&&x.variant&&j.variants&&(j=j.variants.find(ee=>ee.id===x.variant))):j=V.find(ee=>!ee.id)),j?j.members_count:t},[x,V]),ve={metadata:n,loadingMetadata:c,setLoadingMetadata:u,loadingItems:a,setLoadingItems:i,resultCount:p,totalCount:f,setResultCount:N,activePage:d,setActivePage:v,pageSize:t,filters:x,setFilters:C,doQuery:W,query:R,setQuery:k,debouncedQuery:A,results:U,currentPageTotal:Y,selectorStructure:V,translations:F,setTranslations:j=>B({..._s,...j}),showSelectors:z,initExplore:Z};return jsx(Sl.Provider,{value:ve,children:e})}var _s,Sl,Ut,ir=h(()=>{l();_s={try_another:"Try another search or filter.",search:"Search",filters_all:"All",no_results:"No Results",load_more:"Load more",select_report:"Select Report",select_variant:"Select Variant",count_format:".2s",report:{},dimension:{},variant:{}},Sl=createContext({metadata:[],loadingItems:false,setLoadingItems:()=>null,loadingMetadata:false,setLoadingMetadata:()=>null,resultCount:{},totalCount:{},setResultCount:()=>null,activePage:1,setActivePage:()=>null,pageSize:10,results:[],filters:{},doQuery:()=>null,setFilters:()=>null,query:"",setQuery:()=>null,debouncedQuery:"",currentPageTotal:10,selectorStructure:[],translations:_s,setTranslations:()=>null,showSelectors:true}),Ut=()=>useContext(Sl);});function ng({translations:e}){let{loadingItems:t,setFilters:o,selectorStructure:r,filters:n,showSelectors:s}=Ut(),a=d=>{let v=d===null||Number.isNaN(d)?void 0:parseInt(d,10);v!==n.profile?o({profile:v,variant:void 0}):v&&o({profile:void 0,variant:void 0});},i=d=>{let v=d===null?void 0:typeof d=="string"&&d.includes(",")?d:parseInt(d,10);v!==n.variant?o({...n,variant:v}):v&&o({...n,variant:void 0});},c=d=>d<1e3?d:format$1(e.count_format)(d).replace(/\.0+([a-zA-Z]*)$/,"$1"),u=r.length===2?r[1].id:n.profile,p=u?r.find(d=>d.id===u):void 0,m=p&&p.variants&&n.variant?p.variants.find(d=>d.id===n.variant):void 0,f=useMemo(()=>r.map(d=>({value:String(d.id||""),label:(e?.dimensionIcon?.[d.name]?`${e?.dimensionIcon?.[d.name]} `:"")+(e?.dimension[d.name]||d.name)+(!t&&(!p||d.id===p?.id)?` (${c(d.members_count)})`:"")})),[e,p,r]),g=useMemo(()=>p?.variants?.map(d=>({value:String(d.id||""),label:(e?.variantIcon?.[d.name]?`${e?.variantIcon?.[d.name]} `:"")+(e?.variant[d.name]||d.name)+(!t&&(!m||d.id===m?.id)?` (${c(d.members_count)})`:"")}))??[],[e,m,r]);return jsx(Fragment,{children:s&&jsxs(Fragment,{children:[jsx(MediaQuery,{largerThan:1e3,styles:{display:"none"},children:jsxs(Group,{className:"bespoke-explore-reports-select-container",position:"center",mb:"md",children:[jsx(Select,{className:"bespoke-explore-reports-select",data:f,value:String(p?.id||""),onChange:d=>a(d),label:e.select_report||"Select Report",placeholder:e.select_report||"Select Report",clearable:typeof p?.id<"u",style:{width:"450px"}}),p?.variants&&p.variants.length>2&&jsx(Select,{className:"bespoke-explore-variant-select",data:g,value:String(m?.id||""),onChange:d=>i(d),label:e.select_variant||"Select Variant",placeholder:e.select_variant||"Select Variant",clearable:typeof m?.id<"u",style:{width:"450px"}})]})}),jsx(MediaQuery,{smallerThan:1e3,styles:{display:"none"},children:jsxs("div",{children:[jsx(Group,{position:"center",className:"bespoke-explore-reports-selector",mb:"md",children:r.map(d=>jsxs(Button,{"data-selected":d.id===p?.id?"true":"false","data-report-name":d.name,variant:d.id===p?.id?"outline":"subtle",onClick:()=>a(d.id),rightIcon:d.id&&d.id===p?.id?jsx(IconX,{size:"1rem"}):void 0,leftIcon:e?.dimensionIcon?.[d.name]??void 0,children:[jsx(Text,{span:true,className:"bespoke-explore-reports-name",dangerouslySetInnerHTML:{__html:e?.dimension[d.name]??d.name}}),!t&&(!p||d.id===p?.id)&&jsx(Text,{span:true,size:"xs",ml:"0.2rem",className:"bespoke-explore-reports-count",children:`(${c(d.members_count)})`})]},`p-${d.id}`))}),p&&p.variants&&p.variants.length>2&&jsx(Group,{position:"center",style:{minHeight:"36px"},className:"bespoke-explore-variant-selector",mb:"md",children:p.variants.map(d=>jsxs(Button,{"data-selected":d.id===m?.id?"true":"false","data-variant-name":d.name,variant:d.id===m?.id?"outline":"subtle",onClick:()=>i(d.id),rightIcon:d.id&&d.id===m?.id?jsx(IconX,{size:"1rem"}):void 0,leftIcon:e?.variantIcon?.[d.name]?jsx(Text,{span:true,dangerouslySetInnerHTML:{__html:e.variantIcon[d.name]}}):void 0,children:[jsx(Text,{span:true,className:"bespoke-explore-variant-name",dangerouslySetInnerHTML:{__html:e?.variant[d.name]??d.name}}),!t&&(!m||d.id===m?.id)&&jsx(Text,{span:true,size:"xs",ml:"0.2rem",className:"bespoke-explore-variant-count",children:`(${c(d.members_count)})`})]},`v-${d.id}`))})]})})]})})}var Cl,wl=h(()=>{l();ir();Cl=ng;});function dt(e,t){return e.request(t).then(o=>{let{status:r,data:n}=o;return "error"in n?{ok:false,status:r,error:n.error}:{ok:true,status:r,wrapper:n.wrapper,data:n.data}},o=>{if("isAxiosError"in o){let{status:r,data:n}=o.response||{status:500};return {ok:false,status:r,error:n?.error??o.message}}return {ok:false,status:500,error:o.message}})}function Te(e,t,o){let r=typeof t=="string"?{url:t}:t;return n=>dt(e,{...r,method:"GET",params:o?o(n):n})}function Re(e,t,o){let r=typeof t=="string"?{url:t}:t;return n=>dt(e,{...r,method:"POST",data:n})}function oo(e,t,o){let r=typeof t=="string"?{url:t}:t;return n=>dt(e,{...r,method:"DELETE",params:o?o(n):n})}var lr=h(()=>{l();});function Co(e,t){return o=>dt(e,{method:"POST",url:`images/save/${t}`,params:{prompt:o.prompt,provider:t}})}var Al=h(()=>{l();lr();});function cr(e,t){return o=>dt(e,{method:"GET",url:`images/search/${t}`,params:{prompt:o.prompt,page:o.page,provider:t}})}var Pl=h(()=>{l();lr();});function Il(e,t){return ()=>dt(e,{method:"GET",url:`list/icons/${t}`,params:{provider:t}})}var Ll=h(()=>{l();lr();});function Ol(e,t){return o=>dt(e,{method:"GET",url:`read/icons/${t}/icon.svg`,params:{name:o.name}})}var _l=h(()=>{l();lr();});function Nr(e){let t=On.create({baseURL:e});return {createBulkBlock:Re(t,"create/bulk/block"),createBlock:Re(t,"create/block"),createDimension:Re(t,"create/dimension"),createFormatter:Re(t,"create/formatter"),createReport:Re(t,"create/report"),createSection:Re(t,"create/section"),createVariant:Re(t,"create/variant"),createDatasource:Re(t,"create/datasource"),deleteBlock:oo(t,"delete/block",wo),deleteDimension:oo(t,"delete/dimension",wo),deleteFormatter:oo(t,"delete/formatter",wo),deleteReport:oo(t,"delete/report",wo),deleteSection:oo(t,"delete/section",wo),deleteVariant:oo(t,"delete/variant",wo),deleteDatasource:oo(t,"delete/datasource",wo),readBlock:Te(t,"read/block"),readDimension:Te(t,"read/dimension"),readFormatter:Te(t,"read/formatter"),readReport:Te(t,"read/report"),readSection:Te(t,"read/section"),readVariant:Te(t,"read/variant"),readDatasource:Te(t,"read/datasource"),updateBulkBlock:Re(t,"update/bulk/block"),updateBlock:Re(t,"update/block"),updateDimension:Re(t,"update/dimension"),updateFormatter:Re(t,"update/formatter"),updateReport:Re(t,"update/report"),updateSection:Re(t,"update/section"),updateVariant:Re(t,"update/variant"),updateDatasource:Re(t,"update/datasource"),searchReport:Te(t,"search/reports"),validateVariantSlug:Te(t,"validate/variant"),readMember:Te(t,"read/members",ag),readMemberImage:Te(t,{url:"member/image",responseType:"blob"}),searchMember:Te(t,"search/members"),updateMember:Te(t,"update/members"),imageLocalSearch:cr(t,"local"),imageLocalSave:Co(t,"local"),imageFlickrSearch:cr(t,"flickr"),imageFlickrSave:Co(t,"flickr"),imageUnsplashSearch:cr(t,"unsplash"),imageUnsplashSave:Co(t,"unsplash"),imageUploadSave:Co(t,"upload"),imageAdobeSearch:cr(t,"adobe"),imageAdobeSave:Co(t,"adobe"),imagePixabaySearch:cr(t,"pixabay"),imagePixabaySave:Co(t,"pixabay"),readMetadata:Te(t,"read/metadata"),regenerateSearch:Re(t,"search/regenerate"),urlProxy:Te(t,"url/proxy"),searchRole:Te(t,"auth/search/roles"),searchUser:Te(t,"auth/search/users"),readUser:Te(t,"auth/read/user"),updateUser:Re(t,"auth/update/user"),updateMyData:Re(t,"auth/update/me"),revalidateReport:Te(t,"revalidate/report"),revalidateUrl:Te(t,"revalidate/url"),readPrivateBlocks:Re(t,"read/blocks/private"),readClientSideBlocks:Re(t,"read/section/client"),listTablerIcons:Il(t,"tabler"),readTablerIcon:Ol(t,"tabler"),readEnvSecrets:Te(t,"read/secrets")}}var wo,ag,Bl=h(()=>{l();Al();Pl();lr();Ll();_l();wo=e=>({id:e}),ag=e=>{if(e.mode==="slugs"){let t=e.slugs.map(o=>[o.variantSlug,o.memberSlug].join("/")).join(",");return {...e,slugs:t}}return ["related","whole"].includes(e.mode)?{...e}:{...e,[e.mode]:e[e.mode].join(",")}};});var Ms=h(()=>{l();Bl();});var Ml=h(()=>{l();});var Nl=h(()=>{l();Ml();});var cg,Pe,mt=h(()=>{l();cg=()=>{let e=process.env.NEXT_PUBLIC_REPORTS_LOCALE_DEFAULT||"en",t=process.env.NEXT_PUBLIC_REPORTS_LOCALES?.split(",")||[e];return t.includes(e)||t.push(e),{localeDefault:e,locales:t}},Pe=cg;});function lt(e){return {variables:e.variables||{},query:e.query||{},locale:e.locale||ug}}var ug,ur=h(()=>{l();Nl();mt();({localeDefault:ug}=Pe());});var Ao,Dl,Ie,xn,Fl,Ns,pg,dg,mg,fg,gg,Ds,Fs,S,fe,Se,ft,Vl,vn,de=h(()=>{l();Ao={REPORT:"report",SECTION:"section",BLOCK:"block",INPUT:"block_input",FORMATTER:"formatter",DATASOURCE:"datasource",DIMENSION:"report_dimension",VARIANT:"report_dimension_variant",SEARCH:"search"},[Ao.BLOCK,Ao.SEARCH],{[Ao.SECTION]:"report_id",[Ao.DIMENSION]:"report_id",[Ao.VARIANT]:"dimension_id",[Ao.BLOCK]:"section_id",[Ao.INPUT]:"block_id"},Dl={REPORT:"report",STORY:"story"},Ie={SINGLE:"single",MULTI:"multi"},xn={SEGMENTED_CONTROL:"segmented control",SELECTOR:"selector"},Fl={TITLE:"title",SUBTITLE:"subtitle",LABEL:"label"},{[Dl.REPORT]:Object.values(Fl),[Dl.STORY]:Object.values(Fl)},Ns={ALLOWED:"allowed",ALLOWED_LOGIC:"allowedLogic",IGNORE_CASCADE:"ignoreCascade"},pg={ACCESS:"access",ACCESS_LOGIC:"accessLogic"},dg={DISABLED:"disabled"},mg={FALLBACK:"fallback"},fg={CLIENT_SIDE:"clientSideSection"},{...Ns},{POSITION:"position",ICON:"icon",...Ns},gg={IMAGE:"image",PARAGRAPH:"paragraph",SELECTOR:"selector",STAT:"stat",SUBTITLE:"subtitle",TITLE:"title",NAV:"nav",RESET_BUTTON:"reset_button",COMPARISON_BUTTON:"comparison_button",TABLE:"table",BUTTON:"button",MULTIHIERARCHY_SELECTOR:"multihierarchy_selector",FALLBACK:"fallback",SKELETON:"skeleton"},Ds={GENERATOR:"generator",RELATED:"related",VIZ:"visualization",SECTION_FLAG:"section_flag"},Fs="logic",S={...gg,...Ds},[S.GENERATOR,S.SECTION_FLAG,S.SELECTOR,S.VIZ,S.IMAGE,S.TABLE,S.MULTIHIERARCHY_SELECTOR],fe={ALT:"alt",AUTHOR:"author",DESC:"desc",FOOTNOTE:"footnote",BIO:"bio",IMAGE:"image",LABEL:"label",LOGIC:"logic",MULTIHIERARCHY_SELECTOR:"multihierarchySelector",MULTIHIERARCHY_SELECTOR_ALL_LABEL:"multihierarchySelectorAllLabel",MULTIHIERARCHY_SELECTOR_NAME:"multihierarchySelectorName",MULTIHIERARCHY_SELECTOR_PLACEHOLDER:"multihierarchySelectorPlaceholder",SIMPLE:"simple",SIMPLE_ENABLED:"simpleEnabled",PARAGRAPH:"paragraph",SELECTOR_DEFAULT:"selectorDefault",SELECTOR_DYNAMIC:"selectorDynamic",SELECTOR_NAME:"selectorName",SELECTOR_TYPE:"selectorType",SRC:"src",SLUG:"slug",SUBTITLE:"subtitle",TABLE:"table",TITLE:"title",SHORT_TITLE:"shortTitle",TOOLTIP:"tooltip",TWITTER:"twitter",URL:"url",VALUE:"value"},[fe.LOGIC,fe.SIMPLE,fe.SIMPLE_ENABLED],Se={ENABLE_ALL:{bubbleMenu:true,toolbarOptions:{history:true,alignment:false,format:true}},DISABLE_ALL:{bubbleMenu:false,toolbarOptions:{history:false,alignment:false,format:false}},ENABLE_FORMAT:{bubbleMenu:true,toolbarOptions:{history:true,alignment:false,format:true}}},{[S.IMAGE]:[{field:fe.TITLE,editorConfig:Se.ENABLE_ALL},{field:fe.SRC,editorConfig:Se.DISABLE_ALL},{field:fe.ALT,editorConfig:Se.DISABLE_ALL},{field:fe.DESC,editorConfig:Se.ENABLE_ALL}],[S.PARAGRAPH]:[{field:S.PARAGRAPH,editorConfig:Se.ENABLE_ALL},{field:fe.TOOLTIP,editorConfig:Se.ENABLE_FORMAT}],[S.SELECTOR]:[{field:fe.SELECTOR_DEFAULT},{field:fe.SELECTOR_DYNAMIC},{field:fe.SELECTOR_NAME,editorConfig:Se.ENABLE_FORMAT},{field:fe.SELECTOR_TYPE}],[S.STAT]:[{field:fe.TITLE,editorConfig:Se.ENABLE_FORMAT},{field:fe.SUBTITLE,editorConfig:Se.ENABLE_FORMAT},{field:fe.VALUE,editorConfig:Se.ENABLE_FORMAT},{field:fe.TOOLTIP,editorConfig:Se.ENABLE_FORMAT}],[S.SUBTITLE]:[{field:fe.SUBTITLE,editorConfig:Se.ENABLE_FORMAT},{field:fe.TOOLTIP,editorConfig:Se.ENABLE_FORMAT}],[S.TITLE]:[{field:fe.TITLE,editorConfig:Se.ENABLE_FORMAT},{field:fe.SLUG,editorConfig:Se.DISABLE_ALL},{field:fe.TOOLTIP,editorConfig:Se.ENABLE_FORMAT}],[S.BUTTON]:[{field:fe.LABEL,editorConfig:Se.ENABLE_FORMAT},{field:fe.URL,editorConfig:Se.ENABLE_FORMAT}],[S.GENERATOR]:[],[S.SECTION_FLAG]:[],[S.VIZ]:[],[S.TABLE]:[],[S.MULTIHIERARCHY_SELECTOR]:[{field:fe.MULTIHIERARCHY_SELECTOR_NAME,editorConfig:Se.ENABLE_FORMAT},{field:fe.MULTIHIERARCHY_SELECTOR_PLACEHOLDER,editorConfig:Se.DISABLE_ALL},{field:fe.MULTIHIERARCHY_SELECTOR_ALL_LABEL,editorConfig:Se.DISABLE_ALL}],[S.NAV]:[{field:fe.TITLE,editorConfig:Se.ENABLE_FORMAT},{field:fe.SHORT_TITLE,editorConfig:Se.ENABLE_FORMAT}]},ft={NAME:"name",DESCRIPTION:"description",...Ns,...pg,...mg,...dg,...fg},Vl={FORMATTER:"formatter",FUNCTION:"function"},{[Vl.FORMATTER]:"Formatter",[Vl.FUNCTION]:"Function"},vn={STRING:"string",NUMBER:"number",OBJECT:"object",DATE:"date"},{[vn.STRING]:"String",[vn.NUMBER]:"Number",[vn.OBJECT]:"Object/Array",[vn.DATE]:"Date"};});function Vs(e){let t=1+76.18009173/e-86.50532033/(e+1)+24.01409822/(e+2)-1.231739516/(e+3)+.00120858003/(e+4)-536382e-11/(e+5);return (e-.5)*Math.log(e+4.5)-(e+4.5)+Math.log(t*2.50662827465)}function zl(e,t,o){let r=0,n=1,s=1,a=1,i=0,c=0,u;for(;Math.abs((s-c)/s)>1e-5;)c=s,u=-(t+i)*(t+o+i)*e/(t+2*i)/(t+2*i+1),r=s+u*r,n=a+u*n,i+=1,u=i*(o-i)*e/(t+2*i-1)/(t+2*i),s=r+u*s,a=n+u*a,r/=a,n/=a,s/=a,a=1;return s/t}function bg(e,t,o){let r,n;if(e<0)n=0;else if(e>=t)n=1;else {e=Math.floor(e);let s=o,a=e+1,i=t-e,c=a+i,u=Math.exp(Vs(c)-Vs(i)-Vs(a)+a*Math.log(s)+i*Math.log(1-s));s<(a+1)/(c+2)?r=u*zl(s,a,i):r=1-u*zl(1-s,i,a),n=1-r;}return Math.round(n*1e5)/1e5}function yg(e){return {.99999:15.137,.99:6.635,.95:3.841,.9:2.706}[e]}function Dr(e,t,o,r){let n=t/(1-t),s=0,a=1,i=0,c=0;for(;s<=e;)c+=a,s>=o&s<=r&&(i+=a),c>1e30&&(i/=1e30,c/=1e30,a/=1e30),s+=1,a=a*n*(e+1-s)/s;return i/c}function Sg(e,t,o){let r=e/t,s=(100-o*100)/2,a,i;if(e===0)a=0;else {let c=r/2,u=0,p=r,m=s/100;for(;p-u>1e-5;)Dr(t,c,e,e)*.5+Dr(t,c,e+1,t)>m?(p=c,c=(u+c)/2):(u=c,c=(p+c)/2);a=c;}if(e===t)i=0;else {let c=(1+r)/2,u=r,p=1,m=s/100;for(;p-u>1e-5;)Dr(t,c,e,e)*.5+Dr(t,c,0,e-1)<m?(p=c,c=(u+c)/2):(u=c,c=(p+c)/2);i=c;}return {lci:a,uci:i}}function vg(e,t){let o=e,r=t,n=o,s=r,a=95,i=.5,c=.5,p=(100-a)/2/100,m=n;for(;c>1e-5;)c/=2,Tn((1+m)*i/(1-i),m+1,1e10)+.5*Tn((1+m)*i/(1-i),m,m)>p?i-=c:i+=c;let f=(1+m)*i/(1-i)/s;for(i=.5,c=.5,p=(100-a)/2/100;c>1e-5;)c/=2,Tn((1+m)*i/(1-i),0,m-1)+.5*Tn((1+m)*i/(1-i),m,m)<p?i-=c:i+=c;let d=(1+m)*i/(1-i)/s;return {lci:f,uci:d}}function Tn(e,t,o){let r=1,n=0,s=0,a=0;for(;a<e||r>n*1e-10;)n+=r,a>=t&a<=o&&(s+=r),n>1e30&&(s/=1e30,n/=1e30,r/=1e30),a+=1,r=r*e/a;return s/n}var $l,Ul=h(()=>{l();$l={binomialCdf:bg,binP:Dr,computeMidP:Sg,criticalValue:yg,smr:vg};});function H(e){let t=e.logicFactory(ro);return Og[e.name]={description:e.description,inputType:e.inputType,logic:_g(t),testValue:e.testValue,type:e.type||"formatter"},t}function _g(e){let t=e.toString().trim();if(t.startsWith("function"))return t.replace(/^function(?:\s\w+)?\([^)]\)/,"").trim().replace(/^{([\s\S]+)\}$/,"$1");let o=t.replace(/^.+?=>/,"").trim();return o.startsWith("{")?o.replace(/^{([\s\S]+)\}$/,"$1"):`return ${o}`}var ro,Og,le=h(()=>{l();Ul();ro={d3:{...xg,...Tg,...Rg,...Eg},d3plus:{assign:assign,closest:closest,date:date,formatAbbreviate:formatAbbreviate,merge:merge,strip:strip,titleCase:titleCase},stats:$l},Og={};});function Dg(e,t,o,r,n=void 0,s){let a={},i=[],{locale:c}=lt(s);try{if(t){let u=new Proxy(console,{get(m,f){return Fg(f,"log","debug","info","warn","error")?(...g)=>{i.push(`${f} ${Date.now()} - ${g.map(d=>format(d)).join(" ")}`),Ng&&m[f](...g);}:m[f]}}),p;return n?p=new Function(e,"console","libs","formatters","locale","variables",o)(t,u,ro,r,c,n):p=new Function(e,"console","libs","formatters","locale",o)(t,u,ro,r,c),typeof p=="object"&&Object.keys(p).length>0&&Object.assign(a,p),{vars:a,error:null,log:i,output:p}}return {vars:a,error:"Invalid API Link",log:i}}catch(u){return {vars:a,error:u.message,log:i}}}function Fg(e,...t){return t.includes(e)}var Ng,no,Fr=h(()=>{l();ur();le();Ng=Bg(process.env.REPORTS_LOGGING),no=Dg;});function zs(e){return e.reduce((t,o,r)=>(r?r===e.length-1&&r===1?t+=` and ${o}`:r===e.length-1?t+=`, and ${o}`:t+=`, ${o}`:t+=o,t),"")}var Gl=h(()=>{l();});function Vg(e,t,o,r=false){let{variables:n}=lt(o);if(!e)return e;let s=/([A-z0-9]*)\{\{([^\}]+)\}\}/g;return e.replace(s,(i,c,u)=>{let p=f=>f;if(c){let f=c.replace(/^\w/g,g=>g.toLowerCase());f in t?p=t[f]:p=g=>`${c}${g}`;}let m=Array.isArray(n[u])?zs(n[u]):n[u];if(m===void 0)return r?i:"N/A";try{return p(m,ro,t)}catch(f){return console.error(`Error using formatter ${p.name}
2
- `,`Error message: ${f.message}`),"N/A"}})}var Et,pr=h(()=>{l();ur();Gl();le();Et=Vg;});var $s,gt,Po=h(()=>{l();pr();$s=(e,t,o)=>{let{variables:r}=o,n=a=>a.allowed==="never"?false:!a.allowed||a.allowed==="always"||r[a.allowed],s={...e};return Object.keys(s).forEach(a=>{typeof s[a]=="string"?s[a]=Et(s[a],t,o):Array.isArray(s[a])?s[a]=s[a].filter(n).map(i=>typeof i=="object"?$s(i,t,o):typeof i=="string"?Et(i,t,o):i):typeof s[a]=="object"&&s[a]!==null&&!(s[a]instanceof Date)&&(s[a]=$s(s[a],t,o));}),s},gt=$s;});var Hl,Wl=h(()=>{l();Hl=e=>Array.isArray(e)?e.map(t=>typeof t=="string"?{allowed:"always",label:t,id:t}:{allowed:"always",label:t.id,...t}):[];});var zg,Io,Rn=h(()=>{l();de();zg=(e,t,o)=>{if(!o)return false;if(e===Ie.SINGLE)return o.find(n=>n.id===t);let r=Array.isArray(t)?t:t.split(",");return Array.isArray(r)&&r.every(n=>o.map(s=>s.id).includes(n))},Io=zg;});function En(e,t,o,r,n=false){let{variables:s}=lt(r),a=gt({logic:t},o,r).logic,i=no("variables",s,a,o,void 0,r),{vars:c,log:u,error:p}=i,m=c.type||Ie.SINGLE,f=c.component||"Selector",g=c.hideLabel||"false",d=c.resetSectionVars||"false",v=c.name||"Unlabeled Selector",x=Hl(c.options||[]),C=U=>m===Ie.MULTI&&!Array.isArray(U)?[U]:U,R=c.defaultValue,k;if(R&&(R=C(R),Io(m,R,x)&&(k=R)),!k){let U=x&&x[0]&&x[0].id||x[0]||"";k=C(U);}if(n&&typeof window<"u"){let U=`selector${e}id`,G=new URLSearchParams(window.location.search),B=Object.fromEntries(G)[U];B&&!Io(m,B,x)&&B!==void 0&&(G.delete(U),window.history.replaceState(null,null,`?${G.toString()}`));}return {config:{name:v,type:m,options:x,defaultValue:k,component:f,hideLabel:g,resetSectionVars:d},log:u,error:p}}var Us=h(()=>{l();ur();de();Fr();Po();Wl();Rn();});function Gs(e,t,o){if(!e)return false;let r=Array.isArray(o)?o:o.split(",");return Array.isArray(r)&&r.every(n=>e.map(s=>`${s[`${t} ID`]}`).includes(n))}var ql=h(()=>{l();});function kn(e,t,o,r,n=false){let{variables:s}=lt(r),a=gt({logic:t},o,r).logic,i=no("variables",s,a,o,void 0,r),{vars:c,log:u,error:p}=i;if(n&&typeof window<"u"){let f=`multihierarchySelector${e}-value`,g=`multihierarchySelector${e}-type`,d=new URLSearchParams(window.location.search),v=Object.fromEntries(d),x=v[f],C=v[g];x&&x!==void 0&&C&&C!==void 0&&!Gs(c.data,C,x)&&(d.delete(f),d.delete(g),window.history.replaceState(null,null,`?${d.toString()}`));}return {config:c,log:u,error:p}}var Hs=h(()=>{l();ql();ur();Fr();Po();});var $g,jl,Kl=h(()=>{l();de();$g=(e,t,o)=>{let r=`selector${e}id`,n=new URLSearchParams(typeof location<"u"&&location?.search?location.search:"").get(r),s=new URLSearchParams(t).get(r),a=n||s;if(o.type===Ie.MULTI){let u=a?a.split(","):o.defaultValue,p=o.options.filter(m=>u.includes(m.id));return {[`selector${e}id`]:u,[`selector${e}label`]:(p||[]).map(m=>m.label)}}let i=a&&o.options.find(u=>u.id===a)?a:o.defaultValue,c=o.options.find(u=>u.id===i);return {[`selector${e}id`]:i,[`selector${e}label`]:c&&c.label||void 0}},jl=$g;});var Ug,Yl,Xl=h(()=>{l();Ug=(e,t,o)=>{let r=`multihierarchySelector${e}-value`,n=`multihierarchySelector${e}-type`,s=new URLSearchParams(typeof location<"u"&&location?.search?location.search:"").get(r),a=new URLSearchParams(typeof location<"u"&&location?.search?location.search:"").get(n),i=new URLSearchParams(t).get(r),c=new URLSearchParams(t).get(n),u=s||i,p=a||c,m=u?u.split(","):o.defaultValue||[],f=p||o.defaultValueType||"",g=o.data?.filter(d=>m.includes(`${d[`${f} ID`]}`))||[];return {[`multihierarchySelector${e}id`]:m,[`multihierarchySelector${e}label`]:[...new Set((g||[]).map(d=>d[f]))],[`multihierarchySelector${e}type`]:f}},Yl=Ug;});var Ql,Gg,Hg,Wg,kt,Lo=h(()=>{l();de();mt();(({localeDefault:Ql,locales:Gg}=Pe())),Hg=Object.values(Ds),Wg=(e,t=Ql)=>e&&Hg.includes(e.type)?{locale:Fs,locales:[Fs]}:{locale:t,locales:Gg},kt=(e,t=Ql)=>{if(!e)return {};let{locale:o}=Wg(e,t);return e.contentByLocale?.[o]?.content};});function qg(e,t){let o=Object.values(t),r=o.filter(n=>n.shared&&n.section_id!==e).map(n=>n.id);return Object.fromEntries(o.filter(n=>n.section_id===e&&(n.inputs.length===0||n.inputs.some(s=>r.includes(s)))).map(n=>[n.id,n]))}var Zl,Jl=h(()=>{l();Zl=qg;});var ec,tc=h(()=>{l();ec=(e,t)=>t&&typeof t=="string"?t.split(".").reduce((o,r)=>o[r],e):e;});var oc,Ws=h(()=>{l();oc="SECTION_ALLOWED";});function qs(e){return e.type===S.SECTION_FLAG&&e.inputs.length===0&&e.consumers.length===0}var rc=h(()=>{l();de();});var nc,sc=h(()=>{l();nc={jwt:jg};});var wn,An,Pn=h(()=>{l();le();sc();wn=(e,t={},o="en",r={},n={})=>{let s={setVariables:r.onSetVariables?r.onSetVariables:c=>c,openModal:r.onOpenModal?r.onOpenModal:c=>c,formatters:t,libs:ro,locale:o,...n};function a(c){return Function("globals",...c.vars,`with (globals) { ${c.logic} }`).bind(s,s)}function i(c){if(c.vars&&c.logic)return a(c);for(let u in c)Array.isArray(c[u])?c[u]=c[u].map(p=>isObject(p)?i(p):p):isObject(c[u])&&(c[u]=i(c[u]));return c}return i(e)},An=(e,t={})=>{let o={libs:nc,...t};function r(s){return Function("globals",...s.vars,`with (globals) { ${s.logic} }`).bind(o,o)}function n(s){if(s.vars&&s.logic)return r(s);for(let a in s)Array.isArray(s[a])?s[a]=s[a].map(i=>isObject(i)?n(i):i):isObject(s[a])&&(s[a]=n(s[a]));return s}return n(e)};});function Yg(){let{publicRuntimeConfig:e}=Kg(),t=e.bespoke_report_env_vars||{};return {...Object.keys(t).reduce((o,r)=>(o[`ENV_${r}`]=t[r]||"N/A",o),{})}}var Gt,dr=h(()=>{l();Gt=Yg;});function Xg(){return typeof process>"u"?{}:Object.entries(process.env).filter(([e])=>e.startsWith("BESPOKE_SECRET_")).reduce((e,[t,o])=>({...e,[t.replace("BESPOKE_SECRET_","ENV_SECRET_")]:o}),{})}var ac,ic=h(()=>{l();ac=Xg;});function Ln(e){return e.ok!==void 0}function In(e){this.message=e,this.name="ApiFetchException";}async function Ks(e,t,o="en",r,n,s){let a=Date.now(),i=e,c,u=Gt(),p=ac(),m={envs:{...u,...p}},f=new URL(e),g=new URLSearchParams(f.searchParams.toString());g.has("bespoke_slugs")&&(f.searchParams.delete("bespoke_slugs"),i=f.toString());let d={datasource:void 0};r.find(k=>{if(!k.content?.pattern)return false;try{let A=new RegExp(k.content.pattern,"gm");return A.test(i)?(d.datasource=k,!0):A.test(i)}catch{return false}});let v=n?n.settings:{},x=!!(v&&v.useProxy&&v.useProxy==="true"),C=d.datasource&&typeof d.datasource.content.useProxy=="boolean"?d.datasource.content.useProxy:false,R=`${process.env.NEXT_PUBLIC_REPORTS_BASE_URL}/api/cms/url/proxy?url=${encodeURIComponent(i)}`;if(typeof window=="object"&&(x||C)){let k=await rh({url:i,timeout:cc});if(k.ok===true)c=k.data;else throw new In(k?.error)}else try{let A={url:i,timeout:cc};if(d.datasource){let G=m;s&&(G={...m,session:s});let B=typeof window>"u"&&d.datasource.content.logic_ssr?d.datasource.content.logic_ssr:d.datasource.content.logic,O=await An({vars:["url","libs","session"],logic:B},G)(i);if(O.axiosConfig)A=O.axiosConfig;else throw new In(`AxiosConfig is missing in Data Source ${d.datasource.name} (ID: ${d.datasource.id}).`)}let U=await On(A);if(U.status===200)U.headers["content-type"]==="text/csv"?c=csvParse(U.data):c=U.data;else throw new In("No response for: "+i)}catch(k){throw new In(k.message)}if(g.has("bespoke_slugs")){let k=g.get("bespoke_slugs");if(k){let A=k.split(",");if(A.length===3){let[U,G,F]=A,B=ec(c,F);if(B&&Array.isArray(B)){let E=Array.from(new Set(B.map(O=>`${O[G]}`).filter(O=>!["","undefined"].includes(O))));if(E.length>0){let O=E.join("").length>2e3,P=await t({mode:O?"whole":"ids",ids:O?void 0:E,all:false,locale:o,variant:[parseInt(U,10)],output:"lite",limit:E.length+1,allowNulls:true}).then(w=>{let N=[];return Ln(w)?w.ok&&(N=w.data.results):N=w.results,N&&Array.isArray(N)?N:[]}).catch(w=>(console.error(`Error hydrating slugs for Variant: ${U}, Key: ${G}, Accessor: ${F}`),console.error(` Url ${e}`),n&&console.error(` From Section ${n.section_id} and Block ${n.id}`),console.error(w),[]));if(P){let w=Object.fromEntries(P.map(N=>[N.id,`/${N.variant_slug}/${N.slug}`]));B.map(N=>(N.bespoke_slug=w[N[G]]?w[N[G]]:null,N));}}}}}}return {data:c,requestDuration:Date.now()-a,finalUrl:C||x?R:i,apiDataSource:d.datasource?d.datasource:false}}function nh(e){this.name="BlockException",this.message=e;}async function uc(e,t,o,r,n,s){let{locale:a,variables:i,query:c}=lt(o),u=sh(e,o,i,t),p=null,m=e.contentByLocale?.logic?.content?.api,f=null,g=null,d=null,v=null,x=null;if(!u)return {outputVariables:{},renderVariables:{},status:{allowed:false,hiddenByCascade:e.id}};if(e.type===S.FALLBACK||e.type===S.SKELETON)return {outputVariables:{},renderVariables:{},status:{allowed:u,hiddenByCascade:e.id}};if(m){d=oh(m,t,o);let B=d.split("|||").filter(P=>P!==""),E=[];for(let P=0;P<B.length;P++){let w=B[P];new RegExp("^(?:[a-z+]+:)?//","i").test(d)||(w=`${process.env.NEXT_PUBLIC_REPORTS_BASE_URL}/${w}`.replace(/([^:]\/)\/+/g,"$1")),E.push(Ks(w,r,a,n,e,s).catch(Z=>{throw new nh(` Excecution of ${e.type}-${e.id} in section ${e.section_id} in report ${i.report_name} (${i.report_id}) failed.
3
- Error fetching ${w}.
1
+ import'path';import'url';import*as eo from'react';import eo__default,{useState,useCallback,useEffect,useMemo,createContext,useContext,forwardRef,useRef,createElement,memo,Fragment as Fragment$1}from'react';import {useDebouncedValue,useClickOutside,getHotkeyHandler,useMediaQuery,useDisclosure}from'@mantine/hooks';import {useRouter}from'next/router';import On from'axios';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {ActionIcon,Group,Tooltip,Modal,Stack,Text,Badge,Autocomplete,Loader,Container,TextInput,LoadingOverlay,Alert,Paper,Anchor,Flex,packSx,Button,Divider,Popover,Tabs,Box,useMantineTheme,MediaQuery,Input,rem,CloseButton,ScrollArea,Grid,Center,MultiSelect,SegmentedControl,Select,CopyButton,SimpleGrid,Image,Checkbox,Card,ThemeIcon,Notification,List,Menu,Switch,Title,Collapse,UnstyledButton,Skeleton,clsx,Pagination,Accordion,HoverCard}from'@mantine/core';import*as Rg from'd3-format';import {format as format$1}from'd3-format';import {IconSearch,IconX,IconTrash,IconTable,IconCamera,IconShare,IconPhoto,IconSelector,IconChevronLeft,IconChevronRight,IconPlus,IconRefresh,IconListTree,IconAlignLeft,IconChartBar,IconPercentage,IconFlag,IconApi,IconHeading,IconDatabase,IconAlertCircle,IconLink,IconSparkles,IconClipboardCheck,IconClipboardCopy,IconExternalLink,IconTemplate,IconPolaroid,IconCode,IconDownload,IconInfoCircle,IconArrowLeft,IconArrowRight,IconFileTypeXls,IconFileTypeJs,IconFileTypeCsv,IconChevronUp,IconChevronDown,IconCircleKey,IconCodePlus}from'@tabler/icons-react';import*as xg from'd3-array';import*as Tg from'd3-collection';import {nest}from'd3-collection';import*as Eg from'd3-time-format';import {formatAbbreviate}from'd3plus-format';import {date}from'd3plus-axis';import {isObject,merge,closest,assign}from'd3plus-common';import {titleCase,strip}from'd3plus-text';import Bg from'yn';import {format}from'pretty-format';import jg from'jsonwebtoken';import Kg from'next/config';import lc from'axios-retry';import Qg from'toposort';import {csvParse,csvFormat}from'd3-dsv';import {schema,normalize}from'normalizr';import {createSlice,configureStore}from'@reduxjs/toolkit';import {HYDRATE,createWrapper}from'next-redux-wrapper';import {notifications}from'@mantine/notifications';import {useSession}from'next-auth/react';import {useDispatch,useSelector}from'react-redux';import {saveAs}from'file-saver';import {dataConcat,dataLoad}from'd3plus-viz';import {MantineReactTable}from'mantine-react-table';import Gy from'slugify';import Yy from'jszip';import mp,{Element,domToReact,Text as Text$1}from'html-react-parser';import*as ex from'd3plus-react';import rx from'next/dynamic';import {Prism}from'@mantine/prism';import {select}from'd3-selection';import {saveElement}from'd3plus-export';import {FacebookShareButton,FacebookIcon,TwitterShareButton,TwitterIcon,TelegramShareButton,TelegramIcon,WhatsappShareButton,WhatsappIcon,LinkedinShareButton,LinkedinIcon,RedditShareButton,RedditIcon,EmailShareButton,EmailIcon}from'react-share';import'xlsx';var Yf=Object.defineProperty;var h=(e,t)=>()=>(e&&(t=e(e=0)),t);var Os=(e,t)=>{for(var o in t)Yf(e,o,{get:t[o],enumerable:true});};var l=h(()=>{});function tg({children:e,pageSize:t=10,sort:o=void 0}){let r={profile:void 0,variant:void 0},[n,s]=useState([]),[a,i]=useState(false),[c,u]=useState(false),[p,m]=useState({}),[f,g]=useState({}),[d,v]=useState(1),[x,w]=useState(r),[R,k]=useState(""),[P]=useDebouncedValue(R,750),[U,G]=useState([]),[V,B]=useState(_s),[E,O]=useState(false),{locale:A}=useRouter(),C=async()=>{try{u(!0),On.get("/api/cms/read/metadata").then(j=>{if(j&&j.data&&j.data.data&&j.data.data.data){let ee=j.data.data.data.reduce((re,oe)=>(oe.dimensions&&oe.dimensions.forEach(_=>{_.variants&&_.variants.forEach(T=>{re[T.id]=T.members_count||0;});}),re),{});s(j.data.data.data),m(ee),g(ee);}u(!1),O(!0);}).catch(j=>{console.error(j);});}catch(j){console.error("Error fetching metadata:",j),s([]),u(false),m({}),g({});}},N=j=>{m(j||f);},Z=useCallback(async(j,ee,re)=>{!E&&n.length===0&&await C(),w({profile:j,variant:ee}),re!==""&&k(re);},[]);useEffect(()=>{let j=false;return E&&(i(true),v(1),W(j,0)),()=>{j=false;}},[P,x,E]),useEffect(()=>{if(E){i(true);let j=(d-1)*t;W(false,j);}},[d]);let W=async(j,ee)=>{let re=x.profile&&!Number.isNaN(x.profile)?[x.profile]:[],oe=x.variant?typeof x.variant=="string"&&x.variant.includes(",")?x.variant.split(",").map(T=>parseInt(T,10)):[parseInt(x.variant,10)]:[],_={query:P,format:"profiles",locale:A,limit:t,offset:ee,visible:true,includes:true,noImage:false,variant:oe,dimension:[],report:re,all:false,origin:"typesense"};o&&(_.sort=o),On.get("/api/cms/search/reports",{params:_}).then(T=>{if(T&&T.data&&T.data.data&&T.data.data.results&&!j){let L=T.data.data.results;G(L),m(!R||R===""?false:T.data.data.meta.variantCount);}i(false);}).catch(T=>{console.error(T),i(false);});},$=p||f,J={id:void 0,name:V.filters_all||"ALL"},M=j=>{let ee=j.reduce((oe,_)=>oe.reduce((T,L)=>T.concat(_.map(q=>[].concat(L,q))),[])).map(oe=>{let _;return Array.isArray(oe)?_={id:oe.map(T=>T.id).join(","),name:oe.map(T=>T.name).join(" / "),members_count:oe.reduce((T,L)=>T*($[L.id]||1),1),ordering:oe.reduce((T,L)=>T+L.ordering,0)}:(oe.members_count=$[oe.id]||0,_={...oe,members_count:$[oe.id]||0}),_}),re=ee.reduce((oe,_)=>oe+(_.members_count||0),0);return [{...J,members_count:re},...ee]},z=n.length>1,F=useMemo(()=>{let j=[];if(!c&&n.length>0&&$){let ee=n.filter(re=>re.dimensions.length>0).map(re=>{let oe=false,_=M(re.dimensions.map(T=>T.variants));return _&&_.length>2&&(oe=true),{id:re.id,name:re.dimensions.map(T=>T.name).join(" / "),variants:_,members_count:_.filter(T=>T.id).reduce((T,L)=>T+(L.members_count||0),0),show:oe}});j=[{...J,members_count:ee.reduce((re,oe)=>re+(oe.members_count||0),0)},...ee];}return j},[c,$,n,J]),Y=useMemo(()=>{let j;return F&&(x.profile?x.profile&&(j=F.find(ee=>ee.id===x.profile),j&&x.variant&&j.variants&&(j=j.variants.find(ee=>ee.id===x.variant))):j=F.find(ee=>!ee.id)),j?j.members_count:t},[x,F]),ve={metadata:n,loadingMetadata:c,setLoadingMetadata:u,loadingItems:a,setLoadingItems:i,resultCount:p,totalCount:f,setResultCount:N,activePage:d,setActivePage:v,pageSize:t,filters:x,setFilters:w,doQuery:W,query:R,setQuery:k,debouncedQuery:P,results:U,currentPageTotal:Y,selectorStructure:F,translations:V,setTranslations:j=>B({..._s,...j}),showSelectors:z,initExplore:Z};return jsx(Sl.Provider,{value:ve,children:e})}var _s,Sl,Ut,ir=h(()=>{l();_s={try_another:"Try another search or filter.",search:"Search",filters_all:"All",no_results:"No Results",load_more:"Load more",select_report:"Select Report",select_variant:"Select Variant",count_format:".2s",report:{},dimension:{},variant:{}},Sl=createContext({metadata:[],loadingItems:false,setLoadingItems:()=>null,loadingMetadata:false,setLoadingMetadata:()=>null,resultCount:{},totalCount:{},setResultCount:()=>null,activePage:1,setActivePage:()=>null,pageSize:10,results:[],filters:{},doQuery:()=>null,setFilters:()=>null,query:"",setQuery:()=>null,debouncedQuery:"",currentPageTotal:10,selectorStructure:[],translations:_s,setTranslations:()=>null,showSelectors:true}),Ut=()=>useContext(Sl);});function ng({translations:e}){let{loadingItems:t,setFilters:o,selectorStructure:r,filters:n,showSelectors:s}=Ut(),a=d=>{let v=d===null||Number.isNaN(d)?void 0:parseInt(d,10);v!==n.profile?o({profile:v,variant:void 0}):v&&o({profile:void 0,variant:void 0});},i=d=>{let v=d===null?void 0:typeof d=="string"&&d.includes(",")?d:parseInt(d,10);v!==n.variant?o({...n,variant:v}):v&&o({...n,variant:void 0});},c=d=>d<1e3?d:format$1(e.count_format)(d).replace(/\.0+([a-zA-Z]*)$/,"$1"),u=r.length===2?r[1].id:n.profile,p=u?r.find(d=>d.id===u):void 0,m=p&&p.variants&&n.variant?p.variants.find(d=>d.id===n.variant):void 0,f=useMemo(()=>r.map(d=>({value:String(d.id||""),label:(e?.dimensionIcon?.[d.name]?`${e?.dimensionIcon?.[d.name]} `:"")+(e?.dimension[d.name]||d.name)+(!t&&(!p||d.id===p?.id)?` (${c(d.members_count)})`:"")})),[e,p,r]),g=useMemo(()=>p?.variants?.map(d=>({value:String(d.id||""),label:(e?.variantIcon?.[d.name]?`${e?.variantIcon?.[d.name]} `:"")+(e?.variant[d.name]||d.name)+(!t&&(!m||d.id===m?.id)?` (${c(d.members_count)})`:"")}))??[],[e,m,r]);return jsx(Fragment,{children:s&&jsxs(Fragment,{children:[jsx(MediaQuery,{largerThan:1e3,styles:{display:"none"},children:jsxs(Group,{className:"bespoke-explore-reports-select-container",position:"center",mb:"md",children:[jsx(Select,{className:"bespoke-explore-reports-select",data:f,value:String(p?.id||""),onChange:d=>a(d),label:e.select_report||"Select Report",placeholder:e.select_report||"Select Report",clearable:typeof p?.id<"u",style:{width:"450px"}}),p?.variants&&p.variants.length>2&&jsx(Select,{className:"bespoke-explore-variant-select",data:g,value:String(m?.id||""),onChange:d=>i(d),label:e.select_variant||"Select Variant",placeholder:e.select_variant||"Select Variant",clearable:typeof m?.id<"u",style:{width:"450px"}})]})}),jsx(MediaQuery,{smallerThan:1e3,styles:{display:"none"},children:jsxs("div",{children:[jsx(Group,{position:"center",className:"bespoke-explore-reports-selector",mb:"md",children:r.map(d=>jsxs(Button,{"data-selected":d.id===p?.id?"true":"false","data-report-name":d.name,variant:d.id===p?.id?"outline":"subtle",onClick:()=>a(d.id),rightIcon:d.id&&d.id===p?.id?jsx(IconX,{size:"1rem"}):void 0,leftIcon:e?.dimensionIcon?.[d.name]??void 0,children:[jsx(Text,{span:true,className:"bespoke-explore-reports-name",dangerouslySetInnerHTML:{__html:e?.dimension[d.name]??d.name}}),!t&&(!p||d.id===p?.id)&&jsx(Text,{span:true,size:"xs",ml:"0.2rem",className:"bespoke-explore-reports-count",children:`(${c(d.members_count)})`})]},`p-${d.id}`))}),p&&p.variants&&p.variants.length>2&&jsx(Group,{position:"center",style:{minHeight:"36px"},className:"bespoke-explore-variant-selector",mb:"md",children:p.variants.map(d=>jsxs(Button,{"data-selected":d.id===m?.id?"true":"false","data-variant-name":d.name,variant:d.id===m?.id?"outline":"subtle",onClick:()=>i(d.id),rightIcon:d.id&&d.id===m?.id?jsx(IconX,{size:"1rem"}):void 0,leftIcon:e?.variantIcon?.[d.name]?jsx(Text,{span:true,dangerouslySetInnerHTML:{__html:e.variantIcon[d.name]}}):void 0,children:[jsx(Text,{span:true,className:"bespoke-explore-variant-name",dangerouslySetInnerHTML:{__html:e?.variant[d.name]??d.name}}),!t&&(!m||d.id===m?.id)&&jsx(Text,{span:true,size:"xs",ml:"0.2rem",className:"bespoke-explore-variant-count",children:`(${c(d.members_count)})`})]},`v-${d.id}`))})]})})]})})}var Cl,wl=h(()=>{l();ir();Cl=ng;});function dt(e,t){return e.request(t).then(o=>{let{status:r,data:n}=o;return "error"in n?{ok:false,status:r,error:n.error}:{ok:true,status:r,wrapper:n.wrapper,data:n.data}},o=>{if("isAxiosError"in o){let{status:r,data:n}=o.response||{status:500};return {ok:false,status:r,error:n?.error??o.message}}return {ok:false,status:500,error:o.message}})}function Te(e,t,o){let r=typeof t=="string"?{url:t}:t;return n=>dt(e,{...r,method:"GET",params:o?o(n):n})}function Re(e,t,o){let r=typeof t=="string"?{url:t}:t;return n=>dt(e,{...r,method:"POST",data:n})}function oo(e,t,o){let r=typeof t=="string"?{url:t}:t;return n=>dt(e,{...r,method:"DELETE",params:o?o(n):n})}var lr=h(()=>{l();});function Co(e,t){return o=>dt(e,{method:"POST",url:`images/save/${t}`,params:{prompt:o.prompt,provider:t}})}var Al=h(()=>{l();lr();});function cr(e,t){return o=>dt(e,{method:"GET",url:`images/search/${t}`,params:{prompt:o.prompt,page:o.page,provider:t}})}var Pl=h(()=>{l();lr();});function Il(e,t){return ()=>dt(e,{method:"GET",url:`list/icons/${t}`,params:{provider:t}})}var Ll=h(()=>{l();lr();});function Ol(e,t){return o=>dt(e,{method:"GET",url:`read/icons/${t}/icon.svg`,params:{name:o.name}})}var _l=h(()=>{l();lr();});function Nr(e){let t=On.create({baseURL:e});return {createBulkBlock:Re(t,"create/bulk/block"),createBlock:Re(t,"create/block"),createDimension:Re(t,"create/dimension"),createFormatter:Re(t,"create/formatter"),createReport:Re(t,"create/report"),createSection:Re(t,"create/section"),createVariant:Re(t,"create/variant"),createDatasource:Re(t,"create/datasource"),deleteBlock:oo(t,"delete/block",wo),deleteDimension:oo(t,"delete/dimension",wo),deleteFormatter:oo(t,"delete/formatter",wo),deleteReport:oo(t,"delete/report",wo),deleteSection:oo(t,"delete/section",wo),deleteVariant:oo(t,"delete/variant",wo),deleteDatasource:oo(t,"delete/datasource",wo),readBlock:Te(t,"read/block"),readDimension:Te(t,"read/dimension"),readFormatter:Te(t,"read/formatter"),readReport:Te(t,"read/report"),readSection:Te(t,"read/section"),readVariant:Te(t,"read/variant"),readDatasource:Te(t,"read/datasource"),updateBulkBlock:Re(t,"update/bulk/block"),updateBlock:Re(t,"update/block"),updateDimension:Re(t,"update/dimension"),updateFormatter:Re(t,"update/formatter"),updateReport:Re(t,"update/report"),updateSection:Re(t,"update/section"),updateVariant:Re(t,"update/variant"),updateDatasource:Re(t,"update/datasource"),searchReport:Te(t,"search/reports"),validateVariantSlug:Te(t,"validate/variant"),readMember:Te(t,"read/members",ag),readMemberImage:Te(t,{url:"member/image",responseType:"blob"}),searchMember:Te(t,"search/members"),updateMember:Te(t,"update/members"),imageLocalSearch:cr(t,"local"),imageLocalSave:Co(t,"local"),imageFlickrSearch:cr(t,"flickr"),imageFlickrSave:Co(t,"flickr"),imageUnsplashSearch:cr(t,"unsplash"),imageUnsplashSave:Co(t,"unsplash"),imageUploadSave:Co(t,"upload"),imageAdobeSearch:cr(t,"adobe"),imageAdobeSave:Co(t,"adobe"),imagePixabaySearch:cr(t,"pixabay"),imagePixabaySave:Co(t,"pixabay"),readMetadata:Te(t,"read/metadata"),regenerateSearch:Re(t,"search/regenerate"),urlProxy:Te(t,"url/proxy"),searchRole:Te(t,"auth/search/roles"),searchUser:Te(t,"auth/search/users"),readUser:Te(t,"auth/read/user"),updateUser:Re(t,"auth/update/user"),updateMyData:Re(t,"auth/update/me"),revalidateReport:Te(t,"revalidate/report"),revalidateUrl:Te(t,"revalidate/url"),readPrivateBlocks:Re(t,"read/blocks/private"),readClientSideBlocks:Re(t,"read/section/client"),listTablerIcons:Il(t,"tabler"),readTablerIcon:Ol(t,"tabler"),readEnvSecrets:Te(t,"read/secrets")}}var wo,ag,Bl=h(()=>{l();Al();Pl();lr();Ll();_l();wo=e=>({id:e}),ag=e=>{if(e.mode==="slugs"){let t=e.slugs.map(o=>[o.variantSlug,o.memberSlug].join("/")).join(",");return {...e,slugs:t}}return ["related","whole"].includes(e.mode)?{...e}:{...e,[e.mode]:e[e.mode].join(",")}};});var Ms=h(()=>{l();Bl();});var Ml=h(()=>{l();});var Nl=h(()=>{l();Ml();});var cg,Pe,mt=h(()=>{l();cg=()=>{let e=process.env.NEXT_PUBLIC_REPORTS_LOCALE_DEFAULT||"en",t=process.env.NEXT_PUBLIC_REPORTS_LOCALES?.split(",")||[e];return t.includes(e)||t.push(e),{localeDefault:e,locales:t}},Pe=cg;});function lt(e){return {variables:e.variables||{},query:e.query||{},locale:e.locale||ug}}var ug,ur=h(()=>{l();Nl();mt();({localeDefault:ug}=Pe());});var Ao,Dl,Ie,xn,Fl,Ns,pg,dg,mg,fg,gg,Ds,Fs,S,fe,Se,ft,Vl,vn,de=h(()=>{l();Ao={REPORT:"report",SECTION:"section",BLOCK:"block",INPUT:"block_input",FORMATTER:"formatter",DATASOURCE:"datasource",DIMENSION:"report_dimension",VARIANT:"report_dimension_variant",SEARCH:"search"},[Ao.BLOCK,Ao.SEARCH],{[Ao.SECTION]:"report_id",[Ao.DIMENSION]:"report_id",[Ao.VARIANT]:"dimension_id",[Ao.BLOCK]:"section_id",[Ao.INPUT]:"block_id"},Dl={REPORT:"report",STORY:"story"},Ie={SINGLE:"single",MULTI:"multi"},xn={SEGMENTED_CONTROL:"segmented control",SELECTOR:"selector"},Fl={TITLE:"title",SUBTITLE:"subtitle",LABEL:"label"},{[Dl.REPORT]:Object.values(Fl),[Dl.STORY]:Object.values(Fl)},Ns={ALLOWED:"allowed",ALLOWED_LOGIC:"allowedLogic",IGNORE_CASCADE:"ignoreCascade"},pg={ACCESS:"access",ACCESS_LOGIC:"accessLogic"},dg={DISABLED:"disabled"},mg={FALLBACK:"fallback"},fg={CLIENT_SIDE:"clientSideSection"},{...Ns},{POSITION:"position",ICON:"icon",...Ns},gg={IMAGE:"image",PARAGRAPH:"paragraph",SELECTOR:"selector",STAT:"stat",SUBTITLE:"subtitle",TITLE:"title",NAV:"nav",RESET_BUTTON:"reset_button",COMPARISON_BUTTON:"comparison_button",TABLE:"table",BUTTON:"button",MULTIHIERARCHY_SELECTOR:"multihierarchy_selector",FALLBACK:"fallback",SKELETON:"skeleton"},Ds={GENERATOR:"generator",RELATED:"related",VIZ:"visualization",SECTION_FLAG:"section_flag"},Fs="logic",S={...gg,...Ds},[S.GENERATOR,S.SECTION_FLAG,S.SELECTOR,S.VIZ,S.IMAGE,S.TABLE,S.MULTIHIERARCHY_SELECTOR],fe={ALT:"alt",AUTHOR:"author",DESC:"desc",FOOTNOTE:"footnote",BIO:"bio",IMAGE:"image",LABEL:"label",LOGIC:"logic",MULTIHIERARCHY_SELECTOR:"multihierarchySelector",MULTIHIERARCHY_SELECTOR_ALL_LABEL:"multihierarchySelectorAllLabel",MULTIHIERARCHY_SELECTOR_NAME:"multihierarchySelectorName",MULTIHIERARCHY_SELECTOR_PLACEHOLDER:"multihierarchySelectorPlaceholder",SIMPLE:"simple",SIMPLE_ENABLED:"simpleEnabled",PARAGRAPH:"paragraph",SELECTOR_DEFAULT:"selectorDefault",SELECTOR_DYNAMIC:"selectorDynamic",SELECTOR_NAME:"selectorName",SELECTOR_TYPE:"selectorType",SRC:"src",SLUG:"slug",SUBTITLE:"subtitle",TABLE:"table",TITLE:"title",SHORT_TITLE:"shortTitle",TOOLTIP:"tooltip",TWITTER:"twitter",URL:"url",VALUE:"value"},[fe.LOGIC,fe.SIMPLE,fe.SIMPLE_ENABLED],Se={ENABLE_ALL:{bubbleMenu:true,toolbarOptions:{history:true,alignment:false,format:true}},DISABLE_ALL:{bubbleMenu:false,toolbarOptions:{history:false,alignment:false,format:false}},ENABLE_FORMAT:{bubbleMenu:true,toolbarOptions:{history:true,alignment:false,format:true}}},{[S.IMAGE]:[{field:fe.TITLE,editorConfig:Se.ENABLE_ALL},{field:fe.SRC,editorConfig:Se.DISABLE_ALL},{field:fe.ALT,editorConfig:Se.DISABLE_ALL},{field:fe.DESC,editorConfig:Se.ENABLE_ALL}],[S.PARAGRAPH]:[{field:S.PARAGRAPH,editorConfig:Se.ENABLE_ALL},{field:fe.TOOLTIP,editorConfig:Se.ENABLE_FORMAT}],[S.SELECTOR]:[{field:fe.SELECTOR_DEFAULT},{field:fe.SELECTOR_DYNAMIC},{field:fe.SELECTOR_NAME,editorConfig:Se.ENABLE_FORMAT},{field:fe.SELECTOR_TYPE}],[S.STAT]:[{field:fe.TITLE,editorConfig:Se.ENABLE_FORMAT},{field:fe.SUBTITLE,editorConfig:Se.ENABLE_FORMAT},{field:fe.VALUE,editorConfig:Se.ENABLE_FORMAT},{field:fe.TOOLTIP,editorConfig:Se.ENABLE_FORMAT}],[S.SUBTITLE]:[{field:fe.SUBTITLE,editorConfig:Se.ENABLE_FORMAT},{field:fe.TOOLTIP,editorConfig:Se.ENABLE_FORMAT}],[S.TITLE]:[{field:fe.TITLE,editorConfig:Se.ENABLE_FORMAT},{field:fe.SLUG,editorConfig:Se.DISABLE_ALL},{field:fe.TOOLTIP,editorConfig:Se.ENABLE_FORMAT}],[S.BUTTON]:[{field:fe.LABEL,editorConfig:Se.ENABLE_FORMAT},{field:fe.URL,editorConfig:Se.ENABLE_FORMAT}],[S.GENERATOR]:[],[S.SECTION_FLAG]:[],[S.VIZ]:[],[S.TABLE]:[],[S.MULTIHIERARCHY_SELECTOR]:[{field:fe.MULTIHIERARCHY_SELECTOR_NAME,editorConfig:Se.ENABLE_FORMAT},{field:fe.MULTIHIERARCHY_SELECTOR_PLACEHOLDER,editorConfig:Se.DISABLE_ALL},{field:fe.MULTIHIERARCHY_SELECTOR_ALL_LABEL,editorConfig:Se.DISABLE_ALL}],[S.NAV]:[{field:fe.TITLE,editorConfig:Se.ENABLE_FORMAT},{field:fe.SHORT_TITLE,editorConfig:Se.ENABLE_FORMAT}]},ft={NAME:"name",DESCRIPTION:"description",...Ns,...pg,...mg,...dg,...fg},Vl={FORMATTER:"formatter",FUNCTION:"function"},{[Vl.FORMATTER]:"Formatter",[Vl.FUNCTION]:"Function"},vn={STRING:"string",NUMBER:"number",OBJECT:"object",DATE:"date"},{[vn.STRING]:"String",[vn.NUMBER]:"Number",[vn.OBJECT]:"Object/Array",[vn.DATE]:"Date"};});function Vs(e){let t=1+76.18009173/e-86.50532033/(e+1)+24.01409822/(e+2)-1.231739516/(e+3)+.00120858003/(e+4)-536382e-11/(e+5);return (e-.5)*Math.log(e+4.5)-(e+4.5)+Math.log(t*2.50662827465)}function zl(e,t,o){let r=0,n=1,s=1,a=1,i=0,c=0,u;for(;Math.abs((s-c)/s)>1e-5;)c=s,u=-(t+i)*(t+o+i)*e/(t+2*i)/(t+2*i+1),r=s+u*r,n=a+u*n,i+=1,u=i*(o-i)*e/(t+2*i-1)/(t+2*i),s=r+u*s,a=n+u*a,r/=a,n/=a,s/=a,a=1;return s/t}function bg(e,t,o){let r,n;if(e<0)n=0;else if(e>=t)n=1;else {e=Math.floor(e);let s=o,a=e+1,i=t-e,c=a+i,u=Math.exp(Vs(c)-Vs(i)-Vs(a)+a*Math.log(s)+i*Math.log(1-s));s<(a+1)/(c+2)?r=u*zl(s,a,i):r=1-u*zl(1-s,i,a),n=1-r;}return Math.round(n*1e5)/1e5}function yg(e){return {.99999:15.137,.99:6.635,.95:3.841,.9:2.706}[e]}function Dr(e,t,o,r){let n=t/(1-t),s=0,a=1,i=0,c=0;for(;s<=e;)c+=a,s>=o&s<=r&&(i+=a),c>1e30&&(i/=1e30,c/=1e30,a/=1e30),s+=1,a=a*n*(e+1-s)/s;return i/c}function Sg(e,t,o){let r=e/t,s=(100-o*100)/2,a,i;if(e===0)a=0;else {let c=r/2,u=0,p=r,m=s/100;for(;p-u>1e-5;)Dr(t,c,e,e)*.5+Dr(t,c,e+1,t)>m?(p=c,c=(u+c)/2):(u=c,c=(p+c)/2);a=c;}if(e===t)i=0;else {let c=(1+r)/2,u=r,p=1,m=s/100;for(;p-u>1e-5;)Dr(t,c,e,e)*.5+Dr(t,c,0,e-1)<m?(p=c,c=(u+c)/2):(u=c,c=(p+c)/2);i=c;}return {lci:a,uci:i}}function vg(e,t){let o=e,r=t,n=o,s=r,a=95,i=.5,c=.5,p=(100-a)/2/100,m=n;for(;c>1e-5;)c/=2,Tn((1+m)*i/(1-i),m+1,1e10)+.5*Tn((1+m)*i/(1-i),m,m)>p?i-=c:i+=c;let f=(1+m)*i/(1-i)/s;for(i=.5,c=.5,p=(100-a)/2/100;c>1e-5;)c/=2,Tn((1+m)*i/(1-i),0,m-1)+.5*Tn((1+m)*i/(1-i),m,m)<p?i-=c:i+=c;let d=(1+m)*i/(1-i)/s;return {lci:f,uci:d}}function Tn(e,t,o){let r=1,n=0,s=0,a=0;for(;a<e||r>n*1e-10;)n+=r,a>=t&a<=o&&(s+=r),n>1e30&&(s/=1e30,n/=1e30,r/=1e30),a+=1,r=r*e/a;return s/n}var $l,Ul=h(()=>{l();$l={binomialCdf:bg,binP:Dr,computeMidP:Sg,criticalValue:yg,smr:vg};});function H(e){let t=e.logicFactory(ro);return Og[e.name]={description:e.description,inputType:e.inputType,logic:_g(t),testValue:e.testValue,type:e.type||"formatter"},t}function _g(e){let t=e.toString().trim();if(t.startsWith("function"))return t.replace(/^function(?:\s\w+)?\([^)]\)/,"").trim().replace(/^{([\s\S]+)\}$/,"$1");let o=t.replace(/^.+?=>/,"").trim();return o.startsWith("{")?o.replace(/^{([\s\S]+)\}$/,"$1"):`return ${o}`}var ro,Og,le=h(()=>{l();Ul();ro={d3:{...xg,...Tg,...Rg,...Eg},d3plus:{assign:assign,closest:closest,date:date,formatAbbreviate:formatAbbreviate,merge:merge,strip:strip,titleCase:titleCase},stats:$l},Og={};});function Dg(e,t,o,r,n=void 0,s){let a={},i=[],{locale:c}=lt(s);try{if(t){let u=new Proxy(console,{get(m,f){return Fg(f,"log","debug","info","warn","error")?(...g)=>{i.push(`${f} ${Date.now()} - ${g.map(d=>format(d)).join(" ")}`),Ng&&m[f](...g);}:m[f]}}),p;return n?p=new Function(e,"console","libs","formatters","locale","variables",o)(t,u,ro,r,c,n):p=new Function(e,"console","libs","formatters","locale",o)(t,u,ro,r,c),typeof p=="object"&&Object.keys(p).length>0&&Object.assign(a,p),{vars:a,error:null,log:i,output:p}}return {vars:a,error:"Invalid API Link",log:i}}catch(u){return {vars:a,error:u.message,log:i}}}function Fg(e,...t){return t.includes(e)}var Ng,no,Fr=h(()=>{l();ur();le();Ng=Bg(process.env.REPORTS_LOGGING),no=Dg;});function zs(e){return e.reduce((t,o,r)=>(r?r===e.length-1&&r===1?t+=` and ${o}`:r===e.length-1?t+=`, and ${o}`:t+=`, ${o}`:t+=o,t),"")}var Gl=h(()=>{l();});function Vg(e,t,o,r=false){let{variables:n}=lt(o);if(!e)return e;let s=/([A-z0-9]*)\{\{([^\}]+)\}\}/g;return e.replace(s,(i,c,u)=>{let p=f=>f;if(c){let f=c.replace(/^\w/g,g=>g.toLowerCase());f in t?p=t[f]:p=g=>`${c}${g}`;}let m=Array.isArray(n[u])?zs(n[u]):n[u];if(m===void 0)return r?i:"N/A";try{return p(m,ro,t)}catch(f){return console.error(`Error using formatter ${p.name}
2
+ `,`Error message: ${f.message}`),"N/A"}})}var Et,pr=h(()=>{l();ur();Gl();le();Et=Vg;});var $s,gt,Po=h(()=>{l();pr();$s=(e,t,o)=>{let{variables:r}=o,n=a=>a.allowed==="never"?false:!a.allowed||a.allowed==="always"||r[a.allowed],s={...e};return Object.keys(s).forEach(a=>{typeof s[a]=="string"?s[a]=Et(s[a],t,o):Array.isArray(s[a])?s[a]=s[a].filter(n).map(i=>typeof i=="object"?$s(i,t,o):typeof i=="string"?Et(i,t,o):i):typeof s[a]=="object"&&s[a]!==null&&!(s[a]instanceof Date)&&(s[a]=$s(s[a],t,o));}),s},gt=$s;});var Hl,Wl=h(()=>{l();Hl=e=>Array.isArray(e)?e.map(t=>typeof t=="string"?{allowed:"always",label:t,id:t}:{allowed:"always",label:t.id,...t}):[];});var zg,Io,Rn=h(()=>{l();de();zg=(e,t,o)=>{if(!o)return false;if(e===Ie.SINGLE)return o.find(n=>n.id===t);let r=Array.isArray(t)?t:t.split(",");return Array.isArray(r)&&r.every(n=>o.map(s=>s.id).includes(n))},Io=zg;});function En(e,t,o,r,n=false){let{variables:s}=lt(r),a=gt({logic:t},o,r).logic,i=no("variables",s,a,o,void 0,r),{vars:c,log:u,error:p}=i,m=c.type||Ie.SINGLE,f=c.component||"Selector",g=c.hideLabel||"false",d=c.resetSectionVars||"false",v=c.name||"Unlabeled Selector",x=Hl(c.options||[]),w=U=>m===Ie.MULTI&&!Array.isArray(U)?[U]:U,R=c.defaultValue,k;if(R&&(R=w(R),Io(m,R,x)&&(k=R)),!k){let U=x&&x[0]&&x[0].id||x[0]||"";k=w(U);}if(n&&typeof window<"u"){let U=`selector${e}id`,G=new URLSearchParams(window.location.search),B=Object.fromEntries(G)[U];B&&!Io(m,B,x)&&B!==void 0&&(G.delete(U),window.history.replaceState(null,null,`?${G.toString()}`));}return {config:{name:v,type:m,options:x,defaultValue:k,component:f,hideLabel:g,resetSectionVars:d},log:u,error:p}}var Us=h(()=>{l();ur();de();Fr();Po();Wl();Rn();});function Gs(e,t,o){if(!e)return false;let r=Array.isArray(o)?o:o.split(",");return Array.isArray(r)&&r.every(n=>e.map(s=>`${s[`${t} ID`]}`).includes(n))}var ql=h(()=>{l();});function kn(e,t,o,r,n=false){let{variables:s}=lt(r),a=gt({logic:t},o,r).logic,i=no("variables",s,a,o,void 0,r),{vars:c,log:u,error:p}=i;if(n&&typeof window<"u"){let f=`multihierarchySelector${e}-value`,g=`multihierarchySelector${e}-type`,d=new URLSearchParams(window.location.search),v=Object.fromEntries(d),x=v[f],w=v[g];x&&x!==void 0&&w&&w!==void 0&&!Gs(c.data,w,x)&&(d.delete(f),d.delete(g),window.history.replaceState(null,null,`?${d.toString()}`));}return {config:c,log:u,error:p}}var Hs=h(()=>{l();ql();ur();Fr();Po();});var $g,jl,Kl=h(()=>{l();de();$g=(e,t,o)=>{let r=`selector${e}id`,n=new URLSearchParams(typeof location<"u"&&location?.search?location.search:"").get(r),s=new URLSearchParams(t).get(r),a=n||s;if(o.type===Ie.MULTI){let u=a?a.split(","):o.defaultValue,p=o.options.filter(m=>u.includes(m.id));return {[`selector${e}id`]:u,[`selector${e}label`]:(p||[]).map(m=>m.label)}}let i=a&&o.options.find(u=>u.id===a)?a:o.defaultValue,c=o.options.find(u=>u.id===i);return {[`selector${e}id`]:i,[`selector${e}label`]:c&&c.label||void 0}},jl=$g;});var Ug,Yl,Xl=h(()=>{l();Ug=(e,t,o)=>{let r=`multihierarchySelector${e}-value`,n=`multihierarchySelector${e}-type`,s=new URLSearchParams(typeof location<"u"&&location?.search?location.search:"").get(r),a=new URLSearchParams(typeof location<"u"&&location?.search?location.search:"").get(n),i=new URLSearchParams(t).get(r),c=new URLSearchParams(t).get(n),u=s||i,p=a||c,m=u?u.split(","):o.defaultValue||[],f=p||o.defaultValueType||"",g=o.data?.filter(d=>m.includes(`${d[`${f} ID`]}`))||[];return {[`multihierarchySelector${e}id`]:m,[`multihierarchySelector${e}label`]:[...new Set((g||[]).map(d=>d[f]))],[`multihierarchySelector${e}type`]:f}},Yl=Ug;});var Ql,Gg,Hg,Wg,kt,Lo=h(()=>{l();de();mt();(({localeDefault:Ql,locales:Gg}=Pe())),Hg=Object.values(Ds),Wg=(e,t=Ql)=>e&&Hg.includes(e.type)?{locale:Fs,locales:[Fs]}:{locale:t,locales:Gg},kt=(e,t=Ql)=>{if(!e)return {};let{locale:o}=Wg(e,t);return e.contentByLocale?.[o]?.content};});function qg(e,t){let o=Object.values(t),r=o.filter(n=>n.shared&&n.section_id!==e).map(n=>n.id);return Object.fromEntries(o.filter(n=>n.section_id===e&&(n.inputs.length===0||n.inputs.some(s=>r.includes(s)))).map(n=>[n.id,n]))}var Zl,Jl=h(()=>{l();Zl=qg;});var ec,tc=h(()=>{l();ec=(e,t)=>t&&typeof t=="string"?t.split(".").reduce((o,r)=>o[r],e):e;});var oc,Ws=h(()=>{l();oc="SECTION_ALLOWED";});function qs(e){return e.type===S.SECTION_FLAG&&e.inputs.length===0&&e.consumers.length===0}var rc=h(()=>{l();de();});var nc,sc=h(()=>{l();nc={jwt:jg};});var wn,An,Pn=h(()=>{l();le();sc();wn=(e,t={},o="en",r={},n={})=>{let s={setVariables:r.onSetVariables?r.onSetVariables:c=>c,openModal:r.onOpenModal?r.onOpenModal:c=>c,formatters:t,libs:ro,locale:o,...n};function a(c){return Function("globals",...c.vars,`with (globals) { ${c.logic} }`).bind(s,s)}function i(c){if(c.vars&&c.logic)return a(c);for(let u in c)Array.isArray(c[u])?c[u]=c[u].map(p=>isObject(p)?i(p):p):isObject(c[u])&&(c[u]=i(c[u]));return c}return i(e)},An=(e,t={})=>{let o={libs:nc,...t};function r(s){return Function("globals",...s.vars,`with (globals) { ${s.logic} }`).bind(o,o)}function n(s){if(s.vars&&s.logic)return r(s);for(let a in s)Array.isArray(s[a])?s[a]=s[a].map(i=>isObject(i)?n(i):i):isObject(s[a])&&(s[a]=n(s[a]));return s}return n(e)};});function Yg(){let{publicRuntimeConfig:e}=Kg(),t=e.bespoke_report_env_vars||{};return {...Object.keys(t).reduce((o,r)=>(o[`ENV_${r}`]=t[r]||"N/A",o),{})}}var Gt,dr=h(()=>{l();Gt=Yg;});function Xg(){return typeof process>"u"?{}:Object.entries(process.env).filter(([e])=>e.startsWith("BESPOKE_SECRET_")).reduce((e,[t,o])=>({...e,[t.replace("BESPOKE_SECRET_","ENV_SECRET_")]:o}),{})}var ac,ic=h(()=>{l();ac=Xg;});function Ln(e){return e.ok!==void 0}function In(e){this.message=e,this.name="ApiFetchException";}async function Ks(e,t,o="en",r,n,s){let a=Date.now(),i=e,c,u=Gt(),p=ac(),m={envs:{...u,...p}},f=new URL(e),g=new URLSearchParams(f.searchParams.toString());g.has("bespoke_slugs")&&(f.searchParams.delete("bespoke_slugs"),i=f.toString());let d={datasource:void 0};r.find(k=>{if(!k.content?.pattern)return false;try{let P=new RegExp(k.content.pattern,"gm");return P.test(i)?(d.datasource=k,!0):P.test(i)}catch{return false}});let v=n?n.settings:{},x=!!(v&&v.useProxy&&v.useProxy==="true"),w=d.datasource&&typeof d.datasource.content.useProxy=="boolean"?d.datasource.content.useProxy:false,R=`${process.env.NEXT_PUBLIC_REPORTS_BASE_URL}/api/cms/url/proxy?url=${encodeURIComponent(i)}`;if(typeof window=="object"&&(x||w)){let k=await rh({url:i,timeout:cc});if(k.ok===true)c=k.data;else throw new In(k?.error)}else try{let P={url:i,timeout:cc};if(d.datasource){let G=m;s&&(G={...m,session:s});let B=typeof window>"u"&&d.datasource.content.logic_ssr?d.datasource.content.logic_ssr:d.datasource.content.logic,O=await An({vars:["url","libs","session"],logic:B},G)(i);if(O.axiosConfig)P=O.axiosConfig;else throw new In(`AxiosConfig is missing in Data Source ${d.datasource.name} (ID: ${d.datasource.id}).`)}let U=await On(P);if(U.status===200)U.headers["content-type"]==="text/csv"?c=csvParse(U.data):c=U.data;else throw new In("No response for: "+i)}catch(k){throw new In(k.message)}if(g.has("bespoke_slugs")){let k=g.get("bespoke_slugs");if(k){let P=k.split(",");if(P.length===3){let[U,G,V]=P,B=ec(c,V);if(B&&Array.isArray(B)){let E=Array.from(new Set(B.map(O=>`${O[G]}`).filter(O=>!["","undefined"].includes(O))));if(E.length>0){let O=E.join("").length>2e3,A=await t({mode:O?"whole":"ids",ids:O?void 0:E,all:false,locale:o,variant:[parseInt(U,10)],output:"lite",limit:E.length+1,allowNulls:true}).then(C=>{let N=[];return Ln(C)?C.ok&&(N=C.data.results):N=C.results,N&&Array.isArray(N)?N:[]}).catch(C=>(console.error(`Error hydrating slugs for Variant: ${U}, Key: ${G}, Accessor: ${V}`),console.error(` Url ${e}`),n&&console.error(` From Section ${n.section_id} and Block ${n.id}`),console.error(C),[]));if(A){let C=Object.fromEntries(A.map(N=>[N.id,`/${N.variant_slug}/${N.slug}`]));B.map(N=>(N.bespoke_slug=C[N[G]]?C[N[G]]:null,N));}}}}}}return {data:c,requestDuration:Date.now()-a,finalUrl:w||x?R:i,apiDataSource:d.datasource?d.datasource:false}}function nh(e){this.name="BlockException",this.message=e;}async function uc(e,t,o,r,n,s){let{locale:a,variables:i,query:c}=lt(o),u=sh(e,o,i,t),p=null,m=e.contentByLocale?.logic?.content?.api,f=null,g=null,d=null,v=null,x=null;if(!u)return {outputVariables:{},renderVariables:{},status:{allowed:false,hiddenByCascade:e.id}};if(e.type===S.FALLBACK||e.type===S.SKELETON)return {outputVariables:{},renderVariables:{},status:{allowed:u,hiddenByCascade:e.id}};if(m){if(d=oh(m,t,o),e._clientSideGenerator&&!n.some(C=>{if(!C.content?.pattern)return false;try{return new RegExp(C.content.pattern,"gm").test(d||"")}catch{return false}})&&!e._requiredByConsumers)return {outputVariables:{},renderVariables:{},status:{allowed:u,client:true}};let B=d.split("|||").filter(A=>A!==""),E=[];for(let A=0;A<B.length;A++){let C=B[A];new RegExp("^(?:[a-z+]+:)?//","i").test(d)||(C=`${process.env.NEXT_PUBLIC_REPORTS_BASE_URL}/${C}`.replace(/([^:]\/)\/+/g,"$1")),E.push(Ks(C,r,a,n,e,s).catch(Z=>{throw new nh(` Excecution of ${e.type}-${e.id} in section ${e.section_id} in report ${i.report_name} (${i.report_id}) failed.
3
+ Error fetching ${C}.
4
4
  Message: ${Z.message}.
5
- `)}));}let O=await Promise.all(E).catch(P=>P.message);if(typeof O=="string"&&O)return {outputVariables:{},renderVariables:{},status:{error:O}};p=O.length===1?O[0].data:O.map(P=>P.data),g=O.reduce((P,w)=>P+JSON.stringify(w.data).length/1024,0),f=Math.max(...O.map(P=>P.requestDuration)),v=O.map(P=>P.apiDataSource?`${P.apiDataSource.name} (${P.apiDataSource.id})`:null),x=O.map(P=>P.finalUrl);}if(e.type===S.SELECTOR){let{config:B,log:E,error:O}=En(e.id,e.contentByLocale[a].content.logic,t,o,true);return {outputVariables:jl(e.id,c,B),renderVariables:B,status:{log:E,error:O,allowed:u}}}if(e.type===S.MULTIHIERARCHY_SELECTOR){let{config:B,log:E,error:O}=kn(e.id,e.contentByLocale[a].content.logic,t,o,true);return {outputVariables:Yl(e.id,c,B),renderVariables:B,status:{log:E,error:O,allowed:u}}}if(e.type===S.VIZ)return {outputVariables:{},renderVariables:e.contentByLocale.logic.content,status:{log:[],allowed:u}};if(e.type===S.RELATED){let B=e.contentByLocale?.logic?.content?.simple?.compare||"variant",E=e.contentByLocale?.logic?.content?.simple?.limit||4,O=Object.keys(i).filter(z=>z.startsWith("report_id")).map(z=>i[z]),P=Object.keys(i).filter(z=>z.startsWith("dimension_id")).map(z=>i[z]),w=Object.keys(i).filter(z=>z.startsWith("variant_id")).map(z=>i[z]),N=Object.keys(i).filter(z=>z.startsWith("id")).map(z=>i[z]);if(!N.length)return {outputVariables:{related_reports:[]},renderVariables:{},status:{log:[],allowed:false}};let Z=await Promise.all(N.map((z,V)=>r({mode:"ids",locale:a,ids:[z],output:"lite",variant:[w[V]]}))).then(z=>z.flatMap(V=>{let Y=[];return Ln(V)?V.ok&&(Y=V.data.results):Y=V.results,Y&&Array.isArray(Y)?Y:[]})).catch(z=>(console.error("Error getting related members",z),[]));if(P.length>1){let z=Object.keys(i).filter(_=>_.startsWith("variant_slug")).map(_=>i[_]),V=Z.map((_,T)=>{let L={mode:"related",locale:a,related:E??4,current_ids:[_.content_id],output:"full",variant_ids:[_.variant_id]};return T===0&&(L.include_ids=[_.content_id]),L}),Y=await Promise.all(V.map(_=>r(_))).then(_=>_.flatMap(T=>{let L=[];return Ln(T)?T.ok&&(L=T.data.results):L=T.results,L&&Array.isArray(L)?L:[]})).catch(_=>(console.error("Error getting related members",_),[])),ve=Y.reduce((_,T)=>{let L=T.variant_slug;return _[L]||(_[L]=[]),_[L].push(T),_},{}),j=[],ee=Object.keys(ve),re=[{combination:[],index:0}];for(;re.length>0;){let _=re.pop();if(!_)continue;let{combination:T,index:L}=_;if(L===ee.length){j.push(T);continue}let q=ee[L],Q=ve[q];for(let K of Q)re.push({combination:[...T,K],index:L+1});}return {outputVariables:{related_reports:j.map(_=>{let T=_.sort((L,q)=>z.indexOf(L.variant_slug)-z.indexOf(q.variant_slug));return {entities:T,link:"/"+T.map(L=>`${L.variant_slug}/${L.slug}`).join("/")}})},renderVariables:{},status:{log:[],allowed:Y.length>0}}}let W=Z.map(z=>z.content_id),$={mode:"related",locale:a,related:E??4,current_ids:W,output:"full"};(B==="report"?$.report_ids=O:B==="dimension"?$.dimension_ids=P:$.variant_ids=w);let J=await r($).then(z=>{let V=[];return Ln(z)?z.ok&&(V=z.data.results):V=z.results,V&&Array.isArray(V)?V:[]}).catch(z=>(console.error("Error getting related members",z),[]));return {outputVariables:{related_reports:J.map(z=>({entities:[z],link:`/${z.variant_slug}/${z.slug}`}))},renderVariables:{},status:{log:[],allowed:J.length>0}}}let{logic:C}=kt(e,a),R=Et(C,t,o),k=no("resp",p||{},R,t,i,o),{vars:A,error:U,log:G}=k;if(typeof A!="object")return {outputVariables:{},renderVariables:{},status:{error:"Configuration did not return an object",log:G,duration:f,responseSize:g,resp:p,api:d,allowed:u,apiFinalUrls:x,apiDataSources:v}};let F=Object.keys(A).reduce((B,E)=>({...B,[`${e.type}${e.id}${E}`]:A[E]}),{});return {renderVariables:A,outputVariables:[S.GENERATOR,S.SECTION_FLAG].includes(e.type)?A:F,status:{log:G,error:U,duration:f,responseSize:g,resp:p,api:d,allowed:u,apiFinalUrls:x,apiDataSources:v}}}function dc(e,t,o,r,n,s,a){return e.consumers.forEach(i=>{if(t[i]){let c=`${o}-${i}`;!r.includes(c)&&(t[i].section_id===t[o].section_id||!n)&&r.push(c),e.consumers.filter(u=>t[u]&&t[u].section_id===t[o].section_id||!n).forEach(u=>Ys(u,t,r,false,s,n,a));}})}var Ht,eh,th,pc,oh,rh,cc,Ys,sh,Wt,so=h(()=>{l();Ms();ur();de();Us();Hs();Kl();Xl();Fr();pr();Lo();Jl();tc();Ws();rc();Pn();dr();ic();Ht=Bg(process.env.NEXT_PUBLIC_REPORTS_DEBUG),eh=process.env.REPORTS_ORIGIN||"",th=process.env.NEXT_PUBLIC_REPORTS_AXIOS_RETRIES,pc=5;try{pc=parseInt(`${th||5}`,10);}catch(e){console.error("Error setting axios retries NEXT_PUBLIC_REPORTS_AXIOS_RETRIES defaults to 5",e);}lc(On,{retries:pc,retryDelay:lc.exponentialDelay,onRetry:(e,t,o)=>{console.error("Generator request failed. Retrying... Count: ",e),console.error("URL: ",o.url),console.error(t.message);}});On.interceptors.request.use(e=>({...e,requestStart:Date.now()}));On.interceptors.response.use(e=>({...e,requestDuration:new Date().getTime()-e.config.requestStart}),e=>Promise.reject(e));oh=(e,t,o)=>{let r=Et(e,t,o);return r.startsWith("http")||(r=`${eh}${r.startsWith("/")?"":"/"}${r}`),r},{urlProxy:rh}=Nr("/api/cms");cc=process.env.NEXT_PUBLIC_REPORTS_API_FETCH_TIMEOUT||0;Ys=(e,t,o=[],r=true,n=true,s=true,a=[])=>{if(a.includes(e))return [];a.push(e);let i=t[e];return i&&i.inputs.length&&r&&i.inputs.forEach(c=>{let u=`${c}-${e}`;o.includes(u)||o.push(u),i.inputs.forEach(p=>Ys(p,t,o,r,false,s,a));}),i&&i.consumers.length&&n&&dc(i,t,e,o,s,n,a),o},sh=(e,t,o,r)=>{let n=true;if(e&&"allowed"in e.settings&&e.settings.allowed!=="always")if(e.settings.allowed==="never")n=false;else {let s=lt(t),{error:a,output:i}=no("variables",o,e.settings.allowedLogic||"return false;",r,void 0,s);a||(n=!!i);}return n},Wt=async(e,t,o,r,n,s={},a,i="section",c,u)=>{let p=i==="section",m=lt(n),f=m.variables,g={...s.variables??{}},d={...s.status??{}},v=new Set,x=[],C={};o?C={...C,[o]:e[o]}:t?C=(t??[]).reduce((W,$)=>{let{id:J}=$;if($.settings?.[ft.CLIENT_SIDE]&&i==="section"){let z=Object.values(e).filter(V=>V.section_id===J&&V.type!==S.SECTION_FLAG&&(!V.shared||V.shared&&V.consumers?.length===0));return {...W,...z.reduce((V,Y)=>({...V,[Y.id]:Y}),{})}}return {...W,...Zl(J,e)}},{}):C=Object.values(e).filter(W=>qs(W)).reduce((W,$)=>({...W,[$.id]:$}),{});let R=Object.values(C).filter(W=>qs(W));if(R.length>0){Ht&&console.info("%crunConsumers: calculating section flags","color:purple",R.map(M=>M.id).join(", "));let W=Object.fromEntries(await Promise.all(R.map(async M=>[M.id,await uc(M,r,{...m,variables:f,locale:f.locale},a,c,u).then(z=>{let{outputVariables:V,status:Y}=z;if(Y.error){if(typeof window>"u")throw new Error(`Run consumers (Block: ${M.id}, Section ${M.section_id}) failed with message: ${Y.error}. `);d[M.id]={allowed:false,error:Y.error},g[M.id]={};}return (M.consumers.length>0||[S.GENERATOR,S.SECTION_FLAG,S.RELATED].includes(M.type))&&Y.allowed&&Object.keys(V).length>0?g[M.id]=V:g[M.id]={},i==="report"?(d[M.id]={allowed:Y.allowed},[S.GENERATOR,S.SECTION_FLAG].includes(M.type)&&Y.api&&(d[M.id].api=Y.api)):d[M.id]=Y,z})]))),J=Object.entries(W).filter(([,M])=>!M.outputVariables[oc]).map(([M])=>Number(M));v=new Set(J.map(M=>e[M].section_id)),Object.values(C).filter(M=>v.has(M.section_id)).forEach(M=>{x.push(M.id),delete C[M.id];}),Ht&&console.info("%crunConsumers: removing sections","color:purple",v.keys());}let k=v.size>0?Object.fromEntries(Object.entries(e).filter(([,W])=>v?.has(W.section_id)?(x.includes(W.id)||x.push(W.id),false):true)):e;if(x.length>0&&(k=Object.fromEntries(Object.entries(k).map(([W,$])=>{let J={...$,inputs:$.inputs.filter(M=>!x.includes(M)),consumers:$.consumers.filter(M=>!x.includes(M))};return [W,J]}))),!o&&!t)return {variables:{...s.variables??{},...g},status:{...s.status??{},...d}};i==="report"&&x.length>0&&x.forEach(W=>{delete g[W],delete d[W],delete e[W];}),Ht&&console.info("%crunConsumers: running root blocks","color:purple",Object.keys(C));let A=Object.keys(C).reduce((W,$)=>{let J=new Date,M=Ys(Number($),k,[],!o,true,p).map(Y=>Y.split("-")),V=(new Date().getTime()-J.getTime())/1e3;return Ht&&console.info(`%cResolved dependencies for ${$} (${V.toFixed(2)}s)`,"color:blue"),[...W,...M]},[]),U=new Date,G=Object.keys(C).reduce((W,$)=>W.includes($)?[...W]:[$,...W],Qg(A)),B=(new Date().getTime()-U.getTime())/1e3;Ht&&console.info(`%cResolved DAG (${B.toFixed(2)}s): `,"color:green",G);let E=process.env.NEXT_PUBLIC_REPORTS_MAX_CONCURRENT_QUERIES_PER_REPORT,O=parseInt(`${E||0}`,10);async function P(W,$){let J=new Map,M=[],z=async()=>M.length;for(let V of W){if(O!==0){let ee=await z();for(;ee>=O;)Ht&&console.info("Too many pending promises, waiting...",ee,M),await new Promise(re=>setTimeout(re,500)),ee=await z();}let Y=$[V],j=Promise.all(Y.inputs.filter(ee=>W.includes(String(ee))).map(ee=>J.get(Number(ee)))).then(async()=>{let ee=Y.inputs.reduce((K,ie)=>({...K,...g[ie]}),f),re=Y.inputs.find(K=>(Y.settings?.ignoreCascade?Y.settings?.ignoreCascade:[]).includes(K)||!d[K]?false:!d[K].allowed||d[K].hiddenByCascade);if(re){d[V]={allowed:false,hiddenByCascade:d[re].hiddenByCascade||re},g[V]={},M.splice(M.indexOf(Number(V)),1);return}let oe=new Date,_,T=t&&t.find(K=>K.id===Y.section_id)?.settings?.[ft.CLIENT_SIDE];typeof window<"u"&&[S.SELECTOR,S.MULTIHIERARCHY_SELECTOR].includes(Y.type)&&Y.settings[ft.DISABLED]&&!T?_=new Promise(K=>{K({outputVariables:g[V],status:d[V]});}):_=uc(Y,r,{...m,variables:ee,locale:ee.locale},a,c,u);let L=await _.then(({outputVariables:K,status:ie})=>{if(ie.error){if(typeof window>"u")throw new Error(`Run consumers (Block: ${V}, Section ${Y.section_id}) failed with message: ${ie.error}.`);d[V]={allowed:false,error:ie.error},g[V]={};}(Y.consumers.length>0||[S.GENERATOR,S.SECTION_FLAG,S.RELATED].includes(Y.type))&&ie.allowed&&Object.keys(K).length>0?g[V]=K:g[V]={},i==="report"?(d[V]={allowed:ie.allowed},[S.GENERATOR,S.SECTION_FLAG].includes(Y.type)&&ie.api&&(d[V].api=ie.api)):d[V]=ie;}),Q=(new Date().getTime()-oe.getTime())/1e3;return Ht&&console.info(`%cBlock ${Y.id} resolved in ${Q.toFixed(3)}s`,Q>500?"color:red":"color:green"),d[V].duration=d[V].duration?d[V].duration:Q,M.splice(M.indexOf(Number(V)),1),L}).catch(ee=>{throw M.splice(M.indexOf(Number(V)),1),ee});M.push(Number(V)),J.set(Number(V),j);}await Promise.all(Array.from(J.values()));}let w=new Date;i==="section"&&t&&(G=G.filter(W=>!d[W]),Ht&&console.info("%cFiltering DAG to exclude blocks already solved by SSR. Remaining blocks: ","color:yellow",G)),await P(G,k);let Z=(new Date().getTime()-w.getTime())/1e3;return Ht&&console.info(`%cResolved Variables (${Z.toFixed(2)}s), ${G.length} blocks`,"color:green"),{variables:{...s.variables??{},...g},status:{...s.status??{},...d}}};});function ah(e=[]){return e.reduce((t,o,r)=>{if(o){let n=r+1;t[`id${n}`]=o.id,t[`name${n}`]=o.name,t[`slug${n}`]=o.slug,"attributes"in o&&Object.keys(o.attributes).forEach(s=>{t[`attr_${s}${n}`]=o.attributes[s];}),t[`variant_id${n}`]=o.variant_id,t[`variant_name${n}`]=o.variant_name,t[`variant_slug${n}`]=o.variant_slug,t[`dimension_id${n}`]=o.dimension_id,t[`dimension_name${n}`]=o.dimension_name,t.report_id=o.report_id,t.report_name=o.report_name;}return t},{})}var mc,fc=h(()=>{l();mc=ah;});function gc(e,t){return +(e<t)-+(e>t)}function Ct(e,t,o="ordering"){return gc(t[o],e[o])}var Oo=h(()=>{l();});function _n(e,t){let o=dh[e];if(!o)throw new Error(`Invalid entity type: ${e}`);let{entities:r}=normalize(t,[o]);return {report:_o(r,"report"),dimension:_o(r,"dimension"),section:_o(r,"section"),block:_o(r,"block"),variant:_o(r,"variant"),formatter:_o(r,"formatter"),datasource:_o(r,"datasource")}}function _o(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:{}}var lh,Vr,hc,bc,yc,ch,uh,ph,dh,Sc,ao,qt=h(()=>{l();Oo();Pn();mt();(({localeDefault:lh}=Pe())),Vr=new schema.Entity("block",{},{mergeStrategy(e,t){return t.block_input?e||{}:{...e,...t}}});Vr.define({consumers:[Vr],inputs:[Vr]});hc=new schema.Entity("variant"),bc=new schema.Entity("dimension",{variants:[hc]},{processStrategy(e){return {...e,variants:"variants"in e?e.variants:[]}}}),yc=new schema.Entity("section",{blocks:[Vr]}),ch=new schema.Entity("report",{dimensions:[bc],sections:[yc]},{processStrategy(e){return {...e,sections:"sections"in e?e.sections.sort(Ct):[]}}}),uh=new schema.Entity("formatter"),ph=new schema.Entity("datasource"),dh={report:ch,section:yc,block:Vr,dimension:bc,variant:hc,formatter:uh,datasource:ph};Sc=(e,t=void 0)=>{let{sid:o,bid:r,previews:n=[],query:s={}}=t||{},a,i,c={};return o?(a=o,c.activeSection=a):a=e.activeSection,n.length>0?(i=n,c.previews=i.filter(Boolean)):i=e.previews,{parsedParams:{sid:a,bid:r,previews:i,query:s},statusPayload:c}},ao=(e=[],t=lh)=>e.reduce((o,r)=>{let n=wn({vars:["n"],logic:r.content.logic},{},t,{});return o[r.name]=n,o},{});});var wt,Bn,zr=h(()=>{l();wt=process.env.NEXT_PUBLIC_REPORTS_LOCALE_DEFAULT||"en",Bn=process.env.NEXT_PUBLIC_REPORTS_LOCALES?.split(",")||[wt];Bn.includes(wt)||Bn.push(wt);});var gh,Mn,Mo,$r=h(()=>{l();zr();gh={localeDefault:wt,locales:Bn,currentLocale:wt,preferredLocale:wt,showToolbar:false,activeSection:null,previews:[],query:{},sectionState:{},activeEntity:{type:null,id:null},sidebarStatus:{tools:true,settings:false,reportEditor:false},isCMS:false,isRunConsumersRunning:[]},Mn=createSlice({name:"status",initialState:gh,reducers:{setStatus:(e,t)=>{Object.assign(e,t.payload);},setPreviews(e,t){e.previews=t.payload;},setCurrentLocale(e,t){e.currentLocale=t.payload;},setPreferredLocale(e,t){e.preferredLocale=t.payload;},setSectionState(e,t){e.sectionState={...e.sectionState,...t.payload};},resetSectionState(e,t){e.sectionState={...e.sectionState,[t.payload]:{}};},setActiveEntity(e,t){e.activeEntity=t.payload;},openSidebar(e,t){e.sidebarStatus={...e.sidebarStatus,[t.payload]:true};},closeSidebar(e,t){e.sidebarStatus={...e.sidebarStatus,[t.payload]:false};},toggleSidebar(e,t){e.sidebarStatus={...e.sidebarStatus,[t.payload]:!e.sidebarStatus[t.payload]};},addRunConsumersRunning(e,t){e.isRunConsumersRunning=e.isRunConsumersRunning.concat(t.payload);},removeRunConsumersRunning(e,t){e.isRunConsumersRunning=e.isRunConsumersRunning.filter(o=>!t.payload.includes(o));}},extraReducers:{[HYDRATE]:(e,t)=>({...e,previews:t.payload.status.previews})}}),Mo=Mn.actions;});var yh,Nn,io,No=h(()=>{l();yh={attributes:{},variables:{},status:{}},Nn=createSlice({name:"variables",initialState:yh,reducers:{setVariableChange:(e,t)=>{e.attributes={...e.attributes,...t.payload.attributes},e.variables={...e.variables,...t.payload.variables},e.status={...e.status,...t.payload.status};}},extraReducers:{[HYDRATE]:(e,t)=>({attributes:{...e.attributes,...t.payload.variables.attributes},status:{...e.status,...t.payload.variables.status},variables:{...e.variables,...t.payload.variables.variables}})}}),io=Nn.actions;});function Ur(e,t){return Object.fromEntries(Object.keys(e).map(o=>[o,{...e[o],...t[o]}]))}function Dn(e,t){return e.map(n=>t[n]).sort((n,s)=>typeof n.ordering=="string"&&typeof s.ordering=="string"?Ct(n,s):typeof n.ordering=="number"&&typeof s.ordering=="number"?n.ordering-s.ordering:String(n.ordering).localeCompare(String(s.ordering))).map(n=>n.id)}function Th(e,t){let o=e.indexOf(t);o>-1&&e.splice(o,1);}var xh,jt,Gr=h(()=>{l();Oo();qt();xh={tree:[],reports:null,entities:{block:{},dimension:{},report:{},section:{},variant:{},formatter:{},datasource:{}},requests:{block:{},dimension:{},report:{},section:{},variant:{},formatter:{},datasource:{}}},jt=createSlice({name:"records",initialState:xh,reducers:{set:(e,t)=>{let o=t.payload;return {entities:Ur(e.entities,o.entities||{}),requests:Ur(e.requests,o.requests||{}),reports:o.reports||e.reports,tree:o.tree||e.tree}},setRequest:(e,t)=>{let o=t.payload;e.requests[o.type][o.key]=o;},setCreateRequest(e,t){let o=t.payload;if(e.requests[o.type][o.key]=o,o.status==="SUCCESS"){let r=Array.isArray(o.data)?o.data:[o.data],n=_n(o.type,r),s=Ur(e.entities,n);if(e.entities=s,o.type==="report"){let a=o.data;e.reports?e.reports.indexOf(a.id)===-1&&(e.reports=[...e.reports,a.id]):e.reports=[a.id];}else if(o.type==="dimension"){let a=o.data;e.entities.report[a.report_id].dimensions.push(a.id),e.entities.report[a.report_id].dimensions=Dn(s.report[a.report_id].dimensions,s.dimension);}else if(o.type==="variant"){let a=o.data;e.entities.dimension[a.dimension_id].variants.push(a.id);}else if(o.type==="section"&&!Array.isArray(o.data)){let a=o.data;e.entities.report[a.report_id].sections.push(a.id),e.entities.report[a.report_id].sections=Dn(s.report[a.report_id].sections,s.section);}else if(o.type==="block")if(Array.isArray(o.data)){let a=o.data,i=a[0],c=a.map(u=>u.id);e.entities.section[i.section_id].blocks.concat(c);}else {let a=o.data;e.entities.section[a.section_id].blocks.push(a.id);}}},setReadRequest(e,t){let o=t.payload;if(o.type!=="report"&&(e.requests[o.type][o.key]=o),o.status==="SUCCESS"){let r=_n(o.type,o.data),n=Ur(e.entities,r);e.entities=n;}},setUpdateRequest(e,t){let o=t.payload;if(e.requests[o.type][o.key]=o,o.status==="SUCCESS"){let r=Array.isArray(o.data)?o.data:[o.data],n=_n(o.type,r),s,a,i;if(o.type==="block"&&!Array.isArray(o.data)){let u=e.entities.block[o.data.id].inputs,p=n.block[o.data.id].inputs;s=u.length!==p.length,s&&(i=u.length>p.length,a=i?u.filter(m=>!p.includes(m))[0]:p.filter(m=>!u.includes(m))[0]),Object.values(n.block).forEach(m=>{m.block_input&&delete n.block[m.id];});}let c=Ur(e.entities,n);if(e.entities=c,o.type==="dimension"){let u=o.data;e.entities.report[u.report_id].dimensions=Dn(c.report[u.report_id].dimensions,c.dimension);}else if(o.type==="section"&&!Array.isArray(o.data)){let u=o.data;e.entities.report[u.report_id].sections=Dn(c.report[u.report_id].sections,c.section);}else if(o.type==="block"&&!Array.isArray(o.data)){let u=o.data;s&&(i?e.entities.block[a].consumers=e.entities.block[a].consumers.filter(p=>p!==u.id):e.entities.block[a].consumers.push(u.id));}}},setDeleteRequest(e,t){let o=t.payload;if(e.requests[o.type][o.key]=o,o.status==="SUCCESS"){let{id:r,parentId:n,parentType:s}=o.data;if(delete e.entities[o.type][r],s&&n!=null){let a=`${o.type}s`;Th(e.entities[s][n][a],r);}}},removeBlocks:(e,t)=>{let o=t.payload,r={...e.entities.block};return o.forEach(n=>{delete r[n];}),{...e,entities:{...e.entities,block:r}}},addBlocks:(e,t)=>{let o=t.payload;return {...e,entities:{...e.entities,block:{...e.entities.block,...o}}}},removeDataSourceLogic:e=>{let t={...e.entities.datasource};Object.keys(t).forEach(o=>{e.entities.datasource[o].content.useProxy&&(delete e.entities.datasource[o].content.logic,delete e.entities.datasource[o].content.logic_ssr,delete e.entities.datasource[o].content.testUrl,delete e.entities.datasource[o].content.access);});}},extraReducers:{[HYDRATE]:(e,t)=>{let o=t.payload.records,r=o.entities;return {entities:r,reports:Object.values(r.report).map(n=>n.id),requests:{block:{},dimension:{},report:{},section:{},variant:{},formatter:{},datasource:{}},tree:o.tree}}}});});function Do(e,t,o){if(t==="createBulk"||t==="updateBulk"){let n=`${t}${vc(o)}`;return e[n]}let r=`${t}${vc(o)}`;return e[r]}function vc(e){return e[0].toUpperCase()+e.slice(1)}var xc=h(()=>{l();});function Me(e){for(var t=arguments.length,o=Array(t>1?t-1:0),r=1;r<t;r++)o[r-1]=arguments[r];if(process.env.NODE_ENV!=="production"){var n=Ih[e],s=n?typeof n=="function"?n.apply(null,o):n:"unknown error nr: "+e;throw Error("[Immer] "+s)}throw Error("[Immer] minified error nr: "+e+(o.length?" "+o.map((function(a){return "'"+a+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function mr(e){return !!e&&!!e[ot]}function Vo(e){var t;return !!e&&((function(o){if(!o||typeof o!="object")return false;var r=Object.getPrototypeOf(o);if(r===null)return true;var n=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return n===Object||typeof n=="function"&&Function.toString.call(n)===Lh})(e)||Array.isArray(e)||!!e[Pc]||!!(!((t=e.constructor)===null||t===void 0)&&t[Pc])||sa(e)||aa(e))}function Wr(e,t,o){o===void 0&&(o=false),gr(e)===0?(o?Object.keys:pa)(e).forEach((function(r){o&&typeof r=="symbol"||t(r,e[r],e);})):e.forEach((function(r,n){return t(n,r,e)}));}function gr(e){var t=e[ot];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:sa(e)?2:aa(e)?3:0}function ea(e,t){return gr(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Rh(e,t){return gr(e)===2?e.get(t):e[t]}function Ic(e,t,o){var r=gr(e);r===2?e.set(t,o):r===3?e.add(o):e[t]=o;}function Eh(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function sa(e){return Ah&&e instanceof Map}function aa(e){return Ph&&e instanceof Set}function Fo(e){return e.o||e.t}function ia(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Oh(e);delete t[ot];for(var o=pa(t),r=0;r<o.length;r++){var n=o[r],s=t[n];s.writable===false&&(s.writable=true,s.configurable=true),(s.get||s.set)&&(t[n]={configurable:true,writable:true,enumerable:s.enumerable,value:e[n]});}return Object.create(Object.getPrototypeOf(e),t)}function la(e,t){return t===void 0&&(t=false),ca(e)||mr(e)||!Vo(e)||(gr(e)>1&&(e.set=e.add=e.clear=e.delete=kh),Object.freeze(e),t&&Wr(e,(function(o,r){return la(r,true)}),true)),e}function kh(){Me(2);}function ca(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function At(e){var t=_h[e];return t||Me(18,e),t}function Tc(){return process.env.NODE_ENV==="production"||fr||Me(0),fr}function Xs(e,t){t&&(At("Patches"),e.u=[],e.s=[],e.v=t);}function Fn(e){ta(e),e.p.forEach(Ch),e.p=null;}function ta(e){e===fr&&(fr=e.l);}function Rc(e){return fr={p:[],l:fr,h:e,m:true,_:0}}function Ch(e){var t=e[ot];t.i===0||t.i===1?t.j():t.g=true;}function Qs(e,t){t._=t.p.length;var o=t.p[0],r=e!==void 0&&e!==o;return t.h.O||At("ES5").S(t,e,r),r?(o[ot].P&&(Fn(t),Me(4)),Vo(e)&&(e=Vn(t,e),t.l||zn(t,e)),t.u&&At("Patches").M(o[ot].t,e,t.u,t.s)):e=Vn(t,o,[]),Fn(t),t.u&&t.v(t.u,t.s),e!==Lc?e:void 0}function Vn(e,t,o){if(ca(t))return t;var r=t[ot];if(!r)return Wr(t,(function(i,c){return Ec(e,r,t,i,c,o)}),true),t;if(r.A!==e)return t;if(!r.P)return zn(e,r.t,true),r.t;if(!r.I){r.I=true,r.A._--;var n=r.i===4||r.i===5?r.o=ia(r.k):r.o,s=n,a=false;r.i===3&&(s=new Set(n),n.clear(),a=true),Wr(s,(function(i,c){return Ec(e,r,n,i,c,o,a)})),zn(e,n,false),o&&e.u&&At("Patches").N(r,o,e.u,e.s);}return r.o}function Ec(e,t,o,r,n,s,a){if(process.env.NODE_ENV!=="production"&&n===o&&Me(5),mr(n)){var i=Vn(e,n,s&&t&&t.i!==3&&!ea(t.R,r)?s.concat(r):void 0);if(Ic(o,r,i),!mr(i))return;e.m=false;}else a&&o.add(n);if(Vo(n)&&!ca(n)){if(!e.h.D&&e._<1)return;Vn(e,n),t&&t.A.l||zn(e,n);}}function zn(e,t,o){o===void 0&&(o=false),!e.l&&e.h.D&&e.m&&la(t,o);}function Zs(e,t){var o=e[ot];return (o?Fo(o):e)[t]}function kc(e,t){if(t in e)for(var o=Object.getPrototypeOf(e);o;){var r=Object.getOwnPropertyDescriptor(o,t);if(r)return r;o=Object.getPrototypeOf(o);}}function oa(e){e.P||(e.P=true,e.l&&oa(e.l));}function Js(e){e.o||(e.o=ia(e.t));}function ra(e,t,o){var r=sa(t)?At("MapSet").F(t,o):aa(t)?At("MapSet").T(t,o):e.O?(function(n,s){var a=Array.isArray(n),i={i:a?1:0,A:s?s.A:Tc(),P:false,I:false,R:{},l:s,t:n,k:null,o:null,j:null,C:false},c=i,u=na;a&&(c=[i],u=Hr);var p=Proxy.revocable(c,u),m=p.revoke,f=p.proxy;return i.k=f,i.j=m,f})(t,o):At("ES5").J(t,o);return (o?o.A:Tc()).p.push(r),r}function wh(e){return mr(e)||Me(22,e),(function t(o){if(!Vo(o))return o;var r,n=o[ot],s=gr(o);if(n){if(!n.P&&(n.i<4||!At("ES5").K(n)))return n.t;n.I=true,r=Cc(o,s),n.I=false;}else r=Cc(o,s);return Wr(r,(function(a,i){n&&Rh(n.t,a)===i||Ic(r,a,t(i));})),s===3?new Set(r):r})(e)}function Cc(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return ia(e)}var wc,fr,ua,Ah,Ph,Ac,Lc,Pc,ot,Ih,Lh,pa,Oh,_h,na,Hr,Bh,rt,Mh,$n,Oc=h(()=>{l();ua=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",Ah=typeof Map<"u",Ph=typeof Set<"u",Ac=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",Lc=ua?Symbol.for("immer-nothing"):((wc={})["immer-nothing"]=true,wc),Pc=ua?Symbol.for("immer-draftable"):"__$immer_draftable",ot=ua?Symbol.for("immer-state"):"__$immer_state",Ih={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3:function(e){return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(e){return "Cannot apply patch, path doesn't resolve: "+e},16:'Sets cannot have "replace" patches.',17:function(e){return "Unsupported patch operation: "+e},18:function(e){return "The plugin for '"+e+"' has not been loaded into Immer. To enable the plugin, import and call `enable"+e+"()` when initializing your application."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21:function(e){return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '"+e+"'"},22:function(e){return "'current' expects a draft, got: "+e},23:function(e){return "'original' expects a draft, got: "+e},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},Lh=""+Object.prototype.constructor,pa=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Oh=Object.getOwnPropertyDescriptors||function(e){var t={};return pa(e).forEach((function(o){t[o]=Object.getOwnPropertyDescriptor(e,o);})),t},_h={},na={get:function(e,t){if(t===ot)return e;var o=Fo(e);if(!ea(o,t))return (function(n,s,a){var i,c=kc(s,a);return c?"value"in c?c.value:(i=c.get)===null||i===void 0?void 0:i.call(n.k):void 0})(e,o,t);var r=o[t];return e.I||!Vo(r)?r:r===Zs(e.t,t)?(Js(e),e.o[t]=ra(e.A.h,r,e)):r},has:function(e,t){return t in Fo(e)},ownKeys:function(e){return Reflect.ownKeys(Fo(e))},set:function(e,t,o){var r=kc(Fo(e),t);if(r?.set)return r.set.call(e.k,o),true;if(!e.P){var n=Zs(Fo(e),t),s=n?.[ot];if(s&&s.t===o)return e.o[t]=o,e.R[t]=false,true;if(Eh(o,n)&&(o!==void 0||ea(e.t,t)))return true;Js(e),oa(e);}return e.o[t]===o&&(o!==void 0||t in e.o)||Number.isNaN(o)&&Number.isNaN(e.o[t])||(e.o[t]=o,e.R[t]=true),true},deleteProperty:function(e,t){return Zs(e.t,t)!==void 0||t in e.t?(e.R[t]=false,Js(e),oa(e)):delete e.R[t],e.o&&delete e.o[t],true},getOwnPropertyDescriptor:function(e,t){var o=Fo(e),r=Reflect.getOwnPropertyDescriptor(o,t);return r&&{writable:true,configurable:e.i!==1||t!=="length",enumerable:r.enumerable,value:o[t]}},defineProperty:function(){Me(11);},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){Me(12);}},Hr={};Wr(na,(function(e,t){Hr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)};})),Hr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Me(13),Hr.set.call(this,e,t,void 0)},Hr.set=function(e,t,o){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Me(14),na.set.call(this,e[0],t,o,e[0])};Bh=(function(){function e(o){var r=this;this.O=Ac,this.D=true,this.produce=function(n,s,a){if(typeof n=="function"&&typeof s!="function"){var i=s;s=n;var c=r;return function(v){var x=this;v===void 0&&(v=i);for(var C=arguments.length,R=Array(C>1?C-1:0),k=1;k<C;k++)R[k-1]=arguments[k];return c.produce(v,(function(A){var U;return (U=s).call.apply(U,[x,A].concat(R))}))}}var u;if(typeof s!="function"&&Me(6),a!==void 0&&typeof a!="function"&&Me(7),Vo(n)){var p=Rc(r),m=ra(r,n,void 0),f=true;try{u=s(m),f=!1;}finally{f?Fn(p):ta(p);}return typeof Promise<"u"&&u instanceof Promise?u.then((function(v){return Xs(p,a),Qs(v,p)}),(function(v){throw Fn(p),v})):(Xs(p,a),Qs(u,p))}if(!n||typeof n!="object"){if((u=s(n))===void 0&&(u=n),u===Lc&&(u=void 0),r.D&&la(u,true),a){var g=[],d=[];At("Patches").M(n,u,g,d),a(g,d);}return u}Me(21,n);},this.produceWithPatches=function(n,s){if(typeof n=="function")return function(u){for(var p=arguments.length,m=Array(p>1?p-1:0),f=1;f<p;f++)m[f-1]=arguments[f];return r.produceWithPatches(u,(function(g){return n.apply(void 0,[g].concat(m))}))};var a,i,c=r.produce(n,s,(function(u,p){a=u,i=p;}));return typeof Promise<"u"&&c instanceof Promise?c.then((function(u){return [u,a,i]})):[c,a,i]},typeof o?.useProxies=="boolean"&&this.setUseProxies(o.useProxies),typeof o?.autoFreeze=="boolean"&&this.setAutoFreeze(o.autoFreeze);}var t=e.prototype;return t.createDraft=function(o){Vo(o)||Me(8),mr(o)&&(o=wh(o));var r=Rc(this),n=ra(this,o,void 0);return n[ot].C=true,ta(r),n},t.finishDraft=function(o,r){var n=o&&o[ot];process.env.NODE_ENV!=="production"&&(n&&n.C||Me(9),n.I&&Me(10));var s=n.A;return Xs(s,r),Qs(void 0,s)},t.setAutoFreeze=function(o){this.D=o;},t.setUseProxies=function(o){o&&!Ac&&Me(20),this.O=o;},t.applyPatches=function(o,r){var n;for(n=r.length-1;n>=0;n--){var s=r[n];if(s.path.length===0&&s.op==="replace"){o=s.value;break}}n>-1&&(r=r.slice(n+1));var a=At("Patches").$;return mr(o)?a(o,r):this.produce(o,(function(i){return a(i,r)}))},e})(),rt=new Bh,Mh=rt.produce,rt.produceWithPatches.bind(rt),rt.setAutoFreeze.bind(rt),rt.setUseProxies.bind(rt),rt.applyPatches.bind(rt),rt.createDraft.bind(rt),rt.finishDraft.bind(rt),$n=Mh;});function jr(e){return (t,o)=>{let r=e[t];if(!r)throw new Error(`Attempting to dispatch action for invalid entity type '${t}'`);return r(o)}}function Uo(e,t){return (o,r)=>{let s=r().records.requests[e][t],a=!s||s.status==="UNINITIALIZED"?"LOADING":"FETCHING";o(ht.setRequest({key:t,type:e,status:a}));}}function $o(e,t,o,r){return n=>{typeof window=="object"&&notifications.show({autoClose:3e3,color:"red",id:t,message:r,title:"Error"}),n(ht.setRequest({key:t,type:e,status:"FAILURE",error:{code:o,message:r}}));}}function lo(e){return t=>{let o=ma(e,t);return (r,n,s)=>(r(Uo(e,o)),Do(s,"create",e)(t).then(i=>(i.ok===true?r(ht.setCreateRequest({key:o,operation:"create",status:"SUCCESS",type:e,data:i.data})):r($o(e,o,i.status,i.error)),i)))}}function Fh(e){return t=>{let o=ma(e,t[0]);return (r,n,s)=>(r(Uo(e,o)),Do(s,"createBulk",e)(t).then(i=>(i.ok===true?r(ht.setCreateRequest({key:o,operation:"createBulk",status:"SUCCESS",type:e,data:i.data})):r($o(e,o,i.status,i.error)),i)))}}function _c(e,t,o){return o.replace(new RegExp(e,"g"),t)}function Vh(e){return e.section_id!==void 0}function zh(e){return e.report_id!==void 0}function Bc(e){return t=>{let{create:o}=t;return (r,n,s)=>lo(e)(o)(r,n,s).then(async i=>{if(i.ok){let{data:c}=i,{id:u}=c,{update:p}=t,m=Uc(e,{id:u});if(r(Uo(e,`${m}`)),e==="block"&&Vh(o)){let f=$n(p,x=>{x.id=u;}),{contentByLocale:g}=f;g&&(f=$n(f,x=>{x.id=u,x.contentByLocale=Object.keys(g).reduce((C,R)=>{let k=g?g[R]:{};return C[R]={...k,id:u},C},{});}));let v=f.inputs?.map(x=>({type:x.type,id:x.id,inputAction:{operation:"create",input:{input_id:x.id,block_id:f.id}}}));return v&&v.length>0&&Mc(e)([f,...v])(r,n,s).then(()=>co("section")({id:f.section_id,include:true})(r,n,s).then(x=>(x.ok&&r(ht.setRequest({key:m,type:e,status:"SUCCESS",data:x.data})),x))),Pt(e)(f)(r,n,s).then(x=>(x.ok&&r(ht.setRequest({key:m,type:e,status:"SUCCESS",data:x.data})),x))}if(e==="section"&&zh(o)){let{id:f}=c,g=$n(p,x=>{x.id=f;}),{blocks:d}=g,v=d?.map(x=>({type:x.type,blockcol:x.blockcol,blockrow:x.blockrow,section_id:f,locales:Object.keys(x.contentByLocale).map(C=>C)}));return v&&d&&await Fh("block")(v)(r,n,s).then(x=>{if(x.ok){let C=x.data,R=[],k=C.map((A,U)=>{let F={...A},B=F.id,E=d[U];E.contentByLocale&&(F.contentByLocale=Object.keys(E.contentByLocale).reduce((J,M)=>{let z=E.contentByLocale[M];return J[M]={...z,content:{...z.content},id:F.id},J},{}));let{settings:O}=E,{contentByLocale:P,id:w}=F;F.settings=O;let N={id:w,contentByLocale:P,settings:O};return E.inputs.map(J=>J.id).reduce((J,M)=>{let z=d.findIndex(V=>V.id===M);return [...J,z]},[]).map(J=>({...C[J],originalBlock:d[J]})).forEach(J=>{let{id:M,type:z,originalBlock:V}=J;if([S.SELECTOR,S.VIZ].includes(z)){if(N.contentByLocale?.logic?.content?.api){let Y=N.contentByLocale?.logic.content.api;N.contentByLocale.logic.content.api=_c(`(selector${V.id}id)`,`selector${M}id`,Y);}if(N.contentByLocale?.logic?.content?.logic){let Y=N.contentByLocale.logic.content.logic;N.contentByLocale.logic.content.logic=_c(`(selector${V.id}id)`,`selector${M}id`,Y);}}R.push({id:M,inputAction:{operation:"create",input:{input_id:M,block_id:B}}});}),N});return Mc("block")([...k,...R])(r,n,s)}}),Pt(e)(g)(r,n,s).then(x=>(x.ok&&r(ht.setRequest({key:m,type:e,status:"SUCCESS",data:x.data})),x))}return Pt(e)({...p,id:c.id})(r,n,s)}})}}function co(e){return t=>{let o=zc(e,t);return (r,n,s)=>{r(Uo(e,o));let a=Do(s,"read",e);if(typeof a!="function"){let i=`Failed to get valid RPC method for entity "${e}"`;return r($o(e,o,500,i)),Promise.reject(new Error(i))}return a(t).then(i=>(i.ok===true?r(ht.setReadRequest({key:o,operation:"read",status:"SUCCESS",type:e,data:i.data})):r($o(e,o,i.status,i.error)),i))}}}function Pt(e){return t=>{let o=fa(e,t);return (r,n,s)=>(r(Uo(e,o)),Do(s,"update",e)(t).then(i=>(i.ok===true?r(ht.setUpdateRequest({key:o,operation:"update",status:"SUCCESS",type:e,data:i.data})):r($o(e,o,i.status,i.error)),i)))}}function Mc(e){return t=>{let o=fa(e,t[0]);return (r,n,s)=>(r(Uo(e,o)),Do(s,"updateBulk",e)(t).then(i=>(i.ok===true?r(ht.setUpdateRequest({key:o,operation:"updateBulk",status:"SUCCESS",type:e,data:i.data})):r($o(e,o,i.status,i.error)),i)))}}function zo(e){return t=>{let o=$c(e,t);return (r,n,s)=>(r(Uo(e,o)),Do(s,"delete",e)(t).then(i=>{i.ok===true?r(ht.setDeleteRequest({key:o,operation:"delete",status:"SUCCESS",type:e,data:i.data})):r($o(e,o,i.status,i.error));}))}}function ma(e,t){if(e==="variant"){let o=t;return `create(variant, [${o.dimension_id}, ${o.name}])`}return `create(${e}, [${Object.keys(t)}])`}function zc(e,t={}){let o=t.id==null?null:`'${t.id}'`;return `read(${e}, ${o}, ${!!t.include})`}function fa(e,t){let{id:o,...r}=t;return `update(${e}, ${o}, [${Object.keys(r)}])`}function $c(e,t){return `delete(${e}, ${t})`}function Uc(e,t){let o=t.id==null?null:`'${t.id}'`;return `clone(${e}, ${o})`}var ht,da,Nc,qr,Dc,Fc,Vc,ga=h(()=>{l();xc();Gr();Oc();de();ht=jt.actions,da={create:ma,read:zc,update:fa,delete:$c,clone:Uc},Nc=jr({block:lo("block"),dimension:lo("dimension"),formatter:lo("formatter"),report:lo("report"),section:lo("section"),variant:lo("variant"),datasource:lo("datasource")}),qr=jr({block:co("block"),dimension:co("dimension"),formatter:co("formatter"),report:co("report"),section:co("section"),variant:co("variant"),datasource:co("datasource")}),Dc=jr({block:Pt("block"),dimension:Pt("dimension"),formatter:Pt("formatter"),report:Pt("report"),section:Pt("section"),variant:Pt("variant"),datasource:Pt("datasource")}),Fc=jr({block:zo("block"),dimension:zo("dimension"),formatter:zo("formatter"),report:zo("report"),section:zo("section"),variant:zo("variant"),datasource:zo("datasource")}),Vc=jr({block:Bc("block"),section:Bc("section")});});var nt={};Os(nt,{addBlockToState:()=>ob,addRunConsumersRunning:()=>ya,cloneEntity:()=>Vc,createEntity:()=>Nc,deleteEntity:()=>Fc,deleteQueryParam:()=>va,readClientSideBlocks:()=>nb,readEntity:()=>qr,readEnvSecrets:()=>ib,readMember:()=>Hc,readMetadata:()=>Kh,readPrivateBlocks:()=>rb,readUser:()=>Zh,recalculateVariables:()=>xa,removeBlocksFromState:()=>tb,removeDataSourceLogic:()=>lb,removeRunConsumersRunning:()=>Sa,reportSearch:()=>Wh,resetSectionState:()=>ba,revalidateReport:()=>ab,revalidateUrl:()=>sb,searchMember:()=>jh,searchRegenerate:()=>qh,searchRole:()=>Xh,searchUser:()=>Qh,setCurrentLocale:()=>Uh,setPreferredLocale:()=>Gh,setPreviews:()=>$h,setQueryParam:()=>Go,setSectionState:()=>ha,setStatus:()=>Gc,updateEntity:()=>Dc,updateMyData:()=>eb,updateUser:()=>Jh,urlProxy:()=>Yh,variantValidateSlug:()=>Hh});function Hh(e,t){return async(o,r,n)=>{let s=await n.validateVariantSlug({dimension:e,slug:t});if("error"in s)throw new Error(s.error);return s.data}}function Wh(e){return async(t,o,r)=>{let n=await r.searchReport(e);if("error"in n)throw new Error(n.error);return n.data}}function qh(){return async(e,t,o)=>{let r=await o.regenerateSearch(void 0);if("error"in r)throw new Error(r.error);return r.data}}function Hc(e){return async(t,o,r)=>{let n=await r.readMember(e);if("error"in n)throw new Error(n.error);return n.data}}function jh(e){return async(t,o,r)=>{let n=await r.searchMember(e);if(n.ok===true)return n.data;throw new Error(n.error)}}async function Wc(e,t,o,r,n){let s=o().status,a={...s,...r},i={...s.query,...r.query};Object.keys(i).forEach(u=>i[u]===void 0&&delete i[u]);let c={...a,query:i};t(Gc(c)),s.activeSection&&t(xa(e,{query:i},n));}function va(e,t,o){return async(r,n)=>Wc(e,r,n,{query:{[t]:void 0}},o)}function Go(e,t,o,r){return async(n,s)=>Wc(e,n,s,{query:{[t]:o}},r)}function xa(e,t,o){return async(r,n)=>{let s=n(),{currentLocale:a}=s.status,i=s.records.entities.block,c=e.formatterFunctions[a],u=e.datasourceFunctions,{parsedParams:p,statusPayload:m}=Sc(s.status,t),{sid:f,bid:g,previews:d,query:v}=p;Object.keys(m).length&&r(Mo.setStatus(m));let x={...mc(d),locale:a,...Gt()},C={variables:x,query:v,locale:a};r(Mo.addRunConsumersRunning([f]));let R=s.records.entities.section[f],k=async A=>r(Hc(A));try{let A=await Wt(i,R&&[R],g,c,C,void 0,k,"section",u,o),{variables:U,status:G}=A;r(io.setVariableChange({attributes:x,variables:U,status:G})),r(Mo.removeRunConsumersRunning([f]));}catch(A){console.error("Error in runConsumers client side: recalculateVariables",A);}}}function Kh(e){return async(t,o,r)=>{let n=await r.readMetadata(e);if("error"in n)throw new Error(n.error);return n.data}}function Yh(e){return async(t,o,r)=>{let n=await r.urlProxy(e);if("error"in n)throw new Error(n.error);return n.data}}function Xh(){return async(e,t,o)=>{let r=await o.searchRole("");if("error"in r)throw new Error(r.error);return r.data}}function Qh(e){return async(t,o,r)=>{let n=await r.searchUser(e);if("error"in n)throw new Error(n.error);return n.data}}function Zh(e){return async(t,o,r)=>{let n=await r.readUser({user_id:e});if("error"in n)throw new Error(n.error);return n.data}}function Jh({user:e}){return async(t,o,r)=>{let n=await r.updateUser(e);if("error"in n)throw new Error(n.error);return n.data}}function eb(e){return async(t,o,r)=>{let n=await r.updateMyData(e);if("error"in n)throw new Error(n.error);return n.data}}function tb(e){let{removeBlocks:t}=jt.actions;return async o=>{await o(t(e));}}function ob(e){let{addBlocks:t}=jt.actions;return async o=>{await o(t(e));}}function rb(e){return async(t,o,r)=>{let n=await r.readPrivateBlocks({...e,roles:[]});if("error"in n)throw new Error(n.error);return n.data}}function nb(e){return async(t,o,r)=>{let n=await r.readClientSideBlocks(e);if("error"in n)throw new Error(n.error);return n.data}}function sb(e){return async(t,o,r)=>{let n=await r.revalidateUrl({target:e.target});if("error"in n)throw new Error(n.error);return n.data}}function ab(e){return async(t,o,r)=>{let n=await r.revalidateReport({reportId:e.reportId,profilePrefix:e.profilePrefix});if("error"in n)throw new Error(n.error);return n.data}}function ib(){return async(e,t,o)=>{let r=await o.readEnvSecrets({});if("error"in r)throw new Error(r.error);return r.data}}function lb(){let{removeDataSourceLogic:e}=jt.actions;return async t=>{await t(e());}}var Gc,$h,ha,ba,Uh,Gh,ya,Sa,Kr=h(()=>{l();so();fc();dr();qt();$r();No();Gr();ga();({setStatus:Gc,setPreviews:$h,setSectionState:ha,resetSectionState:ba,setCurrentLocale:Uh,setPreferredLocale:Gh,addRunConsumersRunning:ya,removeRunConsumersRunning:Sa}=Mo);});function Yr(){let e=useContext(Kt);if(e===void 0)throw new Error("useBespoke must be used inside ResourceProvider");return e}var pb,db,Kt,uo=h(()=>{l();mt();qt();ce();dr();pr();(({locales:pb}=Pe())),db={pathSegment:"path",formatterFunctions:pb.reduce((e,t)=>({...e,[t]:{}}),{}),datasourceFunctions:[],profilePrefix:"path",previewPrefix:null,siteProps:{}},Kt=createContext(db);});function fb(e={required:false}){let{update:t,data:o,status:r}=useSession(e);return {update:t,user:o?.user,status:r,isLoading:r==="loading"}}var Ee,$e=h(()=>{l();Ee=fb;});function _e(e){let t=Ue(),o=X(s=>s.status.sectionState)[e]||{},r=useCallback(s=>{t(ha({[e]:s}));},[e]),n=useCallback(()=>{t(ba(e));},[e]);return {sectionVariables:o,setSectionVariables:r,resetSectionVariables:n}}function br(){let e=Ue(),t=X(n=>n.status.isRunConsumersRunning),o=useCallback(n=>{e(ya(n));},[]),r=useCallback(n=>{e(Sa(n));},[]);return {isRunConsumersRunning:t,addRunConsumersRunning:o,removeRunConsumersRunning:r}}function Jc(){return X(t=>t.status.currentLocale)}function Wo(e){return t=>{let o=Ue(),r=useMemo(()=>da.read(e,{include:true}),[]),n=useCallback(a=>{let i=Object.values(a.records.entities[e]),c=a.records.requests[e][r]||{status:i==null?"UNINITIALIZED":"SUCCESS"},u=t?i.filter(p=>t.includes(p.id)):i;return eu(u,c)},[r]),s=X(n);return useEffect(()=>{s.isUninitialized&&o(qr(e,{id:t,include:true}));},[s.status]),s}}function qo(e){return t=>{let o=Ue(),r=useMemo(()=>da.read(e,{id:t,include:true}),[t]),n=useCallback(a=>{let i=a.records.entities[e][t],c=a.records.requests[e][r]||{status:i==null?"UNINITIALIZED":"SUCCESS"};return eu(i,c)},[r]),s=X(n);return useEffect(()=>(s.isUninitialized&&t!==null&&o(qr(e,{id:t,include:true})),()=>{}),[r,s.isUninitialized,o,t]),s}}function eu(e,t){let o={data:void 0,error:void 0,status:t.status,isUninitialized:t.status==="UNINITIALIZED",isLoading:t.status==="LOADING",isFetching:t.status==="LOADING"||t.status==="FETCHING",isSuccess:t.status==="SUCCESS",isError:t.status==="FAILURE"};return t.status==="UNINITIALIZED"?o:t.status==="LOADING"?{...o,data:e}:t.status==="FETCHING"?{...o,data:e}:t.status==="FAILURE"?{...o,error:t.error}:{...o,data:e}}var bb,Ue,X,Xr,Un,It,Qr,po,Ho,Gn,Le=h(()=>{l();Kr();ga();Gr();uo();mt();$r();$e();(({localeDefault:bb}=Pe())),Ue=useDispatch,X=useSelector,Xr=Wo("section"),Un=qo("section"),It=qo("block"),Qr=(e,t=void 0,o=void 0)=>{if(!e)return {};let r=It(e).data,n=X(i=>t||i.variables.variables),s=X(i=>o||i.variables.attributes);return useMemo(()=>r?r.inputs.reduce((i,c)=>({...i,...n[c]}),s):{},[r,s,n])},po=(e=bb)=>useContext(Kt).formatterFunctions[e],Ho=()=>useContext(Kt).datasourceFunctions,Gn=()=>useContext(Kt).profilePrefix;});var tu,ou=h(()=>{l();Ms();Gr();$r();No();tu=()=>configureStore({reducer:{[jt.name]:jt.reducer,[Mn.name]:Mn.reducer,[Nn.name]:Nn.reducer},middleware(e){return e({thunk:{extraArgument:Nr("/api/cms/")}})}}),createWrapper(tu);});var ru=h(()=>{l();});var ce=h(()=>{l();Kr();Le();ou();ru();});function yr(e){return t=>Object.values(t.records.entities[e])}function Ko(e){return Object.values(e.records.entities.datasource||[]).sort((t,o)=>t.content.order>o.content.order?1:-1).map(t=>{let o={...wb};return {...t,content:{...t.content,pattern:Et(t.content.pattern,{},{variables:o})}}})}var mo,Ea,jo,wb,Lt=h(()=>{l();dr();pr();mo=e=>e.records.entities.block;Ea=yr("block"),jo=yr("formatter"),wb=Gt();});var ka=h(()=>{l();uo();});var su=h(()=>{l();ce();ka();});function Pb(e,t){let o=[],r={},n=new Set,s=1/0;for(let a of e){let i=parseInt(a.settings.order,10);i<s&&(s=i);}for(let a of e){let{id:i,settings:c}=a,u=parseInt(c.order,10),p=t[i]?t[i]:false,m=Ab(p,i),f=a.section_id&&!n.has(a.section_id);a.section_id&&n.add(a.section_id);let g={id:i,order:u,label:t[i]?t[i][`title${i}title`]:`Title ${i}`,iconProps:m,properties:{sectionId:a.section_id,...a.section_id&&{titleType:f?"primary":"secondary"}},children:[]};if(r[i]=g,u===s)o.push(g);else {let d=u-1,v;for(let x=e.indexOf(a)-1;x>=0;x--){let C=e[x],R=parseInt(C.settings.order,10);if(R===d){v=r[C.id];break}else if(R<d){v=r[C.id];break}}v?v.children.push(g):o.push(g);}}return o}function Yo(e=1,t=6,o=[]){let r=X(f=>f),n=X(f=>f.variables.variables),s=X(f=>f.variables.status),a=Xr(),i=Ea(r).filter(f=>f.type===S.TITLE&&o.includes(f.id)),c=Object.fromEntries(i.map(f=>[f.id,f])),u=Object.fromEntries(i.map(f=>[f.id,n[f.id]])),p=Object.fromEntries(i.map(f=>[f.id,s[f.id]])),m=useMemo(()=>{if(a.isSuccess&&c){let f=[];return a.data.sort(Ct).forEach(g=>{let d=g.blocks.reduce((v,x)=>c[x]&&c[x].type===S.TITLE?v.concat([c[x]]):v,[]);f=f.concat(d.sort((v,x)=>Ct(v,x,"blockrow")));}),Object.keys(s).length?f.filter(g=>{let d=parseInt(g.settings.order||"1",10);return d>=e&&d<=t&&p[g.id]?.allowed&&!p[g.id]?.hiddenByCascade}):[]}},[o,a,c,p]);return useMemo(()=>m&&m?.length>0?Pb(m,u):[],[m,u])}var Ab,Ca=h(()=>{l();ce();Lt();Oo();de();Ab=(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`]});});function Ot(){let e=Ue();return useMemo(()=>async t=>await e(nt.readMember(t)),[e])}var iu=h(()=>{l();ce();});var lu=h(()=>{l();ce();mt();$e();});var cu=h(()=>{l();ce();});var wa,Zr,pu=h(()=>{l();$e();wa=(e,t,o,r=null)=>{let[n,s]=useState(false),[a,i]=useState(null);return {print:u=>{s(true),i(null);let p=process.env.NEXT_PUBLIC_REPORTS_BASE_URL,m=new URLSearchParams(window.location.search),f=u?"&transparent=true":"",g=r?`/embeds/${t}/${o}?section=${e}&block=${r}${m.toString()?"&"+m.toString():""}`:`/embeds/${t}/${o}?section=${e}${m.toString()?"&"+m.toString():""}`,d=`${p}${g}&print=true`;On.get(`${process.env.NEXT_PUBLIC_PDF_API_URL}/screenshot?url=${encodeURIComponent(d)}${f}`,{responseType:"blob"}).then(v=>{let x=r?`section${e}_block${r}.png`:`section${e}.png`;saveAs(v.data,x);}).catch(v=>{i(v.response?.data?.message||"Failed to download image. Please try again.");}).finally(()=>{s(false);});},downloadLoading:n,error:a}},Zr=()=>!!process.env.NEXT_PUBLIC_PDF_API_URL;});var Qe=h(()=>{l();ka();su();Ca();iu();lu();cu();pu();});var du=h(()=>{l();ce();Lt();Lt();qt();zr();so();$e();ce();No();Qe();Le();de();});function bt(){return useContext(Db)}var Db,fo=h(()=>{l();Ne();Db=createContext({active:false,variables:null,status:null,setComparisonVariables:null,comparisonLoaded:false,loading:false,error:false});});function Hn(e,t,o,r=false,n=false){let s=useRouter(),{query:a,locale:i}=s,c=X(w=>w),u=useDispatch(),p=bt(),m=X(w=>r&&p.variables?p?.variables?.attributes:w.variables.attributes),f=mo(c),g=jo(c),d=Ko(c),v=ao(g,i),x=Qr(e,r&&p.active?p?.variables.variables:void 0,r&&p.active?p?.variables.attributes:void 0),C=X(w=>r?p.variables.variables:w.variables.variables),R=X(w=>r?p.variables.status:w.variables.status),k=Ot(),{sectionVariables:A,resetSectionVariables:U}=_e(t),{addRunConsumersRunning:G,removeRunConsumersRunning:F}=br(),B=Ee(),E=r&&p.active?`${o}Compare`:o,O=r&&p.active?Object.fromEntries(Object.entries(a).filter(([w])=>w.match(Ub)).map(([w,N])=>[w.replace("Compare",""),N])):Object.fromEntries(Object.entries(a).filter(([w])=>w.match(Gb)).map(([w,N])=>[w.replace("Compare",""),N]));return useCallback(w=>{let N={locale:i,query:{...O,[o]:w},variables:x},Z=new URLSearchParams(window.location.search);Z.set(E,w),window.history.replaceState(null,null,`?${Z.toString()}`),G([t]),Wt(f,void 0,e,v,N,{variables:C,status:R},k,"report",d,B).then(W=>{p.active&&r?p.setComparisonVariables({attributes:m,variables:W.variables,status:W.status}):u(io.setVariableChange({attributes:m,variables:W.variables,status:W.status})),n&&A&&U(),F([t]);});},[e,t,o,E,a,f,u,v,s,x.attributes,r,n,R,C])}var Ub,Gb,mu=h(()=>{l();so();ce();qt();Lt();No();Le();Qe();fo();$e();Ub=/\w*Compare\b/,Gb=/selector\d+id/;});var fu=h(()=>{l();});var Wb,qb,gu,hu,Wn,jb,Xo,Jr=h(()=>{l();Pn();dr();Wb=process.env.NEXT_PUBLIC_REPORTS_LOCALE_DEFAULT||"en",qb="Error Rendering Visualization",gu={data:[],dataFormat:e=>e,type:"Treemap",noDataHTML:`<p style="font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;">
5
+ `)}));}let O=await Promise.all(E).catch(A=>A.message);if(typeof O=="string"&&O)return {outputVariables:{},renderVariables:{},status:{error:O}};p=O.length===1?O[0].data:O.map(A=>A.data),g=O.reduce((A,C)=>A+JSON.stringify(C.data).length/1024,0),f=Math.max(...O.map(A=>A.requestDuration)),v=O.map(A=>A.apiDataSource?`${A.apiDataSource.name} (${A.apiDataSource.id})`:null),x=O.map(A=>A.finalUrl);}if(e.type===S.SELECTOR){let{config:B,log:E,error:O}=En(e.id,e.contentByLocale[a].content.logic,t,o,true);return {outputVariables:jl(e.id,c,B),renderVariables:B,status:{log:E,error:O,allowed:u}}}if(e.type===S.MULTIHIERARCHY_SELECTOR){let{config:B,log:E,error:O}=kn(e.id,e.contentByLocale[a].content.logic,t,o,true);return {outputVariables:Yl(e.id,c,B),renderVariables:B,status:{log:E,error:O,allowed:u}}}if(e.type===S.VIZ)return {outputVariables:{},renderVariables:e.contentByLocale.logic.content,status:{log:[],allowed:u}};if(e.type===S.RELATED){let B=e.contentByLocale?.logic?.content?.simple?.compare||"variant",E=e.contentByLocale?.logic?.content?.simple?.limit||4,O=Object.keys(i).filter(z=>z.startsWith("report_id")).map(z=>i[z]),A=Object.keys(i).filter(z=>z.startsWith("dimension_id")).map(z=>i[z]),C=Object.keys(i).filter(z=>z.startsWith("variant_id")).map(z=>i[z]),N=Object.keys(i).filter(z=>z.startsWith("id")).map(z=>i[z]);if(!N.length)return {outputVariables:{related_reports:[]},renderVariables:{},status:{log:[],allowed:false}};let Z=await Promise.all(N.map((z,F)=>r({mode:"ids",locale:a,ids:[z],output:"lite",variant:[C[F]]}))).then(z=>z.flatMap(F=>{let Y=[];return Ln(F)?F.ok&&(Y=F.data.results):Y=F.results,Y&&Array.isArray(Y)?Y:[]})).catch(z=>(console.error("Error getting related members",z),[]));if(A.length>1){let z=Object.keys(i).filter(_=>_.startsWith("variant_slug")).map(_=>i[_]),F=Z.map((_,T)=>{let L={mode:"related",locale:a,related:E??4,current_ids:[_.content_id],output:"full",variant_ids:[_.variant_id]};return T===0&&(L.include_ids=[_.content_id]),L}),Y=await Promise.all(F.map(_=>r(_))).then(_=>_.flatMap(T=>{let L=[];return Ln(T)?T.ok&&(L=T.data.results):L=T.results,L&&Array.isArray(L)?L:[]})).catch(_=>(console.error("Error getting related members",_),[])),ve=Y.reduce((_,T)=>{let L=T.variant_slug;return _[L]||(_[L]=[]),_[L].push(T),_},{}),j=[],ee=Object.keys(ve),re=[{combination:[],index:0}];for(;re.length>0;){let _=re.pop();if(!_)continue;let{combination:T,index:L}=_;if(L===ee.length){j.push(T);continue}let q=ee[L],Q=ve[q];for(let K of Q)re.push({combination:[...T,K],index:L+1});}return {outputVariables:{related_reports:j.map(_=>{let T=_.sort((L,q)=>z.indexOf(L.variant_slug)-z.indexOf(q.variant_slug));return {entities:T,link:"/"+T.map(L=>`${L.variant_slug}/${L.slug}`).join("/")}})},renderVariables:{},status:{log:[],allowed:Y.length>0}}}let W=Z.map(z=>z.content_id),$={mode:"related",locale:a,related:E??4,current_ids:W,output:"full"};(B==="report"?$.report_ids=O:B==="dimension"?$.dimension_ids=A:$.variant_ids=C);let J=await r($).then(z=>{let F=[];return Ln(z)?z.ok&&(F=z.data.results):F=z.results,F&&Array.isArray(F)?F:[]}).catch(z=>(console.error("Error getting related members",z),[]));return {outputVariables:{related_reports:J.map(z=>({entities:[z],link:`/${z.variant_slug}/${z.slug}`}))},renderVariables:{},status:{log:[],allowed:J.length>0}}}let{logic:w}=kt(e,a),R=Et(w,t,o),k=no("resp",p||{},R,t,i,o),{vars:P,error:U,log:G}=k;if(typeof P!="object")return {outputVariables:{},renderVariables:{},status:{error:"Configuration did not return an object",log:G,duration:f,responseSize:g,resp:p,api:d,allowed:u,apiFinalUrls:x,apiDataSources:v}};let V=Object.keys(P).reduce((B,E)=>({...B,[`${e.type}${e.id}${E}`]:P[E]}),{});return {renderVariables:P,outputVariables:[S.GENERATOR,S.SECTION_FLAG].includes(e.type)?P:V,status:{log:G,error:U,duration:f,responseSize:g,resp:p,api:d,allowed:u,apiFinalUrls:x,apiDataSources:v}}}function dc(e,t,o,r,n,s,a){return e.consumers.forEach(i=>{if(t[i]){let c=`${o}-${i}`;!r.includes(c)&&(t[i].section_id===t[o].section_id||!n)&&r.push(c),e.consumers.filter(u=>t[u]&&t[u].section_id===t[o].section_id||!n).forEach(u=>Ys(u,t,r,false,s,n,a));}})}var Ht,eh,th,pc,oh,rh,cc,Ys,sh,Wt,so=h(()=>{l();Ms();ur();de();Us();Hs();Kl();Xl();Fr();pr();Lo();Jl();tc();Ws();rc();Pn();dr();ic();Ht=Bg(process.env.NEXT_PUBLIC_REPORTS_DEBUG),eh=process.env.REPORTS_ORIGIN||"",th=process.env.NEXT_PUBLIC_REPORTS_AXIOS_RETRIES,pc=5;try{pc=parseInt(`${th||5}`,10);}catch(e){console.error("Error setting axios retries NEXT_PUBLIC_REPORTS_AXIOS_RETRIES defaults to 5",e);}lc(On,{retries:pc,retryDelay:lc.exponentialDelay,onRetry:(e,t,o)=>{console.error("Generator request failed. Retrying... Count: ",e),console.error("URL: ",o.url),console.error(t.message);}});On.interceptors.request.use(e=>({...e,requestStart:Date.now()}));On.interceptors.response.use(e=>({...e,requestDuration:new Date().getTime()-e.config.requestStart}),e=>Promise.reject(e));oh=(e,t,o)=>{let r=Et(e,t,o);return r.startsWith("http")||(r=`${eh}${r.startsWith("/")?"":"/"}${r}`),r},{urlProxy:rh}=Nr("/api/cms");cc=process.env.NEXT_PUBLIC_REPORTS_API_FETCH_TIMEOUT||0;Ys=(e,t,o=[],r=true,n=true,s=true,a=[])=>{if(a.includes(e))return [];a.push(e);let i=t[e];return i&&i.inputs.length&&r&&i.inputs.forEach(c=>{let u=`${c}-${e}`;o.includes(u)||o.push(u),i.inputs.forEach(p=>Ys(p,t,o,r,false,s,a));}),i&&i.consumers.length&&n&&dc(i,t,e,o,s,n,a),o},sh=(e,t,o,r)=>{let n=true;if(e&&"allowed"in e.settings&&e.settings.allowed!=="always")if(e.settings.allowed==="never")n=false;else {let s=lt(t),{error:a,output:i}=no("variables",o,e.settings.allowedLogic||"return false;",r,void 0,s);a||(n=!!i);}return n},Wt=async(e,t,o,r,n,s={},a,i="section",c,u)=>{let p=i==="section",m=lt(n),f=m.variables,g={...s.variables??{}},d={...s.status??{}},v=new Set,x=[],w={};o?w={...w,[o]:e[o]}:t?w=(t??[]).reduce((W,$)=>{let{id:J}=$;if($.settings?.[ft.CLIENT_SIDE]&&p){let z=Object.values(e).filter(F=>F.section_id===J&&F.type!==S.SECTION_FLAG&&(F.type===S.GENERATOR&&F._clientSideGenerator||!F.shared||F.shared&&F.consumers?.length===0));return {...W,...z.reduce((F,Y)=>({...F,[Y.id]:Y}),{})}}return {...W,...Zl(J,e)}},{}):w=Object.values(e).filter(W=>qs(W)).reduce((W,$)=>({...W,[$.id]:$}),{});let R=Object.values(w).filter(W=>qs(W));if(R.length>0){Ht&&console.info("%crunConsumers: calculating section flags","color:purple",R.map(M=>M.id).join(", "));let W=Object.fromEntries(await Promise.all(R.map(async M=>[M.id,await uc(M,r,{...m,variables:f,locale:f.locale},a,c,u).then(z=>{let{outputVariables:F,status:Y}=z;if(Y.error){if(typeof window>"u")throw new Error(`Run consumers (Block: ${M.id}, Section ${M.section_id}) failed with message: ${Y.error}. `);d[M.id]={allowed:false,error:Y.error},g[M.id]={};}return (M.consumers.length>0||[S.GENERATOR,S.SECTION_FLAG,S.RELATED].includes(M.type))&&Y.allowed&&Object.keys(F).length>0?g[M.id]=F:g[M.id]={},i==="report"?(d[M.id]={allowed:Y.allowed,client:Y.client||null},[S.GENERATOR,S.SECTION_FLAG].includes(M.type)&&Y.api&&(d[M.id].api=Y.api)):d[M.id]=Y,z})]))),J=Object.entries(W).filter(([,M])=>!M.outputVariables[oc]).map(([M])=>Number(M));v=new Set(J.map(M=>e[M].section_id)),Object.values(w).filter(M=>v.has(M.section_id)).forEach(M=>{x.push(M.id),delete w[M.id];}),Ht&&console.info("%crunConsumers: removing sections","color:purple",v.keys());}let k=v.size>0?Object.fromEntries(Object.entries(e).filter(([,W])=>v?.has(W.section_id)?(x.includes(W.id)||x.push(W.id),false):true)):e;if(x.length>0&&(k=Object.fromEntries(Object.entries(k).map(([W,$])=>{let J={...$,inputs:$.inputs.filter(M=>!x.includes(M)),consumers:$.consumers.filter(M=>!x.includes(M))};return [W,J]}))),!o&&!t)return {variables:{...s.variables??{},...g},status:{...s.status??{},...d}};i==="report"&&x.length>0&&x.forEach(W=>{delete g[W],delete d[W],delete e[W];}),Ht&&console.info("%crunConsumers: running root blocks","color:purple",Object.keys(w));let P=Object.keys(w).reduce((W,$)=>{let J=new Date,M=Ys(Number($),k,[],!o,true,p).map(Y=>Y.split("-")),F=(new Date().getTime()-J.getTime())/1e3;return Ht&&console.info(`%cResolved dependencies for ${$} (${F.toFixed(2)}s)`,"color:blue"),[...W,...M]},[]),U=new Date,G=Object.keys(w).reduce((W,$)=>W.includes($)?[...W]:[$,...W],Qg(P)),B=(new Date().getTime()-U.getTime())/1e3;Ht&&console.info(`%cResolved DAG (${B.toFixed(2)}s): `,"color:green",G);let E=process.env.NEXT_PUBLIC_REPORTS_MAX_CONCURRENT_QUERIES_PER_REPORT,O=parseInt(`${E||0}`,10);async function A(W,$){let J=new Map,M=[],z=async()=>M.length;for(let F of W){if(O!==0){let ee=await z();for(;ee>=O;)Ht&&console.info("Too many pending promises, waiting...",ee,M),await new Promise(re=>setTimeout(re,500)),ee=await z();}let Y=$[F],j=Promise.all(Y.inputs.filter(ee=>W.includes(String(ee))).map(ee=>J.get(Number(ee)))).then(async()=>{let ee=Y.inputs.reduce((K,ie)=>({...K,...g[ie]}),f),re=Y.inputs.find(K=>(Y.settings?.ignoreCascade?Y.settings?.ignoreCascade:[]).includes(K)||!d[K]?false:!d[K].allowed||d[K].hiddenByCascade);if(re){d[F]={allowed:false,hiddenByCascade:d[re].hiddenByCascade||re},g[F]={},M.splice(M.indexOf(Number(F)),1);return}let oe=new Date,_,T=t&&t.find(K=>K.id===Y.section_id)?.settings?.[ft.CLIENT_SIDE];typeof window<"u"&&[S.SELECTOR,S.MULTIHIERARCHY_SELECTOR].includes(Y.type)&&Y.settings[ft.DISABLED]&&!T?_=new Promise(K=>{K({outputVariables:g[F],status:d[F]});}):_=uc(Y,r,{...m,variables:ee,locale:ee.locale},a,c,u);let L=await _.then(({outputVariables:K,status:ie})=>{if(ie.error){if(typeof window>"u")throw new Error(`Run consumers (Block: ${F}, Section ${Y.section_id}) failed with message: ${ie.error}.`);d[F]={allowed:false,error:ie.error},g[F]={};}(Y.consumers.length>0||[S.GENERATOR,S.SECTION_FLAG,S.RELATED].includes(Y.type))&&ie.allowed&&Object.keys(K).length>0?g[F]=K:g[F]={},i==="report"?(d[F]={allowed:ie.allowed,client:ie.client||null},[S.GENERATOR,S.SECTION_FLAG].includes(Y.type)&&ie.api&&(d[F].api=ie.api)):d[F]=ie;}),Q=(new Date().getTime()-oe.getTime())/1e3;return Ht&&console.info(`%cBlock ${Y.id} resolved in ${Q.toFixed(3)}s`,Q>500?"color:red":"color:green"),d[F].duration=d[F].duration?d[F].duration:Q,M.splice(M.indexOf(Number(F)),1),L}).catch(ee=>{throw M.splice(M.indexOf(Number(F)),1),ee});M.push(Number(F)),J.set(Number(F),j);}await Promise.all(Array.from(J.values()));}let C=new Date;i==="section"&&t&&(G=G.filter(W=>!d[W]||d[W].client),Ht&&console.info("%cFiltering DAG to exclude blocks already solved by SSR. Remaining blocks: ","color:yellow",G)),await A(G,k);let Z=(new Date().getTime()-C.getTime())/1e3;return Ht&&console.info(`%cResolved Variables (${Z.toFixed(2)}s), ${G.length} blocks`,"color:green"),{variables:{...s.variables??{},...g},status:{...s.status??{},...d}}};});function ah(e=[]){return e.reduce((t,o,r)=>{if(o){let n=r+1;t[`id${n}`]=o.id,t[`name${n}`]=o.name,t[`slug${n}`]=o.slug,"attributes"in o&&Object.keys(o.attributes).forEach(s=>{t[`attr_${s}${n}`]=o.attributes[s];}),t[`variant_id${n}`]=o.variant_id,t[`variant_name${n}`]=o.variant_name,t[`variant_slug${n}`]=o.variant_slug,t[`dimension_id${n}`]=o.dimension_id,t[`dimension_name${n}`]=o.dimension_name,t.report_id=o.report_id,t.report_name=o.report_name;}return t},{})}var mc,fc=h(()=>{l();mc=ah;});function gc(e,t){return +(e<t)-+(e>t)}function Ct(e,t,o="ordering"){return gc(t[o],e[o])}var Oo=h(()=>{l();});function _n(e,t){let o=dh[e];if(!o)throw new Error(`Invalid entity type: ${e}`);let{entities:r}=normalize(t,[o]);return {report:_o(r,"report"),dimension:_o(r,"dimension"),section:_o(r,"section"),block:_o(r,"block"),variant:_o(r,"variant"),formatter:_o(r,"formatter"),datasource:_o(r,"datasource")}}function _o(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:{}}var lh,Vr,hc,bc,yc,ch,uh,ph,dh,Sc,ao,qt=h(()=>{l();Oo();Pn();mt();(({localeDefault:lh}=Pe())),Vr=new schema.Entity("block",{},{mergeStrategy(e,t){return t.block_input?e||{}:{...e,...t}}});Vr.define({consumers:[Vr],inputs:[Vr]});hc=new schema.Entity("variant"),bc=new schema.Entity("dimension",{variants:[hc]},{processStrategy(e){return {...e,variants:"variants"in e?e.variants:[]}}}),yc=new schema.Entity("section",{blocks:[Vr]}),ch=new schema.Entity("report",{dimensions:[bc],sections:[yc]},{processStrategy(e){return {...e,sections:"sections"in e?e.sections.sort(Ct):[]}}}),uh=new schema.Entity("formatter"),ph=new schema.Entity("datasource"),dh={report:ch,section:yc,block:Vr,dimension:bc,variant:hc,formatter:uh,datasource:ph};Sc=(e,t=void 0)=>{let{sid:o,bid:r,previews:n=[],query:s={}}=t||{},a,i,c={};return o?(a=o,c.activeSection=a):a=e.activeSection,n.length>0?(i=n,c.previews=i.filter(Boolean)):i=e.previews,{parsedParams:{sid:a,bid:r,previews:i,query:s},statusPayload:c}},ao=(e=[],t=lh)=>e.reduce((o,r)=>{let n=wn({vars:["n"],logic:r.content.logic},{},t,{});return o[r.name]=n,o},{});});var wt,Bn,zr=h(()=>{l();wt=process.env.NEXT_PUBLIC_REPORTS_LOCALE_DEFAULT||"en",Bn=process.env.NEXT_PUBLIC_REPORTS_LOCALES?.split(",")||[wt];Bn.includes(wt)||Bn.push(wt);});var gh,Mn,Mo,$r=h(()=>{l();zr();gh={localeDefault:wt,locales:Bn,currentLocale:wt,preferredLocale:wt,showToolbar:false,activeSection:null,previews:[],query:{},sectionState:{},activeEntity:{type:null,id:null},sidebarStatus:{tools:true,settings:false,reportEditor:false},isCMS:false,isRunConsumersRunning:[]},Mn=createSlice({name:"status",initialState:gh,reducers:{setStatus:(e,t)=>{Object.assign(e,t.payload);},setPreviews(e,t){e.previews=t.payload;},setCurrentLocale(e,t){e.currentLocale=t.payload;},setPreferredLocale(e,t){e.preferredLocale=t.payload;},setSectionState(e,t){e.sectionState={...e.sectionState,...t.payload};},resetSectionState(e,t){e.sectionState={...e.sectionState,[t.payload]:{}};},setActiveEntity(e,t){e.activeEntity=t.payload;},openSidebar(e,t){e.sidebarStatus={...e.sidebarStatus,[t.payload]:true};},closeSidebar(e,t){e.sidebarStatus={...e.sidebarStatus,[t.payload]:false};},toggleSidebar(e,t){e.sidebarStatus={...e.sidebarStatus,[t.payload]:!e.sidebarStatus[t.payload]};},addRunConsumersRunning(e,t){e.isRunConsumersRunning=e.isRunConsumersRunning.concat(t.payload);},removeRunConsumersRunning(e,t){e.isRunConsumersRunning=e.isRunConsumersRunning.filter(o=>!t.payload.includes(o));}},extraReducers:{[HYDRATE]:(e,t)=>({...e,previews:t.payload.status.previews})}}),Mo=Mn.actions;});var yh,Nn,io,No=h(()=>{l();yh={attributes:{},variables:{},status:{}},Nn=createSlice({name:"variables",initialState:yh,reducers:{setVariableChange:(e,t)=>{e.attributes={...e.attributes,...t.payload.attributes},e.variables={...e.variables,...t.payload.variables},e.status={...e.status,...t.payload.status};}},extraReducers:{[HYDRATE]:(e,t)=>({attributes:{...e.attributes,...t.payload.variables.attributes},status:{...e.status,...t.payload.variables.status},variables:{...e.variables,...t.payload.variables.variables}})}}),io=Nn.actions;});function Ur(e,t){return Object.fromEntries(Object.keys(e).map(o=>[o,{...e[o],...t[o]}]))}function Dn(e,t){return e.map(n=>t[n]).sort((n,s)=>typeof n.ordering=="string"&&typeof s.ordering=="string"?Ct(n,s):typeof n.ordering=="number"&&typeof s.ordering=="number"?n.ordering-s.ordering:String(n.ordering).localeCompare(String(s.ordering))).map(n=>n.id)}function Th(e,t){let o=e.indexOf(t);o>-1&&e.splice(o,1);}var xh,jt,Gr=h(()=>{l();Oo();qt();xh={tree:[],reports:null,entities:{block:{},dimension:{},report:{},section:{},variant:{},formatter:{},datasource:{}},requests:{block:{},dimension:{},report:{},section:{},variant:{},formatter:{},datasource:{}}},jt=createSlice({name:"records",initialState:xh,reducers:{set:(e,t)=>{let o=t.payload;return {entities:Ur(e.entities,o.entities||{}),requests:Ur(e.requests,o.requests||{}),reports:o.reports||e.reports,tree:o.tree||e.tree}},setRequest:(e,t)=>{let o=t.payload;e.requests[o.type][o.key]=o;},setCreateRequest(e,t){let o=t.payload;if(e.requests[o.type][o.key]=o,o.status==="SUCCESS"){let r=Array.isArray(o.data)?o.data:[o.data],n=_n(o.type,r),s=Ur(e.entities,n);if(e.entities=s,o.type==="report"){let a=o.data;e.reports?e.reports.indexOf(a.id)===-1&&(e.reports=[...e.reports,a.id]):e.reports=[a.id];}else if(o.type==="dimension"){let a=o.data;e.entities.report[a.report_id].dimensions.push(a.id),e.entities.report[a.report_id].dimensions=Dn(s.report[a.report_id].dimensions,s.dimension);}else if(o.type==="variant"){let a=o.data;e.entities.dimension[a.dimension_id].variants.push(a.id);}else if(o.type==="section"&&!Array.isArray(o.data)){let a=o.data;e.entities.report[a.report_id].sections.push(a.id),e.entities.report[a.report_id].sections=Dn(s.report[a.report_id].sections,s.section);}else if(o.type==="block")if(Array.isArray(o.data)){let a=o.data,i=a[0],c=a.map(u=>u.id);e.entities.section[i.section_id].blocks.concat(c);}else {let a=o.data;e.entities.section[a.section_id].blocks.push(a.id);}}},setReadRequest(e,t){let o=t.payload;if(o.type!=="report"&&(e.requests[o.type][o.key]=o),o.status==="SUCCESS"){let r=_n(o.type,o.data),n=Ur(e.entities,r);e.entities=n;}},setUpdateRequest(e,t){let o=t.payload;if(e.requests[o.type][o.key]=o,o.status==="SUCCESS"){let r=Array.isArray(o.data)?o.data:[o.data],n=_n(o.type,r),s,a,i;if(o.type==="block"&&!Array.isArray(o.data)){let u=e.entities.block[o.data.id].inputs,p=n.block[o.data.id].inputs;s=u.length!==p.length,s&&(i=u.length>p.length,a=i?u.filter(m=>!p.includes(m))[0]:p.filter(m=>!u.includes(m))[0]),Object.values(n.block).forEach(m=>{m.block_input&&delete n.block[m.id];});}let c=Ur(e.entities,n);if(e.entities=c,o.type==="dimension"){let u=o.data;e.entities.report[u.report_id].dimensions=Dn(c.report[u.report_id].dimensions,c.dimension);}else if(o.type==="section"&&!Array.isArray(o.data)){let u=o.data;e.entities.report[u.report_id].sections=Dn(c.report[u.report_id].sections,c.section);}else if(o.type==="block"&&!Array.isArray(o.data)){let u=o.data;s&&(i?e.entities.block[a].consumers=e.entities.block[a].consumers.filter(p=>p!==u.id):e.entities.block[a].consumers.push(u.id));}}},setDeleteRequest(e,t){let o=t.payload;if(e.requests[o.type][o.key]=o,o.status==="SUCCESS"){let{id:r,parentId:n,parentType:s}=o.data;if(delete e.entities[o.type][r],s&&n!=null){let a=`${o.type}s`;Th(e.entities[s][n][a],r);}}},removeBlocks:(e,t)=>{let o=t.payload,r={...e.entities.block};return o.forEach(n=>{delete r[n];}),{...e,entities:{...e.entities,block:r}}},addBlocks:(e,t)=>{let o=t.payload;return {...e,entities:{...e.entities,block:{...e.entities.block,...o}}}},removeDataSourceLogic:e=>{let t={...e.entities.datasource};Object.keys(t).forEach(o=>{e.entities.datasource[o].content.useProxy&&(delete e.entities.datasource[o].content.logic,delete e.entities.datasource[o].content.logic_ssr,delete e.entities.datasource[o].content.testUrl,delete e.entities.datasource[o].content.access);});}},extraReducers:{[HYDRATE]:(e,t)=>{let o=t.payload.records,r=o.entities;return {entities:r,reports:Object.values(r.report).map(n=>n.id),requests:{block:{},dimension:{},report:{},section:{},variant:{},formatter:{},datasource:{}},tree:o.tree}}}});});function Do(e,t,o){if(t==="createBulk"||t==="updateBulk"){let n=`${t}${vc(o)}`;return e[n]}let r=`${t}${vc(o)}`;return e[r]}function vc(e){return e[0].toUpperCase()+e.slice(1)}var xc=h(()=>{l();});function Me(e){for(var t=arguments.length,o=Array(t>1?t-1:0),r=1;r<t;r++)o[r-1]=arguments[r];if(process.env.NODE_ENV!=="production"){var n=Ih[e],s=n?typeof n=="function"?n.apply(null,o):n:"unknown error nr: "+e;throw Error("[Immer] "+s)}throw Error("[Immer] minified error nr: "+e+(o.length?" "+o.map((function(a){return "'"+a+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function mr(e){return !!e&&!!e[ot]}function Vo(e){var t;return !!e&&((function(o){if(!o||typeof o!="object")return false;var r=Object.getPrototypeOf(o);if(r===null)return true;var n=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return n===Object||typeof n=="function"&&Function.toString.call(n)===Lh})(e)||Array.isArray(e)||!!e[Pc]||!!(!((t=e.constructor)===null||t===void 0)&&t[Pc])||sa(e)||aa(e))}function Wr(e,t,o){o===void 0&&(o=false),gr(e)===0?(o?Object.keys:pa)(e).forEach((function(r){o&&typeof r=="symbol"||t(r,e[r],e);})):e.forEach((function(r,n){return t(n,r,e)}));}function gr(e){var t=e[ot];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:sa(e)?2:aa(e)?3:0}function ea(e,t){return gr(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Rh(e,t){return gr(e)===2?e.get(t):e[t]}function Ic(e,t,o){var r=gr(e);r===2?e.set(t,o):r===3?e.add(o):e[t]=o;}function Eh(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function sa(e){return Ah&&e instanceof Map}function aa(e){return Ph&&e instanceof Set}function Fo(e){return e.o||e.t}function ia(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Oh(e);delete t[ot];for(var o=pa(t),r=0;r<o.length;r++){var n=o[r],s=t[n];s.writable===false&&(s.writable=true,s.configurable=true),(s.get||s.set)&&(t[n]={configurable:true,writable:true,enumerable:s.enumerable,value:e[n]});}return Object.create(Object.getPrototypeOf(e),t)}function la(e,t){return t===void 0&&(t=false),ca(e)||mr(e)||!Vo(e)||(gr(e)>1&&(e.set=e.add=e.clear=e.delete=kh),Object.freeze(e),t&&Wr(e,(function(o,r){return la(r,true)}),true)),e}function kh(){Me(2);}function ca(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function At(e){var t=_h[e];return t||Me(18,e),t}function Tc(){return process.env.NODE_ENV==="production"||fr||Me(0),fr}function Xs(e,t){t&&(At("Patches"),e.u=[],e.s=[],e.v=t);}function Fn(e){ta(e),e.p.forEach(Ch),e.p=null;}function ta(e){e===fr&&(fr=e.l);}function Rc(e){return fr={p:[],l:fr,h:e,m:true,_:0}}function Ch(e){var t=e[ot];t.i===0||t.i===1?t.j():t.g=true;}function Qs(e,t){t._=t.p.length;var o=t.p[0],r=e!==void 0&&e!==o;return t.h.O||At("ES5").S(t,e,r),r?(o[ot].P&&(Fn(t),Me(4)),Vo(e)&&(e=Vn(t,e),t.l||zn(t,e)),t.u&&At("Patches").M(o[ot].t,e,t.u,t.s)):e=Vn(t,o,[]),Fn(t),t.u&&t.v(t.u,t.s),e!==Lc?e:void 0}function Vn(e,t,o){if(ca(t))return t;var r=t[ot];if(!r)return Wr(t,(function(i,c){return Ec(e,r,t,i,c,o)}),true),t;if(r.A!==e)return t;if(!r.P)return zn(e,r.t,true),r.t;if(!r.I){r.I=true,r.A._--;var n=r.i===4||r.i===5?r.o=ia(r.k):r.o,s=n,a=false;r.i===3&&(s=new Set(n),n.clear(),a=true),Wr(s,(function(i,c){return Ec(e,r,n,i,c,o,a)})),zn(e,n,false),o&&e.u&&At("Patches").N(r,o,e.u,e.s);}return r.o}function Ec(e,t,o,r,n,s,a){if(process.env.NODE_ENV!=="production"&&n===o&&Me(5),mr(n)){var i=Vn(e,n,s&&t&&t.i!==3&&!ea(t.R,r)?s.concat(r):void 0);if(Ic(o,r,i),!mr(i))return;e.m=false;}else a&&o.add(n);if(Vo(n)&&!ca(n)){if(!e.h.D&&e._<1)return;Vn(e,n),t&&t.A.l||zn(e,n);}}function zn(e,t,o){o===void 0&&(o=false),!e.l&&e.h.D&&e.m&&la(t,o);}function Zs(e,t){var o=e[ot];return (o?Fo(o):e)[t]}function kc(e,t){if(t in e)for(var o=Object.getPrototypeOf(e);o;){var r=Object.getOwnPropertyDescriptor(o,t);if(r)return r;o=Object.getPrototypeOf(o);}}function oa(e){e.P||(e.P=true,e.l&&oa(e.l));}function Js(e){e.o||(e.o=ia(e.t));}function ra(e,t,o){var r=sa(t)?At("MapSet").F(t,o):aa(t)?At("MapSet").T(t,o):e.O?(function(n,s){var a=Array.isArray(n),i={i:a?1:0,A:s?s.A:Tc(),P:false,I:false,R:{},l:s,t:n,k:null,o:null,j:null,C:false},c=i,u=na;a&&(c=[i],u=Hr);var p=Proxy.revocable(c,u),m=p.revoke,f=p.proxy;return i.k=f,i.j=m,f})(t,o):At("ES5").J(t,o);return (o?o.A:Tc()).p.push(r),r}function wh(e){return mr(e)||Me(22,e),(function t(o){if(!Vo(o))return o;var r,n=o[ot],s=gr(o);if(n){if(!n.P&&(n.i<4||!At("ES5").K(n)))return n.t;n.I=true,r=Cc(o,s),n.I=false;}else r=Cc(o,s);return Wr(r,(function(a,i){n&&Rh(n.t,a)===i||Ic(r,a,t(i));})),s===3?new Set(r):r})(e)}function Cc(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return ia(e)}var wc,fr,ua,Ah,Ph,Ac,Lc,Pc,ot,Ih,Lh,pa,Oh,_h,na,Hr,Bh,rt,Mh,$n,Oc=h(()=>{l();ua=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",Ah=typeof Map<"u",Ph=typeof Set<"u",Ac=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",Lc=ua?Symbol.for("immer-nothing"):((wc={})["immer-nothing"]=true,wc),Pc=ua?Symbol.for("immer-draftable"):"__$immer_draftable",ot=ua?Symbol.for("immer-state"):"__$immer_state",Ih={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3:function(e){return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(e){return "Cannot apply patch, path doesn't resolve: "+e},16:'Sets cannot have "replace" patches.',17:function(e){return "Unsupported patch operation: "+e},18:function(e){return "The plugin for '"+e+"' has not been loaded into Immer. To enable the plugin, import and call `enable"+e+"()` when initializing your application."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21:function(e){return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '"+e+"'"},22:function(e){return "'current' expects a draft, got: "+e},23:function(e){return "'original' expects a draft, got: "+e},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},Lh=""+Object.prototype.constructor,pa=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Oh=Object.getOwnPropertyDescriptors||function(e){var t={};return pa(e).forEach((function(o){t[o]=Object.getOwnPropertyDescriptor(e,o);})),t},_h={},na={get:function(e,t){if(t===ot)return e;var o=Fo(e);if(!ea(o,t))return (function(n,s,a){var i,c=kc(s,a);return c?"value"in c?c.value:(i=c.get)===null||i===void 0?void 0:i.call(n.k):void 0})(e,o,t);var r=o[t];return e.I||!Vo(r)?r:r===Zs(e.t,t)?(Js(e),e.o[t]=ra(e.A.h,r,e)):r},has:function(e,t){return t in Fo(e)},ownKeys:function(e){return Reflect.ownKeys(Fo(e))},set:function(e,t,o){var r=kc(Fo(e),t);if(r?.set)return r.set.call(e.k,o),true;if(!e.P){var n=Zs(Fo(e),t),s=n?.[ot];if(s&&s.t===o)return e.o[t]=o,e.R[t]=false,true;if(Eh(o,n)&&(o!==void 0||ea(e.t,t)))return true;Js(e),oa(e);}return e.o[t]===o&&(o!==void 0||t in e.o)||Number.isNaN(o)&&Number.isNaN(e.o[t])||(e.o[t]=o,e.R[t]=true),true},deleteProperty:function(e,t){return Zs(e.t,t)!==void 0||t in e.t?(e.R[t]=false,Js(e),oa(e)):delete e.R[t],e.o&&delete e.o[t],true},getOwnPropertyDescriptor:function(e,t){var o=Fo(e),r=Reflect.getOwnPropertyDescriptor(o,t);return r&&{writable:true,configurable:e.i!==1||t!=="length",enumerable:r.enumerable,value:o[t]}},defineProperty:function(){Me(11);},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){Me(12);}},Hr={};Wr(na,(function(e,t){Hr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)};})),Hr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Me(13),Hr.set.call(this,e,t,void 0)},Hr.set=function(e,t,o){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Me(14),na.set.call(this,e[0],t,o,e[0])};Bh=(function(){function e(o){var r=this;this.O=Ac,this.D=true,this.produce=function(n,s,a){if(typeof n=="function"&&typeof s!="function"){var i=s;s=n;var c=r;return function(v){var x=this;v===void 0&&(v=i);for(var w=arguments.length,R=Array(w>1?w-1:0),k=1;k<w;k++)R[k-1]=arguments[k];return c.produce(v,(function(P){var U;return (U=s).call.apply(U,[x,P].concat(R))}))}}var u;if(typeof s!="function"&&Me(6),a!==void 0&&typeof a!="function"&&Me(7),Vo(n)){var p=Rc(r),m=ra(r,n,void 0),f=true;try{u=s(m),f=!1;}finally{f?Fn(p):ta(p);}return typeof Promise<"u"&&u instanceof Promise?u.then((function(v){return Xs(p,a),Qs(v,p)}),(function(v){throw Fn(p),v})):(Xs(p,a),Qs(u,p))}if(!n||typeof n!="object"){if((u=s(n))===void 0&&(u=n),u===Lc&&(u=void 0),r.D&&la(u,true),a){var g=[],d=[];At("Patches").M(n,u,g,d),a(g,d);}return u}Me(21,n);},this.produceWithPatches=function(n,s){if(typeof n=="function")return function(u){for(var p=arguments.length,m=Array(p>1?p-1:0),f=1;f<p;f++)m[f-1]=arguments[f];return r.produceWithPatches(u,(function(g){return n.apply(void 0,[g].concat(m))}))};var a,i,c=r.produce(n,s,(function(u,p){a=u,i=p;}));return typeof Promise<"u"&&c instanceof Promise?c.then((function(u){return [u,a,i]})):[c,a,i]},typeof o?.useProxies=="boolean"&&this.setUseProxies(o.useProxies),typeof o?.autoFreeze=="boolean"&&this.setAutoFreeze(o.autoFreeze);}var t=e.prototype;return t.createDraft=function(o){Vo(o)||Me(8),mr(o)&&(o=wh(o));var r=Rc(this),n=ra(this,o,void 0);return n[ot].C=true,ta(r),n},t.finishDraft=function(o,r){var n=o&&o[ot];process.env.NODE_ENV!=="production"&&(n&&n.C||Me(9),n.I&&Me(10));var s=n.A;return Xs(s,r),Qs(void 0,s)},t.setAutoFreeze=function(o){this.D=o;},t.setUseProxies=function(o){o&&!Ac&&Me(20),this.O=o;},t.applyPatches=function(o,r){var n;for(n=r.length-1;n>=0;n--){var s=r[n];if(s.path.length===0&&s.op==="replace"){o=s.value;break}}n>-1&&(r=r.slice(n+1));var a=At("Patches").$;return mr(o)?a(o,r):this.produce(o,(function(i){return a(i,r)}))},e})(),rt=new Bh,Mh=rt.produce,rt.produceWithPatches.bind(rt),rt.setAutoFreeze.bind(rt),rt.setUseProxies.bind(rt),rt.applyPatches.bind(rt),rt.createDraft.bind(rt),rt.finishDraft.bind(rt),$n=Mh;});function jr(e){return (t,o)=>{let r=e[t];if(!r)throw new Error(`Attempting to dispatch action for invalid entity type '${t}'`);return r(o)}}function Uo(e,t){return (o,r)=>{let s=r().records.requests[e][t],a=!s||s.status==="UNINITIALIZED"?"LOADING":"FETCHING";o(ht.setRequest({key:t,type:e,status:a}));}}function $o(e,t,o,r){return n=>{typeof window=="object"&&notifications.show({autoClose:3e3,color:"red",id:t,message:r,title:"Error"}),n(ht.setRequest({key:t,type:e,status:"FAILURE",error:{code:o,message:r}}));}}function lo(e){return t=>{let o=ma(e,t);return (r,n,s)=>(r(Uo(e,o)),Do(s,"create",e)(t).then(i=>(i.ok===true?r(ht.setCreateRequest({key:o,operation:"create",status:"SUCCESS",type:e,data:i.data})):r($o(e,o,i.status,i.error)),i)))}}function Fh(e){return t=>{let o=ma(e,t[0]);return (r,n,s)=>(r(Uo(e,o)),Do(s,"createBulk",e)(t).then(i=>(i.ok===true?r(ht.setCreateRequest({key:o,operation:"createBulk",status:"SUCCESS",type:e,data:i.data})):r($o(e,o,i.status,i.error)),i)))}}function _c(e,t,o){return o.replace(new RegExp(e,"g"),t)}function Vh(e){return e.section_id!==void 0}function zh(e){return e.report_id!==void 0}function Bc(e){return t=>{let{create:o}=t;return (r,n,s)=>lo(e)(o)(r,n,s).then(async i=>{if(i.ok){let{data:c}=i,{id:u}=c,{update:p}=t,m=Uc(e,{id:u});if(r(Uo(e,`${m}`)),e==="block"&&Vh(o)){let f=$n(p,x=>{x.id=u;}),{contentByLocale:g}=f;g&&(f=$n(f,x=>{x.id=u,x.contentByLocale=Object.keys(g).reduce((w,R)=>{let k=g?g[R]:{};return w[R]={...k,id:u},w},{});}));let v=f.inputs?.map(x=>({type:x.type,id:x.id,inputAction:{operation:"create",input:{input_id:x.id,block_id:f.id}}}));return v&&v.length>0&&Mc(e)([f,...v])(r,n,s).then(()=>co("section")({id:f.section_id,include:true})(r,n,s).then(x=>(x.ok&&r(ht.setRequest({key:m,type:e,status:"SUCCESS",data:x.data})),x))),Pt(e)(f)(r,n,s).then(x=>(x.ok&&r(ht.setRequest({key:m,type:e,status:"SUCCESS",data:x.data})),x))}if(e==="section"&&zh(o)){let{id:f}=c,g=$n(p,x=>{x.id=f;}),{blocks:d}=g,v=d?.map(x=>({type:x.type,blockcol:x.blockcol,blockrow:x.blockrow,section_id:f,locales:Object.keys(x.contentByLocale).map(w=>w)}));return v&&d&&await Fh("block")(v)(r,n,s).then(x=>{if(x.ok){let w=x.data,R=[],k=w.map((P,U)=>{let V={...P},B=V.id,E=d[U];E.contentByLocale&&(V.contentByLocale=Object.keys(E.contentByLocale).reduce((J,M)=>{let z=E.contentByLocale[M];return J[M]={...z,content:{...z.content},id:V.id},J},{}));let{settings:O}=E,{contentByLocale:A,id:C}=V;V.settings=O;let N={id:C,contentByLocale:A,settings:O};return E.inputs.map(J=>J.id).reduce((J,M)=>{let z=d.findIndex(F=>F.id===M);return [...J,z]},[]).map(J=>({...w[J],originalBlock:d[J]})).forEach(J=>{let{id:M,type:z,originalBlock:F}=J;if([S.SELECTOR,S.VIZ].includes(z)){if(N.contentByLocale?.logic?.content?.api){let Y=N.contentByLocale?.logic.content.api;N.contentByLocale.logic.content.api=_c(`(selector${F.id}id)`,`selector${M}id`,Y);}if(N.contentByLocale?.logic?.content?.logic){let Y=N.contentByLocale.logic.content.logic;N.contentByLocale.logic.content.logic=_c(`(selector${F.id}id)`,`selector${M}id`,Y);}}R.push({id:M,inputAction:{operation:"create",input:{input_id:M,block_id:B}}});}),N});return Mc("block")([...k,...R])(r,n,s)}}),Pt(e)(g)(r,n,s).then(x=>(x.ok&&r(ht.setRequest({key:m,type:e,status:"SUCCESS",data:x.data})),x))}return Pt(e)({...p,id:c.id})(r,n,s)}})}}function co(e){return t=>{let o=zc(e,t);return (r,n,s)=>{r(Uo(e,o));let a=Do(s,"read",e);if(typeof a!="function"){let i=`Failed to get valid RPC method for entity "${e}"`;return r($o(e,o,500,i)),Promise.reject(new Error(i))}return a(t).then(i=>(i.ok===true?r(ht.setReadRequest({key:o,operation:"read",status:"SUCCESS",type:e,data:i.data})):r($o(e,o,i.status,i.error)),i))}}}function Pt(e){return t=>{let o=fa(e,t);return (r,n,s)=>(r(Uo(e,o)),Do(s,"update",e)(t).then(i=>(i.ok===true?r(ht.setUpdateRequest({key:o,operation:"update",status:"SUCCESS",type:e,data:i.data})):r($o(e,o,i.status,i.error)),i)))}}function Mc(e){return t=>{let o=fa(e,t[0]);return (r,n,s)=>(r(Uo(e,o)),Do(s,"updateBulk",e)(t).then(i=>(i.ok===true?r(ht.setUpdateRequest({key:o,operation:"updateBulk",status:"SUCCESS",type:e,data:i.data})):r($o(e,o,i.status,i.error)),i)))}}function zo(e){return t=>{let o=$c(e,t);return (r,n,s)=>(r(Uo(e,o)),Do(s,"delete",e)(t).then(i=>{i.ok===true?r(ht.setDeleteRequest({key:o,operation:"delete",status:"SUCCESS",type:e,data:i.data})):r($o(e,o,i.status,i.error));}))}}function ma(e,t){if(e==="variant"){let o=t;return `create(variant, [${o.dimension_id}, ${o.name}])`}return `create(${e}, [${Object.keys(t)}])`}function zc(e,t={}){let o=t.id==null?null:`'${t.id}'`;return `read(${e}, ${o}, ${!!t.include})`}function fa(e,t){let{id:o,...r}=t;return `update(${e}, ${o}, [${Object.keys(r)}])`}function $c(e,t){return `delete(${e}, ${t})`}function Uc(e,t){let o=t.id==null?null:`'${t.id}'`;return `clone(${e}, ${o})`}var ht,da,Nc,qr,Dc,Fc,Vc,ga=h(()=>{l();xc();Gr();Oc();de();ht=jt.actions,da={create:ma,read:zc,update:fa,delete:$c,clone:Uc},Nc=jr({block:lo("block"),dimension:lo("dimension"),formatter:lo("formatter"),report:lo("report"),section:lo("section"),variant:lo("variant"),datasource:lo("datasource")}),qr=jr({block:co("block"),dimension:co("dimension"),formatter:co("formatter"),report:co("report"),section:co("section"),variant:co("variant"),datasource:co("datasource")}),Dc=jr({block:Pt("block"),dimension:Pt("dimension"),formatter:Pt("formatter"),report:Pt("report"),section:Pt("section"),variant:Pt("variant"),datasource:Pt("datasource")}),Fc=jr({block:zo("block"),dimension:zo("dimension"),formatter:zo("formatter"),report:zo("report"),section:zo("section"),variant:zo("variant"),datasource:zo("datasource")}),Vc=jr({block:Bc("block"),section:Bc("section")});});var nt={};Os(nt,{addBlockToState:()=>ob,addRunConsumersRunning:()=>ya,cloneEntity:()=>Vc,createEntity:()=>Nc,deleteEntity:()=>Fc,deleteQueryParam:()=>va,readClientSideBlocks:()=>nb,readEntity:()=>qr,readEnvSecrets:()=>ib,readMember:()=>Hc,readMetadata:()=>Kh,readPrivateBlocks:()=>rb,readUser:()=>Zh,recalculateVariables:()=>xa,removeBlocksFromState:()=>tb,removeDataSourceLogic:()=>lb,removeRunConsumersRunning:()=>Sa,reportSearch:()=>Wh,resetSectionState:()=>ba,revalidateReport:()=>ab,revalidateUrl:()=>sb,searchMember:()=>jh,searchRegenerate:()=>qh,searchRole:()=>Xh,searchUser:()=>Qh,setCurrentLocale:()=>Uh,setPreferredLocale:()=>Gh,setPreviews:()=>$h,setQueryParam:()=>Go,setSectionState:()=>ha,setStatus:()=>Gc,updateEntity:()=>Dc,updateMyData:()=>eb,updateUser:()=>Jh,urlProxy:()=>Yh,variantValidateSlug:()=>Hh});function Hh(e,t){return async(o,r,n)=>{let s=await n.validateVariantSlug({dimension:e,slug:t});if("error"in s)throw new Error(s.error);return s.data}}function Wh(e){return async(t,o,r)=>{let n=await r.searchReport(e);if("error"in n)throw new Error(n.error);return n.data}}function qh(){return async(e,t,o)=>{let r=await o.regenerateSearch(void 0);if("error"in r)throw new Error(r.error);return r.data}}function Hc(e){return async(t,o,r)=>{let n=await r.readMember(e);if("error"in n)throw new Error(n.error);return n.data}}function jh(e){return async(t,o,r)=>{let n=await r.searchMember(e);if(n.ok===true)return n.data;throw new Error(n.error)}}async function Wc(e,t,o,r,n){let s=o().status,a={...s,...r},i={...s.query,...r.query};Object.keys(i).forEach(u=>i[u]===void 0&&delete i[u]);let c={...a,query:i};t(Gc(c)),s.activeSection&&t(xa(e,{query:i},n));}function va(e,t,o){return async(r,n)=>Wc(e,r,n,{query:{[t]:void 0}},o)}function Go(e,t,o,r){return async(n,s)=>Wc(e,n,s,{query:{[t]:o}},r)}function xa(e,t,o){return async(r,n)=>{let s=n(),{currentLocale:a}=s.status,i=s.records.entities.block,c=e.formatterFunctions[a],u=e.datasourceFunctions,{parsedParams:p,statusPayload:m}=Sc(s.status,t),{sid:f,bid:g,previews:d,query:v}=p;Object.keys(m).length&&r(Mo.setStatus(m));let x={...mc(d),locale:a,...Gt()},w={variables:x,query:v,locale:a};r(Mo.addRunConsumersRunning([f]));let R=s.records.entities.section[f],k=async P=>r(Hc(P));try{let P=await Wt(i,R&&[R],g,c,w,void 0,k,"section",u,o),{variables:U,status:G}=P;r(io.setVariableChange({attributes:x,variables:U,status:G})),r(Mo.removeRunConsumersRunning([f]));}catch(P){console.error("Error in runConsumers client side: recalculateVariables",P);}}}function Kh(e){return async(t,o,r)=>{let n=await r.readMetadata(e);if("error"in n)throw new Error(n.error);return n.data}}function Yh(e){return async(t,o,r)=>{let n=await r.urlProxy(e);if("error"in n)throw new Error(n.error);return n.data}}function Xh(){return async(e,t,o)=>{let r=await o.searchRole("");if("error"in r)throw new Error(r.error);return r.data}}function Qh(e){return async(t,o,r)=>{let n=await r.searchUser(e);if("error"in n)throw new Error(n.error);return n.data}}function Zh(e){return async(t,o,r)=>{let n=await r.readUser({user_id:e});if("error"in n)throw new Error(n.error);return n.data}}function Jh({user:e}){return async(t,o,r)=>{let n=await r.updateUser(e);if("error"in n)throw new Error(n.error);return n.data}}function eb(e){return async(t,o,r)=>{let n=await r.updateMyData(e);if("error"in n)throw new Error(n.error);return n.data}}function tb(e){let{removeBlocks:t}=jt.actions;return async o=>{await o(t(e));}}function ob(e){let{addBlocks:t}=jt.actions;return async o=>{await o(t(e));}}function rb(e){return async(t,o,r)=>{let n=await r.readPrivateBlocks({...e,roles:[]});if("error"in n)throw new Error(n.error);return n.data}}function nb(e){return async(t,o,r)=>{let n=await r.readClientSideBlocks(e);if("error"in n)throw new Error(n.error);return n.data}}function sb(e){return async(t,o,r)=>{let n=await r.revalidateUrl({target:e.target});if("error"in n)throw new Error(n.error);return n.data}}function ab(e){return async(t,o,r)=>{let n=await r.revalidateReport({reportId:e.reportId,profilePrefix:e.profilePrefix});if("error"in n)throw new Error(n.error);return n.data}}function ib(){return async(e,t,o)=>{let r=await o.readEnvSecrets({});if("error"in r)throw new Error(r.error);return r.data}}function lb(){let{removeDataSourceLogic:e}=jt.actions;return async t=>{await t(e());}}var Gc,$h,ha,ba,Uh,Gh,ya,Sa,Kr=h(()=>{l();so();fc();dr();qt();$r();No();Gr();ga();({setStatus:Gc,setPreviews:$h,setSectionState:ha,resetSectionState:ba,setCurrentLocale:Uh,setPreferredLocale:Gh,addRunConsumersRunning:ya,removeRunConsumersRunning:Sa}=Mo);});function Yr(){let e=useContext(Kt);if(e===void 0)throw new Error("useBespoke must be used inside ResourceProvider");return e}var pb,db,Kt,uo=h(()=>{l();mt();qt();ce();dr();pr();(({locales:pb}=Pe())),db={pathSegment:"path",formatterFunctions:pb.reduce((e,t)=>({...e,[t]:{}}),{}),datasourceFunctions:[],profilePrefix:"path",previewPrefix:null,siteProps:{}},Kt=createContext(db);});function fb(e={required:false}){let{update:t,data:o,status:r}=useSession(e);return {update:t,user:o?.user,status:r,isLoading:r==="loading"}}var Ee,$e=h(()=>{l();Ee=fb;});function _e(e){let t=Ue(),o=X(s=>s.status.sectionState)[e]||{},r=useCallback(s=>{t(ha({[e]:s}));},[e]),n=useCallback(()=>{t(ba(e));},[e]);return {sectionVariables:o,setSectionVariables:r,resetSectionVariables:n}}function br(){let e=Ue(),t=X(n=>n.status.isRunConsumersRunning),o=useCallback(n=>{e(ya(n));},[]),r=useCallback(n=>{e(Sa(n));},[]);return {isRunConsumersRunning:t,addRunConsumersRunning:o,removeRunConsumersRunning:r}}function Jc(){return X(t=>t.status.currentLocale)}function Wo(e){return t=>{let o=Ue(),r=useMemo(()=>da.read(e,{include:true}),[]),n=useCallback(a=>{let i=Object.values(a.records.entities[e]),c=a.records.requests[e][r]||{status:i==null?"UNINITIALIZED":"SUCCESS"},u=t?i.filter(p=>t.includes(p.id)):i;return eu(u,c)},[r]),s=X(n);return useEffect(()=>{s.isUninitialized&&o(qr(e,{id:t,include:true}));},[s.status]),s}}function qo(e){return t=>{let o=Ue(),r=useMemo(()=>da.read(e,{id:t,include:true}),[t]),n=useCallback(a=>{let i=a.records.entities[e][t],c=a.records.requests[e][r]||{status:i==null?"UNINITIALIZED":"SUCCESS"};return eu(i,c)},[r]),s=X(n);return useEffect(()=>(s.isUninitialized&&t!==null&&o(qr(e,{id:t,include:true})),()=>{}),[r,s.isUninitialized,o,t]),s}}function eu(e,t){let o={data:void 0,error:void 0,status:t.status,isUninitialized:t.status==="UNINITIALIZED",isLoading:t.status==="LOADING",isFetching:t.status==="LOADING"||t.status==="FETCHING",isSuccess:t.status==="SUCCESS",isError:t.status==="FAILURE"};return t.status==="UNINITIALIZED"?o:t.status==="LOADING"?{...o,data:e}:t.status==="FETCHING"?{...o,data:e}:t.status==="FAILURE"?{...o,error:t.error}:{...o,data:e}}var bb,Ue,X,Xr,Un,It,Qr,po,Ho,Gn,Le=h(()=>{l();Kr();ga();Gr();uo();mt();$r();$e();(({localeDefault:bb}=Pe())),Ue=useDispatch,X=useSelector,Xr=Wo("section"),Un=qo("section"),It=qo("block"),Qr=(e,t=void 0,o=void 0)=>{if(!e)return {};let r=It(e).data,n=X(i=>t||i.variables.variables),s=X(i=>o||i.variables.attributes);return useMemo(()=>r?r.inputs.reduce((i,c)=>({...i,...n[c]}),s):{},[r,s,n])},po=(e=bb)=>useContext(Kt).formatterFunctions[e],Ho=()=>useContext(Kt).datasourceFunctions,Gn=()=>useContext(Kt).profilePrefix;});var tu,ou=h(()=>{l();Ms();Gr();$r();No();tu=()=>configureStore({reducer:{[jt.name]:jt.reducer,[Mn.name]:Mn.reducer,[Nn.name]:Nn.reducer},middleware(e){return e({thunk:{extraArgument:Nr("/api/cms/")}})}}),createWrapper(tu);});var ru=h(()=>{l();});var ce=h(()=>{l();Kr();Le();ou();ru();});function yr(e){return t=>Object.values(t.records.entities[e])}function Ko(e){return Object.values(e.records.entities.datasource||[]).sort((t,o)=>t.content.order>o.content.order?1:-1).map(t=>{let o={...wb};return {...t,content:{...t.content,pattern:Et(t.content.pattern,{},{variables:o})}}})}var mo,Ea,jo,wb,Lt=h(()=>{l();dr();pr();mo=e=>e.records.entities.block;Ea=yr("block"),jo=yr("formatter"),wb=Gt();});var ka=h(()=>{l();uo();});var su=h(()=>{l();ce();ka();});function Pb(e,t){let o=[],r={},n=new Set,s=1/0;for(let a of e){let i=parseInt(a.settings.order,10);i<s&&(s=i);}for(let a of e){let{id:i,settings:c}=a,u=parseInt(c.order,10),p=t[i]?t[i]:false,m=Ab(p,i),f=a.section_id&&!n.has(a.section_id);a.section_id&&n.add(a.section_id);let g={id:i,order:u,label:t[i]?t[i][`title${i}title`]:`Title ${i}`,iconProps:m,properties:{sectionId:a.section_id,...a.section_id&&{titleType:f?"primary":"secondary"}},children:[]};if(r[i]=g,u===s)o.push(g);else {let d=u-1,v;for(let x=e.indexOf(a)-1;x>=0;x--){let w=e[x],R=parseInt(w.settings.order,10);if(R===d){v=r[w.id];break}else if(R<d){v=r[w.id];break}}v?v.children.push(g):o.push(g);}}return o}function Yo(e=1,t=6,o=[]){let r=X(f=>f),n=X(f=>f.variables.variables),s=X(f=>f.variables.status),a=Xr(),i=Ea(r).filter(f=>f.type===S.TITLE&&o.includes(f.id)),c=Object.fromEntries(i.map(f=>[f.id,f])),u=Object.fromEntries(i.map(f=>[f.id,n[f.id]])),p=Object.fromEntries(i.map(f=>[f.id,s[f.id]])),m=useMemo(()=>{if(a.isSuccess&&c){let f=[];return a.data.sort(Ct).forEach(g=>{let d=g.blocks.reduce((v,x)=>c[x]&&c[x].type===S.TITLE?v.concat([c[x]]):v,[]);f=f.concat(d.sort((v,x)=>Ct(v,x,"blockrow")));}),Object.keys(s).length?f.filter(g=>{let d=parseInt(g.settings.order||"1",10);return d>=e&&d<=t&&p[g.id]?.allowed&&!p[g.id]?.hiddenByCascade}):[]}},[o,a,c,p]);return useMemo(()=>m&&m?.length>0?Pb(m,u):[],[m,u])}var Ab,Ca=h(()=>{l();ce();Lt();Oo();de();Ab=(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`]});});function Ot(){let e=Ue();return useMemo(()=>async t=>await e(nt.readMember(t)),[e])}var iu=h(()=>{l();ce();});var lu=h(()=>{l();ce();mt();$e();});var cu=h(()=>{l();ce();});var wa,Zr,pu=h(()=>{l();$e();wa=(e,t,o,r=null)=>{let[n,s]=useState(false),[a,i]=useState(null);return {print:u=>{s(true),i(null);let p=process.env.NEXT_PUBLIC_REPORTS_BASE_URL,m=new URLSearchParams(window.location.search),f=u?"&transparent=true":"",g=r?`/embeds/${t}/${o}?section=${e}&block=${r}${m.toString()?"&"+m.toString():""}`:`/embeds/${t}/${o}?section=${e}${m.toString()?"&"+m.toString():""}`,d=`${p}${g}&print=true`;On.get(`${process.env.NEXT_PUBLIC_PDF_API_URL}/screenshot?url=${encodeURIComponent(d)}${f}`,{responseType:"blob"}).then(v=>{let x=r?`section${e}_block${r}.png`:`section${e}.png`;saveAs(v.data,x);}).catch(v=>{i(v.response?.data?.message||"Failed to download image. Please try again.");}).finally(()=>{s(false);});},downloadLoading:n,error:a}},Zr=()=>!!process.env.NEXT_PUBLIC_PDF_API_URL;});var Qe=h(()=>{l();ka();su();Ca();iu();lu();cu();pu();});var du=h(()=>{l();ce();Lt();Lt();qt();zr();so();$e();ce();No();Qe();Le();de();});function bt(){return useContext(Db)}var Db,fo=h(()=>{l();Ne();Db=createContext({active:false,variables:null,status:null,setComparisonVariables:null,comparisonLoaded:false,loading:false,error:false});});function Hn(e,t,o,r=false,n=false){let s=useRouter(),{query:a,locale:i}=s,c=X(C=>C),u=useDispatch(),p=bt(),m=X(C=>r&&p.variables?p?.variables?.attributes:C.variables.attributes),f=mo(c),g=jo(c),d=Ko(c),v=ao(g,i),x=Qr(e,r&&p.active?p?.variables.variables:void 0,r&&p.active?p?.variables.attributes:void 0),w=X(C=>r?p.variables.variables:C.variables.variables),R=X(C=>r?p.variables.status:C.variables.status),k=Ot(),{sectionVariables:P,resetSectionVariables:U}=_e(t),{addRunConsumersRunning:G,removeRunConsumersRunning:V}=br(),B=Ee(),E=r&&p.active?`${o}Compare`:o,O=r&&p.active?Object.fromEntries(Object.entries(a).filter(([C])=>C.match(Ub)).map(([C,N])=>[C.replace("Compare",""),N])):Object.fromEntries(Object.entries(a).filter(([C])=>C.match(Gb)).map(([C,N])=>[C.replace("Compare",""),N]));return useCallback(C=>{let N={locale:i,query:{...O,[o]:C},variables:x},Z=new URLSearchParams(window.location.search);Z.set(E,C),window.history.replaceState(null,null,`?${Z.toString()}`),G([t]),Wt(f,void 0,e,v,N,{variables:w,status:R},k,"report",d,B).then(W=>{p.active&&r?p.setComparisonVariables({attributes:m,variables:W.variables,status:W.status}):u(io.setVariableChange({attributes:m,variables:W.variables,status:W.status})),n&&P&&U(),V([t]);});},[e,t,o,E,a,f,u,v,s,x.attributes,r,n,R,w])}var Ub,Gb,mu=h(()=>{l();so();ce();qt();Lt();No();Le();Qe();fo();$e();Ub=/\w*Compare\b/,Gb=/selector\d+id/;});var fu=h(()=>{l();});var Wb,qb,gu,hu,Wn,jb,Xo,Jr=h(()=>{l();Pn();dr();Wb=process.env.NEXT_PUBLIC_REPORTS_LOCALE_DEFAULT||"en",qb="Error Rendering Visualization",gu={data:[],dataFormat:e=>e,type:"Treemap",noDataHTML:`<p style="font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;">
6
6
  <strong>${qb}</strong>
7
- </p>`},hu=(e,t,o)=>{let r=t.find(n=>{let s=n.content?.pattern;if(!s)return false;try{return new RegExp(s,"gm").test(e)}catch{return false}});if(r){if(r.content?.useProxy)return `${process.env.NEXT_PUBLIC_REPORTS_BASE_URL}/api/cms/url/proxy?url=${encodeURIComponent(e)}&wrapper=false`;try{let s={envs:{...Gt()},...o?{session:o}:{}},i=An({vars:["url","libs","session"],logic:r.content.logic},s)(e);if(i instanceof Promise)console.warn(`[DataSource] Logic for "${r.name}" is async, which is not supported in this context. Use useProxy=true for async logic.`);else if(i?.axiosConfig?.url!=null){let{url:c,headers:u}=i.axiosConfig;return u&&Object.keys(u).length>0?{url:c,headers:u}:c}}catch(n){console.error(`[DataSource] Failed to apply logic for URL "${e}":`,n.message);}}return e},Wn=(e,t,o)=>typeof e=="string"?hu(e,t,o):Array.isArray(e)?e.map(r=>typeof r=="string"?hu(r,t,o):r):e,jb=(e,t,o={},r=Wb,n=null,s={},a={},i=[],c)=>{let u;try{u=wn({vars:["variables"],logic:e},t,r,s,a)(o),u.data=Wn(u.data,i,c),u._downloadUrl&&(u.__downloadUrl=Wn(u.__downloadUrl,i,c));}catch(d){return console.error(`Parsing Error in propify (ID: ${n})`),console.error(`Error message: ${d.message}`),{error:`${d}`,config:gu}}if(typeof u!="object")return {error:"Visualization JS code must return an object",config:gu};let p=u.dataFormat?u.dataFormat:d=>{let x=Array.isArray(u.data)&&u.data.length>1&&u.data.some(C=>typeof C=="string")?d:[d];return dataConcat(x,"data")};delete u.dataFormat;let m=u.linksFormat||void 0;delete u.linksFormat;let f=u.nodesFormat||void 0;delete u.nodesFormat;let g=u.topojsonFormat||void 0;return delete u.topojsonFormat,{config:u,dataFormat:p,linksFormat:m,nodesFormat:f,topojsonFormat:g}},Xo=jb;});var bu=h(()=>{l();le();H({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 yu=h(()=>{l();le();H({name:"abs",description:"Simple Absolute Value.",logicFactory(){return e=>Math.abs(e)},inputType:"number",testValue:"-123",type:"formatter"});});var Xb,Su=h(()=>{l();le();Xb=()=>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,s=>`${parseInt(s)+1}k`):n.indexOf(",")===n.length-8&&(n=n.replace(/,000,000$/g,"M").replace(/([0-9]+)(,999,999$)/g,s=>`${parseInt(s)+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"},H({name:"bucket",description:"Sanitizes bucket strings to '< n', 'n1 - n2', and 'n+'",logicFactory:Xb,inputType:"number",testValue:"1234",type:"formatter"});});var vu=h(()=>{l();le();H({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 xu=h(()=>{l();le();H({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 Tu=h(()=>{l();le();H({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 Ru=h(()=>{l();le();H({name:"formatFieldName",description:"Based on field name returns a string",logicFactory(){return e=>{if(e.contentType.toLowerCase()==="stat"){if(e.field==="title")return "Stat label";if(e.field==="value")return "Stat value";if(e.field==="subtitle")return "Stat subtitle";if(e.field==="tooltip")return "Tooltip text"}return e.contentType.toLowerCase()==="section"&&e.field==="short"?"Short title":e.contentType.toLowerCase()==="description"&&e.field==="description"?"Paragraph":e.field}},inputType:"object",testValue:'{"field":"title","contentType":"stat"}',type:"formatter"});});var Eu=h(()=>{l();le();H({name:"grewTo",description:"Returns the text with grow direction: 'declined from', 'grew to' o 'stayed at'",logicFactory(){return e=>e<0?"declined from":e>0?"grew to":"stayed at"},inputType:"number",testValue:"-1234",type:"formatter"});});var ku=h(()=>{l();le();H({name:"grewWord",description:"Returns either 'grew', 'declined', or 'stayed' depending on the provided number's sign.",logicFactory(){return e=>e<0?"declined":e>0?"grew":"stayed"},inputType:"number",testValue:"-1234",type:"formatter"});});var Cu=h(()=>{l();le();H({name:"growing",description:"Returns either 'declining', 'growing' depending on the provided number's sign.",logicFactory(){return e=>e<0?"declining":"growing"},inputType:"number",testValue:"-1234",type:"formatter"});});var sy,wu=h(()=>{l();le();sy=()=>function(t){let{curr:o,currMoe:r=0,prev:n,prevMoe:s=0}=t,a;if(r||s){let i=(-n/o**2)**2*r**2,c=(1/o)**2*s**2;a=Math.sqrt(i+c);}else a=(o-n)/n;return a*100},H({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:sy,inputType:"object",testValue:'{"curr":10,"currMoe":0,"prev":13,"prevMoe":0}',type:"formatter"});});var Au=h(()=>{l();le();H({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 Pu=h(()=>{l();le();H({name:"growthWord",description:"Returns either 'growth' or 'decline' depending on the provided number's sign.",logicFactory(){return e=>e<0?"decline":"growth"},inputType:"number",testValue:"-1234",type:"formatter"});});var Iu=h(()=>{l();le();H({name:"highWord",description:"Returns either 'higher than', 'lower than', or 'approximately the same as' depending on the provided number's sign.",logicFactory(){return e=>e<0?"lower than":e>0?"higher than":"approximately the same as"},inputType:"number",testValue:"0",type:"formatter"});});var Lu=h(()=>{l();le();H({name:"increaseWord",description:"Returns either 'increase', 'decrease', or 'change' depending on the provided number's sign.",logicFactory(){return e=>e<0?"decrease":e>0?"increase":"change"},inputType:"number",testValue:"1234",type:"formatter"});});var Ou=h(()=>{l();le();H({name:"increasedWord",description:"Returns either 'increased', 'decreased', or 'remained the same' depending on the provided number's sign.",logicFactory(){return e=>e<0?"decreased":e>0?"increased":"remained the same"},inputType:"number",testValue:"0",type:"formatter"});});var _u=h(()=>{l();le();H({name:"increasing",description:"Returns either 'decreasing', 'increasing' or 'maintaining' depending on the provided number's sign.",logicFactory(){return e=>e<0?"decreasing":e>0?"increasing":"maintaining"},inputType:"number",testValue:"-1234",type:"formatter"});});var Bu=h(()=>{l();le();H({name:"largerThan",description:"Returns either 'higher than', 'lower than', or 'approximately the same as' depending on the provided number's sign",logicFactory(){return e=>e<0?"smaller than":e>0?"larger than":"the same as"},inputType:"number",testValue:"-1234",type:"formatter"});});var Mu=h(()=>{l();le();H({name:"list",description:"Joins an array of strings together, adding commas and 'and' when necessary.",logicFactory(){return e=>e.reduce((t,o,r)=>(r?r===e.length-1&&r===1?t+=` and ${o}`:r===e.length-1?t+=`, and ${o}`:t+=`, ${o}`:t+=o,t),"")},inputType:"object",testValue:'["foo","bar","bee"]',type:"formatter"});});var Nu=h(()=>{l();le();H({name:"longWord",description:"",logicFactory(){return e=>e<0?"shorter":e>0?"longer":"similar"},inputType:"number",testValue:"5",type:"formatter"});});var Du=h(()=>{l();le();H({name:"lowerCaseFirst",description:"Converts the first letter of a string to lowercase",logicFactory(){return e=>typeof e=="string"?e.charAt(0).toLowerCase()+e.slice(1):e},inputType:"string",testValue:"foo",type:"formatter"});});var Fu=h(()=>{l();le();H({name:"moreFewerWord",description:"",logicFactory(){return e=>e<0?"fewer":"more"},inputType:"number",testValue:"-5",type:"formatter"});});var Vu=h(()=>{l();le();H({name:"moreLess",description:"Returns either 'more' or 'less' depending on the provided number's sign.",logicFactory(){return e=>e<0?"less":"more"},inputType:"number",testValue:"-5",type:"formatter"});});var zu=h(()=>{l();le();H({name:"moreLess",description:"Returns either 'more than', 'less than', or 'approximately the same' depending on the provided number's sign.",logicFactory(){return e=>e<0?"less than":e>0?"more than":"approximately the same"},inputType:"number",testValue:"-5",type:"formatter"});});var $u=h(()=>{l();le();H({name:"olderWord",description:"",logicFactory(){return e=>e<0?"getting younger":e>0?"getting older":"staying the same age"},inputType:"number",testValue:"-5",type:"formatter"});});var Uu=h(()=>{l();le();H({name:"olderYounger",description:"",logicFactory(){return e=>e<0?"younger than":e>0?"older than":"the same age as"},inputType:"number",testValue:"-5",type:"formatter"});});var Gu=h(()=>{l();le();H({name:"plural",description:"Pluralizes a word.",logicFactory(){return e=>e.replace(/\w$/g,t=>t==="y"?"ies":`${t}s`)},inputType:"string",testValue:"Foo",type:"formatter"});});var Hu=h(()=>{l();le();H({name:"pxToInt",description:"Takes a pixel value and converts it to an integer",logicFactory(){return e=>parseInt(e.replace(/\D+/g,""),10)},inputType:"string",testValue:"12px",type:"formatter"});});var Wu=h(()=>{l();le();H({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 qu=h(()=>{l();le();H({name:"stripEntities",description:"Removes non breaking spaces & other html entities from a string",logicFactory(){return e=>typeof e=="string"?String(e).replace(/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});/ig," "):e},inputType:"string",testValue:"<b>MyText</b>",type:"formatter"});});var Ku=h(()=>{l();le();H({name:"stripHTML",description:"Converts html tags to spaces, then removes redundant spaces",logicFactory(){return e=>{let t={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'","&#x60;":"`","&nbsp;":""},o=`(?:${Object.keys(t).join("|")})`,r=RegExp(o),n=RegExp(o,"g"),s=String(e).replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();return r.test(s)?s.replace(n,a=>t[a]):s}},inputType:"string",testValue:"<b>My text</b>",type:"formatter"});});var Yu=h(()=>{l();le();H({name:"stripOL",description:"Removes ordered list wrapper tags from a string.",logicFactory(){return e=>e.replace(/<ol>/g,"").replace(/<\/ol>/g,"")},inputType:"string",testValue:"<ol><li>My list</li></ol>",type:"formatter"});});var Xu=h(()=>{l();le();H({name:"stripP",description:"Removes all paragraph tags from a string.",logicFactory(){return e=>e.replace(/<p>/g,"").replace(/<\/p>/g,"")},inputType:"string",testValue:"<p>My p</p>",type:"formatter"});});var Qu=h(()=>{l();le();H({name:"stripUL",description:"Removes unordered list wrapper tags from a string.",logicFactory(){return e=>e.replace(/<ul>/g,"").replace(/<\/ul>/g,"")},inputType:"string",testValue:"<ul><li>My list</li></ul>",type:"formatter"});});var Zu=h(()=>{l();le();H({name:"toKebabCase",description:"Takes a camelCase or PascalCase string and converts it to kebab-case.",logicFactory(){return e=>typeof e=="string"?(e=e.charAt(0).toLowerCase()+e.substring(1),e.replace(/([A-Z])/g,"-$1").toLowerCase()):"invalid string passed to toKebabCase()"},inputType:"string",testValue:"camelCaseText",type:"formatter"});});var Ju=h(()=>{l();le();H({name:"toSpacedCase",description:"Takes a camelCase or PascalCase string and adds spaces (I know Spaced Case isn't a thing, deal with it).",logicFactory(){return e=>typeof e=="string"?e.replace(/([A-Z])/g," $1").toLowerCase().trim():"invalid string passed to toSpacedCase()"},inputType:"string",testValue:"camelCaseText",type:"formatter"});});var ep=h(()=>{l();le();H({name:"upperCaseFirst",description:"Converts the first letter of a string to uppercase",logicFactory(){return e=>e.charAt(0).toUpperCase()+e.slice(1)},inputType:"string",testValue:"my name",type:"formatter"});});var tp=h(()=>{l();bu();yu();Su();vu();xu();Tu();Ru();Eu();ku();Cu();wu();Au();Pu();Iu();Lu();Ou();_u();Bu();Mu();Nu();Du();Fu();Vu();zu();$u();Uu();Gu();Hu();Wu();qu();Ku();Yu();Xu();Qu();Zu();Ju();ep();});function je(e){let t=useContext(By);return e?t[e]??t:t}var By,_t=h(()=>{l();By=createContext({});});function op({direction:e,onClick:t,visible:o}){return o?jsx(ActionIcon,{className:`bespoke-sortable-table-arrow bespoke-sortable-table-arrow-${e}`,variant:"filled",size:"md",sx:{position:"absolute",top:"50%",[e==="left"?"left":"right"]:"16px",zIndex:10,opacity:.55,"&:hover":{opacity:1}},onClick:t,children:e==="left"?jsx(IconArrowLeft,{size:16}):jsx(IconArrowRight,{size:16})}):null}function rp({data:e}){let t=useRef(null),[o,r]=useState(false),[n,s]=useState(false),[a,i]=useState(false),c=useMemo(()=>(e&&Array.isArray(e)&&e[0]?Object.keys(e[0]):[]).filter(m=>!m.startsWith("_")).map(m=>({accessorKey:m,header:m,enableSorting:true})),[e]);return useEffect(()=>{let u=()=>{if(t.current){let{scrollWidth:p,clientWidth:m,scrollLeft:f}=t.current;r(p>m),s(f>0),i(f+m<p-1);}};return u(),window.addEventListener("resize",u),t.current?.addEventListener("scroll",u),()=>{window.removeEventListener("resize",u),t.current?.removeEventListener("scroll",u);}},[e]),jsxs("div",{className:"bespoke-sortable-table",style:{position:"relative"},children:[jsx(MantineReactTable,{columns:c,data:e,enableBottomToolbar:false,enableColumnActions:false,enablePagination:false,enableSorting:true,enableTopToolbar:false,layoutMode:"grid",enableStickyHeader:true,initialState:{density:"xs"},mantineTableProps:{sx:{tableLayout:"fixed"}},mantineTableContainerProps:{ref:t,sx:{minHeight:100,maxHeight:350,overflowX:"auto"}},mantineTableBodyCellProps:{p:"5px !important",sx:{textWrap:"wrap"}},defaultColumn:{minSize:50,maxSize:150}}),jsx(op,{direction:"left",visible:o&&n,onClick:()=>{t.current&&t.current.scrollBy({left:-150,behavior:"smooth"});}}),jsx(op,{direction:"right",visible:o&&a,onClick:()=>{t.current&&t.current.scrollBy({left:150,behavior:"smooth"});}})]})}var np=h(()=>{l();});function Qo(e){let t={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'","&#x60;":"`","&nbsp;":""},o=`(?:${Object.keys(t).join("|")})`,r=RegExp(o),n=RegExp(o,"g"),s=String(e).replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();return r.test(s)?s.replace(n,a=>t[a]):s}var qn=h(()=>{l();});function Pa(e){return typeof e=="string"?String(e).replace(/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});/ig," "):e}var sp=h(()=>{l();});function Hy(e){return e?Gy(Pa(Qo(e)),{replacement:"-",remove:/[*+~.()'"!:@]/g,lower:true,strict:true,trim:true}):""}var yt,en=h(()=>{l();qn();sp();yt=Hy;});var Zo,jn,Kn=h(()=>{l();Zo="HTML",jn=({config:e})=>!e||!e.html?null:jsx("div",{className:"bespoke-html",dangerouslySetInnerHTML:{__html:e.html}});});function Ma(e){let{section:t}=e,o=Ot(),r=useRouter(),n=X(T=>T.status.isCMS),s=X(T=>T.status.currentLocale),a=r.locale,i=n?s:a,c=50,u=po(i),p=Ho(),m=Ee(),f=je("options"),g={...pp,...f.data_tab},[d,v]=useState([]),[x,C]=useState([]),[R,k]=useState(),[A,U]=useState(),[G,F]=useState(false),[B,E]=useState({}),[O,P]=useState(true),[w,N]=useState(true),{sectionVariables:Z,setSectionVariables:W,resetSectionVariables:$}=_e(t.id),J=t.blocks||[],M=X(T=>T),z=useMemo(()=>J.reduce((T,L)=>{let q=M.records.entities.block[L],Q=M.variables.variables[L],K=M.variables.status[L];return q&&(S.GENERATOR===q.type&&Q._downloadEnabled===true&&K.allowed||S.VIZ===q.type&&K.allowed)&&(T[L]={entity:q,variables:M.variables.variables[L],status:M.variables.status[L],inputVariablesFlat:q.inputs.reduce((ie,he)=>({...ie,...M.variables.variables[he]}),M.variables.attributes)}),T},{}),[J]),V=T=>{C(L=>L.includes(T)?L:[...L,T]);},Y=T=>{v(L=>(L.find(Q=>Q.ix===T.ix)?L:[...L,T]).sort((Q,K)=>Q.ix>K.ix?1:-1));};function ve(T){!R&&T[0]&&j(T[0]);}function j(T){k(T),U("0");}useEffect(()=>{let T=async(L,q,Q)=>{let K=dataLoad.bind({});return new Promise((ie,he)=>{K(q,null,null,(it,Ce)=>{if(it)he(it);else {let xe=Q instanceof Function?Q(Ce):Ce;L.data.unshift(xe),Y(L),ie(Ce);}});})};if(d.length===0&&x.length===0){let L=0;for(let q of Object.values(z)){let Q=q.entity;if([S.GENERATOR,S.SECTION_FLAG].includes(Q.type)){let K=q.variables._downloadData||q.variables._downloadUrl||q.status.api;if(K){let ie=[];typeof K=="string"?ie=K.split("|||"):ie=[K],ie=Wn(ie,p,m);let he=q.variables._downloadTitle||`${g.data_source} ${L+1}`,it=q.variables._downloadFileName||he;Y({ix:L,id:Q.id,title:Qo(he),fileName:it,data:Array.isArray(ie)?ie:[ie],loading:false,type:S.GENERATOR}),V(L),L++;}}else if(Q.type===S.VIZ){let K=kt(Q),ie=q.inputVariablesFlat,he={variables:ie},it=gt({logic:K.logic},u,he).logic,Ce={router:r,section:{variables:Z,setVariables:W,resetVariables:$}},xe=Xo(it,u,ie,i,Q.id,{},Ce,p,m),Tt=xe.config._downloadTitle||xe.config.title||`${g.viz_source} ${L+1}`,$t=xe.config._downloadFileName||Tt;if(xe.config._downloadEnabled!==false&&xe.config.type!==Zo)try{let Rt=xe.config._downloadUrl||xe.config.data,_r=typeof Rt=="string"?[Rt]:Rt,Eo=xe.dataFormat instanceof Function?xe.dataFormat:!1,ko=xe.config._downloadDataFormat instanceof Function?xe.config._downloadDataFormat:!1;T({ix:L,id:Q.id,title:Qo(Tt),fileName:$t,data:_r,loading:!1,type:S.VIZ},Rt,ko||Eo),V(L),L++;}catch(Rt){console.error("DataLoad catch",Rt);}}}N(false);}},[z]),useEffect(()=>{d.length===x.length&&ve(d);},[d]),useEffect(()=>{if(R&&A){let T=parseInt(A,10);if(R.data[T]&&(!B[R.ix]||!B[R.ix][A])){P(true);let L=R.data[A];typeof L=="string"?Ks(L,o,i,[],void 0).then(q=>{let Q=cS(q);E({...B,[R.ix]:{...B[R.ix],[T]:Q}});}).catch(q=>{console.error(q);}).finally(()=>{P(false);}):(E({...B,[R.ix]:{...B[R.ix],[T]:L}}),P(false));}}},[A,R]);let ee=(T,L)=>{let q=T===L?"":`-${T}`.toLowerCase();if(R){let Q=R.data.length>1&&A?`-${parseInt(A,10)+1}`:"";return `${yt(R.fileName)}${q}${Q}.${L.toLowerCase()}`}return `${q}.${L}`},re=async T=>{if(R){F(true);let L=new Yy,q=ee(T,T);try{switch(T){case Yn.json.extension:L.file(q,JSON.stringify(oe));break;case Yn.csv.extension:L.file(q,csvFormat(oe));break;case Yn.xlsx.extension:{let{utils:Q,write:K}=await import('xlsx'),ie=Q.book_new();Q.book_append_sheet(ie,Q.json_to_sheet(oe),q.substring(0,30));let he=K(ie,{bookType:"xlsx",bookSST:!0,type:"binary"});L.file(q,he,{binary:!0});break}default:break}L.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:9}}).then(Q=>{F(!1),saveAs(Q,ee(T,"zip"));});}catch(Q){console.error(g.error_generating,Q),F(false);}}},oe=useMemo(()=>R&&B[R.ix]&&B[R.ix][A]?B[R.ix][A]:[],[B,R,A]),_=useMemo(()=>{if(d&&d.length>0&&d.length===x.length){let T=d.map(L=>({value:`${L.ix}`,label:L.title}));return jsx(Select,{disabled:!R,style:{flex:"1"},value:`${R?.ix}`,onChange:L=>{let q=d.find(Q=>`${Q.ix}`===L);j(q);},data:T,icon:jsx(IconDatabase,{size:16})})}else return ""},[d,R,x]);return jsxs(Stack,{className:"cms-section-options-data",spacing:"xs",children:[jsx(LoadingOverlay,{visible:w,overlayBlur:2}),d.length===0&&!w&&jsx(Alert,{icon:jsx(IconAlertCircle,{size:"1rem"}),title:"Oops!",children:g.no_data_src}),d.length>1&&d.length===x.length&&!w&&jsx(Input.Wrapper,{label:`${g.choose_data_src}:`,children:jsx(Group,{spacing:"xs",children:_})}),R&&A&&jsx(Stack,{spacing:"xs",children:jsx(Input.Wrapper,{label:`${g.preview}
8
- ${oe.length>c?g.rows_preview.replace("{nrows}",c):""}:`,children:jsxs(Group,{spacing:"xs",children:[jsx(Select,{disabled:!(R.data.length>1),style:{flex:"1"},value:A,onChange:T=>U(T),data:R.data.map((T,L)=>({value:`${L}`,group:typeof T=="string"?g.raw_group:g.formatted_group,label:typeof T=="string"?T:g.formatted_src.replace("{src}",R.title)})),icon:typeof R.data[A]=="string"?jsx(IconLink,{}):jsx(IconSparkles,{})}),jsx(CopyButton,{value:typeof R.data[A]=="string"?R.data[A]:"",timeout:2e3,children:({copied:T,copy:L})=>jsx(Tooltip,{label:T?g.copied:g.copy,withArrow:true,position:"top",children:jsx(ActionIcon,{variant:T?"filled":"subtle",onClick:L,disabled:typeof R.data[A]!="string",children:T?jsx(IconClipboardCheck,{size:16}):jsx(IconClipboardCopy,{size:16})})})})]})})}),R&&!O&&oe.length===0&&jsx(Alert,{icon:jsx(IconAlertCircle,{size:"1rem"}),title:"Oops!",children:g.error_preview}),R&&A&&!O&&oe.length===0&&jsx("a",{href:R.data[A],target:"_blank",rel:"noreferrer",children:jsx(Button,{leftIcon:jsx(IconExternalLink,{size:16}),fullWidth:true,children:g.open_in_window.replace("{src}",R.title)})}),jsxs(Stack,{pos:"relative",mih:"400px",spacing:"xs",children:[jsx(LoadingOverlay,{visible:O&&d.length>0,overlayBlur:2}),R&&!O&&oe.length>0&&jsxs(Fragment,{children:[jsx(rp,{data:oe.slice(0,c)}),jsx(Input.Wrapper,{label:`${g.download}:`,children:jsx(Button.Group,{children:Object.values(Yn).map(T=>jsx(Button,{leftIcon:jsx(T.icon,{size:24}),onClick:()=>re(T.extension),loading:G,fullWidth:true,children:T.extension},`format-${T.extension}`))})})]})]})]})}var Yn,pp,cS,Na=h(()=>{l();ce();np();de();Jr();en();qn();Lo();Le();$e();Po();so();Qe();Ws();_t();Kn();Yn={csv:{extension:"CSV",icon:IconFileTypeCsv},json:{extension:"JSON",icon:IconFileTypeJs},xlsx:{extension:"XLSX",icon:IconFileTypeXls}},pp={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.
9
- 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!"},cS=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};});var dS,Qn=h(()=>{l();ce();$e();Qe();dS={active:false,pdfParam:false,position:"DEFAULT",XlsxVizActive:false,pdfVariants:[],xlsxVariants:[],currentVariantPdfEnabled:false,currentVariantXlsxEnabled:false,isLoading:false,pdfAccessAllowed:false,xlsxAccessAllowed:false,sectionSelection:false,navBlockId:void 0},createContext(dS);});var mS,fS,gS,hS,ke,Yt=h(()=>{l();mS=e=>typeof e=="string"?e.replace(/&nbsp;<\/p>/g,"</p>"):e,fS=e=>typeof e=="string"&&e==="<p><br></p>"?"":e,gS=e=>typeof e=="string"?e.replace(/^<p>(.*)<\/p>$/,"$1"):e,hS=e=>e&&gS(fS(mS(e))),ke=hS;});function ae({id:e="",component:t="p",order:o=1,size:r="md",html:n,style:s={},append:a=jsx(Fragment,{}),isPreview:i=false,lineClamp:c="none"}){let u=SS(n),p=vS(n,i),m=s&&s.align?String(s.align):"left",f=Text,g={};return t==="h"?(f=Title,g={id:e,order:o}):g={component:t,size:r,lineClamp:c},jsxs(f,{align:m||u.align||"left",...g,children:[p,a]})}var SS,vS,we=h(()=>{l();SS=(e="<></>")=>{let t=null,o={replace:r=>(r instanceof Element&&!t&&(t=r.attribs,t.align=r.attribs.style?r.attribs.style.replace("text-align: ",""):"",delete t.children),r)};return e?(mp(e,o),t):{}},vS=(e="",t=false)=>{let o={replace:r=>{let{type:n}=r;if(r instanceof Element&&n==="tag"){let{name:s,attribs:a,children:i,parent:c}=r;if(s==="p"&&!c)return jsx(Fragment,{children:domToReact(i,o)});if(s==="a"){let{href:u,target:p}=a,m=u.indexOf("http")===0,f=!!(p&&p==="_blank"),g=jsx(Anchor,{...a,href:a.href,target:"_blank",children:domToReact(i,o)});return m||f||t?g:jsx(Anchor,{...a,href:a.href,children:domToReact(i,o)})}else {if(s==="strong")return jsx(Text,{component:"strong",children:domToReact(i,o)});if(s==="em")return jsx(Text,{component:"em",fs:"italic",children:domToReact(i,o)});if(s==="u")return jsx(Text,{component:"u",td:"underline",children:domToReact(i,o)});if(s==="sup")return jsx(Text,{component:"sup",style:{verticalAlign:"super",fontSize:"0.75em"},children:domToReact(i,o)});if(s==="sub")return jsx(Text,{component:"sub",style:{verticalAlign:"sub",fontSize:"0.75em"},children:domToReact(i,o)});if(s==="span")return jsx(Text,{component:"span",children:domToReact(i,o)});if(s==="br")return jsx("br",{})}return jsx(Fragment,{children:domToReact(i,o)})}else if(r instanceof Text$1&&r.type==="text")return jsx(Fragment,{children:r.data})}};return mp(e,o)};});function De(e){let{content:t,style:o={}}=e,{print:r}=Ze(),n=jsx(ae,{component:"span",html:t,isPreview:true}),s=useMemo(()=>r?jsx("div",{className:"bespoke-inner-tooltip-notification",children:jsx(Notification,{icon:jsx(IconInfoCircle,{size:"1.1rem"}),withCloseButton:false,withBorder:true,styles:{root:{boxShadow:"none"}},children:n})},"tooltip-notification"):jsx("div",{className:"bespoke-inner-tooltip",style:o,children:jsx(Tooltip,{label:n,withArrow:true,withinPortal:true,multiline:true,maw:220,children:jsx(ActionIcon,{size:"1.5rem",children:jsx(IconInfoCircle,{})})})},"tooltip"),[r,t,o]);return jsx(Fragment,{children:s})}var Qt=h(()=>{l();Zt();we();});function Fa({paragraph:e,tooltip:t,settings:o}){let r=ke(t);return jsx(ae,{component:"p",html:e,style:o,append:t?jsx(De,{content:r,style:{display:"inline-block",verticalAlign:"bottom"}}):jsx(Fragment,{})})}var hp=h(()=>{l();Yt();Qt();we();});function ye({iconType:e="none",iconVariant:t="transparent",icon:o="",iconRadius:r="md",iconSize:n="md",iconPadding:s="1",blockType:a}){let[i,c]=useState(void 0),u=e==="custom"?o:`/api/cms/read/icons/${e}/icon.svg?name=${o}`,p=/^.*\.svg*$/.test(u)||e==="tabler";return useEffect(()=>{p&&On.get(u,{responseType:"text"}).then(f=>f.data).then(c).catch(()=>{});},[e,p,u]),jsx(Fragment,{children:e!=="none"&&o&&o!==""&&!!(i||!p)&&jsx(ThemeIcon,{className:`bespoke-${a}-icon-wrapper`,variant:t,radius:r,size:n,p:parseInt(s),dangerouslySetInnerHTML:i&&p?{__html:i}:void 0,children:p?null:jsx(Image,{src:u,alt:"Title Icon"})})})}var Jt=h(()=>{l();});var ho,bp,yp,Sp,vp,Je,Ge,vr,He=h(()=>{l();de();ho={display:{label:"Size",defaultValue:"block",options:[{label:"Full Width",value:"block"},{label:"Inline",value:"inline"}]}},bp={useProxy:{label:"Use proxy (avoid CORS)",defaultValue:"false",options:[{label:"No",value:"false"},{label:"Yes",value:"true"}]}},{[S.IMAGE]:{...ho},[S.PARAGRAPH]:{...ho},[S.SUBTITLE]:{...ho},[S.SELECTOR]:{...ho},[S.STAT]:{...ho},[S.VIZ]:{...ho},[S.TITLE]:{order:{label:"Importance",defaultValue:"1",options:[{label:"1",value:"1"},{label:"2",value:"2"},{label:"3",value:"3"},{label:"4",value:"4"},{label:"5",value:"5"},{label:"6",value:"6"}]},search:{label:"Search on Click",defaultValue:"off",options:[{label:"Off",value:"off"},{label:"Inline",value:"inline"},{label:"Modal",value:"modal"}]},addComparisonName:{label:"Show member name on comparison mode",defaultValue:"no",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]},...ho},[S.GENERATOR]:{...bp},[S.SECTION_FLAG]:{...bp},[S.NAV]:{variant:{label:"Nav variant",defaultValue:"inline",options:[{label:"Inline",value:"inline"},{label:"Fixed",value:"fixed"},{label:"Jump",value:"jump"}]},min:{label:"Min Title level",defaultValue:"1",options:[{label:"1",value:"1"},{label:"2",value:"2"},{label:"3",value:"3"},{label:"4",value:"4"},{label:"5",value:"5"},{label:"6",value:"6"}]},max:{label:"Max Title level",defaultValue:"6",options:[{label:"1",value:"1"},{label:"2",value:"2"},{label:"3",value:"3"},{label:"4",value:"4"},{label:"5",value:"5"},{label:"6",value:"6"}]},icons:{label:"Show icons",defaultValue:"yes",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]},titlePosition:{label:"Title position",defaultValue:"left",options:[{label:"Left",value:"left"},{label:"Top",value:"top"},{label:"Right",value:"right"},{label:"Bottom",value:"bottom"}]}},[S.MULTIHIERARCHY_SELECTOR]:{...ho}},yp={left:"flex-start",right:"flex-end",justify:"stretch"},Sp={justify:"apart"},vp={justify:"space-between"},Je=e=>yp[e]?yp[e]:e,Ge=e=>Sp[e]?Sp[e]:e,vr=e=>vp[e]?vp[e]:e;});function za({subtitle:e,title:t,value:o,tooltip:r,settings:n,_iconType:s,_iconVariant:a,_icon:i,_iconRadius:c,_iconSize:u,_iconPadding:p}){if(!t&&!o&&!e)return null;let m=n&&n.align?n.align:"left";return jsxs(Group,{spacing:"md",position:Ge(m),children:[jsx(ye,{blockType:"stat",iconType:s,iconVariant:a,iconRadius:c,iconSize:u,icon:i,iconPadding:p}),jsxs(Stack,{spacing:0,children:[t&&jsx(ae,{component:"div",size:"md",html:t,style:n}),o&&jsx(ae,{component:"div",size:"xl",html:o,style:n}),e&&jsx(ae,{component:"div",size:"sm",html:e,style:n})]},"stat"),r&&jsx(De,{content:r})]})}var Tp=h(()=>{l();Qt();Jt();we();He();});function $a({subtitle:e,tooltip:t,settings:o}){let r=e||"<span class='cr-block-placeholder'>Small subtitle.</span>",n=o&&o.align?o.align:"left";return jsxs(Group,{spacing:"sm",position:Ge(n),children:[jsx(ae,{size:"sm",html:r}),t&&jsx(De,{content:t,style:{display:"inline-flex"}})]})}var Ep=h(()=>{l();Qt();we();He();});function Ga({title:e,tooltip:t,slug:o,_iconType:r,_iconVariant:n,_icon:s,settings:a,_iconRadius:i,_iconSize:c,_iconPadding:u,asComparison:p=false}){let{print:m}=Ze(),f=ke(e)||"<span class='cr-block-placeholder'>Title</span>",g=a&&a.order?parseInt(a.order,10):1,d=g<=6?g:1,v=a&&a.search?a.search:"off",x=a&&a.align?a.align:"left",C=bt(),R=X(B=>B.status.previews),A=(p?C.status.previews:R).map(B=>B.name).join(" | "),U=jsxs(Group,{children:[jsx(ye,{blockType:"title",iconType:r,iconVariant:n,iconRadius:i,iconSize:c,icon:s,iconPadding:u}),jsx(ae,{id:o||void 0,component:"h",order:d,style:a,html:f})]}),G=xr(U,v),F=a&&a.addComparisonName==="yes"&&C.active;return jsxs(Group,{spacing:"sm",position:Ge(x),children:[jsxs("div",{children:[m?U:G,F&&jsx(Text,{className:"bespoke-comparison-title",children:A})]}),t&&jsx(De,{content:t})]})}var Cp=h(()=>{l();Yt();Jt();we();Ne();fo();ce();Zt();Qt();He();});function ja(e){let{name:t,settings:o,options:r,id:n,defaultValue:s,section:a,component:i,asComparison:c,hideLabel:u,resetSectionVars:p}=e,{print:m}=Ze(),f=jS(n),g=Hn(n,a,f,c,p==="true"),d=c?`${f}Compare`:f,[v,x]=useState(s),[C,R]=useState(Ap(s,[])),k=JSON.stringify(r),A=o[ft.DISABLED]||false,U=useMemo(()=>r?.map(P=>({value:P.id,label:P.label,imageUrl:P.imageUrl})),[k]),G=m?r.filter(P=>C.includes(P.id)).map(P=>P.label).join(", "):"",F=m&&v&&r.find(P=>P.id===v)?.label||"",B=e.hideLabel==="true"?jsx(Fragment,{}):jsx(ae,{component:"div",html:t,size:"sm",style:o});if(useEffect(()=>{if(!A){let w=new URLSearchParams(window.location.search).get(d)||s;w&&(e.type===Ie.SINGLE?x(w):R(Ap(w,s)));}},[window.location.search,s]),U.length<=1)return jsx(Fragment,{});let E=P=>{R(P),g(P.join(","));},O=P=>{x(P),g(P);};return jsx(Fragment,{children:m?jsxs(Box,{style:{display:"flex",alignItems:"center"},children:[B,jsx(Button,{ml:"sm",radius:"xl",variant:"outline",children:e.type===Ie.SINGLE?F:G})]}):jsx(Box,{children:{[Ie.SINGLE]:i===xn.SEGMENTED_CONTROL?jsxs("div",{children:[jsx(Text,{size:"sm",fw:500,display:u==="true"?"none":"block",children:B}),jsx(SegmentedControl,{data:U,disabled:A,value:U.map(P=>P.value).includes(v)?v:"",onChange:O,fullWidth:true})]}):jsx(Select,{label:B,data:U,disabled:A,value:v,itemComponent:KS,onChange:O,styles:{label:{display:u==="true"?"none":"block"}}}),[Ie.MULTI]:jsx(MultiSelect,{label:B,data:U,value:C,onChange:E,disabled:A,styles:{label:{display:u==="true"?"none":"block"}}})}[e.type]})})}var jS,Ap,KS,Ip=h(()=>{l();we();de();Ne();Zt();jS=e=>`selector${e}id`,Ap=(e,t)=>e&&typeof e=="string"?e.split(","):t,KS=forwardRef(function({imageUrl:t,label:o,...r},n){return jsx("div",{ref:n,...r,children:jsxs(Group,{noWrap:true,children:[t&&!["","undefined"].includes(t)&&jsx(Box,{component:"img",w:25,h:25,src:t}),jsx("div",{children:jsx(Text,{size:"sm",children:o})})]})})});});function es(){return jsx("div",{children:"Generator"})}var Lp=h(()=>{l();});function Ka(e){let{alt:t,src:o,desc:r,title:n,settings:s,...a}=e,i=ke(t),c=ke(o),u=ke(r),p=jsx("img",{src:c,alt:i,style:a}),m=s&&s.align?String(s.align):"left";return (u&&u.length||n&&n.length)&&(p=jsxs(Stack,{className:"bespoke-Image-wrapper",align:Je(m),spacing:"sm",children:[n&&jsx(ae,{component:"p",html:n,style:s}),p,r&&jsx(ae,{component:"p",size:"sm",html:r,style:s})]})),c&&i?p:jsx(Center,{mih:100,bg:"white",children:jsx(Badge,{color:"gray",variant:"outline",children:"IMAGE"},"type")})}var Op=h(()=>{l();Yt();we();He();});function rn(){return rn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r]);}return e},rn.apply(this,arguments)}var _p=h(()=>{l();});function nn(){return nn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r]);}return e},nn.apply(this,arguments)}var Bp=h(()=>{l();});function er(e,t,o){var r,n=(r=o.initialDeps)!=null?r:[],s;return function(){var a;o.key&&o.debug!=null&&o.debug()&&(a=Date.now());var i=e(),c=i.length!==n.length||i.some(function(d,v){return n[v]!==d});if(!c)return s;n=i;var u;if(o.key&&o.debug!=null&&o.debug()&&(u=Date.now()),s=t.apply(void 0,i),o.key&&o.debug!=null&&o.debug()){var p=Math.round((Date.now()-a)*100)/100,m=Math.round((Date.now()-u)*100)/100,f=m/16,g=function(v,x){for(v=String(v);v.length<x;)v=" "+v;return v};console.info("%c\u23F1 "+g(m,5)+" /"+g(p,5)+" ms",`
7
+ </p>`},hu=(e,t,o)=>{let r=t.find(n=>{let s=n.content?.pattern;if(!s)return false;try{return new RegExp(s,"gm").test(e)}catch{return false}});if(r){if(r.content?.useProxy)return `${process.env.NEXT_PUBLIC_REPORTS_BASE_URL}/api/cms/url/proxy?url=${encodeURIComponent(e)}&wrapper=false`;try{let s={envs:{...Gt()},...o?{session:o}:{}},i=An({vars:["url","libs","session"],logic:r.content.logic},s)(e);if(i instanceof Promise)console.warn(`[DataSource] Logic for "${r.name}" is async, which is not supported in this context. Use useProxy=true for async logic.`);else if(i?.axiosConfig?.url!=null){let{url:c,headers:u}=i.axiosConfig;return u&&Object.keys(u).length>0?{url:c,headers:u}:c}}catch(n){console.error(`[DataSource] Failed to apply logic for URL "${e}":`,n.message);}}return e},Wn=(e,t,o)=>typeof e=="string"?hu(e,t,o):Array.isArray(e)?e.map(r=>typeof r=="string"?hu(r,t,o):r):e,jb=(e,t,o={},r=Wb,n=null,s={},a={},i=[],c)=>{let u;try{u=wn({vars:["variables"],logic:e},t,r,s,a)(o),u.data=Wn(u.data,i,c),u._downloadUrl&&(u.__downloadUrl=Wn(u.__downloadUrl,i,c));}catch(d){return console.error(`Parsing Error in propify (ID: ${n})`),console.error(`Error message: ${d.message}`),{error:`${d}`,config:gu}}if(typeof u!="object")return {error:"Visualization JS code must return an object",config:gu};let p=u.dataFormat?u.dataFormat:d=>{let x=Array.isArray(u.data)&&u.data.length>1&&u.data.some(w=>typeof w=="string")?d:[d];return dataConcat(x,"data")};delete u.dataFormat;let m=u.linksFormat||void 0;delete u.linksFormat;let f=u.nodesFormat||void 0;delete u.nodesFormat;let g=u.topojsonFormat||void 0;return delete u.topojsonFormat,{config:u,dataFormat:p,linksFormat:m,nodesFormat:f,topojsonFormat:g}},Xo=jb;});var bu=h(()=>{l();le();H({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 yu=h(()=>{l();le();H({name:"abs",description:"Simple Absolute Value.",logicFactory(){return e=>Math.abs(e)},inputType:"number",testValue:"-123",type:"formatter"});});var Xb,Su=h(()=>{l();le();Xb=()=>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,s=>`${parseInt(s)+1}k`):n.indexOf(",")===n.length-8&&(n=n.replace(/,000,000$/g,"M").replace(/([0-9]+)(,999,999$)/g,s=>`${parseInt(s)+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"},H({name:"bucket",description:"Sanitizes bucket strings to '< n', 'n1 - n2', and 'n+'",logicFactory:Xb,inputType:"number",testValue:"1234",type:"formatter"});});var vu=h(()=>{l();le();H({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 xu=h(()=>{l();le();H({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 Tu=h(()=>{l();le();H({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 Ru=h(()=>{l();le();H({name:"formatFieldName",description:"Based on field name returns a string",logicFactory(){return e=>{if(e.contentType.toLowerCase()==="stat"){if(e.field==="title")return "Stat label";if(e.field==="value")return "Stat value";if(e.field==="subtitle")return "Stat subtitle";if(e.field==="tooltip")return "Tooltip text"}return e.contentType.toLowerCase()==="section"&&e.field==="short"?"Short title":e.contentType.toLowerCase()==="description"&&e.field==="description"?"Paragraph":e.field}},inputType:"object",testValue:'{"field":"title","contentType":"stat"}',type:"formatter"});});var Eu=h(()=>{l();le();H({name:"grewTo",description:"Returns the text with grow direction: 'declined from', 'grew to' o 'stayed at'",logicFactory(){return e=>e<0?"declined from":e>0?"grew to":"stayed at"},inputType:"number",testValue:"-1234",type:"formatter"});});var ku=h(()=>{l();le();H({name:"grewWord",description:"Returns either 'grew', 'declined', or 'stayed' depending on the provided number's sign.",logicFactory(){return e=>e<0?"declined":e>0?"grew":"stayed"},inputType:"number",testValue:"-1234",type:"formatter"});});var Cu=h(()=>{l();le();H({name:"growing",description:"Returns either 'declining', 'growing' depending on the provided number's sign.",logicFactory(){return e=>e<0?"declining":"growing"},inputType:"number",testValue:"-1234",type:"formatter"});});var sy,wu=h(()=>{l();le();sy=()=>function(t){let{curr:o,currMoe:r=0,prev:n,prevMoe:s=0}=t,a;if(r||s){let i=(-n/o**2)**2*r**2,c=(1/o)**2*s**2;a=Math.sqrt(i+c);}else a=(o-n)/n;return a*100},H({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:sy,inputType:"object",testValue:'{"curr":10,"currMoe":0,"prev":13,"prevMoe":0}',type:"formatter"});});var Au=h(()=>{l();le();H({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 Pu=h(()=>{l();le();H({name:"growthWord",description:"Returns either 'growth' or 'decline' depending on the provided number's sign.",logicFactory(){return e=>e<0?"decline":"growth"},inputType:"number",testValue:"-1234",type:"formatter"});});var Iu=h(()=>{l();le();H({name:"highWord",description:"Returns either 'higher than', 'lower than', or 'approximately the same as' depending on the provided number's sign.",logicFactory(){return e=>e<0?"lower than":e>0?"higher than":"approximately the same as"},inputType:"number",testValue:"0",type:"formatter"});});var Lu=h(()=>{l();le();H({name:"increaseWord",description:"Returns either 'increase', 'decrease', or 'change' depending on the provided number's sign.",logicFactory(){return e=>e<0?"decrease":e>0?"increase":"change"},inputType:"number",testValue:"1234",type:"formatter"});});var Ou=h(()=>{l();le();H({name:"increasedWord",description:"Returns either 'increased', 'decreased', or 'remained the same' depending on the provided number's sign.",logicFactory(){return e=>e<0?"decreased":e>0?"increased":"remained the same"},inputType:"number",testValue:"0",type:"formatter"});});var _u=h(()=>{l();le();H({name:"increasing",description:"Returns either 'decreasing', 'increasing' or 'maintaining' depending on the provided number's sign.",logicFactory(){return e=>e<0?"decreasing":e>0?"increasing":"maintaining"},inputType:"number",testValue:"-1234",type:"formatter"});});var Bu=h(()=>{l();le();H({name:"largerThan",description:"Returns either 'higher than', 'lower than', or 'approximately the same as' depending on the provided number's sign",logicFactory(){return e=>e<0?"smaller than":e>0?"larger than":"the same as"},inputType:"number",testValue:"-1234",type:"formatter"});});var Mu=h(()=>{l();le();H({name:"list",description:"Joins an array of strings together, adding commas and 'and' when necessary.",logicFactory(){return e=>e.reduce((t,o,r)=>(r?r===e.length-1&&r===1?t+=` and ${o}`:r===e.length-1?t+=`, and ${o}`:t+=`, ${o}`:t+=o,t),"")},inputType:"object",testValue:'["foo","bar","bee"]',type:"formatter"});});var Nu=h(()=>{l();le();H({name:"longWord",description:"",logicFactory(){return e=>e<0?"shorter":e>0?"longer":"similar"},inputType:"number",testValue:"5",type:"formatter"});});var Du=h(()=>{l();le();H({name:"lowerCaseFirst",description:"Converts the first letter of a string to lowercase",logicFactory(){return e=>typeof e=="string"?e.charAt(0).toLowerCase()+e.slice(1):e},inputType:"string",testValue:"foo",type:"formatter"});});var Fu=h(()=>{l();le();H({name:"moreFewerWord",description:"",logicFactory(){return e=>e<0?"fewer":"more"},inputType:"number",testValue:"-5",type:"formatter"});});var Vu=h(()=>{l();le();H({name:"moreLess",description:"Returns either 'more' or 'less' depending on the provided number's sign.",logicFactory(){return e=>e<0?"less":"more"},inputType:"number",testValue:"-5",type:"formatter"});});var zu=h(()=>{l();le();H({name:"moreLess",description:"Returns either 'more than', 'less than', or 'approximately the same' depending on the provided number's sign.",logicFactory(){return e=>e<0?"less than":e>0?"more than":"approximately the same"},inputType:"number",testValue:"-5",type:"formatter"});});var $u=h(()=>{l();le();H({name:"olderWord",description:"",logicFactory(){return e=>e<0?"getting younger":e>0?"getting older":"staying the same age"},inputType:"number",testValue:"-5",type:"formatter"});});var Uu=h(()=>{l();le();H({name:"olderYounger",description:"",logicFactory(){return e=>e<0?"younger than":e>0?"older than":"the same age as"},inputType:"number",testValue:"-5",type:"formatter"});});var Gu=h(()=>{l();le();H({name:"plural",description:"Pluralizes a word.",logicFactory(){return e=>e.replace(/\w$/g,t=>t==="y"?"ies":`${t}s`)},inputType:"string",testValue:"Foo",type:"formatter"});});var Hu=h(()=>{l();le();H({name:"pxToInt",description:"Takes a pixel value and converts it to an integer",logicFactory(){return e=>parseInt(e.replace(/\D+/g,""),10)},inputType:"string",testValue:"12px",type:"formatter"});});var Wu=h(()=>{l();le();H({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 qu=h(()=>{l();le();H({name:"stripEntities",description:"Removes non breaking spaces & other html entities from a string",logicFactory(){return e=>typeof e=="string"?String(e).replace(/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});/ig," "):e},inputType:"string",testValue:"<b>MyText</b>",type:"formatter"});});var Ku=h(()=>{l();le();H({name:"stripHTML",description:"Converts html tags to spaces, then removes redundant spaces",logicFactory(){return e=>{let t={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'","&#x60;":"`","&nbsp;":""},o=`(?:${Object.keys(t).join("|")})`,r=RegExp(o),n=RegExp(o,"g"),s=String(e).replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();return r.test(s)?s.replace(n,a=>t[a]):s}},inputType:"string",testValue:"<b>My text</b>",type:"formatter"});});var Yu=h(()=>{l();le();H({name:"stripOL",description:"Removes ordered list wrapper tags from a string.",logicFactory(){return e=>e.replace(/<ol>/g,"").replace(/<\/ol>/g,"")},inputType:"string",testValue:"<ol><li>My list</li></ol>",type:"formatter"});});var Xu=h(()=>{l();le();H({name:"stripP",description:"Removes all paragraph tags from a string.",logicFactory(){return e=>e.replace(/<p>/g,"").replace(/<\/p>/g,"")},inputType:"string",testValue:"<p>My p</p>",type:"formatter"});});var Qu=h(()=>{l();le();H({name:"stripUL",description:"Removes unordered list wrapper tags from a string.",logicFactory(){return e=>e.replace(/<ul>/g,"").replace(/<\/ul>/g,"")},inputType:"string",testValue:"<ul><li>My list</li></ul>",type:"formatter"});});var Zu=h(()=>{l();le();H({name:"toKebabCase",description:"Takes a camelCase or PascalCase string and converts it to kebab-case.",logicFactory(){return e=>typeof e=="string"?(e=e.charAt(0).toLowerCase()+e.substring(1),e.replace(/([A-Z])/g,"-$1").toLowerCase()):"invalid string passed to toKebabCase()"},inputType:"string",testValue:"camelCaseText",type:"formatter"});});var Ju=h(()=>{l();le();H({name:"toSpacedCase",description:"Takes a camelCase or PascalCase string and adds spaces (I know Spaced Case isn't a thing, deal with it).",logicFactory(){return e=>typeof e=="string"?e.replace(/([A-Z])/g," $1").toLowerCase().trim():"invalid string passed to toSpacedCase()"},inputType:"string",testValue:"camelCaseText",type:"formatter"});});var ep=h(()=>{l();le();H({name:"upperCaseFirst",description:"Converts the first letter of a string to uppercase",logicFactory(){return e=>e.charAt(0).toUpperCase()+e.slice(1)},inputType:"string",testValue:"my name",type:"formatter"});});var tp=h(()=>{l();bu();yu();Su();vu();xu();Tu();Ru();Eu();ku();Cu();wu();Au();Pu();Iu();Lu();Ou();_u();Bu();Mu();Nu();Du();Fu();Vu();zu();$u();Uu();Gu();Hu();Wu();qu();Ku();Yu();Xu();Qu();Zu();Ju();ep();});function je(e){let t=useContext(By);return e?t[e]??t:t}var By,_t=h(()=>{l();By=createContext({});});function op({direction:e,onClick:t,visible:o}){return o?jsx(ActionIcon,{className:`bespoke-sortable-table-arrow bespoke-sortable-table-arrow-${e}`,variant:"filled",size:"md",sx:{position:"absolute",top:"50%",[e==="left"?"left":"right"]:"16px",zIndex:10,opacity:.55,"&:hover":{opacity:1}},onClick:t,children:e==="left"?jsx(IconArrowLeft,{size:16}):jsx(IconArrowRight,{size:16})}):null}function rp({data:e}){let t=useRef(null),[o,r]=useState(false),[n,s]=useState(false),[a,i]=useState(false),c=useMemo(()=>(e&&Array.isArray(e)&&e[0]?Object.keys(e[0]):[]).filter(m=>!m.startsWith("_")).map(m=>({accessorKey:m,header:m,enableSorting:true})),[e]);return useEffect(()=>{let u=()=>{if(t.current){let{scrollWidth:p,clientWidth:m,scrollLeft:f}=t.current;r(p>m),s(f>0),i(f+m<p-1);}};return u(),window.addEventListener("resize",u),t.current?.addEventListener("scroll",u),()=>{window.removeEventListener("resize",u),t.current?.removeEventListener("scroll",u);}},[e]),jsxs("div",{className:"bespoke-sortable-table",style:{position:"relative"},children:[jsx(MantineReactTable,{columns:c,data:e,enableBottomToolbar:false,enableColumnActions:false,enablePagination:false,enableSorting:true,enableTopToolbar:false,layoutMode:"grid",enableStickyHeader:true,initialState:{density:"xs"},mantineTableProps:{sx:{tableLayout:"fixed"}},mantineTableContainerProps:{ref:t,sx:{minHeight:100,maxHeight:350,overflowX:"auto"}},mantineTableBodyCellProps:{p:"5px !important",sx:{textWrap:"wrap"}},defaultColumn:{minSize:50,maxSize:150}}),jsx(op,{direction:"left",visible:o&&n,onClick:()=>{t.current&&t.current.scrollBy({left:-150,behavior:"smooth"});}}),jsx(op,{direction:"right",visible:o&&a,onClick:()=>{t.current&&t.current.scrollBy({left:150,behavior:"smooth"});}})]})}var np=h(()=>{l();});function Qo(e){let t={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'","&#x60;":"`","&nbsp;":""},o=`(?:${Object.keys(t).join("|")})`,r=RegExp(o),n=RegExp(o,"g"),s=String(e).replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();return r.test(s)?s.replace(n,a=>t[a]):s}var qn=h(()=>{l();});function Pa(e){return typeof e=="string"?String(e).replace(/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});/ig," "):e}var sp=h(()=>{l();});function Hy(e){return e?Gy(Pa(Qo(e)),{replacement:"-",remove:/[*+~.()'"!:@]/g,lower:true,strict:true,trim:true}):""}var yt,en=h(()=>{l();qn();sp();yt=Hy;});var Zo,jn,Kn=h(()=>{l();Zo="HTML",jn=({config:e})=>!e||!e.html?null:jsx("div",{className:"bespoke-html",dangerouslySetInnerHTML:{__html:e.html}});});function Ma(e){let{section:t}=e,o=Ot(),r=useRouter(),n=X(T=>T.status.isCMS),s=X(T=>T.status.currentLocale),a=r.locale,i=n?s:a,c=50,u=po(i),p=Ho(),m=Ee(),f=je("options"),g={...pp,...f.data_tab},[d,v]=useState([]),[x,w]=useState([]),[R,k]=useState(),[P,U]=useState(),[G,V]=useState(false),[B,E]=useState({}),[O,A]=useState(true),[C,N]=useState(true),{sectionVariables:Z,setSectionVariables:W,resetSectionVariables:$}=_e(t.id),J=t.blocks||[],M=X(T=>T),z=useMemo(()=>J.reduce((T,L)=>{let q=M.records.entities.block[L],Q=M.variables.variables[L],K=M.variables.status[L];return q&&(S.GENERATOR===q.type&&Q._downloadEnabled===true&&K.allowed||S.VIZ===q.type&&K.allowed)&&(T[L]={entity:q,variables:M.variables.variables[L],status:M.variables.status[L],inputVariablesFlat:q.inputs.reduce((ie,he)=>({...ie,...M.variables.variables[he]}),M.variables.attributes)}),T},{}),[J]),F=T=>{w(L=>L.includes(T)?L:[...L,T]);},Y=T=>{v(L=>(L.find(Q=>Q.ix===T.ix)?L:[...L,T]).sort((Q,K)=>Q.ix>K.ix?1:-1));};function ve(T){!R&&T[0]&&j(T[0]);}function j(T){k(T),U("0");}useEffect(()=>{let T=async(L,q,Q)=>{let K=dataLoad.bind({});return new Promise((ie,he)=>{K(q,null,null,(it,Ce)=>{if(it)he(it);else {let xe=Q instanceof Function?Q(Ce):Ce;L.data.unshift(xe),Y(L),ie(Ce);}});})};if(d.length===0&&x.length===0){let L=0;for(let q of Object.values(z)){let Q=q.entity;if([S.GENERATOR,S.SECTION_FLAG].includes(Q.type)){let K=q.variables._downloadData||q.variables._downloadUrl||q.status.api;if(K){let ie=[];typeof K=="string"?ie=K.split("|||"):ie=[K],ie=Wn(ie,p,m);let he=q.variables._downloadTitle||`${g.data_source} ${L+1}`,it=q.variables._downloadFileName||he;Y({ix:L,id:Q.id,title:Qo(he),fileName:it,data:Array.isArray(ie)?ie:[ie],loading:false,type:S.GENERATOR}),F(L),L++;}}else if(Q.type===S.VIZ){let K=kt(Q),ie=q.inputVariablesFlat,he={variables:ie},it=gt({logic:K.logic},u,he).logic,Ce={router:r,section:{variables:Z,setVariables:W,resetVariables:$}},xe=Xo(it,u,ie,i,Q.id,{},Ce,p,m),Tt=xe.config._downloadTitle||xe.config.title||`${g.viz_source} ${L+1}`,$t=xe.config._downloadFileName||Tt;if(xe.config._downloadEnabled!==false&&xe.config.type!==Zo)try{let Rt=xe.config._downloadUrl||xe.config.data,_r=typeof Rt=="string"?[Rt]:Rt,Eo=xe.dataFormat instanceof Function?xe.dataFormat:!1,ko=xe.config._downloadDataFormat instanceof Function?xe.config._downloadDataFormat:!1;T({ix:L,id:Q.id,title:Qo(Tt),fileName:$t,data:_r,loading:!1,type:S.VIZ},Rt,ko||Eo),F(L),L++;}catch(Rt){console.error("DataLoad catch",Rt);}}}N(false);}},[z]),useEffect(()=>{d.length===x.length&&ve(d);},[d]),useEffect(()=>{if(R&&P){let T=parseInt(P,10);if(R.data[T]&&(!B[R.ix]||!B[R.ix][P])){A(true);let L=R.data[P];typeof L=="string"?Ks(L,o,i,[],void 0).then(q=>{let Q=cS(q);E({...B,[R.ix]:{...B[R.ix],[T]:Q}});}).catch(q=>{console.error(q);}).finally(()=>{A(false);}):(E({...B,[R.ix]:{...B[R.ix],[T]:L}}),A(false));}}},[P,R]);let ee=(T,L)=>{let q=T===L?"":`-${T}`.toLowerCase();if(R){let Q=R.data.length>1&&P?`-${parseInt(P,10)+1}`:"";return `${yt(R.fileName)}${q}${Q}.${L.toLowerCase()}`}return `${q}.${L}`},re=async T=>{if(R){V(true);let L=new Yy,q=ee(T,T);try{switch(T){case Yn.json.extension:L.file(q,JSON.stringify(oe));break;case Yn.csv.extension:L.file(q,csvFormat(oe));break;case Yn.xlsx.extension:{let{utils:Q,write:K}=await import('xlsx'),ie=Q.book_new();Q.book_append_sheet(ie,Q.json_to_sheet(oe),q.substring(0,30));let he=K(ie,{bookType:"xlsx",bookSST:!0,type:"binary"});L.file(q,he,{binary:!0});break}default:break}L.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:9}}).then(Q=>{V(!1),saveAs(Q,ee(T,"zip"));});}catch(Q){console.error(g.error_generating,Q),V(false);}}},oe=useMemo(()=>R&&B[R.ix]&&B[R.ix][P]?B[R.ix][P]:[],[B,R,P]),_=useMemo(()=>{if(d&&d.length>0&&d.length===x.length){let T=d.map(L=>({value:`${L.ix}`,label:L.title}));return jsx(Select,{disabled:!R,style:{flex:"1"},value:`${R?.ix}`,onChange:L=>{let q=d.find(Q=>`${Q.ix}`===L);j(q);},data:T,icon:jsx(IconDatabase,{size:16})})}else return ""},[d,R,x]);return jsxs(Stack,{className:"cms-section-options-data",spacing:"xs",children:[jsx(LoadingOverlay,{visible:C,overlayBlur:2}),d.length===0&&!C&&jsx(Alert,{icon:jsx(IconAlertCircle,{size:"1rem"}),title:"Oops!",children:g.no_data_src}),d.length>1&&d.length===x.length&&!C&&jsx(Input.Wrapper,{label:`${g.choose_data_src}:`,children:jsx(Group,{spacing:"xs",children:_})}),R&&P&&jsx(Stack,{spacing:"xs",children:jsx(Input.Wrapper,{label:`${g.preview}
8
+ ${oe.length>c?g.rows_preview.replace("{nrows}",c):""}:`,children:jsxs(Group,{spacing:"xs",children:[jsx(Select,{disabled:!(R.data.length>1),style:{flex:"1"},value:P,onChange:T=>U(T),data:R.data.map((T,L)=>({value:`${L}`,group:typeof T=="string"?g.raw_group:g.formatted_group,label:typeof T=="string"?T:g.formatted_src.replace("{src}",R.title)})),icon:typeof R.data[P]=="string"?jsx(IconLink,{}):jsx(IconSparkles,{})}),jsx(CopyButton,{value:typeof R.data[P]=="string"?R.data[P]:"",timeout:2e3,children:({copied:T,copy:L})=>jsx(Tooltip,{label:T?g.copied:g.copy,withArrow:true,position:"top",children:jsx(ActionIcon,{variant:T?"filled":"subtle",onClick:L,disabled:typeof R.data[P]!="string",children:T?jsx(IconClipboardCheck,{size:16}):jsx(IconClipboardCopy,{size:16})})})})]})})}),R&&!O&&oe.length===0&&jsx(Alert,{icon:jsx(IconAlertCircle,{size:"1rem"}),title:"Oops!",children:g.error_preview}),R&&P&&!O&&oe.length===0&&jsx("a",{href:R.data[P],target:"_blank",rel:"noreferrer",children:jsx(Button,{leftIcon:jsx(IconExternalLink,{size:16}),fullWidth:true,children:g.open_in_window.replace("{src}",R.title)})}),jsxs(Stack,{pos:"relative",mih:"400px",spacing:"xs",children:[jsx(LoadingOverlay,{visible:O&&d.length>0,overlayBlur:2}),R&&!O&&oe.length>0&&jsxs(Fragment,{children:[jsx(rp,{data:oe.slice(0,c)}),jsx(Input.Wrapper,{label:`${g.download}:`,children:jsx(Button.Group,{children:Object.values(Yn).map(T=>jsx(Button,{leftIcon:jsx(T.icon,{size:24}),onClick:()=>re(T.extension),loading:G,fullWidth:true,children:T.extension},`format-${T.extension}`))})})]})]})]})}var Yn,pp,cS,Na=h(()=>{l();ce();np();de();Jr();en();qn();Lo();Le();$e();Po();so();Qe();Ws();_t();Kn();Yn={csv:{extension:"CSV",icon:IconFileTypeCsv},json:{extension:"JSON",icon:IconFileTypeJs},xlsx:{extension:"XLSX",icon:IconFileTypeXls}},pp={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.
9
+ 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!"},cS=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};});var dS,Qn=h(()=>{l();ce();$e();Qe();dS={active:false,pdfParam:false,position:"DEFAULT",XlsxVizActive:false,pdfVariants:[],xlsxVariants:[],currentVariantPdfEnabled:false,currentVariantXlsxEnabled:false,isLoading:false,pdfAccessAllowed:false,xlsxAccessAllowed:false,sectionSelection:false,navBlockId:void 0},createContext(dS);});var mS,fS,gS,hS,ke,Yt=h(()=>{l();mS=e=>typeof e=="string"?e.replace(/&nbsp;<\/p>/g,"</p>"):e,fS=e=>typeof e=="string"&&e==="<p><br></p>"?"":e,gS=e=>typeof e=="string"?e.replace(/^<p>(.*)<\/p>$/,"$1"):e,hS=e=>e&&gS(fS(mS(e))),ke=hS;});function ae({id:e="",component:t="p",order:o=1,size:r="md",html:n,style:s={},append:a=jsx(Fragment,{}),isPreview:i=false,lineClamp:c="none"}){let u=SS(n),p=vS(n,i),m=s&&s.align?String(s.align):"left",f=Text,g={};return t==="h"?(f=Title,g={id:e,order:o}):g={component:t,size:r,lineClamp:c},jsxs(f,{align:m||u.align||"left",...g,children:[p,a]})}var SS,vS,we=h(()=>{l();SS=(e="<></>")=>{let t=null,o={replace:r=>(r instanceof Element&&!t&&(t=r.attribs,t.align=r.attribs.style?r.attribs.style.replace("text-align: ",""):"",delete t.children),r)};return e?(mp(e,o),t):{}},vS=(e="",t=false)=>{let o={replace:r=>{let{type:n}=r;if(r instanceof Element&&n==="tag"){let{name:s,attribs:a,children:i,parent:c}=r;if(s==="p"&&!c)return jsx(Fragment,{children:domToReact(i,o)});if(s==="a"){let{href:u,target:p}=a,m=u.indexOf("http")===0,f=!!(p&&p==="_blank"),g=jsx(Anchor,{...a,href:a.href,target:"_blank",children:domToReact(i,o)});return m||f||t?g:jsx(Anchor,{...a,href:a.href,children:domToReact(i,o)})}else {if(s==="strong")return jsx(Text,{component:"strong",children:domToReact(i,o)});if(s==="em")return jsx(Text,{component:"em",fs:"italic",children:domToReact(i,o)});if(s==="u")return jsx(Text,{component:"u",td:"underline",children:domToReact(i,o)});if(s==="sup")return jsx(Text,{component:"sup",style:{verticalAlign:"super",fontSize:"0.75em"},children:domToReact(i,o)});if(s==="sub")return jsx(Text,{component:"sub",style:{verticalAlign:"sub",fontSize:"0.75em"},children:domToReact(i,o)});if(s==="span")return jsx(Text,{component:"span",children:domToReact(i,o)});if(s==="br")return jsx("br",{})}return jsx(Fragment,{children:domToReact(i,o)})}else if(r instanceof Text$1&&r.type==="text")return jsx(Fragment,{children:r.data})}};return mp(e,o)};});function De(e){let{content:t,style:o={}}=e,{print:r}=Ze(),n=jsx(ae,{component:"span",html:t,isPreview:true}),s=useMemo(()=>r?jsx("div",{className:"bespoke-inner-tooltip-notification",children:jsx(Notification,{icon:jsx(IconInfoCircle,{size:"1.1rem"}),withCloseButton:false,withBorder:true,styles:{root:{boxShadow:"none"}},children:n})},"tooltip-notification"):jsx("div",{className:"bespoke-inner-tooltip",style:o,children:jsx(Tooltip,{label:n,withArrow:true,withinPortal:true,multiline:true,maw:220,children:jsx(ActionIcon,{size:"1.5rem",children:jsx(IconInfoCircle,{})})})},"tooltip"),[r,t,o]);return jsx(Fragment,{children:s})}var Qt=h(()=>{l();Zt();we();});function Fa({paragraph:e,tooltip:t,settings:o}){let r=ke(t);return jsx(ae,{component:"p",html:e,style:o,append:t?jsx(De,{content:r,style:{display:"inline-block",verticalAlign:"bottom"}}):jsx(Fragment,{})})}var hp=h(()=>{l();Yt();Qt();we();});function ye({iconType:e="none",iconVariant:t="transparent",icon:o="",iconRadius:r="md",iconSize:n="md",iconPadding:s="1",blockType:a}){let[i,c]=useState(void 0),u=e==="custom"?o:`/api/cms/read/icons/${e}/icon.svg?name=${o}`,p=/^.*\.svg*$/.test(u)||e==="tabler";return useEffect(()=>{p&&On.get(u,{responseType:"text"}).then(f=>f.data).then(c).catch(()=>{});},[e,p,u]),jsx(Fragment,{children:e!=="none"&&o&&o!==""&&!!(i||!p)&&jsx(ThemeIcon,{className:`bespoke-${a}-icon-wrapper`,variant:t,radius:r,size:n,p:parseInt(s),dangerouslySetInnerHTML:i&&p?{__html:i}:void 0,children:p?null:jsx(Image,{src:u,alt:"Title Icon"})})})}var Jt=h(()=>{l();});var ho,bp,yp,Sp,vp,Je,Ge,vr,He=h(()=>{l();de();ho={display:{label:"Size",defaultValue:"block",options:[{label:"Full Width",value:"block"},{label:"Inline",value:"inline"}]}},bp={useProxy:{label:"Use proxy (avoid CORS)",defaultValue:"false",options:[{label:"No",value:"false"},{label:"Yes",value:"true"}]}},{[S.IMAGE]:{...ho},[S.PARAGRAPH]:{...ho},[S.SUBTITLE]:{...ho},[S.SELECTOR]:{...ho},[S.STAT]:{...ho},[S.VIZ]:{...ho},[S.TITLE]:{order:{label:"Importance",defaultValue:"1",options:[{label:"1",value:"1"},{label:"2",value:"2"},{label:"3",value:"3"},{label:"4",value:"4"},{label:"5",value:"5"},{label:"6",value:"6"}]},search:{label:"Search on Click",defaultValue:"off",options:[{label:"Off",value:"off"},{label:"Inline",value:"inline"},{label:"Modal",value:"modal"}]},addComparisonName:{label:"Show member name on comparison mode",defaultValue:"no",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]},...ho},[S.GENERATOR]:{...bp},[S.SECTION_FLAG]:{...bp},[S.NAV]:{variant:{label:"Nav variant",defaultValue:"inline",options:[{label:"Inline",value:"inline"},{label:"Fixed",value:"fixed"},{label:"Jump",value:"jump"}]},min:{label:"Min Title level",defaultValue:"1",options:[{label:"1",value:"1"},{label:"2",value:"2"},{label:"3",value:"3"},{label:"4",value:"4"},{label:"5",value:"5"},{label:"6",value:"6"}]},max:{label:"Max Title level",defaultValue:"6",options:[{label:"1",value:"1"},{label:"2",value:"2"},{label:"3",value:"3"},{label:"4",value:"4"},{label:"5",value:"5"},{label:"6",value:"6"}]},icons:{label:"Show icons",defaultValue:"yes",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]},titlePosition:{label:"Title position",defaultValue:"left",options:[{label:"Left",value:"left"},{label:"Top",value:"top"},{label:"Right",value:"right"},{label:"Bottom",value:"bottom"}]}},[S.MULTIHIERARCHY_SELECTOR]:{...ho}},yp={left:"flex-start",right:"flex-end",justify:"stretch"},Sp={justify:"apart"},vp={justify:"space-between"},Je=e=>yp[e]?yp[e]:e,Ge=e=>Sp[e]?Sp[e]:e,vr=e=>vp[e]?vp[e]:e;});function za({subtitle:e,title:t,value:o,tooltip:r,settings:n,_iconType:s,_iconVariant:a,_icon:i,_iconRadius:c,_iconSize:u,_iconPadding:p}){if(!t&&!o&&!e)return null;let m=n&&n.align?n.align:"left";return jsxs(Group,{spacing:"md",position:Ge(m),children:[jsx(ye,{blockType:"stat",iconType:s,iconVariant:a,iconRadius:c,iconSize:u,icon:i,iconPadding:p}),jsxs(Stack,{spacing:0,children:[t&&jsx(ae,{component:"div",size:"md",html:t,style:n}),o&&jsx(ae,{component:"div",size:"xl",html:o,style:n}),e&&jsx(ae,{component:"div",size:"sm",html:e,style:n})]},"stat"),r&&jsx(De,{content:r})]})}var Tp=h(()=>{l();Qt();Jt();we();He();});function $a({subtitle:e,tooltip:t,settings:o}){let r=e||"<span class='cr-block-placeholder'>Small subtitle.</span>",n=o&&o.align?o.align:"left";return jsxs(Group,{spacing:"sm",position:Ge(n),children:[jsx(ae,{size:"sm",html:r}),t&&jsx(De,{content:t,style:{display:"inline-flex"}})]})}var Ep=h(()=>{l();Qt();we();He();});function Ga({title:e,tooltip:t,slug:o,_iconType:r,_iconVariant:n,_icon:s,settings:a,_iconRadius:i,_iconSize:c,_iconPadding:u,asComparison:p=false}){let{print:m}=Ze(),f=ke(e)||"<span class='cr-block-placeholder'>Title</span>",g=a&&a.order?parseInt(a.order,10):1,d=g<=6?g:1,v=a&&a.search?a.search:"off",x=a&&a.align?a.align:"left",w=bt(),R=X(B=>B.status.previews),P=(p?w.status.previews:R).map(B=>B.name).join(" | "),U=jsxs(Group,{children:[jsx(ye,{blockType:"title",iconType:r,iconVariant:n,iconRadius:i,iconSize:c,icon:s,iconPadding:u}),jsx(ae,{id:o||void 0,component:"h",order:d,style:a,html:f})]}),G=xr(U,v),V=a&&a.addComparisonName==="yes"&&w.active;return jsxs(Group,{spacing:"sm",position:Ge(x),children:[jsxs("div",{children:[m?U:G,V&&jsx(Text,{className:"bespoke-comparison-title",children:P})]}),t&&jsx(De,{content:t})]})}var Cp=h(()=>{l();Yt();Jt();we();Ne();fo();ce();Zt();Qt();He();});function ja(e){let{name:t,settings:o,options:r,id:n,defaultValue:s,section:a,component:i,asComparison:c,hideLabel:u,resetSectionVars:p}=e,{print:m}=Ze(),f=jS(n),g=Hn(n,a,f,c,p==="true"),d=c?`${f}Compare`:f,[v,x]=useState(s),[w,R]=useState(Ap(s,[])),k=JSON.stringify(r),P=o[ft.DISABLED]||false,U=useMemo(()=>r?.map(A=>({value:A.id,label:A.label,imageUrl:A.imageUrl})),[k]),G=m?r.filter(A=>w.includes(A.id)).map(A=>A.label).join(", "):"",V=m&&v&&r.find(A=>A.id===v)?.label||"",B=e.hideLabel==="true"?jsx(Fragment,{}):jsx(ae,{component:"div",html:t,size:"sm",style:o});if(useEffect(()=>{if(!P){let C=new URLSearchParams(window.location.search).get(d)||s;C&&(e.type===Ie.SINGLE?x(C):R(Ap(C,s)));}},[window.location.search,s]),U.length<=1)return jsx(Fragment,{});let E=A=>{R(A),g(A.join(","));},O=A=>{x(A),g(A);};return jsx(Fragment,{children:m?jsxs(Box,{style:{display:"flex",alignItems:"center"},children:[B,jsx(Button,{ml:"sm",radius:"xl",variant:"outline",children:e.type===Ie.SINGLE?V:G})]}):jsx(Box,{children:{[Ie.SINGLE]:i===xn.SEGMENTED_CONTROL?jsxs("div",{children:[jsx(Text,{size:"sm",fw:500,display:u==="true"?"none":"block",children:B}),jsx(SegmentedControl,{data:U,disabled:P,value:U.map(A=>A.value).includes(v)?v:"",onChange:O,fullWidth:true})]}):jsx(Select,{label:B,data:U,disabled:P,value:v,itemComponent:KS,onChange:O,styles:{label:{display:u==="true"?"none":"block"}}}),[Ie.MULTI]:jsx(MultiSelect,{label:B,data:U,value:w,onChange:E,disabled:P,styles:{label:{display:u==="true"?"none":"block"}}})}[e.type]})})}var jS,Ap,KS,Ip=h(()=>{l();we();de();Ne();Zt();jS=e=>`selector${e}id`,Ap=(e,t)=>e&&typeof e=="string"?e.split(","):t,KS=forwardRef(function({imageUrl:t,label:o,...r},n){return jsx("div",{ref:n,...r,children:jsxs(Group,{noWrap:true,children:[t&&!["","undefined"].includes(t)&&jsx(Box,{component:"img",w:25,h:25,src:t}),jsx("div",{children:jsx(Text,{size:"sm",children:o})})]})})});});function es(){return jsx("div",{children:"Generator"})}var Lp=h(()=>{l();});function Ka(e){let{alt:t,src:o,desc:r,title:n,settings:s,...a}=e,i=ke(t),c=ke(o),u=ke(r),p=jsx("img",{src:c,alt:i,style:a}),m=s&&s.align?String(s.align):"left";return (u&&u.length||n&&n.length)&&(p=jsxs(Stack,{className:"bespoke-Image-wrapper",align:Je(m),spacing:"sm",children:[n&&jsx(ae,{component:"p",html:n,style:s}),p,r&&jsx(ae,{component:"p",size:"sm",html:r,style:s})]})),c&&i?p:jsx(Center,{mih:100,bg:"white",children:jsx(Badge,{color:"gray",variant:"outline",children:"IMAGE"},"type")})}var Op=h(()=>{l();Yt();we();He();});function rn(){return rn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r]);}return e},rn.apply(this,arguments)}var _p=h(()=>{l();});function nn(){return nn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r]);}return e},nn.apply(this,arguments)}var Bp=h(()=>{l();});function er(e,t,o){var r,n=(r=o.initialDeps)!=null?r:[],s;return function(){var a;o.key&&o.debug!=null&&o.debug()&&(a=Date.now());var i=e(),c=i.length!==n.length||i.some(function(d,v){return n[v]!==d});if(!c)return s;n=i;var u;if(o.key&&o.debug!=null&&o.debug()&&(u=Date.now()),s=t.apply(void 0,i),o.key&&o.debug!=null&&o.debug()){var p=Math.round((Date.now()-a)*100)/100,m=Math.round((Date.now()-u)*100)/100,f=m/16,g=function(v,x){for(v=String(v);v.length<x;)v=" "+v;return v};console.info("%c\u23F1 "+g(m,5)+" /"+g(p,5)+" ms",`
10
10
  font-size: .6rem;
11
11
  font-weight: bold;
12
- color: hsl(`+Math.max(0,Math.min(120-120*f,120))+"deg 100% 31%);",o?.key);}return o==null||o.onChange==null||o.onChange(s),s}}function ts(e,t){if(e===void 0)throw new Error("Unexpected undefined"+(""));return e}var Mp,Np=h(()=>{l();Mp=function(t,o){return Math.abs(t-o)<1};});function ov(e){for(var t=e.measurements,o=e.outerSize,r=e.scrollOffset,n=t.length-1,s=function(u){return t[u].start},a=$p(0,n,s,r),i=a;i<n&&t[i].end<r+o;)i++;return {startIndex:a,endIndex:i}}var ev,sn,Dp,Fp,tv,Vp,zp,$p,Ya=h(()=>{l();Bp();Np();ev=function(t){return t},sn=function(t){for(var o=Math.max(t.startIndex-t.overscan,0),r=Math.min(t.endIndex+t.overscan,t.count-1),n=[],s=o;s<=r;s++)n.push(s);return n},Dp=function(t,o){var r=t.scrollElement;if(r){var n=function(i){var c=i.width,u=i.height;o({width:Math.round(c),height:Math.round(u)});};n(r.getBoundingClientRect());var s=new ResizeObserver(function(a){var i=a[0];if(i!=null&&i.borderBoxSize){var c=i.borderBoxSize[0];if(c){n({width:c.inlineSize,height:c.blockSize});return}}n(r.getBoundingClientRect());});return s.observe(r,{box:"border-box"}),function(){s.unobserve(r);}}},Fp=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:true}),function(){r.removeEventListener("scroll",n);}}},tv=function(t,o,r){if(o!=null&&o.borderBoxSize){var n=o.borderBoxSize[0];if(n){var s=Math.round(n[r.options.horizontal?"inlineSize":"blockSize"]);return s}}return Math.round(t.getBoundingClientRect()[r.options.horizontal?"width":"height"])},Vp=function(t,o,r){var n,s,a=o.adjustments,i=a===void 0?0:a,c=o.behavior,u=t+i;(n=r.scrollElement)==null||n.scrollTo==null||n.scrollTo((s={},s[r.options.horizontal?"left":"top"]=u,s.behavior=c,s));},zp=function(t){var o=this;this.unsubs=[],this.scrollElement=null,this.isScrolling=false,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(i){o._measureElement(i.target,i);});}):null)};return {disconnect:function(){var a;return (a=n())==null?void 0:a.disconnect()},observe:function(a){var i;return (i=n())==null?void 0:i.observe(a,{box:"border-box"})},unobserve:function(a){var i;return (i=n())==null?void 0:i.unobserve(a)}}})(),this.range={startIndex:0,endIndex:0},this.setOptions=function(r){Object.entries(r).forEach(function(n){var s=n[0],a=n[1];typeof a>"u"&&delete r[s];}),o.options=nn({debug:false,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:false,getItemKey:ev,rangeExtractor:sn,onChange:function(){},measureElement:tv,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 s=o.scrollRect;o.scrollRect=n,(o.options.horizontal?n.width!==s.width:n.height!==s.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=true,o.scrollDirection=o.scrollOffset<n?"forward":"backward",o.scrollOffset=n,o.maybeNotify(),o.isScrollingTimeoutId=setTimeout(function(){o.isScrollingTimeoutId=null,o.isScrolling=false,o.scrollDirection=null,o.maybeNotify();},o.options.scrollingDelay));})));},this.getSize=function(){return o.scrollRect[o.options.horizontal?"width":"height"]},this.memoOptions=er(function(){return [o.options.count,o.options.paddingStart,o.options.scrollMargin,o.options.getItemKey]},function(r,n,s,a){return o.pendingMeasuredCacheIndexes=[],{count:r,paddingStart:n,scrollMargin:s,getItemKey:a}},{key:false}),this.getFurthestMeasurement=function(r,n){for(var s=new Map,a=new Map,i=n-1;i>=0;i--){var c=r[i];if(!s.has(c.lane)){var u=a.get(c.lane);if(u==null||c.end>u.end?a.set(c.lane,c):c.end<u.end&&s.set(c.lane,true),s.size===o.options.lanes)break}}return a.size===o.options.lanes?Array.from(a.values()).sort(function(p,m){return p.end-m.end})[0]:void 0},this.getMeasurements=er(function(){return [o.memoOptions(),o.itemSizeCache]},function(r,n){var s=r.count,a=r.paddingStart,i=r.scrollMargin,c=r.getItemKey,u=o.pendingMeasuredCacheIndexes.length>0?Math.min.apply(Math,o.pendingMeasuredCacheIndexes):0;o.pendingMeasuredCacheIndexes=[];for(var p=o.measurementsCache.slice(0,u),m=u;m<s;m++){var f=c(m),g=o.options.lanes===1?p[m-1]:o.getFurthestMeasurement(p,m),d=g?g.end:a+i,v=n.get(f),x=typeof v=="number"?v:o.options.estimateSize(m),C=d+x,R=g?g.lane:m%o.options.lanes;p[m]={index:m,start:d,size:x,end:C,key:f,lane:R};}return o.measurementsCache=p,p},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:function(){return o.options.debug}}),this.calculateRange=er(function(){return [o.getMeasurements(),o.getSize(),o.scrollOffset]},function(r,n,s){return o.range=ov({measurements:r,outerSize:n,scrollOffset:s})},{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:function(){return o.options.debug}}),this.maybeNotify=er(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=er(function(){return [o.options.rangeExtractor,o.calculateRange(),o.options.overscan,o.options.count,o.getSize()]},function(r,n,s,a,i){return i===0?[]:r(nn({},n,{overscan:s,count:a}))},{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:function(){return o.options.debug}}),this.indexFromElement=function(r){var n=o.options.indexAttribute,s=r.getAttribute(n);return s?parseInt(s,10):(console.warn("Missing attribute name '"+n+"={index}' on measured element."),-1)},this._measureElement=function(r,n){var s=o.measurementsCache[o.indexFromElement(r)];if(!s||!r.isConnected){o.measureElementCache.forEach(function(c,u){c===r&&(o.observer.unobserve(r),o.measureElementCache.delete(u));});return}var a=o.measureElementCache.get(s.key);a!==r&&(a&&o.observer.unobserve(a),o.observer.observe(r),o.measureElementCache.set(s.key,r));var i=o.options.measureElement(r,n,o);o.resizeItem(s,i);},this.resizeItem=function(r,n){var s,a=(s=o.itemSizeCache.get(r.key))!=null?s:r.size,i=n-a;i!==0&&(r.start<o.scrollOffset&&(process.env.NODE_ENV!=="production"&&o.options.debug&&console.info("correction",i),o._scrollToOffset(o.scrollOffset,{adjustments:o.scrollAdjustments+=i,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=er(function(){return [o.getIndexes(),o.getMeasurements()]},function(r,n){for(var s=[],a=0,i=r.length;a<i;a++){var c=r[a],u=n[c];s.push(u);}return s},{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:function(){return o.options.debug}}),this.getVirtualItemForOffset=function(r){var n=o.getMeasurements();return ts(n[$p(0,n.length-1,function(s){return ts(n[s]).start},r)])},this.getOffsetForAlignment=function(r,n){var s=o.getSize();n==="auto"&&(r<=o.scrollOffset?n="start":r>=o.scrollOffset+s?n="end":n="start"),n==="start"?r=r:n==="end"?r=r-s:n==="center"&&(r=r-s/2);var a=o.options.horizontal?"scrollWidth":"scrollHeight",i=o.scrollElement?"document"in o.scrollElement?o.scrollElement.document.documentElement[a]:o.scrollElement[a]:0,c=i-o.getSize();return Math.max(Math.min(c,r),0)},this.getOffsetForIndex=function(r,n){n===void 0&&(n="auto"),r=Math.max(0,Math.min(r,o.options.count-1));var s=ts(o.getMeasurements()[r]);if(n==="auto")if(s.end>=o.scrollOffset+o.getSize()-o.options.scrollPaddingEnd)n="end";else if(s.start<=o.scrollOffset+o.options.scrollPaddingStart)n="start";else return [o.scrollOffset,n];var a=n==="end"?s.end+o.options.scrollPaddingEnd:s.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 s=n===void 0?{}:n,a=s.align,i=a===void 0?"start":a,c=s.behavior;o.cancelScrollToIndex(),c==="smooth"&&o.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),o._scrollToOffset(o.getOffsetForAlignment(r,i),{adjustments:void 0,behavior:c});},this.scrollToIndex=function(r,n){var s=n===void 0?{}:n,a=s.align,i=a===void 0?"auto":a,c=s.behavior;r=Math.max(0,Math.min(r,o.options.count-1)),o.cancelScrollToIndex(),c==="smooth"&&o.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");var u=o.getOffsetForIndex(r,i),p=u[0],m=u[1];o._scrollToOffset(p,{adjustments:void 0,behavior:c}),c!=="smooth"&&o.isDynamicMode()&&(o.scrollToIndexTimeoutId=setTimeout(function(){o.scrollToIndexTimeoutId=null;var f=o.measureElementCache.has(o.options.getItemKey(r));if(f){var g=o.getOffsetForIndex(r,m),d=g[0];Mp(d,o.scrollOffset)||o.scrollToIndex(r,{align:m,behavior:c});}else o.scrollToIndex(r,{align:m,behavior:c});}));},this.scrollBy=function(r,n){var s=n===void 0?{}:n,a=s.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 s=n.adjustments,a=n.behavior;o.options.scrollToFn(r,{behavior:a,adjustments:s},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();},$p=function(t,o,r,n){for(;t<=o;){var s=(t+o)/2|0,a=r(s);if(a<n)t=s+1;else if(a>n)o=s-1;else return s}return t>0?t-1:0};});function nv(e){var t=eo.useReducer(function(){return {}},{})[1],o=rn({},e,{onChange:function(a){t(),e.onChange==null||e.onChange(a);}}),r=eo.useState(function(){return new zp(o)}),n=r[0];return n.setOptions(o),eo.useEffect(function(){return n._didMount()},[]),rv(function(){return n._willUpdate()}),n}function os(e){return nv(rn({observeElementRect:Dp,observeElementOffset:Fp,scrollToFn:Vp},e))}var rv,Xa=h(()=>{l();_p();Ya();Ya();rv=typeof document<"u"?eo.useLayoutEffect:eo.useEffect;});function Ja(e){let{allLabel:t,asComparison:o,colorKey:r,data:n,defaultValue:s,defaultValueType:a,hideLabel:i,resetSectionVars:c,iconKey:u,id:p,levels:m,limit:f,placeholder:g,searchIndexKey:d,searchIndexSeparator:v,section:x,settings:C}=e,{print:R}=Ze(),k=yv(p),A=is(p,x,k,o,c==="true"),U=o?`${k}-valueCompare`:`${k}-value`,G=o?`${k}-typeCompare`:`${k}-type`,F=useMantineTheme(),[B,E]=useState(false),[O,P]=useState(true),[w,N]=useState(""),[Z,W]=useState(false),[$,J]=useState([""].slice(1)),[M,z]=useState([]),[V,Y]=useState(""),ve=C[ft.DISABLED]||false,j=useMemo(()=>R?Array.from(new Set(n.filter(se=>M.includes(se[`${V} ID`])))).map(se=>se?.[V]).join(", "):"",[R]),ee=i==="true"||!e.label?jsx(Fragment,{}):jsx(ae,{component:"div",html:e.label,size:"sm",style:C}),re=useRef(null),oe=useRef(false),_=useRef(!!f&&f<M.length),T=$.length,L=m[T],q=$.filter(Boolean);$.length>0&&q.length===0&&q.push(`${t} ${L?.label}`),useEffect(()=>{if(!ve){let I=new URLSearchParams(window.location.search),se=I.get(U)||s,ne=I.get(G)||a;se&&ne?(z(Sv(se,s)),Y(ne)):(z([]),Y(""));}},[window.location.search,s,a,ve]),useEffect(()=>{let I=()=>{P(true);};return window.addEventListener("touchmove",I),()=>{window.removeEventListener("touchmove",I);}},[]);let Q=useMemo(()=>gv(n,m,r,u,d,v),[r,n,u,m,d,v]),K=useMemo(()=>{let I=hv(w),se=Array.from(bv(Q,I)).reverse();return Z?se:$.reduce((ne,Ye)=>ne.filter(be=>!Ye||be.searchindex.indexOf(Ye)>-1),se.filter(ne=>ne.type===L?.value))},[L,Q,w,Z,$]),ie=useRef(null),he=os({count:B?K.length:0,estimateSize:()=>30,getScrollElement:useCallback(()=>ie.current,[]),overscan:10,rangeExtractor:useCallback(I=>sn(I),[])}),[it,Ce]=useState(-1),xe=Math.min(it,K.length-1),Tt=useCallback(I=>{let se=$.concat(I);Z&&W(false),J(se);},[Z,$]),$t=useCallback(()=>{let I=$.slice(0,T-1);Z&&W(false),J(I);},[Z,$,T]),Rt=useCallback(I=>{N(I.currentTarget.value),!_.current&&n.length>0&&E(true);},[n,N,_,E]),_r=useCallback(()=>{N(""),A([],""),re.current?.focus(),f&&(_.current=false);},[N,A,re,f,_]),Eo=useCallback(I=>{let se=M.filter(ne=>ne!==I);se.length>0?A(se,V):A([],""),f&&se.length<f&&(_.current=false);},[M,V,A,f,_]),ko=useCallback(I=>{V!==I.type?A([I.value],I.type):M.includes(I.value)?Eo(I.value):f?(M.length<f&&A([...M,I.value],V),M.length===f&&A([...M.slice(1),I.value],V)):A([...M,I.value],V),N("");},[A,V,M,Eo,f]),Rs=useCallback(()=>{M.length>0&&w.length===0&&(A(M.slice(0,-1),V),E(true),f&&(_.current=false)),w.length>0&&N(w.slice(0,-1));},[A,M,V,w,N,E,f,_]),Es=useCallback(()=>{P(I=>I&&(oe.current=I,!I)),Ce(I=>I+1>=K.length?I:I+1);},[Ce,K]),ks=useCallback(()=>{let I=K[xe];I&&ko(I);},[K,xe,ko]),Cs=useCallback(()=>{E(false);},[E]),ws=useCallback(()=>{$t(),Ce(0);},[Ce,$t]),As=useCallback(()=>{let I=K[xe];!Z&&I&&I.type!==m[m.length-1]?.value&&(Tt(I.name),Ce(0));},[K,xe,Z,m,Ce,Tt]),Ps=useCallback(()=>{P(I=>I&&(oe.current=I,!I)),Ce(I=>I-1<0?0:I-1);},[Ce]),Is=({label:I,onRemove:se,...ne})=>jsxs("div",{style:{alignItems:"center",backgroundColor:F.colorScheme==="dark"?F.colors.dark[7]:F.colors.gray[1],borderRadius:F.radius.sm,cursor:"default",color:F.colorScheme==="dark"?F.colors.dark[0]:F.colors.gray[7],display:"flex",fontSize:rem(12),fontWeight:500,height:rem(22),margin:`calc(${F.spacing.xs} / 2 - ${rem(2)}) calc(${F.spacing.xs} / 2)`,maxWidth:`calc(100% - ${rem(10)})`,paddingLeft:`calc(${F.spacing.sm} / 1.5)`,paddingRight:0,userSelect:"none"},...ne,children:[jsx("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:I}),jsx(CloseButton,{"aria-hidden":true,iconSize:"70%",onMouseDown:se,radius:2,size:"sm",sx:{color:F.colorScheme==="dark"?F.colors.dark[0]:F.colors.gray[7],marginLeft:`calc(${F.spacing.sm} / 6)`},tabIndex:-1})]}),D=useMemo(()=>M.map(I=>Q.find(se=>se.value===I)).filter(I=>!!I).map((I,se)=>createElement(Is,{...I,index:se,label:I.label,key:I.value,onRemove:ne=>{ne.preventDefault(),ne.stopPropagation(),Eo(I.value);}})),[M]),ue=forwardRef(function({color:se,icon:ne,label:Ye,value:be,...Ls},Kf){return jsx("div",{ref:Kf,style:{cursor:"pointer",width:"100%"},...Ls,children:jsxs(Group,{align:"center",noWrap:true,spacing:"xs",w:"100%",children:[ne&&jsx(Box,{bg:se??"transparent",component:"img",w:20,h:20,src:ne}),jsx(Text,{lineClamp:1,size:"sm",children:Ye||be})]})})});return jsxs(Fragment,{children:[jsx(MediaQuery,{query:"print",styles:{display:"none"},children:jsx(Input.Wrapper,{label:ee,children:jsxs(Popover,{closeOnClickOutside:true,disabled:ve,keepMounted:true,opened:B,onChange:E,onClose:()=>{Ce(0),N("");},onOpen:()=>{K.length>0&&he.scrollToIndex(0);},shadow:"sm",width:"target",withinPortal:true,children:[jsx(Popover.Target,{children:jsxs(Box,{"aria-haspopup":"listbox",component:"div",onMouseLeave:()=>Ce(0),sx:{position:"relative","& .defaultValue":{backgroundColor:F.colorScheme==="dark"?F.colors.dark[5]:F.colors.gray[3],color:F.colorScheme==="dark"?F.colors.dark[1]:F.colors.gray[7]}},tabIndex:-1,children:[jsx("input",{type:"hidden",value:M.join(",")}),jsx(Input,{component:"div",disabled:ve,multiline:true,onMouseDown:I=>{I.preventDefault(),!_.current&&n.length>0&&E(!B),re.current?.focus();},rightSection:M.length>0?jsx(CloseButton,{disabled:ve,onClick:_r,onMouseDown:I=>I.preventDefault(),variant:"transparent"}):jsx(IconSelector,{color:F.colors.gray[6],size:18,stroke:1.5}),style:{overflow:"hidden"},w:"100%",children:jsxs(Box,{component:"div","data-clearable":true,sx:{alignItems:"center",boxSizing:"border-box",display:"flex",flexWrap:"wrap",marginLeft:`calc(-${F.spacing.xs} / 2)`,minHeight:`calc(${rem(36)} - ${rem(2)})`,"&[data-clearable]":{marginRight:rem(36)},"&::placeholder":{color:F.colorScheme==="dark"?F.colors.dark[3]:F.colors.gray[5],opacity:1}},children:[D,jsx("input",{autoComplete:"off","data-mantine-stop-propagation":B,onChange:Rt,onKeyDown:getHotkeyHandler([["ArrowDown",Es],["ArrowLeft",ws],["ArrowRight",As],["ArrowUp",Ps],["Backspace",Rs],["Enter",ks],["Escape",Cs]]),placeholder:M.length===0&&g||"",ref:re,readOnly:_.current,style:{appearance:"none",backgroundColor:"transparent",border:0,color:"inherit",flex:1,fontSize:F.fontSizes.sm,marginLeft:`calc(${F.spacing.xs} / 2)`,maxHeight:rem(22),minWidth:rem(60),outline:0,padding:0},type:"search",value:w})]})})]})}),jsx(Popover.Dropdown,{onMouseDown:I=>I.preventDefault(),p:0,children:jsx("div",{style:{display:"flex",maxHeight:rem(300)},children:jsx(Box,{component:"div","data-combobox-popover":true,onMouseDown:I=>I.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:I=>{I.stopPropagation();},px:"xs",position:"center",spacing:"xs",children:[jsx(Button,{onClick:()=>{Ce(0),W(true),J([]),K.length>0&&he.scrollToIndex(0);},size:"xs",variant:Z?"filled":"outline",children:t}),m.map((I,se)=>jsx(Button,{onClick:()=>{Z&&W(false);let ne=[""].slice(1),Ye=se;for(;Ye--;)ne[Ye]=$[Ye]||"";Ce(0),J(ne),K.length>0&&he.scrollToIndex(0);},size:"xs",variant:!Z&&$.length===m.findIndex(ne=>ne.value===I?.value)?"filled":"outline",children:I?.label},I?.value))]}),jsx(Divider,{})]}),T>0&&jsxs(Group,{align:"center",noWrap:true,px:"xs",children:[jsx(ActionIcon,{onClick:$t,size:"sm",children:jsx(IconChevronLeft,{})}),jsx("div",{children:q.map(I=>jsx(Text,{lineClamp:1,size:"xs",children:I},`${I}`))})]}),jsx(ScrollArea,{mah:250,onWheel:()=>P(true),px:"xs",style:{overflow:"auto",width:"100%"},viewportRef:ie,viewportProps:{tabIndex:-1},w:"100%",children:jsx("div",{style:{height:`${he.getTotalSize()}px`,position:"relative",width:"100%"},children:he.getVirtualItems().map(I=>{let se=K[I.index],ne=xe===I.index,Ye=M.includes(se.value);return K.length>0&&ne&&!O&&he.scrollToIndex(xe),jsxs(Group,{"aria-selected":ne,align:"center","data-hovered":ne||void 0,"data-index":I.index,"data-selected":Ye,id:se.vale,noWrap:true,onMouseEnter:be=>{be.preventDefault(),be.stopPropagation(),O&&(Ce(I.index),P(false));},onMouseMove:be=>{be.preventDefault(),be.stopPropagation(),P(true);},onMouseDown:be=>{be.preventDefault(),ko(se);},position:"apart",ref:he.measureElement,role:"option",spacing:"xs",sx:be=>({borderRadius:be.radius.xs,padding:"15px 5px 15px",paddingLeft:Z&&10*m.findIndex(Ls=>Ls?.value===se.type)||5,position:"absolute",top:0,left:0,height:`${I.size}px`,transform:`translateY(${I.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(ue,{index:I.index,...se}),!Z&&se.type!==m[m.length-1]?.value&&jsx(ActionIcon,{onMouseDown:be=>{be.preventDefault(),be.stopPropagation(),Tt(se.name);},size:"sm",tabIndex:-1,children:jsx(IconChevronRight,{})})]},se.value)})})})]})})})})]})})}),R&&jsxs(Text,{children:[ee,": ",j]})]})}var gv,hv,bv,yv,Sv,Yp=h(()=>{l();Xa();we();Zt();Ne();de();gv=(e=[],t=[],o="",r="",n="",s="|")=>{let a=t.map(v=>v.value).slice(),i=`${a.pop()}`,c=v=>v[o],u=v=>v[r],p=v=>{if(v[n])return typeof v[n]=="string"?v[n].split(s):v[n]},m=new Set,f=[],g=[],d=nest().rollup(v=>{let x=v[0],C=E=>E&&E.value&&!m.has(E.value),R=a.map(E=>x[`${E} ID`]),k=a.map(E=>x[E]),A=a.map((E,O)=>{if(g[O]!==k[O]){g[O]=k[O];let P=c[O]||c[c.length-1]||c,w=u[O]||u[u.length-1]||u,N=p[O]||p[p.length-1]||p;return {color:P(x,E)||void 0,icon:w(x,E)||void 0,value:`${R[O]}`,label:k[O],name:k[O],type:E,searchindex:k.slice(0,O+1).concat(N(x,E)).join("|")}}return {}}).filter(C);A.forEach(E=>m.add(E.value));let U=c[c.length-1]||c,G=u[u.length-1]||u,F=p[p.length-1]||p,B=v.map(E=>({color:U(E,i)||void 0,icon:G(E,i)||void 0,value:`${E[`${i} ID`]}`,label:E[i],name:E[i],type:i,searchindex:k.concat(E[i]).concat(F(E,i)).join("|")}));f.push(...A.concat(B));});return a.forEach(v=>{d.key(x=>`${x[`${v} ID`]}|${x[v]}`);}),d.entries(e),f},hv=e=>{if(!e)return /./i;let t=e.normalize("NFD").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"[^|]+");return RegExp(t,"i")},bv=(e,t)=>{let o=e.length,r,n=i=>r&&r.searchindex.includes(i.searchindex),a={next:()=>{for(let i=o-1;i>-1;i--){let c=e[i];if(t.test(`${c.value} ${c.label} ${c.searchindex}`)||n(c))return r=c,o=i,{done:false,value:c}}return {done:true,value:void 0}},[Symbol.iterator]:()=>a};return a},yv=e=>`multihierarchySelector${e}`,Sv=(e,t)=>e&&typeof e=="string"?e.split(","):t;});function ei({headings:e,settings:t,type:o,title:r,shortTitle:n,_iconType:s,_iconVariant:a,_icon:i,_iconRadius:c,_iconSize:u,_iconPadding:p}){let{min:m="1",max:f="6",icons:g="yes"}=t||{},d=Yo(parseInt(m,10),parseInt(f,10),e),v=g==="yes",x=ke(r)||"",C=ke(n||r)||"",R=x&&x.length>0,k=s&&s!=="none",U=`(max-width: ${useMantineTheme().breakpoints.md})`,G=useMediaQuery(U),F=G?C:x,B=t&&t.align?String(t.align):"left",E=vr(B),O=Ge(B),P=Je(B),w=t&&t.titlePosition?String(t.titlePosition):"left",N=useMemo(()=>{let J={right:"left",left:"right"},M=R&&["left","right"].includes(w),z={};if(M){let V=w==="right";z={spacing:"xs",position:V&&J[O]?J[O]:O,style:{flexDirection:V?"row-reverse":"row"},noWrap:true};}else z={spacing:"xs",align:P,justify:"center",style:{flexDirection:w==="bottom"?"column-reverse":"column"}};return {element:M?Group:Stack,props:z}},[R,O,P,w]),Z=useMemo(()=>R?jsxs(Group,{spacing:"xs",position:O,noWrap:true,children:[k&&jsx(ye,{blockType:"title",iconType:s,iconVariant:a,iconRadius:c,iconSize:u,icon:i,iconPadding:p}),jsx(ae,{style:{...t},html:F,lineClamp:1})]}):null,[R,k,O,F]),W=useMemo(()=>G?jsx(Cv,{contentOutline:d,showIcons:v,titleElement:Z,wrapper:N}):null,[G,Z,N]),$=useMemo(()=>G?null:o==="multilevel"?jsx(wv,{contentOutline:d,showIcons:v,align:E}):jsx(kv,{contentOutline:d,showIcons:v,align:E}),[d,v,E,G]);return jsxs(Fragment,{children:[G&&W,!G&&jsxs(N.element,{pos:"relative",...N.props,children:[R&&Z,$]})]})}var Qp,kv,nd,Cv,wv,sd=h(()=>{l();Ne();Jt();He();Yt();Jt();we();Qp=e=>t=>({display:"flex",gap:t.spacing.md,justifyContent:e,listStyleType:"none"}),kv=({contentOutline:e,showIcons:t,align:o})=>{let[r,n]=useState(null);useEffect(()=>{let a=()=>{let i=document.querySelector(".bespoke-nav");if(!i)return;let c=i.getBoundingClientRect(),u=false;e.forEach(p=>{let m=document.getElementById(`bespoke-title-${p.id}`);m&&m.getBoundingClientRect().top<=c.bottom&&(n(p.id),u=true);}),u||n(null);};return window.addEventListener("scroll",a),()=>{window.removeEventListener("scroll",a);}},[e]);let s=a=>!a||!a?.length?null:jsx(Fragment,{children:a.map(i=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${i.id}`,children:jsxs(Group,{spacing:"sm",noWrap:true,children:[t&&jsx(ye,{...i.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:i.label}})]})})}),jsx(Box,{pl:"xs",children:s(i.children)})]},i.id))});return jsx(Fragment,{children:jsx(Box,{component:"nav",className:"bespoke-nav",children:jsx(List,{sx:a=>({display:"flex",gap:a.spacing.md,justifyContent:o,listStyleType:"none"}),children:e?.map(a=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${a.id}`,"data-active":a.id===r,children:jsxs(Group,{spacing:"sm",noWrap:true,children:[t&&jsx(ye,{...a.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:a.label}})]})})}),a?.children?.length?jsx(Menu.Dropdown,{children:s(a.children)}):null]})},a.id))})})})},nd=({contentOutline:e,closeNav:t,showIcons:o})=>{let[r,n]=useState(null);return jsx(Stack,{children:e.map(s=>s.children.length?jsxs(Fragment,{children:[jsxs(Group,{spacing:0,noWrap:true,children:[jsx(UnstyledButton,{w:"100%",component:"a",onClick:t,href:`#bespoke-title-${s.id}`,children:jsxs(Group,{spacing:"sm",noWrap:true,children:[o&&jsx(ye,{...s.iconProps,iconSize:"sm",iconPadding:"2"}),jsx(Text,{dangerouslySetInnerHTML:{__html:s.label}})]})},s.id),jsx(ActionIcon,{component:"a",size:"lg",onClick:()=>n(a=>a===s.id?null:s.id),children:jsx(IconChevronDown,{style:{transition:"transform 0.2s",transform:r===s.id?"rotate(-180deg)":"none"},stroke:1})})]},s.id),jsx(Collapse,{in:r===s.id,pl:"sm",transitionTimingFunction:"linear",transitionDuration:200,children:jsx(nd,{contentOutline:s.children,closeNav:t,showIcons:o})})]}):jsx(Group,{noWrap:true,children:jsx(UnstyledButton,{display:"flex",w:"100%",component:"a",href:`#bespoke-title-${s.id}`,children:jsxs(Group,{spacing:"sm",noWrap:true,children:[o&&jsx(ye,{...s.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:s.label}})]})},s.id)},s.id))})},Cv=({contentOutline:e,showIcons:t,titleElement:o,wrapper:r})=>{let[n,{toggle:s}]=useDisclosure(false),a=n?"Close content outline":"Open content outline";return jsxs(Box,{className:"bespoke-mobile-nav",component:"nav",children:[jsxs(r.element,{className:"bespoke-mobile-nav-header",...r.props,onClick:s,children:[o&&o,jsx(ActionIcon,{className:"bespoke-mobile-nav-toggle","aria-label":a,size:"lg",variant:"subtle",children:n?jsx(IconChevronUp,{size:"xl",stroke:1.5}):jsx(IconChevronDown,{size:"xl",stroke:1.5})})]}),jsx(Collapse,{in:n,mt:"md",className:"bespoke-mobile-nav-body",children:jsx(nd,{contentOutline:e,closeNav:s,showIcons:t})})]})},wv=({contentOutline:e,showIcons:t,align:o})=>{let[r,n]=useState(null),[s,a]=useState(null);useEffect(()=>{let c=()=>{let u=document.querySelector(".bespoke-nav");if(!u)return;let p=u.getBoundingClientRect(),m=false;e.forEach(f=>{let g=document.getElementById(`bespoke-title-${f.id}`);g&&(g.getBoundingClientRect().top<=p.bottom&&(n(f.id),a(null),m=true),f.children.forEach(v=>{let x=document.getElementById(`bespoke-title-${v.id}`);x&&x.getBoundingClientRect().top<=p.bottom&&(a(v.id),n(f.id),m=true);}));}),m||(n(null),a(null));};return window.addEventListener("scroll",c),()=>{window.removeEventListener("scroll",c);}},[e]);let i=c=>!c||!c?.length?null:jsx(Fragment,{children:c.map(u=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${u.id}`,children:jsxs(Group,{spacing:"sm",noWrap:true,children:[t&&jsx(ye,{...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:Qp(o),children:e?.map(c=>jsx(List.Item,{children:jsx(Anchor,{href:`#bespoke-title-${c.id}`,"data-active":r===c.id,onClick:()=>n(c.id),children:jsxs(Group,{spacing:"sm",noWrap:true,children:[t&&jsx(ye,{...c.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:c.label}})]})})},c.id))}),r&&e.find(c=>c.id===r)?.children.length>0&&jsx(List,{className:"bespoke-nav-level2",sx:Qp(o),children:e.find(c=>c.id===r)?.children.map(c=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${c.id}`,"data-active":c.id===s,children:jsxs(Group,{spacing:"sm",noWrap:true,children:[t&&jsx(ye,{...c.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:c.label}})]})})}),c?.children?.length?jsx(Menu.Dropdown,{children:i(c.children)}):null]})},c.id))})]})};});function oi(e){let{related_reports:t,settings:o}=e,r=X(f=>f.status.currentLocale),n=X(f=>f.status.localeDefault),s=Gn(),a=useRouter(),{components:i}=Fe();if(!t?.length)return;let c=r===n?"":`/${r}`,u=f=>{a.push(`${f}`);},p=i?.ReportTile?i.ReportTile:ri,m=Je(o&&o.align?String(o.align):"center");return jsx(Grid,{justify:m,children:t.map(f=>{let g=`${c}${s}${f.link}`,d=f.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}})),v=f.entities.map(k=>k.id).join("-"),x=f.entities.map(k=>k.name).join(" & "),C=f.entities[0]?f.entities[0].report_id:null,R=k=>{k.preventDefault(),u(g);};return jsx(Grid.Col,{xs:12,sm:6,md:4,lg:4,xl:3,children:jsx(p,{reportId:C,reportName:x,members:d,href:g,onClick:R})},v)})})}var id=h(()=>{l();ce();Le();ni();Ne();He();});function si({id:e,label:t,settings:o,showIcon:r,fullWidth:n,showWhenDisabled:s}){let a=It(e).data,{sectionVariables:i,resetSectionVariables:c}=_e(a?.section_id),u=!!Object.keys(i).length,p=Je(o&&o.align?o.align:"left");return !u&&!s?null:jsx(Button,{onClick:()=>c(),disabled:!u,fullWidth:n,sx:{justifySelf:p},children:jsxs(Group,{align:"center",children:[t,r&&jsx(IconRefresh,{})]})})}var cd=h(()=>{l();Le();He();});function ai({settings:e,label:t,removeLabel:o,showIcon:r,position:n="center",asComparison:s=false}){let a=X(k=>k.records.entities.report),i=X(k=>k.variables.attributes),c=e&&e.search?e.search:"inline",u=Object.values(a)[0].settings,p=useRouter(),{comparisonLoaded:m,loading:f}=bt(),g=Object.keys(p.query).includes("compare"),v=m&&g?jsx(Button,{onClick:()=>{let k={...p.query};delete k.compare,p.push({pathname:p.pathname,query:k},void 0,{shallow:true});},rightIcon:jsx(IconX,{}),children:o||"Remove Comparison"}):jsx(Button,{loading:f,children:jsxs(Group,{align:"center",children:[t||"Add Comparison",r&&jsx(IconPlus,{})]})}),x={searchReportParams:{report:[Number(Object.keys(a)[0])],variant:u.compareLevels?[]:[i.variant_id1]}},R=xr(v,c,k=>{p.push({pathname:p.pathname,query:{...p.query,compare:k.reportPath}});},x);return s?null:jsx(Group,{position:n,children:g?v:R})}var dd=h(()=>{l();Ne();ce();fo();});function li({columns:e=[],data:t=[],tableProps:o={},sectionId:r=null}){let[n,s]=useState(false),[a,i]=useState({}),c=useMemo(()=>e.map(f=>f.accessorKey),[e]),u=useMemo(()=>t.filter(f=>typeof f=="object"&&f!==null&&!Array.isArray(f)&&Object.keys(f).some(g=>c.includes(g))),[c,t]),p=useMemo(()=>e.map(f=>({...f,Cell:({renderedCellValue:g})=>jsx(ae,{html:`${g}`}),filterFn:"contains"})),[e]),{locale:m}=useRouter();return useEffect(()=>{(async()=>{try{let g=m||"en",d=`${g.toUpperCase()}`,v=await import(`mantine-react-table/locales/${g}.js`);i(v[`MRT_Localization_${d}`]);}catch(g){console.error("Error loading translations:",g);}})();},[m]),jsx(MantineReactTable,{...o,autoResetPageIndex:false,columns:p,data:u,enableColumnFilterModes:true,enableFilterMatchHighlighting:false,globalFilterFn:"contains",layoutMode:"grid",localization:a,onIsFullScreenChange:f=>{let g=document.getElementById(`section-${r}`);g&&(f?g.style.zIndex="10":g.style.zIndex="1"),s(f);},state:{...o.state,isFullScreen:n}})}var gd=h(()=>{l();we();});function ci({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 bd=h(()=>{l();});function qv({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 ui(e){let t=jv();return jsx(t,{block:e})}var jv,vd=h(()=>{l();Ne();jv=()=>{let{components:e}=Fe(),t=qv;return e?.CustomFallback&&(t=e.CustomFallback),t};});function Fe(){return useMantineTheme().other.bespokeStyles??{}}var pi=h(()=>{l();});function Xv({block:e}){let{id:t}=e;return jsxs(Grid,{className:"bespoke-client-side-section-skeleton","data-section-skeleton-id":t,children:[jsx(Grid.Col,{md:3,lg:4,children:jsxs(Stack,{children:[jsx(Skeleton,{height:20}),jsx(Skeleton,{height:10}),jsx(Skeleton,{height:10}),jsx(Skeleton,{height:10})]})}),jsx(Grid.Col,{md:9,lg:8,children:jsx(Skeleton,{height:"100%"})})]})}function mi(e){let t=Qv();return jsx(t,{block:e})}var Qv,Td=h(()=>{l();pi();Qv=()=>{let{components:e}=Fe(),t=Xv;return e?.CustomSkeleton&&(t=e.CustomSkeleton),t};});var or,fi=h(()=>{l();or=class extends eo__default.Component{constructor(t){super(t),this.state={hasError:false};}static getDerivedStateFromError(t){return console.info("getDerivedStateFromError",t),{hasError:true}}componentDidCatch(t,o){console.error("Error information:",o.componentStack),notifications.show({autoClose:false,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}};});var kd={};Os(kd,{default:()=>Ed});function Ed(e){let{print:t}=Ze(),{block:o,active:r,locale:n,variables:s,configOverride:a={}}=e,i=kt(o),c=po(n),u={variables:s},p=useRouter(),{sectionVariables:m,setSectionVariables:f,resetSectionVariables:g}=_e(o.section_id),d=Ho(),v=Ee(),x=JSON.stringify(m),C=useMemo(()=>{if(!i?.logic)return {error:"Add a Configuration"};let F=gt({logic:i.logic},c,u).logic,B={router:p,section:{variables:m,setVariables:f,resetVariables:g}};return Xo(F,c,s,n,o.id,{},B,d,v)},[o,r,s,x,v.status]),{type:R}=C.config||{},k=R&&gi[R]?R:"Treemap";gi[R]||(C.config={error:`"${R}" is not a valid Visualization Type`});let A=gi[k],U=useMemo(()=>{let{_data:F,...B}=C.config;return ox(B,t)},[C,t]),G={locale:n,variables:s,...U,...a};return jsx("div",{className:"bespoke-Viz","data-ignore-print":G._printIgnore?"true":void 0,children:jsx("div",{style:{display:"flex",flex:"1 1 100%",minHeight:R===Zo?void 0:400},children:jsx(or,{fallback:jsx("p",{children:"Error in d3plus viz config."}),children:jsx(A,{style:{flex:1},dataFormat:F=>{let B;try{B=C.dataFormat(F);}catch(E){console.error("Error in dataFormat: ",E),B=[];}return B},linksFormat:C.linksFormat,nodesFormat:C.nodesFormat,topojsonFormat:C.topojsonFormat,config:{...G,sectionVariables:x}},"viz-key")})})})}var gi,ox,Cd=h(()=>{l();Lo();Jr();Po();Le();$e();fi();Zt();Kn();gi={...ex,[Zo]:jn},ox=(e,t)=>{let o={...e};return t&&(o.detectResize=false,o.detectResizeDelay=0,o.detectVisible=false,o.detectVisibleInterval=0,o.duration=0,o.shapeConfig={...o.shapeConfig,duration:0}),o};});var nx,wd=h(()=>{l();de();hp();Tp();Ep();Cp();Ip();Lp();Op();Yp();sd();id();cd();dd();gd();bd();vd();Td();nx=rx(()=>Promise.resolve().then(()=>(Cd(),kd)),{ssr:false}),{[S.PARAGRAPH]:Fa,[S.STAT]:za,[S.SUBTITLE]:$a,[S.TITLE]:Ga,[S.SELECTOR]:ja,[S.VIZ]:nx,[S.GENERATOR]:es,[S.SECTION_FLAG]:es,[S.IMAGE]:Ka,[S.NAV]:ei,[S.RELATED]:oi,[S.RESET_BUTTON]:si,[S.COMPARISON_BUTTON]:ai,[S.TABLE]:li,[S.BUTTON]:ci,[S.MULTIHIERARCHY_SELECTOR]:Ja,[S.FALLBACK]:ui,[S.SKELETON]:mi};});var sx,Ad,Pd=h(()=>{l();sx=(e,t)=>{let o=e.allLabel||"All",r=e.colorKey||"",n=e.data||[],s=e.hideLabel||"false",a=e.resetSectionVars||"false",i=e.iconKey||"",c=e.label||"Unlabeled Multihierarchy Selector",u=e.levels||[],p=e.limit||void 0,m=e.placeholder||"",f=e.searchIndexKey||"",g=e.searchIndexSeparator||"",d,v;return e.defaultValue&&e.defaultValueType&&(d=e.defaultValue,v=e.defaultValueType),(!d||!v)&&(d=[],v=""),{allLabel:o,colorKey:r,data:n,defaultValue:d,defaultValueType:v,hideLabel:s,resetSectionVars:a,iconKey:i,id:t,label:c,levels:u,limit:p,placeholder:m,searchIndexKey:f,searchIndexSeparator:g}},Ad=sx;});var ax,Id,ix,Ld,Od=h(()=>{l();de();Rn();ax=e=>Array.isArray(e)?e.map(t=>typeof t=="string"?{id:t,label:t}:t):[],Id=(e,t)=>t===Ie.MULTI&&!Array.isArray(e)?[e]:e,ix=(e,t)=>{let o=e.type||Ie.SINGLE,r=e.component||"Selector",n=e.hideLabel||"false",s=e.resetSectionVars||"false",a=e.name||"Unlabeled Selector",i=ax(e.options||[]),c;if(e.defaultValue){let u=Id(e.defaultValue,o);Io(o,u,i)&&(c=u);}if(!c){let u=i&&i[0]&&i[0].id||i[0]||"";c=Id(u,o);}return {id:t,name:a,type:o,options:i,component:r,defaultValue:c,hideLabel:n,resetSectionVars:s}},Ld=ix;});var lx,fn,_d=h(()=>{l();de();Pd();Od();lx={[S.SELECTOR]:Ld,[S.MULTIHIERARCHY_SELECTOR]:Ad},fn=lx;});function bi({paragraph:e,tooltip:t,settings:o}){return jsx(ae,{component:"p",html:e||`Lorem ipsum dolor sit amet,
12
+ color: hsl(`+Math.max(0,Math.min(120-120*f,120))+"deg 100% 31%);",o?.key);}return o==null||o.onChange==null||o.onChange(s),s}}function ts(e,t){if(e===void 0)throw new Error("Unexpected undefined"+(""));return e}var Mp,Np=h(()=>{l();Mp=function(t,o){return Math.abs(t-o)<1};});function ov(e){for(var t=e.measurements,o=e.outerSize,r=e.scrollOffset,n=t.length-1,s=function(u){return t[u].start},a=$p(0,n,s,r),i=a;i<n&&t[i].end<r+o;)i++;return {startIndex:a,endIndex:i}}var ev,sn,Dp,Fp,tv,Vp,zp,$p,Ya=h(()=>{l();Bp();Np();ev=function(t){return t},sn=function(t){for(var o=Math.max(t.startIndex-t.overscan,0),r=Math.min(t.endIndex+t.overscan,t.count-1),n=[],s=o;s<=r;s++)n.push(s);return n},Dp=function(t,o){var r=t.scrollElement;if(r){var n=function(i){var c=i.width,u=i.height;o({width:Math.round(c),height:Math.round(u)});};n(r.getBoundingClientRect());var s=new ResizeObserver(function(a){var i=a[0];if(i!=null&&i.borderBoxSize){var c=i.borderBoxSize[0];if(c){n({width:c.inlineSize,height:c.blockSize});return}}n(r.getBoundingClientRect());});return s.observe(r,{box:"border-box"}),function(){s.unobserve(r);}}},Fp=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:true}),function(){r.removeEventListener("scroll",n);}}},tv=function(t,o,r){if(o!=null&&o.borderBoxSize){var n=o.borderBoxSize[0];if(n){var s=Math.round(n[r.options.horizontal?"inlineSize":"blockSize"]);return s}}return Math.round(t.getBoundingClientRect()[r.options.horizontal?"width":"height"])},Vp=function(t,o,r){var n,s,a=o.adjustments,i=a===void 0?0:a,c=o.behavior,u=t+i;(n=r.scrollElement)==null||n.scrollTo==null||n.scrollTo((s={},s[r.options.horizontal?"left":"top"]=u,s.behavior=c,s));},zp=function(t){var o=this;this.unsubs=[],this.scrollElement=null,this.isScrolling=false,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(i){o._measureElement(i.target,i);});}):null)};return {disconnect:function(){var a;return (a=n())==null?void 0:a.disconnect()},observe:function(a){var i;return (i=n())==null?void 0:i.observe(a,{box:"border-box"})},unobserve:function(a){var i;return (i=n())==null?void 0:i.unobserve(a)}}})(),this.range={startIndex:0,endIndex:0},this.setOptions=function(r){Object.entries(r).forEach(function(n){var s=n[0],a=n[1];typeof a>"u"&&delete r[s];}),o.options=nn({debug:false,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:false,getItemKey:ev,rangeExtractor:sn,onChange:function(){},measureElement:tv,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 s=o.scrollRect;o.scrollRect=n,(o.options.horizontal?n.width!==s.width:n.height!==s.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=true,o.scrollDirection=o.scrollOffset<n?"forward":"backward",o.scrollOffset=n,o.maybeNotify(),o.isScrollingTimeoutId=setTimeout(function(){o.isScrollingTimeoutId=null,o.isScrolling=false,o.scrollDirection=null,o.maybeNotify();},o.options.scrollingDelay));})));},this.getSize=function(){return o.scrollRect[o.options.horizontal?"width":"height"]},this.memoOptions=er(function(){return [o.options.count,o.options.paddingStart,o.options.scrollMargin,o.options.getItemKey]},function(r,n,s,a){return o.pendingMeasuredCacheIndexes=[],{count:r,paddingStart:n,scrollMargin:s,getItemKey:a}},{key:false}),this.getFurthestMeasurement=function(r,n){for(var s=new Map,a=new Map,i=n-1;i>=0;i--){var c=r[i];if(!s.has(c.lane)){var u=a.get(c.lane);if(u==null||c.end>u.end?a.set(c.lane,c):c.end<u.end&&s.set(c.lane,true),s.size===o.options.lanes)break}}return a.size===o.options.lanes?Array.from(a.values()).sort(function(p,m){return p.end-m.end})[0]:void 0},this.getMeasurements=er(function(){return [o.memoOptions(),o.itemSizeCache]},function(r,n){var s=r.count,a=r.paddingStart,i=r.scrollMargin,c=r.getItemKey,u=o.pendingMeasuredCacheIndexes.length>0?Math.min.apply(Math,o.pendingMeasuredCacheIndexes):0;o.pendingMeasuredCacheIndexes=[];for(var p=o.measurementsCache.slice(0,u),m=u;m<s;m++){var f=c(m),g=o.options.lanes===1?p[m-1]:o.getFurthestMeasurement(p,m),d=g?g.end:a+i,v=n.get(f),x=typeof v=="number"?v:o.options.estimateSize(m),w=d+x,R=g?g.lane:m%o.options.lanes;p[m]={index:m,start:d,size:x,end:w,key:f,lane:R};}return o.measurementsCache=p,p},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:function(){return o.options.debug}}),this.calculateRange=er(function(){return [o.getMeasurements(),o.getSize(),o.scrollOffset]},function(r,n,s){return o.range=ov({measurements:r,outerSize:n,scrollOffset:s})},{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:function(){return o.options.debug}}),this.maybeNotify=er(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=er(function(){return [o.options.rangeExtractor,o.calculateRange(),o.options.overscan,o.options.count,o.getSize()]},function(r,n,s,a,i){return i===0?[]:r(nn({},n,{overscan:s,count:a}))},{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:function(){return o.options.debug}}),this.indexFromElement=function(r){var n=o.options.indexAttribute,s=r.getAttribute(n);return s?parseInt(s,10):(console.warn("Missing attribute name '"+n+"={index}' on measured element."),-1)},this._measureElement=function(r,n){var s=o.measurementsCache[o.indexFromElement(r)];if(!s||!r.isConnected){o.measureElementCache.forEach(function(c,u){c===r&&(o.observer.unobserve(r),o.measureElementCache.delete(u));});return}var a=o.measureElementCache.get(s.key);a!==r&&(a&&o.observer.unobserve(a),o.observer.observe(r),o.measureElementCache.set(s.key,r));var i=o.options.measureElement(r,n,o);o.resizeItem(s,i);},this.resizeItem=function(r,n){var s,a=(s=o.itemSizeCache.get(r.key))!=null?s:r.size,i=n-a;i!==0&&(r.start<o.scrollOffset&&(process.env.NODE_ENV!=="production"&&o.options.debug&&console.info("correction",i),o._scrollToOffset(o.scrollOffset,{adjustments:o.scrollAdjustments+=i,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=er(function(){return [o.getIndexes(),o.getMeasurements()]},function(r,n){for(var s=[],a=0,i=r.length;a<i;a++){var c=r[a],u=n[c];s.push(u);}return s},{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:function(){return o.options.debug}}),this.getVirtualItemForOffset=function(r){var n=o.getMeasurements();return ts(n[$p(0,n.length-1,function(s){return ts(n[s]).start},r)])},this.getOffsetForAlignment=function(r,n){var s=o.getSize();n==="auto"&&(r<=o.scrollOffset?n="start":r>=o.scrollOffset+s?n="end":n="start"),n==="start"?r=r:n==="end"?r=r-s:n==="center"&&(r=r-s/2);var a=o.options.horizontal?"scrollWidth":"scrollHeight",i=o.scrollElement?"document"in o.scrollElement?o.scrollElement.document.documentElement[a]:o.scrollElement[a]:0,c=i-o.getSize();return Math.max(Math.min(c,r),0)},this.getOffsetForIndex=function(r,n){n===void 0&&(n="auto"),r=Math.max(0,Math.min(r,o.options.count-1));var s=ts(o.getMeasurements()[r]);if(n==="auto")if(s.end>=o.scrollOffset+o.getSize()-o.options.scrollPaddingEnd)n="end";else if(s.start<=o.scrollOffset+o.options.scrollPaddingStart)n="start";else return [o.scrollOffset,n];var a=n==="end"?s.end+o.options.scrollPaddingEnd:s.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 s=n===void 0?{}:n,a=s.align,i=a===void 0?"start":a,c=s.behavior;o.cancelScrollToIndex(),c==="smooth"&&o.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),o._scrollToOffset(o.getOffsetForAlignment(r,i),{adjustments:void 0,behavior:c});},this.scrollToIndex=function(r,n){var s=n===void 0?{}:n,a=s.align,i=a===void 0?"auto":a,c=s.behavior;r=Math.max(0,Math.min(r,o.options.count-1)),o.cancelScrollToIndex(),c==="smooth"&&o.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");var u=o.getOffsetForIndex(r,i),p=u[0],m=u[1];o._scrollToOffset(p,{adjustments:void 0,behavior:c}),c!=="smooth"&&o.isDynamicMode()&&(o.scrollToIndexTimeoutId=setTimeout(function(){o.scrollToIndexTimeoutId=null;var f=o.measureElementCache.has(o.options.getItemKey(r));if(f){var g=o.getOffsetForIndex(r,m),d=g[0];Mp(d,o.scrollOffset)||o.scrollToIndex(r,{align:m,behavior:c});}else o.scrollToIndex(r,{align:m,behavior:c});}));},this.scrollBy=function(r,n){var s=n===void 0?{}:n,a=s.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 s=n.adjustments,a=n.behavior;o.options.scrollToFn(r,{behavior:a,adjustments:s},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();},$p=function(t,o,r,n){for(;t<=o;){var s=(t+o)/2|0,a=r(s);if(a<n)t=s+1;else if(a>n)o=s-1;else return s}return t>0?t-1:0};});function nv(e){var t=eo.useReducer(function(){return {}},{})[1],o=rn({},e,{onChange:function(a){t(),e.onChange==null||e.onChange(a);}}),r=eo.useState(function(){return new zp(o)}),n=r[0];return n.setOptions(o),eo.useEffect(function(){return n._didMount()},[]),rv(function(){return n._willUpdate()}),n}function os(e){return nv(rn({observeElementRect:Dp,observeElementOffset:Fp,scrollToFn:Vp},e))}var rv,Xa=h(()=>{l();_p();Ya();Ya();rv=typeof document<"u"?eo.useLayoutEffect:eo.useEffect;});function Ja(e){let{allLabel:t,asComparison:o,colorKey:r,data:n,defaultValue:s,defaultValueType:a,hideLabel:i,resetSectionVars:c,iconKey:u,id:p,levels:m,limit:f,placeholder:g,searchIndexKey:d,searchIndexSeparator:v,section:x,settings:w}=e,{print:R}=Ze(),k=yv(p),P=is(p,x,k,o,c==="true"),U=o?`${k}-valueCompare`:`${k}-value`,G=o?`${k}-typeCompare`:`${k}-type`,V=useMantineTheme(),[B,E]=useState(false),[O,A]=useState(true),[C,N]=useState(""),[Z,W]=useState(false),[$,J]=useState([""].slice(1)),[M,z]=useState([]),[F,Y]=useState(""),ve=w[ft.DISABLED]||false,j=useMemo(()=>R?Array.from(new Set(n.filter(se=>M.includes(se[`${F} ID`])))).map(se=>se?.[F]).join(", "):"",[R]),ee=i==="true"||!e.label?jsx(Fragment,{}):jsx(ae,{component:"div",html:e.label,size:"sm",style:w}),re=useRef(null),oe=useRef(false),_=useRef(!!f&&f<M.length),T=$.length,L=m[T],q=$.filter(Boolean);$.length>0&&q.length===0&&q.push(`${t} ${L?.label}`),useEffect(()=>{if(!ve){let I=new URLSearchParams(window.location.search),se=I.get(U)||s,ne=I.get(G)||a;se&&ne?(z(Sv(se,s)),Y(ne)):(z([]),Y(""));}},[window.location.search,s,a,ve]),useEffect(()=>{let I=()=>{A(true);};return window.addEventListener("touchmove",I),()=>{window.removeEventListener("touchmove",I);}},[]);let Q=useMemo(()=>gv(n,m,r,u,d,v),[r,n,u,m,d,v]),K=useMemo(()=>{let I=hv(C),se=Array.from(bv(Q,I)).reverse();return Z?se:$.reduce((ne,Ye)=>ne.filter(be=>!Ye||be.searchindex.indexOf(Ye)>-1),se.filter(ne=>ne.type===L?.value))},[L,Q,C,Z,$]),ie=useRef(null),he=os({count:B?K.length:0,estimateSize:()=>30,getScrollElement:useCallback(()=>ie.current,[]),overscan:10,rangeExtractor:useCallback(I=>sn(I),[])}),[it,Ce]=useState(-1),xe=Math.min(it,K.length-1),Tt=useCallback(I=>{let se=$.concat(I);Z&&W(false),J(se);},[Z,$]),$t=useCallback(()=>{let I=$.slice(0,T-1);Z&&W(false),J(I);},[Z,$,T]),Rt=useCallback(I=>{N(I.currentTarget.value),!_.current&&n.length>0&&E(true);},[n,N,_,E]),_r=useCallback(()=>{N(""),P([],""),re.current?.focus(),f&&(_.current=false);},[N,P,re,f,_]),Eo=useCallback(I=>{let se=M.filter(ne=>ne!==I);se.length>0?P(se,F):P([],""),f&&se.length<f&&(_.current=false);},[M,F,P,f,_]),ko=useCallback(I=>{F!==I.type?P([I.value],I.type):M.includes(I.value)?Eo(I.value):f?(M.length<f&&P([...M,I.value],F),M.length===f&&P([...M.slice(1),I.value],F)):P([...M,I.value],F),N("");},[P,F,M,Eo,f]),Rs=useCallback(()=>{M.length>0&&C.length===0&&(P(M.slice(0,-1),F),E(true),f&&(_.current=false)),C.length>0&&N(C.slice(0,-1));},[P,M,F,C,N,E,f,_]),Es=useCallback(()=>{A(I=>I&&(oe.current=I,!I)),Ce(I=>I+1>=K.length?I:I+1);},[Ce,K]),ks=useCallback(()=>{let I=K[xe];I&&ko(I);},[K,xe,ko]),Cs=useCallback(()=>{E(false);},[E]),ws=useCallback(()=>{$t(),Ce(0);},[Ce,$t]),As=useCallback(()=>{let I=K[xe];!Z&&I&&I.type!==m[m.length-1]?.value&&(Tt(I.name),Ce(0));},[K,xe,Z,m,Ce,Tt]),Ps=useCallback(()=>{A(I=>I&&(oe.current=I,!I)),Ce(I=>I-1<0?0:I-1);},[Ce]),Is=({label:I,onRemove:se,...ne})=>jsxs("div",{style:{alignItems:"center",backgroundColor:V.colorScheme==="dark"?V.colors.dark[7]:V.colors.gray[1],borderRadius:V.radius.sm,cursor:"default",color:V.colorScheme==="dark"?V.colors.dark[0]:V.colors.gray[7],display:"flex",fontSize:rem(12),fontWeight:500,height:rem(22),margin:`calc(${V.spacing.xs} / 2 - ${rem(2)}) calc(${V.spacing.xs} / 2)`,maxWidth:`calc(100% - ${rem(10)})`,paddingLeft:`calc(${V.spacing.sm} / 1.5)`,paddingRight:0,userSelect:"none"},...ne,children:[jsx("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:I}),jsx(CloseButton,{"aria-hidden":true,iconSize:"70%",onMouseDown:se,radius:2,size:"sm",sx:{color:V.colorScheme==="dark"?V.colors.dark[0]:V.colors.gray[7],marginLeft:`calc(${V.spacing.sm} / 6)`},tabIndex:-1})]}),D=useMemo(()=>M.map(I=>Q.find(se=>se.value===I)).filter(I=>!!I).map((I,se)=>createElement(Is,{...I,index:se,label:I.label,key:I.value,onRemove:ne=>{ne.preventDefault(),ne.stopPropagation(),Eo(I.value);}})),[M]),ue=forwardRef(function({color:se,icon:ne,label:Ye,value:be,...Ls},Kf){return jsx("div",{ref:Kf,style:{cursor:"pointer",width:"100%"},...Ls,children:jsxs(Group,{align:"center",noWrap:true,spacing:"xs",w:"100%",children:[ne&&jsx(Box,{bg:se??"transparent",component:"img",w:20,h:20,src:ne}),jsx(Text,{lineClamp:1,size:"sm",children:Ye||be})]})})});return jsxs(Fragment,{children:[jsx(MediaQuery,{query:"print",styles:{display:"none"},children:jsx(Input.Wrapper,{label:ee,children:jsxs(Popover,{closeOnClickOutside:true,disabled:ve,keepMounted:true,opened:B,onChange:E,onClose:()=>{Ce(0),N("");},onOpen:()=>{K.length>0&&he.scrollToIndex(0);},shadow:"sm",width:"target",withinPortal:true,children:[jsx(Popover.Target,{children:jsxs(Box,{"aria-haspopup":"listbox",component:"div",onMouseLeave:()=>Ce(0),sx:{position:"relative","& .defaultValue":{backgroundColor:V.colorScheme==="dark"?V.colors.dark[5]:V.colors.gray[3],color:V.colorScheme==="dark"?V.colors.dark[1]:V.colors.gray[7]}},tabIndex:-1,children:[jsx("input",{type:"hidden",value:M.join(",")}),jsx(Input,{component:"div",disabled:ve,multiline:true,onMouseDown:I=>{I.preventDefault(),!_.current&&n.length>0&&E(!B),re.current?.focus();},rightSection:M.length>0?jsx(CloseButton,{disabled:ve,onClick:_r,onMouseDown:I=>I.preventDefault(),variant:"transparent"}):jsx(IconSelector,{color:V.colors.gray[6],size:18,stroke:1.5}),style:{overflow:"hidden"},w:"100%",children:jsxs(Box,{component:"div","data-clearable":true,sx:{alignItems:"center",boxSizing:"border-box",display:"flex",flexWrap:"wrap",marginLeft:`calc(-${V.spacing.xs} / 2)`,minHeight:`calc(${rem(36)} - ${rem(2)})`,"&[data-clearable]":{marginRight:rem(36)},"&::placeholder":{color:V.colorScheme==="dark"?V.colors.dark[3]:V.colors.gray[5],opacity:1}},children:[D,jsx("input",{autoComplete:"off","data-mantine-stop-propagation":B,onChange:Rt,onKeyDown:getHotkeyHandler([["ArrowDown",Es],["ArrowLeft",ws],["ArrowRight",As],["ArrowUp",Ps],["Backspace",Rs],["Enter",ks],["Escape",Cs]]),placeholder:M.length===0&&g||"",ref:re,readOnly:_.current,style:{appearance:"none",backgroundColor:"transparent",border:0,color:"inherit",flex:1,fontSize:V.fontSizes.sm,marginLeft:`calc(${V.spacing.xs} / 2)`,maxHeight:rem(22),minWidth:rem(60),outline:0,padding:0},type:"search",value:C})]})})]})}),jsx(Popover.Dropdown,{onMouseDown:I=>I.preventDefault(),p:0,children:jsx("div",{style:{display:"flex",maxHeight:rem(300)},children:jsx(Box,{component:"div","data-combobox-popover":true,onMouseDown:I=>I.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:I=>{I.stopPropagation();},px:"xs",position:"center",spacing:"xs",children:[jsx(Button,{onClick:()=>{Ce(0),W(true),J([]),K.length>0&&he.scrollToIndex(0);},size:"xs",variant:Z?"filled":"outline",children:t}),m.map((I,se)=>jsx(Button,{onClick:()=>{Z&&W(false);let ne=[""].slice(1),Ye=se;for(;Ye--;)ne[Ye]=$[Ye]||"";Ce(0),J(ne),K.length>0&&he.scrollToIndex(0);},size:"xs",variant:!Z&&$.length===m.findIndex(ne=>ne.value===I?.value)?"filled":"outline",children:I?.label},I?.value))]}),jsx(Divider,{})]}),T>0&&jsxs(Group,{align:"center",noWrap:true,px:"xs",children:[jsx(ActionIcon,{onClick:$t,size:"sm",children:jsx(IconChevronLeft,{})}),jsx("div",{children:q.map(I=>jsx(Text,{lineClamp:1,size:"xs",children:I},`${I}`))})]}),jsx(ScrollArea,{mah:250,onWheel:()=>A(true),px:"xs",style:{overflow:"auto",width:"100%"},viewportRef:ie,viewportProps:{tabIndex:-1},w:"100%",children:jsx("div",{style:{height:`${he.getTotalSize()}px`,position:"relative",width:"100%"},children:he.getVirtualItems().map(I=>{let se=K[I.index],ne=xe===I.index,Ye=M.includes(se.value);return K.length>0&&ne&&!O&&he.scrollToIndex(xe),jsxs(Group,{"aria-selected":ne,align:"center","data-hovered":ne||void 0,"data-index":I.index,"data-selected":Ye,id:se.vale,noWrap:true,onMouseEnter:be=>{be.preventDefault(),be.stopPropagation(),O&&(Ce(I.index),A(false));},onMouseMove:be=>{be.preventDefault(),be.stopPropagation(),A(true);},onMouseDown:be=>{be.preventDefault(),ko(se);},position:"apart",ref:he.measureElement,role:"option",spacing:"xs",sx:be=>({borderRadius:be.radius.xs,padding:"15px 5px 15px",paddingLeft:Z&&10*m.findIndex(Ls=>Ls?.value===se.type)||5,position:"absolute",top:0,left:0,height:`${I.size}px`,transform:`translateY(${I.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(ue,{index:I.index,...se}),!Z&&se.type!==m[m.length-1]?.value&&jsx(ActionIcon,{onMouseDown:be=>{be.preventDefault(),be.stopPropagation(),Tt(se.name);},size:"sm",tabIndex:-1,children:jsx(IconChevronRight,{})})]},se.value)})})})]})})})})]})})}),R&&jsxs(Text,{children:[ee,": ",j]})]})}var gv,hv,bv,yv,Sv,Yp=h(()=>{l();Xa();we();Zt();Ne();de();gv=(e=[],t=[],o="",r="",n="",s="|")=>{let a=t.map(v=>v.value).slice(),i=`${a.pop()}`,c=v=>v[o],u=v=>v[r],p=v=>{if(v[n])return typeof v[n]=="string"?v[n].split(s):v[n]},m=new Set,f=[],g=[],d=nest().rollup(v=>{let x=v[0],w=E=>E&&E.value&&!m.has(E.value),R=a.map(E=>x[`${E} ID`]),k=a.map(E=>x[E]),P=a.map((E,O)=>{if(g[O]!==k[O]){g[O]=k[O];let A=c[O]||c[c.length-1]||c,C=u[O]||u[u.length-1]||u,N=p[O]||p[p.length-1]||p;return {color:A(x,E)||void 0,icon:C(x,E)||void 0,value:`${R[O]}`,label:k[O],name:k[O],type:E,searchindex:k.slice(0,O+1).concat(N(x,E)).join("|")}}return {}}).filter(w);P.forEach(E=>m.add(E.value));let U=c[c.length-1]||c,G=u[u.length-1]||u,V=p[p.length-1]||p,B=v.map(E=>({color:U(E,i)||void 0,icon:G(E,i)||void 0,value:`${E[`${i} ID`]}`,label:E[i],name:E[i],type:i,searchindex:k.concat(E[i]).concat(V(E,i)).join("|")}));f.push(...P.concat(B));});return a.forEach(v=>{d.key(x=>`${x[`${v} ID`]}|${x[v]}`);}),d.entries(e),f},hv=e=>{if(!e)return /./i;let t=e.normalize("NFD").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"[^|]+");return RegExp(t,"i")},bv=(e,t)=>{let o=e.length,r,n=i=>r&&r.searchindex.includes(i.searchindex),a={next:()=>{for(let i=o-1;i>-1;i--){let c=e[i];if(t.test(`${c.value} ${c.label} ${c.searchindex}`)||n(c))return r=c,o=i,{done:false,value:c}}return {done:true,value:void 0}},[Symbol.iterator]:()=>a};return a},yv=e=>`multihierarchySelector${e}`,Sv=(e,t)=>e&&typeof e=="string"?e.split(","):t;});function ei({headings:e,settings:t,type:o,title:r,shortTitle:n,_iconType:s,_iconVariant:a,_icon:i,_iconRadius:c,_iconSize:u,_iconPadding:p}){let{min:m="1",max:f="6",icons:g="yes"}=t||{},d=Yo(parseInt(m,10),parseInt(f,10),e),v=g==="yes",x=ke(r)||"",w=ke(n||r)||"",R=x&&x.length>0,k=s&&s!=="none",U=`(max-width: ${useMantineTheme().breakpoints.md})`,G=useMediaQuery(U),V=G?w:x,B=t&&t.align?String(t.align):"left",E=vr(B),O=Ge(B),A=Je(B),C=t&&t.titlePosition?String(t.titlePosition):"left",N=useMemo(()=>{let J={right:"left",left:"right"},M=R&&["left","right"].includes(C),z={};if(M){let F=C==="right";z={spacing:"xs",position:F&&J[O]?J[O]:O,style:{flexDirection:F?"row-reverse":"row"},noWrap:true};}else z={spacing:"xs",align:A,justify:"center",style:{flexDirection:C==="bottom"?"column-reverse":"column"}};return {element:M?Group:Stack,props:z}},[R,O,A,C]),Z=useMemo(()=>R?jsxs(Group,{spacing:"xs",position:O,noWrap:true,children:[k&&jsx(ye,{blockType:"title",iconType:s,iconVariant:a,iconRadius:c,iconSize:u,icon:i,iconPadding:p}),jsx(ae,{style:{...t},html:V,lineClamp:1})]}):null,[R,k,O,V]),W=useMemo(()=>G?jsx(Cv,{contentOutline:d,showIcons:v,titleElement:Z,wrapper:N}):null,[G,Z,N]),$=useMemo(()=>G?null:o==="multilevel"?jsx(wv,{contentOutline:d,showIcons:v,align:E}):jsx(kv,{contentOutline:d,showIcons:v,align:E}),[d,v,E,G]);return jsxs(Fragment,{children:[G&&W,!G&&jsxs(N.element,{pos:"relative",...N.props,children:[R&&Z,$]})]})}var Qp,kv,nd,Cv,wv,sd=h(()=>{l();Ne();Jt();He();Yt();Jt();we();Qp=e=>t=>({display:"flex",gap:t.spacing.md,justifyContent:e,listStyleType:"none"}),kv=({contentOutline:e,showIcons:t,align:o})=>{let[r,n]=useState(null);useEffect(()=>{let a=()=>{let i=document.querySelector(".bespoke-nav");if(!i)return;let c=i.getBoundingClientRect(),u=false;e.forEach(p=>{let m=document.getElementById(`bespoke-title-${p.id}`);m&&m.getBoundingClientRect().top<=c.bottom&&(n(p.id),u=true);}),u||n(null);};return window.addEventListener("scroll",a),()=>{window.removeEventListener("scroll",a);}},[e]);let s=a=>!a||!a?.length?null:jsx(Fragment,{children:a.map(i=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${i.id}`,children:jsxs(Group,{spacing:"sm",noWrap:true,children:[t&&jsx(ye,{...i.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:i.label}})]})})}),jsx(Box,{pl:"xs",children:s(i.children)})]},i.id))});return jsx(Fragment,{children:jsx(Box,{component:"nav",className:"bespoke-nav",children:jsx(List,{sx:a=>({display:"flex",gap:a.spacing.md,justifyContent:o,listStyleType:"none"}),children:e?.map(a=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${a.id}`,"data-active":a.id===r,children:jsxs(Group,{spacing:"sm",noWrap:true,children:[t&&jsx(ye,{...a.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:a.label}})]})})}),a?.children?.length?jsx(Menu.Dropdown,{children:s(a.children)}):null]})},a.id))})})})},nd=({contentOutline:e,closeNav:t,showIcons:o})=>{let[r,n]=useState(null);return jsx(Stack,{children:e.map(s=>s.children.length?jsxs(Fragment,{children:[jsxs(Group,{spacing:0,noWrap:true,children:[jsx(UnstyledButton,{w:"100%",component:"a",onClick:t,href:`#bespoke-title-${s.id}`,children:jsxs(Group,{spacing:"sm",noWrap:true,children:[o&&jsx(ye,{...s.iconProps,iconSize:"sm",iconPadding:"2"}),jsx(Text,{dangerouslySetInnerHTML:{__html:s.label}})]})},s.id),jsx(ActionIcon,{component:"a",size:"lg",onClick:()=>n(a=>a===s.id?null:s.id),children:jsx(IconChevronDown,{style:{transition:"transform 0.2s",transform:r===s.id?"rotate(-180deg)":"none"},stroke:1})})]},s.id),jsx(Collapse,{in:r===s.id,pl:"sm",transitionTimingFunction:"linear",transitionDuration:200,children:jsx(nd,{contentOutline:s.children,closeNav:t,showIcons:o})})]}):jsx(Group,{noWrap:true,children:jsx(UnstyledButton,{display:"flex",w:"100%",component:"a",href:`#bespoke-title-${s.id}`,children:jsxs(Group,{spacing:"sm",noWrap:true,children:[o&&jsx(ye,{...s.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:s.label}})]})},s.id)},s.id))})},Cv=({contentOutline:e,showIcons:t,titleElement:o,wrapper:r})=>{let[n,{toggle:s}]=useDisclosure(false),a=n?"Close content outline":"Open content outline";return jsxs(Box,{className:"bespoke-mobile-nav",component:"nav",children:[jsxs(r.element,{className:"bespoke-mobile-nav-header",...r.props,onClick:s,children:[o&&o,jsx(ActionIcon,{className:"bespoke-mobile-nav-toggle","aria-label":a,size:"lg",variant:"subtle",children:n?jsx(IconChevronUp,{size:"xl",stroke:1.5}):jsx(IconChevronDown,{size:"xl",stroke:1.5})})]}),jsx(Collapse,{in:n,mt:"md",className:"bespoke-mobile-nav-body",children:jsx(nd,{contentOutline:e,closeNav:s,showIcons:t})})]})},wv=({contentOutline:e,showIcons:t,align:o})=>{let[r,n]=useState(null),[s,a]=useState(null);useEffect(()=>{let c=()=>{let u=document.querySelector(".bespoke-nav");if(!u)return;let p=u.getBoundingClientRect(),m=false;e.forEach(f=>{let g=document.getElementById(`bespoke-title-${f.id}`);g&&(g.getBoundingClientRect().top<=p.bottom&&(n(f.id),a(null),m=true),f.children.forEach(v=>{let x=document.getElementById(`bespoke-title-${v.id}`);x&&x.getBoundingClientRect().top<=p.bottom&&(a(v.id),n(f.id),m=true);}));}),m||(n(null),a(null));};return window.addEventListener("scroll",c),()=>{window.removeEventListener("scroll",c);}},[e]);let i=c=>!c||!c?.length?null:jsx(Fragment,{children:c.map(u=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${u.id}`,children:jsxs(Group,{spacing:"sm",noWrap:true,children:[t&&jsx(ye,{...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:Qp(o),children:e?.map(c=>jsx(List.Item,{children:jsx(Anchor,{href:`#bespoke-title-${c.id}`,"data-active":r===c.id,onClick:()=>n(c.id),children:jsxs(Group,{spacing:"sm",noWrap:true,children:[t&&jsx(ye,{...c.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:c.label}})]})})},c.id))}),r&&e.find(c=>c.id===r)?.children.length>0&&jsx(List,{className:"bespoke-nav-level2",sx:Qp(o),children:e.find(c=>c.id===r)?.children.map(c=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${c.id}`,"data-active":c.id===s,children:jsxs(Group,{spacing:"sm",noWrap:true,children:[t&&jsx(ye,{...c.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:c.label}})]})})}),c?.children?.length?jsx(Menu.Dropdown,{children:i(c.children)}):null]})},c.id))})]})};});function oi(e){let{related_reports:t,settings:o}=e,r=X(f=>f.status.currentLocale),n=X(f=>f.status.localeDefault),s=Gn(),a=useRouter(),{components:i}=Fe();if(!t?.length)return;let c=r===n?"":`/${r}`,u=f=>{a.push(`${f}`);},p=i?.ReportTile?i.ReportTile:ri,m=Je(o&&o.align?String(o.align):"center");return jsx(Grid,{justify:m,children:t.map(f=>{let g=`${c}${s}${f.link}`,d=f.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}})),v=f.entities.map(k=>k.id).join("-"),x=f.entities.map(k=>k.name).join(" & "),w=f.entities[0]?f.entities[0].report_id:null,R=k=>{k.preventDefault(),u(g);};return jsx(Grid.Col,{xs:12,sm:6,md:4,lg:4,xl:3,children:jsx(p,{reportId:w,reportName:x,members:d,href:g,onClick:R})},v)})})}var id=h(()=>{l();ce();Le();ni();Ne();He();});function si({id:e,label:t,settings:o,showIcon:r,fullWidth:n,showWhenDisabled:s}){let a=It(e).data,{sectionVariables:i,resetSectionVariables:c}=_e(a?.section_id),u=!!Object.keys(i).length,p=Je(o&&o.align?o.align:"left");return !u&&!s?null:jsx(Button,{onClick:()=>c(),disabled:!u,fullWidth:n,sx:{justifySelf:p},children:jsxs(Group,{align:"center",children:[t,r&&jsx(IconRefresh,{})]})})}var cd=h(()=>{l();Le();He();});function ai({settings:e,label:t,removeLabel:o,showIcon:r,position:n="center",asComparison:s=false}){let a=X(k=>k.records.entities.report),i=X(k=>k.variables.attributes),c=e&&e.search?e.search:"inline",u=Object.values(a)[0].settings,p=useRouter(),{comparisonLoaded:m,loading:f}=bt(),g=Object.keys(p.query).includes("compare"),v=m&&g?jsx(Button,{onClick:()=>{let k={...p.query};delete k.compare,p.push({pathname:p.pathname,query:k},void 0,{shallow:true});},rightIcon:jsx(IconX,{}),children:o||"Remove Comparison"}):jsx(Button,{loading:f,children:jsxs(Group,{align:"center",children:[t||"Add Comparison",r&&jsx(IconPlus,{})]})}),x={searchReportParams:{report:[Number(Object.keys(a)[0])],variant:u.compareLevels?[]:[i.variant_id1]}},R=xr(v,c,k=>{p.push({pathname:p.pathname,query:{...p.query,compare:k.reportPath}});},x);return s?null:jsx(Group,{position:n,children:g?v:R})}var dd=h(()=>{l();Ne();ce();fo();});function li({columns:e=[],data:t=[],tableProps:o={},sectionId:r=null}){let[n,s]=useState(false),[a,i]=useState({}),c=useMemo(()=>e.map(f=>f.accessorKey),[e]),u=useMemo(()=>t.filter(f=>typeof f=="object"&&f!==null&&!Array.isArray(f)&&Object.keys(f).some(g=>c.includes(g))),[c,t]),p=useMemo(()=>e.map(f=>({...f,Cell:({renderedCellValue:g})=>jsx(ae,{html:`${g}`}),filterFn:"contains"})),[e]),{locale:m}=useRouter();return useEffect(()=>{(async()=>{try{let g=m||"en",d=`${g.toUpperCase()}`,v=await import(`mantine-react-table/locales/${g}.js`);i(v[`MRT_Localization_${d}`]);}catch(g){console.error("Error loading translations:",g);}})();},[m]),jsx(MantineReactTable,{...o,autoResetPageIndex:false,columns:p,data:u,enableColumnFilterModes:true,enableFilterMatchHighlighting:false,globalFilterFn:"contains",layoutMode:"grid",localization:a,onIsFullScreenChange:f=>{let g=document.getElementById(`section-${r}`);g&&(f?g.style.zIndex="10":g.style.zIndex="1"),s(f);},state:{...o.state,isFullScreen:n}})}var gd=h(()=>{l();we();});function ci({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 bd=h(()=>{l();});function qv({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 ui(e){let t=jv();return jsx(t,{block:e})}var jv,vd=h(()=>{l();Ne();jv=()=>{let{components:e}=Fe(),t=qv;return e?.CustomFallback&&(t=e.CustomFallback),t};});function Fe(){return useMantineTheme().other.bespokeStyles??{}}var pi=h(()=>{l();});function Xv({block:e}){let{id:t}=e;return jsxs(Grid,{className:"bespoke-client-side-section-skeleton","data-section-skeleton-id":t,children:[jsx(Grid.Col,{md:3,lg:4,children:jsxs(Stack,{children:[jsx(Skeleton,{height:20}),jsx(Skeleton,{height:10}),jsx(Skeleton,{height:10}),jsx(Skeleton,{height:10})]})}),jsx(Grid.Col,{md:9,lg:8,children:jsx(Skeleton,{height:"100%"})})]})}function mi(e){let t=Qv();return jsx(t,{block:e})}var Qv,Td=h(()=>{l();pi();Qv=()=>{let{components:e}=Fe(),t=Xv;return e?.CustomSkeleton&&(t=e.CustomSkeleton),t};});var or,fi=h(()=>{l();or=class extends eo__default.Component{constructor(t){super(t),this.state={hasError:false};}static getDerivedStateFromError(t){return console.info("getDerivedStateFromError",t),{hasError:true}}componentDidCatch(t,o){console.error("Error information:",o.componentStack),notifications.show({autoClose:false,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}};});var kd={};Os(kd,{default:()=>Ed});function Ed(e){let{print:t}=Ze(),{block:o,active:r,locale:n,variables:s,configOverride:a={}}=e,i=kt(o),c=po(n),u={variables:s},p=useRouter(),{sectionVariables:m,setSectionVariables:f,resetSectionVariables:g}=_e(o.section_id),d=Ho(),v=Ee(),x=JSON.stringify(m),w=useMemo(()=>{if(!i?.logic)return {error:"Add a Configuration"};let V=gt({logic:i.logic},c,u).logic,B={router:p,section:{variables:m,setVariables:f,resetVariables:g}};return Xo(V,c,s,n,o.id,{},B,d,v)},[o,r,s,x,v.status]),{type:R}=w.config||{},k=R&&gi[R]?R:"Treemap";gi[R]||(w.config={error:`"${R}" is not a valid Visualization Type`});let P=gi[k],U=useMemo(()=>{let{_data:V,...B}=w.config;return ox(B,t)},[w,t]),G={locale:n,variables:s,...U,...a};return jsx("div",{className:"bespoke-Viz","data-ignore-print":G._printIgnore?"true":void 0,children:jsx("div",{style:{display:"flex",flex:"1 1 100%",minHeight:R===Zo?void 0:400},children:jsx(or,{fallback:jsx("p",{children:"Error in d3plus viz config."}),children:jsx(P,{style:{flex:1},dataFormat:V=>{let B;try{B=w.dataFormat(V);}catch(E){console.error("Error in dataFormat: ",E),B=[];}return B},linksFormat:w.linksFormat,nodesFormat:w.nodesFormat,topojsonFormat:w.topojsonFormat,config:{...G,sectionVariables:x}},"viz-key")})})})}var gi,ox,Cd=h(()=>{l();Lo();Jr();Po();Le();$e();fi();Zt();Kn();gi={...ex,[Zo]:jn},ox=(e,t)=>{let o={...e};return t&&(o.detectResize=false,o.detectResizeDelay=0,o.detectVisible=false,o.detectVisibleInterval=0,o.duration=0,o.shapeConfig={...o.shapeConfig,duration:0}),o};});var nx,wd=h(()=>{l();de();hp();Tp();Ep();Cp();Ip();Lp();Op();Yp();sd();id();cd();dd();gd();bd();vd();Td();nx=rx(()=>Promise.resolve().then(()=>(Cd(),kd)),{ssr:false}),{[S.PARAGRAPH]:Fa,[S.STAT]:za,[S.SUBTITLE]:$a,[S.TITLE]:Ga,[S.SELECTOR]:ja,[S.VIZ]:nx,[S.GENERATOR]:es,[S.SECTION_FLAG]:es,[S.IMAGE]:Ka,[S.NAV]:ei,[S.RELATED]:oi,[S.RESET_BUTTON]:si,[S.COMPARISON_BUTTON]:ai,[S.TABLE]:li,[S.BUTTON]:ci,[S.MULTIHIERARCHY_SELECTOR]:Ja,[S.FALLBACK]:ui,[S.SKELETON]:mi};});var sx,Ad,Pd=h(()=>{l();sx=(e,t)=>{let o=e.allLabel||"All",r=e.colorKey||"",n=e.data||[],s=e.hideLabel||"false",a=e.resetSectionVars||"false",i=e.iconKey||"",c=e.label||"Unlabeled Multihierarchy Selector",u=e.levels||[],p=e.limit||void 0,m=e.placeholder||"",f=e.searchIndexKey||"",g=e.searchIndexSeparator||"",d,v;return e.defaultValue&&e.defaultValueType&&(d=e.defaultValue,v=e.defaultValueType),(!d||!v)&&(d=[],v=""),{allLabel:o,colorKey:r,data:n,defaultValue:d,defaultValueType:v,hideLabel:s,resetSectionVars:a,iconKey:i,id:t,label:c,levels:u,limit:p,placeholder:m,searchIndexKey:f,searchIndexSeparator:g}},Ad=sx;});var ax,Id,ix,Ld,Od=h(()=>{l();de();Rn();ax=e=>Array.isArray(e)?e.map(t=>typeof t=="string"?{id:t,label:t}:t):[],Id=(e,t)=>t===Ie.MULTI&&!Array.isArray(e)?[e]:e,ix=(e,t)=>{let o=e.type||Ie.SINGLE,r=e.component||"Selector",n=e.hideLabel||"false",s=e.resetSectionVars||"false",a=e.name||"Unlabeled Selector",i=ax(e.options||[]),c;if(e.defaultValue){let u=Id(e.defaultValue,o);Io(o,u,i)&&(c=u);}if(!c){let u=i&&i[0]&&i[0].id||i[0]||"";c=Id(u,o);}return {id:t,name:a,type:o,options:i,component:r,defaultValue:c,hideLabel:n,resetSectionVars:s}},Ld=ix;});var lx,fn,_d=h(()=>{l();de();Pd();Od();lx={[S.SELECTOR]:Ld,[S.MULTIHIERARCHY_SELECTOR]:Ad},fn=lx;});function bi({paragraph:e,tooltip:t,settings:o}){return jsx(ae,{component:"p",html:e||`Lorem ipsum dolor sit amet,
13
13
  consectetur adipiscing elit. Etiam justo purus, placerat ac turpis at,
14
14
  dignissim interdum eros. Curabitur non tincidunt libero.
15
15
  Suspendisse quis nibh in massa tincidunt feugiat sit amet vitae nisl.
16
16
  In pulvinar sapien ut tincidunt volutpat. Donec auctor tellus eu augue feugiat,
17
- a viverra sapien pulvinar.`,style:o,append:t?jsx(De,{content:t,style:{display:"inline-block",verticalAlign:"bottom"}}):jsx(Fragment,{}),isPreview:true})}var Bd=h(()=>{l();Qt();we();});function yi({subtitle:e,title:t,value:o,tooltip:r,settings:n,_iconType:s,_iconVariant:a,_icon:i,_iconRadius:c,_iconSize:u,_iconPadding:p}){let m=t||"<span class='cr-block-placeholder'>Title</span>",f=o||"<span class='cr-block-placeholder'>Big Stat</span>",g=e||"<span class='cr-block-placeholder'>Subtitle</span>",d=n&&n.align||"left";return jsx("div",{className:"bespoke-Stat-root",children:jsxs(Group,{className:"bespoke-StatGroup-wrapper",position:Ge(d),children:[s!=="none"&&s&&jsx(ye,{blockType:"stat",iconType:s,iconVariant:a,iconRadius:c,iconSize:u,icon:i,iconPadding:p}),jsxs("div",{className:"bespoke-Stat-wrapper",children:[jsx(ae,{component:"div",size:"md",html:m,style:n,isPreview:true}),jsx(ae,{component:"div",size:"xl",html:f,style:n,isPreview:true}),jsx(ae,{component:"div",size:"sm",html:g,style:n,isPreview:true})]},"stat"),r&&jsx(De,{content:r})]})})}var Nd=h(()=>{l();Qt();Jt();we();He();});function Si({subtitle:e,tooltip:t,settings:o}){let r=ke(e)||"<span class='cr-block-placeholder'>Small subtitle.</span>",n=o&&o.align?o.align:"left";return jsxs(Group,{spacing:"sm",position:Ge(n),children:[jsx(ae,{size:"sm",html:r,isPreview:true}),t&&jsx(De,{content:t,style:{display:"inline-flex"}})]})}var Fd=h(()=>{l();Qt();Yt();we();He();});function vi({title:e,tooltip:t,_iconType:o,_iconVariant:r,_icon:n,settings:s,_iconRadius:a,_iconSize:i,_iconPadding:c}){let u=ke(e)||"Title",p=s&&s.order?parseInt(s.order,10):1,m=p<=6?p:1,f=!!(s&&s.search&&s.search!=="off"),g=s&&s.search?s.search:"",d=s&&s.align?s.align:"left";return jsxs(Group,{spacing:"sm",position:Ge(d),children:[o!=="none"&&o&&jsx(ye,{blockType:"title",iconType:o,iconVariant:r,iconRadius:a,iconSize:i,icon:n,iconPadding:c}),jsx(ae,{component:"h",order:m,style:s,html:u,isPreview:true}),f&&jsx(Tooltip,{label:`Click will open '${g}' report search`,children:jsx(ActionIcon,{variant:"light",children:jsx(IconSearch,{size:20})})}),t&&jsx(De,{content:t})]})}var Vd=h(()=>{l();Qt();Yt();Jt();we();He();});function Ri(e){let{id:t,type:o,defaultValue:r,options:n,name:s,settings:a,hideLabel:i,component:c,resetSectionVars:u,section:p}=e,m=useDispatch(),f=useContext(Kt),g=Ee(),d=X(w=>w.status.query),{sectionVariables:v,resetSectionVariables:x}=_e(p),C=wx(t),R=useMemo(()=>d[C]||r,[d[C],o,r]),k=useMemo(()=>Ax(d[C],r),[d[C],o,r]),[A,U]=useState(n?.map(w=>({value:w.id,label:w.label,imageUrl:w.imageUrl}))||[]),[G,F]=useState((n||[]).map(w=>w.id).join("-"));useEffect(()=>{let w=n.map(W=>`${W.label}|${W.id}`).join("-");if(G===w)return;F(w);let N=n.map(W=>({value:W.id,label:W.label}));U(N);let Z=o===Ie.SINGLE?R:k;Io(o,Z,n)||m(va(f,C,g));},[JSON.stringify(n),t]);let B=()=>{u==="true"&&v&&x();},E=w=>{m(Go(f,C,w,g)),B();},O=w=>{m(Go(f,C,w.join(),g)),B();},P=i==="true"?jsx(Fragment,{}):jsx(ae,{component:"div",html:s,size:"sm",style:a,isPreview:true});return A.length===0?jsx(Text,{c:"dimmed",size:"xs",children:"No options defined yet. Selector hidden in report."}):A.length===1?jsxs(Text,{c:"dimmed",size:"xs",children:["Only one option defined. Selector hidden in report. ",JSON.stringify(A)]}):{[Ie.SINGLE]:c===xn.SEGMENTED_CONTROL?jsxs("div",{children:[P,jsx(SegmentedControl,{data:A,value:A.map(w=>w.value).includes(R)?R:"",onChange:E,fullWidth:true})]}):jsx(Select,{label:P,data:A,value:R,onChange:E,itemComponent:Px,styles:{label:{display:i==="true"?"none":"block"}}}),[Ie.MULTI]:jsx(MultiSelect,{label:P,data:A,value:k,onChange:O,styles:{label:{display:i==="true"?"none":"block"}}})}[o]}var wx,Ax,Px,Ud=h(()=>{l();Kr();Rn();de();ce();uo();we();Le();$e();wx=e=>`selector${e}id`,Ax=(e,t)=>e&&typeof e=="string"?e.split(","):t,Px=forwardRef(function({imageUrl:t,label:o,...r},n){return jsx("div",{ref:n,...r,children:jsxs(Group,{noWrap:true,children:[t&&jsx(Box,{component:"img",w:25,h:25,src:t}),jsx("div",{children:jsx(Text,{size:"sm",children:o})})]})})});});var Gd=h(()=>{});function wi({dimmed:e=false,label:t,root:o=true,value:r,parentIsArray:n=false,level:s=0}){let a=useMantineTheme();if(s===Ci)return null;let i=jsx(Text,{lineClamp:1,size:"xs",variant:"dimmed",p:5,children:"[Max depth hitted for preview]"}),c=ki(r),u=r,p=JSON.stringify(u),m=100,f=1e3,g=!!(p&&p.length>m),d=10,v={control:{padding:"5px 0px 5px 5px"},label:{padding:"5px 0px"},content:{paddingTop:0,paddingBottom:0,paddingRight:0}};if(c==="object")return jsx(Accordion,{className:"cr-variable-accordion",variant:"contained",styles:v,children:jsxs(Accordion.Item,{value:"label",children:[jsx(Accordion.Control,{children:jsx(Text,{lineClamp:1,size:"xs",weight:700,color:e?"dimmed":a.primaryColor,children:o?`{{${t}}}`:n?`[${t}]`:t})}),jsx(Accordion.Panel,{children:s+1<Ci?Object.keys(r).sort((x,C)=>{let R=ki(r[x]),k=ki(r[C]);return R!==k?Hd.indexOf(R)-Hd.indexOf(k):x.localeCompare(C)}).map(x=>jsx(wi,{root:false,label:x,value:r[x],level:s+1},x)):i})]})});if(c==="array"){let x=r.length>d,C=x?r.slice(0,d):r,R=x?r.length-d:0;return jsx(Accordion,{className:"cr-variable-accordion",variant:"contained",styles:v,children:jsxs(Accordion.Item,{value:"label",children:[jsx(Accordion.Control,{children:jsx(Text,{lineClamp:1,size:"xs",weight:700,p:0,color:e?"dimmed":a.primaryColor,children:o?`{{${t}}}`:n?`[${t}]`:t})}),jsxs(Accordion.Panel,{children:[s+1<Ci?C.map((k,A)=>jsx(wi,{root:false,label:A,value:k,level:s+1,parentIsArray:true},A)):i,x&&jsxs(Text,{lineClamp:1,size:"xs",variant:"dimmed",p:5,children:["[+ ",R," other elements]"]})]})]})})}return c==="string"?u=g?`"${u.substring(0,m)} ... "`:`"${u}"`:c==="error"?u=`Error: ${u.message}`:c==="undefined"?u=c:u.toString&&(u=u.toString()),jsxs(Group,{noWrap:true,spacing:0,children:[jsx(Text,{color:e?"dimmed":a.primaryColor,lineClamp:1,size:"xs",pl:5,style:{overflow:"visible",wordBreak:"keep-all",whiteSpace:"nowrap"},weight:700,children:o?`{{${t}}}`:n?`[${t}]`:t}),jsx(Prism,{className:"cr-variable",language:"jsx",noCopy:true,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}),g&&jsxs(HoverCard,{width:500,shadow:"md",withinPortal:true,children:[jsx(HoverCard.Target,{children:jsx(ActionIcon,{children:jsx(IconCodePlus,{})})}),jsx(HoverCard.Dropdown,{w:500,children:jsx(Text,{size:"sm",maw:"100%",style:{wordBreak:"break-all",whiteSpace:"pre-wrap",overflowWrap:"break-word"},children:p.substring(0,f)})})]})]})}var ki,Hd,Ci,Wd,qd=h(()=>{l();Gd();ki=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"],Ci=5;Wd=wi;});var jd,Kd=h(()=>{l();jd=e=>t=>t.replace(new RegExp(`^${e}`),"").startsWith("_");});function Fx({reserved:e=[],id:t,variables:o={},showInternal:r=false}){let s=It(t==="attributes"?null:t).data,a=s?s.type:"block",i=s?.type&&s?.id?`${s.type}${s.id}`:"",c=Object.keys(o).filter(r?()=>true:u=>!jd(i)(u));return jsx(Stack,{spacing:0,children:c.length?c.map(u=>jsx(Wd,{dimmed:e.includes(u),label:u,value:o[u]},u)):jsx(Text,{color:"dimmed",size:"xs",children:jsx("i",{children:`empty ${a}`})})})}var Yd,Xd=h(()=>{l();qd();ce();Kd();Yd=Fx;});function jx({outputVariables:e,status:t,hasAPI:o=false,debug:r,type:n}){let[s,a]=useState(false),i=o&&!Object.keys(e).length&&!t.error,c=Object.keys(e).some(p=>p.startsWith("_"));return r?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"}),c&&jsx(Switch,{label:"Show internal variables",mb:"xs",size:"xs",checked:s,onChange:p=>a(p.currentTarget.checked)}),jsx(Yd,{variables:e,showInternal:s})]}):jsx(Center,{children:jsx(Badge,{color:"gray",variant:"outline",children:n.toUpperCase()},"type")})}var Pi,Qd=h(()=>{l();Xd();Pi=jx;});function Ii(e){let{alt:t,src:o,desc:r,title:n,settings:s,...a}=e,i=ke(t),c=ke(o),u=ke(r),p=jsx("img",{src:c,alt:i,style:a}),m=s&&s.align?String(s.align):"left";return (u&&u.length||n&&n.length)&&(p=jsxs(Stack,{className:"bespoke-Image-wrapper",align:Je(m),spacing:"sm",children:[n&&jsx(ae,{component:"p",html:n,style:s,isPreview:true}),p,r&&jsx(ae,{component:"p",size:"sm",html:r,style:s,isPreview:true})]})),c&&i?p:jsx(Center,{mih:100,bg:"white",children:jsx(Badge,{color:"gray",variant:"outline",children:"IMAGE"},"type")})}var Zd=h(()=>{l();Yt();we();He();});function _i({headings:e,settings:t,title:o,shortTitle:r,_iconType:n,_iconVariant:s,_icon:a,_iconRadius:i,_iconSize:c,_iconPadding:u}){let{min:p="1",max:m="6",icons:f="yes"}=t||{},g=ke(o)||"",d=ke(r||o)||"",v=g&&g.length>0,x=n&&n!=="none",C=d===g?`${g}`:`${g} (${d})`,R=Yo(parseInt(p,10),parseInt(m,10),e),k=f==="yes",A=t&&t.align?String(t.align):"left",U=vr(A),G=Ge(A),F=Je(A),B=t&&t.titlePosition?String(t.titlePosition):"left",E=useMemo(()=>{let P={right:"left",left:"right"},w=v&&["left","right"].includes(B),N={};if(w){let Z=B==="right";N={spacing:"xs",position:Z&&P[G]?P[G]:G,style:{flexDirection:Z?"row-reverse":"row"},noWrap:true};}else N={spacing:"xs",align:F,justify:"center",style:{flexDirection:B==="bottom"?"column-reverse":"column"}};return {element:w?Group:Stack,props:N}},[v,G,F,B]),O=P=>!P||!P?.length?null:jsx(Fragment,{children:P.map(w=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${w.id}`,children:jsxs(Group,{spacing:"sm",children:[k&&jsx(ye,{...w.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:w.label}})]})})},w.id),jsx(Box,{pl:"xs",children:O(w.children)})]},w.id))});return jsxs(E.element,{pos:"relative",...E.props,children:[v&&jsxs(Group,{spacing:"xs",position:G,noWrap:true,children:[x&&jsx(ye,{blockType:"title",iconType:n,iconVariant:s,iconRadius:i,iconSize:c,icon:a,iconPadding:u}),jsx(ae,{style:t,html:C,isPreview:true,lineClamp:1})]}),jsxs(List,{sx:P=>({display:"flex",gap:P.spacing.md,justifyContent:U,alignItems:"center",listStyleType:"none"}),children:[R?.map(P=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:400,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${P.id}`,children:jsxs(Group,{spacing:"sm",noWrap:true,children:[k&&jsx(ye,{blockType:"nav",...P.iconProps,iconSize:"sm",iconPadding:"2"}),jsx(Text,{dangerouslySetInnerHTML:{__html:P.label}})]})})}),P?.children?.length?jsx(Menu.Dropdown,{children:O(P.children)}):null]})},P.id)),!R||R.length===0&&jsx(List.Item,{children:jsx(Text,{color:"dimmed",children:"- Include some titles as inputs to see the Nav component -"})})]})]})}var em=h(()=>{l();Qe();Jt();He();we();Jt();Yt();});function Mi(e){let{related_reports:t,settings:o}=e;if(!t?.length)return jsx(Text,{children:"There are no available members related to your current selection and report."});let r=vr(o&&o.align?String(o.align):"left");return jsx(List,{sx:()=>({display:"flex",justifyContent:r,"& li":{marginRight:"1rem"}}),children:t.map(n=>jsx(List.Item,{children:n.entities.map(s=>s.name).join(" & ")},n.link))})}var om=h(()=>{l();He();});function Di({id:e,label:t,settings:o,showIcon:r,fullWidth:n,showWhenDisabled:s}){let a=It(e).data,{sectionVariables:i,resetSectionVariables:c}=_e(a?.section_id),u=!!Object.keys(i).length,p=Je(o&&o.align?o.align:"left");return jsxs(Stack,{align:p,children:[!u&&!s&&jsx(Text,{size:"xs",ta:o?.align||"left",children:"Reset button will not be shown on its disabled state"}),jsx(Button,{onClick:()=>c(),disabled:!u,fullWidth:n,children:jsxs(Group,{align:"center",children:[t,r&&jsx(IconRefresh,{})]})})]})}var nm=h(()=>{l();Le();He();});function Fi({settings:e,label:t,showIcon:o,position:r="center"}){let n=e&&e.search?e.search:"";return jsxs(Group,{position:r,children:[jsx(Tooltip,{label:`Click will open '${n}' report search`,children:jsx(Button,{children:jsxs(Group,{align:"center",children:[t||"Comparison Button",o&&jsx(IconPlus,{})]})})}),jsx(ActionIcon,{variant:"light",children:jsx(IconSearch,{size:20})})]})}var im=h(()=>{l();});function zi({columns:e=[],id:t,data:o=[],tableProps:r={}}){let[n,s]=useState({}),{initialState:a}=r,i=a?.pagination?.pageIndex,c=a?.pagination?.pageSize,u=`table-${[t,i,c].filter(d=>d).join("-")}`,p=useMemo(()=>e.map(d=>d.accessorKey),[e]),m=useMemo(()=>o.filter(d=>typeof d=="object"&&d!==null&&!Array.isArray(d)&&Object.keys(d).some(v=>p.includes(v))),[p,o]),f=useMemo(()=>e.map(d=>({...d,Cell:({renderedCellValue:v})=>jsx(ae,{html:`${v}`,isPreview:true}),filterFn:"contains"})),[e]),g=Jc();return useEffect(()=>{(async()=>{try{let v=g||"en",x=`${v.toUpperCase()}`,C=await import(`mantine-react-table/locales/${v}.js`);s(C[`MRT_Localization_${x}`]);}catch(v){console.error("Error loading translations:",v);}})();},[g]),createElement(MantineReactTable,{...r,autoResetPageIndex:false,columns:f,data:m,enableColumnFilterModes:true,enableFilterMatchHighlighting:false,globalFilterFn:"contains",key:u,layoutMode:"grid",localization:n,state:{...r.state,isFullScreen:false}})}var lm=h(()=>{l();we();Le();});function $i({label:e,url:t,settings:o}){let{align:r}=o;return jsx(Group,{position:r,grow:r==="justify",children:jsx(Button,{component:"a",target:"_blank",href:t||"",children:e||"Button"})})}var um=h(()=>{l();});function Gi(e){let t=useDispatch(),o=useContext(Kt),r=Ee(),n=X(D=>D.status.query),s=DT(e.id),a=useMantineTheme(),{allLabel:i,colorKey:c,data:u,defaultValue:p,defaultValueType:m,iconKey:f,levels:g,limit:d,placeholder:v,searchIndexKey:x,searchIndexSeparator:C,resetSectionVars:R,section:k}=e,[A,U]=useState(false),[G,F]=useState(true),[B,E]=useState(""),[O,P]=useState(false),[w,N]=useState([""].slice(1)),{sectionVariables:Z,resetSectionVariables:W}=_e(k),$=useMemo(()=>FT(n[`${s}-value`],p),[n,p,s]),J=useMemo(()=>n[`${s}-type`]||m,[n,m,s]),M=useCallback(()=>{R==="true"&&Z&&W();},[R,Z,W]),z=useCallback(D=>{M(),t(Go(o,`${s}-value`,D.join(),r));},[t,o,s,M,r.status]),V=useCallback(D=>{M(),t(Go(o,`${s}-type`,D,r));},[t,o,s,M,r.status]),Y=useRef(null),ve=useRef(false),j=useRef(!!d&&d<$.length),ee=w.length,re=g[ee],oe=w.filter(Boolean);w.length>0&&oe.length===0&&oe.push(`${i} ${re?.label}`),useEffect(()=>{let D=()=>{F(true);};return window.addEventListener("touchmove",D),()=>{window.removeEventListener("touchmove",D);}},[]);let _=useMemo(()=>BT(u,g,c,f,x,C),[c,u,f,g,x,C]),T=useMemo(()=>{let D=MT(B),ue=Array.from(NT(_,D)).reverse();return O?ue:w.reduce((I,se)=>I.filter(ne=>!se||ne.searchindex.indexOf(se)>-1),ue.filter(I=>I.type===re?.value))},[re,_,B,O,w]),L=useRef(null),q=os({count:A?T.length:0,estimateSize:()=>30,getScrollElement:useCallback(()=>L.current,[]),overscan:10,rangeExtractor:useCallback(D=>sn(D),[])}),[Q,K]=useState(-1),ie=Math.min(Q,T.length-1),he=useCallback(D=>{let ue=w.concat(D);O&&P(false),N(ue);},[O,w]),it=useCallback(()=>{let D=w.slice(0,ee-1);O&&P(false),N(D);},[O,w,ee]),Ce=useCallback(D=>{E(D.currentTarget.value),!j.current&&u.length>0&&U(true);},[u,E,j,U]),xe=useCallback(()=>{E(""),z([]),Y.current?.focus(),d&&(j.current=false);},[E,z,Y,d,j]),Tt=useCallback(D=>{let ue=$.filter(I=>I!==D);z(ue),d&&ue.length<d&&(j.current=false);},[$,z,d,j]),$t=useCallback(D=>{J||V(D.type),J!==D.type?(V(D.type),z([D.value])):$.includes(D.value)?Tt(D.value):d?($.length<d&&z([...$,D.value]),$.length===d&&z([...$.slice(1),D.value])):z([...$,D.value]),E("");},[J,V,z,$,Tt,d]),Rt=useCallback(()=>{$.length>0&&B.length===0&&(z($.slice(0,-1)),U(true),d&&(j.current=false)),B.length>0&&E(B.slice(0,-1));},[$,B,z,E,U,d,j]),_r=useCallback(()=>{F(D=>D&&(ve.current=D,!D)),K(D=>D+1>=T.length?D:D+1);},[K,T]),Eo=useCallback(()=>{let D=T[ie];D&&$t(D);},[T,ie,$t]),ko=useCallback(()=>{U(false);},[U]),Rs=useCallback(()=>{it(),K(0);},[K,it]),Es=useCallback(()=>{let D=T[ie];!O&&D&&D.type!==g[g.length-1]?.value&&(he(D.name),K(0));},[T,ie,O,g,K,he]),ks=useCallback(()=>{F(D=>D&&(ve.current=D,!D)),K(D=>D-1<0?0:D-1);},[K]),Cs=({label:D,onRemove:ue,...I})=>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"},...I,children:[jsx("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D}),jsx(CloseButton,{"aria-hidden":true,iconSize:"70%",onMouseDown:ue,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})]}),ws=useMemo(()=>$.map(D=>_.find(ue=>ue.value===D)).filter(D=>!!D).map((D,ue)=>createElement(Cs,{...D,index:ue,key:D.value,onRemove:I=>{I.preventDefault(),I.stopPropagation(),Tt(D.value);}})),[$]),As=forwardRef(function({color:ue,icon:I,label:se,value:ne,...Ye},be){return jsx("div",{ref:be,style:{cursor:"pointer",width:"100%"},...Ye,children:jsxs(Group,{align:"center",noWrap:true,spacing:"xs",w:"100%",children:[I&&jsx(Box,{bg:ue??"transparent",component:"img",w:20,h:20,src:I}),jsx(Text,{lineClamp:1,size:"sm",children:se||ne})]})})}),{settings:Ps}=e,Is=e.hideLabel==="true"||!e.label?jsx(Fragment,{}):jsx(ae,{component:"div",html:e.label,size:"sm",style:Ps,isPreview:true});return jsx(Input.Wrapper,{label:Is,children:jsxs(Popover,{closeOnClickOutside:true,keepMounted:true,opened:A,onChange:U,onClose:()=>{K(0),E("");},onOpen:()=>{q.scrollToIndex(0);},shadow:"sm",width:"target",withinPortal:true,children:[jsx(Popover.Target,{children:jsxs(Box,{"aria-haspopup":"listbox",component:"div",onMouseLeave:()=>K(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:$.join(",")}),jsx(Input,{component:"div",multiline:true,onMouseDown:D=>{D.preventDefault(),!j.current&&u.length>0&&U(!A),Y.current?.focus();},rightSection:$.length>0?jsx(CloseButton,{onClick:xe,onMouseDown:D=>D.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":true,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:[ws,jsx("input",{autoComplete:"off","data-mantine-stop-propagation":A,onChange:Ce,onKeyDown:getHotkeyHandler([["ArrowDown",_r],["ArrowLeft",Rs],["ArrowRight",Es],["ArrowUp",ks],["Backspace",Rt],["Enter",Eo],["Escape",ko]]),placeholder:$.length===0?v:void 0,ref:Y,readOnly:j.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:B})]})})]})}),jsx(Popover.Dropdown,{onMouseDown:D=>D.preventDefault(),p:0,children:jsx("div",{style:{display:"flex",maxHeight:rem(300)},children:jsx(Box,{component:"div","data-combobox-popover":true,onMouseDown:D=>D.preventDefault(),role:"listbox",sx:{width:"100%"},tabIndex:-1,children:jsxs(Stack,{h:"100%",py:"xs",spacing:"xs",w:"100%",children:[g.length>1&&jsxs(Stack,{spacing:"xs",children:[jsxs(Group,{onClick:D=>{D.stopPropagation();},px:"xs",position:"center",spacing:"xs",children:[jsx(Button,{onClick:()=>{K(0),P(true),N([]),T.length>0&&q.scrollToIndex(0);},size:"xs",variant:O?"filled":"outline",children:i}),g.map((D,ue)=>jsx(Button,{onClick:()=>{O&&P(false);let I=[""].slice(1),se=ue;for(;se--;)I[se]=w[se]||"";K(0),N(I),T.length>0&&q.scrollToIndex(0);},size:"xs",variant:!O&&w.length===g.findIndex(I=>I.value===D?.value)?"filled":"outline",children:D?.label},D?.value))]}),jsx(Divider,{})]}),ee>0&&jsxs(Group,{align:"center",noWrap:true,px:"xs",children:[jsx(ActionIcon,{onClick:it,size:"sm",children:jsx(IconChevronLeft,{})}),jsx("div",{children:oe.map(D=>jsx(Text,{lineClamp:1,size:"xs",children:D},`${D}`))})]}),jsx(ScrollArea,{mah:250,onWheel:()=>F(true),px:"xs",style:{overflow:"auto",width:"100%"},viewportRef:L,viewportProps:{tabIndex:-1},w:"100%",children:jsx("div",{style:{height:`${q.getTotalSize()}px`,position:"relative",width:"100%"},children:q.getVirtualItems().map(D=>{let ue=T[D.index],I=ie===D.index,se=$.includes(ue.value);return T.length>0&&I&&!G&&q.scrollToIndex(ie),jsxs(Group,{"aria-selected":I,align:"center","data-hovered":I||void 0,"data-index":D.index,"data-selected":se,id:ue.vale,noWrap:true,onMouseEnter:ne=>{ne.preventDefault(),ne.stopPropagation(),G&&(K(D.index),F(false));},onMouseMove:ne=>{ne.preventDefault(),ne.stopPropagation(),F(true);},onMouseDown:ne=>{ne.preventDefault(),$t(ue);},position:"apart",ref:q.measureElement,role:"option",spacing:"xs",sx:ne=>({borderRadius:ne.radius.xs,padding:"15px 5px 15px",paddingLeft:O&&10*g.findIndex(Ye=>Ye?.value===ue.type)||5,position:"absolute",top:0,left:0,height:`${D.size}px`,transform:`translateY(${D.start}px)`,width:"100%","&[data-hovered]":{backgroundColor:ne.colorScheme==="dark"?ne.colors.dark[4]:ne.colors.gray[1]},"&:hover":{backgroundColor:ne.colorScheme==="dark"?ne.colors.dark[4]:ne.colors.gray[1]}}),tabIndex:-1,children:[jsx(As,{index:D.index,...ue}),!O&&ue.type!==g[g.length-1]?.value&&jsx(ActionIcon,{onMouseDown:ne=>{ne.preventDefault(),ne.stopPropagation(),he(ue.name);},size:"sm",tabIndex:-1,children:jsx(IconChevronRight,{})})]},ue.value)})})})]})})})})]})})}var BT,MT,NT,DT,FT,bm=h(()=>{l();Xa();we();uo();ce();Le();Kr();$e();BT=(e=[],t=[],o="",r="",n="",s="|")=>{let a=t.map(v=>v.value).slice(),i=`${a.pop()}`,c=v=>v[o],u=v=>v[r],p=v=>{if(v[n])return typeof v[n]=="string"?v[n].split(s):v[n]},m=new Set,f=[],g=[],d=nest().rollup(v=>{let x=v[0],C=E=>E&&E.value&&!m.has(E.value),R=a.map(E=>x[`${E} ID`]),k=a.map(E=>x[E]),A=a.map((E,O)=>{if(g[O]!==k[O]){g[O]=k[O];let P=c[O]||c[c.length-1]||c,w=u[O]||u[u.length-1]||u,N=p[O]||p[p.length-1]||p;return {color:P(x,E)||void 0,icon:w(x,E)||void 0,value:`${R[O]}`,label:k[O],name:k[O],type:E,searchindex:k.slice(0,O+1).concat(N(x,E)).join("|")}}return {}}).filter(C);A.forEach(E=>m.add(E.value));let U=c[c.length-1]||c,G=u[u.length-1]||u,F=p[p.length-1]||p,B=v.map(E=>({color:U(E,i)||void 0,icon:G(E,i)||void 0,value:`${E[`${i} ID`]}`,label:E[i],name:E[i],type:i,searchindex:k.concat(E[i]).concat(F(E,i)).join("|")}));f.push(...A.concat(B));});return a.forEach(v=>{d.key(x=>`${x[`${v} ID`]}|${x[v]}`);}),d.entries(e),f},MT=e=>{if(!e)return /./i;let t=e.normalize("NFD").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"[^|]+");return RegExp(t,"i")},NT=(e,t)=>{let o=e.length,r,n=i=>r&&r.searchindex.includes(i.searchindex),a={next:()=>{for(let i=o-1;i>-1;i--){let c=e[i];if(t.test(`${c.value} ${c.label} ${c.searchindex}`)||n(c))return r=c,o=i,{done:false,value:c}}return {done:true,value:void 0}},[Symbol.iterator]:()=>a};return a},DT=e=>`multihierarchySelector${e}`,FT=(e,t)=>e&&typeof e=="string"?e.split(","):t;});var ym={};Os(ym,{default:()=>XT});function YT({block:e,active:t,locale:o,variables:r,configOverride:n={}}){let s=jT(),a=kt(e),i=po(o),c={variables:r},u=Ho(),p=Ee(),m=useRouter(),{sectionVariables:f,setSectionVariables:g,resetSectionVariables:d}=_e(e.section_id),v=useMemo(()=>{if(!t)return {error:"Activate to View"};if(!a?.logic)return {error:"Add a Configuration"};let F=gt({logic:a.logic},i,c).logic,B={router:m,section:{variables:f,setVariables:g,resetVariables:d}};return Xo(F,i,r,o,e.id,{},B,u,p)},[a?.logic,t,r,f,p.status]),{type:x}=v.config||{},C=x&&Hi[x]?x:"Treemap";x||(v.config={error:'Visualization missing "type"'}),Hi[x]||(v.config={error:`"${x}" is not a valid Visualization Type`});let R=Hi[C],k=v.error||v.config?.error||false;if(k)return jsx(Center,{style:{height:"100%"},children:jsx(Badge,{color:"gray",variant:"outline",children:k},"type")});let{_data:A,...U}=v.config,G={locale:o,variables:r,...U,...n};return s.print&&(G.detectVisible=false),jsx("div",{style:{display:"flex",flex:"1 1 100%"},children:jsx(or,{fallback:jsx("p",{children:"Error in d3plus viz config."}),children:jsx(R,{style:{flex:1},dataFormat:F=>{let B;try{B=v.dataFormat(F);}catch(E){console.error("Error in dataFormat: ",E),B=[];}return B},linksFormat:v.linksFormat,nodesFormat:v.nodesFormat,topojsonFormat:v.topojsonFormat,config:{...G}},"viz-key")})})}var jT,KT,Hi,XT,Sm=h(()=>{l();Po();Kn();Jr();Lo();Le();$e();fi();jT=()=>({}),KT={},Hi={[Zo]:jn,...ex,...KT};XT=memo(YT,(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 ZT,ze,vm=h(()=>{l();de();Bd();Nd();Fd();Vd();Ud();Qd();Zd();em();om();nm();im();lm();um();bm();ZT=rx(()=>Promise.resolve().then(()=>(Sm(),ym)),{ssr:false}),ze={[S.PARAGRAPH]:bi,[S.STAT]:yi,[S.SUBTITLE]:Si,[S.TITLE]:vi,[S.SELECTOR]:Ri,[S.VIZ]:ZT,[S.GENERATOR]:Pi,[S.SECTION_FLAG]:Pi,[S.IMAGE]:Ii,[S.NAV]:_i,[S.RELATED]:Mi,[S.RESET_BUTTON]:Di,[S.COMPARISON_BUTTON]:Fi,[S.TABLE]:zi,[S.BUTTON]:$i,[S.MULTIHIERARCHY_SELECTOR]:Gi};});var xm=h(()=>{l();de();({[S.TITLE]:IconHeading,[S.GENERATOR]:IconApi,[S.SECTION_FLAG]:IconFlag,[S.STAT]:IconPercentage,[S.VIZ]:IconChartBar,[S.PARAGRAPH]:IconAlignLeft,[S.SELECTOR]:IconSelector,[S.IMAGE]:IconPhoto,[S.TABLE]:IconTable,[S.MULTIHIERARCHY_SELECTOR]:IconListTree});});var Tm=h(()=>{l();de();({[S.TITLE]:"Title",[S.GENERATOR]:"Data",[S.STAT]:"Stat",[S.VIZ]:"Visualization",[S.PARAGRAPH]:"Paragraph",[S.SELECTOR]:"Selector",[S.SUBTITLE]:"Subtitle",[S.RESET_BUTTON]:"Reset Button",[S.COMPARISON_BUTTON]:"Comparison Button",[S.RELATED]:"Related Reports",[S.NAV]:"Navigation",[S.IMAGE]:"Image",[S.TABLE]:"Table",[S.BUTTON]:"Button",[S.FALLBACK]:"Fallback",[S.SECTION_FLAG]:"Section Flag",[S.MULTIHIERARCHY_SELECTOR]:"Multihierarchy Selector"});});var Rm=h(()=>{l();de();_d();vm();xm();Tm();({[S.GENERATOR]:{type:S.GENERATOR,renderer:ze[S.GENERATOR],renderPreviewOnEdit:false},[S.SECTION_FLAG]:{type:S.SECTION_FLAG,renderer:ze[S.SECTION_FLAG],renderPreviewOnEdit:false},[S.IMAGE]:{type:S.IMAGE,renderer:ze[S.IMAGE],renderPreviewOnEdit:false},[S.PARAGRAPH]:{type:S.PARAGRAPH,renderer:ze[S.PARAGRAPH],renderPreviewOnEdit:true,evalWhenNonActive:true},[S.RELATED]:{type:S.RELATED,renderer:ze[S.RELATED],renderPreviewOnEdit:false,evalWhenNonActive:false},[S.SELECTOR]:{type:S.SELECTOR,renderer:ze[S.SELECTOR],adapter:fn[S.SELECTOR],nonActiveAdapter:()=>fn[S.SELECTOR]({name:"Selector Preview"}),renderPreviewOnEdit:false},[S.STAT]:{type:S.STAT,renderer:ze[S.STAT],renderPreviewOnEdit:true,evalWhenNonActive:true},[S.SUBTITLE]:{type:S.SUBTITLE,renderer:ze[S.SUBTITLE],renderPreviewOnEdit:true,evalWhenNonActive:true},[S.TITLE]:{type:S.TITLE,renderer:ze[S.TITLE],renderPreviewOnEdit:true,evalWhenNonActive:true},[S.VIZ]:{type:S.VIZ,renderer:ze[S.VIZ],renderPreviewOnEdit:false},[S.NAV]:{type:S.NAV,renderer:ze[S.NAV],renderPreviewOnEdit:true,evalWhenNonActive:true},[S.RESET_BUTTON]:{type:S.RESET_BUTTON,renderer:ze[S.RESET_BUTTON],renderPreviewOnEdit:true,evalWhenNonActive:true},[S.COMPARISON_BUTTON]:{type:S.COMPARISON_BUTTON,renderer:ze[S.COMPARISON_BUTTON],renderPreviewOnEdit:true,evalWhenNonActive:true},[S.TABLE]:{type:S.TABLE,renderer:ze[S.TABLE],renderPreviewOnEdit:false,evalWhenNonActive:false},[S.BUTTON]:{type:S.BUTTON,renderer:ze[S.BUTTON],renderPreviewOnEdit:true,evalWhenNonActive:true},[S.MULTIHIERARCHY_SELECTOR]:{type:S.MULTIHIERARCHY_SELECTOR,renderer:ze[S.MULTIHIERARCHY_SELECTOR],adapter:fn[S.MULTIHIERARCHY_SELECTOR],nonActiveAdapter:()=>fn[S.MULTIHIERARCHY_SELECTOR]({label:"Multihierarchy Selector Preview"}),renderPreviewOnEdit:false}});});var Em=h(()=>{l();de();wd();Rm();Lo();Le();pr();Fr();zr();Us();Hs();fo();});var km,cR,hs,bs=h(()=>{l();km={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"}]}},cR=Object.keys(km).reduce((e,t)=>(e[t]=km[t].defaultValue,e),{}),{memberImageBg:false,optionsMenu:false,optionData:true,optionImage:true,optionShare:true,showAnchor:false,clientSideSection:false,...cR},hs=e=>({data:typeof e.optionData=="boolean"?e.optionData:true,image:typeof e.optionImage=="boolean"?e.optionImage:true,share:typeof e.optionShare=="boolean"?e.optionShare:true});});function Cm({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:true,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 wm=h(()=>{l();});function ji(e){let{section:t}=e,o=t.blocks||[],r=X(_=>o.map(T=>({..._.records.entities.block[T],status:_.variables.status[T]})).filter(T=>T.type===S.VIZ&&T.status.allowed)),{variant_slug1:n,slug1:s}=X(_=>_.variables.attributes),a=Zr(),[i,c]=useState(vt.section),[u,p]=useState(xt.png),[m,f]=useState(false),[g,d]=useState(false),[v,x]=useState([]),[C,R]=useState(r.length>0?r[0].id:null),k=i!==vt.section,{print:A,downloadLoading:U}=wa(t.id,n,s,k?C:null),[G,F]=useState(true),[B,E]=useState(false),O=je("options"),P={...LR,...O.image_tab},{siteProps:w}=Yr(),N=w?.logoSrc&&typeof w.logoSrc=="string",Z=useMemo(()=>t?.settings?.name?yt(t?.settings?.name):`section-${t.id}`,[t.id,t?.settings?.name]),W=`#${Z}`,$=useMantineTheme(),J=()=>{let _=V(C);return select(_).select("svg").size()===1},M=()=>`${yt(Z)}`,z=()=>{let _=document.getElementById(Z);return select(_).select(".bespoke-section-content").node()},V=_=>{let T=z();return select(T).select(`#bespoke-visualization-${_}.bespoke-block-area`).node()},Y=()=>new Promise(_=>{let T;i===vt.section?T=z():i===vt.viz&&(T=V(C));let L=document.createElement("div");L.style.display="flex",L.style.justifyContent="space-between",L.classList.add("bespoke-share-source"),L.style.padding=$.spacing.xs,L.style.width="100%";let q=document.createElement("div");if(q.innerText=P.source.replace("{src}",`${window.location}${W}`),q.style.fontSize=$.fontSizes.xs,L.appendChild(q),N){let Q=document.createElement("img");Q.src=w.logoSrc,Q.style.height="30px",Q.onload=()=>_(T),Q.onerror=()=>{Q.remove(),_(T);},L.appendChild(Q),T.appendChild(L);}else T.appendChild(L),_(T);}),ve=_=>{if(G)return "transparent";let T=select(_).style("background-color");return T!=="rgba(0, 0, 0, 0)"&&T!=="transparent"?T:_===document.body?"white":ve(_.parentNode)},j=async(_,T)=>{let{toPng:L}=await import('html-to-image');L(_,{backgroundColor:T.background,cacheBust:true,filter:q=>q&&q.classList?!T.exclusionClasses.some(Q=>q.classList.contains(Q)):true}).then(q=>{let Q=document.createElement("a");Q.download=`${T.filename}.png`,Q.href=q,Q.click();}).catch(q=>{console.error("Error generating image",q);}).finally(()=>{IR(),f(false);});},ee=(_,T)=>{saveElement(_,{filename:T.filename,type:"svg",callback:()=>f(false)},{background:T.background});},re=async()=>{f(true);let _=await Y(),T={background:ve(_),exclusionClasses:["export-hidden"],filename:M()},L=u===xt.png?j:ee;try{if(_)L(_,T);else throw new Error(P.wrong_node)}catch{f(false);}},oe=async()=>{let{toCanvas:_}=await import('html-to-image');Promise.all(r.map(T=>{let L=V(T.id),q=L.querySelector("g.d3plus-geomap-tileGroup");q&&(q.style.display="none");let Q=select(L).select("svg").select("g").size()>0,K=select(L).select("div.bespoke-html").size()>0,ie=Q||K?L:OR();return _(ie).then(he=>(q&&(q.style.display="block"),he))})).then(T=>{x(T.map(L=>L.toDataURL())),E(false);});};return useEffect(()=>{i===vt.viz&&r.length>0?(R(r[0].id),E(true),oe()):i===vt.section&&x([]);},[i]),useEffect(()=>{C&&(J()?d(true):(d(false),p(xt.png)));},[C]),jsxs(Stack,{className:"cms-section-options-image",children:[r.length>0?jsx(Input.Wrapper,{label:`${P.choose_area}:`,children:jsx(SegmentedControl,{fullWidth:true,value:i,data:[{value:vt.section,label:jsxs(Center,{children:[jsx(IconTemplate,{size:"1rem"}),jsx(Box,{ml:10,children:P.entire_section})]})},{value:vt.viz,label:jsxs(Center,{children:[jsx(IconChartBar,{size:"1rem"}),jsx(Box,{ml:10,children:P.viz_only})]})}],onChange:_=>{c(_),_===vt.section&&p(xt.png);}})}):jsx(Text,{fw:"700",color:"gray.7",children:`${P.entire_section}:`}),i===vt.viz&&r.length>0&&jsxs(Input.Wrapper,{label:`${P.choose_viz}:`,style:{minHeight:"161px",position:"relative"},children:[!B&&v.length>0&&jsx(ScrollArea,{style:{height:250},children:jsx(SimpleGrid,{cols:3,children:r.map((_,T)=>jsx(Image,{alt:`Viz ${_.id}`,onClick:()=>{R(_.id);},style:{cursor:"pointer",border:C===_.id?"4px solid #228be6":"4px solid #eee"},radius:0,src:v[T],withPlaceholder:true,styles:()=>({figure:{height:"100%"},imageWrapper:{height:"100%"}})},`viz-option-${_.id}`))})}),jsx(LoadingOverlay,{visible:B})]}),g&&i!==vt.section&&jsx(Input.Wrapper,{label:`${P.choose_format}:`,children:jsxs(Button.Group,{children:[jsx(Button,{leftIcon:jsx(IconPolaroid,{size:16}),onClick:()=>p(xt.png),variant:u===xt.png?"filled":"default",fullWidth:true,children:xt.png}),jsx(Button,{leftIcon:jsx(IconCode,{size:16}),onClick:()=>p(xt.svg),variant:u===xt.svg?"filled":"default",fullWidth:true,children:xt.svg})]})}),jsx(Checkbox,{checked:G,label:`${P.transparent_bg}`,onChange:()=>F(!G),radius:"xl"}),jsx(Button,{leftIcon:jsx(IconDownload,{size:16}),loading:m||U,onClick:a&&u!==xt.svg?()=>A(G):re,fullWidth:true,children:jsx("span",{children:m||U?P.processing:P.download.replace("{imageFormat}",u)})})]})}var vt,xt,IR,LR,OR,Lm=h(()=>{l();en();ce();_t();uo();Qe();de();vt={viz:"viz",section:"section"},xt={png:"PNG",svg:"SVG"},IR=()=>{let e=document.getElementsByClassName("bespoke-share-source");Array.from(e).forEach(t=>t.remove());},LR={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}"},OR=()=>document.createElement("div");});function _m(e){let{title:t,url:o,disabled:r=false}=e,n=r?IconCode:IconLink;return jsx(Input.Wrapper,{label:t,children:jsx(Input,{icon:jsx(n,{}),value:o,disabled:r,readOnly:true,rightSection:jsx(CopyButton,{value:o,timeout:2e3,children:({copied:s,copy:a})=>jsx(Tooltip,{label:s?"Copied":"Copy",withArrow:true,position:"right",children:jsx(ActionIcon,{variant:s?"filled":"subtle",onClick:a,disabled:r,children:s?jsx(IconClipboardCheck,{size:16}):jsx(IconClipboardCopy,{size:16})})})})})})}var Bm=h(()=>{l();});function Yi(e){let{section:t}=e,[o,r]=useState(""),[n,s]=useState(""),[a,i]=useState(true),c=je("options"),u={...nE,...c.share_tab};return useEffect(()=>{s(document.title);let{origin:p,pathname:m}=window.location,f=`${p}${m}`,g=a?t.settings?.name?.length?`#${yt(t.settings.name)}`:`#section-${t.id}`:"";r(`${f}${g}`);},[a]),jsxs(Stack,{className:"cms-section-options-share",children:[jsx(_m,{title:`${u.title}: ${n}`,url:o}),jsx(Checkbox,{checked:a,label:u.include_section,onChange:()=>i(!a),radius:"xl"}),jsxs(Group,{position:"center",children:[jsx(FacebookShareButton,{url:o,children:jsx(FacebookIcon,{size:32,round:true})}),jsx(TwitterShareButton,{url:o,title:n,children:jsx(TwitterIcon,{size:32,round:true})}),jsx(TelegramShareButton,{url:o,title:n,children:jsx(TelegramIcon,{size:32,round:true})}),jsx(WhatsappShareButton,{url:o,title:n,separator:":: ",children:jsx(WhatsappIcon,{size:32,round:true})}),jsx(LinkedinShareButton,{url:o,children:jsx(LinkedinIcon,{size:32,round:true})}),jsx(RedditShareButton,{url:o,title:n,windowWidth:660,windowHeight:460,children:jsx(RedditIcon,{size:32,round:true})}),jsx(EmailShareButton,{url:o,subject:n,children:jsx(EmailIcon,{size:32,round:true})})]})]})}var nE,Nm=h(()=>{l();Bm();_t();en();nE={title:"Title",include_section:"Include Section"};});function dE({panels:e,value:t,onTabChange:o}){let r=useRef(null),[n,s]=useState(false),[a,i]=useState(false),c=Object.keys(e),u=()=>{let m=r.current;if(!m)return;let{scrollLeft:f,scrollWidth:g,clientWidth:d}=m;s(f>0),i(f<g-d);};useEffect(()=>{let m=r.current;if(m)return u(),m.addEventListener("scroll",u),()=>{m.removeEventListener("scroll",u);}},[]);let p=m=>{let f=r.current;if(!f)return;let g=m==="left"?-150:150;f.scrollBy({left:g,behavior:"smooth"});};return jsxs(Box,{className:"bespoke-report-modal-tabs-container",pos:"relative",sx:{flexGrow:1,maxWidth:"calc(100% - 38px)"},children:[jsx(Box,{"data-direction":"left",display:n?"flex":"none",sx:Fm,children:jsx(ActionIcon,{onClick:()=>p("left"),children:jsx(IconChevronLeft,{size:20})})}),jsx(Tabs,{ref:r,value:t,onTabChange:o,sx:pE,children:jsx(Tabs.List,{className:"bespoke-report-modal-tabs",sx:{flexWrap:"nowrap",width:"fit-content"},children:c.map(m=>jsx(Tabs.Tab,{className:"bespoke-report-modal-tab",value:m,children:e[m].label},m))})}),jsx(Box,{display:a?"flex":"none","data-direction":"right",sx:Fm,children:jsx(ActionIcon,{onClick:()=>p("right"),children:jsx(IconChevronRight,{size:20})})})]})}function mE({className:e,opened:t,onClose:o,panels:r}){let[n,s]=useState(Object.keys(r)[0]);return jsxs(Modal.Root,{className:clsx("bespoke-report-modal",e),opened:t,onClose:o,size:"xl",centered:true,children:[jsx(Modal.Overlay,{className:"bespoke-report-modal-overlay"}),jsxs(Modal.Content,{children:[jsx(Modal.Header,{className:"bespoke-report-modal-header",children:jsxs(Group,{w:"100%",position:"apart",spacing:"md",noWrap:true,children:[jsx(dE,{panels:r,value:n,onTabChange:a=>a&&s(a)}),jsx(Modal.CloseButton,{className:"bespoke-report-modal-close-btn",ml:0})]})}),jsx(Modal.Body,{className:"bespoke-report-modal-body",children:r[n].component})]})]})}var pE,Fm,Ji,el=h(()=>{l();pE={overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none",WebkitOverflowScrolling:"touch",flexWrap:"nowrap"},Fm={height:"100%",zIndex:1,top:0,width:50,position:"absolute",backgroundSize:"cover",display:"flex",alignItems:"center","&[data-direction='left']":{background:"linear-gradient(to right, rgba(255, 255, 255, 1) 15px, rgba(255, 255, 255, 0))",left:0,justifyContent:"flex-start"},"&[data-direction='right']":{background:"linear-gradient(to left, rgba(255, 255, 255, 1) 15px, rgba(255, 255, 255, 0))",right:0,justifyContent:"flex-end"}};Ji=mE;});function $m(e){let{section:t,initialMode:o,onEnds:r,open:n,title:s}=e,a=hs(t.settings),i=useMemo(()=>hE.filter(g=>a[g]),[a]),[c,u]=useState(o||i[0]||"data"),p=je("options");useEffect(()=>{o!==c&&u(o);},[o]);let m={...tl,...p};useMemo(()=>jsxs(Fragment,{children:[jsxs(Tabs.List,{children:[a.data&&jsx(Tabs.Tab,{value:"data",children:m.download_title}),a.image&&jsx(Tabs.Tab,{value:"image",children:m.image_title}),a.share&&jsx(Tabs.Tab,{value:"share",children:m.share_title})]}),a.data&&jsx(Tabs.Panel,{value:"data",children:jsx(Ma,{section:t})}),a.image&&jsx(Tabs.Panel,{value:"image",children:jsx(ji,{section:t})}),a.share&&jsx(Tabs.Panel,{value:"share",children:jsx(Yi,{section:t})})]}),[a,t,m]);return jsx(Ji,{className:"cms-section-options-modal",opened:n,onClose:()=>r(),panels:{data:{label:m.download_title,component:jsx(Ma,{section:t})},image:{label:m.image_title,component:jsx(ji,{section:t})},share:{label:m.share_title,component:jsx(Yi,{section:t})}}})}var tl,hE,Um=h(()=>{l();Na();Lm();Nm();_t();bs();el();tl={download_title:"Download Data",image_title:"Save Image",share_title:"Share Link"},hE=["data","image","share"];});function Wm(e){let{sectionId:t,disabled:o=false}=e,[r,n]=useState(false),[s,a]=useState("data"),i=Un(t),c=je("options"),u={...tl,...c},p=hs(i.isSuccess?i.data.settings:{}),m=g=>{a(g),n(true);},f=()=>{n(false);};return jsxs("div",{className:"cms-section-options",children:[jsxs(Button.Group,{children:[p.data&&jsx(Button,{variant:"default",size:"xs",compact:true,onClick:()=>m("data"),"aria-label":u.download_title,disabled:o,children:jsx(IconTable,{size:16})}),p.image&&jsx(Button,{variant:"default",size:"xs",compact:true,onClick:()=>m("image"),"aria-label":u.image_title,disabled:o,children:jsx(IconCamera,{size:16})}),p.share&&jsx(Button,{variant:"default",size:"xs",compact:true,onClick:()=>m("share"),"aria-label":u.share_title,disabled:o,children:jsx(IconShare,{size:16})})]}),i.isSuccess&&jsx($m,{section:i.data,initialMode:s,open:r,onEnds:f})]})}var qm=h(()=>{l();Um();ce();_t();bs();});var jm=h(()=>{l();Qe();});var Km=h(()=>{l();ce();});var Ym=h(()=>{l();$r();ce();});var ol=h(()=>{l();jm();Km();Ym();});function EE({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 Jm=h(()=>{l();ce();ol();eo__default.forwardRef(function({children:t,column:o,basis:r,columnSettings:n={},sx:s={},...a},i){let c=Object.values(o).some(f=>f.settings?.display==="inline"),u=n?.width?`${n.width}px`:r,p=n?.width?`${n?.width}px`:"100%",m=n?.full?"100%":p;return jsx(Flex,{ref:i,className:"bespoke-section-col",align:"flex-start",direction:c?"row":"column",wrap:c?"wrap":"nowrap",maw:{base:"100%",md:m},miw:{base:"none",md:300},p:0,pos:"relative",sx:[{flexGrow:1,flexShrink:n?.full?0:1,flexBasis:n?.full?"100%":u},...packSx(s)],...a,children:t})}),eo__default.forwardRef(EE);});var ef=h(()=>{l();});var rl,tf=h(()=>{l();He();ce();ef();de();rl={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:rl.px},"%":{defaultValue:50,min:20,max:100,step:5,formatter:rl["%"]}};});var of=h(()=>{l();});function sl({previews:e,translations:t}){let{print:o}=Ze(),r=useMemo(()=>e.map(({image:n,name:s},a)=>(n?.author||n?.url)&&jsxs(Stack,{spacing:0,children:[n.author&&jsxs(Text,{size:"xs",children:[s," ",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})]}),a+1<e.length&&jsx(Divider,{})]},n.id)),[e]);return jsx(Fragment,{children:o?jsx(Fragment,{children:r}):jsxs(Popover,{position:"right",children:[jsx(Popover.Target,{children:jsx(ActionIcon,{variant:"light",radius:"xl",children:jsx(IconPhoto,{size:20})})}),jsx(Popover.Dropdown,{children:r})]})})}var sf=h(()=>{l();Zt();});var af=h(()=>{l();});var lf=h(()=>{l();ce();Lt();qt();zr();so();Qe();No();Le();$e();de();af();});var cf=h(()=>{l();Ne();});var al,mf,DE,FE,VE,ff=h(()=>{l();ce();Lt();Em();bs();Oo();wm();qm();Ne();de();Jm();tf();of();Zt();_t();sf();fo();en();uo();Ne();lf();cf();al=(e,t)=>o=>e?e(o,t):{},mf=forwardRef(({settings:e,styles:t,print:o,children:r,...n},s)=>{let{position:a,shouldBreak:i}=e,c={normal:{position:"relative",backgroundColor:o?"transparent":"initial",borderRadius:0},sticky:{position:"sticky",zIndex:2,top:0,borderRadius:0,borderTop:o?"none":"initial",borderLeft:o?"none":"initial",borderRight:o?"none":"initial"}},u={normal:{radius:0},sticky:{radius:0,withBorder:true}},p=[c[a],al(t,e),i?{pageBreakBefore:"always"}:{}];return jsx(Paper,{ref:s,component:"section",sx:p,...u[a],...n,children:r})});mf.displayName="PositionWrapper";DE=({settings:e,styles:t,children:o,...r})=>{let{width:n}=e,s={center:{zIndex:1},full:{zIndex:1}},a={center:{size:"lg",p:"sm",fluid:false},full:{fluid:true,p:"md"}},i=[s[n],al(t,e)];return jsx(Container,{sx:i,...a[n],...r,children:o})},FE=({settings:e,styles:t,print:o,children:r,...n})=>{let{style:s}=e,a={none:{},card:{boxShadow:o?"none":"initial"}},i={none:{bg:"transparent"},card:{shadow:o?"none":"lg",p:"md",radius:"md"}},c=[a[s],al(t,e)];return jsx(Paper,{sx:c,...i[s],...n,"data-screenshot-target":"true",children:r})},VE=forwardRef(({name:e,children:t,clientSideError:o,clientSideLoading:r=false,id:n,isClientSide:s=false,sectionSettings:a,sectionStyles:i,previews:c,translations:u},p)=>{let{print:m}=Ze(),f=a.memberImageBg&&c.some(({image:v})=>v&&(v.url||v.author)),g=useMemo(()=>a.showAnchor&&a.optionsMenu?"apart":!a.showAnchor&&a.optionsMenu?"right":a.showAnchor&&!a.optionsMenu?"left":"right",[a.showAnchor,a.optionsMenu]),d=e?.length?yt(e):`section-${n}`;return jsxs(mf,{ref:p,className:`bespoke-Section-${n} bespoke-Section-root `,settings:a,styles:i?.root||void 0,print:m,"data-section-id":d,"data-section-tags":Array.isArray(a.tags)?a.tags.join(" "):a.tags,children:[a.memberImageBg&&jsx(Cm,{previews:c}),jsxs(DE,{className:`bespoke-Section-${n} bespoke-Section-container `,settings:a,styles:i?.container,id:e?.length?yt(e):`section-${n}`,pos:"relative",children:[!m&&jsxs(Group,{position:g,mb:"xs",children:[a.showAnchor&&jsxs(Anchor,{className:"cms-section-anchor",href:`#${a.name?yt(a.name):"section-"+n}`,sx:{"&:hover .cms-section-name":{visibility:"visible",opacity:1}},children:[jsx(Text,{span:true,size:"small",children:"#"}),jsx(Text,{span:true,size:"small",className:"cms-section-name",sx:{visibility:"hidden",opacity:0,transition:"visibility 0s, opacity 0.2s ease-in-out"},children:a.name||"section-"+n})]}),a.optionsMenu&&(!s||s&&!r&&!o)&&jsx(Wm,{sectionId:n,disabled:false})]}),jsxs(FE,{print:m,className:`bespoke-Section-${n} bespoke-Section-container`,settings:a,styles:i?.content,children:[t,f&&jsx(sl,{previews:c,translations:u})]})]})]})});VE.displayName="SectionWrapper";});var gf=h(()=>{l();});var hf=h(()=>{l();ce();});var bf=h(()=>{l();Le();ol();gf();Qe();hf();Lt();de();});var Sf=h(()=>{l();_t();Qn();ce();Qe();Ne();qn();el();});var xf=h(()=>{l();});function Ze(){let e=useContext(WE);if(e===void 0)throw new Error("usePrint must be used within a PrintContext");return e}var WE,Zt=h(()=>{l();ce();Oo();ff();fo();Qn();Ne();Qe();bf();Sf();xf();WE=createContext({print:false,isEmbed:false});});var Tf=h(()=>{l();ce();de();Lo();Po();Le();Jr();$e();tp();_t();Na();Qn();Zt();Oo();});var Rf=h(()=>{l();ce();});var Ef=h(()=>{l();uo();ce();so();qt();Lt();Qe();$e();});function is(e,t,o,r,n=false){let s=useRouter(),{query:a,locale:i}=s,c=X(N=>N),u=useDispatch(),p=bt(),m=X(N=>r&&p.variables?p?.variables?.attributes:N.variables.attributes),f=mo(c),g=jo(c),d=Ko(c),v=ao(g,i),x=Qr(e,r&&p.active?p?.variables.variables:void 0,r&&p.active?p?.variables.attributes:void 0),C=X(N=>r?p.variables.variables:N.variables.variables),R=X(N=>r?p.variables.status:N.variables.status),k=Ot(),{sectionVariables:A,resetSectionVariables:U}=_e(t),{addRunConsumersRunning:G,removeRunConsumersRunning:F}=br(),B=Ee(),E=r&&p.active?`${o}-valueCompare`:`${o}-value`,O=r&&p.active?`${o}-typeCompare`:`${o}-type`,P=r&&p.active?Object.fromEntries(Object.entries(a).filter(([N])=>N.match(XE)).map(([N,Z])=>[N.replace("Compare",""),Z])):Object.fromEntries(Object.entries(a).filter(([N])=>N.match(QE)).map(([N,Z])=>[N.replace("Compare",""),Z]));return useCallback((N,Z)=>{let W={locale:i,query:{...P,[`${o}-type`]:Z,[`${o}-value`]:N},variables:x},$=new URLSearchParams(window.location.search);N&&Z?($.set(E,N.join(",")),$.set(O,Z)):($.delete(E),$.delete(O)),window.history.replaceState(null,null,`?${$.toString()}`),G([t]),Wt(f,void 0,e,v,W,{variables:C,status:R},k,"report",d,B).then(J=>{n&&A&&U(),p.active&&r?p.setComparisonVariables({attributes:m,variables:J.variables,status:J.status}):u(io.setVariableChange({attributes:m,variables:J.variables,status:J.status})),F([t]);});},[r,m,e,f,p,u,v,R,C,i,P,k,o,O,E,x,A,n,U])}var XE,QE,kf=h(()=>{l();fo();Qe();so();ce();Le();qt();Lt();No();$e();XE=/\w*Compare\b/,QE=/multihierarchySelector\d+(id|-(type|value))/;});var Cf=h(()=>{l();});function sk({exploreProps:e={profilePrefix:"/",locale:nk},icon:t=jsx(IconSearch,{size:20}),actionIconProps:o={},modalProps:r={},tooltipProps:n={},tooltipText:s="Click to Explore",showIcon:a=true,showTooltip:i=false,children:c}){let[u,p]=useState(false),m={variant:"light",size:"md",radius:"md",...o},f={fullScreen:true,opened:u,onClose:()=>p(false)},g=jsx(ActionIcon,{...m,onClick:()=>p(true),children:t}),d=a?jsxs(Group,{spacing:"sm",style:{cursor:"pointer"},children:[c,g]}):c;return i&&(d=jsx(Tooltip,{label:s,...n,children:d})),jsxs(Fragment,{children:[jsx(Modal,{...f,...r,children:u&&jsx(cl,{...e,onSelect:()=>p(false)})}),jsx("div",{onClick:()=>p(true),children:c?d:jsx(Fragment,{children:g})})]})}var nk,il,ll=h(()=>{l();ul();mt();({localeDefault:nk}=Pe());il=sk;});var pk,Pf,If=h(()=>{l();pk=forwardRef(({id:e,members:t,...o},r)=>{let n=t.map(s=>jsxs(Stack,{align:"center",children:[jsx(Text,{weight:500,children:s.name}),jsx(Badge,{color:"green",variant:"light",children:s.variant})]},s.id));return jsx("div",{ref:r,children:jsx(Group,{position:"apart",grow:true,...o,children:n})},e)}),Pf=pk;});function Rk({locale:e,profilePrefix:t="/report",autocompleteProps:o={},tooltipProps:r={},tooltipText:n="Click to search",searchReportParams:s={},callback:a,children:i}){let c=useRouter(),u=c.locale,{localeDefault:p}=Pe(),m=u===p?"":`/${u}`,f=Tk(o?o.itemComponent:null),[g,d]=useState(""),[v,x]=useDebouncedValue(g,500),[C,R]=useState([]),[k,A]=useState(false),[U,G]=useState(false),[F,B]=useState(false),[E,O]=useState(!i),P=()=>{O(false);},w=()=>{O(true),$();},N=useRef(),Z=useClickOutside(P),W=o?.searchConfig?.searchLimit??10,$=()=>{A(true);let ee={query:v,format:"profiles",locale:e,limit:W,visible:true,includes:true,noImage:false,variant:[],dimension:[],report:[],all:false,...s};On.get("/api/cms/search/reports",{params:ee}).then(re=>{re&&re.data&&re.data.data&&re.data.data.results&&R(re.data.data.results.map(oe=>({id:oe.id,reportName:oe.report.name,href:`${m}${t}${oe.path}`,reportPath:`${oe.path}`,profilePrefix:t,value:`VALUE: ${oe.id}`,members:oe.members.map(_=>({original_id:_.metadata.id,name:_.name,id:_.id,variant:_.metadata.variant.name,image:{src:`/api/cms/member/image?member=${_.id}&size=thumb`,alt:_.name}}))}))),A(false),N.current?.focus();}).catch(re=>{console.error(re),A(false);});};useEffect(()=>{F&&v.length>=(o.searchConfig?.queryThreshold??0)&&$();},[F,v,o.searchConfig?.queryThreshold]),useEffect(()=>{x(),N.current&&E&&B(true);},[]),useEffect(()=>{x(),N.current&&E&&B(true);},[E]);let J=ee=>{O(false),a?a(ee):(c.push(ee.href),G(true));},M=ee=>{ee.includes("VALUE:")||d(ee);},{searchConfig:z,...V}=o,Y={placeholder:"Search",size:"md",icon:jsx(IconSearch,{}),...V,data:C},ve=jsx(Autocomplete,{value:g,itemComponent:f,onItemSubmit:J,onChange:M,filter:()=>true,disabled:(k||U)&&!F,limit:W,maxDropdownHeight:250,rightSection:jsx(Group,{spacing:0,position:"right",children:k?jsx(Loader,{size:20}):jsx(Fragment,{})}),rightSectionWidth:50,ref:N,...Y});return i?jsx(Tooltip,{label:n,disabled:E,...r,children:jsxs(Group,{ref:Z,spacing:"sm",align:"center",style:{cursor:"pointer"},children:[!E&&jsx("div",{onClick:()=>O(true),children:i}),E&&jsx(Fragment,{children:ve}),E?jsx(ActionIcon,{variant:"light",onClick:P,children:jsx(IconX,{size:20})}):jsx(ActionIcon,{variant:"light",onClick:w,children:jsx(IconSearch,{size:20})})]})}):ve}var Tk,dl,ml=h(()=>{l();Ne();If();mt();Tk=e=>{let{components:t}=Fe(),o=Pf;return t?.ReportItem&&(o=t?.ReportItem),e&&(o=e),o};dl=Rk;});function wk(){let{components:e}=Fe(),{modal:t,inline:o}=e?.search??{};return {modal:t,inline:o}}function xr(e,t,o,r,n){let s=wk(),a=X(m=>({reportId:m.variables.attributes.report_id,variantId:m.variables.attributes.variant_id1,title:m.variables.attributes.name1})),i=useRouter(),c=Gn(),u=je();return useMemo(()=>{let m=e;return t==="modal"?m=jsx(il,{exploreProps:{locale:i.locale||Mf,profilePrefix:c,translations:u.explore,initialReportId:a.reportId,initialVariantId:a.variantId,initialQuery:a.title},tooltipText:u.explore?.tooltip,modalProps:s.modal,...n,children:e}):t==="inline"&&(m=jsx(dl,{locale:i.locale||Mf,profilePrefix:c,callback:o,tooltipText:u.explore?.tooltip,...r,autocompleteProps:s.inline,children:e})),m},[t,e])}var Mf,Df=h(()=>{l();_t();ce();Le();ll();ml();mt();Ne();({localeDefault:Mf}=Pe());});var Ne=h(()=>{l();du();mu();fu();Tf();Ca();Rf();Ef();kf();pi();Cf();Df();});function ri({reportId:e,reportName:t,members:o,href:r,onClick:n}){let s=o.map(i=>jsx(Image,{src:i.image.src,height:160,imageProps:{loading:"lazy"},alt:i.name},i.id)),a=o.map(i=>jsxs(Stack,{children:[jsx(Text,{weight:500,children:i.name}),jsx(Badge,{color:"green",variant:"light",w:"fit-content",children:i.variant})]},i.id));return jsxs(Card,{className:`report-${e}-tile`,shadow:"sm",p:"lg",radius:"md",withBorder:true,children:[jsx(Card.Section,{children:jsx(Group,{grow:true,spacing:0,children:s})}),jsx(Group,{position:"apart",mt:"md",mb:"xs",children:a}),jsx("a",{href:r,onClick:n,children:jsx(Button,{variant:"light",color:"blue",fullWidth:true,mt:"md",radius:"md",children:`See ${t} Report`})})]})}function Nk({profile:e,profilePrefix:t,onSelect:o,reportTile:r}){let n=useRouter(),s=n.locale,{localeDefault:a}=Pe(),c=`${s===a?"":`/${s}`}${t}${e.path}`,u=e.members.map(g=>({original_id:g.metadata.id,name:g.name,id:g.id,dimension_id:g.metadata.dimension.id,dimension:g.metadata.dimension.name,variant_id:g.metadata.variant.id,variant:g.metadata.variant.name,image:{src:`/api/cms/member/image?member=${g.id}&size=thumb`,alt:g.name}})),p=g=>{n.push(`${g}`),o&&o();},m=g=>{g.preventDefault(),p(c);},f=Mk(r);return jsx(Grid.Col,{xs:12,sm:6,md:4,lg:4,xl:3,children:jsx(f,{reportId:e.report.id,reportName:e.report.name,members:u,href:c,onClick:m})},e.id)}var Mk,$f,ni=h(()=>{l();Ne();mt();Mk=e=>{let{components:t}=Fe(),o=ri;return t?.ReportTile&&(o=t?.ReportTile),e&&(o=e),o};$f=Nk;});function Uk({profilePrefix:e,onSelect:t=()=>{},reportTile:o}){let[r,n]=useState(500),s=useRef(null),{results:a}=Ut(),i=s.current?.offsetTop||0,c=50;return useEffect(()=>{let{innerHeight:u}=window;n(u-i-c);},[i]),jsx(ScrollArea,{offsetScrollbars:true,type:"always",h:r,ref:s,children:jsx(Grid,{align:"stretch",children:a.map(u=>jsx($f,{profile:u,profilePrefix:e,reportTile:o,onSelect:t},u.id))})})}var Uf,Gf=h(()=>{l();ni();ir();Uf=Uk;});function Wk(){let{activePage:e,setActivePage:t,pageSize:o,currentPageTotal:r}=Ut();return jsx(Group,{position:"center",children:jsx(Pagination,{value:e,onChange:s=>{t(s);},total:Math.ceil(r/o),size:"sm",py:"xs"})})}var Wf,qf=h(()=>{l();ir();Wf=Wk;});function oC({profilePrefix:e,initialReportId:t,initialVariantId:o,translations:r,onSelect:n,reportTile:s,initialQuery:a}){let i=useRef(),c=Ut(),{query:u,setQuery:p,results:m,loadingItems:f,loadingMetadata:g,translations:d,setTranslations:v,initExplore:x}=c;useEffect(()=>{x&&x(t,o,a);},[x]),useEffect(()=>{f||i.current?.focus();},[f]),useEffect(()=>{r&&v(r);},[r]);let C=()=>{p("");};return jsxs(Container,{fluid:true,pt:"1em",children:[jsx(TextInput,{placeholder:d.search,mb:"md",size:"xl",onChange:R=>p(R.target.value),readOnly:g||f,icon:jsx(IconSearch,{size:24}),value:u,rightSectionWidth:100,rightSectionProps:{style:{justifyContent:"flex-end",padding:"0 15px 0 0"}},rightSection:jsxs(Group,{align:"center",children:[(g||f)&&jsx(Loader,{size:28}),u&&u!==""&&jsx(ActionIcon,{onClick:C,children:jsx(IconTrash,{size:24})})]}),ref:i}),jsx(Cl,{translations:d}),jsx(LoadingOverlay,{visible:g||f}),!f&&m.length===0&&jsx(Alert,{title:d.no_results,color:"blue",children:d.try_another}),jsx(Uf,{profilePrefix:e,onSelect:n,reportTile:s}),jsx(Wf,{})]})}var cl,ul=h(()=>{l();wl();Gf();qf();ir();cl=oC;});l();ul();ll();ml();ir();/*! Bundled license information:
17
+ a viverra sapien pulvinar.`,style:o,append:t?jsx(De,{content:t,style:{display:"inline-block",verticalAlign:"bottom"}}):jsx(Fragment,{}),isPreview:true})}var Bd=h(()=>{l();Qt();we();});function yi({subtitle:e,title:t,value:o,tooltip:r,settings:n,_iconType:s,_iconVariant:a,_icon:i,_iconRadius:c,_iconSize:u,_iconPadding:p}){let m=t||"<span class='cr-block-placeholder'>Title</span>",f=o||"<span class='cr-block-placeholder'>Big Stat</span>",g=e||"<span class='cr-block-placeholder'>Subtitle</span>",d=n&&n.align||"left";return jsx("div",{className:"bespoke-Stat-root",children:jsxs(Group,{className:"bespoke-StatGroup-wrapper",position:Ge(d),children:[s!=="none"&&s&&jsx(ye,{blockType:"stat",iconType:s,iconVariant:a,iconRadius:c,iconSize:u,icon:i,iconPadding:p}),jsxs("div",{className:"bespoke-Stat-wrapper",children:[jsx(ae,{component:"div",size:"md",html:m,style:n,isPreview:true}),jsx(ae,{component:"div",size:"xl",html:f,style:n,isPreview:true}),jsx(ae,{component:"div",size:"sm",html:g,style:n,isPreview:true})]},"stat"),r&&jsx(De,{content:r})]})})}var Nd=h(()=>{l();Qt();Jt();we();He();});function Si({subtitle:e,tooltip:t,settings:o}){let r=ke(e)||"<span class='cr-block-placeholder'>Small subtitle.</span>",n=o&&o.align?o.align:"left";return jsxs(Group,{spacing:"sm",position:Ge(n),children:[jsx(ae,{size:"sm",html:r,isPreview:true}),t&&jsx(De,{content:t,style:{display:"inline-flex"}})]})}var Fd=h(()=>{l();Qt();Yt();we();He();});function vi({title:e,tooltip:t,_iconType:o,_iconVariant:r,_icon:n,settings:s,_iconRadius:a,_iconSize:i,_iconPadding:c}){let u=ke(e)||"Title",p=s&&s.order?parseInt(s.order,10):1,m=p<=6?p:1,f=!!(s&&s.search&&s.search!=="off"),g=s&&s.search?s.search:"",d=s&&s.align?s.align:"left";return jsxs(Group,{spacing:"sm",position:Ge(d),children:[o!=="none"&&o&&jsx(ye,{blockType:"title",iconType:o,iconVariant:r,iconRadius:a,iconSize:i,icon:n,iconPadding:c}),jsx(ae,{component:"h",order:m,style:s,html:u,isPreview:true}),f&&jsx(Tooltip,{label:`Click will open '${g}' report search`,children:jsx(ActionIcon,{variant:"light",children:jsx(IconSearch,{size:20})})}),t&&jsx(De,{content:t})]})}var Vd=h(()=>{l();Qt();Yt();Jt();we();He();});function Ri(e){let{id:t,type:o,defaultValue:r,options:n,name:s,settings:a,hideLabel:i,component:c,resetSectionVars:u,section:p}=e,m=useDispatch(),f=useContext(Kt),g=Ee(),d=X(C=>C.status.query),{sectionVariables:v,resetSectionVariables:x}=_e(p),w=wx(t),R=useMemo(()=>d[w]||r,[d[w],o,r]),k=useMemo(()=>Ax(d[w],r),[d[w],o,r]),[P,U]=useState(n?.map(C=>({value:C.id,label:C.label,imageUrl:C.imageUrl}))||[]),[G,V]=useState((n||[]).map(C=>C.id).join("-"));useEffect(()=>{let C=n.map(W=>`${W.label}|${W.id}`).join("-");if(G===C)return;V(C);let N=n.map(W=>({value:W.id,label:W.label}));U(N);let Z=o===Ie.SINGLE?R:k;Io(o,Z,n)||m(va(f,w,g));},[JSON.stringify(n),t]);let B=()=>{u==="true"&&v&&x();},E=C=>{m(Go(f,w,C,g)),B();},O=C=>{m(Go(f,w,C.join(),g)),B();},A=i==="true"?jsx(Fragment,{}):jsx(ae,{component:"div",html:s,size:"sm",style:a,isPreview:true});return P.length===0?jsx(Text,{c:"dimmed",size:"xs",children:"No options defined yet. Selector hidden in report."}):P.length===1?jsxs(Text,{c:"dimmed",size:"xs",children:["Only one option defined. Selector hidden in report. ",JSON.stringify(P)]}):{[Ie.SINGLE]:c===xn.SEGMENTED_CONTROL?jsxs("div",{children:[A,jsx(SegmentedControl,{data:P,value:P.map(C=>C.value).includes(R)?R:"",onChange:E,fullWidth:true})]}):jsx(Select,{label:A,data:P,value:R,onChange:E,itemComponent:Px,styles:{label:{display:i==="true"?"none":"block"}}}),[Ie.MULTI]:jsx(MultiSelect,{label:A,data:P,value:k,onChange:O,styles:{label:{display:i==="true"?"none":"block"}}})}[o]}var wx,Ax,Px,Ud=h(()=>{l();Kr();Rn();de();ce();uo();we();Le();$e();wx=e=>`selector${e}id`,Ax=(e,t)=>e&&typeof e=="string"?e.split(","):t,Px=forwardRef(function({imageUrl:t,label:o,...r},n){return jsx("div",{ref:n,...r,children:jsxs(Group,{noWrap:true,children:[t&&jsx(Box,{component:"img",w:25,h:25,src:t}),jsx("div",{children:jsx(Text,{size:"sm",children:o})})]})})});});var Gd=h(()=>{});function wi({dimmed:e=false,label:t,root:o=true,value:r,parentIsArray:n=false,level:s=0}){let a=useMantineTheme();if(s===Ci)return null;let i=jsx(Text,{lineClamp:1,size:"xs",variant:"dimmed",p:5,children:"[Max depth hitted for preview]"}),c=ki(r),u=r,p=JSON.stringify(u),m=100,f=1e3,g=!!(p&&p.length>m),d=10,v={control:{padding:"5px 0px 5px 5px"},label:{padding:"5px 0px"},content:{paddingTop:0,paddingBottom:0,paddingRight:0}};if(c==="object")return jsx(Accordion,{className:"cr-variable-accordion",variant:"contained",styles:v,children:jsxs(Accordion.Item,{value:"label",children:[jsx(Accordion.Control,{children:jsx(Text,{lineClamp:1,size:"xs",weight:700,color:e?"dimmed":a.primaryColor,children:o?`{{${t}}}`:n?`[${t}]`:t})}),jsx(Accordion.Panel,{children:s+1<Ci?Object.keys(r).sort((x,w)=>{let R=ki(r[x]),k=ki(r[w]);return R!==k?Hd.indexOf(R)-Hd.indexOf(k):x.localeCompare(w)}).map(x=>jsx(wi,{root:false,label:x,value:r[x],level:s+1},x)):i})]})});if(c==="array"){let x=r.length>d,w=x?r.slice(0,d):r,R=x?r.length-d:0;return jsx(Accordion,{className:"cr-variable-accordion",variant:"contained",styles:v,children:jsxs(Accordion.Item,{value:"label",children:[jsx(Accordion.Control,{children:jsx(Text,{lineClamp:1,size:"xs",weight:700,p:0,color:e?"dimmed":a.primaryColor,children:o?`{{${t}}}`:n?`[${t}]`:t})}),jsxs(Accordion.Panel,{children:[s+1<Ci?w.map((k,P)=>jsx(wi,{root:false,label:P,value:k,level:s+1,parentIsArray:true},P)):i,x&&jsxs(Text,{lineClamp:1,size:"xs",variant:"dimmed",p:5,children:["[+ ",R," other elements]"]})]})]})})}return c==="string"?u=g?`"${u.substring(0,m)} ... "`:`"${u}"`:c==="error"?u=`Error: ${u.message}`:c==="undefined"?u=c:u.toString&&(u=u.toString()),jsxs(Group,{noWrap:true,spacing:0,children:[jsx(Text,{color:e?"dimmed":a.primaryColor,lineClamp:1,size:"xs",pl:5,style:{overflow:"visible",wordBreak:"keep-all",whiteSpace:"nowrap"},weight:700,children:o?`{{${t}}}`:n?`[${t}]`:t}),jsx(Prism,{className:"cr-variable",language:"jsx",noCopy:true,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}),g&&jsxs(HoverCard,{width:500,shadow:"md",withinPortal:true,children:[jsx(HoverCard.Target,{children:jsx(ActionIcon,{children:jsx(IconCodePlus,{})})}),jsx(HoverCard.Dropdown,{w:500,children:jsx(Text,{size:"sm",maw:"100%",style:{wordBreak:"break-all",whiteSpace:"pre-wrap",overflowWrap:"break-word"},children:p.substring(0,f)})})]})]})}var ki,Hd,Ci,Wd,qd=h(()=>{l();Gd();ki=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"],Ci=5;Wd=wi;});var jd,Kd=h(()=>{l();jd=e=>t=>t.replace(new RegExp(`^${e}`),"").startsWith("_");});function Fx({reserved:e=[],id:t,variables:o={},showInternal:r=false}){let s=It(t==="attributes"?null:t).data,a=s?s.type:"block",i=s?.type&&s?.id?`${s.type}${s.id}`:"",c=Object.keys(o).filter(r?()=>true:u=>!jd(i)(u));return jsx(Stack,{spacing:0,children:c.length?c.map(u=>jsx(Wd,{dimmed:e.includes(u),label:u,value:o[u]},u)):jsx(Text,{color:"dimmed",size:"xs",children:jsx("i",{children:`empty ${a}`})})})}var Yd,Xd=h(()=>{l();qd();ce();Kd();Yd=Fx;});function jx({outputVariables:e,status:t,hasAPI:o=false,debug:r,type:n}){let[s,a]=useState(false),i=o&&!Object.keys(e).length&&!t.error,c=Object.keys(e).some(p=>p.startsWith("_"));return r?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"}),c&&jsx(Switch,{label:"Show internal variables",mb:"xs",size:"xs",checked:s,onChange:p=>a(p.currentTarget.checked)}),jsx(Yd,{variables:e,showInternal:s})]}):jsx(Center,{children:jsx(Badge,{color:"gray",variant:"outline",children:n.toUpperCase()},"type")})}var Pi,Qd=h(()=>{l();Xd();Pi=jx;});function Ii(e){let{alt:t,src:o,desc:r,title:n,settings:s,...a}=e,i=ke(t),c=ke(o),u=ke(r),p=jsx("img",{src:c,alt:i,style:a}),m=s&&s.align?String(s.align):"left";return (u&&u.length||n&&n.length)&&(p=jsxs(Stack,{className:"bespoke-Image-wrapper",align:Je(m),spacing:"sm",children:[n&&jsx(ae,{component:"p",html:n,style:s,isPreview:true}),p,r&&jsx(ae,{component:"p",size:"sm",html:r,style:s,isPreview:true})]})),c&&i?p:jsx(Center,{mih:100,bg:"white",children:jsx(Badge,{color:"gray",variant:"outline",children:"IMAGE"},"type")})}var Zd=h(()=>{l();Yt();we();He();});function _i({headings:e,settings:t,title:o,shortTitle:r,_iconType:n,_iconVariant:s,_icon:a,_iconRadius:i,_iconSize:c,_iconPadding:u}){let{min:p="1",max:m="6",icons:f="yes"}=t||{},g=ke(o)||"",d=ke(r||o)||"",v=g&&g.length>0,x=n&&n!=="none",w=d===g?`${g}`:`${g} (${d})`,R=Yo(parseInt(p,10),parseInt(m,10),e),k=f==="yes",P=t&&t.align?String(t.align):"left",U=vr(P),G=Ge(P),V=Je(P),B=t&&t.titlePosition?String(t.titlePosition):"left",E=useMemo(()=>{let A={right:"left",left:"right"},C=v&&["left","right"].includes(B),N={};if(C){let Z=B==="right";N={spacing:"xs",position:Z&&A[G]?A[G]:G,style:{flexDirection:Z?"row-reverse":"row"},noWrap:true};}else N={spacing:"xs",align:V,justify:"center",style:{flexDirection:B==="bottom"?"column-reverse":"column"}};return {element:C?Group:Stack,props:N}},[v,G,V,B]),O=A=>!A||!A?.length?null:jsx(Fragment,{children:A.map(C=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${C.id}`,children:jsxs(Group,{spacing:"sm",children:[k&&jsx(ye,{...C.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:C.label}})]})})},C.id),jsx(Box,{pl:"xs",children:O(C.children)})]},C.id))});return jsxs(E.element,{pos:"relative",...E.props,children:[v&&jsxs(Group,{spacing:"xs",position:G,noWrap:true,children:[x&&jsx(ye,{blockType:"title",iconType:n,iconVariant:s,iconRadius:i,iconSize:c,icon:a,iconPadding:u}),jsx(ae,{style:t,html:w,isPreview:true,lineClamp:1})]}),jsxs(List,{sx:A=>({display:"flex",gap:A.spacing.md,justifyContent:U,alignItems:"center",listStyleType:"none"}),children:[R?.map(A=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:400,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${A.id}`,children:jsxs(Group,{spacing:"sm",noWrap:true,children:[k&&jsx(ye,{blockType:"nav",...A.iconProps,iconSize:"sm",iconPadding:"2"}),jsx(Text,{dangerouslySetInnerHTML:{__html:A.label}})]})})}),A?.children?.length?jsx(Menu.Dropdown,{children:O(A.children)}):null]})},A.id)),!R||R.length===0&&jsx(List.Item,{children:jsx(Text,{color:"dimmed",children:"- Include some titles as inputs to see the Nav component -"})})]})]})}var em=h(()=>{l();Qe();Jt();He();we();Jt();Yt();});function Mi(e){let{related_reports:t,settings:o}=e;if(!t?.length)return jsx(Text,{children:"There are no available members related to your current selection and report."});let r=vr(o&&o.align?String(o.align):"left");return jsx(List,{sx:()=>({display:"flex",justifyContent:r,"& li":{marginRight:"1rem"}}),children:t.map(n=>jsx(List.Item,{children:n.entities.map(s=>s.name).join(" & ")},n.link))})}var om=h(()=>{l();He();});function Di({id:e,label:t,settings:o,showIcon:r,fullWidth:n,showWhenDisabled:s}){let a=It(e).data,{sectionVariables:i,resetSectionVariables:c}=_e(a?.section_id),u=!!Object.keys(i).length,p=Je(o&&o.align?o.align:"left");return jsxs(Stack,{align:p,children:[!u&&!s&&jsx(Text,{size:"xs",ta:o?.align||"left",children:"Reset button will not be shown on its disabled state"}),jsx(Button,{onClick:()=>c(),disabled:!u,fullWidth:n,children:jsxs(Group,{align:"center",children:[t,r&&jsx(IconRefresh,{})]})})]})}var nm=h(()=>{l();Le();He();});function Fi({settings:e,label:t,showIcon:o,position:r="center"}){let n=e&&e.search?e.search:"";return jsxs(Group,{position:r,children:[jsx(Tooltip,{label:`Click will open '${n}' report search`,children:jsx(Button,{children:jsxs(Group,{align:"center",children:[t||"Comparison Button",o&&jsx(IconPlus,{})]})})}),jsx(ActionIcon,{variant:"light",children:jsx(IconSearch,{size:20})})]})}var im=h(()=>{l();});function zi({columns:e=[],id:t,data:o=[],tableProps:r={}}){let[n,s]=useState({}),{initialState:a}=r,i=a?.pagination?.pageIndex,c=a?.pagination?.pageSize,u=`table-${[t,i,c].filter(d=>d).join("-")}`,p=useMemo(()=>e.map(d=>d.accessorKey),[e]),m=useMemo(()=>o.filter(d=>typeof d=="object"&&d!==null&&!Array.isArray(d)&&Object.keys(d).some(v=>p.includes(v))),[p,o]),f=useMemo(()=>e.map(d=>({...d,Cell:({renderedCellValue:v})=>jsx(ae,{html:`${v}`,isPreview:true}),filterFn:"contains"})),[e]),g=Jc();return useEffect(()=>{(async()=>{try{let v=g||"en",x=`${v.toUpperCase()}`,w=await import(`mantine-react-table/locales/${v}.js`);s(w[`MRT_Localization_${x}`]);}catch(v){console.error("Error loading translations:",v);}})();},[g]),createElement(MantineReactTable,{...r,autoResetPageIndex:false,columns:f,data:m,enableColumnFilterModes:true,enableFilterMatchHighlighting:false,globalFilterFn:"contains",key:u,layoutMode:"grid",localization:n,state:{...r.state,isFullScreen:false}})}var lm=h(()=>{l();we();Le();});function $i({label:e,url:t,settings:o}){let{align:r}=o;return jsx(Group,{position:r,grow:r==="justify",children:jsx(Button,{component:"a",target:"_blank",href:t||"",children:e||"Button"})})}var um=h(()=>{l();});function Gi(e){let t=useDispatch(),o=useContext(Kt),r=Ee(),n=X(D=>D.status.query),s=DT(e.id),a=useMantineTheme(),{allLabel:i,colorKey:c,data:u,defaultValue:p,defaultValueType:m,iconKey:f,levels:g,limit:d,placeholder:v,searchIndexKey:x,searchIndexSeparator:w,resetSectionVars:R,section:k}=e,[P,U]=useState(false),[G,V]=useState(true),[B,E]=useState(""),[O,A]=useState(false),[C,N]=useState([""].slice(1)),{sectionVariables:Z,resetSectionVariables:W}=_e(k),$=useMemo(()=>FT(n[`${s}-value`],p),[n,p,s]),J=useMemo(()=>n[`${s}-type`]||m,[n,m,s]),M=useCallback(()=>{R==="true"&&Z&&W();},[R,Z,W]),z=useCallback(D=>{M(),t(Go(o,`${s}-value`,D.join(),r));},[t,o,s,M,r.status]),F=useCallback(D=>{M(),t(Go(o,`${s}-type`,D,r));},[t,o,s,M,r.status]),Y=useRef(null),ve=useRef(false),j=useRef(!!d&&d<$.length),ee=C.length,re=g[ee],oe=C.filter(Boolean);C.length>0&&oe.length===0&&oe.push(`${i} ${re?.label}`),useEffect(()=>{let D=()=>{V(true);};return window.addEventListener("touchmove",D),()=>{window.removeEventListener("touchmove",D);}},[]);let _=useMemo(()=>BT(u,g,c,f,x,w),[c,u,f,g,x,w]),T=useMemo(()=>{let D=MT(B),ue=Array.from(NT(_,D)).reverse();return O?ue:C.reduce((I,se)=>I.filter(ne=>!se||ne.searchindex.indexOf(se)>-1),ue.filter(I=>I.type===re?.value))},[re,_,B,O,C]),L=useRef(null),q=os({count:P?T.length:0,estimateSize:()=>30,getScrollElement:useCallback(()=>L.current,[]),overscan:10,rangeExtractor:useCallback(D=>sn(D),[])}),[Q,K]=useState(-1),ie=Math.min(Q,T.length-1),he=useCallback(D=>{let ue=C.concat(D);O&&A(false),N(ue);},[O,C]),it=useCallback(()=>{let D=C.slice(0,ee-1);O&&A(false),N(D);},[O,C,ee]),Ce=useCallback(D=>{E(D.currentTarget.value),!j.current&&u.length>0&&U(true);},[u,E,j,U]),xe=useCallback(()=>{E(""),z([]),Y.current?.focus(),d&&(j.current=false);},[E,z,Y,d,j]),Tt=useCallback(D=>{let ue=$.filter(I=>I!==D);z(ue),d&&ue.length<d&&(j.current=false);},[$,z,d,j]),$t=useCallback(D=>{J||F(D.type),J!==D.type?(F(D.type),z([D.value])):$.includes(D.value)?Tt(D.value):d?($.length<d&&z([...$,D.value]),$.length===d&&z([...$.slice(1),D.value])):z([...$,D.value]),E("");},[J,F,z,$,Tt,d]),Rt=useCallback(()=>{$.length>0&&B.length===0&&(z($.slice(0,-1)),U(true),d&&(j.current=false)),B.length>0&&E(B.slice(0,-1));},[$,B,z,E,U,d,j]),_r=useCallback(()=>{V(D=>D&&(ve.current=D,!D)),K(D=>D+1>=T.length?D:D+1);},[K,T]),Eo=useCallback(()=>{let D=T[ie];D&&$t(D);},[T,ie,$t]),ko=useCallback(()=>{U(false);},[U]),Rs=useCallback(()=>{it(),K(0);},[K,it]),Es=useCallback(()=>{let D=T[ie];!O&&D&&D.type!==g[g.length-1]?.value&&(he(D.name),K(0));},[T,ie,O,g,K,he]),ks=useCallback(()=>{V(D=>D&&(ve.current=D,!D)),K(D=>D-1<0?0:D-1);},[K]),Cs=({label:D,onRemove:ue,...I})=>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"},...I,children:[jsx("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D}),jsx(CloseButton,{"aria-hidden":true,iconSize:"70%",onMouseDown:ue,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})]}),ws=useMemo(()=>$.map(D=>_.find(ue=>ue.value===D)).filter(D=>!!D).map((D,ue)=>createElement(Cs,{...D,index:ue,key:D.value,onRemove:I=>{I.preventDefault(),I.stopPropagation(),Tt(D.value);}})),[$]),As=forwardRef(function({color:ue,icon:I,label:se,value:ne,...Ye},be){return jsx("div",{ref:be,style:{cursor:"pointer",width:"100%"},...Ye,children:jsxs(Group,{align:"center",noWrap:true,spacing:"xs",w:"100%",children:[I&&jsx(Box,{bg:ue??"transparent",component:"img",w:20,h:20,src:I}),jsx(Text,{lineClamp:1,size:"sm",children:se||ne})]})})}),{settings:Ps}=e,Is=e.hideLabel==="true"||!e.label?jsx(Fragment,{}):jsx(ae,{component:"div",html:e.label,size:"sm",style:Ps,isPreview:true});return jsx(Input.Wrapper,{label:Is,children:jsxs(Popover,{closeOnClickOutside:true,keepMounted:true,opened:P,onChange:U,onClose:()=>{K(0),E("");},onOpen:()=>{q.scrollToIndex(0);},shadow:"sm",width:"target",withinPortal:true,children:[jsx(Popover.Target,{children:jsxs(Box,{"aria-haspopup":"listbox",component:"div",onMouseLeave:()=>K(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:$.join(",")}),jsx(Input,{component:"div",multiline:true,onMouseDown:D=>{D.preventDefault(),!j.current&&u.length>0&&U(!P),Y.current?.focus();},rightSection:$.length>0?jsx(CloseButton,{onClick:xe,onMouseDown:D=>D.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":true,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:[ws,jsx("input",{autoComplete:"off","data-mantine-stop-propagation":P,onChange:Ce,onKeyDown:getHotkeyHandler([["ArrowDown",_r],["ArrowLeft",Rs],["ArrowRight",Es],["ArrowUp",ks],["Backspace",Rt],["Enter",Eo],["Escape",ko]]),placeholder:$.length===0?v:void 0,ref:Y,readOnly:j.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:B})]})})]})}),jsx(Popover.Dropdown,{onMouseDown:D=>D.preventDefault(),p:0,children:jsx("div",{style:{display:"flex",maxHeight:rem(300)},children:jsx(Box,{component:"div","data-combobox-popover":true,onMouseDown:D=>D.preventDefault(),role:"listbox",sx:{width:"100%"},tabIndex:-1,children:jsxs(Stack,{h:"100%",py:"xs",spacing:"xs",w:"100%",children:[g.length>1&&jsxs(Stack,{spacing:"xs",children:[jsxs(Group,{onClick:D=>{D.stopPropagation();},px:"xs",position:"center",spacing:"xs",children:[jsx(Button,{onClick:()=>{K(0),A(true),N([]),T.length>0&&q.scrollToIndex(0);},size:"xs",variant:O?"filled":"outline",children:i}),g.map((D,ue)=>jsx(Button,{onClick:()=>{O&&A(false);let I=[""].slice(1),se=ue;for(;se--;)I[se]=C[se]||"";K(0),N(I),T.length>0&&q.scrollToIndex(0);},size:"xs",variant:!O&&C.length===g.findIndex(I=>I.value===D?.value)?"filled":"outline",children:D?.label},D?.value))]}),jsx(Divider,{})]}),ee>0&&jsxs(Group,{align:"center",noWrap:true,px:"xs",children:[jsx(ActionIcon,{onClick:it,size:"sm",children:jsx(IconChevronLeft,{})}),jsx("div",{children:oe.map(D=>jsx(Text,{lineClamp:1,size:"xs",children:D},`${D}`))})]}),jsx(ScrollArea,{mah:250,onWheel:()=>V(true),px:"xs",style:{overflow:"auto",width:"100%"},viewportRef:L,viewportProps:{tabIndex:-1},w:"100%",children:jsx("div",{style:{height:`${q.getTotalSize()}px`,position:"relative",width:"100%"},children:q.getVirtualItems().map(D=>{let ue=T[D.index],I=ie===D.index,se=$.includes(ue.value);return T.length>0&&I&&!G&&q.scrollToIndex(ie),jsxs(Group,{"aria-selected":I,align:"center","data-hovered":I||void 0,"data-index":D.index,"data-selected":se,id:ue.vale,noWrap:true,onMouseEnter:ne=>{ne.preventDefault(),ne.stopPropagation(),G&&(K(D.index),V(false));},onMouseMove:ne=>{ne.preventDefault(),ne.stopPropagation(),V(true);},onMouseDown:ne=>{ne.preventDefault(),$t(ue);},position:"apart",ref:q.measureElement,role:"option",spacing:"xs",sx:ne=>({borderRadius:ne.radius.xs,padding:"15px 5px 15px",paddingLeft:O&&10*g.findIndex(Ye=>Ye?.value===ue.type)||5,position:"absolute",top:0,left:0,height:`${D.size}px`,transform:`translateY(${D.start}px)`,width:"100%","&[data-hovered]":{backgroundColor:ne.colorScheme==="dark"?ne.colors.dark[4]:ne.colors.gray[1]},"&:hover":{backgroundColor:ne.colorScheme==="dark"?ne.colors.dark[4]:ne.colors.gray[1]}}),tabIndex:-1,children:[jsx(As,{index:D.index,...ue}),!O&&ue.type!==g[g.length-1]?.value&&jsx(ActionIcon,{onMouseDown:ne=>{ne.preventDefault(),ne.stopPropagation(),he(ue.name);},size:"sm",tabIndex:-1,children:jsx(IconChevronRight,{})})]},ue.value)})})})]})})})})]})})}var BT,MT,NT,DT,FT,bm=h(()=>{l();Xa();we();uo();ce();Le();Kr();$e();BT=(e=[],t=[],o="",r="",n="",s="|")=>{let a=t.map(v=>v.value).slice(),i=`${a.pop()}`,c=v=>v[o],u=v=>v[r],p=v=>{if(v[n])return typeof v[n]=="string"?v[n].split(s):v[n]},m=new Set,f=[],g=[],d=nest().rollup(v=>{let x=v[0],w=E=>E&&E.value&&!m.has(E.value),R=a.map(E=>x[`${E} ID`]),k=a.map(E=>x[E]),P=a.map((E,O)=>{if(g[O]!==k[O]){g[O]=k[O];let A=c[O]||c[c.length-1]||c,C=u[O]||u[u.length-1]||u,N=p[O]||p[p.length-1]||p;return {color:A(x,E)||void 0,icon:C(x,E)||void 0,value:`${R[O]}`,label:k[O],name:k[O],type:E,searchindex:k.slice(0,O+1).concat(N(x,E)).join("|")}}return {}}).filter(w);P.forEach(E=>m.add(E.value));let U=c[c.length-1]||c,G=u[u.length-1]||u,V=p[p.length-1]||p,B=v.map(E=>({color:U(E,i)||void 0,icon:G(E,i)||void 0,value:`${E[`${i} ID`]}`,label:E[i],name:E[i],type:i,searchindex:k.concat(E[i]).concat(V(E,i)).join("|")}));f.push(...P.concat(B));});return a.forEach(v=>{d.key(x=>`${x[`${v} ID`]}|${x[v]}`);}),d.entries(e),f},MT=e=>{if(!e)return /./i;let t=e.normalize("NFD").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"[^|]+");return RegExp(t,"i")},NT=(e,t)=>{let o=e.length,r,n=i=>r&&r.searchindex.includes(i.searchindex),a={next:()=>{for(let i=o-1;i>-1;i--){let c=e[i];if(t.test(`${c.value} ${c.label} ${c.searchindex}`)||n(c))return r=c,o=i,{done:false,value:c}}return {done:true,value:void 0}},[Symbol.iterator]:()=>a};return a},DT=e=>`multihierarchySelector${e}`,FT=(e,t)=>e&&typeof e=="string"?e.split(","):t;});var ym={};Os(ym,{default:()=>XT});function YT({block:e,active:t,locale:o,variables:r,configOverride:n={}}){let s=jT(),a=kt(e),i=po(o),c={variables:r},u=Ho(),p=Ee(),m=useRouter(),{sectionVariables:f,setSectionVariables:g,resetSectionVariables:d}=_e(e.section_id),v=useMemo(()=>{if(!t)return {error:"Activate to View"};if(!a?.logic)return {error:"Add a Configuration"};let V=gt({logic:a.logic},i,c).logic,B={router:m,section:{variables:f,setVariables:g,resetVariables:d}};return Xo(V,i,r,o,e.id,{},B,u,p)},[a?.logic,t,r,f,p.status]),{type:x}=v.config||{},w=x&&Hi[x]?x:"Treemap";x||(v.config={error:'Visualization missing "type"'}),Hi[x]||(v.config={error:`"${x}" is not a valid Visualization Type`});let R=Hi[w],k=v.error||v.config?.error||false;if(k)return jsx(Center,{style:{height:"100%"},children:jsx(Badge,{color:"gray",variant:"outline",children:k},"type")});let{_data:P,...U}=v.config,G={locale:o,variables:r,...U,...n};return s.print&&(G.detectVisible=false),jsx("div",{style:{display:"flex",flex:"1 1 100%"},children:jsx(or,{fallback:jsx("p",{children:"Error in d3plus viz config."}),children:jsx(R,{style:{flex:1},dataFormat:V=>{let B;try{B=v.dataFormat(V);}catch(E){console.error("Error in dataFormat: ",E),B=[];}return B},linksFormat:v.linksFormat,nodesFormat:v.nodesFormat,topojsonFormat:v.topojsonFormat,config:{...G}},"viz-key")})})}var jT,KT,Hi,XT,Sm=h(()=>{l();Po();Kn();Jr();Lo();Le();$e();fi();jT=()=>({}),KT={},Hi={[Zo]:jn,...ex,...KT};XT=memo(YT,(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 ZT,ze,vm=h(()=>{l();de();Bd();Nd();Fd();Vd();Ud();Qd();Zd();em();om();nm();im();lm();um();bm();ZT=rx(()=>Promise.resolve().then(()=>(Sm(),ym)),{ssr:false}),ze={[S.PARAGRAPH]:bi,[S.STAT]:yi,[S.SUBTITLE]:Si,[S.TITLE]:vi,[S.SELECTOR]:Ri,[S.VIZ]:ZT,[S.GENERATOR]:Pi,[S.SECTION_FLAG]:Pi,[S.IMAGE]:Ii,[S.NAV]:_i,[S.RELATED]:Mi,[S.RESET_BUTTON]:Di,[S.COMPARISON_BUTTON]:Fi,[S.TABLE]:zi,[S.BUTTON]:$i,[S.MULTIHIERARCHY_SELECTOR]:Gi};});var xm=h(()=>{l();de();({[S.TITLE]:IconHeading,[S.GENERATOR]:IconApi,[S.SECTION_FLAG]:IconFlag,[S.STAT]:IconPercentage,[S.VIZ]:IconChartBar,[S.PARAGRAPH]:IconAlignLeft,[S.SELECTOR]:IconSelector,[S.IMAGE]:IconPhoto,[S.TABLE]:IconTable,[S.MULTIHIERARCHY_SELECTOR]:IconListTree});});var Tm=h(()=>{l();de();({[S.TITLE]:"Title",[S.GENERATOR]:"Data",[S.STAT]:"Stat",[S.VIZ]:"Visualization",[S.PARAGRAPH]:"Paragraph",[S.SELECTOR]:"Selector",[S.SUBTITLE]:"Subtitle",[S.RESET_BUTTON]:"Reset Button",[S.COMPARISON_BUTTON]:"Comparison Button",[S.RELATED]:"Related Reports",[S.NAV]:"Navigation",[S.IMAGE]:"Image",[S.TABLE]:"Table",[S.BUTTON]:"Button",[S.FALLBACK]:"Fallback",[S.SECTION_FLAG]:"Section Flag",[S.MULTIHIERARCHY_SELECTOR]:"Multihierarchy Selector"});});var Rm=h(()=>{l();de();_d();vm();xm();Tm();({[S.GENERATOR]:{type:S.GENERATOR,renderer:ze[S.GENERATOR],renderPreviewOnEdit:false},[S.SECTION_FLAG]:{type:S.SECTION_FLAG,renderer:ze[S.SECTION_FLAG],renderPreviewOnEdit:false},[S.IMAGE]:{type:S.IMAGE,renderer:ze[S.IMAGE],renderPreviewOnEdit:false},[S.PARAGRAPH]:{type:S.PARAGRAPH,renderer:ze[S.PARAGRAPH],renderPreviewOnEdit:true,evalWhenNonActive:true},[S.RELATED]:{type:S.RELATED,renderer:ze[S.RELATED],renderPreviewOnEdit:false,evalWhenNonActive:false},[S.SELECTOR]:{type:S.SELECTOR,renderer:ze[S.SELECTOR],adapter:fn[S.SELECTOR],nonActiveAdapter:()=>fn[S.SELECTOR]({name:"Selector Preview"}),renderPreviewOnEdit:false},[S.STAT]:{type:S.STAT,renderer:ze[S.STAT],renderPreviewOnEdit:true,evalWhenNonActive:true},[S.SUBTITLE]:{type:S.SUBTITLE,renderer:ze[S.SUBTITLE],renderPreviewOnEdit:true,evalWhenNonActive:true},[S.TITLE]:{type:S.TITLE,renderer:ze[S.TITLE],renderPreviewOnEdit:true,evalWhenNonActive:true},[S.VIZ]:{type:S.VIZ,renderer:ze[S.VIZ],renderPreviewOnEdit:false},[S.NAV]:{type:S.NAV,renderer:ze[S.NAV],renderPreviewOnEdit:true,evalWhenNonActive:true},[S.RESET_BUTTON]:{type:S.RESET_BUTTON,renderer:ze[S.RESET_BUTTON],renderPreviewOnEdit:true,evalWhenNonActive:true},[S.COMPARISON_BUTTON]:{type:S.COMPARISON_BUTTON,renderer:ze[S.COMPARISON_BUTTON],renderPreviewOnEdit:true,evalWhenNonActive:true},[S.TABLE]:{type:S.TABLE,renderer:ze[S.TABLE],renderPreviewOnEdit:false,evalWhenNonActive:false},[S.BUTTON]:{type:S.BUTTON,renderer:ze[S.BUTTON],renderPreviewOnEdit:true,evalWhenNonActive:true},[S.MULTIHIERARCHY_SELECTOR]:{type:S.MULTIHIERARCHY_SELECTOR,renderer:ze[S.MULTIHIERARCHY_SELECTOR],adapter:fn[S.MULTIHIERARCHY_SELECTOR],nonActiveAdapter:()=>fn[S.MULTIHIERARCHY_SELECTOR]({label:"Multihierarchy Selector Preview"}),renderPreviewOnEdit:false}});});var Em=h(()=>{l();de();wd();Rm();Lo();Le();pr();Fr();zr();Us();Hs();fo();});var km,cR,hs,bs=h(()=>{l();km={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"}]}},cR=Object.keys(km).reduce((e,t)=>(e[t]=km[t].defaultValue,e),{}),{memberImageBg:false,optionsMenu:false,optionData:true,optionImage:true,optionShare:true,showAnchor:false,clientSideSection:false,...cR},hs=e=>({data:typeof e.optionData=="boolean"?e.optionData:true,image:typeof e.optionImage=="boolean"?e.optionImage:true,share:typeof e.optionShare=="boolean"?e.optionShare:true});});function Cm({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:true,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 wm=h(()=>{l();});function ji(e){let{section:t}=e,o=t.blocks||[],r=X(_=>o.map(T=>({..._.records.entities.block[T],status:_.variables.status[T]})).filter(T=>T.type===S.VIZ&&T.status.allowed)),{variant_slug1:n,slug1:s}=X(_=>_.variables.attributes),a=Zr(),[i,c]=useState(vt.section),[u,p]=useState(xt.png),[m,f]=useState(false),[g,d]=useState(false),[v,x]=useState([]),[w,R]=useState(r.length>0?r[0].id:null),k=i!==vt.section,{print:P,downloadLoading:U}=wa(t.id,n,s,k?w:null),[G,V]=useState(true),[B,E]=useState(false),O=je("options"),A={...LR,...O.image_tab},{siteProps:C}=Yr(),N=C?.logoSrc&&typeof C.logoSrc=="string",Z=useMemo(()=>t?.settings?.name?yt(t?.settings?.name):`section-${t.id}`,[t.id,t?.settings?.name]),W=`#${Z}`,$=useMantineTheme(),J=()=>{let _=F(w);return select(_).select("svg").size()===1},M=()=>`${yt(Z)}`,z=()=>{let _=document.getElementById(Z);return select(_).select(".bespoke-section-content").node()},F=_=>{let T=z();return select(T).select(`#bespoke-visualization-${_}.bespoke-block-area`).node()},Y=()=>new Promise(_=>{let T;i===vt.section?T=z():i===vt.viz&&(T=F(w));let L=document.createElement("div");L.style.display="flex",L.style.justifyContent="space-between",L.classList.add("bespoke-share-source"),L.style.padding=$.spacing.xs,L.style.width="100%";let q=document.createElement("div");if(q.innerText=A.source.replace("{src}",`${window.location}${W}`),q.style.fontSize=$.fontSizes.xs,L.appendChild(q),N){let Q=document.createElement("img");Q.src=C.logoSrc,Q.style.height="30px",Q.onload=()=>_(T),Q.onerror=()=>{Q.remove(),_(T);},L.appendChild(Q),T.appendChild(L);}else T.appendChild(L),_(T);}),ve=_=>{if(G)return "transparent";let T=select(_).style("background-color");return T!=="rgba(0, 0, 0, 0)"&&T!=="transparent"?T:_===document.body?"white":ve(_.parentNode)},j=async(_,T)=>{let{toPng:L}=await import('html-to-image');L(_,{backgroundColor:T.background,cacheBust:true,filter:q=>q&&q.classList?!T.exclusionClasses.some(Q=>q.classList.contains(Q)):true}).then(q=>{let Q=document.createElement("a");Q.download=`${T.filename}.png`,Q.href=q,Q.click();}).catch(q=>{console.error("Error generating image",q);}).finally(()=>{IR(),f(false);});},ee=(_,T)=>{saveElement(_,{filename:T.filename,type:"svg",callback:()=>f(false)},{background:T.background});},re=async()=>{f(true);let _=await Y(),T={background:ve(_),exclusionClasses:["export-hidden"],filename:M()},L=u===xt.png?j:ee;try{if(_)L(_,T);else throw new Error(A.wrong_node)}catch{f(false);}},oe=async()=>{let{toCanvas:_}=await import('html-to-image');Promise.all(r.map(T=>{let L=F(T.id),q=L.querySelector("g.d3plus-geomap-tileGroup");q&&(q.style.display="none");let Q=select(L).select("svg").select("g").size()>0,K=select(L).select("div.bespoke-html").size()>0,ie=Q||K?L:OR();return _(ie).then(he=>(q&&(q.style.display="block"),he))})).then(T=>{x(T.map(L=>L.toDataURL())),E(false);});};return useEffect(()=>{i===vt.viz&&r.length>0?(R(r[0].id),E(true),oe()):i===vt.section&&x([]);},[i]),useEffect(()=>{w&&(J()?d(true):(d(false),p(xt.png)));},[w]),jsxs(Stack,{className:"cms-section-options-image",children:[r.length>0?jsx(Input.Wrapper,{label:`${A.choose_area}:`,children:jsx(SegmentedControl,{fullWidth:true,value:i,data:[{value:vt.section,label:jsxs(Center,{children:[jsx(IconTemplate,{size:"1rem"}),jsx(Box,{ml:10,children:A.entire_section})]})},{value:vt.viz,label:jsxs(Center,{children:[jsx(IconChartBar,{size:"1rem"}),jsx(Box,{ml:10,children:A.viz_only})]})}],onChange:_=>{c(_),_===vt.section&&p(xt.png);}})}):jsx(Text,{fw:"700",color:"gray.7",children:`${A.entire_section}:`}),i===vt.viz&&r.length>0&&jsxs(Input.Wrapper,{label:`${A.choose_viz}:`,style:{minHeight:"161px",position:"relative"},children:[!B&&v.length>0&&jsx(ScrollArea,{style:{height:250},children:jsx(SimpleGrid,{cols:3,children:r.map((_,T)=>jsx(Image,{alt:`Viz ${_.id}`,onClick:()=>{R(_.id);},style:{cursor:"pointer",border:w===_.id?"4px solid #228be6":"4px solid #eee"},radius:0,src:v[T],withPlaceholder:true,styles:()=>({figure:{height:"100%"},imageWrapper:{height:"100%"}})},`viz-option-${_.id}`))})}),jsx(LoadingOverlay,{visible:B})]}),g&&i!==vt.section&&jsx(Input.Wrapper,{label:`${A.choose_format}:`,children:jsxs(Button.Group,{children:[jsx(Button,{leftIcon:jsx(IconPolaroid,{size:16}),onClick:()=>p(xt.png),variant:u===xt.png?"filled":"default",fullWidth:true,children:xt.png}),jsx(Button,{leftIcon:jsx(IconCode,{size:16}),onClick:()=>p(xt.svg),variant:u===xt.svg?"filled":"default",fullWidth:true,children:xt.svg})]})}),jsx(Checkbox,{checked:G,label:`${A.transparent_bg}`,onChange:()=>V(!G),radius:"xl"}),jsx(Button,{leftIcon:jsx(IconDownload,{size:16}),loading:m||U,onClick:a&&u!==xt.svg?()=>P(G):re,fullWidth:true,children:jsx("span",{children:m||U?A.processing:A.download.replace("{imageFormat}",u)})})]})}var vt,xt,IR,LR,OR,Lm=h(()=>{l();en();ce();_t();uo();Qe();de();vt={viz:"viz",section:"section"},xt={png:"PNG",svg:"SVG"},IR=()=>{let e=document.getElementsByClassName("bespoke-share-source");Array.from(e).forEach(t=>t.remove());},LR={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}"},OR=()=>document.createElement("div");});function _m(e){let{title:t,url:o,disabled:r=false}=e,n=r?IconCode:IconLink;return jsx(Input.Wrapper,{label:t,children:jsx(Input,{icon:jsx(n,{}),value:o,disabled:r,readOnly:true,rightSection:jsx(CopyButton,{value:o,timeout:2e3,children:({copied:s,copy:a})=>jsx(Tooltip,{label:s?"Copied":"Copy",withArrow:true,position:"right",children:jsx(ActionIcon,{variant:s?"filled":"subtle",onClick:a,disabled:r,children:s?jsx(IconClipboardCheck,{size:16}):jsx(IconClipboardCopy,{size:16})})})})})})}var Bm=h(()=>{l();});function Yi(e){let{section:t}=e,[o,r]=useState(""),[n,s]=useState(""),[a,i]=useState(true),c=je("options"),u={...nE,...c.share_tab};return useEffect(()=>{s(document.title);let{origin:p,pathname:m}=window.location,f=`${p}${m}`,g=a?t.settings?.name?.length?`#${yt(t.settings.name)}`:`#section-${t.id}`:"";r(`${f}${g}`);},[a]),jsxs(Stack,{className:"cms-section-options-share",children:[jsx(_m,{title:`${u.title}: ${n}`,url:o}),jsx(Checkbox,{checked:a,label:u.include_section,onChange:()=>i(!a),radius:"xl"}),jsxs(Group,{position:"center",children:[jsx(FacebookShareButton,{url:o,children:jsx(FacebookIcon,{size:32,round:true})}),jsx(TwitterShareButton,{url:o,title:n,children:jsx(TwitterIcon,{size:32,round:true})}),jsx(TelegramShareButton,{url:o,title:n,children:jsx(TelegramIcon,{size:32,round:true})}),jsx(WhatsappShareButton,{url:o,title:n,separator:":: ",children:jsx(WhatsappIcon,{size:32,round:true})}),jsx(LinkedinShareButton,{url:o,children:jsx(LinkedinIcon,{size:32,round:true})}),jsx(RedditShareButton,{url:o,title:n,windowWidth:660,windowHeight:460,children:jsx(RedditIcon,{size:32,round:true})}),jsx(EmailShareButton,{url:o,subject:n,children:jsx(EmailIcon,{size:32,round:true})})]})]})}var nE,Nm=h(()=>{l();Bm();_t();en();nE={title:"Title",include_section:"Include Section"};});function dE({panels:e,value:t,onTabChange:o}){let r=useRef(null),[n,s]=useState(false),[a,i]=useState(false),c=Object.keys(e),u=()=>{let m=r.current;if(!m)return;let{scrollLeft:f,scrollWidth:g,clientWidth:d}=m;s(f>0),i(f<g-d);};useEffect(()=>{let m=r.current;if(m)return u(),m.addEventListener("scroll",u),()=>{m.removeEventListener("scroll",u);}},[]);let p=m=>{let f=r.current;if(!f)return;let g=m==="left"?-150:150;f.scrollBy({left:g,behavior:"smooth"});};return jsxs(Box,{className:"bespoke-report-modal-tabs-container",pos:"relative",sx:{flexGrow:1,maxWidth:"calc(100% - 38px)"},children:[jsx(Box,{"data-direction":"left",display:n?"flex":"none",sx:Fm,children:jsx(ActionIcon,{onClick:()=>p("left"),children:jsx(IconChevronLeft,{size:20})})}),jsx(Tabs,{ref:r,value:t,onTabChange:o,sx:pE,children:jsx(Tabs.List,{className:"bespoke-report-modal-tabs",sx:{flexWrap:"nowrap",width:"fit-content"},children:c.map(m=>jsx(Tabs.Tab,{className:"bespoke-report-modal-tab",value:m,children:e[m].label},m))})}),jsx(Box,{display:a?"flex":"none","data-direction":"right",sx:Fm,children:jsx(ActionIcon,{onClick:()=>p("right"),children:jsx(IconChevronRight,{size:20})})})]})}function mE({className:e,opened:t,onClose:o,panels:r}){let[n,s]=useState(Object.keys(r)[0]);return jsxs(Modal.Root,{className:clsx("bespoke-report-modal",e),opened:t,onClose:o,size:"xl",centered:true,children:[jsx(Modal.Overlay,{className:"bespoke-report-modal-overlay"}),jsxs(Modal.Content,{children:[jsx(Modal.Header,{className:"bespoke-report-modal-header",children:jsxs(Group,{w:"100%",position:"apart",spacing:"md",noWrap:true,children:[jsx(dE,{panels:r,value:n,onTabChange:a=>a&&s(a)}),jsx(Modal.CloseButton,{className:"bespoke-report-modal-close-btn",ml:0})]})}),jsx(Modal.Body,{className:"bespoke-report-modal-body",children:r[n].component})]})]})}var pE,Fm,Ji,el=h(()=>{l();pE={overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none",WebkitOverflowScrolling:"touch",flexWrap:"nowrap"},Fm={height:"100%",zIndex:1,top:0,width:50,position:"absolute",backgroundSize:"cover",display:"flex",alignItems:"center","&[data-direction='left']":{background:"linear-gradient(to right, rgba(255, 255, 255, 1) 15px, rgba(255, 255, 255, 0))",left:0,justifyContent:"flex-start"},"&[data-direction='right']":{background:"linear-gradient(to left, rgba(255, 255, 255, 1) 15px, rgba(255, 255, 255, 0))",right:0,justifyContent:"flex-end"}};Ji=mE;});function $m(e){let{section:t,initialMode:o,onEnds:r,open:n,title:s}=e,a=hs(t.settings),i=useMemo(()=>hE.filter(g=>a[g]),[a]),[c,u]=useState(o||i[0]||"data"),p=je("options");useEffect(()=>{o!==c&&u(o);},[o]);let m={...tl,...p};useMemo(()=>jsxs(Fragment,{children:[jsxs(Tabs.List,{children:[a.data&&jsx(Tabs.Tab,{value:"data",children:m.download_title}),a.image&&jsx(Tabs.Tab,{value:"image",children:m.image_title}),a.share&&jsx(Tabs.Tab,{value:"share",children:m.share_title})]}),a.data&&jsx(Tabs.Panel,{value:"data",children:jsx(Ma,{section:t})}),a.image&&jsx(Tabs.Panel,{value:"image",children:jsx(ji,{section:t})}),a.share&&jsx(Tabs.Panel,{value:"share",children:jsx(Yi,{section:t})})]}),[a,t,m]);return jsx(Ji,{className:"cms-section-options-modal",opened:n,onClose:()=>r(),panels:{data:{label:m.download_title,component:jsx(Ma,{section:t})},image:{label:m.image_title,component:jsx(ji,{section:t})},share:{label:m.share_title,component:jsx(Yi,{section:t})}}})}var tl,hE,Um=h(()=>{l();Na();Lm();Nm();_t();bs();el();tl={download_title:"Download Data",image_title:"Save Image",share_title:"Share Link"},hE=["data","image","share"];});function Wm(e){let{sectionId:t,disabled:o=false}=e,[r,n]=useState(false),[s,a]=useState("data"),i=Un(t),c=je("options"),u={...tl,...c},p=hs(i.isSuccess?i.data.settings:{}),m=g=>{a(g),n(true);},f=()=>{n(false);};return jsxs("div",{className:"cms-section-options",children:[jsxs(Button.Group,{children:[p.data&&jsx(Button,{variant:"default",size:"xs",compact:true,onClick:()=>m("data"),"aria-label":u.download_title,disabled:o,children:jsx(IconTable,{size:16})}),p.image&&jsx(Button,{variant:"default",size:"xs",compact:true,onClick:()=>m("image"),"aria-label":u.image_title,disabled:o,children:jsx(IconCamera,{size:16})}),p.share&&jsx(Button,{variant:"default",size:"xs",compact:true,onClick:()=>m("share"),"aria-label":u.share_title,disabled:o,children:jsx(IconShare,{size:16})})]}),i.isSuccess&&jsx($m,{section:i.data,initialMode:s,open:r,onEnds:f})]})}var qm=h(()=>{l();Um();ce();_t();bs();});var jm=h(()=>{l();Qe();});var Km=h(()=>{l();ce();});var Ym=h(()=>{l();$r();ce();});var ol=h(()=>{l();jm();Km();Ym();});function EE({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 Jm=h(()=>{l();ce();ol();eo__default.forwardRef(function({children:t,column:o,basis:r,columnSettings:n={},sx:s={},...a},i){let c=Object.values(o).some(f=>f.settings?.display==="inline"),u=n?.width?`${n.width}px`:r,p=n?.width?`${n?.width}px`:"100%",m=n?.full?"100%":p;return jsx(Flex,{ref:i,className:"bespoke-section-col",align:"flex-start",direction:c?"row":"column",wrap:c?"wrap":"nowrap",maw:{base:"100%",md:m},miw:{base:"none",md:300},p:0,pos:"relative",sx:[{flexGrow:1,flexShrink:n?.full?0:1,flexBasis:n?.full?"100%":u},...packSx(s)],...a,children:t})}),eo__default.forwardRef(EE);});var ef=h(()=>{l();});var rl,tf=h(()=>{l();He();ce();ef();de();rl={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:rl.px},"%":{defaultValue:50,min:20,max:100,step:5,formatter:rl["%"]}};});var of=h(()=>{l();});function sl({previews:e,translations:t}){let{print:o}=Ze(),r=useMemo(()=>e.map(({image:n,name:s},a)=>(n?.author||n?.url)&&jsxs(Stack,{spacing:0,children:[n.author&&jsxs(Text,{size:"xs",children:[s," ",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})]}),a+1<e.length&&jsx(Divider,{})]},n.id)),[e]);return jsx(Fragment,{children:o?jsx(Fragment,{children:r}):jsxs(Popover,{position:"right",children:[jsx(Popover.Target,{children:jsx(ActionIcon,{variant:"light",radius:"xl",children:jsx(IconPhoto,{size:20})})}),jsx(Popover.Dropdown,{children:r})]})})}var sf=h(()=>{l();Zt();});var af=h(()=>{l();});var lf=h(()=>{l();ce();Lt();qt();zr();so();Qe();No();Le();$e();de();af();});var cf=h(()=>{l();Ne();});var al,mf,DE,FE,VE,ff=h(()=>{l();ce();Lt();Em();bs();Oo();wm();qm();Ne();de();Jm();tf();of();Zt();_t();sf();fo();en();uo();Ne();lf();cf();al=(e,t)=>o=>e?e(o,t):{},mf=forwardRef(({settings:e,styles:t,print:o,children:r,...n},s)=>{let{position:a,shouldBreak:i}=e,c={normal:{position:"relative",backgroundColor:o?"transparent":"initial",borderRadius:0},sticky:{position:"sticky",zIndex:2,top:0,borderRadius:0,borderTop:o?"none":"initial",borderLeft:o?"none":"initial",borderRight:o?"none":"initial"}},u={normal:{radius:0},sticky:{radius:0,withBorder:true}},p=[c[a],al(t,e),i?{pageBreakBefore:"always"}:{}];return jsx(Paper,{ref:s,component:"section",sx:p,...u[a],...n,children:r})});mf.displayName="PositionWrapper";DE=({settings:e,styles:t,children:o,...r})=>{let{width:n}=e,s={center:{zIndex:1},full:{zIndex:1}},a={center:{size:"lg",p:"sm",fluid:false},full:{fluid:true,p:"md"}},i=[s[n],al(t,e)];return jsx(Container,{sx:i,...a[n],...r,children:o})},FE=({settings:e,styles:t,print:o,children:r,...n})=>{let{style:s}=e,a={none:{},card:{boxShadow:o?"none":"initial"}},i={none:{bg:"transparent"},card:{shadow:o?"none":"lg",p:"md",radius:"md"}},c=[a[s],al(t,e)];return jsx(Paper,{sx:c,...i[s],...n,"data-screenshot-target":"true",children:r})},VE=forwardRef(({name:e,children:t,clientSideError:o,clientSideLoading:r=false,id:n,isClientSide:s=false,sectionSettings:a,sectionStyles:i,previews:c,translations:u},p)=>{let{print:m}=Ze(),f=a.memberImageBg&&c.some(({image:v})=>v&&(v.url||v.author)),g=useMemo(()=>a.showAnchor&&a.optionsMenu?"apart":!a.showAnchor&&a.optionsMenu?"right":a.showAnchor&&!a.optionsMenu?"left":"right",[a.showAnchor,a.optionsMenu]),d=e?.length?yt(e):`section-${n}`;return jsxs(mf,{ref:p,className:`bespoke-Section-${n} bespoke-Section-root `,settings:a,styles:i?.root||void 0,print:m,"data-section-id":d,"data-section-tags":Array.isArray(a.tags)?a.tags.join(" "):a.tags,children:[a.memberImageBg&&jsx(Cm,{previews:c}),jsxs(DE,{className:`bespoke-Section-${n} bespoke-Section-container `,settings:a,styles:i?.container,id:e?.length?yt(e):`section-${n}`,pos:"relative",children:[!m&&jsxs(Group,{position:g,mb:"xs",children:[a.showAnchor&&jsxs(Anchor,{className:"cms-section-anchor",href:`#${a.name?yt(a.name):"section-"+n}`,sx:{"&:hover .cms-section-name":{visibility:"visible",opacity:1}},children:[jsx(Text,{span:true,size:"small",children:"#"}),jsx(Text,{span:true,size:"small",className:"cms-section-name",sx:{visibility:"hidden",opacity:0,transition:"visibility 0s, opacity 0.2s ease-in-out"},children:a.name||"section-"+n})]}),a.optionsMenu&&(!s||s&&!r&&!o)&&jsx(Wm,{sectionId:n,disabled:false})]}),jsxs(FE,{print:m,className:`bespoke-Section-${n} bespoke-Section-container`,settings:a,styles:i?.content,children:[t,f&&jsx(sl,{previews:c,translations:u})]})]})]})});VE.displayName="SectionWrapper";});var gf=h(()=>{l();});var hf=h(()=>{l();ce();});var bf=h(()=>{l();Le();ol();gf();Qe();hf();Lt();de();});var Sf=h(()=>{l();_t();Qn();ce();Qe();Ne();qn();el();});var xf=h(()=>{l();});function Ze(){let e=useContext(WE);if(e===void 0)throw new Error("usePrint must be used within a PrintContext");return e}var WE,Zt=h(()=>{l();ce();Oo();ff();fo();Qn();Ne();Qe();bf();Sf();xf();WE=createContext({print:false,isEmbed:false});});var Tf=h(()=>{l();ce();de();Lo();Po();Le();Jr();$e();tp();_t();Na();Qn();Zt();Oo();});var Rf=h(()=>{l();ce();});var Ef=h(()=>{l();uo();ce();so();qt();Lt();Qe();$e();});function is(e,t,o,r,n=false){let s=useRouter(),{query:a,locale:i}=s,c=X(N=>N),u=useDispatch(),p=bt(),m=X(N=>r&&p.variables?p?.variables?.attributes:N.variables.attributes),f=mo(c),g=jo(c),d=Ko(c),v=ao(g,i),x=Qr(e,r&&p.active?p?.variables.variables:void 0,r&&p.active?p?.variables.attributes:void 0),w=X(N=>r?p.variables.variables:N.variables.variables),R=X(N=>r?p.variables.status:N.variables.status),k=Ot(),{sectionVariables:P,resetSectionVariables:U}=_e(t),{addRunConsumersRunning:G,removeRunConsumersRunning:V}=br(),B=Ee(),E=r&&p.active?`${o}-valueCompare`:`${o}-value`,O=r&&p.active?`${o}-typeCompare`:`${o}-type`,A=r&&p.active?Object.fromEntries(Object.entries(a).filter(([N])=>N.match(XE)).map(([N,Z])=>[N.replace("Compare",""),Z])):Object.fromEntries(Object.entries(a).filter(([N])=>N.match(QE)).map(([N,Z])=>[N.replace("Compare",""),Z]));return useCallback((N,Z)=>{let W={locale:i,query:{...A,[`${o}-type`]:Z,[`${o}-value`]:N},variables:x},$=new URLSearchParams(window.location.search);N&&Z?($.set(E,N.join(",")),$.set(O,Z)):($.delete(E),$.delete(O)),window.history.replaceState(null,null,`?${$.toString()}`),G([t]),Wt(f,void 0,e,v,W,{variables:w,status:R},k,"report",d,B).then(J=>{n&&P&&U(),p.active&&r?p.setComparisonVariables({attributes:m,variables:J.variables,status:J.status}):u(io.setVariableChange({attributes:m,variables:J.variables,status:J.status})),V([t]);});},[r,m,e,f,p,u,v,R,w,i,A,k,o,O,E,x,P,n,U])}var XE,QE,kf=h(()=>{l();fo();Qe();so();ce();Le();qt();Lt();No();$e();XE=/\w*Compare\b/,QE=/multihierarchySelector\d+(id|-(type|value))/;});var Cf=h(()=>{l();});function sk({exploreProps:e={profilePrefix:"/",locale:nk},icon:t=jsx(IconSearch,{size:20}),actionIconProps:o={},modalProps:r={},tooltipProps:n={},tooltipText:s="Click to Explore",showIcon:a=true,showTooltip:i=false,children:c}){let[u,p]=useState(false),m={variant:"light",size:"md",radius:"md",...o},f={fullScreen:true,opened:u,onClose:()=>p(false)},g=jsx(ActionIcon,{...m,onClick:()=>p(true),children:t}),d=a?jsxs(Group,{spacing:"sm",style:{cursor:"pointer"},children:[c,g]}):c;return i&&(d=jsx(Tooltip,{label:s,...n,children:d})),jsxs(Fragment,{children:[jsx(Modal,{...f,...r,children:u&&jsx(cl,{...e,onSelect:()=>p(false)})}),jsx("div",{onClick:()=>p(true),children:c?d:jsx(Fragment,{children:g})})]})}var nk,il,ll=h(()=>{l();ul();mt();({localeDefault:nk}=Pe());il=sk;});var pk,Pf,If=h(()=>{l();pk=forwardRef(({id:e,members:t,...o},r)=>{let n=t.map(s=>jsxs(Stack,{align:"center",children:[jsx(Text,{weight:500,children:s.name}),jsx(Badge,{color:"green",variant:"light",children:s.variant})]},s.id));return jsx("div",{ref:r,children:jsx(Group,{position:"apart",grow:true,...o,children:n})},e)}),Pf=pk;});function Rk({locale:e,profilePrefix:t="/report",autocompleteProps:o={},tooltipProps:r={},tooltipText:n="Click to search",searchReportParams:s={},callback:a,children:i}){let c=useRouter(),u=c.locale,{localeDefault:p}=Pe(),m=u===p?"":`/${u}`,f=Tk(o?o.itemComponent:null),[g,d]=useState(""),[v,x]=useDebouncedValue(g,500),[w,R]=useState([]),[k,P]=useState(false),[U,G]=useState(false),[V,B]=useState(false),[E,O]=useState(!i),A=()=>{O(false);},C=()=>{O(true),$();},N=useRef(),Z=useClickOutside(A),W=o?.searchConfig?.searchLimit??10,$=()=>{P(true);let ee={query:v,format:"profiles",locale:e,limit:W,visible:true,includes:true,noImage:false,variant:[],dimension:[],report:[],all:false,...s};On.get("/api/cms/search/reports",{params:ee}).then(re=>{re&&re.data&&re.data.data&&re.data.data.results&&R(re.data.data.results.map(oe=>({id:oe.id,reportName:oe.report.name,href:`${m}${t}${oe.path}`,reportPath:`${oe.path}`,profilePrefix:t,value:`VALUE: ${oe.id}`,members:oe.members.map(_=>({original_id:_.metadata.id,name:_.name,id:_.id,variant:_.metadata.variant.name,image:{src:`/api/cms/member/image?member=${_.id}&size=thumb`,alt:_.name}}))}))),P(false),N.current?.focus();}).catch(re=>{console.error(re),P(false);});};useEffect(()=>{V&&v.length>=(o.searchConfig?.queryThreshold??0)&&$();},[V,v,o.searchConfig?.queryThreshold]),useEffect(()=>{x(),N.current&&E&&B(true);},[]),useEffect(()=>{x(),N.current&&E&&B(true);},[E]);let J=ee=>{O(false),a?a(ee):(c.push(ee.href),G(true));},M=ee=>{ee.includes("VALUE:")||d(ee);},{searchConfig:z,...F}=o,Y={placeholder:"Search",size:"md",icon:jsx(IconSearch,{}),...F,data:w},ve=jsx(Autocomplete,{value:g,itemComponent:f,onItemSubmit:J,onChange:M,filter:()=>true,disabled:(k||U)&&!V,limit:W,maxDropdownHeight:250,rightSection:jsx(Group,{spacing:0,position:"right",children:k?jsx(Loader,{size:20}):jsx(Fragment,{})}),rightSectionWidth:50,ref:N,...Y});return i?jsx(Tooltip,{label:n,disabled:E,...r,children:jsxs(Group,{ref:Z,spacing:"sm",align:"center",style:{cursor:"pointer"},children:[!E&&jsx("div",{onClick:()=>O(true),children:i}),E&&jsx(Fragment,{children:ve}),E?jsx(ActionIcon,{variant:"light",onClick:A,children:jsx(IconX,{size:20})}):jsx(ActionIcon,{variant:"light",onClick:C,children:jsx(IconSearch,{size:20})})]})}):ve}var Tk,dl,ml=h(()=>{l();Ne();If();mt();Tk=e=>{let{components:t}=Fe(),o=Pf;return t?.ReportItem&&(o=t?.ReportItem),e&&(o=e),o};dl=Rk;});function wk(){let{components:e}=Fe(),{modal:t,inline:o}=e?.search??{};return {modal:t,inline:o}}function xr(e,t,o,r,n){let s=wk(),a=X(m=>({reportId:m.variables.attributes.report_id,variantId:m.variables.attributes.variant_id1,title:m.variables.attributes.name1})),i=useRouter(),c=Gn(),u=je();return useMemo(()=>{let m=e;return t==="modal"?m=jsx(il,{exploreProps:{locale:i.locale||Mf,profilePrefix:c,translations:u.explore,initialReportId:a.reportId,initialVariantId:a.variantId,initialQuery:a.title},tooltipText:u.explore?.tooltip,modalProps:s.modal,...n,children:e}):t==="inline"&&(m=jsx(dl,{locale:i.locale||Mf,profilePrefix:c,callback:o,tooltipText:u.explore?.tooltip,...r,autocompleteProps:s.inline,children:e})),m},[t,e])}var Mf,Df=h(()=>{l();_t();ce();Le();ll();ml();mt();Ne();({localeDefault:Mf}=Pe());});var Ne=h(()=>{l();du();mu();fu();Tf();Ca();Rf();Ef();kf();pi();Cf();Df();});function ri({reportId:e,reportName:t,members:o,href:r,onClick:n}){let s=o.map(i=>jsx(Image,{src:i.image.src,height:160,imageProps:{loading:"lazy"},alt:i.name},i.id)),a=o.map(i=>jsxs(Stack,{children:[jsx(Text,{weight:500,children:i.name}),jsx(Badge,{color:"green",variant:"light",w:"fit-content",children:i.variant})]},i.id));return jsxs(Card,{className:`report-${e}-tile`,shadow:"sm",p:"lg",radius:"md",withBorder:true,children:[jsx(Card.Section,{children:jsx(Group,{grow:true,spacing:0,children:s})}),jsx(Group,{position:"apart",mt:"md",mb:"xs",children:a}),jsx("a",{href:r,onClick:n,children:jsx(Button,{variant:"light",color:"blue",fullWidth:true,mt:"md",radius:"md",children:`See ${t} Report`})})]})}function Nk({profile:e,profilePrefix:t,onSelect:o,reportTile:r}){let n=useRouter(),s=n.locale,{localeDefault:a}=Pe(),c=`${s===a?"":`/${s}`}${t}${e.path}`,u=e.members.map(g=>({original_id:g.metadata.id,name:g.name,id:g.id,dimension_id:g.metadata.dimension.id,dimension:g.metadata.dimension.name,variant_id:g.metadata.variant.id,variant:g.metadata.variant.name,image:{src:`/api/cms/member/image?member=${g.id}&size=thumb`,alt:g.name}})),p=g=>{n.push(`${g}`),o&&o();},m=g=>{g.preventDefault(),p(c);},f=Mk(r);return jsx(Grid.Col,{xs:12,sm:6,md:4,lg:4,xl:3,children:jsx(f,{reportId:e.report.id,reportName:e.report.name,members:u,href:c,onClick:m})},e.id)}var Mk,$f,ni=h(()=>{l();Ne();mt();Mk=e=>{let{components:t}=Fe(),o=ri;return t?.ReportTile&&(o=t?.ReportTile),e&&(o=e),o};$f=Nk;});function Uk({profilePrefix:e,onSelect:t=()=>{},reportTile:o}){let[r,n]=useState(500),s=useRef(null),{results:a}=Ut(),i=s.current?.offsetTop||0,c=50;return useEffect(()=>{let{innerHeight:u}=window;n(u-i-c);},[i]),jsx(ScrollArea,{offsetScrollbars:true,type:"always",h:r,ref:s,children:jsx(Grid,{align:"stretch",children:a.map(u=>jsx($f,{profile:u,profilePrefix:e,reportTile:o,onSelect:t},u.id))})})}var Uf,Gf=h(()=>{l();ni();ir();Uf=Uk;});function Wk(){let{activePage:e,setActivePage:t,pageSize:o,currentPageTotal:r}=Ut();return jsx(Group,{position:"center",children:jsx(Pagination,{value:e,onChange:s=>{t(s);},total:Math.ceil(r/o),size:"sm",py:"xs"})})}var Wf,qf=h(()=>{l();ir();Wf=Wk;});function oC({profilePrefix:e,initialReportId:t,initialVariantId:o,translations:r,onSelect:n,reportTile:s,initialQuery:a}){let i=useRef(),c=Ut(),{query:u,setQuery:p,results:m,loadingItems:f,loadingMetadata:g,translations:d,setTranslations:v,initExplore:x}=c;useEffect(()=>{x&&x(t,o,a);},[x]),useEffect(()=>{f||i.current?.focus();},[f]),useEffect(()=>{r&&v(r);},[r]);let w=()=>{p("");};return jsxs(Container,{fluid:true,pt:"1em",children:[jsx(TextInput,{placeholder:d.search,mb:"md",size:"xl",onChange:R=>p(R.target.value),readOnly:g||f,icon:jsx(IconSearch,{size:24}),value:u,rightSectionWidth:100,rightSectionProps:{style:{justifyContent:"flex-end",padding:"0 15px 0 0"}},rightSection:jsxs(Group,{align:"center",children:[(g||f)&&jsx(Loader,{size:28}),u&&u!==""&&jsx(ActionIcon,{onClick:w,children:jsx(IconTrash,{size:24})})]}),ref:i}),jsx(Cl,{translations:d}),jsx(LoadingOverlay,{visible:g||f}),!f&&m.length===0&&jsx(Alert,{title:d.no_results,color:"blue",children:d.try_another}),jsx(Uf,{profilePrefix:e,onSelect:n,reportTile:s}),jsx(Wf,{})]})}var cl,ul=h(()=>{l();wl();Gf();qf();ir();cl=oC;});l();ul();ll();ml();ir();/*! Bundled license information:
18
18
 
19
19
  @tanstack/react-virtual/build/lib/_virtual/_rollupPluginBabelHelpers.mjs:
20
20
  @tanstack/react-virtual/build/lib/index.mjs: