@datawheel/bespoke 0.8.0-rc.24 → 0.8.0-rc.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/report.js CHANGED
@@ -44,26 +44,26 @@ import { saveElement } from 'd3plus-export';
44
44
  import { FacebookShareButton, FacebookIcon, TwitterShareButton, TwitterIcon, TelegramShareButton, TelegramIcon, WhatsappShareButton, WhatsappIcon, LinkedinShareButton, LinkedinIcon, RedditShareButton, RedditIcon, EmailShareButton, EmailIcon } from 'react-share';
45
45
  import * as Do from 'xlsx';
46
46
 
47
- var ug=Object.defineProperty;var b=(e,t)=>()=>(e&&(t=e(e=0)),t);var Na=(e,t)=>{for(var r in t)ug(e,r,{get:t[r],enumerable:!0});};var c=b(()=>{});var pg,we,Ct=b(()=>{c();pg=()=>{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}},we=pg;});function Da(e,t){return +(e<t)-+(e>t)}function Ke(e,t,r="ordering"){return Da(t[r],e[r])}var io=b(()=>{c();});function Fa(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 vl(e,t,r){let o=0,n=1,a=1,s=1,i=0,l=0,u;for(;Math.abs((a-l)/a)>1e-5;)l=a,u=-(t+i)*(t+r+i)*e/(t+2*i)/(t+2*i+1),o=a+u*o,n=s+u*n,i+=1,u=i*(r-i)*e/(t+2*i-1)/(t+2*i),a=o+u*a,s=n+u*s,o/=s,n/=s,a/=s,s=1;return a/t}function dg(e,t,r){let o,n;if(e<0)n=0;else if(e>=t)n=1;else {e=Math.floor(e);let a=r,s=e+1,i=t-e,l=s+i,u=Math.exp(Fa(l)-Fa(i)-Fa(s)+s*Math.log(a)+i*Math.log(1-a));a<(s+1)/(l+2)?o=u*vl(a,s,i):o=1-u*vl(1-a,i,s),n=1-o;}return Math.round(n*1e5)/1e5}function mg(e){return {.99999:15.137,.99:6.635,.95:3.841,.9:2.706}[e]}function Fo(e,t,r,o){let n=t/(1-t),a=0,s=1,i=0,l=0;for(;a<=e;)l+=s,a>=r&a<=o&&(i+=s),l>1e30&&(i/=1e30,l/=1e30,s/=1e30),a+=1,s=s*n*(e+1-a)/a;return i/l}function fg(e,t,r){let o=e/t,a=(100-r*100)/2,s,i;if(e===0)s=0;else {let l=o/2,u=0,p=o,m=a/100;for(;p-u>1e-5;)Fo(t,l,e,e)*.5+Fo(t,l,e+1,t)>m?(p=l,l=(u+l)/2):(u=l,l=(p+l)/2);s=l;}if(e===t)i=0;else {let l=(1+o)/2,u=o,p=1,m=a/100;for(;p-u>1e-5;)Fo(t,l,e,e)*.5+Fo(t,l,0,e-1)<m?(p=l,l=(u+l)/2):(u=l,l=(p+l)/2);i=l;}return {lci:s,uci:i}}function gg(e,t){let r=e,o=t,n=r,a=o,s=95,i=.5,l=.5,p=(100-s)/2/100,m=n;for(;l>1e-5;)l/=2,kn((1+m)*i/(1-i),m+1,1e10)+.5*kn((1+m)*i/(1-i),m,m)>p?i-=l:i+=l;let d=(1+m)*i/(1-i)/a;for(i=.5,l=.5,p=(100-s)/2/100;l>1e-5;)l/=2,kn((1+m)*i/(1-i),0,m-1)+.5*kn((1+m)*i/(1-i),m,m)<p?i-=l:i+=l;let g=(1+m)*i/(1-i)/a;return {lci:d,uci:g}}function kn(e,t,r){let o=1,n=0,a=0,s=0;for(;s<e||o>n*1e-10;)n+=o,s>=t&s<=r&&(a+=o),n>1e30&&(a/=1e30,n/=1e30,o/=1e30),s+=1,o=o*e/s;return a/n}var Sl,Tl=b(()=>{c();Sl={binomialCdf:dg,binP:Fo,computeMidP:fg,criticalValue:mg,smr:gg};});function W(e){let t=e.logicFactory(sr);return Ag[e.name]={description:e.description,inputType:e.inputType,logic:wg(t),testValue:e.testValue,type:e.type||"formatter"},t}function wg(e){let t=e.toString().trim();if(t.startsWith("function"))return t.replace(/^function(?:\s\w+)?\([^)]\)/,"").trim().replace(/^{([\s\S]+)\}$/,"$1");let r=t.replace(/^.+?=>/,"").trim();return r.startsWith("{")?r.replace(/^{([\s\S]+)\}$/,"$1"):`return ${r}`}var sr,Ag,ae=b(()=>{c();Tl();sr={d3:{...hg,...yg,...bg,...vg},d3plus:{assign:assign,closest:closest,date:date,formatAbbreviate:formatAbbreviate,merge:merge,strip:strip,titleCase:titleCase},stats:Sl},Ag={};});var xl,Rl=b(()=>{c();xl={jwt:Pg};});var An,El,wn=b(()=>{c();ae();Rl();An=(e,t={},r="en",o={},n={})=>{let a={setVariables:o.onSetVariables?o.onSetVariables:l=>l,openModal:o.onOpenModal?o.onOpenModal:l=>l,formatters:t,libs:sr,locale:r,...n};function s(l){return Function("globals",...l.vars,`with (globals) { ${l.logic} }`).bind(a,a)}function i(l){if(l.vars&&l.logic)return s(l);for(let u in l)Array.isArray(l[u])?l[u]=l[u].map(p=>isObject(p)?i(p):p):isObject(l[u])&&(l[u]=i(l[u]));return l}return i(e)},El=(e,t={})=>{let r={libs:xl,...t};function o(a){return Function("globals",...a.vars,`with (globals) { ${a.logic} }`).bind(r,r)}function n(a){if(a.vars&&a.logic)return o(a);for(let s in a)Array.isArray(a[s])?a[s]=a[s].map(i=>isObject(i)?n(i):i):isObject(a[s])&&(a[s]=n(a[s]));return a}return n(e)};});function Pn(e,t){let r=Mg[e];if(!r)throw new Error(`Invalid entity type: ${e}`);let{entities:o}=normalize(t,[r]);return {report:Pr(o,"report"),dimension:Pr(o,"dimension"),section:Pr(o,"section"),block:Pr(o,"block"),variant:Pr(o,"variant"),formatter:Pr(o,"formatter"),datasource:Pr(o,"datasource")}}function Pr(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:{}}var Lg,Vo,kl,Cl,Al,Og,_g,Bg,Mg,wl,At,ir=b(()=>{c();io();wn();Ct();(({localeDefault:Lg}=we())),Vo=new schema.Entity("block",{},{mergeStrategy(e,t){return t.block_input?e||{}:{...e,...t}}});Vo.define({consumers:[Vo],inputs:[Vo]});kl=new schema.Entity("variant"),Cl=new schema.Entity("dimension",{variants:[kl]},{processStrategy(e){return {...e,variants:"variants"in e?e.variants:[]}}}),Al=new schema.Entity("section",{blocks:[Vo]}),Og=new schema.Entity("report",{dimensions:[Cl],sections:[Al]},{processStrategy(e){return {...e,sections:"sections"in e?e.sections.sort(Ke):[]}}}),_g=new schema.Entity("formatter"),Bg=new schema.Entity("datasource"),Mg={report:Og,section:Al,block:Vo,dimension:Cl,variant:kl,formatter:_g,datasource:Bg};wl=(e,t=void 0)=>{let{sid:r,bid:o,previews:n=[],query:a={}}=t||{},s,i,l={};return r?(s=r,l.activeSection=s):s=e.activeSection,n.length>0?(i=n,l.previews=i.filter(Boolean)):i=e.previews,{parsedParams:{sid:s,bid:o,previews:i,query:a},statusPayload:l}},At=(e=[],t=Lg)=>e.reduce((r,o)=>{let n=An({vars:["n"],logic:o.content.logic},{},t,{});return r[o.name]=n,r},{});});function gt(e,t){return e.request(t).then(r=>{let{status:o,data:n}=r;return "error"in n?{ok:!1,status:o,error:n.error}:{ok:!0,status:o,wrapper:n.wrapper,data:n.data}},r=>{if("isAxiosError"in r){let{status:o,data:n}=r.response||{status:500};return {ok:!1,status:o,error:n?.error??r.message}}return {ok:!1,status:500,error:r.message}})}function Se(e,t,r){let o=typeof t=="string"?{url:t}:t;return n=>gt(e,{...o,method:"GET",params:r?r(n):n})}function Te(e,t,r){let o=typeof t=="string"?{url:t}:t;return n=>gt(e,{...o,method:"POST",data:r?r(n):n})}function lr(e,t,r){let o=typeof t=="string"?{url:t}:t;return n=>gt(e,{...o,method:"DELETE",params:r?r(n):n})}var lo=b(()=>{c();});function co(e,t){return r=>gt(e,{method:"POST",url:`images/save/${t}`,params:{prompt:r.prompt,provider:t}})}var Pl=b(()=>{c();lo();});function $o(e,t){return r=>gt(e,{method:"GET",url:`images/search/${t}`,params:{prompt:r.prompt,page:r.page,provider:t}})}var Il=b(()=>{c();lo();});function Ll(e,t){return ()=>gt(e,{method:"GET",url:`list/icons/${t}`,params:{provider:t}})}var Ol=b(()=>{c();lo();});function _l(e,t){return r=>gt(e,{method:"GET",url:`read/icons/${t}/icon.svg`,params:{name:r.name}})}var Bl=b(()=>{c();lo();});function zo(e){let t=Nn.create({baseURL:e});return {createBulkBlock:Te(t,"create/bulk/block"),createBlock:Te(t,"create/block"),createDimension:Te(t,"create/dimension"),createFormatter:Te(t,"create/formatter"),createReport:Te(t,"create/report"),createSection:Te(t,"create/section"),createVariant:Te(t,"create/variant"),createDatasource:Te(t,"create/datasource"),deleteBlock:lr(t,"delete/block",Lr),deleteDimension:lr(t,"delete/dimension",Lr),deleteFormatter:lr(t,"delete/formatter",Lr),deleteReport:lr(t,"delete/report",Lr),deleteSection:lr(t,"delete/section",Lr),deleteVariant:lr(t,"delete/variant",Lr),deleteDatasource:lr(t,"delete/datasource",Lr),readBlock:Se(t,"read/block"),readDimension:Se(t,"read/dimension"),readFormatter:Se(t,"read/formatter"),readReport:Se(t,"read/report"),readSection:Se(t,"read/section"),readVariant:Se(t,"read/variant"),readDatasource:Se(t,"read/datasource"),updateBulkBlock:Te(t,"update/bulk/block"),updateBlock:Te(t,"update/block"),updateDimension:Te(t,"update/dimension"),updateFormatter:Te(t,"update/formatter"),updateReport:Te(t,"update/report"),updateSection:Te(t,"update/section"),updateVariant:Te(t,"update/variant"),updateDatasource:Te(t,"update/datasource"),searchReport:Se(t,"search/reports"),validateVariantSlug:Se(t,"validate/variant"),readMember:Se(t,"read/members",Dg),readMemberImage:Se(t,{url:"member/image",responseType:"blob"}),searchMember:Se(t,"search/members"),updateMember:Se(t,"update/members"),imageLocalSearch:$o(t,"local"),imageLocalSave:co(t,"local"),imageFlickrSearch:$o(t,"flickr"),imageFlickrSave:co(t,"flickr"),imageUnsplashSearch:$o(t,"unsplash"),imageUnsplashSave:co(t,"unsplash"),imageUploadSave:co(t,"upload"),imageAdobeSearch:$o(t,"adobe"),imageAdobeSave:co(t,"adobe"),readMetadata:Se(t,"read/metadata"),regenerateSearch:Te(t,"search/regenerate"),urlProxy:Se(t,"url/proxy"),searchRole:Se(t,"auth/search/roles"),searchUser:Se(t,"auth/search/users"),readUser:Se(t,"auth/read/user"),updateUser:Te(t,"auth/update/user"),updateMyData:Te(t,"auth/update/me"),revalidateReport:Se(t,"revalidate/report"),revalidateUrl:Se(t,"revalidate/url"),readPrivateBlocks:Te(t,"read/blocks/private"),listTablerIcons:Ll(t,"tabler"),readTablerIcon:_l(t,"tabler"),readEnvSecrets:Se(t,"read/secrets")}}var Lr,Dg,Ml=b(()=>{c();Pl();Il();lo();Ol();Bl();Lr=e=>({id:e}),Dg=e=>{if(e.mode==="slugs"){let t=e.slugs.map(r=>[r.variantSlug,r.memberSlug].join("/")).join(",");return {...e,slugs:t}}return ["related","whole"].includes(e.mode)?{...e}:{...e,[e.mode]:e[e.mode].join(",")}};});var Va=b(()=>{c();Ml();});var Nl=b(()=>{c();});var Dl=b(()=>{c();Nl();});function ct(e){return {variables:e.variables||{},query:e.query||{},locale:e.locale||$g}}var $g,uo=b(()=>{c();Dl();Ct();({localeDefault:$g}=we());});var Or,Fl,Ce,Ln,Vl,$a,zg,Ug,Gg,za,Ua,h,fe,xe,$l,In,he=b(()=>{c();Or={REPORT:"report",SECTION:"section",BLOCK:"block",INPUT:"block_input",FORMATTER:"formatter",DATASOURCE:"datasource",DIMENSION:"report_dimension",VARIANT:"report_dimension_variant",SEARCH:"search"},[Or.BLOCK,Or.SEARCH],{[Or.SECTION]:"report_id",[Or.DIMENSION]:"report_id",[Or.VARIANT]:"dimension_id",[Or.BLOCK]:"section_id",[Or.INPUT]:"block_id"},Fl={REPORT:"report",STORY:"story"},Ce={SINGLE:"single",MULTI:"multi"},Ln={SEGMENTED_CONTROL:"segmented control",SELECTOR:"selector"},Vl={TITLE:"title",SUBTITLE:"subtitle",LABEL:"label"},{[Fl.REPORT]:Object.values(Vl),[Fl.STORY]:Object.values(Vl)},$a={ALLOWED:"allowed",ALLOWED_LOGIC:"allowedLogic",IGNORE_CASCADE:"ignoreCascade"},zg={ACCESS:"access",ACCESS_LOGIC:"accessLogic"},Ug={FALLBACK:"fallback"},{...$a},{POSITION:"position",ICON:"icon",...$a},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"},za={GENERATOR:"generator",RELATED:"related",VIZ:"visualization",SECTION_FLAG:"section_flag"},Ua="logic",h={...Gg,...za},[h.GENERATOR,h.SECTION_FLAG,h.SELECTOR,h.VIZ,h.IMAGE,h.TABLE,h.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",TOOLTIP:"tooltip",TWITTER:"twitter",URL:"url",VALUE:"value"},[fe.LOGIC,fe.SIMPLE,fe.SIMPLE_ENABLED],xe={ENABLE_ALL:{bubbleMenu:!0,toolbarOptions:{history:!0,alignment:!1,format:!0}},DISABLE_ALL:{bubbleMenu:!1,toolbarOptions:{history:!1,alignment:!1,format:!1}},ENABLE_FORMAT:{bubbleMenu:!0,toolbarOptions:{history:!0,alignment:!1,format:!0}}},{[h.IMAGE]:[{field:fe.TITLE,editorConfig:xe.ENABLE_ALL},{field:fe.SRC,editorConfig:xe.DISABLE_ALL},{field:fe.ALT,editorConfig:xe.DISABLE_ALL},{field:fe.DESC,editorConfig:xe.ENABLE_ALL}],[h.PARAGRAPH]:[{field:h.PARAGRAPH,editorConfig:xe.ENABLE_ALL},{field:fe.TOOLTIP,editorConfig:xe.ENABLE_FORMAT}],[h.SELECTOR]:[{field:fe.SELECTOR_DEFAULT},{field:fe.SELECTOR_DYNAMIC},{field:fe.SELECTOR_NAME,editorConfig:xe.ENABLE_FORMAT},{field:fe.SELECTOR_TYPE}],[h.STAT]:[{field:fe.TITLE,editorConfig:xe.ENABLE_FORMAT},{field:fe.SUBTITLE,editorConfig:xe.ENABLE_FORMAT},{field:fe.VALUE,editorConfig:xe.ENABLE_FORMAT},{field:fe.TOOLTIP,editorConfig:xe.ENABLE_FORMAT}],[h.SUBTITLE]:[{field:fe.SUBTITLE,editorConfig:xe.ENABLE_FORMAT},{field:fe.TOOLTIP,editorConfig:xe.ENABLE_FORMAT}],[h.TITLE]:[{field:fe.TITLE,editorConfig:xe.ENABLE_FORMAT},{field:fe.SLUG,editorConfig:xe.DISABLE_ALL},{field:fe.TOOLTIP,editorConfig:xe.ENABLE_FORMAT}],[h.BUTTON]:[{field:fe.LABEL,editorConfig:xe.ENABLE_FORMAT},{field:fe.URL,editorConfig:xe.ENABLE_FORMAT}],[h.GENERATOR]:[],[h.SECTION_FLAG]:[],[h.VIZ]:[],[h.TABLE]:[],[h.MULTIHIERARCHY_SELECTOR]:[{field:fe.MULTIHIERARCHY_SELECTOR_NAME,editorConfig:xe.ENABLE_FORMAT},{field:fe.MULTIHIERARCHY_SELECTOR_PLACEHOLDER,editorConfig:xe.DISABLE_ALL},{field:fe.MULTIHIERARCHY_SELECTOR_ALL_LABEL,editorConfig:xe.DISABLE_ALL}]},{NAME:"name",DESCRIPTION:"description",...$a,...zg,...Ug},$l={FORMATTER:"formatter",FUNCTION:"function"},{[$l.FORMATTER]:"Formatter",[$l.FUNCTION]:"Function"},In={STRING:"string",NUMBER:"number",OBJECT:"object",DATE:"date"},{[In.STRING]:"String",[In.NUMBER]:"Number",[In.OBJECT]:"Object/Array",[In.DATE]:"Date"};});function Kg(e,t,r,o,n=void 0,a){let s={},i=[],{locale:l}=ct(a);try{if(t){let u=new Proxy(console,{get(m,d){return Yg(d,"log","debug","info","warn","error")?(...f)=>{i.push(`${d} ${Date.now()} - ${f.map(g=>format(g)).join(" ")}`),Wg&&m[d](...f);}:m[d]}}),p;return n?p=new Function(e,"console","libs","formatters","locale","variables",r)(t,u,sr,o,l,n):p=new Function(e,"console","libs","formatters","locale",r)(t,u,sr,o,l),typeof p=="object"&&Object.keys(p).length>0&&Object.assign(s,p),{vars:s,error:null,log:i,output:p}}return {vars:s,error:"Invalid API Link",log:i}}catch(u){return {vars:s,error:u.message,log:i}}}function Yg(e,...t){return t.includes(e)}var Wg,wt,Uo=b(()=>{c();uo();ae();Wg=Hg(process.env.REPORTS_LOGGING),wt=Kg;});function Ga(e){return e.reduce((t,r,o)=>(o?o===e.length-1&&o===1?t+=` and ${r}`:o===e.length-1?t+=`, and ${r}`:t+=`, ${r}`:t+=r,t),"")}var zl=b(()=>{c();});function Xg(e,t,r,o=!1){let{variables:n}=ct(r);if(!e)return e;let a=/([A-z0-9]*)\{\{([^\}]+)\}\}/g;return e.replace(a,(i,l,u)=>{let p=d=>d;if(l){let d=l.replace(/^\w/g,f=>f.toLowerCase());d in t?p=t[d]:p=f=>`${l}${f}`;}let m=Array.isArray(n[u])?Ga(n[u]):n[u];if(m===void 0)return o?i:"N/A";try{return p(m,sr,t)}catch(d){return console.error(`Error using formatter ${p.name}
48
- `,`Error message: ${d.message}`),"N/A"}})}var tt,po=b(()=>{c();uo();zl();ae();tt=Xg;});var qa,ut,_r=b(()=>{c();po();qa=(e,t,r)=>{let{variables:o}=r,n=s=>s.allowed==="never"?!1:!s.allowed||s.allowed==="always"||o[s.allowed],a={...e};return Object.keys(a).forEach(s=>{typeof a[s]=="string"?a[s]=tt(a[s],t,r):Array.isArray(a[s])?a[s]=a[s].filter(n).map(i=>typeof i=="object"?qa(i,t,r):typeof i=="string"?tt(i,t,r):i):typeof a[s]=="object"&&a[s]!==null&&!(a[s]instanceof Date)&&(a[s]=qa(a[s],t,r));}),a},ut=qa;});var Ul,Gl=b(()=>{c();Ul=e=>Array.isArray(e)?e.map(t=>typeof t=="string"?{allowed:"always",label:t,id:t}:{allowed:"always",label:t.id,...t}):[];});var Qg,Br,On=b(()=>{c();he();Qg=(e,t,r)=>{if(!r)return !1;if(e===Ce.SINGLE)return r.find(n=>n.id===t);let o=Array.isArray(t)?t:t.split(",");return Array.isArray(o)&&o.every(n=>r.map(a=>a.id).includes(n))},Br=Qg;});function mo(e,t,r,o,n=!1){let{variables:a}=ct(o),s=ut({logic:t},r,o).logic,i=wt("variables",a,s,r,void 0,o),{vars:l,log:u,error:p}=i,m=l.type||Ce.SINGLE,d=l.component||"Selector",f=l.hideLabel||"false",g=l.resetSectionVars||"false",y=l.name||"Unlabeled Selector",T=Ul(l.options||[]),C=U=>m===Ce.MULTI&&!Array.isArray(U)?[U]:U,N=l.defaultValue,R;if(N&&(N=C(N),Br(m,N,T)&&(R=N)),!R){let U=T&&T[0]&&T[0].id||T[0]||"";R=C(U);}if(n&&typeof window<"u"){let U=`selector${e}id`,K=new URLSearchParams(window.location.search),O=Object.fromEntries(K)[U];O&&!Br(m,O,T)&&O!==void 0&&(K.delete(U),window.history.replaceState(null,null,`?${K.toString()}`));}return {config:{name:y,type:m,options:T,defaultValue:R,component:d,hideLabel:f,resetSectionVars:g},log:u,error:p}}var Ha=b(()=>{c();uo();he();Uo();_r();Gl();On();});function ja(e,t,r){if(!e)return !1;let o=Array.isArray(r)?r:r.split(",");return Array.isArray(o)&&o.every(n=>e.map(a=>`${a[`${t} ID`]}`).includes(n))}var ql=b(()=>{c();});function fo(e,t,r,o,n=!1){let{variables:a}=ct(o),s=ut({logic:t},r,o).logic,i=wt("variables",a,s,r,void 0,o),{vars:l,log:u,error:p}=i;if(n&&typeof window<"u"){let d=`multihierarchySelector${e}-value`,f=`multihierarchySelector${e}-type`,g=new URLSearchParams(window.location.search),y=Object.fromEntries(g),T=y[d],C=y[f];T&&T!==void 0&&C&&C!==void 0&&!ja(l.data,C,T)&&(g.delete(d),g.delete(f),window.history.replaceState(null,null,`?${g.toString()}`));}return {config:l,log:u,error:p}}var Wa=b(()=>{c();ql();uo();Uo();_r();});var Zg,Hl,jl=b(()=>{c();he();Zg=(e,t,r)=>{let o=`selector${e}id`,n=new URLSearchParams(typeof location<"u"&&location?.search?location.search:"").get(o),a=new URLSearchParams(t).get(o),s=n||a;if(r.type===Ce.MULTI){let u=s?s.split(","):r.defaultValue,p=r.options.filter(m=>u.includes(m.id));return {[`selector${e}id`]:u,[`selector${e}label`]:(p||[]).map(m=>m.label)}}let i=s&&r.options.find(u=>u.id===s)?s:r.defaultValue,l=r.options.find(u=>u.id===i);return {[`selector${e}id`]:i,[`selector${e}label`]:l&&l.label||void 0}},Hl=Zg;});var Jg,Wl,Kl=b(()=>{c();Jg=(e,t,r)=>{let o=`multihierarchySelector${e}-value`,n=`multihierarchySelector${e}-type`,a=new URLSearchParams(typeof location<"u"&&location?.search?location.search:"").get(o),s=new URLSearchParams(typeof location<"u"&&location?.search?location.search:"").get(n),i=new URLSearchParams(t).get(o),l=new URLSearchParams(t).get(n),u=a||i,p=s||l,m=u?u.split(","):r.defaultValue||[],d=p||r.defaultValueType||"",f=r.data?.filter(g=>m.includes(`${g[`${d} ID`]}`))||[];return {[`multihierarchySelector${e}id`]:m,[`multihierarchySelector${e}label`]:[...new Set((f||[]).map(g=>g[d]))],[`multihierarchySelector${e}type`]:d}},Wl=Jg;});var Yl,eh,th,rh,Be,Mr=b(()=>{c();he();Ct();(({localeDefault:Yl,locales:eh}=we())),th=Object.values(za),rh=(e,t=Yl)=>e&&th.includes(e.type)?{locale:Ua,locales:[Ua]}:{locale:t,locales:eh},Be=(e,t=Yl)=>{if(!e)return {};let{locale:r}=rh(e,t);return e.contentByLocale?.[r]?.content};});function oh(e,t){let r=Object.values(t),o=r.filter(n=>n.shared&&n.section_id!==e).map(n=>n.id);return Object.fromEntries(r.filter(n=>n.section_id===e&&(n.inputs.length===0||n.inputs.some(a=>o.includes(a)))).map(n=>[n.id,n]))}var Xl,Ql=b(()=>{c();Xl=oh;});var Zl,Jl=b(()=>{c();Zl=(e,t)=>t&&typeof t=="string"?t.split(".").reduce((r,o)=>r[o],e):e;});var _n,ec,Ka=b(()=>{c();_n="|||",ec="SECTION_ALLOWED";});function Ya(e){return e.type===h.SECTION_FLAG&&e.inputs.length===0&&e.consumers.length===0}var tc=b(()=>{c();he();});function ah(){let{publicRuntimeConfig:e}=nh(),t=e.bespoke_report_env_vars||{};return {...Object.keys(t).reduce((r,o)=>(r[`ENV_${o}`]=t[o]||"N/A",r),{})}}var cr,Go=b(()=>{c();cr=ah;});function sh(){return typeof process>"u"?{}:Object.entries(process.env).filter(([e])=>e.startsWith("BESPOKE_SECRET_")).reduce((e,[t,r])=>({...e,[t.replace("BESPOKE_SECRET_","ENV_SECRET_")]:r}),{})}var rc,oc=b(()=>{c();rc=sh;});function Mn(e){return e.ok!==void 0}function Bn(e){this.message=e,this.name="ApiFetchException";}async function Xa(e,t,r="en",o,n){let a=Date.now(),s=e,i,l=cr(),u=rc(),p={envs:{...l,...u}},d=new URL(e).searchParams;if(d.has("bespoke_slugs")){let N=new RegExp(`[?&]bespoke_slugs=${d.get("bespoke_slugs")}`,"g");s=s.replace(N,"");}let f={datasource:void 0};o.find(N=>{if(!N.content?.pattern)return !1;try{let R=new RegExp(N.content.pattern,"gm");return R.test(s)?(f.datasource=N,!0):R.test(s)}catch{return !1}});let g=n?n.settings:{},y=!!(g&&g.useProxy&&g.useProxy==="true"),T=f.datasource&&typeof f.datasource.content.useProxy=="boolean"?f.datasource.content.useProxy:!1,C=`${process.env.NEXT_PUBLIC_REPORTS_BASE_URL}/api/cms/url/proxy?url=${encodeURIComponent(s)}`;if(typeof window=="object"&&(y||T)){let N=await mh({url:s,timeout:ac});if(N.ok===!0)i=N.data;else throw new Bn(N?.error)}else try{let R={url:s,timeout:ac};if(f.datasource){let K=await El({vars:["url","libs"],logic:f.datasource.content.logic},p)(s);if(K.axiosConfig)R=K.axiosConfig;else throw new Bn(`AxiosConfig is missing in Data Source ${f.datasource.name} (ID: ${f.datasource.id}).`)}let M=await Nn(R);if(M.status===200)M.headers["content-type"]==="text/csv"?i=csvParse(M.data):i=M.data;else throw new Bn("No response for: "+s)}catch(N){throw new Bn(N.message)}if(d.has("bespoke_slugs")){let N=d.get("bespoke_slugs");if(N){let R=N.split(",");if(R.length===3){let[M,U,K]=R,w=Zl(i,K);if(w&&Array.isArray(w)){let O=Array.from(new Set(w.map(k=>`${k[U]}`).filter(k=>!["","undefined"].includes(k))));if(O.length>0){let k=O.join("").length>2e3,I=await t({mode:k?"whole":"ids",ids:k?void 0:O,all:!1,locale:r,variant:[parseInt(M,10)],output:"lite",limit:O.length+1}).then(E=>{let A=[];return Mn(E)?E.ok&&(A=E.data.results):A=E.results,A&&Array.isArray(A)?A:[]}).catch(E=>(console.error(`Error hydrating slugs for Variant: ${M}, Key: ${U}, Accessor: ${K}`),console.error(` Url ${e}`),n&&console.error(` From Section ${n.section_id} and Block ${n.id}`),console.error(E),[]));if(I){let E=Object.fromEntries(I.map(A=>[A.id,`/${A.variant_slug}/${A.slug}`]));w.map(A=>(A.bespoke_slug=E[A[U]]?E[A[U]]:null,A));}}}}}}return {data:i,requestDuration:Date.now()-a,finalUrl:T||y?C:s,apiDataSource:f.datasource?f.datasource:!1}}function fh(e){this.name="BlockException",this.message=e;}async function sc(e,t,r,o,n){let{locale:a,variables:s,query:i}=ct(r),l=gh(e,r,s,t),u=null,p=e.contentByLocale?.logic?.content?.api,m=null,d=null,f=null,g=null,y=null;if(!l)return {outputVariables:{},renderVariables:{},status:{allowed:!1,hiddenByCascade:e.id}};if(e.type===h.FALLBACK)return {outputVariables:{},renderVariables:{},status:{allowed:l,hiddenByCascade:e.id}};if(p){f=dh(p,t,r);let w=f.split(_n).filter(I=>I!==""),O=[];for(let I=0;I<w.length;I++){let E=w[I];new RegExp("^(?:[a-z+]+:)?//","i").test(f)||(E=`${process.env.NEXT_PUBLIC_REPORTS_BASE_URL}/${E}`.replace(/([^:]\/)\/+/g,"$1")),O.push(Xa(E,o,a,n,e).catch(z=>{throw new fh(` Excecution of ${e.type}-${e.id} in section ${e.section_id} in report ${s.report_name} (${s.report_id}) failed.
47
+ var ug=Object.defineProperty;var b=(e,t)=>()=>(e&&(t=e(e=0)),t);var Na=(e,t)=>{for(var r in t)ug(e,r,{get:t[r],enumerable:!0});};var c=b(()=>{});var pg,Ae,Ct=b(()=>{c();pg=()=>{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}},Ae=pg;});function Da(e,t){return +(e<t)-+(e>t)}function Ke(e,t,r="ordering"){return Da(t[r],e[r])}var io=b(()=>{c();});function Fa(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 vl(e,t,r){let o=0,n=1,a=1,s=1,i=0,l=0,u;for(;Math.abs((a-l)/a)>1e-5;)l=a,u=-(t+i)*(t+r+i)*e/(t+2*i)/(t+2*i+1),o=a+u*o,n=s+u*n,i+=1,u=i*(r-i)*e/(t+2*i-1)/(t+2*i),a=o+u*a,s=n+u*s,o/=s,n/=s,a/=s,s=1;return a/t}function dg(e,t,r){let o,n;if(e<0)n=0;else if(e>=t)n=1;else {e=Math.floor(e);let a=r,s=e+1,i=t-e,l=s+i,u=Math.exp(Fa(l)-Fa(i)-Fa(s)+s*Math.log(a)+i*Math.log(1-a));a<(s+1)/(l+2)?o=u*vl(a,s,i):o=1-u*vl(1-a,i,s),n=1-o;}return Math.round(n*1e5)/1e5}function mg(e){return {.99999:15.137,.99:6.635,.95:3.841,.9:2.706}[e]}function Fo(e,t,r,o){let n=t/(1-t),a=0,s=1,i=0,l=0;for(;a<=e;)l+=s,a>=r&a<=o&&(i+=s),l>1e30&&(i/=1e30,l/=1e30,s/=1e30),a+=1,s=s*n*(e+1-a)/a;return i/l}function fg(e,t,r){let o=e/t,a=(100-r*100)/2,s,i;if(e===0)s=0;else {let l=o/2,u=0,p=o,m=a/100;for(;p-u>1e-5;)Fo(t,l,e,e)*.5+Fo(t,l,e+1,t)>m?(p=l,l=(u+l)/2):(u=l,l=(p+l)/2);s=l;}if(e===t)i=0;else {let l=(1+o)/2,u=o,p=1,m=a/100;for(;p-u>1e-5;)Fo(t,l,e,e)*.5+Fo(t,l,0,e-1)<m?(p=l,l=(u+l)/2):(u=l,l=(p+l)/2);i=l;}return {lci:s,uci:i}}function gg(e,t){let r=e,o=t,n=r,a=o,s=95,i=.5,l=.5,p=(100-s)/2/100,m=n;for(;l>1e-5;)l/=2,kn((1+m)*i/(1-i),m+1,1e10)+.5*kn((1+m)*i/(1-i),m,m)>p?i-=l:i+=l;let d=(1+m)*i/(1-i)/a;for(i=.5,l=.5,p=(100-s)/2/100;l>1e-5;)l/=2,kn((1+m)*i/(1-i),0,m-1)+.5*kn((1+m)*i/(1-i),m,m)<p?i-=l:i+=l;let g=(1+m)*i/(1-i)/a;return {lci:d,uci:g}}function kn(e,t,r){let o=1,n=0,a=0,s=0;for(;s<e||o>n*1e-10;)n+=o,s>=t&s<=r&&(a+=o),n>1e30&&(a/=1e30,n/=1e30,o/=1e30),s+=1,o=o*e/s;return a/n}var Sl,Tl=b(()=>{c();Sl={binomialCdf:dg,binP:Fo,computeMidP:fg,criticalValue:mg,smr:gg};});function W(e){let t=e.logicFactory(sr);return wg[e.name]={description:e.description,inputType:e.inputType,logic:Ag(t),testValue:e.testValue,type:e.type||"formatter"},t}function Ag(e){let t=e.toString().trim();if(t.startsWith("function"))return t.replace(/^function(?:\s\w+)?\([^)]\)/,"").trim().replace(/^{([\s\S]+)\}$/,"$1");let r=t.replace(/^.+?=>/,"").trim();return r.startsWith("{")?r.replace(/^{([\s\S]+)\}$/,"$1"):`return ${r}`}var sr,wg,ae=b(()=>{c();Tl();sr={d3:{...hg,...yg,...bg,...vg},d3plus:{assign:assign,closest:closest,date:date,formatAbbreviate:formatAbbreviate,merge:merge,strip:strip,titleCase:titleCase},stats:Sl},wg={};});var xl,Rl=b(()=>{c();xl={jwt:Pg};});var wn,El,An=b(()=>{c();ae();Rl();wn=(e,t={},r="en",o={},n={})=>{let a={setVariables:o.onSetVariables?o.onSetVariables:l=>l,openModal:o.onOpenModal?o.onOpenModal:l=>l,formatters:t,libs:sr,locale:r,...n};function s(l){return Function("globals",...l.vars,`with (globals) { ${l.logic} }`).bind(a,a)}function i(l){if(l.vars&&l.logic)return s(l);for(let u in l)Array.isArray(l[u])?l[u]=l[u].map(p=>isObject(p)?i(p):p):isObject(l[u])&&(l[u]=i(l[u]));return l}return i(e)},El=(e,t={})=>{let r={libs:xl,...t};function o(a){return Function("globals",...a.vars,`with (globals) { ${a.logic} }`).bind(r,r)}function n(a){if(a.vars&&a.logic)return o(a);for(let s in a)Array.isArray(a[s])?a[s]=a[s].map(i=>isObject(i)?n(i):i):isObject(a[s])&&(a[s]=n(a[s]));return a}return n(e)};});function Pn(e,t){let r=Mg[e];if(!r)throw new Error(`Invalid entity type: ${e}`);let{entities:o}=normalize(t,[r]);return {report:Pr(o,"report"),dimension:Pr(o,"dimension"),section:Pr(o,"section"),block:Pr(o,"block"),variant:Pr(o,"variant"),formatter:Pr(o,"formatter"),datasource:Pr(o,"datasource")}}function Pr(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:{}}var Lg,Vo,kl,Cl,wl,Og,_g,Bg,Mg,Al,wt,ir=b(()=>{c();io();An();Ct();(({localeDefault:Lg}=Ae())),Vo=new schema.Entity("block",{},{mergeStrategy(e,t){return t.block_input?e||{}:{...e,...t}}});Vo.define({consumers:[Vo],inputs:[Vo]});kl=new schema.Entity("variant"),Cl=new schema.Entity("dimension",{variants:[kl]},{processStrategy(e){return {...e,variants:"variants"in e?e.variants:[]}}}),wl=new schema.Entity("section",{blocks:[Vo]}),Og=new schema.Entity("report",{dimensions:[Cl],sections:[wl]},{processStrategy(e){return {...e,sections:"sections"in e?e.sections.sort(Ke):[]}}}),_g=new schema.Entity("formatter"),Bg=new schema.Entity("datasource"),Mg={report:Og,section:wl,block:Vo,dimension:Cl,variant:kl,formatter:_g,datasource:Bg};Al=(e,t=void 0)=>{let{sid:r,bid:o,previews:n=[],query:a={}}=t||{},s,i,l={};return r?(s=r,l.activeSection=s):s=e.activeSection,n.length>0?(i=n,l.previews=i.filter(Boolean)):i=e.previews,{parsedParams:{sid:s,bid:o,previews:i,query:a},statusPayload:l}},wt=(e=[],t=Lg)=>e.reduce((r,o)=>{let n=wn({vars:["n"],logic:o.content.logic},{},t,{});return r[o.name]=n,r},{});});function gt(e,t){return e.request(t).then(r=>{let{status:o,data:n}=r;return "error"in n?{ok:!1,status:o,error:n.error}:{ok:!0,status:o,wrapper:n.wrapper,data:n.data}},r=>{if("isAxiosError"in r){let{status:o,data:n}=r.response||{status:500};return {ok:!1,status:o,error:n?.error??r.message}}return {ok:!1,status:500,error:r.message}})}function Se(e,t,r){let o=typeof t=="string"?{url:t}:t;return n=>gt(e,{...o,method:"GET",params:r?r(n):n})}function Te(e,t,r){let o=typeof t=="string"?{url:t}:t;return n=>gt(e,{...o,method:"POST",data:r?r(n):n})}function lr(e,t,r){let o=typeof t=="string"?{url:t}:t;return n=>gt(e,{...o,method:"DELETE",params:r?r(n):n})}var lo=b(()=>{c();});function co(e,t){return r=>gt(e,{method:"POST",url:`images/save/${t}`,params:{prompt:r.prompt,provider:t}})}var Pl=b(()=>{c();lo();});function $o(e,t){return r=>gt(e,{method:"GET",url:`images/search/${t}`,params:{prompt:r.prompt,page:r.page,provider:t}})}var Il=b(()=>{c();lo();});function Ll(e,t){return ()=>gt(e,{method:"GET",url:`list/icons/${t}`,params:{provider:t}})}var Ol=b(()=>{c();lo();});function _l(e,t){return r=>gt(e,{method:"GET",url:`read/icons/${t}/icon.svg`,params:{name:r.name}})}var Bl=b(()=>{c();lo();});function zo(e){let t=Nn.create({baseURL:e});return {createBulkBlock:Te(t,"create/bulk/block"),createBlock:Te(t,"create/block"),createDimension:Te(t,"create/dimension"),createFormatter:Te(t,"create/formatter"),createReport:Te(t,"create/report"),createSection:Te(t,"create/section"),createVariant:Te(t,"create/variant"),createDatasource:Te(t,"create/datasource"),deleteBlock:lr(t,"delete/block",Lr),deleteDimension:lr(t,"delete/dimension",Lr),deleteFormatter:lr(t,"delete/formatter",Lr),deleteReport:lr(t,"delete/report",Lr),deleteSection:lr(t,"delete/section",Lr),deleteVariant:lr(t,"delete/variant",Lr),deleteDatasource:lr(t,"delete/datasource",Lr),readBlock:Se(t,"read/block"),readDimension:Se(t,"read/dimension"),readFormatter:Se(t,"read/formatter"),readReport:Se(t,"read/report"),readSection:Se(t,"read/section"),readVariant:Se(t,"read/variant"),readDatasource:Se(t,"read/datasource"),updateBulkBlock:Te(t,"update/bulk/block"),updateBlock:Te(t,"update/block"),updateDimension:Te(t,"update/dimension"),updateFormatter:Te(t,"update/formatter"),updateReport:Te(t,"update/report"),updateSection:Te(t,"update/section"),updateVariant:Te(t,"update/variant"),updateDatasource:Te(t,"update/datasource"),searchReport:Se(t,"search/reports"),validateVariantSlug:Se(t,"validate/variant"),readMember:Se(t,"read/members",Dg),readMemberImage:Se(t,{url:"member/image",responseType:"blob"}),searchMember:Se(t,"search/members"),updateMember:Se(t,"update/members"),imageLocalSearch:$o(t,"local"),imageLocalSave:co(t,"local"),imageFlickrSearch:$o(t,"flickr"),imageFlickrSave:co(t,"flickr"),imageUnsplashSearch:$o(t,"unsplash"),imageUnsplashSave:co(t,"unsplash"),imageUploadSave:co(t,"upload"),imageAdobeSearch:$o(t,"adobe"),imageAdobeSave:co(t,"adobe"),readMetadata:Se(t,"read/metadata"),regenerateSearch:Te(t,"search/regenerate"),urlProxy:Se(t,"url/proxy"),searchRole:Se(t,"auth/search/roles"),searchUser:Se(t,"auth/search/users"),readUser:Se(t,"auth/read/user"),updateUser:Te(t,"auth/update/user"),updateMyData:Te(t,"auth/update/me"),revalidateReport:Se(t,"revalidate/report"),revalidateUrl:Se(t,"revalidate/url"),readPrivateBlocks:Te(t,"read/blocks/private"),listTablerIcons:Ll(t,"tabler"),readTablerIcon:_l(t,"tabler"),readEnvSecrets:Se(t,"read/secrets")}}var Lr,Dg,Ml=b(()=>{c();Pl();Il();lo();Ol();Bl();Lr=e=>({id:e}),Dg=e=>{if(e.mode==="slugs"){let t=e.slugs.map(r=>[r.variantSlug,r.memberSlug].join("/")).join(",");return {...e,slugs:t}}return ["related","whole"].includes(e.mode)?{...e}:{...e,[e.mode]:e[e.mode].join(",")}};});var Va=b(()=>{c();Ml();});var Nl=b(()=>{c();});var Dl=b(()=>{c();Nl();});function ct(e){return {variables:e.variables||{},query:e.query||{},locale:e.locale||$g}}var $g,uo=b(()=>{c();Dl();Ct();({localeDefault:$g}=Ae());});var Or,Fl,Ce,Ln,Vl,$a,zg,Ug,Gg,za,Ua,h,fe,xe,$l,In,he=b(()=>{c();Or={REPORT:"report",SECTION:"section",BLOCK:"block",INPUT:"block_input",FORMATTER:"formatter",DATASOURCE:"datasource",DIMENSION:"report_dimension",VARIANT:"report_dimension_variant",SEARCH:"search"},[Or.BLOCK,Or.SEARCH],{[Or.SECTION]:"report_id",[Or.DIMENSION]:"report_id",[Or.VARIANT]:"dimension_id",[Or.BLOCK]:"section_id",[Or.INPUT]:"block_id"},Fl={REPORT:"report",STORY:"story"},Ce={SINGLE:"single",MULTI:"multi"},Ln={SEGMENTED_CONTROL:"segmented control",SELECTOR:"selector"},Vl={TITLE:"title",SUBTITLE:"subtitle",LABEL:"label"},{[Fl.REPORT]:Object.values(Vl),[Fl.STORY]:Object.values(Vl)},$a={ALLOWED:"allowed",ALLOWED_LOGIC:"allowedLogic",IGNORE_CASCADE:"ignoreCascade"},zg={ACCESS:"access",ACCESS_LOGIC:"accessLogic"},Ug={FALLBACK:"fallback"},{...$a},{POSITION:"position",ICON:"icon",...$a},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"},za={GENERATOR:"generator",RELATED:"related",VIZ:"visualization",SECTION_FLAG:"section_flag"},Ua="logic",h={...Gg,...za},[h.GENERATOR,h.SECTION_FLAG,h.SELECTOR,h.VIZ,h.IMAGE,h.TABLE,h.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",TOOLTIP:"tooltip",TWITTER:"twitter",URL:"url",VALUE:"value"},[fe.LOGIC,fe.SIMPLE,fe.SIMPLE_ENABLED],xe={ENABLE_ALL:{bubbleMenu:!0,toolbarOptions:{history:!0,alignment:!1,format:!0}},DISABLE_ALL:{bubbleMenu:!1,toolbarOptions:{history:!1,alignment:!1,format:!1}},ENABLE_FORMAT:{bubbleMenu:!0,toolbarOptions:{history:!0,alignment:!1,format:!0}}},{[h.IMAGE]:[{field:fe.TITLE,editorConfig:xe.ENABLE_ALL},{field:fe.SRC,editorConfig:xe.DISABLE_ALL},{field:fe.ALT,editorConfig:xe.DISABLE_ALL},{field:fe.DESC,editorConfig:xe.ENABLE_ALL}],[h.PARAGRAPH]:[{field:h.PARAGRAPH,editorConfig:xe.ENABLE_ALL},{field:fe.TOOLTIP,editorConfig:xe.ENABLE_FORMAT}],[h.SELECTOR]:[{field:fe.SELECTOR_DEFAULT},{field:fe.SELECTOR_DYNAMIC},{field:fe.SELECTOR_NAME,editorConfig:xe.ENABLE_FORMAT},{field:fe.SELECTOR_TYPE}],[h.STAT]:[{field:fe.TITLE,editorConfig:xe.ENABLE_FORMAT},{field:fe.SUBTITLE,editorConfig:xe.ENABLE_FORMAT},{field:fe.VALUE,editorConfig:xe.ENABLE_FORMAT},{field:fe.TOOLTIP,editorConfig:xe.ENABLE_FORMAT}],[h.SUBTITLE]:[{field:fe.SUBTITLE,editorConfig:xe.ENABLE_FORMAT},{field:fe.TOOLTIP,editorConfig:xe.ENABLE_FORMAT}],[h.TITLE]:[{field:fe.TITLE,editorConfig:xe.ENABLE_FORMAT},{field:fe.SLUG,editorConfig:xe.DISABLE_ALL},{field:fe.TOOLTIP,editorConfig:xe.ENABLE_FORMAT}],[h.BUTTON]:[{field:fe.LABEL,editorConfig:xe.ENABLE_FORMAT},{field:fe.URL,editorConfig:xe.ENABLE_FORMAT}],[h.GENERATOR]:[],[h.SECTION_FLAG]:[],[h.VIZ]:[],[h.TABLE]:[],[h.MULTIHIERARCHY_SELECTOR]:[{field:fe.MULTIHIERARCHY_SELECTOR_NAME,editorConfig:xe.ENABLE_FORMAT},{field:fe.MULTIHIERARCHY_SELECTOR_PLACEHOLDER,editorConfig:xe.DISABLE_ALL},{field:fe.MULTIHIERARCHY_SELECTOR_ALL_LABEL,editorConfig:xe.DISABLE_ALL}]},{NAME:"name",DESCRIPTION:"description",...$a,...zg,...Ug},$l={FORMATTER:"formatter",FUNCTION:"function"},{[$l.FORMATTER]:"Formatter",[$l.FUNCTION]:"Function"},In={STRING:"string",NUMBER:"number",OBJECT:"object",DATE:"date"},{[In.STRING]:"String",[In.NUMBER]:"Number",[In.OBJECT]:"Object/Array",[In.DATE]:"Date"};});function Kg(e,t,r,o,n=void 0,a){let s={},i=[],{locale:l}=ct(a);try{if(t){let u=new Proxy(console,{get(m,d){return Yg(d,"log","debug","info","warn","error")?(...f)=>{i.push(`${d} ${Date.now()} - ${f.map(g=>format(g)).join(" ")}`),Wg&&m[d](...f);}:m[d]}}),p;return n?p=new Function(e,"console","libs","formatters","locale","variables",r)(t,u,sr,o,l,n):p=new Function(e,"console","libs","formatters","locale",r)(t,u,sr,o,l),typeof p=="object"&&Object.keys(p).length>0&&Object.assign(s,p),{vars:s,error:null,log:i,output:p}}return {vars:s,error:"Invalid API Link",log:i}}catch(u){return {vars:s,error:u.message,log:i}}}function Yg(e,...t){return t.includes(e)}var Wg,At,Uo=b(()=>{c();uo();ae();Wg=Hg(process.env.REPORTS_LOGGING),At=Kg;});function Ga(e){return e.reduce((t,r,o)=>(o?o===e.length-1&&o===1?t+=` and ${r}`:o===e.length-1?t+=`, and ${r}`:t+=`, ${r}`:t+=r,t),"")}var zl=b(()=>{c();});function Xg(e,t,r,o=!1){let{variables:n}=ct(r);if(!e)return e;let a=/([A-z0-9]*)\{\{([^\}]+)\}\}/g;return e.replace(a,(i,l,u)=>{let p=d=>d;if(l){let d=l.replace(/^\w/g,f=>f.toLowerCase());d in t?p=t[d]:p=f=>`${l}${f}`;}let m=Array.isArray(n[u])?Ga(n[u]):n[u];if(m===void 0)return o?i:"N/A";try{return p(m,sr,t)}catch(d){return console.error(`Error using formatter ${p.name}
48
+ `,`Error message: ${d.message}`),"N/A"}})}var tt,po=b(()=>{c();uo();zl();ae();tt=Xg;});var qa,ut,_r=b(()=>{c();po();qa=(e,t,r)=>{let{variables:o}=r,n=s=>s.allowed==="never"?!1:!s.allowed||s.allowed==="always"||o[s.allowed],a={...e};return Object.keys(a).forEach(s=>{typeof a[s]=="string"?a[s]=tt(a[s],t,r):Array.isArray(a[s])?a[s]=a[s].filter(n).map(i=>typeof i=="object"?qa(i,t,r):typeof i=="string"?tt(i,t,r):i):typeof a[s]=="object"&&a[s]!==null&&!(a[s]instanceof Date)&&(a[s]=qa(a[s],t,r));}),a},ut=qa;});var Ul,Gl=b(()=>{c();Ul=e=>Array.isArray(e)?e.map(t=>typeof t=="string"?{allowed:"always",label:t,id:t}:{allowed:"always",label:t.id,...t}):[];});var Qg,Br,On=b(()=>{c();he();Qg=(e,t,r)=>{if(!r)return !1;if(e===Ce.SINGLE)return r.find(n=>n.id===t);let o=Array.isArray(t)?t:t.split(",");return Array.isArray(o)&&o.every(n=>r.map(a=>a.id).includes(n))},Br=Qg;});function mo(e,t,r,o,n=!1){let{variables:a}=ct(o),s=ut({logic:t},r,o).logic,i=At("variables",a,s,r,void 0,o),{vars:l,log:u,error:p}=i,m=l.type||Ce.SINGLE,d=l.component||"Selector",f=l.hideLabel||"false",g=l.resetSectionVars||"false",y=l.name||"Unlabeled Selector",T=Ul(l.options||[]),C=U=>m===Ce.MULTI&&!Array.isArray(U)?[U]:U,N=l.defaultValue,R;if(N&&(N=C(N),Br(m,N,T)&&(R=N)),!R){let U=T&&T[0]&&T[0].id||T[0]||"";R=C(U);}if(n&&typeof window<"u"){let U=`selector${e}id`,K=new URLSearchParams(window.location.search),O=Object.fromEntries(K)[U];O&&!Br(m,O,T)&&O!==void 0&&(K.delete(U),window.history.replaceState(null,null,`?${K.toString()}`));}return {config:{name:y,type:m,options:T,defaultValue:R,component:d,hideLabel:f,resetSectionVars:g},log:u,error:p}}var Ha=b(()=>{c();uo();he();Uo();_r();Gl();On();});function ja(e,t,r){if(!e)return !1;let o=Array.isArray(r)?r:r.split(",");return Array.isArray(o)&&o.every(n=>e.map(a=>`${a[`${t} ID`]}`).includes(n))}var ql=b(()=>{c();});function fo(e,t,r,o,n=!1){let{variables:a}=ct(o),s=ut({logic:t},r,o).logic,i=At("variables",a,s,r,void 0,o),{vars:l,log:u,error:p}=i;if(n&&typeof window<"u"){let d=`multihierarchySelector${e}-value`,f=`multihierarchySelector${e}-type`,g=new URLSearchParams(window.location.search),y=Object.fromEntries(g),T=y[d],C=y[f];T&&T!==void 0&&C&&C!==void 0&&!ja(l.data,C,T)&&(g.delete(d),g.delete(f),window.history.replaceState(null,null,`?${g.toString()}`));}return {config:l,log:u,error:p}}var Wa=b(()=>{c();ql();uo();Uo();_r();});var Zg,Hl,jl=b(()=>{c();he();Zg=(e,t,r)=>{let o=`selector${e}id`,n=new URLSearchParams(typeof location<"u"&&location?.search?location.search:"").get(o),a=new URLSearchParams(t).get(o),s=n||a;if(r.type===Ce.MULTI){let u=s?s.split(","):r.defaultValue,p=r.options.filter(m=>u.includes(m.id));return {[`selector${e}id`]:u,[`selector${e}label`]:(p||[]).map(m=>m.label)}}let i=s&&r.options.find(u=>u.id===s)?s:r.defaultValue,l=r.options.find(u=>u.id===i);return {[`selector${e}id`]:i,[`selector${e}label`]:l&&l.label||void 0}},Hl=Zg;});var Jg,Wl,Kl=b(()=>{c();Jg=(e,t,r)=>{let o=`multihierarchySelector${e}-value`,n=`multihierarchySelector${e}-type`,a=new URLSearchParams(typeof location<"u"&&location?.search?location.search:"").get(o),s=new URLSearchParams(typeof location<"u"&&location?.search?location.search:"").get(n),i=new URLSearchParams(t).get(o),l=new URLSearchParams(t).get(n),u=a||i,p=s||l,m=u?u.split(","):r.defaultValue||[],d=p||r.defaultValueType||"",f=r.data?.filter(g=>m.includes(`${g[`${d} ID`]}`))||[];return {[`multihierarchySelector${e}id`]:m,[`multihierarchySelector${e}label`]:[...new Set((f||[]).map(g=>g[d]))],[`multihierarchySelector${e}type`]:d}},Wl=Jg;});var Yl,eh,th,rh,Be,Mr=b(()=>{c();he();Ct();(({localeDefault:Yl,locales:eh}=Ae())),th=Object.values(za),rh=(e,t=Yl)=>e&&th.includes(e.type)?{locale:Ua,locales:[Ua]}:{locale:t,locales:eh},Be=(e,t=Yl)=>{if(!e)return {};let{locale:r}=rh(e,t);return e.contentByLocale?.[r]?.content};});function oh(e,t){let r=Object.values(t),o=r.filter(n=>n.shared&&n.section_id!==e).map(n=>n.id);return Object.fromEntries(r.filter(n=>n.section_id===e&&(n.inputs.length===0||n.inputs.some(a=>o.includes(a)))).map(n=>[n.id,n]))}var Xl,Ql=b(()=>{c();Xl=oh;});var Zl,Jl=b(()=>{c();Zl=(e,t)=>t&&typeof t=="string"?t.split(".").reduce((r,o)=>r[o],e):e;});var _n,ec,Ka=b(()=>{c();_n="|||",ec="SECTION_ALLOWED";});function Ya(e){return e.type===h.SECTION_FLAG&&e.inputs.length===0&&e.consumers.length===0}var tc=b(()=>{c();he();});function ah(){let{publicRuntimeConfig:e}=nh(),t=e.bespoke_report_env_vars||{};return {...Object.keys(t).reduce((r,o)=>(r[`ENV_${o}`]=t[o]||"N/A",r),{})}}var cr,Go=b(()=>{c();cr=ah;});function sh(){return typeof process>"u"?{}:Object.entries(process.env).filter(([e])=>e.startsWith("BESPOKE_SECRET_")).reduce((e,[t,r])=>({...e,[t.replace("BESPOKE_SECRET_","ENV_SECRET_")]:r}),{})}var rc,oc=b(()=>{c();rc=sh;});function Mn(e){return e.ok!==void 0}function Bn(e){this.message=e,this.name="ApiFetchException";}async function Xa(e,t,r="en",o,n){let a=Date.now(),s=e,i,l=cr(),u=rc(),p={envs:{...l,...u}},d=new URL(e).searchParams;if(d.has("bespoke_slugs")){let N=new RegExp(`[?&]bespoke_slugs=${d.get("bespoke_slugs")}`,"g");s=s.replace(N,"");}let f={datasource:void 0};o.find(N=>{if(!N.content?.pattern)return !1;try{let R=new RegExp(N.content.pattern,"gm");return R.test(s)?(f.datasource=N,!0):R.test(s)}catch{return !1}});let g=n?n.settings:{},y=!!(g&&g.useProxy&&g.useProxy==="true"),T=f.datasource&&typeof f.datasource.content.useProxy=="boolean"?f.datasource.content.useProxy:!1,C=`${process.env.NEXT_PUBLIC_REPORTS_BASE_URL}/api/cms/url/proxy?url=${encodeURIComponent(s)}`;if(typeof window=="object"&&(y||T)){let N=await mh({url:s,timeout:ac});if(N.ok===!0)i=N.data;else throw new Bn(N?.error)}else try{let R={url:s,timeout:ac};if(f.datasource){let K=await El({vars:["url","libs"],logic:f.datasource.content.logic},p)(s);if(K.axiosConfig)R=K.axiosConfig;else throw new Bn(`AxiosConfig is missing in Data Source ${f.datasource.name} (ID: ${f.datasource.id}).`)}let M=await Nn(R);if(M.status===200)M.headers["content-type"]==="text/csv"?i=csvParse(M.data):i=M.data;else throw new Bn("No response for: "+s)}catch(N){throw new Bn(N.message)}if(d.has("bespoke_slugs")){let N=d.get("bespoke_slugs");if(N){let R=N.split(",");if(R.length===3){let[M,U,K]=R,A=Zl(i,K);if(A&&Array.isArray(A)){let O=Array.from(new Set(A.map(k=>`${k[U]}`).filter(k=>!["","undefined"].includes(k))));if(O.length>0){let k=O.join("").length>2e3,I=await t({mode:k?"whole":"ids",ids:k?void 0:O,all:!1,locale:r,variant:[parseInt(M,10)],output:"lite",limit:O.length+1,allowNulls:!0}).then(E=>{let w=[];return Mn(E)?E.ok&&(w=E.data.results):w=E.results,w&&Array.isArray(w)?w:[]}).catch(E=>(console.error(`Error hydrating slugs for Variant: ${M}, Key: ${U}, Accessor: ${K}`),console.error(` Url ${e}`),n&&console.error(` From Section ${n.section_id} and Block ${n.id}`),console.error(E),[]));if(I){let E=Object.fromEntries(I.map(w=>[w.id,`/${w.variant_slug}/${w.slug}`]));A.map(w=>(w.bespoke_slug=E[w[U]]?E[w[U]]:null,w));}}}}}}return {data:i,requestDuration:Date.now()-a,finalUrl:T||y?C:s,apiDataSource:f.datasource?f.datasource:!1}}function fh(e){this.name="BlockException",this.message=e;}async function sc(e,t,r,o,n){let{locale:a,variables:s,query:i}=ct(r),l=gh(e,r,s,t),u=null,p=e.contentByLocale?.logic?.content?.api,m=null,d=null,f=null,g=null,y=null;if(!l)return {outputVariables:{},renderVariables:{},status:{allowed:!1,hiddenByCascade:e.id}};if(e.type===h.FALLBACK)return {outputVariables:{},renderVariables:{},status:{allowed:l,hiddenByCascade:e.id}};if(p){f=dh(p,t,r);let A=f.split(_n).filter(I=>I!==""),O=[];for(let I=0;I<A.length;I++){let E=A[I];new RegExp("^(?:[a-z+]+:)?//","i").test(f)||(E=`${process.env.NEXT_PUBLIC_REPORTS_BASE_URL}/${E}`.replace(/([^:]\/)\/+/g,"$1")),O.push(Xa(E,o,a,n,e).catch(z=>{throw new fh(` Excecution of ${e.type}-${e.id} in section ${e.section_id} in report ${s.report_name} (${s.report_id}) failed.
49
49
  Error fetching ${E}.
50
50
  Message: ${z.message}.
51
- `)}));}let k=await Promise.all(O).catch(I=>I.message);if(typeof k=="string"&&k)return {outputVariables:{},renderVariables:{},status:{error:k}};u=k.length===1?k[0].data:k.map(I=>I.data),d=k.reduce((I,E)=>I+JSON.stringify(E.data).length/1024,0),m=Math.max(...k.map(I=>I.requestDuration)),g=k.map(I=>I.apiDataSource?`${I.apiDataSource.name} (${I.apiDataSource.id})`:!1),y=k.map(I=>I.finalUrl);}if(e.type===h.SELECTOR){let{config:w,log:O,error:k}=mo(e.id,e.contentByLocale[a].content.logic,t,r,!0);return {outputVariables:Hl(e.id,i,w),renderVariables:w,status:{log:O,error:k,allowed:l}}}if(e.type===h.MULTIHIERARCHY_SELECTOR){let{config:w,log:O,error:k}=fo(e.id,e.contentByLocale[a].content.logic,t,r,!0);return {outputVariables:Wl(e.id,i,w),renderVariables:w,status:{log:O,error:k,allowed:l}}}if(e.type===h.VIZ)return {outputVariables:{},renderVariables:e.contentByLocale.logic.content,status:{log:[],allowed:l}};if(e.type===h.RELATED){let w=e.contentByLocale?.logic?.content?.simple?.compare||"variant",O=e.contentByLocale?.logic?.content?.simple?.limit||4,k=Object.keys(s).filter(L=>L.startsWith("report_id")).map(L=>s[L]),I=Object.keys(s).filter(L=>L.startsWith("dimension_id")).map(L=>s[L]),E=Object.keys(s).filter(L=>L.startsWith("variant_id")).map(L=>s[L]),A=Object.keys(s).filter(L=>L.startsWith("id")).map(L=>s[L]);if(!A.length)return {outputVariables:{related_reports:[]},renderVariables:{},status:{log:[],allowed:!1}};let z=await Promise.all(A.map((L,H)=>o({mode:"ids",locale:a,ids:[L],output:"lite",variant:[E[H]]}))).then(L=>L.flatMap(H=>{let $=[];return Mn(H)?H.ok&&($=H.data.results):$=H.results,$&&Array.isArray($)?$:[]})).catch(L=>(console.error("Error getting related members",L),[]));if(I.length>1){let L=Object.keys(s).filter(q=>q.startsWith("variant_slug")).map(q=>s[q]),H=z.map((q,x)=>{let P={mode:"related",locale:a,related:O??4,current_ids:[q.content_id],output:"full",variant_ids:[q.variant_id]};return x===0&&(P.include_ids=[q.content_id]),P}),$=await Promise.all(H.map(q=>o(q))).then(q=>q.flatMap(x=>{let P=[];return Mn(x)?x.ok&&(P=x.data.results):P=x.results,P&&Array.isArray(P)?P:[]})).catch(q=>(console.error("Error getting related members",q),[])),ie=$.reduce((q,x)=>{let P=x.variant_slug;return q[P]||(q[P]=[]),q[P].push(x),q},{}),Y=[],re=Object.keys(ie),Z=[{combination:[],index:0}];for(;Z.length>0;){let q=Z.pop();if(!q)continue;let{combination:x,index:P}=q;if(P===re.length){Y.push(x);continue}let G=re[P],J=ie[G];for(let X of J)Z.push({combination:[...x,X],index:P+1});}return {outputVariables:{related_reports:Y.map(q=>{let x=q.sort((P,G)=>L.indexOf(P.variant_slug)-L.indexOf(G.variant_slug));return {entities:x,link:"/"+x.map(P=>`${P.variant_slug}/${P.slug}`).join("/")}})},renderVariables:{},status:{log:[],allowed:$.length>0}}}let B=z.map(L=>L.content_id),D={mode:"related",locale:a,related:O??4,current_ids:B,output:"full"};w&&(w==="report"?D.report_ids=k:w==="dimension"?D.dimension_ids=I:D.variant_ids=E);let j=await o(D).then(L=>{let H=[];return Mn(L)?L.ok&&(H=L.data.results):H=L.results,H&&Array.isArray(H)?H:[]}).catch(L=>(console.error("Error getting related members",L),[]));return {outputVariables:{related_reports:j.map(L=>({entities:[L],link:`/${L.variant_slug}/${L.slug}`}))},renderVariables:{},status:{log:[],allowed:j.length>0}}}let{logic:T}=Be(e,a),C=tt(T,t,r),N=wt("resp",u||{},C,t,s,r),{vars:R,error:M,log:U}=N;if(typeof R!="object")return {outputVariables:{},renderVariables:{},status:{error:"Configuration did not return an object",log:U,duration:m,responseSize:d,resp:u,api:f,allowed:l,apiFinalUrls:y,apiDataSources:g}};let K=Object.keys(R).reduce((w,O)=>({...w,[`${e.type}${e.id}${O}`]:R[O]}),{});return {renderVariables:R,outputVariables:[h.GENERATOR,h.SECTION_FLAG].includes(e.type)?R:K,status:{log:U,error:M,duration:m,responseSize:d,resp:u,api:f,allowed:l,apiFinalUrls:y,apiDataSources:g}}}function Dn(e,t,r,o,n,a,s){return e.consumers.forEach(i=>{if(t[i]){let l=`${r}-${i}`;!o.includes(l)&&(t[i].section_id===t[r].section_id||!n)&&o.push(l),e.consumers.filter(u=>t[u]&&t[u].section_id===t[r].section_id||!n).forEach(u=>Qa(u,t,o,!1,a,n,s));}})}var ur,uh,ph,ic,dh,mh,ac,Qa,gh,Pt,Nr=b(()=>{c();Va();uo();he();Ha();Wa();jl();Kl();Uo();po();Mr();Ql();Jl();Ka();tc();wn();Go();oc();ur=Hg(process.env.NEXT_PUBLIC_REPORTS_DEBUG),uh=process.env.REPORTS_ORIGIN||"",ph=process.env.NEXT_PUBLIC_REPORTS_AXIOS_RETRIES,ic=5;try{ic=parseInt(`${ph||5}`,10);}catch(e){console.error("Error setting axios retries NEXT_PUBLIC_REPORTS_AXIOS_RETRIES defaults to 5",e);}nc(Nn,{retries:ic,retryDelay:nc.exponentialDelay,onRetry:(e,t,r)=>{console.error("Generator request failed. Retrying... Count: ",e),console.error("URL: ",r.url),console.error(t.message);}});Nn.interceptors.request.use(e=>({...e,requestStart:Date.now()}));Nn.interceptors.response.use(e=>({...e,requestDuration:new Date().getTime()-e.config.requestStart}),e=>Promise.reject(e));dh=(e,t,r)=>{let o=tt(e,t,r);return o.startsWith("http")||(o=`${uh}${o.startsWith("/")?"":"/"}${o}`),o},{urlProxy:mh}=zo("/api/cms");ac=process.env.NEXT_PUBLIC_REPORTS_API_FETCH_TIMEOUT||0;Qa=(e,t,r=[],o=!0,n=!0,a=!0,s=[])=>{if(s.includes(e))return [];s.push(e);let i=t[e];return i&&i.inputs.length&&o&&i.inputs.forEach(l=>{let u=`${l}-${e}`;r.includes(u)||r.push(u),i.inputs.forEach(p=>Qa(p,t,r,o,!1,a,s));}),i&&i.consumers.length&&n&&Dn(i,t,e,r,a,n,s),r},gh=(e,t,r,o)=>{let n=!0;if(e&&"allowed"in e.settings&&e.settings.allowed!=="always")if(e.settings.allowed==="never")n=!1;else {let a=ct(t),{error:s,output:i}=wt("variables",r,e.settings.allowedLogic||"return false;",o,void 0,a);s||(n=!!i);}return n},Pt=async(e,t,r,o,n,a={},s,i="section",l)=>{let u=i==="section",p=ct(n),m=p.variables,d={...a.variables??{}},f={...a.status??{}},g=new Set,y=[],T={};r?T={...T,[r]:e[r]}:t?T=(t??[]).reduce((B,{id:D})=>({...B,...Xl(D,e)}),{}):T=Object.values(e).filter(B=>Ya(B)).reduce((B,D)=>({...B,[D.id]:D}),{});let C=Object.values(T).filter(B=>Ya(B));if(C.length>0){ur&&console.info("%crunConsumers: calculating section flags","color:purple",C.map(V=>V.id).join(", "));let B=Object.fromEntries(await Promise.all(C.map(async V=>[V.id,await sc(V,o,{...p,variables:m,locale:m.locale},s,l).then(L=>{let{outputVariables:H,status:$}=L;if($.error){if(typeof window>"u")throw new Error(`Run consumers (Block: ${V.id}, Section ${V.section_id}) failed with message: ${$.error}. `);f[V.id]={allowed:!1,error:$.error},d[V.id]={};}return (V.consumers.length>0||[h.GENERATOR,h.SECTION_FLAG,h.RELATED].includes(V.type))&&$.allowed&&Object.keys(H).length>0?d[V.id]=H:d[V.id]={},i==="report"?(f[V.id]={allowed:$.allowed},[h.GENERATOR,h.SECTION_FLAG].includes(V.type)&&$.api&&(f[V.id].api=$.api)):f[V.id]=$,L})]))),j=Object.entries(B).filter(([,V])=>!V.outputVariables[ec]).map(([V])=>Number(V));g=new Set(j.map(V=>e[V].section_id)),Object.values(T).filter(V=>g.has(V.section_id)).forEach(V=>{y.push(V.id),delete T[V.id];}),ur&&console.info("%crunConsumers: removing sections","color:purple",g.keys());}let N=g.size>0?Object.fromEntries(Object.entries(e).filter(([,B])=>g?.has(B.section_id)?(y.includes(B.id)||y.push(B.id),!1):!0)):e;if(y.length>0&&(N=Object.fromEntries(Object.entries(N).map(([B,D])=>{let j={...D,inputs:D.inputs.filter(V=>!y.includes(V)),consumers:D.consumers.filter(V=>!y.includes(V))};return [B,j]}))),!r&&!t)return {variables:{...a.variables??{},...d},status:{...a.status??{},...f}};i==="report"&&y.length>0&&y.forEach(B=>{delete d[B],delete f[B],delete e[B];}),ur&&console.info("%crunConsumers: running root blocks","color:purple",Object.keys(T));let R=Object.keys(T).reduce((B,D)=>{let j=new Date,V=Qa(Number(D),N,[],!r,!0,u).map($=>$.split("-")),H=(new Date().getTime()-j.getTime())/1e3;return ur&&console.info(`%cResolved dependencies for ${D} (${H.toFixed(2)}s)`,"color:blue"),[...B,...V]},[]),M=new Date,U=Object.keys(T).reduce((B,D)=>B.includes(D)?[...B]:[D,...B],ih(R)),w=(new Date().getTime()-M.getTime())/1e3;ur&&console.info(`%cResolved DAG (${w.toFixed(2)}s): `,"color:green",U);let O=process.env.NEXT_PUBLIC_REPORTS_MAX_CONCURRENT_QUERIES_PER_REPORT,k=parseInt(`${O||0}`,10);async function I(B,D){let j=new Map,V=[],L=async()=>V.length;for(let H of B){if(k!==0){let re=await L();for(;re>=k;)ur&&console.info("Too many pending promises, waiting...",re),await new Promise(Z=>setTimeout(Z,500)),re=await L();}let $=D[H],Y=Promise.all($.inputs.filter(re=>B.includes(String(re))).map(re=>j.get(Number(re)))).then(async()=>{let re=$.inputs.reduce((G,J)=>({...G,...d[J]}),m),Z=$.inputs.find(G=>($.settings?.ignoreCascade?$.settings?.ignoreCascade:[]).includes(G)||!f[G]?!1:!f[G].allowed||f[G].hiddenByCascade);if(Z){f[H]={allowed:!1,hiddenByCascade:f[Z].hiddenByCascade||Z},d[H]={};return}let te=new Date,q=await sc($,o,{...p,variables:re,locale:re.locale},s,l).then(({outputVariables:G,status:J})=>{if(J.error){if(typeof window>"u")throw new Error(`Run consumers (Block: ${H}, Section ${$.section_id}) failed with message: ${J.error}.`);f[H]={allowed:!1,error:J.error},d[H]={};}($.consumers.length>0||[h.GENERATOR,h.SECTION_FLAG,h.RELATED].includes($.type))&&J.allowed&&Object.keys(G).length>0?d[H]=G:d[H]={},i==="report"?(f[H]={allowed:J.allowed},[h.GENERATOR,h.SECTION_FLAG].includes($.type)&&J.api&&(f[H].api=J.api)):f[H]=J;}),P=(new Date().getTime()-te.getTime())/1e3;return ur&&console.info(`%cBlock ${$.id} resolved in ${P.toFixed(3)}s`,P>500?"color:red":"color:green"),V.splice(V.indexOf(Number(H)),1),q});V.push(Number(H)),j.set(Number(H),Y);}await Promise.all(Array.from(j.values()));}let E=new Date;await I(U,N);let z=(new Date().getTime()-E.getTime())/1e3;return ur&&console.info(`%cResolved Variables (${z.toFixed(2)}s), ${U.length} blocks`,"color:green"),{variables:{...a.variables??{},...d},status:{...a.status??{},...f}}};});function hh(e=[]){return e.reduce((t,r,o)=>{if(r){let n=o+1;t[`id${n}`]=r.id,t[`name${n}`]=r.name,t[`slug${n}`]=r.slug,"attributes"in r&&Object.keys(r.attributes).forEach(a=>{t[`attr_${a}${n}`]=r.attributes[a];}),t[`variant_id${n}`]=r.variant_id,t[`variant_name${n}`]=r.variant_name,t[`variant_slug${n}`]=r.variant_slug,t[`dimension_id${n}`]=r.dimension_id,t[`dimension_name${n}`]=r.dimension_name,t.report_id=r.report_id,t.report_name=r.report_name;}return t},{})}var lc,cc=b(()=>{c();lc=hh;});var ht,Fn,Vn=b(()=>{c();ht=process.env.NEXT_PUBLIC_REPORTS_LOCALE_DEFAULT||"en",Fn=process.env.NEXT_PUBLIC_REPORTS_LOCALES?.split(",")||[ht];Fn.includes(ht)||Fn.push(ht);});var vh,$n,go,zn=b(()=>{c();Vn();vh={localeDefault:ht,locales:Fn,currentLocale:ht,preferredLocale:ht,showToolbar:!1,activeSection:null,previews:[],query:{},sectionState:{},activeEntity:{type:null,id:null},sidebarStatus:{tools:!0,settings:!1,reportEditor:!1},isCMS:!1,isRunConsumersRunning:[]},$n=createSlice({name:"status",initialState:vh,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]:!0};},closeSidebar(e,t){e.sidebarStatus={...e.sidebarStatus,[t.payload]:!1};},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(r=>!t.payload.includes(r));}},extraReducers:{[HYDRATE]:(e,t)=>({...e,previews:t.payload.status.previews})}}),go=$n.actions;});var xh,Un,pr,ho=b(()=>{c();xh={attributes:{},variables:{},status:{}},Un=createSlice({name:"variables",initialState:xh,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}})}}),pr=Un.actions;});function qo(e,t){return Object.fromEntries(Object.keys(e).map(r=>[r,{...e[r],...t[r]}]))}function Gn(e,t){return e.map(n=>t[n]).sort(Ke).map(n=>n.id)}function Ch(e,t){let r=e.indexOf(t);r>-1&&e.splice(r,1);}var kh,jt,Ho=b(()=>{c();io();ir();kh={tree:[],reports:null,entities:{block:{},dimension:{},report:{},section:{},variant:{},formatter:{},datasource:{}},requests:{block:{},dimension:{},report:{},section:{},variant:{},formatter:{},datasource:{}}},jt=createSlice({name:"records",initialState:kh,reducers:{set:(e,t)=>{let r=t.payload;return {entities:qo(e.entities,r.entities||{}),requests:qo(e.requests,r.requests||{}),reports:r.reports||e.reports,tree:r.tree||e.tree}},setRequest:(e,t)=>{let r=t.payload;e.requests[r.type][r.key]=r;},setCreateRequest(e,t){let r=t.payload;if(e.requests[r.type][r.key]=r,r.status==="SUCCESS"){let o=Array.isArray(r.data)?r.data:[r.data],n=Pn(r.type,o),a=qo(e.entities,n);if(e.entities=a,r.type==="report"){let s=r.data;e.reports?e.reports.indexOf(s.id)===-1&&(e.reports=[...e.reports,s.id]):e.reports=[s.id];}else if(r.type==="dimension"){let s=r.data;e.entities.report[s.report_id].dimensions.push(s.id),e.entities.report[s.report_id].dimensions=Gn(a.report[s.report_id].dimensions,a.dimension);}else if(r.type==="variant"){let s=r.data;e.entities.dimension[s.dimension_id].variants.push(s.id);}else if(r.type==="section"&&!Array.isArray(r.data)){let s=r.data;e.entities.report[s.report_id].sections.push(s.id),e.entities.report[s.report_id].sections=Gn(a.report[s.report_id].sections,a.section);}else if(r.type==="block")if(Array.isArray(r.data)){let s=r.data,i=s[0],l=s.map(u=>u.id);e.entities.section[i.section_id].blocks.concat(l);}else {let s=r.data;e.entities.section[s.section_id].blocks.push(s.id);}}},setReadRequest(e,t){let r=t.payload;if(r.type!=="report"&&(e.requests[r.type][r.key]=r),r.status==="SUCCESS"){let o=Pn(r.type,r.data),n=qo(e.entities,o);e.entities=n;}},setUpdateRequest(e,t){let r=t.payload;if(e.requests[r.type][r.key]=r,r.status==="SUCCESS"){let o=Array.isArray(r.data)?r.data:[r.data],n=Pn(r.type,o),a,s,i;if(r.type==="block"&&!Array.isArray(r.data)){let u=e.entities.block[r.data.id].inputs,p=n.block[r.data.id].inputs;a=u.length!==p.length,a&&(i=u.length>p.length,s=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 l=qo(e.entities,n);if(e.entities=l,r.type==="dimension"){let u=r.data;e.entities.report[u.report_id].dimensions=Gn(l.report[u.report_id].dimensions,l.dimension);}else if(r.type==="section"&&!Array.isArray(r.data)){let u=r.data;e.entities.report[u.report_id].sections=Gn(l.report[u.report_id].sections,l.section);}else if(r.type==="block"&&!Array.isArray(r.data)){let u=r.data;a&&(i?e.entities.block[s].consumers=e.entities.block[s].consumers.filter(p=>p!==u.id):e.entities.block[s].consumers.push(u.id));}}},setDeleteRequest(e,t){let r=t.payload;if(e.requests[r.type][r.key]=r,r.status==="SUCCESS"){let{id:o,parentId:n,parentType:a}=r.data;if(delete e.entities[r.type][o],a&&n!=null){let s=`${r.type}s`;Ch(e.entities[a][n][s],o);}}},removeBlocks:(e,t)=>{let r=t.payload,o={...e.entities.block};return r.forEach(n=>{delete o[n];}),{...e,entities:{...e.entities,block:o}}},addBlocks:(e,t)=>{let r=t.payload;return {...e,entities:{...e.entities,block:{...e.entities.block,...r}}}},removeDataSourceLogic:e=>{let t={...e.entities.datasource};Object.keys(t).forEach(r=>{e.entities.datasource[r].content.useProxy&&(delete e.entities.datasource[r].content.logic,delete e.entities.datasource[r].content.testUrl,delete e.entities.datasource[r].content.access);});}},extraReducers:{[HYDRATE]:(e,t)=>{let r=t.payload.records,o=r.entities;return {entities:o,reports:Object.values(o.report).map(n=>n.id),requests:{block:{},dimension:{},report:{},section:{},variant:{},formatter:{},datasource:{}},tree:r.tree}}}});});function Dr(e,t,r){if(t==="createBulk"||t==="updateBulk"){let n=`${t}${uc(r)}`;return e[n]}let o=`${t}${uc(r)}`;return e[o]}function uc(e){return e[0].toUpperCase()+e.slice(1)}var pc=b(()=>{c();});function Me(e){for(var t=arguments.length,r=Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];if(process.env.NODE_ENV!=="production"){var n=Bh[e],a=n?typeof n=="function"?n.apply(null,r):n:"unknown error nr: "+e;throw Error("[Immer] "+a)}throw Error("[Immer] minified error nr: "+e+(r.length?" "+r.map(function(s){return "'"+s+"'"}).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function yo(e){return !!e&&!!e[rt]}function Vr(e){var t;return !!e&&(function(r){if(!r||typeof r!="object")return !1;var o=Object.getPrototypeOf(r);if(o===null)return !0;var n=Object.hasOwnProperty.call(o,"constructor")&&o.constructor;return n===Object||typeof n=="function"&&Function.toString.call(n)===Mh}(e)||Array.isArray(e)||!!e[vc]||!!(!((t=e.constructor)===null||t===void 0)&&t[vc])||is(e)||ls(e))}function Wo(e,t,r){r===void 0&&(r=!1),vo(e)===0?(r?Object.keys:ms)(e).forEach(function(o){r&&typeof o=="symbol"||t(o,e[o],e);}):e.forEach(function(o,n){return t(n,o,e)});}function vo(e){var t=e[rt];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:is(e)?2:ls(e)?3:0}function rs(e,t){return vo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Ah(e,t){return vo(e)===2?e.get(t):e[t]}function Sc(e,t,r){var o=vo(e);o===2?e.set(t,r):o===3?e.add(r):e[t]=r;}function wh(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function is(e){return Oh&&e instanceof Map}function ls(e){return _h&&e instanceof Set}function Fr(e){return e.o||e.t}function cs(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Nh(e);delete t[rt];for(var r=ms(t),o=0;o<r.length;o++){var n=r[o],a=t[n];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[n]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[n]});}return Object.create(Object.getPrototypeOf(e),t)}function us(e,t){return t===void 0&&(t=!1),ps(e)||yo(e)||!Vr(e)||(vo(e)>1&&(e.set=e.add=e.clear=e.delete=Ph),Object.freeze(e),t&&Wo(e,function(r,o){return us(o,!0)},!0)),e}function Ph(){Me(2);}function ps(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function It(e){var t=Dh[e];return t||Me(18,e),t}function dc(){return process.env.NODE_ENV==="production"||bo||Me(0),bo}function Za(e,t){t&&(It("Patches"),e.u=[],e.s=[],e.v=t);}function qn(e){os(e),e.p.forEach(Ih),e.p=null;}function os(e){e===bo&&(bo=e.l);}function mc(e){return bo={p:[],l:bo,h:e,m:!0,_:0}}function Ih(e){var t=e[rt];t.i===0||t.i===1?t.j():t.g=!0;}function Ja(e,t){t._=t.p.length;var r=t.p[0],o=e!==void 0&&e!==r;return t.h.O||It("ES5").S(t,e,o),o?(r[rt].P&&(qn(t),Me(4)),Vr(e)&&(e=Hn(t,e),t.l||jn(t,e)),t.u&&It("Patches").M(r[rt].t,e,t.u,t.s)):e=Hn(t,r,[]),qn(t),t.u&&t.v(t.u,t.s),e!==Tc?e:void 0}function Hn(e,t,r){if(ps(t))return t;var o=t[rt];if(!o)return Wo(t,function(i,l){return fc(e,o,t,i,l,r)},!0),t;if(o.A!==e)return t;if(!o.P)return jn(e,o.t,!0),o.t;if(!o.I){o.I=!0,o.A._--;var n=o.i===4||o.i===5?o.o=cs(o.k):o.o,a=n,s=!1;o.i===3&&(a=new Set(n),n.clear(),s=!0),Wo(a,function(i,l){return fc(e,o,n,i,l,r,s)}),jn(e,n,!1),r&&e.u&&It("Patches").N(o,r,e.u,e.s);}return o.o}function fc(e,t,r,o,n,a,s){if(process.env.NODE_ENV!=="production"&&n===r&&Me(5),yo(n)){var i=Hn(e,n,a&&t&&t.i!==3&&!rs(t.R,o)?a.concat(o):void 0);if(Sc(r,o,i),!yo(i))return;e.m=!1;}else s&&r.add(n);if(Vr(n)&&!ps(n)){if(!e.h.D&&e._<1)return;Hn(e,n),t&&t.A.l||jn(e,n);}}function jn(e,t,r){r===void 0&&(r=!1),!e.l&&e.h.D&&e.m&&us(t,r);}function es(e,t){var r=e[rt];return (r?Fr(r):e)[t]}function gc(e,t){if(t in e)for(var r=Object.getPrototypeOf(e);r;){var o=Object.getOwnPropertyDescriptor(r,t);if(o)return o;r=Object.getPrototypeOf(r);}}function ns(e){e.P||(e.P=!0,e.l&&ns(e.l));}function ts(e){e.o||(e.o=cs(e.t));}function as(e,t,r){var o=is(t)?It("MapSet").F(t,r):ls(t)?It("MapSet").T(t,r):e.O?function(n,a){var s=Array.isArray(n),i={i:s?1:0,A:a?a.A:dc(),P:!1,I:!1,R:{},l:a,t:n,k:null,o:null,j:null,C:!1},l=i,u=ss;s&&(l=[i],u=jo);var p=Proxy.revocable(l,u),m=p.revoke,d=p.proxy;return i.k=d,i.j=m,d}(t,r):It("ES5").J(t,r);return (r?r.A:dc()).p.push(o),o}function Lh(e){return yo(e)||Me(22,e),function t(r){if(!Vr(r))return r;var o,n=r[rt],a=vo(r);if(n){if(!n.P&&(n.i<4||!It("ES5").K(n)))return n.t;n.I=!0,o=hc(r,a),n.I=!1;}else o=hc(r,a);return Wo(o,function(s,i){n&&Ah(n.t,s)===i||Sc(o,s,t(i));}),a===3?new Set(o):o}(e)}function hc(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return cs(e)}var yc,bo,ds,Oh,_h,bc,Tc,vc,rt,Bh,Mh,ms,Nh,Dh,ss,jo,Fh,ot,Vh,Wn,xc=b(()=>{c();ds=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",Oh=typeof Map<"u",_h=typeof Set<"u",bc=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",Tc=ds?Symbol.for("immer-nothing"):((yc={})["immer-nothing"]=!0,yc),vc=ds?Symbol.for("immer-draftable"):"__$immer_draftable",rt=ds?Symbol.for("immer-state"):"__$immer_state",Bh={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"},Mh=""+Object.prototype.constructor,ms=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Nh=Object.getOwnPropertyDescriptors||function(e){var t={};return ms(e).forEach(function(r){t[r]=Object.getOwnPropertyDescriptor(e,r);}),t},Dh={},ss={get:function(e,t){if(t===rt)return e;var r=Fr(e);if(!rs(r,t))return function(n,a,s){var i,l=gc(a,s);return l?"value"in l?l.value:(i=l.get)===null||i===void 0?void 0:i.call(n.k):void 0}(e,r,t);var o=r[t];return e.I||!Vr(o)?o:o===es(e.t,t)?(ts(e),e.o[t]=as(e.A.h,o,e)):o},has:function(e,t){return t in Fr(e)},ownKeys:function(e){return Reflect.ownKeys(Fr(e))},set:function(e,t,r){var o=gc(Fr(e),t);if(o?.set)return o.set.call(e.k,r),!0;if(!e.P){var n=es(Fr(e),t),a=n?.[rt];if(a&&a.t===r)return e.o[t]=r,e.R[t]=!1,!0;if(wh(r,n)&&(r!==void 0||rs(e.t,t)))return !0;ts(e),ns(e);}return e.o[t]===r&&(r!==void 0||t in e.o)||Number.isNaN(r)&&Number.isNaN(e.o[t])||(e.o[t]=r,e.R[t]=!0),!0},deleteProperty:function(e,t){return es(e.t,t)!==void 0||t in e.t?(e.R[t]=!1,ts(e),ns(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=Fr(e),o=Reflect.getOwnPropertyDescriptor(r,t);return o&&{writable:!0,configurable:e.i!==1||t!=="length",enumerable:o.enumerable,value:r[t]}},defineProperty:function(){Me(11);},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){Me(12);}},jo={};Wo(ss,function(e,t){jo[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)};}),jo.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Me(13),jo.set.call(this,e,t,void 0)},jo.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Me(14),ss.set.call(this,e[0],t,r,e[0])};Fh=function(){function e(r){var o=this;this.O=bc,this.D=!0,this.produce=function(n,a,s){if(typeof n=="function"&&typeof a!="function"){var i=a;a=n;var l=o;return function(y){var T=this;y===void 0&&(y=i);for(var C=arguments.length,N=Array(C>1?C-1:0),R=1;R<C;R++)N[R-1]=arguments[R];return l.produce(y,function(M){var U;return (U=a).call.apply(U,[T,M].concat(N))})}}var u;if(typeof a!="function"&&Me(6),s!==void 0&&typeof s!="function"&&Me(7),Vr(n)){var p=mc(o),m=as(o,n,void 0),d=!0;try{u=a(m),d=!1;}finally{d?qn(p):os(p);}return typeof Promise<"u"&&u instanceof Promise?u.then(function(y){return Za(p,s),Ja(y,p)},function(y){throw qn(p),y}):(Za(p,s),Ja(u,p))}if(!n||typeof n!="object"){if((u=a(n))===void 0&&(u=n),u===Tc&&(u=void 0),o.D&&us(u,!0),s){var f=[],g=[];It("Patches").M(n,u,f,g),s(f,g);}return u}Me(21,n);},this.produceWithPatches=function(n,a){if(typeof n=="function")return function(u){for(var p=arguments.length,m=Array(p>1?p-1:0),d=1;d<p;d++)m[d-1]=arguments[d];return o.produceWithPatches(u,function(f){return n.apply(void 0,[f].concat(m))})};var s,i,l=o.produce(n,a,function(u,p){s=u,i=p;});return typeof Promise<"u"&&l instanceof Promise?l.then(function(u){return [u,s,i]}):[l,s,i]},typeof r?.useProxies=="boolean"&&this.setUseProxies(r.useProxies),typeof r?.autoFreeze=="boolean"&&this.setAutoFreeze(r.autoFreeze);}var t=e.prototype;return t.createDraft=function(r){Vr(r)||Me(8),yo(r)&&(r=Lh(r));var o=mc(this),n=as(this,r,void 0);return n[rt].C=!0,os(o),n},t.finishDraft=function(r,o){var n=r&&r[rt];process.env.NODE_ENV!=="production"&&(n&&n.C||Me(9),n.I&&Me(10));var a=n.A;return Za(a,o),Ja(void 0,a)},t.setAutoFreeze=function(r){this.D=r;},t.setUseProxies=function(r){r&&!bc&&Me(20),this.O=r;},t.applyPatches=function(r,o){var n;for(n=o.length-1;n>=0;n--){var a=o[n];if(a.path.length===0&&a.op==="replace"){r=a.value;break}}n>-1&&(o=o.slice(n+1));var s=It("Patches").$;return yo(r)?s(r,o):this.produce(r,function(i){return s(i,o)})},e}(),ot=new Fh,Vh=ot.produce,ot.produceWithPatches.bind(ot),ot.setAutoFreeze.bind(ot),ot.setUseProxies.bind(ot),ot.applyPatches.bind(ot),ot.createDraft.bind(ot),ot.finishDraft.bind(ot),Wn=Vh;});function Yo(e){return (t,r)=>{let o=e[t];if(!o)throw new Error(`Attempting to dispatch action for invalid entity type '${t}'`);return o(r)}}function Ur(e,t){return (r,o)=>{let a=o().records.requests[e][t],s=!a||a.status==="UNINITIALIZED"?"LOADING":"FETCHING";r(yt.setRequest({key:t,type:e,status:s}));}}function zr(e,t,r,o){return n=>{typeof window=="object"&&notifications.show({autoClose:3e3,color:"red",id:t,message:o,title:"Error"}),n(yt.setRequest({key:t,type:e,status:"FAILURE",error:{code:r,message:o}}));}}function dr(e){return t=>{let r=gs(e,t);return (o,n,a)=>(o(Ur(e,r)),Dr(a,"create",e)(t).then(i=>(i.ok===!0?o(yt.setCreateRequest({key:r,operation:"create",status:"SUCCESS",type:e,data:i.data})):o(zr(e,r,i.status,i.error)),i)))}}function Uh(e){return t=>{let r=gs(e,t[0]);return (o,n,a)=>(o(Ur(e,r)),Dr(a,"createBulk",e)(t).then(i=>(i.ok===!0?o(yt.setCreateRequest({key:r,operation:"createBulk",status:"SUCCESS",type:e,data:i.data})):o(zr(e,r,i.status,i.error)),i)))}}function Rc(e,t,r){return r.replace(new RegExp(e,"g"),t)}function Gh(e){return e.section_id!==void 0}function qh(e){return e.report_id!==void 0}function Ec(e){return t=>{let{create:r}=t;return (o,n,a)=>dr(e)(r)(o,n,a).then(async i=>{if(i.ok){let{data:l}=i,{id:u}=l,{update:p}=t,m=Oc(e,{id:u});if(o(Ur(e,`${m}`)),e==="block"&&Gh(r)){let d=Wn(p,T=>{T.id=u;}),{contentByLocale:f}=d;f&&(d=Wn(d,T=>{T.id=u,T.contentByLocale=Object.keys(f).reduce((C,N)=>{let R=f?f[N]:{};return C[N]={...R,id:u},C},{});}));let y=d.inputs?.map(T=>({type:T.type,id:T.id,inputAction:{operation:"create",input:{input_id:T.id,block_id:d.id}}}));return y&&y.length>0&&kc(e)([d,...y])(o,n,a).then(()=>mr("section")({id:d.section_id,include:!0})(o,n,a).then(T=>(T.ok&&o(yt.setRequest({key:m,type:e,status:"SUCCESS",data:T.data})),T))),Lt(e)(d)(o,n,a).then(T=>(T.ok&&o(yt.setRequest({key:m,type:e,status:"SUCCESS",data:T.data})),T))}if(e==="section"&&qh(r)){let{id:d}=l,f=Wn(p,T=>{T.id=d;}),{blocks:g}=f,y=g?.map(T=>({type:T.type,blockcol:T.blockcol,blockrow:T.blockrow,section_id:d,locales:Object.keys(T.contentByLocale).map(C=>C)}));return y&&g&&await Uh("block")(y)(o,n,a).then(T=>{if(T.ok){let C=T.data,N=[],R=C.map((M,U)=>{let w={...M},O=w.id,k=g[U];k.contentByLocale&&(w.contentByLocale=Object.keys(k.contentByLocale).reduce((V,L)=>{let H=k.contentByLocale[L];return V[L]={...H,content:{...H.content},id:w.id},V},{}));let{settings:I}=k,{contentByLocale:E,id:A}=w;w.settings=I;let z={id:A,contentByLocale:E,settings:I};return k.inputs.map(V=>V.id).reduce((V,L)=>{let H=g.findIndex($=>$.id===L);return [...V,H]},[]).map(V=>({...C[V],originalBlock:g[V]})).forEach(V=>{let{id:L,type:H,originalBlock:$}=V;if([h.SELECTOR,h.VIZ].includes(H)){if(z.contentByLocale?.logic?.content?.api){let ie=z.contentByLocale?.logic.content.api;z.contentByLocale.logic.content.api=Rc(`(selector${$.id}id)`,`selector${L}id`,ie);}if(z.contentByLocale?.logic?.content?.logic){let ie=z.contentByLocale.logic.content.logic;z.contentByLocale.logic.content.logic=Rc(`(selector${$.id}id)`,`selector${L}id`,ie);}}N.push({id:L,inputAction:{operation:"create",input:{input_id:L,block_id:O}}});}),z});return kc("block")([...R,...N])(o,n,a)}}),Lt(e)(f)(o,n,a).then(T=>(T.ok&&o(yt.setRequest({key:m,type:e,status:"SUCCESS",data:T.data})),T))}return Lt(e)({...p,id:l.id})(o,n,a)}})}}function mr(e){return t=>{let r=Ic(e,t);return (o,n,a)=>{o(Ur(e,r));let s=Dr(a,"read",e);if(typeof s!="function"){let i=`Failed to get valid RPC method for entity "${e}"`;return o(zr(e,r,500,i)),Promise.reject(new Error(i))}return s(t).then(i=>(i.ok===!0?o(yt.setReadRequest({key:r,operation:"read",status:"SUCCESS",type:e,data:i.data})):o(zr(e,r,i.status,i.error)),i))}}}function Lt(e){return t=>{let r=hs(e,t);return (o,n,a)=>(o(Ur(e,r)),Dr(a,"update",e)(t).then(i=>(i.ok===!0?o(yt.setUpdateRequest({key:r,operation:"update",status:"SUCCESS",type:e,data:i.data})):o(zr(e,r,i.status,i.error)),i)))}}function kc(e){return t=>{let r=hs(e,t[0]);return (o,n,a)=>(o(Ur(e,r)),Dr(a,"updateBulk",e)(t).then(i=>(i.ok===!0?o(yt.setUpdateRequest({key:r,operation:"updateBulk",status:"SUCCESS",type:e,data:i.data})):o(zr(e,r,i.status,i.error)),i)))}}function $r(e){return t=>{let r=Lc(e,t);return (o,n,a)=>(o(Ur(e,r)),Dr(a,"delete",e)(t).then(i=>{i.ok===!0?o(yt.setDeleteRequest({key:r,operation:"delete",status:"SUCCESS",type:e,data:i.data})):o(zr(e,r,i.status,i.error));}))}}function gs(e,t){if(e==="variant"){let r=t;return `create(variant, [${r.dimension_id}, ${r.name}])`}return `create(${e}, [${Object.keys(t)}])`}function Ic(e,t={}){let r=t.id==null?null:`'${t.id}'`;return `read(${e}, ${r}, ${!!t.include})`}function hs(e,t){let{id:r,...o}=t;return `update(${e}, ${r}, [${Object.keys(o)}])`}function Lc(e,t){return `delete(${e}, ${t})`}function Oc(e,t){let r=t.id==null?null:`'${t.id}'`;return `clone(${e}, ${r})`}var yt,fs,Cc,Ko,Ac,wc,Pc,ys=b(()=>{c();pc();Ho();xc();he();yt=jt.actions,fs={create:gs,read:Ic,update:hs,delete:Lc,clone:Oc},Cc=Yo({block:dr("block"),dimension:dr("dimension"),formatter:dr("formatter"),report:dr("report"),section:dr("section"),variant:dr("variant"),datasource:dr("datasource")}),Ko=Yo({block:mr("block"),dimension:mr("dimension"),formatter:mr("formatter"),report:mr("report"),section:mr("section"),variant:mr("variant"),datasource:mr("datasource")}),Ac=Yo({block:Lt("block"),dimension:Lt("dimension"),formatter:Lt("formatter"),report:Lt("report"),section:Lt("section"),variant:Lt("variant"),datasource:Lt("datasource")}),wc=Yo({block:$r("block"),dimension:$r("dimension"),formatter:$r("formatter"),report:$r("report"),section:$r("section"),variant:$r("variant"),datasource:$r("datasource")}),Pc=Yo({block:Ec("block"),section:Ec("section")});});var nt={};Na(nt,{addBlockToState:()=>sy,addRunConsumersRunning:()=>bs,cloneEntity:()=>Pc,createEntity:()=>Cc,deleteEntity:()=>wc,deleteQueryParam:()=>Ss,readEntity:()=>Ko,readEnvSecrets:()=>uy,readMember:()=>Bc,readMetadata:()=>Zh,readPrivateBlocks:()=>iy,readUser:()=>ry,recalculateVariables:()=>Nc,removeBlocksFromState:()=>ay,removeDataSourceLogic:()=>py,removeRunConsumersRunning:()=>vs,reportSearch:()=>Yh,resetSectionState:()=>Qo,revalidateReport:()=>cy,revalidateUrl:()=>ly,searchMember:()=>Qh,searchRegenerate:()=>Xh,searchRole:()=>ey,searchUser:()=>ty,setCurrentLocale:()=>jh,setPreferredLocale:()=>Wh,setPreviews:()=>Hh,setQueryParam:()=>Gr,setSectionState:()=>Xo,setStatus:()=>_c,updateEntity:()=>Ac,updateMyData:()=>ny,updateUser:()=>oy,urlProxy:()=>Jh,variantValidateSlug:()=>Kh});function Kh(e,t){return async(r,o,n)=>{let a=await n.validateVariantSlug({dimension:e,slug:t});if("error"in a)throw new Error(a.error);return a.data}}function Yh(e){return async(t,r,o)=>{let n=await o.searchReport(e);if("error"in n)throw new Error(n.error);return n.data}}function Xh(){return async(e,t,r)=>{let o=await r.regenerateSearch(void 0);if("error"in o)throw new Error(o.error);return o.data}}function Bc(e){return async(t,r,o)=>{let n=await o.readMember(e);if("error"in n)throw new Error(n.error);return n.data}}function Qh(e){return async(t,r,o)=>{let n=await o.searchMember(e);if(n.ok===!0)return n.data;throw new Error(n.error)}}async function Mc(e,t,r,o){let n=r().status,a={...n,...o},s={...n.query,...o.query};Object.keys(s).forEach(l=>s[l]===void 0&&delete s[l]);let i={...a,query:s};t(_c(i)),n.activeSection&&t(Nc(e,{query:s}));}function Ss(e,t){return async(r,o)=>Mc(e,r,o,{query:{[t]:void 0}})}function Gr(e,t,r){return async(o,n)=>Mc(e,o,n,{query:{[t]:r}})}function Nc(e,t){return async(r,o)=>{let n=o(),{currentLocale:a}=n.status,s=n.records.entities.block,i=e.formatterFunctions[a],l=e.datasourceFunctions,{parsedParams:u,statusPayload:p}=wl(n.status,t),{sid:m,bid:d,previews:f,query:g}=u;Object.keys(p).length&&r(go.setStatus(p));let y={...lc(f),locale:a,...cr()},T={variables:y,query:g,locale:a};r(go.addRunConsumersRunning([m]));let C=n.records.entities.section[m],N=async R=>r(Bc(R));try{let R=await Pt(s,C&&[C],d,i,T,void 0,N,"section",l),{variables:M,status:U}=R;r(pr.setVariableChange({attributes:y,variables:M,status:U})),r(go.removeRunConsumersRunning([m]));}catch(R){console.error("Error in runConsumers client side: recalculateVariables",R);}}}function Zh(e){return async(t,r,o)=>{let n=await o.readMetadata(e);if("error"in n)throw new Error(n.error);return n.data}}function Jh(e){return async(t,r,o)=>{let n=await o.urlProxy(e);if("error"in n)throw new Error(n.error);return n.data}}function ey(){return async(e,t,r)=>{let o=await r.searchRole("");if("error"in o)throw new Error(o.error);return o.data}}function ty(e){return async(t,r,o)=>{let n=await o.searchUser(e);if("error"in n)throw new Error(n.error);return n.data}}function ry(e){return async(t,r,o)=>{let n=await o.readUser({user_id:e});if("error"in n)throw new Error(n.error);return n.data}}function oy({user:e}){return async(t,r,o)=>{let n=await o.updateUser(e);if("error"in n)throw new Error(n.error);return n.data}}function ny(e){return async(t,r,o)=>{let n=await o.updateMyData(e);if("error"in n)throw new Error(n.error);return n.data}}function ay(e){let{removeBlocks:t}=jt.actions;return async r=>{await r(t(e));}}function sy(e){let{addBlocks:t}=jt.actions;return async r=>{await r(t(e));}}function iy(e){return async(t,r,o)=>{let n=await o.readPrivateBlocks({...e,roles:[]});if("error"in n)throw new Error(n.error);return n.data}}function ly(e){return async(t,r,o)=>{let n=await o.revalidateUrl({target:e.target});if("error"in n)throw new Error(n.error);return n.data}}function cy(e){return async(t,r,o)=>{let n=await o.revalidateReport({reportId:e.reportId,profilePrefix:e.profilePrefix});if("error"in n)throw new Error(n.error);return n.data}}function uy(){return async(e,t,r)=>{let o=await r.readEnvSecrets({});if("error"in o)throw new Error(o.error);return o.data}}function py(){let{removeDataSourceLogic:e}=jt.actions;return async t=>{await t(e());}}var _c,Hh,Xo,Qo,jh,Wh,bs,vs,Zo=b(()=>{c();Nr();cc();Go();ir();zn();ho();Ho();ys();({setStatus:_c,setPreviews:Hh,setSectionState:Xo,resetSectionState:Qo,setCurrentLocale:jh,setPreferredLocale:Wh,addRunConsumersRunning:bs,removeRunConsumersRunning:vs}=go);});function Pe(e){let t=Ye(),r=Q(a=>a.status.sectionState)[e]||{},o=useCallback(a=>{t(Xo({[e]:a}));},[e]),n=useCallback(()=>{t(Qo(e));},[e]);return {sectionVariables:r,setSectionVariables:o,resetSectionVariables:n}}function Vc(e){let t=Ye(),r=Q(l=>l.status.sectionState),o=useMemo(()=>e.reduce((l,u)=>(l[u]=r[u]||{},l),{}),[e,r]),n=useCallback(l=>{t(Xo(l));},[]),a=useCallback(()=>{e.map(u=>Qo(u)).forEach(u=>t(u));},[e]),s=useCallback(l=>u=>{t(Xo({[l]:u}));},[]),i=useCallback(l=>()=>{t(Qo(l));},[]);return {sectionsVariables:o,setSectionsVariables:n,resetSectionsVariables:a,setSectionVariables:s,resetSectionVariables:i}}function To(){let e=Ye(),t=Q(n=>n.status.isRunConsumersRunning),r=useCallback(n=>{e(bs(n));},[]),o=useCallback(n=>{e(vs(n));},[]);return {isRunConsumersRunning:t,addRunConsumersRunning:r,removeRunConsumersRunning:o}}function $c(){return Q(t=>t.status.currentLocale)}function qr(e){return t=>{let r=Ye(),o=useMemo(()=>fs.read(e,{include:!0}),[]),n=useCallback(s=>{let i=Object.values(s.records.entities[e]),l=s.records.requests[e][o]||{key:o,type:e,status:i==null?"UNINITIALIZED":"SUCCESS"},u=t?i.filter(p=>t.includes(p.id)):i;return zc(u,l)},[o]),a=Q(n);return useEffect(()=>{a.isUninitialized&&r(Ko(e,{id:t,include:!0}));},[a.status]),a}}function Hr(e){return t=>{let r=Ye(),o=useMemo(()=>fs.read(e,{id:t,include:!0}),[t]),n=useCallback(s=>{let i=s.records.entities[e][t],l=s.records.requests[e][o]||{key:o,type:e,status:i==null?"UNINITIALIZED":"SUCCESS"};return zc(i,l)},[o]),a=Q(n);return useEffect(()=>(a.isUninitialized&&t!==null&&r(Ko(e,{id:t,include:!0})),()=>{}),[o,a.isUninitialized,r,t]),a}}function zc(e,t){let r={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"?r:t.status==="LOADING"?{...r,data:e}:t.status==="FETCHING"?{...r,data:e}:t.status==="FAILURE"?{...r,error:t.error}:{...r,data:e}}var fy,Ye,Q,xs,Jo,Rs,Es,Yn,bt,So,_t,fr,Xn,Ee=b(()=>{c();Zo();ys();Ho();Wt();Ct();zn();(({localeDefault:fy}=we())),Ye=useDispatch,Q=useSelector,xs=qr("report"),Jo=qr("section"),Rs=qr("formatter"),Es=qr("datasource"),Yn=Hr("section"),bt=Hr("block"),So=(e,t=void 0,r=void 0)=>{if(!e)return {};let o=bt(e).data,n=Q(i=>t||i.variables.variables),a=Q(i=>r||i.variables.attributes);return useMemo(()=>o?o.inputs.reduce((i,l)=>({...i,...n[l]}),a):{},[o,a,n])},_t=(e=fy)=>useContext(Bt).formatterFunctions[e],fr=()=>useContext(Bt).datasourceFunctions,Xn=()=>useContext(Bt).profilePrefix;});var Uc,Gc=b(()=>{c();Va();Ho();zn();ho();Uc=()=>configureStore({reducer:{[jt.name]:jt.reducer,[$n.name]:$n.reducer,[Un.name]:Un.reducer},middleware(e){return e({thunk:{extraArgument:zo("/api/cms/")}})}}),createWrapper(Uc);});var qc=b(()=>{c();});var ge=b(()=>{c();Zo();Ee();Gc();qc();});function jc(e){let {pathSegment:t,profilePrefix:r,siteProps:o}=e,n=Rs();Q(p=>p.status.isCMS);let s=Es(),l={...cr()},u=useMemo(()=>({profilePrefix:r,pathSegment:t,siteProps:o,formatterFunctions:Hc.reduce((p,m)=>({...p,[m]:n.data?At(n.data,m):{}}),{}),datasourceFunctions:(s?.data||[]).sort((p,m)=>p.content.order>m.content.order?1:-1).map(p=>({...p,content:{...p.content,pattern:tt(p.content.pattern,{},{variables:l})}}))}),[n,t,r,o,s]);return jsx(Bt.Provider,{value:u,children:e.children})}function jr(){let e=useContext(Bt);if(e===void 0)throw new Error("useBespoke must be used inside ResourceProvider");return e}var Hc,wy,Bt,Wt=b(()=>{c();Ct();ir();ge();Go();po();(({locales:Hc}=we())),wy={pathSegment:"path",formatterFunctions:Hc.reduce((e,t)=>({...e,[t]:{}}),{}),datasourceFunctions:[],profilePrefix:"path",siteProps:{}},Bt=createContext(wy);});function xo(e){return t=>Object.values(t.records.entities[e])}function hr(e){return Object.values(e.records.entities.datasource||[]).sort((t,r)=>t.content.order>r.content.order?1:-1).map(t=>{let r={...Iy};return {...t,content:{...t.content,pattern:tt(t.content.pattern,{},{variables:r})}}})}var Mt,Wc,gr,Iy,yr=b(()=>{c();Go();po();Mt=e=>e.records.entities.block;Wc=xo("block"),gr=xo("formatter"),Iy=cr();});var Ly,Oy,_y,By,Ue,Wr=b(()=>{c();Ly=e=>typeof e=="string"?e.replace(/&nbsp;<\/p>/g,"</p>"):e,Oy=e=>typeof e=="string"&&e==="<p><br></p>"?"":e,_y=e=>typeof e=="string"?e.replace(/^<p>(.*)<\/p>$/,"$1"):e,By=e=>e&&_y(Oy(Ly(e))),Ue=By;});function se({id:e="",component:t="p",order:r=1,size:o="md",html:n,style:a={},append:s=jsx(Fragment,{}),isPreview:i=!1}){let l=Vy(n),u=$y(n,i),p=a&&a.align?String(a.align):"left",m=Text,d={};return t==="h"?(m=Title,d={id:e,order:r}):d={component:t,size:o},jsxs(m,{align:p||l.align||"left",...d,children:[u,s]})}var Vy,$y,Ie=b(()=>{c();Vy=(e="<></>")=>{let t=null,r={replace:o=>(o instanceof Element&&!t&&(t=o.attribs,t.align=o.attribs.style?o.attribs.style.replace("text-align: ",""):"",delete t.children),o)};return e?(Kc(e,r),t):{}},$y=(e="",t=!1)=>{let r={replace:o=>{let{type:n}=o;if(o instanceof Element&&n==="tag"){let{name:a,attribs:s,children:i,parent:l}=o;if(a==="p"&&!l)return jsx(Fragment,{children:domToReact(i,r)});if(a==="a"){let{href:u,target:p}=s,m=u.indexOf("http")===0,d=!!(p&&p==="_blank"),f=jsx(Anchor,{...s,href:s.href,target:"_blank",children:domToReact(i,r)});return m||d||t?f:jsx(Dy,{...s,href:s.href,prefetch:!1,passHref:!0,children:f})}else {if(a==="strong")return jsx(Text,{component:"strong",children:domToReact(i,r)});if(a==="em")return jsx(Text,{component:"em",fs:"italic",children:domToReact(i,r)});if(a==="u")return jsx(Text,{component:"u",td:"underline",children:domToReact(i,r)});if(a==="sup")return jsx(Text,{component:"sup",style:{verticalAlign:"super",fontSize:"0.75em"},children:domToReact(i,r)});if(a==="sub")return jsx(Text,{component:"sub",style:{verticalAlign:"sub",fontSize:"0.75em"},children:domToReact(i,r)});if(a==="span")return jsx(Text,{component:"span",children:domToReact(i,r)});if(a==="br")return jsx("br",{})}return jsx(Fragment,{children:domToReact(i,r)})}else if(o instanceof Text$1&&o.type==="text")return jsx(Fragment,{children:o.data})}};return Kc(e,r)};});function Ne(e){let{content:t,style:r={}}=e,{print:o}=qe(),n=jsx(se,{component:"span",html:t,isPreview:!0}),a=useMemo(()=>o?jsx("div",{className:"bespoke-inner-tooltip-notification",children:jsx(Notification,{icon:jsx(IconInfoCircle,{size:"1.1rem"}),withCloseButton:!1,withBorder:!0,styles:{root:{boxShadow:"none"}},children:n})},"tooltip-notification"):jsx("div",{className:"bespoke-inner-tooltip",style:r,children:jsx(Tooltip,{label:n,withArrow:!0,withinPortal:!0,multiline:!0,maw:220,children:jsx(ActionIcon,{size:"1.5rem",children:jsx(IconInfoCircle,{})})})},"tooltip"),[o,t,r]);return jsx(Fragment,{children:a})}var Xt=b(()=>{c();Qt();Ie();});function Cs({paragraph:e,tooltip:t,settings:r}){let o=Ue(t);return jsx(se,{component:"p",html:e,style:r,append:t?jsx(Ne,{content:o,style:{display:"inline-block",verticalAlign:"bottom"}}):jsx(Fragment,{})})}var Qc=b(()=>{c();Wr();Xt();Ie();});function ke({iconType:e="none",iconVariant:t="transparent",icon:r="",iconRadius:o="md",iconSize:n="md",iconPadding:a="1",blockType:s}){let[i,l]=useState(void 0),u=e==="custom"?r:`/api/cms/read/icons/${e}/icon.svg?name=${r}`,p=/^.*\.svg*$/.test(u)||e==="tabler";return useEffect(()=>{p&&Nn.get(u,{responseType:"text"}).then(d=>d.data).then(l).catch(()=>{});},[e,p,u]),jsx(Fragment,{children:e!=="none"&&r&&r!==""&&!!(i||!p)&&jsx(ThemeIcon,{className:`bespoke-${s}-icon-wrapper`,variant:t,radius:o,size:n,p:parseInt(a),dangerouslySetInnerHTML:i&&p?{__html:i}:void 0,children:p?null:jsx(Image,{src:u,alt:"Title Icon"})})})}var Yr=b(()=>{c();});var br,Zc,Jc,eu,tu,Nt,pt,Ro,Ge=b(()=>{c();he();br={display:{label:"Size",defaultValue:"block",options:[{label:"Full Width",value:"block"},{label:"Inline",value:"inline"}]}},Zc={useProxy:{label:"Use proxy (avoid CORS)",defaultValue:"false",options:[{label:"No",value:"false"},{label:"Yes",value:"true"}]}},{[h.IMAGE]:{...br},[h.PARAGRAPH]:{...br},[h.SUBTITLE]:{...br},[h.SELECTOR]:{...br},[h.STAT]:{...br},[h.VIZ]:{...br},[h.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"}]},...br},[h.GENERATOR]:{...Zc},[h.SECTION_FLAG]:{...Zc},[h.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"}]}},[h.MULTIHIERARCHY_SELECTOR]:{...br}},Jc={left:"flex-start",right:"flex-end",justify:"stretch"},eu={justify:"apart"},tu={justify:"space-between"},Nt=e=>Jc[e]?Jc[e]:e,pt=e=>eu[e]?eu[e]:e,Ro=e=>tu[e]?tu[e]:e;});function ws({subtitle:e,title:t,value:r,tooltip:o,settings:n,_iconType:a,_iconVariant:s,_icon:i,_iconRadius:l,_iconSize:u,_iconPadding:p}){if(!t&&!r&&!e)return null;let m=n&&n.align?n.align:"left";return jsxs(Group,{spacing:"md",position:pt(m),children:[jsx(ke,{blockType:"stat",iconType:a,iconVariant:s,iconRadius:l,iconSize:u,icon:i,iconPadding:p}),jsxs(Stack,{spacing:0,children:[t&&jsx(se,{component:"div",size:"md",html:t,style:n}),r&&jsx(se,{component:"div",size:"xl",html:r,style:n}),e&&jsx(se,{component:"div",size:"sm",html:e,style:n})]},"stat"),o&&jsx(Ne,{content:o})]})}var ou=b(()=>{c();Xt();Yr();Ie();Ge();});function Ps({subtitle:e,tooltip:t,settings:r}){let o=e||"<span class='cr-block-placeholder'>Small subtitle.</span>",n=r&&r.align?r.align:"left";return jsxs(Group,{spacing:"sm",position:pt(n),children:[jsx(se,{size:"sm",html:o}),t&&jsx(Ne,{content:t,style:{display:"inline-flex"}})]})}var au=b(()=>{c();Xt();Ie();Ge();});function Le(e){let t=useContext(su);return e?t[e]??t:t}function Is({translations:e,children:t}){return jsx(su.Provider,{value:e||{},children:t})}var su,vt=b(()=>{c();su=createContext({});});function pu({children:e,pageSize:t=10}){let r={profile:void 0,variant:void 0},[o,n]=useState([]),[a,s]=useState(!1),[i,l]=useState(!1),[u,p]=useState({}),[m,d]=useState({}),[f,g]=useState(1),[y,T]=useState(r),[C,N]=useState(""),[R]=useDebouncedValue(C,750),[M,U]=useState([]),[K,w]=useState(Ls),[O,k]=useState(!1),{locale:I}=useRouter(),E=async()=>{try{l(!0),Nn.get("/api/cms/read/metadata").then(Y=>{if(Y&&Y.data&&Y.data.data&&Y.data.data.data){let re=Y.data.data.data.reduce((Z,te)=>(te.dimensions&&te.dimensions.forEach(q=>{q.variants&&q.variants.forEach(x=>{Z[x.id]=x.members_count||0;});}),Z),{});n(Y.data.data.data),p(re),d(re);}l(!1),k(!0);}).catch(Y=>{console.error(Y);});}catch(Y){console.error("Error fetching metadata:",Y),n([]),l(!1),p({}),d({});}},A=Y=>{p(Y||m);},z=useCallback(async(Y,re,Z)=>{!O&&o.length===0&&await E(),T({profile:Y,variant:re}),Z!==""&&N(Z);},[]);useEffect(()=>{let Y=!1;return O&&(s(!0),g(1),B(Y,0)),()=>{Y=!1;}},[R,y,O]),useEffect(()=>{if(O){s(!0);let Y=(f-1)*t;B(!1,Y);}},[f]);let B=async(Y,re)=>{let Z=y.profile&&!Number.isNaN(y.profile)?[y.profile]:[],te=y.variant?typeof y.variant=="string"&&y.variant.includes(",")?y.variant.split(",").map(x=>parseInt(x,10)):[parseInt(y.variant,10)]:[],q={query:R,format:"profiles",locale:I,limit:t,offset:re,visible:!0,includes:!0,noImage:!1,variant:te,dimension:[],report:Z,all:!1,origin:"typesense"};Nn.get("/api/cms/search/reports",{params:q}).then(x=>{if(x&&x.data&&x.data.data&&x.data.data.results&&!Y){let P=x.data.data.results;U(P),p(!C||C===""?!1:x.data.data.meta.variantCount);}s(!1);}).catch(x=>{console.error(x),s(!1);});},D=u||m,j={id:void 0,name:K.filters_all||"ALL"},V=Y=>{let re=Y.reduce((te,q)=>te.reduce((x,P)=>x.concat(q.map(G=>[].concat(P,G))),[])).map(te=>{let q;return Array.isArray(te)?q={id:te.map(x=>x.id).join(","),name:te.map(x=>x.name).join(" / "),members_count:te.reduce((x,P)=>x*(D[P.id]||1),1),ordering:te.reduce((x,P)=>x+P.ordering,0)}:(te.members_count=D[te.id]||0,q={...te,members_count:D[te.id]||0}),q}),Z=re.reduce((te,q)=>te+(q.members_count||0),0);return [{...j,members_count:Z},...re]},L=o.length>1,H=useMemo(()=>{let Y=[];if(!i&&o.length>0&&D){let re=o.filter(Z=>Z.dimensions.length>0).map(Z=>{let te=!1,q=V(Z.dimensions.map(x=>x.variants));return q&&q.length>2&&(te=!0),{id:Z.id,name:Z.dimensions.map(x=>x.name).join(" / "),variants:q,members_count:q.filter(x=>x.id).reduce((x,P)=>x+(P.members_count||0),0),show:te}});Y=[{...j,members_count:re.reduce((Z,te)=>Z+(te.members_count||0),0)},...re];}return Y},[i,D,o,j]),$=useMemo(()=>{let Y;return H&&(y.profile?y.profile&&(Y=H.find(re=>re.id===y.profile),Y&&y.variant&&Y.variants&&(Y=Y.variants.find(re=>re.id===y.variant))):Y=H.find(re=>!re.id)),Y?Y.members_count:t},[y,H]),ie={metadata:o,loadingMetadata:i,setLoadingMetadata:l,loadingItems:a,setLoadingItems:s,resultCount:u,totalCount:m,setResultCount:A,activePage:f,setActivePage:g,pageSize:t,filters:y,setFilters:T,doQuery:B,query:C,setQuery:N,debouncedQuery:R,results:M,currentPageTotal:$,selectorStructure:H,translations:K,setTranslations:Y=>w({...Ls,...Y}),showSelectors:L,initExplore:z};return jsx(uu.Provider,{value:ie,children:e})}var Ls,uu,vr,Eo=b(()=>{c();Ls={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:{}},uu=createContext({metadata:[],loadingItems:!1,setLoadingItems:()=>null,loadingMetadata:!1,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:Ls,setTranslations:()=>null,showSelectors:!0}),vr=()=>useContext(uu);});function fb({translations:e}){let{loadingItems:t,setFilters:r,selectorStructure:o,filters:n,showSelectors:a}=vr(),s=g=>{let y=g===null||Number.isNaN(g)?void 0:parseInt(g,10);y!==n.profile?r({profile:y,variant:void 0}):y&&r({profile:void 0,variant:void 0});},i=g=>{let y=g===null?void 0:typeof g=="string"&&g.includes(",")?g:parseInt(g,10);y!==n.variant?r({...n,variant:y}):y&&r({...n,variant:void 0});},l=g=>g<1e3?g:format$1(e.count_format)(g).replace(/\.0+([a-zA-Z]*)$/,"$1"),u=o.length===2?o[1].id:n.profile,p=u?o.find(g=>g.id===u):void 0,m=p&&p.variants&&n.variant?p.variants.find(g=>g.id===n.variant):void 0,d=useMemo(()=>o.map(g=>({value:String(g.id||""),label:(e?.dimensionIcon?.[g.name]?`${e?.dimensionIcon?.[g.name]} `:"")+(e?.dimension[g.name]||g.name)+(!t&&(!p||g.id===p?.id)?` (${l(g.members_count)})`:"")})),[e,p,o]),f=useMemo(()=>p?.variants?.map(g=>({value:String(g.id||""),label:(e?.variantIcon?.[g.name]?`${e?.variantIcon?.[g.name]} `:"")+(e?.variant[g.name]||g.name)+(!t&&(!m||g.id===m?.id)?` (${l(g.members_count)})`:"")}))??[],[e,m,o]);return jsx(Fragment,{children:a&&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:d,value:String(p?.id||""),onChange:g=>s(g),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:f,value:String(m?.id||""),onChange:g=>i(g),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:o.map(g=>jsxs(Button,{"data-selected":g.id===p?.id?"true":"false","data-report-name":g.name,variant:g.id===p?.id?"outline":"subtle",onClick:()=>s(g.id),rightIcon:g.id&&g.id===p?.id?jsx(IconX,{size:"1rem"}):void 0,leftIcon:e?.dimensionIcon?.[g.name]??void 0,children:[jsx(Text,{span:!0,className:"bespoke-explore-reports-name",dangerouslySetInnerHTML:{__html:e?.dimension[g.name]??g.name}}),!t&&(!p||g.id===p?.id)&&jsx(Text,{span:!0,size:"xs",ml:"0.2rem",className:"bespoke-explore-reports-count",children:`(${l(g.members_count)})`})]},`p-${g.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(g=>jsxs(Button,{"data-selected":g.id===m?.id?"true":"false","data-variant-name":g.name,variant:g.id===m?.id?"outline":"subtle",onClick:()=>i(g.id),rightIcon:g.id&&g.id===m?.id?jsx(IconX,{size:"1rem"}):void 0,leftIcon:e?.variantIcon?.[g.name]?jsx(Text,{span:!0,dangerouslySetInnerHTML:{__html:e.variantIcon[g.name]}}):void 0,children:[jsx(Text,{span:!0,className:"bespoke-explore-variant-name",dangerouslySetInnerHTML:{__html:e?.variant[g.name]??g.name}}),!t&&(!m||g.id===m?.id)&&jsx(Text,{span:!0,size:"xs",ml:"0.2rem",className:"bespoke-explore-variant-count",children:`(${l(g.members_count)})`})]},`v-${g.id}`))})]})})]})})}var bu,vu=b(()=>{c();Eo();bu=fb;});function st(){return useMantineTheme().other.bespokeStyles??{}}var Xr=b(()=>{c();});function _s({reportId:e,reportName:t,members:r,href:o,onClick:n}){let a=r.map(i=>jsx(Image,{src:i.image.src,height:160,imageProps:{loading:"lazy"},alt:i.name},i.id)),s=r.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:!0,children:[jsx(Card.Section,{children:jsx(Group,{grow:!0,spacing:0,children:a})}),jsx(Group,{position:"apart",mt:"md",mb:"xs",children:s}),jsx("a",{href:o,onClick:n,children:jsx(Button,{variant:"light",color:"blue",fullWidth:!0,mt:"md",radius:"md",children:`See ${t} Report`})})]})}function Eb({profile:e,profilePrefix:t,onSelect:r,reportTile:o}){let n=useRouter(),a=n.locale,{localeDefault:s}=we(),l=`${a===s?"":`/${a}`}${t}${e.path}`,u=e.members.map(f=>({original_id:f.metadata.id,name:f.name,id:f.id,dimension_id:f.metadata.dimension.id,dimension:f.metadata.dimension.name,variant_id:f.metadata.variant.id,variant:f.metadata.variant.name,image:{src:`/api/cms/member/image?member=${f.id}&size=thumb`,alt:f.name}})),p=f=>{n.push(`${f}`),r&&r();},m=f=>{f.preventDefault(),p(l);},d=Rb(o);return jsx(Grid.Col,{xs:12,sm:6,md:4,lg:4,xl:3,children:jsx(d,{reportId:e.report.id,reportName:e.report.name,members:u,href:l,onClick:m})},e.id)}var Rb,Ru,Bs=b(()=>{c();Xr();Ct();Rb=e=>{let{components:t}=st(),r=_s;return t?.ReportTile&&(r=t?.ReportTile),e&&(r=e),r};Ru=Eb;});function Ib({profilePrefix:e,onSelect:t=()=>{},reportTile:r}){let[o,n]=useState(500),a=useRef(null),{results:s}=vr(),i=a.current?.offsetTop||0,l=50;return useEffect(()=>{let{innerHeight:u}=window;n(u-i-l);},[i]),jsx(ScrollArea,{offsetScrollbars:!0,type:"always",h:o,ref:a,children:jsx(Grid,{align:"stretch",children:s.map(u=>jsx(Ru,{profile:u,profilePrefix:e,reportTile:r,onSelect:t},u.id))})})}var Eu,ku=b(()=>{c();Bs();Eo();Eu=Ib;});function _b(){let{activePage:e,setActivePage:t,pageSize:r,currentPageTotal:o}=vr();return jsx(Group,{position:"center",children:jsx(Pagination,{value:e,onChange:a=>{t(a);},total:Math.ceil(o/r),size:"sm",py:"xs"})})}var Au,wu=b(()=>{c();Eo();Au=_b;});function qb({profilePrefix:e,initialReportId:t,initialVariantId:r,translations:o,onSelect:n,reportTile:a,initialQuery:s}){let i=useRef(),l=vr(),{query:u,setQuery:p,results:m,loadingItems:d,loadingMetadata:f,translations:g,setTranslations:y,initExplore:T}=l;useEffect(()=>{T&&T(t,r,s);},[T]),useEffect(()=>{d||i.current?.focus();},[d]),useEffect(()=>{o&&y(o);},[o]);let C=()=>{p("");};return jsxs(Container,{fluid:!0,pt:"1em",children:[jsx(TextInput,{placeholder:g.search,mb:"md",size:"xl",onChange:N=>p(N.target.value),readOnly:f||d,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:[(f||d)&&jsx(Loader,{size:28}),u&&u!==""&&jsx(ActionIcon,{onClick:C,children:jsx(IconTrash,{size:24})})]}),ref:i}),jsx(bu,{translations:g}),jsx(LoadingOverlay,{visible:f||d}),!d&&m.length===0&&jsx(Alert,{title:g.no_results,color:"blue",children:g.try_another}),jsx(Eu,{profilePrefix:e,onSelect:n,reportTile:a}),jsx(Au,{})]})}var Iu,Lu=b(()=>{c();vu();ku();wu();Eo();Iu=qb;});function Zb({exploreProps:e={profilePrefix:"/",locale:Qb},icon:t=jsx(IconSearch,{size:20}),actionIconProps:r={},modalProps:o={},tooltipProps:n={},tooltipText:a="Click to Explore",showIcon:s=!0,showTooltip:i=!1,children:l}){let[u,p]=useState(!1),m={variant:"light",size:"md",radius:"md",...r},d={fullScreen:!0,opened:u,onClose:()=>p(!1)},f=jsx(ActionIcon,{...m,onClick:()=>p(!0),children:t}),g=s?jsxs(Group,{spacing:"sm",style:{cursor:"pointer"},children:[l,f]}):l;return i&&(g=jsx(Tooltip,{label:a,...n,children:g})),jsxs(Fragment,{children:[jsx(Modal,{...d,...o,children:u&&jsx(Iu,{...e,onSelect:()=>p(!1)})}),jsx("div",{onClick:()=>p(!0),children:l?g:jsx(Fragment,{children:f})})]})}var Qb,Bu,Mu=b(()=>{c();Lu();Ct();({localeDefault:Qb}=we());Bu=Zb;});var nv,Nu,Du=b(()=>{c();nv=forwardRef(({id:e,members:t,...r},o)=>{let n=t.map(a=>jsxs(Stack,{align:"center",children:[jsx(Text,{weight:500,children:a.name}),jsx(Badge,{color:"green",variant:"light",children:a.variant})]},a.id));return jsx("div",{ref:o,children:jsx(Group,{position:"apart",grow:!0,...r,children:n})},e)}),Nu=nv;});function hv({locale:e,profilePrefix:t="/report",autocompleteProps:r={},tooltipProps:o={},tooltipText:n="Click to search",searchReportParams:a={},callback:s,children:i}){let l=useRouter(),u=l.locale,{localeDefault:p}=we(),m=u===p?"":`/${u}`,d=gv(r?r.itemComponent:null),[f,g]=useState(""),[y,T]=useDebouncedValue(f,500),[C,N]=useState([]),[R,M]=useState(!1),[U,K]=useState(!1),[w,O]=useState(!1),[k,I]=useState(!i),E=()=>{I(!1);},A=()=>{I(!0),j();},z=useRef(),B=useClickOutside(E),D=r?.searchConfig?.searchLimit??10,j=()=>{M(!0);let Z={query:y,format:"profiles",locale:e,limit:D,visible:!0,includes:!0,noImage:!1,variant:[],dimension:[],report:[],all:!1,...a};Nn.get("/api/cms/search/reports",{params:Z}).then(te=>{te&&te.data&&te.data.data&&te.data.data.results&&N(te.data.data.results.map(q=>({id:q.id,reportName:q.report.name,href:`${m}${t}${q.path}`,reportPath:`${q.path}`,profilePrefix:t,value:`VALUE: ${q.id}`,members:q.members.map(x=>({original_id:x.metadata.id,name:x.name,id:x.id,variant:x.metadata.variant.name,image:{src:`/api/cms/member/image?member=${x.id}&size=thumb`,alt:x.name}}))}))),M(!1),z.current?.focus();}).catch(te=>{console.error(te),M(!1);});};useEffect(()=>{w&&y.length>=(r.searchConfig?.queryThreshold??0)&&j();},[w,y,r.searchConfig?.queryThreshold]),useEffect(()=>{T(),z.current&&k&&O(!0);},[]),useEffect(()=>{T(),z.current&&k&&O(!0);},[k]);let V=Z=>{I(!1),s?s(Z):(l.push(Z.href),K(!0));},L=Z=>{Z.includes("VALUE:")||g(Z);},{searchConfig:H,...$}=r,ie={placeholder:"Search",size:"md",icon:jsx(IconSearch,{}),...$,data:C},Y=jsx(Autocomplete,{value:f,itemComponent:d,onItemSubmit:V,onChange:L,filter:()=>!0,disabled:(R||U)&&!w,limit:D,maxDropdownHeight:250,rightSection:jsx(Group,{spacing:0,position:"right",children:R?jsx(Loader,{size:20}):jsx(Fragment,{})}),rightSectionWidth:50,ref:z,...ie});return i?jsx(Tooltip,{label:n,disabled:k,...o,children:jsxs(Group,{ref:B,spacing:"sm",align:"center",style:{cursor:"pointer"},children:[!k&&jsx("div",{onClick:()=>I(!0),children:i}),k&&jsx(Fragment,{children:Y}),k?jsx(ActionIcon,{variant:"light",onClick:E,children:jsx(IconX,{size:20})}):jsx(ActionIcon,{variant:"light",onClick:A,children:jsx(IconSearch,{size:20})})]})}):Y}var gv,Uu,Gu=b(()=>{c();Xr();Du();Ct();gv=e=>{let{components:t}=st(),r=Nu;return t?.ReportItem&&(r=t?.ReportItem),e&&(r=e),r};Uu=hv;});function Sv(){let{components:e}=st(),{modal:t,inline:r}=e?.search??{};return {modal:t,inline:r}}function on(e,t,r,o,n){let a=Sv(),s=Q(m=>({reportId:m.variables.attributes.report_id,variantId:m.variables.attributes.variant_id1,title:m.variables.attributes.name1})),i=useRouter(),l=Xn(),u=Le();return useMemo(()=>{let m=e;return t==="modal"?m=jsx(Bu,{exploreProps:{locale:i.locale||qu,profilePrefix:l,translations:u.explore,initialReportId:s.reportId,initialVariantId:s.variantId,initialQuery:s.title},tooltipText:u.explore?.tooltip,modalProps:a.modal,...n,children:e}):t==="inline"&&(m=jsx(Uu,{locale:i.locale||qu,profilePrefix:l,callback:r,tooltipText:u.explore?.tooltip,...o,autocompleteProps:a.inline,children:e})),m},[t,e])}var qu,Fs=b(()=>{c();vt();ge();Ee();Mu();Gu();Ct();Xr();({localeDefault:qu}=we());});function Vt(){let e=Ye();return useMemo(()=>async t=>await e(nt.readMember(t)),[e])}var Co=b(()=>{c();ge();});function Vs(){let{query:e,locale:t,asPath:r}=useRouter(),{profilePrefix:o}=jr(),{compare:n}=e,a=Q(w=>Object.values(w.records.entities.report)[0]),s=Q(w=>w),i=Mt(s),l=gr(s),u=hr(s),p=At(l,t),m=Vt(),[d,f]=useState(null),[g,y]=useState(null),[T,C]=useState(!!n),[N,R]=useState(!1),[M,U]=useState(!1),K=a.settings;return useEffect(()=>{let w=!1,O=Nn.CancelToken.source();if(K.comparison&&n&&!N){C(!0);let k={cancelToken:O.token};Nn.get(`/api/cms/report?report=${n}&locale=${t}&prefix=${o}`,k).then(I=>{if(!w){let[,E]=r.split("?"),A=E?JSON.parse('{"'+decodeURI(E).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')+'"}'):{},z=Object.fromEntries(Object.entries(A).filter(([j])=>j.match(Wu)).map(([j,V])=>[j.replace("Compare",""),V])),B=Object.entries(A).filter(([j])=>j.match(Wu)).map(([j])=>Number(j.match(/\d+/))),D=I.data.data.variables;B.length?Promise.all(B.map(j=>{let L=i[j].consumers.reduce(($,ie)=>({...$,...D.variables[ie]}),{}),H={locale:t,query:z,variables:{...L,...D.attributes}};return Pt(i,void 0,j,p,H,{variables:D.variables,status:D.status},m,"report",u)})).then(j=>{let V=Object.assign({},...j.map(H=>H.variables)),L=Object.assign({},...j.map(H=>H.status));U(!1),C(!1),R(!0),f({variables:V,attributes:D.attributes,status:L}),y(I.data.data.status);}):(U(!1),C(!1),R(!0),f(I.data.data.variables),y(I.data.data.status));}}).catch(()=>{w||(U(!0),R(!1),C(!1),f(null));});}return n||(f(null),y(null),R(!1)),()=>{w=!0,O.cancel();}},[n,t,o,K.comparison,r,N,m]),{active:!!d,variables:d,status:g,setComparisonVariables:f,comparisonLoaded:N,loading:T,error:M}}var Wu,Ku=b(()=>{c();Wt();ge();Nr();ir();yr();Co();Wu=/\w*Compare\b/;});function Qe(){return useContext(Yu)}function $s({children:e}){let t=Vs();return jsx(Yu.Provider,{value:t,children:e})}var Yu,Zt=b(()=>{c();Ku();Yu=createContext({active:!1,variables:null,status:null,setComparisonVariables:null,comparisonLoaded:!1,loading:!1,error:!1});});function Us({title:e,tooltip:t,slug:r,_iconType:o,_iconVariant:n,_icon:a,settings:s,_iconRadius:i,_iconSize:l,_iconPadding:u,asComparison:p=!1}){let{print:m}=qe(),d=Ue(e)||"<span class='cr-block-placeholder'>Title</span>",f=s&&s.order?parseInt(s.order,10):1,g=f<=6?f:1,y=s&&s.search?s.search:"off",T=s&&s.align?s.align:"left",C=Qe(),N=Q(O=>O.status.previews),M=(p?C.status.previews:N).map(O=>O.name).join(" | "),U=jsxs(Group,{children:[jsx(ke,{blockType:"title",iconType:o,iconVariant:n,iconRadius:i,iconSize:l,icon:a,iconPadding:u}),jsx(se,{id:r||void 0,component:"h",order:g,style:s,html:d})]}),K=on(U,y),w=s&&s.addComparisonName==="yes"&&C.active;return jsxs(Group,{spacing:"sm",position:pt(T),children:[jsxs("div",{children:[m?U:K,w&&jsx(Text,{className:"bespoke-comparison-title",children:M})]}),t&&jsx(Ne,{content:t})]})}var Qu=b(()=>{c();Wr();Yr();Ie();Fs();Zt();ge();Qt();Xt();Ge();});function ea(e,t,r,o=!1,n=!1){let a=useRouter(),{query:s,locale:i}=a,l=Q(E=>E),u=useDispatch(),p=Qe(),m=Q(E=>o&&p.variables?p?.variables?.attributes:E.variables.attributes),d=Mt(l),f=gr(l),g=hr(l),y=At(f,i),T=So(e,o&&p.active?p?.variables.variables:void 0,o&&p.active?p?.variables.attributes:void 0),C=Q(E=>o?p.variables.variables:E.variables.variables),N=Q(E=>o?p.variables.status:E.variables.status),R=Vt(),{sectionVariables:M,resetSectionVariables:U}=Pe(t),{addRunConsumersRunning:K,removeRunConsumersRunning:w}=To(),O=o&&p.active?`${r}Compare`:r,k=o&&p.active?Object.fromEntries(Object.entries(s).filter(([E])=>E.match(Lv)).map(([E,A])=>[E.replace("Compare",""),A])):Object.fromEntries(Object.entries(s).filter(([E])=>E.match(Ov)).map(([E,A])=>[E.replace("Compare",""),A]));return useCallback(E=>{let A={locale:i,query:{...k,[r]:E},variables:T},z=new URLSearchParams(window.location.search);z.set(O,E),window.history.replaceState(null,null,`?${z.toString()}`),K([t]),Pt(d,void 0,e,y,A,{variables:C,status:N},R,"report",g).then(B=>{p.active&&o?p.setComparisonVariables({attributes:m,variables:B.variables,status:B.status}):u(pr.setVariableChange({attributes:m,variables:B.variables,status:B.status})),n&&M&&U(),w([t]);});},[e,t,r,O,s,d,u,y,a,T.attributes,o,n,N,C])}var Lv,Ov,Gs=b(()=>{c();Nr();ge();ir();yr();ho();Ee();Co();Zt();Lv=/\w*Compare\b/,Ov=/selector\d+id/;});function Ws(e){let{name:t,settings:r,options:o,id:n,defaultValue:a,section:s,component:i,asComparison:l,hideLabel:u,resetSectionVars:p}=e,{print:m}=qe(),d=zv(n),f=ea(n,s,d,l,p==="true"),g=l?`${d}Compare`:d,[y,T]=useState(a),[C,N]=useState(Ju(a,[])),R=JSON.stringify(o),M=useMemo(()=>o?.map(I=>({value:I.id,label:I.label,imageUrl:I.imageUrl})),[R]),U=m?o.filter(I=>C.includes(I.id)).map(I=>I.label).join(", "):"",K=m&&y&&o.find(I=>I.id===y)?.label||"",w=e.hideLabel==="true"?jsx(Fragment,{}):jsx(se,{component:"div",html:t,size:"sm",style:r});if(useEffect(()=>{let E=new URLSearchParams(window.location.search).get(g)||a;E&&(e.type===Ce.SINGLE?T(E):N(Ju(E,a)));},[window.location.search,a]),M.length<=1)return jsx(Fragment,{});let O=I=>{N(I),f(I.join(","));},k=I=>{T(I),f(I);};return jsx(Fragment,{children:m?jsxs(Box,{style:{display:"flex",alignItems:"center"},children:[w,jsx(Button,{ml:"sm",radius:"xl",variant:"outline",children:e.type===Ce.SINGLE?K:U})]}):jsx(Box,{children:{[Ce.SINGLE]:i===Ln.SEGMENTED_CONTROL?jsxs("div",{children:[jsx(Text,{size:"sm",fw:500,display:u==="true"?"none":"block",children:w}),jsx(SegmentedControl,{data:M,value:M.map(I=>I.value).includes(y)?y:"",onChange:k,fullWidth:!0})]}):jsx(Select,{label:w,data:M,value:y,itemComponent:Uv,onChange:k,styles:{label:{display:u==="true"?"none":"block"}}}),[Ce.MULTI]:jsx(MultiSelect,{label:w,data:M,value:C,onChange:O,styles:{label:{display:u==="true"?"none":"block"}}})}[e.type]})})}var zv,Ju,Uv,tp=b(()=>{c();Ie();he();Gs();Qt();zv=e=>`selector${e}id`,Ju=(e,t)=>e&&typeof e=="string"?e.split(","):t,Uv=forwardRef(function({imageUrl:t,label:r,...o},n){return jsx("div",{ref:n,...o,children:jsxs(Group,{noWrap:!0,children:[t&&!["","undefined"].includes(t)&&jsx(Box,{component:"img",w:25,h:25,src:t}),jsx("div",{children:jsx(Text,{size:"sm",children:r})})]})})});});function ta(){return jsx("div",{children:"Generator"})}var rp=b(()=>{c();});function Ks(e){let{alt:t,src:r,desc:o,title:n,settings:a,...s}=e,i=Ue(t),l=Ue(r),u=Ue(o),p=jsx("img",{src:l,alt:i,style:s}),m=a&&a.align?String(a.align):"left";return (u&&u.length||n&&n.length)&&(p=jsxs(Stack,{className:"bespoke-Image-wrapper",align:Nt(m),spacing:"sm",children:[n&&jsx(se,{component:"p",html:n,style:a}),p,o&&jsx(se,{component:"p",size:"sm",html:o,style:a})]})),l&&i?p:jsx(Center,{mih:100,bg:"white",children:jsx(Badge,{color:"gray",variant:"outline",children:"IMAGE"},"type")})}var op=b(()=>{c();Wr();Ie();Ge();});function sn(){return sn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);}return e},sn.apply(this,arguments)}var np=b(()=>{c();});function ln(){return ln=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);}return e},ln.apply(this,arguments)}var ap=b(()=>{c();});function Zr(e,t,r){var o,n=(o=r.initialDeps)!=null?o:[],a;return function(){var s;r.key&&r.debug!=null&&r.debug()&&(s=Date.now());var i=e(),l=i.length!==n.length||i.some(function(g,y){return n[y]!==g});if(!l)return a;n=i;var u;if(r.key&&r.debug!=null&&r.debug()&&(u=Date.now()),a=t.apply(void 0,i),r.key&&r.debug!=null&&r.debug()){var p=Math.round((Date.now()-s)*100)/100,m=Math.round((Date.now()-u)*100)/100,d=m/16,f=function(y,T){for(y=String(y);y.length<T;)y=" "+y;return y};console.info("%c\u23F1 "+f(m,5)+" /"+f(p,5)+" ms",`
51
+ `)}));}let k=await Promise.all(O).catch(I=>I.message);if(typeof k=="string"&&k)return {outputVariables:{},renderVariables:{},status:{error:k}};u=k.length===1?k[0].data:k.map(I=>I.data),d=k.reduce((I,E)=>I+JSON.stringify(E.data).length/1024,0),m=Math.max(...k.map(I=>I.requestDuration)),g=k.map(I=>I.apiDataSource?`${I.apiDataSource.name} (${I.apiDataSource.id})`:!1),y=k.map(I=>I.finalUrl);}if(e.type===h.SELECTOR){let{config:A,log:O,error:k}=mo(e.id,e.contentByLocale[a].content.logic,t,r,!0);return {outputVariables:Hl(e.id,i,A),renderVariables:A,status:{log:O,error:k,allowed:l}}}if(e.type===h.MULTIHIERARCHY_SELECTOR){let{config:A,log:O,error:k}=fo(e.id,e.contentByLocale[a].content.logic,t,r,!0);return {outputVariables:Wl(e.id,i,A),renderVariables:A,status:{log:O,error:k,allowed:l}}}if(e.type===h.VIZ)return {outputVariables:{},renderVariables:e.contentByLocale.logic.content,status:{log:[],allowed:l}};if(e.type===h.RELATED){let A=e.contentByLocale?.logic?.content?.simple?.compare||"variant",O=e.contentByLocale?.logic?.content?.simple?.limit||4,k=Object.keys(s).filter(L=>L.startsWith("report_id")).map(L=>s[L]),I=Object.keys(s).filter(L=>L.startsWith("dimension_id")).map(L=>s[L]),E=Object.keys(s).filter(L=>L.startsWith("variant_id")).map(L=>s[L]),w=Object.keys(s).filter(L=>L.startsWith("id")).map(L=>s[L]);if(!w.length)return {outputVariables:{related_reports:[]},renderVariables:{},status:{log:[],allowed:!1}};let z=await Promise.all(w.map((L,q)=>o({mode:"ids",locale:a,ids:[L],output:"lite",variant:[E[q]]}))).then(L=>L.flatMap(q=>{let $=[];return Mn(q)?q.ok&&($=q.data.results):$=q.results,$&&Array.isArray($)?$:[]})).catch(L=>(console.error("Error getting related members",L),[]));if(I.length>1){let L=Object.keys(s).filter(H=>H.startsWith("variant_slug")).map(H=>s[H]),q=z.map((H,x)=>{let P={mode:"related",locale:a,related:O??4,current_ids:[H.content_id],output:"full",variant_ids:[H.variant_id]};return x===0&&(P.include_ids=[H.content_id]),P}),$=await Promise.all(q.map(H=>o(H))).then(H=>H.flatMap(x=>{let P=[];return Mn(x)?x.ok&&(P=x.data.results):P=x.results,P&&Array.isArray(P)?P:[]})).catch(H=>(console.error("Error getting related members",H),[])),ie=$.reduce((H,x)=>{let P=x.variant_slug;return H[P]||(H[P]=[]),H[P].push(x),H},{}),Y=[],re=Object.keys(ie),Z=[{combination:[],index:0}];for(;Z.length>0;){let H=Z.pop();if(!H)continue;let{combination:x,index:P}=H;if(P===re.length){Y.push(x);continue}let G=re[P],J=ie[G];for(let X of J)Z.push({combination:[...x,X],index:P+1});}return {outputVariables:{related_reports:Y.map(H=>{let x=H.sort((P,G)=>L.indexOf(P.variant_slug)-L.indexOf(G.variant_slug));return {entities:x,link:"/"+x.map(P=>`${P.variant_slug}/${P.slug}`).join("/")}})},renderVariables:{},status:{log:[],allowed:$.length>0}}}let B=z.map(L=>L.content_id),D={mode:"related",locale:a,related:O??4,current_ids:B,output:"full"};A&&(A==="report"?D.report_ids=k:A==="dimension"?D.dimension_ids=I:D.variant_ids=E);let j=await o(D).then(L=>{let q=[];return Mn(L)?L.ok&&(q=L.data.results):q=L.results,q&&Array.isArray(q)?q:[]}).catch(L=>(console.error("Error getting related members",L),[]));return {outputVariables:{related_reports:j.map(L=>({entities:[L],link:`/${L.variant_slug}/${L.slug}`}))},renderVariables:{},status:{log:[],allowed:j.length>0}}}let{logic:T}=Be(e,a),C=tt(T,t,r),N=At("resp",u||{},C,t,s,r),{vars:R,error:M,log:U}=N;if(typeof R!="object")return {outputVariables:{},renderVariables:{},status:{error:"Configuration did not return an object",log:U,duration:m,responseSize:d,resp:u,api:f,allowed:l,apiFinalUrls:y,apiDataSources:g}};let K=Object.keys(R).reduce((A,O)=>({...A,[`${e.type}${e.id}${O}`]:R[O]}),{});return {renderVariables:R,outputVariables:[h.GENERATOR,h.SECTION_FLAG].includes(e.type)?R:K,status:{log:U,error:M,duration:m,responseSize:d,resp:u,api:f,allowed:l,apiFinalUrls:y,apiDataSources:g}}}function Dn(e,t,r,o,n,a,s){return e.consumers.forEach(i=>{if(t[i]){let l=`${r}-${i}`;!o.includes(l)&&(t[i].section_id===t[r].section_id||!n)&&o.push(l),e.consumers.filter(u=>t[u]&&t[u].section_id===t[r].section_id||!n).forEach(u=>Qa(u,t,o,!1,a,n,s));}})}var ur,uh,ph,ic,dh,mh,ac,Qa,gh,Pt,Nr=b(()=>{c();Va();uo();he();Ha();Wa();jl();Kl();Uo();po();Mr();Ql();Jl();Ka();tc();An();Go();oc();ur=Hg(process.env.NEXT_PUBLIC_REPORTS_DEBUG),uh=process.env.REPORTS_ORIGIN||"",ph=process.env.NEXT_PUBLIC_REPORTS_AXIOS_RETRIES,ic=5;try{ic=parseInt(`${ph||5}`,10);}catch(e){console.error("Error setting axios retries NEXT_PUBLIC_REPORTS_AXIOS_RETRIES defaults to 5",e);}nc(Nn,{retries:ic,retryDelay:nc.exponentialDelay,onRetry:(e,t,r)=>{console.error("Generator request failed. Retrying... Count: ",e),console.error("URL: ",r.url),console.error(t.message);}});Nn.interceptors.request.use(e=>({...e,requestStart:Date.now()}));Nn.interceptors.response.use(e=>({...e,requestDuration:new Date().getTime()-e.config.requestStart}),e=>Promise.reject(e));dh=(e,t,r)=>{let o=tt(e,t,r);return o.startsWith("http")||(o=`${uh}${o.startsWith("/")?"":"/"}${o}`),o},{urlProxy:mh}=zo("/api/cms");ac=process.env.NEXT_PUBLIC_REPORTS_API_FETCH_TIMEOUT||0;Qa=(e,t,r=[],o=!0,n=!0,a=!0,s=[])=>{if(s.includes(e))return [];s.push(e);let i=t[e];return i&&i.inputs.length&&o&&i.inputs.forEach(l=>{let u=`${l}-${e}`;r.includes(u)||r.push(u),i.inputs.forEach(p=>Qa(p,t,r,o,!1,a,s));}),i&&i.consumers.length&&n&&Dn(i,t,e,r,a,n,s),r},gh=(e,t,r,o)=>{let n=!0;if(e&&"allowed"in e.settings&&e.settings.allowed!=="always")if(e.settings.allowed==="never")n=!1;else {let a=ct(t),{error:s,output:i}=At("variables",r,e.settings.allowedLogic||"return false;",o,void 0,a);s||(n=!!i);}return n},Pt=async(e,t,r,o,n,a={},s,i="section",l)=>{let u=i==="section",p=ct(n),m=p.variables,d={...a.variables??{}},f={...a.status??{}},g=new Set,y=[],T={};r?T={...T,[r]:e[r]}:t?T=(t??[]).reduce((B,{id:D})=>({...B,...Xl(D,e)}),{}):T=Object.values(e).filter(B=>Ya(B)).reduce((B,D)=>({...B,[D.id]:D}),{});let C=Object.values(T).filter(B=>Ya(B));if(C.length>0){ur&&console.info("%crunConsumers: calculating section flags","color:purple",C.map(V=>V.id).join(", "));let B=Object.fromEntries(await Promise.all(C.map(async V=>[V.id,await sc(V,o,{...p,variables:m,locale:m.locale},s,l).then(L=>{let{outputVariables:q,status:$}=L;if($.error){if(typeof window>"u")throw new Error(`Run consumers (Block: ${V.id}, Section ${V.section_id}) failed with message: ${$.error}. `);f[V.id]={allowed:!1,error:$.error},d[V.id]={};}return (V.consumers.length>0||[h.GENERATOR,h.SECTION_FLAG,h.RELATED].includes(V.type))&&$.allowed&&Object.keys(q).length>0?d[V.id]=q:d[V.id]={},i==="report"?(f[V.id]={allowed:$.allowed},[h.GENERATOR,h.SECTION_FLAG].includes(V.type)&&$.api&&(f[V.id].api=$.api)):f[V.id]=$,L})]))),j=Object.entries(B).filter(([,V])=>!V.outputVariables[ec]).map(([V])=>Number(V));g=new Set(j.map(V=>e[V].section_id)),Object.values(T).filter(V=>g.has(V.section_id)).forEach(V=>{y.push(V.id),delete T[V.id];}),ur&&console.info("%crunConsumers: removing sections","color:purple",g.keys());}let N=g.size>0?Object.fromEntries(Object.entries(e).filter(([,B])=>g?.has(B.section_id)?(y.includes(B.id)||y.push(B.id),!1):!0)):e;if(y.length>0&&(N=Object.fromEntries(Object.entries(N).map(([B,D])=>{let j={...D,inputs:D.inputs.filter(V=>!y.includes(V)),consumers:D.consumers.filter(V=>!y.includes(V))};return [B,j]}))),!r&&!t)return {variables:{...a.variables??{},...d},status:{...a.status??{},...f}};i==="report"&&y.length>0&&y.forEach(B=>{delete d[B],delete f[B],delete e[B];}),ur&&console.info("%crunConsumers: running root blocks","color:purple",Object.keys(T));let R=Object.keys(T).reduce((B,D)=>{let j=new Date,V=Qa(Number(D),N,[],!r,!0,u).map($=>$.split("-")),q=(new Date().getTime()-j.getTime())/1e3;return ur&&console.info(`%cResolved dependencies for ${D} (${q.toFixed(2)}s)`,"color:blue"),[...B,...V]},[]),M=new Date,U=Object.keys(T).reduce((B,D)=>B.includes(D)?[...B]:[D,...B],ih(R)),A=(new Date().getTime()-M.getTime())/1e3;ur&&console.info(`%cResolved DAG (${A.toFixed(2)}s): `,"color:green",U);let O=process.env.NEXT_PUBLIC_REPORTS_MAX_CONCURRENT_QUERIES_PER_REPORT,k=parseInt(`${O||0}`,10);async function I(B,D){let j=new Map,V=[],L=async()=>V.length;for(let q of B){if(k!==0){let re=await L();for(;re>=k;)ur&&console.info("Too many pending promises, waiting...",re),await new Promise(Z=>setTimeout(Z,500)),re=await L();}let $=D[q],Y=Promise.all($.inputs.filter(re=>B.includes(String(re))).map(re=>j.get(Number(re)))).then(async()=>{let re=$.inputs.reduce((G,J)=>({...G,...d[J]}),m),Z=$.inputs.find(G=>($.settings?.ignoreCascade?$.settings?.ignoreCascade:[]).includes(G)||!f[G]?!1:!f[G].allowed||f[G].hiddenByCascade);if(Z){f[q]={allowed:!1,hiddenByCascade:f[Z].hiddenByCascade||Z},d[q]={};return}let te=new Date,H=await sc($,o,{...p,variables:re,locale:re.locale},s,l).then(({outputVariables:G,status:J})=>{if(J.error){if(typeof window>"u")throw new Error(`Run consumers (Block: ${q}, Section ${$.section_id}) failed with message: ${J.error}.`);f[q]={allowed:!1,error:J.error},d[q]={};}($.consumers.length>0||[h.GENERATOR,h.SECTION_FLAG,h.RELATED].includes($.type))&&J.allowed&&Object.keys(G).length>0?d[q]=G:d[q]={},i==="report"?(f[q]={allowed:J.allowed},[h.GENERATOR,h.SECTION_FLAG].includes($.type)&&J.api&&(f[q].api=J.api)):f[q]=J;}),P=(new Date().getTime()-te.getTime())/1e3;return ur&&console.info(`%cBlock ${$.id} resolved in ${P.toFixed(3)}s`,P>500?"color:red":"color:green"),f[q].duration=f[q].duration?f[q].duration:P,V.splice(V.indexOf(Number(q)),1),H});V.push(Number(q)),j.set(Number(q),Y);}await Promise.all(Array.from(j.values()));}let E=new Date;await I(U,N);let z=(new Date().getTime()-E.getTime())/1e3;return ur&&console.info(`%cResolved Variables (${z.toFixed(2)}s), ${U.length} blocks`,"color:green"),{variables:{...a.variables??{},...d},status:{...a.status??{},...f}}};});function hh(e=[]){return e.reduce((t,r,o)=>{if(r){let n=o+1;t[`id${n}`]=r.id,t[`name${n}`]=r.name,t[`slug${n}`]=r.slug,"attributes"in r&&Object.keys(r.attributes).forEach(a=>{t[`attr_${a}${n}`]=r.attributes[a];}),t[`variant_id${n}`]=r.variant_id,t[`variant_name${n}`]=r.variant_name,t[`variant_slug${n}`]=r.variant_slug,t[`dimension_id${n}`]=r.dimension_id,t[`dimension_name${n}`]=r.dimension_name,t.report_id=r.report_id,t.report_name=r.report_name;}return t},{})}var lc,cc=b(()=>{c();lc=hh;});var ht,Fn,Vn=b(()=>{c();ht=process.env.NEXT_PUBLIC_REPORTS_LOCALE_DEFAULT||"en",Fn=process.env.NEXT_PUBLIC_REPORTS_LOCALES?.split(",")||[ht];Fn.includes(ht)||Fn.push(ht);});var vh,$n,go,zn=b(()=>{c();Vn();vh={localeDefault:ht,locales:Fn,currentLocale:ht,preferredLocale:ht,showToolbar:!1,activeSection:null,previews:[],query:{},sectionState:{},activeEntity:{type:null,id:null},sidebarStatus:{tools:!0,settings:!1,reportEditor:!1},isCMS:!1,isRunConsumersRunning:[]},$n=createSlice({name:"status",initialState:vh,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]:!0};},closeSidebar(e,t){e.sidebarStatus={...e.sidebarStatus,[t.payload]:!1};},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(r=>!t.payload.includes(r));}},extraReducers:{[HYDRATE]:(e,t)=>({...e,previews:t.payload.status.previews})}}),go=$n.actions;});var xh,Un,pr,ho=b(()=>{c();xh={attributes:{},variables:{},status:{}},Un=createSlice({name:"variables",initialState:xh,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}})}}),pr=Un.actions;});function qo(e,t){return Object.fromEntries(Object.keys(e).map(r=>[r,{...e[r],...t[r]}]))}function Gn(e,t){return e.map(n=>t[n]).sort(Ke).map(n=>n.id)}function Ch(e,t){let r=e.indexOf(t);r>-1&&e.splice(r,1);}var kh,jt,Ho=b(()=>{c();io();ir();kh={tree:[],reports:null,entities:{block:{},dimension:{},report:{},section:{},variant:{},formatter:{},datasource:{}},requests:{block:{},dimension:{},report:{},section:{},variant:{},formatter:{},datasource:{}}},jt=createSlice({name:"records",initialState:kh,reducers:{set:(e,t)=>{let r=t.payload;return {entities:qo(e.entities,r.entities||{}),requests:qo(e.requests,r.requests||{}),reports:r.reports||e.reports,tree:r.tree||e.tree}},setRequest:(e,t)=>{let r=t.payload;e.requests[r.type][r.key]=r;},setCreateRequest(e,t){let r=t.payload;if(e.requests[r.type][r.key]=r,r.status==="SUCCESS"){let o=Array.isArray(r.data)?r.data:[r.data],n=Pn(r.type,o),a=qo(e.entities,n);if(e.entities=a,r.type==="report"){let s=r.data;e.reports?e.reports.indexOf(s.id)===-1&&(e.reports=[...e.reports,s.id]):e.reports=[s.id];}else if(r.type==="dimension"){let s=r.data;e.entities.report[s.report_id].dimensions.push(s.id),e.entities.report[s.report_id].dimensions=Gn(a.report[s.report_id].dimensions,a.dimension);}else if(r.type==="variant"){let s=r.data;e.entities.dimension[s.dimension_id].variants.push(s.id);}else if(r.type==="section"&&!Array.isArray(r.data)){let s=r.data;e.entities.report[s.report_id].sections.push(s.id),e.entities.report[s.report_id].sections=Gn(a.report[s.report_id].sections,a.section);}else if(r.type==="block")if(Array.isArray(r.data)){let s=r.data,i=s[0],l=s.map(u=>u.id);e.entities.section[i.section_id].blocks.concat(l);}else {let s=r.data;e.entities.section[s.section_id].blocks.push(s.id);}}},setReadRequest(e,t){let r=t.payload;if(r.type!=="report"&&(e.requests[r.type][r.key]=r),r.status==="SUCCESS"){let o=Pn(r.type,r.data),n=qo(e.entities,o);e.entities=n;}},setUpdateRequest(e,t){let r=t.payload;if(e.requests[r.type][r.key]=r,r.status==="SUCCESS"){let o=Array.isArray(r.data)?r.data:[r.data],n=Pn(r.type,o),a,s,i;if(r.type==="block"&&!Array.isArray(r.data)){let u=e.entities.block[r.data.id].inputs,p=n.block[r.data.id].inputs;a=u.length!==p.length,a&&(i=u.length>p.length,s=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 l=qo(e.entities,n);if(e.entities=l,r.type==="dimension"){let u=r.data;e.entities.report[u.report_id].dimensions=Gn(l.report[u.report_id].dimensions,l.dimension);}else if(r.type==="section"&&!Array.isArray(r.data)){let u=r.data;e.entities.report[u.report_id].sections=Gn(l.report[u.report_id].sections,l.section);}else if(r.type==="block"&&!Array.isArray(r.data)){let u=r.data;a&&(i?e.entities.block[s].consumers=e.entities.block[s].consumers.filter(p=>p!==u.id):e.entities.block[s].consumers.push(u.id));}}},setDeleteRequest(e,t){let r=t.payload;if(e.requests[r.type][r.key]=r,r.status==="SUCCESS"){let{id:o,parentId:n,parentType:a}=r.data;if(delete e.entities[r.type][o],a&&n!=null){let s=`${r.type}s`;Ch(e.entities[a][n][s],o);}}},removeBlocks:(e,t)=>{let r=t.payload,o={...e.entities.block};return r.forEach(n=>{delete o[n];}),{...e,entities:{...e.entities,block:o}}},addBlocks:(e,t)=>{let r=t.payload;return {...e,entities:{...e.entities,block:{...e.entities.block,...r}}}},removeDataSourceLogic:e=>{let t={...e.entities.datasource};Object.keys(t).forEach(r=>{e.entities.datasource[r].content.useProxy&&(delete e.entities.datasource[r].content.logic,delete e.entities.datasource[r].content.testUrl,delete e.entities.datasource[r].content.access);});}},extraReducers:{[HYDRATE]:(e,t)=>{let r=t.payload.records,o=r.entities;return {entities:o,reports:Object.values(o.report).map(n=>n.id),requests:{block:{},dimension:{},report:{},section:{},variant:{},formatter:{},datasource:{}},tree:r.tree}}}});});function Dr(e,t,r){if(t==="createBulk"||t==="updateBulk"){let n=`${t}${uc(r)}`;return e[n]}let o=`${t}${uc(r)}`;return e[o]}function uc(e){return e[0].toUpperCase()+e.slice(1)}var pc=b(()=>{c();});function Me(e){for(var t=arguments.length,r=Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];if(process.env.NODE_ENV!=="production"){var n=Bh[e],a=n?typeof n=="function"?n.apply(null,r):n:"unknown error nr: "+e;throw Error("[Immer] "+a)}throw Error("[Immer] minified error nr: "+e+(r.length?" "+r.map(function(s){return "'"+s+"'"}).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function yo(e){return !!e&&!!e[rt]}function Vr(e){var t;return !!e&&(function(r){if(!r||typeof r!="object")return !1;var o=Object.getPrototypeOf(r);if(o===null)return !0;var n=Object.hasOwnProperty.call(o,"constructor")&&o.constructor;return n===Object||typeof n=="function"&&Function.toString.call(n)===Mh}(e)||Array.isArray(e)||!!e[vc]||!!(!((t=e.constructor)===null||t===void 0)&&t[vc])||is(e)||ls(e))}function Wo(e,t,r){r===void 0&&(r=!1),vo(e)===0?(r?Object.keys:ms)(e).forEach(function(o){r&&typeof o=="symbol"||t(o,e[o],e);}):e.forEach(function(o,n){return t(n,o,e)});}function vo(e){var t=e[rt];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:is(e)?2:ls(e)?3:0}function rs(e,t){return vo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function wh(e,t){return vo(e)===2?e.get(t):e[t]}function Sc(e,t,r){var o=vo(e);o===2?e.set(t,r):o===3?e.add(r):e[t]=r;}function Ah(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function is(e){return Oh&&e instanceof Map}function ls(e){return _h&&e instanceof Set}function Fr(e){return e.o||e.t}function cs(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Nh(e);delete t[rt];for(var r=ms(t),o=0;o<r.length;o++){var n=r[o],a=t[n];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[n]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[n]});}return Object.create(Object.getPrototypeOf(e),t)}function us(e,t){return t===void 0&&(t=!1),ps(e)||yo(e)||!Vr(e)||(vo(e)>1&&(e.set=e.add=e.clear=e.delete=Ph),Object.freeze(e),t&&Wo(e,function(r,o){return us(o,!0)},!0)),e}function Ph(){Me(2);}function ps(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function It(e){var t=Dh[e];return t||Me(18,e),t}function dc(){return process.env.NODE_ENV==="production"||bo||Me(0),bo}function Za(e,t){t&&(It("Patches"),e.u=[],e.s=[],e.v=t);}function qn(e){os(e),e.p.forEach(Ih),e.p=null;}function os(e){e===bo&&(bo=e.l);}function mc(e){return bo={p:[],l:bo,h:e,m:!0,_:0}}function Ih(e){var t=e[rt];t.i===0||t.i===1?t.j():t.g=!0;}function Ja(e,t){t._=t.p.length;var r=t.p[0],o=e!==void 0&&e!==r;return t.h.O||It("ES5").S(t,e,o),o?(r[rt].P&&(qn(t),Me(4)),Vr(e)&&(e=Hn(t,e),t.l||jn(t,e)),t.u&&It("Patches").M(r[rt].t,e,t.u,t.s)):e=Hn(t,r,[]),qn(t),t.u&&t.v(t.u,t.s),e!==Tc?e:void 0}function Hn(e,t,r){if(ps(t))return t;var o=t[rt];if(!o)return Wo(t,function(i,l){return fc(e,o,t,i,l,r)},!0),t;if(o.A!==e)return t;if(!o.P)return jn(e,o.t,!0),o.t;if(!o.I){o.I=!0,o.A._--;var n=o.i===4||o.i===5?o.o=cs(o.k):o.o,a=n,s=!1;o.i===3&&(a=new Set(n),n.clear(),s=!0),Wo(a,function(i,l){return fc(e,o,n,i,l,r,s)}),jn(e,n,!1),r&&e.u&&It("Patches").N(o,r,e.u,e.s);}return o.o}function fc(e,t,r,o,n,a,s){if(process.env.NODE_ENV!=="production"&&n===r&&Me(5),yo(n)){var i=Hn(e,n,a&&t&&t.i!==3&&!rs(t.R,o)?a.concat(o):void 0);if(Sc(r,o,i),!yo(i))return;e.m=!1;}else s&&r.add(n);if(Vr(n)&&!ps(n)){if(!e.h.D&&e._<1)return;Hn(e,n),t&&t.A.l||jn(e,n);}}function jn(e,t,r){r===void 0&&(r=!1),!e.l&&e.h.D&&e.m&&us(t,r);}function es(e,t){var r=e[rt];return (r?Fr(r):e)[t]}function gc(e,t){if(t in e)for(var r=Object.getPrototypeOf(e);r;){var o=Object.getOwnPropertyDescriptor(r,t);if(o)return o;r=Object.getPrototypeOf(r);}}function ns(e){e.P||(e.P=!0,e.l&&ns(e.l));}function ts(e){e.o||(e.o=cs(e.t));}function as(e,t,r){var o=is(t)?It("MapSet").F(t,r):ls(t)?It("MapSet").T(t,r):e.O?function(n,a){var s=Array.isArray(n),i={i:s?1:0,A:a?a.A:dc(),P:!1,I:!1,R:{},l:a,t:n,k:null,o:null,j:null,C:!1},l=i,u=ss;s&&(l=[i],u=jo);var p=Proxy.revocable(l,u),m=p.revoke,d=p.proxy;return i.k=d,i.j=m,d}(t,r):It("ES5").J(t,r);return (r?r.A:dc()).p.push(o),o}function Lh(e){return yo(e)||Me(22,e),function t(r){if(!Vr(r))return r;var o,n=r[rt],a=vo(r);if(n){if(!n.P&&(n.i<4||!It("ES5").K(n)))return n.t;n.I=!0,o=hc(r,a),n.I=!1;}else o=hc(r,a);return Wo(o,function(s,i){n&&wh(n.t,s)===i||Sc(o,s,t(i));}),a===3?new Set(o):o}(e)}function hc(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return cs(e)}var yc,bo,ds,Oh,_h,bc,Tc,vc,rt,Bh,Mh,ms,Nh,Dh,ss,jo,Fh,ot,Vh,Wn,xc=b(()=>{c();ds=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",Oh=typeof Map<"u",_h=typeof Set<"u",bc=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",Tc=ds?Symbol.for("immer-nothing"):((yc={})["immer-nothing"]=!0,yc),vc=ds?Symbol.for("immer-draftable"):"__$immer_draftable",rt=ds?Symbol.for("immer-state"):"__$immer_state",Bh={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"},Mh=""+Object.prototype.constructor,ms=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Nh=Object.getOwnPropertyDescriptors||function(e){var t={};return ms(e).forEach(function(r){t[r]=Object.getOwnPropertyDescriptor(e,r);}),t},Dh={},ss={get:function(e,t){if(t===rt)return e;var r=Fr(e);if(!rs(r,t))return function(n,a,s){var i,l=gc(a,s);return l?"value"in l?l.value:(i=l.get)===null||i===void 0?void 0:i.call(n.k):void 0}(e,r,t);var o=r[t];return e.I||!Vr(o)?o:o===es(e.t,t)?(ts(e),e.o[t]=as(e.A.h,o,e)):o},has:function(e,t){return t in Fr(e)},ownKeys:function(e){return Reflect.ownKeys(Fr(e))},set:function(e,t,r){var o=gc(Fr(e),t);if(o?.set)return o.set.call(e.k,r),!0;if(!e.P){var n=es(Fr(e),t),a=n?.[rt];if(a&&a.t===r)return e.o[t]=r,e.R[t]=!1,!0;if(Ah(r,n)&&(r!==void 0||rs(e.t,t)))return !0;ts(e),ns(e);}return e.o[t]===r&&(r!==void 0||t in e.o)||Number.isNaN(r)&&Number.isNaN(e.o[t])||(e.o[t]=r,e.R[t]=!0),!0},deleteProperty:function(e,t){return es(e.t,t)!==void 0||t in e.t?(e.R[t]=!1,ts(e),ns(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=Fr(e),o=Reflect.getOwnPropertyDescriptor(r,t);return o&&{writable:!0,configurable:e.i!==1||t!=="length",enumerable:o.enumerable,value:r[t]}},defineProperty:function(){Me(11);},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){Me(12);}},jo={};Wo(ss,function(e,t){jo[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)};}),jo.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Me(13),jo.set.call(this,e,t,void 0)},jo.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Me(14),ss.set.call(this,e[0],t,r,e[0])};Fh=function(){function e(r){var o=this;this.O=bc,this.D=!0,this.produce=function(n,a,s){if(typeof n=="function"&&typeof a!="function"){var i=a;a=n;var l=o;return function(y){var T=this;y===void 0&&(y=i);for(var C=arguments.length,N=Array(C>1?C-1:0),R=1;R<C;R++)N[R-1]=arguments[R];return l.produce(y,function(M){var U;return (U=a).call.apply(U,[T,M].concat(N))})}}var u;if(typeof a!="function"&&Me(6),s!==void 0&&typeof s!="function"&&Me(7),Vr(n)){var p=mc(o),m=as(o,n,void 0),d=!0;try{u=a(m),d=!1;}finally{d?qn(p):os(p);}return typeof Promise<"u"&&u instanceof Promise?u.then(function(y){return Za(p,s),Ja(y,p)},function(y){throw qn(p),y}):(Za(p,s),Ja(u,p))}if(!n||typeof n!="object"){if((u=a(n))===void 0&&(u=n),u===Tc&&(u=void 0),o.D&&us(u,!0),s){var f=[],g=[];It("Patches").M(n,u,f,g),s(f,g);}return u}Me(21,n);},this.produceWithPatches=function(n,a){if(typeof n=="function")return function(u){for(var p=arguments.length,m=Array(p>1?p-1:0),d=1;d<p;d++)m[d-1]=arguments[d];return o.produceWithPatches(u,function(f){return n.apply(void 0,[f].concat(m))})};var s,i,l=o.produce(n,a,function(u,p){s=u,i=p;});return typeof Promise<"u"&&l instanceof Promise?l.then(function(u){return [u,s,i]}):[l,s,i]},typeof r?.useProxies=="boolean"&&this.setUseProxies(r.useProxies),typeof r?.autoFreeze=="boolean"&&this.setAutoFreeze(r.autoFreeze);}var t=e.prototype;return t.createDraft=function(r){Vr(r)||Me(8),yo(r)&&(r=Lh(r));var o=mc(this),n=as(this,r,void 0);return n[rt].C=!0,os(o),n},t.finishDraft=function(r,o){var n=r&&r[rt];process.env.NODE_ENV!=="production"&&(n&&n.C||Me(9),n.I&&Me(10));var a=n.A;return Za(a,o),Ja(void 0,a)},t.setAutoFreeze=function(r){this.D=r;},t.setUseProxies=function(r){r&&!bc&&Me(20),this.O=r;},t.applyPatches=function(r,o){var n;for(n=o.length-1;n>=0;n--){var a=o[n];if(a.path.length===0&&a.op==="replace"){r=a.value;break}}n>-1&&(o=o.slice(n+1));var s=It("Patches").$;return yo(r)?s(r,o):this.produce(r,function(i){return s(i,o)})},e}(),ot=new Fh,Vh=ot.produce,ot.produceWithPatches.bind(ot),ot.setAutoFreeze.bind(ot),ot.setUseProxies.bind(ot),ot.applyPatches.bind(ot),ot.createDraft.bind(ot),ot.finishDraft.bind(ot),Wn=Vh;});function Yo(e){return (t,r)=>{let o=e[t];if(!o)throw new Error(`Attempting to dispatch action for invalid entity type '${t}'`);return o(r)}}function Ur(e,t){return (r,o)=>{let a=o().records.requests[e][t],s=!a||a.status==="UNINITIALIZED"?"LOADING":"FETCHING";r(yt.setRequest({key:t,type:e,status:s}));}}function zr(e,t,r,o){return n=>{typeof window=="object"&&notifications.show({autoClose:3e3,color:"red",id:t,message:o,title:"Error"}),n(yt.setRequest({key:t,type:e,status:"FAILURE",error:{code:r,message:o}}));}}function dr(e){return t=>{let r=gs(e,t);return (o,n,a)=>(o(Ur(e,r)),Dr(a,"create",e)(t).then(i=>(i.ok===!0?o(yt.setCreateRequest({key:r,operation:"create",status:"SUCCESS",type:e,data:i.data})):o(zr(e,r,i.status,i.error)),i)))}}function Uh(e){return t=>{let r=gs(e,t[0]);return (o,n,a)=>(o(Ur(e,r)),Dr(a,"createBulk",e)(t).then(i=>(i.ok===!0?o(yt.setCreateRequest({key:r,operation:"createBulk",status:"SUCCESS",type:e,data:i.data})):o(zr(e,r,i.status,i.error)),i)))}}function Rc(e,t,r){return r.replace(new RegExp(e,"g"),t)}function Gh(e){return e.section_id!==void 0}function qh(e){return e.report_id!==void 0}function Ec(e){return t=>{let{create:r}=t;return (o,n,a)=>dr(e)(r)(o,n,a).then(async i=>{if(i.ok){let{data:l}=i,{id:u}=l,{update:p}=t,m=Oc(e,{id:u});if(o(Ur(e,`${m}`)),e==="block"&&Gh(r)){let d=Wn(p,T=>{T.id=u;}),{contentByLocale:f}=d;f&&(d=Wn(d,T=>{T.id=u,T.contentByLocale=Object.keys(f).reduce((C,N)=>{let R=f?f[N]:{};return C[N]={...R,id:u},C},{});}));let y=d.inputs?.map(T=>({type:T.type,id:T.id,inputAction:{operation:"create",input:{input_id:T.id,block_id:d.id}}}));return y&&y.length>0&&kc(e)([d,...y])(o,n,a).then(()=>mr("section")({id:d.section_id,include:!0})(o,n,a).then(T=>(T.ok&&o(yt.setRequest({key:m,type:e,status:"SUCCESS",data:T.data})),T))),Lt(e)(d)(o,n,a).then(T=>(T.ok&&o(yt.setRequest({key:m,type:e,status:"SUCCESS",data:T.data})),T))}if(e==="section"&&qh(r)){let{id:d}=l,f=Wn(p,T=>{T.id=d;}),{blocks:g}=f,y=g?.map(T=>({type:T.type,blockcol:T.blockcol,blockrow:T.blockrow,section_id:d,locales:Object.keys(T.contentByLocale).map(C=>C)}));return y&&g&&await Uh("block")(y)(o,n,a).then(T=>{if(T.ok){let C=T.data,N=[],R=C.map((M,U)=>{let A={...M},O=A.id,k=g[U];k.contentByLocale&&(A.contentByLocale=Object.keys(k.contentByLocale).reduce((V,L)=>{let q=k.contentByLocale[L];return V[L]={...q,content:{...q.content},id:A.id},V},{}));let{settings:I}=k,{contentByLocale:E,id:w}=A;A.settings=I;let z={id:w,contentByLocale:E,settings:I};return k.inputs.map(V=>V.id).reduce((V,L)=>{let q=g.findIndex($=>$.id===L);return [...V,q]},[]).map(V=>({...C[V],originalBlock:g[V]})).forEach(V=>{let{id:L,type:q,originalBlock:$}=V;if([h.SELECTOR,h.VIZ].includes(q)){if(z.contentByLocale?.logic?.content?.api){let ie=z.contentByLocale?.logic.content.api;z.contentByLocale.logic.content.api=Rc(`(selector${$.id}id)`,`selector${L}id`,ie);}if(z.contentByLocale?.logic?.content?.logic){let ie=z.contentByLocale.logic.content.logic;z.contentByLocale.logic.content.logic=Rc(`(selector${$.id}id)`,`selector${L}id`,ie);}}N.push({id:L,inputAction:{operation:"create",input:{input_id:L,block_id:O}}});}),z});return kc("block")([...R,...N])(o,n,a)}}),Lt(e)(f)(o,n,a).then(T=>(T.ok&&o(yt.setRequest({key:m,type:e,status:"SUCCESS",data:T.data})),T))}return Lt(e)({...p,id:l.id})(o,n,a)}})}}function mr(e){return t=>{let r=Ic(e,t);return (o,n,a)=>{o(Ur(e,r));let s=Dr(a,"read",e);if(typeof s!="function"){let i=`Failed to get valid RPC method for entity "${e}"`;return o(zr(e,r,500,i)),Promise.reject(new Error(i))}return s(t).then(i=>(i.ok===!0?o(yt.setReadRequest({key:r,operation:"read",status:"SUCCESS",type:e,data:i.data})):o(zr(e,r,i.status,i.error)),i))}}}function Lt(e){return t=>{let r=hs(e,t);return (o,n,a)=>(o(Ur(e,r)),Dr(a,"update",e)(t).then(i=>(i.ok===!0?o(yt.setUpdateRequest({key:r,operation:"update",status:"SUCCESS",type:e,data:i.data})):o(zr(e,r,i.status,i.error)),i)))}}function kc(e){return t=>{let r=hs(e,t[0]);return (o,n,a)=>(o(Ur(e,r)),Dr(a,"updateBulk",e)(t).then(i=>(i.ok===!0?o(yt.setUpdateRequest({key:r,operation:"updateBulk",status:"SUCCESS",type:e,data:i.data})):o(zr(e,r,i.status,i.error)),i)))}}function $r(e){return t=>{let r=Lc(e,t);return (o,n,a)=>(o(Ur(e,r)),Dr(a,"delete",e)(t).then(i=>{i.ok===!0?o(yt.setDeleteRequest({key:r,operation:"delete",status:"SUCCESS",type:e,data:i.data})):o(zr(e,r,i.status,i.error));}))}}function gs(e,t){if(e==="variant"){let r=t;return `create(variant, [${r.dimension_id}, ${r.name}])`}return `create(${e}, [${Object.keys(t)}])`}function Ic(e,t={}){let r=t.id==null?null:`'${t.id}'`;return `read(${e}, ${r}, ${!!t.include})`}function hs(e,t){let{id:r,...o}=t;return `update(${e}, ${r}, [${Object.keys(o)}])`}function Lc(e,t){return `delete(${e}, ${t})`}function Oc(e,t){let r=t.id==null?null:`'${t.id}'`;return `clone(${e}, ${r})`}var yt,fs,Cc,Ko,wc,Ac,Pc,ys=b(()=>{c();pc();Ho();xc();he();yt=jt.actions,fs={create:gs,read:Ic,update:hs,delete:Lc,clone:Oc},Cc=Yo({block:dr("block"),dimension:dr("dimension"),formatter:dr("formatter"),report:dr("report"),section:dr("section"),variant:dr("variant"),datasource:dr("datasource")}),Ko=Yo({block:mr("block"),dimension:mr("dimension"),formatter:mr("formatter"),report:mr("report"),section:mr("section"),variant:mr("variant"),datasource:mr("datasource")}),wc=Yo({block:Lt("block"),dimension:Lt("dimension"),formatter:Lt("formatter"),report:Lt("report"),section:Lt("section"),variant:Lt("variant"),datasource:Lt("datasource")}),Ac=Yo({block:$r("block"),dimension:$r("dimension"),formatter:$r("formatter"),report:$r("report"),section:$r("section"),variant:$r("variant"),datasource:$r("datasource")}),Pc=Yo({block:Ec("block"),section:Ec("section")});});var nt={};Na(nt,{addBlockToState:()=>sy,addRunConsumersRunning:()=>bs,cloneEntity:()=>Pc,createEntity:()=>Cc,deleteEntity:()=>Ac,deleteQueryParam:()=>Ss,readEntity:()=>Ko,readEnvSecrets:()=>uy,readMember:()=>Bc,readMetadata:()=>Zh,readPrivateBlocks:()=>iy,readUser:()=>ry,recalculateVariables:()=>Nc,removeBlocksFromState:()=>ay,removeDataSourceLogic:()=>py,removeRunConsumersRunning:()=>vs,reportSearch:()=>Yh,resetSectionState:()=>Qo,revalidateReport:()=>cy,revalidateUrl:()=>ly,searchMember:()=>Qh,searchRegenerate:()=>Xh,searchRole:()=>ey,searchUser:()=>ty,setCurrentLocale:()=>jh,setPreferredLocale:()=>Wh,setPreviews:()=>Hh,setQueryParam:()=>Gr,setSectionState:()=>Xo,setStatus:()=>_c,updateEntity:()=>wc,updateMyData:()=>ny,updateUser:()=>oy,urlProxy:()=>Jh,variantValidateSlug:()=>Kh});function Kh(e,t){return async(r,o,n)=>{let a=await n.validateVariantSlug({dimension:e,slug:t});if("error"in a)throw new Error(a.error);return a.data}}function Yh(e){return async(t,r,o)=>{let n=await o.searchReport(e);if("error"in n)throw new Error(n.error);return n.data}}function Xh(){return async(e,t,r)=>{let o=await r.regenerateSearch(void 0);if("error"in o)throw new Error(o.error);return o.data}}function Bc(e){return async(t,r,o)=>{let n=await o.readMember(e);if("error"in n)throw new Error(n.error);return n.data}}function Qh(e){return async(t,r,o)=>{let n=await o.searchMember(e);if(n.ok===!0)return n.data;throw new Error(n.error)}}async function Mc(e,t,r,o){let n=r().status,a={...n,...o},s={...n.query,...o.query};Object.keys(s).forEach(l=>s[l]===void 0&&delete s[l]);let i={...a,query:s};t(_c(i)),n.activeSection&&t(Nc(e,{query:s}));}function Ss(e,t){return async(r,o)=>Mc(e,r,o,{query:{[t]:void 0}})}function Gr(e,t,r){return async(o,n)=>Mc(e,o,n,{query:{[t]:r}})}function Nc(e,t){return async(r,o)=>{let n=o(),{currentLocale:a}=n.status,s=n.records.entities.block,i=e.formatterFunctions[a],l=e.datasourceFunctions,{parsedParams:u,statusPayload:p}=Al(n.status,t),{sid:m,bid:d,previews:f,query:g}=u;Object.keys(p).length&&r(go.setStatus(p));let y={...lc(f),locale:a,...cr()},T={variables:y,query:g,locale:a};r(go.addRunConsumersRunning([m]));let C=n.records.entities.section[m],N=async R=>r(Bc(R));try{let R=await Pt(s,C&&[C],d,i,T,void 0,N,"section",l),{variables:M,status:U}=R;r(pr.setVariableChange({attributes:y,variables:M,status:U})),r(go.removeRunConsumersRunning([m]));}catch(R){console.error("Error in runConsumers client side: recalculateVariables",R);}}}function Zh(e){return async(t,r,o)=>{let n=await o.readMetadata(e);if("error"in n)throw new Error(n.error);return n.data}}function Jh(e){return async(t,r,o)=>{let n=await o.urlProxy(e);if("error"in n)throw new Error(n.error);return n.data}}function ey(){return async(e,t,r)=>{let o=await r.searchRole("");if("error"in o)throw new Error(o.error);return o.data}}function ty(e){return async(t,r,o)=>{let n=await o.searchUser(e);if("error"in n)throw new Error(n.error);return n.data}}function ry(e){return async(t,r,o)=>{let n=await o.readUser({user_id:e});if("error"in n)throw new Error(n.error);return n.data}}function oy({user:e}){return async(t,r,o)=>{let n=await o.updateUser(e);if("error"in n)throw new Error(n.error);return n.data}}function ny(e){return async(t,r,o)=>{let n=await o.updateMyData(e);if("error"in n)throw new Error(n.error);return n.data}}function ay(e){let{removeBlocks:t}=jt.actions;return async r=>{await r(t(e));}}function sy(e){let{addBlocks:t}=jt.actions;return async r=>{await r(t(e));}}function iy(e){return async(t,r,o)=>{let n=await o.readPrivateBlocks({...e,roles:[]});if("error"in n)throw new Error(n.error);return n.data}}function ly(e){return async(t,r,o)=>{let n=await o.revalidateUrl({target:e.target});if("error"in n)throw new Error(n.error);return n.data}}function cy(e){return async(t,r,o)=>{let n=await o.revalidateReport({reportId:e.reportId,profilePrefix:e.profilePrefix});if("error"in n)throw new Error(n.error);return n.data}}function uy(){return async(e,t,r)=>{let o=await r.readEnvSecrets({});if("error"in o)throw new Error(o.error);return o.data}}function py(){let{removeDataSourceLogic:e}=jt.actions;return async t=>{await t(e());}}var _c,Hh,Xo,Qo,jh,Wh,bs,vs,Zo=b(()=>{c();Nr();cc();Go();ir();zn();ho();Ho();ys();({setStatus:_c,setPreviews:Hh,setSectionState:Xo,resetSectionState:Qo,setCurrentLocale:jh,setPreferredLocale:Wh,addRunConsumersRunning:bs,removeRunConsumersRunning:vs}=go);});function Pe(e){let t=Ye(),r=Q(a=>a.status.sectionState)[e]||{},o=useCallback(a=>{t(Xo({[e]:a}));},[e]),n=useCallback(()=>{t(Qo(e));},[e]);return {sectionVariables:r,setSectionVariables:o,resetSectionVariables:n}}function Vc(e){let t=Ye(),r=Q(l=>l.status.sectionState),o=useMemo(()=>e.reduce((l,u)=>(l[u]=r[u]||{},l),{}),[e,r]),n=useCallback(l=>{t(Xo(l));},[]),a=useCallback(()=>{e.map(u=>Qo(u)).forEach(u=>t(u));},[e]),s=useCallback(l=>u=>{t(Xo({[l]:u}));},[]),i=useCallback(l=>()=>{t(Qo(l));},[]);return {sectionsVariables:o,setSectionsVariables:n,resetSectionsVariables:a,setSectionVariables:s,resetSectionVariables:i}}function To(){let e=Ye(),t=Q(n=>n.status.isRunConsumersRunning),r=useCallback(n=>{e(bs(n));},[]),o=useCallback(n=>{e(vs(n));},[]);return {isRunConsumersRunning:t,addRunConsumersRunning:r,removeRunConsumersRunning:o}}function $c(){return Q(t=>t.status.currentLocale)}function qr(e){return t=>{let r=Ye(),o=useMemo(()=>fs.read(e,{include:!0}),[]),n=useCallback(s=>{let i=Object.values(s.records.entities[e]),l=s.records.requests[e][o]||{key:o,type:e,status:i==null?"UNINITIALIZED":"SUCCESS"},u=t?i.filter(p=>t.includes(p.id)):i;return zc(u,l)},[o]),a=Q(n);return useEffect(()=>{a.isUninitialized&&r(Ko(e,{id:t,include:!0}));},[a.status]),a}}function Hr(e){return t=>{let r=Ye(),o=useMemo(()=>fs.read(e,{id:t,include:!0}),[t]),n=useCallback(s=>{let i=s.records.entities[e][t],l=s.records.requests[e][o]||{key:o,type:e,status:i==null?"UNINITIALIZED":"SUCCESS"};return zc(i,l)},[o]),a=Q(n);return useEffect(()=>(a.isUninitialized&&t!==null&&r(Ko(e,{id:t,include:!0})),()=>{}),[o,a.isUninitialized,r,t]),a}}function zc(e,t){let r={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"?r:t.status==="LOADING"?{...r,data:e}:t.status==="FETCHING"?{...r,data:e}:t.status==="FAILURE"?{...r,error:t.error}:{...r,data:e}}var fy,Ye,Q,xs,Jo,Rs,Es,Yn,bt,So,_t,fr,Xn,Ee=b(()=>{c();Zo();ys();Ho();Wt();Ct();zn();(({localeDefault:fy}=Ae())),Ye=useDispatch,Q=useSelector,xs=qr("report"),Jo=qr("section"),Rs=qr("formatter"),Es=qr("datasource"),Yn=Hr("section"),bt=Hr("block"),So=(e,t=void 0,r=void 0)=>{if(!e)return {};let o=bt(e).data,n=Q(i=>t||i.variables.variables),a=Q(i=>r||i.variables.attributes);return useMemo(()=>o?o.inputs.reduce((i,l)=>({...i,...n[l]}),a):{},[o,a,n])},_t=(e=fy)=>useContext(Bt).formatterFunctions[e],fr=()=>useContext(Bt).datasourceFunctions,Xn=()=>useContext(Bt).profilePrefix;});var Uc,Gc=b(()=>{c();Va();Ho();zn();ho();Uc=()=>configureStore({reducer:{[jt.name]:jt.reducer,[$n.name]:$n.reducer,[Un.name]:Un.reducer},middleware(e){return e({thunk:{extraArgument:zo("/api/cms/")}})}}),createWrapper(Uc);});var qc=b(()=>{c();});var ge=b(()=>{c();Zo();Ee();Gc();qc();});function jc(e){let {pathSegment:t,profilePrefix:r,siteProps:o}=e,n=Rs();Q(p=>p.status.isCMS);let s=Es(),l={...cr()},u=useMemo(()=>({profilePrefix:r,pathSegment:t,siteProps:o,formatterFunctions:Hc.reduce((p,m)=>({...p,[m]:n.data?wt(n.data,m):{}}),{}),datasourceFunctions:(s?.data||[]).sort((p,m)=>p.content.order>m.content.order?1:-1).map(p=>({...p,content:{...p.content,pattern:tt(p.content.pattern,{},{variables:l})}}))}),[n,t,r,o,s]);return jsx(Bt.Provider,{value:u,children:e.children})}function jr(){let e=useContext(Bt);if(e===void 0)throw new Error("useBespoke must be used inside ResourceProvider");return e}var Hc,Ay,Bt,Wt=b(()=>{c();Ct();ir();ge();Go();po();(({locales:Hc}=Ae())),Ay={pathSegment:"path",formatterFunctions:Hc.reduce((e,t)=>({...e,[t]:{}}),{}),datasourceFunctions:[],profilePrefix:"path",siteProps:{}},Bt=createContext(Ay);});function xo(e){return t=>Object.values(t.records.entities[e])}function hr(e){return Object.values(e.records.entities.datasource||[]).sort((t,r)=>t.content.order>r.content.order?1:-1).map(t=>{let r={...Iy};return {...t,content:{...t.content,pattern:tt(t.content.pattern,{},{variables:r})}}})}var Mt,Wc,gr,Iy,yr=b(()=>{c();Go();po();Mt=e=>e.records.entities.block;Wc=xo("block"),gr=xo("formatter"),Iy=cr();});var Ly,Oy,_y,By,Ue,Wr=b(()=>{c();Ly=e=>typeof e=="string"?e.replace(/&nbsp;<\/p>/g,"</p>"):e,Oy=e=>typeof e=="string"&&e==="<p><br></p>"?"":e,_y=e=>typeof e=="string"?e.replace(/^<p>(.*)<\/p>$/,"$1"):e,By=e=>e&&_y(Oy(Ly(e))),Ue=By;});function se({id:e="",component:t="p",order:r=1,size:o="md",html:n,style:a={},append:s=jsx(Fragment,{}),isPreview:i=!1}){let l=Vy(n),u=$y(n,i),p=a&&a.align?String(a.align):"left",m=Text,d={};return t==="h"?(m=Title,d={id:e,order:r}):d={component:t,size:o},jsxs(m,{align:p||l.align||"left",...d,children:[u,s]})}var Vy,$y,Ie=b(()=>{c();Vy=(e="<></>")=>{let t=null,r={replace:o=>(o instanceof Element&&!t&&(t=o.attribs,t.align=o.attribs.style?o.attribs.style.replace("text-align: ",""):"",delete t.children),o)};return e?(Kc(e,r),t):{}},$y=(e="",t=!1)=>{let r={replace:o=>{let{type:n}=o;if(o instanceof Element&&n==="tag"){let{name:a,attribs:s,children:i,parent:l}=o;if(a==="p"&&!l)return jsx(Fragment,{children:domToReact(i,r)});if(a==="a"){let{href:u,target:p}=s,m=u.indexOf("http")===0,d=!!(p&&p==="_blank"),f=jsx(Anchor,{...s,href:s.href,target:"_blank",children:domToReact(i,r)});return m||d||t?f:jsx(Dy,{...s,href:s.href,prefetch:!1,passHref:!0,children:f})}else {if(a==="strong")return jsx(Text,{component:"strong",children:domToReact(i,r)});if(a==="em")return jsx(Text,{component:"em",fs:"italic",children:domToReact(i,r)});if(a==="u")return jsx(Text,{component:"u",td:"underline",children:domToReact(i,r)});if(a==="sup")return jsx(Text,{component:"sup",style:{verticalAlign:"super",fontSize:"0.75em"},children:domToReact(i,r)});if(a==="sub")return jsx(Text,{component:"sub",style:{verticalAlign:"sub",fontSize:"0.75em"},children:domToReact(i,r)});if(a==="span")return jsx(Text,{component:"span",children:domToReact(i,r)});if(a==="br")return jsx("br",{})}return jsx(Fragment,{children:domToReact(i,r)})}else if(o instanceof Text$1&&o.type==="text")return jsx(Fragment,{children:o.data})}};return Kc(e,r)};});function Ne(e){let{content:t,style:r={}}=e,{print:o}=qe(),n=jsx(se,{component:"span",html:t,isPreview:!0}),a=useMemo(()=>o?jsx("div",{className:"bespoke-inner-tooltip-notification",children:jsx(Notification,{icon:jsx(IconInfoCircle,{size:"1.1rem"}),withCloseButton:!1,withBorder:!0,styles:{root:{boxShadow:"none"}},children:n})},"tooltip-notification"):jsx("div",{className:"bespoke-inner-tooltip",style:r,children:jsx(Tooltip,{label:n,withArrow:!0,withinPortal:!0,multiline:!0,maw:220,children:jsx(ActionIcon,{size:"1.5rem",children:jsx(IconInfoCircle,{})})})},"tooltip"),[o,t,r]);return jsx(Fragment,{children:a})}var Xt=b(()=>{c();Qt();Ie();});function Cs({paragraph:e,tooltip:t,settings:r}){let o=Ue(t);return jsx(se,{component:"p",html:e,style:r,append:t?jsx(Ne,{content:o,style:{display:"inline-block",verticalAlign:"bottom"}}):jsx(Fragment,{})})}var Qc=b(()=>{c();Wr();Xt();Ie();});function ke({iconType:e="none",iconVariant:t="transparent",icon:r="",iconRadius:o="md",iconSize:n="md",iconPadding:a="1",blockType:s}){let[i,l]=useState(void 0),u=e==="custom"?r:`/api/cms/read/icons/${e}/icon.svg?name=${r}`,p=/^.*\.svg*$/.test(u)||e==="tabler";return useEffect(()=>{p&&Nn.get(u,{responseType:"text"}).then(d=>d.data).then(l).catch(()=>{});},[e,p,u]),jsx(Fragment,{children:e!=="none"&&r&&r!==""&&!!(i||!p)&&jsx(ThemeIcon,{className:`bespoke-${s}-icon-wrapper`,variant:t,radius:o,size:n,p:parseInt(a),dangerouslySetInnerHTML:i&&p?{__html:i}:void 0,children:p?null:jsx(Image,{src:u,alt:"Title Icon"})})})}var Yr=b(()=>{c();});var br,Zc,Jc,eu,tu,Nt,pt,Ro,Ge=b(()=>{c();he();br={display:{label:"Size",defaultValue:"block",options:[{label:"Full Width",value:"block"},{label:"Inline",value:"inline"}]}},Zc={useProxy:{label:"Use proxy (avoid CORS)",defaultValue:"false",options:[{label:"No",value:"false"},{label:"Yes",value:"true"}]}},{[h.IMAGE]:{...br},[h.PARAGRAPH]:{...br},[h.SUBTITLE]:{...br},[h.SELECTOR]:{...br},[h.STAT]:{...br},[h.VIZ]:{...br},[h.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"}]},...br},[h.GENERATOR]:{...Zc},[h.SECTION_FLAG]:{...Zc},[h.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"}]}},[h.MULTIHIERARCHY_SELECTOR]:{...br}},Jc={left:"flex-start",right:"flex-end",justify:"stretch"},eu={justify:"apart"},tu={justify:"space-between"},Nt=e=>Jc[e]?Jc[e]:e,pt=e=>eu[e]?eu[e]:e,Ro=e=>tu[e]?tu[e]:e;});function As({subtitle:e,title:t,value:r,tooltip:o,settings:n,_iconType:a,_iconVariant:s,_icon:i,_iconRadius:l,_iconSize:u,_iconPadding:p}){if(!t&&!r&&!e)return null;let m=n&&n.align?n.align:"left";return jsxs(Group,{spacing:"md",position:pt(m),children:[jsx(ke,{blockType:"stat",iconType:a,iconVariant:s,iconRadius:l,iconSize:u,icon:i,iconPadding:p}),jsxs(Stack,{spacing:0,children:[t&&jsx(se,{component:"div",size:"md",html:t,style:n}),r&&jsx(se,{component:"div",size:"xl",html:r,style:n}),e&&jsx(se,{component:"div",size:"sm",html:e,style:n})]},"stat"),o&&jsx(Ne,{content:o})]})}var ou=b(()=>{c();Xt();Yr();Ie();Ge();});function Ps({subtitle:e,tooltip:t,settings:r}){let o=e||"<span class='cr-block-placeholder'>Small subtitle.</span>",n=r&&r.align?r.align:"left";return jsxs(Group,{spacing:"sm",position:pt(n),children:[jsx(se,{size:"sm",html:o}),t&&jsx(Ne,{content:t,style:{display:"inline-flex"}})]})}var au=b(()=>{c();Xt();Ie();Ge();});function Le(e){let t=useContext(su);return e?t[e]??t:t}function Is({translations:e,children:t}){return jsx(su.Provider,{value:e||{},children:t})}var su,vt=b(()=>{c();su=createContext({});});function pu({children:e,pageSize:t=10}){let r={profile:void 0,variant:void 0},[o,n]=useState([]),[a,s]=useState(!1),[i,l]=useState(!1),[u,p]=useState({}),[m,d]=useState({}),[f,g]=useState(1),[y,T]=useState(r),[C,N]=useState(""),[R]=useDebouncedValue(C,750),[M,U]=useState([]),[K,A]=useState(Ls),[O,k]=useState(!1),{locale:I}=useRouter(),E=async()=>{try{l(!0),Nn.get("/api/cms/read/metadata").then(Y=>{if(Y&&Y.data&&Y.data.data&&Y.data.data.data){let re=Y.data.data.data.reduce((Z,te)=>(te.dimensions&&te.dimensions.forEach(H=>{H.variants&&H.variants.forEach(x=>{Z[x.id]=x.members_count||0;});}),Z),{});n(Y.data.data.data),p(re),d(re);}l(!1),k(!0);}).catch(Y=>{console.error(Y);});}catch(Y){console.error("Error fetching metadata:",Y),n([]),l(!1),p({}),d({});}},w=Y=>{p(Y||m);},z=useCallback(async(Y,re,Z)=>{!O&&o.length===0&&await E(),T({profile:Y,variant:re}),Z!==""&&N(Z);},[]);useEffect(()=>{let Y=!1;return O&&(s(!0),g(1),B(Y,0)),()=>{Y=!1;}},[R,y,O]),useEffect(()=>{if(O){s(!0);let Y=(f-1)*t;B(!1,Y);}},[f]);let B=async(Y,re)=>{let Z=y.profile&&!Number.isNaN(y.profile)?[y.profile]:[],te=y.variant?typeof y.variant=="string"&&y.variant.includes(",")?y.variant.split(",").map(x=>parseInt(x,10)):[parseInt(y.variant,10)]:[],H={query:R,format:"profiles",locale:I,limit:t,offset:re,visible:!0,includes:!0,noImage:!1,variant:te,dimension:[],report:Z,all:!1,origin:"typesense"};Nn.get("/api/cms/search/reports",{params:H}).then(x=>{if(x&&x.data&&x.data.data&&x.data.data.results&&!Y){let P=x.data.data.results;U(P),p(!C||C===""?!1:x.data.data.meta.variantCount);}s(!1);}).catch(x=>{console.error(x),s(!1);});},D=u||m,j={id:void 0,name:K.filters_all||"ALL"},V=Y=>{let re=Y.reduce((te,H)=>te.reduce((x,P)=>x.concat(H.map(G=>[].concat(P,G))),[])).map(te=>{let H;return Array.isArray(te)?H={id:te.map(x=>x.id).join(","),name:te.map(x=>x.name).join(" / "),members_count:te.reduce((x,P)=>x*(D[P.id]||1),1),ordering:te.reduce((x,P)=>x+P.ordering,0)}:(te.members_count=D[te.id]||0,H={...te,members_count:D[te.id]||0}),H}),Z=re.reduce((te,H)=>te+(H.members_count||0),0);return [{...j,members_count:Z},...re]},L=o.length>1,q=useMemo(()=>{let Y=[];if(!i&&o.length>0&&D){let re=o.filter(Z=>Z.dimensions.length>0).map(Z=>{let te=!1,H=V(Z.dimensions.map(x=>x.variants));return H&&H.length>2&&(te=!0),{id:Z.id,name:Z.dimensions.map(x=>x.name).join(" / "),variants:H,members_count:H.filter(x=>x.id).reduce((x,P)=>x+(P.members_count||0),0),show:te}});Y=[{...j,members_count:re.reduce((Z,te)=>Z+(te.members_count||0),0)},...re];}return Y},[i,D,o,j]),$=useMemo(()=>{let Y;return q&&(y.profile?y.profile&&(Y=q.find(re=>re.id===y.profile),Y&&y.variant&&Y.variants&&(Y=Y.variants.find(re=>re.id===y.variant))):Y=q.find(re=>!re.id)),Y?Y.members_count:t},[y,q]),ie={metadata:o,loadingMetadata:i,setLoadingMetadata:l,loadingItems:a,setLoadingItems:s,resultCount:u,totalCount:m,setResultCount:w,activePage:f,setActivePage:g,pageSize:t,filters:y,setFilters:T,doQuery:B,query:C,setQuery:N,debouncedQuery:R,results:M,currentPageTotal:$,selectorStructure:q,translations:K,setTranslations:Y=>A({...Ls,...Y}),showSelectors:L,initExplore:z};return jsx(uu.Provider,{value:ie,children:e})}var Ls,uu,vr,Eo=b(()=>{c();Ls={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:{}},uu=createContext({metadata:[],loadingItems:!1,setLoadingItems:()=>null,loadingMetadata:!1,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:Ls,setTranslations:()=>null,showSelectors:!0}),vr=()=>useContext(uu);});function fb({translations:e}){let{loadingItems:t,setFilters:r,selectorStructure:o,filters:n,showSelectors:a}=vr(),s=g=>{let y=g===null||Number.isNaN(g)?void 0:parseInt(g,10);y!==n.profile?r({profile:y,variant:void 0}):y&&r({profile:void 0,variant:void 0});},i=g=>{let y=g===null?void 0:typeof g=="string"&&g.includes(",")?g:parseInt(g,10);y!==n.variant?r({...n,variant:y}):y&&r({...n,variant:void 0});},l=g=>g<1e3?g:format$1(e.count_format)(g).replace(/\.0+([a-zA-Z]*)$/,"$1"),u=o.length===2?o[1].id:n.profile,p=u?o.find(g=>g.id===u):void 0,m=p&&p.variants&&n.variant?p.variants.find(g=>g.id===n.variant):void 0,d=useMemo(()=>o.map(g=>({value:String(g.id||""),label:(e?.dimensionIcon?.[g.name]?`${e?.dimensionIcon?.[g.name]} `:"")+(e?.dimension[g.name]||g.name)+(!t&&(!p||g.id===p?.id)?` (${l(g.members_count)})`:"")})),[e,p,o]),f=useMemo(()=>p?.variants?.map(g=>({value:String(g.id||""),label:(e?.variantIcon?.[g.name]?`${e?.variantIcon?.[g.name]} `:"")+(e?.variant[g.name]||g.name)+(!t&&(!m||g.id===m?.id)?` (${l(g.members_count)})`:"")}))??[],[e,m,o]);return jsx(Fragment,{children:a&&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:d,value:String(p?.id||""),onChange:g=>s(g),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:f,value:String(m?.id||""),onChange:g=>i(g),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:o.map(g=>jsxs(Button,{"data-selected":g.id===p?.id?"true":"false","data-report-name":g.name,variant:g.id===p?.id?"outline":"subtle",onClick:()=>s(g.id),rightIcon:g.id&&g.id===p?.id?jsx(IconX,{size:"1rem"}):void 0,leftIcon:e?.dimensionIcon?.[g.name]??void 0,children:[jsx(Text,{span:!0,className:"bespoke-explore-reports-name",dangerouslySetInnerHTML:{__html:e?.dimension[g.name]??g.name}}),!t&&(!p||g.id===p?.id)&&jsx(Text,{span:!0,size:"xs",ml:"0.2rem",className:"bespoke-explore-reports-count",children:`(${l(g.members_count)})`})]},`p-${g.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(g=>jsxs(Button,{"data-selected":g.id===m?.id?"true":"false","data-variant-name":g.name,variant:g.id===m?.id?"outline":"subtle",onClick:()=>i(g.id),rightIcon:g.id&&g.id===m?.id?jsx(IconX,{size:"1rem"}):void 0,leftIcon:e?.variantIcon?.[g.name]?jsx(Text,{span:!0,dangerouslySetInnerHTML:{__html:e.variantIcon[g.name]}}):void 0,children:[jsx(Text,{span:!0,className:"bespoke-explore-variant-name",dangerouslySetInnerHTML:{__html:e?.variant[g.name]??g.name}}),!t&&(!m||g.id===m?.id)&&jsx(Text,{span:!0,size:"xs",ml:"0.2rem",className:"bespoke-explore-variant-count",children:`(${l(g.members_count)})`})]},`v-${g.id}`))})]})})]})})}var bu,vu=b(()=>{c();Eo();bu=fb;});function st(){return useMantineTheme().other.bespokeStyles??{}}var Xr=b(()=>{c();});function _s({reportId:e,reportName:t,members:r,href:o,onClick:n}){let a=r.map(i=>jsx(Image,{src:i.image.src,height:160,imageProps:{loading:"lazy"},alt:i.name},i.id)),s=r.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:!0,children:[jsx(Card.Section,{children:jsx(Group,{grow:!0,spacing:0,children:a})}),jsx(Group,{position:"apart",mt:"md",mb:"xs",children:s}),jsx("a",{href:o,onClick:n,children:jsx(Button,{variant:"light",color:"blue",fullWidth:!0,mt:"md",radius:"md",children:`See ${t} Report`})})]})}function Eb({profile:e,profilePrefix:t,onSelect:r,reportTile:o}){let n=useRouter(),a=n.locale,{localeDefault:s}=Ae(),l=`${a===s?"":`/${a}`}${t}${e.path}`,u=e.members.map(f=>({original_id:f.metadata.id,name:f.name,id:f.id,dimension_id:f.metadata.dimension.id,dimension:f.metadata.dimension.name,variant_id:f.metadata.variant.id,variant:f.metadata.variant.name,image:{src:`/api/cms/member/image?member=${f.id}&size=thumb`,alt:f.name}})),p=f=>{n.push(`${f}`),r&&r();},m=f=>{f.preventDefault(),p(l);},d=Rb(o);return jsx(Grid.Col,{xs:12,sm:6,md:4,lg:4,xl:3,children:jsx(d,{reportId:e.report.id,reportName:e.report.name,members:u,href:l,onClick:m})},e.id)}var Rb,Ru,Bs=b(()=>{c();Xr();Ct();Rb=e=>{let{components:t}=st(),r=_s;return t?.ReportTile&&(r=t?.ReportTile),e&&(r=e),r};Ru=Eb;});function Ib({profilePrefix:e,onSelect:t=()=>{},reportTile:r}){let[o,n]=useState(500),a=useRef(null),{results:s}=vr(),i=a.current?.offsetTop||0,l=50;return useEffect(()=>{let{innerHeight:u}=window;n(u-i-l);},[i]),jsx(ScrollArea,{offsetScrollbars:!0,type:"always",h:o,ref:a,children:jsx(Grid,{align:"stretch",children:s.map(u=>jsx(Ru,{profile:u,profilePrefix:e,reportTile:r,onSelect:t},u.id))})})}var Eu,ku=b(()=>{c();Bs();Eo();Eu=Ib;});function _b(){let{activePage:e,setActivePage:t,pageSize:r,currentPageTotal:o}=vr();return jsx(Group,{position:"center",children:jsx(Pagination,{value:e,onChange:a=>{t(a);},total:Math.ceil(o/r),size:"sm",py:"xs"})})}var wu,Au=b(()=>{c();Eo();wu=_b;});function qb({profilePrefix:e,initialReportId:t,initialVariantId:r,translations:o,onSelect:n,reportTile:a,initialQuery:s}){let i=useRef(),l=vr(),{query:u,setQuery:p,results:m,loadingItems:d,loadingMetadata:f,translations:g,setTranslations:y,initExplore:T}=l;useEffect(()=>{T&&T(t,r,s);},[T]),useEffect(()=>{d||i.current?.focus();},[d]),useEffect(()=>{o&&y(o);},[o]);let C=()=>{p("");};return jsxs(Container,{fluid:!0,pt:"1em",children:[jsx(TextInput,{placeholder:g.search,mb:"md",size:"xl",onChange:N=>p(N.target.value),readOnly:f||d,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:[(f||d)&&jsx(Loader,{size:28}),u&&u!==""&&jsx(ActionIcon,{onClick:C,children:jsx(IconTrash,{size:24})})]}),ref:i}),jsx(bu,{translations:g}),jsx(LoadingOverlay,{visible:f||d}),!d&&m.length===0&&jsx(Alert,{title:g.no_results,color:"blue",children:g.try_another}),jsx(Eu,{profilePrefix:e,onSelect:n,reportTile:a}),jsx(wu,{})]})}var Iu,Lu=b(()=>{c();vu();ku();Au();Eo();Iu=qb;});function Zb({exploreProps:e={profilePrefix:"/",locale:Qb},icon:t=jsx(IconSearch,{size:20}),actionIconProps:r={},modalProps:o={},tooltipProps:n={},tooltipText:a="Click to Explore",showIcon:s=!0,showTooltip:i=!1,children:l}){let[u,p]=useState(!1),m={variant:"light",size:"md",radius:"md",...r},d={fullScreen:!0,opened:u,onClose:()=>p(!1)},f=jsx(ActionIcon,{...m,onClick:()=>p(!0),children:t}),g=s?jsxs(Group,{spacing:"sm",style:{cursor:"pointer"},children:[l,f]}):l;return i&&(g=jsx(Tooltip,{label:a,...n,children:g})),jsxs(Fragment,{children:[jsx(Modal,{...d,...o,children:u&&jsx(Iu,{...e,onSelect:()=>p(!1)})}),jsx("div",{onClick:()=>p(!0),children:l?g:jsx(Fragment,{children:f})})]})}var Qb,Bu,Mu=b(()=>{c();Lu();Ct();({localeDefault:Qb}=Ae());Bu=Zb;});var nv,Nu,Du=b(()=>{c();nv=forwardRef(({id:e,members:t,...r},o)=>{let n=t.map(a=>jsxs(Stack,{align:"center",children:[jsx(Text,{weight:500,children:a.name}),jsx(Badge,{color:"green",variant:"light",children:a.variant})]},a.id));return jsx("div",{ref:o,children:jsx(Group,{position:"apart",grow:!0,...r,children:n})},e)}),Nu=nv;});function hv({locale:e,profilePrefix:t="/report",autocompleteProps:r={},tooltipProps:o={},tooltipText:n="Click to search",searchReportParams:a={},callback:s,children:i}){let l=useRouter(),u=l.locale,{localeDefault:p}=Ae(),m=u===p?"":`/${u}`,d=gv(r?r.itemComponent:null),[f,g]=useState(""),[y,T]=useDebouncedValue(f,500),[C,N]=useState([]),[R,M]=useState(!1),[U,K]=useState(!1),[A,O]=useState(!1),[k,I]=useState(!i),E=()=>{I(!1);},w=()=>{I(!0),j();},z=useRef(),B=useClickOutside(E),D=r?.searchConfig?.searchLimit??10,j=()=>{M(!0);let Z={query:y,format:"profiles",locale:e,limit:D,visible:!0,includes:!0,noImage:!1,variant:[],dimension:[],report:[],all:!1,...a};Nn.get("/api/cms/search/reports",{params:Z}).then(te=>{te&&te.data&&te.data.data&&te.data.data.results&&N(te.data.data.results.map(H=>({id:H.id,reportName:H.report.name,href:`${m}${t}${H.path}`,reportPath:`${H.path}`,profilePrefix:t,value:`VALUE: ${H.id}`,members:H.members.map(x=>({original_id:x.metadata.id,name:x.name,id:x.id,variant:x.metadata.variant.name,image:{src:`/api/cms/member/image?member=${x.id}&size=thumb`,alt:x.name}}))}))),M(!1),z.current?.focus();}).catch(te=>{console.error(te),M(!1);});};useEffect(()=>{A&&y.length>=(r.searchConfig?.queryThreshold??0)&&j();},[A,y,r.searchConfig?.queryThreshold]),useEffect(()=>{T(),z.current&&k&&O(!0);},[]),useEffect(()=>{T(),z.current&&k&&O(!0);},[k]);let V=Z=>{I(!1),s?s(Z):(l.push(Z.href),K(!0));},L=Z=>{Z.includes("VALUE:")||g(Z);},{searchConfig:q,...$}=r,ie={placeholder:"Search",size:"md",icon:jsx(IconSearch,{}),...$,data:C},Y=jsx(Autocomplete,{value:f,itemComponent:d,onItemSubmit:V,onChange:L,filter:()=>!0,disabled:(R||U)&&!A,limit:D,maxDropdownHeight:250,rightSection:jsx(Group,{spacing:0,position:"right",children:R?jsx(Loader,{size:20}):jsx(Fragment,{})}),rightSectionWidth:50,ref:z,...ie});return i?jsx(Tooltip,{label:n,disabled:k,...o,children:jsxs(Group,{ref:B,spacing:"sm",align:"center",style:{cursor:"pointer"},children:[!k&&jsx("div",{onClick:()=>I(!0),children:i}),k&&jsx(Fragment,{children:Y}),k?jsx(ActionIcon,{variant:"light",onClick:E,children:jsx(IconX,{size:20})}):jsx(ActionIcon,{variant:"light",onClick:w,children:jsx(IconSearch,{size:20})})]})}):Y}var gv,Uu,Gu=b(()=>{c();Xr();Du();Ct();gv=e=>{let{components:t}=st(),r=Nu;return t?.ReportItem&&(r=t?.ReportItem),e&&(r=e),r};Uu=hv;});function Sv(){let{components:e}=st(),{modal:t,inline:r}=e?.search??{};return {modal:t,inline:r}}function on(e,t,r,o,n){let a=Sv(),s=Q(m=>({reportId:m.variables.attributes.report_id,variantId:m.variables.attributes.variant_id1,title:m.variables.attributes.name1})),i=useRouter(),l=Xn(),u=Le();return useMemo(()=>{let m=e;return t==="modal"?m=jsx(Bu,{exploreProps:{locale:i.locale||qu,profilePrefix:l,translations:u.explore,initialReportId:s.reportId,initialVariantId:s.variantId,initialQuery:s.title},tooltipText:u.explore?.tooltip,modalProps:a.modal,...n,children:e}):t==="inline"&&(m=jsx(Uu,{locale:i.locale||qu,profilePrefix:l,callback:r,tooltipText:u.explore?.tooltip,...o,autocompleteProps:a.inline,children:e})),m},[t,e])}var qu,Fs=b(()=>{c();vt();ge();Ee();Mu();Gu();Ct();Xr();({localeDefault:qu}=Ae());});function Vt(){let e=Ye();return useMemo(()=>async t=>await e(nt.readMember(t)),[e])}var Co=b(()=>{c();ge();});function Vs(){let{query:e,locale:t,asPath:r}=useRouter(),{profilePrefix:o}=jr(),{compare:n}=e,a=Q(A=>Object.values(A.records.entities.report)[0]),s=Q(A=>A),i=Mt(s),l=gr(s),u=hr(s),p=wt(l,t),m=Vt(),[d,f]=useState(null),[g,y]=useState(null),[T,C]=useState(!!n),[N,R]=useState(!1),[M,U]=useState(!1),K=a.settings;return useEffect(()=>{let A=!1,O=Nn.CancelToken.source();if(K.comparison&&n&&!N){C(!0);let k={cancelToken:O.token};Nn.get(`/api/cms/report?report=${n}&locale=${t}&prefix=${o}`,k).then(I=>{if(!A){let[,E]=r.split("?"),w=E?JSON.parse('{"'+decodeURI(E).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')+'"}'):{},z=Object.fromEntries(Object.entries(w).filter(([j])=>j.match(Wu)).map(([j,V])=>[j.replace("Compare",""),V])),B=Object.entries(w).filter(([j])=>j.match(Wu)).map(([j])=>Number(j.match(/\d+/))),D=I.data.data.variables;B.length?Promise.all(B.map(j=>{let L=i[j].consumers.reduce(($,ie)=>({...$,...D.variables[ie]}),{}),q={locale:t,query:z,variables:{...L,...D.attributes}};return Pt(i,void 0,j,p,q,{variables:D.variables,status:D.status},m,"report",u)})).then(j=>{let V=Object.assign({},...j.map(q=>q.variables)),L=Object.assign({},...j.map(q=>q.status));U(!1),C(!1),R(!0),f({variables:V,attributes:D.attributes,status:L}),y(I.data.data.status);}):(U(!1),C(!1),R(!0),f(I.data.data.variables),y(I.data.data.status));}}).catch(()=>{A||(U(!0),R(!1),C(!1),f(null));});}return n||(f(null),y(null),R(!1)),()=>{A=!0,O.cancel();}},[n,t,o,K.comparison,r,N,m]),{active:!!d,variables:d,status:g,setComparisonVariables:f,comparisonLoaded:N,loading:T,error:M}}var Wu,Ku=b(()=>{c();Wt();ge();Nr();ir();yr();Co();Wu=/\w*Compare\b/;});function Qe(){return useContext(Yu)}function $s({children:e}){let t=Vs();return jsx(Yu.Provider,{value:t,children:e})}var Yu,Zt=b(()=>{c();Ku();Yu=createContext({active:!1,variables:null,status:null,setComparisonVariables:null,comparisonLoaded:!1,loading:!1,error:!1});});function Us({title:e,tooltip:t,slug:r,_iconType:o,_iconVariant:n,_icon:a,settings:s,_iconRadius:i,_iconSize:l,_iconPadding:u,asComparison:p=!1}){let{print:m}=qe(),d=Ue(e)||"<span class='cr-block-placeholder'>Title</span>",f=s&&s.order?parseInt(s.order,10):1,g=f<=6?f:1,y=s&&s.search?s.search:"off",T=s&&s.align?s.align:"left",C=Qe(),N=Q(O=>O.status.previews),M=(p?C.status.previews:N).map(O=>O.name).join(" | "),U=jsxs(Group,{children:[jsx(ke,{blockType:"title",iconType:o,iconVariant:n,iconRadius:i,iconSize:l,icon:a,iconPadding:u}),jsx(se,{id:r||void 0,component:"h",order:g,style:s,html:d})]}),K=on(U,y),A=s&&s.addComparisonName==="yes"&&C.active;return jsxs(Group,{spacing:"sm",position:pt(T),children:[jsxs("div",{children:[m?U:K,A&&jsx(Text,{className:"bespoke-comparison-title",children:M})]}),t&&jsx(Ne,{content:t})]})}var Qu=b(()=>{c();Wr();Yr();Ie();Fs();Zt();ge();Qt();Xt();Ge();});function ea(e,t,r,o=!1,n=!1){let a=useRouter(),{query:s,locale:i}=a,l=Q(E=>E),u=useDispatch(),p=Qe(),m=Q(E=>o&&p.variables?p?.variables?.attributes:E.variables.attributes),d=Mt(l),f=gr(l),g=hr(l),y=wt(f,i),T=So(e,o&&p.active?p?.variables.variables:void 0,o&&p.active?p?.variables.attributes:void 0),C=Q(E=>o?p.variables.variables:E.variables.variables),N=Q(E=>o?p.variables.status:E.variables.status),R=Vt(),{sectionVariables:M,resetSectionVariables:U}=Pe(t),{addRunConsumersRunning:K,removeRunConsumersRunning:A}=To(),O=o&&p.active?`${r}Compare`:r,k=o&&p.active?Object.fromEntries(Object.entries(s).filter(([E])=>E.match(Lv)).map(([E,w])=>[E.replace("Compare",""),w])):Object.fromEntries(Object.entries(s).filter(([E])=>E.match(Ov)).map(([E,w])=>[E.replace("Compare",""),w]));return useCallback(E=>{let w={locale:i,query:{...k,[r]:E},variables:T},z=new URLSearchParams(window.location.search);z.set(O,E),window.history.replaceState(null,null,`?${z.toString()}`),K([t]),Pt(d,void 0,e,y,w,{variables:C,status:N},R,"report",g).then(B=>{p.active&&o?p.setComparisonVariables({attributes:m,variables:B.variables,status:B.status}):u(pr.setVariableChange({attributes:m,variables:B.variables,status:B.status})),n&&M&&U(),A([t]);});},[e,t,r,O,s,d,u,y,a,T.attributes,o,n,N,C])}var Lv,Ov,Gs=b(()=>{c();Nr();ge();ir();yr();ho();Ee();Co();Zt();Lv=/\w*Compare\b/,Ov=/selector\d+id/;});function Ws(e){let{name:t,settings:r,options:o,id:n,defaultValue:a,section:s,component:i,asComparison:l,hideLabel:u,resetSectionVars:p}=e,{print:m}=qe(),d=zv(n),f=ea(n,s,d,l,p==="true"),g=l?`${d}Compare`:d,[y,T]=useState(a),[C,N]=useState(Ju(a,[])),R=JSON.stringify(o),M=useMemo(()=>o?.map(I=>({value:I.id,label:I.label,imageUrl:I.imageUrl})),[R]),U=m?o.filter(I=>C.includes(I.id)).map(I=>I.label).join(", "):"",K=m&&y&&o.find(I=>I.id===y)?.label||"",A=e.hideLabel==="true"?jsx(Fragment,{}):jsx(se,{component:"div",html:t,size:"sm",style:r});if(useEffect(()=>{let E=new URLSearchParams(window.location.search).get(g)||a;E&&(e.type===Ce.SINGLE?T(E):N(Ju(E,a)));},[window.location.search,a]),M.length<=1)return jsx(Fragment,{});let O=I=>{N(I),f(I.join(","));},k=I=>{T(I),f(I);};return jsx(Fragment,{children:m?jsxs(Box,{style:{display:"flex",alignItems:"center"},children:[A,jsx(Button,{ml:"sm",radius:"xl",variant:"outline",children:e.type===Ce.SINGLE?K:U})]}):jsx(Box,{children:{[Ce.SINGLE]:i===Ln.SEGMENTED_CONTROL?jsxs("div",{children:[jsx(Text,{size:"sm",fw:500,display:u==="true"?"none":"block",children:A}),jsx(SegmentedControl,{data:M,value:M.map(I=>I.value).includes(y)?y:"",onChange:k,fullWidth:!0})]}):jsx(Select,{label:A,data:M,value:y,itemComponent:Uv,onChange:k,styles:{label:{display:u==="true"?"none":"block"}}}),[Ce.MULTI]:jsx(MultiSelect,{label:A,data:M,value:C,onChange:O,styles:{label:{display:u==="true"?"none":"block"}}})}[e.type]})})}var zv,Ju,Uv,tp=b(()=>{c();Ie();he();Gs();Qt();zv=e=>`selector${e}id`,Ju=(e,t)=>e&&typeof e=="string"?e.split(","):t,Uv=forwardRef(function({imageUrl:t,label:r,...o},n){return jsx("div",{ref:n,...o,children:jsxs(Group,{noWrap:!0,children:[t&&!["","undefined"].includes(t)&&jsx(Box,{component:"img",w:25,h:25,src:t}),jsx("div",{children:jsx(Text,{size:"sm",children:r})})]})})});});function ta(){return jsx("div",{children:"Generator"})}var rp=b(()=>{c();});function Ks(e){let{alt:t,src:r,desc:o,title:n,settings:a,...s}=e,i=Ue(t),l=Ue(r),u=Ue(o),p=jsx("img",{src:l,alt:i,style:s}),m=a&&a.align?String(a.align):"left";return (u&&u.length||n&&n.length)&&(p=jsxs(Stack,{className:"bespoke-Image-wrapper",align:Nt(m),spacing:"sm",children:[n&&jsx(se,{component:"p",html:n,style:a}),p,o&&jsx(se,{component:"p",size:"sm",html:o,style:a})]})),l&&i?p:jsx(Center,{mih:100,bg:"white",children:jsx(Badge,{color:"gray",variant:"outline",children:"IMAGE"},"type")})}var op=b(()=>{c();Wr();Ie();Ge();});function sn(){return sn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);}return e},sn.apply(this,arguments)}var np=b(()=>{c();});function ln(){return ln=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);}return e},ln.apply(this,arguments)}var ap=b(()=>{c();});function Zr(e,t,r){var o,n=(o=r.initialDeps)!=null?o:[],a;return function(){var s;r.key&&r.debug!=null&&r.debug()&&(s=Date.now());var i=e(),l=i.length!==n.length||i.some(function(g,y){return n[y]!==g});if(!l)return a;n=i;var u;if(r.key&&r.debug!=null&&r.debug()&&(u=Date.now()),a=t.apply(void 0,i),r.key&&r.debug!=null&&r.debug()){var p=Math.round((Date.now()-s)*100)/100,m=Math.round((Date.now()-u)*100)/100,d=m/16,f=function(y,T){for(y=String(y);y.length<T;)y=" "+y;return y};console.info("%c\u23F1 "+f(m,5)+" /"+f(p,5)+" ms",`
52
52
  font-size: .6rem;
53
53
  font-weight: bold;
54
- color: hsl(`+Math.max(0,Math.min(120-120*d,120))+"deg 100% 31%);",r?.key);}return r==null||r.onChange==null||r.onChange(a),a}}function ra(e,t){if(e===void 0)throw new Error("Unexpected undefined"+(t?": "+t:""));return e}var sp,ip=b(()=>{c();sp=function(t,r){return Math.abs(t-r)<1};});function Xv(e){for(var t=e.measurements,r=e.outerSize,o=e.scrollOffset,n=t.length-1,a=function(u){return t[u].start},s=dp(0,n,a,o),i=s;i<n&&t[i].end<o+r;)i++;return {startIndex:s,endIndex:i}}var Kv,cn,lp,cp,Yv,up,pp,dp,Ys=b(()=>{c();ap();ip();Kv=function(t){return t},cn=function(t){for(var r=Math.max(t.startIndex-t.overscan,0),o=Math.min(t.endIndex+t.overscan,t.count-1),n=[],a=r;a<=o;a++)n.push(a);return n},lp=function(t,r){var o=t.scrollElement;if(o){var n=function(i){var l=i.width,u=i.height;r({width:Math.round(l),height:Math.round(u)});};n(o.getBoundingClientRect());var a=new ResizeObserver(function(s){var i=s[0];if(i!=null&&i.borderBoxSize){var l=i.borderBoxSize[0];if(l){n({width:l.inlineSize,height:l.blockSize});return}}n(o.getBoundingClientRect());});return a.observe(o,{box:"border-box"}),function(){a.unobserve(o);}}},cp=function(t,r){var o=t.scrollElement;if(o){var n=function(){r(o[t.options.horizontal?"scrollLeft":"scrollTop"]);};return n(),o.addEventListener("scroll",n,{passive:!0}),function(){o.removeEventListener("scroll",n);}}},Yv=function(t,r,o){if(r!=null&&r.borderBoxSize){var n=r.borderBoxSize[0];if(n){var a=Math.round(n[o.options.horizontal?"inlineSize":"blockSize"]);return a}}return Math.round(t.getBoundingClientRect()[o.options.horizontal?"width":"height"])},up=function(t,r,o){var n,a,s=r.adjustments,i=s===void 0?0:s,l=r.behavior,u=t+i;(n=o.scrollElement)==null||n.scrollTo==null||n.scrollTo((a={},a[o.options.horizontal?"left":"top"]=u,a.behavior=l,a));},pp=function(t){var r=this;this.unsubs=[],this.scrollElement=null,this.isScrolling=!1,this.isScrollingTimeoutId=null,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollDirection=null,this.scrollAdjustments=0,this.measureElementCache=new Map,this.observer=function(){var o=null,n=function(){return o||(typeof ResizeObserver<"u"?o=new ResizeObserver(function(s){s.forEach(function(i){r._measureElement(i.target,i);});}):null)};return {disconnect:function(){var s;return (s=n())==null?void 0:s.disconnect()},observe:function(s){var i;return (i=n())==null?void 0:i.observe(s,{box:"border-box"})},unobserve:function(s){var i;return (i=n())==null?void 0:i.unobserve(s)}}}(),this.range={startIndex:0,endIndex:0},this.setOptions=function(o){Object.entries(o).forEach(function(n){var a=n[0],s=n[1];typeof s>"u"&&delete o[a];}),r.options=ln({debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Kv,rangeExtractor:cn,onChange:function(){},measureElement:Yv,initialRect:{width:0,height:0},scrollMargin:0,scrollingDelay:150,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1},o);},this.notify=function(){r.options.onChange==null||r.options.onChange(r);},this.cleanup=function(){r.unsubs.filter(Boolean).forEach(function(o){return o()}),r.unsubs=[],r.scrollElement=null;},this._didMount=function(){return r.measureElementCache.forEach(r.observer.observe),function(){r.observer.disconnect(),r.cleanup();}},this._willUpdate=function(){var o=r.options.getScrollElement();r.scrollElement!==o&&(r.cleanup(),r.scrollElement=o,r._scrollToOffset(r.scrollOffset,{adjustments:void 0,behavior:void 0}),r.unsubs.push(r.options.observeElementRect(r,function(n){var a=r.scrollRect;r.scrollRect=n,(r.options.horizontal?n.width!==a.width:n.height!==a.height)&&r.maybeNotify();})),r.unsubs.push(r.options.observeElementOffset(r,function(n){r.scrollAdjustments=0,r.scrollOffset!==n&&(r.isScrollingTimeoutId!==null&&(clearTimeout(r.isScrollingTimeoutId),r.isScrollingTimeoutId=null),r.isScrolling=!0,r.scrollDirection=r.scrollOffset<n?"forward":"backward",r.scrollOffset=n,r.maybeNotify(),r.isScrollingTimeoutId=setTimeout(function(){r.isScrollingTimeoutId=null,r.isScrolling=!1,r.scrollDirection=null,r.maybeNotify();},r.options.scrollingDelay));})));},this.getSize=function(){return r.scrollRect[r.options.horizontal?"width":"height"]},this.memoOptions=Zr(function(){return [r.options.count,r.options.paddingStart,r.options.scrollMargin,r.options.getItemKey]},function(o,n,a,s){return r.pendingMeasuredCacheIndexes=[],{count:o,paddingStart:n,scrollMargin:a,getItemKey:s}},{key:!1}),this.getFurthestMeasurement=function(o,n){for(var a=new Map,s=new Map,i=n-1;i>=0;i--){var l=o[i];if(!a.has(l.lane)){var u=s.get(l.lane);if(u==null||l.end>u.end?s.set(l.lane,l):l.end<u.end&&a.set(l.lane,!0),a.size===r.options.lanes)break}}return s.size===r.options.lanes?Array.from(s.values()).sort(function(p,m){return p.end-m.end})[0]:void 0},this.getMeasurements=Zr(function(){return [r.memoOptions(),r.itemSizeCache]},function(o,n){var a=o.count,s=o.paddingStart,i=o.scrollMargin,l=o.getItemKey,u=r.pendingMeasuredCacheIndexes.length>0?Math.min.apply(Math,r.pendingMeasuredCacheIndexes):0;r.pendingMeasuredCacheIndexes=[];for(var p=r.measurementsCache.slice(0,u),m=u;m<a;m++){var d=l(m),f=r.options.lanes===1?p[m-1]:r.getFurthestMeasurement(p,m),g=f?f.end:s+i,y=n.get(d),T=typeof y=="number"?y:r.options.estimateSize(m),C=g+T,N=f?f.lane:m%r.options.lanes;p[m]={index:m,start:g,size:T,end:C,key:d,lane:N};}return r.measurementsCache=p,p},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:function(){return r.options.debug}}),this.calculateRange=Zr(function(){return [r.getMeasurements(),r.getSize(),r.scrollOffset]},function(o,n,a){return r.range=Xv({measurements:o,outerSize:n,scrollOffset:a})},{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:function(){return r.options.debug}}),this.maybeNotify=Zr(function(){var o=r.calculateRange();return [o.startIndex,o.endIndex,r.isScrolling]},function(){r.notify();},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:function(){return r.options.debug},initialDeps:[this.range.startIndex,this.range.endIndex,this.isScrolling]}),this.getIndexes=Zr(function(){return [r.options.rangeExtractor,r.calculateRange(),r.options.overscan,r.options.count,r.getSize()]},function(o,n,a,s,i){return i===0?[]:o(ln({},n,{overscan:a,count:s}))},{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:function(){return r.options.debug}}),this.indexFromElement=function(o){var n=r.options.indexAttribute,a=o.getAttribute(n);return a?parseInt(a,10):(console.warn("Missing attribute name '"+n+"={index}' on measured element."),-1)},this._measureElement=function(o,n){var a=r.measurementsCache[r.indexFromElement(o)];if(!a||!o.isConnected){r.measureElementCache.forEach(function(l,u){l===o&&(r.observer.unobserve(o),r.measureElementCache.delete(u));});return}var s=r.measureElementCache.get(a.key);s!==o&&(s&&r.observer.unobserve(s),r.observer.observe(o),r.measureElementCache.set(a.key,o));var i=r.options.measureElement(o,n,r);r.resizeItem(a,i);},this.resizeItem=function(o,n){var a,s=(a=r.itemSizeCache.get(o.key))!=null?a:o.size,i=n-s;i!==0&&(o.start<r.scrollOffset&&(process.env.NODE_ENV!=="production"&&r.options.debug&&console.info("correction",i),r._scrollToOffset(r.scrollOffset,{adjustments:r.scrollAdjustments+=i,behavior:void 0})),r.pendingMeasuredCacheIndexes.push(o.index),r.itemSizeCache=new Map(r.itemSizeCache.set(o.key,n)),r.notify());},this.measureElement=function(o){o&&r._measureElement(o,void 0);},this.getVirtualItems=Zr(function(){return [r.getIndexes(),r.getMeasurements()]},function(o,n){for(var a=[],s=0,i=o.length;s<i;s++){var l=o[s],u=n[l];a.push(u);}return a},{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:function(){return r.options.debug}}),this.getVirtualItemForOffset=function(o){var n=r.getMeasurements();return ra(n[dp(0,n.length-1,function(a){return ra(n[a]).start},o)])},this.getOffsetForAlignment=function(o,n){var a=r.getSize();n==="auto"&&(o<=r.scrollOffset?n="start":o>=r.scrollOffset+a?n="end":n="start"),n==="start"?o=o:n==="end"?o=o-a:n==="center"&&(o=o-a/2);var s=r.options.horizontal?"scrollWidth":"scrollHeight",i=r.scrollElement?"document"in r.scrollElement?r.scrollElement.document.documentElement[s]:r.scrollElement[s]:0,l=i-r.getSize();return Math.max(Math.min(l,o),0)},this.getOffsetForIndex=function(o,n){n===void 0&&(n="auto"),o=Math.max(0,Math.min(o,r.options.count-1));var a=ra(r.getMeasurements()[o]);if(n==="auto")if(a.end>=r.scrollOffset+r.getSize()-r.options.scrollPaddingEnd)n="end";else if(a.start<=r.scrollOffset+r.options.scrollPaddingStart)n="start";else return [r.scrollOffset,n];var s=n==="end"?a.end+r.options.scrollPaddingEnd:a.start-r.options.scrollPaddingStart;return [r.getOffsetForAlignment(s,n),n]},this.isDynamicMode=function(){return r.measureElementCache.size>0},this.cancelScrollToIndex=function(){r.scrollToIndexTimeoutId!==null&&(clearTimeout(r.scrollToIndexTimeoutId),r.scrollToIndexTimeoutId=null);},this.scrollToOffset=function(o,n){var a=n===void 0?{}:n,s=a.align,i=s===void 0?"start":s,l=a.behavior;r.cancelScrollToIndex(),l==="smooth"&&r.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),r._scrollToOffset(r.getOffsetForAlignment(o,i),{adjustments:void 0,behavior:l});},this.scrollToIndex=function(o,n){var a=n===void 0?{}:n,s=a.align,i=s===void 0?"auto":s,l=a.behavior;o=Math.max(0,Math.min(o,r.options.count-1)),r.cancelScrollToIndex(),l==="smooth"&&r.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");var u=r.getOffsetForIndex(o,i),p=u[0],m=u[1];r._scrollToOffset(p,{adjustments:void 0,behavior:l}),l!=="smooth"&&r.isDynamicMode()&&(r.scrollToIndexTimeoutId=setTimeout(function(){r.scrollToIndexTimeoutId=null;var d=r.measureElementCache.has(r.options.getItemKey(o));if(d){var f=r.getOffsetForIndex(o,m),g=f[0];sp(g,r.scrollOffset)||r.scrollToIndex(o,{align:m,behavior:l});}else r.scrollToIndex(o,{align:m,behavior:l});}));},this.scrollBy=function(o,n){var a=n===void 0?{}:n,s=a.behavior;r.cancelScrollToIndex(),s==="smooth"&&r.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),r._scrollToOffset(r.scrollOffset+o,{adjustments:void 0,behavior:s});},this.getTotalSize=function(){var o;return (((o=r.getMeasurements()[r.options.count-1])==null?void 0:o.end)||r.options.paddingStart)-r.options.scrollMargin+r.options.paddingEnd},this._scrollToOffset=function(o,n){var a=n.adjustments,s=n.behavior;r.options.scrollToFn(o,{behavior:s,adjustments:a},r);},this.measure=function(){r.itemSizeCache=new Map,r.notify();},this.setOptions(t),this.scrollRect=this.options.initialRect,this.scrollOffset=this.options.initialOffset,this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(function(o){r.itemSizeCache.set(o.key,o.size);}),this.maybeNotify();},dp=function(t,r,o,n){for(;t<=r;){var a=(t+r)/2|0,s=o(a);if(s<n)t=a+1;else if(s>n)r=a-1;else return a}return t>0?t-1:0};});function Zv(e){var t=Jt.useReducer(function(){return {}},{})[1],r=sn({},e,{onChange:function(s){t(),e.onChange==null||e.onChange(s);}}),o=Jt.useState(function(){return new pp(r)}),n=o[0];return n.setOptions(r),Jt.useEffect(function(){return n._didMount()},[]),Qv(function(){return n._willUpdate()}),n}function oa(e){return Zv(sn({observeElementRect:lp,observeElementOffset:cp,scrollToFn:up},e))}var Qv,Xs=b(()=>{c();np();Ys();Ys();Qv=typeof document<"u"?Jt.useLayoutEffect:Jt.useEffect;});function Qs(e,t,r,o,n=!1){let a=useRouter(),{query:s,locale:i}=a,l=Q(A=>A),u=useDispatch(),p=Qe(),m=Q(A=>o&&p.variables?p?.variables?.attributes:A.variables.attributes),d=Mt(l),f=gr(l),g=hr(l),y=At(f,i),T=So(e,o&&p.active?p?.variables.variables:void 0,o&&p.active?p?.variables.attributes:void 0),C=Q(A=>o?p.variables.variables:A.variables.variables),N=Q(A=>o?p.variables.status:A.variables.status),R=Vt(),{sectionVariables:M,resetSectionVariables:U}=Pe(t),{addRunConsumersRunning:K,removeRunConsumersRunning:w}=To(),O=o&&p.active?`${r}-valueCompare`:`${r}-value`,k=o&&p.active?`${r}-typeCompare`:`${r}-type`,I=o&&p.active?Object.fromEntries(Object.entries(s).filter(([A])=>A.match(rS)).map(([A,z])=>[A.replace("Compare",""),z])):Object.fromEntries(Object.entries(s).filter(([A])=>A.match(oS)).map(([A,z])=>[A.replace("Compare",""),z]));return useCallback((A,z)=>{let B={locale:i,query:{...I,[`${r}-type`]:z,[`${r}-value`]:A},variables:T},D=new URLSearchParams(window.location.search);A&&z?(D.set(O,A.join(",")),D.set(k,z)):(D.delete(O),D.delete(k)),window.history.replaceState(null,null,`?${D.toString()}`),K([t]),Pt(d,void 0,e,y,B,{variables:C,status:N},R,"report",g).then(j=>{n&&M&&U(),p.active&&o?p.setComparisonVariables({attributes:m,variables:j.variables,status:j.status}):u(pr.setVariableChange({attributes:m,variables:j.variables,status:j.status})),w([t]);});},[o,m,e,d,p,u,y,N,C,i,I,R,r,k,O,T,M,n,U])}var rS,oS,mp=b(()=>{c();Zt();Co();Nr();ge();Ee();ir();yr();ho();rS=/\w*Compare\b/,oS=/multihierarchySelector\d+(id|-(type|value))/;});function ei(e){let{allLabel:t,asComparison:r,colorKey:o,data:n,defaultValue:a,defaultValueType:s,hideLabel:i,resetSectionVars:l,iconKey:u,id:p,levels:m,limit:d,placeholder:f,searchIndexKey:g,searchIndexSeparator:y,section:T,settings:C}=e,{print:N}=qe(),R=yS(p),M=Qs(p,T,R,r,l==="true"),U=r?`${R}-valueCompare`:`${R}-value`,K=r?`${R}-typeCompare`:`${R}-type`,w=useMantineTheme(),[O,k]=useState(!1),[I,E]=useState(!0),[A,z]=useState(""),[B,D]=useState(!1),[j,V]=useState([""].slice(1)),[L,H]=useState([]),[$,ie]=useState(""),Y=useMemo(()=>N?Array.from(new Set(n.filter(ne=>L.includes(ne[`${$} ID`])))).map(ne=>ne?.[$]).join(", "):"",[N]),re=i==="true"||!e.label?jsx(Fragment,{}):jsx(se,{component:"div",html:e.label,size:"sm",style:C}),Z=useRef(null),te=useRef(!1),q=useRef(!!d&&d<L.length),x=j.length,P=m[x],G=j.filter(Boolean);j.length>0&&G.length===0&&G.push(`${t} ${P?.label}`),useEffect(()=>{let _=new URLSearchParams(window.location.search),ne=_.get(U)||a,oe=_.get(K)||s;ne&&oe?(H(bS(ne,a)),ie(oe)):(H([]),ie(""));},[window.location.search,a,s]),useEffect(()=>{let _=()=>{E(!0);};return window.addEventListener("touchmove",_),()=>{window.removeEventListener("touchmove",_);}},[]);let J=useMemo(()=>fS(n,m,o,u,g,y),[o,n,u,m,g,y]),X=useMemo(()=>{let _=gS(A),ne=Array.from(hS(J,_)).reverse();return B?ne:j.reduce((oe,We)=>oe.filter(be=>!We||be.searchindex.indexOf(We)>-1),ne.filter(oe=>oe.type===P?.value))},[P,J,A,B,j]),le=useRef(null),de=oa({count:O?X.length:0,estimateSize:()=>30,getScrollElement:useCallback(()=>le.current,[]),overscan:10,rangeExtractor:useCallback(_=>cn(_),[])}),[ze,ye]=useState(-1),ve=Math.min(ze,X.length-1),Je=useCallback(_=>{let ne=j.concat(_);B&&D(!1),V(ne);},[B,j]),et=useCallback(()=>{let _=j.slice(0,x-1);B&&D(!1),V(_);},[B,j,x]),it=useCallback(_=>{z(_.currentTarget.value),!q.current&&n.length>0&&k(!0);},[n,z,q,k]),Ar=useCallback(()=>{z(""),M([],""),Z.current?.focus(),d&&(q.current=!1);},[z,M,Z,d,q]),Ht=useCallback(_=>{let ne=L.filter(oe=>oe!==_);ne.length>0?M(ne,$):M([],""),d&&ne.length<d&&(q.current=!1);},[L,$,M,d,q]),lt=useCallback(_=>{$!==_.type?M([_.value],_.type):L.includes(_.value)?Ht(_.value):d?(L.length<d&&M([...L,_.value],$),L.length===d&&M([...L.slice(1),_.value],$)):M([...L,_.value],$),z("");},[M,$,L,Ht,d]),or=useCallback(()=>{L.length>0&&A.length===0&&(M(L.slice(0,-1),$),k(!0),d&&(q.current=!1)),A.length>0&&z(A.slice(0,-1));},[M,L,$,A,z,k,d,q]),nr=useCallback(()=>{E(_=>_&&(te.current=_,!_)),ye(_=>_+1>=X.length?_:_+1);},[ye,X]),wr=useCallback(()=>{let _=X[ve];_&&lt(_);},[X,ve,lt]),no=useCallback(()=>{k(!1);},[k]),_e=useCallback(()=>{et(),ye(0);},[ye,et]),ao=useCallback(()=>{let _=X[ve];!B&&_&&_.type!==m[m.length-1]?.value&&(Je(_.name),ye(0));},[X,ve,B,m,ye,Je]),so=useCallback(()=>{E(_=>_&&(te.current=_,!_)),ye(_=>_-1<0?0:_-1);},[ye]),ar=({label:_,onRemove:ne,...oe})=>jsxs("div",{style:{alignItems:"center",backgroundColor:w.colorScheme==="dark"?w.colors.dark[7]:w.colors.gray[1],borderRadius:w.radius.sm,cursor:"default",color:w.colorScheme==="dark"?w.colors.dark[0]:w.colors.gray[7],display:"flex",fontSize:rem(12),fontWeight:500,height:rem(22),margin:`calc(${w.spacing.xs} / 2 - ${rem(2)}) calc(${w.spacing.xs} / 2)`,maxWidth:`calc(100% - ${rem(10)})`,paddingLeft:`calc(${w.spacing.sm} / 1.5)`,paddingRight:0,userSelect:"none"},...oe,children:[jsx("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:_}),jsx(CloseButton,{"aria-hidden":!0,iconSize:"70%",onMouseDown:ne,radius:2,size:"sm",sx:{color:w.colorScheme==="dark"?w.colors.dark[0]:w.colors.gray[7],marginLeft:`calc(${w.spacing.sm} / 6)`},tabIndex:-1})]}),F=useMemo(()=>L.map(_=>J.find(ne=>ne.value===_)).filter(_=>!!_).map((_,ne)=>createElement(ar,{..._,index:ne,label:_.label,key:_.value,onRemove:oe=>{oe.preventDefault(),oe.stopPropagation(),Ht(_.value);}})),[L]),ce=forwardRef(function({color:ne,icon:oe,label:We,value:be,...Ma},cg){return jsx("div",{ref:cg,style:{cursor:"pointer",width:"100%"},...Ma,children:jsxs(Group,{align:"center",noWrap:!0,spacing:"xs",w:"100%",children:[oe&&jsx(Box,{bg:ne??"transparent",component:"img",w:20,h:20,src:oe}),jsx(Text,{lineClamp:1,size:"sm",children:We||be})]})})});return jsxs(Fragment,{children:[jsx(MediaQuery,{query:"print",styles:{display:"none"},children:jsx(Input.Wrapper,{label:re,children:jsxs(Popover,{closeOnClickOutside:!0,keepMounted:!0,opened:O,onChange:k,onClose:()=>{ye(0),z("");},onOpen:()=>{X.length>0&&de.scrollToIndex(0);},shadow:"sm",width:"target",withinPortal:!0,children:[jsx(Popover.Target,{children:jsxs(Box,{"aria-haspopup":"listbox",component:"div",onMouseLeave:()=>ye(0),sx:{position:"relative","& .defaultValue":{backgroundColor:w.colorScheme==="dark"?w.colors.dark[5]:w.colors.gray[3],color:w.colorScheme==="dark"?w.colors.dark[1]:w.colors.gray[7]}},tabIndex:-1,children:[jsx("input",{type:"hidden",value:L.join(",")}),jsx(Input,{component:"div",multiline:!0,onMouseDown:_=>{_.preventDefault(),!q.current&&n.length>0&&k(!O),Z.current?.focus();},rightSection:L.length>0?jsx(CloseButton,{onClick:Ar,onMouseDown:_=>_.preventDefault(),variant:"transparent"}):jsx(IconSelector,{color:w.colors.gray[6],size:18,stroke:1.5}),style:{overflow:"hidden"},w:"100%",children:jsxs(Box,{component:"div","data-clearable":!0,sx:{alignItems:"center",boxSizing:"border-box",display:"flex",flexWrap:"wrap",marginLeft:`calc(-${w.spacing.xs} / 2)`,minHeight:`calc(${rem(36)} - ${rem(2)})`,"&[data-clearable]":{marginRight:rem(36)},"&::placeholder":{color:w.colorScheme==="dark"?w.colors.dark[3]:w.colors.gray[5],opacity:1}},children:[F,jsx("input",{autoComplete:"off","data-mantine-stop-propagation":O,onChange:it,onKeyDown:getHotkeyHandler([["ArrowDown",nr],["ArrowLeft",_e],["ArrowRight",ao],["ArrowUp",so],["Backspace",or],["Enter",wr],["Escape",no]]),placeholder:L.length===0&&f||"",ref:Z,readOnly:q.current,style:{appearance:"none",backgroundColor:"transparent",border:0,color:"inherit",flex:1,fontSize:w.fontSizes.sm,marginLeft:`calc(${w.spacing.xs} / 2)`,maxHeight:rem(22),minWidth:rem(60),outline:0,padding:0},type:"search",value:A})]})})]})}),jsx(Popover.Dropdown,{onMouseDown:_=>_.preventDefault(),p:0,children:jsx("div",{style:{display:"flex",maxHeight:rem(300)},children:jsx(Box,{component:"div","data-combobox-popover":!0,onMouseDown:_=>_.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:_=>{_.stopPropagation();},px:"xs",position:"center",spacing:"xs",children:[jsx(Button,{onClick:()=>{ye(0),D(!0),V([]),X.length>0&&de.scrollToIndex(0);},size:"xs",variant:B?"filled":"outline",children:t}),m.map((_,ne)=>jsx(Button,{onClick:()=>{B&&D(!1);let oe=[""].slice(1),We=ne;for(;We--;)oe[We]=j[We]||"";ye(0),V(oe),X.length>0&&de.scrollToIndex(0);},size:"xs",variant:!B&&j.length===m.findIndex(oe=>oe.value===_?.value)?"filled":"outline",children:_?.label},_?.value))]}),jsx(Divider,{})]}),x>0&&jsxs(Group,{align:"center",noWrap:!0,px:"xs",children:[jsx(ActionIcon,{onClick:et,size:"sm",children:jsx(IconChevronLeft,{})}),jsx("div",{children:G.map(_=>jsx(Text,{lineClamp:1,size:"xs",children:_},`${_}`))})]}),jsx(ScrollArea,{mah:250,onWheel:()=>E(!0),px:"xs",style:{overflow:"auto",width:"100%"},viewportRef:le,viewportProps:{tabIndex:-1},w:"100%",children:jsx("div",{style:{height:`${de.getTotalSize()}px`,position:"relative",width:"100%"},children:de.getVirtualItems().map(_=>{let ne=X[_.index],oe=ve===_.index,We=L.includes(ne.value);return X.length>0&&oe&&!I&&de.scrollToIndex(ve),jsxs(Group,{"aria-selected":oe,align:"center","data-hovered":oe||void 0,"data-index":_.index,"data-selected":We,id:ne.vale,noWrap:!0,onMouseEnter:be=>{be.preventDefault(),be.stopPropagation(),I&&(ye(_.index),E(!1));},onMouseMove:be=>{be.preventDefault(),be.stopPropagation(),E(!0);},onMouseDown:be=>{be.preventDefault(),lt(ne);},position:"apart",ref:de.measureElement,role:"option",spacing:"xs",sx:be=>({borderRadius:be.radius.xs,padding:"15px 5px 15px",paddingLeft:B&&10*m.findIndex(Ma=>Ma?.value===ne.type)||5,position:"absolute",top:0,left:0,height:`${_.size}px`,transform:`translateY(${_.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(ce,{index:_.index,...ne}),!B&&ne.type!==m[m.length-1]?.value&&jsx(ActionIcon,{onMouseDown:be=>{be.preventDefault(),be.stopPropagation(),Je(ne.name);},size:"sm",tabIndex:-1,children:jsx(IconChevronRight,{})})]},ne.value)})})})]})})})})]})})}),N&&jsxs(Text,{children:[re,": ",Y]})]})}var fS,gS,hS,yS,bS,Tp=b(()=>{c();Xs();Ie();Qt();mp();fS=(e=[],t=[],r="",o="",n="",a="|")=>{let s=t.map(y=>y.value).slice(),i=`${s.pop()}`,l=y=>y[r],u=y=>y[o],p=y=>{if(y[n])return typeof y[n]=="string"?y[n].split(a):y[n]},m=new Set,d=[],f=[],g=nest().rollup(y=>{let T=y[0],C=k=>k&&k.value&&!m.has(k.value),N=s.map(k=>T[`${k} ID`]),R=s.map(k=>T[k]),M=s.map((k,I)=>{if(f[I]!==R[I]){f[I]=R[I];let E=l[I]||l[l.length-1]||l,A=u[I]||u[u.length-1]||u,z=p[I]||p[p.length-1]||p;return {color:E(T,k)||void 0,icon:A(T,k)||void 0,value:`${N[I]}`,label:R[I],name:R[I],type:k,searchindex:R.slice(0,I+1).concat(z(T,k)).join("|")}}return {}}).filter(C);M.forEach(k=>m.add(k.value));let U=l[l.length-1]||l,K=u[u.length-1]||u,w=p[p.length-1]||p,O=y.map(k=>({color:U(k,i)||void 0,icon:K(k,i)||void 0,value:`${k[`${i} ID`]}`,label:k[i],name:k[i],type:i,searchindex:R.concat(k[i]).concat(w(k,i)).join("|")}));d.push(...M.concat(O));});return s.forEach(y=>{g.key(T=>`${T[`${y} ID`]}|${T[y]}`);}),g.entries(e),d},gS=e=>{if(!e)return /./i;let t=e.normalize("NFD").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"[^|]+");return RegExp(t,"i")},hS=(e,t)=>{let r=e.length,o,n=i=>o&&o.searchindex.includes(i.searchindex),s={next:()=>{for(let i=r-1;i>-1;i--){let l=e[i];if(t.test(`${l.value} ${l.label} ${l.searchindex}`)||n(l))return o=l,r=i,{done:!1,value:l}}return {done:!0,value:void 0}},[Symbol.iterator]:()=>s};return s},yS=e=>`multihierarchySelector${e}`,bS=(e,t)=>e&&typeof e=="string"?e.split(","):t;});function TS(e={required:!1}){let{update:t,data:r,status:o}=useSession(e);return {update:t,user:r?.user,status:o,isLoading:o==="loading"}}var xp,Rp=b(()=>{c();xp=TS;});function la(e){let{asPath:t,locale:r,defaultLocale:o}=useRouter(),[n,a]=useState(!0),{user:s,isLoading:i}=xp(),[l,u]=useState({resolved:!1,blocks:[]}),p=Ye(),[,m]=t.split("?"),d=m?Object.fromEntries(new URLSearchParams(`?${m}`)):{},f=Q(E=>E),g=xs().data,y=g&&g[0].id,T=Q(E=>E.variables.attributes),C=Mt(f),N=gr(f),R=hr(f),M=At(N,r),U=Q(E=>E.variables.variables),K=Q(E=>E.variables.status),w=Vt(),{addRunConsumersRunning:O,removeRunConsumersRunning:k}=To(),I=useMemo(()=>Object.keys(T).filter(E=>E.startsWith("id")).map(E=>T[E]).join("-"),[T]);return useEffect(()=>{if(l.blocks.length>0&&p(nt.removeBlocksFromState(l.blocks)).then(()=>{u({resolved:!1,blocks:[]});}),l.blocks.length>0&&u({resolved:!1,blocks:[]}),!i&&s&&y){let E=Object.keys(Object.values(C).reduce((A,z)=>(z.type!=="fallback"?A[z.section_id]=!0:A[z.section_id]=!1,A),{})).map(A=>parseInt(A,10));p(nt.readPrivateBlocks({report_id:y,locale:r||o||"en",section_id:E})).then(A=>{if(A.data&&A.data.length){let z=A.data.reduce((B,D)=>({...B,[D.id]:D}),[]);p(nt.addBlockToState(z)).then(()=>{u({resolved:!0,blocks:A.data.map(B=>B.id)});});}u({resolved:!0,blocks:[]}),a(!1);}).catch(()=>{u({resolved:!0,blocks:[]}),a(!1);});}!i&&!s&&(u({resolved:!0,blocks:[]}),a(!1));},[I,s,i,y]),useEffect(()=>{if((Object.keys(d).some(A=>A!==e)||l.blocks.length>0)&&l.resolved){let A=Object.keys(d).map($=>Number($.match(/\d+/))).filter($=>C[$]),z=Array.from(new Set(A.filter($=>$!==0).concat(l.blocks))),B={...f.variables},D=[],j=[];z.forEach($=>{let ie=C[$];Dn(ie,C,$,D,!0,!0,j);});let V={},L=z.filter($=>(V[C[$].section_id]=!0,!j.includes($))),H=Object.keys(V).map($=>parseInt($,10));O(H),Promise.all(L.map($=>{let Y=C[$].consumers.reduce((Z,te)=>({...Z,...U[te]}),{}),re={locale:ht,query:d,variables:{...Y,...T}};return Pt(C,void 0,$,M,re,{variables:U,status:K},w,"report",R)})).then($=>($.forEach((ie,Y)=>{let re=L[Y],Z=C[re],te=[],q=[];Dn(Z,C,re,te,!0,!0,q);let x={},P={};q.forEach(G=>{x[G]=ie.status[G],P[G]=ie.variables[G];}),B.status={...B.status,...x,[re]:{...ie.status[re]}},B.variables={...B.variables,...P,[re]:{...ie.variables[re]}};}),B)).then($=>{p(pr.setVariableChange({...$,attributes:T})),k(H);});}},[l.resolved]),n||!l.resolved}var Cp=b(()=>{c();ge();yr();yr();ir();Vn();Nr();Rp();ge();ho();Co();Ee();});function ca(){let e=useRouter(),t=useRef(!1),r=500;useEffect(()=>{let o=()=>{let{asPath:a}=e;if(!t.current&&a.includes("#")){let s=a.split("#")[1],i=document.getElementById(s);i&&(t.current=!0,setTimeout(()=>{i.scrollIntoView({behavior:"smooth"}),t.current=!1;},r));}};o();let n=()=>{o();};return e.events.on("hashChangeComplete",n),()=>{e.events.off("hashChangeComplete",n);}},[e]);}var ti=b(()=>{c();});function wS(e,t){let r=[],o={},n=1/0;for(let a of e){let s=parseInt(a.settings.order);s<n&&(n=s);}for(let a of e){let{id:s,settings:i}=a,l=parseInt(i.order),u=t[s]?t[s]:!1,p=AS(u,s),m={id:s,order:l,label:t[s]?t[s][`title${s}title`]:`Title ${s}`,iconProps:p,children:[]};if(o[s]=m,l===n)r.push(m);else {let d=l-1,f;for(let g=e.indexOf(a)-1;g>=0;g--){let y=e[g],T=parseInt(y.settings.order);if(T===d){f=o[y.id];break}else if(T<d){f=o[y.id];break}}f?f.children.push(m):r.push(m);}}return r}function Ao(e=1,t=6,r=[]){let o=Q(d=>d),n=Q(d=>d.variables.variables),a=Q(d=>d.variables.status),s=Jo(),i=Wc(o).filter(d=>d.type===h.TITLE&&r.includes(d.id)),l=Object.fromEntries(i.map(d=>[d.id,d])),u=Object.fromEntries(i.map(d=>[d.id,n[d.id]])),p=Object.fromEntries(i.map(d=>[d.id,a[d.id]])),m=useMemo(()=>{if(s.isSuccess&&l){let d=[];return s.data.sort(Ke).forEach(f=>{let g=f.blocks.reduce((y,T)=>l[T]&&l[T].type===h.TITLE?y.concat([l[T]]):y,[]);d=d.concat(g.sort((y,T)=>Ke(y,T,"blockrow")));}),Object.keys(a).length?d.filter(f=>{let g=parseInt(f.settings.order||"1",10);return g>=e&&g<=t&&p[f.id]?.allowed&&!p[f.id]?.hiddenByCascade}):[]}},[r,s,l,p]);return useMemo(()=>m&&m?.length>0?wS(m,u):[],[m,u])}var AS,ri=b(()=>{c();ge();yr();io();he();AS=(e,t)=>({iconType:e[`title${t}_iconType`],icon:e[`title${t}_icon`],iconSize:e[`title${t}_iconSize`],iconVariant:e[`title${t}_iconVariant`],iconRadius:e[`title${t}_iconRadius`]});});var oi=b(()=>{c();Cp();Gs();ti();ri();});function un(){let e=useContext(wp);if(e===void 0)throw new Error("usePdf must be used within a PdfProvider");return e}function ni({children:e}){let{query:t}=useRouter(),o=Q(a=>Object.values(a.records.entities.report)[0]).settings,n=Hg(t.print)??!1;return jsx(wp.Provider,{value:{active:o.pdf||!1,pdfParam:n,position:o.position||"DEFAULT",XlsxVizActive:o.XlsxViz||!1},children:e})}var _S,wp,ua=b(()=>{c();ge();_S={active:!1,pdfParam:!1,position:"DEFAULT",XlsxVizActive:!1},wp=createContext(_S);});var ai=b(()=>{c();ge();});var Pp=b(()=>{c();});var si=b(()=>{c();Wt();});var Lp=b(()=>{c();ge();si();});var ii=b(()=>{c();si();Lp();ri();});function pa(e,t){return e===t}var li=b(()=>{c();Ee();ai();Pp();ii();});var Bp,ma,Mp,fa=b(()=>{c();Bp=(e,t,r,o=null)=>{let[n,a]=useState(!1),[s,i]=useState(null);return {print:u=>{a(!0),i(null);let p=process.env.NEXT_PUBLIC_REPORTS_BASE_URL,m=new URLSearchParams(window.location.search),d=u?"&transparent=true":"",f=o?`/embeds/${t}/${r}?section=${e}&block=${o}${m.toString()?"&"+m.toString():""}`:`/embeds/${t}/${r}?section=${e}${m.toString()?"&"+m.toString():""}`,g=encodeURIComponent(`${p}${f}&print=true`);Nn.get(`${process.env.NEXT_PUBLIC_PDF_API_URL}/screenshot?url=${g}${d}`,{responseType:"blob"}).then(y=>{let T=o?`section${e}_block${o}.png`:`section${e}.png`;saveAs(y.data,T);}).catch(y=>{i(y.response?.data?.message||"Failed to download image. Please try again.");}).finally(()=>{a(!1);});},downloadLoading:n,error:s}},ma=()=>{let{asPath:e}=useRouter(),[t,r]=useState(!1),[o,n]=useState(null);return {printReport:()=>{r(!0),n(null);let s=process.env.NEXT_PUBLIC_REPORTS_BASE_URL,i=e.replace(/[&?]printBtn=[^&]+/,""),l=i.includes("?")?"&":"?",u=encodeURIComponent(`${s}${i}${l}print=true`);return Nn.get(`${process.env.NEXT_PUBLIC_PDF_API_URL}/pdf?url=${u}`,{responseType:"blob"}).then(p=>{let d=p.headers["content-disposition"]?.match(/filename[^;=\n]*=(['"]?)(.*?)\1/),f=d&&d[2]?d[2]:"report.pdf";saveAs(p.data,f);}).catch(p=>{n(p.response?.data?.message||"Failed to generate PDF. Please try again.");}).finally(()=>{r(!1);})},error:o,setError:n,downloadLoading:t}},Mp=()=>!!process.env.NEXT_PUBLIC_PDF_API_URL;});function $p({contentOutline:e=[]}){return jsx(Menu,{children:zp(e)})}function zp(e,t=!0){return e.map((r,o)=>t?jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${r.id}`,children:jsx(Group,{children:jsx(Text,{dangerouslySetInnerHTML:{__html:r.label}})})})}),r.children.length?jsx(Box,{ml:"md",children:zp(r.children,!1)}):null]},o):jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${r.id}`,children:jsx(Text,{dangerouslySetInnerHTML:{__html:r.label}})})},o))}function ui({headings:e,settings:t,type:r}){let{min:o="1",max:n="6",icons:a="yes"}=t||{},s=Ao(parseInt(o,10),parseInt(n,10),e),i=a==="yes",u=`(max-width: ${useMantineTheme().breakpoints.md})`,p=useMediaQuery(u),m=Ro(t&&t.align?String(t.align):"left");return p?jsx(HS,{contentOutline:s,showIcons:i}):r==="multilevel"?jsx(jS,{contentOutline:s,showIcons:i,align:m}):jsx(qS,{contentOutline:s,showIcons:i,align:m})}var Dp,qS,Up,HS,jS,Gp=b(()=>{c();oi();Yr();Ge();ua();li();fa();Dp=e=>t=>({display:"flex",gap:t.spacing.md,justifyContent:e,listStyleType:"none"});qS=({contentOutline:e,showIcons:t,align:r})=>{let{active:o,position:n,pdfParam:a}=un(),{downloadLoading:s,printReport:i}=ma(),[l,u]=useState(null);if(useEffect(()=>{let m=()=>{let d=document.querySelector(".bespoke-nav");if(!d)return;let f=d.getBoundingClientRect(),g=!1;e.forEach(y=>{let T=document.getElementById(`bespoke-title-${y.id}`);T&&T.getBoundingClientRect().top<=f.bottom&&(u(y.id),g=!0);}),g||u(null);};return window.addEventListener("scroll",m),()=>{window.removeEventListener("scroll",m);}},[e]),o&&a)return jsx($p,{contentOutline:e});let p=m=>!m||!m?.length?null:jsx(Fragment,{children:m.map(d=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${d.id}`,children:jsxs(Group,{spacing:"sm",children:[t&&jsx(ke,{...d.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:d.label}})]})})}),jsx(Box,{pl:"xs",children:p(d.children)})]},d.id))});return jsxs(Box,{component:"nav",className:"bespoke-nav",children:[jsx(List,{sx:m=>({display:"flex",gap:m.spacing.md,justifyContent:r,listStyleType:"none"}),children:e?.map(m=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${m.id}`,"data-active":m.id===l,children:jsxs(Group,{spacing:"sm",children:[t&&jsx(ke,{...m.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:m.label}})]})})}),m?.children?.length?jsx(Menu.Dropdown,{children:p(m.children)}):null]})},m.id))}),pa(n,"NAV")&&o&&e.length>=1&&jsx(List.Item,{children:jsx(Button,{variant:"outline",onClick:i,children:s?"Downloading":"Download PDF"})})]})},Up=({contentOutline:e,closeNav:t,showIcons:r})=>{let[o,n]=useState(null);return jsx(Stack,{children:e.map(a=>a.children.length?jsxs(Fragment,{children:[jsxs(Group,{spacing:0,noWrap:!0,children:[jsx(UnstyledButton,{w:"100%",component:"a",onClick:t,href:`#bespoke-title-${a.id}`,children:jsxs(Group,{spacing:"sm",noWrap:!0,children:[r&&jsx(ke,{...a.iconProps,iconSize:"sm",iconPadding:"2"}),jsx(Text,{dangerouslySetInnerHTML:{__html:a.label}})]})},a.id),jsx(ActionIcon,{component:"a",size:"lg",onClick:()=>n(s=>s===a.id?null:a.id),children:jsx(IconChevronDown,{style:{transition:"transform 0.2s",transform:o===a.id?"rotate(-180deg)":"none"},stroke:1})})]},a.id),jsx(Collapse,{in:o===a.id,pl:"sm",transitionTimingFunction:"linear",transitionDuration:200,children:jsx(Up,{contentOutline:a.children,closeNav:t,showIcons:r})})]}):jsx(Group,{noWrap:!0,children:jsx(UnstyledButton,{display:"flex",w:"100%",component:"a",href:`#bespoke-title-${a.id}`,children:jsxs(Group,{spacing:"sm",children:[r&&jsx(ke,{...a.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:a.label}})]})},a.id)},a.id))})},HS=({contentOutline:e,showIcons:t})=>{let[r,{toggle:o}]=useDisclosure(!1),n=r?"Close content outline":"Open content outline",{active:a,pdfParam:s}=un();return a&&s?jsx($p,{contentOutline:e}):jsxs(Box,{component:"nav",children:[jsx(Group,{children:jsx(Burger,{opened:r,onClick:o,"aria-label":n,size:"md"})}),jsx(Collapse,{in:r,mt:"md",children:jsx(Up,{contentOutline:e,closeNav:o,showIcons:t})})]})},jS=({contentOutline:e,showIcons:t,align:r})=>{let[o,n]=useState(null),[a,s]=useState(null);useEffect(()=>{let l=()=>{let u=document.querySelector(".bespoke-nav");if(!u)return;let p=u.getBoundingClientRect(),m=!1;e.forEach(d=>{let f=document.getElementById(`bespoke-title-${d.id}`);f&&(f.getBoundingClientRect().top<=p.bottom&&(n(d.id),s(null),m=!0),d.children.forEach(y=>{let T=document.getElementById(`bespoke-title-${y.id}`);T&&T.getBoundingClientRect().top<=p.bottom&&(s(y.id),n(d.id),m=!0);}));}),m||(n(null),s(null));};return window.addEventListener("scroll",l),()=>{window.removeEventListener("scroll",l);}},[e]);let i=l=>!l||!l?.length?null:jsx(Fragment,{children:l.map(u=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${u.id}`,children:jsxs(Group,{spacing:"sm",children:[t&&jsx(ke,{...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:Dp(r),children:e?.map(l=>jsx(List.Item,{children:jsx(Anchor,{href:`#bespoke-title-${l.id}`,"data-active":o===l.id,onClick:()=>n(l.id),children:jsxs(Group,{spacing:"sm",children:[t&&jsx(ke,{...l.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:l.label}})]})})},l.id))}),o&&e.find(l=>l.id===o)?.children.length>0&&jsx(List,{className:"bespoke-nav-level2",sx:Dp(r),children:e.find(l=>l.id===o)?.children.map(l=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${l.id}`,"data-active":l.id===a,children:jsxs(Group,{spacing:"sm",children:[t&&jsx(ke,{...l.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:l.label}})]})})}),l?.children?.length?jsx(Menu.Dropdown,{children:i(l.children)}):null]})},l.id))})]})};});function mi(e){let{related_reports:t,settings:r}=e,o=Q(d=>d.status.currentLocale),n=Q(d=>d.status.localeDefault),a=Xn(),s=useRouter(),{components:i}=st();if(!t?.length)return;let l=o===n?"":`/${o}`,u=d=>{s.push(`${d}`);},p=i?.ReportTile?i.ReportTile:_s,m=Nt(r&&r.align?String(r.align):"center");return jsx(Grid,{justify:m,children:t.map(d=>{let f=`${l}${a}${d.link}`,g=d.entities.map(R=>({original_id:R.id,name:R.name,id:R.content_id,variant:R.variant_name,variant_id:R.variant_id,dimension:R.dimension_name,dimension_id:R.dimension_id,image:{src:`/api/cms/member/image?member=${R.content_id}&size=thumb`,alt:R.name}})),y=d.entities.map(R=>R.id).join("-"),T=d.entities.map(R=>R.name).join(" & "),C=d.entities[0]?d.entities[0].report_id:null,N=R=>{R.preventDefault(),u(f);};return jsx(Grid.Col,{xs:12,sm:6,md:4,lg:4,xl:3,children:jsx(p,{reportId:C,reportName:T,members:g,href:f,onClick:N})},y)})})}var Hp=b(()=>{c();ge();Ee();Bs();Xr();Ge();});function fi({id:e,label:t,settings:r,showIcon:o,fullWidth:n,showWhenDisabled:a}){let s=bt(e).data,{sectionVariables:i,resetSectionVariables:l}=Pe(s?.section_id),u=!!Object.keys(i).length,p=Nt(r&&r.align?r.align:"left");return !u&&!a?null:jsx(Button,{onClick:()=>l(),disabled:!u,fullWidth:n,sx:{justifySelf:p},children:jsxs(Group,{align:"center",children:[t,o&&jsx(IconRefresh,{})]})})}var Wp=b(()=>{c();Ee();Ee();Ge();});function gi({settings:e,label:t,removeLabel:r,showIcon:o,position:n="center",asComparison:a=!1}){let s=Q(R=>R.records.entities.report),i=Q(R=>R.variables.attributes),l=e&&e.search?e.search:"inline",u=Object.values(s)[0].settings,p=useRouter(),{comparisonLoaded:m,loading:d}=Qe(),f=Object.keys(p.query).includes("compare"),y=m&&f?jsx(Button,{onClick:()=>{let R={...p.query};delete R.compare,p.push({pathname:p.pathname,query:R},void 0,{shallow:!0});},rightIcon:jsx(IconX,{}),children:r||"Remove Comparison"}):jsx(Button,{loading:d,children:jsxs(Group,{align:"center",children:[t||"Add Comparison",o&&jsx(IconPlus,{})]})}),T={searchReportParams:{report:[Number(Object.keys(s)[0])],variant:u.compareLevels?[]:[i.variant_id1]}},N=on(y,l,R=>{p.push({pathname:p.pathname,query:{...p.query,compare:R.reportPath}});},T);return a?null:jsx(Group,{position:n,children:f?y:N})}var Xp=b(()=>{c();Fs();ge();Zt();});function yi({columns:e=[],data:t=[],tableProps:r={},sectionId:o=null}){let[n,a]=useState(!1),[s,i]=useState({}),l=useMemo(()=>e.map(d=>d.accessorKey),[e]),u=useMemo(()=>t.filter(d=>typeof d=="object"&&d!==null&&!Array.isArray(d)&&Object.keys(d).some(f=>l.includes(f))),[l,t]),p=useMemo(()=>e.map(d=>({...d,Cell:({renderedCellValue:f})=>jsx(se,{html:`${f}`}),filterFn:"contains"})),[e]),{locale:m}=useRouter();return useEffect(()=>{(async()=>{try{let f=m||"en",g=`${f.toUpperCase()}`,y=await import(`mantine-react-table/locales/${f}.js`);i(y[`MRT_Localization_${g}`]);}catch(f){console.error("Error loading translations:",f);}})();},[m]),jsx(MantineReactTable,{...r,autoResetPageIndex:!1,columns:p,data:u,enableColumnFilterModes:!0,enableFilterMatchHighlighting:!1,globalFilterFn:"contains",layoutMode:"grid",localization:s,onIsFullScreenChange:d=>{let f=document.getElementById(`section-${o}`);f&&(d?f.style.zIndex="10":f.style.zIndex="1"),a(d);},state:{...r.state,isFullScreen:n}})}var Jp=b(()=>{c();Ie();});function bi({label:e,url:t,settings:r}){let{align:o}=r;return e?jsx(Group,{position:o,grow:o==="justify",children:jsx(Button,{component:"a",target:"_blank",href:t||"",children:e||"Button"})}):null}var td=b(()=>{c();});function pT({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 vi(e){let t=dT();return jsx(t,{block:e})}var dT,nd=b(()=>{c();Xr();dT=()=>{let{components:e}=st(),t=pT;return e?.CustomFallback&&(t=e.CustomFallback),t};});var fT,gT,ad,sd,ha,hT,Tr,mn=b(()=>{c();wn();fT=process.env.NEXT_PUBLIC_REPORTS_LOCALE_DEFAULT||"en",gT="Error Rendering Visualization",ad={data:[],dataFormat:e=>e,type:"Treemap",noDataHTML:`<p style="font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;">
54
+ color: hsl(`+Math.max(0,Math.min(120-120*d,120))+"deg 100% 31%);",r?.key);}return r==null||r.onChange==null||r.onChange(a),a}}function ra(e,t){if(e===void 0)throw new Error("Unexpected undefined"+(t?": "+t:""));return e}var sp,ip=b(()=>{c();sp=function(t,r){return Math.abs(t-r)<1};});function Xv(e){for(var t=e.measurements,r=e.outerSize,o=e.scrollOffset,n=t.length-1,a=function(u){return t[u].start},s=dp(0,n,a,o),i=s;i<n&&t[i].end<o+r;)i++;return {startIndex:s,endIndex:i}}var Kv,cn,lp,cp,Yv,up,pp,dp,Ys=b(()=>{c();ap();ip();Kv=function(t){return t},cn=function(t){for(var r=Math.max(t.startIndex-t.overscan,0),o=Math.min(t.endIndex+t.overscan,t.count-1),n=[],a=r;a<=o;a++)n.push(a);return n},lp=function(t,r){var o=t.scrollElement;if(o){var n=function(i){var l=i.width,u=i.height;r({width:Math.round(l),height:Math.round(u)});};n(o.getBoundingClientRect());var a=new ResizeObserver(function(s){var i=s[0];if(i!=null&&i.borderBoxSize){var l=i.borderBoxSize[0];if(l){n({width:l.inlineSize,height:l.blockSize});return}}n(o.getBoundingClientRect());});return a.observe(o,{box:"border-box"}),function(){a.unobserve(o);}}},cp=function(t,r){var o=t.scrollElement;if(o){var n=function(){r(o[t.options.horizontal?"scrollLeft":"scrollTop"]);};return n(),o.addEventListener("scroll",n,{passive:!0}),function(){o.removeEventListener("scroll",n);}}},Yv=function(t,r,o){if(r!=null&&r.borderBoxSize){var n=r.borderBoxSize[0];if(n){var a=Math.round(n[o.options.horizontal?"inlineSize":"blockSize"]);return a}}return Math.round(t.getBoundingClientRect()[o.options.horizontal?"width":"height"])},up=function(t,r,o){var n,a,s=r.adjustments,i=s===void 0?0:s,l=r.behavior,u=t+i;(n=o.scrollElement)==null||n.scrollTo==null||n.scrollTo((a={},a[o.options.horizontal?"left":"top"]=u,a.behavior=l,a));},pp=function(t){var r=this;this.unsubs=[],this.scrollElement=null,this.isScrolling=!1,this.isScrollingTimeoutId=null,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollDirection=null,this.scrollAdjustments=0,this.measureElementCache=new Map,this.observer=function(){var o=null,n=function(){return o||(typeof ResizeObserver<"u"?o=new ResizeObserver(function(s){s.forEach(function(i){r._measureElement(i.target,i);});}):null)};return {disconnect:function(){var s;return (s=n())==null?void 0:s.disconnect()},observe:function(s){var i;return (i=n())==null?void 0:i.observe(s,{box:"border-box"})},unobserve:function(s){var i;return (i=n())==null?void 0:i.unobserve(s)}}}(),this.range={startIndex:0,endIndex:0},this.setOptions=function(o){Object.entries(o).forEach(function(n){var a=n[0],s=n[1];typeof s>"u"&&delete o[a];}),r.options=ln({debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Kv,rangeExtractor:cn,onChange:function(){},measureElement:Yv,initialRect:{width:0,height:0},scrollMargin:0,scrollingDelay:150,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1},o);},this.notify=function(){r.options.onChange==null||r.options.onChange(r);},this.cleanup=function(){r.unsubs.filter(Boolean).forEach(function(o){return o()}),r.unsubs=[],r.scrollElement=null;},this._didMount=function(){return r.measureElementCache.forEach(r.observer.observe),function(){r.observer.disconnect(),r.cleanup();}},this._willUpdate=function(){var o=r.options.getScrollElement();r.scrollElement!==o&&(r.cleanup(),r.scrollElement=o,r._scrollToOffset(r.scrollOffset,{adjustments:void 0,behavior:void 0}),r.unsubs.push(r.options.observeElementRect(r,function(n){var a=r.scrollRect;r.scrollRect=n,(r.options.horizontal?n.width!==a.width:n.height!==a.height)&&r.maybeNotify();})),r.unsubs.push(r.options.observeElementOffset(r,function(n){r.scrollAdjustments=0,r.scrollOffset!==n&&(r.isScrollingTimeoutId!==null&&(clearTimeout(r.isScrollingTimeoutId),r.isScrollingTimeoutId=null),r.isScrolling=!0,r.scrollDirection=r.scrollOffset<n?"forward":"backward",r.scrollOffset=n,r.maybeNotify(),r.isScrollingTimeoutId=setTimeout(function(){r.isScrollingTimeoutId=null,r.isScrolling=!1,r.scrollDirection=null,r.maybeNotify();},r.options.scrollingDelay));})));},this.getSize=function(){return r.scrollRect[r.options.horizontal?"width":"height"]},this.memoOptions=Zr(function(){return [r.options.count,r.options.paddingStart,r.options.scrollMargin,r.options.getItemKey]},function(o,n,a,s){return r.pendingMeasuredCacheIndexes=[],{count:o,paddingStart:n,scrollMargin:a,getItemKey:s}},{key:!1}),this.getFurthestMeasurement=function(o,n){for(var a=new Map,s=new Map,i=n-1;i>=0;i--){var l=o[i];if(!a.has(l.lane)){var u=s.get(l.lane);if(u==null||l.end>u.end?s.set(l.lane,l):l.end<u.end&&a.set(l.lane,!0),a.size===r.options.lanes)break}}return s.size===r.options.lanes?Array.from(s.values()).sort(function(p,m){return p.end-m.end})[0]:void 0},this.getMeasurements=Zr(function(){return [r.memoOptions(),r.itemSizeCache]},function(o,n){var a=o.count,s=o.paddingStart,i=o.scrollMargin,l=o.getItemKey,u=r.pendingMeasuredCacheIndexes.length>0?Math.min.apply(Math,r.pendingMeasuredCacheIndexes):0;r.pendingMeasuredCacheIndexes=[];for(var p=r.measurementsCache.slice(0,u),m=u;m<a;m++){var d=l(m),f=r.options.lanes===1?p[m-1]:r.getFurthestMeasurement(p,m),g=f?f.end:s+i,y=n.get(d),T=typeof y=="number"?y:r.options.estimateSize(m),C=g+T,N=f?f.lane:m%r.options.lanes;p[m]={index:m,start:g,size:T,end:C,key:d,lane:N};}return r.measurementsCache=p,p},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:function(){return r.options.debug}}),this.calculateRange=Zr(function(){return [r.getMeasurements(),r.getSize(),r.scrollOffset]},function(o,n,a){return r.range=Xv({measurements:o,outerSize:n,scrollOffset:a})},{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:function(){return r.options.debug}}),this.maybeNotify=Zr(function(){var o=r.calculateRange();return [o.startIndex,o.endIndex,r.isScrolling]},function(){r.notify();},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:function(){return r.options.debug},initialDeps:[this.range.startIndex,this.range.endIndex,this.isScrolling]}),this.getIndexes=Zr(function(){return [r.options.rangeExtractor,r.calculateRange(),r.options.overscan,r.options.count,r.getSize()]},function(o,n,a,s,i){return i===0?[]:o(ln({},n,{overscan:a,count:s}))},{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:function(){return r.options.debug}}),this.indexFromElement=function(o){var n=r.options.indexAttribute,a=o.getAttribute(n);return a?parseInt(a,10):(console.warn("Missing attribute name '"+n+"={index}' on measured element."),-1)},this._measureElement=function(o,n){var a=r.measurementsCache[r.indexFromElement(o)];if(!a||!o.isConnected){r.measureElementCache.forEach(function(l,u){l===o&&(r.observer.unobserve(o),r.measureElementCache.delete(u));});return}var s=r.measureElementCache.get(a.key);s!==o&&(s&&r.observer.unobserve(s),r.observer.observe(o),r.measureElementCache.set(a.key,o));var i=r.options.measureElement(o,n,r);r.resizeItem(a,i);},this.resizeItem=function(o,n){var a,s=(a=r.itemSizeCache.get(o.key))!=null?a:o.size,i=n-s;i!==0&&(o.start<r.scrollOffset&&(process.env.NODE_ENV!=="production"&&r.options.debug&&console.info("correction",i),r._scrollToOffset(r.scrollOffset,{adjustments:r.scrollAdjustments+=i,behavior:void 0})),r.pendingMeasuredCacheIndexes.push(o.index),r.itemSizeCache=new Map(r.itemSizeCache.set(o.key,n)),r.notify());},this.measureElement=function(o){o&&r._measureElement(o,void 0);},this.getVirtualItems=Zr(function(){return [r.getIndexes(),r.getMeasurements()]},function(o,n){for(var a=[],s=0,i=o.length;s<i;s++){var l=o[s],u=n[l];a.push(u);}return a},{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:function(){return r.options.debug}}),this.getVirtualItemForOffset=function(o){var n=r.getMeasurements();return ra(n[dp(0,n.length-1,function(a){return ra(n[a]).start},o)])},this.getOffsetForAlignment=function(o,n){var a=r.getSize();n==="auto"&&(o<=r.scrollOffset?n="start":o>=r.scrollOffset+a?n="end":n="start"),n==="start"?o=o:n==="end"?o=o-a:n==="center"&&(o=o-a/2);var s=r.options.horizontal?"scrollWidth":"scrollHeight",i=r.scrollElement?"document"in r.scrollElement?r.scrollElement.document.documentElement[s]:r.scrollElement[s]:0,l=i-r.getSize();return Math.max(Math.min(l,o),0)},this.getOffsetForIndex=function(o,n){n===void 0&&(n="auto"),o=Math.max(0,Math.min(o,r.options.count-1));var a=ra(r.getMeasurements()[o]);if(n==="auto")if(a.end>=r.scrollOffset+r.getSize()-r.options.scrollPaddingEnd)n="end";else if(a.start<=r.scrollOffset+r.options.scrollPaddingStart)n="start";else return [r.scrollOffset,n];var s=n==="end"?a.end+r.options.scrollPaddingEnd:a.start-r.options.scrollPaddingStart;return [r.getOffsetForAlignment(s,n),n]},this.isDynamicMode=function(){return r.measureElementCache.size>0},this.cancelScrollToIndex=function(){r.scrollToIndexTimeoutId!==null&&(clearTimeout(r.scrollToIndexTimeoutId),r.scrollToIndexTimeoutId=null);},this.scrollToOffset=function(o,n){var a=n===void 0?{}:n,s=a.align,i=s===void 0?"start":s,l=a.behavior;r.cancelScrollToIndex(),l==="smooth"&&r.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),r._scrollToOffset(r.getOffsetForAlignment(o,i),{adjustments:void 0,behavior:l});},this.scrollToIndex=function(o,n){var a=n===void 0?{}:n,s=a.align,i=s===void 0?"auto":s,l=a.behavior;o=Math.max(0,Math.min(o,r.options.count-1)),r.cancelScrollToIndex(),l==="smooth"&&r.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");var u=r.getOffsetForIndex(o,i),p=u[0],m=u[1];r._scrollToOffset(p,{adjustments:void 0,behavior:l}),l!=="smooth"&&r.isDynamicMode()&&(r.scrollToIndexTimeoutId=setTimeout(function(){r.scrollToIndexTimeoutId=null;var d=r.measureElementCache.has(r.options.getItemKey(o));if(d){var f=r.getOffsetForIndex(o,m),g=f[0];sp(g,r.scrollOffset)||r.scrollToIndex(o,{align:m,behavior:l});}else r.scrollToIndex(o,{align:m,behavior:l});}));},this.scrollBy=function(o,n){var a=n===void 0?{}:n,s=a.behavior;r.cancelScrollToIndex(),s==="smooth"&&r.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),r._scrollToOffset(r.scrollOffset+o,{adjustments:void 0,behavior:s});},this.getTotalSize=function(){var o;return (((o=r.getMeasurements()[r.options.count-1])==null?void 0:o.end)||r.options.paddingStart)-r.options.scrollMargin+r.options.paddingEnd},this._scrollToOffset=function(o,n){var a=n.adjustments,s=n.behavior;r.options.scrollToFn(o,{behavior:s,adjustments:a},r);},this.measure=function(){r.itemSizeCache=new Map,r.notify();},this.setOptions(t),this.scrollRect=this.options.initialRect,this.scrollOffset=this.options.initialOffset,this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(function(o){r.itemSizeCache.set(o.key,o.size);}),this.maybeNotify();},dp=function(t,r,o,n){for(;t<=r;){var a=(t+r)/2|0,s=o(a);if(s<n)t=a+1;else if(s>n)r=a-1;else return a}return t>0?t-1:0};});function Zv(e){var t=Jt.useReducer(function(){return {}},{})[1],r=sn({},e,{onChange:function(s){t(),e.onChange==null||e.onChange(s);}}),o=Jt.useState(function(){return new pp(r)}),n=o[0];return n.setOptions(r),Jt.useEffect(function(){return n._didMount()},[]),Qv(function(){return n._willUpdate()}),n}function oa(e){return Zv(sn({observeElementRect:lp,observeElementOffset:cp,scrollToFn:up},e))}var Qv,Xs=b(()=>{c();np();Ys();Ys();Qv=typeof document<"u"?Jt.useLayoutEffect:Jt.useEffect;});function Qs(e,t,r,o,n=!1){let a=useRouter(),{query:s,locale:i}=a,l=Q(w=>w),u=useDispatch(),p=Qe(),m=Q(w=>o&&p.variables?p?.variables?.attributes:w.variables.attributes),d=Mt(l),f=gr(l),g=hr(l),y=wt(f,i),T=So(e,o&&p.active?p?.variables.variables:void 0,o&&p.active?p?.variables.attributes:void 0),C=Q(w=>o?p.variables.variables:w.variables.variables),N=Q(w=>o?p.variables.status:w.variables.status),R=Vt(),{sectionVariables:M,resetSectionVariables:U}=Pe(t),{addRunConsumersRunning:K,removeRunConsumersRunning:A}=To(),O=o&&p.active?`${r}-valueCompare`:`${r}-value`,k=o&&p.active?`${r}-typeCompare`:`${r}-type`,I=o&&p.active?Object.fromEntries(Object.entries(s).filter(([w])=>w.match(rS)).map(([w,z])=>[w.replace("Compare",""),z])):Object.fromEntries(Object.entries(s).filter(([w])=>w.match(oS)).map(([w,z])=>[w.replace("Compare",""),z]));return useCallback((w,z)=>{let B={locale:i,query:{...I,[`${r}-type`]:z,[`${r}-value`]:w},variables:T},D=new URLSearchParams(window.location.search);w&&z?(D.set(O,w.join(",")),D.set(k,z)):(D.delete(O),D.delete(k)),window.history.replaceState(null,null,`?${D.toString()}`),K([t]),Pt(d,void 0,e,y,B,{variables:C,status:N},R,"report",g).then(j=>{n&&M&&U(),p.active&&o?p.setComparisonVariables({attributes:m,variables:j.variables,status:j.status}):u(pr.setVariableChange({attributes:m,variables:j.variables,status:j.status})),A([t]);});},[o,m,e,d,p,u,y,N,C,i,I,R,r,k,O,T,M,n,U])}var rS,oS,mp=b(()=>{c();Zt();Co();Nr();ge();Ee();ir();yr();ho();rS=/\w*Compare\b/,oS=/multihierarchySelector\d+(id|-(type|value))/;});function ei(e){let{allLabel:t,asComparison:r,colorKey:o,data:n,defaultValue:a,defaultValueType:s,hideLabel:i,resetSectionVars:l,iconKey:u,id:p,levels:m,limit:d,placeholder:f,searchIndexKey:g,searchIndexSeparator:y,section:T,settings:C}=e,{print:N}=qe(),R=yS(p),M=Qs(p,T,R,r,l==="true"),U=r?`${R}-valueCompare`:`${R}-value`,K=r?`${R}-typeCompare`:`${R}-type`,A=useMantineTheme(),[O,k]=useState(!1),[I,E]=useState(!0),[w,z]=useState(""),[B,D]=useState(!1),[j,V]=useState([""].slice(1)),[L,q]=useState([]),[$,ie]=useState(""),Y=useMemo(()=>N?Array.from(new Set(n.filter(ne=>L.includes(ne[`${$} ID`])))).map(ne=>ne?.[$]).join(", "):"",[N]),re=i==="true"||!e.label?jsx(Fragment,{}):jsx(se,{component:"div",html:e.label,size:"sm",style:C}),Z=useRef(null),te=useRef(!1),H=useRef(!!d&&d<L.length),x=j.length,P=m[x],G=j.filter(Boolean);j.length>0&&G.length===0&&G.push(`${t} ${P?.label}`),useEffect(()=>{let _=new URLSearchParams(window.location.search),ne=_.get(U)||a,oe=_.get(K)||s;ne&&oe?(q(bS(ne,a)),ie(oe)):(q([]),ie(""));},[window.location.search,a,s]),useEffect(()=>{let _=()=>{E(!0);};return window.addEventListener("touchmove",_),()=>{window.removeEventListener("touchmove",_);}},[]);let J=useMemo(()=>fS(n,m,o,u,g,y),[o,n,u,m,g,y]),X=useMemo(()=>{let _=gS(w),ne=Array.from(hS(J,_)).reverse();return B?ne:j.reduce((oe,We)=>oe.filter(be=>!We||be.searchindex.indexOf(We)>-1),ne.filter(oe=>oe.type===P?.value))},[P,J,w,B,j]),le=useRef(null),de=oa({count:O?X.length:0,estimateSize:()=>30,getScrollElement:useCallback(()=>le.current,[]),overscan:10,rangeExtractor:useCallback(_=>cn(_),[])}),[ze,ye]=useState(-1),ve=Math.min(ze,X.length-1),Je=useCallback(_=>{let ne=j.concat(_);B&&D(!1),V(ne);},[B,j]),et=useCallback(()=>{let _=j.slice(0,x-1);B&&D(!1),V(_);},[B,j,x]),it=useCallback(_=>{z(_.currentTarget.value),!H.current&&n.length>0&&k(!0);},[n,z,H,k]),wr=useCallback(()=>{z(""),M([],""),Z.current?.focus(),d&&(H.current=!1);},[z,M,Z,d,H]),Ht=useCallback(_=>{let ne=L.filter(oe=>oe!==_);ne.length>0?M(ne,$):M([],""),d&&ne.length<d&&(H.current=!1);},[L,$,M,d,H]),lt=useCallback(_=>{$!==_.type?M([_.value],_.type):L.includes(_.value)?Ht(_.value):d?(L.length<d&&M([...L,_.value],$),L.length===d&&M([...L.slice(1),_.value],$)):M([...L,_.value],$),z("");},[M,$,L,Ht,d]),or=useCallback(()=>{L.length>0&&w.length===0&&(M(L.slice(0,-1),$),k(!0),d&&(H.current=!1)),w.length>0&&z(w.slice(0,-1));},[M,L,$,w,z,k,d,H]),nr=useCallback(()=>{E(_=>_&&(te.current=_,!_)),ye(_=>_+1>=X.length?_:_+1);},[ye,X]),Ar=useCallback(()=>{let _=X[ve];_&&lt(_);},[X,ve,lt]),no=useCallback(()=>{k(!1);},[k]),_e=useCallback(()=>{et(),ye(0);},[ye,et]),ao=useCallback(()=>{let _=X[ve];!B&&_&&_.type!==m[m.length-1]?.value&&(Je(_.name),ye(0));},[X,ve,B,m,ye,Je]),so=useCallback(()=>{E(_=>_&&(te.current=_,!_)),ye(_=>_-1<0?0:_-1);},[ye]),ar=({label:_,onRemove:ne,...oe})=>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"},...oe,children:[jsx("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:_}),jsx(CloseButton,{"aria-hidden":!0,iconSize:"70%",onMouseDown:ne,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})]}),F=useMemo(()=>L.map(_=>J.find(ne=>ne.value===_)).filter(_=>!!_).map((_,ne)=>createElement(ar,{..._,index:ne,label:_.label,key:_.value,onRemove:oe=>{oe.preventDefault(),oe.stopPropagation(),Ht(_.value);}})),[L]),ce=forwardRef(function({color:ne,icon:oe,label:We,value:be,...Ma},cg){return jsx("div",{ref:cg,style:{cursor:"pointer",width:"100%"},...Ma,children:jsxs(Group,{align:"center",noWrap:!0,spacing:"xs",w:"100%",children:[oe&&jsx(Box,{bg:ne??"transparent",component:"img",w:20,h:20,src:oe}),jsx(Text,{lineClamp:1,size:"sm",children:We||be})]})})});return jsxs(Fragment,{children:[jsx(MediaQuery,{query:"print",styles:{display:"none"},children:jsx(Input.Wrapper,{label:re,children:jsxs(Popover,{closeOnClickOutside:!0,keepMounted:!0,opened:O,onChange:k,onClose:()=>{ye(0),z("");},onOpen:()=>{X.length>0&&de.scrollToIndex(0);},shadow:"sm",width:"target",withinPortal:!0,children:[jsx(Popover.Target,{children:jsxs(Box,{"aria-haspopup":"listbox",component:"div",onMouseLeave:()=>ye(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:L.join(",")}),jsx(Input,{component:"div",multiline:!0,onMouseDown:_=>{_.preventDefault(),!H.current&&n.length>0&&k(!O),Z.current?.focus();},rightSection:L.length>0?jsx(CloseButton,{onClick:wr,onMouseDown:_=>_.preventDefault(),variant:"transparent"}):jsx(IconSelector,{color:A.colors.gray[6],size:18,stroke:1.5}),style:{overflow:"hidden"},w:"100%",children:jsxs(Box,{component:"div","data-clearable":!0,sx:{alignItems:"center",boxSizing:"border-box",display:"flex",flexWrap:"wrap",marginLeft:`calc(-${A.spacing.xs} / 2)`,minHeight:`calc(${rem(36)} - ${rem(2)})`,"&[data-clearable]":{marginRight:rem(36)},"&::placeholder":{color:A.colorScheme==="dark"?A.colors.dark[3]:A.colors.gray[5],opacity:1}},children:[F,jsx("input",{autoComplete:"off","data-mantine-stop-propagation":O,onChange:it,onKeyDown:getHotkeyHandler([["ArrowDown",nr],["ArrowLeft",_e],["ArrowRight",ao],["ArrowUp",so],["Backspace",or],["Enter",Ar],["Escape",no]]),placeholder:L.length===0&&f||"",ref:Z,readOnly:H.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:w})]})})]})}),jsx(Popover.Dropdown,{onMouseDown:_=>_.preventDefault(),p:0,children:jsx("div",{style:{display:"flex",maxHeight:rem(300)},children:jsx(Box,{component:"div","data-combobox-popover":!0,onMouseDown:_=>_.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:_=>{_.stopPropagation();},px:"xs",position:"center",spacing:"xs",children:[jsx(Button,{onClick:()=>{ye(0),D(!0),V([]),X.length>0&&de.scrollToIndex(0);},size:"xs",variant:B?"filled":"outline",children:t}),m.map((_,ne)=>jsx(Button,{onClick:()=>{B&&D(!1);let oe=[""].slice(1),We=ne;for(;We--;)oe[We]=j[We]||"";ye(0),V(oe),X.length>0&&de.scrollToIndex(0);},size:"xs",variant:!B&&j.length===m.findIndex(oe=>oe.value===_?.value)?"filled":"outline",children:_?.label},_?.value))]}),jsx(Divider,{})]}),x>0&&jsxs(Group,{align:"center",noWrap:!0,px:"xs",children:[jsx(ActionIcon,{onClick:et,size:"sm",children:jsx(IconChevronLeft,{})}),jsx("div",{children:G.map(_=>jsx(Text,{lineClamp:1,size:"xs",children:_},`${_}`))})]}),jsx(ScrollArea,{mah:250,onWheel:()=>E(!0),px:"xs",style:{overflow:"auto",width:"100%"},viewportRef:le,viewportProps:{tabIndex:-1},w:"100%",children:jsx("div",{style:{height:`${de.getTotalSize()}px`,position:"relative",width:"100%"},children:de.getVirtualItems().map(_=>{let ne=X[_.index],oe=ve===_.index,We=L.includes(ne.value);return X.length>0&&oe&&!I&&de.scrollToIndex(ve),jsxs(Group,{"aria-selected":oe,align:"center","data-hovered":oe||void 0,"data-index":_.index,"data-selected":We,id:ne.vale,noWrap:!0,onMouseEnter:be=>{be.preventDefault(),be.stopPropagation(),I&&(ye(_.index),E(!1));},onMouseMove:be=>{be.preventDefault(),be.stopPropagation(),E(!0);},onMouseDown:be=>{be.preventDefault(),lt(ne);},position:"apart",ref:de.measureElement,role:"option",spacing:"xs",sx:be=>({borderRadius:be.radius.xs,padding:"15px 5px 15px",paddingLeft:B&&10*m.findIndex(Ma=>Ma?.value===ne.type)||5,position:"absolute",top:0,left:0,height:`${_.size}px`,transform:`translateY(${_.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(ce,{index:_.index,...ne}),!B&&ne.type!==m[m.length-1]?.value&&jsx(ActionIcon,{onMouseDown:be=>{be.preventDefault(),be.stopPropagation(),Je(ne.name);},size:"sm",tabIndex:-1,children:jsx(IconChevronRight,{})})]},ne.value)})})})]})})})})]})})}),N&&jsxs(Text,{children:[re,": ",Y]})]})}var fS,gS,hS,yS,bS,Tp=b(()=>{c();Xs();Ie();Qt();mp();fS=(e=[],t=[],r="",o="",n="",a="|")=>{let s=t.map(y=>y.value).slice(),i=`${s.pop()}`,l=y=>y[r],u=y=>y[o],p=y=>{if(y[n])return typeof y[n]=="string"?y[n].split(a):y[n]},m=new Set,d=[],f=[],g=nest().rollup(y=>{let T=y[0],C=k=>k&&k.value&&!m.has(k.value),N=s.map(k=>T[`${k} ID`]),R=s.map(k=>T[k]),M=s.map((k,I)=>{if(f[I]!==R[I]){f[I]=R[I];let E=l[I]||l[l.length-1]||l,w=u[I]||u[u.length-1]||u,z=p[I]||p[p.length-1]||p;return {color:E(T,k)||void 0,icon:w(T,k)||void 0,value:`${N[I]}`,label:R[I],name:R[I],type:k,searchindex:R.slice(0,I+1).concat(z(T,k)).join("|")}}return {}}).filter(C);M.forEach(k=>m.add(k.value));let U=l[l.length-1]||l,K=u[u.length-1]||u,A=p[p.length-1]||p,O=y.map(k=>({color:U(k,i)||void 0,icon:K(k,i)||void 0,value:`${k[`${i} ID`]}`,label:k[i],name:k[i],type:i,searchindex:R.concat(k[i]).concat(A(k,i)).join("|")}));d.push(...M.concat(O));});return s.forEach(y=>{g.key(T=>`${T[`${y} ID`]}|${T[y]}`);}),g.entries(e),d},gS=e=>{if(!e)return /./i;let t=e.normalize("NFD").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"[^|]+");return RegExp(t,"i")},hS=(e,t)=>{let r=e.length,o,n=i=>o&&o.searchindex.includes(i.searchindex),s={next:()=>{for(let i=r-1;i>-1;i--){let l=e[i];if(t.test(`${l.value} ${l.label} ${l.searchindex}`)||n(l))return o=l,r=i,{done:!1,value:l}}return {done:!0,value:void 0}},[Symbol.iterator]:()=>s};return s},yS=e=>`multihierarchySelector${e}`,bS=(e,t)=>e&&typeof e=="string"?e.split(","):t;});function TS(e={required:!1}){let{update:t,data:r,status:o}=useSession(e);return {update:t,user:r?.user,status:o,isLoading:o==="loading"}}var xp,Rp=b(()=>{c();xp=TS;});function la(e){let{asPath:t,locale:r,defaultLocale:o}=useRouter(),[n,a]=useState(!0),{user:s,isLoading:i}=xp(),[l,u]=useState({resolved:!1,blocks:[]}),p=Ye(),[,m]=t.split("?"),d=m?Object.fromEntries(new URLSearchParams(`?${m}`)):{},f=Q(E=>E),g=xs().data,y=g&&g[0].id,T=Q(E=>E.variables.attributes),C=Mt(f),N=gr(f),R=hr(f),M=wt(N,r),U=Q(E=>E.variables.variables),K=Q(E=>E.variables.status),A=Vt(),{addRunConsumersRunning:O,removeRunConsumersRunning:k}=To(),I=useMemo(()=>Object.keys(T).filter(E=>E.startsWith("id")).map(E=>T[E]).join("-"),[T]);return useEffect(()=>{if(l.blocks.length>0&&p(nt.removeBlocksFromState(l.blocks)).then(()=>{u({resolved:!1,blocks:[]});}),l.blocks.length>0&&u({resolved:!1,blocks:[]}),!i&&s&&y){let E=Object.keys(Object.values(C).reduce((w,z)=>(z.type!=="fallback"?w[z.section_id]=!0:w[z.section_id]=!1,w),{})).map(w=>parseInt(w,10));p(nt.readPrivateBlocks({report_id:y,locale:r||o||"en",section_id:E})).then(w=>{if(w.data&&w.data.length){let z=w.data.reduce((B,D)=>({...B,[D.id]:D}),[]);p(nt.addBlockToState(z)).then(()=>{u({resolved:!0,blocks:w.data.map(B=>B.id)});});}u({resolved:!0,blocks:[]}),a(!1);}).catch(()=>{u({resolved:!0,blocks:[]}),a(!1);});}!i&&!s&&(u({resolved:!0,blocks:[]}),a(!1));},[I,s,i,y,r]),useEffect(()=>{if((Object.keys(d).some(w=>w!==e)||l.blocks.length>0)&&l.resolved){let w=Object.keys(d).map($=>Number($.match(/\d+/))).filter($=>C[$]),z=Array.from(new Set(w.filter($=>$!==0).concat(l.blocks))),B={...f.variables},D=[],j=[];z.forEach($=>{let ie=C[$];Dn(ie,C,$,D,!0,!0,j);});let V={},L=z.filter($=>(V[C[$].section_id]=!0,!j.includes($))),q=Object.keys(V).map($=>parseInt($,10));O(q),Promise.all(L.map($=>{let Y=C[$].consumers.reduce((Z,te)=>({...Z,...U[te]}),{}),re={locale:ht,query:d,variables:{...Y,...T}};return Pt(C,void 0,$,M,re,{variables:U,status:K},A,"report",R)})).then($=>($.forEach((ie,Y)=>{let re=L[Y],Z=C[re],te=[],H=[];Dn(Z,C,re,te,!0,!0,H);let x={},P={};H.forEach(G=>{x[G]=ie.status[G],P[G]=ie.variables[G];}),B.status={...B.status,...x,[re]:{...ie.status[re]}},B.variables={...B.variables,...P,[re]:{...ie.variables[re]}};}),B)).then($=>{p(pr.setVariableChange({...$,attributes:T})),k(q);});}},[l.resolved]),n||!l.resolved}var Cp=b(()=>{c();ge();yr();yr();ir();Vn();Nr();Rp();ge();ho();Co();Ee();});function ca(){let e=useRouter(),t=useRef(!1),r=500;useEffect(()=>{let o=()=>{let{asPath:a}=e;if(!t.current&&a.includes("#")){let s=a.split("#")[1],i=document.getElementById(s);i&&(t.current=!0,setTimeout(()=>{i.scrollIntoView({behavior:"smooth"}),t.current=!1;},r));}};o();let n=()=>{o();};return e.events.on("hashChangeComplete",n),()=>{e.events.off("hashChangeComplete",n);}},[e]);}var ti=b(()=>{c();});function AS(e,t){let r=[],o={},n=1/0;for(let a of e){let s=parseInt(a.settings.order);s<n&&(n=s);}for(let a of e){let{id:s,settings:i}=a,l=parseInt(i.order),u=t[s]?t[s]:!1,p=wS(u,s),m={id:s,order:l,label:t[s]?t[s][`title${s}title`]:`Title ${s}`,iconProps:p,children:[]};if(o[s]=m,l===n)r.push(m);else {let d=l-1,f;for(let g=e.indexOf(a)-1;g>=0;g--){let y=e[g],T=parseInt(y.settings.order);if(T===d){f=o[y.id];break}else if(T<d){f=o[y.id];break}}f?f.children.push(m):r.push(m);}}return r}function wo(e=1,t=6,r=[]){let o=Q(d=>d),n=Q(d=>d.variables.variables),a=Q(d=>d.variables.status),s=Jo(),i=Wc(o).filter(d=>d.type===h.TITLE&&r.includes(d.id)),l=Object.fromEntries(i.map(d=>[d.id,d])),u=Object.fromEntries(i.map(d=>[d.id,n[d.id]])),p=Object.fromEntries(i.map(d=>[d.id,a[d.id]])),m=useMemo(()=>{if(s.isSuccess&&l){let d=[];return s.data.sort(Ke).forEach(f=>{let g=f.blocks.reduce((y,T)=>l[T]&&l[T].type===h.TITLE?y.concat([l[T]]):y,[]);d=d.concat(g.sort((y,T)=>Ke(y,T,"blockrow")));}),Object.keys(a).length?d.filter(f=>{let g=parseInt(f.settings.order||"1",10);return g>=e&&g<=t&&p[f.id]?.allowed&&!p[f.id]?.hiddenByCascade}):[]}},[r,s,l,p]);return useMemo(()=>m&&m?.length>0?AS(m,u):[],[m,u])}var wS,ri=b(()=>{c();ge();yr();io();he();wS=(e,t)=>({iconType:e[`title${t}_iconType`],icon:e[`title${t}_icon`],iconSize:e[`title${t}_iconSize`],iconVariant:e[`title${t}_iconVariant`],iconRadius:e[`title${t}_iconRadius`]});});var oi=b(()=>{c();Cp();Gs();ti();ri();});function un(){let e=useContext(Ap);if(e===void 0)throw new Error("usePdf must be used within a PdfProvider");return e}function ni({children:e}){let{query:t}=useRouter(),o=Q(a=>Object.values(a.records.entities.report)[0]).settings,n=Hg(t.print)??!1;return jsx(Ap.Provider,{value:{active:o.pdf||!1,pdfParam:n,position:o.position||"DEFAULT",XlsxVizActive:o.XlsxViz||!1},children:e})}var _S,Ap,ua=b(()=>{c();ge();_S={active:!1,pdfParam:!1,position:"DEFAULT",XlsxVizActive:!1},Ap=createContext(_S);});var ai=b(()=>{c();ge();});var Pp=b(()=>{c();});var si=b(()=>{c();Wt();});var Lp=b(()=>{c();ge();si();});var ii=b(()=>{c();si();Lp();ri();});function pa(e,t){return e===t}var li=b(()=>{c();Ee();ai();Pp();ii();});var Bp,ma,Mp,fa=b(()=>{c();Bp=(e,t,r,o=null)=>{let[n,a]=useState(!1),[s,i]=useState(null);return {print:u=>{a(!0),i(null);let p=process.env.NEXT_PUBLIC_REPORTS_BASE_URL,m=new URLSearchParams(window.location.search),d=u?"&transparent=true":"",f=o?`/embeds/${t}/${r}?section=${e}&block=${o}${m.toString()?"&"+m.toString():""}`:`/embeds/${t}/${r}?section=${e}${m.toString()?"&"+m.toString():""}`,g=encodeURIComponent(`${p}${f}&print=true`);Nn.get(`${process.env.NEXT_PUBLIC_PDF_API_URL}/screenshot?url=${g}${d}`,{responseType:"blob"}).then(y=>{let T=o?`section${e}_block${o}.png`:`section${e}.png`;saveAs(y.data,T);}).catch(y=>{i(y.response?.data?.message||"Failed to download image. Please try again.");}).finally(()=>{a(!1);});},downloadLoading:n,error:s}},ma=()=>{let{asPath:e}=useRouter(),[t,r]=useState(!1),[o,n]=useState(null);return {printReport:()=>{r(!0),n(null);let s=process.env.NEXT_PUBLIC_REPORTS_BASE_URL,i=e.replace(/[&?]printBtn=[^&]+/,""),l=i.includes("?")?"&":"?",u=encodeURIComponent(`${s}${i}${l}print=true`);return Nn.get(`${process.env.NEXT_PUBLIC_PDF_API_URL}/pdf?url=${u}`,{responseType:"blob"}).then(p=>{let d=p.headers["content-disposition"]?.match(/filename[^;=\n]*=(['"]?)(.*?)\1/),f=d&&d[2]?d[2]:"report.pdf";saveAs(p.data,f);}).catch(p=>{n(p.response?.data?.message||"Failed to generate PDF. Please try again.");}).finally(()=>{r(!1);})},error:o,setError:n,downloadLoading:t}},Mp=()=>!!process.env.NEXT_PUBLIC_PDF_API_URL;});function $p({contentOutline:e=[]}){return jsx(Menu,{children:zp(e)})}function zp(e,t=!0){return e.map((r,o)=>t?jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${r.id}`,children:jsx(Group,{children:jsx(Text,{dangerouslySetInnerHTML:{__html:r.label}})})})}),r.children.length?jsx(Box,{ml:"md",children:zp(r.children,!1)}):null]},o):jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${r.id}`,children:jsx(Text,{dangerouslySetInnerHTML:{__html:r.label}})})},o))}function ui({headings:e,settings:t,type:r}){let{min:o="1",max:n="6",icons:a="yes"}=t||{},s=wo(parseInt(o,10),parseInt(n,10),e),i=a==="yes",u=`(max-width: ${useMantineTheme().breakpoints.md})`,p=useMediaQuery(u),m=Ro(t&&t.align?String(t.align):"left");return p?jsx(HS,{contentOutline:s,showIcons:i}):r==="multilevel"?jsx(jS,{contentOutline:s,showIcons:i,align:m}):jsx(qS,{contentOutline:s,showIcons:i,align:m})}var Dp,qS,Up,HS,jS,Gp=b(()=>{c();oi();Yr();Ge();ua();li();fa();Dp=e=>t=>({display:"flex",gap:t.spacing.md,justifyContent:e,listStyleType:"none"});qS=({contentOutline:e,showIcons:t,align:r})=>{let{active:o,position:n,pdfParam:a}=un(),{downloadLoading:s,printReport:i}=ma(),[l,u]=useState(null);if(useEffect(()=>{let m=()=>{let d=document.querySelector(".bespoke-nav");if(!d)return;let f=d.getBoundingClientRect(),g=!1;e.forEach(y=>{let T=document.getElementById(`bespoke-title-${y.id}`);T&&T.getBoundingClientRect().top<=f.bottom&&(u(y.id),g=!0);}),g||u(null);};return window.addEventListener("scroll",m),()=>{window.removeEventListener("scroll",m);}},[e]),o&&a)return jsx($p,{contentOutline:e});let p=m=>!m||!m?.length?null:jsx(Fragment,{children:m.map(d=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${d.id}`,children:jsxs(Group,{spacing:"sm",children:[t&&jsx(ke,{...d.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:d.label}})]})})}),jsx(Box,{pl:"xs",children:p(d.children)})]},d.id))});return jsxs(Box,{component:"nav",className:"bespoke-nav",children:[jsx(List,{sx:m=>({display:"flex",gap:m.spacing.md,justifyContent:r,listStyleType:"none"}),children:e?.map(m=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${m.id}`,"data-active":m.id===l,children:jsxs(Group,{spacing:"sm",children:[t&&jsx(ke,{...m.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:m.label}})]})})}),m?.children?.length?jsx(Menu.Dropdown,{children:p(m.children)}):null]})},m.id))}),pa(n,"NAV")&&o&&e.length>=1&&jsx(List.Item,{children:jsx(Button,{variant:"outline",onClick:i,children:s?"Downloading":"Download PDF"})})]})},Up=({contentOutline:e,closeNav:t,showIcons:r})=>{let[o,n]=useState(null);return jsx(Stack,{children:e.map(a=>a.children.length?jsxs(Fragment,{children:[jsxs(Group,{spacing:0,noWrap:!0,children:[jsx(UnstyledButton,{w:"100%",component:"a",onClick:t,href:`#bespoke-title-${a.id}`,children:jsxs(Group,{spacing:"sm",noWrap:!0,children:[r&&jsx(ke,{...a.iconProps,iconSize:"sm",iconPadding:"2"}),jsx(Text,{dangerouslySetInnerHTML:{__html:a.label}})]})},a.id),jsx(ActionIcon,{component:"a",size:"lg",onClick:()=>n(s=>s===a.id?null:a.id),children:jsx(IconChevronDown,{style:{transition:"transform 0.2s",transform:o===a.id?"rotate(-180deg)":"none"},stroke:1})})]},a.id),jsx(Collapse,{in:o===a.id,pl:"sm",transitionTimingFunction:"linear",transitionDuration:200,children:jsx(Up,{contentOutline:a.children,closeNav:t,showIcons:r})})]}):jsx(Group,{noWrap:!0,children:jsx(UnstyledButton,{display:"flex",w:"100%",component:"a",href:`#bespoke-title-${a.id}`,children:jsxs(Group,{spacing:"sm",children:[r&&jsx(ke,{...a.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:a.label}})]})},a.id)},a.id))})},HS=({contentOutline:e,showIcons:t})=>{let[r,{toggle:o}]=useDisclosure(!1),n=r?"Close content outline":"Open content outline",{active:a,pdfParam:s}=un();return a&&s?jsx($p,{contentOutline:e}):jsxs(Box,{component:"nav",children:[jsx(Group,{children:jsx(Burger,{opened:r,onClick:o,"aria-label":n,size:"md"})}),jsx(Collapse,{in:r,mt:"md",children:jsx(Up,{contentOutline:e,closeNav:o,showIcons:t})})]})},jS=({contentOutline:e,showIcons:t,align:r})=>{let[o,n]=useState(null),[a,s]=useState(null);useEffect(()=>{let l=()=>{let u=document.querySelector(".bespoke-nav");if(!u)return;let p=u.getBoundingClientRect(),m=!1;e.forEach(d=>{let f=document.getElementById(`bespoke-title-${d.id}`);f&&(f.getBoundingClientRect().top<=p.bottom&&(n(d.id),s(null),m=!0),d.children.forEach(y=>{let T=document.getElementById(`bespoke-title-${y.id}`);T&&T.getBoundingClientRect().top<=p.bottom&&(s(y.id),n(d.id),m=!0);}));}),m||(n(null),s(null));};return window.addEventListener("scroll",l),()=>{window.removeEventListener("scroll",l);}},[e]);let i=l=>!l||!l?.length?null:jsx(Fragment,{children:l.map(u=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${u.id}`,children:jsxs(Group,{spacing:"sm",children:[t&&jsx(ke,{...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:Dp(r),children:e?.map(l=>jsx(List.Item,{children:jsx(Anchor,{href:`#bespoke-title-${l.id}`,"data-active":o===l.id,onClick:()=>n(l.id),children:jsxs(Group,{spacing:"sm",children:[t&&jsx(ke,{...l.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:l.label}})]})})},l.id))}),o&&e.find(l=>l.id===o)?.children.length>0&&jsx(List,{className:"bespoke-nav-level2",sx:Dp(r),children:e.find(l=>l.id===o)?.children.map(l=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${l.id}`,"data-active":l.id===a,children:jsxs(Group,{spacing:"sm",children:[t&&jsx(ke,{...l.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:l.label}})]})})}),l?.children?.length?jsx(Menu.Dropdown,{children:i(l.children)}):null]})},l.id))})]})};});function mi(e){let{related_reports:t,settings:r}=e,o=Q(d=>d.status.currentLocale),n=Q(d=>d.status.localeDefault),a=Xn(),s=useRouter(),{components:i}=st();if(!t?.length)return;let l=o===n?"":`/${o}`,u=d=>{s.push(`${d}`);},p=i?.ReportTile?i.ReportTile:_s,m=Nt(r&&r.align?String(r.align):"center");return jsx(Grid,{justify:m,children:t.map(d=>{let f=`${l}${a}${d.link}`,g=d.entities.map(R=>({original_id:R.id,name:R.name,id:R.content_id,variant:R.variant_name,variant_id:R.variant_id,dimension:R.dimension_name,dimension_id:R.dimension_id,image:{src:`/api/cms/member/image?member=${R.content_id}&size=thumb`,alt:R.name}})),y=d.entities.map(R=>R.id).join("-"),T=d.entities.map(R=>R.name).join(" & "),C=d.entities[0]?d.entities[0].report_id:null,N=R=>{R.preventDefault(),u(f);};return jsx(Grid.Col,{xs:12,sm:6,md:4,lg:4,xl:3,children:jsx(p,{reportId:C,reportName:T,members:g,href:f,onClick:N})},y)})})}var Hp=b(()=>{c();ge();Ee();Bs();Xr();Ge();});function fi({id:e,label:t,settings:r,showIcon:o,fullWidth:n,showWhenDisabled:a}){let s=bt(e).data,{sectionVariables:i,resetSectionVariables:l}=Pe(s?.section_id),u=!!Object.keys(i).length,p=Nt(r&&r.align?r.align:"left");return !u&&!a?null:jsx(Button,{onClick:()=>l(),disabled:!u,fullWidth:n,sx:{justifySelf:p},children:jsxs(Group,{align:"center",children:[t,o&&jsx(IconRefresh,{})]})})}var Wp=b(()=>{c();Ee();Ee();Ge();});function gi({settings:e,label:t,removeLabel:r,showIcon:o,position:n="center",asComparison:a=!1}){let s=Q(R=>R.records.entities.report),i=Q(R=>R.variables.attributes),l=e&&e.search?e.search:"inline",u=Object.values(s)[0].settings,p=useRouter(),{comparisonLoaded:m,loading:d}=Qe(),f=Object.keys(p.query).includes("compare"),y=m&&f?jsx(Button,{onClick:()=>{let R={...p.query};delete R.compare,p.push({pathname:p.pathname,query:R},void 0,{shallow:!0});},rightIcon:jsx(IconX,{}),children:r||"Remove Comparison"}):jsx(Button,{loading:d,children:jsxs(Group,{align:"center",children:[t||"Add Comparison",o&&jsx(IconPlus,{})]})}),T={searchReportParams:{report:[Number(Object.keys(s)[0])],variant:u.compareLevels?[]:[i.variant_id1]}},N=on(y,l,R=>{p.push({pathname:p.pathname,query:{...p.query,compare:R.reportPath}});},T);return a?null:jsx(Group,{position:n,children:f?y:N})}var Xp=b(()=>{c();Fs();ge();Zt();});function yi({columns:e=[],data:t=[],tableProps:r={},sectionId:o=null}){let[n,a]=useState(!1),[s,i]=useState({}),l=useMemo(()=>e.map(d=>d.accessorKey),[e]),u=useMemo(()=>t.filter(d=>typeof d=="object"&&d!==null&&!Array.isArray(d)&&Object.keys(d).some(f=>l.includes(f))),[l,t]),p=useMemo(()=>e.map(d=>({...d,Cell:({renderedCellValue:f})=>jsx(se,{html:`${f}`}),filterFn:"contains"})),[e]),{locale:m}=useRouter();return useEffect(()=>{(async()=>{try{let f=m||"en",g=`${f.toUpperCase()}`,y=await import(`mantine-react-table/locales/${f}.js`);i(y[`MRT_Localization_${g}`]);}catch(f){console.error("Error loading translations:",f);}})();},[m]),jsx(MantineReactTable,{...r,autoResetPageIndex:!1,columns:p,data:u,enableColumnFilterModes:!0,enableFilterMatchHighlighting:!1,globalFilterFn:"contains",layoutMode:"grid",localization:s,onIsFullScreenChange:d=>{let f=document.getElementById(`section-${o}`);f&&(d?f.style.zIndex="10":f.style.zIndex="1"),a(d);},state:{...r.state,isFullScreen:n}})}var Jp=b(()=>{c();Ie();});function bi({label:e,url:t,settings:r}){let{align:o}=r;return e?jsx(Group,{position:o,grow:o==="justify",children:jsx(Button,{component:"a",target:"_blank",href:t||"",children:e||"Button"})}):null}var td=b(()=>{c();});function pT({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 vi(e){let t=dT();return jsx(t,{block:e})}var dT,nd=b(()=>{c();Xr();dT=()=>{let{components:e}=st(),t=pT;return e?.CustomFallback&&(t=e.CustomFallback),t};});var fT,gT,ad,sd,ha,hT,Tr,mn=b(()=>{c();An();fT=process.env.NEXT_PUBLIC_REPORTS_LOCALE_DEFAULT||"en",gT="Error Rendering Visualization",ad={data:[],dataFormat:e=>e,type:"Treemap",noDataHTML:`<p style="font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;">
55
55
  <strong>${gT}</strong>
56
- </p>`},sd=(e,t)=>t.find(o=>{let n=o.content?.pattern;if(!n||!o.content?.useProxy)return !1;try{return new RegExp(n).test(e)}catch{return !1}})?`${process.env.NEXT_PUBLIC_REPORTS_BASE_URL}/api/cms/url/proxy?url=${encodeURIComponent(e)}&wrapper=false`:e,ha=(e,t)=>typeof e=="string"?sd(e,t):Array.isArray(e)?e.map(r=>typeof r=="string"?sd(r,t):r):e,hT=(e,t,r={},o=fT,n=null,a={},s={},i=[])=>{let l;try{l=An({vars:["variables"],logic:e},t,o,a,s)(r),l.data=ha(l.data,i),l._downloadUrl&&(l.__downloadUrl=ha(l.__downloadUrl,i));}catch(f){return console.error(`Parsing Error in propify (ID: ${n})`),console.error(`Error message: ${f.message}`),{error:`${f}`,config:ad}}if(typeof l!="object")return {error:"Visualization JS code must return an object",config:ad};let u=l.dataFormat?l.dataFormat:f=>{let y=Array.isArray(l.data)&&l.data.length>1&&l.data.some(T=>typeof T=="string")?f:[f];return dataConcat(y,"data")};delete l.dataFormat;let p=l.linksFormat||void 0;delete l.linksFormat;let m=l.nodesFormat||void 0;delete l.nodesFormat;let d=l.topojsonFormat||void 0;return delete l.topojsonFormat,{config:l,dataFormat:u,linksFormat:p,nodesFormat:m,topojsonFormat:d}},Tr=hT;});var to,Si=b(()=>{c();to=class extends Jt__default.Component{constructor(t){super(t),this.state={hasError:!1};}static getDerivedStateFromError(t){return console.info("getDerivedStateFromError",t),{hasError:!0}}componentDidCatch(t,r){console.error("Error information:",r.componentStack),notifications.show({autoClose:!1,color:"red",id:"revalidate-error",message:"Check the console for more details",title:t.message});}render(){return this.state.hasError?this.props.fallback:this.props.children}};});function fn({config:e}){return !e||!e.html?null:jsx("div",{className:"bespoke-html",dangerouslySetInnerHTML:{__html:e.html}})}var Ti=b(()=>{c();});var cd={};Na(cd,{default:()=>ld});function ld(e){let{print:t}=qe(),{block:r,active:o,locale:n,variables:a,configOverride:s={}}=e,i=Be(r),l=_t(n),u={variables:a},p=useRouter(),{sectionVariables:m,setSectionVariables:d,resetSectionVariables:f}=Pe(r.section_id),g=fr(),y=JSON.stringify(m),T=useMemo(()=>{if(!i?.logic)return {error:"Add a Configuration"};let K=ut({logic:i.logic},l,u).logic,w={router:p,section:{variables:m,setVariables:d,resetVariables:f}};return Tr(K,l,a,n,r.id,{},w,g)},[r,o,a,y]),{type:C}=T.config||{},N=C&&xi[C]?C:"Treemap";xi[C]||(T.config={error:`"${C}" is not a valid Visualization Type`});let R=xi[N],M=useMemo(()=>{let{_data:K,...w}=T.config;return xT(w,t)},[T,t]),U={locale:n,variables:a,...M,...s};return jsx("div",{className:"bespoke-Viz","data-ignore-print":U._printIgnore?"true":void 0,children:jsx("div",{style:{display:"flex",flex:"1 1 100%",minHeight:C==="HTML"?void 0:400},children:jsx(to,{fallback:jsx("p",{children:"Error in d3plus viz config."}),children:jsx(R,{style:{flex:1},dataFormat:K=>{let w;try{w=T.dataFormat(K);}catch(O){console.error("Error in dataFormat: ",O),w=[];}return w},linksFormat:T.linksFormat,nodesFormat:T.nodesFormat,topojsonFormat:T.topojsonFormat,config:{...U,sectionVariables:y}},"viz-key")})})})}var xi,xT,ud=b(()=>{c();Mr();mn();_r();Ee();Si();Qt();Ti();xi={...ST,HTML:fn},xT=(e,t)=>{let r={...e};return t&&(r.detectResize=!1,r.detectResizeDelay=0,r.detectVisible=!1,r.detectVisibleInterval=0,r.duration=0,r.shapeConfig={...r.shapeConfig,duration:0}),r};});var ET,kT,pd,dd=b(()=>{c();he();Qc();ou();au();Qu();tp();rp();op();Tp();Gp();Hp();Wp();Xp();Jp();td();nd();ET=RT(()=>Promise.resolve().then(()=>(ud(),cd)),{ssr:!1}),kT={[h.PARAGRAPH]:Cs,[h.STAT]:ws,[h.SUBTITLE]:Ps,[h.TITLE]:Us,[h.SELECTOR]:Ws,[h.VIZ]:ET,[h.GENERATOR]:ta,[h.SECTION_FLAG]:ta,[h.IMAGE]:Ks,[h.NAV]:ui,[h.RELATED]:mi,[h.RESET_BUTTON]:fi,[h.COMPARISON_BUTTON]:gi,[h.TABLE]:yi,[h.BUTTON]:bi,[h.MULTIHIERARCHY_SELECTOR]:ei,[h.FALLBACK]:vi},pd=kT;});var CT,md,fd=b(()=>{c();CT=(e,t)=>{let r=e.allLabel||"All",o=e.colorKey||"",n=e.data||[],a=e.hideLabel||"false",s=e.resetSectionVars||"false",i=e.iconKey||"",l=e.label||"Unlabeled Multihierarchy Selector",u=e.levels||[],p=e.limit||void 0,m=e.placeholder||"",d=e.searchIndexKey||"",f=e.searchIndexSeparator||"",g,y;return e.defaultValue&&e.defaultValueType&&(g=e.defaultValue,y=e.defaultValueType),(!g||!y)&&(g=[],y=""),{allLabel:r,colorKey:o,data:n,defaultValue:g,defaultValueType:y,hideLabel:a,resetSectionVars:s,iconKey:i,id:t,label:l,levels:u,limit:p,placeholder:m,searchIndexKey:d,searchIndexSeparator:f}},md=CT;});var AT,gd,wT,hd,yd=b(()=>{c();he();On();AT=e=>Array.isArray(e)?e.map(t=>typeof t=="string"?{id:t,label:t}:t):[],gd=(e,t)=>t===Ce.MULTI&&!Array.isArray(e)?[e]:e,wT=(e,t)=>{let r=e.type||Ce.SINGLE,o=e.component||"Selector",n=e.hideLabel||"false",a=e.resetSectionVars||"false",s=e.name||"Unlabeled Selector",i=AT(e.options||[]),l;if(e.defaultValue){let u=gd(e.defaultValue,r);Br(r,u,i)&&(l=u);}if(!l){let u=i&&i[0]&&i[0].id||i[0]||"";l=gd(u,r);}return {id:t,name:s,type:r,options:i,component:o,defaultValue:l,hideLabel:n,resetSectionVars:a}},hd=wT;});var PT,hn,bd=b(()=>{c();he();fd();yd();PT={[h.SELECTOR]:hd,[h.MULTIHIERARCHY_SELECTOR]:md},hn=PT;});function Ei({paragraph:e,tooltip:t,settings:r}){return jsx(se,{component:"p",html:e||`Lorem ipsum dolor sit amet,
56
+ </p>`},sd=(e,t)=>t.find(o=>{let n=o.content?.pattern;if(!n||!o.content?.useProxy)return !1;try{return new RegExp(n).test(e)}catch{return !1}})?`${process.env.NEXT_PUBLIC_REPORTS_BASE_URL}/api/cms/url/proxy?url=${encodeURIComponent(e)}&wrapper=false`:e,ha=(e,t)=>typeof e=="string"?sd(e,t):Array.isArray(e)?e.map(r=>typeof r=="string"?sd(r,t):r):e,hT=(e,t,r={},o=fT,n=null,a={},s={},i=[])=>{let l;try{l=wn({vars:["variables"],logic:e},t,o,a,s)(r),l.data=ha(l.data,i),l._downloadUrl&&(l.__downloadUrl=ha(l.__downloadUrl,i));}catch(f){return console.error(`Parsing Error in propify (ID: ${n})`),console.error(`Error message: ${f.message}`),{error:`${f}`,config:ad}}if(typeof l!="object")return {error:"Visualization JS code must return an object",config:ad};let u=l.dataFormat?l.dataFormat:f=>{let y=Array.isArray(l.data)&&l.data.length>1&&l.data.some(T=>typeof T=="string")?f:[f];return dataConcat(y,"data")};delete l.dataFormat;let p=l.linksFormat||void 0;delete l.linksFormat;let m=l.nodesFormat||void 0;delete l.nodesFormat;let d=l.topojsonFormat||void 0;return delete l.topojsonFormat,{config:l,dataFormat:u,linksFormat:p,nodesFormat:m,topojsonFormat:d}},Tr=hT;});var to,Si=b(()=>{c();to=class extends Jt__default.Component{constructor(t){super(t),this.state={hasError:!1};}static getDerivedStateFromError(t){return console.info("getDerivedStateFromError",t),{hasError:!0}}componentDidCatch(t,r){console.error("Error information:",r.componentStack),notifications.show({autoClose:!1,color:"red",id:"revalidate-error",message:"Check the console for more details",title:t.message});}render(){return this.state.hasError?this.props.fallback:this.props.children}};});function fn({config:e}){return !e||!e.html?null:jsx("div",{className:"bespoke-html",dangerouslySetInnerHTML:{__html:e.html}})}var Ti=b(()=>{c();});var cd={};Na(cd,{default:()=>ld});function ld(e){let{print:t}=qe(),{block:r,active:o,locale:n,variables:a,configOverride:s={}}=e,i=Be(r),l=_t(n),u={variables:a},p=useRouter(),{sectionVariables:m,setSectionVariables:d,resetSectionVariables:f}=Pe(r.section_id),g=fr(),y=JSON.stringify(m),T=useMemo(()=>{if(!i?.logic)return {error:"Add a Configuration"};let K=ut({logic:i.logic},l,u).logic,A={router:p,section:{variables:m,setVariables:d,resetVariables:f}};return Tr(K,l,a,n,r.id,{},A,g)},[r,o,a,y]),{type:C}=T.config||{},N=C&&xi[C]?C:"Treemap";xi[C]||(T.config={error:`"${C}" is not a valid Visualization Type`});let R=xi[N],M=useMemo(()=>{let{_data:K,...A}=T.config;return xT(A,t)},[T,t]),U={locale:n,variables:a,...M,...s};return jsx("div",{className:"bespoke-Viz","data-ignore-print":U._printIgnore?"true":void 0,children:jsx("div",{style:{display:"flex",flex:"1 1 100%",minHeight:C==="HTML"?void 0:400},children:jsx(to,{fallback:jsx("p",{children:"Error in d3plus viz config."}),children:jsx(R,{style:{flex:1},dataFormat:K=>{let A;try{A=T.dataFormat(K);}catch(O){console.error("Error in dataFormat: ",O),A=[];}return A},linksFormat:T.linksFormat,nodesFormat:T.nodesFormat,topojsonFormat:T.topojsonFormat,config:{...U,sectionVariables:y}},"viz-key")})})})}var xi,xT,ud=b(()=>{c();Mr();mn();_r();Ee();Si();Qt();Ti();xi={...ST,HTML:fn},xT=(e,t)=>{let r={...e};return t&&(r.detectResize=!1,r.detectResizeDelay=0,r.detectVisible=!1,r.detectVisibleInterval=0,r.duration=0,r.shapeConfig={...r.shapeConfig,duration:0}),r};});var ET,kT,pd,dd=b(()=>{c();he();Qc();ou();au();Qu();tp();rp();op();Tp();Gp();Hp();Wp();Xp();Jp();td();nd();ET=RT(()=>Promise.resolve().then(()=>(ud(),cd)),{ssr:!1}),kT={[h.PARAGRAPH]:Cs,[h.STAT]:As,[h.SUBTITLE]:Ps,[h.TITLE]:Us,[h.SELECTOR]:Ws,[h.VIZ]:ET,[h.GENERATOR]:ta,[h.SECTION_FLAG]:ta,[h.IMAGE]:Ks,[h.NAV]:ui,[h.RELATED]:mi,[h.RESET_BUTTON]:fi,[h.COMPARISON_BUTTON]:gi,[h.TABLE]:yi,[h.BUTTON]:bi,[h.MULTIHIERARCHY_SELECTOR]:ei,[h.FALLBACK]:vi},pd=kT;});var CT,md,fd=b(()=>{c();CT=(e,t)=>{let r=e.allLabel||"All",o=e.colorKey||"",n=e.data||[],a=e.hideLabel||"false",s=e.resetSectionVars||"false",i=e.iconKey||"",l=e.label||"Unlabeled Multihierarchy Selector",u=e.levels||[],p=e.limit||void 0,m=e.placeholder||"",d=e.searchIndexKey||"",f=e.searchIndexSeparator||"",g,y;return e.defaultValue&&e.defaultValueType&&(g=e.defaultValue,y=e.defaultValueType),(!g||!y)&&(g=[],y=""),{allLabel:r,colorKey:o,data:n,defaultValue:g,defaultValueType:y,hideLabel:a,resetSectionVars:s,iconKey:i,id:t,label:l,levels:u,limit:p,placeholder:m,searchIndexKey:d,searchIndexSeparator:f}},md=CT;});var wT,gd,AT,hd,yd=b(()=>{c();he();On();wT=e=>Array.isArray(e)?e.map(t=>typeof t=="string"?{id:t,label:t}:t):[],gd=(e,t)=>t===Ce.MULTI&&!Array.isArray(e)?[e]:e,AT=(e,t)=>{let r=e.type||Ce.SINGLE,o=e.component||"Selector",n=e.hideLabel||"false",a=e.resetSectionVars||"false",s=e.name||"Unlabeled Selector",i=wT(e.options||[]),l;if(e.defaultValue){let u=gd(e.defaultValue,r);Br(r,u,i)&&(l=u);}if(!l){let u=i&&i[0]&&i[0].id||i[0]||"";l=gd(u,r);}return {id:t,name:s,type:r,options:i,component:o,defaultValue:l,hideLabel:n,resetSectionVars:a}},hd=AT;});var PT,hn,bd=b(()=>{c();he();fd();yd();PT={[h.SELECTOR]:hd,[h.MULTIHIERARCHY_SELECTOR]:md},hn=PT;});function Ei({paragraph:e,tooltip:t,settings:r}){return jsx(se,{component:"p",html:e||`Lorem ipsum dolor sit amet,
57
57
  consectetur adipiscing elit. Etiam justo purus, placerat ac turpis at,
58
58
  dignissim interdum eros. Curabitur non tincidunt libero.
59
59
  Suspendisse quis nibh in massa tincidunt feugiat sit amet vitae nisl.
60
60
  In pulvinar sapien ut tincidunt volutpat. Donec auctor tellus eu augue feugiat,
61
- a viverra sapien pulvinar.`,style:r,append:t?jsx(Ne,{content:t,style:{display:"inline-block",verticalAlign:"bottom"}}):jsx(Fragment,{}),isPreview:!0})}var vd=b(()=>{c();Xt();Ie();});function ki({subtitle:e,title:t,value:r,tooltip:o,settings:n,_iconType:a,_iconVariant:s,_icon:i,_iconRadius:l,_iconSize:u,_iconPadding:p}){let m=t||"<span class='cr-block-placeholder'>Title</span>",d=r||"<span class='cr-block-placeholder'>Big Stat</span>",f=e||"<span class='cr-block-placeholder'>Subtitle</span>",g=n&&n.align||"left";return jsx("div",{className:"bespoke-Stat-root",children:jsxs(Group,{className:"bespoke-StatGroup-wrapper",position:pt(g),children:[a!=="none"&&a&&jsx(ke,{blockType:"stat",iconType:a,iconVariant:s,iconRadius:l,iconSize:u,icon:i,iconPadding:p}),jsxs("div",{className:"bespoke-Stat-wrapper",children:[jsx(se,{component:"div",size:"md",html:m,style:n,isPreview:!0}),jsx(se,{component:"div",size:"xl",html:d,style:n,isPreview:!0}),jsx(se,{component:"div",size:"sm",html:f,style:n,isPreview:!0})]},"stat"),o&&jsx(Ne,{content:o})]})})}var Td=b(()=>{c();Xt();Yr();Ie();Ge();});function Ci({subtitle:e,tooltip:t,settings:r}){let o=Ue(e)||"<span class='cr-block-placeholder'>Small subtitle.</span>",n=r&&r.align?r.align:"left";return jsxs(Group,{spacing:"sm",position:pt(n),children:[jsx(se,{size:"sm",html:o,isPreview:!0}),t&&jsx(Ne,{content:t,style:{display:"inline-flex"}})]})}var Rd=b(()=>{c();Xt();Wr();Ie();Ge();});function Ai({title:e,tooltip:t,_iconType:r,_iconVariant:o,_icon:n,settings:a,_iconRadius:s,_iconSize:i,_iconPadding:l}){let u=Ue(e)||"Title",p=a&&a.order?parseInt(a.order,10):1,m=p<=6?p:1,d=!!(a&&a.search&&a.search!=="off"),f=a&&a.search?a.search:"",g=a&&a.align?a.align:"left";return jsxs(Group,{spacing:"sm",position:pt(g),children:[r!=="none"&&r&&jsx(ke,{blockType:"title",iconType:r,iconVariant:o,iconRadius:s,iconSize:i,icon:n,iconPadding:l}),jsx(se,{component:"h",order:m,style:a,html:u,isPreview:!0}),d&&jsx(Tooltip,{label:`Click will open '${f}' report search`,children:jsx(ActionIcon,{variant:"light",children:jsx(IconSearch,{size:20})})}),t&&jsx(Ne,{content:t})]})}var Ed=b(()=>{c();Xt();Wr();Yr();Ie();Ge();});function Ii(e){let{id:t,type:r,defaultValue:o,options:n,name:a,settings:s,hideLabel:i,component:l,resetSectionVars:u,section:p}=e,m=useDispatch(),d=useContext(Bt),f=Q(E=>E.status.query),{sectionVariables:g,resetSectionVariables:y}=Pe(p),T=KT(t),C=useMemo(()=>f[T]||o,[f[T],r,o]),N=useMemo(()=>YT(f[T],o),[f[T],r,o]),[R,M]=useState(n?.map(E=>({value:E.id,label:E.label,imageUrl:E.imageUrl}))||[]),[U,K]=useState((n||[]).map(E=>E.id).join("-"));useEffect(()=>{let E=n.map(B=>`${B.label}|${B.id}`).join("-");if(U===E)return;K(E);let A=n.map(B=>({value:B.id,label:B.label}));M(A);let z=r===Ce.SINGLE?C:N;Br(r,z,n)||m(Ss(d,T));},[JSON.stringify(n),t]);let w=()=>{u==="true"&&g&&y();},O=E=>{m(Gr(d,T,E)),w();},k=E=>{m(Gr(d,T,E.join())),w();},I=i==="true"?jsx(Fragment,{}):jsx(se,{component:"div",html:a,size:"sm",style:s,isPreview:!0});return R.length===0?jsx(Text,{c:"dimmed",size:"xs",children:"No options defined yet. Selector hidden in report."}):R.length===1?jsxs(Text,{c:"dimmed",size:"xs",children:["Only one option defined. Selector hidden in report. ",JSON.stringify(R)]}):{[Ce.SINGLE]:l===Ln.SEGMENTED_CONTROL?jsxs("div",{children:[I,jsx(SegmentedControl,{data:R,value:R.map(E=>E.value).includes(C)?C:"",onChange:O,fullWidth:!0})]}):jsx(Select,{label:I,data:R,value:C,onChange:O,itemComponent:XT,styles:{label:{display:i==="true"?"none":"block"}}}),[Ce.MULTI]:jsx(MultiSelect,{label:I,data:R,value:N,onChange:k,styles:{label:{display:i==="true"?"none":"block"}}})}[r]}var KT,YT,XT,Ad=b(()=>{c();Zo();On();he();ge();Wt();Ie();Ee();KT=e=>`selector${e}id`,YT=(e,t)=>e&&typeof e=="string"?e.split(","):t,XT=forwardRef(function({imageUrl:t,label:r,...o},n){return jsx("div",{ref:n,...o,children:jsxs(Group,{noWrap:!0,children:[t&&jsx(Box,{component:"img",w:25,h:25,src:t}),jsx("div",{children:jsx(Text,{size:"sm",children:r})})]})})});});var wd=b(()=>{});function Bi({dimmed:e=!1,label:t,root:r=!0,value:o,parentIsArray:n=!1,level:a=0}){let s=useMantineTheme();if(a===_i)return null;let i=jsx(Text,{lineClamp:1,size:"xs",variant:"dimmed",p:5,children:"[Max depth hitted for preview]"}),l=Oi(o),u=o,p=JSON.stringify(u),m=100,d=1e3,f=!!(p&&p.length>m),g=10,y={control:{padding:"5px 0px 5px 5px"},label:{padding:"5px 0px"},content:{paddingTop:0,paddingBottom:0,paddingRight:0}};if(l==="object")return jsx(Accordion,{className:"cr-variable-accordion",variant:"contained",styles:y,children:jsxs(Accordion.Item,{value:"label",children:[jsx(Accordion.Control,{children:jsx(Text,{lineClamp:1,size:"xs",weight:700,color:e?"dimmed":s.primaryColor,children:r?`{{${t}}}`:n?`[${t}]`:t})}),jsx(Accordion.Panel,{children:a+1<_i?Object.keys(o).sort((T,C)=>{let N=Oi(o[T]),R=Oi(o[C]);return N!==R?Pd.indexOf(N)-Pd.indexOf(R):T.localeCompare(C)}).map(T=>jsx(Bi,{root:!1,label:T,value:o[T],level:a+1},T)):i})]})});if(l==="array"){let T=o.length>g,C=T?o.slice(0,g):o,N=T?o.length-g:0;return jsx(Accordion,{className:"cr-variable-accordion",variant:"contained",styles:y,children:jsxs(Accordion.Item,{value:"label",children:[jsx(Accordion.Control,{children:jsx(Text,{lineClamp:1,size:"xs",weight:700,p:0,color:e?"dimmed":s.primaryColor,children:r?`{{${t}}}`:n?`[${t}]`:t})}),jsxs(Accordion.Panel,{children:[a+1<_i?C.map((R,M)=>jsx(Bi,{root:!1,label:M,value:R,level:a+1,parentIsArray:!0},M)):i,T&&jsxs(Text,{lineClamp:1,size:"xs",variant:"dimmed",p:5,children:["[+ ",N," other elements]"]})]})]})})}return l==="string"?u=f?`"${u.substring(0,m)} ... "`:`"${u}"`:l==="error"?u=`Error: ${u.message}`:l==="undefined"?u=l:u.toString&&(u=u.toString()),jsxs(Group,{noWrap:!0,spacing:0,children:[jsx(Text,{color:e?"dimmed":s.primaryColor,lineClamp:1,size:"xs",pl:5,style:{overflow:"visible",wordBreak:"keep-all",whiteSpace:"nowrap"},weight:700,children:r?`{{${t}}}`:n?`[${t}]`:t}),jsx(Prism,{className:"cr-variable",language:"jsx",noCopy:!0,scrollAreaComponent:"div",styles:{root:{flex:"1 1 100%",textAlign:"right",overflow:"hidden"},code:{padding:"5px 0 5px 5px"},scrollArea:{marginLeft:"5px"},line:{paddingRight:"5px"}},children:u}),f&&jsxs(HoverCard,{width:500,shadow:"md",withinPortal:!0,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,d)})})]})]})}var Oi,Pd,_i,Id,Ld=b(()=>{c();wd();Oi=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},Pd=["object","array","string","number"],_i=5;Id=Bi;});var Od,_d=b(()=>{c();Od=e=>t=>t.replace(new RegExp(`^${e}`),"").startsWith("_");});function ax({reserved:e=[],id:t,variables:r={},showInternal:o=!1}){let a=bt(t==="attributes"?null:t).data,s=a?a.type:"block",i=a?.type&&a?.id?`${a.type}${a.id}`:"",l=Object.keys(r).filter(o?()=>!0:u=>!Od(i)(u));return jsx(Stack,{spacing:0,children:l.length?l.map(u=>jsx(Id,{dimmed:e.includes(u),label:u,value:r[u]},u)):jsx(Text,{color:"dimmed",size:"xs",children:jsx("i",{children:`empty ${s}`})})})}var Bd,Md=b(()=>{c();Ld();ge();_d();Bd=ax;});function fx({outputVariables:e,status:t,hasAPI:r=!1,debug:o,type:n}){let[a,s]=useState(!1),i=r&&!Object.keys(e).length&&!t.error,l=Object.keys(e).some(p=>p.startsWith("_"));return o?i?jsxs(Stack,{align:"center",children:[jsx(Loader,{}),jsxs(Text,{size:"sm",children:["Loading ",n]})]}):jsxs(Fragment,{children:[jsx(Divider,{label:"Output Variables",labelPosition:"center"}),l&&jsx(Switch,{label:"Show internal variables",mb:"xs",size:"xs",checked:a,onChange:p=>s(p.currentTarget.checked)}),jsx(Bd,{variables:e,showInternal:a})]}):jsx(Center,{children:jsx(Badge,{color:"gray",variant:"outline",children:n.toUpperCase()},"type")})}var Ni,Nd=b(()=>{c();Md();Ni=fx;});function Di(e){let{alt:t,src:r,desc:o,title:n,settings:a,...s}=e,i=Ue(t),l=Ue(r),u=Ue(o),p=jsx("img",{src:l,alt:i,style:s}),m=a&&a.align?String(a.align):"left";return (u&&u.length||n&&n.length)&&(p=jsxs(Stack,{className:"bespoke-Image-wrapper",align:Nt(m),spacing:"sm",children:[n&&jsx(se,{component:"p",html:n,style:a,isPreview:!0}),p,o&&jsx(se,{component:"p",size:"sm",html:o,style:a,isPreview:!0})]})),l&&i?p:jsx(Center,{mih:100,bg:"white",children:jsx(Badge,{color:"gray",variant:"outline",children:"IMAGE"},"type")})}var Dd=b(()=>{c();Wr();Ie();Ge();});function $i({headings:e,settings:t}){let{min:r="1",max:o="6",icons:n="yes"}=t||{},a=Ao(parseInt(r,10),parseInt(o,10),e),s=n==="yes",i=Ro(t&&t.align?String(t.align):"left"),l=u=>!u||!u?.length?null:jsx(Fragment,{children:u.map(p=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${p.id}`,children:jsxs(Group,{spacing:"sm",children:[s&&jsx(ke,{...p.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:p.label}})]})})},p.id),jsx(Box,{pl:"xs",children:l(p.children)})]},p.id))});return jsx(Box,{pos:"relative",children:jsxs(List,{sx:u=>({display:"flex",gap:u.spacing.md,justifyContent:i,listStyleType:"none"}),children:[a?.map(u=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:400,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${u.id}`,children:jsxs(Group,{spacing:"sm",noWrap:!0,children:[s&&jsx(ke,{blockType:"nav",...u.iconProps,iconSize:"sm",iconPadding:"2"}),jsx(Text,{dangerouslySetInnerHTML:{__html:u.label}})]})})}),u?.children?.length?jsx(Menu.Dropdown,{children:l(u.children)}):null]})},u.id)),!a||a.length===0&&jsx(List.Item,{children:jsx(Text,{color:"dimmed",children:"- Include some titles as inputs to see the Nav component -"})})]})})}var zd=b(()=>{c();ii();Yr();Ge();});function Ui(e){let{related_reports:t,settings:r}=e;if(!t?.length)return jsx(Text,{children:"There are no available members related to your current selection and report."});let o=Ro(r&&r.align?String(r.align):"left");return jsx(List,{sx:()=>({display:"flex",justifyContent:o,"& li":{marginRight:"1rem"}}),children:t.map(n=>jsx(List.Item,{children:n.entities.map(a=>a.name).join(" & ")},n.link))})}var Gd=b(()=>{c();Ge();});function qi({id:e,label:t,settings:r,showIcon:o,fullWidth:n,showWhenDisabled:a}){let s=bt(e).data,{sectionVariables:i,resetSectionVariables:l}=Pe(s?.section_id),u=!!Object.keys(i).length,p=Nt(r&&r.align?r.align:"left");return jsxs(Stack,{align:p,children:[!u&&!a&&jsx(Text,{size:"xs",ta:r?.align||"left",children:"Reset button will not be shown on its disabled state"}),jsx(Button,{onClick:()=>l(),disabled:!u,fullWidth:n,children:jsxs(Group,{align:"center",children:[t,o&&jsx(IconRefresh,{})]})})]})}var Hd=b(()=>{c();Ee();Ee();Ge();});function Hi({settings:e,label:t,showIcon:r,position:o="center"}){let n=e&&e.search?e.search:"";return jsxs(Group,{position:o,children:[jsx(Tooltip,{label:`Click will open '${n}' report search`,children:jsx(Button,{children:jsxs(Group,{align:"center",children:[t||"Comparison Button",r&&jsx(IconPlus,{})]})})}),jsx(ActionIcon,{variant:"light",children:jsx(IconSearch,{size:20})})]})}var Kd=b(()=>{c();});function Wi({columns:e=[],id:t,data:r=[],tableProps:o={}}){let[n,a]=useState({}),{initialState:s}=o,i=s?.pagination?.pageIndex,l=s?.pagination?.pageSize,u=`table-${[t,i,l].filter(g=>g).join("-")}`,p=useMemo(()=>e.map(g=>g.accessorKey),[e]),m=useMemo(()=>r.filter(g=>typeof g=="object"&&g!==null&&!Array.isArray(g)&&Object.keys(g).some(y=>p.includes(y))),[p,r]),d=useMemo(()=>e.map(g=>({...g,Cell:({renderedCellValue:y})=>jsx(se,{html:`${y}`,isPreview:!0}),filterFn:"contains"})),[e]),f=$c();return useEffect(()=>{(async()=>{try{let y=f||"en",T=`${y.toUpperCase()}`,C=await import(`mantine-react-table/locales/${y}.js`);a(C[`MRT_Localization_${T}`]);}catch(y){console.error("Error loading translations:",y);}})();},[f]),createElement(MantineReactTable,{...o,autoResetPageIndex:!1,columns:d,data:m,enableColumnFilterModes:!0,enableFilterMatchHighlighting:!1,globalFilterFn:"contains",key:u,layoutMode:"grid",localization:n,state:{...o.state,isFullScreen:!1}})}var Yd=b(()=>{c();Ie();Ee();});function Ki({label:e,url:t,settings:r}){let{align:o}=r;return jsx(Group,{position:o,grow:o==="justify",children:jsx(Button,{component:"a",target:"_blank",href:t||"",children:e||"Button"})})}var Qd=b(()=>{c();});function Xi(e){let t=useDispatch(),r=useContext(Bt),o=Q(F=>F.status.query),n=tR(e.id),a=useMantineTheme(),{allLabel:s,colorKey:i,data:l,defaultValue:u,defaultValueType:p,iconKey:m,levels:d,limit:f,placeholder:g,searchIndexKey:y,searchIndexSeparator:T,resetSectionVars:C,section:N}=e,[R,M]=useState(!1),[U,K]=useState(!0),[w,O]=useState(""),[k,I]=useState(!1),[E,A]=useState([""].slice(1)),{sectionVariables:z,resetSectionVariables:B}=Pe(N),D=useMemo(()=>rR(o[`${n}-value`],u),[o,u,n]),j=useMemo(()=>o[`${n}-type`]||p,[o,p,n]),V=useCallback(()=>{C==="true"&&z&&B();},[C,z,B]),L=useCallback(F=>{V(),t(Gr(r,`${n}-value`,F.join()));},[t,r,n,V]),H=useCallback(F=>{V(),t(Gr(r,`${n}-type`,F));},[t,r,n,V]),$=useRef(null),ie=useRef(!1),Y=useRef(!!f&&f<D.length),re=E.length,Z=d[re],te=E.filter(Boolean);E.length>0&&te.length===0&&te.push(`${s} ${Z?.label}`),useEffect(()=>{let F=()=>{K(!0);};return window.addEventListener("touchmove",F),()=>{window.removeEventListener("touchmove",F);}},[]);let q=useMemo(()=>Zx(l,d,i,m,y,T),[i,l,m,d,y,T]),x=useMemo(()=>{let F=Jx(w),ce=Array.from(eR(q,F)).reverse();return k?ce:E.reduce((_,ne)=>_.filter(oe=>!ne||oe.searchindex.indexOf(ne)>-1),ce.filter(_=>_.type===Z?.value))},[Z,q,w,k,E]),P=useRef(null),G=oa({count:R?x.length:0,estimateSize:()=>30,getScrollElement:useCallback(()=>P.current,[]),overscan:10,rangeExtractor:useCallback(F=>cn(F),[])}),[J,X]=useState(-1),le=Math.min(J,x.length-1),de=useCallback(F=>{let ce=E.concat(F);k&&I(!1),A(ce);},[k,E]),ze=useCallback(()=>{let F=E.slice(0,re-1);k&&I(!1),A(F);},[k,E,re]),ye=useCallback(F=>{O(F.currentTarget.value),!Y.current&&l.length>0&&M(!0);},[l,O,Y,M]),ve=useCallback(()=>{O(""),L([]),$.current?.focus(),f&&(Y.current=!1);},[O,L,$,f,Y]),Je=useCallback(F=>{let ce=D.filter(_=>_!==F);L(ce),f&&ce.length<f&&(Y.current=!1);},[D,L,f,Y]),et=useCallback(F=>{j||H(F.type),j!==F.type?(H(F.type),L([F.value])):D.includes(F.value)?Je(F.value):f?(D.length<f&&L([...D,F.value]),D.length===f&&L([...D.slice(1),F.value])):L([...D,F.value]),O("");},[j,H,L,D,Je,f]),it=useCallback(()=>{D.length>0&&w.length===0&&(L(D.slice(0,-1)),M(!0),f&&(Y.current=!1)),w.length>0&&O(w.slice(0,-1));},[D,w,L,O,M,f,Y]),Ar=useCallback(()=>{K(F=>F&&(ie.current=F,!F)),X(F=>F+1>=x.length?F:F+1);},[X,x]),Ht=useCallback(()=>{let F=x[le];F&&et(F);},[x,le,et]),lt=useCallback(()=>{M(!1);},[M]),or=useCallback(()=>{ze(),X(0);},[X,ze]),nr=useCallback(()=>{let F=x[le];!k&&F&&F.type!==d[d.length-1]?.value&&(de(F.name),X(0));},[x,le,k,d,X,de]),wr=useCallback(()=>{K(F=>F&&(ie.current=F,!F)),X(F=>F-1<0?0:F-1);},[X]),no=({label:F,onRemove:ce,..._})=>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"},..._,children:[jsx("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:F}),jsx(CloseButton,{"aria-hidden":!0,iconSize:"70%",onMouseDown:ce,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})]}),_e=useMemo(()=>D.map(F=>q.find(ce=>ce.value===F)).filter(F=>!!F).map((F,ce)=>createElement(no,{...F,index:ce,key:F.value,onRemove:_=>{_.preventDefault(),_.stopPropagation(),Je(F.value);}})),[D]),ao=forwardRef(function({color:ce,icon:_,label:ne,value:oe,...We},be){return jsx("div",{ref:be,style:{cursor:"pointer",width:"100%"},...We,children:jsxs(Group,{align:"center",noWrap:!0,spacing:"xs",w:"100%",children:[_&&jsx(Box,{bg:ce??"transparent",component:"img",w:20,h:20,src:_}),jsx(Text,{lineClamp:1,size:"sm",children:ne||oe})]})})}),{settings:so}=e,ar=e.hideLabel==="true"||!e.label?jsx(Fragment,{}):jsx(se,{component:"div",html:e.label,size:"sm",style:so,isPreview:!0});return jsx(Input.Wrapper,{label:ar,children:jsxs(Popover,{closeOnClickOutside:!0,keepMounted:!0,opened:R,onChange:M,onClose:()=>{X(0),O("");},onOpen:()=>{G.scrollToIndex(0);},shadow:"sm",width:"target",withinPortal:!0,children:[jsx(Popover.Target,{children:jsxs(Box,{"aria-haspopup":"listbox",component:"div",onMouseLeave:()=>X(0),sx:{position:"relative","& .defaultValue":{backgroundColor:a.colorScheme==="dark"?a.colors.dark[5]:a.colors.gray[3],color:a.colorScheme==="dark"?a.colors.dark[1]:a.colors.gray[7]}},tabIndex:-1,children:[jsx("input",{type:"hidden",value:D.join(",")}),jsx(Input,{component:"div",multiline:!0,onMouseDown:F=>{F.preventDefault(),!Y.current&&l.length>0&&M(!R),$.current?.focus();},rightSection:D.length>0?jsx(CloseButton,{onClick:ve,onMouseDown:F=>F.preventDefault(),variant:"transparent"}):jsx(IconSelector,{color:a.colors.gray[6],size:18,stroke:1.5}),style:{overflow:"hidden"},w:"100%",children:jsxs(Box,{component:"div","data-clearable":!0,sx:{alignItems:"center",boxSizing:"border-box",display:"flex",flexWrap:"wrap",marginLeft:`calc(-${a.spacing.xs} / 2)`,minHeight:`calc(${rem(36)} - ${rem(2)})`,"&[data-clearable]":{marginRight:rem(36)},"&::placeholder":{color:a.colorScheme==="dark"?a.colors.dark[3]:a.colors.gray[5],opacity:1}},children:[_e,jsx("input",{autoComplete:"off","data-mantine-stop-propagation":R,onChange:ye,onKeyDown:getHotkeyHandler([["ArrowDown",Ar],["ArrowLeft",or],["ArrowRight",nr],["ArrowUp",wr],["Backspace",it],["Enter",Ht],["Escape",lt]]),placeholder:D.length===0?g:void 0,ref:$,readOnly:Y.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:w})]})})]})}),jsx(Popover.Dropdown,{onMouseDown:F=>F.preventDefault(),p:0,children:jsx("div",{style:{display:"flex",maxHeight:rem(300)},children:jsx(Box,{component:"div","data-combobox-popover":!0,onMouseDown:F=>F.preventDefault(),role:"listbox",sx:{width:"100%"},tabIndex:-1,children:jsxs(Stack,{h:"100%",py:"xs",spacing:"xs",w:"100%",children:[d.length>1&&jsxs(Stack,{spacing:"xs",children:[jsxs(Group,{onClick:F=>{F.stopPropagation();},px:"xs",position:"center",spacing:"xs",children:[jsx(Button,{onClick:()=>{X(0),I(!0),A([]),x.length>0&&G.scrollToIndex(0);},size:"xs",variant:k?"filled":"outline",children:s}),d.map((F,ce)=>jsx(Button,{onClick:()=>{k&&I(!1);let _=[""].slice(1),ne=ce;for(;ne--;)_[ne]=E[ne]||"";X(0),A(_),x.length>0&&G.scrollToIndex(0);},size:"xs",variant:!k&&E.length===d.findIndex(_=>_.value===F?.value)?"filled":"outline",children:F?.label},F?.value))]}),jsx(Divider,{})]}),re>0&&jsxs(Group,{align:"center",noWrap:!0,px:"xs",children:[jsx(ActionIcon,{onClick:ze,size:"sm",children:jsx(IconChevronLeft,{})}),jsx("div",{children:te.map(F=>jsx(Text,{lineClamp:1,size:"xs",children:F},`${F}`))})]}),jsx(ScrollArea,{mah:250,onWheel:()=>K(!0),px:"xs",style:{overflow:"auto",width:"100%"},viewportRef:P,viewportProps:{tabIndex:-1},w:"100%",children:jsx("div",{style:{height:`${G.getTotalSize()}px`,position:"relative",width:"100%"},children:G.getVirtualItems().map(F=>{let ce=x[F.index],_=le===F.index,ne=D.includes(ce.value);return x.length>0&&_&&!U&&G.scrollToIndex(le),jsxs(Group,{"aria-selected":_,align:"center","data-hovered":_||void 0,"data-index":F.index,"data-selected":ne,id:ce.vale,noWrap:!0,onMouseEnter:oe=>{oe.preventDefault(),oe.stopPropagation(),U&&(X(F.index),K(!1));},onMouseMove:oe=>{oe.preventDefault(),oe.stopPropagation(),K(!0);},onMouseDown:oe=>{oe.preventDefault(),et(ce);},position:"apart",ref:G.measureElement,role:"option",spacing:"xs",sx:oe=>({borderRadius:oe.radius.xs,padding:"15px 5px 15px",paddingLeft:k&&10*d.findIndex(We=>We?.value===ce.type)||5,position:"absolute",top:0,left:0,height:`${F.size}px`,transform:`translateY(${F.start}px)`,width:"100%","&[data-hovered]":{backgroundColor:oe.colorScheme==="dark"?oe.colors.dark[4]:oe.colors.gray[1]},"&:hover":{backgroundColor:oe.colorScheme==="dark"?oe.colors.dark[4]:oe.colors.gray[1]}}),tabIndex:-1,children:[jsx(ao,{index:F.index,...ce}),!k&&ce.type!==d[d.length-1]?.value&&jsx(ActionIcon,{onMouseDown:oe=>{oe.preventDefault(),oe.stopPropagation(),de(ce.name);},size:"sm",tabIndex:-1,children:jsx(IconChevronRight,{})})]},ce.value)})})})]})})})})]})})}var Zx,Jx,eR,tR,rR,nm=b(()=>{c();Xs();Ie();Wt();ge();Ee();Zo();Zx=(e=[],t=[],r="",o="",n="",a="|")=>{let s=t.map(y=>y.value).slice(),i=`${s.pop()}`,l=y=>y[r],u=y=>y[o],p=y=>{if(y[n])return typeof y[n]=="string"?y[n].split(a):y[n]},m=new Set,d=[],f=[],g=nest().rollup(y=>{let T=y[0],C=k=>k&&k.value&&!m.has(k.value),N=s.map(k=>T[`${k} ID`]),R=s.map(k=>T[k]),M=s.map((k,I)=>{if(f[I]!==R[I]){f[I]=R[I];let E=l[I]||l[l.length-1]||l,A=u[I]||u[u.length-1]||u,z=p[I]||p[p.length-1]||p;return {color:E(T,k)||void 0,icon:A(T,k)||void 0,value:`${N[I]}`,label:R[I],name:R[I],type:k,searchindex:R.slice(0,I+1).concat(z(T,k)).join("|")}}return {}}).filter(C);M.forEach(k=>m.add(k.value));let U=l[l.length-1]||l,K=u[u.length-1]||u,w=p[p.length-1]||p,O=y.map(k=>({color:U(k,i)||void 0,icon:K(k,i)||void 0,value:`${k[`${i} ID`]}`,label:k[i],name:k[i],type:i,searchindex:R.concat(k[i]).concat(w(k,i)).join("|")}));d.push(...M.concat(O));});return s.forEach(y=>{g.key(T=>`${T[`${y} ID`]}|${T[y]}`);}),g.entries(e),d},Jx=e=>{if(!e)return /./i;let t=e.normalize("NFD").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"[^|]+");return RegExp(t,"i")},eR=(e,t)=>{let r=e.length,o,n=i=>o&&o.searchindex.includes(i.searchindex),s={next:()=>{for(let i=r-1;i>-1;i--){let l=e[i];if(t.test(`${l.value} ${l.label} ${l.searchindex}`)||n(l))return o=l,r=i,{done:!1,value:l}}return {done:!0,value:void 0}},[Symbol.iterator]:()=>s};return s},tR=e=>`multihierarchySelector${e}`,rR=(e,t)=>e&&typeof e=="string"?e.split(","):t;});var am={};Na(am,{default:()=>fR});function mR({block:e,active:t,locale:r,variables:o,configOverride:n={}}){let a=pR(),s=Be(e),i=_t(r),l={variables:o},u=fr(),p=useRouter(),{sectionVariables:m,setSectionVariables:d,resetSectionVariables:f}=Pe(e.section_id),g=useMemo(()=>{if(!t)return {error:"Activate to View"};if(!s?.logic)return {error:"Add a Configuration"};let K=ut({logic:s.logic},i,l).logic,w={router:p,section:{variables:m,setVariables:d,resetVariables:f}};return Tr(K,i,o,r,e.id,{},w,u)},[s?.logic,t,o,m]),{type:y}=g.config||{},T=y&&Qi[y]?y:"Treemap";y||(g.config={error:'Visualization missing "type"'}),Qi[y]||(g.config={error:`"${y}" is not a valid Visualization Type`});let C=Qi[T],N=g.error||g.config?.error||!1;if(N)return jsx(Center,{style:{height:"100%"},children:jsx(Badge,{color:"gray",variant:"outline",children:N},"type")});let{_data:R,...M}=g.config,U={locale:r,variables:o,...M,...n};return a.print&&(U.detectVisible=!1),jsx("div",{style:{display:"flex",flex:"1 1 100%"},children:jsx(to,{fallback:jsx("p",{children:"Error in d3plus viz config."}),children:jsx(C,{style:{flex:1},dataFormat:K=>{let w;try{w=g.dataFormat(K);}catch(O){console.error("Error in dataFormat: ",O),w=[];}return w},linksFormat:g.linksFormat,nodesFormat:g.nodesFormat,topojsonFormat:g.topojsonFormat,config:{...U}},"viz-key")})})}var pR,dR,Qi,fR,sm=b(()=>{c();_r();Ti();mn();Mr();Ee();Si();pR=()=>({}),dR={},Qi={HTML:fn,...ST,...dR};fR=memo(mR,(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 hR,Ve,im=b(()=>{c();he();vd();Td();Rd();Ed();Ad();Nd();Dd();zd();Gd();Hd();Kd();Yd();Qd();nm();hR=RT(()=>Promise.resolve().then(()=>(sm(),am)),{ssr:!1}),Ve={[h.PARAGRAPH]:Ei,[h.STAT]:ki,[h.SUBTITLE]:Ci,[h.TITLE]:Ai,[h.SELECTOR]:Ii,[h.VIZ]:hR,[h.GENERATOR]:Ni,[h.SECTION_FLAG]:Ni,[h.IMAGE]:Di,[h.NAV]:$i,[h.RELATED]:Ui,[h.RESET_BUTTON]:qi,[h.COMPARISON_BUTTON]:Hi,[h.TABLE]:Wi,[h.BUTTON]:Ki,[h.MULTIHIERARCHY_SELECTOR]:Xi};});var lm=b(()=>{c();he();({[h.TITLE]:IconHeading,[h.GENERATOR]:IconApi,[h.SECTION_FLAG]:IconFlag,[h.STAT]:IconPercentage,[h.VIZ]:IconChartBar,[h.PARAGRAPH]:IconAlignLeft,[h.SELECTOR]:IconSelector,[h.IMAGE]:IconPhoto,[h.TABLE]:IconTable,[h.MULTIHIERARCHY_SELECTOR]:IconListTree});});var cm=b(()=>{c();he();({[h.TITLE]:"Title",[h.GENERATOR]:"Data",[h.STAT]:"Stat",[h.VIZ]:"Visualization",[h.PARAGRAPH]:"Paragraph",[h.SELECTOR]:"Selector",[h.SUBTITLE]:"Subtitle",[h.RESET_BUTTON]:"Reset Button",[h.COMPARISON_BUTTON]:"Comparison Button",[h.RELATED]:"Related Reports",[h.NAV]:"Navigation",[h.IMAGE]:"Image",[h.TABLE]:"Table",[h.BUTTON]:"Button",[h.FALLBACK]:"Fallback",[h.SECTION_FLAG]:"Section Flag",[h.MULTIHIERARCHY_SELECTOR]:"Multihierarchy Selector"});});var AR,Zi,um=b(()=>{c();he();bd();im();lm();cm();AR={[h.GENERATOR]:{type:h.GENERATOR,renderer:Ve[h.GENERATOR],renderPreviewOnEdit:!1},[h.SECTION_FLAG]:{type:h.SECTION_FLAG,renderer:Ve[h.SECTION_FLAG],renderPreviewOnEdit:!1},[h.IMAGE]:{type:h.IMAGE,renderer:Ve[h.IMAGE],renderPreviewOnEdit:!1},[h.PARAGRAPH]:{type:h.PARAGRAPH,renderer:Ve[h.PARAGRAPH],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[h.RELATED]:{type:h.RELATED,renderer:Ve[h.RELATED],renderPreviewOnEdit:!1,evalWhenNonActive:!1},[h.SELECTOR]:{type:h.SELECTOR,renderer:Ve[h.SELECTOR],adapter:hn[h.SELECTOR],nonActiveAdapter:()=>hn[h.SELECTOR]({name:"Selector Preview"}),renderPreviewOnEdit:!1},[h.STAT]:{type:h.STAT,renderer:Ve[h.STAT],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[h.SUBTITLE]:{type:h.SUBTITLE,renderer:Ve[h.SUBTITLE],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[h.TITLE]:{type:h.TITLE,renderer:Ve[h.TITLE],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[h.VIZ]:{type:h.VIZ,renderer:Ve[h.VIZ],renderPreviewOnEdit:!1},[h.NAV]:{type:h.NAV,renderer:Ve[h.NAV],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[h.RESET_BUTTON]:{type:h.RESET_BUTTON,renderer:Ve[h.RESET_BUTTON],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[h.COMPARISON_BUTTON]:{type:h.COMPARISON_BUTTON,renderer:Ve[h.COMPARISON_BUTTON],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[h.TABLE]:{type:h.TABLE,renderer:Ve[h.TABLE],renderPreviewOnEdit:!1,evalWhenNonActive:!1},[h.BUTTON]:{type:h.BUTTON,renderer:Ve[h.BUTTON],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[h.MULTIHIERARCHY_SELECTOR]:{type:h.MULTIHIERARCHY_SELECTOR,renderer:Ve[h.MULTIHIERARCHY_SELECTOR],adapter:hn[h.MULTIHIERARCHY_SELECTOR],nonActiveAdapter:()=>hn[h.MULTIHIERARCHY_SELECTOR]({label:"Multihierarchy Selector Preview"}),renderPreviewOnEdit:!1}},Zi=AR;});function xa({blockId:e,active:t=!0,asComparison:r=!1}){let{query:o,locale:n=ht}=useRouter(),a=Qe(),s=bt(e).data,i=So(e,r&&a.active?a?.variables.variables:void 0,r&&a.active?a?.variables.attributes:void 0),l=Be(s,n),u=_t(n),p={variables:i,query:o,locale:n},m=Q(C=>C.variables.variables[s.id]||{}),d=Q(C=>C.variables.status[s.id]||{}),[f,g]=useState(()=>{if(![h.GENERATOR,h.VIZ,h.NAV].includes(s.type)){if(s?.type===h.SELECTOR){let R=Be(s,n),{config:M}=mo(s.id,R?.logic,u,p);return {...M,id:s.id,section:s.section_id}}if(s?.type===h.MULTIHIERARCHY_SELECTOR){let R=Be(s,n),{config:M}=fo(s.id,R.logic,u,p);return {...M,id:s.id,section:s.section_id}}if(s?.type===h.RESET_BUTTON)return {...l.simple,id:s.id,section:s.section_id};if(s?.type===h.COMPARISON_BUTTON)return {...l.simple,id:s.id,section:s.section_id};let C=tt(l?.logic,u,p),{vars:N}=wt("variables",i,C,u,void 0,p);return N}return null});useEffect(()=>{(async()=>{if(!s||s.type===h.GENERATOR)return;if(s.type===h.VIZ){g({block:s,locale:n,variables:i,active:t});return}if(!t&&!Zi[s.type].evalWhenNonActive){let{nonActiveAdapter:M}=Zi[s.type],U=M&&typeof M=="function"?M():{};g(U);return}if(s.type===h.GENERATOR){g({outputVariables:m});return}if(h.SELECTOR===s.type){let M=Be(s,n),{config:U}=mo(s.id,M.logic,u,p);g({...U,id:s.id,section:s.section_id});return}if(h.MULTIHIERARCHY_SELECTOR===s.type){let M=Be(s,n),{config:U}=fo(s.id,M.logic,u,p);g({...U,id:s.id,section:s.section_id});return}if(s.type===h.NAV){let M=Be(s,n).simple;g({id:s.id,headings:s.inputs,type:M?.type,section:s.section_id,settings:s.settings});return}if(s.type===h.RELATED){let{related_reports:M}=m;g({related_reports:M});return}if(s.type===h.RESET_BUTTON){g({id:s.id,...l.simple});return}if(s.type===h.COMPARISON_BUTTON){g({id:s.id,...l.simple});return}if(s.type===h.FALLBACK){g({id:s.id,type:s.original_type,roles:s.settings.access});return}let N=tt(l?.logic,u,p),{vars:R}=wt("variables",i,N,u,void 0,p);if(s.type===h.TABLE){g({sectionId:s.section_id,...R});return}g(R);})();},[l,i]);let y=d.allowed||s?.type===h.NAV;if(!s||!f||!y)return null;let T=pd[s.type];return jsx("div",{id:`bespoke-${s.type}-${s.id}`,className:`cms-block-wrapper bespoke-block-area cms-block-${e}`,children:jsx(T,{...f,settings:s.settings,asComparison:r})})}var dm=b(()=>{c();he();dd();um();Mr();Ee();po();Uo();Vn();Ha();Wa();Zt();});var mm,LR,fm,Ra,Ea=b(()=>{c();mm={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"}]}},LR=Object.keys(mm).reduce((e,t)=>(e[t]=mm[t].defaultValue,e),{}),fm={memberImageBg:!1,optionsMenu:!1,optionData:!0,optionImage:!0,optionShare:!0,showAnchor:!1,...LR},Ra=e=>({data:typeof e.optionData=="boolean"?e.optionData:!0,image:typeof e.optionImage=="boolean"?e.optionImage:!0,share:typeof e.optionShare=="boolean"?e.optionShare:!0});});function gm({previews:e}){let t=e.map((r,o)=>({key:r?`bg-${r.content_id}`:`bg-${o}`,src:r?`/api/cms/member/image?member=${r.content_id}&size=splash`:""}));return jsxs(Fragment,{children:[jsx(Group,{className:"cms-section-bg",grow:!0,spacing:0,style:{position:"absolute",width:"100%",height:"100%"},children:t.map(r=>jsx("div",{className:"cms-section-member-bg",style:{backgroundImage:`url(${r.src})`,backgroundSize:"cover",backgroundPosition:"center center",height:"100%",width:"100%"}},r.key))}),jsx("div",{className:"cms-section-gradient-bg",style:{background:"white",position:"absolute",width:"100%",height:"100%",opacity:.33}})]})}var hm=b(()=>{c();});function ym({data:e}){let o=(e&&Array.isArray(e)&&e[0]?Object.keys(e[0]):[]).filter(n=>!n.startsWith("_")).map(n=>({accessorKey:n,header:n,enableSorting:!0,mantineTableBodyCellProps:{sx:{textWrap:"wrap"}}}));return jsx(MantineReactTable,{columns:o,data:e,enableBottomToolbar:!1,enableColumnActions:!1,enablePagination:!1,enableSorting:!0,enableTopToolbar:!1,initialState:{density:"xs"},layoutMode:"grid",mantineTableContainerProps:{sx:{minHeight:100,maxHeight:350}}})}var bm=b(()=>{c();});function No(e){let t={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'","&#x60;":"`","&nbsp;":""},r=`(?:${Object.keys(t).join("|")})`,o=RegExp(r),n=RegExp(r,"g"),a=String(e).replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();return o.test(a)?a.replace(n,s=>t[s]):a}var el=b(()=>{c();});function tl(e){return typeof e=="string"?String(e).replace(/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});/ig," "):e}var vm=b(()=>{c();});function FR(e){return e?DR(tl(No(e)),{replacement:"-",remove:/[*+~.()'"!:@]/g,lower:!0,strict:!0,trim:!0}):""}var tr,Tn=b(()=>{c();el();vm();tr=FR;});function Em(e){let{section:t}=e,r=Vt(),o=useRouter(),n=Q(x=>x.status.isCMS),a=Q(x=>x.status.currentLocale),s=o.locale,i=n?a:s,l=50,u=_t(i),p=fr(),m=Le("options"),d={...sl,...m.data_tab},[f,g]=useState([]),[y,T]=useState([]),[C,N]=useState(),[R,M]=useState(),[U,K]=useState(!1),[w,O]=useState({}),[k,I]=useState(!0),[E,A]=useState(!0),{sectionVariables:z,setSectionVariables:B,resetSectionVariables:D}=Pe(t.id),j=t.blocks||[],V=Q(x=>x),L=useMemo(()=>j.reduce((x,P)=>{let G=V.records.entities.block[P],J=V.variables.variables[P],X=V.variables.status[P];return (h.GENERATOR===G.type&&J._downloadEnabled===!0&&X.allowed||h.VIZ===G.type&&X.allowed)&&(x[P]={entity:G,variables:V.variables.variables[P],status:V.variables.status[P],inputVariablesFlat:G.inputs.reduce((le,de)=>({...le,...V.variables.variables[de]}),V.variables.attributes)}),x},{}),[j]),H=x=>{T(P=>P.includes(x)?P:[...P,x]);},$=x=>{g(P=>(P.find(J=>J.ix===x.ix)?P:[...P,x]).sort((J,X)=>J.ix>X.ix?1:-1));};function ie(x){!C&&x[0]&&Y(x[0]);}function Y(x){N(x),M("0");}useEffect(()=>{let x=async(P,G,J)=>{let X=dataLoad.bind({});return new Promise((le,de)=>{X(G,null,null,(ze,ye)=>{if(ze)de(ze);else {let ve=J instanceof Function?J(ye):ye;P.data.unshift(ve),$(P),le(ye);}});})};if(f.length===0&&y.length===0){let P=0;for(let G of Object.values(L)){let J=G.entity;if([h.GENERATOR,h.SECTION_FLAG].includes(J.type)){let X=G.variables._downloadData||G.variables._downloadUrl||G.status.api;if(X){let le=[];typeof X=="string"?le=X.split(_n):le=[X],le=ha(le,p);let de=G.variables._downloadTitle||`${d.data_source} ${P+1}`,ze=G.variables._downloadFileName||de;$({ix:P,id:J.id,title:No(de),fileName:ze,data:Array.isArray(le)?le:[le],loading:!1,type:h.GENERATOR}),H(P),P++;}}else if(J.type===h.VIZ){let X=Be(J),le=G.inputVariablesFlat,de={variables:le},ze=ut({logic:X.logic},u,de).logic,ye={router:o,section:{variables:z,setVariables:B,resetVariables:D}},ve=Tr(ze,u,le,i,J.id,{},ye,p),Je=ve.config._downloadTitle||ve.config.title||`${d.viz_source} ${P+1}`,et=ve.config._downloadFileName||Je;if(ve.config._downloadEnabled!==!1)try{let it=ve.config._downloadUrl||ve.config.data,Ar=typeof it=="string"?[it]:it,Ht=ve.dataFormat instanceof Function?ve.dataFormat:!1,lt=ve.config._downloadDataFormat instanceof Function?ve.config._downloadDataFormat:!1;x({ix:P,id:J.id,title:No(Je),fileName:et,data:Ar,loading:!1,type:h.VIZ},it,lt||Ht),H(P),P++;}catch(it){console.error("DataLoad catch",it);}}}A(!1);}},[L]),useEffect(()=>{f.length===y.length&&ie(f);},[f]),useEffect(()=>{if(C&&R){let x=parseInt(R,10);if(C.data[x]&&(!w[C.ix]||!w[C.ix][R])){I(!0);let P=C.data[R];typeof P=="string"?Xa(P,r,i,[],void 0).then(G=>{let J=aE(G);O({...w,[C.ix]:{...w[C.ix],[x]:J}});}).catch(G=>{console.error(G);}).finally(()=>{I(!1);}):(O({...w,[C.ix]:{...w[C.ix],[x]:P}}),I(!1));}}},[R,C]);let re=(x,P)=>{let G=x===P?"":`-${x}`.toLowerCase();if(C){let J=C.data.length>1&&R?`-${parseInt(R,10)+1}`:"";return `${tr(C.fileName)}${G}${J}.${P.toLowerCase()}`}return `${G}.${P}`},Z=async x=>{if(C){K(!0);let P=new HR,G=re(x,x);try{switch(x){case Ca.json.extension:P.file(G,JSON.stringify(te));break;case Ca.csv.extension:P.file(G,csvFormat(te));break;case Ca.xlsx.extension:{let{utils:J,write:X}=await import('xlsx'),le=J.book_new();J.book_append_sheet(le,J.json_to_sheet(te),G.substring(0,30));let de=X(le,{bookType:"xlsx",bookSST:!0,type:"binary"});P.file(G,de,{binary:!0});break}default:break}P.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:9}}).then(J=>{K(!1),saveAs(J,re(x,"zip"));});}catch(J){console.error(d.error_generating,J),K(!1);}}},te=useMemo(()=>C&&w[C.ix]&&w[C.ix][R]?w[C.ix][R]:[],[w,C,R]),q=useMemo(()=>f&&f.length>0&&f.length===y.length&&f.map((x,P)=>jsx(Button,{leftIcon:jsx(IconDatabase,{size:16}),onClick:()=>Y(x),variant:C?.ix===P?"filled":"default",loading:x.loading,disabled:x.loading,children:x.title},`source-${x.id}-${P}`)),[f,C,y]);return jsxs(Stack,{className:"cms-section-options-data",children:[jsx(Space,{h:"xs"}),jsx(LoadingOverlay,{visible:E,overlayBlur:2}),f.length===0&&!E&&jsx(Alert,{icon:jsx(IconAlertCircle,{size:"1rem"}),title:"Oops!",children:d.no_data_src}),f.length>1&&f.length===y.length&&!E&&jsx(Input.Wrapper,{label:`${d.choose_data_src}:`,children:jsx(Group,{spacing:"xs",children:q})}),C&&R&&jsx(Stack,{spacing:"xs",children:jsx(Input.Wrapper,{label:`${d.preview}
61
+ a viverra sapien pulvinar.`,style:r,append:t?jsx(Ne,{content:t,style:{display:"inline-block",verticalAlign:"bottom"}}):jsx(Fragment,{}),isPreview:!0})}var vd=b(()=>{c();Xt();Ie();});function ki({subtitle:e,title:t,value:r,tooltip:o,settings:n,_iconType:a,_iconVariant:s,_icon:i,_iconRadius:l,_iconSize:u,_iconPadding:p}){let m=t||"<span class='cr-block-placeholder'>Title</span>",d=r||"<span class='cr-block-placeholder'>Big Stat</span>",f=e||"<span class='cr-block-placeholder'>Subtitle</span>",g=n&&n.align||"left";return jsx("div",{className:"bespoke-Stat-root",children:jsxs(Group,{className:"bespoke-StatGroup-wrapper",position:pt(g),children:[a!=="none"&&a&&jsx(ke,{blockType:"stat",iconType:a,iconVariant:s,iconRadius:l,iconSize:u,icon:i,iconPadding:p}),jsxs("div",{className:"bespoke-Stat-wrapper",children:[jsx(se,{component:"div",size:"md",html:m,style:n,isPreview:!0}),jsx(se,{component:"div",size:"xl",html:d,style:n,isPreview:!0}),jsx(se,{component:"div",size:"sm",html:f,style:n,isPreview:!0})]},"stat"),o&&jsx(Ne,{content:o})]})})}var Td=b(()=>{c();Xt();Yr();Ie();Ge();});function Ci({subtitle:e,tooltip:t,settings:r}){let o=Ue(e)||"<span class='cr-block-placeholder'>Small subtitle.</span>",n=r&&r.align?r.align:"left";return jsxs(Group,{spacing:"sm",position:pt(n),children:[jsx(se,{size:"sm",html:o,isPreview:!0}),t&&jsx(Ne,{content:t,style:{display:"inline-flex"}})]})}var Rd=b(()=>{c();Xt();Wr();Ie();Ge();});function wi({title:e,tooltip:t,_iconType:r,_iconVariant:o,_icon:n,settings:a,_iconRadius:s,_iconSize:i,_iconPadding:l}){let u=Ue(e)||"Title",p=a&&a.order?parseInt(a.order,10):1,m=p<=6?p:1,d=!!(a&&a.search&&a.search!=="off"),f=a&&a.search?a.search:"",g=a&&a.align?a.align:"left";return jsxs(Group,{spacing:"sm",position:pt(g),children:[r!=="none"&&r&&jsx(ke,{blockType:"title",iconType:r,iconVariant:o,iconRadius:s,iconSize:i,icon:n,iconPadding:l}),jsx(se,{component:"h",order:m,style:a,html:u,isPreview:!0}),d&&jsx(Tooltip,{label:`Click will open '${f}' report search`,children:jsx(ActionIcon,{variant:"light",children:jsx(IconSearch,{size:20})})}),t&&jsx(Ne,{content:t})]})}var Ed=b(()=>{c();Xt();Wr();Yr();Ie();Ge();});function Ii(e){let{id:t,type:r,defaultValue:o,options:n,name:a,settings:s,hideLabel:i,component:l,resetSectionVars:u,section:p}=e,m=useDispatch(),d=useContext(Bt),f=Q(E=>E.status.query),{sectionVariables:g,resetSectionVariables:y}=Pe(p),T=KT(t),C=useMemo(()=>f[T]||o,[f[T],r,o]),N=useMemo(()=>YT(f[T],o),[f[T],r,o]),[R,M]=useState(n?.map(E=>({value:E.id,label:E.label,imageUrl:E.imageUrl}))||[]),[U,K]=useState((n||[]).map(E=>E.id).join("-"));useEffect(()=>{let E=n.map(B=>`${B.label}|${B.id}`).join("-");if(U===E)return;K(E);let w=n.map(B=>({value:B.id,label:B.label}));M(w);let z=r===Ce.SINGLE?C:N;Br(r,z,n)||m(Ss(d,T));},[JSON.stringify(n),t]);let A=()=>{u==="true"&&g&&y();},O=E=>{m(Gr(d,T,E)),A();},k=E=>{m(Gr(d,T,E.join())),A();},I=i==="true"?jsx(Fragment,{}):jsx(se,{component:"div",html:a,size:"sm",style:s,isPreview:!0});return R.length===0?jsx(Text,{c:"dimmed",size:"xs",children:"No options defined yet. Selector hidden in report."}):R.length===1?jsxs(Text,{c:"dimmed",size:"xs",children:["Only one option defined. Selector hidden in report. ",JSON.stringify(R)]}):{[Ce.SINGLE]:l===Ln.SEGMENTED_CONTROL?jsxs("div",{children:[I,jsx(SegmentedControl,{data:R,value:R.map(E=>E.value).includes(C)?C:"",onChange:O,fullWidth:!0})]}):jsx(Select,{label:I,data:R,value:C,onChange:O,itemComponent:XT,styles:{label:{display:i==="true"?"none":"block"}}}),[Ce.MULTI]:jsx(MultiSelect,{label:I,data:R,value:N,onChange:k,styles:{label:{display:i==="true"?"none":"block"}}})}[r]}var KT,YT,XT,wd=b(()=>{c();Zo();On();he();ge();Wt();Ie();Ee();KT=e=>`selector${e}id`,YT=(e,t)=>e&&typeof e=="string"?e.split(","):t,XT=forwardRef(function({imageUrl:t,label:r,...o},n){return jsx("div",{ref:n,...o,children:jsxs(Group,{noWrap:!0,children:[t&&jsx(Box,{component:"img",w:25,h:25,src:t}),jsx("div",{children:jsx(Text,{size:"sm",children:r})})]})})});});var Ad=b(()=>{});function Bi({dimmed:e=!1,label:t,root:r=!0,value:o,parentIsArray:n=!1,level:a=0}){let s=useMantineTheme();if(a===_i)return null;let i=jsx(Text,{lineClamp:1,size:"xs",variant:"dimmed",p:5,children:"[Max depth hitted for preview]"}),l=Oi(o),u=o,p=JSON.stringify(u),m=100,d=1e3,f=!!(p&&p.length>m),g=10,y={control:{padding:"5px 0px 5px 5px"},label:{padding:"5px 0px"},content:{paddingTop:0,paddingBottom:0,paddingRight:0}};if(l==="object")return jsx(Accordion,{className:"cr-variable-accordion",variant:"contained",styles:y,children:jsxs(Accordion.Item,{value:"label",children:[jsx(Accordion.Control,{children:jsx(Text,{lineClamp:1,size:"xs",weight:700,color:e?"dimmed":s.primaryColor,children:r?`{{${t}}}`:n?`[${t}]`:t})}),jsx(Accordion.Panel,{children:a+1<_i?Object.keys(o).sort((T,C)=>{let N=Oi(o[T]),R=Oi(o[C]);return N!==R?Pd.indexOf(N)-Pd.indexOf(R):T.localeCompare(C)}).map(T=>jsx(Bi,{root:!1,label:T,value:o[T],level:a+1},T)):i})]})});if(l==="array"){let T=o.length>g,C=T?o.slice(0,g):o,N=T?o.length-g:0;return jsx(Accordion,{className:"cr-variable-accordion",variant:"contained",styles:y,children:jsxs(Accordion.Item,{value:"label",children:[jsx(Accordion.Control,{children:jsx(Text,{lineClamp:1,size:"xs",weight:700,p:0,color:e?"dimmed":s.primaryColor,children:r?`{{${t}}}`:n?`[${t}]`:t})}),jsxs(Accordion.Panel,{children:[a+1<_i?C.map((R,M)=>jsx(Bi,{root:!1,label:M,value:R,level:a+1,parentIsArray:!0},M)):i,T&&jsxs(Text,{lineClamp:1,size:"xs",variant:"dimmed",p:5,children:["[+ ",N," other elements]"]})]})]})})}return l==="string"?u=f?`"${u.substring(0,m)} ... "`:`"${u}"`:l==="error"?u=`Error: ${u.message}`:l==="undefined"?u=l:u.toString&&(u=u.toString()),jsxs(Group,{noWrap:!0,spacing:0,children:[jsx(Text,{color:e?"dimmed":s.primaryColor,lineClamp:1,size:"xs",pl:5,style:{overflow:"visible",wordBreak:"keep-all",whiteSpace:"nowrap"},weight:700,children:r?`{{${t}}}`:n?`[${t}]`:t}),jsx(Prism,{className:"cr-variable",language:"jsx",noCopy:!0,scrollAreaComponent:"div",styles:{root:{flex:"1 1 100%",textAlign:"right",overflow:"hidden"},code:{padding:"5px 0 5px 5px"},scrollArea:{marginLeft:"5px"},line:{paddingRight:"5px"}},children:u}),f&&jsxs(HoverCard,{width:500,shadow:"md",withinPortal:!0,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,d)})})]})]})}var Oi,Pd,_i,Id,Ld=b(()=>{c();Ad();Oi=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},Pd=["object","array","string","number"],_i=5;Id=Bi;});var Od,_d=b(()=>{c();Od=e=>t=>t.replace(new RegExp(`^${e}`),"").startsWith("_");});function ax({reserved:e=[],id:t,variables:r={},showInternal:o=!1}){let a=bt(t==="attributes"?null:t).data,s=a?a.type:"block",i=a?.type&&a?.id?`${a.type}${a.id}`:"",l=Object.keys(r).filter(o?()=>!0:u=>!Od(i)(u));return jsx(Stack,{spacing:0,children:l.length?l.map(u=>jsx(Id,{dimmed:e.includes(u),label:u,value:r[u]},u)):jsx(Text,{color:"dimmed",size:"xs",children:jsx("i",{children:`empty ${s}`})})})}var Bd,Md=b(()=>{c();Ld();ge();_d();Bd=ax;});function fx({outputVariables:e,status:t,hasAPI:r=!1,debug:o,type:n}){let[a,s]=useState(!1),i=r&&!Object.keys(e).length&&!t.error,l=Object.keys(e).some(p=>p.startsWith("_"));return o?i?jsxs(Stack,{align:"center",children:[jsx(Loader,{}),jsxs(Text,{size:"sm",children:["Loading ",n]})]}):jsxs(Fragment,{children:[jsx(Divider,{label:"Output Variables",labelPosition:"center"}),l&&jsx(Switch,{label:"Show internal variables",mb:"xs",size:"xs",checked:a,onChange:p=>s(p.currentTarget.checked)}),jsx(Bd,{variables:e,showInternal:a})]}):jsx(Center,{children:jsx(Badge,{color:"gray",variant:"outline",children:n.toUpperCase()},"type")})}var Ni,Nd=b(()=>{c();Md();Ni=fx;});function Di(e){let{alt:t,src:r,desc:o,title:n,settings:a,...s}=e,i=Ue(t),l=Ue(r),u=Ue(o),p=jsx("img",{src:l,alt:i,style:s}),m=a&&a.align?String(a.align):"left";return (u&&u.length||n&&n.length)&&(p=jsxs(Stack,{className:"bespoke-Image-wrapper",align:Nt(m),spacing:"sm",children:[n&&jsx(se,{component:"p",html:n,style:a,isPreview:!0}),p,o&&jsx(se,{component:"p",size:"sm",html:o,style:a,isPreview:!0})]})),l&&i?p:jsx(Center,{mih:100,bg:"white",children:jsx(Badge,{color:"gray",variant:"outline",children:"IMAGE"},"type")})}var Dd=b(()=>{c();Wr();Ie();Ge();});function $i({headings:e,settings:t}){let{min:r="1",max:o="6",icons:n="yes"}=t||{},a=wo(parseInt(r,10),parseInt(o,10),e),s=n==="yes",i=Ro(t&&t.align?String(t.align):"left"),l=u=>!u||!u?.length?null:jsx(Fragment,{children:u.map(p=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${p.id}`,children:jsxs(Group,{spacing:"sm",children:[s&&jsx(ke,{...p.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:p.label}})]})})},p.id),jsx(Box,{pl:"xs",children:l(p.children)})]},p.id))});return jsx(Box,{pos:"relative",children:jsxs(List,{sx:u=>({display:"flex",gap:u.spacing.md,justifyContent:i,listStyleType:"none"}),children:[a?.map(u=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:400,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${u.id}`,children:jsxs(Group,{spacing:"sm",noWrap:!0,children:[s&&jsx(ke,{blockType:"nav",...u.iconProps,iconSize:"sm",iconPadding:"2"}),jsx(Text,{dangerouslySetInnerHTML:{__html:u.label}})]})})}),u?.children?.length?jsx(Menu.Dropdown,{children:l(u.children)}):null]})},u.id)),!a||a.length===0&&jsx(List.Item,{children:jsx(Text,{color:"dimmed",children:"- Include some titles as inputs to see the Nav component -"})})]})})}var zd=b(()=>{c();ii();Yr();Ge();});function Ui(e){let{related_reports:t,settings:r}=e;if(!t?.length)return jsx(Text,{children:"There are no available members related to your current selection and report."});let o=Ro(r&&r.align?String(r.align):"left");return jsx(List,{sx:()=>({display:"flex",justifyContent:o,"& li":{marginRight:"1rem"}}),children:t.map(n=>jsx(List.Item,{children:n.entities.map(a=>a.name).join(" & ")},n.link))})}var Gd=b(()=>{c();Ge();});function qi({id:e,label:t,settings:r,showIcon:o,fullWidth:n,showWhenDisabled:a}){let s=bt(e).data,{sectionVariables:i,resetSectionVariables:l}=Pe(s?.section_id),u=!!Object.keys(i).length,p=Nt(r&&r.align?r.align:"left");return jsxs(Stack,{align:p,children:[!u&&!a&&jsx(Text,{size:"xs",ta:r?.align||"left",children:"Reset button will not be shown on its disabled state"}),jsx(Button,{onClick:()=>l(),disabled:!u,fullWidth:n,children:jsxs(Group,{align:"center",children:[t,o&&jsx(IconRefresh,{})]})})]})}var Hd=b(()=>{c();Ee();Ee();Ge();});function Hi({settings:e,label:t,showIcon:r,position:o="center"}){let n=e&&e.search?e.search:"";return jsxs(Group,{position:o,children:[jsx(Tooltip,{label:`Click will open '${n}' report search`,children:jsx(Button,{children:jsxs(Group,{align:"center",children:[t||"Comparison Button",r&&jsx(IconPlus,{})]})})}),jsx(ActionIcon,{variant:"light",children:jsx(IconSearch,{size:20})})]})}var Kd=b(()=>{c();});function Wi({columns:e=[],id:t,data:r=[],tableProps:o={}}){let[n,a]=useState({}),{initialState:s}=o,i=s?.pagination?.pageIndex,l=s?.pagination?.pageSize,u=`table-${[t,i,l].filter(g=>g).join("-")}`,p=useMemo(()=>e.map(g=>g.accessorKey),[e]),m=useMemo(()=>r.filter(g=>typeof g=="object"&&g!==null&&!Array.isArray(g)&&Object.keys(g).some(y=>p.includes(y))),[p,r]),d=useMemo(()=>e.map(g=>({...g,Cell:({renderedCellValue:y})=>jsx(se,{html:`${y}`,isPreview:!0}),filterFn:"contains"})),[e]),f=$c();return useEffect(()=>{(async()=>{try{let y=f||"en",T=`${y.toUpperCase()}`,C=await import(`mantine-react-table/locales/${y}.js`);a(C[`MRT_Localization_${T}`]);}catch(y){console.error("Error loading translations:",y);}})();},[f]),createElement(MantineReactTable,{...o,autoResetPageIndex:!1,columns:d,data:m,enableColumnFilterModes:!0,enableFilterMatchHighlighting:!1,globalFilterFn:"contains",key:u,layoutMode:"grid",localization:n,state:{...o.state,isFullScreen:!1}})}var Yd=b(()=>{c();Ie();Ee();});function Ki({label:e,url:t,settings:r}){let{align:o}=r;return jsx(Group,{position:o,grow:o==="justify",children:jsx(Button,{component:"a",target:"_blank",href:t||"",children:e||"Button"})})}var Qd=b(()=>{c();});function Xi(e){let t=useDispatch(),r=useContext(Bt),o=Q(F=>F.status.query),n=tR(e.id),a=useMantineTheme(),{allLabel:s,colorKey:i,data:l,defaultValue:u,defaultValueType:p,iconKey:m,levels:d,limit:f,placeholder:g,searchIndexKey:y,searchIndexSeparator:T,resetSectionVars:C,section:N}=e,[R,M]=useState(!1),[U,K]=useState(!0),[A,O]=useState(""),[k,I]=useState(!1),[E,w]=useState([""].slice(1)),{sectionVariables:z,resetSectionVariables:B}=Pe(N),D=useMemo(()=>rR(o[`${n}-value`],u),[o,u,n]),j=useMemo(()=>o[`${n}-type`]||p,[o,p,n]),V=useCallback(()=>{C==="true"&&z&&B();},[C,z,B]),L=useCallback(F=>{V(),t(Gr(r,`${n}-value`,F.join()));},[t,r,n,V]),q=useCallback(F=>{V(),t(Gr(r,`${n}-type`,F));},[t,r,n,V]),$=useRef(null),ie=useRef(!1),Y=useRef(!!f&&f<D.length),re=E.length,Z=d[re],te=E.filter(Boolean);E.length>0&&te.length===0&&te.push(`${s} ${Z?.label}`),useEffect(()=>{let F=()=>{K(!0);};return window.addEventListener("touchmove",F),()=>{window.removeEventListener("touchmove",F);}},[]);let H=useMemo(()=>Zx(l,d,i,m,y,T),[i,l,m,d,y,T]),x=useMemo(()=>{let F=Jx(A),ce=Array.from(eR(H,F)).reverse();return k?ce:E.reduce((_,ne)=>_.filter(oe=>!ne||oe.searchindex.indexOf(ne)>-1),ce.filter(_=>_.type===Z?.value))},[Z,H,A,k,E]),P=useRef(null),G=oa({count:R?x.length:0,estimateSize:()=>30,getScrollElement:useCallback(()=>P.current,[]),overscan:10,rangeExtractor:useCallback(F=>cn(F),[])}),[J,X]=useState(-1),le=Math.min(J,x.length-1),de=useCallback(F=>{let ce=E.concat(F);k&&I(!1),w(ce);},[k,E]),ze=useCallback(()=>{let F=E.slice(0,re-1);k&&I(!1),w(F);},[k,E,re]),ye=useCallback(F=>{O(F.currentTarget.value),!Y.current&&l.length>0&&M(!0);},[l,O,Y,M]),ve=useCallback(()=>{O(""),L([]),$.current?.focus(),f&&(Y.current=!1);},[O,L,$,f,Y]),Je=useCallback(F=>{let ce=D.filter(_=>_!==F);L(ce),f&&ce.length<f&&(Y.current=!1);},[D,L,f,Y]),et=useCallback(F=>{j||q(F.type),j!==F.type?(q(F.type),L([F.value])):D.includes(F.value)?Je(F.value):f?(D.length<f&&L([...D,F.value]),D.length===f&&L([...D.slice(1),F.value])):L([...D,F.value]),O("");},[j,q,L,D,Je,f]),it=useCallback(()=>{D.length>0&&A.length===0&&(L(D.slice(0,-1)),M(!0),f&&(Y.current=!1)),A.length>0&&O(A.slice(0,-1));},[D,A,L,O,M,f,Y]),wr=useCallback(()=>{K(F=>F&&(ie.current=F,!F)),X(F=>F+1>=x.length?F:F+1);},[X,x]),Ht=useCallback(()=>{let F=x[le];F&&et(F);},[x,le,et]),lt=useCallback(()=>{M(!1);},[M]),or=useCallback(()=>{ze(),X(0);},[X,ze]),nr=useCallback(()=>{let F=x[le];!k&&F&&F.type!==d[d.length-1]?.value&&(de(F.name),X(0));},[x,le,k,d,X,de]),Ar=useCallback(()=>{K(F=>F&&(ie.current=F,!F)),X(F=>F-1<0?0:F-1);},[X]),no=({label:F,onRemove:ce,..._})=>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"},..._,children:[jsx("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:F}),jsx(CloseButton,{"aria-hidden":!0,iconSize:"70%",onMouseDown:ce,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})]}),_e=useMemo(()=>D.map(F=>H.find(ce=>ce.value===F)).filter(F=>!!F).map((F,ce)=>createElement(no,{...F,index:ce,key:F.value,onRemove:_=>{_.preventDefault(),_.stopPropagation(),Je(F.value);}})),[D]),ao=forwardRef(function({color:ce,icon:_,label:ne,value:oe,...We},be){return jsx("div",{ref:be,style:{cursor:"pointer",width:"100%"},...We,children:jsxs(Group,{align:"center",noWrap:!0,spacing:"xs",w:"100%",children:[_&&jsx(Box,{bg:ce??"transparent",component:"img",w:20,h:20,src:_}),jsx(Text,{lineClamp:1,size:"sm",children:ne||oe})]})})}),{settings:so}=e,ar=e.hideLabel==="true"||!e.label?jsx(Fragment,{}):jsx(se,{component:"div",html:e.label,size:"sm",style:so,isPreview:!0});return jsx(Input.Wrapper,{label:ar,children:jsxs(Popover,{closeOnClickOutside:!0,keepMounted:!0,opened:R,onChange:M,onClose:()=>{X(0),O("");},onOpen:()=>{G.scrollToIndex(0);},shadow:"sm",width:"target",withinPortal:!0,children:[jsx(Popover.Target,{children:jsxs(Box,{"aria-haspopup":"listbox",component:"div",onMouseLeave:()=>X(0),sx:{position:"relative","& .defaultValue":{backgroundColor:a.colorScheme==="dark"?a.colors.dark[5]:a.colors.gray[3],color:a.colorScheme==="dark"?a.colors.dark[1]:a.colors.gray[7]}},tabIndex:-1,children:[jsx("input",{type:"hidden",value:D.join(",")}),jsx(Input,{component:"div",multiline:!0,onMouseDown:F=>{F.preventDefault(),!Y.current&&l.length>0&&M(!R),$.current?.focus();},rightSection:D.length>0?jsx(CloseButton,{onClick:ve,onMouseDown:F=>F.preventDefault(),variant:"transparent"}):jsx(IconSelector,{color:a.colors.gray[6],size:18,stroke:1.5}),style:{overflow:"hidden"},w:"100%",children:jsxs(Box,{component:"div","data-clearable":!0,sx:{alignItems:"center",boxSizing:"border-box",display:"flex",flexWrap:"wrap",marginLeft:`calc(-${a.spacing.xs} / 2)`,minHeight:`calc(${rem(36)} - ${rem(2)})`,"&[data-clearable]":{marginRight:rem(36)},"&::placeholder":{color:a.colorScheme==="dark"?a.colors.dark[3]:a.colors.gray[5],opacity:1}},children:[_e,jsx("input",{autoComplete:"off","data-mantine-stop-propagation":R,onChange:ye,onKeyDown:getHotkeyHandler([["ArrowDown",wr],["ArrowLeft",or],["ArrowRight",nr],["ArrowUp",Ar],["Backspace",it],["Enter",Ht],["Escape",lt]]),placeholder:D.length===0?g:void 0,ref:$,readOnly:Y.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:A})]})})]})}),jsx(Popover.Dropdown,{onMouseDown:F=>F.preventDefault(),p:0,children:jsx("div",{style:{display:"flex",maxHeight:rem(300)},children:jsx(Box,{component:"div","data-combobox-popover":!0,onMouseDown:F=>F.preventDefault(),role:"listbox",sx:{width:"100%"},tabIndex:-1,children:jsxs(Stack,{h:"100%",py:"xs",spacing:"xs",w:"100%",children:[d.length>1&&jsxs(Stack,{spacing:"xs",children:[jsxs(Group,{onClick:F=>{F.stopPropagation();},px:"xs",position:"center",spacing:"xs",children:[jsx(Button,{onClick:()=>{X(0),I(!0),w([]),x.length>0&&G.scrollToIndex(0);},size:"xs",variant:k?"filled":"outline",children:s}),d.map((F,ce)=>jsx(Button,{onClick:()=>{k&&I(!1);let _=[""].slice(1),ne=ce;for(;ne--;)_[ne]=E[ne]||"";X(0),w(_),x.length>0&&G.scrollToIndex(0);},size:"xs",variant:!k&&E.length===d.findIndex(_=>_.value===F?.value)?"filled":"outline",children:F?.label},F?.value))]}),jsx(Divider,{})]}),re>0&&jsxs(Group,{align:"center",noWrap:!0,px:"xs",children:[jsx(ActionIcon,{onClick:ze,size:"sm",children:jsx(IconChevronLeft,{})}),jsx("div",{children:te.map(F=>jsx(Text,{lineClamp:1,size:"xs",children:F},`${F}`))})]}),jsx(ScrollArea,{mah:250,onWheel:()=>K(!0),px:"xs",style:{overflow:"auto",width:"100%"},viewportRef:P,viewportProps:{tabIndex:-1},w:"100%",children:jsx("div",{style:{height:`${G.getTotalSize()}px`,position:"relative",width:"100%"},children:G.getVirtualItems().map(F=>{let ce=x[F.index],_=le===F.index,ne=D.includes(ce.value);return x.length>0&&_&&!U&&G.scrollToIndex(le),jsxs(Group,{"aria-selected":_,align:"center","data-hovered":_||void 0,"data-index":F.index,"data-selected":ne,id:ce.vale,noWrap:!0,onMouseEnter:oe=>{oe.preventDefault(),oe.stopPropagation(),U&&(X(F.index),K(!1));},onMouseMove:oe=>{oe.preventDefault(),oe.stopPropagation(),K(!0);},onMouseDown:oe=>{oe.preventDefault(),et(ce);},position:"apart",ref:G.measureElement,role:"option",spacing:"xs",sx:oe=>({borderRadius:oe.radius.xs,padding:"15px 5px 15px",paddingLeft:k&&10*d.findIndex(We=>We?.value===ce.type)||5,position:"absolute",top:0,left:0,height:`${F.size}px`,transform:`translateY(${F.start}px)`,width:"100%","&[data-hovered]":{backgroundColor:oe.colorScheme==="dark"?oe.colors.dark[4]:oe.colors.gray[1]},"&:hover":{backgroundColor:oe.colorScheme==="dark"?oe.colors.dark[4]:oe.colors.gray[1]}}),tabIndex:-1,children:[jsx(ao,{index:F.index,...ce}),!k&&ce.type!==d[d.length-1]?.value&&jsx(ActionIcon,{onMouseDown:oe=>{oe.preventDefault(),oe.stopPropagation(),de(ce.name);},size:"sm",tabIndex:-1,children:jsx(IconChevronRight,{})})]},ce.value)})})})]})})})})]})})}var Zx,Jx,eR,tR,rR,nm=b(()=>{c();Xs();Ie();Wt();ge();Ee();Zo();Zx=(e=[],t=[],r="",o="",n="",a="|")=>{let s=t.map(y=>y.value).slice(),i=`${s.pop()}`,l=y=>y[r],u=y=>y[o],p=y=>{if(y[n])return typeof y[n]=="string"?y[n].split(a):y[n]},m=new Set,d=[],f=[],g=nest().rollup(y=>{let T=y[0],C=k=>k&&k.value&&!m.has(k.value),N=s.map(k=>T[`${k} ID`]),R=s.map(k=>T[k]),M=s.map((k,I)=>{if(f[I]!==R[I]){f[I]=R[I];let E=l[I]||l[l.length-1]||l,w=u[I]||u[u.length-1]||u,z=p[I]||p[p.length-1]||p;return {color:E(T,k)||void 0,icon:w(T,k)||void 0,value:`${N[I]}`,label:R[I],name:R[I],type:k,searchindex:R.slice(0,I+1).concat(z(T,k)).join("|")}}return {}}).filter(C);M.forEach(k=>m.add(k.value));let U=l[l.length-1]||l,K=u[u.length-1]||u,A=p[p.length-1]||p,O=y.map(k=>({color:U(k,i)||void 0,icon:K(k,i)||void 0,value:`${k[`${i} ID`]}`,label:k[i],name:k[i],type:i,searchindex:R.concat(k[i]).concat(A(k,i)).join("|")}));d.push(...M.concat(O));});return s.forEach(y=>{g.key(T=>`${T[`${y} ID`]}|${T[y]}`);}),g.entries(e),d},Jx=e=>{if(!e)return /./i;let t=e.normalize("NFD").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"[^|]+");return RegExp(t,"i")},eR=(e,t)=>{let r=e.length,o,n=i=>o&&o.searchindex.includes(i.searchindex),s={next:()=>{for(let i=r-1;i>-1;i--){let l=e[i];if(t.test(`${l.value} ${l.label} ${l.searchindex}`)||n(l))return o=l,r=i,{done:!1,value:l}}return {done:!0,value:void 0}},[Symbol.iterator]:()=>s};return s},tR=e=>`multihierarchySelector${e}`,rR=(e,t)=>e&&typeof e=="string"?e.split(","):t;});var am={};Na(am,{default:()=>fR});function mR({block:e,active:t,locale:r,variables:o,configOverride:n={}}){let a=pR(),s=Be(e),i=_t(r),l={variables:o},u=fr(),p=useRouter(),{sectionVariables:m,setSectionVariables:d,resetSectionVariables:f}=Pe(e.section_id),g=useMemo(()=>{if(!t)return {error:"Activate to View"};if(!s?.logic)return {error:"Add a Configuration"};let K=ut({logic:s.logic},i,l).logic,A={router:p,section:{variables:m,setVariables:d,resetVariables:f}};return Tr(K,i,o,r,e.id,{},A,u)},[s?.logic,t,o,m]),{type:y}=g.config||{},T=y&&Qi[y]?y:"Treemap";y||(g.config={error:'Visualization missing "type"'}),Qi[y]||(g.config={error:`"${y}" is not a valid Visualization Type`});let C=Qi[T],N=g.error||g.config?.error||!1;if(N)return jsx(Center,{style:{height:"100%"},children:jsx(Badge,{color:"gray",variant:"outline",children:N},"type")});let{_data:R,...M}=g.config,U={locale:r,variables:o,...M,...n};return a.print&&(U.detectVisible=!1),jsx("div",{style:{display:"flex",flex:"1 1 100%"},children:jsx(to,{fallback:jsx("p",{children:"Error in d3plus viz config."}),children:jsx(C,{style:{flex:1},dataFormat:K=>{let A;try{A=g.dataFormat(K);}catch(O){console.error("Error in dataFormat: ",O),A=[];}return A},linksFormat:g.linksFormat,nodesFormat:g.nodesFormat,topojsonFormat:g.topojsonFormat,config:{...U}},"viz-key")})})}var pR,dR,Qi,fR,sm=b(()=>{c();_r();Ti();mn();Mr();Ee();Si();pR=()=>({}),dR={},Qi={HTML:fn,...ST,...dR};fR=memo(mR,(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 hR,Ve,im=b(()=>{c();he();vd();Td();Rd();Ed();wd();Nd();Dd();zd();Gd();Hd();Kd();Yd();Qd();nm();hR=RT(()=>Promise.resolve().then(()=>(sm(),am)),{ssr:!1}),Ve={[h.PARAGRAPH]:Ei,[h.STAT]:ki,[h.SUBTITLE]:Ci,[h.TITLE]:wi,[h.SELECTOR]:Ii,[h.VIZ]:hR,[h.GENERATOR]:Ni,[h.SECTION_FLAG]:Ni,[h.IMAGE]:Di,[h.NAV]:$i,[h.RELATED]:Ui,[h.RESET_BUTTON]:qi,[h.COMPARISON_BUTTON]:Hi,[h.TABLE]:Wi,[h.BUTTON]:Ki,[h.MULTIHIERARCHY_SELECTOR]:Xi};});var lm=b(()=>{c();he();({[h.TITLE]:IconHeading,[h.GENERATOR]:IconApi,[h.SECTION_FLAG]:IconFlag,[h.STAT]:IconPercentage,[h.VIZ]:IconChartBar,[h.PARAGRAPH]:IconAlignLeft,[h.SELECTOR]:IconSelector,[h.IMAGE]:IconPhoto,[h.TABLE]:IconTable,[h.MULTIHIERARCHY_SELECTOR]:IconListTree});});var cm=b(()=>{c();he();({[h.TITLE]:"Title",[h.GENERATOR]:"Data",[h.STAT]:"Stat",[h.VIZ]:"Visualization",[h.PARAGRAPH]:"Paragraph",[h.SELECTOR]:"Selector",[h.SUBTITLE]:"Subtitle",[h.RESET_BUTTON]:"Reset Button",[h.COMPARISON_BUTTON]:"Comparison Button",[h.RELATED]:"Related Reports",[h.NAV]:"Navigation",[h.IMAGE]:"Image",[h.TABLE]:"Table",[h.BUTTON]:"Button",[h.FALLBACK]:"Fallback",[h.SECTION_FLAG]:"Section Flag",[h.MULTIHIERARCHY_SELECTOR]:"Multihierarchy Selector"});});var wR,Zi,um=b(()=>{c();he();bd();im();lm();cm();wR={[h.GENERATOR]:{type:h.GENERATOR,renderer:Ve[h.GENERATOR],renderPreviewOnEdit:!1},[h.SECTION_FLAG]:{type:h.SECTION_FLAG,renderer:Ve[h.SECTION_FLAG],renderPreviewOnEdit:!1},[h.IMAGE]:{type:h.IMAGE,renderer:Ve[h.IMAGE],renderPreviewOnEdit:!1},[h.PARAGRAPH]:{type:h.PARAGRAPH,renderer:Ve[h.PARAGRAPH],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[h.RELATED]:{type:h.RELATED,renderer:Ve[h.RELATED],renderPreviewOnEdit:!1,evalWhenNonActive:!1},[h.SELECTOR]:{type:h.SELECTOR,renderer:Ve[h.SELECTOR],adapter:hn[h.SELECTOR],nonActiveAdapter:()=>hn[h.SELECTOR]({name:"Selector Preview"}),renderPreviewOnEdit:!1},[h.STAT]:{type:h.STAT,renderer:Ve[h.STAT],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[h.SUBTITLE]:{type:h.SUBTITLE,renderer:Ve[h.SUBTITLE],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[h.TITLE]:{type:h.TITLE,renderer:Ve[h.TITLE],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[h.VIZ]:{type:h.VIZ,renderer:Ve[h.VIZ],renderPreviewOnEdit:!1},[h.NAV]:{type:h.NAV,renderer:Ve[h.NAV],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[h.RESET_BUTTON]:{type:h.RESET_BUTTON,renderer:Ve[h.RESET_BUTTON],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[h.COMPARISON_BUTTON]:{type:h.COMPARISON_BUTTON,renderer:Ve[h.COMPARISON_BUTTON],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[h.TABLE]:{type:h.TABLE,renderer:Ve[h.TABLE],renderPreviewOnEdit:!1,evalWhenNonActive:!1},[h.BUTTON]:{type:h.BUTTON,renderer:Ve[h.BUTTON],renderPreviewOnEdit:!0,evalWhenNonActive:!0},[h.MULTIHIERARCHY_SELECTOR]:{type:h.MULTIHIERARCHY_SELECTOR,renderer:Ve[h.MULTIHIERARCHY_SELECTOR],adapter:hn[h.MULTIHIERARCHY_SELECTOR],nonActiveAdapter:()=>hn[h.MULTIHIERARCHY_SELECTOR]({label:"Multihierarchy Selector Preview"}),renderPreviewOnEdit:!1}},Zi=wR;});function xa({blockId:e,active:t=!0,asComparison:r=!1}){let{query:o,locale:n=ht}=useRouter(),a=Qe(),s=bt(e).data,i=So(e,r&&a.active?a?.variables.variables:void 0,r&&a.active?a?.variables.attributes:void 0),l=Be(s,n),u=_t(n),p={variables:i,query:o,locale:n},m=Q(C=>C.variables.variables[s.id]||{}),d=Q(C=>C.variables.status[s.id]||{}),[f,g]=useState(()=>{if(![h.GENERATOR,h.VIZ,h.NAV].includes(s.type)){if(s?.type===h.SELECTOR){let R=Be(s,n),{config:M}=mo(s.id,R?.logic,u,p);return {...M,id:s.id,section:s.section_id}}if(s?.type===h.MULTIHIERARCHY_SELECTOR){let R=Be(s,n),{config:M}=fo(s.id,R.logic,u,p);return {...M,id:s.id,section:s.section_id}}if(s?.type===h.RESET_BUTTON)return {...l.simple,id:s.id,section:s.section_id};if(s?.type===h.COMPARISON_BUTTON)return {...l.simple,id:s.id,section:s.section_id};let C=tt(l?.logic,u,p),{vars:N}=At("variables",i,C,u,void 0,p);return N}return null});useEffect(()=>{(async()=>{if(!s||s.type===h.GENERATOR)return;if(s.type===h.VIZ){g({block:s,locale:n,variables:i,active:t});return}if(!t&&!Zi[s.type].evalWhenNonActive){let{nonActiveAdapter:M}=Zi[s.type],U=M&&typeof M=="function"?M():{};g(U);return}if(s.type===h.GENERATOR){g({outputVariables:m});return}if(h.SELECTOR===s.type){let M=Be(s,n),{config:U}=mo(s.id,M.logic,u,p);g({...U,id:s.id,section:s.section_id});return}if(h.MULTIHIERARCHY_SELECTOR===s.type){let M=Be(s,n),{config:U}=fo(s.id,M.logic,u,p);g({...U,id:s.id,section:s.section_id});return}if(s.type===h.NAV){let M=Be(s,n).simple;g({id:s.id,headings:s.inputs,type:M?.type,section:s.section_id,settings:s.settings});return}if(s.type===h.RELATED){let{related_reports:M}=m;g({related_reports:M});return}if(s.type===h.RESET_BUTTON){g({id:s.id,...l.simple});return}if(s.type===h.COMPARISON_BUTTON){g({id:s.id,...l.simple});return}if(s.type===h.FALLBACK){g({id:s.id,type:s.original_type,roles:s.settings.access});return}let N=tt(l?.logic,u,p),{vars:R}=At("variables",i,N,u,void 0,p);if(s.type===h.TABLE){g({sectionId:s.section_id,...R});return}g(R);})();},[l,i]);let y=d.allowed||s?.type===h.NAV;if(!s||!f||!y)return null;let T=pd[s.type];return jsx("div",{id:`bespoke-${s.type}-${s.id}`,className:`cms-block-wrapper bespoke-block-area cms-block-${e}`,children:jsx(T,{...f,settings:s.settings,asComparison:r})})}var dm=b(()=>{c();he();dd();um();Mr();Ee();po();Uo();Vn();Ha();Wa();Zt();});var mm,LR,fm,Ra,Ea=b(()=>{c();mm={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"}]}},LR=Object.keys(mm).reduce((e,t)=>(e[t]=mm[t].defaultValue,e),{}),fm={memberImageBg:!1,optionsMenu:!1,optionData:!0,optionImage:!0,optionShare:!0,showAnchor:!1,...LR},Ra=e=>({data:typeof e.optionData=="boolean"?e.optionData:!0,image:typeof e.optionImage=="boolean"?e.optionImage:!0,share:typeof e.optionShare=="boolean"?e.optionShare:!0});});function gm({previews:e}){let t=e.map((r,o)=>({key:r?`bg-${r.content_id}`:`bg-${o}`,src:r?`/api/cms/member/image?member=${r.content_id}&size=splash`:""}));return jsxs(Fragment,{children:[jsx(Group,{className:"cms-section-bg",grow:!0,spacing:0,style:{position:"absolute",width:"100%",height:"100%"},children:t.map(r=>jsx("div",{className:"cms-section-member-bg",style:{backgroundImage:`url(${r.src})`,backgroundSize:"cover",backgroundPosition:"center center",height:"100%",width:"100%"}},r.key))}),jsx("div",{className:"cms-section-gradient-bg",style:{background:"white",position:"absolute",width:"100%",height:"100%",opacity:.33}})]})}var hm=b(()=>{c();});function ym({data:e}){let o=(e&&Array.isArray(e)&&e[0]?Object.keys(e[0]):[]).filter(n=>!n.startsWith("_")).map(n=>({accessorKey:n,header:n,enableSorting:!0,mantineTableBodyCellProps:{sx:{textWrap:"wrap"}}}));return jsx(MantineReactTable,{columns:o,data:e,enableBottomToolbar:!1,enableColumnActions:!1,enablePagination:!1,enableSorting:!0,enableTopToolbar:!1,initialState:{density:"xs"},layoutMode:"grid",mantineTableContainerProps:{sx:{minHeight:100,maxHeight:350}}})}var bm=b(()=>{c();});function No(e){let t={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'","&#x60;":"`","&nbsp;":""},r=`(?:${Object.keys(t).join("|")})`,o=RegExp(r),n=RegExp(r,"g"),a=String(e).replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();return o.test(a)?a.replace(n,s=>t[s]):a}var el=b(()=>{c();});function tl(e){return typeof e=="string"?String(e).replace(/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});/ig," "):e}var vm=b(()=>{c();});function FR(e){return e?DR(tl(No(e)),{replacement:"-",remove:/[*+~.()'"!:@]/g,lower:!0,strict:!0,trim:!0}):""}var tr,Tn=b(()=>{c();el();vm();tr=FR;});function Em(e){let{section:t}=e,r=Vt(),o=useRouter(),n=Q(x=>x.status.isCMS),a=Q(x=>x.status.currentLocale),s=o.locale,i=n?a:s,l=50,u=_t(i),p=fr(),m=Le("options"),d={...sl,...m.data_tab},[f,g]=useState([]),[y,T]=useState([]),[C,N]=useState(),[R,M]=useState(),[U,K]=useState(!1),[A,O]=useState({}),[k,I]=useState(!0),[E,w]=useState(!0),{sectionVariables:z,setSectionVariables:B,resetSectionVariables:D}=Pe(t.id),j=t.blocks||[],V=Q(x=>x),L=useMemo(()=>j.reduce((x,P)=>{let G=V.records.entities.block[P],J=V.variables.variables[P],X=V.variables.status[P];return (h.GENERATOR===G.type&&J._downloadEnabled===!0&&X.allowed||h.VIZ===G.type&&X.allowed)&&(x[P]={entity:G,variables:V.variables.variables[P],status:V.variables.status[P],inputVariablesFlat:G.inputs.reduce((le,de)=>({...le,...V.variables.variables[de]}),V.variables.attributes)}),x},{}),[j]),q=x=>{T(P=>P.includes(x)?P:[...P,x]);},$=x=>{g(P=>(P.find(J=>J.ix===x.ix)?P:[...P,x]).sort((J,X)=>J.ix>X.ix?1:-1));};function ie(x){!C&&x[0]&&Y(x[0]);}function Y(x){N(x),M("0");}useEffect(()=>{let x=async(P,G,J)=>{let X=dataLoad.bind({});return new Promise((le,de)=>{X(G,null,null,(ze,ye)=>{if(ze)de(ze);else {let ve=J instanceof Function?J(ye):ye;P.data.unshift(ve),$(P),le(ye);}});})};if(f.length===0&&y.length===0){let P=0;for(let G of Object.values(L)){let J=G.entity;if([h.GENERATOR,h.SECTION_FLAG].includes(J.type)){let X=G.variables._downloadData||G.variables._downloadUrl||G.status.api;if(X){let le=[];typeof X=="string"?le=X.split(_n):le=[X],le=ha(le,p);let de=G.variables._downloadTitle||`${d.data_source} ${P+1}`,ze=G.variables._downloadFileName||de;$({ix:P,id:J.id,title:No(de),fileName:ze,data:Array.isArray(le)?le:[le],loading:!1,type:h.GENERATOR}),q(P),P++;}}else if(J.type===h.VIZ){let X=Be(J),le=G.inputVariablesFlat,de={variables:le},ze=ut({logic:X.logic},u,de).logic,ye={router:o,section:{variables:z,setVariables:B,resetVariables:D}},ve=Tr(ze,u,le,i,J.id,{},ye,p),Je=ve.config._downloadTitle||ve.config.title||`${d.viz_source} ${P+1}`,et=ve.config._downloadFileName||Je;if(ve.config._downloadEnabled!==!1)try{let it=ve.config._downloadUrl||ve.config.data,wr=typeof it=="string"?[it]:it,Ht=ve.dataFormat instanceof Function?ve.dataFormat:!1,lt=ve.config._downloadDataFormat instanceof Function?ve.config._downloadDataFormat:!1;x({ix:P,id:J.id,title:No(Je),fileName:et,data:wr,loading:!1,type:h.VIZ},it,lt||Ht),q(P),P++;}catch(it){console.error("DataLoad catch",it);}}}w(!1);}},[L]),useEffect(()=>{f.length===y.length&&ie(f);},[f]),useEffect(()=>{if(C&&R){let x=parseInt(R,10);if(C.data[x]&&(!A[C.ix]||!A[C.ix][R])){I(!0);let P=C.data[R];typeof P=="string"?Xa(P,r,i,[],void 0).then(G=>{let J=aE(G);O({...A,[C.ix]:{...A[C.ix],[x]:J}});}).catch(G=>{console.error(G);}).finally(()=>{I(!1);}):(O({...A,[C.ix]:{...A[C.ix],[x]:P}}),I(!1));}}},[R,C]);let re=(x,P)=>{let G=x===P?"":`-${x}`.toLowerCase();if(C){let J=C.data.length>1&&R?`-${parseInt(R,10)+1}`:"";return `${tr(C.fileName)}${G}${J}.${P.toLowerCase()}`}return `${G}.${P}`},Z=async x=>{if(C){K(!0);let P=new HR,G=re(x,x);try{switch(x){case Ca.json.extension:P.file(G,JSON.stringify(te));break;case Ca.csv.extension:P.file(G,csvFormat(te));break;case Ca.xlsx.extension:{let{utils:J,write:X}=await import('xlsx'),le=J.book_new();J.book_append_sheet(le,J.json_to_sheet(te),G.substring(0,30));let de=X(le,{bookType:"xlsx",bookSST:!0,type:"binary"});P.file(G,de,{binary:!0});break}default:break}P.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:9}}).then(J=>{K(!1),saveAs(J,re(x,"zip"));});}catch(J){console.error(d.error_generating,J),K(!1);}}},te=useMemo(()=>C&&A[C.ix]&&A[C.ix][R]?A[C.ix][R]:[],[A,C,R]),H=useMemo(()=>f&&f.length>0&&f.length===y.length&&f.map((x,P)=>jsx(Button,{leftIcon:jsx(IconDatabase,{size:16}),onClick:()=>Y(x),variant:C?.ix===P?"filled":"default",loading:x.loading,disabled:x.loading,children:x.title},`source-${x.id}-${P}`)),[f,C,y]);return jsxs(Stack,{className:"cms-section-options-data",children:[jsx(Space,{h:"xs"}),jsx(LoadingOverlay,{visible:E,overlayBlur:2}),f.length===0&&!E&&jsx(Alert,{icon:jsx(IconAlertCircle,{size:"1rem"}),title:"Oops!",children:d.no_data_src}),f.length>1&&f.length===y.length&&!E&&jsx(Input.Wrapper,{label:`${d.choose_data_src}:`,children:jsx(Group,{spacing:"xs",children:H})}),C&&R&&jsx(Stack,{spacing:"xs",children:jsx(Input.Wrapper,{label:`${d.preview}
62
62
  ${te.length>l?d.rows_preview.replace("{nrows}",l):""}:`,children:jsxs(Group,{spacing:"xs",children:[jsx(Select,{disabled:!(C.data.length>1),style:{flex:"1"},value:R,onChange:x=>M(x),data:C.data.map((x,P)=>({value:`${P}`,group:typeof x=="string"?d.raw_group:d.formatted_group,label:typeof x=="string"?x:d.formatted_src.replace("{src}",C.title)})),icon:typeof C.data[R]=="string"?jsx(IconLink,{}):jsx(IconSparkles,{})}),jsx(CopyButton,{value:typeof C.data[R]=="string"?C.data[R]:"",timeout:2e3,children:({copied:x,copy:P})=>jsx(Tooltip,{label:x?d.copied:d.copy,withArrow:!0,position:"top",children:jsx(ActionIcon,{variant:x?"filled":"subtle",onClick:P,disabled:typeof C.data[R]!="string",children:x?jsx(IconClipboardCheck,{size:16}):jsx(IconClipboardCopy,{size:16})})})})]})})}),C&&!k&&te.length===0&&jsx(Alert,{icon:jsx(IconAlertCircle,{size:"1rem"}),title:"Oops!",children:d.error_preview}),C&&R&&!k&&te.length===0&&jsx("a",{href:C.data[R],target:"_blank",rel:"noreferrer",children:jsx(Button,{leftIcon:jsx(IconExternalLink,{size:16}),fullWidth:!0,children:d.open_in_window.replace("{src}",C.title)})}),jsxs(Stack,{pos:"relative",mih:"430px",children:[jsx(LoadingOverlay,{visible:k&&f.length>0,overlayBlur:2}),C&&!k&&te.length>0&&jsxs(Fragment,{children:[jsx(Box,{h:"350px",children:jsx(ym,{data:te.slice(0,l)})}),jsx(Input.Wrapper,{label:`${d.download}:`,children:jsx(Button.Group,{children:Object.values(Ca).map(x=>jsx(Button,{leftIcon:jsx(x.icon,{size:24}),onClick:()=>Z(x.extension),loading:U,fullWidth:!0,children:x.extension},`format-${x.extension}`))})})]})]})]})}var Ca,sl,aE,il=b(()=>{c();ge();bm();he();mn();Tn();el();Mr();Ee();_r();Nr();Co();Ka();vt();Ca={csv:{extension:"CSV",icon:IconFileTypeCsv},json:{extension:"JSON",icon:IconFileTypeJs},xlsx:{extension:"XLSX",icon:IconFileTypeXls}},sl={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.
63
- 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!"},aE=e=>{let t=[];return e&&e.data&&(e.data&&Array.isArray(e.data)?t=e.data:e.data&&e.data.data&&Array.isArray(e.data.data)?t=e.data.data:e.data&&e.data.data&&e.data.data.results&&Array.isArray(e.data.data.results)?t=e.data.data.results:e.data&&e.data.results&&Array.isArray(e.data.results)&&(t=e.data.results)),t};});function wm(e){let{section:t}=e,r=t.blocks||[],o=Q(x=>r.map(P=>x.records.entities.block[P]).filter(P=>P.type===h.VIZ&&x.variables.status[P.id].allowed)),{variant_slug1:n,slug1:a}=Q(x=>x.variables.attributes),s=Mp(),[i,l]=useState(Rt.section),[u,p]=useState(Et.png),[m,d]=useState(!1),[f,g]=useState(!1),[y,T]=useState([]),[C,N]=useState(o.length>0?o[0].id:null),R=i!==Rt.section,{print:M,downloadLoading:U}=Bp(t.id,n,a,R?C:null),[K,w]=useState(!0),[O,k]=useState(!1),I=Le("options"),E={...EE,...I.image_tab},{siteProps:A}=jr(),z=A?.logoSrc&&typeof A.logoSrc=="string",B=t?.settings?.name||`section-${t.id}`,D=`#${B}`,j=useMantineTheme(),V=()=>{let x=$(C);return select(x).select("svg").size()===1},L=()=>`${tr(B)}`,H=()=>{let x=document.getElementById(B);return select(x).select(".bespoke-section-content").node()},$=x=>{let P=H();return select(P).select(`#bespoke-visualization-${x}.bespoke-block-area`).node()},ie=()=>new Promise(x=>{let P;i===Rt.section?P=H():i===Rt.viz&&(P=$(C));let G=document.createElement("div");G.style.display="flex",G.style.justifyContent="space-between",G.classList.add("bespoke-Viz-source"),G.style.padding=j.spacing.xs,G.style.width="100%";let J=document.createElement("div");if(J.innerText=E.source.replace("{src}",`${window.location}${D}`),J.style.fontSize=j.fontSizes.xs,G.appendChild(J),z){let X=document.createElement("img");X.src=A.logoSrc,X.style.height="30px",X.onload=()=>x(P),X.onerror=()=>{X.remove(),x(P);},G.appendChild(X),P.appendChild(G);}else P.appendChild(G),x(P);}),Y=x=>{if(K)return "transparent";let P=select(x).style("background-color");return P!=="rgba(0, 0, 0, 0)"&&P!=="transparent"?P:x===document.body?"white":Y(x.parentNode)},re=async(x,P)=>{let{toPng:G}=await import('html-to-image');G(x,{backgroundColor:P.background,cacheBust:!0,filter:J=>J&&J.classList?!P.exclusionClasses.some(X=>J.classList.contains(X)):!0}).then(J=>{let X=document.createElement("a");X.download=`${P.filename}.png`,X.href=J,X.click(),RE(),d(!1);}).catch(J=>{console.error(J);});},Z=(x,P)=>{saveElement(x,{filename:P.filename,type:"svg",callback:()=>d(!1)},{background:P.background});},te=async()=>{d(!0);let x=await ie(),P={background:Y(x),exclusionClasses:["export-hidden"],filename:L()},G=u===Et.png?re:Z;try{if(x)G(x,P);else throw new Error(E.wrong_node)}catch{d(!1);}},q=async()=>{let{toCanvas:x}=await import('html-to-image');Promise.all(o.map(P=>{let G=$(P.id),J=G.querySelector("g.d3plus-geomap-tileGroup");return J.style.display="none",x(G).then(X=>(J.style.display="block",X))})).then(P=>{T(P.map(G=>G.toDataURL())),k(!1);});};return useEffect(()=>{i===Rt.viz&&o.length>0?(N(o[0].id),k(!0),q()):i===Rt.section&&T([]);},[i]),useEffect(()=>{C&&(V()?g(!0):(g(!1),p(Et.png)));},[C]),jsxs(Stack,{className:"cms-section-options-image",children:[jsx(Space,{h:"xs"}),o.length>0?jsx(Input.Wrapper,{label:`${E.choose_area}:`,children:jsx(SegmentedControl,{fullWidth:!0,value:i,data:[{value:Rt.section,label:jsxs(Center,{children:[jsx(IconTemplate,{size:"1rem"}),jsx(Box,{ml:10,children:E.entire_section})]})},{value:Rt.viz,label:jsxs(Center,{children:[jsx(IconChartBar,{size:"1rem"}),jsx(Box,{ml:10,children:E.viz_only})]})}],onChange:x=>{l(x),x===Rt.section&&p(Et.png);}})}):jsx(Text,{fw:"700",color:"gray.7",children:`${E.entire_section}:`}),i===Rt.viz&&o.length>0&&jsxs(Input.Wrapper,{label:`${E.choose_viz}:`,style:{minHeight:"161px",position:"relative"},children:[!O&&y.length>0&&jsx(ScrollArea,{style:{height:250},children:jsx(SimpleGrid,{cols:3,children:o.map((x,P)=>jsx(Image,{alt:`Viz ${x.id}`,onClick:()=>{N(x.id);},style:{cursor:"pointer",border:C===x.id?"4px solid #228be6":"4px solid #eee"},radius:0,src:y[P],withPlaceholder:!0},`viz-option-${x.id}`))})}),jsx(LoadingOverlay,{visible:O})]}),f&&i!==Rt.section&&jsx(Input.Wrapper,{label:`${E.choose_format}:`,children:jsxs(Button.Group,{children:[jsx(Button,{leftIcon:jsx(IconPolaroid,{size:16}),onClick:()=>p(Et.png),variant:u===Et.png?"filled":"default",fullWidth:!0,children:Et.png}),jsx(Button,{leftIcon:jsx(IconCode,{size:16}),onClick:()=>p(Et.svg),variant:u===Et.svg?"filled":"default",fullWidth:!0,children:Et.svg})]})}),jsx(Checkbox,{checked:K,label:`${E.transparent_bg}`,onChange:()=>w(!K),radius:"xl"}),jsx(Button,{leftIcon:jsx(IconDownload,{size:16}),loading:m||U,onClick:s&&u!==Et.svg?()=>M(K):te,fullWidth:!0,children:jsx("span",{children:m||U?E.processing:E.download.replace("{imageFormat}",u)})})]})}var Rt,Et,RE,EE,Pm=b(()=>{c();Tn();ge();vt();Wt();fa();he();Rt={viz:"viz",section:"section"},Et={png:"PNG",svg:"SVG"},RE=()=>{let e=document.getElementsByClassName("bespoke-Viz-source");Array.from(e).forEach(t=>t.remove());},EE={wrong_node:"Wrong node in export",choose_area:"Choose image area",choose_viz:"Choose visualization",choose_format:"Choose format",transparent_bg:"Transparent background",processing:"Processing image...",download:"Download {imageFormat}",entire_section:"Entire section",viz_only:"Visualization only",source:"Source: {src}"};});function Lm(e){let{title:t,url:r,disabled:o=!1}=e,n=o?IconCode:IconLink;return jsx(Input.Wrapper,{label:t,children:jsx(Input,{icon:jsx(n,{}),value:r,disabled:o,readOnly:!0,rightSection:jsx(CopyButton,{value:r,timeout:2e3,children:({copied:a,copy:s})=>jsx(Tooltip,{label:a?"Copied":"Copy",withArrow:!0,position:"right",children:jsx(ActionIcon,{variant:a?"filled":"subtle",onClick:s,disabled:o,children:a?jsx(IconClipboardCheck,{size:16}):jsx(IconClipboardCopy,{size:16})})})})})})}var Om=b(()=>{c();});function Bm(e){let{section:t}=e,[r,o]=useState(""),[n,a]=useState(""),[s,i]=useState(!0),l=Le("options"),u={...QE,...l.share_tab};return useEffect(()=>{a(document.title);let{origin:p,pathname:m}=window.location,d=`${p}${m}`,f=s?t.settings?.name?.length?`#${tr(t.settings.name)}`:`#section-${t.id}`:"";o(`${d}${f}`);},[s]),jsxs(Stack,{className:"cms-section-options-share",children:[jsx(Space,{h:"xs"}),jsx(Lm,{title:`${u.title}: ${n}`,url:r}),jsx(Checkbox,{checked:s,label:u.include_section,onChange:()=>i(!s),radius:"xl"}),jsxs(Group,{position:"center",children:[jsx(FacebookShareButton,{url:r,quote:n,children:jsx(FacebookIcon,{size:32,round:!0})}),jsx(TwitterShareButton,{url:r,title:n,children:jsx(TwitterIcon,{size:32,round:!0})}),jsx(TelegramShareButton,{url:r,title:n,children:jsx(TelegramIcon,{size:32,round:!0})}),jsx(WhatsappShareButton,{url:r,title:n,separator:":: ",children:jsx(WhatsappIcon,{size:32,round:!0})}),jsx(LinkedinShareButton,{url:r,children:jsx(LinkedinIcon,{size:32,round:!0})}),jsx(RedditShareButton,{url:r,title:n,windowWidth:660,windowHeight:460,children:jsx(RedditIcon,{size:32,round:!0})}),jsx(EmailShareButton,{url:r,subject:n,children:jsx(EmailIcon,{size:32,round:!0})})]})]})}var QE,Mm=b(()=>{c();Om();vt();Tn();QE={title:"Title",include_section:"Include Section"};});function Fm(e){let{section:t,initialMode:r,onEnds:o,open:n,title:a}=e,s=Ra(t.settings),i=useMemo(()=>tk.filter(f=>s[f]),[s]),[l,u]=useState(r||i[0]||"data"),p=Le("options");useEffect(()=>{r!==l&&u(r);},[r]);let m={...ul,...p},d=useMemo(()=>jsxs(Fragment,{children:[jsxs(Tabs.List,{children:[s.data&&jsx(Tabs.Tab,{value:"data",children:m.download_title}),s.image&&jsx(Tabs.Tab,{value:"image",children:m.image_title}),s.share&&jsx(Tabs.Tab,{value:"share",children:m.share_title})]}),s.data&&jsx(Tabs.Panel,{value:"data",children:jsx(Em,{section:t})}),s.image&&jsx(Tabs.Panel,{value:"image",children:jsx(wm,{section:t})}),s.share&&jsx(Tabs.Panel,{value:"share",children:jsx(Bm,{section:t})})]}),[s,t,m]);return jsx("div",{className:"cms-section-options-modal",children:n&&jsx(Modal,{className:"bespoke-options-modal",opened:!0,onClose:()=>o(),size:"xl",title:a,children:jsx(Tabs,{onTabChange:u,value:l,keepMounted:!1,children:d})})})}var ul,tk,Vm=b(()=>{c();il();Pm();Mm();vt();Ea();ul={download_title:"Download Data",image_title:"Save Image",share_title:"Share Link"},tk=["data","image","share"];});function Um(e){let{sectionId:t,disabled:r=!1}=e,[o,n]=useState(!1),[a,s]=useState("data"),i=Yn(t),l=Le("options"),u={...ul,...l},p=Ra(i.isSuccess?i.data.settings:{}),m=f=>{s(f),n(!0);},d=()=>{n(!1);};return jsxs("div",{className:"cms-section-options",children:[jsxs(Button.Group,{children:[p.data&&jsx(Button,{variant:"default",size:"xs",compact:!0,onClick:()=>m("data"),"aria-label":u.download_title,disabled:r,children:jsx(IconTable,{size:16})}),p.image&&jsx(Button,{variant:"default",size:"xs",compact:!0,onClick:()=>m("image"),"aria-label":u.image_title,disabled:r,children:jsx(IconCamera,{size:16})}),p.share&&jsx(Button,{variant:"default",size:"xs",compact:!0,onClick:()=>m("share"),"aria-label":u.share_title,disabled:r,children:jsx(IconShare,{size:16})})]}),i.isSuccess&&jsx(Fm,{section:i.data,initialMode:a,open:o,onEnds:d})]})}var Gm=b(()=>{c();Vm();ge();vt();Ea();});function ik({children:e,containerProps:t},r){return jsx(Flex,{ref:r,className:"bespoke-section-content",pos:"relative",align:"stretch",p:0,direction:{base:"column",md:"row"},wrap:"wrap",...t,children:e})}var La,jm,Km=b(()=>{c();ge();ai();La=Jt__default.forwardRef(function({children:t,column:r,basis:o,columnSettings:n={},sx:a={},...s},i){let l=Object.values(r).some(d=>d.settings?.display==="inline"),u=n?.width?`${n.width}px`:o,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:l?"row":"column",wrap:l?"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(a)],...s,children:t})}),jm=Jt__default.forwardRef(ik);});var Ym=b(()=>{c();});var Rn,Xm=b(()=>{c();Ge();ge();Ym();he();Rn={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:Rn.px},"%":{defaultValue:50,min:20,max:100,step:5,formatter:Rn["%"]}};});var pl,Qm=b(()=>{c();pl={backgroundColor:"#fafafa",block:{padding:10},column:{padding:12},section:{backgroundColor:"white",borderRadius:10,boxShadow:"0px 6px 10px rgba(12, 32, 50, 0.14), 0px 1px 15px rgba(12, 32, 50, 0.12), 0px 3px 5px rgba(12, 32, 50, 0.15)",margin:8,padding:32}};});function ml({previews:e,translations:t}){let{print:r}=qe(),o=useMemo(()=>e.map(({image:n,name:a},s)=>(n?.author||n?.url)&&jsxs(Stack,{spacing:0,children:[n.author&&jsxs(Text,{size:"xs",children:[a," ",t.image_by," ",jsx("strong",{children:n.author})]}),n.url&&jsxs(Text,{size:"xs",children:["URL: "," ",jsx(Anchor,{href:n.url,target:"_blank",children:n.url})]}),s+1<e.length&&jsx(Divider,{})]},n.id)),[e]);return jsx(Fragment,{children:r?jsx(Fragment,{children:o}):jsxs(Popover,{position:"right",children:[jsx(Popover.Target,{children:jsx(ActionIcon,{variant:"light",radius:"xl",children:jsx(IconPhoto,{size:20})})}),jsx(Popover.Dropdown,{children:o})]})})}var ef=b(()=>{c();Qt();});function tf(){let{locales:e}=useRouter(),t=location&&location.pathname.split("/").filter(r=>r.length>0)[0];return e?.includes(t)}var rf=b(()=>{c();});function xk({name:e,children:t,id:r,sectionSettings:o,sectionStyles:n,previews:a,translations:s}){let{print:i}=qe(),l=o.memberImageBg&&a.some(({image:p})=>p&&(p.url||p.author)),u=useMemo(()=>o.showAnchor&&o.optionsMenu?"apart":!o.showAnchor&&o.optionsMenu?"right":o.showAnchor&&!o.optionsMenu?"left":"right",[o.showAnchor,o.optionsMenu]);return jsxs(vk,{className:`bespoke-Section-${r} bespoke-Section-root `,settings:o,styles:n?.root||void 0,print:i,children:[o.memberImageBg&&jsx(gm,{previews:a}),jsxs(Sk,{className:`bespoke-Section-${r} bespoke-Section-container `,settings:o,styles:n?.container,id:e?.length?tr(e):`section-${r}`,pos:"relative",children:[!i&&jsxs(Group,{position:u,mb:"xs",children:[o.showAnchor&&jsxs(Anchor,{className:"cms-section-anchor",href:`#${o.name?tr(o.name):"section-"+r}`,sx:{"&:hover .cms-section-name":{visibility:"visible",opacity:1}},children:[jsx(Text,{span:!0,size:"small",children:"#"}),jsx(Text,{span:!0,size:"small",className:"cms-section-name",sx:{visibility:"hidden",opacity:0,transition:"visibility 0s, opacity 0.2s ease-in-out"},children:o.name||"section-"+r})]}),o.optionsMenu&&jsx(Um,{sectionId:r,disabled:!1})]}),jsxs(Tk,{print:i,className:`bespoke-Section-${r} bespoke-Section-container`,settings:o,styles:n?.content,children:[t,l&&jsx(ml,{previews:a,translations:s})]})]})]})}function Ek({section:e,sectionLoader:t,print:r}){let{isEmbed:o}=qe(),{id:n,settings:a}=e,s={...fm,...a},i=Qe(),l=Q(O=>O),u=Q(O=>O.variables.status),{previews:p,isRunConsumersRunning:m}=Q(O=>O.status),d=i.active&&i.status?p.concat(i.status?.previews||[]):p,f=st().Section,g=Mt(l),y=Object.values(g||{}).filter(O=>O.section_id===n),T=Le("sections"),C={...bk,...T},N=y.some(O=>{try{return u[O.id].allowed&&![h.GENERATOR,h.SECTION_FLAG].includes(O.type)||O.type===h.NAV}catch{return O.settings.allowed==="always"}}),R=y.filter(O=>![h.GENERATOR,h.SECTION_FLAG].includes(O.type)).reduce((O,k)=>(O[k.blockcol]?O[k.blockcol][k.blockrow]=k:O[k.blockcol]={[k.blockrow]:k},O),{}),M=Object.keys(y).length>0&&!a.hidden&&N;r&&(M=M&&!a.pdfHidden);let U=Object.keys(R).length;if(!M||i.active&&a.comparisonHide)return null;let K=(O,k=!1)=>{let I=Array.from(new Set(O.map(A=>A.blockcol))).map(A=>({blockcol:A})).sort((A,z)=>Ke(A,z,"blockcol")),E=[];return I.forEach(({blockcol:A})=>{let z=O.filter(B=>B.blockcol===A).sort((B,D)=>Ke(B,D,"blockrow")).map(B=>{if(!B.id||!u[B.id]?.allowed&&B.type!==h.NAV)return null;let{settings:D,type:j}=g[B.id],V=D.width&&!D.width.stretch&&D.width.unit?Rn[D.width.unit](D.width.value):D.display==="inline"?"auto":"100%",L={alignSelf:j===h.VIZ?"stretch":"flex-start",flexGrow:0,margin:"0",width:V,minWidth:300};return jsx(Box,{className:"bespoke-Block-wrapper",id:`bespoke-Block-${B.id}`,sx:L,py:pl.block.padding,children:jsx(xa,{blockId:B.id,asComparison:k},B.id)},B.id)});E.push(z);}),E.flat()},w=[];if(i.active&&!a.comparisonMerge){let O=y.filter(k=>![h.GENERATOR,h.SECTION_FLAG].includes(k.type)).reduce((k,I)=>({...k,[I.id]:I}),{});w=[jsx(La,{column:O,basis:"50%",children:K(Object.values(y.filter(k=>![h.GENERATOR,h.SECTION_FLAG].includes(k.type))))},"original"),jsx(La,{column:O,basis:"50%",children:K(Object.values(y.filter(k=>![h.GENERATOR,h.SECTION_FLAG].includes(k.type))),!0)},"comparison")];}else w=Object.keys(R).sort((O,k)=>-Da(O,k)).map(O=>{let k=R[O],I=a.columnSettings?a.columnSettings[O]:{},E=Object.values(k).sort((A,z)=>Ke(A,z,"blockrow"));return E.some(A=>!u[A.id]||u[A.id].allowed||A.type===h.NAV)?jsx(La,{column:k,columnSettings:I,basis:`calc(${100/U}% - (10px * ${U}))`,children:E.map(A=>{if(!A.id||!u[A.id]?.allowed&&A.type!==h.NAV)return null;let{settings:z,type:B}=g[A.id],D=z.width&&!z.width.stretch&&z.width.unit?Rn[z.width.unit](z.width.value):z.display==="inline"?"auto":"100%",j={alignSelf:B===h.VIZ?"stretch":"flex-start",flexGrow:0,margin:"0",width:D,minWidth:300};return jsx(Box,{className:`bespoke-Block-wrapper bespoke-${A.type}-wrapper`,id:`bespoke-Block-${A.id}`,sx:j,py:pl.block.padding,children:jsx(xa,{blockId:A.id},A.id)},A.id)})},O):null});return jsxs(xk,{id:n,name:e?.settings?.name,previews:d,sectionSettings:s,sectionStyles:f,translations:C,children:[m.includes(n)&&t,jsx(jm,{containerProps:{gap:s.columnGutter||"md",wrap:i.active?"nowrap":"wrap",sx:{zIndex:20}},children:w}),o&&jsx(Rk,{})]})}var bk,fl,vk,Sk,Tk,Rk,cf,uf=b(()=>{c();ge();yr();dm();Ea();io();hm();Gm();Xr();he();Km();Xm();Qm();Qt();vt();ef();Zt();Tn();Wt();rf();bk={image_by:"image by"},fl=(e,t)=>r=>e?e(r,t):{},vk=({settings:e,styles:t,print:r,children:o,...n})=>{let{position:a,shouldBreak:s}=e,i={normal:{position:"relative",backgroundColor:r?"transparent":"initial",borderRadius:0},sticky:{position:"sticky",zIndex:2,top:0,borderRadius:0,borderTop:r?"none":"initial",borderLeft:r?"none":"initial",borderRight:r?"none":"initial"}},l={normal:{radius:0},sticky:{radius:0,withBorder:!0}},u=[i[a],fl(t,e),s?{pageBreakBefore:"always"}:{}];return jsx(Paper,{component:"section",sx:u,...l[a],...n,children:o})},Sk=({settings:e,styles:t,children:r,...o})=>{let{width:n}=e,a={center:{zIndex:1},full:{zIndex:1}},s={center:{size:"lg",p:"sm",fluid:!1},full:{fluid:!0,p:"md"}},i=[a[n],fl(t,e)];return jsx(Container,{sx:i,...s[n],...o,children:r})},Tk=({settings:e,styles:t,print:r,children:o,...n})=>{let{style:a}=e,s={none:{},card:{boxShadow:r?"none":"initial"}},i={none:{bg:"transparent"},card:{shadow:r?"none":"lg",p:"md",radius:"md"}},l=[s[a],fl(t,e)];return jsx(Paper,{sx:l,...i[a],...n,"data-screenshot-target":"true",children:o})};Rk=()=>{let e=useRouter(),{query:t,locale:r}=e,{siteProps:o={logoSrc:""},profilePrefix:n,pathSegment:a}=jr(),s=t[a],i=Array.isArray(s)?s.join("/"):[],u=tf()?`/${r}`:"";u+=`${n}/${i}/`;let p=new URL(u,window.location.href).href;return jsxs(Group,{position:"apart",noWrap:!0,sx:{flexGrow:1},children:[jsx(Anchor,{href:p,target:"_blank",children:p}),jsx("img",{src:o.logoSrc,height:40,width:"auto",alt:"Site Logo"})]})};cf=Ek;});var pf=b(()=>{c();ae();W({name:"abbreviate",description:"Abbreviates a number into a smaller more human-readable number.",logicFactory(e){return t=>e.d3plus.formatAbbreviate(t)},inputType:"number",testValue:"123456",type:"formatter"});});var df=b(()=>{c();ae();W({name:"abs",description:"Simple Absolute Value.",logicFactory(){return e=>Math.abs(e)},inputType:"number",testValue:"-123",type:"formatter"});});var Ak,mf=b(()=>{c();ae();Ak=()=>function(t){let o=new RegExp(/([\$0-9\,]+)[A-z\-\s\&]*([\$0-9\,]*)/g).exec(t);return o?(o=o.slice(1).filter(n=>n.length).map(n=>(n.includes(",")&&(n.indexOf(",")===n.length-4?n=n.replace(/,000$/g,"k").replace(/([0-9]+)(,999$)/g,a=>`${parseInt(a)+1}k`):n.indexOf(",")===n.length-8&&(n=n.replace(/,000,000$/g,"M").replace(/([0-9]+)(,999,999$)/g,a=>`${parseInt(a)+1}M`))),n)),o.length===2?o.join(" - "):t.toLowerCase().match(/under|less|</g)?`< ${o[0]}`:t.toLowerCase().match(/over|more|\+|>/g)?`${o[0]}+`:`${o[0]}`):"None"},W({name:"bucket",description:"Sanitizes bucket strings to '< n', 'n1 - n2', and 'n+'",logicFactory:Ak,inputType:"number",testValue:"1234",type:"formatter"});});var ff=b(()=>{c();ae();W({name:"commas",description:"* Rounds to nearest whole number and adds commas.",logicFactory(e){return t=>e.d3.format(",")(Math.round(t))},inputType:"number",testValue:"1234.6",type:"formatter"});});var gf=b(()=>{c();ae();W({name:"date",description:"Formats a date into '%B %d, %Y' format.",logicFactory(e){return t=>(typeof t=="string"&&(t=e.d3plus.date(t)),e.d3.timeFormat("%B %d, %Y")(t))},inputType:"date",testValue:"2022-01-01",type:"formatter"});});var hf=b(()=>{c();ae();W({name:"dollar",description:"Adds a US dollar sign to the beginning of a String or Number.",logicFactory(e){return t=>(typeof t=="number"&&(t=e.d3plus.formatAbbreviate(t)),t.charAt(0)==="-"?t.replace("-","-$"):`$${t}`)},inputType:"number",testValue:"123",type:"formatter"});});var yf=b(()=>{c();ae();W({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 bf=b(()=>{c();ae();W({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 vf=b(()=>{c();ae();W({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 Sf=b(()=>{c();ae();W({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 Nk,Tf=b(()=>{c();ae();Nk=()=>function(t){let{curr:r,currMoe:o=0,prev:n,prevMoe:a=0}=t,s;if(o||a){let i=(-n/r**2)**2*o**2,l=(1/r)**2*a**2;s=Math.sqrt(i+l);}else s=(r-n)/n;return s*100},W({name:"growth",description:"Calculates the growth percentage between two numbers provided the following object format: {curr, prev}. Also supports calculating the growth between two margin of errors using this format: {curr, currMoe, prev, prevMoe}",logicFactory:Nk,inputType:"object",testValue:'{"curr":10,"currMoe":0,"prev":13,"prevMoe":0}',type:"formatter"});});var xf=b(()=>{c();ae();W({name:"growthPct",description:"Abbreviates a growth value, turns it absolute, and adds a percent sign.",logicFactory(e){return t=>`${e.d3plus.formatAbbreviate(Math.abs(t))}%`},inputType:"number",testValue:"12345",type:"formatter"});});var Rf=b(()=>{c();ae();W({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 Ef=b(()=>{c();ae();W({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 kf=b(()=>{c();ae();W({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 Cf=b(()=>{c();ae();W({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 Af=b(()=>{c();ae();W({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 wf=b(()=>{c();ae();W({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 Pf=b(()=>{c();ae();W({name:"list",description:"Joins an array of strings together, adding commas and 'and' when necessary.",logicFactory(){return e=>e.reduce((t,r,o)=>(o?o===e.length-1&&o===1?t+=` and ${r}`:o===e.length-1?t+=`, and ${r}`:t+=`, ${r}`:t+=r,t),"")},inputType:"object",testValue:'["foo","bar","bee"]',type:"formatter"});});var If=b(()=>{c();ae();W({name:"longWord",description:"",logicFactory(){return e=>e<0?"shorter":e>0?"longer":"similar"},inputType:"number",testValue:"5",type:"formatter"});});var Lf=b(()=>{c();ae();W({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 Of=b(()=>{c();ae();W({name:"moreFewerWord",description:"",logicFactory(){return e=>e<0?"fewer":"more"},inputType:"number",testValue:"-5",type:"formatter"});});var _f=b(()=>{c();ae();W({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 Bf=b(()=>{c();ae();W({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 Mf=b(()=>{c();ae();W({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 Nf=b(()=>{c();ae();W({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 Df=b(()=>{c();ae();W({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 Ff=b(()=>{c();ae();W({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 Vf=b(()=>{c();ae();W({name:"salary",description:"Displays salary values with proper precision (ie. '$74,200' instead of '$74.2k')",logicFactory(e){return t=>{let r;return t<1e6?r=e.d3.format(",")(t.toFixed(0)):r=e.d3plus.formatAbbreviate(t),`$${r}`}},inputType:"number",testValue:"1000000",type:"formatter"});});var $f=b(()=>{c();ae();W({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 gl,zf=b(()=>{c();ae();gl=W({name:"stripHTML",description:"Converts html tags to spaces, then removes redundant spaces",logicFactory(){return e=>{let t={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'","&#x60;":"`","&nbsp;":""},r=`(?:${Object.keys(t).join("|")})`,o=RegExp(r),n=RegExp(r,"g"),a=String(e).replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();return o.test(a)?a.replace(n,s=>t[s]):a}},inputType:"string",testValue:"<b>My text</b>",type:"formatter"});});var Uf=b(()=>{c();ae();W({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 Gf=b(()=>{c();ae();W({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 qf=b(()=>{c();ae();W({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 Hf=b(()=>{c();ae();W({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 jf=b(()=>{c();ae();W({name:"toSpacedCase",description:"Takes a camelCase or PascalCase string and adds spaces (I know Spaced Case isn't a thing, deal with it).",logicFactory(){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 Wf=b(()=>{c();ae();W({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 Kf=b(()=>{c();pf();df();mf();ff();gf();hf();yf();bf();vf();Sf();Tf();xf();Rf();Ef();kf();Cf();Af();wf();Pf();If();Lf();Of();_f();Bf();Mf();Nf();Df();Ff();Vf();$f();zf();Uf();Gf();qf();Hf();jf();Wf();});function Zf({onDownloadPDF:e,onDownloadCSV:t}){let[r,o]=useState(!1),[n,a]=useState(!1),[s,i]=useState(!1),l=useMediaQuery("(max-width: 768px)"),u=Le("export"),p={...hC,...u},m=async()=>{if(e){o(!0);try{await e();}finally{o(!1),i(!1);}}},d=async()=>{if(t){a(!0);try{await t();}finally{a(!1),i(!1);}}},f=(T,C,N,R,M,U)=>jsx(Button,{id:U,size:"sm",onClick:T,disabled:C,fullWidth:!0,variant:"subtle",h:"auto",px:"xs",w:"100%",styles:()=>({inner:{width:"100%",display:"block"}}),children:jsxs(Group,{noWrap:!0,position:"left",spacing:"xs",w:"100%",children:[C?jsx(Loader,{size:"1.75rem"}):N,jsxs(Stack,{spacing:0,w:"100%",py:"0.5rem",className:"bespoke-report-download-btn-text-container",children:[jsx(Text,{w:"100%",size:"sm",lineClamp:1,className:"bespoke-report-download-btn-text-container-cta",children:R}),M&&jsx(Text,{size:"xs",w:"100%",lineClamp:2,maw:"100%",style:{wordWrap:"break-word",whiteSpace:"normal"},variant:"dimmed",lh:"0.9rem",h:"1.9rem",className:"bespoke-report-download-btn-text-desc",children:M})]})]})}),g=e&&f(m,r,jsx(IconFileTypePdf,{size:"1.75rem"}),p.pdf.label,p.pdf.desc,"bespoke-download-pdf-btn"),y=t&&f(d,n,jsx(IconFileTypeXls,{size:"1.75rem"}),p.xlsx.label,p.xlsx.desc,"bespoke-download-xlsx-btn");return e||t?jsx(Affix,{position:{bottom:l?rem(0):rem(20),right:l?rem(0):rem(20)},id:"bespoke-report-download-affix",style:{width:l?"100%":"auto",boxShadow:l?"0px -2px 6px rgba(0, 0, 0, 0.1)":"0px 2px 6px rgba(0, 0, 0, 0.1)",borderRadius:"0.25rem",background:"white"},p:"xs",children:jsxs(Popover,{opened:s,onChange:i,position:"top",shadow:"md",width:l?"100%":250,id:"bespoke-report-download-popover",children:[jsx(Popover.Target,{children:jsx(Button,{id:"bespoke-report-download-btn",size:"sm",onClick:()=>i(T=>!T),leftIcon:jsx(IconDownload,{size:"1.2rem"}),variant:"subtle",loading:r||n,fullWidth:l,children:p.export})}),jsx(Popover.Dropdown,{p:"0.5rem",children:jsxs(Stack,{spacing:"xs",children:[g,y]})})]})}):null}var hC,Jf=b(()=>{"use client";c();vt();hC={export:"Export",pdf:{label:"Download PDF",desc:"Generates a printable version of the report page in PDF format."},xlsx:{label:"Download XLSX",desc:"Creates a downloadable spreadsheet of the report page data."}};});function SC(e,t){let r=e.replace(/[:\\/?*[\]]/g,"");return r.trim().length===0&&(r=`Sheet${t+1}`),r.slice(0,31)}function TC(e){let t=new ArrayBuffer(e.length),r=new Uint8Array(t);for(let o=0;o<e.length;o++)r[o]=e.charCodeAt(o)&255;return t}function eg(){let e=window.document.querySelector("title")?.textContent;return e||`data_export_${new Date().toISOString()}`}var vC,xC,tg,rg=b(()=>{c();vC=e=>new Promise((t,r)=>{if(!e||e.length===0){r(new Error("No data provided"));return}try{let o=Do.utils.book_new();e.forEach((i,l)=>{if(i.data&&i.data.length>0){let u=i.data[0],p=Do.utils.json_to_sheet(u),m=SC(i.fileName||`Sheet${l+1}`,l),d=1;for(;o.SheetNames.includes(m);){let f=` (${d})`;m=`${m.slice(0,31-f.length)}${f}`,d++;}Do.utils.book_append_sheet(o,p,m);}});let n=Do.write(o,{bookType:"xlsx",type:"binary"}),a=new Blob([TC(n)],{type:"application/octet-stream"}),s=new HR;s.file(`${eg()}.xlsx`,a),s.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:9}}).then(i=>{t(i);}).catch(r);}catch(o){r(o);}});xC=async e=>{try{let t=await vC(e);saveAs(t,`${eg()}.zip`);}catch(t){console.error("Error generating file:",t);}},tg=xC;});function qe(){let e=useContext(sg);if(e===void 0)throw new Error("usePrint must be used within a PrintContext");return e}function OC(e){return useMemo(()=>e.data.reduce((r,o)=>(o.blocks&&o.blocks.forEach(n=>{r[n]=o.id;}),r),{}),[e.data])}function _C({pathSegmentsKey:e="bespoke",sectionLoader:t,mode:r}){let{query:o}=useRouter(),n=Jo(),a=Qe(),s=un(),i=Hg(o.print)??!1,l=r==="embed",{printReport:u,error:p,setError:m}=ma();ca();let d=ng.locale,f=_t(d),g=useMemo(()=>n.data?.sort(Ke).filter(E=>E.settings?.hidden!==!0).filter(E=>E.settings?.pdfHidden!==!0).reduce((E,A)=>(A.blocks&&A.blocks.length>0&&E.push(...A.blocks),E),[])??[],[n.data]),y=OC({data:n.data||[]}),{sectionsVariables:T,resetSectionVariables:C,setSectionVariables:N}=Vc(n.data?.map(E=>E.id)||[]),R=Q(E=>E),M=Le("options"),U={...sl,...M.data_tab},K=useMemo(()=>g.reduce((E,A)=>{let z=R.records.entities.block[A],B=R.variables.status[A];return h.VIZ===z?.type&&B.allowed&&E.push({id:A,entity:z,variables:R.variables.variables[A],status:R.variables.status[A],inputVariablesFlat:z.inputs.reduce((D,j)=>({...D,...R.variables.variables[j]}),R.variables.attributes)}),E},[]),[g,R.records.entities.block,R.variables.attributes,R.variables.status,R.variables.variables]);function w(E){return E=E.replace(/<p>/g,""),E=E.replace(/<\/p>/g,""),E}let O=async(E,A,z)=>{let B=dataLoad.bind({});return new Promise((D,j)=>{B(A,null,null,(V,L)=>{if(V)j(V);else try{E||(E={data:[]}),Array.isArray(E.data)||(E.data=[]);let H=z instanceof Function?z(L):L;E.data.unshift(H),E.rawData=L,D(E);}catch(H){j(H);}});})},k=fr(),I=async()=>{if(!s.XlsxVizActive)return;let E=[],A=[],z=0,B=1;for(let V of K){let L=V.entity,H=Be(L),$=V.inputVariablesFlat,ie={variables:$},Y=ut({logic:H.logic},f,ie).logic,re={router:ng,section:{variables:T[y[L.id]],setVariables:N(T[y[L.id]]),resetVariables:C(T[y[L.id]])}},Z=Tr(Y,f,$,d,L.id,{},re,k),te=Z.config._downloadTitle||Z.config.title||`${U.viz_source} ${z+1}`,q=Z.config._downloadFileName||te;if(Z.config._downloadEnabled!==!1){let x=Z.config._downloadUrl||Z.config.data;if(!x){console.error("API is undefined for block:",L.id);continue}let P=typeof x=="string"?[x]:x,G=Z.dataFormat instanceof Function?Z.dataFormat:!1,J=Z.config._downloadDataFormat instanceof Function?Z.config._downloadDataFormat:!1,X=Z.config._downloadSectionName,le=Z.config._downloadSource;try{let de=await O({ix:z,id:L.id,title:gl(te),fileName:le?X?`${B} ${w(X)}`:`${B} ${q}`:X?w(X):q,data:P,loading:!1,type:h.VIZ},x,J||G);if(le){let ze=Array.isArray(de.rawData)?de.rawData:[de.rawData],ye=new Set;ze.forEach((ve,Je)=>{let et=le(ve),it=et.name.trim().split(`
64
- `),Ar=et.description.trim().split(`
63
+ 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!"},aE=e=>{let t=[];return e&&e.data&&(e.data&&Array.isArray(e.data)?t=e.data:e.data&&e.data.data&&Array.isArray(e.data.data)?t=e.data.data:e.data&&e.data.data&&e.data.data.results&&Array.isArray(e.data.data.results)?t=e.data.data.results:e.data&&e.data.results&&Array.isArray(e.data.results)&&(t=e.data.results)),t};});function Am(e){let{section:t}=e,r=t.blocks||[],o=Q(x=>r.map(P=>x.records.entities.block[P]).filter(P=>P.type===h.VIZ&&x.variables.status[P.id].allowed)),{variant_slug1:n,slug1:a}=Q(x=>x.variables.attributes),s=Mp(),[i,l]=useState(Rt.section),[u,p]=useState(Et.png),[m,d]=useState(!1),[f,g]=useState(!1),[y,T]=useState([]),[C,N]=useState(o.length>0?o[0].id:null),R=i!==Rt.section,{print:M,downloadLoading:U}=Bp(t.id,n,a,R?C:null),[K,A]=useState(!0),[O,k]=useState(!1),I=Le("options"),E={...EE,...I.image_tab},{siteProps:w}=jr(),z=w?.logoSrc&&typeof w.logoSrc=="string",B=t?.settings?.name||`section-${t.id}`,D=`#${B}`,j=useMantineTheme(),V=()=>{let x=$(C);return select(x).select("svg").size()===1},L=()=>`${tr(B)}`,q=()=>{let x=document.getElementById(B);return select(x).select(".bespoke-section-content").node()},$=x=>{let P=q();return select(P).select(`#bespoke-visualization-${x}.bespoke-block-area`).node()},ie=()=>new Promise(x=>{let P;i===Rt.section?P=q():i===Rt.viz&&(P=$(C));let G=document.createElement("div");G.style.display="flex",G.style.justifyContent="space-between",G.classList.add("bespoke-Viz-source"),G.style.padding=j.spacing.xs,G.style.width="100%";let J=document.createElement("div");if(J.innerText=E.source.replace("{src}",`${window.location}${D}`),J.style.fontSize=j.fontSizes.xs,G.appendChild(J),z){let X=document.createElement("img");X.src=w.logoSrc,X.style.height="30px",X.onload=()=>x(P),X.onerror=()=>{X.remove(),x(P);},G.appendChild(X),P.appendChild(G);}else P.appendChild(G),x(P);}),Y=x=>{if(K)return "transparent";let P=select(x).style("background-color");return P!=="rgba(0, 0, 0, 0)"&&P!=="transparent"?P:x===document.body?"white":Y(x.parentNode)},re=async(x,P)=>{let{toPng:G}=await import('html-to-image');G(x,{backgroundColor:P.background,cacheBust:!0,filter:J=>J&&J.classList?!P.exclusionClasses.some(X=>J.classList.contains(X)):!0}).then(J=>{let X=document.createElement("a");X.download=`${P.filename}.png`,X.href=J,X.click(),RE(),d(!1);}).catch(J=>{console.error(J);});},Z=(x,P)=>{saveElement(x,{filename:P.filename,type:"svg",callback:()=>d(!1)},{background:P.background});},te=async()=>{d(!0);let x=await ie(),P={background:Y(x),exclusionClasses:["export-hidden"],filename:L()},G=u===Et.png?re:Z;try{if(x)G(x,P);else throw new Error(E.wrong_node)}catch{d(!1);}},H=async()=>{let{toCanvas:x}=await import('html-to-image');Promise.all(o.map(P=>{let G=$(P.id),J=G.querySelector("g.d3plus-geomap-tileGroup");return J.style.display="none",x(G).then(X=>(J.style.display="block",X))})).then(P=>{T(P.map(G=>G.toDataURL())),k(!1);});};return useEffect(()=>{i===Rt.viz&&o.length>0?(N(o[0].id),k(!0),H()):i===Rt.section&&T([]);},[i]),useEffect(()=>{C&&(V()?g(!0):(g(!1),p(Et.png)));},[C]),jsxs(Stack,{className:"cms-section-options-image",children:[jsx(Space,{h:"xs"}),o.length>0?jsx(Input.Wrapper,{label:`${E.choose_area}:`,children:jsx(SegmentedControl,{fullWidth:!0,value:i,data:[{value:Rt.section,label:jsxs(Center,{children:[jsx(IconTemplate,{size:"1rem"}),jsx(Box,{ml:10,children:E.entire_section})]})},{value:Rt.viz,label:jsxs(Center,{children:[jsx(IconChartBar,{size:"1rem"}),jsx(Box,{ml:10,children:E.viz_only})]})}],onChange:x=>{l(x),x===Rt.section&&p(Et.png);}})}):jsx(Text,{fw:"700",color:"gray.7",children:`${E.entire_section}:`}),i===Rt.viz&&o.length>0&&jsxs(Input.Wrapper,{label:`${E.choose_viz}:`,style:{minHeight:"161px",position:"relative"},children:[!O&&y.length>0&&jsx(ScrollArea,{style:{height:250},children:jsx(SimpleGrid,{cols:3,children:o.map((x,P)=>jsx(Image,{alt:`Viz ${x.id}`,onClick:()=>{N(x.id);},style:{cursor:"pointer",border:C===x.id?"4px solid #228be6":"4px solid #eee"},radius:0,src:y[P],withPlaceholder:!0},`viz-option-${x.id}`))})}),jsx(LoadingOverlay,{visible:O})]}),f&&i!==Rt.section&&jsx(Input.Wrapper,{label:`${E.choose_format}:`,children:jsxs(Button.Group,{children:[jsx(Button,{leftIcon:jsx(IconPolaroid,{size:16}),onClick:()=>p(Et.png),variant:u===Et.png?"filled":"default",fullWidth:!0,children:Et.png}),jsx(Button,{leftIcon:jsx(IconCode,{size:16}),onClick:()=>p(Et.svg),variant:u===Et.svg?"filled":"default",fullWidth:!0,children:Et.svg})]})}),jsx(Checkbox,{checked:K,label:`${E.transparent_bg}`,onChange:()=>A(!K),radius:"xl"}),jsx(Button,{leftIcon:jsx(IconDownload,{size:16}),loading:m||U,onClick:s&&u!==Et.svg?()=>M(K):te,fullWidth:!0,children:jsx("span",{children:m||U?E.processing:E.download.replace("{imageFormat}",u)})})]})}var Rt,Et,RE,EE,Pm=b(()=>{c();Tn();ge();vt();Wt();fa();he();Rt={viz:"viz",section:"section"},Et={png:"PNG",svg:"SVG"},RE=()=>{let e=document.getElementsByClassName("bespoke-Viz-source");Array.from(e).forEach(t=>t.remove());},EE={wrong_node:"Wrong node in export",choose_area:"Choose image area",choose_viz:"Choose visualization",choose_format:"Choose format",transparent_bg:"Transparent background",processing:"Processing image...",download:"Download {imageFormat}",entire_section:"Entire section",viz_only:"Visualization only",source:"Source: {src}"};});function Lm(e){let{title:t,url:r,disabled:o=!1}=e,n=o?IconCode:IconLink;return jsx(Input.Wrapper,{label:t,children:jsx(Input,{icon:jsx(n,{}),value:r,disabled:o,readOnly:!0,rightSection:jsx(CopyButton,{value:r,timeout:2e3,children:({copied:a,copy:s})=>jsx(Tooltip,{label:a?"Copied":"Copy",withArrow:!0,position:"right",children:jsx(ActionIcon,{variant:a?"filled":"subtle",onClick:s,disabled:o,children:a?jsx(IconClipboardCheck,{size:16}):jsx(IconClipboardCopy,{size:16})})})})})})}var Om=b(()=>{c();});function Bm(e){let{section:t}=e,[r,o]=useState(""),[n,a]=useState(""),[s,i]=useState(!0),l=Le("options"),u={...QE,...l.share_tab};return useEffect(()=>{a(document.title);let{origin:p,pathname:m}=window.location,d=`${p}${m}`,f=s?t.settings?.name?.length?`#${tr(t.settings.name)}`:`#section-${t.id}`:"";o(`${d}${f}`);},[s]),jsxs(Stack,{className:"cms-section-options-share",children:[jsx(Space,{h:"xs"}),jsx(Lm,{title:`${u.title}: ${n}`,url:r}),jsx(Checkbox,{checked:s,label:u.include_section,onChange:()=>i(!s),radius:"xl"}),jsxs(Group,{position:"center",children:[jsx(FacebookShareButton,{url:r,quote:n,children:jsx(FacebookIcon,{size:32,round:!0})}),jsx(TwitterShareButton,{url:r,title:n,children:jsx(TwitterIcon,{size:32,round:!0})}),jsx(TelegramShareButton,{url:r,title:n,children:jsx(TelegramIcon,{size:32,round:!0})}),jsx(WhatsappShareButton,{url:r,title:n,separator:":: ",children:jsx(WhatsappIcon,{size:32,round:!0})}),jsx(LinkedinShareButton,{url:r,children:jsx(LinkedinIcon,{size:32,round:!0})}),jsx(RedditShareButton,{url:r,title:n,windowWidth:660,windowHeight:460,children:jsx(RedditIcon,{size:32,round:!0})}),jsx(EmailShareButton,{url:r,subject:n,children:jsx(EmailIcon,{size:32,round:!0})})]})]})}var QE,Mm=b(()=>{c();Om();vt();Tn();QE={title:"Title",include_section:"Include Section"};});function Fm(e){let{section:t,initialMode:r,onEnds:o,open:n,title:a}=e,s=Ra(t.settings),i=useMemo(()=>tk.filter(f=>s[f]),[s]),[l,u]=useState(r||i[0]||"data"),p=Le("options");useEffect(()=>{r!==l&&u(r);},[r]);let m={...ul,...p},d=useMemo(()=>jsxs(Fragment,{children:[jsxs(Tabs.List,{children:[s.data&&jsx(Tabs.Tab,{value:"data",children:m.download_title}),s.image&&jsx(Tabs.Tab,{value:"image",children:m.image_title}),s.share&&jsx(Tabs.Tab,{value:"share",children:m.share_title})]}),s.data&&jsx(Tabs.Panel,{value:"data",children:jsx(Em,{section:t})}),s.image&&jsx(Tabs.Panel,{value:"image",children:jsx(Am,{section:t})}),s.share&&jsx(Tabs.Panel,{value:"share",children:jsx(Bm,{section:t})})]}),[s,t,m]);return jsx("div",{className:"cms-section-options-modal",children:n&&jsx(Modal,{className:"bespoke-options-modal",opened:!0,onClose:()=>o(),size:"xl",title:a,children:jsx(Tabs,{onTabChange:u,value:l,keepMounted:!1,children:d})})})}var ul,tk,Vm=b(()=>{c();il();Pm();Mm();vt();Ea();ul={download_title:"Download Data",image_title:"Save Image",share_title:"Share Link"},tk=["data","image","share"];});function Um(e){let{sectionId:t,disabled:r=!1}=e,[o,n]=useState(!1),[a,s]=useState("data"),i=Yn(t),l=Le("options"),u={...ul,...l},p=Ra(i.isSuccess?i.data.settings:{}),m=f=>{s(f),n(!0);},d=()=>{n(!1);};return jsxs("div",{className:"cms-section-options",children:[jsxs(Button.Group,{children:[p.data&&jsx(Button,{variant:"default",size:"xs",compact:!0,onClick:()=>m("data"),"aria-label":u.download_title,disabled:r,children:jsx(IconTable,{size:16})}),p.image&&jsx(Button,{variant:"default",size:"xs",compact:!0,onClick:()=>m("image"),"aria-label":u.image_title,disabled:r,children:jsx(IconCamera,{size:16})}),p.share&&jsx(Button,{variant:"default",size:"xs",compact:!0,onClick:()=>m("share"),"aria-label":u.share_title,disabled:r,children:jsx(IconShare,{size:16})})]}),i.isSuccess&&jsx(Fm,{section:i.data,initialMode:a,open:o,onEnds:d})]})}var Gm=b(()=>{c();Vm();ge();vt();Ea();});function ik({children:e,containerProps:t},r){return jsx(Flex,{ref:r,className:"bespoke-section-content",pos:"relative",align:"stretch",p:0,direction:{base:"column",md:"row"},wrap:"wrap",...t,children:e})}var La,jm,Km=b(()=>{c();ge();ai();La=Jt__default.forwardRef(function({children:t,column:r,basis:o,columnSettings:n={},sx:a={},...s},i){let l=Object.values(r).some(d=>d.settings?.display==="inline"),u=n?.width?`${n.width}px`:o,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:l?"row":"column",wrap:l?"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(a)],...s,children:t})}),jm=Jt__default.forwardRef(ik);});var Ym=b(()=>{c();});var Rn,Xm=b(()=>{c();Ge();ge();Ym();he();Rn={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:Rn.px},"%":{defaultValue:50,min:20,max:100,step:5,formatter:Rn["%"]}};});var pl,Qm=b(()=>{c();pl={backgroundColor:"#fafafa",block:{padding:10},column:{padding:12},section:{backgroundColor:"white",borderRadius:10,boxShadow:"0px 6px 10px rgba(12, 32, 50, 0.14), 0px 1px 15px rgba(12, 32, 50, 0.12), 0px 3px 5px rgba(12, 32, 50, 0.15)",margin:8,padding:32}};});function ml({previews:e,translations:t}){let{print:r}=qe(),o=useMemo(()=>e.map(({image:n,name:a},s)=>(n?.author||n?.url)&&jsxs(Stack,{spacing:0,children:[n.author&&jsxs(Text,{size:"xs",children:[a," ",t.image_by," ",jsx("strong",{children:n.author})]}),n.url&&jsxs(Text,{size:"xs",children:["URL: "," ",jsx(Anchor,{href:n.url,target:"_blank",children:n.url})]}),s+1<e.length&&jsx(Divider,{})]},n.id)),[e]);return jsx(Fragment,{children:r?jsx(Fragment,{children:o}):jsxs(Popover,{position:"right",children:[jsx(Popover.Target,{children:jsx(ActionIcon,{variant:"light",radius:"xl",children:jsx(IconPhoto,{size:20})})}),jsx(Popover.Dropdown,{children:o})]})})}var ef=b(()=>{c();Qt();});function tf(){let{locales:e}=useRouter(),t=location&&location.pathname.split("/").filter(r=>r.length>0)[0];return e?.includes(t)}var rf=b(()=>{c();});function xk({name:e,children:t,id:r,sectionSettings:o,sectionStyles:n,previews:a,translations:s}){let{print:i}=qe(),l=o.memberImageBg&&a.some(({image:p})=>p&&(p.url||p.author)),u=useMemo(()=>o.showAnchor&&o.optionsMenu?"apart":!o.showAnchor&&o.optionsMenu?"right":o.showAnchor&&!o.optionsMenu?"left":"right",[o.showAnchor,o.optionsMenu]);return jsxs(vk,{className:`bespoke-Section-${r} bespoke-Section-root `,settings:o,styles:n?.root||void 0,print:i,children:[o.memberImageBg&&jsx(gm,{previews:a}),jsxs(Sk,{className:`bespoke-Section-${r} bespoke-Section-container `,settings:o,styles:n?.container,id:e?.length?tr(e):`section-${r}`,pos:"relative",children:[!i&&jsxs(Group,{position:u,mb:"xs",children:[o.showAnchor&&jsxs(Anchor,{className:"cms-section-anchor",href:`#${o.name?tr(o.name):"section-"+r}`,sx:{"&:hover .cms-section-name":{visibility:"visible",opacity:1}},children:[jsx(Text,{span:!0,size:"small",children:"#"}),jsx(Text,{span:!0,size:"small",className:"cms-section-name",sx:{visibility:"hidden",opacity:0,transition:"visibility 0s, opacity 0.2s ease-in-out"},children:o.name||"section-"+r})]}),o.optionsMenu&&jsx(Um,{sectionId:r,disabled:!1})]}),jsxs(Tk,{print:i,className:`bespoke-Section-${r} bespoke-Section-container`,settings:o,styles:n?.content,children:[t,l&&jsx(ml,{previews:a,translations:s})]})]})]})}function Ek({section:e,sectionLoader:t,print:r}){let{isEmbed:o}=qe(),{id:n,settings:a}=e,s={...fm,...a},i=Qe(),l=Q(O=>O),u=Q(O=>O.variables.status),{previews:p,isRunConsumersRunning:m}=Q(O=>O.status),d=i.active&&i.status?p.concat(i.status?.previews||[]):p,f=st().Section,g=Mt(l),y=Object.values(g||{}).filter(O=>O.section_id===n),T=Le("sections"),C={...bk,...T},N=y.some(O=>{try{return u[O.id].allowed&&![h.GENERATOR,h.SECTION_FLAG].includes(O.type)||O.type===h.NAV}catch{return O.settings.allowed==="always"}}),R=y.filter(O=>![h.GENERATOR,h.SECTION_FLAG].includes(O.type)).reduce((O,k)=>(O[k.blockcol]?O[k.blockcol][k.blockrow]=k:O[k.blockcol]={[k.blockrow]:k},O),{}),M=Object.keys(y).length>0&&!a.hidden&&N;r&&(M=M&&!a.pdfHidden);let U=Object.keys(R).length;if(!M||i.active&&a.comparisonHide)return null;let K=(O,k=!1)=>{let I=Array.from(new Set(O.map(w=>w.blockcol))).map(w=>({blockcol:w})).sort((w,z)=>Ke(w,z,"blockcol")),E=[];return I.forEach(({blockcol:w})=>{let z=O.filter(B=>B.blockcol===w).sort((B,D)=>Ke(B,D,"blockrow")).map(B=>{if(!B.id||!u[B.id]?.allowed&&B.type!==h.NAV)return null;let{settings:D,type:j}=g[B.id],V=D.width&&!D.width.stretch&&D.width.unit?Rn[D.width.unit](D.width.value):D.display==="inline"?"auto":"100%",L={alignSelf:j===h.VIZ?"stretch":"flex-start",flexGrow:0,margin:"0",width:V,minWidth:300};return jsx(Box,{className:"bespoke-Block-wrapper",id:`bespoke-Block-${B.id}`,sx:L,py:pl.block.padding,children:jsx(xa,{blockId:B.id,asComparison:k},B.id)},B.id)});E.push(z);}),E.flat()},A=[];if(i.active&&!a.comparisonMerge){let O=y.filter(k=>![h.GENERATOR,h.SECTION_FLAG].includes(k.type)).reduce((k,I)=>({...k,[I.id]:I}),{});A=[jsx(La,{column:O,basis:"50%",children:K(Object.values(y.filter(k=>![h.GENERATOR,h.SECTION_FLAG].includes(k.type))))},"original"),jsx(La,{column:O,basis:"50%",children:K(Object.values(y.filter(k=>![h.GENERATOR,h.SECTION_FLAG].includes(k.type))),!0)},"comparison")];}else A=Object.keys(R).sort((O,k)=>-Da(O,k)).map(O=>{let k=R[O],I=a.columnSettings?a.columnSettings[O]:{},E=Object.values(k).sort((w,z)=>Ke(w,z,"blockrow"));return E.some(w=>!u[w.id]||u[w.id].allowed||w.type===h.NAV)?jsx(La,{column:k,columnSettings:I,basis:`calc(${100/U}% - (10px * ${U}))`,children:E.map(w=>{if(!w.id||!u[w.id]?.allowed&&w.type!==h.NAV)return null;let{settings:z,type:B}=g[w.id],D=z.width&&!z.width.stretch&&z.width.unit?Rn[z.width.unit](z.width.value):z.display==="inline"?"auto":"100%",j={alignSelf:B===h.VIZ?"stretch":"flex-start",flexGrow:0,margin:"0",width:D,minWidth:300};return jsx(Box,{className:`bespoke-Block-wrapper bespoke-${w.type}-wrapper`,id:`bespoke-Block-${w.id}`,sx:j,py:pl.block.padding,children:jsx(xa,{blockId:w.id},w.id)},w.id)})},O):null});return jsxs(xk,{id:n,name:e?.settings?.name,previews:d,sectionSettings:s,sectionStyles:f,translations:C,children:[m.includes(n)&&t,jsx(jm,{containerProps:{gap:s.columnGutter||"md",wrap:i.active?"nowrap":"wrap",sx:{zIndex:20}},children:A}),o&&jsx(Rk,{})]})}var bk,fl,vk,Sk,Tk,Rk,cf,uf=b(()=>{c();ge();yr();dm();Ea();io();hm();Gm();Xr();he();Km();Xm();Qm();Qt();vt();ef();Zt();Tn();Wt();rf();bk={image_by:"image by"},fl=(e,t)=>r=>e?e(r,t):{},vk=({settings:e,styles:t,print:r,children:o,...n})=>{let{position:a,shouldBreak:s}=e,i={normal:{position:"relative",backgroundColor:r?"transparent":"initial",borderRadius:0},sticky:{position:"sticky",zIndex:2,top:0,borderRadius:0,borderTop:r?"none":"initial",borderLeft:r?"none":"initial",borderRight:r?"none":"initial"}},l={normal:{radius:0},sticky:{radius:0,withBorder:!0}},u=[i[a],fl(t,e),s?{pageBreakBefore:"always"}:{}];return jsx(Paper,{component:"section",sx:u,...l[a],...n,children:o})},Sk=({settings:e,styles:t,children:r,...o})=>{let{width:n}=e,a={center:{zIndex:1},full:{zIndex:1}},s={center:{size:"lg",p:"sm",fluid:!1},full:{fluid:!0,p:"md"}},i=[a[n],fl(t,e)];return jsx(Container,{sx:i,...s[n],...o,children:r})},Tk=({settings:e,styles:t,print:r,children:o,...n})=>{let{style:a}=e,s={none:{},card:{boxShadow:r?"none":"initial"}},i={none:{bg:"transparent"},card:{shadow:r?"none":"lg",p:"md",radius:"md"}},l=[s[a],fl(t,e)];return jsx(Paper,{sx:l,...i[a],...n,"data-screenshot-target":"true",children:o})};Rk=()=>{let e=useRouter(),{query:t,locale:r}=e,{siteProps:o={logoSrc:""},profilePrefix:n,pathSegment:a}=jr(),s=t[a],i=Array.isArray(s)?s.join("/"):[],u=tf()?`/${r}`:"";u+=`${n}/${i}/`;let p=new URL(u,window.location.href).href;return jsxs(Group,{position:"apart",noWrap:!0,sx:{flexGrow:1},children:[jsx(Anchor,{href:p,target:"_blank",children:p}),jsx("img",{src:o.logoSrc,height:40,width:"auto",alt:"Site Logo"})]})};cf=Ek;});var pf=b(()=>{c();ae();W({name:"abbreviate",description:"Abbreviates a number into a smaller more human-readable number.",logicFactory(e){return t=>e.d3plus.formatAbbreviate(t)},inputType:"number",testValue:"123456",type:"formatter"});});var df=b(()=>{c();ae();W({name:"abs",description:"Simple Absolute Value.",logicFactory(){return e=>Math.abs(e)},inputType:"number",testValue:"-123",type:"formatter"});});var wk,mf=b(()=>{c();ae();wk=()=>function(t){let o=new RegExp(/([\$0-9\,]+)[A-z\-\s\&]*([\$0-9\,]*)/g).exec(t);return o?(o=o.slice(1).filter(n=>n.length).map(n=>(n.includes(",")&&(n.indexOf(",")===n.length-4?n=n.replace(/,000$/g,"k").replace(/([0-9]+)(,999$)/g,a=>`${parseInt(a)+1}k`):n.indexOf(",")===n.length-8&&(n=n.replace(/,000,000$/g,"M").replace(/([0-9]+)(,999,999$)/g,a=>`${parseInt(a)+1}M`))),n)),o.length===2?o.join(" - "):t.toLowerCase().match(/under|less|</g)?`< ${o[0]}`:t.toLowerCase().match(/over|more|\+|>/g)?`${o[0]}+`:`${o[0]}`):"None"},W({name:"bucket",description:"Sanitizes bucket strings to '< n', 'n1 - n2', and 'n+'",logicFactory:wk,inputType:"number",testValue:"1234",type:"formatter"});});var ff=b(()=>{c();ae();W({name:"commas",description:"* Rounds to nearest whole number and adds commas.",logicFactory(e){return t=>e.d3.format(",")(Math.round(t))},inputType:"number",testValue:"1234.6",type:"formatter"});});var gf=b(()=>{c();ae();W({name:"date",description:"Formats a date into '%B %d, %Y' format.",logicFactory(e){return t=>(typeof t=="string"&&(t=e.d3plus.date(t)),e.d3.timeFormat("%B %d, %Y")(t))},inputType:"date",testValue:"2022-01-01",type:"formatter"});});var hf=b(()=>{c();ae();W({name:"dollar",description:"Adds a US dollar sign to the beginning of a String or Number.",logicFactory(e){return t=>(typeof t=="number"&&(t=e.d3plus.formatAbbreviate(t)),t.charAt(0)==="-"?t.replace("-","-$"):`$${t}`)},inputType:"number",testValue:"123",type:"formatter"});});var yf=b(()=>{c();ae();W({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 bf=b(()=>{c();ae();W({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 vf=b(()=>{c();ae();W({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 Sf=b(()=>{c();ae();W({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 Nk,Tf=b(()=>{c();ae();Nk=()=>function(t){let{curr:r,currMoe:o=0,prev:n,prevMoe:a=0}=t,s;if(o||a){let i=(-n/r**2)**2*o**2,l=(1/r)**2*a**2;s=Math.sqrt(i+l);}else s=(r-n)/n;return s*100},W({name:"growth",description:"Calculates the growth percentage between two numbers provided the following object format: {curr, prev}. Also supports calculating the growth between two margin of errors using this format: {curr, currMoe, prev, prevMoe}",logicFactory:Nk,inputType:"object",testValue:'{"curr":10,"currMoe":0,"prev":13,"prevMoe":0}',type:"formatter"});});var xf=b(()=>{c();ae();W({name:"growthPct",description:"Abbreviates a growth value, turns it absolute, and adds a percent sign.",logicFactory(e){return t=>`${e.d3plus.formatAbbreviate(Math.abs(t))}%`},inputType:"number",testValue:"12345",type:"formatter"});});var Rf=b(()=>{c();ae();W({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 Ef=b(()=>{c();ae();W({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 kf=b(()=>{c();ae();W({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 Cf=b(()=>{c();ae();W({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 wf=b(()=>{c();ae();W({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 Af=b(()=>{c();ae();W({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 Pf=b(()=>{c();ae();W({name:"list",description:"Joins an array of strings together, adding commas and 'and' when necessary.",logicFactory(){return e=>e.reduce((t,r,o)=>(o?o===e.length-1&&o===1?t+=` and ${r}`:o===e.length-1?t+=`, and ${r}`:t+=`, ${r}`:t+=r,t),"")},inputType:"object",testValue:'["foo","bar","bee"]',type:"formatter"});});var If=b(()=>{c();ae();W({name:"longWord",description:"",logicFactory(){return e=>e<0?"shorter":e>0?"longer":"similar"},inputType:"number",testValue:"5",type:"formatter"});});var Lf=b(()=>{c();ae();W({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 Of=b(()=>{c();ae();W({name:"moreFewerWord",description:"",logicFactory(){return e=>e<0?"fewer":"more"},inputType:"number",testValue:"-5",type:"formatter"});});var _f=b(()=>{c();ae();W({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 Bf=b(()=>{c();ae();W({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 Mf=b(()=>{c();ae();W({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 Nf=b(()=>{c();ae();W({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 Df=b(()=>{c();ae();W({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 Ff=b(()=>{c();ae();W({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 Vf=b(()=>{c();ae();W({name:"salary",description:"Displays salary values with proper precision (ie. '$74,200' instead of '$74.2k')",logicFactory(e){return t=>{let r;return t<1e6?r=e.d3.format(",")(t.toFixed(0)):r=e.d3plus.formatAbbreviate(t),`$${r}`}},inputType:"number",testValue:"1000000",type:"formatter"});});var $f=b(()=>{c();ae();W({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 gl,zf=b(()=>{c();ae();gl=W({name:"stripHTML",description:"Converts html tags to spaces, then removes redundant spaces",logicFactory(){return e=>{let t={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'","&#x60;":"`","&nbsp;":""},r=`(?:${Object.keys(t).join("|")})`,o=RegExp(r),n=RegExp(r,"g"),a=String(e).replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();return o.test(a)?a.replace(n,s=>t[s]):a}},inputType:"string",testValue:"<b>My text</b>",type:"formatter"});});var Uf=b(()=>{c();ae();W({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 Gf=b(()=>{c();ae();W({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 qf=b(()=>{c();ae();W({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 Hf=b(()=>{c();ae();W({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 jf=b(()=>{c();ae();W({name:"toSpacedCase",description:"Takes a camelCase or PascalCase string and adds spaces (I know Spaced Case isn't a thing, deal with it).",logicFactory(){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 Wf=b(()=>{c();ae();W({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 Kf=b(()=>{c();pf();df();mf();ff();gf();hf();yf();bf();vf();Sf();Tf();xf();Rf();Ef();kf();Cf();wf();Af();Pf();If();Lf();Of();_f();Bf();Mf();Nf();Df();Ff();Vf();$f();zf();Uf();Gf();qf();Hf();jf();Wf();});function Zf({onDownloadPDF:e,onDownloadCSV:t}){let[r,o]=useState(!1),[n,a]=useState(!1),[s,i]=useState(!1),l=useMediaQuery("(max-width: 768px)"),u=Le("export"),p={...hC,...u},m=async()=>{if(e){o(!0);try{await e();}finally{o(!1),i(!1);}}},d=async()=>{if(t){a(!0);try{await t();}finally{a(!1),i(!1);}}},f=(T,C,N,R,M,U)=>jsx(Button,{id:U,size:"sm",onClick:T,disabled:C,fullWidth:!0,variant:"subtle",h:"auto",px:"xs",w:"100%",styles:()=>({inner:{width:"100%",display:"block"}}),children:jsxs(Group,{noWrap:!0,position:"left",spacing:"xs",w:"100%",children:[C?jsx(Loader,{size:"1.75rem"}):N,jsxs(Stack,{spacing:0,w:"100%",py:"0.5rem",className:"bespoke-report-download-btn-text-container",children:[jsx(Text,{w:"100%",size:"sm",lineClamp:1,className:"bespoke-report-download-btn-text-container-cta",children:R}),M&&jsx(Text,{size:"xs",w:"100%",lineClamp:2,maw:"100%",style:{wordWrap:"break-word",whiteSpace:"normal"},variant:"dimmed",lh:"0.9rem",h:"1.9rem",className:"bespoke-report-download-btn-text-desc",children:M})]})]})}),g=e&&f(m,r,jsx(IconFileTypePdf,{size:"1.75rem"}),p.pdf.label,p.pdf.desc,"bespoke-download-pdf-btn"),y=t&&f(d,n,jsx(IconFileTypeXls,{size:"1.75rem"}),p.xlsx.label,p.xlsx.desc,"bespoke-download-xlsx-btn");return e||t?jsx(Affix,{position:{bottom:l?rem(0):rem(20),right:l?rem(0):rem(20)},id:"bespoke-report-download-affix",style:{width:l?"100%":"auto",boxShadow:l?"0px -2px 6px rgba(0, 0, 0, 0.1)":"0px 2px 6px rgba(0, 0, 0, 0.1)",borderRadius:"0.25rem",background:"white"},p:"xs",children:jsxs(Popover,{opened:s,onChange:i,position:"top",shadow:"md",width:l?"100%":250,id:"bespoke-report-download-popover",children:[jsx(Popover.Target,{children:jsx(Button,{id:"bespoke-report-download-btn",size:"sm",onClick:()=>i(T=>!T),leftIcon:jsx(IconDownload,{size:"1.2rem"}),variant:"subtle",loading:r||n,fullWidth:l,children:p.export})}),jsx(Popover.Dropdown,{p:"0.5rem",children:jsxs(Stack,{spacing:"xs",children:[g,y]})})]})}):null}var hC,Jf=b(()=>{"use client";c();vt();hC={export:"Export",pdf:{label:"Download PDF",desc:"Generates a printable version of the report page in PDF format."},xlsx:{label:"Download XLSX",desc:"Creates a downloadable spreadsheet of the report page data."}};});function SC(e,t){let r=e.replace(/[:\\/?*[\]]/g,"");return r.trim().length===0&&(r=`Sheet${t+1}`),r.slice(0,31)}function TC(e){let t=new ArrayBuffer(e.length),r=new Uint8Array(t);for(let o=0;o<e.length;o++)r[o]=e.charCodeAt(o)&255;return t}function eg(){let e=window.document.querySelector("title")?.textContent;return e||`data_export_${new Date().toISOString()}`}var vC,xC,tg,rg=b(()=>{c();vC=e=>new Promise((t,r)=>{if(!e||e.length===0){r(new Error("No data provided"));return}try{let o=Do.utils.book_new();e.forEach((i,l)=>{if(i.data&&i.data.length>0){let u=i.data[0],p=Do.utils.json_to_sheet(u),m=SC(i.fileName||`Sheet${l+1}`,l),d=1;for(;o.SheetNames.includes(m);){let f=` (${d})`;m=`${m.slice(0,31-f.length)}${f}`,d++;}Do.utils.book_append_sheet(o,p,m);}});let n=Do.write(o,{bookType:"xlsx",type:"binary"}),a=new Blob([TC(n)],{type:"application/octet-stream"}),s=new HR;s.file(`${eg()}.xlsx`,a),s.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:9}}).then(i=>{t(i);}).catch(r);}catch(o){r(o);}});xC=async e=>{try{let t=await vC(e);saveAs(t,`${eg()}.zip`);}catch(t){console.error("Error generating file:",t);}},tg=xC;});function qe(){let e=useContext(sg);if(e===void 0)throw new Error("usePrint must be used within a PrintContext");return e}function OC(e){return useMemo(()=>e.data.reduce((r,o)=>(o.blocks&&o.blocks.forEach(n=>{r[n]=o.id;}),r),{}),[e.data])}function _C({pathSegmentsKey:e="bespoke",sectionLoader:t,mode:r}){let{query:o}=useRouter(),n=Jo(),a=Qe(),s=un(),i=Hg(o.print)??!1,l=r==="embed",{printReport:u,error:p,setError:m}=ma();ca();let d=ng.locale,f=_t(d),g=useMemo(()=>n.data?.sort(Ke).filter(E=>E.settings?.hidden!==!0).filter(E=>E.settings?.pdfHidden!==!0).reduce((E,w)=>(w.blocks&&w.blocks.length>0&&E.push(...w.blocks),E),[])??[],[n.data]),y=OC({data:n.data||[]}),{sectionsVariables:T,resetSectionVariables:C,setSectionVariables:N}=Vc(n.data?.map(E=>E.id)||[]),R=Q(E=>E),M=Le("options"),U={...sl,...M.data_tab},K=useMemo(()=>g.reduce((E,w)=>{let z=R.records.entities.block[w],B=R.variables.status[w];return h.VIZ===z?.type&&B.allowed&&E.push({id:w,entity:z,variables:R.variables.variables[w],status:R.variables.status[w],inputVariablesFlat:z.inputs.reduce((D,j)=>({...D,...R.variables.variables[j]}),R.variables.attributes)}),E},[]),[g,R.records.entities.block,R.variables.attributes,R.variables.status,R.variables.variables]);function A(E){return E=E.replace(/<p>/g,""),E=E.replace(/<\/p>/g,""),E}let O=async(E,w,z)=>{let B=dataLoad.bind({});return new Promise((D,j)=>{B(w,null,null,(V,L)=>{if(V)j(V);else try{E||(E={data:[]}),Array.isArray(E.data)||(E.data=[]);let q=z instanceof Function?z(L):L;E.data.unshift(q),E.rawData=L,D(E);}catch(q){j(q);}});})},k=fr(),I=async()=>{if(!s.XlsxVizActive)return;let E=[],w=[],z=0,B=1;for(let V of K){let L=V.entity,q=Be(L),$=V.inputVariablesFlat,ie={variables:$},Y=ut({logic:q.logic},f,ie).logic,re={router:ng,section:{variables:T[y[L.id]],setVariables:N(T[y[L.id]]),resetVariables:C(T[y[L.id]])}},Z=Tr(Y,f,$,d,L.id,{},re,k),te=Z.config._downloadTitle||Z.config.title||`${U.viz_source} ${z+1}`,H=Z.config._downloadFileName||te;if(Z.config._downloadEnabled!==!1){let x=Z.config._downloadUrl||Z.config.data;if(!x){console.error("API is undefined for block:",L.id);continue}let P=typeof x=="string"?[x]:x,G=Z.dataFormat instanceof Function?Z.dataFormat:!1,J=Z.config._downloadDataFormat instanceof Function?Z.config._downloadDataFormat:!1,X=Z.config._downloadSectionName,le=Z.config._downloadSource;try{let de=await O({ix:z,id:L.id,title:gl(te),fileName:le?X?`${B} ${A(X)}`:`${B} ${H}`:X?A(X):H,data:P,loading:!1,type:h.VIZ},x,J||G);if(le){let ze=Array.isArray(de.rawData)?de.rawData:[de.rawData],ye=new Set;ze.forEach((ve,Je)=>{let et=le(ve),it=et.name.trim().split(`
64
+ `),wr=et.description.trim().split(`
65
65
  `),Ht=et.link.trim().split(`
66
- `),lt=it.map(_e=>_e.trim()).filter(Boolean),or=Ar.map(_e=>_e.trim()).filter(Boolean),nr=Ht.map(_e=>_e.trim()).filter(Boolean),wr=Math.max(lt.length,or.length,nr.length),no=!1;for(let _e=0;_e<wr;_e++){let ao=lt[_e]||lt[lt.length-1]||"",so=or[_e]||or[or.length-1]||"",ar=nr[_e]||nr[nr.length-1]||"";!ye.has(ar)&&ao&&so&&ar&&(no=!0,ye.add(ar),A.push({"Sheet Number":B,Name:X?`${w(X)} - ${q}${ze.length>1?` (${Je+1})`:""}${wr>1?` - ${_e+1}`:""}`:`${q}${ze.length>1?` (${Je+1})`:""}${wr>1?` - ${_e+1}`:""}`,Source:`${ao} - ${so} (${ar})`}));}no&&B++;});}E.push(de),z++;}catch(de){console.error(`Error loading data for block ${L.id}:`,de);}}}let D=E,j={fileName:"Metadata",data:A.length>0?[A]:[]};return D.unshift(j),D};return jsxs(sg.Provider,{value:{print:i,isEmbed:l},children:[jsxs(Container,{id:"bespoke-report",className:a.comparisonLoaded?"compare":"",p:0,pos:"relative",fluid:!0,children:[n.isSuccess&&n.data.sort(Ke).map(E=>jsx(cf,{section:E,sectionLoader:t,print:i},E.id)),BC({pdf:s,print:i,printReport:u,downloadCSV:tg,isPosition:pa,handleLoadData:I})]}),p&&jsx(Affix,{position:{bottom:rem(80),right:rem(20)},children:jsx(Notification,{title:"Error",color:"red",onClose:()=>m(null),icon:jsx(IconX,{size:"1.1rem"}),children:p})})]})}function BC({pdf:e,print:t,printReport:r,downloadCSV:o,isPosition:n,handleLoadData:a}){return t||!n(e.position,"DEFAULT")?null:e.active||e.XlsxVizActive?jsx(Zf,{onDownloadPDF:e.active?r:void 0,onDownloadCSV:e.XlsxVizActive?async()=>{let s=await a();s&&s.length>0?await o(s):console.error("No data loaded for CSV download");}:void 0}):null}var sg,ig,Qt=b(()=>{c();ge();io();uf();Zt();ua();ti();fa();li();he();Mr();_r();Ee();mn();Kf();vt();Jf();rg();il();sg=createContext({print:!1,isEmbed:!1});ig=_C;});c();c();Wt();Qt();oi();vt();Zt();ua();Eo();function NC({pathSegmentsKey:e="bespoke",translations:t,bespokeStyles:r,buildTime:o,siteProps:n,profilePrefix:a="/defaultPath",loader:s=jsx(LoadingOverlay,{visible:!0}),sectionLoader:i=jsx(LoadingOverlay,{visible:!0}),mantineProviderProps:l={},mode:u}){return la(e)?jsx(Fragment,{children:s}):jsx(MantineProvider,{...l,theme:{other:{bespokeStyles:r}},inherit:!0,children:jsxs(jc,{pathSegment:"bespoke",profilePrefix:a,siteProps:n,children:[jsx(Is,{translations:t,children:jsx($s,{children:jsx(ni,{children:jsx(pu,{pageSize:12,children:jsx(ig,{sectionLoader:i||s,mode:u})})})})}),jsx("small",{className:"bespoke-timestamp",children:o})]})})}/*! Bundled license information:
66
+ `),lt=it.map(_e=>_e.trim()).filter(Boolean),or=wr.map(_e=>_e.trim()).filter(Boolean),nr=Ht.map(_e=>_e.trim()).filter(Boolean),Ar=Math.max(lt.length,or.length,nr.length),no=!1;for(let _e=0;_e<Ar;_e++){let ao=lt[_e]||lt[lt.length-1]||"",so=or[_e]||or[or.length-1]||"",ar=nr[_e]||nr[nr.length-1]||"";!ye.has(ar)&&ao&&so&&ar&&(no=!0,ye.add(ar),w.push({"Sheet Number":B,Name:X?`${A(X)} - ${H}${ze.length>1?` (${Je+1})`:""}${Ar>1?` - ${_e+1}`:""}`:`${H}${ze.length>1?` (${Je+1})`:""}${Ar>1?` - ${_e+1}`:""}`,Source:`${ao} - ${so} (${ar})`}));}no&&B++;});}E.push(de),z++;}catch(de){console.error(`Error loading data for block ${L.id}:`,de);}}}let D=E,j={fileName:"Metadata",data:w.length>0?[w]:[]};return D.unshift(j),D};return jsxs(sg.Provider,{value:{print:i,isEmbed:l},children:[jsxs(Container,{id:"bespoke-report",className:a.comparisonLoaded?"compare":"",p:0,pos:"relative",fluid:!0,children:[n.isSuccess&&n.data.sort(Ke).map(E=>jsx(cf,{section:E,sectionLoader:t,print:i},E.id)),BC({pdf:s,print:i,printReport:u,downloadCSV:tg,isPosition:pa,handleLoadData:I})]}),p&&jsx(Affix,{position:{bottom:rem(80),right:rem(20)},children:jsx(Notification,{title:"Error",color:"red",onClose:()=>m(null),icon:jsx(IconX,{size:"1.1rem"}),children:p})})]})}function BC({pdf:e,print:t,printReport:r,downloadCSV:o,isPosition:n,handleLoadData:a}){return t||!n(e.position,"DEFAULT")?null:e.active||e.XlsxVizActive?jsx(Zf,{onDownloadPDF:e.active?r:void 0,onDownloadCSV:e.XlsxVizActive?async()=>{let s=await a();s&&s.length>0?await o(s):console.error("No data loaded for CSV download");}:void 0}):null}var sg,ig,Qt=b(()=>{c();ge();io();uf();Zt();ua();ti();fa();li();he();Mr();_r();Ee();mn();Kf();vt();Jf();rg();il();sg=createContext({print:!1,isEmbed:!1});ig=_C;});c();c();Wt();Qt();oi();vt();Zt();ua();Eo();function NC({pathSegmentsKey:e="bespoke",translations:t,bespokeStyles:r,buildTime:o,siteProps:n,profilePrefix:a="/defaultPath",loader:s=jsx(LoadingOverlay,{visible:!0}),sectionLoader:i=jsx(LoadingOverlay,{visible:!0}),mantineProviderProps:l={},mode:u}){return la(e)?jsx(Fragment,{children:s}):jsx(MantineProvider,{...l,theme:{other:{bespokeStyles:r}},inherit:!0,children:jsxs(jc,{pathSegment:"bespoke",profilePrefix:a,siteProps:n,children:[jsx(Is,{translations:t,children:jsx($s,{children:jsx(ni,{children:jsx(pu,{pageSize:12,children:jsx(ig,{sectionLoader:i||s,mode:u})})})})}),jsx("small",{className:"bespoke-timestamp",children:o})]})})}/*! Bundled license information:
67
67
 
68
68
  @tanstack/react-virtual/build/lib/_virtual/_rollupPluginBabelHelpers.mjs:
69
69
  (**