site-libsoc/Server/public/js/components/groups-component.js

2 lines
6.3 KiB
JavaScript

import{S as t,i as n,a as o,b as e,s as r,e as c,n as a,d as i,c as s,o as m,h as l,t as p,j as u,k as g,w as d,x as f,l as h,y as b,p as j}from"./index-0d9f0c09.js";import{w as x}from"./index-1c123138.js";import{loadLocaleContent as y,getData as w}from"../../../../../../../../../js/libraries/serverTools.js";import{addMarkersEntries as k,translate as v}from"../../../../../../../../../js/libraries/mapTools.js";import{addGroupPinContent as z}from"../../../../../../../../../js/mapFuncs.js";import"../../../../../../../../../js/components/map-component.js";function N(t,n,o){const e=t.slice();return e[12]=n[o][0],e[3]=n[o][1],e}function O(t,n,o){const e=t.slice();return e[15]=n[o],e}function T(t){let n,o,r,c,a,s,m,x,y,w,k,v,z,O,T,C,D,E,R,_,A=t[1].groups+"",F=t[1].p1+"",G=t[1].subheading1+"",H=t[1]["map-prompt"]+"",J=Object.entries(t[0]),K=[];for(let n=0;n<J.length;n+=1)K[n]=S(N(t,J,n));return{c(){n=l("div"),o=l("div"),r=l("h1"),c=p(A),a=u(),s=l("img"),x=u(),y=l("p"),w=p(F),k=u(),v=l("h3"),z=p(G),O=u(),T=l("map-component"),D=u(),E=l("p"),R=p(H),_=u();for(let t=0;t<K.length;t+=1)K[t].c();g(s,"id","groups-img"),d(s.src,m="/img/common/groups.svg")||g(s,"src","/img/common/groups.svg"),g(s,"alt","groups"),g(y,"class","description"),f(T,"id","map"),f(T,"callback",C=t[10]),g(E,"id","add-prompt"),g(o,"id","text-container"),g(n,"id","container")},m(t,i){e(t,n,i),h(n,o),h(o,r),h(r,c),h(o,a),h(o,s),h(o,x),h(o,y),h(y,w),h(o,k),h(o,v),h(v,z),h(o,O),h(o,T),h(o,D),h(o,E),h(E,R),h(o,_);for(let t=0;t<K.length;t+=1)K[t].m(o,null)},p(t,n){if(2&n&&A!==(A=t[1].groups+"")&&b(c,A),2&n&&F!==(F=t[1].p1+"")&&b(w,F),2&n&&G!==(G=t[1].subheading1+"")&&b(z,G),2&n&&C!==(C=t[10])&&f(T,"callback",C),2&n&&H!==(H=t[1]["map-prompt"]+"")&&b(R,H),771&n){let e;for(J=Object.entries(t[0]),e=0;e<J.length;e+=1){const r=N(t,J,e);K[e]?K[e].p(r,n):(K[e]=S(r),K[e].c(),K[e].m(o,null))}for(;e<K.length;e+=1)K[e].d(1);K.length=J.length}},d(t){t&&i(n),j(K,t)}}}function C(t){let n,o,r,c,a,s=t[1].contact+"",m=t[15].contact+"";return{c(){n=l("p"),o=l("b"),r=p(s),c=p(": "),a=p(m)},m(t,i){e(t,n,i),h(n,o),h(o,r),h(o,c),h(n,a)},p(t,n){2&n&&s!==(s=t[1].contact+"")&&b(r,s),1&n&&m!==(m=t[15].contact+"")&&b(a,m)},d(t){t&&i(n)}}}function D(t){let n,o,r,c,a,s,m,u=t[1].contact+"",d=t[15].contact+"";return{c(){n=l("p"),o=l("b"),r=p(u),c=p(": "),a=l("a"),s=p(d),g(a,"href",m=t[15].contact),g(a,"target",";_blank;"),g(a,"rel","noreferrer")},m(t,i){e(t,n,i),h(n,o),h(o,r),h(o,c),h(n,a),h(a,s)},p(t,n){2&n&&u!==(u=t[1].contact+"")&&b(r,u),1&n&&d!==(d=t[15].contact+"")&&b(s,d),1&n&&m!==(m=t[15].contact)&&g(a,"href",m)},d(t){t&&i(n)}}}function E(t){let n,o,r,c,a,s,m,u=t[1].contact+"",d=t[15].contact+"";return{c(){n=l("p"),o=l("b"),r=p(u),c=p(": "),a=l("a"),s=p(d),g(a,"href",m="mailto:"+t[15].contact),g(a,"target",";_blank;"),g(a,"rel","noreferrer")},m(t,i){e(t,n,i),h(n,o),h(o,r),h(o,c),h(n,a),h(a,s)},p(t,n){2&n&&u!==(u=t[1].contact+"")&&b(r,u),1&n&&d!==(d=t[15].contact+"")&&b(s,d),1&n&&m!==(m="mailto:"+t[15].contact)&&g(a,"href",m)},d(t){t&&i(n)}}}function R(t){let n,o,r,c,a,s,m,d,f,j,x,y,w,k,v,z=t[1].location+"",N=t[9](t[15])+"",O=t[1].members+"",T=t[15].members+"";function R(t,n){return 1&n&&(k=null),1&n&&(v=null),null==k&&(k=!!t[15].contact.includes("@")),k?E:(null==v&&(v=!!t[15].contact.includes("http")),v?D:C)}let S=R(t,-1),_=S(t);return{c(){n=l("div"),o=l("p"),r=l("b"),c=p(z),a=p(": "),s=p(N),m=u(),d=l("p"),f=l("b"),j=p(O),x=p(": "),y=p(T),w=u(),_.c(),g(n,"class","location-info")},m(t,i){e(t,n,i),h(n,o),h(o,r),h(r,c),h(r,a),h(o,s),h(n,m),h(n,d),h(d,f),h(f,j),h(f,x),h(d,y),h(n,w),_.m(n,null)},p(t,o){2&o&&z!==(z=t[1].location+"")&&b(c,z),1&o&&N!==(N=t[9](t[15])+"")&&b(s,N),2&o&&O!==(O=t[1].members+"")&&b(j,O),1&o&&T!==(T=t[15].members+"")&&b(y,T),S===(S=R(t,o))&&_?_.p(t,o):(_.d(1),_=S(t),_&&(_.c(),_.m(n,null)))},d(t){t&&i(n),_.d()}}}function S(t){let n,o,r,c,a,s=t[8](t[12])+"",m=t[3],d=[];for(let n=0;n<m.length;n+=1)d[n]=R(O(t,m,n));return{c(){n=l("h4"),o=p(s),r=u(),c=l("div");for(let t=0;t<d.length;t+=1)d[t].c();a=u(),g(n,"class","country-name"),g(c,"class","country-block")},m(t,i){e(t,n,i),h(n,o),e(t,r,i),e(t,c,i);for(let t=0;t<d.length;t+=1)d[t].m(c,null);h(c,a)},p(t,n){if(1&n&&s!==(s=t[8](t[12])+"")&&b(o,s),515&n){let o;for(m=t[3],o=0;o<m.length;o+=1){const e=O(t,m,o);d[o]?d[o].p(e,n):(d[o]=R(e),d[o].c(),d[o].m(c,a))}for(;o<d.length;o+=1)d[o].d(1);d.length=m.length}},d(t){t&&i(n),t&&i(r),t&&i(c),j(d,t)}}}function _(t){let n,o=3==t[2]&&T(t);return{c(){o&&o.c(),n=c()},m(t,r){o&&o.m(t,r),e(t,n,r)},p(t,e){3==t[2]?o?o.p(t,e):(o=T(t),o.c(),o.m(n.parentNode,n)):o&&(o.d(1),o=null)},d(t){o&&o.d(t),t&&i(n)}}}function A(t){let n,o=t[2],s=_(t);return{c(){s.c(),n=c(),this.c=a},m(t,o){s.m(t,o),e(t,n,o)},p(t,[e]){4&e&&r(o,o=t[2])?(s.d(1),s=_(t),s.c(),s.m(n.parentNode,n)):s.p(t,e)},i:a,o:a,d(t){t&&i(n),s.d(t)}}}function F(t,n,o){let e,r,c=x(0);s(t,c,(t=>o(2,r=t)));let a,i,l=x({});s(t,l,(t=>o(1,e=t)));let p=y(l,"groups-component",c);y(l,"countries",c);function u(t,n,o){let e=t([22,0],2);k(a,i,e,n,o,z,"green",{enableCountryGrouping:!0})}w("/assets/groups.json",(t=>{o(3,a=JSON.parse(t)),o(0,i={});for(let t of a){let n=t.country;null==t.contact&&(t.contact="https://discord.gg/Qk8KUk787z"),n in i?i[n].push(t):o(0,i[n]=[t],i)}c.update((t=>t+1))})),m((()=>{}));return[i,e,r,a,c,l,p,u,function(t){return"en"==p?t:v(e,t)},function(t){return[t.country,t.state,t.town].filter((t=>null!=t)).map((t=>"en"==p?t:v(e,t))).join(", ")},t=>u(t,e,p)]}class G extends t{constructor(t){super(),this.shadowRoot.innerHTML="<style>@import '/css/common.css';.description{margin-bottom:1rem}#add-prompt{margin-bottom:2rem}#groups-img{position:absolute;width:14rem;left:50%;transform:translate(-50%);z-index:0;opacity:0.2}#text-container>:nth-child(3){margin-top:8rem}.country-name{margin-bottom:0.5rem}.country-block{margin-bottom:2rem}.location-info{margin-bottom:0.75rem}.location-info p{margin-bottom:0}a{color:#DD1C1A}#map{--height:30rem;--width:100%;--margin-bottom:0.5rem}#text-container{position:relative;max-width:calc(100vw - 4rem);margin:auto}h1{margin-bottom:1rem;font-size:2.2rem;text-align:center}h3{margin-bottom:1rem}#container{margin:auto;max-width:800px;margin-top:1rem;margin-bottom:4rem}#container p{text-align:justify}</style>",n(this,{target:this.shadowRoot,props:o(this.attributes),customElement:!0},F,A,r,{},null),t&&t.target&&e(t.target,this,t.anchor)}}customElements.define("groups-component",G);export{G as default};