0?n.fullyOpenLegend():G.startState==="fullyOpen"?n.openLegend():n.collapseLegend()}function C(X){X==="fullyOpen"?n.fullyOpenLegend():X==="collapsed"?n.collapseLegend():n.openLegend()}let D=null,W=null,Z=null;return to(()=>{const X=q.value;if(!X||typeof ResizeObserver>"u")return;const Y=X.getRootNode();W=Y instanceof ShadowRoot?Y.host:Y.documentElement||null,W&&(Z=X,D=new ResizeObserver(()=>{const p=X.offsetHeight;p<=0||(W.style.setProperty(Vu,`${p}px`),W.__legendSheetVarOwner=X)}),D.observe(X))}),Lo(()=>{D&&(D.disconnect(),D=null),W&&W.__legendSheetVarOwner===Z&&(W.style.removeProperty(Vu),W.__legendSheetVarOwner=null),W=null,Z=null}),(X,Y)=>{var p;return H(),ee("div",Pv,[Ve.value==="detail"&&Ze.value&&K.value==="open"&&et.value?(H(),ee("div",{key:0,class:"floating-mini-image",onClick:Y[0]||(Y[0]=h=>be(n).fullyOpenLegend())},[T("img",{src:et.value,alt:(p=Ze.value.properties)==null?void 0:p.name,class:"mini-image"},null,8,Nv)])):me("",!0),T("div",{ref_key:"sheetRef",ref:q,class:Ce(["legend-mobile-sheet",[K.value,{"sheet-dark":e.isDark,dragging:A.value}]]),style:nt({height:pe.value,"--legend-sheet-top-reserve":zu+"px"}),onTouchstart:wt,onTouchmove:$,onTouchend:E,onTouchcancel:E},[T("div",{class:"sheet-drag-strip",onClick:Qe},[Ge.value?(H(),ee("div",Mv)):me("",!0)]),Ve.value==="detail"&&K.value!=="collapsed"?(H(),ee("button",{key:0,class:"detail-collapse-btn-mobile",onClick:Ht(Qe,["stop"]),"aria-label":be(t)("aria.toggleLegend")},null,8,Iv)):me("",!0),Ve.value==="detail"&&K.value!=="collapsed"?(H(),ee("button",{key:1,class:"detail-close-btn",onClick:Ht(gt,["stop"]),"aria-label":be(t)("aria.backToLegend")},[...Y[1]||(Y[1]=[T("svg",{width:"18",height:"18",viewBox:"0 0 20 20",fill:"none"},[T("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"})],-1)])],8,Rv)):me("",!0),K.value==="collapsed"&&Ve.value==="detail"&&Ze.value?(H(),ee("div",{key:2,class:"collapsed-detail-footer",onClick:Qe},[T("button",{class:"mobile-collapse-caret",style:nt({transform:`rotate(${ge.value}deg)`}),"aria-label":be(t)("aria.toggleLegend"),tabindex:"-1"},[...Y[2]||(Y[2]=[T("svg",{width:"9",height:"9",viewBox:"0 0 12 12",fill:"none"},[T("path",{d:"M4.5 3L7.5 6L4.5 9",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],12,Fv),T("span",Ov,ce(Xe.value),1)])):me("",!0),T("div",Dv,[Ve.value==="detail"&&Ze.value?(H(),ee(Le,{key:0},[K.value!=="collapsed"?(H(),lt(Hu,{key:0,peopleGroup:Ze.value,hideHeader:!0,dark:e.isDark,action:e.popupAction},null,8,["peopleGroup","dark","action"])):me("",!0)],64)):e.legendType!=="default"?(H(),lt(bu,{key:1,nodes:z.value,tabs:V.value,title:Xe.value||ae.value,hideTabs:e.nodes?!e.tabs:M.value,columnLabel:j.value,columns:e.columns||["count","pop"],onSelect:be(a)},{"title-caret":Kt(()=>[T("button",{class:"mobile-collapse-caret",style:nt({transform:`rotate(${ge.value}deg)`}),onClick:Ht(Qe,["stop"]),"aria-label":be(t)("aria.toggleLegend")},[...Y[3]||(Y[3]=[T("svg",{width:"9",height:"9",viewBox:"0 0 12 12",fill:"none"},[T("path",{d:"M4.5 3L7.5 6L4.5 9",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],12,Bv)]),_:1},8,["nodes","tabs","title","hideTabs","columnLabel","columns","onSelect"])):(H(),lt(w0,{key:2,title:Xe.value,items:be(i),columns:be(l),activeFilter:be(u),isDark:e.isDark,hideColumnHeader:!1,showFooter:!1,disableCollapse:!0,totalCount:be(f),totalPopulation:be(x),fmtPop:be(b),fmtCount:be(v),onFilterClick:tt},{"title-caret":Kt(()=>[T("button",{class:"mobile-collapse-caret",style:nt({transform:`rotate(${ge.value}deg)`}),onClick:Ht(Qe,["stop"]),"aria-label":be(t)("aria.toggleLegend")},[...Y[4]||(Y[4]=[T("svg",{width:"9",height:"9",viewBox:"0 0 12 12",fill:"none"},[T("path",{d:"M4.5 3L7.5 6L4.5 9",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],12,jv)]),_:1},8,["title","items","columns","activeFilter","isDark","totalCount","totalPopulation","fmtPop","fmtCount"]))])],38)])}}},[["__scopeId","data-v-5e599fcc"]]),zv={__name:"MapToolbar",props:{hasGeocoder:{type:Boolean,default:!0}},setup(e){return At(`
.map-toolbar {
position: absolute;
top: 6px;
@@ -726,8 +728,10 @@
.map-toolbar .hbg-btn { width: 32px; height: 32px; }
.map-toolbar .hbg-ctrl { margin: 10px 0 0 0; }
@media (max-width: 767px) {
- .map-toolbar { top: 72px; gap: 6px; }
- .map-toolbar.map-toolbar--no-geocoder { top: 6px; gap: 6px; }
+ .map-toolbar { top: calc(8px + 35px + 12px); right: 8px; gap: 8px; }
+ .map-toolbar.map-toolbar--no-geocoder { top: 8px; }
+ .map-toolbar .mcb,
+ .map-toolbar .hbg-btn { width: 36px; height: 36px; }
}
`,"map-toolbar"),(t,o)=>(H(),ee("div",{class:Ce(["map-toolbar",{"map-toolbar--no-geocoder":!e.hasGeocoder}])},[Fn(t.$slots,"default")],2))}},Vv=["title","disabled"],Yo={__name:"MapControlButton",props:{isDark:{type:Boolean,default:!1},title:{type:String,default:""},active:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["click"],setup(e){return At(`
.mcb{
@@ -1071,7 +1075,7 @@
z-index:9999;
}
}
-`,"share-button");const{t,tm:o,rt:n}=kt(),r=e,a=ue(!1),s=ue(null),i=ue(null),l=ue("link"),c=ue(!1),u=ue(!1),d=ue("medium"),f={small:{label:"Small",height:400},medium:{label:"Medium",height:600},large:{label:"Large",height:800}},x=Ee("profileConfig",null),b=Q(()=>a1({embedPath:r.embedPath,profileConfig:be(x)||null})),v=Q(()=>{const P=f[d.value].height;return''});function _(){a.value=!a.value,a.value&&(l.value="link",c.value=!1,u.value=!1)}function w(){a.value=!1}async function S(P){try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(P),!0}catch{}try{const N=document.createElement("textarea");N.value=P,N.setAttribute("readonly",""),N.style.cssText="position:fixed;top:-1000px;opacity:0",document.body.appendChild(N),N.select();const M=document.execCommand("copy");return document.body.removeChild(N),M}catch{return!1}}async function m(){await S(b.value)&&(c.value=!0,setTimeout(()=>{c.value=!1},2e3))}async function g(){await S(v.value)&&(u.value=!0,setTimeout(()=>{u.value=!1},2e3))}function y(P){if(!a.value)return;const N=P.composedPath?P.composedPath():[P.target];s.value&&N.some(I=>I===s.value)||i.value&&N.some(I=>I===i.value||I===i.value.$el)||!N.some(I=>{var z,V;return(V=(z=I==null?void 0:I.classList)==null?void 0:z.contains)==null?void 0:V.call(z,"mapboxgl-canvas")})||w()}function L(P){P.key==="Escape"&&a.value&&w()}return to(()=>{document.addEventListener("click",y,!0),document.addEventListener("keydown",L)}),Lo(()=>{document.removeEventListener("click",y,!0),document.removeEventListener("keydown",L)}),(P,N)=>(H(),ee("div",r1,[Be(Yo,{ref_key:"btnEl",ref:i,"is-dark":e.isDark,active:a.value,title:be(t)("buttons.shareEmbed"),onClick:_},{default:Kt(()=>[...N[2]||(N[2]=[T("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[T("path",{d:"M4 12v7a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7"}),T("polyline",{points:"16 6 12 2 8 6"}),T("line",{x1:"12",y1:"2",x2:"12",y2:"15"})],-1)])]),_:1},8,["is-dark","active","title"]),a.value?(H(),ee("div",{key:0,ref_key:"popoverEl",ref:s,class:Ce(["share-pop",{light:!e.isDark}])},[T("div",{class:"share-header"},[N[4]||(N[4]=T("span",{class:"share-title"},"Share",-1)),T("button",{class:"share-close",onClick:w,"aria-label":"Close"},[...N[3]||(N[3]=[T("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},[T("line",{x1:"2",y1:"2",x2:"12",y2:"12"}),T("line",{x1:"12",y1:"2",x2:"2",y2:"12"})],-1)])])]),T("ul",s1,[(H(!0),ee(Le,null,St(be(o)("buttons.shareSteps"),(M,I)=>(H(),ee("li",{key:I},ce(be(n)(M)),1))),128))]),T("div",i1,[T("button",{class:Ce(["share-tab",{active:l.value==="link"}]),onClick:N[0]||(N[0]=M=>l.value="link")},"Embed link",2),T("button",{class:Ce(["share-tab",{active:l.value==="embed"}]),onClick:N[1]||(N[1]=M=>l.value="embed")},"Add to Your Website",2)]),l.value==="link"?(H(),ee("div",l1,[T("div",c1,[T("div",u1,ce(b.value),1)]),T("button",{class:Ce(["share-primary-btn",{copied:c.value}]),onClick:m},[c.value?(H(),ee("svg",p1,[...N[6]||(N[6]=[T("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):(H(),ee("svg",d1,[...N[5]||(N[5]=[T("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"},null,-1),T("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"},null,-1)])])),dt(" "+ce(c.value?"Copied!":"Copy Link"),1)],2)])):me("",!0),l.value==="embed"?(H(),ee("div",g1,[N[9]||(N[9]=T("div",{class:"share-embed-desc"}," Paste this code into your website builder (WordPress, Squarespace, Wix, or any site that accepts HTML widgets). ",-1)),T("div",f1,[(H(),ee(Le,null,St(f,(M,I)=>T("button",{key:I,class:Ce(["share-size-pill",{active:d.value===I}]),onClick:z=>d.value=I},ce(M.label),11,h1)),64))]),T("div",m1,ce(v.value),1),T("button",{class:Ce(["share-secondary-btn",{copied:u.value}]),onClick:g},[u.value?(H(),ee("svg",y1,[...N[8]||(N[8]=[T("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):(H(),ee("svg",b1,[...N[7]||(N[7]=[T("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"},null,-1),T("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"},null,-1)])])),dt(" "+ce(u.value?"Copied!":"Copy Code"),1)],2)])):me("",!0)],2)):me("",!0)]))}},_1=["blocs","clusters","peopleGroups","families","languages","dialects","people","places","regions","wagfBlocks","religions"],v1={"people-groups":["blocs","clusters","peopleGroups","people","places","families","languages","dialects","regions","religions"],language:["families","languages","dialects","people","blocs","clusters","peopleGroups","places","regions","religions"],regions:["regions","wagfBlocks","places","blocs","clusters","peopleGroups","people","families","languages","dialects","religions"],religion:["religions","people","blocs","clusters","peopleGroups","places","families","languages","dialects","regions"]};function k1(e){return v1[e]||_1}const w1={blocs:3,clusters:3,peopleGroups:3,families:3,languages:3,dialects:3,people:5,places:2,regions:3,wagfBlocks:3,religions:2},sr=["peopleGroups","people","places","languages","religions"],x1={regions:[...sr,"regions","wagfBlocks"],"people-groups":[...sr,"blocs","clusters"],language:[...sr,"dialects","families"],religion:[...sr]},S1=100,A1=50,$1=25,L1=10,Bs=5,Yu=20,C1=[[/ sign language$/i,"Sign Language"]];function T1(e){if(!e||typeof e!="string")return"";const t=e.indexOf(",");return t>0?e.slice(0,t).trim():e.trim()}function E1(e){if(!e||typeof e!="string")return null;const t=e.indexOf(",");return t>=0&&e.slice(t+1).trim()||null}function P1(e){if(!e||typeof e!="string")return null;const t=e.split(",").map(n=>n.trim()).filter(Boolean);if(t.length>=2){const n=[...t].reverse().join(" ");if($t[n])return $t[n];if(t.length>=3){const r=[t[1],t[0]].join(" ");if($t[r])return $t[r]}}if($t[e])return $t[e];const o=e.replace(/\s*\(.*?\)\s*$/,"").trim();if(o!==e&&$t[o])return $t[o];for(const[n,r]of C1)if(n.test(e))return r;return null}function Ju(e,t){return{id:`doxa-section-header-${js(e)}`,place_name:e,text:e,center:[0,0],place_type:["doxa-section-header"],geometry:{type:"Point",coordinates:[0,0]},properties:{headerLabel:e,isHeader:!0,isAllDataSection:!!t},feature:null}}function js(e){return String(e||"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function xe(e){return e==null?"":typeof e=="string"?e.toLowerCase():typeof e=="object"&&"label"in e?String(e.label||"").toLowerCase():typeof e=="object"&&"value"in e?String(e.value||"").toLowerCase():String(e).toLowerCase()}function ir(e){return e==null?"":typeof e=="string"?e:typeof e=="object"?e.label||e.value||"":String(e)}function N1(e){var o,n,r,a,s;if(!Array.isArray(e))return[];const t=[];for(const i of e){if(!i)continue;const l=Number(i.latitude),c=Number(i.longitude);if(!Number.isFinite(l)||!Number.isFinite(c))continue;const u=xe(i.name)+" "+xe(i.displayName)+" "+xe(i.alternateName),d=xe(i.countryName)+" "+xe(i.country)+" "+xe(i.countryIso)+" "+xe(i.countryIsoLabel),f=xe(i.religionName)+" "+xe(i.religion)+" "+xe(i.religionLabel)+" "+xe(i.religionCode),x=xe(i.language)+" "+xe(i.languageFamily)+" "+xe(i.languageCode),b=xe(i.doxaRegion)+" "+xe(i.wagfRegion)+" "+xe(i.wagfBlock),v=xe(i.affinityBlock)+" "+xe(i.affinityBlockLabel)+" "+xe((o=i._raw)==null?void 0:o.rop1),_=xe(i.cluster)+" "+xe(i.clusterLabel)+" "+xe((n=i._raw)==null?void 0:n.imb_reg_of_people_2),w=xe(i.peopleGroup)+" "+xe(i.peopleGroupLabel)+" "+xe((r=i._raw)==null?void 0:r.imb_reg_of_people_25),S=((a=i._raw)==null?void 0:a.primary_language)??((s=i._raw)==null?void 0:s.PrimaryLanguage),m=S&&(typeof S=="object"?S.label||S.value:S)||ir(i.language)||ir(i.primaryLanguage)||"",g=T1(m),y=E1(m);t.push({feature:i,nameHay:u,countryHay:d,religionHay:f,languageHay:x,regionHay:b,haystack:u+" "+d+" "+f+" "+x+" "+b+" "+v+" "+_+" "+w,blocHay:v,clusterHay:_,pgHay:w,lat:l,lng:c,familyDerived:P1(m)||null,languageLabel:m,baseLang:g,dialectLabel:y})}return t}function M1(e){const t=(o,n,r)=>{const a=new Map;for(const s of e){const i=o(s);if(!i)continue;const l=a.get(i);if(l)l.count+=1,l.lngSum+=s.lng,l.latSum+=s.lat,l.memberIds.push(String(s.feature.uniqueId??s.feature.id??s.feature.slug??"")),l.minLng=Math.min(l.minLng,s.lng),l.maxLng=Math.max(l.maxLng,s.lng),l.minLat=Math.min(l.minLat,s.lat),l.maxLat=Math.max(l.maxLat,s.lat),r&&r(l,s,!1);else{const c={key:i,label:ir(n(s))||i,count:1,lngSum:s.lng,latSum:s.lat,minLng:s.lng,maxLng:s.lng,minLat:s.lat,maxLat:s.lat,memberIds:[String(s.feature.uniqueId??s.feature.id??s.feature.slug??"")]};r&&r(c,s,!0),a.set(i,c)}}for(const s of a.values())s.lng=s.lngSum/s.count,s.lat=s.latSum/s.count;return Array.from(a.values())};return{countries:t(o=>xe(o.feature.countryName)||xe(o.feature.country)||xe(o.feature.countryIso),o=>o.feature.countryName||o.feature.country||o.feature.countryIso||""),families:t(o=>xe(o.familyDerived),o=>o.familyDerived||""),languages:t(o=>xe(o.baseLang),o=>o.baseLang||""),dialects:t(o=>o.dialectLabel?`${xe(o.baseLang)}__${xe(o.dialectLabel)}`:"",o=>`${o.baseLang}, ${o.dialectLabel}`,(o,n,r)=>{r?(o.originalLabels=new Set([n.languageLabel]),o.familyDerived=n.familyDerived||"",o.baseLang=n.baseLang||"",o.dialectLabel=n.dialectLabel||""):(o.originalLabels.add(n.languageLabel),!o.familyDerived&&n.familyDerived&&(o.familyDerived=n.familyDerived))}),religions:t(o=>{var n,r,a;return ta(o.feature.religion||((r=(n=o.feature._raw)==null?void 0:n.religion)==null?void 0:r.value)||((a=o.feature._raw)==null?void 0:a.religion)||"")},o=>{var n,r,a;return ea[ta(o.feature.religion||((r=(n=o.feature._raw)==null?void 0:n.religion)==null?void 0:r.value)||((a=o.feature._raw)==null?void 0:a.religion)||"")]||"Unknown"}),regions:t(o=>xe(o.feature.doxaRegion)||xe(o.feature.wagfRegion),o=>{var n,r;return o.feature.wagfRegionLabel||o.feature.doxaRegionLabel||((r=(n=o.feature._raw)==null?void 0:n.wagf_region)==null?void 0:r.label)||o.feature.doxaRegion||o.feature.wagfRegion||""}),wagfBlocks:t(o=>xe(o.feature.wagfBlock),o=>{var n,r;return o.feature.wagfBlockLabel||((r=(n=o.feature._raw)==null?void 0:n.wagf_block)==null?void 0:r.label)||o.feature.wagfBlock||""}),blocs:t(o=>xe(o.feature.affinityBlockLabel)||xe(o.feature.affinityBlock),o=>o.feature.affinityBlockLabel||o.feature.affinityBlock||"",(o,n,r)=>{r&&(o.blocCode=n.feature.affinityBlock||"")}),clusters:t(o=>{const n=o.feature.affinityBlock||"",r=o.feature.cluster||"";return r?`${n}__${r}`:""},o=>o.feature.clusterLabel||o.feature.cluster||"",(o,n,r)=>{r&&(o.blocCode=n.feature.affinityBlock||"",o.blocLabel=n.feature.affinityBlockLabel||"",o.clusterCode=n.feature.cluster||"")}),peopleGroups:t(o=>xe(o.feature.peopleGroup)||xe(o.feature.peopleGroupLabel),o=>o.feature.peopleGroupLabel||o.feature.peopleGroup||o.feature.name||"",(o,n,r)=>{r&&(o.blocCode=n.feature.affinityBlock||"",o.blocLabel=n.feature.affinityBlockLabel||"",o.clusterCode=n.feature.cluster||"",o.clusterLabel=n.feature.clusterLabel||"",o.peopleGroupCode=n.feature.peopleGroup||"")})}}function I1(e){const t=e.feature,o=t.name||t.displayName||t.slug||"Unknown",n=t.countryName||t.country||t.countryIso||"",r=t.religionName||t.religion||"",a=t.slug||t.uniqueId||js(o+"-"+n),s=[e.lng,e.lat],i=[n,r].filter(Boolean).join(" — "),l=i?`${o}, ${i}`:o;return{id:`doxa-pg-${a}`,place_name:l,text:o,center:s,place_type:["people-group"],geometry:{type:"Point",coordinates:s},properties:{slug:a,...t},feature:t}}function io(e,t){let o,n;switch(e){case"country":o="doxa-country",n="doxa-country-";break;case"region":o="doxa-region",n="doxa-region-";break;case"language-family":o="doxa-language-family",n="doxa-language-family-";break;case"language":o="doxa-language",n="doxa-language-";break;case"dialect":o="doxa-dialect",n="doxa-dialect-";break;case"religion":o="doxa-religion",n="doxa-religion-";break;case"affinity-bloc":o="doxa-affinity-bloc",n="doxa-affinity-bloc-";break;case"cluster":o="doxa-cluster",n="doxa-cluster-";break;case"people-group":o="doxa-people-group",n="doxa-people-group-";break;default:o="doxa",n="doxa-"}const r=ir(t.label)||t.key,a=js(t.key),s=[t.lng,t.lat],l={"affinity-bloc":"Affinity Block",cluster:"Cluster","people-group":"PG","pg-in-country":"PGIC"}[e],c=l?`${r} (${l}) · ${t.count}`:`${r} (${t.count})`,u=t.originalLabels?Array.from(t.originalLabels):void 0,d=e==="dialect"?{familyDerived:t.familyDerived||"",baseLang:t.baseLang||"",dialectLabel:t.dialectLabel||""}:null;return{id:`${n}${a}`,place_name:c,text:r,center:s,bbox:[t.minLng,t.minLat,t.maxLng,t.maxLat],place_type:[o],geometry:{type:"Point",coordinates:s},properties:{slug:a,doxaAggregate:e,count:t.count,label:r,memberIds:t.memberIds,bounds:[t.minLng,t.minLat,t.maxLng,t.maxLat],...u?{originalLabels:u}:{},...d||{},...e==="affinity-bloc"?{blocCode:t.blocCode||""}:{},...e==="cluster"?{blocCode:t.blocCode||"",blocLabel:t.blocLabel||"",clusterCode:t.clusterCode||""}:{},...e==="people-group"?{blocCode:t.blocCode||"",blocLabel:t.blocLabel||"",clusterCode:t.clusterCode||"",clusterLabel:t.clusterLabel||"",peopleGroupCode:t.peopleGroupCode||""}:{}},feature:null}}function R1(e={}){const{dataStore:t,dataSourceId:o,getActiveFilter:n,getActiveContext:r}=e,{t:a}=kt(),s=Q(()=>{var d,f;if(!t||!t.sources)return[];if(o&&((d=t.sources[o])!=null&&d.features))return t.sources[o].features;for(const x of Object.keys(t.sources)){const b=t.sources[x];if((f=b==null?void 0:b.features)!=null&&f.length)return b.features}return[]}),i=Q(()=>N1(s.value)),l=Q(()=>M1(i.value));function c(d){const f=String(d||"").trim().toLowerCase(),x={people:[],places:[],regions:[],wagfBlocks:[],families:[],languages:[],dialects:[],religions:[],blocs:[],clusters:[],peopleGroups:[]};if(f.length<2)return x;const b=f.split(/[\s,;]+/).filter(Boolean);if(!b.length)return x;const v=i.value;if(!v.length)return x;const _=l.value,w=[];for(const A of v){let G=!0;for(const ye of b)if(!A.haystack.includes(ye)){G=!1;break}if(!G)continue;let re=0;b.some(ye=>A.nameHay.includes(ye))&&(re+=S1),b.some(ye=>A.countryHay.includes(ye))&&(re+=A1),b.some(ye=>A.religionHay.includes(ye))&&(re+=$1),b.some(ye=>A.languageHay.includes(ye))&&(re+=L1),w.push({entry:A,score:re})}w.sort((A,G)=>G.score-A.score);const S=w.slice(0,Bs).map(A=>I1(A.entry)),m=A=>A.filter(G=>b.every(re=>G.key.includes(re)||xe(G.label).includes(re))).sort((G,re)=>re.count-G.count).slice(0,Bs),g=m(_.countries).map(A=>io("country",A)),y=m(_.regions).map(A=>io("region",A)),L=m(_.wagfBlocks).map(A=>io("region",A)),P=m(_.families).map(A=>io("language-family",A)),N=m(_.languages).map(A=>io("language",A)),M=m(_.dialects).map(A=>io("dialect",A)),I=m(_.religions).map(A=>io("religion",A)),z=m(_.blocs).map(A=>io("affinity-bloc",A));let V=m(_.clusters).map(A=>io("cluster",A)),ae=m(_.peopleGroups).map(A=>io("people-group",A));const j=new Set(z.map(A=>xe(A.text)));V=V.filter(A=>!j.has(xe(A.text)));const q=new Set(V.map(A=>xe(A.text)));return ae=ae.filter(A=>!j.has(xe(A.text))&&!q.has(xe(A.text))),{people:S,places:g,regions:y,wagfBlocks:L,families:P,languages:N,dialects:M,religions:I,blocs:z,clusters:V,peopleGroups:ae}}function u(d){const f=typeof n=="function"?n():null,x=typeof r=="function"?r():null,b=c(d),v=k1(x),_=x1[x],w=_?Object.fromEntries(_.filter(P=>b[P]).map(P=>[P,b[P]])):b,S=v.flatMap(P=>w[P]||[]);if(!(f!=null&&f.key)||!S.length)return S.slice(0,Yu);const m=[];for(const P of b.people){const N=i.value.find(I=>I.feature===P.feature);let M=!1;N&&(f.kind==="family"?M=(N.familyDerived||"").toLowerCase()===f.key.toLowerCase():f.kind==="language"&&(M=N.languageLabel.toLowerCase()===f.key.toLowerCase())),M&&m.push(P)}const g=[],y=f.key;m.length&&(g.push(Ju(a("search.sections.within",{selection:y}),!1)),g.push(...m.slice(0,Bs)));const L=v.flatMap(P=>(w[P]||[]).slice(0,w1[P]??3)).map(P=>({...P,properties:{...P.properties,_allDataSection:!0}}));return g.push(Ju(a("search.sections.allData"),!0)),g.push(...L),g.slice(0,Yu+8)}return{search:u,searchGrouped:c,index:i,aggregates:l}}const qu="https://cdn.jsdelivr.net/npm/@maplibre/maplibre-gl-geocoder@1/dist/maplibre-gl-geocoder.min.js",F1={__name:"GeocoderComponent",props:{mapInstance:{type:Object,required:!1,default:null},accessToken:{type:String,required:!0},provider:{type:String,default:"mapbox"},isDark:{type:Boolean,default:!1},standalone:{type:Boolean,default:!1},placeholder:{type:String,default:""},dataSourceId:{type:String,default:""},activeContext:{type:String,default:""}},emits:["result","people-group-result","aggregate-result","clear","error"],setup(e,{expose:t,emit:o}){function n(I){return I+I.replace(/mapboxgl/g,"maplibregl")}At(n('.mapboxgl-ctrl-geocoder--input,.mapboxgl-ctrl-geocoder input[type="text"],.mapboxgl-ctrl-geocoder input[type="search"]{font-size:16px !important;line-height:1.3;}'),"geocoder-ios-zoom-fix"),At(n(".mapboxgl-ctrl-geocoder--icon-loading{display:none !important;}"),"geocoder-hide-loading"),At(n(".mapboxgl-ctrl-geocoder{height:35px!important;min-height:35px!important;box-sizing:border-box!important;}.mapboxgl-ctrl-geocoder--input{height:35px!important;min-height:35px!important;box-sizing:border-box!important;padding-top:0!important;padding-bottom:0!important;line-height:35px!important;}.mapboxgl-ctrl-geocoder--icon-search{top:50%!important;transform:translateY(-50%)!important;margin-top:0!important;left:7px!important;}"),"geocoder-height-35"),At(n(".mapboxgl-ctrl-geocoder{width:100%!important;max-width:100%!important;min-width:0!important;}@media(max-width:767px){.mapboxgl-ctrl-top-left{top:10px!important;left:3px!important;right:3px!important;width:calc(100% - 6px)!important;max-width:none!important;}}.mapboxgl-ctrl-geocoder{border-radius:999px!important;background:#fff;box-shadow:0 2px 8px rgba(0,0,0,0.15)!important;transition:box-shadow .12s,border-color .12s;}.mapboxgl-ctrl-geocoder:focus-within{box-shadow:0 2px 8px rgba(0,0,0,0.15),0 0 0 3px rgba(59,70,61,0.18)!important;}.mapboxgl-ctrl-geocoder--input{border-radius:999px!important;font-size:13px!important;}.mapboxgl-ctrl-geocoder--input::placeholder{font-size:12px!important;}.mapboxgl-ctrl-geocoder--button{display:none!important;top:50%!important;bottom:auto!important;transform:translateY(-50%)!important;margin:0!important;padding:0!important;width:24px!important;height:24px!important;background:transparent!important;border:none!important;box-shadow:none!important;}.mapboxgl-ctrl-geocoder:has(.mapboxgl-ctrl-geocoder--input:not(:placeholder-shown)) .mapboxgl-ctrl-geocoder--button{display:block!important;}.mapboxgl-ctrl-geocoder--button .mapboxgl-ctrl-geocoder--icon-close{position:absolute!important;top:50%!important;left:50%!important;transform:translate(-50%,-50%)!important;margin:0!important;width:16px!important;height:16px!important;}.mapboxgl-ctrl-geocoder--suggestions,.mapboxgl-ctrl-geocoder .suggestions{z-index:1200!important;position:absolute;max-height:60vh!important;overflow-y:auto!important;}.geocoder-dark.mapboxgl-ctrl-geocoder,.dsm-dark .mapboxgl-ctrl-geocoder{background:#4e594f!important;border:1px solid rgba(255,255,255,0.14)!important;box-shadow:0 2px 8px rgba(0,0,0,0.4)!important;}.geocoder-dark.mapboxgl-ctrl-geocoder:focus-within,.dsm-dark .mapboxgl-ctrl-geocoder:focus-within{box-shadow:0 2px 8px rgba(0,0,0,0.4),0 0 0 3px rgba(115,161,127,0.22)!important;}.geocoder-dark .mapboxgl-ctrl-geocoder--input,.dsm-dark .mapboxgl-ctrl-geocoder--input{color:#F3F3F1!important;background:transparent!important;}.geocoder-dark .mapboxgl-ctrl-geocoder--input::placeholder,.dsm-dark .mapboxgl-ctrl-geocoder--input::placeholder{color:rgba(243,243,241,0.65)!important;}.geocoder-dark .mapboxgl-ctrl-geocoder--icon,.dsm-dark .mapboxgl-ctrl-geocoder .mapboxgl-ctrl-geocoder--icon{fill:rgba(243,243,241,0.75)!important;}.geocoder-dark .mapboxgl-ctrl-geocoder--button,.dsm-dark .mapboxgl-ctrl-geocoder--button{background:transparent!important;}"),"geocoder-skin");const{t:r,locale:a}=kt(),s=e,i=Q(()=>s.placeholder||r("search.placeholder")),l=o,c={"&":"&","<":"<",">":">",'"':""","'":"'"};function u(I){return String(I??"").replace(/[&<>"']/g,z=>c[z])}function d(I){return I==null?"":typeof I=="string"?I:typeof I=="object"?I.label||I.value||"":String(I)}const f={"people-group":"people","doxa-people-group":"peopleGroup","doxa-affinity-bloc":"bloc","doxa-cluster":"cluster","doxa-country":"country","doxa-region":"region","doxa-language-family":"family","doxa-language":"languageKind","doxa-dialect":"dialect","doxa-religion":"religionKind"};function x(I){const z=f[I];if(!z)return"";const V=r("search.kinds."+z);return`${u(V)}`}function b(I){var ae;if(!I)return"";const z=I.place_type||[];if(z.includes("doxa-section-header"))return``;if(z.includes("people-group")){const j=I.properties||{},q=d(j.name)||d(j.displayName)||d(I.text)||"",A=d(j.countryName)||d(j.country)||d(j.countryIso)||"",G=d(j.language)||d(j.primaryLanguage)||d(j.languageFamily)||"",re=d(j.religionName)||d(j.religion)||"",ye=r("search.labels.place"),K=r("search.labels.language"),pe=r("search.labels.religion"),ge=[];return A&&ge.push(`${u(ye)} ${u(A)}`),G&&ge.push(`${u(K)} ${u(G)}`),re&&ge.push(`${u(pe)} ${u(re)}`),`${x("people-group")}${u(q)}
`+(ge.length?`${ge.join("")}
`:"")}const V=z.find(j=>j.startsWith("doxa-"));if(V){const j=I.properties||{},q=u(d(j.label)||I.text||""),A=Number(j.count)||0,G=A?` ${A}`:"";return`${x(V)}${q}${G}
`}return`${u(I.place_name||I.text||"")}
`}const v=Ee("dataStore",null),_=Ee("mapStore",null),w=Ee("uiStore",null);function S(){return _?_.selectedFamily?{kind:"family",key:_.selectedFamily}:_.selectedLanguage?{kind:"language",key:_.selectedLanguage}:null:null}const{search:m}=R1({dataStore:v,dataSourceId:s.dataSourceId||void 0,getActiveFilter:S,getActiveContext:()=>s.activeContext||null}),g=En(null),y=ue(null),L={mapbox:"https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v5.0.0/mapbox-gl-geocoder.css",maplibre:"https://cdn.jsdelivr.net/npm/@maplibre/maplibre-gl-geocoder@1/dist/maplibre-gl-geocoder.css"};function P(I,z){const V=L[z]||L.mapbox;if(I.querySelector(`link[href="${V}"]`))return;const ae=document.createElement("link");ae.rel="stylesheet",ae.href=V,I.prepend(ae)}async function N(){if(typeof window<"u"&&window.MaplibreGeocoder||typeof document>"u")return;const I=document.querySelector(`script[src="${qu}"]`);if(I){if(window.MaplibreGeocoder)return;await new Promise(z=>{I.addEventListener("load",z,{once:!0}),I.addEventListener("error",z,{once:!0})});return}await new Promise((z,V)=>{const ae=document.createElement("script");ae.src=qu,ae.async=!1,ae.addEventListener("load",z,{once:!0}),ae.addEventListener("error",()=>V(new Error("[GeocoderComponent] Failed to load MapLibre geocoder")),{once:!0}),document.head.appendChild(ae)})}function M(I,z){return async V=>{const ae={features:[]};if(!I||!(V!=null&&V.query))return ae;try{const j=Array.isArray(V.language)?V.language[0]:V.language||z()||"en",q=new URLSearchParams({access_token:I,autocomplete:"true",limit:String(V.limit||5)});j&&q.set("language",j);const A=`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(V.query)}.json?${q.toString()}`,G=await fetch(A);if(!G.ok)return ae;const re=await G.json();return re&&Array.isArray(re.features)?re:ae}catch{return ae}}}return to(async()=>{var j,q,A,G,re;const I=s.provider==="maplibre";if(I){if(await N(),typeof MaplibreGeocoder>"u"){console.error("[GeocoderComponent] MaplibreGeocoder global unavailable.");return}}else if(typeof MapboxGeocoder>"u")return;const z=s.mapInstance;if(!s.standalone&&!z)return;const V=s.standalone?(q=(j=y.value)==null?void 0:j.getRootNode)==null?void 0:q.call(j):(re=(G=(A=z.getContainer)==null?void 0:A.call(z))==null?void 0:G.getRootNode)==null?void 0:re.call(G);V instanceof ShadowRoot&&P(V,s.provider);const ae={marker:!1,flyTo:!s.standalone,trackProximity:!s.standalone,placeholder:i.value,language:a.value||"en",localGeocoder:m,limit:20,zoom:6,render:b};if(I){const ye=typeof maplibregl<"u"?maplibregl:void 0,K={forwardGeocode:M(s.accessToken,()=>a.value)};g.value=new MaplibreGeocoder(K,{...ae,maplibregl:ye,showResultsWhileTyping:!0,reverseGeocode:!1})}else g.value=new MapboxGeocoder({accessToken:s.accessToken,mapboxgl,...ae});if(g.value.on("result",ye=>{var pe,ge,Ge,Ve,Ze,Xe,tt,Qe,gt,et,wt,$,E,C,D,W,Z,X,Y,p,h,F,U,se,ne,O,k,R,oe,le;const K=ye==null?void 0:ye.result;K&&((pe=K.place_type)!=null&&pe.includes("doxa-section-header")||(_&&(_.selectedRegion=null,_.selectedResource=null,_.selectedAffinityBlock=null,_.selectedDialect=null),w&&((ge=w.setPrayerFilter)==null||ge.call(w,null),(Ge=w.setEngagementFilter)==null||Ge.call(w,null),(Ve=w.setAdoptionFilter)==null||Ve.call(w,null),(Ze=w.setReligionFilter)==null||Ze.call(w,null)),(Xe=K.properties)!=null&&Xe._allDataSection&&_&&(_.selectedFamily=null,_.selectedLanguage=null),l("result",ye),(tt=K.place_type)!=null&&tt.includes("people-group")&&K.feature?l("people-group-result",{type:"Feature",properties:K.properties||K.feature,geometry:K.geometry||{type:"Point",coordinates:K.center}}):((Qe=K.place_type)!=null&&Qe.includes("doxa-country")||(gt=K.place_type)!=null&>.includes("doxa-region")||(et=K.place_type)!=null&&et.includes("doxa-language-family")||(wt=K.place_type)!=null&&wt.includes("doxa-language")||($=K.place_type)!=null&&$.includes("doxa-dialect")||(E=K.place_type)!=null&&E.includes("doxa-religion")||(C=K.place_type)!=null&&C.includes("doxa-affinity-bloc")||(D=K.place_type)!=null&&D.includes("doxa-cluster")||(W=K.place_type)!=null&&W.includes("doxa-people-group"))&&l("aggregate-result",{kind:K.place_type[0].replace(/^doxa-/,""),label:((Z=K.properties)==null?void 0:Z.label)||K.text,count:((X=K.properties)==null?void 0:X.count)||0,memberIds:((Y=K.properties)==null?void 0:Y.memberIds)||[],bounds:((p=K.properties)==null?void 0:p.bounds)||null,center:K.center,originalLabels:((h=K.properties)==null?void 0:h.originalLabels)||null,familyDerived:((F=K.properties)==null?void 0:F.familyDerived)||"",baseLang:((U=K.properties)==null?void 0:U.baseLang)||"",dialectLabel:((se=K.properties)==null?void 0:se.dialectLabel)||"",slug:((ne=K.properties)==null?void 0:ne.slug)||null,id:K.id||null,blocCode:((O=K.properties)==null?void 0:O.blocCode)||"",blocLabel:((k=K.properties)==null?void 0:k.blocLabel)||"",clusterCode:((R=K.properties)==null?void 0:R.clusterCode)||"",clusterLabel:((oe=K.properties)==null?void 0:oe.clusterLabel)||"",peopleGroupCode:((le=K.properties)==null?void 0:le.peopleGroupCode)||"",properties:K.properties||null})))}),g.value.on("clear",()=>l("clear")),g.value.on("error",ye=>l("error",ye)),s.standalone){if(y.value){const ye={on(){},off(){},fire(){},getContainer:()=>y.value,getZoom:()=>0,getCenter:()=>({lng:0,lat:0}),getBounds:()=>null,flyTo(){},fitBounds(){},addControl(){},removeControl(){},hasControl:()=>!1};try{const K=g.value.onAdd(s.mapInstance||ye);K&&y.value.appendChild(K)}catch(K){l("error",K)}}}else z.addControl(g.value,"top-left")}),ut(i,I=>{var ae,j;const z=g.value;if(!z)return;const V=z._inputEl||((j=(ae=z.container)==null?void 0:ae.querySelector)==null?void 0:j.call(ae,"input.mapboxgl-ctrl-geocoder--input"));V&&(V.placeholder=I,V.setAttribute("placeholder",I)),z.options&&(z.options.placeholder=I)}),ut(a,I=>{const z=g.value;z!=null&&z.options&&(z.options.language=I||"en")}),Lo(()=>{var I,z;if(g.value){try{s.standalone?(z=(I=g.value).onRemove)==null||z.call(I):s.mapInstance&&s.mapInstance.removeControl(g.value)}catch{}g.value=null}}),t({geocoder:g}),(I,z)=>e.standalone?(H(),ee("div",{key:0,ref_key:"standaloneContainer",ref:y,class:"dg-standalone-geocoder"},null,512)):Fn(I.$slots,"default",{},void 0,void 0,1)}},O1=["country_code","wagf_region","wagf_block","primary_language","religion"];function D1(e){return e==null?{value:null,label:null}:typeof e=="object"?{value:e.value??null,label:e.label??null}:{value:e,label:null}}function B1(e){if(e==null||typeof e!="object")return e;const t={...e};for(const o of O1)if(o in t){const{value:n,label:r}=D1(t[o]);t[o]=n,r!=null&&(t[`${o}_label`]=r)}return t}function Zu(e){return Array.isArray(e)?e.map(B1):[]}function Xu(e){return Array.isArray(e)?e:e&&typeof e=="object"?e.posts||e.data||e.records||e.results||e.items||[]:[]}function bn(e){return e==null||typeof e!="object"?null:e.slug??null}function Qu(e){return typeof e=="string"&&e.toLowerCase().includes("deaf")}function j1(e){const t=e==null?null:e.rop1;return t==null?null:typeof t=="object"?t.value??null:t}function oa(e,t){const o=new Set;if(e==null||typeof e!="object"||typeof e.type!="string")throw new Error(`selector-evaluator: malformed selector (expected an object with a string \`type\`), got: ${JSON.stringify(e)}`);const n=Array.isArray(t)?t:[];switch(e.type){case"country_code":{const r=e.value;for(const a of n)if(a&&a.country_code===r){const s=bn(a);s!=null&&o.add(s)}return o}case"country_codes":{const r=new Set(Array.isArray(e.values)?e.values:[]);for(const a of n)if(a&&r.has(a.country_code)){const s=bn(a);s!=null&&o.add(s)}return o}case"wagf_block":{const r=e.value;for(const a of n)if(a&&a.wagf_block===r){const s=bn(a);s!=null&&o.add(s)}return o}case"wagf_region":{const r=e.value;for(const a of n)if(a&&a.wagf_region===r){const s=bn(a);s!=null&&o.add(s)}return o}case"union":{const r=Array.isArray(e.selectors)?e.selectors:[];for(const a of r){const s=oa(a,n);for(const i of s)o.add(i)}return o}case"deaf_predicate":{const r=new Set(Array.isArray(e.regions)?e.regions:[]);for(const a of n){if(!a)continue;if((Qu(a.slug)||Qu(a.name))&&r.has(a.wagf_region)){const i=bn(a);i!=null&&o.add(i)}}return o}case"affinity_bloc":{const r=e.rop1;for(const a of n)if(a&&j1(a)===r){const s=bn(a);s!=null&&o.add(s)}return o}default:throw new Error(`selector-evaluator: unknown selector type "${e.type}" (supported: country_code, country_codes, wagf_block, wagf_region, union, deaf_predicate, affinity_bloc)`)}}const G1=Object.freeze(Object.defineProperty({__proto__:null,default:oa,evaluate:oa},Symbol.toStringTag,{value:"Module"}));function U1(e,t){return`hsl(${Math.round(e*360/(t||1))}, 72%, 56%)`}function lr(e){if(typeof e.count=="number")return e.count;if(typeof e.expected_count=="number")return e.expected_count}function ed(e){const t=parseInt(e&&e.population,10);return Number.isFinite(t)?t:0}function K1(e,t){if(!Array.isArray(t)||t.length===0)return;const o=e&&e.selector;if(o==null)return;if(o.type==="pg_slugs"){const a=new Set(Array.isArray(o.values)?o.values:[]);let s=0;for(const i of t)i&&a.has(i.slug)&&(s+=ed(i));return s}const n=oa(o,t);let r=0;for(const a of t)a&&n.has(a.slug)&&(r+=ed(a));return r}function Gs(e,t={}){const o=t.deafCount??123,n=Array.isArray(t.records)?t.records:null,r=e.lists||[],a=e.asia_lists||[],s=e.uncovered_lists||[],i={type:"affinity_bloc",rop1:"A017"},l=a.filter(j=>j.id.startsWith("asia-india")),c=a.filter(j=>j.id.startsWith("asia-china")),u=[...r.map(j=>j.id),"deaf",...l.map(j=>j.id),...c.map(j=>j.id),...s.map(j=>j.id)],d=u.length,f=j=>U1(u.indexOf(j),d),x=(j,q,A)=>{if(!n)return j;const G=A??(q&&q.selector);return j.pop=K1({selector:G},n),j},b=j=>n?j.reduce((q,A)=>q+(A.pop||0),0):void 0,v=r.map(j=>x({id:j.id,zoneKey:j.id,label:j.label,...j.provinceLabel?{provinceLabel:j.provinceLabel}:{},color:f(j.id),count:lr(j)},j)),_=x({id:"deaf",zoneKey:"deaf",label:"Deaf (affinity bloc A017)",color:f("deaf"),count:o,info:"Unified deaf row — affinity bloc rop1=A017 (collapses the two deaf_lists; zero-delta vs old deaf_predicate). Population double-counts vs geographic rows (design-approved, slice 08)."},null,i),w=j=>x({id:j.id,zoneKey:j.id,label:j.label,...j.provinceLabel?{provinceLabel:j.provinceLabel}:{},color:f(j.id),count:lr(j),...Array.isArray(j.adm0)&&j.adm0.length?{adm0:j.adm0}:{},...Array.isArray(j.provinces)&&j.provinces.length?{provinces:j.provinces}:{}},j),S=l.map(w),m=c.map(w),g=j=>j.reduce((q,A)=>q+(lr(A)||0),0),y={id:"asia-india",label:"India",count:g(l),children:S},L={id:"asia-china",label:"China",count:g(c),children:m};n&&(y.pop=b(S),L.pop=b(m)),g(a),n&&b([y,L]);const P=j=>x({id:j.id,zoneKey:j.id,label:j.label,...j.provinceLabel?{provinceLabel:j.provinceLabel}:{},color:f(j.id),count:lr(j)},j),N=s.map(P);N.length>0&&(()=>{const j={id:"frontier-asia",label:"Frontier Asia (uncovered)",count:g(s),children:N};return n&&(j.pop=b(N)),j})();const M={"west-africa":"Africa",sudan:"Africa","east-africa":"Africa","central-africa":"Africa","southern-africa-islands":"Africa","maghreb-egypt":"Middle East","middle-east-core":"Middle East","uncovered-nas-a":"Central Asia",laos:"Southeast Asia + Oceania","oceania-indonesia":"Southeast Asia + Oceania","mainland-se-asia-philippines":"Southeast Asia + Oceania",brazil:"Americas","andean-caribbean":"Americas","uncovered-scatter":"Americas",europe:"Europe",deaf:"Deaf","deaf-old-world":"Deaf"},I=j=>M[j]||(String(j).startsWith("asia-india-")?"India":String(j).startsWith("asia-china-")?"China + Mongolia":"Other"),z=[...v,_,...S,...m,...N].filter(Boolean),V=new Map;for(const j of z){const q=I(j.id||j.zoneKey);V.has(q)||V.set(q,[]),V.get(q).push(j)}const ae=[...V.entries()].map(([j,q])=>{q.sort((G,re)=>(re.count||0)-(G.count||0));const A={id:"region-"+j.toLowerCase().replace(/[^a-z0-9]+/g,"-"),label:j,count:q.reduce((G,re)=>G+(re.count||0),0),children:q};return n&&(A.pop=b(q)),A}).sort((j,q)=>(q.count||0)-(j.count||0));return H1(td(ae),{withPop:!!n}),ae}function H1(e,{withPop:t=!1}={}){const o=[];for(const n of e||[]){const r=[];(typeof n.id!="string"||!n.id)&&r.push("id"),(typeof n.zoneKey!="string"||!n.zoneKey)&&r.push("zoneKey"),(typeof n.label!="string"||!n.label)&&r.push("label"),(typeof n.color!="string"||!n.color)&&r.push("color"),typeof n.count!="number"&&r.push("count"),t&&typeof n.pop!="number"&&r.push("pop"),r.length&&o.push(`${n.id||"(no-id)"}: missing/!type [${r.join(", ")}]`)}if(o.length)throw new Error(`legend-tree L15: ${o.length} leaf node(s) violate the uniform consumer shape:
+`,"share-button");const{t,tm:o,rt:n}=kt(),r=e,a=ue(!1),s=ue(null),i=ue(null),l=ue("link"),c=ue(!1),u=ue(!1),d=ue("medium"),f={small:{label:"Small",height:400},medium:{label:"Medium",height:600},large:{label:"Large",height:800}},x=Ee("profileConfig",null),b=Q(()=>a1({embedPath:r.embedPath,profileConfig:be(x)||null})),v=Q(()=>{const P=f[d.value].height;return''});function _(){a.value=!a.value,a.value&&(l.value="link",c.value=!1,u.value=!1)}function w(){a.value=!1}async function S(P){try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(P),!0}catch{}try{const N=document.createElement("textarea");N.value=P,N.setAttribute("readonly",""),N.style.cssText="position:fixed;top:-1000px;opacity:0",document.body.appendChild(N),N.select();const M=document.execCommand("copy");return document.body.removeChild(N),M}catch{return!1}}async function m(){await S(b.value)&&(c.value=!0,setTimeout(()=>{c.value=!1},2e3))}async function g(){await S(v.value)&&(u.value=!0,setTimeout(()=>{u.value=!1},2e3))}function y(P){if(!a.value)return;const N=P.composedPath?P.composedPath():[P.target];s.value&&N.some(I=>I===s.value)||i.value&&N.some(I=>I===i.value||I===i.value.$el)||!N.some(I=>{var z,V;return(V=(z=I==null?void 0:I.classList)==null?void 0:z.contains)==null?void 0:V.call(z,"mapboxgl-canvas")})||w()}function L(P){P.key==="Escape"&&a.value&&w()}return to(()=>{document.addEventListener("click",y,!0),document.addEventListener("keydown",L)}),Lo(()=>{document.removeEventListener("click",y,!0),document.removeEventListener("keydown",L)}),(P,N)=>(H(),ee("div",r1,[Be(Yo,{ref_key:"btnEl",ref:i,"is-dark":e.isDark,active:a.value,title:be(t)("buttons.shareEmbed"),onClick:_},{default:Kt(()=>[...N[2]||(N[2]=[T("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[T("path",{d:"M4 12v7a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7"}),T("polyline",{points:"16 6 12 2 8 6"}),T("line",{x1:"12",y1:"2",x2:"12",y2:"15"})],-1)])]),_:1},8,["is-dark","active","title"]),a.value?(H(),ee("div",{key:0,ref_key:"popoverEl",ref:s,class:Ce(["share-pop",{light:!e.isDark}])},[T("div",{class:"share-header"},[N[4]||(N[4]=T("span",{class:"share-title"},"Share",-1)),T("button",{class:"share-close",onClick:w,"aria-label":"Close"},[...N[3]||(N[3]=[T("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},[T("line",{x1:"2",y1:"2",x2:"12",y2:"12"}),T("line",{x1:"12",y1:"2",x2:"2",y2:"12"})],-1)])])]),T("ul",s1,[(H(!0),ee(Le,null,St(be(o)("buttons.shareSteps"),(M,I)=>(H(),ee("li",{key:I},ce(be(n)(M)),1))),128))]),T("div",i1,[T("button",{class:Ce(["share-tab",{active:l.value==="link"}]),onClick:N[0]||(N[0]=M=>l.value="link")},"Embed link",2),T("button",{class:Ce(["share-tab",{active:l.value==="embed"}]),onClick:N[1]||(N[1]=M=>l.value="embed")},"Add to Your Website",2)]),l.value==="link"?(H(),ee("div",l1,[T("div",c1,[T("div",u1,ce(b.value),1)]),T("button",{class:Ce(["share-primary-btn",{copied:c.value}]),onClick:m},[c.value?(H(),ee("svg",p1,[...N[6]||(N[6]=[T("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):(H(),ee("svg",d1,[...N[5]||(N[5]=[T("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"},null,-1),T("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"},null,-1)])])),dt(" "+ce(c.value?"Copied!":"Copy Link"),1)],2)])):me("",!0),l.value==="embed"?(H(),ee("div",g1,[N[9]||(N[9]=T("div",{class:"share-embed-desc"}," Paste this code into your website builder (WordPress, Squarespace, Wix, or any site that accepts HTML widgets). ",-1)),T("div",f1,[(H(),ee(Le,null,St(f,(M,I)=>T("button",{key:I,class:Ce(["share-size-pill",{active:d.value===I}]),onClick:z=>d.value=I},ce(M.label),11,h1)),64))]),T("div",m1,ce(v.value),1),T("button",{class:Ce(["share-secondary-btn",{copied:u.value}]),onClick:g},[u.value?(H(),ee("svg",y1,[...N[8]||(N[8]=[T("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):(H(),ee("svg",b1,[...N[7]||(N[7]=[T("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"},null,-1),T("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"},null,-1)])])),dt(" "+ce(u.value?"Copied!":"Copy Code"),1)],2)])):me("",!0)],2)):me("",!0)]))}},_1=["blocs","clusters","peopleGroups","families","languages","dialects","people","places","regions","wagfBlocks","religions"],v1={"people-groups":["blocs","clusters","peopleGroups","people","places","families","languages","dialects","regions","religions"],language:["families","languages","dialects","people","blocs","clusters","peopleGroups","places","regions","religions"],regions:["regions","wagfBlocks","places","blocs","clusters","peopleGroups","people","families","languages","dialects","religions"],religion:["religions","people","blocs","clusters","peopleGroups","places","families","languages","dialects","regions"]};function k1(e){return v1[e]||_1}const w1={blocs:3,clusters:3,peopleGroups:3,families:3,languages:3,dialects:3,people:5,places:2,regions:3,wagfBlocks:3,religions:2},sr=["peopleGroups","people","places","languages","religions"],x1={regions:[...sr,"regions","wagfBlocks"],"people-groups":[...sr,"blocs","clusters"],language:[...sr,"dialects","families"],religion:[...sr]},S1=100,A1=50,$1=25,L1=10,Bs=5,Yu=20,C1=[[/ sign language$/i,"Sign Language"]];function T1(e){if(!e||typeof e!="string")return"";const t=e.indexOf(",");return t>0?e.slice(0,t).trim():e.trim()}function E1(e){if(!e||typeof e!="string")return null;const t=e.indexOf(",");return t>=0&&e.slice(t+1).trim()||null}function P1(e){if(!e||typeof e!="string")return null;const t=e.split(",").map(n=>n.trim()).filter(Boolean);if(t.length>=2){const n=[...t].reverse().join(" ");if($t[n])return $t[n];if(t.length>=3){const r=[t[1],t[0]].join(" ");if($t[r])return $t[r]}}if($t[e])return $t[e];const o=e.replace(/\s*\(.*?\)\s*$/,"").trim();if(o!==e&&$t[o])return $t[o];for(const[n,r]of C1)if(n.test(e))return r;return null}function Ju(e,t){return{id:`doxa-section-header-${js(e)}`,place_name:e,text:e,center:[0,0],place_type:["doxa-section-header"],geometry:{type:"Point",coordinates:[0,0]},properties:{headerLabel:e,isHeader:!0,isAllDataSection:!!t},feature:null}}function js(e){return String(e||"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function xe(e){return e==null?"":typeof e=="string"?e.toLowerCase():typeof e=="object"&&"label"in e?String(e.label||"").toLowerCase():typeof e=="object"&&"value"in e?String(e.value||"").toLowerCase():String(e).toLowerCase()}function ir(e){return e==null?"":typeof e=="string"?e:typeof e=="object"?e.label||e.value||"":String(e)}function N1(e){var o,n,r,a,s;if(!Array.isArray(e))return[];const t=[];for(const i of e){if(!i)continue;const l=Number(i.latitude),c=Number(i.longitude);if(!Number.isFinite(l)||!Number.isFinite(c))continue;const u=xe(i.name)+" "+xe(i.displayName)+" "+xe(i.alternateName),d=xe(i.countryName)+" "+xe(i.country)+" "+xe(i.countryIso)+" "+xe(i.countryIsoLabel),f=xe(i.religionName)+" "+xe(i.religion)+" "+xe(i.religionLabel)+" "+xe(i.religionCode),x=xe(i.language)+" "+xe(i.languageFamily)+" "+xe(i.languageCode),b=xe(i.doxaRegion)+" "+xe(i.wagfRegion)+" "+xe(i.wagfBlock),v=xe(i.affinityBlock)+" "+xe(i.affinityBlockLabel)+" "+xe((o=i._raw)==null?void 0:o.rop1),_=xe(i.cluster)+" "+xe(i.clusterLabel)+" "+xe((n=i._raw)==null?void 0:n.imb_reg_of_people_2),w=xe(i.peopleGroup)+" "+xe(i.peopleGroupLabel)+" "+xe((r=i._raw)==null?void 0:r.imb_reg_of_people_25),S=((a=i._raw)==null?void 0:a.primary_language)??((s=i._raw)==null?void 0:s.PrimaryLanguage),m=S&&(typeof S=="object"?S.label||S.value:S)||ir(i.language)||ir(i.primaryLanguage)||"",g=T1(m),y=E1(m);t.push({feature:i,nameHay:u,countryHay:d,religionHay:f,languageHay:x,regionHay:b,haystack:u+" "+d+" "+f+" "+x+" "+b+" "+v+" "+_+" "+w,blocHay:v,clusterHay:_,pgHay:w,lat:l,lng:c,familyDerived:P1(m)||null,languageLabel:m,baseLang:g,dialectLabel:y})}return t}function M1(e){const t=(o,n,r)=>{const a=new Map;for(const s of e){const i=o(s);if(!i)continue;const l=a.get(i);if(l)l.count+=1,l.lngSum+=s.lng,l.latSum+=s.lat,l.memberIds.push(String(s.feature.uniqueId??s.feature.id??s.feature.slug??"")),l.minLng=Math.min(l.minLng,s.lng),l.maxLng=Math.max(l.maxLng,s.lng),l.minLat=Math.min(l.minLat,s.lat),l.maxLat=Math.max(l.maxLat,s.lat),r&&r(l,s,!1);else{const c={key:i,label:ir(n(s))||i,count:1,lngSum:s.lng,latSum:s.lat,minLng:s.lng,maxLng:s.lng,minLat:s.lat,maxLat:s.lat,memberIds:[String(s.feature.uniqueId??s.feature.id??s.feature.slug??"")]};r&&r(c,s,!0),a.set(i,c)}}for(const s of a.values())s.lng=s.lngSum/s.count,s.lat=s.latSum/s.count;return Array.from(a.values())};return{countries:t(o=>xe(o.feature.countryName)||xe(o.feature.country)||xe(o.feature.countryIso),o=>o.feature.countryName||o.feature.country||o.feature.countryIso||""),families:t(o=>xe(o.familyDerived),o=>o.familyDerived||""),languages:t(o=>xe(o.baseLang),o=>o.baseLang||""),dialects:t(o=>o.dialectLabel?`${xe(o.baseLang)}__${xe(o.dialectLabel)}`:"",o=>`${o.baseLang}, ${o.dialectLabel}`,(o,n,r)=>{r?(o.originalLabels=new Set([n.languageLabel]),o.familyDerived=n.familyDerived||"",o.baseLang=n.baseLang||"",o.dialectLabel=n.dialectLabel||""):(o.originalLabels.add(n.languageLabel),!o.familyDerived&&n.familyDerived&&(o.familyDerived=n.familyDerived))}),religions:t(o=>{var n,r,a;return ta(o.feature.religion||((r=(n=o.feature._raw)==null?void 0:n.religion)==null?void 0:r.value)||((a=o.feature._raw)==null?void 0:a.religion)||"")},o=>{var n,r,a;return ea[ta(o.feature.religion||((r=(n=o.feature._raw)==null?void 0:n.religion)==null?void 0:r.value)||((a=o.feature._raw)==null?void 0:a.religion)||"")]||"Unknown"}),regions:t(o=>xe(o.feature.doxaRegion)||xe(o.feature.wagfRegion),o=>{var n,r;return o.feature.wagfRegionLabel||o.feature.doxaRegionLabel||((r=(n=o.feature._raw)==null?void 0:n.wagf_region)==null?void 0:r.label)||o.feature.doxaRegion||o.feature.wagfRegion||""}),wagfBlocks:t(o=>xe(o.feature.wagfBlock),o=>{var n,r;return o.feature.wagfBlockLabel||((r=(n=o.feature._raw)==null?void 0:n.wagf_block)==null?void 0:r.label)||o.feature.wagfBlock||""}),blocs:t(o=>xe(o.feature.affinityBlockLabel)||xe(o.feature.affinityBlock),o=>o.feature.affinityBlockLabel||o.feature.affinityBlock||"",(o,n,r)=>{r&&(o.blocCode=n.feature.affinityBlock||"")}),clusters:t(o=>{const n=o.feature.affinityBlock||"",r=o.feature.cluster||"";return r?`${n}__${r}`:""},o=>o.feature.clusterLabel||o.feature.cluster||"",(o,n,r)=>{r&&(o.blocCode=n.feature.affinityBlock||"",o.blocLabel=n.feature.affinityBlockLabel||"",o.clusterCode=n.feature.cluster||"")}),peopleGroups:t(o=>xe(o.feature.peopleGroup)||xe(o.feature.peopleGroupLabel),o=>o.feature.peopleGroupLabel||o.feature.peopleGroup||o.feature.name||"",(o,n,r)=>{r&&(o.blocCode=n.feature.affinityBlock||"",o.blocLabel=n.feature.affinityBlockLabel||"",o.clusterCode=n.feature.cluster||"",o.clusterLabel=n.feature.clusterLabel||"",o.peopleGroupCode=n.feature.peopleGroup||"")})}}function I1(e){const t=e.feature,o=t.name||t.displayName||t.slug||"Unknown",n=t.countryName||t.country||t.countryIso||"",r=t.religionName||t.religion||"",a=t.slug||t.uniqueId||js(o+"-"+n),s=[e.lng,e.lat],i=[n,r].filter(Boolean).join(" — "),l=i?`${o}, ${i}`:o;return{id:`doxa-pg-${a}`,place_name:l,text:o,center:s,place_type:["people-group"],geometry:{type:"Point",coordinates:s},properties:{slug:a,...t},feature:t}}function io(e,t){let o,n;switch(e){case"country":o="doxa-country",n="doxa-country-";break;case"region":o="doxa-region",n="doxa-region-";break;case"language-family":o="doxa-language-family",n="doxa-language-family-";break;case"language":o="doxa-language",n="doxa-language-";break;case"dialect":o="doxa-dialect",n="doxa-dialect-";break;case"religion":o="doxa-religion",n="doxa-religion-";break;case"affinity-bloc":o="doxa-affinity-bloc",n="doxa-affinity-bloc-";break;case"cluster":o="doxa-cluster",n="doxa-cluster-";break;case"people-group":o="doxa-people-group",n="doxa-people-group-";break;default:o="doxa",n="doxa-"}const r=ir(t.label)||t.key,a=js(t.key),s=[t.lng,t.lat],l={"affinity-bloc":"Affinity Block",cluster:"Cluster","people-group":"PG","pg-in-country":"PGIC"}[e],c=l?`${r} (${l}) · ${t.count}`:`${r} (${t.count})`,u=t.originalLabels?Array.from(t.originalLabels):void 0,d=e==="dialect"?{familyDerived:t.familyDerived||"",baseLang:t.baseLang||"",dialectLabel:t.dialectLabel||""}:null;return{id:`${n}${a}`,place_name:c,text:r,center:s,bbox:[t.minLng,t.minLat,t.maxLng,t.maxLat],place_type:[o],geometry:{type:"Point",coordinates:s},properties:{slug:a,doxaAggregate:e,count:t.count,label:r,memberIds:t.memberIds,bounds:[t.minLng,t.minLat,t.maxLng,t.maxLat],...u?{originalLabels:u}:{},...d||{},...e==="affinity-bloc"?{blocCode:t.blocCode||""}:{},...e==="cluster"?{blocCode:t.blocCode||"",blocLabel:t.blocLabel||"",clusterCode:t.clusterCode||""}:{},...e==="people-group"?{blocCode:t.blocCode||"",blocLabel:t.blocLabel||"",clusterCode:t.clusterCode||"",clusterLabel:t.clusterLabel||"",peopleGroupCode:t.peopleGroupCode||""}:{}},feature:null}}function R1(e={}){const{dataStore:t,dataSourceId:o,getActiveFilter:n,getActiveContext:r}=e,{t:a}=kt(),s=Q(()=>{var d,f;if(!t||!t.sources)return[];if(o&&((d=t.sources[o])!=null&&d.features))return t.sources[o].features;for(const x of Object.keys(t.sources)){const b=t.sources[x];if((f=b==null?void 0:b.features)!=null&&f.length)return b.features}return[]}),i=Q(()=>N1(s.value)),l=Q(()=>M1(i.value));function c(d){const f=String(d||"").trim().toLowerCase(),x={people:[],places:[],regions:[],wagfBlocks:[],families:[],languages:[],dialects:[],religions:[],blocs:[],clusters:[],peopleGroups:[]};if(f.length<2)return x;const b=f.split(/[\s,;]+/).filter(Boolean);if(!b.length)return x;const v=i.value;if(!v.length)return x;const _=l.value,w=[];for(const A of v){let G=!0;for(const ye of b)if(!A.haystack.includes(ye)){G=!1;break}if(!G)continue;let re=0;b.some(ye=>A.nameHay.includes(ye))&&(re+=S1),b.some(ye=>A.countryHay.includes(ye))&&(re+=A1),b.some(ye=>A.religionHay.includes(ye))&&(re+=$1),b.some(ye=>A.languageHay.includes(ye))&&(re+=L1),w.push({entry:A,score:re})}w.sort((A,G)=>G.score-A.score);const S=w.slice(0,Bs).map(A=>I1(A.entry)),m=A=>A.filter(G=>b.every(re=>G.key.includes(re)||xe(G.label).includes(re))).sort((G,re)=>re.count-G.count).slice(0,Bs),g=m(_.countries).map(A=>io("country",A)),y=m(_.regions).map(A=>io("region",A)),L=m(_.wagfBlocks).map(A=>io("region",A)),P=m(_.families).map(A=>io("language-family",A)),N=m(_.languages).map(A=>io("language",A)),M=m(_.dialects).map(A=>io("dialect",A)),I=m(_.religions).map(A=>io("religion",A)),z=m(_.blocs).map(A=>io("affinity-bloc",A));let V=m(_.clusters).map(A=>io("cluster",A)),ae=m(_.peopleGroups).map(A=>io("people-group",A));const j=new Set(z.map(A=>xe(A.text)));V=V.filter(A=>!j.has(xe(A.text)));const q=new Set(V.map(A=>xe(A.text)));return ae=ae.filter(A=>!j.has(xe(A.text))&&!q.has(xe(A.text))),{people:S,places:g,regions:y,wagfBlocks:L,families:P,languages:N,dialects:M,religions:I,blocs:z,clusters:V,peopleGroups:ae}}function u(d){const f=typeof n=="function"?n():null,x=typeof r=="function"?r():null,b=c(d),v=k1(x),_=x1[x],w=_?Object.fromEntries(_.filter(P=>b[P]).map(P=>[P,b[P]])):b,S=v.flatMap(P=>w[P]||[]);if(!(f!=null&&f.key)||!S.length)return S.slice(0,Yu);const m=[];for(const P of b.people){const N=i.value.find(I=>I.feature===P.feature);let M=!1;N&&(f.kind==="family"?M=(N.familyDerived||"").toLowerCase()===f.key.toLowerCase():f.kind==="language"&&(M=N.languageLabel.toLowerCase()===f.key.toLowerCase())),M&&m.push(P)}const g=[],y=f.key;m.length&&(g.push(Ju(a("search.sections.within",{selection:y}),!1)),g.push(...m.slice(0,Bs)));const L=v.flatMap(P=>(w[P]||[]).slice(0,w1[P]??3)).map(P=>({...P,properties:{...P.properties,_allDataSection:!0}}));return g.push(Ju(a("search.sections.allData"),!0)),g.push(...L),g.slice(0,Yu+8)}return{search:u,searchGrouped:c,index:i,aggregates:l}}const qu="https://cdn.jsdelivr.net/npm/@maplibre/maplibre-gl-geocoder@1/dist/maplibre-gl-geocoder.min.js",F1={__name:"GeocoderComponent",props:{mapInstance:{type:Object,required:!1,default:null},accessToken:{type:String,required:!0},provider:{type:String,default:"mapbox"},isDark:{type:Boolean,default:!1},standalone:{type:Boolean,default:!1},placeholder:{type:String,default:""},dataSourceId:{type:String,default:""},activeContext:{type:String,default:""}},emits:["result","people-group-result","aggregate-result","clear","error"],setup(e,{expose:t,emit:o}){function n(I){return I+I.replace(/mapboxgl/g,"maplibregl")}At(n('.mapboxgl-ctrl-geocoder--input,.mapboxgl-ctrl-geocoder input[type="text"],.mapboxgl-ctrl-geocoder input[type="search"]{font-size:16px !important;line-height:1.3;}'),"geocoder-ios-zoom-fix"),At(n(".mapboxgl-ctrl-geocoder--icon-loading{display:none !important;}"),"geocoder-hide-loading"),At(n(".mapboxgl-ctrl-geocoder{height:35px!important;min-height:35px!important;box-sizing:border-box!important;}.mapboxgl-ctrl-geocoder--input{height:35px!important;min-height:35px!important;box-sizing:border-box!important;padding-top:0!important;padding-bottom:0!important;line-height:35px!important;}.mapboxgl-ctrl-geocoder--icon-search{top:50%!important;transform:translateY(-50%)!important;margin-top:0!important;left:7px!important;}"),"geocoder-height-35"),At(n(".mapboxgl-ctrl-geocoder{width:100%!important;max-width:100%!important;min-width:0!important;}@media(max-width:767px){.mapboxgl-ctrl-top-left{top:8px!important;left:8px!important;right:8px!important;width:calc(100% - 16px)!important;max-width:none!important;}}.mapboxgl-ctrl-geocoder{border-radius:999px!important;background:#fff;box-shadow:0 2px 8px rgba(0,0,0,0.15)!important;transition:box-shadow .12s,border-color .12s;}.mapboxgl-ctrl-geocoder:focus-within{box-shadow:0 2px 8px rgba(0,0,0,0.15),0 0 0 3px rgba(59,70,61,0.18)!important;}.mapboxgl-ctrl-geocoder--input{border-radius:999px!important;font-size:13px!important;}.mapboxgl-ctrl-geocoder--input::placeholder{font-size:12px!important;}.mapboxgl-ctrl-geocoder--button{display:none!important;top:50%!important;bottom:auto!important;transform:translateY(-50%)!important;margin:0!important;padding:0!important;width:24px!important;height:24px!important;background:transparent!important;border:none!important;box-shadow:none!important;}.mapboxgl-ctrl-geocoder:has(.mapboxgl-ctrl-geocoder--input:not(:placeholder-shown)) .mapboxgl-ctrl-geocoder--button{display:block!important;}.mapboxgl-ctrl-geocoder--button .mapboxgl-ctrl-geocoder--icon-close{position:absolute!important;top:50%!important;left:50%!important;transform:translate(-50%,-50%)!important;margin:0!important;width:16px!important;height:16px!important;}.mapboxgl-ctrl-geocoder--suggestions,.mapboxgl-ctrl-geocoder .suggestions{z-index:1200!important;position:absolute;max-height:60vh!important;overflow-y:auto!important;}.geocoder-dark.mapboxgl-ctrl-geocoder,.dsm-dark .mapboxgl-ctrl-geocoder{background:#4e594f!important;border:1px solid rgba(255,255,255,0.14)!important;box-shadow:0 2px 8px rgba(0,0,0,0.4)!important;}.geocoder-dark.mapboxgl-ctrl-geocoder:focus-within,.dsm-dark .mapboxgl-ctrl-geocoder:focus-within{box-shadow:0 2px 8px rgba(0,0,0,0.4),0 0 0 3px rgba(115,161,127,0.22)!important;}.geocoder-dark .mapboxgl-ctrl-geocoder--input,.dsm-dark .mapboxgl-ctrl-geocoder--input{color:#F3F3F1!important;background:transparent!important;}.geocoder-dark .mapboxgl-ctrl-geocoder--input::placeholder,.dsm-dark .mapboxgl-ctrl-geocoder--input::placeholder{color:rgba(243,243,241,0.65)!important;}.geocoder-dark .mapboxgl-ctrl-geocoder--icon,.dsm-dark .mapboxgl-ctrl-geocoder .mapboxgl-ctrl-geocoder--icon{fill:rgba(243,243,241,0.75)!important;}.geocoder-dark .mapboxgl-ctrl-geocoder--button,.dsm-dark .mapboxgl-ctrl-geocoder--button{background:transparent!important;}"),"geocoder-skin");const{t:r,locale:a}=kt(),s=e,i=Q(()=>s.placeholder||r("search.placeholder")),l=o,c={"&":"&","<":"<",">":">",'"':""","'":"'"};function u(I){return String(I??"").replace(/[&<>"']/g,z=>c[z])}function d(I){return I==null?"":typeof I=="string"?I:typeof I=="object"?I.label||I.value||"":String(I)}const f={"people-group":"people","doxa-people-group":"peopleGroup","doxa-affinity-bloc":"bloc","doxa-cluster":"cluster","doxa-country":"country","doxa-region":"region","doxa-language-family":"family","doxa-language":"languageKind","doxa-dialect":"dialect","doxa-religion":"religionKind"};function x(I){const z=f[I];if(!z)return"";const V=r("search.kinds."+z);return`${u(V)}`}function b(I){var ae;if(!I)return"";const z=I.place_type||[];if(z.includes("doxa-section-header"))return``;if(z.includes("people-group")){const j=I.properties||{},q=d(j.name)||d(j.displayName)||d(I.text)||"",A=d(j.countryName)||d(j.country)||d(j.countryIso)||"",G=d(j.language)||d(j.primaryLanguage)||d(j.languageFamily)||"",re=d(j.religionName)||d(j.religion)||"",ye=r("search.labels.place"),K=r("search.labels.language"),pe=r("search.labels.religion"),ge=[];return A&&ge.push(`${u(ye)} ${u(A)}`),G&&ge.push(`${u(K)} ${u(G)}`),re&&ge.push(`${u(pe)} ${u(re)}`),`${x("people-group")}${u(q)}
`+(ge.length?`${ge.join("")}
`:"")}const V=z.find(j=>j.startsWith("doxa-"));if(V){const j=I.properties||{},q=u(d(j.label)||I.text||""),A=Number(j.count)||0,G=A?` ${A}`:"";return`${x(V)}${q}${G}
`}return`${u(I.place_name||I.text||"")}
`}const v=Ee("dataStore",null),_=Ee("mapStore",null),w=Ee("uiStore",null);function S(){return _?_.selectedFamily?{kind:"family",key:_.selectedFamily}:_.selectedLanguage?{kind:"language",key:_.selectedLanguage}:null:null}const{search:m}=R1({dataStore:v,dataSourceId:s.dataSourceId||void 0,getActiveFilter:S,getActiveContext:()=>s.activeContext||null}),g=En(null),y=ue(null),L={mapbox:"https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v5.0.0/mapbox-gl-geocoder.css",maplibre:"https://cdn.jsdelivr.net/npm/@maplibre/maplibre-gl-geocoder@1/dist/maplibre-gl-geocoder.css"};function P(I,z){const V=L[z]||L.mapbox;if(I.querySelector(`link[href="${V}"]`))return;const ae=document.createElement("link");ae.rel="stylesheet",ae.href=V,I.prepend(ae)}async function N(){if(typeof window<"u"&&window.MaplibreGeocoder||typeof document>"u")return;const I=document.querySelector(`script[src="${qu}"]`);if(I){if(window.MaplibreGeocoder)return;await new Promise(z=>{I.addEventListener("load",z,{once:!0}),I.addEventListener("error",z,{once:!0})});return}await new Promise((z,V)=>{const ae=document.createElement("script");ae.src=qu,ae.async=!1,ae.addEventListener("load",z,{once:!0}),ae.addEventListener("error",()=>V(new Error("[GeocoderComponent] Failed to load MapLibre geocoder")),{once:!0}),document.head.appendChild(ae)})}function M(I,z){return async V=>{const ae={features:[]};if(!I||!(V!=null&&V.query))return ae;try{const j=Array.isArray(V.language)?V.language[0]:V.language||z()||"en",q=new URLSearchParams({access_token:I,autocomplete:"true",limit:String(V.limit||5)});j&&q.set("language",j);const A=`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(V.query)}.json?${q.toString()}`,G=await fetch(A);if(!G.ok)return ae;const re=await G.json();return re&&Array.isArray(re.features)?re:ae}catch{return ae}}}return to(async()=>{var j,q,A,G,re;const I=s.provider==="maplibre";if(I){if(await N(),typeof MaplibreGeocoder>"u"){console.error("[GeocoderComponent] MaplibreGeocoder global unavailable.");return}}else if(typeof MapboxGeocoder>"u")return;const z=s.mapInstance;if(!s.standalone&&!z)return;const V=s.standalone?(q=(j=y.value)==null?void 0:j.getRootNode)==null?void 0:q.call(j):(re=(G=(A=z.getContainer)==null?void 0:A.call(z))==null?void 0:G.getRootNode)==null?void 0:re.call(G);V instanceof ShadowRoot&&P(V,s.provider);const ae={marker:!1,flyTo:!s.standalone,trackProximity:!s.standalone,placeholder:i.value,language:a.value||"en",localGeocoder:m,limit:20,zoom:6,render:b};if(I){const ye=typeof maplibregl<"u"?maplibregl:void 0,K={forwardGeocode:M(s.accessToken,()=>a.value)};g.value=new MaplibreGeocoder(K,{...ae,maplibregl:ye,showResultsWhileTyping:!0,reverseGeocode:!1})}else g.value=new MapboxGeocoder({accessToken:s.accessToken,mapboxgl,...ae});if(g.value.on("result",ye=>{var pe,ge,Ge,Ve,Ze,Xe,tt,Qe,gt,et,wt,$,E,C,D,W,Z,X,Y,p,h,F,U,se,ne,O,k,R,oe,le;const K=ye==null?void 0:ye.result;K&&((pe=K.place_type)!=null&&pe.includes("doxa-section-header")||(_&&(_.selectedRegion=null,_.selectedResource=null,_.selectedAffinityBlock=null,_.selectedDialect=null),w&&((ge=w.setPrayerFilter)==null||ge.call(w,null),(Ge=w.setEngagementFilter)==null||Ge.call(w,null),(Ve=w.setAdoptionFilter)==null||Ve.call(w,null),(Ze=w.setReligionFilter)==null||Ze.call(w,null)),(Xe=K.properties)!=null&&Xe._allDataSection&&_&&(_.selectedFamily=null,_.selectedLanguage=null),l("result",ye),(tt=K.place_type)!=null&&tt.includes("people-group")&&K.feature?l("people-group-result",{type:"Feature",properties:K.properties||K.feature,geometry:K.geometry||{type:"Point",coordinates:K.center}}):((Qe=K.place_type)!=null&&Qe.includes("doxa-country")||(gt=K.place_type)!=null&>.includes("doxa-region")||(et=K.place_type)!=null&&et.includes("doxa-language-family")||(wt=K.place_type)!=null&&wt.includes("doxa-language")||($=K.place_type)!=null&&$.includes("doxa-dialect")||(E=K.place_type)!=null&&E.includes("doxa-religion")||(C=K.place_type)!=null&&C.includes("doxa-affinity-bloc")||(D=K.place_type)!=null&&D.includes("doxa-cluster")||(W=K.place_type)!=null&&W.includes("doxa-people-group"))&&l("aggregate-result",{kind:K.place_type[0].replace(/^doxa-/,""),label:((Z=K.properties)==null?void 0:Z.label)||K.text,count:((X=K.properties)==null?void 0:X.count)||0,memberIds:((Y=K.properties)==null?void 0:Y.memberIds)||[],bounds:((p=K.properties)==null?void 0:p.bounds)||null,center:K.center,originalLabels:((h=K.properties)==null?void 0:h.originalLabels)||null,familyDerived:((F=K.properties)==null?void 0:F.familyDerived)||"",baseLang:((U=K.properties)==null?void 0:U.baseLang)||"",dialectLabel:((se=K.properties)==null?void 0:se.dialectLabel)||"",slug:((ne=K.properties)==null?void 0:ne.slug)||null,id:K.id||null,blocCode:((O=K.properties)==null?void 0:O.blocCode)||"",blocLabel:((k=K.properties)==null?void 0:k.blocLabel)||"",clusterCode:((R=K.properties)==null?void 0:R.clusterCode)||"",clusterLabel:((oe=K.properties)==null?void 0:oe.clusterLabel)||"",peopleGroupCode:((le=K.properties)==null?void 0:le.peopleGroupCode)||"",properties:K.properties||null})))}),g.value.on("clear",()=>l("clear")),g.value.on("error",ye=>l("error",ye)),s.standalone){if(y.value){const ye={on(){},off(){},fire(){},getContainer:()=>y.value,getZoom:()=>0,getCenter:()=>({lng:0,lat:0}),getBounds:()=>null,flyTo(){},fitBounds(){},addControl(){},removeControl(){},hasControl:()=>!1};try{const K=g.value.onAdd(s.mapInstance||ye);K&&y.value.appendChild(K)}catch(K){l("error",K)}}}else z.addControl(g.value,"top-left")}),ut(i,I=>{var ae,j;const z=g.value;if(!z)return;const V=z._inputEl||((j=(ae=z.container)==null?void 0:ae.querySelector)==null?void 0:j.call(ae,"input.mapboxgl-ctrl-geocoder--input"));V&&(V.placeholder=I,V.setAttribute("placeholder",I)),z.options&&(z.options.placeholder=I)}),ut(a,I=>{const z=g.value;z!=null&&z.options&&(z.options.language=I||"en")}),Lo(()=>{var I,z;if(g.value){try{s.standalone?(z=(I=g.value).onRemove)==null||z.call(I):s.mapInstance&&s.mapInstance.removeControl(g.value)}catch{}g.value=null}}),t({geocoder:g}),(I,z)=>e.standalone?(H(),ee("div",{key:0,ref_key:"standaloneContainer",ref:y,class:"dg-standalone-geocoder"},null,512)):Fn(I.$slots,"default",{},void 0,void 0,1)}},O1=["country_code","wagf_region","wagf_block","primary_language","religion"];function D1(e){return e==null?{value:null,label:null}:typeof e=="object"?{value:e.value??null,label:e.label??null}:{value:e,label:null}}function B1(e){if(e==null||typeof e!="object")return e;const t={...e};for(const o of O1)if(o in t){const{value:n,label:r}=D1(t[o]);t[o]=n,r!=null&&(t[`${o}_label`]=r)}return t}function Zu(e){return Array.isArray(e)?e.map(B1):[]}function Xu(e){return Array.isArray(e)?e:e&&typeof e=="object"?e.posts||e.data||e.records||e.results||e.items||[]:[]}function bn(e){return e==null||typeof e!="object"?null:e.slug??null}function Qu(e){return typeof e=="string"&&e.toLowerCase().includes("deaf")}function j1(e){const t=e==null?null:e.rop1;return t==null?null:typeof t=="object"?t.value??null:t}function oa(e,t){const o=new Set;if(e==null||typeof e!="object"||typeof e.type!="string")throw new Error(`selector-evaluator: malformed selector (expected an object with a string \`type\`), got: ${JSON.stringify(e)}`);const n=Array.isArray(t)?t:[];switch(e.type){case"country_code":{const r=e.value;for(const a of n)if(a&&a.country_code===r){const s=bn(a);s!=null&&o.add(s)}return o}case"country_codes":{const r=new Set(Array.isArray(e.values)?e.values:[]);for(const a of n)if(a&&r.has(a.country_code)){const s=bn(a);s!=null&&o.add(s)}return o}case"wagf_block":{const r=e.value;for(const a of n)if(a&&a.wagf_block===r){const s=bn(a);s!=null&&o.add(s)}return o}case"wagf_region":{const r=e.value;for(const a of n)if(a&&a.wagf_region===r){const s=bn(a);s!=null&&o.add(s)}return o}case"union":{const r=Array.isArray(e.selectors)?e.selectors:[];for(const a of r){const s=oa(a,n);for(const i of s)o.add(i)}return o}case"deaf_predicate":{const r=new Set(Array.isArray(e.regions)?e.regions:[]);for(const a of n){if(!a)continue;if((Qu(a.slug)||Qu(a.name))&&r.has(a.wagf_region)){const i=bn(a);i!=null&&o.add(i)}}return o}case"affinity_bloc":{const r=e.rop1;for(const a of n)if(a&&j1(a)===r){const s=bn(a);s!=null&&o.add(s)}return o}default:throw new Error(`selector-evaluator: unknown selector type "${e.type}" (supported: country_code, country_codes, wagf_block, wagf_region, union, deaf_predicate, affinity_bloc)`)}}const G1=Object.freeze(Object.defineProperty({__proto__:null,default:oa,evaluate:oa},Symbol.toStringTag,{value:"Module"}));function U1(e,t){return`hsl(${Math.round(e*360/(t||1))}, 72%, 56%)`}function lr(e){if(typeof e.count=="number")return e.count;if(typeof e.expected_count=="number")return e.expected_count}function ed(e){const t=parseInt(e&&e.population,10);return Number.isFinite(t)?t:0}function K1(e,t){if(!Array.isArray(t)||t.length===0)return;const o=e&&e.selector;if(o==null)return;if(o.type==="pg_slugs"){const a=new Set(Array.isArray(o.values)?o.values:[]);let s=0;for(const i of t)i&&a.has(i.slug)&&(s+=ed(i));return s}const n=oa(o,t);let r=0;for(const a of t)a&&n.has(a.slug)&&(r+=ed(a));return r}function Gs(e,t={}){const o=t.deafCount??123,n=Array.isArray(t.records)?t.records:null,r=e.lists||[],a=e.asia_lists||[],s=e.uncovered_lists||[],i={type:"affinity_bloc",rop1:"A017"},l=a.filter(j=>j.id.startsWith("asia-india")),c=a.filter(j=>j.id.startsWith("asia-china")),u=[...r.map(j=>j.id),"deaf",...l.map(j=>j.id),...c.map(j=>j.id),...s.map(j=>j.id)],d=u.length,f=j=>U1(u.indexOf(j),d),x=(j,q,A)=>{if(!n)return j;const G=A??(q&&q.selector);return j.pop=K1({selector:G},n),j},b=j=>n?j.reduce((q,A)=>q+(A.pop||0),0):void 0,v=r.map(j=>x({id:j.id,zoneKey:j.id,label:j.label,...j.provinceLabel?{provinceLabel:j.provinceLabel}:{},color:f(j.id),count:lr(j)},j)),_=x({id:"deaf",zoneKey:"deaf",label:"Deaf (affinity bloc A017)",color:f("deaf"),count:o,info:"Unified deaf row — affinity bloc rop1=A017 (collapses the two deaf_lists; zero-delta vs old deaf_predicate). Population double-counts vs geographic rows (design-approved, slice 08)."},null,i),w=j=>x({id:j.id,zoneKey:j.id,label:j.label,...j.provinceLabel?{provinceLabel:j.provinceLabel}:{},color:f(j.id),count:lr(j),...Array.isArray(j.adm0)&&j.adm0.length?{adm0:j.adm0}:{},...Array.isArray(j.provinces)&&j.provinces.length?{provinces:j.provinces}:{}},j),S=l.map(w),m=c.map(w),g=j=>j.reduce((q,A)=>q+(lr(A)||0),0),y={id:"asia-india",label:"India",count:g(l),children:S},L={id:"asia-china",label:"China",count:g(c),children:m};n&&(y.pop=b(S),L.pop=b(m)),g(a),n&&b([y,L]);const P=j=>x({id:j.id,zoneKey:j.id,label:j.label,...j.provinceLabel?{provinceLabel:j.provinceLabel}:{},color:f(j.id),count:lr(j)},j),N=s.map(P);N.length>0&&(()=>{const j={id:"frontier-asia",label:"Frontier Asia (uncovered)",count:g(s),children:N};return n&&(j.pop=b(N)),j})();const M={"west-africa":"Africa",sudan:"Africa","east-africa":"Africa","central-africa":"Africa","southern-africa-islands":"Africa","maghreb-egypt":"Middle East","middle-east-core":"Middle East","uncovered-nas-a":"Central Asia",laos:"Southeast Asia + Oceania","oceania-indonesia":"Southeast Asia + Oceania","mainland-se-asia-philippines":"Southeast Asia + Oceania",brazil:"Americas","andean-caribbean":"Americas","uncovered-scatter":"Americas",europe:"Europe",deaf:"Deaf","deaf-old-world":"Deaf"},I=j=>M[j]||(String(j).startsWith("asia-india-")?"India":String(j).startsWith("asia-china-")?"China + Mongolia":"Other"),z=[...v,_,...S,...m,...N].filter(Boolean),V=new Map;for(const j of z){const q=I(j.id||j.zoneKey);V.has(q)||V.set(q,[]),V.get(q).push(j)}const ae=[...V.entries()].map(([j,q])=>{q.sort((G,re)=>(re.count||0)-(G.count||0));const A={id:"region-"+j.toLowerCase().replace(/[^a-z0-9]+/g,"-"),label:j,count:q.reduce((G,re)=>G+(re.count||0),0),children:q};return n&&(A.pop=b(q)),A}).sort((j,q)=>(q.count||0)-(j.count||0));return H1(td(ae),{withPop:!!n}),ae}function H1(e,{withPop:t=!1}={}){const o=[];for(const n of e||[]){const r=[];(typeof n.id!="string"||!n.id)&&r.push("id"),(typeof n.zoneKey!="string"||!n.zoneKey)&&r.push("zoneKey"),(typeof n.label!="string"||!n.label)&&r.push("label"),(typeof n.color!="string"||!n.color)&&r.push("color"),typeof n.count!="number"&&r.push("count"),t&&typeof n.pop!="number"&&r.push("pop"),r.length&&o.push(`${n.id||"(no-id)"}: missing/!type [${r.join(", ")}]`)}if(o.length)throw new Error(`legend-tree L15: ${o.length} leaf node(s) violate the uniform consumer shape:
`+o.join(`
`));return!0}function td(e){const t=[],o=n=>{for(const r of n)r.children&&r.children.length?o(r.children):t.push(r)};return o(e||[]),t}const od=()=>({type:"FeatureCollection",features:[]});function z1(e,t){const o=oa(e.selector,t),n=new Set;for(const r of t)r&&o.has(r.slug)&&r.country_code&&n.add(r.country_code);return n}function V1(e){return typeof e.id=="string"&&e.id.startsWith("asia-")}function Us(e,t){return{type:"Feature",properties:{...e.properties||{},zoneKey:t.zoneKey??t.id,zoneColor:t.color??t.zoneColor??"#888",zoneLabel:t.label,...t.id==="deaf"?{hatch:!0}:{}},geometry:e.geometry}}function W1(e,t){const{records:o=[],adm0:n,adm1Ind:r,adm1Chn:a}=t||{},s=od();if(V1(e)){const l=[r,a].filter(Boolean);for(const c of l)for(const u of c.features||[])u.properties&&u.properties.listId===e.id&&s.features.push(Us(u,e));if(Array.isArray(e.adm0)&&e.adm0.length&&n){const c=new Set(e.adm0);for(const u of n.features||[])u.properties&&c.has(u.properties.iso3)&&s.features.push(Us(u,e))}return s}if(!e.selector)return s;const i=z1(e,o);if(n&&i.size)for(const l of n.features||[])l.properties&&i.has(l.properties.iso3)&&s.features.push(Us(l,e));return s}function Y1(e,t){const o=od(),n=new Map;for(const r of e){if(r.id==="deaf"){n.set(r.zoneKey??r.id,0);continue}const a=W1(r,t);n.set(r.zoneKey??r.id,a.features.length);for(const s of a.features)o.features.push(s)}return{tapestry:o,perZone:n}}const J1={"andean-caribbean":"#f9a51f","asia-china-tibet-autonomous-region":"#00f0c8","asia-china-yunnan-province":"#22ddff","asia-frontier-nas-a":"#ff1744","asia-india-andhra-pradesh":"#22ddff","asia-india-assam":"#22ddff","asia-india-chhattisgarh":"#536dfe","asia-india-gujarat":"#536dfe","asia-india-karnataka":"#536dfe","asia-india-kerala":"#2196ff","asia-india-madhya-pradesh":"#2196ff","asia-india-maharashtra":"#2196ff","asia-india-odisha":"#2196ff","asia-india-rajasthan":"#22ddff","asia-india-tamil-nadu":"#7c4dff","asia-india-uttarakhand":"#536dfe","asia-india-west-bengal":"#22ddff",brazil:"#f4c57b","central-africa":"#c20001",deaf:"#18ffff","east-africa":"#ef3410",europe:"#34cb74",laos:"#7c4dff","maghreb-egypt":"#602f74","mainland-se-asia-philippines":"#ff1744","middle-east-core":"#bc8bd0","oceania-indonesia":"#ee892f","southern-africa-islands":"#e75556",sudan:"#e69e93","uncovered-central-asia":"#ff8a00","uncovered-himalaya":"#ff6d00","uncovered-japan":"#ffc400","uncovered-mongolia":"#76ff03","uncovered-nas-a":"#ff1744","uncovered-nepal":"#ffea00","uncovered-sa-west":"#ff1744","uncovered-scatter":"#eeff41","west-africa":"#edcac9"};function q1(e,t){const o=J1[e];return typeof o=="string"&&o?o:t}const cr={"Andaman and Nicobar Islands":9,"Andhra Pradesh":81,"Arunāchal Pradesh":7,Assam:15,Bihār:18,Chandīgarh:1,Chhattīsgarh:24,Delhi:1,"Dādra and Nagar Haveli and Damān and Diu":1,Goa:5,Gujarāt:90,Haryāna:4,"Himāchal Pradesh":20,"Jammu and Kashmīr":33,Jhārkhand:9,Karnātaka:81,Kerala:72,Ladākh:6,Lakshadweep:1,"Madhya Pradesh":33,Mahārāshtra:54,Manipur:5,Meghālaya:2,Odisha:64,Puducherry:5,Punjab:4,Rājasthān:48,Sikkim:1,"Tamil Nādu":64,Telangāna:26,Tripura:11,"Uttar Pradesh":23,Uttarākhand:7,"West Bengal":30,"Gansu Province":3,"Guangxi Zhuang Autonomous Region":6,"Guizhou Province":34,"Hainan Province":3,"Heilongjiang Province":2,"Hunan Province":5,"Inner Mongolia Autonomous Region":3,"Qinghai Province":3,"Sichuan Province":12,"Tibet Autonomous Region":13,"Xinjiang Uyghur Autonomous Region":7,"Yunnan Province":61},nd={ABW:1,AFG:21,AGO:10,ALB:1,AND:1,ARE:2,ARM:1,ASM:1,ATG:1,AZE:3,BEN:9,BFA:8,BGD:3,BGR:1,BHR:2,BHS:1,BIH:1,BLM:1,BLR:1,BMU:1,BOL:1,BRA:103,BRB:1,BRN:5,BTN:13,CAF:1,CHN:154,CIV:2,CMR:8,COD:9,COG:2,COK:1,COL:27,COM:3,CUB:1,CUW:1,CYM:1,CYP:1,CZE:1,DJI:1,DMA:1,DZA:17,ECU:1,EGY:3,ERI:8,ESP:1,ETH:29,FIN:1,FJI:1,FRO:1,FSM:1,GAB:2,GEO:1,GGY:1,GHA:1,GIN:13,GLP:1,GMB:3,GNB:3,GNQ:1,GRC:1,GRD:1,GUF:2,GUM:1,GUY:1,IDN:36,IRN:20,IRQ:8,ISL:1,ISR:4,JAM:1,JOR:3,JPN:6,KAZ:1,KEN:5,KGZ:2,KHM:1,KIR:1,KWT:1,LAO:95,LBN:4,LBR:2,LBY:15,LCA:1,LIE:1,LKA:1,LUX:1,MAR:4,MDV:1,MHL:1,MLI:13,MLT:1,MMR:7,MNE:1,MNG:1,MNP:1,MOZ:4,MRT:3,MSR:1,MUS:1,MWI:1,MYS:12,MYT:1,NAM:6,NCL:1,NER:2,NGA:38,NIU:1,NPL:34,NZL:1,OMN:7,PAK:24,PAN:1,PER:10,PHL:1,PLW:1,PNG:1,PRK:1,PRY:1,PSE:4,PYF:1,QAT:3,RUS:21,SAU:3,SDN:105,SEN:1,SHN:1,SLB:1,SLE:2,SMR:1,SOM:9,SSD:22,STP:1,SUR:2,SWE:2,SWZ:1,SYR:5,TCA:1,TCD:53,TGO:6,THA:8,TJK:3,TON:1,TUN:2,TUR:3,TZA:16,UGA:6,USA:3,UZB:1,VCT:1,VEN:6,VGB:1,VIR:1,VNM:16,VUT:1,WLF:1,WSM:1,YEM:9,ZAF:2,ZMB:6,ZWE:3},na={ABW:"Aruba",IND:"India",AFG:"Afghanistan",AGO:"Angola",ALB:"Albania",AND:"Andorra",ARE:"United Arab Emirates",ARM:"Armenia",ASM:"American Samoa",ATG:"Antigua and Barbuda",AZE:"Azerbaijan",BEN:"Benin",BFA:"Burkina Faso",BGD:"Bangladesh",BGR:"Bulgaria",BHR:"Bahrain",BHS:"Bahamas",BIH:"Bosnia and Herzegovina",BLM:"Saint Barthélemy",BLR:"Belarus",BMU:"Bermuda",BOL:"Bolivia",BRA:"Brazil",BRB:"Barbados",BRN:"Brunei",BTN:"Bhutan",CAF:"Central African Republic",CHN:"China",CIV:"Côte d'Ivoire",CMR:"Cameroon",COD:"DR Congo",COG:"Congo",COK:"Cook Islands",COL:"Colombia",COM:"Comoros",CUB:"Cuba",CUW:"Curaçao",CYM:"Cayman Islands",CYP:"Cyprus",CZE:"Czechia",DJI:"Djibouti",DMA:"Dominica",DZA:"Algeria",ECU:"Ecuador",EGY:"Egypt",ERI:"Eritrea",ESP:"Spain",ETH:"Ethiopia",FIN:"Finland",FJI:"Fiji",FRO:"Faroe Islands",FSM:"Micronesia",GAB:"Gabon",GEO:"Georgia",GGY:"Guernsey",GHA:"Ghana",GIN:"Guinea",GLP:"Guadeloupe",GMB:"Gambia",GNB:"Guinea-Bissau",GNQ:"Equatorial Guinea",GRC:"Greece",GRD:"Grenada",GUF:"French Guiana",GUM:"Guam",GUY:"Guyana",IDN:"Indonesia",IRN:"Iran",IRQ:"Iraq",ISL:"Iceland",ISR:"Israel",JAM:"Jamaica",JOR:"Jordan",JPN:"Japan",KAZ:"Kazakhstan",KEN:"Kenya",KGZ:"Kyrgyzstan",KHM:"Cambodia",KIR:"Kiribati",KWT:"Kuwait",LAO:"Laos",LBN:"Lebanon",LBR:"Liberia",LBY:"Libya",LCA:"Saint Lucia",LIE:"Liechtenstein",LKA:"Sri Lanka",LUX:"Luxembourg",MAR:"Morocco",MDV:"Maldives",MHL:"Marshall Islands",MLI:"Mali",MLT:"Malta",MMR:"Myanmar",MNE:"Montenegro",MNG:"Mongolia",MNP:"Northern Mariana Islands",MOZ:"Mozambique",MRT:"Mauritania",MSR:"Montserrat",MUS:"Mauritius",MWI:"Malawi",MYS:"Malaysia",MYT:"Mayotte",NAM:"Namibia",NCL:"New Caledonia",NER:"Niger",NGA:"Nigeria",NIU:"Niue",NPL:"Nepal",NZL:"New Zealand",OMN:"Oman",PAK:"Pakistan",PAN:"Panama",PER:"Peru",PHL:"Philippines",PLW:"Palau",PNG:"Papua New Guinea",PRK:"North Korea",PRY:"Paraguay",PSE:"Palestine",PYF:"French Polynesia",QAT:"Qatar",RUS:"Russia",SAU:"Saudi Arabia",SDN:"Sudan",SEN:"Senegal",SHN:"Saint Helena",SLB:"Solomon Islands",SLE:"Sierra Leone",SMR:"San Marino",SOM:"Somalia",SSD:"South Sudan",STP:"São Tomé and Príncipe",SUR:"Suriname",SWE:"Sweden",SWZ:"Eswatini",SYR:"Syria",TCA:"Turks and Caicos Islands",TCD:"Chad",TGO:"Togo",THA:"Thailand",TJK:"Tajikistan",TON:"Tonga",TUN:"Tunisia",TUR:"Turkey",TZA:"Tanzania",UGA:"Uganda",USA:"United States",UZB:"Uzbekistan",VCT:"Saint Vincent and the Grenadines",VEN:"Venezuela",VGB:"British Virgin Islands",VIR:"U.S. Virgin Islands",VNM:"Vietnam",VUT:"Vanuatu",WLF:"Wallis and Futuna",WSM:"Samoa",YEM:"Yemen",ZAF:"South Africa",ZMB:"Zambia",ZWE:"Zimbabwe"};function ad(e){const t={...na};for(const o of e||[]){const n=o&&o.country_code,r=o&&o.country_code_label;n&&r&&(t[n]=r)}return t}function rd(e,t={}){if(!e||typeof e!="object")return null;const o=t.nameMap||na;if(e.shapeName){const n=String(e.shapeName),r=Object.prototype.hasOwnProperty.call(cr,n)?cr[n]:null;return{key:"adm1:"+n,name:n,count:r,kind:"adm1"}}if(e.iso3){const n=String(e.iso3),r=o[n]||na[n]||n,a=Object.prototype.hasOwnProperty.call(nd,n)?nd[n]:null;return{key:"adm0:"+n,name:r,count:a,kind:"adm0"}}return null}function sd(e,t={}){const o=Array.isArray(e)?e:[],n=o.map(l=>l.name),r=o.reduce((l,c)=>l+(Number(c.count)||0),0),a=t&&typeof t.color=="string"&&t.color?t.color:"",s=n.join(", ")+" — "+r+" UUPG"+(a?" · "+a:""),i=o.map(l=>l.name+" "+(Number(l.count)||0)).join(", ");return s+`
`+i}function yn(e){return String(e??"").normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().trim()}function Z1(e){return yn(e).split(/[\s,;]+/).filter(Boolean)}function X1(e={}){const{records:t=[],leafZones:o=[],adm1Counts:n={},iso3Names:r={},countryNameMap:a=null}=e,s=[],i=new Set;for(const c of t){if(!c)continue;const u=c.slug;if(!u||i.has(u))continue;const d=Number(c.latitude),f=Number(c.longitude);if(!Number.isFinite(d)||!Number.isFinite(f))continue;const x=c.name||u;i.add(u),s.push({label:x,kind:"pg",target:{type:"pg",slug:u,lng:f,lat:d},_hay:yn(x)})}for(const c of o){if(!c)continue;const u=c.zoneKey||c.id,d=c.label||u;u&&s.push({label:d,kind:"zone",target:{type:"zone",zoneId:u},_hay:yn(d)})}for(const c of Object.keys(n))s.push({label:c,kind:"territory",target:{type:"territory",shapeName:c},_hay:yn(c)});const l=a||r;for(const c of Object.keys(r)){const u=l&&l[c]||r[c]||c;s.push({label:u,kind:"territory",target:{type:"territory",shapeName:c,iso3:!0},_hay:yn(u)})}return s}const Q1={zone:0,territory:1,pg:2};function ek(e={}){const{records:t=[],leafZones:o=[],adm1Counts:n={},iso3Names:r={},countryNameMap:a=null,centroidFor:s=null}=e,i=[];for(const u of t)u&&i.push(u);const l=(u,d,f)=>!d||!Number.isFinite(d[0])||!Number.isFinite(d[1])?null:{name:u,slug:f.__synthSlug,latitude:d[1],longitude:d[0],...f};for(const u of o){if(!u)continue;const d=u.zoneKey||u.id,f=u.label||d;if(!d)continue;const x=typeof s=="function"?s(v=>v&&v.properties&&v.properties.zoneKey===d):null,b=l(f,x,{__upgKind:"zone",__zoneId:d,__synthSlug:`__zone__${d}`});b&&i.push(b)}for(const u of Object.keys(n)){const d=typeof s=="function"?s(x=>x&&x.properties&&x.properties.shapeName===u):null,f=l(u,d,{__upgKind:"territory",__shapeName:u,__synthSlug:`__terr__${u}`});f&&i.push(f)}const c=a||r;for(const u of Object.keys(r)){const d=c&&c[u]||r[u]||u,f=typeof s=="function"?s(b=>b&&b.properties&&b.properties.iso3===u):null,x=l(d,f,{__upgKind:"territory",__shapeName:u,__synthSlug:`__terr__${u}`});x&&i.push(x)}return i}function id(e,t,o={}){const n=o.limit??8,r=Z1(t);if(!r.length)return[];const a=r[0],s=[];for(const i of e){let l=!0;for(const d of r)if(!i._hay.includes(d)){l=!1;break}if(!l)continue;const c=i._hay.startsWith(a)?0:1,u=i._hay===yn(t)?-1:0;s.push({e:i,starts:c,exact:u,kr:Q1[i.kind]??9,len:i._hay.length})}return s.sort((i,l)=>i.exact-l.exact||i.starts-l.starts||i.kr-l.kr||i.len-l.len),s.slice(0,n).map(i=>i.e)}const tk="rgba(120, 128, 134, 0.28)",ld="36px",cd=()=>{};function ok(e,t={}){const{enabled:o=!0}=t;if(!o||!e)return cd;const n=Array.from(e.querySelectorAll(".map-scroll-edge"));if(!n.length)return cd;const r=S=>S.classList.contains("map-scroll-edge--left");for(const S of n)S.style.background=`linear-gradient(${r(S)?"to right":"to left"}, ${tk} ${ld}, transparent ${ld})`,S.style.opacity="0",S.style.transition="opacity 0.16s ease",S.style.userSelect="none",S.style.webkitUserSelect="none";const a=S=>{S.style.opacity="1"},s=S=>{S.style.opacity="0"},i=()=>n.find(S=>!r(S))||null,l=new Set;let c=!1,u=null;const d=()=>{for(const S of n)l.has(S)||s(S)},f=()=>{const S=i();S&&(a(S),u&&clearTimeout(u),u=setTimeout(d,250))},x=()=>f(),b=S=>{if(!(S.touches&&S.touches.length===1))return;const m=S.target;m&&m.classList&&m.classList.contains("map-scroll-edge")||f()},v=()=>{u&&clearTimeout(u),d()};e.addEventListener("wheel",x,{passive:!0}),e.addEventListener("touchmove",b,{passive:!0}),e.addEventListener("touchend",v,{passive:!0}),e.addEventListener("touchcancel",v,{passive:!0});const _=()=>{c||f()};typeof window<"u"&&window.addEventListener("scroll",_,{passive:!0});const w=[];for(const S of n){const m=()=>{l.add(S),a(S)},g=()=>{l.delete(S),s(S)},y=()=>{c=!0,a(S)},L=()=>{c=!1,s(S)};S.addEventListener("mouseenter",m),S.addEventListener("mouseleave",g),S.addEventListener("touchstart",y,{passive:!0}),S.addEventListener("touchend",L,{passive:!0}),w.push(()=>{S.removeEventListener("mouseenter",m),S.removeEventListener("mouseleave",g),S.removeEventListener("touchstart",y),S.removeEventListener("touchend",L)})}return function(){u&&(clearTimeout(u),u=null),e.removeEventListener("wheel",x),e.removeEventListener("touchmove",b),e.removeEventListener("touchend",v),e.removeEventListener("touchcancel",v),typeof window<"u"&&window.removeEventListener("scroll",_);for(const m of w)m();for(const m of n)s(m)}}const nk={class:"upg-root"},ak={key:0,class:"upg-map-err"},rk={class:"upg-legend-desktop-slot"},sk={class:"upg-legend-mobile-slot"},ik={class:"upg-detail-desktop-slot"},lk={key:4,class:"upg-hud"},ck={key:0,class:"upg-hud-head"},uk={class:"upg-hud-total"},dk={key:1,class:"upg-hud-names"},pk={key:2,class:"upg-hud-swatches"},gk=["data-color","title","onClick"],fk={key:3,class:"upg-hud-actions"},hk={key:4,class:"upg-hud-flash"},mk={class:"upg-status"},Ks="upg-search",ud="My UPG 100 List — Legend",bk="people-groups",yk="Search people group, zone, or territory…",dd=8,Hs=123,_k=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"upg-100-list",setup(e){const t=Gi(()=>wn(()=>Promise.resolve().then(()=>Ev),void 0)),o={lists:pu,asia_lists:gu,uncovered_lists:fu},n=Ee("mapboxToken",ue("")),r=Ee("profileConfig",ue(null)),a=Q(()=>{var B;const J=(B=r.value)==null?void 0:B.edgeScrollAffordance;return J==null?!0:!(J===!1||J==="false")}),s=Ee("dataStore",null),i=Ee("uiStore",null),l=ue(null),c=ue("loading…"),u=ue(""),d=En([]),f=ue(null),x=En(null),b=ue(!1),v=Fy("my-upg-100-list");v.theme.value="light",Oy(v);const _=ue([]),w=Q(()=>_.value.reduce((J,B)=>J+(Number(B.count)||0),0)),S=Q(()=>_.value.length),m=ue("");let g=null;const y=ue(!1);function L(J){const B=J===void 0?!y.value:!!J;return B===y.value||(y.value=B,A&&(A.getCanvas().style.cursor=""),tt()),B}function P(){L()}ut([y,b],()=>{jo(()=>R())});function N(J){if(!J)return;const B=_.value,te=B.findIndex(ie=>ie.key===J.key);te>=0?_.value=B.filter((ie,$e)=>$e!==te):_.value=[...B,J],tt(),m.value=""}const M=["#e69f00","#56b4e9","#009e73","#f0e442","#0072b2","#d55e00","#cc79a7","#999999"],I=ue(""),z=ue("");function V(J){const B=/^#?([0-9a-fA-F]{6})$/.exec(String(J||"").trim());if(!B)return;const te="#"+B[1].toLowerCase();I.value=I.value===te?"":te,tt()}function ae(){/^#?[0-9a-fA-F]{6}$/.test(z.value.trim())&&V(z.value)}const j=ue(null);let q=[],A=null,G=null,re=[],ye=null,K=null,pe=null;const ge=typeof window<"u"&&window.MAP_APP_API_URL||"https://pray.doxa.life";At(`.upg-root{position:absolute;inset:0;background:#0a1410;color:#e5e7eb;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif}.upg-map{position:absolute;inset:0}.upg-map-err{position:absolute;left:0;right:0;top:50%;transform:translateY(-50%);z-index:1;pointer-events:none;text-align:center;padding:0 24px;font:13px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;color:#9aa7b8}.upg-map-err strong{display:block;font-size:14px;color:#cbd5e1;margin-bottom:4px}.map-scroll-edge{position:absolute;top:0;bottom:0;width:40px;z-index:2;touch-action:pan-y;pointer-events:auto;background:transparent}.map-scroll-edge--left{left:0}.map-scroll-edge--right{right:0}.upg-legend-mobile-slot{display:none}@media(max-width:767px){.upg-legend-mobile-slot{display:block}.upg-legend-desktop-slot{display:none}.upg-detail-desktop-slot{display:none}}.upg-status{position:absolute;bottom:10px;right:10px;z-index:5;font:10px/1 ui-monospace,monospace;color:#9aa7b8;background:rgba(10,14,21,.82);padding:6px 10px;border-radius:8px}.upg-detail-panel{position:absolute;top:60px;right:8px;bottom:10px;width:340px;max-width:calc(100vw - 16px);z-index:6;background:#fff;border-radius:12px;box-shadow:0 8px 28px rgba(0,0,0,.45);overflow:hidden;display:flex;flex-direction:column;animation:upgPanelIn .18s ease}.upg-detail-panel.dark{background:#1a1a2e}@keyframes upgPanelIn{from{transform:translateX(16px);opacity:0}to{transform:translateX(0);opacity:1}}@media(max-width:480px){.upg-detail-panel{top:auto;left:8px;right:8px;width:auto;height:55vh}}.upg-hud{position:absolute;bottom:34px;right:10px;z-index:6;min-width:150px;font:11px/1.35 ui-monospace,monospace;color:#e5e7eb;background:rgba(10,20,16,.92);border:1px solid rgba(110,231,183,.35);border-radius:10px;padding:8px 10px;box-shadow:0 4px 16px rgba(0,0,0,.4)}.upg-hud-head{display:flex;align-items:baseline;gap:6px;white-space:nowrap}.upg-hud-total{font-size:15px;font-weight:700;color:#6ee7b7}.upg-hud-band{margin-left:auto;font-size:9px;color:#9aa7b8}.upg-hud-band.ok{color:#6ee7b7}.upg-hud-names{margin-top:5px;max-height:84px;overflow:auto;font-size:10px;color:#cbd5e1;line-height:1.45;word-break:break-word}.upg-hud-actions{display:flex;gap:6px;margin-top:7px}.upg-hud-btn{flex:1;cursor:pointer;border:1px solid rgba(110,231,183,.4);background:rgba(16,185,129,.18);color:#d1fae5;font:12px/1 ui-monospace,monospace;padding:0 10px;min-height:40px;border-radius:8px}.upg-hud-btn:hover{background:rgba(16,185,129,.32)}.upg-hud-btn.clear{background:rgba(148,163,184,.12);border-color:rgba(148,163,184,.4);color:#cbd5e1}.upg-hud-flash{margin-top:5px;font-size:9px;color:#6ee7b7;min-height:11px}.upg-hud-hint{margin-top:4px;font-size:9px;color:#64748b}.upg-hud-swatches{display:flex;gap:6px;margin-top:7px;align-items:center;flex-wrap:wrap}.upg-swatch{width:40px;height:40px;border-radius:9px;cursor:pointer;padding:0;border:1px solid rgba(255,255,255,.3)}.upg-swatch.active{outline:2px solid #fff;outline-offset:1px}.upg-hex{width:84px;min-height:40px;background:rgba(148,163,184,.12);border:1px solid rgba(148,163,184,.4);color:#cbd5e1;font:12px/1 ui-monospace,monospace;padding:0 8px;border-radius:8px}@media(max-width:480px){.upg-hud{left:8px;right:8px;min-width:0;bottom:30px;max-height:48vh;overflow:auto}}.map-toolbar .mcb.upg-batch-on{background:#10b981!important;color:#04241a!important;box-shadow:0 0 0 2px rgba(52,211,153,.45),0 1px 4px rgba(0,0,0,0.2)!important}.map-toolbar .mcb.upg-batch-on.dark{border-color:#34d399!important}.upg-batch-row{position:relative;background:rgba(16,185,129,.16)!important;opacity:1!important;box-shadow:inset 3px 0 0 0 #10b981}.upg-batch-row .stl-name{color:#065f46!important;font-weight:700}.stl-panel[data-theme="dark"] .upg-batch-row .stl-name,.upg-batch-row.dark .stl-name{color:#6ee7b7!important}.upg-batch-row .stl-dot{box-shadow:0 0 0 2px #10b981}.mapboxgl-ctrl-top-left{top:12px!important;left:8px!important;width:380px!important;max-width:380px!important;z-index:1200!important}.mapboxgl-ctrl-top-left .mapboxgl-ctrl{margin:0!important;float:none!important}.stl-panel{top:58px!important}.dg-main{font:13px/1.3 ui-monospace,monospace}.dg-meta{margin-top:2px;font-size:11px;color:#475569;display:flex;flex-wrap:wrap;gap:8px}.dg-field strong{font-weight:700}.dg-section-header-item{padding:4px 8px;font:10px/1.2 ui-monospace,monospace;letter-spacing:.06em;text-transform:uppercase;color:#94a3b8;pointer-events:none}`);function Ge(J){const B=[];for(const te of J)B.push(te.zoneKey,q1(te.zoneKey,te.color));return["match",["get","zoneKey"],...B,"#9ca3af"]}function Ve(){if(A.getSource("tapestry"))return;A.addSource("tapestry",{type:"geojson",data:G});const J=b.value?.45:.3,B=b.value?.65:.45;A.addLayer({id:"tapestry-fill",type:"fill",source:"tapestry",paint:{"fill-color":ye,"fill-opacity":["case",["==",["get","zoneKey"],"deaf"],J,B]}}),A.addLayer({id:"tapestry-line",type:"line",source:"tapestry",paint:{"line-color":ye,"line-width":1.2,"line-opacity":.9}})}function Ze(){!A||!A.getSource("tapestry")||A.getLayer("upg-sel-fill")||(A.addLayer({id:"upg-sel-fill",type:"fill",source:"tapestry",filter:["boolean",!1],paint:{"fill-color":"#f59e0b","fill-opacity":.28}}),A.addLayer({id:"upg-sel-line",type:"line",source:"tapestry",filter:["boolean",!1],paint:{"line-color":"#fbbf24","line-width":2.4,"line-opacity":.95}}))}function Xe(){const J=[],B=[],te=[];for(const $e of _.value)$e.kind==="adm1"?J.push($e.name):$e.kind==="adm0"?B.push($e.key.slice(5)):$e.kind==="zone"&&te.push($e.key.slice(5));const ie=[];return J.length&&ie.push(["in",["get","shapeName"],["literal",J]]),B.length&&ie.push(["in",["get","iso3"],["literal",B]]),te.length&&ie.push(["in",["get","zoneKey"],["literal",te]]),ie.length?ie.length===1?ie[0]:["any",...ie]:["boolean",!1]}function tt(){if(R(),!A||!A.getLayer("upg-sel-fill"))return;const J=y.value?Xe():["boolean",!1];A.setFilter("upg-sel-fill",J),A.setFilter("upg-sel-line",J);const B=I.value;A.setPaintProperty("upg-sel-fill","fill-color",B||"#f59e0b"),A.setPaintProperty("upg-sel-fill","fill-opacity",B?.55:.28),A.setPaintProperty("upg-sel-line","line-color",B||"#fbbf24")}let Qe=null,gt=!1;function et(){if(!(!A||!A.getLayer("tapestry-fill"))){if(Qe)try{A.off("click","tapestry-fill",Qe)}catch{}Qe=J=>{const B=J&&J.features&&J.features[0];if(B&&y.value){const te=rd(B.properties,{nameMap:g});if(!te){console.warn("[batch-select] clicked feature has no shapeName/iso3",B.properties);return}te.count==null&&console.warn("[batch-select] no UUPG count for territory",te.name,B.properties),N(te)}},A.on("click","tapestry-fill",Qe),gt||(A.on("mouseenter","tapestry-fill",()=>{A&&(A.getCanvas().style.cursor=y.value?"crosshair":"")}),A.on("mouseleave","tapestry-fill",()=>{A&&(A.getCanvas().style.cursor="")}),gt=!0)}}function wt(){_.value=[],m.value="",I.value="",z.value="",tt()}async function $(){if(!_.value.length)return;const J=sd(_.value,{color:I.value});typeof window<"u"&&(window.__UPG_LAST_CLIPBOARD__=J);let B=!1;try{navigator.clipboard&&navigator.clipboard.writeText?(await navigator.clipboard.writeText(J),B=!0):B=E(J)}catch{B=E(J)}m.value=B?"Copied!":"Copy failed — press Ctrl/Cmd-C",setTimeout(()=>{m.value.startsWith("Copied")&&(m.value="")},1800)}function E(J){try{const B=document.createElement("textarea");B.value=J,B.style.position="fixed",B.style.opacity="0",B.style.top="0",document.body.appendChild(B),B.focus(),B.select();const te=document.execCommand&&document.execCommand("copy");return document.body.removeChild(B),!!te}catch{return!1}}function C(J){if(s&&typeof s.cacheSourceData=="function"){const B=ek({records:J,leafZones:re,adm1Counts:cr,iso3Names:na,countryNameMap:g,centroidFor:te=>{const ie=F(te);return ie?[(ie[0][0]+ie[1][0])/2,(ie[0][1]+ie[1][1])/2]:null}});s.cacheSourceData(Ks,{normalizedData:B})}q=X1({records:J,leafZones:re,adm1Counts:cr,iso3Names:na,countryNameMap:g}),typeof window<"u"&&(window.__UPG_SEARCH__={size:()=>q.length,counts:()=>{const B={pg:0,zone:0,territory:0};for(const te of q)B[te.kind]=(B[te.kind]||0)+1;return B},query:B=>id(q,B,{limit:dd}).map(te=>({label:te.label,kind:te.kind,target:te.target})),select:B=>{const te=id(q,B,{limit:dd})[0];return te?(X(te.target),{label:te.label,kind:te.kind,target:te.target}):null},feedSize:()=>{const B=s&&s.sources&&s.sources[Ks];return B&&Array.isArray(B.features)&&B.features.length||0},localGeocoder:B=>{const te=j.value&&j.value.geocoder,ie=te&&te.options&&te.options.localGeocoder;return ie?ie(B).map($e=>$e&&$e.place_name):null}})}function D(J){const B=J&&J.properties||{},te=B.__upgKind;if(te==="zone")p(B.__zoneId);else if(te==="territory")h(B.__shapeName);else{const ie=J&&J.geometry,$e=ie&&Array.isArray(ie.coordinates)?ie.coordinates:null;$e&&Number.isFinite($e[0])&&Number.isFinite($e[1])&&A&&A.flyTo({center:[$e[0],$e[1]],zoom:6,duration:800}),Y(B.slug)}}function W(J){if(!J||!A)return;const B=new Set(J.memberIds||[]);if(!B.size)return;let te=[];try{te=A.querySourceFeatures("upg").filter(Fe=>{const he=Fe.properties||{};return B.has(he.slug)||B.has(he.id)||B.has(he.peopleGroupId)})}catch{return}if(!te.length)return;let ie=180,$e=90,Nt=-180,bt=-90,Re=!1;for(const Fe of te){const he=Fe.geometry&&Fe.geometry.coordinates;!Array.isArray(he)||!Number.isFinite(he[0])||!Number.isFinite(he[1])||(he[0]Nt&&(Nt=he[0]),he[1]<$e&&($e=he[1]),he[1]>bt&&(bt=he[1]),Re=!0)}Re&&A.fitBounds([[ie,$e],[Nt,bt]],{padding:60,duration:800,maxZoom:6})}function Z(){Ae(null),i&&typeof i.selectPeopleGroup=="function"&&i.selectPeopleGroup(null)}function X(J){!J||!A||(J.type==="pg"?(Number.isFinite(J.lng)&&Number.isFinite(J.lat)&&A.flyTo({center:[J.lng,J.lat],zoom:6,duration:800}),Y(J.slug)):J.type==="zone"?p(J.zoneId):J.type==="territory"&&h(J.shapeName))}function Y(J){if(!J||!i||typeof i.selectPeopleGroup!="function")return;const B=A&&A.getSource&&A.getSource("upg"),ie=(B&&B._data&&B._data.features||[]).find($e=>$e.properties&&$e.properties.slug===J);ie&&i.selectPeopleGroup(ie)}function p(J){if(!J||!A||!G)return;const B=F(te=>te.properties&&te.properties.zoneKey===J);B&&A.fitBounds(B,{padding:40,duration:800,maxZoom:6})}function h(J){if(!J||!A||!G)return;const B=F(te=>{const ie=te.properties||{};return ie.shapeName===J||ie.iso3===J});B&&A.fitBounds(B,{padding:40,duration:800,maxZoom:6})}function F(J){let B=180,te=90,ie=-180,$e=-90,Nt=!1;const bt=Re=>{if(typeof Re[0]=="number"){const[Fe,he]=Re;Feie&&(ie=Fe),he$e&&($e=he),Nt=!0;return}for(const Fe of Re)bt(Fe)};for(const Re of G.features)J(Re)&&bt(Re.geometry.coordinates);return Nt?[[B,te],[ie,$e]]:null}function U(J){const B=new Set,te=ie=>{ie.children&&ie.children.length?ie.children.forEach(te):B.add(ie.zoneKey??ie.id)};return te(J),B}let se=null;function ne(J){if(![...U(J)].length)return;const te=[],ie=Re=>{Re.children&&Re.children.length?Re.children.forEach(ie):te.push(Re)};ie(J);const $e=_.value,Nt=new Set($e.filter(Re=>Re.kind==="zone").map(Re=>Re.key));if(te.every(Re=>Nt.has("zone:"+(Re.zoneKey??Re.id)))){const Re=new Set(te.map(Fe=>"zone:"+(Fe.zoneKey??Fe.id)));_.value=$e.filter(Fe=>!Re.has(Fe.key))}else{const Re=te.filter(Fe=>!Nt.has("zone:"+(Fe.zoneKey??Fe.id))).map(Fe=>({key:"zone:"+(Fe.zoneKey??Fe.id),name:Fe.label||Fe.id,count:Number(Fe.count)||0,kind:"zone"}));_.value=[...$e,...Re]}tt(),m.value=""}function O(){const J=new Set;for(const B of _.value)B.kind==="zone"&&J.add(B.key.slice(5));return J}function k(){const J=new Map,B=te=>{const ie=U(te);te.label&&J.set(te.label,ie),te.children&&te.children.length&&te.children.forEach(B)};for(const te of d.value)B(te);return J}function R(){if(typeof document>"u")return;const J=document.querySelector("my-upg-100-list-map"),te=(J&&J.shadowRoot||document).querySelectorAll(".stl-row");if(!te.length)return;if(!y.value){te.forEach(bt=>bt.classList.remove("upg-batch-row"));return}const ie=O(),$e=k(),Nt=b.value;te.forEach(bt=>{const Re=bt.querySelector(".stl-name"),Fe=Re?Re.textContent.trim():"",he=Fe&&$e.get(Fe),We=!!(he&&he.size&&[...he].every(st=>ie.has(st)));bt.classList.toggle("upg-batch-row",We),bt.classList.toggle("dark",We&&Nt)})}let oe=null;function le(){if(typeof document>"u"||oe)return;const J=document.querySelector("my-upg-100-list-map"),te=(J&&J.shadowRoot||document).querySelector(".stl-rows");te&&(oe=new MutationObserver(()=>{requestAnimationFrame(()=>R())}),oe.observe(te,{childList:!0,subtree:!0}))}Dt("onSemanticTreeSelect",Ae);function fe(J){var $e;const B=f.value;if(!B)return;if(J==="packet"){c.value="Prayer List — coming soon",setTimeout(()=>{c.value=""},2600);return}const te=String((($e=r.value)==null?void 0:$e.assetsBase)||"./assets").replace(/\/+$/,""),ie=document.createElement("a");ie.href=`${te}/posters/${B}.webp`,ie.download=`doxa-upg-100-${B}-poster.webp`,document.body.appendChild(ie),ie.click(),ie.remove()}function Ae(J){if(!A||!A.getLayer("tapestry-fill"))return;if(y.value){J&&ne(J);return}if(!J){se=null,f.value=null,A.setFilter("tapestry-fill",null),A.setFilter("tapestry-line",null),A.setPaintProperty("upg-pins","circle-opacity",.85);return}se=J;const B=[...U(J)];f.value=B.length===1?B[0]:J.id??null;const te=["in",["get","zoneKey"],["literal",B]];A.setFilter("tapestry-fill",te),A.setFilter("tapestry-line",te),A.getLayer("upg-pins")&&A.setPaintProperty("upg-pins","circle-opacity",["case",["in",["get","zoneKey"],["literal",B]],.95,.05]);const ie=F($e=>B.includes($e.properties.zoneKey));ie&&A.fitBounds(ie,{padding:40,duration:700,maxZoom:6})}function we(){!A||!G||(Ve(),typeof pe=="function"&&pe(),Ze(),et(),tt(),f.value&&A.getLayer("tapestry-fill")&&Ae(se))}function ft(){A&&(b.value=!b.value,v.theme.value=b.value?"dark":"light",A.setStyle(b.value?"mapbox://styles/mapbox/dark-v11":"mapbox://styles/mapbox/light-v11"),A.once("style.load",we))}function Ie(){!A||!A.getLayer("upg-pins")||(A.on("click","upg-pins",J=>{const B=J&&J.features&&J.features[0];B&&i&&typeof i.selectPeopleGroup=="function"&&i.selectPeopleGroup(B)}),A.on("mouseenter","upg-pins",()=>{A&&(A.getCanvas().style.cursor="pointer")}),A.on("mouseleave","upg-pins",()=>{A&&(A.getCanvas().style.cursor="")}))}let Ke=null;function _n(J){var ie;const B=((ie=J==null?void 0:J.detail)==null?void 0:ie.listId)??null;if(!B){Ae(null);return}const te=aa(d.value,B);te&&Ae(te)}function aa(J,B){for(const te of J||[]){if((te.zoneKey||te.id)===B)return te;const ie=te.children&&aa(te.children,B);if(ie)return ie}return null}function Tk(){const J=Gs(o,{deafCount:Hs});d.value=J,re=td(J);const B={};for(const te of o.lists||[])B[te.id]=te.selector;for(const te of o.asia_lists||[])B[te.id]=te.selector;for(const te of o.uncovered_lists||[])B[te.id]=te.selector;B.deaf={type:"affinity_bloc",rop1:"A017"};for(const te of re)te.selector=B[te.id];ye=Ge(re)}async function fd(){try{const B=await fetch(`${ge}/api/people-groups/list?fields=slug,name,country_code,wagf_region,wagf_block,rop1,population,latitude,longitude&lang=en`,{cache:"no-store"});if(!B.ok)throw new Error(`list ${B.status}`);const te=Zu(Xu(await B.json()));g=ad(te),d.value=Gs(o,{deafCount:Hs,records:te})}catch{}}return to(async()=>{var $e,Nt,bt,Re,Fe;Tk();const J=window.mapboxgl,B=(n==null?void 0:n.value)||(($e=r==null?void 0:r.value)==null?void 0:$e.tk)||"";if(!J){c.value="⚠ mapbox-gl not loaded",u.value="mapbox-gl did not load. The list and legend are unaffected.",fd();return}if(!B){c.value="⚠ no mapbox token",u.value="No Mapbox token configured. The list and legend are unaffected.",fd();return}J.accessToken=B;try{const he=l.value&&l.value.getRootNode();if(he instanceof ShadowRoot){const We="https://api.mapbox.com/mapbox-gl-js/v3.3.0/mapbox-gl.css";if(!he.querySelector(`link[href="${We}"]`)){const st=document.createElement("link");st.rel="stylesheet",st.href=We,he.prepend(st)}}}catch{}A=new J.Map({container:l.value,style:"mapbox://styles/mapbox/light-v11",center:[35,20],zoom:1.5,projection:"mercator"}),x.value=A,K=ok(((Nt=l.value)==null?void 0:Nt.parentElement)||null,{enabled:a.value}),typeof window<"u"&&(window.__UPG_MAP__=A),window.__UPG_SELECT__={get list(){return _.value.map(he=>({...he}))},get total(){return w.value},get count(){return S.value},get color(){return I.value},get batchMode(){return y.value},setColor:he=>V(he),setBatchMode:he=>L(he),clipboardText:()=>sd(_.value,{color:I.value}),clear:()=>wt(),toggleByProps:he=>{const We=rd(he,{nameMap:g});return We?(N(We),{...We}):null},toggleLegendRow:he=>{const We=Fo=>{for(const at of Fo){if(at.label===he)return at;if(at.children&&at.children.length){const lo=We(at.children);if(lo)return lo}}return null},st=We(d.value);return st?(ne(st),{label:st.label,zoneKeys:[...U(st)]}):null},markedLegendRows:()=>{if(typeof document>"u")return[];const he=document.querySelector("my-upg-100-list-map");return[...(he&&he.shadowRoot||document).querySelectorAll(".stl-row.upg-batch-row .stl-name")].map(st=>st.textContent.trim())},highlightFeatureCount:()=>{if(!A||!G||!A.getLayer("upg-sel-fill"))return-1;const he=new Set,We=new Set,st=new Set;for(const at of _.value)at.kind==="zone"?he.add(at.key.slice(5)):at.kind==="adm1"?We.add(at.name):at.kind==="adm0"&&st.add(at.key.slice(5));let Fo=0;for(const at of G.features){const lo=at.properties||{};(he.has(lo.zoneKey)||We.has(lo.shapeName)||st.has(lo.iso3))&&Fo++}return Fo},zoneKeysForRow:he=>{const We=Fo=>{for(const at of Fo){if(at.label===he)return at;if(at.children&&at.children.length){const lo=We(at.children);if(lo)return lo}}return null},st=We(d.value);return st?[...U(st)]:null}};try{c.value="loading boundaries…";const he=Oe=>{var it;return`${String(((it=r.value)==null?void 0:it.assetsBase)||"./assets").replace(/\/+$/,"")}/boundaries/${Oe}`},We=Oe=>fetch(he(Oe)).then(it=>{if(!it.ok)throw new Error(`boundary fetch ${it.status} ${Oe}`);return it.json()}),[st,Fo,at]=await Promise.all([We("world-adm0.geojson"),We("gb-IND-ADM1.geojson"),We("gb-CHN-ADM1.geojson")]);c.value="fetching 2106 UUPGs…";const zs=await fetch(`${ge}/api/people-groups/list?fields=slug,name,country_code,wagf_region,wagf_block,rop1,population,latitude,longitude&lang=en`,{cache:"no-store"});if(!zs.ok)throw new Error(`list ${zs.status}`);const vn=Zu(Xu(await zs.json()));g=ad(vn),d.value=Gs(o,{deafCount:Hs,records:vn});const{tapestry:Ek,perZone:Pk}=Y1(re,{records:vn,adm0:st,adm1Ind:Fo,adm1Chn:at});G=Do(Ek),C(vn);const Vs=[],ra={},{evaluate:Nk}=await wn(async()=>{const{evaluate:Oe}=await Promise.resolve().then(()=>G1);return{evaluate:Oe}},void 0);for(const Oe of re)if(Oe.selector&&Oe.selector.type==="pg_slugs")for(const it of Oe.selector.values||[])it in ra||(ra[it]=Oe.zoneKey);else try{for(const it of Nk(Oe.selector,vn))it in ra||(ra[it]=Oe.zoneKey)}catch(it){console.warn("zone selector skipped",Oe.id,it&&it.message)}for(const Oe of vn){const it=Number(Oe.latitude),Ys=Number(Oe.longitude);!isFinite(it)||!isFinite(Ys)||Vs.push({type:"Feature",geometry:{type:"Point",coordinates:[Ys,it]},properties:{slug:Oe.slug,zoneKey:ra[Oe.slug]||"",name:Oe.name||Oe.slug||"",population:Oe.population??0,countryName:Oe.country_code_label||"",country:Oe.country_code||""}})}const Mk=Do({type:"FeatureCollection",features:Vs});pe=()=>{A.getSource("upg")||(A.addSource("upg",{type:"geojson",data:Mk}),A.addLayer({id:"upg-pins",type:"circle",source:"upg",paint:{"circle-radius":["interpolate",["linear"],["zoom"],1,2.5,4,4,8,6],"circle-color":ye,"circle-opacity":.85,"circle-stroke-width":.6,"circle-stroke-color":"rgba(255,255,255,0.6)"}}),Ie())};let Ws=!0;const kn=()=>{Ws&&(Ws=!1,A.off("style.load",kn),A.off("idle",kn),we())};if(A.isStyleLoaded())kn();else{A.once("style.load",kn),A.once("idle",kn);const Oe=setInterval(()=>{if(!Ws||!A){clearInterval(Oe);return}let it=!1;try{it=A.isStyleLoaded()}catch{clearInterval(Oe);return}it&&(clearInterval(Oe),kn())},120);setTimeout(()=>clearInterval(Oe),15e3)}const Ik=[...Pk.values()].filter(Oe=>Oe>=1).length;c.value=`${G.features.length} polys · ${Ik}/26 zones · ${Vs.length} pins`}catch(he){c.value="⚠ "+(he&&he.message?he.message:String(he))}let te=0;const ie=()=>{const he=typeof document<"u"&&document.querySelector("my-upg-100-list-map"),We=he&&he.shadowRoot||(typeof document<"u"?document:null);if(We&&We.querySelector(".stl-rows")){le(),R();return}te++<40&&setTimeout(ie,250)};ie();{const he=(Fe=(Re=(bt=l.value)==null?void 0:bt.getRootNode)==null?void 0:Re.call(bt))==null?void 0:Fe.host;he&&(Ke=_n,he.addEventListener("doxa:select-zone",Ke))}}),Lo(()=>{var J,B,te;if(Ke){const ie=(te=(B=(J=l.value)==null?void 0:J.getRootNode)==null?void 0:B.call(J))==null?void 0:te.host;ie==null||ie.removeEventListener("doxa:select-zone",Ke),Ke=null}if(oe){try{oe.disconnect()}catch{}oe=null}if(K){try{K()}catch{}K=null}A&&(A.remove(),A=null),G=null}),(J,B)=>{var te;return H(),ee("div",nk,[T("div",{ref_key:"mapEl",ref:l,class:"upg-map"},null,512),u.value?(H(),ee("div",ak,[B[1]||(B[1]=T("strong",null,"Map unavailable",-1)),dt(ce(u.value),1)])):me("",!0),a.value?(H(),ee(Le,{key:1},[B[2]||(B[2]=T("div",{class:"map-scroll-edge map-scroll-edge--left"},null,-1)),B[3]||(B[3]=T("div",{class:"map-scroll-edge map-scroll-edge--right"},null,-1))],64)):me("",!0),x.value?(H(),lt(F1,{key:2,ref_key:"geocoderRef",ref:j,"map-instance":x.value,"access-token":be(n)||((te=be(r))==null?void 0:te.tk)||"","data-source-id":Ks,"is-dark":b.value,placeholder:yk,"active-context":bk,onPeopleGroupResult:D,onAggregateResult:W,onClear:Z},null,8,["map-instance","access-token","is-dark"])):me("",!0),x.value?(H(),lt(zv,{key:3},{default:Kt(()=>[Be(Wv,{map:x.value,"is-dark":b.value},null,8,["map","is-dark"]),Be(Yv,{map:x.value,"is-dark":b.value},null,8,["map","is-dark"]),Be(Jv,{map:x.value,"is-dark":b.value},null,8,["map","is-dark"]),Be(Xv,{"map-container":l.value,"is-dark":b.value},null,8,["map-container","is-dark"]),Be(e1,{"is-dark":b.value,onToggle:ft},null,8,["is-dark"]),Be(Wu,{"is-dark":b.value,"embed-path":"my-upg-100-list/upg-100-list/index.html"},null,8,["is-dark"]),Be(Yo,{"is-dark":b.value,active:y.value,class:Ce({"upg-batch-on":y.value}),"aria-pressed":y.value?"true":"false",title:"Batch Select",onClick:P},{default:Kt(()=>[...B[4]||(B[4]=[T("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[T("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),T("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),T("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),T("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})],-1)])]),_:1},8,["is-dark","active","class","aria-pressed"])]),_:1})):me("",!0),T("div",rk,[d.value.length?(H(),lt(bu,{key:0,nodes:d.value,columns:["count","pop"],title:ud,"export-enabled":!0,onSelect:Ae,onExport:fe},null,8,["nodes"])):me("",!0)]),T("div",sk,[d.value.length?(H(),lt(Hv,{key:0,"legend-type":"upg-100",nodes:d.value,columns:["count","pop"],"column-label":"UPG 100",title:ud,"is-dark":b.value,"popup-action":"pray"},null,8,["nodes","is-dark"])):me("",!0)]),T("div",ik,[be(i)&&be(i).selectedPeopleGroup?(H(),ee("div",{key:0,class:Ce(["upg-detail-panel pg-detail-root",{dark:b.value}])},[Be(be(t),{peopleGroup:be(i).selectedPeopleGroup,dark:b.value,action:"pray"},null,8,["peopleGroup","dark"])],2)):me("",!0)]),y.value?(H(),ee("div",lk,[B[5]||(B[5]=T("div",{class:"upg-hud-hint"}," Tap territories on the map or legend rows to add · tap again to remove ",-1)),S.value?(H(),ee("div",ck,[T("span",null,ce(S.value)+" territor"+ce(S.value===1?"y":"ies")+" ·",1),T("span",uk,ce(w.value)+" UUPG",1),T("span",{class:Ce(["upg-hud-band",{ok:w.value>=50&&w.value<=100}])},ce(w.value>=50&&w.value<=100?"✓ 50–100 band":"band 50–100"),3)])):me("",!0),S.value?(H(),ee("div",dk,ce(_.value.map(ie=>ie.name).join(", ")),1)):me("",!0),S.value?(H(),ee("div",pk,[(H(),ee(Le,null,St(M,ie=>T("button",{key:ie,class:Ce(["upg-swatch",{active:I.value===ie}]),"data-color":ie,style:nt({background:ie}),title:ie,onClick:$e=>V(ie)},null,14,gk)),64)),lp(T("input",{"onUpdate:modelValue":B[0]||(B[0]=ie=>z.value=ie),class:"upg-hex",placeholder:"#hex",spellcheck:"false",onChange:ae,onKeyup:Kg(ae,["enter"])},null,544),[[Bg,z.value]])])):me("",!0),S.value?(H(),ee("div",fk,[T("button",{class:"upg-hud-btn copy",onClick:$},"Copy selection"),T("button",{class:"upg-hud-btn clear",onClick:wt},"Clear")])):me("",!0),S.value?(H(),ee("div",hk,ce(m.value),1)):me("",!0)])):me("",!0),T("div",mk,ce(c.value),1)])}}}},Symbol.toStringTag,{value:"Module"})),vk=`
diff --git a/public/embed/doxa-maps-build/doxa-maps/my-upg-100-list/poster-wall/index.html b/public/embed/doxa-maps-build/doxa-maps/my-upg-100-list/poster-wall/index.html
index 640dbd5a..c3c2e732 100644
--- a/public/embed/doxa-maps-build/doxa-maps/my-upg-100-list/poster-wall/index.html
+++ b/public/embed/doxa-maps-build/doxa-maps/my-upg-100-list/poster-wall/index.html
@@ -29,7 +29,7 @@
-
+
-
+
-
+
-
+