diff --git a/Server/app/resources/basic/BasicController.jl b/Server/app/resources/basic/BasicController.jl index 9670be4..8028641 100644 --- a/Server/app/resources/basic/BasicController.jl +++ b/Server/app/resources/basic/BasicController.jl @@ -11,6 +11,7 @@ dict_layouts = Dict( :manifesto => generate_layout_html("main",controller,"manifesto"), :join_us => generate_layout_html("main",controller,"join_us",libraries=["Leaflet"]), :groups => generate_layout_html("main",controller,"groups",libraries=["Leaflet"]), + :groups_add => generate_layout_html("main",controller,"groups_add",libraries=["Leaflet"]), :cooperatives => generate_layout_html("main",controller,"cooperatives",libraries=["Leaflet"]), :communes => generate_layout_html("main",controller,"communes",libraries=["Leaflet"]), :parties => generate_layout_html("main",controller,"parties",libraries=["Leaflet"]), @@ -162,6 +163,14 @@ function groups() ) end +function groups_add() + locale = get_locale() + html(:basic,:groups_add, layout = dict_layouts[:groups_add], context = @__MODULE__, + title = groups_info[locale][:title], + description = groups_info[locale][:description] + ) +end + function cooperatives() locale = get_locale() html(:basic,:cooperatives, layout = dict_layouts[:cooperatives], context = @__MODULE__, @@ -202,4 +211,16 @@ function political_compass() ) end -end \ No newline at end of file +function groups_add_post() + data = collect(JSON3.read(rawpayload())) + push!(data,1) + dict = Dict(zip(["country","state","town","latitude","longitude","contact","members"],data)) + insert_into_table("groups",dict) +end + +end + +#= +json_string = """["United States","California",null,38.24508142880928,-120.58593750000001,""]""" +data = JSON3.read(json_string)´ +=# \ No newline at end of file diff --git a/Server/app/resources/basic/views/groups_add.jl.html b/Server/app/resources/basic/views/groups_add.jl.html new file mode 100644 index 0000000..5a45a39 --- /dev/null +++ b/Server/app/resources/basic/views/groups_add.jl.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Server/app/svelte/public/css/common.css b/Server/app/svelte/public/css/common.css index 7e695db..4920c69 100644 --- a/Server/app/svelte/public/css/common.css +++ b/Server/app/svelte/public/css/common.css @@ -310,7 +310,7 @@ input[type="text"],input[type="email"],input[type="password"],input[type="number border-color: black; border: black solid 0.063rem; padding-left: 0.5rem; - font: 1.3rem var(--serif, serif); + font: 1.15rem var(--serif, serif); } input[type="text"] { diff --git a/Server/app/svelte/public/js/communes.js b/Server/app/svelte/public/js/communes.js index c7a748e..b3165fa 100644 --- a/Server/app/svelte/public/js/communes.js +++ b/Server/app/svelte/public/js/communes.js @@ -39,7 +39,7 @@ for (let c of communes) { export let communesMarkersLayer = L.layerGroup() -export function addMarkersCommunes(map,content) { +export function addMarkersCommunes(map,content,locale) { for (let g of communes) { let coordinates let text = ""+content["Commune"]+"
" @@ -50,7 +50,14 @@ export function addMarkersCommunes(map,content) { } else if (field=="location") { let location = g[field][0] - let locationString = location.map(x => content[x]).join(", ") + let locationString + if (locale=="en") { + locationString = location.map(x => x).join(", ") + } + else { + locationString = location.map(x => content[x]).join(", ") + } + text += fieldText + locationString + "
" coordinates = g[field][1] } diff --git a/Server/app/svelte/public/js/coops.js b/Server/app/svelte/public/js/coops.js index 1b6038b..8338fcc 100644 --- a/Server/app/svelte/public/js/coops.js +++ b/Server/app/svelte/public/js/coops.js @@ -2,7 +2,7 @@ export let coops = [ { logo: "chiron_logo", name: "Chiron Health", - location: [["Estonia","KohtlaJarve"],[59.41038769769602, 27.287802936242034]], + location: [["Estonia","Kohtla-Järve"],[59.41038769769602, 27.287802936242034]], market: "wellnessAndHealth", workers: 2, status: "inDevelopment", @@ -13,7 +13,7 @@ export let coops = [ { logo: "kuusk_logo", name: "Kuusk", - location: [["Estonia","KohtlaJarve"],[59.399947051803004, 27.277159931677055]], + location: [["Estonia","Kohtla-Järve"],[59.399947051803004, 27.277159931677055]], market: "herbalTeas", workers: 1, status: "inDevelopment", @@ -36,7 +36,7 @@ for (let g of coops) { export let coopsMarkersLayer = L.layerGroup() -export function addMarkersCoops(map,content) { +export function addMarkersCoops(map,content,locale) { for (let g of coops) { let coordinates let text = ""+content["Cooperative"]+"
" @@ -56,7 +56,13 @@ export function addMarkersCoops(map,content) { } else if (field=="location") { let location = g[field][0] - let locationString = location.map(x => content[x]).join(", ") + let locationString + if (locale=="en") { + locationString = location.map(x => x).join(", ") + } + else { + locationString = location.map(x => content[x]).join(", ") + } text += fieldText + locationString + "
" coordinates = g[field][1] } diff --git a/Server/app/svelte/public/js/groups.js b/Server/app/svelte/public/js/groups.js index 3aef913..95b2c52 100644 --- a/Server/app/svelte/public/js/groups.js +++ b/Server/app/svelte/public/js/groups.js @@ -25,7 +25,7 @@ export let groups = [ contact: ["https://discord.gg/Qk8KUk787z","DiscordInviteLink"] }, { - location: [["Estonia","KohtlaJarve"], [59.40629447076191, 27.280605339416322]], + location: [["Estonia","Kohtla-Järve"], [59.40629447076191, 27.280605339416322]], members: 3, contact: ["https://discord.gg/Qk8KUk787z","DiscordInviteLink"] }, @@ -93,7 +93,7 @@ let groupsMarkersLayerIn = L.layerGroup() let contactGeneral =["https://discord.gg/4BUau4AZre","DiscordInviteLink"] -function addMarkersToLayer(g,layer,content) { +function addMarkersToLayer(g,layer,content,locale) { let coordinates let text = ""+content["Group"]+"
" for (let field in g) { @@ -103,7 +103,13 @@ function addMarkersToLayer(g,layer,content) { } else if (field=="location") { let location = g[field][0] - let locationString = location.map(x => content[x]).join(", ") + let locationString + if (locale=="en") { + locationString = location.map(x => x).join(", ") + } + else { + locationString = location.map(x => content[x]).join(", ") + } text += fieldText + locationString + "
" coordinates = g[field][1] } @@ -123,15 +129,15 @@ function addMarkersToLayer(g,layer,content) { marker.addTo(layer).bindPopup(text) } -export function addMarkersGroups(map,content) { +export function addMarkersGroups(map,content,locale) { for (let g of groups) { - addMarkersToLayer(g,groupsMarkersLayerIn,content) + addMarkersToLayer(g,groupsMarkersLayerIn,content,locale) } for (let gs of Object.values(groupsByCountry)) { if (gs.length==1) { let g = {...gs[0]} g.location[0] = [g.location[0][0]] - addMarkersToLayer(g,groupsMarkersLayerOut,content) + addMarkersToLayer(g,groupsMarkersLayerOut,content,locale) } else { let locationName = [gs[0].location[0][0]] @@ -153,7 +159,7 @@ export function addMarkersGroups(map,content) { members: members, contact: contact } - addMarkersToLayer(gNew,groupsMarkersLayerOut,content) + addMarkersToLayer(gNew,groupsMarkersLayerOut,content,locale) } } groupsMarkersLayerOut.addTo(groupsMarkersLayer) @@ -172,37 +178,5 @@ function onZoomEnd(map) { groupsMarkersLayerIn.addTo(groupsMarkersLayer) } } -/* -function reverseGeocode(latitude, longitude) { - let url = `https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=${latitude}&lon=${longitude}`; - - // Create a new XMLHttpRequest object - let xhr = new XMLHttpRequest(); - - // Set up the AJAX request - xhr.open('GET', url, true); - - // Define the onload function - xhr.onload = function() { - if (xhr.status === 200) { - // Parse the response JSON - let response = JSON.parse(xhr.responseText); - - // Extract the address information from the response - let address = response.address; - let city = address.city || address.town || address.village || address.hamlet; - let country = address.country; - let fullAddress = city + ', ' + country; - - // Do something with the address - console.log(fullAddress); - } - }; - - // Send the AJAX request - xhr.send(); - } + -let latitude = 123.456; // Replace with your latitude -let longitude = 78.901; // Replace with your longitude -reverseGeocode(latitude, longitude);*/ \ No newline at end of file diff --git a/Server/app/svelte/public/js/libraries/serverTools.js b/Server/app/svelte/public/js/libraries/serverTools.js index 76df3ab..6e85d01 100644 --- a/Server/app/svelte/public/js/libraries/serverTools.js +++ b/Server/app/svelte/public/js/libraries/serverTools.js @@ -1,17 +1,17 @@ // Get data from server export function getData(path,callback) { - var xhr = new XMLHttpRequest(); - xhr.overrideMimeType("application/json"); - xhr.open('GET', path, true); + let xhr = new XMLHttpRequest(); + xhr.overrideMimeType("application/json") + xhr.open('GET', path, true) xhr.onreadystatechange = function () { - if (xhr.readyState == 4 && xhr.status == "200") { + if (xhr.readyState == 4 && xhr.status == "200") { if (callback !== undefined) { - callback(xhr.responseText); + callback(xhr.responseText) } - } + } }; - xhr.send(null); + xhr.send() } // Parse JSON from given path into a given variable under a given key @@ -35,6 +35,7 @@ export function sendData(route,data,callback) { callback(xhr.responseText) } } else { + console.log("Request gave an error") // Oh no! There has been an error with the request! } } diff --git a/Server/app/svelte/public/js/parties.js b/Server/app/svelte/public/js/parties.js index 22a775b..5921eb9 100644 --- a/Server/app/svelte/public/js/parties.js +++ b/Server/app/svelte/public/js/parties.js @@ -22,7 +22,7 @@ for (let g of parties) { export let partiesMarkersLayer = L.layerGroup() -export function addMarkersParties(map,content) { +export function addMarkersParties(map,content,locale) { for (let g of parties) { let coordinates let text = ""+content["Party"]+"
" @@ -42,7 +42,13 @@ export function addMarkersParties(map,content) { } else if (field=="location") { let location = g[field][0] - let locationString = location + let locationString + if (locale=="en") { + locationString = location + } + else { + locationString = content[location] + } text += fieldText + locationString + "
" coordinates = g[field][1] } diff --git a/Server/app/svelte/public/locales/en/countries.json b/Server/app/svelte/public/locales/en/countries.json index 3680dc3..8919b1b 100644 --- a/Server/app/svelte/public/locales/en/countries.json +++ b/Server/app/svelte/public/locales/en/countries.json @@ -1,29 +1,3 @@ { - "map-prompt": "Want to appear on our map? Contact us!", - "Online": "Online", - "Denmark": "Denmark", - "Estonia": "Estonia", - "Greece": "Greece", - "Latvia": "Latvia", - "Canada": "Canada", - "Germany": "Germany", - "Copenhagen": "Copenhagen", - "Ireland": "Ireland", - "USA": "USA", - "Bulgaria": "Bulgaria", - "Colorado": "Colorado", - "Georgia": "Georgia", - "Ohio": "Ohio", - "Montreal": "Montreal", - "Kolding": "Kolding", - "KohtlaJarve": "Kohtla-Järve", - "Athens": "Athens", - "Riga": "Riga", - "Halifax": "Halifax", - "Wiesbaden": "Wiesbaden", - "Florida": "Florida", - "Tallinn": "Tallinn", - "Varna": "Varna", - "Louisville": "Louisville", - "Toronto": "Toronto" + "map-prompt": "Want to appear on our map? Contact us!" } \ No newline at end of file diff --git a/Server/app/svelte/public/locales/ru/countries.json b/Server/app/svelte/public/locales/ru/countries.json index 5cf1964..08eec1d 100644 --- a/Server/app/svelte/public/locales/ru/countries.json +++ b/Server/app/svelte/public/locales/ru/countries.json @@ -15,7 +15,7 @@ "Ohio": "Огайо", "Copenhagen": "Копенгаген", "Kolding": "Колдинг", - "KohtlaJarve": "Кохтла-Ярве", + "Kohtla-Järve": "Кохтла-Ярве", "Athens": "Афины", "Riga": "Рига", "Halifax": "Галифакс", diff --git a/Server/app/svelte/rollup.config.js b/Server/app/svelte/rollup.config.js index 8e3d30e..bade40b 100644 --- a/Server/app/svelte/rollup.config.js +++ b/Server/app/svelte/rollup.config.js @@ -31,7 +31,6 @@ function serve() { } }; } - const walkSync = require("walk-sync"); const paths = walkSync("./src", {globs: ["**/*.svelte"]}).map(x => "src/"+x) diff --git a/Server/app/svelte/src/communes-component.svelte b/Server/app/svelte/src/communes-component.svelte index 340e8b7..e710735 100644 --- a/Server/app/svelte/src/communes-component.svelte +++ b/Server/app/svelte/src/communes-component.svelte @@ -17,9 +17,17 @@ loadLocaleContent(content,"countries",loaded) let locale = loadLocaleContent(content,"communes-component",loaded) - function mapCallbackCommunes(createMap,content) { + function mapCallbackCommunes(createMap,content,locale) { let map = createMap([22, 0],2) - addMarkersCommunes(map,content) + addMarkersCommunes(map,content,locale) + } + + function getCountry(name) { + return locale=="en" ? name : $content[name] + } + + function getAddress(group) { + return group.location[0].map(x => locale=="en" ? x : $content[x]).join(", ") } onMount(() => { @@ -39,11 +47,11 @@ mapCallbackCommunes(createMap,$content,locale)}>

{$content["map-prompt"]}

{#each Object.entries(communesByCountry) as [name,communes]} -

{$content[name]}

+

{getCountry(name)}

{#each communes as commune}
-

{$content.location}: {commune.location[0].map(x => $content[x]).join(", ")}

+

{$content.location}: {getAddress(commune)}

{$content.status}: {$content[commune.status]}

{$content.members}: {commune.members}

{$content.contact}: {$content[commune.contact[1]]}

diff --git a/Server/app/svelte/src/cooperatives-component.svelte b/Server/app/svelte/src/cooperatives-component.svelte index 0647983..1e255d5 100644 --- a/Server/app/svelte/src/cooperatives-component.svelte +++ b/Server/app/svelte/src/cooperatives-component.svelte @@ -14,12 +14,20 @@ let loaded = writable(0) let content = writable({}) - loadLocaleContent(content,"countries",loaded) - let locale = loadLocaleContent(content,"cooperatives-component",loaded) + let locale = loadLocaleContent(content,"countries",loaded) + loadLocaleContent(content,"cooperatives-component",loaded) function mapCallbackCoops(createMap,content) { let map = createMap([22, 0],2) - addMarkersCoops(map,content) + addMarkersCoops(map,content,locale) + } + + function getCountry(name) { + return locale=="en" ? name : $content[name] + } + + function getAddress(group) { + return group.location[0].map(x => locale=="en" ? x : $content[x]).join(", ") } onMount(() => { @@ -38,14 +46,14 @@ mapCallbackCoops(createMap,$content,locale)}>

{$content["map-prompt"]}

{#each Object.entries(coopsByCountry) as [name,coops]} -

{$content[name]}

+

{getCountry(name)}

{#each coops as coop}

{$content.name}: {coop.name}

-

{$content.location}: {coop.location[0].map(x => $content[x]).join(", ")}

+

{$content.location}: {getAddress(coop)}

{$content.market}: {$content[coop.market]}

{$content.workers}: {coop.workers}

{$content.status}: {$content[coop.status]}

diff --git a/Server/app/svelte/src/groups-add-component.svelte b/Server/app/svelte/src/groups-add-component.svelte new file mode 100644 index 0000000..abc1844 --- /dev/null +++ b/Server/app/svelte/src/groups-add-component.svelte @@ -0,0 +1,248 @@ + + + + +{#key $loaded} + {#if $loaded==2} +
+ +
+

Add a Group

+ groups +

If there are no groups in your town with whom you can organize then

+
    +
  1. click on the map to show us where you are located,
  2. +
  3. add a way to contact you or leave blank for a pin to point to our discord and
  4. +
  5. press "Submit" to add yourself to our map
  6. +
+
+ + + mapCallbackGroups(createMap,$content)}> +
+
+ {/if} +{/key} + + \ No newline at end of file diff --git a/Server/app/svelte/src/groups-component.svelte b/Server/app/svelte/src/groups-component.svelte index b0de63b..d4b272e 100644 --- a/Server/app/svelte/src/groups-component.svelte +++ b/Server/app/svelte/src/groups-component.svelte @@ -5,7 +5,7 @@ import { onMount } from 'svelte' import { writable } from 'svelte/store'; import { groupsByCountry, addMarkersGroups } from '/js/groups.js' - import { loadLocaleContent} from "/js/libraries/serverTools.js" + import { loadLocaleContent, getData, sendData } from "/js/libraries/serverTools.js" // Import components import "/js/components/map-component.js" @@ -14,16 +14,24 @@ let loaded = writable(0) let content = writable({}) - loadLocaleContent(content,"groups-component",loaded) + let locale = loadLocaleContent(content,"groups-component",loaded) loadLocaleContent(content,"countries",loaded) - function mapCallbackGroups(createMap,content) { + function mapCallbackGroups(createMap,content,locale) { let map = createMap([22, 0],2) - addMarkersGroups(map,content) + addMarkersGroups(map,content,locale) + } + + function getCountry(name) { + return locale=="en" ? name : $content[name] + } + + function getAddress(group) { + return group.location[0].map(x => locale=="en" ? x : $content[x]).join(", ") } onMount(() => { - // {console.log(loaded)} + }) @@ -36,14 +44,14 @@ groups

{$content.p1}

{$content.subheading1}

- mapCallbackGroups(createMap,$content)}> + mapCallbackGroups(createMap,$content,locale)}>

{$content["map-prompt"]}

{#each Object.entries(groupsByCountry) as [name,groups]} -

{$content[name]}

+

{getCountry(name)}

{#each groups as group}
-

{$content.location}: {group.location[0].map(x => $content[x]).join(", ")}

+

{$content.location}: {getAddress(group)}

{$content.members}: {group.members}

{$content.contact}: {$content[group.contact[1]]}

diff --git a/Server/app/svelte/src/join-us-component.svelte b/Server/app/svelte/src/join-us-component.svelte index 268cd2c..2c1ad23 100644 --- a/Server/app/svelte/src/join-us-component.svelte +++ b/Server/app/svelte/src/join-us-component.svelte @@ -24,12 +24,12 @@ loadLocaleContent(content,"countries",loaded) let locale = loadLocaleContent(content,"join-us-component",loaded) - function mapCallback(createMap,content) { + function mapCallback(createMap,content,locale) { let map = createMap([22, 0],2) - addMarkersGroups(map,content) - addMarkersCommunes(map,content) - addMarkersCoops(map,content) - addMarkersParties(map,content) + addMarkersGroups(map,content,locale) + addMarkersCommunes(map,content,locale) + addMarkersCoops(map,content,locale) + addMarkersParties(map,content,locale) let overlayMaps = { "Groups": groupsMarkersLayer, @@ -77,7 +77,7 @@

{$content.nearYou}

{$content.noneNear} {$content.WhatsAppGroup} {$content.or} {$content.DiscordServer}{$content.helpStart}

- mapCallback(createMap,$content)}> + mapCallback(createMap,$content,locale)}>
{/if} diff --git a/Server/app/svelte/src/landing-component.svelte b/Server/app/svelte/src/landing-component.svelte index 1a071af..94c37a0 100644 --- a/Server/app/svelte/src/landing-component.svelte +++ b/Server/app/svelte/src/landing-component.svelte @@ -36,12 +36,12 @@ let locale = loadLocaleContent(content,"landing-component",loaded,changeWidth) changeWidth(locale) - function mapCallback(createMap,content) { + function mapCallback(createMap,content,locale) { let map = createMap([22, 0],2) - addMarkersGroups(map,content) - addMarkersCommunes(map,content) - addMarkersCoops(map,content) - addMarkersParties(map,content) + addMarkersGroups(map,content,locale) + addMarkersCommunes(map,content,locale) + addMarkersCoops(map,content,locale) + addMarkersParties(map,content,locale) let overlayMaps = {} overlayMaps[content.groups] = groupsMarkersLayer @@ -107,7 +107,7 @@
-->

{$content.findUs}

- mapCallback(createMap,$content)} colors={["#23AC20","#CA2437","#217BC9","#FFD326"]}> + mapCallback(createMap,$content,locale)} colors={["#23AC20","#CA2437","#217BC9","#FFD326"]}>

{$content.whatNow}

{$content.joinUs} diff --git a/Server/app/svelte/src/parties-component.svelte b/Server/app/svelte/src/parties-component.svelte index d8d53dd..d091526 100644 --- a/Server/app/svelte/src/parties-component.svelte +++ b/Server/app/svelte/src/parties-component.svelte @@ -15,11 +15,19 @@ let content = writable({}) loadLocaleContent(content,"countries",loaded) - loadLocaleContent(content,"parties-component",loaded) + let locale = loadLocaleContent(content,"parties-component",loaded) - function mapCallbackParties(createMap,content) { + function mapCallbackParties(createMap,content,locale) { let map = createMap([22, 0],2) - addMarkersParties(map,content) + addMarkersParties(map,content,locale) + } + + function getCountry(name) { + return locale=="en" ? name : $content[name] + } + + function getAddress(group) { + return locale=="en" ? group.location : $content[group.location] } onMount(() => { @@ -36,10 +44,10 @@ party

{$content.p1}

{$content.subheading1}

- mapCallbackParties(createMap,$content)}> + mapCallbackParties(createMap,$content,locale)}>

{$content["map-prompt"]}

{#each Object.entries(partiesByCountry) as [name,parties]} -

{$content[name]}

+

{getCountry(name)}

{#each parties as party}
@@ -51,7 +59,7 @@

{$content.name}: {party.name}

-

{$content.location}: {$content[party.location[0]]}

+

{$content.location}: {getAddress(party)}

{$content.link}: {party.link}

diff --git a/Server/app/svelte/src/partners-component.svelte b/Server/app/svelte/src/partners-component.svelte index 432ad41..01483a9 100644 --- a/Server/app/svelte/src/partners-component.svelte +++ b/Server/app/svelte/src/partners-component.svelte @@ -15,7 +15,15 @@ let content = writable({}) loadLocaleContent(content,"countries",loaded) - loadLocaleContent(content,"partners-component",loaded) + let locale = loadLocaleContent(content,"partners-component",loaded) + + function getCountry(name) { + return locale=="en" ? name : $content[name] + } + + function getAddress(group) { + return group.location[0].map(x => locale=="en" ? x : $content[x]).join(", ") + } onMount(() => { @@ -32,7 +40,7 @@

{$content.p1}

{$content.subheading1}

{#each Object.entries(partnersByCountry) as [name,partners]} -

{$content[name]}

+

{getCountry(name)}

{#each partners as partner}
@@ -45,7 +53,7 @@

{$content.name}: {partner.name}

{$content.type}: {$content[partner.type]}

-

{$content.location}: {$content[partner.location[0][0]] + (partner.location[0][1]=="" ? "" : ", " + $content[partner.location[0][1]])}

+

{$content.location}: {getAddress(partner)}

{$content.link}: {partner.link}

diff --git a/Server/db/migrations/2022026611846565_create_table_groups.jl b/Server/db/migrations/2022026611846565_create_table_groups.jl new file mode 100644 index 0000000..47989f2 --- /dev/null +++ b/Server/db/migrations/2022026611846565_create_table_groups.jl @@ -0,0 +1,24 @@ +module CreateTableGroups + +import SearchLight.Migrations: create_table, column, primary_key, add_index, drop_table + +function up() + create_table(:groups) do + [ + primary_key() + column(:country, :string) + column(:state, :string) + column(:town, :string) + column(:contact, :string) + column(:latitude, :float) + column(:longitude, :float) + column(:members, :int) + ] + end +end + +function down() + drop_table(:groups) +end + +end \ No newline at end of file diff --git a/Server/lib/DatabaseSupport.jl b/Server/lib/DatabaseSupport.jl index 43fda0d..2149389 100644 --- a/Server/lib/DatabaseSupport.jl +++ b/Server/lib/DatabaseSupport.jl @@ -1,6 +1,6 @@ module DatabaseSupport -#= + using SearchLight, SearchLightPostgreSQL, LibPQ using DataFrames @@ -133,5 +133,5 @@ function add_foreign_key(table,name,table2,name2) ADD CONSTRAINT fk_$(table)_$(table2)_$(name) FOREIGN KEY ($name) REFERENCES $table2 ($name2);""" SearchLight.query(query) end -=# + end diff --git a/Server/public/css/common.css b/Server/public/css/common.css index 7e695db..4920c69 100644 --- a/Server/public/css/common.css +++ b/Server/public/css/common.css @@ -310,7 +310,7 @@ input[type="text"],input[type="email"],input[type="password"],input[type="number border-color: black; border: black solid 0.063rem; padding-left: 0.5rem; - font: 1.3rem var(--serif, serif); + font: 1.15rem var(--serif, serif); } input[type="text"] { diff --git a/Server/public/favicon.png b/Server/public/favicon.png index d3f5d2b..82aa656 100644 Binary files a/Server/public/favicon.png and b/Server/public/favicon.png differ diff --git a/Server/public/favicon4.png b/Server/public/favicon4.png new file mode 100644 index 0000000..d3f5d2b Binary files /dev/null and b/Server/public/favicon4.png differ diff --git a/Server/public/img/common/flag.png b/Server/public/img/common/flag.png index 433035f..70ede68 100644 Binary files a/Server/public/img/common/flag.png and b/Server/public/img/common/flag.png differ diff --git a/Server/public/img/common/flag3.png b/Server/public/img/common/flag3.png new file mode 100644 index 0000000..433035f Binary files /dev/null and b/Server/public/img/common/flag3.png differ diff --git a/Server/public/img/common/markers/marker-black.png b/Server/public/img/common/markers/marker-black.png new file mode 100644 index 0000000..23c94cf Binary files /dev/null and b/Server/public/img/common/markers/marker-black.png differ diff --git a/Server/public/js/communes.js b/Server/public/js/communes.js index c7a748e..b3165fa 100644 --- a/Server/public/js/communes.js +++ b/Server/public/js/communes.js @@ -39,7 +39,7 @@ for (let c of communes) { export let communesMarkersLayer = L.layerGroup() -export function addMarkersCommunes(map,content) { +export function addMarkersCommunes(map,content,locale) { for (let g of communes) { let coordinates let text = ""+content["Commune"]+"
" @@ -50,7 +50,14 @@ export function addMarkersCommunes(map,content) { } else if (field=="location") { let location = g[field][0] - let locationString = location.map(x => content[x]).join(", ") + let locationString + if (locale=="en") { + locationString = location.map(x => x).join(", ") + } + else { + locationString = location.map(x => content[x]).join(", ") + } + text += fieldText + locationString + "
" coordinates = g[field][1] } diff --git a/Server/public/js/components/communes-component.js b/Server/public/js/components/communes-component.js index ba86335..ab25152 100644 --- a/Server/public/js/components/communes-component.js +++ b/Server/public/js/components/communes-component.js @@ -1 +1,598 @@ -import{S as t,i as o,a as n,b as e,s as m,e as r,n as a,d as i,c,o as s,f as l,t as p,g as u,h as g,j as d,k as h,l as f,m as b,p as j}from"./index-4348483d.js";import{w as x}from"./index-71440b21.js";import{addMarkersCommunes as v,communesByCountry as w}from"../../../../../../../../../js/communes.js";import{loadLocaleContent as y}from"../../../../../../../../../js/libraries/serverTools.js";import"../../../../../../../../../js/components/map-component.js";function k(t,o,n){const e=t.slice();return e[8]=o[n][0],e[9]=o[n][1],e}function z(t,o,n){const e=t.slice();return e[12]=o[n],e}function D(t){let o,n,m,r,a,c,s,x,v,y,z,D,E,O,R,T,A,C,H,L,M=t[1].communes+"",S=t[1].p1+"",_=t[1].subheading1+"",q=t[1]["map-prompt"]+"",B=Object.entries(w),F=[];for(let o=0;on(0,e=t)));let a=x({});c(t,a,(t=>n(1,m=t))),y(a,"countries",r);let i=y(a,"communes-component",r);function l(t,o){let n=t([22,0],2);v(n,o)}s((()=>{}));return[e,m,r,a,i,l,t=>l(t,m),t=>m[t]]}class A extends t{constructor(t){super(),this.shadowRoot.innerHTML="",o(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},T,R,m,{},null),t&&t.target&&e(t.target,this,t.anchor)}}customElements.define("communes-component",A);export{A as default}; + +(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document); +import { S as SvelteElement, i as init, a as attribute_to_object, b as insert_dev, s as safe_not_equal, d as dispatch_dev, v as validate_slots, c as validate_store, e as component_subscribe, o as onMount, g as globals, f as empty, n as noop, h as detach_dev, j as validate_each_argument, k as element, t as text, l as space, m as add_location, p as attr_dev, q as src_url_equal, r as set_custom_element_data, u as append_dev, w as set_data_dev, x as destroy_each } from './index-d19aafba.js'; +import { w as writable } from './index-4664ced0.js'; +import { communesByCountry, addMarkersCommunes } from '../../../../../../../../../js/communes.js'; +import { loadLocaleContent } from '../../../../../../../../../js/libraries/serverTools.js'; +import '../../../../../../../../../js/components/map-component.js'; + +/* src\communes-component.svelte generated by Svelte v3.52.0 */ + +const { Object: Object_1 } = globals; + +const file = "src\\communes-component.svelte"; + +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[9] = list[i][0]; + child_ctx[10] = list[i][1]; + return child_ctx; +} + +function get_each_context_1(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[13] = list[i]; + return child_ctx; +} + +// (39:4) {#if $loaded==2} +function create_if_block(ctx) { + let div1; + let div0; + let h1; + let t0_value = /*$content*/ ctx[0].communes + ""; + let t0; + let t1; + let img; + let img_src_value; + let t2; + let p0; + let t3_value = /*$content*/ ctx[0].p1 + ""; + let t3; + let t4; + let h3; + let t5_value = /*$content*/ ctx[0].subheading1 + ""; + let t5; + let t6; + let map_component; + let map_component_callback_value; + let t7; + let p1; + let t8_value = /*$content*/ ctx[0]["map-prompt"] + ""; + let t8; + let t9; + let each_value = Object.entries(communesByCountry); + validate_each_argument(each_value); + let each_blocks = []; + + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + + const block = { + c: function create() { + div1 = element("div"); + div0 = element("div"); + h1 = element("h1"); + t0 = text(t0_value); + t1 = space(); + img = element("img"); + t2 = space(); + p0 = element("p"); + t3 = text(t3_value); + t4 = space(); + h3 = element("h3"); + t5 = text(t5_value); + t6 = space(); + map_component = element("map-component"); + t7 = space(); + p1 = element("p"); + t8 = text(t8_value); + t9 = space(); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + add_location(h1, file, 42, 16, 1223); + attr_dev(img, "id", "commune-img"); + if (!src_url_equal(img.src, img_src_value = "/img/common/commune.svg")) attr_dev(img, "src", img_src_value); + attr_dev(img, "alt", "commune"); + add_location(img, file, 43, 16, 1269); + attr_dev(p0, "class", "description"); + add_location(p0, file, 44, 16, 1353); + add_location(h3, file, 45, 16, 1411); + set_custom_element_data(map_component, "id", "map"); + set_custom_element_data(map_component, "callback", map_component_callback_value = /*func*/ ctx[8]); + add_location(map_component, file, 46, 16, 1460); + attr_dev(p1, "id", "add-prompt"); + add_location(p1, file, 47, 16, 1591); + attr_dev(div0, "id", "text-container"); + add_location(div0, file, 41, 12, 1180); + attr_dev(div1, "id", "container"); + add_location(div1, file, 39, 8, 1077); + }, + m: function mount(target, anchor) { + insert_dev(target, div1, anchor); + append_dev(div1, div0); + append_dev(div0, h1); + append_dev(h1, t0); + append_dev(div0, t1); + append_dev(div0, img); + append_dev(div0, t2); + append_dev(div0, p0); + append_dev(p0, t3); + append_dev(div0, t4); + append_dev(div0, h3); + append_dev(h3, t5); + append_dev(div0, t6); + append_dev(div0, map_component); + append_dev(div0, t7); + append_dev(div0, p1); + append_dev(p1, t8); + append_dev(div0, t9); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(div0, null); + } + }, + p: function update(ctx, dirty) { + if (dirty & /*$content*/ 1 && t0_value !== (t0_value = /*$content*/ ctx[0].communes + "")) set_data_dev(t0, t0_value); + if (dirty & /*$content*/ 1 && t3_value !== (t3_value = /*$content*/ ctx[0].p1 + "")) set_data_dev(t3, t3_value); + if (dirty & /*$content*/ 1 && t5_value !== (t5_value = /*$content*/ ctx[0].subheading1 + "")) set_data_dev(t5, t5_value); + + if (dirty & /*$content*/ 1 && map_component_callback_value !== (map_component_callback_value = /*func*/ ctx[8])) { + set_custom_element_data(map_component, "callback", map_component_callback_value); + } + + if (dirty & /*$content*/ 1 && t8_value !== (t8_value = /*$content*/ ctx[0]["map-prompt"] + "")) set_data_dev(t8, t8_value); + + if (dirty & /*Object, communesByCountry, $content, getAddress, getCountry*/ 193) { + each_value = Object.entries(communesByCountry); + validate_each_argument(each_value); + let i; + + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx, each_value, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div0, null); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value.length; + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div1); + destroy_each(each_blocks, detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block.name, + type: "if", + source: "(39:4) {#if $loaded==2}", + ctx + }); + + return block; +} + +// (52:24) {#each communes as commune} +function create_each_block_1(ctx) { + let div; + let p0; + let b0; + let t0_value = /*$content*/ ctx[0].location + ""; + let t0; + let t1; + let t2_value = /*getAddress*/ ctx[7](/*commune*/ ctx[13]) + ""; + let t2; + let t3; + let p1; + let b1; + let t4_value = /*$content*/ ctx[0].status + ""; + let t4; + let t5; + let t6_value = /*$content*/ ctx[0][/*commune*/ ctx[13].status] + ""; + let t6; + let t7; + let p2; + let b2; + let t8_value = /*$content*/ ctx[0].members + ""; + let t8; + let t9; + let t10_value = /*commune*/ ctx[13].members + ""; + let t10; + let t11; + let p3; + let b3; + let t12_value = /*$content*/ ctx[0].contact + ""; + let t12; + let t13; + let a; + let t14_value = /*$content*/ ctx[0][/*commune*/ ctx[13].contact[1]] + ""; + let t14; + + const block = { + c: function create() { + div = element("div"); + p0 = element("p"); + b0 = element("b"); + t0 = text(t0_value); + t1 = text(": "); + t2 = text(t2_value); + t3 = space(); + p1 = element("p"); + b1 = element("b"); + t4 = text(t4_value); + t5 = text(": "); + t6 = text(t6_value); + t7 = space(); + p2 = element("p"); + b2 = element("b"); + t8 = text(t8_value); + t9 = text(": "); + t10 = text(t10_value); + t11 = space(); + p3 = element("p"); + b3 = element("b"); + t12 = text(t12_value); + t13 = text(": "); + a = element("a"); + t14 = text(t14_value); + add_location(b0, file, 53, 35, 1982); + add_location(p0, file, 53, 32, 1979); + add_location(b1, file, 54, 35, 2072); + add_location(p1, file, 54, 32, 2069); + add_location(b2, file, 55, 35, 2165); + add_location(p2, file, 55, 32, 2162); + add_location(b3, file, 56, 35, 2250); + attr_dev(a, "href", /*commune*/ ctx[13].contact[0]); + attr_dev(a, "target", ";_blank;"); + attr_dev(a, "rel", "noreferrer"); + add_location(a, file, 56, 62, 2277); + add_location(p3, file, 56, 32, 2247); + attr_dev(div, "class", "location-info"); + add_location(div, file, 52, 28, 1918); + }, + m: function mount(target, anchor) { + insert_dev(target, div, anchor); + append_dev(div, p0); + append_dev(p0, b0); + append_dev(b0, t0); + append_dev(b0, t1); + append_dev(p0, t2); + append_dev(div, t3); + append_dev(div, p1); + append_dev(p1, b1); + append_dev(b1, t4); + append_dev(b1, t5); + append_dev(p1, t6); + append_dev(div, t7); + append_dev(div, p2); + append_dev(p2, b2); + append_dev(b2, t8); + append_dev(b2, t9); + append_dev(p2, t10); + append_dev(div, t11); + append_dev(div, p3); + append_dev(p3, b3); + append_dev(b3, t12); + append_dev(b3, t13); + append_dev(p3, a); + append_dev(a, t14); + }, + p: function update(ctx, dirty) { + if (dirty & /*$content*/ 1 && t0_value !== (t0_value = /*$content*/ ctx[0].location + "")) set_data_dev(t0, t0_value); + if (dirty & /*$content*/ 1 && t4_value !== (t4_value = /*$content*/ ctx[0].status + "")) set_data_dev(t4, t4_value); + if (dirty & /*$content*/ 1 && t6_value !== (t6_value = /*$content*/ ctx[0][/*commune*/ ctx[13].status] + "")) set_data_dev(t6, t6_value); + if (dirty & /*$content*/ 1 && t8_value !== (t8_value = /*$content*/ ctx[0].members + "")) set_data_dev(t8, t8_value); + if (dirty & /*$content*/ 1 && t12_value !== (t12_value = /*$content*/ ctx[0].contact + "")) set_data_dev(t12, t12_value); + if (dirty & /*$content*/ 1 && t14_value !== (t14_value = /*$content*/ ctx[0][/*commune*/ ctx[13].contact[1]] + "")) set_data_dev(t14, t14_value); + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_each_block_1.name, + type: "each", + source: "(52:24) {#each communes as commune}", + ctx + }); + + return block; +} + +// (49:16) {#each Object.entries(communesByCountry) as [name,communes]} +function create_each_block(ctx) { + let h4; + let t0_value = /*getCountry*/ ctx[6](/*name*/ ctx[9]) + ""; + let t0; + let t1; + let div; + let t2; + let each_value_1 = /*communes*/ ctx[10]; + validate_each_argument(each_value_1); + let each_blocks = []; + + for (let i = 0; i < each_value_1.length; i += 1) { + each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i)); + } + + const block = { + c: function create() { + h4 = element("h4"); + t0 = text(t0_value); + t1 = space(); + div = element("div"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + t2 = space(); + attr_dev(h4, "class", "country-name"); + add_location(h4, file, 49, 20, 1738); + attr_dev(div, "class", "country-block"); + add_location(div, file, 50, 20, 1808); + }, + m: function mount(target, anchor) { + insert_dev(target, h4, anchor); + append_dev(h4, t0); + insert_dev(target, t1, anchor); + insert_dev(target, div, anchor); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(div, null); + } + + append_dev(div, t2); + }, + p: function update(ctx, dirty) { + if (dirty & /*Object, communesByCountry, $content, getAddress*/ 129) { + each_value_1 = /*communes*/ ctx[10]; + validate_each_argument(each_value_1); + let i; + + for (i = 0; i < each_value_1.length; i += 1) { + const child_ctx = get_each_context_1(ctx, each_value_1, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block_1(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div, t2); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value_1.length; + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(h4); + if (detaching) detach_dev(t1); + if (detaching) detach_dev(div); + destroy_each(each_blocks, detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_each_block.name, + type: "each", + source: "(49:16) {#each Object.entries(communesByCountry) as [name,communes]}", + ctx + }); + + return block; +} + +// (38:0) {#key $loaded} +function create_key_block(ctx) { + let if_block_anchor; + let if_block = /*$loaded*/ ctx[1] == 2 && create_if_block(ctx); + + const block = { + c: function create() { + if (if_block) if_block.c(); + if_block_anchor = empty(); + }, + m: function mount(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert_dev(target, if_block_anchor, anchor); + }, + p: function update(ctx, dirty) { + if (/*$loaded*/ ctx[1] == 2) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block(ctx); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + }, + d: function destroy(detaching) { + if (if_block) if_block.d(detaching); + if (detaching) detach_dev(if_block_anchor); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_key_block.name, + type: "key", + source: "(38:0) {#key $loaded}", + ctx + }); + + return block; +} + +function create_fragment(ctx) { + let previous_key = /*$loaded*/ ctx[1]; + let key_block_anchor; + let key_block = create_key_block(ctx); + + const block = { + c: function create() { + key_block.c(); + key_block_anchor = empty(); + this.c = noop; + }, + l: function claim(nodes) { + throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); + }, + m: function mount(target, anchor) { + key_block.m(target, anchor); + insert_dev(target, key_block_anchor, anchor); + }, + p: function update(ctx, [dirty]) { + if (dirty & /*$loaded*/ 2 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[1])) { + key_block.d(1); + key_block = create_key_block(ctx); + key_block.c(); + key_block.m(key_block_anchor.parentNode, key_block_anchor); + } else { + key_block.p(ctx, dirty); + } + }, + i: noop, + o: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(key_block_anchor); + key_block.d(detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment.name, + type: "component", + source: "", + ctx + }); + + return block; +} + +function instance($$self, $$props, $$invalidate) { + let $content; + let $loaded; + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots('communes-component', slots, []); + let loaded = writable(0); + validate_store(loaded, 'loaded'); + component_subscribe($$self, loaded, value => $$invalidate(1, $loaded = value)); + let content = writable({}); + validate_store(content, 'content'); + component_subscribe($$self, content, value => $$invalidate(0, $content = value)); + loadLocaleContent(content, "countries", loaded); + let locale = loadLocaleContent(content, "communes-component", loaded); + + function mapCallbackCommunes(createMap, content, locale) { + let map = createMap([22, 0], 2); + addMarkersCommunes(map, content, locale); + } + + function getCountry(name) { + return locale == "en" ? name : $content[name]; + } + + function getAddress(group) { + return group.location[0].map(x => locale == "en" ? x : $content[x]).join(", "); + } + + onMount(() => { + + }); + + const writable_props = []; + + Object_1.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); + }); + + const func = createMap => mapCallbackCommunes(createMap, $content, locale); + + $$self.$capture_state = () => ({ + onMount, + writable, + communesByCountry, + addMarkersCommunes, + loadLocaleContent, + loaded, + content, + locale, + mapCallbackCommunes, + getCountry, + getAddress, + $content, + $loaded + }); + + $$self.$inject_state = $$props => { + if ('loaded' in $$props) $$invalidate(2, loaded = $$props.loaded); + if ('content' in $$props) $$invalidate(3, content = $$props.content); + if ('locale' in $$props) $$invalidate(4, locale = $$props.locale); + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [ + $content, + $loaded, + loaded, + content, + locale, + mapCallbackCommunes, + getCountry, + getAddress, + func + ]; +} + +class Communes_component extends SvelteElement { + constructor(options) { + super(); + this.shadowRoot.innerHTML = ``; + + init( + this, + { + target: this.shadowRoot, + props: attribute_to_object(this.attributes), + customElement: true + }, + instance, + create_fragment, + safe_not_equal, + {}, + null + ); + + if (options) { + if (options.target) { + insert_dev(options.target, this, options.anchor); + } + } + } +} + +customElements.define("communes-component", Communes_component); + +export { Communes_component as default }; diff --git a/Server/public/js/components/compass-component.js b/Server/public/js/components/compass-component.js index 1e38a3d..1ed1bd2 100644 --- a/Server/public/js/components/compass-component.js +++ b/Server/public/js/components/compass-component.js @@ -1 +1,714 @@ -import{S as t,i as n,a as e,b as i,s as o,e as r,n as s,d as a,c as l,o as m,f as c,t as u,g as p,h as d,j as g,l as h,m as f,q as b,p as v,r as q}from"./index-4348483d.js";import{w as x}from"./index-71440b21.js";import{loadLocaleContent as _}from"../../../../../../../../../js/libraries/serverTools.js";import{shuffleArray as z}from"../../../../../../../../../js/libraries/miscTools.js";function w(t,n,e){const i=t.slice();return i[19]=n[e],i[21]=e,i}function y(t){let n,e,r,s,l,m,b,v,q=t[5].heading+"",x=t[0],_=S(t);return{c(){n=c("div"),e=c("div"),r=c("h1"),s=u(q),l=p(),m=c("img"),v=p(),_.c(),d(m,"id","compass-img"),g(m.src,b="/img/common/compass.svg")||d(m,"src","/img/common/compass.svg"),d(m,"alt","compass"),d(e,"id","text-container"),d(n,"id","container")},m(t,o){i(t,n,o),h(n,e),h(e,r),h(r,s),h(e,l),h(e,m),h(e,v),_.m(e,null)},p(t,n){32&n&&q!==(q=t[5].heading+"")&&f(s,q),1&n&&o(x,x=t[0])?(_.d(1),_=S(t),_.c(),_.m(e,null)):_.p(t,n)},d(t){t&&a(n),_.d(t)}}}function k(t){let n,e,o,r,s,l,m,g,v,q,x,_,z,w,y,k,j,C,S,B,M,N,T,D;return{c(){n=c("p"),n.textContent="You are compatible with ...",e=p(),o=c("ul"),r=c("li"),s=u("capitalism by "),l=c("span"),m=u(t[2]),g=u("%"),v=p(),q=c("li"),x=u("vanguardism by "),_=c("span"),z=u(t[3]),w=u("%"),y=p(),k=c("li"),j=u("libertarian socialism by "),C=c("span"),S=u(t[4]),B=u("%"),M=p(),N=c("button"),N.textContent="back",d(o,"class","results-list"),d(N,"class","quiz-buttons")},m(a,c){i(a,n,c),i(a,e,c),i(a,o,c),h(o,r),h(r,s),h(r,l),h(l,m),h(r,g),h(o,v),h(o,q),h(q,x),h(q,_),h(_,z),h(q,w),h(o,y),h(o,k),h(k,j),h(k,C),h(C,S),h(k,B),i(a,M,c),i(a,N,c),T||(D=b(N,"click",t[16]),T=!0)},p(t,n){4&n&&f(m,t[2]),8&n&&f(z,t[3]),16&n&&f(S,t[4])},d(t){t&&a(n),t&&a(e),t&&a(o),t&&a(M),t&&a(N),T=!1,D()}}}function j(t){let n,e,o,r,s,l,m,g,x,_=t[5].qs[t[0]].q+"",z=t[5].qs[t[0]].as,y=[];for(let n=0;ne(6,o=t)));let s=x({});l(t,s,(t=>e(5,i=t))),_(s,"countries",r),_(s,"compass-component",r,(function(t){for(let n of t.qs)z(n.as)}));let a=0,c=[],u="",p="",d="";function g(t){null!=c[t]&&at.includes("C"))).filter(Boolean).length/c.length).toString()),e(3,p=Math.round(100*c.map((t=>t.includes("V"))).filter(Boolean).length/c.length).toString()),e(4,d=Math.round(100*c.map((t=>t.includes("LS"))).filter(Boolean).length/c.length).toString())),e(0,a+=1))}function h(t){0!=a&&e(0,a-=1)}m((()=>{}));return[a,c,u,p,d,i,o,r,s,g,h,function(){c[a]=this.__value,e(1,c)},[[]],t=>e(1,c[a]=t[1],c),()=>h(),()=>g(a),()=>h()]}class T extends t{constructor(t){super(),this.shadowRoot.innerHTML="",n(this,{target:this.shadowRoot,props:e(this.attributes),customElement:!0},N,M,o,{},null),t&&t.target&&i(t.target,this,t.anchor)}}customElements.define("compass-component",T);export{T as default}; + +(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document); +import { S as SvelteElement, i as init, a as attribute_to_object, b as insert_dev, s as safe_not_equal, d as dispatch_dev, v as validate_slots, c as validate_store, e as component_subscribe, o as onMount, f as empty, n as noop, h as detach_dev, k as element, t as text, l as space, m as add_location, p as attr_dev, q as src_url_equal, u as append_dev, w as set_data_dev, j as validate_each_argument, y as listen_dev, x as destroy_each, z as run_all, A as prop_dev } from './index-d19aafba.js'; +import { w as writable } from './index-4664ced0.js'; +import { loadLocaleContent } from '../../../../../../../../../js/libraries/serverTools.js'; +import { shuffleArray } from '../../../../../../../../../js/libraries/miscTools.js'; + +/* src\compass-component.svelte generated by Svelte v3.52.0 */ +const file = "src\\compass-component.svelte"; + +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[19] = list[i]; + child_ctx[21] = i; + return child_ctx; +} + +// (57:4) {#if $loaded==2} +function create_if_block(ctx) { + let div1; + let div0; + let h1; + let t0_value = /*$content*/ ctx[5].heading + ""; + let t0; + let t1; + let img; + let img_src_value; + let t2; + let previous_key = /*qTag*/ ctx[0]; + let key_block = create_key_block_1(ctx); + + const block = { + c: function create() { + div1 = element("div"); + div0 = element("div"); + h1 = element("h1"); + t0 = text(t0_value); + t1 = space(); + img = element("img"); + t2 = space(); + key_block.c(); + add_location(h1, file, 59, 16, 1759); + attr_dev(img, "id", "compass-img"); + if (!src_url_equal(img.src, img_src_value = "/img/common/compass.svg")) attr_dev(img, "src", img_src_value); + attr_dev(img, "alt", "compass"); + add_location(img, file, 60, 16, 1804); + attr_dev(div0, "id", "text-container"); + add_location(div0, file, 58, 12, 1716); + attr_dev(div1, "id", "container"); + add_location(div1, file, 57, 8, 1682); + }, + m: function mount(target, anchor) { + insert_dev(target, div1, anchor); + append_dev(div1, div0); + append_dev(div0, h1); + append_dev(h1, t0); + append_dev(div0, t1); + append_dev(div0, img); + append_dev(div0, t2); + key_block.m(div0, null); + }, + p: function update(ctx, dirty) { + if (dirty & /*$content*/ 32 && t0_value !== (t0_value = /*$content*/ ctx[5].heading + "")) set_data_dev(t0, t0_value); + + if (dirty & /*qTag*/ 1 && safe_not_equal(previous_key, previous_key = /*qTag*/ ctx[0])) { + key_block.d(1); + key_block = create_key_block_1(ctx); + key_block.c(); + key_block.m(div0, null); + } else { + key_block.p(ctx, dirty); + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div1); + key_block.d(detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block.name, + type: "if", + source: "(57:4) {#if $loaded==2}", + ctx + }); + + return block; +} + +// (74:16) {:else} +function create_else_block(ctx) { + let p; + let t1; + let ul; + let li0; + let t2; + let span0; + let t3; + let t4; + let t5; + let li1; + let t6; + let span1; + let t7; + let t8; + let t9; + let li2; + let t10; + let span2; + let t11; + let t12; + let t13; + let button; + let mounted; + let dispose; + + const block = { + c: function create() { + p = element("p"); + p.textContent = "You are compatible with ..."; + t1 = space(); + ul = element("ul"); + li0 = element("li"); + t2 = text("capitalism by "); + span0 = element("span"); + t3 = text(/*capitalismScore*/ ctx[2]); + t4 = text("%"); + t5 = space(); + li1 = element("li"); + t6 = text("vanguardism by "); + span1 = element("span"); + t7 = text(/*vanguardismScore*/ ctx[3]); + t8 = text("%"); + t9 = space(); + li2 = element("li"); + t10 = text("libertarian socialism by "); + span2 = element("span"); + t11 = text(/*socialismScore*/ ctx[4]); + t12 = text("%"); + t13 = space(); + button = element("button"); + button.textContent = "back"; + add_location(p, file, 74, 20, 2731); + add_location(span0, file, 76, 42, 2856); + add_location(li0, file, 76, 24, 2838); + add_location(span1, file, 77, 43, 2937); + add_location(li1, file, 77, 24, 2918); + add_location(span2, file, 78, 53, 3029); + add_location(li2, file, 78, 24, 3000); + attr_dev(ul, "class", "results-list"); + add_location(ul, file, 75, 20, 2787); + attr_dev(button, "class", "quiz-buttons"); + add_location(button, file, 80, 20, 3113); + }, + m: function mount(target, anchor) { + insert_dev(target, p, anchor); + insert_dev(target, t1, anchor); + insert_dev(target, ul, anchor); + append_dev(ul, li0); + append_dev(li0, t2); + append_dev(li0, span0); + append_dev(span0, t3); + append_dev(li0, t4); + append_dev(ul, t5); + append_dev(ul, li1); + append_dev(li1, t6); + append_dev(li1, span1); + append_dev(span1, t7); + append_dev(li1, t8); + append_dev(ul, t9); + append_dev(ul, li2); + append_dev(li2, t10); + append_dev(li2, span2); + append_dev(span2, t11); + append_dev(li2, t12); + insert_dev(target, t13, anchor); + insert_dev(target, button, anchor); + + if (!mounted) { + dispose = listen_dev(button, "click", /*click_handler_3*/ ctx[16], false, false, false); + mounted = true; + } + }, + p: function update(ctx, dirty) { + if (dirty & /*capitalismScore*/ 4) set_data_dev(t3, /*capitalismScore*/ ctx[2]); + if (dirty & /*vanguardismScore*/ 8) set_data_dev(t7, /*vanguardismScore*/ ctx[3]); + if (dirty & /*socialismScore*/ 16) set_data_dev(t11, /*socialismScore*/ ctx[4]); + }, + d: function destroy(detaching) { + if (detaching) detach_dev(p); + if (detaching) detach_dev(t1); + if (detaching) detach_dev(ul); + if (detaching) detach_dev(t13); + if (detaching) detach_dev(button); + mounted = false; + dispose(); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_else_block.name, + type: "else", + source: "(74:16) {:else}", + ctx + }); + + return block; +} + +// (63:16) {#if qTag!=$content.qs.length} +function create_if_block_1(ctx) { + let p; + let t0_value = /*$content*/ ctx[5].qs[/*qTag*/ ctx[0]].q + ""; + let t0; + let t1; + let div; + let t2; + let button0; + let button1; + let mounted; + let dispose; + let each_value = /*$content*/ ctx[5].qs[/*qTag*/ ctx[0]].as; + validate_each_argument(each_value); + let each_blocks = []; + + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + + const block = { + c: function create() { + p = element("p"); + t0 = text(t0_value); + t1 = space(); + div = element("div"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + t2 = space(); + button0 = element("button"); + button0.textContent = "back"; + button1 = element("button"); + button1.textContent = "next"; + add_location(p, file, 63, 20, 1969); + attr_dev(div, "class", "quiz-inputs"); + add_location(div, file, 64, 20, 2019); + attr_dev(button0, "class", "quiz-buttons"); + add_location(button0, file, 72, 20, 2544); + attr_dev(button1, "class", "quiz-buttons"); + add_location(button1, file, 72, 90, 2614); + }, + m: function mount(target, anchor) { + insert_dev(target, p, anchor); + append_dev(p, t0); + insert_dev(target, t1, anchor); + insert_dev(target, div, anchor); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(div, null); + } + + insert_dev(target, t2, anchor); + insert_dev(target, button0, anchor); + insert_dev(target, button1, anchor); + + if (!mounted) { + dispose = [ + listen_dev(button0, "click", /*click_handler_1*/ ctx[14], false, false, false), + listen_dev(button1, "click", /*click_handler_2*/ ctx[15], false, false, false) + ]; + + mounted = true; + } + }, + p: function update(ctx, dirty) { + if (dirty & /*$content, qTag*/ 33 && t0_value !== (t0_value = /*$content*/ ctx[5].qs[/*qTag*/ ctx[0]].q + "")) set_data_dev(t0, t0_value); + + if (dirty & /*answers, qTag, $content*/ 35) { + each_value = /*$content*/ ctx[5].qs[/*qTag*/ ctx[0]].as; + validate_each_argument(each_value); + let i; + + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx, each_value, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div, null); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value.length; + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(p); + if (detaching) detach_dev(t1); + if (detaching) detach_dev(div); + destroy_each(each_blocks, detaching); + if (detaching) detach_dev(t2); + if (detaching) detach_dev(button0); + if (detaching) detach_dev(button1); + mounted = false; + run_all(dispose); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block_1.name, + type: "if", + source: "(63:16) {#if qTag!=$content.qs.length}", + ctx + }); + + return block; +} + +// (66:24) {#each $content.qs[qTag].as as a,i} +function create_each_block(ctx) { + let div; + let input; + let input_value_value; + let t0; + let button; + let t1_value = /*a*/ ctx[19][0] + ""; + let t1; + let t2; + let mounted; + let dispose; + + function click_handler() { + return /*click_handler*/ ctx[13](/*a*/ ctx[19]); + } + + const block = { + c: function create() { + div = element("div"); + input = element("input"); + t0 = space(); + button = element("button"); + t1 = text(t1_value); + t2 = space(); + attr_dev(input, "type", "radio"); + attr_dev(input, "id", "option" + /*i*/ ctx[21]); + attr_dev(input, "name", "options"); + input.__value = input_value_value = /*a*/ ctx[19][1]; + input.value = input.__value; + /*$$binding_groups*/ ctx[12][0].push(input); + add_location(input, file, 67, 32, 2198); + attr_dev(button, "class", "input-label"); + attr_dev(button, "for", "option" + /*i*/ ctx[21]); + add_location(button, file, 68, 32, 2323); + attr_dev(div, "class", "radio-container"); + add_location(div, file, 66, 28, 2135); + }, + m: function mount(target, anchor) { + insert_dev(target, div, anchor); + append_dev(div, input); + input.checked = input.__value === /*answers*/ ctx[1][/*qTag*/ ctx[0]]; + append_dev(div, t0); + append_dev(div, button); + append_dev(button, t1); + append_dev(div, t2); + + if (!mounted) { + dispose = [ + listen_dev(input, "change", /*input_change_handler*/ ctx[11]), + listen_dev(button, "click", click_handler, false, false, false) + ]; + + mounted = true; + } + }, + p: function update(new_ctx, dirty) { + ctx = new_ctx; + + if (dirty & /*$content, qTag*/ 33 && input_value_value !== (input_value_value = /*a*/ ctx[19][1])) { + prop_dev(input, "__value", input_value_value); + input.value = input.__value; + } + + if (dirty & /*answers, qTag*/ 3) { + input.checked = input.__value === /*answers*/ ctx[1][/*qTag*/ ctx[0]]; + } + + if (dirty & /*$content, qTag*/ 33 && t1_value !== (t1_value = /*a*/ ctx[19][0] + "")) set_data_dev(t1, t1_value); + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div); + /*$$binding_groups*/ ctx[12][0].splice(/*$$binding_groups*/ ctx[12][0].indexOf(input), 1); + mounted = false; + run_all(dispose); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_each_block.name, + type: "each", + source: "(66:24) {#each $content.qs[qTag].as as a,i}", + ctx + }); + + return block; +} + +// (62:16) {#key qTag} +function create_key_block_1(ctx) { + let if_block_anchor; + + function select_block_type(ctx, dirty) { + if (/*qTag*/ ctx[0] != /*$content*/ ctx[5].qs.length) return create_if_block_1; + return create_else_block; + } + + let current_block_type = select_block_type(ctx); + let if_block = current_block_type(ctx); + + const block = { + c: function create() { + if_block.c(); + if_block_anchor = empty(); + }, + m: function mount(target, anchor) { + if_block.m(target, anchor); + insert_dev(target, if_block_anchor, anchor); + }, + p: function update(ctx, dirty) { + if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) { + if_block.p(ctx, dirty); + } else { + if_block.d(1); + if_block = current_block_type(ctx); + + if (if_block) { + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } + }, + d: function destroy(detaching) { + if_block.d(detaching); + if (detaching) detach_dev(if_block_anchor); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_key_block_1.name, + type: "key", + source: "(62:16) {#key qTag}", + ctx + }); + + return block; +} + +// (56:0) {#key $loaded} +function create_key_block(ctx) { + let if_block_anchor; + let if_block = /*$loaded*/ ctx[6] == 2 && create_if_block(ctx); + + const block = { + c: function create() { + if (if_block) if_block.c(); + if_block_anchor = empty(); + }, + m: function mount(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert_dev(target, if_block_anchor, anchor); + }, + p: function update(ctx, dirty) { + if (/*$loaded*/ ctx[6] == 2) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block(ctx); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + }, + d: function destroy(detaching) { + if (if_block) if_block.d(detaching); + if (detaching) detach_dev(if_block_anchor); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_key_block.name, + type: "key", + source: "(56:0) {#key $loaded}", + ctx + }); + + return block; +} + +function create_fragment(ctx) { + let previous_key = /*$loaded*/ ctx[6]; + let key_block_anchor; + let key_block = create_key_block(ctx); + + const block = { + c: function create() { + key_block.c(); + key_block_anchor = empty(); + this.c = noop; + }, + l: function claim(nodes) { + throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); + }, + m: function mount(target, anchor) { + key_block.m(target, anchor); + insert_dev(target, key_block_anchor, anchor); + }, + p: function update(ctx, [dirty]) { + if (dirty & /*$loaded*/ 64 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[6])) { + key_block.d(1); + key_block = create_key_block(ctx); + key_block.c(); + key_block.m(key_block_anchor.parentNode, key_block_anchor); + } else { + key_block.p(ctx, dirty); + } + }, + i: noop, + o: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(key_block_anchor); + key_block.d(detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment.name, + type: "component", + source: "", + ctx + }); + + return block; +} + +function instance($$self, $$props, $$invalidate) { + let $content; + let $loaded; + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots('compass-component', slots, []); + let loaded = writable(0); + validate_store(loaded, 'loaded'); + component_subscribe($$self, loaded, value => $$invalidate(6, $loaded = value)); + let content = writable({}); + validate_store(content, 'content'); + component_subscribe($$self, content, value => $$invalidate(5, $content = value)); + loadLocaleContent(content, "countries", loaded); + let locale = loadLocaleContent(content, "compass-component", loaded, contentCallback); + let qTag = 0; + let answers = []; + let capitalismScore = ""; + let vanguardismScore = ""; + let socialismScore = ""; + + function contentCallback(content) { + for (let q of content.qs) { + shuffleArray(q.as); + } + } + + function next(i) { + if (answers[i] != undefined) { + if (qTag < $content.qs.length) { + if (qTag == $content.qs.length - 1) { + $$invalidate(2, capitalismScore = Math.round(answers.map(x => x.includes("C")).filter(Boolean).length * 100 / answers.length).toString()); + $$invalidate(3, vanguardismScore = Math.round(answers.map(x => x.includes("V")).filter(Boolean).length * 100 / answers.length).toString()); + $$invalidate(4, socialismScore = Math.round(answers.map(x => x.includes("LS")).filter(Boolean).length * 100 / answers.length).toString()); + } + + $$invalidate(0, qTag = qTag + 1); + } + } + } + + function back(i) { + if (qTag != 0) { + $$invalidate(0, qTag = qTag - 1); + } + } + + onMount(() => { + + }); + + const writable_props = []; + + Object.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); + }); + + const $$binding_groups = [[]]; + + function input_change_handler() { + answers[qTag] = this.__value; + $$invalidate(1, answers); + } + + const click_handler = a => $$invalidate(1, answers[qTag] = a[1], answers); + const click_handler_1 = () => back(); + const click_handler_2 = () => next(qTag); + const click_handler_3 = () => back(); + + $$self.$capture_state = () => ({ + onMount, + writable, + loadLocaleContent, + shuffleArray, + loaded, + content, + locale, + qTag, + answers, + capitalismScore, + vanguardismScore, + socialismScore, + contentCallback, + next, + back, + $content, + $loaded + }); + + $$self.$inject_state = $$props => { + if ('loaded' in $$props) $$invalidate(7, loaded = $$props.loaded); + if ('content' in $$props) $$invalidate(8, content = $$props.content); + if ('locale' in $$props) locale = $$props.locale; + if ('qTag' in $$props) $$invalidate(0, qTag = $$props.qTag); + if ('answers' in $$props) $$invalidate(1, answers = $$props.answers); + if ('capitalismScore' in $$props) $$invalidate(2, capitalismScore = $$props.capitalismScore); + if ('vanguardismScore' in $$props) $$invalidate(3, vanguardismScore = $$props.vanguardismScore); + if ('socialismScore' in $$props) $$invalidate(4, socialismScore = $$props.socialismScore); + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [ + qTag, + answers, + capitalismScore, + vanguardismScore, + socialismScore, + $content, + $loaded, + loaded, + content, + next, + back, + input_change_handler, + $$binding_groups, + click_handler, + click_handler_1, + click_handler_2, + click_handler_3 + ]; +} + +class Compass_component extends SvelteElement { + constructor(options) { + super(); + this.shadowRoot.innerHTML = ``; + + init( + this, + { + target: this.shadowRoot, + props: attribute_to_object(this.attributes), + customElement: true + }, + instance, + create_fragment, + safe_not_equal, + {}, + null + ); + + if (options) { + if (options.target) { + insert_dev(options.target, this, options.anchor); + } + } + } +} + +customElements.define("compass-component", Compass_component); + +export { Compass_component as default }; diff --git a/Server/public/js/components/cookies-dialog.js b/Server/public/js/components/cookies-dialog.js index 79c9c70..d4a55c2 100644 --- a/Server/public/js/components/cookies-dialog.js +++ b/Server/public/js/components/cookies-dialog.js @@ -1 +1,99 @@ -import{S as e,i as s,a as t,b as o,s as i,f as a,n as r,h as n,d as c,o as d}from"./index-4348483d.js";function p(e){let s;return{c(){s=a("div"),s.innerHTML="

We use cookies to improve your experience, personalise your content and analyse site usage. By clicking “OK”, you agree to the use of cookies.

",this.c=r,n(s,"id","wrapper")},m(e,t){o(e,s,t)},p:r,i:r,o:r,d(e){e&&c(s)}}}function u(e){return d((()=>{})),[]}class h extends e{constructor(e){super(),this.shadowRoot.innerHTML="",s(this,{target:this.shadowRoot,props:t(this.attributes),customElement:!0},u,p,i,{},null),e&&e.target&&o(e.target,this,e.anchor)}}customElements.define("cookies-dialog",h);export{h as default}; + +(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document); +import { S as SvelteElement, i as init, a as attribute_to_object, b as insert_dev, s as safe_not_equal, d as dispatch_dev, v as validate_slots, o as onMount, k as element, n as noop, m as add_location, p as attr_dev, u as append_dev, h as detach_dev } from './index-d19aafba.js'; + +/* src\components\cookies-dialog.svelte generated by Svelte v3.52.0 */ +const file = "src\\components\\cookies-dialog.svelte"; + +function create_fragment(ctx) { + let div1; + let div0; + let p; + + const block = { + c: function create() { + div1 = element("div"); + div0 = element("div"); + p = element("p"); + p.textContent = "We use cookies to improve your experience, personalise your content and analyse site usage. By clicking “OK”, you agree to the use of cookies."; + this.c = noop; + add_location(p, file, 19, 8, 248); + add_location(div0, file, 18, 4, 233); + attr_dev(div1, "id", "wrapper"); + add_location(div1, file, 17, 0, 209); + }, + l: function claim(nodes) { + throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); + }, + m: function mount(target, anchor) { + insert_dev(target, div1, anchor); + append_dev(div1, div0); + append_dev(div0, p); + }, + p: noop, + i: noop, + o: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(div1); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment.name, + type: "component", + source: "", + ctx + }); + + return block; +} + +function instance($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots('cookies-dialog', slots, []); + + onMount(() => { + + }); + + const writable_props = []; + + Object.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); + }); + + $$self.$capture_state = () => ({ onMount }); + return []; +} + +class Cookies_dialog extends SvelteElement { + constructor(options) { + super(); + this.shadowRoot.innerHTML = ``; + + init( + this, + { + target: this.shadowRoot, + props: attribute_to_object(this.attributes), + customElement: true + }, + instance, + create_fragment, + safe_not_equal, + {}, + null + ); + + if (options) { + if (options.target) { + insert_dev(options.target, this, options.anchor); + } + } + } +} + +customElements.define("cookies-dialog", Cookies_dialog); + +export { Cookies_dialog as default }; diff --git a/Server/public/js/components/cooperatives-component.js b/Server/public/js/components/cooperatives-component.js index bf76fda..d049e46 100644 --- a/Server/public/js/components/cooperatives-component.js +++ b/Server/public/js/components/cooperatives-component.js @@ -1 +1,737 @@ -import{S as t,i as e,a as o,b as n,s as i,e as r,n as a,d as s,c,o as m,f as l,t as p,g,h as d,j as h,k as f,l as u,m as b,p as w}from"./index-4348483d.js";import{w as x}from"./index-71440b21.js";import{addMarkersCoops as v,coopsByCountry as j}from"../../../../../../../../../js/coops.js";import{loadLocaleContent as k}from"../../../../../../../../../js/libraries/serverTools.js";import"../../../../../../../../../js/components/map-component.js";function y(t,e,o){const n=t.slice();return n[8]=e[o][0],n[9]=e[o][1],n}function z(t,e,o){const n=t.slice();return n[12]=e[o],n}function D(t){let e,o,i,r,a,c,m,x,v,k,z,D,E,O,R,T,_,A,C,H,L=t[1].cooperatives+"",M=t[1].p1+"",S=t[1].subheading1+"",q=t[1]["map-prompt"]+"",B=Object.entries(j),F=[];for(let e=0;eo(0,n=t)));let a=x({});c(t,a,(t=>o(1,i=t))),k(a,"countries",r);let s=k(a,"cooperatives-component",r);function l(t,e){let o=t([22,0],2);v(o,e)}m((()=>{}));return[n,i,r,a,s,l,t=>l(t,i),t=>i[t]]}class _ extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:o(this.attributes),customElement:!0},T,R,i,{},null),t&&t.target&&n(t.target,this,t.anchor)}}customElements.define("cooperatives-component",_);export{_ as default}; + +(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document); +import { S as SvelteElement, i as init, a as attribute_to_object, b as insert_dev, s as safe_not_equal, d as dispatch_dev, v as validate_slots, c as validate_store, e as component_subscribe, o as onMount, g as globals, f as empty, n as noop, h as detach_dev, j as validate_each_argument, k as element, t as text, l as space, m as add_location, p as attr_dev, q as src_url_equal, r as set_custom_element_data, u as append_dev, w as set_data_dev, x as destroy_each } from './index-d19aafba.js'; +import { w as writable } from './index-4664ced0.js'; +import { coopsByCountry, addMarkersCoops } from '../../../../../../../../../js/coops.js'; +import { loadLocaleContent } from '../../../../../../../../../js/libraries/serverTools.js'; +import '../../../../../../../../../js/components/map-component.js'; + +/* src\cooperatives-component.svelte generated by Svelte v3.52.0 */ + +const { Object: Object_1 } = globals; + +const file = "src\\cooperatives-component.svelte"; + +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[9] = list[i][0]; + child_ctx[10] = list[i][1]; + return child_ctx; +} + +function get_each_context_1(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[13] = list[i]; + return child_ctx; +} + +// (39:4) {#if $loaded==2} +function create_if_block(ctx) { + let div1; + let div0; + let h1; + let t0_value = /*$content*/ ctx[0].cooperatives + ""; + let t0; + let t1; + let img; + let img_src_value; + let t2; + let p0; + let t3_value = /*$content*/ ctx[0].p1 + ""; + let t3; + let t4; + let h3; + let t5_value = /*$content*/ ctx[0].subheading1 + ""; + let t5; + let t6; + let map_component; + let map_component_callback_value; + let t7; + let p1; + let t8_value = /*$content*/ ctx[0]["map-prompt"] + ""; + let t8; + let t9; + let each_value = Object.entries(coopsByCountry); + validate_each_argument(each_value); + let each_blocks = []; + + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + + const block = { + c: function create() { + div1 = element("div"); + div0 = element("div"); + h1 = element("h1"); + t0 = text(t0_value); + t1 = space(); + img = element("img"); + t2 = space(); + p0 = element("p"); + t3 = text(t3_value); + t4 = space(); + h3 = element("h3"); + t5 = text(t5_value); + t6 = space(); + map_component = element("map-component"); + t7 = space(); + p1 = element("p"); + t8 = text(t8_value); + t9 = space(); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + add_location(h1, file, 41, 16, 1144); + attr_dev(img, "id", "coops-img"); + if (!src_url_equal(img.src, img_src_value = "/img/common/coops.svg")) attr_dev(img, "src", img_src_value); + attr_dev(img, "alt", "coops"); + add_location(img, file, 42, 16, 1194); + attr_dev(p0, "class", "description"); + add_location(p0, file, 43, 16, 1272); + add_location(h3, file, 44, 16, 1330); + set_custom_element_data(map_component, "id", "map"); + set_custom_element_data(map_component, "callback", map_component_callback_value = /*func*/ ctx[8]); + add_location(map_component, file, 45, 16, 1379); + attr_dev(p1, "id", "add-prompt"); + add_location(p1, file, 46, 16, 1507); + attr_dev(div0, "id", "text-container"); + add_location(div0, file, 40, 12, 1101); + attr_dev(div1, "id", "container"); + add_location(div1, file, 39, 8, 1067); + }, + m: function mount(target, anchor) { + insert_dev(target, div1, anchor); + append_dev(div1, div0); + append_dev(div0, h1); + append_dev(h1, t0); + append_dev(div0, t1); + append_dev(div0, img); + append_dev(div0, t2); + append_dev(div0, p0); + append_dev(p0, t3); + append_dev(div0, t4); + append_dev(div0, h3); + append_dev(h3, t5); + append_dev(div0, t6); + append_dev(div0, map_component); + append_dev(div0, t7); + append_dev(div0, p1); + append_dev(p1, t8); + append_dev(div0, t9); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(div0, null); + } + }, + p: function update(ctx, dirty) { + if (dirty & /*$content*/ 1 && t0_value !== (t0_value = /*$content*/ ctx[0].cooperatives + "")) set_data_dev(t0, t0_value); + if (dirty & /*$content*/ 1 && t3_value !== (t3_value = /*$content*/ ctx[0].p1 + "")) set_data_dev(t3, t3_value); + if (dirty & /*$content*/ 1 && t5_value !== (t5_value = /*$content*/ ctx[0].subheading1 + "")) set_data_dev(t5, t5_value); + + if (dirty & /*$content*/ 1 && map_component_callback_value !== (map_component_callback_value = /*func*/ ctx[8])) { + set_custom_element_data(map_component, "callback", map_component_callback_value); + } + + if (dirty & /*$content*/ 1 && t8_value !== (t8_value = /*$content*/ ctx[0]["map-prompt"] + "")) set_data_dev(t8, t8_value); + + if (dirty & /*Object, coopsByCountry, $content, getAddress, getCountry*/ 193) { + each_value = Object.entries(coopsByCountry); + validate_each_argument(each_value); + let i; + + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx, each_value, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div0, null); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value.length; + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div1); + destroy_each(each_blocks, detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block.name, + type: "if", + source: "(39:4) {#if $loaded==2}", + ctx + }); + + return block; +} + +// (51:24) {#each coops as coop} +function create_each_block_1(ctx) { + let div2; + let div1; + let div0; + let p0; + let b0; + let t0_value = /*$content*/ ctx[0].name + ""; + let t0; + let t1; + let t2_value = /*coop*/ ctx[13].name + ""; + let t2; + let t3; + let p1; + let b1; + let t4_value = /*$content*/ ctx[0].location + ""; + let t4; + let t5; + let t6_value = /*getAddress*/ ctx[7](/*coop*/ ctx[13]) + ""; + let t6; + let t7; + let p2; + let b2; + let t8_value = /*$content*/ ctx[0].market + ""; + let t8; + let t9; + let t10_value = /*$content*/ ctx[0][/*coop*/ ctx[13].market] + ""; + let t10; + let t11; + let p3; + let b3; + let t12_value = /*$content*/ ctx[0].workers + ""; + let t12; + let t13; + let t14_value = /*coop*/ ctx[13].workers + ""; + let t14; + let t15; + let p4; + let b4; + let t16_value = /*$content*/ ctx[0].status + ""; + let t16; + let t17; + let t18_value = /*$content*/ ctx[0][/*coop*/ ctx[13].status] + ""; + let t18; + let t19; + let p5; + let b5; + let t20_value = /*$content*/ ctx[0].website + ""; + let t20; + let t21; + let a0; + let t22_value = /*coop*/ ctx[13].website[1] + ""; + let t22; + let t23; + let p6; + let b6; + let t24_value = /*$content*/ ctx[0].contact + ""; + let t24; + let t25; + let a1; + let t26_value = /*$content*/ ctx[0][/*coop*/ ctx[13].contact[1]] + ""; + let t26; + let t27; + let picture; + let source0; + let t28; + let source1; + let t29; + let img; + let t30; + let p7; + let b7; + let t31_value = /*$content*/ ctx[0].description + ""; + let t31; + let t32; + let t33_value = /*$content*/ ctx[0][/*coop*/ ctx[13].description] + ""; + let t33; + + const block = { + c: function create() { + div2 = element("div"); + div1 = element("div"); + div0 = element("div"); + p0 = element("p"); + b0 = element("b"); + t0 = text(t0_value); + t1 = text(": "); + t2 = text(t2_value); + t3 = space(); + p1 = element("p"); + b1 = element("b"); + t4 = text(t4_value); + t5 = text(": "); + t6 = text(t6_value); + t7 = space(); + p2 = element("p"); + b2 = element("b"); + t8 = text(t8_value); + t9 = text(": "); + t10 = text(t10_value); + t11 = space(); + p3 = element("p"); + b3 = element("b"); + t12 = text(t12_value); + t13 = text(": "); + t14 = text(t14_value); + t15 = space(); + p4 = element("p"); + b4 = element("b"); + t16 = text(t16_value); + t17 = text(": "); + t18 = text(t18_value); + t19 = space(); + p5 = element("p"); + b5 = element("b"); + t20 = text(t20_value); + t21 = text(": "); + a0 = element("a"); + t22 = text(t22_value); + t23 = space(); + p6 = element("p"); + b6 = element("b"); + t24 = text(t24_value); + t25 = text(": "); + a1 = element("a"); + t26 = text(t26_value); + t27 = space(); + picture = element("picture"); + source0 = element("source"); + t28 = space(); + source1 = element("source"); + t29 = space(); + img = element("img"); + t30 = space(); + p7 = element("p"); + b7 = element("b"); + t31 = text(t31_value); + t32 = text(": "); + t33 = text(t33_value); + add_location(b0, file, 54, 43, 2001); + add_location(p0, file, 54, 40, 1998); + add_location(b1, file, 55, 43, 2085); + add_location(p1, file, 55, 40, 2082); + add_location(b2, file, 56, 43, 2180); + add_location(p2, file, 56, 40, 2177); + add_location(b3, file, 57, 43, 2278); + add_location(p3, file, 57, 40, 2275); + add_location(b4, file, 58, 43, 2368); + add_location(p4, file, 58, 40, 2365); + add_location(b5, file, 59, 43, 2466); + attr_dev(a0, "href", /*coop*/ ctx[13].website[0]); + attr_dev(a0, "target", "_blank"); + attr_dev(a0, "rel", "noreferrer"); + add_location(a0, file, 59, 70, 2493); + add_location(p5, file, 59, 40, 2463); + add_location(b6, file, 60, 43, 2620); + attr_dev(a1, "href", /*coop*/ ctx[13].contact[0]); + attr_dev(a1, "target", ";_blank;"); + attr_dev(a1, "rel", "noreferrer"); + add_location(a1, file, 60, 70, 2647); + add_location(p6, file, 60, 40, 2617); + add_location(div0, file, 53, 36, 1951); + attr_dev(source0, "srcset", "/img/coops/" + /*coop*/ ctx[13].logo + ".webp"); + add_location(source0, file, 63, 40, 2872); + attr_dev(source1, "srcset", "/img/coops/" + /*coop*/ ctx[13].logo + ".png"); + add_location(source1, file, 64, 40, 2963); + attr_dev(img, "class", "coop-logo"); + attr_dev(img, "alt", "logo"); + add_location(img, file, 65, 40, 3053); + add_location(picture, file, 62, 36, 2821); + attr_dev(div1, "class", "img-general-info"); + add_location(div1, file, 52, 32, 1883); + add_location(b7, file, 68, 35, 3212); + add_location(p7, file, 68, 32, 3209); + attr_dev(div2, "class", "location-info"); + add_location(div2, file, 51, 28, 1822); + }, + m: function mount(target, anchor) { + insert_dev(target, div2, anchor); + append_dev(div2, div1); + append_dev(div1, div0); + append_dev(div0, p0); + append_dev(p0, b0); + append_dev(b0, t0); + append_dev(b0, t1); + append_dev(p0, t2); + append_dev(div0, t3); + append_dev(div0, p1); + append_dev(p1, b1); + append_dev(b1, t4); + append_dev(b1, t5); + append_dev(p1, t6); + append_dev(div0, t7); + append_dev(div0, p2); + append_dev(p2, b2); + append_dev(b2, t8); + append_dev(b2, t9); + append_dev(p2, t10); + append_dev(div0, t11); + append_dev(div0, p3); + append_dev(p3, b3); + append_dev(b3, t12); + append_dev(b3, t13); + append_dev(p3, t14); + append_dev(div0, t15); + append_dev(div0, p4); + append_dev(p4, b4); + append_dev(b4, t16); + append_dev(b4, t17); + append_dev(p4, t18); + append_dev(div0, t19); + append_dev(div0, p5); + append_dev(p5, b5); + append_dev(b5, t20); + append_dev(b5, t21); + append_dev(p5, a0); + append_dev(a0, t22); + append_dev(div0, t23); + append_dev(div0, p6); + append_dev(p6, b6); + append_dev(b6, t24); + append_dev(b6, t25); + append_dev(p6, a1); + append_dev(a1, t26); + append_dev(div1, t27); + append_dev(div1, picture); + append_dev(picture, source0); + append_dev(picture, t28); + append_dev(picture, source1); + append_dev(picture, t29); + append_dev(picture, img); + append_dev(div2, t30); + append_dev(div2, p7); + append_dev(p7, b7); + append_dev(b7, t31); + append_dev(b7, t32); + append_dev(p7, t33); + }, + p: function update(ctx, dirty) { + if (dirty & /*$content*/ 1 && t0_value !== (t0_value = /*$content*/ ctx[0].name + "")) set_data_dev(t0, t0_value); + if (dirty & /*$content*/ 1 && t4_value !== (t4_value = /*$content*/ ctx[0].location + "")) set_data_dev(t4, t4_value); + if (dirty & /*$content*/ 1 && t8_value !== (t8_value = /*$content*/ ctx[0].market + "")) set_data_dev(t8, t8_value); + if (dirty & /*$content*/ 1 && t10_value !== (t10_value = /*$content*/ ctx[0][/*coop*/ ctx[13].market] + "")) set_data_dev(t10, t10_value); + if (dirty & /*$content*/ 1 && t12_value !== (t12_value = /*$content*/ ctx[0].workers + "")) set_data_dev(t12, t12_value); + if (dirty & /*$content*/ 1 && t16_value !== (t16_value = /*$content*/ ctx[0].status + "")) set_data_dev(t16, t16_value); + if (dirty & /*$content*/ 1 && t18_value !== (t18_value = /*$content*/ ctx[0][/*coop*/ ctx[13].status] + "")) set_data_dev(t18, t18_value); + if (dirty & /*$content*/ 1 && t20_value !== (t20_value = /*$content*/ ctx[0].website + "")) set_data_dev(t20, t20_value); + if (dirty & /*$content*/ 1 && t24_value !== (t24_value = /*$content*/ ctx[0].contact + "")) set_data_dev(t24, t24_value); + if (dirty & /*$content*/ 1 && t26_value !== (t26_value = /*$content*/ ctx[0][/*coop*/ ctx[13].contact[1]] + "")) set_data_dev(t26, t26_value); + if (dirty & /*$content*/ 1 && t31_value !== (t31_value = /*$content*/ ctx[0].description + "")) set_data_dev(t31, t31_value); + if (dirty & /*$content*/ 1 && t33_value !== (t33_value = /*$content*/ ctx[0][/*coop*/ ctx[13].description] + "")) set_data_dev(t33, t33_value); + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div2); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_each_block_1.name, + type: "each", + source: "(51:24) {#each coops as coop}", + ctx + }); + + return block; +} + +// (48:16) {#each Object.entries(coopsByCountry) as [name,coops]} +function create_each_block(ctx) { + let h4; + let t0_value = /*getCountry*/ ctx[6](/*name*/ ctx[9]) + ""; + let t0; + let t1; + let div; + let t2; + let each_value_1 = /*coops*/ ctx[10]; + validate_each_argument(each_value_1); + let each_blocks = []; + + for (let i = 0; i < each_value_1.length; i += 1) { + each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i)); + } + + const block = { + c: function create() { + h4 = element("h4"); + t0 = text(t0_value); + t1 = space(); + div = element("div"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + t2 = space(); + attr_dev(h4, "class", "country-name"); + add_location(h4, file, 48, 20, 1648); + attr_dev(div, "class", "country-block"); + add_location(div, file, 49, 20, 1718); + }, + m: function mount(target, anchor) { + insert_dev(target, h4, anchor); + append_dev(h4, t0); + insert_dev(target, t1, anchor); + insert_dev(target, div, anchor); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(div, null); + } + + append_dev(div, t2); + }, + p: function update(ctx, dirty) { + if (dirty & /*$content, Object, coopsByCountry, getAddress*/ 129) { + each_value_1 = /*coops*/ ctx[10]; + validate_each_argument(each_value_1); + let i; + + for (i = 0; i < each_value_1.length; i += 1) { + const child_ctx = get_each_context_1(ctx, each_value_1, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block_1(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div, t2); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value_1.length; + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(h4); + if (detaching) detach_dev(t1); + if (detaching) detach_dev(div); + destroy_each(each_blocks, detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_each_block.name, + type: "each", + source: "(48:16) {#each Object.entries(coopsByCountry) as [name,coops]}", + ctx + }); + + return block; +} + +// (38:0) {#key $loaded} +function create_key_block(ctx) { + let if_block_anchor; + let if_block = /*$loaded*/ ctx[1] == 2 && create_if_block(ctx); + + const block = { + c: function create() { + if (if_block) if_block.c(); + if_block_anchor = empty(); + }, + m: function mount(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert_dev(target, if_block_anchor, anchor); + }, + p: function update(ctx, dirty) { + if (/*$loaded*/ ctx[1] == 2) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block(ctx); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + }, + d: function destroy(detaching) { + if (if_block) if_block.d(detaching); + if (detaching) detach_dev(if_block_anchor); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_key_block.name, + type: "key", + source: "(38:0) {#key $loaded}", + ctx + }); + + return block; +} + +function create_fragment(ctx) { + let previous_key = /*$loaded*/ ctx[1]; + let key_block_anchor; + let key_block = create_key_block(ctx); + + const block = { + c: function create() { + key_block.c(); + key_block_anchor = empty(); + this.c = noop; + }, + l: function claim(nodes) { + throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); + }, + m: function mount(target, anchor) { + key_block.m(target, anchor); + insert_dev(target, key_block_anchor, anchor); + }, + p: function update(ctx, [dirty]) { + if (dirty & /*$loaded*/ 2 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[1])) { + key_block.d(1); + key_block = create_key_block(ctx); + key_block.c(); + key_block.m(key_block_anchor.parentNode, key_block_anchor); + } else { + key_block.p(ctx, dirty); + } + }, + i: noop, + o: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(key_block_anchor); + key_block.d(detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment.name, + type: "component", + source: "", + ctx + }); + + return block; +} + +function instance($$self, $$props, $$invalidate) { + let $content; + let $loaded; + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots('cooperatives-component', slots, []); + let loaded = writable(0); + validate_store(loaded, 'loaded'); + component_subscribe($$self, loaded, value => $$invalidate(1, $loaded = value)); + let content = writable({}); + validate_store(content, 'content'); + component_subscribe($$self, content, value => $$invalidate(0, $content = value)); + let locale = loadLocaleContent(content, "countries", loaded); + loadLocaleContent(content, "cooperatives-component", loaded); + + function mapCallbackCoops(createMap, content) { + let map = createMap([22, 0], 2); + addMarkersCoops(map, content, locale); + } + + function getCountry(name) { + return locale == "en" ? name : $content[name]; + } + + function getAddress(group) { + return group.location[0].map(x => locale == "en" ? x : $content[x]).join(", "); + } + + onMount(() => { + + }); + + const writable_props = []; + + Object_1.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); + }); + + const func = createMap => mapCallbackCoops(createMap, $content); + + $$self.$capture_state = () => ({ + onMount, + writable, + coopsByCountry, + addMarkersCoops, + loadLocaleContent, + loaded, + content, + locale, + mapCallbackCoops, + getCountry, + getAddress, + $content, + $loaded + }); + + $$self.$inject_state = $$props => { + if ('loaded' in $$props) $$invalidate(2, loaded = $$props.loaded); + if ('content' in $$props) $$invalidate(3, content = $$props.content); + if ('locale' in $$props) $$invalidate(4, locale = $$props.locale); + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [ + $content, + $loaded, + loaded, + content, + locale, + mapCallbackCoops, + getCountry, + getAddress, + func + ]; +} + +class Cooperatives_component extends SvelteElement { + constructor(options) { + super(); + this.shadowRoot.innerHTML = ``; + + init( + this, + { + target: this.shadowRoot, + props: attribute_to_object(this.attributes), + customElement: true + }, + instance, + create_fragment, + safe_not_equal, + {}, + null + ); + + if (options) { + if (options.target) { + insert_dev(options.target, this, options.anchor); + } + } + } +} + +customElements.define("cooperatives-component", Cooperatives_component); + +export { Cooperatives_component as default }; diff --git a/Server/public/js/components/footer-component.js b/Server/public/js/components/footer-component.js index 008f55c..56d805f 100644 --- a/Server/public/js/components/footer-component.js +++ b/Server/public/js/components/footer-component.js @@ -1 +1,347 @@ -import{S as t,i as e,a as o,b as r,s as a,e as i,n,d as s,c as m,f as c,t as f,g as d,h as l,v as g,l as h,q as p,m as u}from"./index-4348483d.js";import{w as b}from"./index-71440b21.js";import{loadLocaleContent as w}from"../../../../../../../../../js/libraries/serverTools.js";function v(t){let e,o,a,i,n,m,b,w,v,k,y,x,L,j,z,U,_,C,T,B,H,M,R=t[1].contactUs+"",A=t[1].inviteLink+"",D=t[1].inviteLink+"";return{c(){e=c("footer"),o=c("div"),a=c("div"),i=c("div"),n=c("h2"),m=f(R),b=d(),w=c("p"),v=f("Discord: "),k=c("a"),y=f(A),x=d(),L=c("p"),j=f("WhatsApp: "),z=c("a"),U=f(D),_=d(),C=c("button"),C.innerHTML='',T=d(),B=c("p"),B.innerHTML='Licensed under a Creative Commons CC BY 4.0 license',l(k,"href","https://discord.gg/Qk8KUk787z"),l(k,"target","_blank"),l(k,"rel","noreferrer"),g(k,"margin-left","1.8rem"),l(z,"href","https://chat.whatsapp.com/BhnmUNljUxJ2AjeHUwyTKh"),l(z,"target","_blank"),l(z,"rel","noreferrer"),g(z,"margin-left","0.5rem"),l(i,"id","contact-us-container"),l(a,"id","footer-grid-content-container"),l(a,"class","logged"),l(C,"id","footer-up"),l(C,"aria-label","go up"),l(B,"id","footer-copyright"),l(o,"id","footer-content-container")},m(s,c){r(s,e,c),h(e,o),h(o,a),h(a,i),h(i,n),h(n,m),h(i,b),h(i,w),h(w,v),h(w,k),h(k,y),h(i,x),h(i,L),h(L,j),h(L,z),h(z,U),h(o,_),h(o,C),h(o,T),h(o,B),H||(M=p(C,"click",t[4]),H=!0)},p(t,e){2&e&&R!==(R=t[1].contactUs+"")&&u(m,R),2&e&&A!==(A=t[1].inviteLink+"")&&u(y,A),2&e&&D!==(D=t[1].inviteLink+"")&&u(U,D)},d(t){t&&s(e),H=!1,M()}}}function k(t){let e,o=2==t[0]&&v(t);return{c(){o&&o.c(),e=i()},m(t,a){o&&o.m(t,a),r(t,e,a)},p(t,r){2==t[0]?o?o.p(t,r):(o=v(t),o.c(),o.m(e.parentNode,e)):o&&(o.d(1),o=null)},d(t){o&&o.d(t),t&&s(e)}}}function y(t){let e,o=t[0],m=k(t);return{c(){m.c(),e=i(),this.c=n},m(t,o){m.m(t,o),r(t,e,o)},p(t,[r]){1&r&&a(o,o=t[0])?(m.d(1),m=k(t),m.c(),m.m(e.parentNode,e)):m.p(t,r)},i:n,o:n,d(t){t&&s(e),m.d(t)}}}function x(t,e,o){let r,a,i=b(0);m(t,i,(t=>o(0,r=t)));let n=b({});m(t,n,(t=>o(1,a=t))),w(n,"countries",i),w(n,"footer-component",i);return[r,a,i,n,()=>{location.href="#"}]}class L extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:o(this.attributes),customElement:!0},x,y,a,{},null),t&&t.target&&r(t.target,this,t.anchor)}}customElements.define("footer-component",L);export{L as default}; + +(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document); +import { S as SvelteElement, i as init, a as attribute_to_object, b as insert_dev, s as safe_not_equal, d as dispatch_dev, v as validate_slots, c as validate_store, e as component_subscribe, f as empty, n as noop, h as detach_dev, k as element, t as text, l as space, G as svg_element, m as add_location, p as attr_dev, D as set_style, u as append_dev, y as listen_dev, w as set_data_dev } from './index-d19aafba.js'; +import { w as writable } from './index-4664ced0.js'; +import { loadLocaleContent } from '../../../../../../../../../js/libraries/serverTools.js'; + +/* src\footer\footer-component.svelte generated by Svelte v3.52.0 */ +const file = "src\\footer\\footer-component.svelte"; + +// (21:4) {#if $loaded==2} +function create_if_block(ctx) { + let footer; + let div2; + let div1; + let div0; + let h2; + let t0_value = /*$content*/ ctx[1].contactUs + ""; + let t0; + let t1; + let p0; + let t2; + let a0; + let t3_value = /*$content*/ ctx[1].inviteLink + ""; + let t3; + let t4; + let p1; + let t5; + let a1; + let t6_value = /*$content*/ ctx[1].inviteLink + ""; + let t6; + let t7; + let button; + let svg; + let g; + let rect; + let path; + let t8; + let p2; + let t9; + let a2; + let mounted; + let dispose; + + const block = { + c: function create() { + footer = element("footer"); + div2 = element("div"); + div1 = element("div"); + div0 = element("div"); + h2 = element("h2"); + t0 = text(t0_value); + t1 = space(); + p0 = element("p"); + t2 = text("Discord: "); + a0 = element("a"); + t3 = text(t3_value); + t4 = space(); + p1 = element("p"); + t5 = text("WhatsApp: "); + a1 = element("a"); + t6 = text(t6_value); + t7 = space(); + button = element("button"); + svg = svg_element("svg"); + g = svg_element("g"); + rect = svg_element("rect"); + path = svg_element("path"); + t8 = space(); + p2 = element("p"); + t9 = text("Licensed under a Creative Commons "); + a2 = element("a"); + a2.textContent = "CC BY 4.0 license"; + add_location(h2, file, 25, 24, 692); + attr_dev(a0, "href", "https://discord.gg/Qk8KUk787z"); + attr_dev(a0, "target", "_blank"); + attr_dev(a0, "rel", "noreferrer"); + set_style(a0, "margin-left", "1.8rem"); + add_location(a0, file, 27, 36, 858); + add_location(p0, file, 27, 24, 846); + attr_dev(a1, "href", "https://chat.whatsapp.com/BhnmUNljUxJ2AjeHUwyTKh"); + attr_dev(a1, "target", "_blank"); + attr_dev(a1, "rel", "noreferrer"); + set_style(a1, "margin-left", "0.5rem"); + add_location(a1, file, 28, 37, 1026); + add_location(p1, file, 28, 24, 1013); + attr_dev(div0, "id", "contact-us-container"); + add_location(div0, file, 24, 20, 635); + attr_dev(div1, "id", "footer-grid-content-container"); + attr_dev(div1, "class", "logged"); + add_location(div1, file, 23, 16, 558); + attr_dev(rect, "id", "Rectangle_146"); + attr_dev(rect, "data-name", "Rectangle 146"); + attr_dev(rect, "width", "11"); + attr_dev(rect, "height", "51"); + attr_dev(rect, "rx", "5.5"); + attr_dev(rect, "transform", "translate(22 24)"); + attr_dev(rect, "fill", "#cb1816"); + add_location(rect, file, 34, 24, 1573); + attr_dev(path, "id", "Path_1145"); + attr_dev(path, "data-name", "Path 1145"); + attr_dev(path, "d", "M23.814,4.021a5,5,0,0,1,7.372,0l16.134,17.6c2.94,3.207,1.046,10.4-3.686,8.379S28.02,14.081,28.391,13.524,16.544,27.976,11.366,30,4.741,24.828,7.68,21.621Z"); + attr_dev(path, "fill", "#DD1C1A"); + add_location(path, file, 35, 24, 1727); + attr_dev(g, "id", "Group_268"); + attr_dev(g, "data-name", "Group 268"); + attr_dev(g, "transform", "translate(-6.177 -2.399)"); + add_location(g, file, 33, 24, 1470); + attr_dev(svg, "xmlns", "http://www.w3.org/2000/svg"); + attr_dev(svg, "width", "42.545"); + attr_dev(svg, "height", "72.601"); + attr_dev(svg, "viewBox", "0 0 42.545 72.601"); + add_location(svg, file, 32, 20, 1345); + attr_dev(button, "id", "footer-up"); + attr_dev(button, "aria-label", "go up"); + add_location(button, file, 31, 16, 1244); + attr_dev(a2, "href", "https://creativecommons.org/licenses/by/4.0/legalcode "); + attr_dev(a2, "target", "_blank"); + attr_dev(a2, "rel", "noreferrer"); + add_location(a2, file, 39, 75, 2137); + attr_dev(p2, "id", "footer-copyright"); + add_location(p2, file, 39, 16, 2078); + attr_dev(div2, "id", "footer-content-container"); + add_location(div2, file, 22, 12, 505); + add_location(footer, file, 21, 8, 483); + }, + m: function mount(target, anchor) { + insert_dev(target, footer, anchor); + append_dev(footer, div2); + append_dev(div2, div1); + append_dev(div1, div0); + append_dev(div0, h2); + append_dev(h2, t0); + append_dev(div0, t1); + append_dev(div0, p0); + append_dev(p0, t2); + append_dev(p0, a0); + append_dev(a0, t3); + append_dev(div0, t4); + append_dev(div0, p1); + append_dev(p1, t5); + append_dev(p1, a1); + append_dev(a1, t6); + append_dev(div2, t7); + append_dev(div2, button); + append_dev(button, svg); + append_dev(svg, g); + append_dev(g, rect); + append_dev(g, path); + append_dev(div2, t8); + append_dev(div2, p2); + append_dev(p2, t9); + append_dev(p2, a2); + + if (!mounted) { + dispose = listen_dev(button, "click", /*click_handler*/ ctx[4], false, false, false); + mounted = true; + } + }, + p: function update(ctx, dirty) { + if (dirty & /*$content*/ 2 && t0_value !== (t0_value = /*$content*/ ctx[1].contactUs + "")) set_data_dev(t0, t0_value); + if (dirty & /*$content*/ 2 && t3_value !== (t3_value = /*$content*/ ctx[1].inviteLink + "")) set_data_dev(t3, t3_value); + if (dirty & /*$content*/ 2 && t6_value !== (t6_value = /*$content*/ ctx[1].inviteLink + "")) set_data_dev(t6, t6_value); + }, + d: function destroy(detaching) { + if (detaching) detach_dev(footer); + mounted = false; + dispose(); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block.name, + type: "if", + source: "(21:4) {#if $loaded==2}", + ctx + }); + + return block; +} + +// (20:0) {#key $loaded} +function create_key_block(ctx) { + let if_block_anchor; + let if_block = /*$loaded*/ ctx[0] == 2 && create_if_block(ctx); + + const block = { + c: function create() { + if (if_block) if_block.c(); + if_block_anchor = empty(); + }, + m: function mount(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert_dev(target, if_block_anchor, anchor); + }, + p: function update(ctx, dirty) { + if (/*$loaded*/ ctx[0] == 2) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block(ctx); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + }, + d: function destroy(detaching) { + if (if_block) if_block.d(detaching); + if (detaching) detach_dev(if_block_anchor); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_key_block.name, + type: "key", + source: "(20:0) {#key $loaded}", + ctx + }); + + return block; +} + +function create_fragment(ctx) { + let previous_key = /*$loaded*/ ctx[0]; + let key_block_anchor; + let key_block = create_key_block(ctx); + + const block = { + c: function create() { + key_block.c(); + key_block_anchor = empty(); + this.c = noop; + }, + l: function claim(nodes) { + throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); + }, + m: function mount(target, anchor) { + key_block.m(target, anchor); + insert_dev(target, key_block_anchor, anchor); + }, + p: function update(ctx, [dirty]) { + if (dirty & /*$loaded*/ 1 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[0])) { + key_block.d(1); + key_block = create_key_block(ctx); + key_block.c(); + key_block.m(key_block_anchor.parentNode, key_block_anchor); + } else { + key_block.p(ctx, dirty); + } + }, + i: noop, + o: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(key_block_anchor); + key_block.d(detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment.name, + type: "component", + source: "", + ctx + }); + + return block; +} + +function instance($$self, $$props, $$invalidate) { + let $loaded; + let $content; + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots('footer-component', slots, []); + let loaded = writable(0); + validate_store(loaded, 'loaded'); + component_subscribe($$self, loaded, value => $$invalidate(0, $loaded = value)); + let content = writable({}); + validate_store(content, 'content'); + component_subscribe($$self, content, value => $$invalidate(1, $content = value)); + loadLocaleContent(content, "countries", loaded); + loadLocaleContent(content, "footer-component", loaded); + const writable_props = []; + + Object.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); + }); + + const click_handler = () => { + location.href = '#'; + }; + + $$self.$capture_state = () => ({ + writable, + loadLocaleContent, + loaded, + content, + $loaded, + $content + }); + + $$self.$inject_state = $$props => { + if ('loaded' in $$props) $$invalidate(2, loaded = $$props.loaded); + if ('content' in $$props) $$invalidate(3, content = $$props.content); + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [$loaded, $content, loaded, content, click_handler]; +} + +class Footer_component extends SvelteElement { + constructor(options) { + super(); + this.shadowRoot.innerHTML = ``; + + init( + this, + { + target: this.shadowRoot, + props: attribute_to_object(this.attributes), + customElement: true + }, + instance, + create_fragment, + safe_not_equal, + {}, + null + ); + + if (options) { + if (options.target) { + insert_dev(options.target, this, options.anchor); + } + } + } +} + +customElements.define("footer-component", Footer_component); + +export { Footer_component as default }; diff --git a/Server/public/js/components/groups-add-component.js b/Server/public/js/components/groups-add-component.js new file mode 100644 index 0000000..e998340 --- /dev/null +++ b/Server/public/js/components/groups-add-component.js @@ -0,0 +1,476 @@ + +(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document); +import { S as SvelteElement, i as init, a as attribute_to_object, b as insert_dev, s as safe_not_equal, d as dispatch_dev, v as validate_slots, c as validate_store, e as component_subscribe, o as onMount, g as globals, f as empty, n as noop, h as detach_dev, C as binding_callbacks, k as element, l as space, m as add_location, p as attr_dev, q as src_url_equal, r as set_custom_element_data, u as append_dev, y as listen_dev } from './index-d19aafba.js'; +import { w as writable } from './index-4664ced0.js'; +import { groupsByCountry, addMarkersGroups } from '../../../../../../../../../js/groups.js'; +import { loadLocaleContent, getData, sendData } from '../../../../../../../../../js/libraries/serverTools.js'; +import '../../../../../../../../../js/components/map-component.js'; + +/* src\groups-add-component.svelte generated by Svelte v3.52.0 */ + +const { console: console_1 } = globals; + +const file = "src\\groups-add-component.svelte"; + +// (108:4) {#if $loaded==2} +function create_if_block(ctx) { + let div1; + let div0; + let h1; + let t1; + let img; + let img_src_value; + let t2; + let p; + let t4; + let ol; + let li0; + let t6; + let li1; + let t8; + let li2; + let t10; + let label0; + let input0; + let br; + let t12; + let label1; + let input1; + let t14; + let button; + let t16; + let map_component; + let map_component_callback_value; + let mounted; + let dispose; + + const block = { + c: function create() { + div1 = element("div"); + div0 = element("div"); + h1 = element("h1"); + h1.textContent = "Add a Group"; + t1 = space(); + img = element("img"); + t2 = space(); + p = element("p"); + p.textContent = "If there are no groups in your town with whom you can organize then"; + t4 = space(); + ol = element("ol"); + li0 = element("li"); + li0.textContent = "click on the map to show us where you are located,"; + t6 = space(); + li1 = element("li"); + li1.textContent = "add a way to contact you or leave blank for a pin to point to our discord and"; + t8 = space(); + li2 = element("li"); + li2.textContent = "press \"Submit\" to add yourself to our map"; + t10 = space(); + label0 = element("label"); + label0.textContent = "Location: "; + input0 = element("input"); + br = element("br"); + t12 = space(); + label1 = element("label"); + label1.textContent = "Contact: "; + input1 = element("input"); + t14 = space(); + button = element("button"); + button.textContent = "Submit"; + t16 = space(); + map_component = element("map-component"); + add_location(h1, file, 111, 16, 3533); + attr_dev(img, "id", "groups-img"); + if (!src_url_equal(img.src, img_src_value = "/img/common/groups.svg")) attr_dev(img, "src", img_src_value); + attr_dev(img, "alt", "groups"); + add_location(img, file, 112, 16, 3571); + attr_dev(p, "class", "description"); + add_location(p, file, 113, 16, 3652); + add_location(li0, file, 115, 20, 3790); + add_location(li1, file, 116, 20, 3871); + add_location(li2, file, 117, 20, 3979); + add_location(ol, file, 114, 16, 3764); + attr_dev(label0, "for", "address-input"); + add_location(label0, file, 119, 16, 4070); + attr_dev(input0, "id", "address-input"); + attr_dev(input0, "type", "text"); + input0.readOnly = true; + add_location(input0, file, 119, 61, 4115); + add_location(br, file, 119, 133, 4187); + attr_dev(label1, "for", "contact-input"); + add_location(label1, file, 120, 16, 4209); + attr_dev(input1, "id", "contact-input"); + attr_dev(input1, "type", "text"); + add_location(input1, file, 120, 60, 4253); + attr_dev(button, "id", "submit-button"); + add_location(button, file, 121, 16, 4334); + set_custom_element_data(map_component, "id", "map"); + set_custom_element_data(map_component, "callback", map_component_callback_value = /*func*/ ctx[10]); + add_location(map_component, file, 122, 16, 4420); + attr_dev(div0, "id", "text-container"); + add_location(div0, file, 110, 12, 3490); + attr_dev(div1, "id", "container"); + add_location(div1, file, 108, 8, 3387); + }, + m: function mount(target, anchor) { + insert_dev(target, div1, anchor); + append_dev(div1, div0); + append_dev(div0, h1); + append_dev(div0, t1); + append_dev(div0, img); + append_dev(div0, t2); + append_dev(div0, p); + append_dev(div0, t4); + append_dev(div0, ol); + append_dev(ol, li0); + append_dev(ol, t6); + append_dev(ol, li1); + append_dev(ol, t8); + append_dev(ol, li2); + append_dev(div0, t10); + append_dev(div0, label0); + append_dev(div0, input0); + /*input0_binding*/ ctx[8](input0); + append_dev(div0, br); + append_dev(div0, t12); + append_dev(div0, label1); + append_dev(div0, input1); + /*input1_binding*/ ctx[9](input1); + append_dev(div0, t14); + append_dev(div0, button); + append_dev(div0, t16); + append_dev(div0, map_component); + + if (!mounted) { + dispose = listen_dev(button, "click", /*submitLocation*/ ctx[7], false, false, false); + mounted = true; + } + }, + p: function update(ctx, dirty) { + if (dirty & /*$content*/ 8 && map_component_callback_value !== (map_component_callback_value = /*func*/ ctx[10])) { + set_custom_element_data(map_component, "callback", map_component_callback_value); + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div1); + /*input0_binding*/ ctx[8](null); + /*input1_binding*/ ctx[9](null); + mounted = false; + dispose(); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block.name, + type: "if", + source: "(108:4) {#if $loaded==2}", + ctx + }); + + return block; +} + +// (107:0) {#key $loaded} +function create_key_block(ctx) { + let if_block_anchor; + let if_block = /*$loaded*/ ctx[2] == 2 && create_if_block(ctx); + + const block = { + c: function create() { + if (if_block) if_block.c(); + if_block_anchor = empty(); + }, + m: function mount(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert_dev(target, if_block_anchor, anchor); + }, + p: function update(ctx, dirty) { + if (/*$loaded*/ ctx[2] == 2) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block(ctx); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + }, + d: function destroy(detaching) { + if (if_block) if_block.d(detaching); + if (detaching) detach_dev(if_block_anchor); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_key_block.name, + type: "key", + source: "(107:0) {#key $loaded}", + ctx + }); + + return block; +} + +function create_fragment(ctx) { + let previous_key = /*$loaded*/ ctx[2]; + let key_block_anchor; + let key_block = create_key_block(ctx); + + const block = { + c: function create() { + key_block.c(); + key_block_anchor = empty(); + this.c = noop; + }, + l: function claim(nodes) { + throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); + }, + m: function mount(target, anchor) { + key_block.m(target, anchor); + insert_dev(target, key_block_anchor, anchor); + }, + p: function update(ctx, [dirty]) { + if (dirty & /*$loaded*/ 4 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[2])) { + key_block.d(1); + key_block = create_key_block(ctx); + key_block.c(); + key_block.m(key_block_anchor.parentNode, key_block_anchor); + } else { + key_block.p(ctx, dirty); + } + }, + i: noop, + o: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(key_block_anchor); + key_block.d(detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment.name, + type: "component", + source: "", + ctx + }); + + return block; +} + +function createPin(lat, lng) { + let markerIcon = new L.Icon({ + iconUrl: '/img/common/markers/marker-black.png', + shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png', + iconSize: [25, 41], + iconAnchor: [12, 41], + popupAnchor: [1, -34], + shadowSize: [41, 41] + }); + + return L.marker([lat, lng], { icon: markerIcon }); +} + +function updatePin(marker, lat, lng) { + let newLatLng = L.latLng(lat, lng); // Replace with the desired coordinates + marker.setLatLng(newLatLng); +} + +function instance($$self, $$props, $$invalidate) { + let $loaded; + let $content; + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots('groups-add-component', slots, []); + let loaded = writable(0); + validate_store(loaded, 'loaded'); + component_subscribe($$self, loaded, value => $$invalidate(2, $loaded = value)); + let content = writable({}); + validate_store(content, 'content'); + component_subscribe($$self, content, value => $$invalidate(3, $content = value)); + let addressInput; + let contactInput; + let addressVec; + let userPinLat = 0; + let userPinLng = 0; + let userPin = createPin(0, 0); + userPin.setOpacity(0); + let locale = loadLocaleContent(content, "groups-component", loaded); + loadLocaleContent(content, "countries", loaded); + + function reverseGeocode(latitude, longitude) { + let url = `https://nominatim.openstreetmap.org/reverse?lat=${latitude}&lon=${longitude}&format=jsonv2`; + + let callback = response => { + // Parse the response JSON + response = JSON.parse(response); + + // Extract the address information from the response + let address = response.address; + + let city = address.city || address.town || address.village || address.hamlet; + let state = address.state; + let country = address.country; + let fullAddress = country; + + if (state != undefined) { + fullAddress += ", " + state; + } else { + state = ""; + } + + if (city != undefined) { + fullAddress += ", " + city; + } else { + city = ""; + } + + $$invalidate(0, addressInput.value = fullAddress, addressInput); + addressVec = [country, state, city]; + }; + + getData(url, callback); + } + + function mapCallbackGroups(createMap, content) { + let map = createMap([22, 0], 2); + addMarkersGroups(map, content); + userPin.addTo(map); + + map.on('click', function (event) { + let lat = event.latlng.lat; + let lng = event.latlng.lng; + userPinLat = lat; + userPinLng = lng; + updatePin(userPin, lat, lng); + userPin.setOpacity(1); + reverseGeocode(lat, lng); + }); + } + + function submitLocation() { + if (addressVec != undefined) { + let data = [...addressVec, userPinLat, userPinLng, contactInput.value]; + let url = "/" + locale + "/groups-add-post/"; + console.log(data); + sendData(url, data); + } + } + + onMount(() => { + + }); + + const writable_props = []; + + Object.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console_1.warn(` was created with unknown prop '${key}'`); + }); + + function input0_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + addressInput = $$value; + $$invalidate(0, addressInput); + }); + } + + function input1_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + contactInput = $$value; + $$invalidate(1, contactInput); + }); + } + + const func = createMap => mapCallbackGroups(createMap, $content); + + $$self.$capture_state = () => ({ + onMount, + writable, + groupsByCountry, + addMarkersGroups, + loadLocaleContent, + getData, + sendData, + loaded, + content, + addressInput, + contactInput, + addressVec, + userPinLat, + userPinLng, + userPin, + locale, + createPin, + updatePin, + reverseGeocode, + mapCallbackGroups, + submitLocation, + $loaded, + $content + }); + + $$self.$inject_state = $$props => { + if ('loaded' in $$props) $$invalidate(4, loaded = $$props.loaded); + if ('content' in $$props) $$invalidate(5, content = $$props.content); + if ('addressInput' in $$props) $$invalidate(0, addressInput = $$props.addressInput); + if ('contactInput' in $$props) $$invalidate(1, contactInput = $$props.contactInput); + if ('addressVec' in $$props) addressVec = $$props.addressVec; + if ('userPinLat' in $$props) userPinLat = $$props.userPinLat; + if ('userPinLng' in $$props) userPinLng = $$props.userPinLng; + if ('userPin' in $$props) userPin = $$props.userPin; + if ('locale' in $$props) locale = $$props.locale; + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [ + addressInput, + contactInput, + $loaded, + $content, + loaded, + content, + mapCallbackGroups, + submitLocation, + input0_binding, + input1_binding, + func + ]; +} + +class Groups_add_component extends SvelteElement { + constructor(options) { + super(); + this.shadowRoot.innerHTML = ``; + + init( + this, + { + target: this.shadowRoot, + props: attribute_to_object(this.attributes), + customElement: true + }, + instance, + create_fragment, + safe_not_equal, + {}, + null + ); + + if (options) { + if (options.target) { + insert_dev(options.target, this, options.anchor); + } + } + } +} + +customElements.define("groups-add-component", Groups_add_component); + +export { Groups_add_component as default }; diff --git a/Server/public/js/components/groups-component.js b/Server/public/js/components/groups-component.js index 64ea256..286ad32 100644 --- a/Server/public/js/components/groups-component.js +++ b/Server/public/js/components/groups-component.js @@ -1 +1,576 @@ -import{S as t,i as o,a as n,b as e,s as r,e as a,n as i,d as m,c as s,o as c,f as l,t as p,g,h as u,j as d,k as h,l as f,m as b,p as j}from"./index-4348483d.js";import{w as x}from"./index-71440b21.js";import{addMarkersGroups as v,groupsByCountry as w}from"../../../../../../../../../js/groups.js";import{loadLocaleContent as y}from"../../../../../../../../../js/libraries/serverTools.js";import"../../../../../../../../../js/components/map-component.js";function k(t,o,n){const e=t.slice();return e[7]=o[n][0],e[8]=o[n][1],e}function z(t,o,n){const e=t.slice();return e[11]=o[n],e}function D(t){let o,n,r,a,i,s,c,x,v,y,z,D,E,O,R,T,A,C,H,L,M=t[1].groups+"",S=t[1].p1+"",_=t[1].subheading1+"",q=t[1]["map-prompt"]+"",B=Object.entries(w),F=[];for(let o=0;on(0,e=t)));let i=x({});function m(t,o){let n=t([22,0],2);v(n,o)}s(t,i,(t=>n(1,r=t))),y(i,"groups-component",a),y(i,"countries",a),c((()=>{}));return[e,r,a,i,m,t=>m(t,r),t=>r[t]]}class A extends t{constructor(t){super(),this.shadowRoot.innerHTML="",o(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},T,R,r,{},null),t&&t.target&&e(t.target,this,t.anchor)}}customElements.define("groups-component",A);export{A as default}; + +(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document); +import { S as SvelteElement, i as init, a as attribute_to_object, b as insert_dev, s as safe_not_equal, d as dispatch_dev, v as validate_slots, c as validate_store, e as component_subscribe, o as onMount, g as globals, f as empty, n as noop, h as detach_dev, j as validate_each_argument, k as element, t as text, l as space, m as add_location, p as attr_dev, q as src_url_equal, r as set_custom_element_data, u as append_dev, w as set_data_dev, x as destroy_each } from './index-d19aafba.js'; +import { w as writable } from './index-4664ced0.js'; +import { groupsByCountry, addMarkersGroups } from '../../../../../../../../../js/groups.js'; +import { loadLocaleContent, getData, sendData } from '../../../../../../../../../js/libraries/serverTools.js'; +import '../../../../../../../../../js/components/map-component.js'; + +/* src\groups-component.svelte generated by Svelte v3.52.0 */ + +const { Object: Object_1 } = globals; + +const file = "src\\groups-component.svelte"; + +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[9] = list[i][0]; + child_ctx[10] = list[i][1]; + return child_ctx; +} + +function get_each_context_1(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[13] = list[i]; + return child_ctx; +} + +// (39:4) {#if $loaded==2} +function create_if_block(ctx) { + let div1; + let div0; + let h1; + let t0_value = /*$content*/ ctx[0].groups + ""; + let t0; + let t1; + let img; + let img_src_value; + let t2; + let p0; + let t3_value = /*$content*/ ctx[0].p1 + ""; + let t3; + let t4; + let h3; + let t5_value = /*$content*/ ctx[0].subheading1 + ""; + let t5; + let t6; + let map_component; + let map_component_callback_value; + let t7; + let p1; + let t8_value = /*$content*/ ctx[0]["map-prompt"] + ""; + let t8; + let t9; + let each_value = Object.entries(groupsByCountry); + validate_each_argument(each_value); + let each_blocks = []; + + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + + const block = { + c: function create() { + div1 = element("div"); + div0 = element("div"); + h1 = element("h1"); + t0 = text(t0_value); + t1 = space(); + img = element("img"); + t2 = space(); + p0 = element("p"); + t3 = text(t3_value); + t4 = space(); + h3 = element("h3"); + t5 = text(t5_value); + t6 = space(); + map_component = element("map-component"); + t7 = space(); + p1 = element("p"); + t8 = text(t8_value); + t9 = space(); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + add_location(h1, file, 42, 16, 1236); + attr_dev(img, "id", "groups-img"); + if (!src_url_equal(img.src, img_src_value = "/img/common/groups.svg")) attr_dev(img, "src", img_src_value); + attr_dev(img, "alt", "groups"); + add_location(img, file, 43, 16, 1280); + attr_dev(p0, "class", "description"); + add_location(p0, file, 44, 16, 1361); + add_location(h3, file, 45, 16, 1419); + set_custom_element_data(map_component, "id", "map"); + set_custom_element_data(map_component, "callback", map_component_callback_value = /*func*/ ctx[8]); + add_location(map_component, file, 46, 16, 1468); + attr_dev(p1, "id", "add-prompt"); + add_location(p1, file, 47, 16, 1597); + attr_dev(div0, "id", "text-container"); + add_location(div0, file, 41, 12, 1193); + attr_dev(div1, "id", "container"); + add_location(div1, file, 39, 8, 1090); + }, + m: function mount(target, anchor) { + insert_dev(target, div1, anchor); + append_dev(div1, div0); + append_dev(div0, h1); + append_dev(h1, t0); + append_dev(div0, t1); + append_dev(div0, img); + append_dev(div0, t2); + append_dev(div0, p0); + append_dev(p0, t3); + append_dev(div0, t4); + append_dev(div0, h3); + append_dev(h3, t5); + append_dev(div0, t6); + append_dev(div0, map_component); + append_dev(div0, t7); + append_dev(div0, p1); + append_dev(p1, t8); + append_dev(div0, t9); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(div0, null); + } + }, + p: function update(ctx, dirty) { + if (dirty & /*$content*/ 1 && t0_value !== (t0_value = /*$content*/ ctx[0].groups + "")) set_data_dev(t0, t0_value); + if (dirty & /*$content*/ 1 && t3_value !== (t3_value = /*$content*/ ctx[0].p1 + "")) set_data_dev(t3, t3_value); + if (dirty & /*$content*/ 1 && t5_value !== (t5_value = /*$content*/ ctx[0].subheading1 + "")) set_data_dev(t5, t5_value); + + if (dirty & /*$content*/ 1 && map_component_callback_value !== (map_component_callback_value = /*func*/ ctx[8])) { + set_custom_element_data(map_component, "callback", map_component_callback_value); + } + + if (dirty & /*$content*/ 1 && t8_value !== (t8_value = /*$content*/ ctx[0]["map-prompt"] + "")) set_data_dev(t8, t8_value); + + if (dirty & /*Object, groupsByCountry, $content, getAddress, getCountry*/ 193) { + each_value = Object.entries(groupsByCountry); + validate_each_argument(each_value); + let i; + + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx, each_value, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div0, null); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value.length; + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div1); + destroy_each(each_blocks, detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block.name, + type: "if", + source: "(39:4) {#if $loaded==2}", + ctx + }); + + return block; +} + +// (52:24) {#each groups as group} +function create_each_block_1(ctx) { + let div; + let p0; + let b0; + let t0_value = /*$content*/ ctx[0].location + ""; + let t0; + let t1; + let t2_value = /*getAddress*/ ctx[7](/*group*/ ctx[13]) + ""; + let t2; + let t3; + let p1; + let b1; + let t4_value = /*$content*/ ctx[0].members + ""; + let t4; + let t5; + let t6_value = /*group*/ ctx[13].members + ""; + let t6; + let t7; + let p2; + let b2; + let t8_value = /*$content*/ ctx[0].contact + ""; + let t8; + let t9; + let a; + let t10_value = /*$content*/ ctx[0][/*group*/ ctx[13].contact[1]] + ""; + let t10; + + const block = { + c: function create() { + div = element("div"); + p0 = element("p"); + b0 = element("b"); + t0 = text(t0_value); + t1 = text(": "); + t2 = text(t2_value); + t3 = space(); + p1 = element("p"); + b1 = element("b"); + t4 = text(t4_value); + t5 = text(": "); + t6 = text(t6_value); + t7 = space(); + p2 = element("p"); + b2 = element("b"); + t8 = text(t8_value); + t9 = text(": "); + a = element("a"); + t10 = text(t10_value); + add_location(b0, file, 53, 35, 1980); + add_location(p0, file, 53, 32, 1977); + add_location(b1, file, 54, 35, 2068); + add_location(p1, file, 54, 32, 2065); + add_location(b2, file, 55, 35, 2151); + attr_dev(a, "href", /*group*/ ctx[13].contact[0]); + attr_dev(a, "target", ";_blank;"); + attr_dev(a, "rel", "noreferrer"); + add_location(a, file, 55, 62, 2178); + add_location(p2, file, 55, 32, 2148); + attr_dev(div, "class", "location-info"); + add_location(div, file, 52, 28, 1916); + }, + m: function mount(target, anchor) { + insert_dev(target, div, anchor); + append_dev(div, p0); + append_dev(p0, b0); + append_dev(b0, t0); + append_dev(b0, t1); + append_dev(p0, t2); + append_dev(div, t3); + append_dev(div, p1); + append_dev(p1, b1); + append_dev(b1, t4); + append_dev(b1, t5); + append_dev(p1, t6); + append_dev(div, t7); + append_dev(div, p2); + append_dev(p2, b2); + append_dev(b2, t8); + append_dev(b2, t9); + append_dev(p2, a); + append_dev(a, t10); + }, + p: function update(ctx, dirty) { + if (dirty & /*$content*/ 1 && t0_value !== (t0_value = /*$content*/ ctx[0].location + "")) set_data_dev(t0, t0_value); + if (dirty & /*$content*/ 1 && t4_value !== (t4_value = /*$content*/ ctx[0].members + "")) set_data_dev(t4, t4_value); + if (dirty & /*$content*/ 1 && t8_value !== (t8_value = /*$content*/ ctx[0].contact + "")) set_data_dev(t8, t8_value); + if (dirty & /*$content*/ 1 && t10_value !== (t10_value = /*$content*/ ctx[0][/*group*/ ctx[13].contact[1]] + "")) set_data_dev(t10, t10_value); + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_each_block_1.name, + type: "each", + source: "(52:24) {#each groups as group}", + ctx + }); + + return block; +} + +// (49:16) {#each Object.entries(groupsByCountry) as [name,groups]} +function create_each_block(ctx) { + let h4; + let t0_value = /*getCountry*/ ctx[6](/*name*/ ctx[9]) + ""; + let t0; + let t1; + let div; + let t2; + let each_value_1 = /*groups*/ ctx[10]; + validate_each_argument(each_value_1); + let each_blocks = []; + + for (let i = 0; i < each_value_1.length; i += 1) { + each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i)); + } + + const block = { + c: function create() { + h4 = element("h4"); + t0 = text(t0_value); + t1 = space(); + div = element("div"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + t2 = space(); + attr_dev(h4, "class", "country-name"); + add_location(h4, file, 49, 20, 1740); + attr_dev(div, "class", "country-block"); + add_location(div, file, 50, 20, 1810); + }, + m: function mount(target, anchor) { + insert_dev(target, h4, anchor); + append_dev(h4, t0); + insert_dev(target, t1, anchor); + insert_dev(target, div, anchor); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(div, null); + } + + append_dev(div, t2); + }, + p: function update(ctx, dirty) { + if (dirty & /*Object, groupsByCountry, $content, getAddress*/ 129) { + each_value_1 = /*groups*/ ctx[10]; + validate_each_argument(each_value_1); + let i; + + for (i = 0; i < each_value_1.length; i += 1) { + const child_ctx = get_each_context_1(ctx, each_value_1, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block_1(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div, t2); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value_1.length; + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(h4); + if (detaching) detach_dev(t1); + if (detaching) detach_dev(div); + destroy_each(each_blocks, detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_each_block.name, + type: "each", + source: "(49:16) {#each Object.entries(groupsByCountry) as [name,groups]}", + ctx + }); + + return block; +} + +// (38:0) {#key $loaded} +function create_key_block(ctx) { + let if_block_anchor; + let if_block = /*$loaded*/ ctx[1] == 2 && create_if_block(ctx); + + const block = { + c: function create() { + if (if_block) if_block.c(); + if_block_anchor = empty(); + }, + m: function mount(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert_dev(target, if_block_anchor, anchor); + }, + p: function update(ctx, dirty) { + if (/*$loaded*/ ctx[1] == 2) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block(ctx); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + }, + d: function destroy(detaching) { + if (if_block) if_block.d(detaching); + if (detaching) detach_dev(if_block_anchor); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_key_block.name, + type: "key", + source: "(38:0) {#key $loaded}", + ctx + }); + + return block; +} + +function create_fragment(ctx) { + let previous_key = /*$loaded*/ ctx[1]; + let key_block_anchor; + let key_block = create_key_block(ctx); + + const block = { + c: function create() { + key_block.c(); + key_block_anchor = empty(); + this.c = noop; + }, + l: function claim(nodes) { + throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); + }, + m: function mount(target, anchor) { + key_block.m(target, anchor); + insert_dev(target, key_block_anchor, anchor); + }, + p: function update(ctx, [dirty]) { + if (dirty & /*$loaded*/ 2 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[1])) { + key_block.d(1); + key_block = create_key_block(ctx); + key_block.c(); + key_block.m(key_block_anchor.parentNode, key_block_anchor); + } else { + key_block.p(ctx, dirty); + } + }, + i: noop, + o: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(key_block_anchor); + key_block.d(detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment.name, + type: "component", + source: "", + ctx + }); + + return block; +} + +function instance($$self, $$props, $$invalidate) { + let $content; + let $loaded; + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots('groups-component', slots, []); + let loaded = writable(0); + validate_store(loaded, 'loaded'); + component_subscribe($$self, loaded, value => $$invalidate(1, $loaded = value)); + let content = writable({}); + validate_store(content, 'content'); + component_subscribe($$self, content, value => $$invalidate(0, $content = value)); + let locale = loadLocaleContent(content, "groups-component", loaded); + loadLocaleContent(content, "countries", loaded); + + function mapCallbackGroups(createMap, content, locale) { + let map = createMap([22, 0], 2); + addMarkersGroups(map, content, locale); + } + + function getCountry(name) { + return locale == "en" ? name : $content[name]; + } + + function getAddress(group) { + return group.location[0].map(x => locale == "en" ? x : $content[x]).join(", "); + } + + onMount(() => { + + }); + + const writable_props = []; + + Object_1.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); + }); + + const func = createMap => mapCallbackGroups(createMap, $content, locale); + + $$self.$capture_state = () => ({ + onMount, + writable, + groupsByCountry, + addMarkersGroups, + loadLocaleContent, + getData, + sendData, + loaded, + content, + locale, + mapCallbackGroups, + getCountry, + getAddress, + $content, + $loaded + }); + + $$self.$inject_state = $$props => { + if ('loaded' in $$props) $$invalidate(2, loaded = $$props.loaded); + if ('content' in $$props) $$invalidate(3, content = $$props.content); + if ('locale' in $$props) $$invalidate(4, locale = $$props.locale); + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [ + $content, + $loaded, + loaded, + content, + locale, + mapCallbackGroups, + getCountry, + getAddress, + func + ]; +} + +class Groups_component extends SvelteElement { + constructor(options) { + super(); + this.shadowRoot.innerHTML = ``; + + init( + this, + { + target: this.shadowRoot, + props: attribute_to_object(this.attributes), + customElement: true + }, + instance, + create_fragment, + safe_not_equal, + {}, + null + ); + + if (options) { + if (options.target) { + insert_dev(options.target, this, options.anchor); + } + } + } +} + +customElements.define("groups-component", Groups_component); + +export { Groups_component as default }; diff --git a/Server/public/js/components/join-us-component.js b/Server/public/js/components/join-us-component.js index c8e7427..8ceec18 100644 --- a/Server/public/js/components/join-us-component.js +++ b/Server/public/js/components/join-us-component.js @@ -1 +1,596 @@ -import{S as o,i as t,a as i,b as e,s as r,e as n,n as a,d as s,c as m,o as l,f as c,t as p,g,j as u,h as d,k as h,l as f,m as b}from"./index-4348483d.js";import{w as v}from"./index-71440b21.js";import{addMarkersGroups as j,groupsMarkersLayer as k}from"../../../../../../../../../js/groups.js";import{addMarkersCoops as w,coopsMarkersLayer as y}from"../../../../../../../../../js/coops.js";import{addMarkersCommunes as x,communesMarkersLayer as P}from"../../../../../../../../../js/communes.js";import{addMarkersParties as T,partiesMarkersLayer as N}from"../../../../../../../../../js/parties.js";import{loadLocaleContent as S}from"../../../../../../../../../js/libraries/serverTools.js";import"../../../../../../../../../js/components/map-component.js";function z(o){let t,i,r,n,a,m,l,v,j,k,w,y,x,P,T,N,S,z,A,D,H,L,O,U,C,G,M,E,K,R,W,Y,_,B,J,Q,q,F,I,V,X,Z,$,oo,to,io,eo,ro,no,ao,so,mo,lo,co,po,go,uo,ho,fo,bo,vo,jo,ko,wo,yo,xo,Po,To,No,So,zo,Ao,Do,Ho,Lo,Oo,Uo,Co,Go,Mo,Eo,Ko,Ro,Wo=o[1].heading+"",Yo=o[1].condition1+"",_o=o[1].condition2+"",Bo=o[1].condition3+"",Jo=o[1].conditionsOutcome+"",Qo=o[1].subheading1+"",qo=o[1].valueProposition1+"",Fo=o[1].valueProposition2+"",Io=o[1].valueProposition3+"",Vo=o[1].valueProposition4+"",Xo=o[1].valueProposition5+"",Zo=o[1].subheading2+"",$o=o[1].findOur+"",ot=o[1].group+"",tt=o[1].commune+"",it=o[1].cooperative+"",et=o[1].or+"",rt=o[1].party+"",nt=o[1].nearYou+"",at=o[1].noneNear+"",st=o[1].WhatsAppGroup+"",mt=o[1].or+"",lt=o[1].DiscordServer+"",ct=o[1].helpStart+"";return{c(){t=c("div"),i=c("div"),r=c("h1"),n=p(Wo),a=g(),m=c("img"),v=g(),j=c("ol"),k=c("li"),w=p(Yo),y=g(),x=c("li"),P=p(_o),T=g(),N=c("li"),S=p(Bo),z=g(),A=c("p"),D=g(),H=c("h2"),L=p(Qo),O=g(),U=c("ol"),C=c("li"),G=p(qo),M=g(),E=c("li"),K=p(Fo),R=g(),W=c("li"),Y=p(Io),_=g(),B=c("li"),J=p(Vo),Q=g(),q=c("p"),F=p(Xo),I=g(),V=c("h2"),X=p(Zo),Z=g(),$=c("div"),oo=c("p"),to=p($o),io=g(),eo=c("ol"),ro=c("li"),no=c("a"),ao=p(ot),so=p(","),mo=g(),lo=c("li"),co=c("a"),po=p(tt),go=g(),uo=c("li"),ho=c("a"),fo=p(it),bo=g(),vo=p(et),jo=g(),ko=c("li"),wo=c("a"),yo=p(rt),xo=g(),Po=c("p"),To=p(nt),No=g(),So=c("p"),zo=p(at),Ao=g(),Do=c("a"),Ho=p(st),Lo=g(),Oo=p(mt),Uo=g(),Co=c("a"),Go=p(lt),Mo=p(ct),Eo=g(),Ko=c("map-component"),u(m.src,l="/img/common/join-group.svg")||d(m,"src","/img/common/join-group.svg"),d(m,"id","join-group"),d(m,"alt","join group"),d(j,"id","condition-list"),d(U,"id","value-proposition-list"),d(no,"href","/"+o[4]+"/groups"),d(co,"href","/"+o[4]+"/communes"),d(ho,"href","/"+o[4]+"/cooperatives"),d(wo,"href","/"+o[4]+"/parties"),d(eo,"id","entities-list"),d($,"id","call-to-action-list"),d(Do,"href","https://chat.whatsapp.com/BhnmUNljUxJ2AjeHUwyTKh"),d(Do,"target","_blank"),d(Do,"rel","noreferrer"),d(Co,"href","https://discord.gg/Qk8KUk787z"),d(Co,"target","_blank"),d(Co,"rel","noreferrer"),h(Ko,"id","map"),h(Ko,"callback",Ro=o[6]),d(i,"id","text-container"),d(t,"id","container")},m(o,s){e(o,t,s),f(t,i),f(i,r),f(r,n),f(i,a),f(i,m),f(i,v),f(i,j),f(j,k),f(k,w),f(j,y),f(j,x),f(x,P),f(j,T),f(j,N),f(N,S),f(j,z),f(j,A),A.innerHTML=Jo,f(i,D),f(i,H),f(H,L),f(i,O),f(i,U),f(U,C),f(C,G),f(U,M),f(U,E),f(E,K),f(U,R),f(U,W),f(W,Y),f(U,_),f(U,B),f(B,J),f(U,Q),f(U,q),f(q,F),f(i,I),f(i,V),f(V,X),f(i,Z),f(i,$),f($,oo),f(oo,to),f($,io),f($,eo),f(eo,ro),f(ro,no),f(no,ao),f(ro,so),f(eo,mo),f(eo,lo),f(lo,co),f(co,po),f(eo,go),f(eo,uo),f(uo,ho),f(ho,fo),f(uo,bo),f(uo,vo),f(eo,jo),f(eo,ko),f(ko,wo),f(wo,yo),f($,xo),f($,Po),f(Po,To),f(i,No),f(i,So),f(So,zo),f(So,Ao),f(So,Do),f(Do,Ho),f(So,Lo),f(So,Oo),f(So,Uo),f(So,Co),f(Co,Go),f(So,Mo),f(i,Eo),f(i,Ko)},p(o,t){2&t&&Wo!==(Wo=o[1].heading+"")&&b(n,Wo),2&t&&Yo!==(Yo=o[1].condition1+"")&&b(w,Yo),2&t&&_o!==(_o=o[1].condition2+"")&&b(P,_o),2&t&&Bo!==(Bo=o[1].condition3+"")&&b(S,Bo),2&t&&Jo!==(Jo=o[1].conditionsOutcome+"")&&(A.innerHTML=Jo),2&t&&Qo!==(Qo=o[1].subheading1+"")&&b(L,Qo),2&t&&qo!==(qo=o[1].valueProposition1+"")&&b(G,qo),2&t&&Fo!==(Fo=o[1].valueProposition2+"")&&b(K,Fo),2&t&&Io!==(Io=o[1].valueProposition3+"")&&b(Y,Io),2&t&&Vo!==(Vo=o[1].valueProposition4+"")&&b(J,Vo),2&t&&Xo!==(Xo=o[1].valueProposition5+"")&&b(F,Xo),2&t&&Zo!==(Zo=o[1].subheading2+"")&&b(X,Zo),2&t&&$o!==($o=o[1].findOur+"")&&b(to,$o),2&t&&ot!==(ot=o[1].group+"")&&b(ao,ot),2&t&&tt!==(tt=o[1].commune+"")&&b(po,tt),2&t&&it!==(it=o[1].cooperative+"")&&b(fo,it),2&t&&et!==(et=o[1].or+"")&&b(vo,et),2&t&&rt!==(rt=o[1].party+"")&&b(yo,rt),2&t&&nt!==(nt=o[1].nearYou+"")&&b(To,nt),2&t&&at!==(at=o[1].noneNear+"")&&b(zo,at),2&t&&st!==(st=o[1].WhatsAppGroup+"")&&b(Ho,st),2&t&&mt!==(mt=o[1].or+"")&&b(Oo,mt),2&t&<!==(lt=o[1].DiscordServer+"")&&b(Go,lt),2&t&&ct!==(ct=o[1].helpStart+"")&&b(Mo,ct),2&t&&Ro!==(Ro=o[6])&&h(Ko,"callback",Ro)},d(o){o&&s(t)}}}function A(o){let t,i=6==o[0]&&z(o);return{c(){i&&i.c(),t=n()},m(o,r){i&&i.m(o,r),e(o,t,r)},p(o,e){6==o[0]?i?i.p(o,e):(i=z(o),i.c(),i.m(t.parentNode,t)):i&&(i.d(1),i=null)},d(o){i&&i.d(o),o&&s(t)}}}function D(o){let t,i=o[0],m=A(o);return{c(){m.c(),t=n(),this.c=a},m(o,i){m.m(o,i),e(o,t,i)},p(o,[e]){1&e&&r(i,i=o[0])?(m.d(1),m=A(o),m.c(),m.m(t.parentNode,t)):m.p(o,e)},i:a,o:a,d(o){o&&s(t),m.d(o)}}}function H(o,t,i){let e,r,n=v(0);m(o,n,(o=>i(0,e=o)));let a=v({});m(o,a,(o=>i(1,r=o))),S(a,"groups-component",n),S(a,"communes-component",n),S(a,"cooperatives-component",n),S(a,"parties-component",n),S(a,"countries",n);let s=S(a,"join-us-component",n);function c(o,t){let i=o([22,0],2);j(i,t),x(i,t),w(i,t),T(i,t);let e={Groups:k,Communes:P,Coops:y,Parties:N};L.control.layers(null,e).addTo(i)}l((()=>{}));return[e,r,n,a,s,c,o=>c(o,r)]}class O extends o{constructor(o){super(),this.shadowRoot.innerHTML="",t(this,{target:this.shadowRoot,props:i(this.attributes),customElement:!0},H,D,r,{},null),o&&o.target&&e(o.target,this,o.anchor)}}customElements.define("join-us-component",O);export{O as default}; + +(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document); +import { S as SvelteElement, i as init, a as attribute_to_object, b as insert_dev, s as safe_not_equal, d as dispatch_dev, v as validate_slots, c as validate_store, e as component_subscribe, o as onMount, f as empty, n as noop, h as detach_dev, k as element, t as text, l as space, m as add_location, q as src_url_equal, p as attr_dev, r as set_custom_element_data, u as append_dev, w as set_data_dev } from './index-d19aafba.js'; +import { w as writable } from './index-4664ced0.js'; +import { addMarkersGroups, groupsMarkersLayer } from '../../../../../../../../../js/groups.js'; +import { addMarkersCoops, coopsMarkersLayer } from '../../../../../../../../../js/coops.js'; +import { addMarkersCommunes, communesMarkersLayer } from '../../../../../../../../../js/communes.js'; +import { addMarkersParties, partiesMarkersLayer } from '../../../../../../../../../js/parties.js'; +import { loadLocaleContent } from '../../../../../../../../../js/libraries/serverTools.js'; +import '../../../../../../../../../js/components/map-component.js'; + +/* src\join-us-component.svelte generated by Svelte v3.52.0 */ + +const file = "src\\join-us-component.svelte"; + +// (49:4) {#if $loaded==6} +function create_if_block(ctx) { + let div2; + let div1; + let h1; + let t0_value = /*$content*/ ctx[1].heading + ""; + let t0; + let t1; + let img; + let img_src_value; + let t2; + let ol0; + let li0; + let t3_value = /*$content*/ ctx[1].condition1 + ""; + let t3; + let t4; + let li1; + let t5_value = /*$content*/ ctx[1].condition2 + ""; + let t5; + let t6; + let li2; + let t7_value = /*$content*/ ctx[1].condition3 + ""; + let t7; + let t8; + let p0; + let raw_value = /*$content*/ ctx[1].conditionsOutcome + ""; + let t9; + let h20; + let t10_value = /*$content*/ ctx[1].subheading1 + ""; + let t10; + let t11; + let ol1; + let li3; + let t12_value = /*$content*/ ctx[1].valueProposition1 + ""; + let t12; + let t13; + let li4; + let t14_value = /*$content*/ ctx[1].valueProposition2 + ""; + let t14; + let t15; + let li5; + let t16_value = /*$content*/ ctx[1].valueProposition3 + ""; + let t16; + let t17; + let li6; + let t18_value = /*$content*/ ctx[1].valueProposition4 + ""; + let t18; + let t19; + let p1; + let t20_value = /*$content*/ ctx[1].valueProposition5 + ""; + let t20; + let t21; + let h21; + let t22_value = /*$content*/ ctx[1].subheading2 + ""; + let t22; + let t23; + let div0; + let p2; + let t24_value = /*$content*/ ctx[1].findOur + ""; + let t24; + let t25; + let ol2; + let li7; + let a0; + let t26_value = /*$content*/ ctx[1].group + ""; + let t26; + let t27; + let t28; + let li8; + let a1; + let t29_value = /*$content*/ ctx[1].commune + ""; + let t29; + let t30; + let li9; + let a2; + let t31_value = /*$content*/ ctx[1].cooperative + ""; + let t31; + let t32; + let t33_value = /*$content*/ ctx[1].or + ""; + let t33; + let t34; + let li10; + let a3; + let t35_value = /*$content*/ ctx[1].party + ""; + let t35; + let t36; + let p3; + let t37_value = /*$content*/ ctx[1].nearYou + ""; + let t37; + let t38; + let p4; + let t39_value = /*$content*/ ctx[1].noneNear + ""; + let t39; + let t40; + let a4; + let t41_value = /*$content*/ ctx[1].WhatsAppGroup + ""; + let t41; + let t42; + let t43_value = /*$content*/ ctx[1].or + ""; + let t43; + let t44; + let a5; + let t45_value = /*$content*/ ctx[1].DiscordServer + ""; + let t45; + let t46_value = /*$content*/ ctx[1].helpStart + ""; + let t46; + let t47; + let map_component; + let map_component_callback_value; + + const block = { + c: function create() { + div2 = element("div"); + div1 = element("div"); + h1 = element("h1"); + t0 = text(t0_value); + t1 = space(); + img = element("img"); + t2 = space(); + ol0 = element("ol"); + li0 = element("li"); + t3 = text(t3_value); + t4 = space(); + li1 = element("li"); + t5 = text(t5_value); + t6 = space(); + li2 = element("li"); + t7 = text(t7_value); + t8 = space(); + p0 = element("p"); + t9 = space(); + h20 = element("h2"); + t10 = text(t10_value); + t11 = space(); + ol1 = element("ol"); + li3 = element("li"); + t12 = text(t12_value); + t13 = space(); + li4 = element("li"); + t14 = text(t14_value); + t15 = space(); + li5 = element("li"); + t16 = text(t16_value); + t17 = space(); + li6 = element("li"); + t18 = text(t18_value); + t19 = space(); + p1 = element("p"); + t20 = text(t20_value); + t21 = space(); + h21 = element("h2"); + t22 = text(t22_value); + t23 = space(); + div0 = element("div"); + p2 = element("p"); + t24 = text(t24_value); + t25 = space(); + ol2 = element("ol"); + li7 = element("li"); + a0 = element("a"); + t26 = text(t26_value); + t27 = text(","); + t28 = space(); + li8 = element("li"); + a1 = element("a"); + t29 = text(t29_value); + t30 = space(); + li9 = element("li"); + a2 = element("a"); + t31 = text(t31_value); + t32 = space(); + t33 = text(t33_value); + t34 = space(); + li10 = element("li"); + a3 = element("a"); + t35 = text(t35_value); + t36 = space(); + p3 = element("p"); + t37 = text(t37_value); + t38 = space(); + p4 = element("p"); + t39 = text(t39_value); + t40 = space(); + a4 = element("a"); + t41 = text(t41_value); + t42 = space(); + t43 = text(t43_value); + t44 = space(); + a5 = element("a"); + t45 = text(t45_value); + t46 = text(t46_value); + t47 = space(); + map_component = element("map-component"); + add_location(h1, file, 51, 16, 1794); + if (!src_url_equal(img.src, img_src_value = "/img/common/join-group.svg")) attr_dev(img, "src", img_src_value); + attr_dev(img, "id", "join-group"); + attr_dev(img, "alt", "join group"); + add_location(img, file, 52, 16, 1839); + add_location(li0, file, 54, 20, 1974); + add_location(li1, file, 55, 20, 2026); + add_location(li2, file, 56, 20, 2078); + add_location(p0, file, 57, 20, 2130); + attr_dev(ol0, "id", "condition-list"); + add_location(ol0, file, 53, 16, 1928); + add_location(h20, file, 59, 16, 2212); + add_location(li3, file, 61, 20, 2315); + add_location(li4, file, 62, 20, 2374); + add_location(li5, file, 63, 20, 2433); + add_location(li6, file, 64, 20, 2492); + add_location(p1, file, 65, 20, 2551); + attr_dev(ol1, "id", "value-proposition-list"); + add_location(ol1, file, 60, 16, 2261); + add_location(h21, file, 67, 16, 2627); + add_location(p2, file, 69, 20, 2728); + attr_dev(a0, "href", "/" + /*locale*/ ctx[4] + "/groups"); + add_location(a0, file, 71, 28, 2828); + add_location(li7, file, 71, 24, 2824); + attr_dev(a1, "href", "/" + /*locale*/ ctx[4] + "/communes"); + add_location(a1, file, 72, 28, 2920); + add_location(li8, file, 72, 24, 2916); + attr_dev(a2, "href", "/" + /*locale*/ ctx[4] + "/cooperatives"); + add_location(a2, file, 73, 28, 3015); + add_location(li9, file, 73, 24, 3011); + attr_dev(a3, "href", "/" + /*locale*/ ctx[4] + "/parties"); + add_location(a3, file, 74, 28, 3131); + add_location(li10, file, 74, 24, 3127); + attr_dev(ol2, "id", "entities-list"); + add_location(ol2, file, 70, 20, 2775); + add_location(p3, file, 76, 20, 3242); + attr_dev(div0, "id", "call-to-action-list"); + add_location(div0, file, 68, 16, 2676); + attr_dev(a4, "href", "https://chat.whatsapp.com/BhnmUNljUxJ2AjeHUwyTKh"); + attr_dev(a4, "target", "_blank"); + attr_dev(a4, "rel", "noreferrer"); + add_location(a4, file, 78, 39, 3332); + attr_dev(a5, "href", "https://discord.gg/Qk8KUk787z"); + attr_dev(a5, "target", "_blank"); + attr_dev(a5, "rel", "noreferrer"); + add_location(a5, file, 78, 172, 3465); + add_location(p4, file, 78, 16, 3309); + set_custom_element_data(map_component, "id", "map"); + set_custom_element_data(map_component, "callback", map_component_callback_value = /*func*/ ctx[6]); + add_location(map_component, file, 79, 16, 3606); + attr_dev(div1, "id", "text-container"); + add_location(div1, file, 50, 12, 1751); + attr_dev(div2, "id", "container"); + add_location(div2, file, 49, 8, 1717); + }, + m: function mount(target, anchor) { + insert_dev(target, div2, anchor); + append_dev(div2, div1); + append_dev(div1, h1); + append_dev(h1, t0); + append_dev(div1, t1); + append_dev(div1, img); + append_dev(div1, t2); + append_dev(div1, ol0); + append_dev(ol0, li0); + append_dev(li0, t3); + append_dev(ol0, t4); + append_dev(ol0, li1); + append_dev(li1, t5); + append_dev(ol0, t6); + append_dev(ol0, li2); + append_dev(li2, t7); + append_dev(ol0, t8); + append_dev(ol0, p0); + p0.innerHTML = raw_value; + append_dev(div1, t9); + append_dev(div1, h20); + append_dev(h20, t10); + append_dev(div1, t11); + append_dev(div1, ol1); + append_dev(ol1, li3); + append_dev(li3, t12); + append_dev(ol1, t13); + append_dev(ol1, li4); + append_dev(li4, t14); + append_dev(ol1, t15); + append_dev(ol1, li5); + append_dev(li5, t16); + append_dev(ol1, t17); + append_dev(ol1, li6); + append_dev(li6, t18); + append_dev(ol1, t19); + append_dev(ol1, p1); + append_dev(p1, t20); + append_dev(div1, t21); + append_dev(div1, h21); + append_dev(h21, t22); + append_dev(div1, t23); + append_dev(div1, div0); + append_dev(div0, p2); + append_dev(p2, t24); + append_dev(div0, t25); + append_dev(div0, ol2); + append_dev(ol2, li7); + append_dev(li7, a0); + append_dev(a0, t26); + append_dev(li7, t27); + append_dev(ol2, t28); + append_dev(ol2, li8); + append_dev(li8, a1); + append_dev(a1, t29); + append_dev(ol2, t30); + append_dev(ol2, li9); + append_dev(li9, a2); + append_dev(a2, t31); + append_dev(li9, t32); + append_dev(li9, t33); + append_dev(ol2, t34); + append_dev(ol2, li10); + append_dev(li10, a3); + append_dev(a3, t35); + append_dev(div0, t36); + append_dev(div0, p3); + append_dev(p3, t37); + append_dev(div1, t38); + append_dev(div1, p4); + append_dev(p4, t39); + append_dev(p4, t40); + append_dev(p4, a4); + append_dev(a4, t41); + append_dev(p4, t42); + append_dev(p4, t43); + append_dev(p4, t44); + append_dev(p4, a5); + append_dev(a5, t45); + append_dev(p4, t46); + append_dev(div1, t47); + append_dev(div1, map_component); + }, + p: function update(ctx, dirty) { + if (dirty & /*$content*/ 2 && t0_value !== (t0_value = /*$content*/ ctx[1].heading + "")) set_data_dev(t0, t0_value); + if (dirty & /*$content*/ 2 && t3_value !== (t3_value = /*$content*/ ctx[1].condition1 + "")) set_data_dev(t3, t3_value); + if (dirty & /*$content*/ 2 && t5_value !== (t5_value = /*$content*/ ctx[1].condition2 + "")) set_data_dev(t5, t5_value); + if (dirty & /*$content*/ 2 && t7_value !== (t7_value = /*$content*/ ctx[1].condition3 + "")) set_data_dev(t7, t7_value); + if (dirty & /*$content*/ 2 && raw_value !== (raw_value = /*$content*/ ctx[1].conditionsOutcome + "")) p0.innerHTML = raw_value; if (dirty & /*$content*/ 2 && t10_value !== (t10_value = /*$content*/ ctx[1].subheading1 + "")) set_data_dev(t10, t10_value); + if (dirty & /*$content*/ 2 && t12_value !== (t12_value = /*$content*/ ctx[1].valueProposition1 + "")) set_data_dev(t12, t12_value); + if (dirty & /*$content*/ 2 && t14_value !== (t14_value = /*$content*/ ctx[1].valueProposition2 + "")) set_data_dev(t14, t14_value); + if (dirty & /*$content*/ 2 && t16_value !== (t16_value = /*$content*/ ctx[1].valueProposition3 + "")) set_data_dev(t16, t16_value); + if (dirty & /*$content*/ 2 && t18_value !== (t18_value = /*$content*/ ctx[1].valueProposition4 + "")) set_data_dev(t18, t18_value); + if (dirty & /*$content*/ 2 && t20_value !== (t20_value = /*$content*/ ctx[1].valueProposition5 + "")) set_data_dev(t20, t20_value); + if (dirty & /*$content*/ 2 && t22_value !== (t22_value = /*$content*/ ctx[1].subheading2 + "")) set_data_dev(t22, t22_value); + if (dirty & /*$content*/ 2 && t24_value !== (t24_value = /*$content*/ ctx[1].findOur + "")) set_data_dev(t24, t24_value); + if (dirty & /*$content*/ 2 && t26_value !== (t26_value = /*$content*/ ctx[1].group + "")) set_data_dev(t26, t26_value); + if (dirty & /*$content*/ 2 && t29_value !== (t29_value = /*$content*/ ctx[1].commune + "")) set_data_dev(t29, t29_value); + if (dirty & /*$content*/ 2 && t31_value !== (t31_value = /*$content*/ ctx[1].cooperative + "")) set_data_dev(t31, t31_value); + if (dirty & /*$content*/ 2 && t33_value !== (t33_value = /*$content*/ ctx[1].or + "")) set_data_dev(t33, t33_value); + if (dirty & /*$content*/ 2 && t35_value !== (t35_value = /*$content*/ ctx[1].party + "")) set_data_dev(t35, t35_value); + if (dirty & /*$content*/ 2 && t37_value !== (t37_value = /*$content*/ ctx[1].nearYou + "")) set_data_dev(t37, t37_value); + if (dirty & /*$content*/ 2 && t39_value !== (t39_value = /*$content*/ ctx[1].noneNear + "")) set_data_dev(t39, t39_value); + if (dirty & /*$content*/ 2 && t41_value !== (t41_value = /*$content*/ ctx[1].WhatsAppGroup + "")) set_data_dev(t41, t41_value); + if (dirty & /*$content*/ 2 && t43_value !== (t43_value = /*$content*/ ctx[1].or + "")) set_data_dev(t43, t43_value); + if (dirty & /*$content*/ 2 && t45_value !== (t45_value = /*$content*/ ctx[1].DiscordServer + "")) set_data_dev(t45, t45_value); + if (dirty & /*$content*/ 2 && t46_value !== (t46_value = /*$content*/ ctx[1].helpStart + "")) set_data_dev(t46, t46_value); + + if (dirty & /*$content*/ 2 && map_component_callback_value !== (map_component_callback_value = /*func*/ ctx[6])) { + set_custom_element_data(map_component, "callback", map_component_callback_value); + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div2); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block.name, + type: "if", + source: "(49:4) {#if $loaded==6}", + ctx + }); + + return block; +} + +// (48:0) {#key $loaded} +function create_key_block(ctx) { + let if_block_anchor; + let if_block = /*$loaded*/ ctx[0] == 6 && create_if_block(ctx); + + const block = { + c: function create() { + if (if_block) if_block.c(); + if_block_anchor = empty(); + }, + m: function mount(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert_dev(target, if_block_anchor, anchor); + }, + p: function update(ctx, dirty) { + if (/*$loaded*/ ctx[0] == 6) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block(ctx); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + }, + d: function destroy(detaching) { + if (if_block) if_block.d(detaching); + if (detaching) detach_dev(if_block_anchor); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_key_block.name, + type: "key", + source: "(48:0) {#key $loaded}", + ctx + }); + + return block; +} + +function create_fragment(ctx) { + let previous_key = /*$loaded*/ ctx[0]; + let key_block_anchor; + let key_block = create_key_block(ctx); + + const block = { + c: function create() { + key_block.c(); + key_block_anchor = empty(); + this.c = noop; + }, + l: function claim(nodes) { + throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); + }, + m: function mount(target, anchor) { + key_block.m(target, anchor); + insert_dev(target, key_block_anchor, anchor); + }, + p: function update(ctx, [dirty]) { + if (dirty & /*$loaded*/ 1 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[0])) { + key_block.d(1); + key_block = create_key_block(ctx); + key_block.c(); + key_block.m(key_block_anchor.parentNode, key_block_anchor); + } else { + key_block.p(ctx, dirty); + } + }, + i: noop, + o: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(key_block_anchor); + key_block.d(detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment.name, + type: "component", + source: "", + ctx + }); + + return block; +} + +function instance($$self, $$props, $$invalidate) { + let $loaded; + let $content; + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots('join-us-component', slots, []); + let loaded = writable(0); + validate_store(loaded, 'loaded'); + component_subscribe($$self, loaded, value => $$invalidate(0, $loaded = value)); + let content = writable({}); + validate_store(content, 'content'); + component_subscribe($$self, content, value => $$invalidate(1, $content = value)); + loadLocaleContent(content, "groups-component", loaded); + loadLocaleContent(content, "communes-component", loaded); + loadLocaleContent(content, "cooperatives-component", loaded); + loadLocaleContent(content, "parties-component", loaded); + loadLocaleContent(content, "countries", loaded); + let locale = loadLocaleContent(content, "join-us-component", loaded); + + function mapCallback(createMap, content, locale) { + let map = createMap([22, 0], 2); + addMarkersGroups(map, content, locale); + addMarkersCommunes(map, content, locale); + addMarkersCoops(map, content, locale); + addMarkersParties(map, content, locale); + + let overlayMaps = { + "Groups": groupsMarkersLayer, + "Communes": communesMarkersLayer, + "Coops": coopsMarkersLayer, + "Parties": partiesMarkersLayer + }; + + L.control.layers(null, overlayMaps).addTo(map); + } + + onMount(() => { + + }); + + const writable_props = []; + + Object.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); + }); + + const func = createMap => mapCallback(createMap, $content, locale); + + $$self.$capture_state = () => ({ + onMount, + writable, + addMarkersGroups, + groupsMarkersLayer, + addMarkersCoops, + coopsMarkersLayer, + addMarkersCommunes, + communesMarkersLayer, + addMarkersParties, + partiesMarkersLayer, + loadLocaleContent, + loaded, + content, + locale, + mapCallback, + $loaded, + $content + }); + + $$self.$inject_state = $$props => { + if ('loaded' in $$props) $$invalidate(2, loaded = $$props.loaded); + if ('content' in $$props) $$invalidate(3, content = $$props.content); + if ('locale' in $$props) $$invalidate(4, locale = $$props.locale); + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [$loaded, $content, loaded, content, locale, mapCallback, func]; +} + +class Join_us_component extends SvelteElement { + constructor(options) { + super(); + + this.shadowRoot.innerHTML = ``; + + init( + this, + { + target: this.shadowRoot, + props: attribute_to_object(this.attributes), + customElement: true + }, + instance, + create_fragment, + safe_not_equal, + {}, + null + ); + + if (options) { + if (options.target) { + insert_dev(options.target, this, options.anchor); + } + } + } +} + +customElements.define("join-us-component", Join_us_component); + +export { Join_us_component as default }; diff --git a/Server/public/js/components/landing-component.js b/Server/public/js/components/landing-component.js index 8fc8089..c03e204 100644 --- a/Server/public/js/components/landing-component.js +++ b/Server/public/js/components/landing-component.js @@ -1 +1,588 @@ -import{S as t,i,a as o,b as e,s as r,e as n,n as s,d as m,c as a,o as c,w as p,f as g,g as d,t as l,h as u,j as h,v as f,k as v,l as w,m as x}from"./index-4348483d.js";import{w as b}from"./index-71440b21.js";import{addMarkersGroups as j,groupsMarkersLayer as T}from"../../../../../../../../../js/groups.js";import{addMarkersCoops as k,coopsMarkersLayer as y}from"../../../../../../../../../js/coops.js";import{addMarkersCommunes as U,communesMarkersLayer as z}from"../../../../../../../../../js/communes.js";import{addMarkersParties as N,partiesMarkersLayer as C}from"../../../../../../../../../js/parties.js";import{loadLocaleContent as A}from"../../../../../../../../../js/libraries/serverTools.js";import"../../../../../../../../../js/components/map-component.js";function E(t){let i,o,r,n,s,a,c,p,b,j,T,k,y,U,z,N,C,L,A,E,F,H,M,R,W,B,D,K,Q,S,_,q,G,I,J,O,P,V,X,Y,Z,$,tt,it,ot,et,rt,nt,st,mt,at,ct,pt,gt,dt,lt,ut,ht,ft,vt,wt,xt,bt,jt,Tt,kt,yt,Ut=t[3].top+"",zt=t[3].groupsTitle+"",Nt=t[3].groupsText+"",Ct=t[3].communesTitle+"",Lt=t[3].communesText+"",At=t[3].cooperativesTitle+"",Et=t[3].cooperativesText+"",Ft=t[3].partiesTitle+"",Ht=t[3].partiesText+"",Mt=t[3].findUs+"",Rt=t[3].whatNow+"",Wt=t[3].joinUs+"",Bt=t[3].talkWithUs+"";return{c(){i=g("div"),o=g("picture"),o.innerHTML=' \n \n crowd',r=d(),n=g("div"),s=g("p"),a=l(Ut),c=d(),p=g("div"),b=g("div"),j=g("a"),T=g("h2"),k=l(zt),y=d(),U=g("img"),N=d(),C=g("p"),L=l(Nt),A=d(),E=g("div"),F=g("a"),H=g("h2"),M=l(Ct),R=d(),W=g("img"),D=d(),K=g("p"),Q=l(Lt),S=d(),_=g("div"),q=g("a"),G=g("h2"),I=l(At),J=d(),O=g("img"),V=d(),X=g("p"),Y=l(Et),Z=d(),$=g("div"),tt=g("a"),it=g("h2"),ot=l(Ft),et=d(),rt=g("img"),st=d(),mt=g("p"),at=l(Ht),ct=d(),pt=g("h1"),gt=l(Mt),dt=d(),lt=g("map-component"),ht=d(),ft=g("h1"),vt=l(Rt),wt=d(),xt=g("div"),bt=g("a"),jt=l(Wt),Tt=d(),kt=g("a"),yt=l(Bt),u(j,"href","/"+t[6]+"/groups"),u(U,"id","groups-img"),h(U.src,z="/img/common/groups.svg")||u(U,"src","/img/common/groups.svg"),u(U,"alt","groups"),u(F,"href","/"+t[6]+"/communes"),u(W,"id","communes-img"),h(W.src,B="/img/common/commune.svg")||u(W,"src","/img/common/commune.svg"),u(W,"alt","communes"),u(q,"href","/"+t[6]+"/coops"),u(O,"id","coops-img"),h(O.src,P="/img/common/coops.svg")||u(O,"src","/img/common/coops.svg"),u(O,"alt","coops"),u(tt,"href","/"+t[6]+"/parties"),u(rt,"id","parties-img"),h(rt.src,nt="/img/common/parties.svg")||u(rt,"src","/img/common/parties.svg"),u(rt,"alt","coops"),u(p,"id","container-grid"),f(p,"--grid-width",t[1]),u(pt,"id","find-us"),v(lt,"id","map"),v(lt,"callback",ut=t[9]),v(lt,"colors",["#23AC20","#CA2437","#217BC9","#FFD326"]),u(bt,"class","link-button"),u(bt,"href","/"+t[6]+"/join-us"),u(kt,"class","link-button"),u(kt,"href","https://discord.gg/Qk8KUk787z"),u(kt,"target","_blank"),u(kt,"rel","noreferrer"),u(xt,"id","action-container"),u(n,"id","text-container"),u(i,"id","container")},m(m,g){e(m,i,g),w(i,o),w(i,r),w(i,n),w(n,s),w(s,a),w(n,c),w(n,p),w(p,b),w(b,j),w(j,T),w(T,k),w(b,y),w(b,U),w(b,N),w(b,C),w(C,L),w(p,A),w(p,E),w(E,F),w(F,H),w(H,M),w(E,R),w(E,W),w(E,D),w(E,K),w(K,Q),w(p,S),w(p,_),w(_,q),w(q,G),w(G,I),w(_,J),w(_,O),w(_,V),w(_,X),w(X,Y),w(p,Z),w(p,$),w($,tt),w(tt,it),w(it,ot),w($,et),w($,rt),w($,st),w($,mt),w(mt,at),t[8](p),w(n,ct),w(n,pt),w(pt,gt),w(n,dt),w(n,lt),w(n,ht),w(n,ft),w(ft,vt),w(n,wt),w(n,xt),w(xt,bt),w(bt,jt),w(xt,Tt),w(xt,kt),w(kt,yt)},p(t,i){8&i&&Ut!==(Ut=t[3].top+"")&&x(a,Ut),8&i&&zt!==(zt=t[3].groupsTitle+"")&&x(k,zt),8&i&&Nt!==(Nt=t[3].groupsText+"")&&x(L,Nt),8&i&&Ct!==(Ct=t[3].communesTitle+"")&&x(M,Ct),8&i&&Lt!==(Lt=t[3].communesText+"")&&x(Q,Lt),8&i&&At!==(At=t[3].cooperativesTitle+"")&&x(I,At),8&i&&Et!==(Et=t[3].cooperativesText+"")&&x(Y,Et),8&i&&Ft!==(Ft=t[3].partiesTitle+"")&&x(ot,Ft),8&i&&Ht!==(Ht=t[3].partiesText+"")&&x(at,Ht),2&i&&f(p,"--grid-width",t[1]),8&i&&Mt!==(Mt=t[3].findUs+"")&&x(gt,Mt),8&i&&ut!==(ut=t[9])&&v(lt,"callback",ut),8&i&&Rt!==(Rt=t[3].whatNow+"")&&x(vt,Rt),8&i&&Wt!==(Wt=t[3].joinUs+"")&&x(jt,Wt),8&i&&Bt!==(Bt=t[3].talkWithUs+"")&&x(yt,Bt)},d(o){o&&m(i),t[8](null)}}}function F(t){let i,o=6==t[2]&&E(t);return{c(){o&&o.c(),i=n()},m(t,r){o&&o.m(t,r),e(t,i,r)},p(t,e){6==t[2]?o?o.p(t,e):(o=E(t),o.c(),o.m(i.parentNode,i)):o&&(o.d(1),o=null)},d(t){o&&o.d(t),t&&m(i)}}}function H(t){let i,o=t[2],a=F(t);return{c(){a.c(),i=n(),this.c=s},m(t,o){a.m(t,o),e(t,i,o)},p(t,[e]){4&e&&r(o,o=t[2])?(a.d(1),a=F(t),a.c(),a.m(i.parentNode,i)):a.p(t,e)},i:s,o:s,d(t){t&&m(i),a.d(t)}}}function M(t,i,o){let e,r,n,s,m=b(0);a(t,m,(t=>o(2,e=t)));let g=b({});function d(t){o(1,s="1fr 1fr")}a(t,g,(t=>o(3,r=t))),A(g,"groups-component",m),A(g,"communes-component",m),A(g,"cooperatives-component",m),A(g,"parties-component",m),A(g,"countries",m);let l=A(g,"landing-component",m,d);function u(t,i){let o=t([22,0],2);j(o,i),U(o,i),k(o,i),N(o,i);let e={};e[i.groups]=T,e[i.communes]=z,e[i.cooperatives]=y,e[i.parties]=C,L.control.layers(null,e).addTo(o)}d(),c((()=>{}));return[n,s,e,r,m,g,l,u,function(t){p[t?"unshift":"push"]((()=>{n=t,o(0,n)}))},t=>u(t,r)]}class R extends t{constructor(t){super(),this.shadowRoot.innerHTML="",i(this,{target:this.shadowRoot,props:o(this.attributes),customElement:!0},M,H,r,{},null),t&&t.target&&e(t.target,this,t.anchor)}}customElements.define("landing-component",R);export{R as default}; + +(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document); +import { S as SvelteElement, i as init, a as attribute_to_object, b as insert_dev, s as safe_not_equal, d as dispatch_dev, v as validate_slots, c as validate_store, e as component_subscribe, o as onMount, f as empty, n as noop, h as detach_dev, C as binding_callbacks, k as element, l as space, t as text, p as attr_dev, m as add_location, q as src_url_equal, D as set_style, r as set_custom_element_data, u as append_dev, w as set_data_dev } from './index-d19aafba.js'; +import { w as writable } from './index-4664ced0.js'; +import { addMarkersGroups, groupsMarkersLayer } from '../../../../../../../../../js/groups.js'; +import { addMarkersCoops, coopsMarkersLayer } from '../../../../../../../../../js/coops.js'; +import { addMarkersCommunes, communesMarkersLayer } from '../../../../../../../../../js/communes.js'; +import { addMarkersParties, partiesMarkersLayer } from '../../../../../../../../../js/parties.js'; +import { loadLocaleContent } from '../../../../../../../../../js/libraries/serverTools.js'; +import '../../../../../../../../../js/components/map-component.js'; + +/* src\landing-component.svelte generated by Svelte v3.52.0 */ + +const file = "src\\landing-component.svelte"; + +// (61:4) {#if $loaded==6} +function create_if_block(ctx) { + let div7; + let picture; + let source0; + let t0; + let source1; + let t1; + let img0; + let t2; + let div6; + let p0; + let t3_value = /*$content*/ ctx[3].top + ""; + let t3; + let t4; + let div4; + let div0; + let a0; + let h20; + let t5_value = /*$content*/ ctx[3].groupsTitle + ""; + let t5; + let t6; + let img1; + let img1_src_value; + let t7; + let p1; + let t8_value = /*$content*/ ctx[3].groupsText + ""; + let t8; + let t9; + let div1; + let a1; + let h21; + let t10_value = /*$content*/ ctx[3].communesTitle + ""; + let t10; + let t11; + let img2; + let img2_src_value; + let t12; + let p2; + let t13_value = /*$content*/ ctx[3].communesText + ""; + let t13; + let t14; + let div2; + let a2; + let h22; + let t15_value = /*$content*/ ctx[3].cooperativesTitle + ""; + let t15; + let t16; + let img3; + let img3_src_value; + let t17; + let p3; + let t18_value = /*$content*/ ctx[3].cooperativesText + ""; + let t18; + let t19; + let div3; + let a3; + let h23; + let t20_value = /*$content*/ ctx[3].partiesTitle + ""; + let t20; + let t21; + let img4; + let img4_src_value; + let t22; + let p4; + let t23_value = /*$content*/ ctx[3].partiesText + ""; + let t23; + let t24; + let h10; + let t25_value = /*$content*/ ctx[3].findUs + ""; + let t25; + let t26; + let map_component; + let map_component_callback_value; + let t27; + let h11; + let t28_value = /*$content*/ ctx[3].whatNow + ""; + let t28; + let t29; + let div5; + let a4; + let t30_value = /*$content*/ ctx[3].joinUs + ""; + let t30; + let t31; + let a5; + let t32_value = /*$content*/ ctx[3].talkWithUs + ""; + let t32; + + const block = { + c: function create() { + div7 = element("div"); + picture = element("picture"); + source0 = element("source"); + t0 = space(); + source1 = element("source"); + t1 = space(); + img0 = element("img"); + t2 = space(); + div6 = element("div"); + p0 = element("p"); + t3 = text(t3_value); + t4 = space(); + div4 = element("div"); + div0 = element("div"); + a0 = element("a"); + h20 = element("h2"); + t5 = text(t5_value); + t6 = space(); + img1 = element("img"); + t7 = space(); + p1 = element("p"); + t8 = text(t8_value); + t9 = space(); + div1 = element("div"); + a1 = element("a"); + h21 = element("h2"); + t10 = text(t10_value); + t11 = space(); + img2 = element("img"); + t12 = space(); + p2 = element("p"); + t13 = text(t13_value); + t14 = space(); + div2 = element("div"); + a2 = element("a"); + h22 = element("h2"); + t15 = text(t15_value); + t16 = space(); + img3 = element("img"); + t17 = space(); + p3 = element("p"); + t18 = text(t18_value); + t19 = space(); + div3 = element("div"); + a3 = element("a"); + h23 = element("h2"); + t20 = text(t20_value); + t21 = space(); + img4 = element("img"); + t22 = space(); + p4 = element("p"); + t23 = text(t23_value); + t24 = space(); + h10 = element("h1"); + t25 = text(t25_value); + t26 = space(); + map_component = element("map-component"); + t27 = space(); + h11 = element("h1"); + t28 = text(t28_value); + t29 = space(); + div5 = element("div"); + a4 = element("a"); + t30 = text(t30_value); + t31 = space(); + a5 = element("a"); + t32 = text(t32_value); + attr_dev(source0, "srcset", "/img/crowd.webp"); + add_location(source0, file, 63, 16, 2097); + attr_dev(source1, "srcset", "/img/crowd.png"); + add_location(source1, file, 64, 16, 2148); + attr_dev(img0, "id", "crowd"); + attr_dev(img0, "alt", "crowd"); + add_location(img0, file, 65, 16, 2198); + add_location(picture, file, 62, 12, 2070); + add_location(p0, file, 68, 16, 2307); + add_location(h20, file, 71, 59, 2510); + attr_dev(a0, "href", "/" + /*locale*/ ctx[6] + "/groups"); + add_location(a0, file, 71, 24, 2475); + attr_dev(img1, "id", "groups-img"); + if (!src_url_equal(img1.src, img1_src_value = "/img/common/groups.svg")) attr_dev(img1, "src", img1_src_value); + attr_dev(img1, "alt", "groups"); + add_location(img1, file, 72, 24, 2571); + add_location(p1, file, 73, 24, 2660); + add_location(div0, file, 70, 20, 2444); + add_location(h21, file, 76, 61, 2806); + attr_dev(a1, "href", "/" + /*locale*/ ctx[6] + "/communes"); + add_location(a1, file, 76, 24, 2769); + attr_dev(img2, "id", "communes-img"); + if (!src_url_equal(img2.src, img2_src_value = "/img/common/commune.svg")) attr_dev(img2, "src", img2_src_value); + attr_dev(img2, "alt", "communes"); + add_location(img2, file, 77, 24, 2869); + add_location(p2, file, 78, 24, 2963); + add_location(div1, file, 75, 20, 2738); + add_location(h22, file, 81, 58, 3108); + attr_dev(a2, "href", "/" + /*locale*/ ctx[6] + "/coops"); + add_location(a2, file, 81, 24, 3074); + attr_dev(img3, "id", "coops-img"); + if (!src_url_equal(img3.src, img3_src_value = "/img/common/coops.svg")) attr_dev(img3, "src", img3_src_value); + attr_dev(img3, "alt", "coops"); + add_location(img3, file, 82, 24, 3175); + add_location(p3, file, 83, 24, 3261); + add_location(div2, file, 80, 20, 3043); + add_location(h23, file, 86, 60, 3412); + attr_dev(a3, "href", "/" + /*locale*/ ctx[6] + "/parties"); + add_location(a3, file, 86, 24, 3376); + attr_dev(img4, "id", "parties-img"); + if (!src_url_equal(img4.src, img4_src_value = "/img/common/parties.svg")) attr_dev(img4, "src", img4_src_value); + attr_dev(img4, "alt", "coops"); + add_location(img4, file, 87, 24, 3474); + add_location(p4, file, 88, 24, 3564); + add_location(div3, file, 85, 20, 3345); + attr_dev(div4, "id", "container-grid"); + set_style(div4, "--grid-width", /*gridWidth*/ ctx[1]); + add_location(div4, file, 69, 16, 2346); + attr_dev(h10, "id", "find-us"); + add_location(h10, file, 108, 16, 6365); + set_custom_element_data(map_component, "id", "map"); + set_custom_element_data(map_component, "callback", map_component_callback_value = /*func*/ ctx[9]); + set_custom_element_data(map_component, "colors", ["#23AC20", "#CA2437", "#217BC9", "#FFD326"]); + add_location(map_component, file, 109, 16, 6422); + add_location(h11, file, 110, 16, 6596); + attr_dev(a4, "class", "link-button"); + attr_dev(a4, "href", "/" + /*locale*/ ctx[6] + "/join-us"); + add_location(a4, file, 112, 20, 6690); + attr_dev(a5, "class", "link-button"); + attr_dev(a5, "href", "https://discord.gg/Qk8KUk787z"); + attr_dev(a5, "target", "_blank"); + attr_dev(a5, "rel", "noreferrer"); + add_location(a5, file, 113, 20, 6789); + attr_dev(div5, "id", "action-container"); + add_location(div5, file, 111, 16, 6641); + attr_dev(div6, "id", "text-container"); + add_location(div6, file, 67, 12, 2264); + attr_dev(div7, "id", "container"); + add_location(div7, file, 61, 8, 2036); + }, + m: function mount(target, anchor) { + insert_dev(target, div7, anchor); + append_dev(div7, picture); + append_dev(picture, source0); + append_dev(picture, t0); + append_dev(picture, source1); + append_dev(picture, t1); + append_dev(picture, img0); + append_dev(div7, t2); + append_dev(div7, div6); + append_dev(div6, p0); + append_dev(p0, t3); + append_dev(div6, t4); + append_dev(div6, div4); + append_dev(div4, div0); + append_dev(div0, a0); + append_dev(a0, h20); + append_dev(h20, t5); + append_dev(div0, t6); + append_dev(div0, img1); + append_dev(div0, t7); + append_dev(div0, p1); + append_dev(p1, t8); + append_dev(div4, t9); + append_dev(div4, div1); + append_dev(div1, a1); + append_dev(a1, h21); + append_dev(h21, t10); + append_dev(div1, t11); + append_dev(div1, img2); + append_dev(div1, t12); + append_dev(div1, p2); + append_dev(p2, t13); + append_dev(div4, t14); + append_dev(div4, div2); + append_dev(div2, a2); + append_dev(a2, h22); + append_dev(h22, t15); + append_dev(div2, t16); + append_dev(div2, img3); + append_dev(div2, t17); + append_dev(div2, p3); + append_dev(p3, t18); + append_dev(div4, t19); + append_dev(div4, div3); + append_dev(div3, a3); + append_dev(a3, h23); + append_dev(h23, t20); + append_dev(div3, t21); + append_dev(div3, img4); + append_dev(div3, t22); + append_dev(div3, p4); + append_dev(p4, t23); + /*div4_binding*/ ctx[8](div4); + append_dev(div6, t24); + append_dev(div6, h10); + append_dev(h10, t25); + append_dev(div6, t26); + append_dev(div6, map_component); + append_dev(div6, t27); + append_dev(div6, h11); + append_dev(h11, t28); + append_dev(div6, t29); + append_dev(div6, div5); + append_dev(div5, a4); + append_dev(a4, t30); + append_dev(div5, t31); + append_dev(div5, a5); + append_dev(a5, t32); + }, + p: function update(ctx, dirty) { + if (dirty & /*$content*/ 8 && t3_value !== (t3_value = /*$content*/ ctx[3].top + "")) set_data_dev(t3, t3_value); + if (dirty & /*$content*/ 8 && t5_value !== (t5_value = /*$content*/ ctx[3].groupsTitle + "")) set_data_dev(t5, t5_value); + if (dirty & /*$content*/ 8 && t8_value !== (t8_value = /*$content*/ ctx[3].groupsText + "")) set_data_dev(t8, t8_value); + if (dirty & /*$content*/ 8 && t10_value !== (t10_value = /*$content*/ ctx[3].communesTitle + "")) set_data_dev(t10, t10_value); + if (dirty & /*$content*/ 8 && t13_value !== (t13_value = /*$content*/ ctx[3].communesText + "")) set_data_dev(t13, t13_value); + if (dirty & /*$content*/ 8 && t15_value !== (t15_value = /*$content*/ ctx[3].cooperativesTitle + "")) set_data_dev(t15, t15_value); + if (dirty & /*$content*/ 8 && t18_value !== (t18_value = /*$content*/ ctx[3].cooperativesText + "")) set_data_dev(t18, t18_value); + if (dirty & /*$content*/ 8 && t20_value !== (t20_value = /*$content*/ ctx[3].partiesTitle + "")) set_data_dev(t20, t20_value); + if (dirty & /*$content*/ 8 && t23_value !== (t23_value = /*$content*/ ctx[3].partiesText + "")) set_data_dev(t23, t23_value); + + if (dirty & /*gridWidth*/ 2) { + set_style(div4, "--grid-width", /*gridWidth*/ ctx[1]); + } + + if (dirty & /*$content*/ 8 && t25_value !== (t25_value = /*$content*/ ctx[3].findUs + "")) set_data_dev(t25, t25_value); + + if (dirty & /*$content*/ 8 && map_component_callback_value !== (map_component_callback_value = /*func*/ ctx[9])) { + set_custom_element_data(map_component, "callback", map_component_callback_value); + } + + if (dirty & /*$content*/ 8 && t28_value !== (t28_value = /*$content*/ ctx[3].whatNow + "")) set_data_dev(t28, t28_value); + if (dirty & /*$content*/ 8 && t30_value !== (t30_value = /*$content*/ ctx[3].joinUs + "")) set_data_dev(t30, t30_value); + if (dirty & /*$content*/ 8 && t32_value !== (t32_value = /*$content*/ ctx[3].talkWithUs + "")) set_data_dev(t32, t32_value); + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div7); + /*div4_binding*/ ctx[8](null); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block.name, + type: "if", + source: "(61:4) {#if $loaded==6}", + ctx + }); + + return block; +} + +// (60:0) {#key $loaded} +function create_key_block(ctx) { + let if_block_anchor; + let if_block = /*$loaded*/ ctx[2] == 6 && create_if_block(ctx); + + const block = { + c: function create() { + if (if_block) if_block.c(); + if_block_anchor = empty(); + }, + m: function mount(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert_dev(target, if_block_anchor, anchor); + }, + p: function update(ctx, dirty) { + if (/*$loaded*/ ctx[2] == 6) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block(ctx); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + }, + d: function destroy(detaching) { + if (if_block) if_block.d(detaching); + if (detaching) detach_dev(if_block_anchor); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_key_block.name, + type: "key", + source: "(60:0) {#key $loaded}", + ctx + }); + + return block; +} + +function create_fragment(ctx) { + let previous_key = /*$loaded*/ ctx[2]; + let key_block_anchor; + let key_block = create_key_block(ctx); + + const block = { + c: function create() { + key_block.c(); + key_block_anchor = empty(); + this.c = noop; + }, + l: function claim(nodes) { + throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); + }, + m: function mount(target, anchor) { + key_block.m(target, anchor); + insert_dev(target, key_block_anchor, anchor); + }, + p: function update(ctx, [dirty]) { + if (dirty & /*$loaded*/ 4 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[2])) { + key_block.d(1); + key_block = create_key_block(ctx); + key_block.c(); + key_block.m(key_block_anchor.parentNode, key_block_anchor); + } else { + key_block.p(ctx, dirty); + } + }, + i: noop, + o: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(key_block_anchor); + key_block.d(detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment.name, + type: "component", + source: "", + ctx + }); + + return block; +} + +function instance($$self, $$props, $$invalidate) { + let $loaded; + let $content; + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots('landing-component', slots, []); + let grid; + let gridWidth; + let loaded = writable(0); + validate_store(loaded, 'loaded'); + component_subscribe($$self, loaded, value => $$invalidate(2, $loaded = value)); + let content = writable({}); + validate_store(content, 'content'); + component_subscribe($$self, content, value => $$invalidate(3, $content = value)); + + function changeWidth(locale) { + if (locale == "ru") { + $$invalidate(1, gridWidth = "1fr 1fr"); + } else { + $$invalidate(1, gridWidth = "1fr 1fr"); + } + } + + loadLocaleContent(content, "groups-component", loaded); + loadLocaleContent(content, "communes-component", loaded); + loadLocaleContent(content, "cooperatives-component", loaded); + loadLocaleContent(content, "parties-component", loaded); + loadLocaleContent(content, "countries", loaded); + let locale = loadLocaleContent(content, "landing-component", loaded, changeWidth); + changeWidth(locale); + + function mapCallback(createMap, content, locale) { + let map = createMap([22, 0], 2); + addMarkersGroups(map, content, locale); + addMarkersCommunes(map, content, locale); + addMarkersCoops(map, content, locale); + addMarkersParties(map, content, locale); + let overlayMaps = {}; + overlayMaps[content.groups] = groupsMarkersLayer; + overlayMaps[content.communes] = communesMarkersLayer; + overlayMaps[content.cooperatives] = coopsMarkersLayer; + overlayMaps[content.parties] = partiesMarkersLayer; + L.control.layers(null, overlayMaps).addTo(map); + } + + onMount(() => { + + }); + + const writable_props = []; + + Object.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); + }); + + function div4_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + grid = $$value; + $$invalidate(0, grid); + }); + } + + const func = createMap => mapCallback(createMap, $content, locale); + + $$self.$capture_state = () => ({ + onMount, + writable, + addMarkersGroups, + groupsMarkersLayer, + addMarkersCoops, + coopsMarkersLayer, + addMarkersCommunes, + communesMarkersLayer, + addMarkersParties, + partiesMarkersLayer, + loadLocaleContent, + grid, + gridWidth, + loaded, + content, + changeWidth, + locale, + mapCallback, + $loaded, + $content + }); + + $$self.$inject_state = $$props => { + if ('grid' in $$props) $$invalidate(0, grid = $$props.grid); + if ('gridWidth' in $$props) $$invalidate(1, gridWidth = $$props.gridWidth); + if ('loaded' in $$props) $$invalidate(4, loaded = $$props.loaded); + if ('content' in $$props) $$invalidate(5, content = $$props.content); + if ('locale' in $$props) $$invalidate(6, locale = $$props.locale); + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [ + grid, + gridWidth, + $loaded, + $content, + loaded, + content, + locale, + mapCallback, + div4_binding, + func + ]; +} + +class Landing_component extends SvelteElement { + constructor(options) { + super(); + this.shadowRoot.innerHTML = ``; + + init( + this, + { + target: this.shadowRoot, + props: attribute_to_object(this.attributes), + customElement: true + }, + instance, + create_fragment, + safe_not_equal, + {}, + null + ); + + if (options) { + if (options.target) { + insert_dev(options.target, this, options.anchor); + } + } + } +} + +customElements.define("landing-component", Landing_component); + +export { Landing_component as default }; diff --git a/Server/public/js/components/legend-component.js b/Server/public/js/components/legend-component.js index 6a643c7..97a38cc 100644 --- a/Server/public/js/components/legend-component.js +++ b/Server/public/js/components/legend-component.js @@ -1 +1,362 @@ -import{S as t,i as e,a as s,b as o,u as n,s as r,f as i,n as a,h as l,d as c,p,o as u,g as h,t as d,v as m,l as f,q as g,m as y,w as $}from"./index-4348483d.js";import{pullLegendData as b}from"../../../../../../../../../js/predict/charts.js";function w(t,e,s){const o=t.slice();return o[10]=e[s],o[11]=e,o[12]=s,o}function x(t){let e,s,n,r,a,p,u,$,b=t[10].name+"",w=t[12];const x=()=>t[6](e,w),k=()=>t[6](null,w);function v(){return t[7](t[12])}return{c(){e=i("button"),s=i("div"),n=h(),r=i("span"),a=d(b),p=h(),l(s,"class","marker"),m(s,"background-color",t[10].color)},m(t,i){o(t,e,i),f(e,s),f(e,n),f(e,r),f(r,a),f(e,p),x(),u||($=g(e,"click",v),u=!0)},p(e,o){t=e,1&o&&m(s,"background-color",t[10].color),1&o&&b!==(b=t[10].name+"")&&y(a,b),w!==t[12]&&(k(),w=t[12],x())},d(t){t&&c(e),k(),u=!1,$()}}}function k(t){let e,s=t[0],n=[];for(let e=0;et._id)),c=a[t];for(let t=0;t{c()}));return t.$$set=t=>{"option"in t&&s(4,n=t.option),"chart"in t&&s(5,r=t.chart),"data"in t&&s(3,i=t.data)},[a,l,p,i,n,r,function(t,e){$[t?"unshift":"push"]((()=>{l[e]=t,s(1,l)}))},t=>p(t)]}class j extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:s(this.attributes),customElement:!0},v,k,r,{option:4,chart:5,data:3},null),t&&(t.target&&o(t.target,this,t.anchor),t.props&&(this.$set(t.props),n()))}static get observedAttributes(){return["option","chart","data"]}get option(){return this.$$.ctx[4]}set option(t){this.$$set({option:t}),n()}get chart(){return this.$$.ctx[5]}set chart(t){this.$$set({chart:t}),n()}get data(){return this.$$.ctx[3]}set data(t){this.$$set({data:t}),n()}}customElements.define("legend-component",j);export{j as default}; + +(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document); +import { S as SvelteElement, i as init, a as attribute_to_object, b as insert_dev, B as flush, s as safe_not_equal, j as validate_each_argument, d as dispatch_dev, v as validate_slots, o as onMount, g as globals, k as element, n as noop, p as attr_dev, m as add_location, h as detach_dev, x as destroy_each, C as binding_callbacks, l as space, t as text, D as set_style, u as append_dev, y as listen_dev, w as set_data_dev } from './index-d19aafba.js'; +import { pullLegendData } from '../../../../../../../../../js/predict/charts.js'; + +/* src\components\legend-component.svelte generated by Svelte v3.52.0 */ + +const { Object: Object_1 } = globals; +const file = "src\\components\\legend-component.svelte"; + +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[10] = list[i]; + child_ctx[11] = list; + child_ctx[12] = i; + return child_ctx; +} + +// (69:4) {#each legendData as item, i} +function create_each_block(ctx) { + let button; + let div; + let t0; + let span; + let t1_value = /*item*/ ctx[10].name + ""; + let t1; + let t2; + let i = /*i*/ ctx[12]; + let mounted; + let dispose; + const assign_button = () => /*button_binding*/ ctx[6](button, i); + const unassign_button = () => /*button_binding*/ ctx[6](null, i); + + function click_handler() { + return /*click_handler*/ ctx[7](/*i*/ ctx[12]); + } + + const block = { + c: function create() { + button = element("button"); + div = element("div"); + t0 = space(); + span = element("span"); + t1 = text(t1_value); + t2 = space(); + attr_dev(div, "class", "marker"); + set_style(div, "background-color", /*item*/ ctx[10].color); + add_location(div, file, 70, 12, 1892); + add_location(span, file, 71, 12, 1971); + add_location(button, file, 69, 8, 1814); + }, + m: function mount(target, anchor) { + insert_dev(target, button, anchor); + append_dev(button, div); + append_dev(button, t0); + append_dev(button, span); + append_dev(span, t1); + append_dev(button, t2); + assign_button(); + + if (!mounted) { + dispose = listen_dev(button, "click", click_handler, false, false, false); + mounted = true; + } + }, + p: function update(new_ctx, dirty) { + ctx = new_ctx; + + if (dirty & /*legendData*/ 1) { + set_style(div, "background-color", /*item*/ ctx[10].color); + } + + if (dirty & /*legendData*/ 1 && t1_value !== (t1_value = /*item*/ ctx[10].name + "")) set_data_dev(t1, t1_value); + + if (i !== /*i*/ ctx[12]) { + unassign_button(); + i = /*i*/ ctx[12]; + assign_button(); + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(button); + unassign_button(); + mounted = false; + dispose(); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_each_block.name, + type: "each", + source: "(69:4) {#each legendData as item, i}", + ctx + }); + + return block; +} + +function create_fragment(ctx) { + let div; + let each_value = /*legendData*/ ctx[0]; + validate_each_argument(each_value); + let each_blocks = []; + + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + + const block = { + c: function create() { + div = element("div"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + this.c = noop; + attr_dev(div, "class", "legend"); + add_location(div, file, 67, 0, 1749); + }, + l: function claim(nodes) { + throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); + }, + m: function mount(target, anchor) { + insert_dev(target, div, anchor); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(div, null); + } + }, + p: function update(ctx, [dirty]) { + if (dirty & /*buttons, toggleSeries, legendData*/ 7) { + each_value = /*legendData*/ ctx[0]; + validate_each_argument(each_value); + let i; + + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx, each_value, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div, null); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value.length; + } + }, + i: noop, + o: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(div); + destroy_each(each_blocks, detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment.name, + type: "component", + source: "", + ctx + }); + + return block; +} + +function instance($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots('legend-component', slots, []); + let { option = null } = $$props; + let { chart = null } = $$props; + let { data = {} } = $$props; + + // Main code + let legendData = []; + + let buttons = []; + let dataKeys; + + function init() { + if (option == null || option == undefined || chart == null || chart == undefined) { + setTimeout(init, 100); + } else { + $$invalidate(0, legendData = pullLegendData(legendData, option)); + + for (let obj of legendData) { + $$invalidate(3, data[obj.name] = true, data); + } + + dataKeys = Object.keys(data); + } + } + + function toggleSeries(i) { + $$invalidate(3, data[dataKeys[i]] = !data[dataKeys[i]], data); + let inds = []; + let ids = option.series.map(x => x._id); + let id = ids[i]; + + for (let j = 0; j < ids.length; j++) { + if (ids[j] == id) { + inds.push(j); + } + } + + for (let i of inds) { + let series = option.series[i]; + + if (!series.tooltip.show) { + series.lineStyle.opacity = 1; + series.itemStyle.opacity = 1; + series.tooltip.show = true; + $$invalidate(1, buttons[inds[0]].style.opacity = 1, buttons); + } else { + series.lineStyle.opacity = 0; + series.itemStyle.opacity = 0; + series.tooltip.show = false; + $$invalidate(1, buttons[inds[0]].style.opacity = 0.5, buttons); + } + } + + chart.setOption(option); + } + + onMount(() => { + init(); + }); + + const writable_props = ['option', 'chart', 'data']; + + Object_1.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); + }); + + function button_binding($$value, i) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + buttons[i] = $$value; + $$invalidate(1, buttons); + }); + } + + const click_handler = i => toggleSeries(i); + + $$self.$$set = $$props => { + if ('option' in $$props) $$invalidate(4, option = $$props.option); + if ('chart' in $$props) $$invalidate(5, chart = $$props.chart); + if ('data' in $$props) $$invalidate(3, data = $$props.data); + }; + + $$self.$capture_state = () => ({ + onMount, + pullLegendData, + option, + chart, + data, + legendData, + buttons, + dataKeys, + init, + toggleSeries + }); + + $$self.$inject_state = $$props => { + if ('option' in $$props) $$invalidate(4, option = $$props.option); + if ('chart' in $$props) $$invalidate(5, chart = $$props.chart); + if ('data' in $$props) $$invalidate(3, data = $$props.data); + if ('legendData' in $$props) $$invalidate(0, legendData = $$props.legendData); + if ('buttons' in $$props) $$invalidate(1, buttons = $$props.buttons); + if ('dataKeys' in $$props) dataKeys = $$props.dataKeys; + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [ + legendData, + buttons, + toggleSeries, + data, + option, + chart, + button_binding, + click_handler + ]; +} + +class Legend_component extends SvelteElement { + constructor(options) { + super(); + this.shadowRoot.innerHTML = ``; + + init( + this, + { + target: this.shadowRoot, + props: attribute_to_object(this.attributes), + customElement: true + }, + instance, + create_fragment, + safe_not_equal, + { option: 4, chart: 5, data: 3 }, + null + ); + + if (options) { + if (options.target) { + insert_dev(options.target, this, options.anchor); + } + + if (options.props) { + this.$set(options.props); + flush(); + } + } + } + + static get observedAttributes() { + return ["option", "chart", "data"]; + } + + get option() { + return this.$$.ctx[4]; + } + + set option(option) { + this.$$set({ option }); + flush(); + } + + get chart() { + return this.$$.ctx[5]; + } + + set chart(chart) { + this.$$set({ chart }); + flush(); + } + + get data() { + return this.$$.ctx[3]; + } + + set data(data) { + this.$$set({ data }); + flush(); + } +} + +customElements.define("legend-component", Legend_component); + +export { Legend_component as default }; diff --git a/Server/public/js/components/loadscreen-component.js b/Server/public/js/components/loadscreen-component.js index 4feb1ba..76d0605 100644 --- a/Server/public/js/components/loadscreen-component.js +++ b/Server/public/js/components/loadscreen-component.js @@ -1 +1,115 @@ -import{S as t,i as s,a as e,b as n,s as o,f as a,n as i,h as d,v as r,d as u,o as c,w as l}from"./index-4348483d.js";function h(t){let s;return{c(){s=a("div"),this.c=i,d(s,"id","loadscreen"),r(s,"width","100%"),r(s,"height","100%"),r(s,"background","white"),r(s,"position","absolute"),r(s,"z-index","100000")},m(e,o){n(e,s,o),t[1](s)},p:i,i:i,o:i,d(e){e&&u(s),t[1](null)}}}function p(t,s,e){let n;return c((()=>{window.addEventListener("load",(function(){e(0,n.parentNode.host.style.display="none",n)}))})),[n,function(t){l[t?"unshift":"push"]((()=>{n=t,e(0,n)}))}]}class f extends t{constructor(t){super(),s(this,{target:this.shadowRoot,props:e(this.attributes),customElement:!0},p,h,o,{},null),t&&t.target&&n(t.target,this,t.anchor)}}customElements.define("loadscreen-component",f);export{f as default}; + +(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document); +import { S as SvelteElement, i as init, a as attribute_to_object, b as insert_dev, s as safe_not_equal, d as dispatch_dev, v as validate_slots, o as onMount, k as element, n as noop, p as attr_dev, D as set_style, m as add_location, h as detach_dev, C as binding_callbacks } from './index-d19aafba.js'; + +/* src\components\loadscreen-component.svelte generated by Svelte v3.52.0 */ +const file = "src\\components\\loadscreen-component.svelte"; + +function create_fragment(ctx) { + let div; + + const block = { + c: function create() { + div = element("div"); + this.c = noop; + attr_dev(div, "id", "loadscreen"); + set_style(div, "width", "100%"); + set_style(div, "height", "100%"); + set_style(div, "background", "white"); + set_style(div, "position", "absolute"); + set_style(div, "z-index", "100000"); + add_location(div, file, 20, 0, 366); + }, + l: function claim(nodes) { + throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); + }, + m: function mount(target, anchor) { + insert_dev(target, div, anchor); + /*div_binding*/ ctx[1](div); + }, + p: noop, + i: noop, + o: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(div); + /*div_binding*/ ctx[1](null); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment.name, + type: "component", + source: "", + ctx + }); + + return block; +} + +function instance($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots('loadscreen-component', slots, []); + let loadscreen; + + onMount(() => { + window.addEventListener('load', function () { + $$invalidate(0, loadscreen.parentNode.host.style.display = "none", loadscreen); + }); + }); + + const writable_props = []; + + Object.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); + }); + + function div_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + loadscreen = $$value; + $$invalidate(0, loadscreen); + }); + } + + $$self.$capture_state = () => ({ onMount, loadscreen }); + + $$self.$inject_state = $$props => { + if ('loadscreen' in $$props) $$invalidate(0, loadscreen = $$props.loadscreen); + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [loadscreen, div_binding]; +} + +class Loadscreen_component extends SvelteElement { + constructor(options) { + super(); + + init( + this, + { + target: this.shadowRoot, + props: attribute_to_object(this.attributes), + customElement: true + }, + instance, + create_fragment, + safe_not_equal, + {}, + null + ); + + if (options) { + if (options.target) { + insert_dev(options.target, this, options.anchor); + } + } + } +} + +customElements.define("loadscreen-component", Loadscreen_component); + +export { Loadscreen_component as default }; diff --git a/Server/public/js/components/manifesto-component.js b/Server/public/js/components/manifesto-component.js index e0230b8..c4f3b17 100644 --- a/Server/public/js/components/manifesto-component.js +++ b/Server/public/js/components/manifesto-component.js @@ -1 +1,1490 @@ -import{S as t,i as e,a as n,b as i,s as l,e as o,n as r,d as s,c,o as a,w as d,f as m,h as u,l as f,t as h,g as p,j as g,v as w,q as b,m as x,p as y,y as v,H as k}from"./index-4348483d.js";import{w as H}from"./index-71440b21.js";import{loadLocaleContent as j,getData as I}from"../../../../../../../../../js/libraries/serverTools.js";import{px2rem as L}from"../../../../../../../../../js/libraries/miscTools.js";function T(t,e,n){const i=t.slice();return i[33]=e[n],i[34]=e,i[35]=n,i}function Y(t,e,n){const i=t.slice();return i[36]=e[n],i}function C(t,e,n){const i=t.slice();return i[36]=e[n],i}function M(t,e,n){const i=t.slice();return i[41]=e[n],i[42]=e,i[43]=n,i}function z(t,e,n){const i=t.slice();return i[44]=e[n],i[45]=e,i[46]=n,i}function A(t){let e,n,o=t[0],r=K(t);return{c(){e=m("div"),n=m("div"),r.c(),u(n,"id","text-container"),u(e,"id","container")},m(l,o){i(l,e,o),f(e,n),r.m(n,null),t[28](e)},p(t,e){1&e[0]&&l(o,o=t[0])?(r.d(1),r=K(t),r.c(),r.m(n,null)):r.p(t,e)},d(n){n&&s(e),r.d(n),t[28](null)}}}function V(t){let e,n,l,o,r,c,a=t[41].name+"",d=t[41];const g=()=>t[21](n,d),w=()=>t[21](null,d);function x(){return t[22](t[41])}return{c(){e=m("div"),n=m("button"),l=h(a),o=p(),u(n,"class","level0 heading-button"),u(e,"class","heading-button-wrapper")},m(t,s){i(t,e,s),f(e,n),f(n,l),g(),f(e,o),r||(c=b(n,"click",x),r=!0)},p(e,n){d!==(t=e)[41]&&(w(),d=t[41],g())},d(t){t&&s(e),w(),r=!1,c()}}}function O(t){let e,n=t[41],l=[];for(let e=0;et[19](n,d),w=()=>t[19](null,d);function x(){return t[20](t[44])}return{c(){e=m("div"),n=m("button"),l=h(a),o=p(),u(n,"class","level1 heading-button"),u(e,"class","heading-button-wrapper")},m(t,s){i(t,e,s),f(e,n),f(n,l),g(),f(e,o),r||(c=b(n,"click",x),r=!0)},p(e,n){d!==(t=e)[44]&&(w(),d=t[44],g())},d(t){t&&s(e),w(),r=!1,c()}}}function S(t){let e;let n=function(t,e){return Array.isArray(t[41])?O:V}(t),l=n(t);return{c(){l.c(),e=o()},m(t,n){l.m(t,n),i(t,e,n)},p(t,e){l.p(t,e)},d(t){l.d(t),t&&s(e)}}}function E(t){let e;let n=function(t,e){return t[33],"ul"==Object.keys(t[33])[0]?D:(t[33],"ol"==Object.keys(t[33])[0]?W:(t[33],"h3"==t[33].type?q:(t[33],"h2"==t[33].type?_:"#"==t[33][0]?B:N)))}(t),l=n(t);return{c(){l.c(),e=o()},m(t,n){l.m(t,n),i(t,e,n)},p(t,e){l.p(t,e)},d(t){l.d(t),t&&s(e)}}}function N(t){let e,n,l,o=t[33]+"";return{c(){e=m("p"),n=new k(!1),l=p(),n.a=l,u(e,"class","margin-end")},m(t,r){i(t,e,r),n.m(o,e),f(e,l)},p:r,d(t){t&&s(e)}}}function B(t){let e,n=t[33].slice(2,t[33].length)+"";return{c(){e=m("h1")},m(t,l){i(t,e,l),e.innerHTML=n},p:r,d(t){t&&s(e)}}}function _(t){let e,n,l,o,r,c=t[33].line+"",a=t[33];const d=()=>t[26](n,a),h=()=>t[26](null,a);return{c(){e=m("button"),n=m("h2"),l=p(),u(n,"id",t[33].id),w(e,"display","block"),w(e,"width","100%")},m(s,a){i(s,e,a),f(e,n),n.innerHTML=c,d(),f(e,l),o||(r=b(e,"click",(function(){v(t[6].scrollIntoView({block:"start"},!0))&&t[6].scrollIntoView({block:"start"},!0).apply(this,arguments)})),o=!0)},p(e,n){a!==(t=e)[33]&&(h(),a=t[33],d())},d(t){t&&s(e),h(),o=!1,r()}}}function q(t){let e,n,l,o,r,c=t[33].line+"",a=t[33];const d=()=>t[25](n,a),h=()=>t[25](null,a);return{c(){e=m("button"),n=m("h3"),l=p(),u(n,"id",t[33].id),w(e,"display","block"),w(e,"width","100%")},m(s,a){i(s,e,a),f(e,n),n.innerHTML=c,d(),f(e,l),o||(r=b(e,"click",(function(){v(t[6].scrollIntoView({block:"start"},!0))&&t[6].scrollIntoView({block:"start"},!0).apply(this,arguments)})),o=!0)},p(e,n){a!==(t=e)[33]&&(h(),a=t[33],d())},d(t){t&&s(e),h(),o=!1,r()}}}function W(t){let e,n,l=t[33].ol,o=[];for(let e=0;en(9,i=t)));let k=H({});c(t,k,(t=>n(10,l=t))),j(k,"countries",v);let T=j(k,"manifesto-component",v);const Y=["ul","ol"];function C(t){w[t].scrollIntoView({block:"start"},!0)}I("/locales/"+T+"/manifesto.txt",(function(t){let e,i=t.split(/\r?\n/),l=0;for(let t=0;tn.includes("<"+t+">"))).findIndex((t=>t));if(-1!=o){let e=Y[o],l={};l[e]=[];let r="";for(;;){if(t+=1,n=i[t],n.includes(r)){p.push(l);break}l[e].push(n)}}else if("###"==n.slice(0,3)){let t=n.slice(4,n.length),i=t.toLowerCase().trim().replaceAll(" ","-");e.push({id:i,name:t,index:l}),l+=1,p.push({type:"h3",id:i,line:t,index:l})}else if("##"==n.slice(0,2)){let t=n.slice(3,n.length),i=t.toLowerCase().trim().replaceAll(" ","-");b.push({id:t.toLowerCase().trim().replaceAll(" ","-"),name:t,index:l}),l+=1,e=[],b.push(e),p.push({type:"h2",id:i,line:t,index:l})}else p.push(n)}n(0,o+=1)})),addEventListener("scroll",(t=>{if(window.innerWidth>1080){let t=L(window.scrollY),e=L(f.getBoundingClientRect().bottom+window.scrollY),i=L(u.getBoundingClientRect().bottom+window.scrollY);if(t>x&&t<5||t=e-1.5)y-=i-(e-1.5);else if(y>-5&&(y=-5),t<5&&0!=t){let t=L(u.offsetHeight-window.innerHeight);y=-Math.min(L(window.scrollY),5+t+2.5)}else if(twindow.innerHeight){let e=L(u.offsetHeight)-L(window.innerHeight);y>-(e+8)?y+=x-t:y=-(e+8)}n(6,u.style.marginTop=y+"rem",u),x=L(window.scrollY)}else n(6,u.style.marginTop="0rem",u)})),a((()=>{let t=localStorage.getItem("manifesto-hide-content");null!=t&&null!=t&&"true"==t&&U(s,m)}));return[o,r,s,m,g,w,u,f,h,i,l,p,b,v,k,C,function(t){d[t?"unshift":"push"]((()=>{s=t,n(2,s)}))},function(t){d[t?"unshift":"push"]((()=>{r=t,n(1,r)}))},()=>U(s,m),function(t,e){d[t?"unshift":"push"]((()=>{g[e.index]=t,n(4,g)}))},t=>C(t.id),function(t,e){d[t?"unshift":"push"]((()=>{g[e.index]=t,n(4,g)}))},t=>C(t.id),function(t){d[t?"unshift":"push"]((()=>{m=t,n(3,m)}))},function(t){d[t?"unshift":"push"]((()=>{u=t,n(6,u)}))},function(t,e){d[t?"unshift":"push"]((()=>{w[e.id]=t,n(5,w)}))},function(t,e){d[t?"unshift":"push"]((()=>{w[e.id]=t,n(5,w)}))},function(t){d[t?"unshift":"push"]((()=>{h=t,n(8,h)}))},function(t){d[t?"unshift":"push"]((()=>{f=t,n(7,f)}))}]}class Z extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},X,Q,l,{},null,[-1,-1]),t&&t.target&&i(t.target,this,t.anchor)}}customElements.define("manifesto-component",Z);export{Z as default}; + +(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document); +import { S as SvelteElement, i as init, a as attribute_to_object, b as insert_dev, s as safe_not_equal, d as dispatch_dev, v as validate_slots, c as validate_store, e as component_subscribe, o as onMount, g as globals, f as empty, n as noop, h as detach_dev, C as binding_callbacks, j as validate_each_argument, k as element, p as attr_dev, m as add_location, u as append_dev, t as text, l as space, q as src_url_equal, D as set_style, y as listen_dev, w as set_data_dev, x as destroy_each, H as is_function, I as HtmlTag } from './index-d19aafba.js'; +import { w as writable } from './index-4664ced0.js'; +import { loadLocaleContent, getData } from '../../../../../../../../../js/libraries/serverTools.js'; +import { px2rem } from '../../../../../../../../../js/libraries/miscTools.js'; + +/* src\manifesto-component.svelte generated by Svelte v3.52.0 */ + +const { Object: Object_1 } = globals; +const file = "src\\manifesto-component.svelte"; + +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[33] = list[i]; + child_ctx[34] = list; + child_ctx[35] = i; + return child_ctx; +} + +function get_each_context_2(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[36] = list[i]; + return child_ctx; +} + +function get_each_context_1(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[36] = list[i]; + return child_ctx; +} + +function get_each_context_3(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[41] = list[i]; + child_ctx[42] = list; + child_ctx[43] = i; + return child_ctx; +} + +function get_each_context_4(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[44] = list[i]; + child_ctx[45] = list; + child_ctx[46] = i; + return child_ctx; +} + +// (168:4) {#if $loaded==2} +function create_if_block(ctx) { + let div1; + let div0; + let previous_key = /*key*/ ctx[0]; + let key_block = create_key_block_1(ctx); + + const block = { + c: function create() { + div1 = element("div"); + div0 = element("div"); + key_block.c(); + attr_dev(div0, "id", "text-container"); + add_location(div0, file, 169, 12, 6059); + attr_dev(div1, "id", "container"); + add_location(div1, file, 168, 8, 6008); + }, + m: function mount(target, anchor) { + insert_dev(target, div1, anchor); + append_dev(div1, div0); + key_block.m(div0, null); + /*div1_binding_1*/ ctx[28](div1); + }, + p: function update(ctx, dirty) { + if (dirty[0] & /*key*/ 1 && safe_not_equal(previous_key, previous_key = /*key*/ ctx[0])) { + key_block.d(1); + key_block = create_key_block_1(ctx); + key_block.c(); + key_block.m(div0, null); + } else { + key_block.p(ctx, dirty); + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div1); + key_block.d(detaching); + /*div1_binding_1*/ ctx[28](null); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block.name, + type: "if", + source: "(168:4) {#if $loaded==2}", + ctx + }); + + return block; +} + +// (187:32) {:else} +function create_else_block_1(ctx) { + let div; + let button; + let t0_value = /*obj*/ ctx[41].name + ""; + let t0; + let obj = /*obj*/ ctx[41]; + let t1; + let mounted; + let dispose; + const assign_button = () => /*button_binding_2*/ ctx[21](button, obj); + const unassign_button = () => /*button_binding_2*/ ctx[21](null, obj); + + function click_handler_2() { + return /*click_handler_2*/ ctx[22](/*obj*/ ctx[41]); + } + + const block = { + c: function create() { + div = element("div"); + button = element("button"); + t0 = text(t0_value); + t1 = space(); + attr_dev(button, "class", "level0 heading-button"); + add_location(button, file, 188, 40, 7396); + attr_dev(div, "class", "heading-button-wrapper"); + add_location(div, file, 187, 36, 7318); + }, + m: function mount(target, anchor) { + insert_dev(target, div, anchor); + append_dev(div, button); + append_dev(button, t0); + assign_button(); + append_dev(div, t1); + + if (!mounted) { + dispose = listen_dev(button, "click", click_handler_2, false, false, false); + mounted = true; + } + }, + p: function update(new_ctx, dirty) { + ctx = new_ctx; + + if (obj !== /*obj*/ ctx[41]) { + unassign_button(); + obj = /*obj*/ ctx[41]; + assign_button(); + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div); + unassign_button(); + mounted = false; + dispose(); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_else_block_1.name, + type: "else", + source: "(187:32) {:else}", + ctx + }); + + return block; +} + +// (179:32) {#if Array.isArray(obj)} +function create_if_block_8(ctx) { + let each_1_anchor; + let each_value_4 = /*obj*/ ctx[41]; + validate_each_argument(each_value_4); + let each_blocks = []; + + for (let i = 0; i < each_value_4.length; i += 1) { + each_blocks[i] = create_each_block_4(get_each_context_4(ctx, each_value_4, i)); + } + + const block = { + c: function create() { + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + each_1_anchor = empty(); + }, + m: function mount(target, anchor) { + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(target, anchor); + } + + insert_dev(target, each_1_anchor, anchor); + }, + p: function update(ctx, dirty) { + if (dirty[0] & /*buttons, contentHeadings, goToChapter*/ 36880) { + each_value_4 = /*obj*/ ctx[41]; + validate_each_argument(each_value_4); + let i; + + for (i = 0; i < each_value_4.length; i += 1) { + const child_ctx = get_each_context_4(ctx, each_value_4, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block_4(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value_4.length; + } + }, + d: function destroy(detaching) { + destroy_each(each_blocks, detaching); + if (detaching) detach_dev(each_1_anchor); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block_8.name, + type: "if", + source: "(179:32) {#if Array.isArray(obj)}", + ctx + }); + + return block; +} + +// (180:36) {#each obj as obj2} +function create_each_block_4(ctx) { + let div; + let button; + let t0_value = /*obj2*/ ctx[44].name + ""; + let t0; + let obj2 = /*obj2*/ ctx[44]; + let t1; + let mounted; + let dispose; + const assign_button = () => /*button_binding_1*/ ctx[19](button, obj2); + const unassign_button = () => /*button_binding_1*/ ctx[19](null, obj2); + + function click_handler_1() { + return /*click_handler_1*/ ctx[20](/*obj2*/ ctx[44]); + } + + const block = { + c: function create() { + div = element("div"); + button = element("button"); + t0 = text(t0_value); + t1 = space(); + attr_dev(button, "class", "level1 heading-button"); + add_location(button, file, 181, 40, 6934); + attr_dev(div, "class", "heading-button-wrapper"); + add_location(div, file, 180, 36, 6856); + }, + m: function mount(target, anchor) { + insert_dev(target, div, anchor); + append_dev(div, button); + append_dev(button, t0); + assign_button(); + append_dev(div, t1); + + if (!mounted) { + dispose = listen_dev(button, "click", click_handler_1, false, false, false); + mounted = true; + } + }, + p: function update(new_ctx, dirty) { + ctx = new_ctx; + + if (obj2 !== /*obj2*/ ctx[44]) { + unassign_button(); + obj2 = /*obj2*/ ctx[44]; + assign_button(); + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div); + unassign_button(); + mounted = false; + dispose(); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_each_block_4.name, + type: "each", + source: "(180:36) {#each obj as obj2}", + ctx + }); + + return block; +} + +// (178:28) {#each contentHeadings as obj} +function create_each_block_3(ctx) { + let if_block_anchor; + + function select_block_type(ctx, dirty) { + if (Array.isArray(/*obj*/ ctx[41])) return create_if_block_8; + return create_else_block_1; + } + + let current_block_type = select_block_type(ctx); + let if_block = current_block_type(ctx); + + const block = { + c: function create() { + if_block.c(); + if_block_anchor = empty(); + }, + m: function mount(target, anchor) { + if_block.m(target, anchor); + insert_dev(target, if_block_anchor, anchor); + }, + p: function update(ctx, dirty) { + if_block.p(ctx, dirty); + }, + d: function destroy(detaching) { + if_block.d(detaching); + if (detaching) detach_dev(if_block_anchor); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_each_block_3.name, + type: "each", + source: "(178:28) {#each contentHeadings as obj}", + ctx + }); + + return block; +} + +// (199:28) {#if line!==""} +function create_if_block_1(ctx) { + let if_block_anchor; + + function select_block_type_2(ctx, dirty) { + if (typeof (/*line*/ ctx[33] === 'object') && Object.keys(/*line*/ ctx[33])[0] == "ul") return create_if_block_2; + if (typeof (/*line*/ ctx[33] === 'object') && Object.keys(/*line*/ ctx[33])[0] == "ol") return create_if_block_3; + if (typeof (/*line*/ ctx[33] === 'object') && /*line*/ ctx[33].type == "h3") return create_if_block_4; + if (typeof (/*line*/ ctx[33] === 'object') && /*line*/ ctx[33].type == "h2") return create_if_block_5; + if (/*line*/ ctx[33][0] == "#") return create_if_block_6; + return create_else_block; + } + + let current_block_type = select_block_type_2(ctx); + let if_block = current_block_type(ctx); + + const block = { + c: function create() { + if_block.c(); + if_block_anchor = empty(); + }, + m: function mount(target, anchor) { + if_block.m(target, anchor); + insert_dev(target, if_block_anchor, anchor); + }, + p: function update(ctx, dirty) { + if_block.p(ctx, dirty); + }, + d: function destroy(detaching) { + if_block.d(detaching); + if (detaching) detach_dev(if_block_anchor); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block_1.name, + type: "if", + source: "(199:28) {#if line!==\\\"\\\"}", + ctx + }); + + return block; +} + +// (224:32) {:else} +function create_else_block(ctx) { + let p; + let html_tag; + let raw_value = /*line*/ ctx[33] + ""; + let t; + + const block = { + c: function create() { + p = element("p"); + html_tag = new HtmlTag(false); + t = space(); + html_tag.a = t; + attr_dev(p, "class", "margin-end"); + add_location(p, file, 224, 36, 9794); + }, + m: function mount(target, anchor) { + insert_dev(target, p, anchor); + html_tag.m(raw_value, p); + append_dev(p, t); + }, + p: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(p); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_else_block.name, + type: "else", + source: "(224:32) {:else}", + ctx + }); + + return block; +} + +// (222:55) +function create_if_block_6(ctx) { + let h1; + let raw_value = /*line*/ ctx[33].slice(2, /*line*/ ctx[33].length) + ""; + + const block = { + c: function create() { + h1 = element("h1"); + add_location(h1, file, 222, 36, 9673); + }, + m: function mount(target, anchor) { + insert_dev(target, h1, anchor); + h1.innerHTML = raw_value; + }, + p: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(h1); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block_6.name, + type: "if", + source: "(222:55) ", + ctx + }); + + return block; +} + +// (218:90) +function create_if_block_5(ctx) { + let button; + let h2; + let raw_value = /*line*/ ctx[33].line + ""; + let line = /*line*/ ctx[33]; + let t; + let mounted; + let dispose; + const assign_h2 = () => /*h2_binding*/ ctx[26](h2, line); + const unassign_h2 = () => /*h2_binding*/ ctx[26](null, line); + + const block = { + c: function create() { + button = element("button"); + h2 = element("h2"); + t = space(); + attr_dev(h2, "id", /*line*/ ctx[33].id); + add_location(h2, file, 219, 40, 9455); + set_style(button, "display", "block"); + set_style(button, "width", "100%"); + add_location(button, file, 218, 36, 9302); + }, + m: function mount(target, anchor) { + insert_dev(target, button, anchor); + append_dev(button, h2); + h2.innerHTML = raw_value; + assign_h2(); + append_dev(button, t); + + if (!mounted) { + dispose = listen_dev( + button, + "click", + function () { + if (is_function(/*contentTable*/ ctx[6].scrollIntoView({ block: 'start' }, true))) /*contentTable*/ ctx[6].scrollIntoView({ block: 'start' }, true).apply(this, arguments); + }, + false, + false, + false + ); + + mounted = true; + } + }, + p: function update(new_ctx, dirty) { + ctx = new_ctx; + + if (line !== /*line*/ ctx[33]) { + unassign_h2(); + line = /*line*/ ctx[33]; + assign_h2(); + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(button); + unassign_h2(); + mounted = false; + dispose(); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block_5.name, + type: "if", + source: "(218:90) ", + ctx + }); + + return block; +} + +// (214:90) +function create_if_block_4(ctx) { + let button; + let h3; + let raw_value = /*line*/ ctx[33].line + ""; + let line = /*line*/ ctx[33]; + let t; + let mounted; + let dispose; + const assign_h3 = () => /*h3_binding*/ ctx[25](h3, line); + const unassign_h3 = () => /*h3_binding*/ ctx[25](null, line); + + const block = { + c: function create() { + button = element("button"); + h3 = element("h3"); + t = space(); + attr_dev(h3, "id", /*line*/ ctx[33].id); + add_location(h3, file, 215, 40, 9049); + set_style(button, "display", "block"); + set_style(button, "width", "100%"); + add_location(button, file, 214, 36, 8896); + }, + m: function mount(target, anchor) { + insert_dev(target, button, anchor); + append_dev(button, h3); + h3.innerHTML = raw_value; + assign_h3(); + append_dev(button, t); + + if (!mounted) { + dispose = listen_dev( + button, + "click", + function () { + if (is_function(/*contentTable*/ ctx[6].scrollIntoView({ block: 'start' }, true))) /*contentTable*/ ctx[6].scrollIntoView({ block: 'start' }, true).apply(this, arguments); + }, + false, + false, + false + ); + + mounted = true; + } + }, + p: function update(new_ctx, dirty) { + ctx = new_ctx; + + if (line !== /*line*/ ctx[33]) { + unassign_h3(); + line = /*line*/ ctx[33]; + assign_h3(); + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(button); + unassign_h3(); + mounted = false; + dispose(); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block_4.name, + type: "if", + source: "(214:90) ", + ctx + }); + + return block; +} + +// (206:101) +function create_if_block_3(ctx) { + let ol; + let t; + let each_value_2 = /*line*/ ctx[33].ol; + validate_each_argument(each_value_2); + let each_blocks = []; + + for (let i = 0; i < each_value_2.length; i += 1) { + each_blocks[i] = create_each_block_2(get_each_context_2(ctx, each_value_2, i)); + } + + const block = { + c: function create() { + ol = element("ol"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + t = space(); + add_location(ol, file, 206, 36, 8440); + }, + m: function mount(target, anchor) { + insert_dev(target, ol, anchor); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(ol, null); + } + + append_dev(ol, t); + }, + p: function update(ctx, dirty) { + if (dirty[0] & /*manifesto*/ 2048) { + each_value_2 = /*line*/ ctx[33].ol; + validate_each_argument(each_value_2); + let i; + + for (i = 0; i < each_value_2.length; i += 1) { + const child_ctx = get_each_context_2(ctx, each_value_2, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block_2(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(ol, t); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value_2.length; + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(ol); + destroy_each(each_blocks, detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block_3.name, + type: "if", + source: "(206:101) ", + ctx + }); + + return block; +} + +// (200:32) {#if typeof (line === 'object') && (Object.keys(line)[0]=="ul")} +function create_if_block_2(ctx) { + let ul; + let t; + let each_value_1 = /*line*/ ctx[33].ul; + validate_each_argument(each_value_1); + let each_blocks = []; + + for (let i = 0; i < each_value_1.length; i += 1) { + each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i)); + } + + const block = { + c: function create() { + ul = element("ul"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + t = space(); + add_location(ul, file, 200, 36, 8075); + }, + m: function mount(target, anchor) { + insert_dev(target, ul, anchor); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(ul, null); + } + + append_dev(ul, t); + }, + p: function update(ctx, dirty) { + if (dirty[0] & /*manifesto*/ 2048) { + each_value_1 = /*line*/ ctx[33].ul; + validate_each_argument(each_value_1); + let i; + + for (i = 0; i < each_value_1.length; i += 1) { + const child_ctx = get_each_context_1(ctx, each_value_1, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block_1(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(ul, t); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value_1.length; + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(ul); + destroy_each(each_blocks, detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block_2.name, + type: "if", + source: "(200:32) {#if typeof (line === 'object') && (Object.keys(line)[0]==\\\"ul\\\")}", + ctx + }); + + return block; +} + +// (208:40) {#each line.ol as line2} +function create_each_block_2(ctx) { + let li; + let raw_value = /*line2*/ ctx[36] + ""; + + const block = { + c: function create() { + li = element("li"); + add_location(li, file, 208, 44, 8556); + }, + m: function mount(target, anchor) { + insert_dev(target, li, anchor); + li.innerHTML = raw_value; + }, + p: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(li); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_each_block_2.name, + type: "each", + source: "(208:40) {#each line.ol as line2}", + ctx + }); + + return block; +} + +// (202:40) {#each line.ul as line2} +function create_each_block_1(ctx) { + let li; + let t_value = /*line2*/ ctx[36] + ""; + let t; + + const block = { + c: function create() { + li = element("li"); + t = text(t_value); + add_location(li, file, 202, 44, 8191); + }, + m: function mount(target, anchor) { + insert_dev(target, li, anchor); + append_dev(li, t); + }, + p: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(li); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_each_block_1.name, + type: "each", + source: "(202:40) {#each line.ul as line2}", + ctx + }); + + return block; +} + +// (198:24) {#each manifesto as line} +function create_each_block(ctx) { + let if_block_anchor; + + function select_block_type_1(ctx, dirty) { + if (/*line*/ ctx[33] !== "") return create_if_block_1; + } + + let current_block_type = select_block_type_1(ctx); + let if_block = current_block_type && current_block_type(ctx); + + const block = { + c: function create() { + if (if_block) if_block.c(); + if_block_anchor = empty(); + }, + m: function mount(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert_dev(target, if_block_anchor, anchor); + }, + p: function update(ctx, dirty) { + if (if_block) if_block.p(ctx, dirty); + }, + d: function destroy(detaching) { + if (if_block) { + if_block.d(detaching); + } + + if (detaching) detach_dev(if_block_anchor); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_each_block.name, + type: "each", + source: "(198:24) {#each manifesto as line}", + ctx + }); + + return block; +} + +// (171:16) {#key key} +function create_key_block_1(ctx) { + let div1; + let button; + let t0_value = /*$content*/ ctx[10].tableOfContents + ""; + let t0; + let t1; + let img; + let img_src_value; + let t2; + let div0; + let t3; + let div2; + let mounted; + let dispose; + let each_value_3 = /*contentHeadings*/ ctx[12]; + validate_each_argument(each_value_3); + let each_blocks_1 = []; + + for (let i = 0; i < each_value_3.length; i += 1) { + each_blocks_1[i] = create_each_block_3(get_each_context_3(ctx, each_value_3, i)); + } + + let each_value = /*manifesto*/ ctx[11]; + validate_each_argument(each_value); + let each_blocks = []; + + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + + const block = { + c: function create() { + div1 = element("div"); + button = element("button"); + t0 = text(t0_value); + t1 = space(); + img = element("img"); + t2 = space(); + div0 = element("div"); + + for (let i = 0; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].c(); + } + + t3 = space(); + div2 = element("div"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + if (!src_url_equal(img.src, img_src_value = "../assets/arrow_down.svg")) attr_dev(img, "src", img_src_value); + attr_dev(img, "alt", "arrow down"); + set_style(img, "transform", "scaleY(-1)"); + add_location(img, file, 174, 28, 6403); + attr_dev(button, "id", "toggle-content"); + add_location(button, file, 172, 24, 6209); + attr_dev(div0, "class", "module"); + set_style(div0, "display", "initial"); + add_location(div0, file, 176, 24, 6572); + attr_dev(div1, "id", "table-content"); + add_location(div1, file, 171, 20, 6134); + attr_dev(div2, "id", "main"); + add_location(div2, file, 196, 20, 7811); + }, + m: function mount(target, anchor) { + insert_dev(target, div1, anchor); + append_dev(div1, button); + append_dev(button, t0); + append_dev(button, t1); + append_dev(button, img); + /*img_binding*/ ctx[16](img); + /*button_binding*/ ctx[17](button); + append_dev(div1, t2); + append_dev(div1, div0); + + for (let i = 0; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].m(div0, null); + } + + /*div0_binding*/ ctx[23](div0); + /*div1_binding*/ ctx[24](div1); + insert_dev(target, t3, anchor); + insert_dev(target, div2, anchor); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(div2, null); + } + + /*div2_binding*/ ctx[27](div2); + + if (!mounted) { + dispose = listen_dev(button, "click", /*click_handler*/ ctx[18], false, false, false); + mounted = true; + } + }, + p: function update(ctx, dirty) { + if (dirty[0] & /*$content*/ 1024 && t0_value !== (t0_value = /*$content*/ ctx[10].tableOfContents + "")) set_data_dev(t0, t0_value); + + if (dirty[0] & /*contentHeadings, buttons, goToChapter*/ 36880) { + each_value_3 = /*contentHeadings*/ ctx[12]; + validate_each_argument(each_value_3); + let i; + + for (i = 0; i < each_value_3.length; i += 1) { + const child_ctx = get_each_context_3(ctx, each_value_3, i); + + if (each_blocks_1[i]) { + each_blocks_1[i].p(child_ctx, dirty); + } else { + each_blocks_1[i] = create_each_block_3(child_ctx); + each_blocks_1[i].c(); + each_blocks_1[i].m(div0, null); + } + } + + for (; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].d(1); + } + + each_blocks_1.length = each_value_3.length; + } + + if (dirty[0] & /*manifesto, contentTable, headingsObjects*/ 2144) { + each_value = /*manifesto*/ ctx[11]; + validate_each_argument(each_value); + let i; + + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx, each_value, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div2, null); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value.length; + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div1); + /*img_binding*/ ctx[16](null); + /*button_binding*/ ctx[17](null); + destroy_each(each_blocks_1, detaching); + /*div0_binding*/ ctx[23](null); + /*div1_binding*/ ctx[24](null); + if (detaching) detach_dev(t3); + if (detaching) detach_dev(div2); + destroy_each(each_blocks, detaching); + /*div2_binding*/ ctx[27](null); + mounted = false; + dispose(); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_key_block_1.name, + type: "key", + source: "(171:16) {#key key}", + ctx + }); + + return block; +} + +// (167:0) {#key $loaded} +function create_key_block(ctx) { + let if_block_anchor; + let if_block = /*$loaded*/ ctx[9] == 2 && create_if_block(ctx); + + const block = { + c: function create() { + if (if_block) if_block.c(); + if_block_anchor = empty(); + }, + m: function mount(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert_dev(target, if_block_anchor, anchor); + }, + p: function update(ctx, dirty) { + if (/*$loaded*/ ctx[9] == 2) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block(ctx); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + }, + d: function destroy(detaching) { + if (if_block) if_block.d(detaching); + if (detaching) detach_dev(if_block_anchor); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_key_block.name, + type: "key", + source: "(167:0) {#key $loaded}", + ctx + }); + + return block; +} + +function create_fragment(ctx) { + let previous_key = /*$loaded*/ ctx[9]; + let key_block_anchor; + let key_block = create_key_block(ctx); + + const block = { + c: function create() { + key_block.c(); + key_block_anchor = empty(); + this.c = noop; + }, + l: function claim(nodes) { + throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); + }, + m: function mount(target, anchor) { + key_block.m(target, anchor); + insert_dev(target, key_block_anchor, anchor); + }, + p: function update(ctx, dirty) { + if (dirty[0] & /*$loaded*/ 512 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[9])) { + key_block.d(1); + key_block = create_key_block(ctx); + key_block.c(); + key_block.m(key_block_anchor.parentNode, key_block_anchor); + } else { + key_block.p(ctx, dirty); + } + }, + i: noop, + o: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(key_block_anchor); + key_block.d(detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment.name, + type: "component", + source: "", + ctx + }); + + return block; +} + +function hideBlock(arrow, block) { + if (block.style.display == "none" || block.style.display == "") { + block.style.display = "initial"; + arrow.style.transform = "scaleY(-1)"; + localStorage.setItem("manifesto-hide-content", "false"); + } else { + block.style.display = "none"; + arrow.style.transform = ""; + localStorage.setItem("manifesto-hide-content", "true"); + } +} + +function instance($$self, $$props, $$invalidate) { + let $loaded; + let $content; + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots('manifesto-component', slots, []); + let manifesto = []; + let key; + let contentButton; + let contentArrow; + let contentBlock; + let buttons = []; + let headingsObjects = {}; + let contentHeadings = []; + let contentTable; + let lastTop = 0; + let margin = 0; + let root; + let main; + let loaded = writable(0); + validate_store(loaded, 'loaded'); + component_subscribe($$self, loaded, value => $$invalidate(9, $loaded = value)); + let content = writable({}); + validate_store(content, 'content'); + component_subscribe($$self, content, value => $$invalidate(10, $content = value)); + loadLocaleContent(content, "countries", loaded); + let locale = loadLocaleContent(content, "manifesto-component", loaded); + const htmlDelims = ["ul", "ol"]; + + getData("/locales/" + locale + "/manifesto.txt", function (response) { + let splitText = response.split(/\r?\n/); + let currentChapter; + let cnt = 0; + + for (let j = 0; j < splitText.length; j++) { + let line = splitText[j]; + let delimInd = htmlDelims.map(x => line.includes("<" + x + ">")).findIndex(x => x); + + if (delimInd != -1) { + let delim = htmlDelims[delimInd]; + let obj = {}; + obj[delim] = []; + let delimEndTag = ""; + + while (true) { + j += 1; + line = splitText[j]; + + if (line.includes(delimEndTag)) { + manifesto.push(obj); + break; + } else { + obj[delim].push(line); + } + } + } else { + if (line.slice(0, 3) == "###") { + let heading = line.slice(4, line.length); + let id = heading.toLowerCase().trim().replaceAll(" ", "-"); + currentChapter.push({ id, name: heading, index: cnt }); + cnt += 1; + + manifesto.push({ + type: "h3", + id, + line: heading, + index: cnt + }); + } else if (line.slice(0, 2) == "##") { + let heading = line.slice(3, line.length); + let id = heading.toLowerCase().trim().replaceAll(" ", "-"); + + contentHeadings.push({ + id: heading.toLowerCase().trim().replaceAll(" ", "-"), + name: heading, + index: cnt + }); + + cnt += 1; + currentChapter = []; + contentHeadings.push(currentChapter); + + manifesto.push({ + type: "h2", + id, + line: heading, + index: cnt + }); + } else { + manifesto.push(line); + } + } + } + + $$invalidate(0, key += 1); + }); + + function goToChapter(id) { + headingsObjects[id].scrollIntoView({ block: 'start' }, true); + } + + addEventListener("scroll", event => { + if (window.innerWidth > 1080) { + let top = px2rem(window.scrollY); + let textBottom = px2rem(root.getBoundingClientRect().bottom + window.scrollY); + let tableBottom = px2rem(contentTable.getBoundingClientRect().bottom + window.scrollY); + + if (top > lastTop && top < 5 || top < lastTop && top < 5) { + margin = -Math.min(px2rem(window.scrollY), 5); + } else if (tableBottom >= textBottom - 1.5) { + margin = margin - (tableBottom - (textBottom - 1.5)); + } else { + if (margin > -5) { + margin = -5; + } + + if (top < 5 && top != 0) { + let dif = px2rem(contentTable.offsetHeight - window.innerHeight); + margin = -Math.min(px2rem(window.scrollY), 5 + dif + 2.5); + } else if (top < lastTop || margin == 0) { + if (margin < -5) { + margin = margin + (lastTop - top); + } else { + margin = -5; + } + } else { + if (contentTable.offsetHeight > window.innerHeight) { + let dif = px2rem(contentTable.offsetHeight) - px2rem(window.innerHeight); + + if (margin > -(dif + 8)) { + margin = margin + (lastTop - top); + } else { + margin = -(dif + 8); + } + } + } + } + + $$invalidate(6, contentTable.style.marginTop = margin + "rem", contentTable); + lastTop = px2rem(window.scrollY); + } else { + $$invalidate(6, contentTable.style.marginTop = "0rem", contentTable); + } + }); + + onMount(() => { + let hideBool = localStorage.getItem("manifesto-hide-content"); + + if (hideBool != undefined && hideBool != null) { + if (hideBool == "true") { + hideBlock(contentArrow, contentBlock); + } + } + }); + + const writable_props = []; + + Object_1.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); + }); + + function img_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + contentArrow = $$value; + $$invalidate(2, contentArrow); + }); + } + + function button_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + contentButton = $$value; + $$invalidate(1, contentButton); + }); + } + + const click_handler = () => hideBlock(contentArrow, contentBlock); + + function button_binding_1($$value, obj2) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + buttons[obj2.index] = $$value; + $$invalidate(4, buttons); + }); + } + + const click_handler_1 = obj2 => goToChapter(obj2.id); + + function button_binding_2($$value, obj) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + buttons[obj.index] = $$value; + $$invalidate(4, buttons); + }); + } + + const click_handler_2 = obj => goToChapter(obj.id); + + function div0_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + contentBlock = $$value; + $$invalidate(3, contentBlock); + }); + } + + function div1_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + contentTable = $$value; + $$invalidate(6, contentTable); + }); + } + + function h3_binding($$value, line) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + headingsObjects[line.id] = $$value; + $$invalidate(5, headingsObjects); + }); + } + + function h2_binding($$value, line) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + headingsObjects[line.id] = $$value; + $$invalidate(5, headingsObjects); + }); + } + + function div2_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + main = $$value; + $$invalidate(8, main); + }); + } + + function div1_binding_1($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + root = $$value; + $$invalidate(7, root); + }); + } + + $$self.$capture_state = () => ({ + onMount, + writable, + getData, + px2rem, + loadLocaleContent, + manifesto, + key, + contentButton, + contentArrow, + contentBlock, + buttons, + headingsObjects, + contentHeadings, + contentTable, + lastTop, + margin, + root, + main, + loaded, + content, + locale, + htmlDelims, + hideBlock, + goToChapter, + $loaded, + $content + }); + + $$self.$inject_state = $$props => { + if ('manifesto' in $$props) $$invalidate(11, manifesto = $$props.manifesto); + if ('key' in $$props) $$invalidate(0, key = $$props.key); + if ('contentButton' in $$props) $$invalidate(1, contentButton = $$props.contentButton); + if ('contentArrow' in $$props) $$invalidate(2, contentArrow = $$props.contentArrow); + if ('contentBlock' in $$props) $$invalidate(3, contentBlock = $$props.contentBlock); + if ('buttons' in $$props) $$invalidate(4, buttons = $$props.buttons); + if ('headingsObjects' in $$props) $$invalidate(5, headingsObjects = $$props.headingsObjects); + if ('contentHeadings' in $$props) $$invalidate(12, contentHeadings = $$props.contentHeadings); + if ('contentTable' in $$props) $$invalidate(6, contentTable = $$props.contentTable); + if ('lastTop' in $$props) lastTop = $$props.lastTop; + if ('margin' in $$props) margin = $$props.margin; + if ('root' in $$props) $$invalidate(7, root = $$props.root); + if ('main' in $$props) $$invalidate(8, main = $$props.main); + if ('loaded' in $$props) $$invalidate(13, loaded = $$props.loaded); + if ('content' in $$props) $$invalidate(14, content = $$props.content); + if ('locale' in $$props) locale = $$props.locale; + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [ + key, + contentButton, + contentArrow, + contentBlock, + buttons, + headingsObjects, + contentTable, + root, + main, + $loaded, + $content, + manifesto, + contentHeadings, + loaded, + content, + goToChapter, + img_binding, + button_binding, + click_handler, + button_binding_1, + click_handler_1, + button_binding_2, + click_handler_2, + div0_binding, + div1_binding, + h3_binding, + h2_binding, + div2_binding, + div1_binding_1 + ]; +} + +class Manifesto_component extends SvelteElement { + constructor(options) { + super(); + this.shadowRoot.innerHTML = ``; + + init( + this, + { + target: this.shadowRoot, + props: attribute_to_object(this.attributes), + customElement: true + }, + instance, + create_fragment, + safe_not_equal, + {}, + null, + [-1, -1] + ); + + if (options) { + if (options.target) { + insert_dev(options.target, this, options.anchor); + } + } + } +} + +customElements.define("manifesto-component", Manifesto_component); + +export { Manifesto_component as default }; diff --git a/Server/public/js/components/map-component.js b/Server/public/js/components/map-component.js index ec2f98e..f96a0e1 100644 --- a/Server/public/js/components/map-component.js +++ b/Server/public/js/components/map-component.js @@ -1 +1,175 @@ -import{S as t,i as e,a as o,b as s,u as a,s as r,f as l,n,h as i,d as c,o as m,w as h}from"./index-4348483d.js";function p(t){let e;return{c(){e=l("div"),this.c=n,i(e,"id","map")},m(o,a){s(o,e,a),t[3](e)},p:n,i:n,o:n,d(o){o&&c(e),t[3](null)}}}function u(t,e,o){let s,{callback:a=null}=e,{colors:r=null}=e;function l(t,e){let o=L.map(s,{center:t,zoom:e});return L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'© OpenStreetMap contributors',minNativeZoom:2,minZoom:2,maxNativeZoom:14,maxZoom:14}).addTo(o),o}return m((()=>{if(a(l),null!=r){let t=s.getElementsByClassName("leaflet-control-layers-overlays")[0].children;for(let e=0;e{"callback"in t&&o(1,a=t.callback),"colors"in t&&o(2,r=t.colors)},[s,a,r,function(t){h[t?"unshift":"push"]((()=>{s=t,o(0,s)}))}]}class d extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:o(this.attributes),customElement:!0},u,p,r,{callback:1,colors:2},null),t&&(t.target&&s(t.target,this,t.anchor),t.props&&(this.$set(t.props),a()))}static get observedAttributes(){return["callback","colors"]}get callback(){return this.$$.ctx[1]}set callback(t){this.$$set({callback:t}),a()}get colors(){return this.$$.ctx[2]}set colors(t){this.$$set({colors:t}),a()}}customElements.define("map-component",d);export{d as default}; + +(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document); +import { S as SvelteElement, i as init, a as attribute_to_object, b as insert_dev, B as flush, s as safe_not_equal, d as dispatch_dev, v as validate_slots, o as onMount, k as element, n as noop, p as attr_dev, m as add_location, h as detach_dev, C as binding_callbacks } from './index-d19aafba.js'; + +/* src\components\map-component.svelte generated by Svelte v3.52.0 */ +const file = "src\\components\\map-component.svelte"; + +function create_fragment(ctx) { + let div; + + const block = { + c: function create() { + div = element("div"); + this.c = noop; + attr_dev(div, "id", "map"); + add_location(div, file, 41, 0, 1151); + }, + l: function claim(nodes) { + throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); + }, + m: function mount(target, anchor) { + insert_dev(target, div, anchor); + /*div_binding*/ ctx[3](div); + }, + p: noop, + i: noop, + o: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(div); + /*div_binding*/ ctx[3](null); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment.name, + type: "component", + source: "", + ctx + }); + + return block; +} + +function instance($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots('map-component', slots, []); + let { callback = null } = $$props; + let { colors = null } = $$props; + + // Main code + let mapContainer; + + function createMap(center, zoom) { + let map = L.map(mapContainer, { center, zoom }); + + L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { + attribution: '© OpenStreetMap contributors', + minNativeZoom: 2, + minZoom: 2, + maxNativeZoom: 14, + maxZoom: 14 + }).addTo(map); + + return map; + } + + onMount(() => { + callback(createMap); + + if (colors != null) { + let els = mapContainer.getElementsByClassName("leaflet-control-layers-overlays")[0].children; + + for (let i = 0; i < els.length; i++) { + els[i].children[0].children[0].style.accentColor = colors[i]; + } + } + }); + + const writable_props = ['callback', 'colors']; + + Object.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); + }); + + function div_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + mapContainer = $$value; + $$invalidate(0, mapContainer); + }); + } + + $$self.$$set = $$props => { + if ('callback' in $$props) $$invalidate(1, callback = $$props.callback); + if ('colors' in $$props) $$invalidate(2, colors = $$props.colors); + }; + + $$self.$capture_state = () => ({ + onMount, + callback, + colors, + mapContainer, + createMap + }); + + $$self.$inject_state = $$props => { + if ('callback' in $$props) $$invalidate(1, callback = $$props.callback); + if ('colors' in $$props) $$invalidate(2, colors = $$props.colors); + if ('mapContainer' in $$props) $$invalidate(0, mapContainer = $$props.mapContainer); + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [mapContainer, callback, colors, div_binding]; +} + +class Map_component extends SvelteElement { + constructor(options) { + super(); + this.shadowRoot.innerHTML = ``; + + init( + this, + { + target: this.shadowRoot, + props: attribute_to_object(this.attributes), + customElement: true + }, + instance, + create_fragment, + safe_not_equal, + { callback: 1, colors: 2 }, + null + ); + + if (options) { + if (options.target) { + insert_dev(options.target, this, options.anchor); + } + + if (options.props) { + this.$set(options.props); + flush(); + } + } + } + + static get observedAttributes() { + return ["callback", "colors"]; + } + + get callback() { + return this.$$.ctx[1]; + } + + set callback(callback) { + this.$$set({ callback }); + flush(); + } + + get colors() { + return this.$$.ctx[2]; + } + + set colors(colors) { + this.$$set({ colors }); + flush(); + } +} + +customElements.define("map-component", Map_component); + +export { Map_component as default }; diff --git a/Server/public/js/components/navbar-component.js b/Server/public/js/components/navbar-component.js index 1064ab1..208d06f 100644 --- a/Server/public/js/components/navbar-component.js +++ b/Server/public/js/components/navbar-component.js @@ -1 +1,638 @@ -import{S as e,i as t,a as n,b as o,s as i,e as r,n as a,d as l,c as s,o as d,t as c,g as m,f as h,h as p,j as g,l as u,q as f,m as b,p as w,r as v,w as y}from"./index-4348483d.js";import{w as k}from"./index-71440b21.js";import{loadLocaleContent as x,locales as j}from"../../../../../../../../../js/libraries/serverTools.js";function H(e,t,n){const o=e.slice();return o[17]=t[n][0],o[18]=t[n][1],o}function z(e){let t,n,i,r,a,s,d,y,k,x,z,L,W,M,O,E,N,S,R,U,q,I,X,A,B,C,D,F,G,J,K,P,Q,V,Y,Z,$,_,ee,te,ne,oe,ie,re,ae,le,se,de,ce,me=e[11]()+"",he=e[4].orgName+"",pe=e[4].manifesto+"",ge=e[4].joinUs+"",ue=e[4].groups+"",fe=e[4].communes+"",be=e[4].cooperatives+"",we=e[4].parties+"",ve=e[4].partners+"",ye=Object.entries(j),ke=[];for(let t=0;t',d=m(),y=h("a"),k=h("img"),z=m(),L=h("span"),W=m(),M=h("nav"),O=h("ul"),E=h("li"),N=h("a"),S=c(pe),R=m(),U=h("li"),q=h("a"),I=c(ge),X=m(),A=h("li"),B=h("a"),C=c(ue),D=m(),F=h("li"),G=h("a"),J=c(fe),K=m(),P=h("li"),Q=h("a"),V=c(be),Y=m(),Z=h("li"),$=h("a"),_=c(we),ee=m(),te=h("li"),ne=h("a"),oe=c(ve),ie=m(),re=h("li"),ae=h("button"),ae.innerHTML=' \n \n globe',le=m(),se=h("div");for(let e=0;en(4,o=e)));let h=x(m,"navbar-component",c);function p(e){localStorage.setItem("locale",e);let t=location.href.split("/"),n=Object.keys(j);t=t.filter((e=>!n.includes(e)));let o=t.slice(0,t.length-1).join("/")+"/"+e+"/"+t[t.length-1];location.href=o}d((()=>{}));return[i,r,a,l,o,c,m,h,function(){i.checked?n(1,r.style.background="white",r):setTimeout((()=>{n(1,r.style.position="relative",r),n(1,r.style.background="",r),n(1,r.style.boxShadow="",r)}),510)},function(){"block"==a.style.display?n(2,a.style.display="none",a):n(2,a.style.display="block",a)},p,function(){if("ru"==h){let e=()=>{null==l?setTimeout(e,100):(window.innerWidth<1700&&window.innerWidth>1400||window.innerWidth<400)&&"100%"!=l.style.lineHeight?(n(3,l.style.lineHeight="120%",l),n(3,l.style.top="1rem",l),n(3,l.style.width="16rem",l)):(window.innerWidth>1700||window.innerWidth>400&&window.innerWidth<1400)&&"400%"!=l.style.lineHeight&&(n(3,l.style.lineHeight="400%",l),n(3,l.style.top="0rem",l),n(3,l.style.width="auto",l))};e(),addEventListener("resize",e)}},function(e){y[e?"unshift":"push"]((()=>{i=e,n(0,i)}))},function(e){y[e?"unshift":"push"]((()=>{l=e,n(3,l)}))},e=>p(e),function(e){y[e?"unshift":"push"]((()=>{a=e,n(2,a)}))},function(e){y[e?"unshift":"push"]((()=>{r=e,n(1,r)}))}]}class M extends e{constructor(e){super(),this.shadowRoot.innerHTML="",t(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},W,L,i,{},null),e&&e.target&&o(e.target,this,e.anchor)}}customElements.define("navbar-component",M);export{M as default}; + +(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document); +import { S as SvelteElement, i as init, a as attribute_to_object, b as insert_dev, s as safe_not_equal, d as dispatch_dev, v as validate_slots, c as validate_store, e as component_subscribe, o as onMount, E as getContext, g as globals, j as validate_each_argument, f as empty, n as noop, h as detach_dev, C as binding_callbacks, t as text, l as space, k as element, p as attr_dev, m as add_location, q as src_url_equal, u as append_dev, y as listen_dev, w as set_data_dev, x as destroy_each, z as run_all } from './index-d19aafba.js'; +import { w as writable } from './index-4664ced0.js'; +import { loadLocaleContent, locales } from '../../../../../../../../../js/libraries/serverTools.js'; + +/* src\navbar\navbar-component.svelte generated by Svelte v3.52.0 */ + +const { Object: Object_1 } = globals; +const file = "src\\navbar\\navbar-component.svelte"; + +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[17] = list[i][0]; + child_ctx[18] = list[i][1]; + return child_ctx; +} + +// (87:4) {#if Object.keys($content).length!=0} +function create_if_block(ctx) { + let t0_value = /*fixHeading*/ ctx[11]() + ""; + let t0; + let t1; + let header; + let input; + let t2; + let label; + let span0; + let t3; + let a0; + let img0; + let img0_src_value; + let t4; + let span1; + let raw_value = /*$content*/ ctx[4].orgName + ""; + let t5; + let nav; + let ul; + let li0; + let a1; + let t6_value = /*$content*/ ctx[4].manifesto + ""; + let t6; + let t7; + let li1; + let a2; + let t8_value = /*$content*/ ctx[4].joinUs + ""; + let t8; + let t9; + let li2; + let a3; + let t10_value = /*$content*/ ctx[4].groups + ""; + let t10; + let t11; + let li3; + let a4; + let t12_value = /*$content*/ ctx[4].communes + ""; + let t12; + let t13; + let li4; + let a5; + let t14_value = /*$content*/ ctx[4].cooperatives + ""; + let t14; + let t15; + let li5; + let a6; + let t16_value = /*$content*/ ctx[4].parties + ""; + let t16; + let t17; + let li6; + let a7; + let t18_value = /*$content*/ ctx[4].partners + ""; + let t18; + let t19; + let li7; + let button; + let picture; + let source0; + let t20; + let source1; + let t21; + let img1; + let t22; + let div; + let mounted; + let dispose; + let each_value = Object.entries(locales); + validate_each_argument(each_value); + let each_blocks = []; + + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + + const block = { + c: function create() { + t0 = text(t0_value); + t1 = space(); + header = element("header"); + input = element("input"); + t2 = space(); + label = element("label"); + span0 = element("span"); + t3 = space(); + a0 = element("a"); + img0 = element("img"); + t4 = space(); + span1 = element("span"); + t5 = space(); + nav = element("nav"); + ul = element("ul"); + li0 = element("li"); + a1 = element("a"); + t6 = text(t6_value); + t7 = space(); + li1 = element("li"); + a2 = element("a"); + t8 = text(t8_value); + t9 = space(); + li2 = element("li"); + a3 = element("a"); + t10 = text(t10_value); + t11 = space(); + li3 = element("li"); + a4 = element("a"); + t12 = text(t12_value); + t13 = space(); + li4 = element("li"); + a5 = element("a"); + t14 = text(t14_value); + t15 = space(); + li5 = element("li"); + a6 = element("a"); + t16 = text(t16_value); + t17 = space(); + li6 = element("li"); + a7 = element("a"); + t18 = text(t18_value); + t19 = space(); + li7 = element("li"); + button = element("button"); + picture = element("picture"); + source0 = element("source"); + t20 = space(); + source1 = element("source"); + t21 = space(); + img1 = element("img"); + t22 = space(); + div = element("div"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + attr_dev(input, "type", "checkbox"); + attr_dev(input, "id", "side-menu"); + add_location(input, file, 90, 12, 2866); + attr_dev(span0, "id", "hamb-line"); + add_location(span0, file, 91, 45, 2997); + attr_dev(label, "id", "hamb"); + attr_dev(label, "for", "side-menu"); + add_location(label, file, 91, 12, 2964); + if (!src_url_equal(img0.src, img0_src_value = "/img/common/flag.png")) attr_dev(img0, "src", img0_src_value); + attr_dev(img0, "id", "navbar-logo"); + attr_dev(img0, "alt", "logo"); + add_location(img0, file, 94, 16, 3139); + attr_dev(span1, "id", "navbar-logo-text"); + add_location(span1, file, 95, 16, 3217); + attr_dev(a0, "id", "logo-container"); + attr_dev(a0, "href", "/" + /*locale*/ ctx[7] + "/"); + add_location(a0, file, 93, 12, 3074); + attr_dev(a1, "href", "/" + /*locale*/ ctx[7] + "/manifesto"); + add_location(a1, file, 100, 24, 3429); + add_location(li0, file, 100, 20, 3425); + attr_dev(a2, "href", "/" + /*locale*/ ctx[7] + "/join-us"); + add_location(a2, file, 101, 24, 3518); + add_location(li1, file, 101, 20, 3514); + attr_dev(a3, "href", "/" + /*locale*/ ctx[7] + "/groups"); + add_location(a3, file, 102, 24, 3602); + add_location(li2, file, 102, 20, 3598); + attr_dev(a4, "href", "/" + /*locale*/ ctx[7] + "/communes"); + add_location(a4, file, 103, 24, 3685); + add_location(li3, file, 103, 20, 3681); + attr_dev(a5, "href", "/" + /*locale*/ ctx[7] + "/cooperatives"); + add_location(a5, file, 104, 24, 3772); + add_location(li4, file, 104, 20, 3768); + attr_dev(a6, "href", "/" + /*locale*/ ctx[7] + "/parties"); + add_location(a6, file, 105, 24, 3867); + add_location(li5, file, 105, 20, 3863); + attr_dev(a7, "href", "/" + /*locale*/ ctx[7] + "/partners"); + add_location(a7, file, 106, 24, 3952); + add_location(li6, file, 106, 20, 3948); + attr_dev(source0, "srcset", "/img/common/globe.webp"); + add_location(source0, file, 110, 32, 4182); + attr_dev(source1, "srcset", "/img/common/globe.png"); + add_location(source1, file, 111, 32, 4256); + attr_dev(img1, "id", "locales-img"); + attr_dev(img1, "alt", "globe"); + add_location(img1, file, 112, 32, 4329); + add_location(picture, file, 109, 28, 4139); + add_location(button, file, 108, 24, 4078); + attr_dev(li7, "id", "locales"); + add_location(li7, file, 107, 20, 4035); + attr_dev(div, "id", "locales-dropdown"); + add_location(div, file, 116, 20, 4487); + attr_dev(ul, "id", "menu"); + add_location(ul, file, 99, 16, 3389); + attr_dev(nav, "id", "nav"); + add_location(nav, file, 98, 12, 3357); + attr_dev(header, "id", "navbar"); + add_location(header, file, 88, 8, 2776); + }, + m: function mount(target, anchor) { + insert_dev(target, t0, anchor); + insert_dev(target, t1, anchor); + insert_dev(target, header, anchor); + append_dev(header, input); + /*input_binding*/ ctx[12](input); + append_dev(header, t2); + append_dev(header, label); + append_dev(label, span0); + append_dev(header, t3); + append_dev(header, a0); + append_dev(a0, img0); + append_dev(a0, t4); + append_dev(a0, span1); + span1.innerHTML = raw_value; + /*span1_binding*/ ctx[13](span1); + append_dev(header, t5); + append_dev(header, nav); + append_dev(nav, ul); + append_dev(ul, li0); + append_dev(li0, a1); + append_dev(a1, t6); + append_dev(ul, t7); + append_dev(ul, li1); + append_dev(li1, a2); + append_dev(a2, t8); + append_dev(ul, t9); + append_dev(ul, li2); + append_dev(li2, a3); + append_dev(a3, t10); + append_dev(ul, t11); + append_dev(ul, li3); + append_dev(li3, a4); + append_dev(a4, t12); + append_dev(ul, t13); + append_dev(ul, li4); + append_dev(li4, a5); + append_dev(a5, t14); + append_dev(ul, t15); + append_dev(ul, li5); + append_dev(li5, a6); + append_dev(a6, t16); + append_dev(ul, t17); + append_dev(ul, li6); + append_dev(li6, a7); + append_dev(a7, t18); + append_dev(ul, t19); + append_dev(ul, li7); + append_dev(li7, button); + append_dev(button, picture); + append_dev(picture, source0); + append_dev(picture, t20); + append_dev(picture, source1); + append_dev(picture, t21); + append_dev(picture, img1); + append_dev(ul, t22); + append_dev(ul, div); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(div, null); + } + + /*div_binding*/ ctx[15](div); + /*header_binding*/ ctx[16](header); + + if (!mounted) { + dispose = [ + listen_dev(input, "click", /*changeNavbar*/ ctx[8], false, false, false), + listen_dev(button, "click", /*showLocales*/ ctx[9], false, false, false) + ]; + + mounted = true; + } + }, + p: function update(ctx, dirty) { + if (dirty & /*$content*/ 16 && raw_value !== (raw_value = /*$content*/ ctx[4].orgName + "")) span1.innerHTML = raw_value; if (dirty & /*$content*/ 16 && t6_value !== (t6_value = /*$content*/ ctx[4].manifesto + "")) set_data_dev(t6, t6_value); + if (dirty & /*$content*/ 16 && t8_value !== (t8_value = /*$content*/ ctx[4].joinUs + "")) set_data_dev(t8, t8_value); + if (dirty & /*$content*/ 16 && t10_value !== (t10_value = /*$content*/ ctx[4].groups + "")) set_data_dev(t10, t10_value); + if (dirty & /*$content*/ 16 && t12_value !== (t12_value = /*$content*/ ctx[4].communes + "")) set_data_dev(t12, t12_value); + if (dirty & /*$content*/ 16 && t14_value !== (t14_value = /*$content*/ ctx[4].cooperatives + "")) set_data_dev(t14, t14_value); + if (dirty & /*$content*/ 16 && t16_value !== (t16_value = /*$content*/ ctx[4].parties + "")) set_data_dev(t16, t16_value); + if (dirty & /*$content*/ 16 && t18_value !== (t18_value = /*$content*/ ctx[4].partners + "")) set_data_dev(t18, t18_value); + + if (dirty & /*changeLocale, Object, locales*/ 1024) { + each_value = Object.entries(locales); + validate_each_argument(each_value); + let i; + + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx, each_value, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div, null); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value.length; + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(t0); + if (detaching) detach_dev(t1); + if (detaching) detach_dev(header); + /*input_binding*/ ctx[12](null); + /*span1_binding*/ ctx[13](null); + destroy_each(each_blocks, detaching); + /*div_binding*/ ctx[15](null); + /*header_binding*/ ctx[16](null); + mounted = false; + run_all(dispose); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block.name, + type: "if", + source: "(87:4) {#if Object.keys($content).length!=0}", + ctx + }); + + return block; +} + +// (118:24) {#each Object.entries(locales) as [loc,name]} +function create_each_block(ctx) { + let button; + let t_value = /*name*/ ctx[18] + ""; + let t; + let mounted; + let dispose; + + function click_handler() { + return /*click_handler*/ ctx[14](/*loc*/ ctx[17]); + } + + const block = { + c: function create() { + button = element("button"); + t = text(t_value); + add_location(button, file, 118, 28, 4643); + }, + m: function mount(target, anchor) { + insert_dev(target, button, anchor); + append_dev(button, t); + + if (!mounted) { + dispose = listen_dev(button, "click", click_handler, false, false, false); + mounted = true; + } + }, + p: function update(new_ctx, dirty) { + ctx = new_ctx; + }, + d: function destroy(detaching) { + if (detaching) detach_dev(button); + mounted = false; + dispose(); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_each_block.name, + type: "each", + source: "(118:24) {#each Object.entries(locales) as [loc,name]}", + ctx + }); + + return block; +} + +function create_fragment(ctx) { + let show_if = Object.keys(/*$content*/ ctx[4]).length != 0; + let if_block_anchor; + let if_block = show_if && create_if_block(ctx); + + const block = { + c: function create() { + if (if_block) if_block.c(); + if_block_anchor = empty(); + this.c = noop; + }, + l: function claim(nodes) { + throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); + }, + m: function mount(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert_dev(target, if_block_anchor, anchor); + }, + p: function update(ctx, [dirty]) { + if (dirty & /*$content*/ 16) show_if = Object.keys(/*$content*/ ctx[4]).length != 0; + + if (show_if) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block(ctx); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + }, + i: noop, + o: noop, + d: function destroy(detaching) { + if (if_block) if_block.d(detaching); + if (detaching) detach_dev(if_block_anchor); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment.name, + type: "component", + source: "", + ctx + }); + + return block; +} + +function instance($$self, $$props, $$invalidate) { + let $content; + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots('navbar-component', slots, []); + let hambInput; + let navbar; + let localesDropdown; + let loaded = writable(0); + let content = writable({}); + validate_store(content, 'content'); + component_subscribe($$self, content, value => $$invalidate(4, $content = value)); + let logoText; + let locale = loadLocaleContent(content, "navbar-component", loaded); + + function changeNavbar() { + if (hambInput.checked) { + $$invalidate(1, navbar.style.background = "white", navbar); + } else { + setTimeout( + () => { + $$invalidate(1, navbar.style.position = "relative", navbar); + $$invalidate(1, navbar.style.background = "", navbar); + $$invalidate(1, navbar.style.boxShadow = "", navbar); + }, + 510 + ); + } + } + + function showLocales() { + if (localesDropdown.style.display == "block") { + $$invalidate(2, localesDropdown.style.display = "none", localesDropdown); + } else { + $$invalidate(2, localesDropdown.style.display = "block", localesDropdown); + } + } + + function changeLocale(lang) { + localStorage.setItem("locale", lang); + let locSplit = location.href.split("/"); + let localesSymbols = Object.keys(locales); + locSplit = locSplit.filter(x => !localesSymbols.includes(x)); + let loc = locSplit.slice(0, locSplit.length - 1).join("/") + "/" + lang + "/" + locSplit[locSplit.length - 1]; + location.href = loc; + } + + function fixHeading() { + if (locale == "ru") { + let func = () => { + if (logoText == undefined) { + setTimeout(func, 100); + } else { + if ((window.innerWidth < 1700 && window.innerWidth > 1400 || window.innerWidth < 400) && logoText.style.lineHeight != "100%") { + $$invalidate(3, logoText.style.lineHeight = "120%", logoText); + $$invalidate(3, logoText.style.top = "1rem", logoText); + $$invalidate(3, logoText.style.width = "16rem", logoText); + } else if ((window.innerWidth > 1700 || window.innerWidth > 400 && window.innerWidth < 1400) && logoText.style.lineHeight != "400%") { + $$invalidate(3, logoText.style.lineHeight = "400%", logoText); + $$invalidate(3, logoText.style.top = "0rem", logoText); + $$invalidate(3, logoText.style.width = "auto", logoText); + } + } + }; + + func(); + addEventListener("resize", func); + } + } + + onMount(() => { + + }); + + const writable_props = []; + + Object_1.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); + }); + + function input_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + hambInput = $$value; + $$invalidate(0, hambInput); + }); + } + + function span1_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + logoText = $$value; + $$invalidate(3, logoText); + }); + } + + const click_handler = loc => changeLocale(loc); + + function div_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + localesDropdown = $$value; + $$invalidate(2, localesDropdown); + }); + } + + function header_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + navbar = $$value; + $$invalidate(1, navbar); + }); + } + + $$self.$capture_state = () => ({ + onMount, + getContext, + writable, + loadLocaleContent, + locales, + hambInput, + navbar, + localesDropdown, + loaded, + content, + logoText, + locale, + changeNavbar, + showLocales, + changeLocale, + fixHeading, + $content + }); + + $$self.$inject_state = $$props => { + if ('hambInput' in $$props) $$invalidate(0, hambInput = $$props.hambInput); + if ('navbar' in $$props) $$invalidate(1, navbar = $$props.navbar); + if ('localesDropdown' in $$props) $$invalidate(2, localesDropdown = $$props.localesDropdown); + if ('loaded' in $$props) $$invalidate(5, loaded = $$props.loaded); + if ('content' in $$props) $$invalidate(6, content = $$props.content); + if ('logoText' in $$props) $$invalidate(3, logoText = $$props.logoText); + if ('locale' in $$props) $$invalidate(7, locale = $$props.locale); + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [ + hambInput, + navbar, + localesDropdown, + logoText, + $content, + loaded, + content, + locale, + changeNavbar, + showLocales, + changeLocale, + fixHeading, + input_binding, + span1_binding, + click_handler, + div_binding, + header_binding + ]; +} + +class Navbar_component extends SvelteElement { + constructor(options) { + super(); + this.shadowRoot.innerHTML = ``; + + init( + this, + { + target: this.shadowRoot, + props: attribute_to_object(this.attributes), + customElement: true + }, + instance, + create_fragment, + safe_not_equal, + {}, + null + ); + + if (options) { + if (options.target) { + insert_dev(options.target, this, options.anchor); + } + } + } +} + +customElements.define("navbar-component", Navbar_component); + +export { Navbar_component as default }; diff --git a/Server/public/js/components/pane-aligner.js b/Server/public/js/components/pane-aligner.js index 784b939..7115f40 100644 --- a/Server/public/js/components/pane-aligner.js +++ b/Server/public/js/components/pane-aligner.js @@ -1 +1,304 @@ -import{S as i,i as e,a,b as t,s as n,f as r,g as s,n as d,h as o,l,d as m,x as p,o as h,w as g}from"./index-4348483d.js";import{debounce as c}from"../../../../../../../../../js/libraries/miscTools.js";function f(i){let e,a,n,p,h,g,c,f,u,b;return{c(){e=r("div"),a=r("div"),n=r("div"),p=r("div"),p.innerHTML='',h=s(),g=r("div"),g.innerHTML='',c=s(),f=r("div"),f.innerHTML='',u=s(),b=r("div"),b.innerHTML='',this.c=d,o(p,"id","sidebar-left"),o(p,"class","pane"),o(g,"id","sidebar-left2"),o(g,"class","pane"),o(n,"id","sidebars-left"),o(n,"class","sidebar"),o(f,"id","sidebar-right"),o(f,"class","pane sidebar"),o(b,"id","main-pane"),o(b,"class","pane"),o(a,"class","pane-container"),o(e,"id","root"),o(e,"class","pane-centering")},m(r,s){t(r,e,s),l(e,a),l(a,n),l(n,p),i[5](p),l(n,h),l(n,g),i[6](g),l(a,c),l(a,f),i[7](f),l(a,u),l(a,b),i[8](b),i[9](e)},p:d,i:d,o:d,d(a){a&&m(e),i[5](null),i[6](null),i[7](null),i[8](null),i[9](null)}}}function u(i,e,a){let t,n,r,s,d,o=null!=p("alignerParent")?p("alignerParent").switchView:void 0,l=!1,m=!1,f=!1;function u(){if(null!=t.parentNode){let i=t.parentNode.host.childNodes;if(0==i.length)setTimeout(u,50);else{let e=!1,n=t.parentNode.innerHTML;for(let a of i)"sidebar-left"!=a.slot||l?"sidebar-left2"!=a.slot||m?"sidebar-right"!=a.slot||f||(n=n.replace("#sidebar-right{display:none;","#sidebar-right{"),f=!0,e=!0):(n=n.replace("#sidebar-left2{display:none}",""),m=!0,e=!0):(n=n.replace("#sidebar-left{display:none}",""),l=!0,e=!0);null!=o&&(n=n.replace("1880px",o),e=!0),e&&a(0,t.parentNode.innerHTML=n,t)}}}return window.addEventListener("resize",c(u,100)),h((()=>{u()})),[t,n,r,s,d,function(i){g[i?"unshift":"push"]((()=>{r=i,a(2,r)}))},function(i){g[i?"unshift":"push"]((()=>{s=i,a(3,s)}))},function(i){g[i?"unshift":"push"]((()=>{d=i,a(4,d)}))},function(i){g[i?"unshift":"push"]((()=>{n=i,a(1,n)}))},function(i){g[i?"unshift":"push"]((()=>{t=i,a(0,t)}))}]}class b extends i{constructor(i){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:a(this.attributes),customElement:!0},u,f,n,{},null),i&&i.target&&t(i.target,this,i.anchor)}}customElements.define("pane-aligner",b);export{b as default}; + +(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document); +import { S as SvelteElement, i as init, a as attribute_to_object, b as insert_dev, s as safe_not_equal, d as dispatch_dev, v as validate_slots, E as getContext, o as onMount, F as setContext, k as element, l as space, n as noop, p as attr_dev, m as add_location, u as append_dev, h as detach_dev, C as binding_callbacks } from './index-d19aafba.js'; +import { debounce } from '../../../../../../../../../js/libraries/miscTools.js'; + +/* src\components\pane-aligner.svelte generated by Svelte v3.52.0 */ +const file = "src\\components\\pane-aligner.svelte"; + +function create_fragment(ctx) { + let div6; + let div5; + let div2; + let div0; + let slot0; + let t0; + let div1; + let slot1; + let t1; + let div3; + let slot2; + let t2; + let div4; + let slot3; + + const block = { + c: function create() { + div6 = element("div"); + div5 = element("div"); + div2 = element("div"); + div0 = element("div"); + slot0 = element("slot"); + t0 = space(); + div1 = element("div"); + slot1 = element("slot"); + t1 = space(); + div3 = element("div"); + slot2 = element("slot"); + t2 = space(); + div4 = element("div"); + slot3 = element("slot"); + this.c = noop; + attr_dev(slot0, "name", "sidebar-left"); + add_location(slot0, file, 74, 16, 2567); + attr_dev(div0, "id", "sidebar-left"); + attr_dev(div0, "class", "pane"); + add_location(div0, file, 73, 12, 2489); + attr_dev(slot1, "name", "sidebar-left2"); + add_location(slot1, file, 77, 16, 2714); + attr_dev(div1, "id", "sidebar-left2"); + attr_dev(div1, "class", "pane"); + add_location(div1, file, 76, 12, 2634); + attr_dev(div2, "id", "sidebars-left"); + attr_dev(div2, "class", "sidebar"); + add_location(div2, file, 72, 8, 2435); + attr_dev(slot2, "name", "sidebar-right"); + add_location(slot2, file, 81, 12, 2879); + attr_dev(div3, "id", "sidebar-right"); + attr_dev(div3, "class", "pane sidebar"); + add_location(div3, file, 80, 8, 2794); + attr_dev(slot3, "name", "main"); + attr_dev(slot3, "id", "main-slot"); + add_location(slot3, file, 84, 12, 3007); + attr_dev(div4, "id", "main-pane"); + attr_dev(div4, "class", "pane"); + add_location(div4, file, 83, 8, 2939); + attr_dev(div5, "class", "pane-container"); + add_location(div5, file, 71, 4, 2397); + attr_dev(div6, "id", "root"); + attr_dev(div6, "class", "pane-centering"); + add_location(div6, file, 70, 0, 2336); + }, + l: function claim(nodes) { + throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); + }, + m: function mount(target, anchor) { + insert_dev(target, div6, anchor); + append_dev(div6, div5); + append_dev(div5, div2); + append_dev(div2, div0); + append_dev(div0, slot0); + /*div0_binding*/ ctx[5](div0); + append_dev(div2, t0); + append_dev(div2, div1); + append_dev(div1, slot1); + /*div1_binding*/ ctx[6](div1); + append_dev(div5, t1); + append_dev(div5, div3); + append_dev(div3, slot2); + /*div3_binding*/ ctx[7](div3); + append_dev(div5, t2); + append_dev(div5, div4); + append_dev(div4, slot3); + /*div4_binding*/ ctx[8](div4); + /*div6_binding*/ ctx[9](div6); + }, + p: noop, + i: noop, + o: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(div6); + /*div0_binding*/ ctx[5](null); + /*div1_binding*/ ctx[6](null); + /*div3_binding*/ ctx[7](null); + /*div4_binding*/ ctx[8](null); + /*div6_binding*/ ctx[9](null); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment.name, + type: "component", + source: "", + ctx + }); + + return block; +} + +function instance($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots('pane-aligner', slots, []); + let root; + let mainPane; + let sidebarLeft; + let sidebarLeft2; + let sidebarRight; + let parentProps = getContext("alignerParent"); + + let switchView = parentProps != undefined + ? getContext("alignerParent").switchView + : undefined; + + let leftReplaced = false; + let left2Replaced = false; + let rightReplaced = false; + let switchViewReplaced = false; + + function adjustSlotted() { + if (root.parentNode != null) { + let slotted = root.parentNode.host.childNodes; + + if (slotted.length == 0) { + setTimeout(adjustSlotted, 50); + } else { + let changed = false; + let html = root.parentNode.innerHTML; + + for (let item of slotted) { + if (item.slot == "sidebar-left" && !leftReplaced) { + html = html.replace("#sidebar-left{display:none}", ""); + leftReplaced = true; + changed = true; + } else if (item.slot == "sidebar-left2" && !left2Replaced) { + html = html.replace("#sidebar-left2{display:none}", ""); + left2Replaced = true; + changed = true; + } else if (item.slot == "sidebar-right" && !rightReplaced) { + html = html.replace("#sidebar-right{display:none;", "#sidebar-right{"); + rightReplaced = true; + changed = true; + } + } + + if (switchView != undefined && !switchViewReplaced) { + html = html.replace("1880px", switchView); + changed = true; + } + + if (changed) { + $$invalidate(0, root.parentNode.innerHTML = html, root); + } + } + } + } + + window.addEventListener("resize", debounce(adjustSlotted, 100)); + + onMount(() => { + adjustSlotted(); + }); + + const writable_props = []; + + Object.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); + }); + + function div0_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + sidebarLeft = $$value; + $$invalidate(2, sidebarLeft); + }); + } + + function div1_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + sidebarLeft2 = $$value; + $$invalidate(3, sidebarLeft2); + }); + } + + function div3_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + sidebarRight = $$value; + $$invalidate(4, sidebarRight); + }); + } + + function div4_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + mainPane = $$value; + $$invalidate(1, mainPane); + }); + } + + function div6_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + root = $$value; + $$invalidate(0, root); + }); + } + + $$self.$capture_state = () => ({ + getContext, + setContext, + onMount, + debounce, + root, + mainPane, + sidebarLeft, + sidebarLeft2, + sidebarRight, + parentProps, + switchView, + leftReplaced, + left2Replaced, + rightReplaced, + switchViewReplaced, + adjustSlotted + }); + + $$self.$inject_state = $$props => { + if ('root' in $$props) $$invalidate(0, root = $$props.root); + if ('mainPane' in $$props) $$invalidate(1, mainPane = $$props.mainPane); + if ('sidebarLeft' in $$props) $$invalidate(2, sidebarLeft = $$props.sidebarLeft); + if ('sidebarLeft2' in $$props) $$invalidate(3, sidebarLeft2 = $$props.sidebarLeft2); + if ('sidebarRight' in $$props) $$invalidate(4, sidebarRight = $$props.sidebarRight); + if ('parentProps' in $$props) parentProps = $$props.parentProps; + if ('switchView' in $$props) switchView = $$props.switchView; + if ('leftReplaced' in $$props) leftReplaced = $$props.leftReplaced; + if ('left2Replaced' in $$props) left2Replaced = $$props.left2Replaced; + if ('rightReplaced' in $$props) rightReplaced = $$props.rightReplaced; + if ('switchViewReplaced' in $$props) switchViewReplaced = $$props.switchViewReplaced; + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [ + root, + mainPane, + sidebarLeft, + sidebarLeft2, + sidebarRight, + div0_binding, + div1_binding, + div3_binding, + div4_binding, + div6_binding + ]; +} + +class Pane_aligner extends SvelteElement { + constructor(options) { + super(); + this.shadowRoot.innerHTML = ``; + + init( + this, + { + target: this.shadowRoot, + props: attribute_to_object(this.attributes), + customElement: true + }, + instance, + create_fragment, + safe_not_equal, + {}, + null + ); + + if (options) { + if (options.target) { + insert_dev(options.target, this, options.anchor); + } + } + } +} + +customElements.define("pane-aligner", Pane_aligner); + +export { Pane_aligner as default }; diff --git a/Server/public/js/components/parties-component.js b/Server/public/js/components/parties-component.js index 0d66c8c..fde9401 100644 --- a/Server/public/js/components/parties-component.js +++ b/Server/public/js/components/parties-component.js @@ -1 +1,637 @@ -import{S as t,i as e,a as n,b as o,s as i,e as r,n as a,d as m,c as s,o as l,f as c,t as p,g,h as d,j as h,k as f,l as u,m as b,p as x}from"./index-4348483d.js";import{w as y}from"./index-71440b21.js";import{addMarkersParties as w,partiesByCountry as j}from"../../../../../../../../../js/parties.js";import{loadLocaleContent as v}from"../../../../../../../../../js/libraries/serverTools.js";import"../../../../../../../../../js/components/map-component.js";function k(t,e,n){const o=t.slice();return o[6]=e[n][0],o[7]=e[n][1],o}function z(t,e,n){const o=t.slice();return o[10]=e[n],o}function D(t){let e,n,i,r,a,s,l,y,w,v,z,D,E,O,R,T,A,C,H,L,M=t[1].parties+"",S=t[1].p1+"",_=t[1].subheading1+"",q=t[1]["map-prompt"]+"",B=Object.entries(j),F=[];for(let e=0;en(0,o=t)));let a=y({});function m(t,e){let n=t([22,0],2);w(n,e)}s(t,a,(t=>n(1,i=t))),v(a,"countries",r),v(a,"parties-component",r),l((()=>{}));return[o,i,r,a,m,t=>m(t,i)]}class A extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},T,R,i,{},null),t&&t.target&&o(t.target,this,t.anchor)}}customElements.define("parties-component",A);export{A as default}; + +(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document); +import { S as SvelteElement, i as init, a as attribute_to_object, b as insert_dev, s as safe_not_equal, d as dispatch_dev, v as validate_slots, c as validate_store, e as component_subscribe, o as onMount, g as globals, f as empty, n as noop, h as detach_dev, j as validate_each_argument, k as element, t as text, l as space, m as add_location, p as attr_dev, q as src_url_equal, r as set_custom_element_data, u as append_dev, w as set_data_dev, x as destroy_each } from './index-d19aafba.js'; +import { w as writable } from './index-4664ced0.js'; +import { partiesByCountry, addMarkersParties } from '../../../../../../../../../js/parties.js'; +import { loadLocaleContent } from '../../../../../../../../../js/libraries/serverTools.js'; +import '../../../../../../../../../js/components/map-component.js'; + +/* src\parties-component.svelte generated by Svelte v3.52.0 */ + +const { Object: Object_1 } = globals; + +const file = "src\\parties-component.svelte"; + +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[9] = list[i][0]; + child_ctx[10] = list[i][1]; + return child_ctx; +} + +function get_each_context_1(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[13] = list[i]; + return child_ctx; +} + +// (39:4) {#if $loaded==2} +function create_if_block(ctx) { + let div1; + let div0; + let h1; + let t0_value = /*$content*/ ctx[0].parties + ""; + let t0; + let t1; + let img; + let img_src_value; + let t2; + let p0; + let t3_value = /*$content*/ ctx[0].p1 + ""; + let t3; + let t4; + let h3; + let t5_value = /*$content*/ ctx[0].subheading1 + ""; + let t5; + let t6; + let map_component; + let map_component_callback_value; + let t7; + let p1; + let t8_value = /*$content*/ ctx[0]["map-prompt"] + ""; + let t8; + let t9; + let each_value = Object.entries(partiesByCountry); + validate_each_argument(each_value); + let each_blocks = []; + + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + + const block = { + c: function create() { + div1 = element("div"); + div0 = element("div"); + h1 = element("h1"); + t0 = text(t0_value); + t1 = space(); + img = element("img"); + t2 = space(); + p0 = element("p"); + t3 = text(t3_value); + t4 = space(); + h3 = element("h3"); + t5 = text(t5_value); + t6 = space(); + map_component = element("map-component"); + t7 = space(); + p1 = element("p"); + t8 = text(t8_value); + t9 = space(); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + add_location(h1, file, 42, 16, 1203); + attr_dev(img, "id", "party-img"); + if (!src_url_equal(img.src, img_src_value = "/img/common/parties.svg")) attr_dev(img, "src", img_src_value); + attr_dev(img, "alt", "party"); + add_location(img, file, 43, 16, 1248); + attr_dev(p0, "class", "description"); + add_location(p0, file, 44, 16, 1328); + add_location(h3, file, 45, 16, 1386); + set_custom_element_data(map_component, "id", "map"); + set_custom_element_data(map_component, "callback", map_component_callback_value = /*func*/ ctx[8]); + add_location(map_component, file, 46, 16, 1435); + attr_dev(p1, "id", "add-prompt"); + add_location(p1, file, 47, 16, 1565); + attr_dev(div0, "id", "text-container"); + add_location(div0, file, 41, 12, 1160); + attr_dev(div1, "id", "container"); + add_location(div1, file, 39, 8, 1057); + }, + m: function mount(target, anchor) { + insert_dev(target, div1, anchor); + append_dev(div1, div0); + append_dev(div0, h1); + append_dev(h1, t0); + append_dev(div0, t1); + append_dev(div0, img); + append_dev(div0, t2); + append_dev(div0, p0); + append_dev(p0, t3); + append_dev(div0, t4); + append_dev(div0, h3); + append_dev(h3, t5); + append_dev(div0, t6); + append_dev(div0, map_component); + append_dev(div0, t7); + append_dev(div0, p1); + append_dev(p1, t8); + append_dev(div0, t9); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(div0, null); + } + }, + p: function update(ctx, dirty) { + if (dirty & /*$content*/ 1 && t0_value !== (t0_value = /*$content*/ ctx[0].parties + "")) set_data_dev(t0, t0_value); + if (dirty & /*$content*/ 1 && t3_value !== (t3_value = /*$content*/ ctx[0].p1 + "")) set_data_dev(t3, t3_value); + if (dirty & /*$content*/ 1 && t5_value !== (t5_value = /*$content*/ ctx[0].subheading1 + "")) set_data_dev(t5, t5_value); + + if (dirty & /*$content*/ 1 && map_component_callback_value !== (map_component_callback_value = /*func*/ ctx[8])) { + set_custom_element_data(map_component, "callback", map_component_callback_value); + } + + if (dirty & /*$content*/ 1 && t8_value !== (t8_value = /*$content*/ ctx[0]["map-prompt"] + "")) set_data_dev(t8, t8_value); + + if (dirty & /*Object, partiesByCountry, $content, getAddress, getCountry*/ 193) { + each_value = Object.entries(partiesByCountry); + validate_each_argument(each_value); + let i; + + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx, each_value, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div0, null); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value.length; + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div1); + destroy_each(each_blocks, detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block.name, + type: "if", + source: "(39:4) {#if $loaded==2}", + ctx + }); + + return block; +} + +// (52:24) {#each parties as party} +function create_each_block_1(ctx) { + let div2; + let div1; + let picture; + let source0; + let t0; + let source1; + let t1; + let img; + let t2; + let div0; + let p0; + let b0; + let t3_value = /*$content*/ ctx[0].name + ""; + let t3; + let t4; + let t5_value = /*party*/ ctx[13].name + ""; + let t5; + let t6; + let p1; + let b1; + let t7_value = /*$content*/ ctx[0].location + ""; + let t7; + let t8; + let t9_value = /*getAddress*/ ctx[7](/*party*/ ctx[13]) + ""; + let t9; + let t10; + let p2; + let b2; + let t11_value = /*$content*/ ctx[0].link + ""; + let t11; + let t12; + let a; + let t13_value = /*party*/ ctx[13].link + ""; + let t13; + let t14; + let p3; + let b3; + let t15_value = /*$content*/ ctx[0].description + ""; + let t15; + let t16; + let t17_value = /*$content*/ ctx[0][/*party*/ ctx[13].description] + ""; + let t17; + + const block = { + c: function create() { + div2 = element("div"); + div1 = element("div"); + picture = element("picture"); + source0 = element("source"); + t0 = space(); + source1 = element("source"); + t1 = space(); + img = element("img"); + t2 = space(); + div0 = element("div"); + p0 = element("p"); + b0 = element("b"); + t3 = text(t3_value); + t4 = text(": "); + t5 = text(t5_value); + t6 = space(); + p1 = element("p"); + b1 = element("b"); + t7 = text(t7_value); + t8 = text(": "); + t9 = text(t9_value); + t10 = space(); + p2 = element("p"); + b2 = element("b"); + t11 = text(t11_value); + t12 = text(": "); + a = element("a"); + t13 = text(t13_value); + t14 = space(); + p3 = element("p"); + b3 = element("b"); + t15 = text(t15_value); + t16 = text(": "); + t17 = text(t17_value); + attr_dev(source0, "srcset", "/img/parties/" + /*party*/ ctx[13].logo + ".webp"); + add_location(source0, file, 55, 36, 2051); + attr_dev(source1, "srcset", "/img/parties/" + /*party*/ ctx[13].logo + ".jpg"); + add_location(source1, file, 56, 36, 2141); + attr_dev(img, "class", "party-logo"); + attr_dev(img, "alt", "logo"); + add_location(img, file, 57, 36, 2230); + add_location(picture, file, 54, 32, 2004); + add_location(b0, file, 60, 39, 2389); + add_location(p0, file, 60, 36, 2386); + add_location(b1, file, 61, 39, 2470); + add_location(p1, file, 61, 36, 2467); + add_location(b2, file, 62, 39, 2562); + attr_dev(a, "href", /*party*/ ctx[13].link); + attr_dev(a, "target", ";_blank;"); + attr_dev(a, "rel", "noreferrer"); + add_location(a, file, 62, 63, 2586); + add_location(p2, file, 62, 36, 2559); + add_location(div0, file, 59, 32, 2343); + attr_dev(div1, "class", "img-general-info"); + add_location(div1, file, 53, 28, 1940); + add_location(b3, file, 65, 31, 2767); + add_location(p3, file, 65, 28, 2764); + attr_dev(div2, "class", "location-info"); + add_location(div2, file, 52, 24, 1883); + }, + m: function mount(target, anchor) { + insert_dev(target, div2, anchor); + append_dev(div2, div1); + append_dev(div1, picture); + append_dev(picture, source0); + append_dev(picture, t0); + append_dev(picture, source1); + append_dev(picture, t1); + append_dev(picture, img); + append_dev(div1, t2); + append_dev(div1, div0); + append_dev(div0, p0); + append_dev(p0, b0); + append_dev(b0, t3); + append_dev(b0, t4); + append_dev(p0, t5); + append_dev(div0, t6); + append_dev(div0, p1); + append_dev(p1, b1); + append_dev(b1, t7); + append_dev(b1, t8); + append_dev(p1, t9); + append_dev(div0, t10); + append_dev(div0, p2); + append_dev(p2, b2); + append_dev(b2, t11); + append_dev(b2, t12); + append_dev(p2, a); + append_dev(a, t13); + append_dev(div2, t14); + append_dev(div2, p3); + append_dev(p3, b3); + append_dev(b3, t15); + append_dev(b3, t16); + append_dev(p3, t17); + }, + p: function update(ctx, dirty) { + if (dirty & /*$content*/ 1 && t3_value !== (t3_value = /*$content*/ ctx[0].name + "")) set_data_dev(t3, t3_value); + if (dirty & /*$content*/ 1 && t7_value !== (t7_value = /*$content*/ ctx[0].location + "")) set_data_dev(t7, t7_value); + if (dirty & /*$content*/ 1 && t11_value !== (t11_value = /*$content*/ ctx[0].link + "")) set_data_dev(t11, t11_value); + if (dirty & /*$content*/ 1 && t15_value !== (t15_value = /*$content*/ ctx[0].description + "")) set_data_dev(t15, t15_value); + if (dirty & /*$content*/ 1 && t17_value !== (t17_value = /*$content*/ ctx[0][/*party*/ ctx[13].description] + "")) set_data_dev(t17, t17_value); + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div2); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_each_block_1.name, + type: "each", + source: "(52:24) {#each parties as party}", + ctx + }); + + return block; +} + +// (49:16) {#each Object.entries(partiesByCountry) as [name,parties]} +function create_each_block(ctx) { + let h4; + let t0_value = /*getCountry*/ ctx[6](/*name*/ ctx[9]) + ""; + let t0; + let t1; + let div; + let t2; + let each_value_1 = /*parties*/ ctx[10]; + validate_each_argument(each_value_1); + let each_blocks = []; + + for (let i = 0; i < each_value_1.length; i += 1) { + each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i)); + } + + const block = { + c: function create() { + h4 = element("h4"); + t0 = text(t0_value); + t1 = space(); + div = element("div"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + t2 = space(); + attr_dev(h4, "class", "country-name"); + add_location(h4, file, 49, 20, 1710); + attr_dev(div, "class", "country-block"); + add_location(div, file, 50, 20, 1780); + }, + m: function mount(target, anchor) { + insert_dev(target, h4, anchor); + append_dev(h4, t0); + insert_dev(target, t1, anchor); + insert_dev(target, div, anchor); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(div, null); + } + + append_dev(div, t2); + }, + p: function update(ctx, dirty) { + if (dirty & /*$content, Object, partiesByCountry, getAddress*/ 129) { + each_value_1 = /*parties*/ ctx[10]; + validate_each_argument(each_value_1); + let i; + + for (i = 0; i < each_value_1.length; i += 1) { + const child_ctx = get_each_context_1(ctx, each_value_1, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block_1(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div, t2); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value_1.length; + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(h4); + if (detaching) detach_dev(t1); + if (detaching) detach_dev(div); + destroy_each(each_blocks, detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_each_block.name, + type: "each", + source: "(49:16) {#each Object.entries(partiesByCountry) as [name,parties]}", + ctx + }); + + return block; +} + +// (38:0) {#key $loaded} +function create_key_block(ctx) { + let if_block_anchor; + let if_block = /*$loaded*/ ctx[1] == 2 && create_if_block(ctx); + + const block = { + c: function create() { + if (if_block) if_block.c(); + if_block_anchor = empty(); + }, + m: function mount(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert_dev(target, if_block_anchor, anchor); + }, + p: function update(ctx, dirty) { + if (/*$loaded*/ ctx[1] == 2) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block(ctx); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + }, + d: function destroy(detaching) { + if (if_block) if_block.d(detaching); + if (detaching) detach_dev(if_block_anchor); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_key_block.name, + type: "key", + source: "(38:0) {#key $loaded}", + ctx + }); + + return block; +} + +function create_fragment(ctx) { + let previous_key = /*$loaded*/ ctx[1]; + let key_block_anchor; + let key_block = create_key_block(ctx); + + const block = { + c: function create() { + key_block.c(); + key_block_anchor = empty(); + this.c = noop; + }, + l: function claim(nodes) { + throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); + }, + m: function mount(target, anchor) { + key_block.m(target, anchor); + insert_dev(target, key_block_anchor, anchor); + }, + p: function update(ctx, [dirty]) { + if (dirty & /*$loaded*/ 2 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[1])) { + key_block.d(1); + key_block = create_key_block(ctx); + key_block.c(); + key_block.m(key_block_anchor.parentNode, key_block_anchor); + } else { + key_block.p(ctx, dirty); + } + }, + i: noop, + o: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(key_block_anchor); + key_block.d(detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment.name, + type: "component", + source: "", + ctx + }); + + return block; +} + +function instance($$self, $$props, $$invalidate) { + let $content; + let $loaded; + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots('parties-component', slots, []); + let loaded = writable(0); + validate_store(loaded, 'loaded'); + component_subscribe($$self, loaded, value => $$invalidate(1, $loaded = value)); + let content = writable({}); + validate_store(content, 'content'); + component_subscribe($$self, content, value => $$invalidate(0, $content = value)); + loadLocaleContent(content, "countries", loaded); + let locale = loadLocaleContent(content, "parties-component", loaded); + + function mapCallbackParties(createMap, content, locale) { + let map = createMap([22, 0], 2); + addMarkersParties(map, content, locale); + } + + function getCountry(name) { + return locale == "en" ? name : $content[name]; + } + + function getAddress(group) { + return locale == "en" + ? group.location + : $content[group.location]; + } + + onMount(() => { + + }); + + const writable_props = []; + + Object_1.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); + }); + + const func = createMap => mapCallbackParties(createMap, $content, locale); + + $$self.$capture_state = () => ({ + onMount, + writable, + partiesByCountry, + addMarkersParties, + loadLocaleContent, + loaded, + content, + locale, + mapCallbackParties, + getCountry, + getAddress, + $content, + $loaded + }); + + $$self.$inject_state = $$props => { + if ('loaded' in $$props) $$invalidate(2, loaded = $$props.loaded); + if ('content' in $$props) $$invalidate(3, content = $$props.content); + if ('locale' in $$props) $$invalidate(4, locale = $$props.locale); + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [ + $content, + $loaded, + loaded, + content, + locale, + mapCallbackParties, + getCountry, + getAddress, + func + ]; +} + +class Parties_component extends SvelteElement { + constructor(options) { + super(); + this.shadowRoot.innerHTML = ``; + + init( + this, + { + target: this.shadowRoot, + props: attribute_to_object(this.attributes), + customElement: true + }, + instance, + create_fragment, + safe_not_equal, + {}, + null + ); + + if (options) { + if (options.target) { + insert_dev(options.target, this, options.anchor); + } + } + } +} + +customElements.define("parties-component", Parties_component); + +export { Parties_component as default }; diff --git a/Server/public/js/components/partners-component.js b/Server/public/js/components/partners-component.js index 6431021..9a475a2 100644 --- a/Server/public/js/components/partners-component.js +++ b/Server/public/js/components/partners-component.js @@ -1 +1,611 @@ -import{S as t,i as n,a as e,b as o,s as i,e as r,n as a,d as m,c as s,o as l,f as c,t as g,g as p,h as d,j as h,l as f,m as u,p as b}from"./index-4348483d.js";import{w as x}from"./index-71440b21.js";import{loadLocaleContent as y}from"../../../../../../../../../js/libraries/serverTools.js";import{partnersByCountry as w}from"../../../../../../../../../js/partners.js";import"../../../../../../../../../js/components/map-component.js";function j(t,n,e){const o=t.slice();return o[4]=n[e][0],o[5]=n[e][1],o}function v(t,n,e){const o=t.slice();return o[8]=n[e],o}function k(t){let n,e,i,r,a,s,l,x,y,v,k,z,E,N,O=t[1].heading+"",R=t[1].p1+"",T=t[1].subheading1+"",A=Object.entries(w),C=[];for(let n=0;ne(0,o=t)));let a=x({});return s(t,a,(t=>e(1,i=t))),y(a,"countries",r),y(a,"partners-component",r),l((()=>{})),[o,i,r,a]}class R extends t{constructor(t){super(),this.shadowRoot.innerHTML="",n(this,{target:this.shadowRoot,props:e(this.attributes),customElement:!0},O,N,i,{},null),t&&t.target&&o(t.target,this,t.anchor)}}customElements.define("partners-component",R);export{R as default}; + +(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document); +import { S as SvelteElement, i as init, a as attribute_to_object, b as insert_dev, s as safe_not_equal, d as dispatch_dev, v as validate_slots, c as validate_store, e as component_subscribe, o as onMount, g as globals, f as empty, n as noop, h as detach_dev, j as validate_each_argument, k as element, t as text, l as space, m as add_location, p as attr_dev, q as src_url_equal, u as append_dev, w as set_data_dev, x as destroy_each } from './index-d19aafba.js'; +import { w as writable } from './index-4664ced0.js'; +import { loadLocaleContent } from '../../../../../../../../../js/libraries/serverTools.js'; +import { partnersByCountry } from '../../../../../../../../../js/partners.js'; +import '../../../../../../../../../js/components/map-component.js'; + +/* src\partners-component.svelte generated by Svelte v3.52.0 */ + +const { Object: Object_1 } = globals; + +const file = "src\\partners-component.svelte"; + +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[7] = list[i][0]; + child_ctx[8] = list[i][1]; + return child_ctx; +} + +function get_each_context_1(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[11] = list[i]; + return child_ctx; +} + +// (34:4) {#if $loaded==2} +function create_if_block(ctx) { + let div1; + let div0; + let h1; + let t0_value = /*$content*/ ctx[0].heading + ""; + let t0; + let t1; + let img; + let img_src_value; + let t2; + let p; + let t3_value = /*$content*/ ctx[0].p1 + ""; + let t3; + let t4; + let h3; + let t5_value = /*$content*/ ctx[0].subheading1 + ""; + let t5; + let t6; + let each_value = Object.entries(partnersByCountry); + validate_each_argument(each_value); + let each_blocks = []; + + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + + const block = { + c: function create() { + div1 = element("div"); + div0 = element("div"); + h1 = element("h1"); + t0 = text(t0_value); + t1 = space(); + img = element("img"); + t2 = space(); + p = element("p"); + t3 = text(t3_value); + t4 = space(); + h3 = element("h3"); + t5 = text(t5_value); + t6 = space(); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + add_location(h1, file, 37, 16, 1044); + attr_dev(img, "id", "hands-img"); + if (!src_url_equal(img.src, img_src_value = "/img/common/handshake.svg")) attr_dev(img, "src", img_src_value); + attr_dev(img, "alt", "hands"); + add_location(img, file, 38, 16, 1089); + add_location(p, file, 39, 16, 1171); + add_location(h3, file, 40, 16, 1209); + attr_dev(div0, "id", "text-container"); + add_location(div0, file, 36, 12, 1001); + attr_dev(div1, "id", "container"); + add_location(div1, file, 34, 8, 898); + }, + m: function mount(target, anchor) { + insert_dev(target, div1, anchor); + append_dev(div1, div0); + append_dev(div0, h1); + append_dev(h1, t0); + append_dev(div0, t1); + append_dev(div0, img); + append_dev(div0, t2); + append_dev(div0, p); + append_dev(p, t3); + append_dev(div0, t4); + append_dev(div0, h3); + append_dev(h3, t5); + append_dev(div0, t6); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(div0, null); + } + }, + p: function update(ctx, dirty) { + if (dirty & /*$content*/ 1 && t0_value !== (t0_value = /*$content*/ ctx[0].heading + "")) set_data_dev(t0, t0_value); + if (dirty & /*$content*/ 1 && t3_value !== (t3_value = /*$content*/ ctx[0].p1 + "")) set_data_dev(t3, t3_value); + if (dirty & /*$content*/ 1 && t5_value !== (t5_value = /*$content*/ ctx[0].subheading1 + "")) set_data_dev(t5, t5_value); + + if (dirty & /*Object, partnersByCountry, $content, getAddress, getCountry*/ 49) { + each_value = Object.entries(partnersByCountry); + validate_each_argument(each_value); + let i; + + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx, each_value, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div0, null); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value.length; + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div1); + destroy_each(each_blocks, detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block.name, + type: "if", + source: "(34:4) {#if $loaded==2}", + ctx + }); + + return block; +} + +// (45:24) {#each partners as partner} +function create_each_block_1(ctx) { + let div2; + let div1; + let picture; + let source0; + let t0; + let source1; + let t1; + let img; + let t2; + let div0; + let p0; + let b0; + let t3_value = /*$content*/ ctx[0].name + ""; + let t3; + let t4; + let t5_value = /*partner*/ ctx[11].name + ""; + let t5; + let t6; + let p1; + let b1; + let t7_value = /*$content*/ ctx[0].type + ""; + let t7; + let t8; + let t9_value = /*$content*/ ctx[0][/*partner*/ ctx[11].type] + ""; + let t9; + let t10; + let p2; + let b2; + let t11_value = /*$content*/ ctx[0].location + ""; + let t11; + let t12; + let t13_value = /*getAddress*/ ctx[5](/*partner*/ ctx[11]) + ""; + let t13; + let t14; + let p3; + let b3; + let t15_value = /*$content*/ ctx[0].link + ""; + let t15; + let t16; + let a; + let t17_value = /*partner*/ ctx[11].link + ""; + let t17; + let t18; + let p4; + let b4; + let t19_value = /*$content*/ ctx[0].description + ""; + let t19; + let t20; + let t21_value = /*$content*/ ctx[0][/*partner*/ ctx[11].description] + ""; + let t21; + + const block = { + c: function create() { + div2 = element("div"); + div1 = element("div"); + picture = element("picture"); + source0 = element("source"); + t0 = space(); + source1 = element("source"); + t1 = space(); + img = element("img"); + t2 = space(); + div0 = element("div"); + p0 = element("p"); + b0 = element("b"); + t3 = text(t3_value); + t4 = text(": "); + t5 = text(t5_value); + t6 = space(); + p1 = element("p"); + b1 = element("b"); + t7 = text(t7_value); + t8 = text(": "); + t9 = text(t9_value); + t10 = space(); + p2 = element("p"); + b2 = element("b"); + t11 = text(t11_value); + t12 = text(": "); + t13 = text(t13_value); + t14 = space(); + p3 = element("p"); + b3 = element("b"); + t15 = text(t15_value); + t16 = text(": "); + a = element("a"); + t17 = text(t17_value); + t18 = space(); + p4 = element("p"); + b4 = element("b"); + t19 = text(t19_value); + t20 = text(": "); + t21 = text(t21_value); + attr_dev(source0, "srcset", "/img/partners/" + /*partner*/ ctx[11].logo + ".webp"); + add_location(source0, file, 48, 36, 1684); + attr_dev(source1, "srcset", "/img/partners/" + /*partner*/ ctx[11].logo + ".jpg"); + add_location(source1, file, 49, 36, 1777); + attr_dev(img, "class", "partner-logo"); + attr_dev(img, "alt", "logo"); + add_location(img, file, 50, 36, 1869); + add_location(picture, file, 47, 32, 1637); + add_location(b0, file, 53, 39, 2030); + add_location(p0, file, 53, 36, 2027); + add_location(b1, file, 54, 39, 2113); + add_location(p1, file, 54, 36, 2110); + add_location(b2, file, 55, 39, 2206); + add_location(p2, file, 55, 36, 2203); + add_location(b3, file, 56, 39, 2300); + attr_dev(a, "href", /*partner*/ ctx[11].link); + attr_dev(a, "target", ";_blank;"); + attr_dev(a, "rel", "noreferrer"); + add_location(a, file, 56, 63, 2324); + add_location(p3, file, 56, 36, 2297); + add_location(div0, file, 52, 32, 1984); + attr_dev(div1, "class", "img-general-info"); + add_location(div1, file, 46, 28, 1573); + add_location(b4, file, 59, 31, 2509); + add_location(p4, file, 59, 28, 2506); + attr_dev(div2, "class", "location-info"); + add_location(div2, file, 45, 24, 1516); + }, + m: function mount(target, anchor) { + insert_dev(target, div2, anchor); + append_dev(div2, div1); + append_dev(div1, picture); + append_dev(picture, source0); + append_dev(picture, t0); + append_dev(picture, source1); + append_dev(picture, t1); + append_dev(picture, img); + append_dev(div1, t2); + append_dev(div1, div0); + append_dev(div0, p0); + append_dev(p0, b0); + append_dev(b0, t3); + append_dev(b0, t4); + append_dev(p0, t5); + append_dev(div0, t6); + append_dev(div0, p1); + append_dev(p1, b1); + append_dev(b1, t7); + append_dev(b1, t8); + append_dev(p1, t9); + append_dev(div0, t10); + append_dev(div0, p2); + append_dev(p2, b2); + append_dev(b2, t11); + append_dev(b2, t12); + append_dev(p2, t13); + append_dev(div0, t14); + append_dev(div0, p3); + append_dev(p3, b3); + append_dev(b3, t15); + append_dev(b3, t16); + append_dev(p3, a); + append_dev(a, t17); + append_dev(div2, t18); + append_dev(div2, p4); + append_dev(p4, b4); + append_dev(b4, t19); + append_dev(b4, t20); + append_dev(p4, t21); + }, + p: function update(ctx, dirty) { + if (dirty & /*$content*/ 1 && t3_value !== (t3_value = /*$content*/ ctx[0].name + "")) set_data_dev(t3, t3_value); + if (dirty & /*$content*/ 1 && t7_value !== (t7_value = /*$content*/ ctx[0].type + "")) set_data_dev(t7, t7_value); + if (dirty & /*$content*/ 1 && t9_value !== (t9_value = /*$content*/ ctx[0][/*partner*/ ctx[11].type] + "")) set_data_dev(t9, t9_value); + if (dirty & /*$content*/ 1 && t11_value !== (t11_value = /*$content*/ ctx[0].location + "")) set_data_dev(t11, t11_value); + if (dirty & /*$content*/ 1 && t15_value !== (t15_value = /*$content*/ ctx[0].link + "")) set_data_dev(t15, t15_value); + if (dirty & /*$content*/ 1 && t19_value !== (t19_value = /*$content*/ ctx[0].description + "")) set_data_dev(t19, t19_value); + if (dirty & /*$content*/ 1 && t21_value !== (t21_value = /*$content*/ ctx[0][/*partner*/ ctx[11].description] + "")) set_data_dev(t21, t21_value); + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div2); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_each_block_1.name, + type: "each", + source: "(45:24) {#each partners as partner}", + ctx + }); + + return block; +} + +// (42:16) {#each Object.entries(partnersByCountry) as [name,partners]} +function create_each_block(ctx) { + let h4; + let t0_value = /*getCountry*/ ctx[4](/*name*/ ctx[7]) + ""; + let t0; + let t1; + let div; + let t2; + let each_value_1 = /*partners*/ ctx[8]; + validate_each_argument(each_value_1); + let each_blocks = []; + + for (let i = 0; i < each_value_1.length; i += 1) { + each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i)); + } + + const block = { + c: function create() { + h4 = element("h4"); + t0 = text(t0_value); + t1 = space(); + div = element("div"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + t2 = space(); + attr_dev(h4, "class", "country-name"); + add_location(h4, file, 42, 20, 1340); + attr_dev(div, "class", "country-block"); + add_location(div, file, 43, 20, 1410); + }, + m: function mount(target, anchor) { + insert_dev(target, h4, anchor); + append_dev(h4, t0); + insert_dev(target, t1, anchor); + insert_dev(target, div, anchor); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(div, null); + } + + append_dev(div, t2); + }, + p: function update(ctx, dirty) { + if (dirty & /*$content, Object, partnersByCountry, getAddress*/ 33) { + each_value_1 = /*partners*/ ctx[8]; + validate_each_argument(each_value_1); + let i; + + for (i = 0; i < each_value_1.length; i += 1) { + const child_ctx = get_each_context_1(ctx, each_value_1, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block_1(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div, t2); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value_1.length; + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(h4); + if (detaching) detach_dev(t1); + if (detaching) detach_dev(div); + destroy_each(each_blocks, detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_each_block.name, + type: "each", + source: "(42:16) {#each Object.entries(partnersByCountry) as [name,partners]}", + ctx + }); + + return block; +} + +// (33:0) {#key $loaded} +function create_key_block(ctx) { + let if_block_anchor; + let if_block = /*$loaded*/ ctx[1] == 2 && create_if_block(ctx); + + const block = { + c: function create() { + if (if_block) if_block.c(); + if_block_anchor = empty(); + }, + m: function mount(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert_dev(target, if_block_anchor, anchor); + }, + p: function update(ctx, dirty) { + if (/*$loaded*/ ctx[1] == 2) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block(ctx); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + }, + d: function destroy(detaching) { + if (if_block) if_block.d(detaching); + if (detaching) detach_dev(if_block_anchor); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_key_block.name, + type: "key", + source: "(33:0) {#key $loaded}", + ctx + }); + + return block; +} + +function create_fragment(ctx) { + let previous_key = /*$loaded*/ ctx[1]; + let key_block_anchor; + let key_block = create_key_block(ctx); + + const block = { + c: function create() { + key_block.c(); + key_block_anchor = empty(); + this.c = noop; + }, + l: function claim(nodes) { + throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); + }, + m: function mount(target, anchor) { + key_block.m(target, anchor); + insert_dev(target, key_block_anchor, anchor); + }, + p: function update(ctx, [dirty]) { + if (dirty & /*$loaded*/ 2 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[1])) { + key_block.d(1); + key_block = create_key_block(ctx); + key_block.c(); + key_block.m(key_block_anchor.parentNode, key_block_anchor); + } else { + key_block.p(ctx, dirty); + } + }, + i: noop, + o: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(key_block_anchor); + key_block.d(detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment.name, + type: "component", + source: "", + ctx + }); + + return block; +} + +function instance($$self, $$props, $$invalidate) { + let $content; + let $loaded; + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots('partners-component', slots, []); + let loaded = writable(0); + validate_store(loaded, 'loaded'); + component_subscribe($$self, loaded, value => $$invalidate(1, $loaded = value)); + let content = writable({}); + validate_store(content, 'content'); + component_subscribe($$self, content, value => $$invalidate(0, $content = value)); + loadLocaleContent(content, "countries", loaded); + let locale = loadLocaleContent(content, "partners-component", loaded); + + function getCountry(name) { + return locale == "en" ? name : $content[name]; + } + + function getAddress(group) { + return group.location[0].map(x => locale == "en" ? x : $content[x]).join(", "); + } + + onMount(() => { + + }); + + const writable_props = []; + + Object_1.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); + }); + + $$self.$capture_state = () => ({ + onMount, + writable, + loadLocaleContent, + partnersByCountry, + loaded, + content, + locale, + getCountry, + getAddress, + $content, + $loaded + }); + + $$self.$inject_state = $$props => { + if ('loaded' in $$props) $$invalidate(2, loaded = $$props.loaded); + if ('content' in $$props) $$invalidate(3, content = $$props.content); + if ('locale' in $$props) locale = $$props.locale; + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [$content, $loaded, loaded, content, getCountry, getAddress]; +} + +class Partners_component extends SvelteElement { + constructor(options) { + super(); + this.shadowRoot.innerHTML = ``; + + init( + this, + { + target: this.shadowRoot, + props: attribute_to_object(this.attributes), + customElement: true + }, + instance, + create_fragment, + safe_not_equal, + {}, + null + ); + + if (options) { + if (options.target) { + insert_dev(options.target, this, options.anchor); + } + } + } +} + +customElements.define("partners-component", Partners_component); + +export { Partners_component as default }; diff --git a/Server/public/js/components/select-component.js b/Server/public/js/components/select-component.js index df38f5d..fefa9f3 100644 --- a/Server/public/js/components/select-component.js +++ b/Server/public/js/components/select-component.js @@ -1 +1,593 @@ -import{S as t,i as e,a as r,b as i,u as o,s as n,f as l,n as s,h as a,d,o as u,t as c,g as h,j as p,v as f,l as m,q as v,m as b,p as g,w}from"./index-4348483d.js";import{px2rem as y,getTextWidth as x,getCanvasFont as $}from"../../../../../../../../../js/libraries/miscTools.js";function k(t,e,r){const i=t.slice();return i[26]=e[r],i[27]=e,i[28]=r,i}function z(t){let e,r,o,n,s,a,u=t[26]+"",p=t[28];const f=()=>t[14](e,p),g=()=>t[14](null,p);function w(){return t[15](t[28])}return{c(){e=l("button"),r=l("span"),o=c(u),n=h(),e.value=t[28]},m(t,l){i(t,e,l),m(e,r),m(r,o),m(e,n),f(),s||(a=v(e,"click",w),s=!0)},p(e,r){t=e,4&r&&u!==(u=t[26]+"")&&b(o,u),p!==t[28]&&(g(),p=t[28],f())},d(t){t&&d(e),g(),s=!1,a()}}}function L(t){let e,r,o,n,s,u,w,y,x,$,L,j=(null!=t[0]?t[0]:"")+"",M=t[2],T=[];for(let e=0;ee==t));r(6,n.innerHTML=t,n),r(5,p[i].style.display="none",p),r(11,c=i)}r(8,f+=1)}}function b(t,e){null!=t&&null!=e&&e[t]!=d&&(r(0,d=e[t]),r(8,f+=1))}function g(){"none"==o.style.display?r(4,o.style.display="initial",o):r(4,o.style.display="none",o)}function k(t,e){r(11,c=t),r(0,d=a[t]),null!=e&&null!=e&&e(t)}function z(){r(4,o.style.display="none",o)}function L(t,e){let r;if(null!=t&&null!=e){let i=getComputedStyle(t).getPropertyValue("--width");if(isNaN(i)||""==i){if(null==m)return m=new ResizeObserver((()=>L(t,e))),void m.observe(l);i=getComputedStyle(l).getPropertyValue("width"),r=y(parseFloat(i.slice(0,i.length-2)))}else r=parseFloat(i.slice(0,i.length-2));let o=[];for(let t=0;tr){let t=1.1*n+"rem";e.style.width=t;for(let r=0;r{n=t,r(6,n)}))}function M(t){w[t?"unshift":"push"]((()=>{l=t,r(7,l)}))}function T(t,e){w[t?"unshift":"push"]((()=>{p[e]=t,r(5,p)}))}u((()=>{h.addEventListener("focusout",z)}));const E=t=>k(t,s);function H(t){w[t?"unshift":"push"]((()=>{o=t,r(4,o)}))}function R(t){w[t?"unshift":"push"]((()=>{i=t,r(3,i)}))}return t.$$set=t=>{"callback"in t&&r(1,s=t.callback),"options"in t&&r(2,a=t.options),"value"in t&&r(0,d=t.value),"valueindex"in t&&r(11,c=t.valueindex)},t.$$.update=()=>{5&t.$$.dirty&&v(d,a),2052&t.$$.dirty&&b(c,a),24&t.$$.dirty&&L(i,o)},[d,s,a,i,o,p,n,l,f,g,k,c,j,M,T,E,H,R]}class T extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:r(this.attributes),customElement:!0},M,j,n,{callback:1,options:2,value:0,valueindex:11},null),t&&(t.target&&i(t.target,this,t.anchor),t.props&&(this.$set(t.props),o()))}static get observedAttributes(){return["callback","options","value","valueindex"]}get callback(){return this.$$.ctx[1]}set callback(t){this.$$set({callback:t}),o()}get options(){return this.$$.ctx[2]}set options(t){this.$$set({options:t}),o()}get value(){return this.$$.ctx[0]}set value(t){this.$$set({value:t}),o()}get valueindex(){return this.$$.ctx[11]}set valueindex(t){this.$$set({valueindex:t}),o()}}customElements.define("select-component",T);export{T as default}; + +(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document); +import { S as SvelteElement, i as init, a as attribute_to_object, b as insert_dev, B as flush, s as safe_not_equal, d as dispatch_dev, v as validate_slots, o as onMount, j as validate_each_argument, k as element, n as noop, p as attr_dev, m as add_location, h as detach_dev, C as binding_callbacks, t as text, l as space, q as src_url_equal, D as set_style, u as append_dev, y as listen_dev, w as set_data_dev, x as destroy_each } from './index-d19aafba.js'; +import { px2rem, getTextWidth, getCanvasFont } from '../../../../../../../../../js/libraries/miscTools.js'; + +/* src\components\select-component.svelte generated by Svelte v3.52.0 */ +const file = "src\\components\\select-component.svelte"; + +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[26] = list[i]; + child_ctx[27] = list; + child_ctx[28] = i; + return child_ctx; +} + +// (135:12) {#each options as option, i} +function create_each_block(ctx) { + let button; + let span; + let t0_value = /*option*/ ctx[26] + ""; + let t0; + let t1; + let i = /*i*/ ctx[28]; + let mounted; + let dispose; + const assign_button = () => /*button_binding_1*/ ctx[14](button, i); + const unassign_button = () => /*button_binding_1*/ ctx[14](null, i); + + function click_handler() { + return /*click_handler*/ ctx[15](/*i*/ ctx[28]); + } + + const block = { + c: function create() { + button = element("button"); + span = element("span"); + t0 = text(t0_value); + t1 = space(); + add_location(span, file, 136, 20, 4826); + button.value = /*i*/ ctx[28]; + add_location(button, file, 135, 16, 4715); + }, + m: function mount(target, anchor) { + insert_dev(target, button, anchor); + append_dev(button, span); + append_dev(span, t0); + append_dev(button, t1); + assign_button(); + + if (!mounted) { + dispose = listen_dev(button, "click", click_handler, false, false, false); + mounted = true; + } + }, + p: function update(new_ctx, dirty) { + ctx = new_ctx; + if (dirty & /*options*/ 4 && t0_value !== (t0_value = /*option*/ ctx[26] + "")) set_data_dev(t0, t0_value); + + if (i !== /*i*/ ctx[28]) { + unassign_button(); + i = /*i*/ ctx[28]; + assign_button(); + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(button); + unassign_button(); + mounted = false; + dispose(); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_each_block.name, + type: "each", + source: "(135:12) {#each options as option, i}", + ctx + }); + + return block; +} + +// (127:4) {#key key} +function create_key_block(ctx) { + let button; + let div0; + let span; + let t0_value = (/*value*/ ctx[0] != null ? /*value*/ ctx[0] : "") + ""; + let t0; + let t1; + let img; + let img_src_value; + let t2; + let div1; + let mounted; + let dispose; + let each_value = /*options*/ ctx[2]; + validate_each_argument(each_value); + let each_blocks = []; + + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + + const block = { + c: function create() { + button = element("button"); + div0 = element("div"); + span = element("span"); + t0 = text(t0_value); + t1 = space(); + img = element("img"); + t2 = space(); + div1 = element("div"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + attr_dev(span, "id", "current-options-span"); + add_location(span, file, 129, 16, 4359); + attr_dev(div0, "id", "current-options-div"); + add_location(div0, file, 128, 12, 4311); + attr_dev(img, "id", "arrow-down"); + if (!src_url_equal(img.src, img_src_value = "../assets/arrow_down.svg")) attr_dev(img, "src", img_src_value); + attr_dev(img, "alt", "arrow down"); + add_location(img, file, 131, 12, 4484); + attr_dev(button, "id", "current-option-button"); + add_location(button, file, 127, 8, 4202); + attr_dev(div1, "id", "options-holder"); + set_style(div1, "display", "none"); + add_location(div1, file, 133, 8, 4582); + }, + m: function mount(target, anchor) { + insert_dev(target, button, anchor); + append_dev(button, div0); + append_dev(div0, span); + append_dev(span, t0); + /*span_binding*/ ctx[12](span); + append_dev(button, t1); + append_dev(button, img); + /*button_binding*/ ctx[13](button); + insert_dev(target, t2, anchor); + insert_dev(target, div1, anchor); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(div1, null); + } + + /*div1_binding*/ ctx[16](div1); + + if (!mounted) { + dispose = listen_dev(button, "click", /*changeVisibility*/ ctx[9], false, false, false); + mounted = true; + } + }, + p: function update(ctx, dirty) { + if (dirty & /*value*/ 1 && t0_value !== (t0_value = (/*value*/ ctx[0] != null ? /*value*/ ctx[0] : "") + "")) set_data_dev(t0, t0_value); + + if (dirty & /*optionButtons, changeOption, callback, options*/ 1062) { + each_value = /*options*/ ctx[2]; + validate_each_argument(each_value); + let i; + + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx, each_value, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div1, null); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value.length; + } + }, + d: function destroy(detaching) { + if (detaching) detach_dev(button); + /*span_binding*/ ctx[12](null); + /*button_binding*/ ctx[13](null); + if (detaching) detach_dev(t2); + if (detaching) detach_dev(div1); + destroy_each(each_blocks, detaching); + /*div1_binding*/ ctx[16](null); + mounted = false; + dispose(); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_key_block.name, + type: "key", + source: "(127:4) {#key key}", + ctx + }); + + return block; +} + +function create_fragment(ctx) { + let div; + let previous_key = /*key*/ ctx[8]; + let key_block = create_key_block(ctx); + + const block = { + c: function create() { + div = element("div"); + key_block.c(); + this.c = noop; + attr_dev(div, "class", "select"); + add_location(div, file, 125, 0, 4137); + }, + l: function claim(nodes) { + throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); + }, + m: function mount(target, anchor) { + insert_dev(target, div, anchor); + key_block.m(div, null); + /*div_binding*/ ctx[17](div); + }, + p: function update(ctx, [dirty]) { + if (dirty & /*key*/ 256 && safe_not_equal(previous_key, previous_key = /*key*/ ctx[8])) { + key_block.d(1); + key_block = create_key_block(ctx); + key_block.c(); + key_block.m(div, null); + } else { + key_block.p(ctx, dirty); + } + }, + i: noop, + o: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(div); + key_block.d(detaching); + /*div_binding*/ ctx[17](null); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment.name, + type: "component", + source: "", + ctx + }); + + return block; +} + +function instance($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots('select-component', slots, []); + let { callback = null } = $$props; + let { options = [""] } = $$props; + let { value = null } = $$props; + let { valueindex = null } = $$props; + + // Main code + let root = arguments[0]; + + let select; + let optionsHolder; + let optionButtons = []; + let currentOption; + let currentOptionButton; + let init = false; + let key = 0; + let obs = null; + + function setKeyValue(value, options) { + if (value !== null) { + if (options.includes(value)) { + let index = options.findIndex(element => element == value); + $$invalidate(6, currentOption.innerHTML = value, currentOption); + $$invalidate(5, optionButtons[index].style.display = "none", optionButtons); + $$invalidate(11, valueindex = index); + } + + $$invalidate(8, key += 1); + } + } + + function setKeyIndex(valueindex, options) { + if (valueindex != null && options != undefined && options[valueindex] != value) { + $$invalidate(0, value = options[valueindex]); + $$invalidate(8, key += 1); + } + } + + function indexToValue(index) { + $$invalidate(0, value = options[index]); + } + + function changeVisibility() { + if (optionsHolder.style.display == "none") { + $$invalidate(4, optionsHolder.style.display = "initial", optionsHolder); + } else { + $$invalidate(4, optionsHolder.style.display = "none", optionsHolder); + } + } + + function changeOption(index, callback) { + $$invalidate(11, valueindex = index); + $$invalidate(0, value = options[index]); + + if (callback != undefined && callback != null) { + callback(index); + } + } + + function hideSelect() { + $$invalidate(4, optionsHolder.style.display = "none", optionsHolder); + } + + function changeOptionsWidth(select, optionsHolder) { + let selectWidth; + + if (select != undefined && optionsHolder != undefined) { + let selectWidthText = getComputedStyle(select).getPropertyValue('--width'); + + if (isNaN(selectWidthText) || selectWidthText == "") { + if (obs == null) { + obs = new ResizeObserver(() => changeOptionsWidth(select, optionsHolder)); + obs.observe(currentOptionButton); + return; + } else { + selectWidthText = getComputedStyle(currentOptionButton).getPropertyValue('width'); + selectWidth = px2rem(parseFloat(selectWidthText.slice(0, selectWidthText.length - 2))); + } + } else { + selectWidth = parseFloat(selectWidthText.slice(0, selectWidthText.length - 2)); + } + + let spanWidths = []; + + for (let i = 0; i < optionsHolder.children.length; i++) { + let span = optionsHolder.children[i].children[0]; + let spanWidth = getTextWidth(span.innerHTML, getCanvasFont(span)); + spanWidths.push(spanWidth); + } + + let maxOptionsWidth = px2rem(Math.max(...spanWidths)); + + if (maxOptionsWidth > selectWidth) { + let width = 1.1 * maxOptionsWidth + "rem"; + optionsHolder.style.width = width; + + for (let i = 0; i < optionsHolder.children.length; i++) { + let button = optionsHolder.children[i]; + button.style.width = width; + } + + optionsHolder.style.marginLeft = -(1.1 * maxOptionsWidth - selectWidth) / 2 - 0.05 + "rem"; + } else { + let width = selectWidth + 0.1 + "rem"; + + for (let i = 0; i < optionsHolder.children.length; i++) { + let button = optionsHolder.children[i]; + button.style.width = width; + } + } + } + } + + onMount(() => { + init = true; + root.addEventListener('focusout', hideSelect); + }); + + const writable_props = ['callback', 'options', 'value', 'valueindex']; + + Object.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); + }); + + function span_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + currentOption = $$value; + $$invalidate(6, currentOption); + }); + } + + function button_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + currentOptionButton = $$value; + $$invalidate(7, currentOptionButton); + }); + } + + function button_binding_1($$value, i) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + optionButtons[i] = $$value; + $$invalidate(5, optionButtons); + }); + } + + const click_handler = i => changeOption(i, callback); + + function div1_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + optionsHolder = $$value; + $$invalidate(4, optionsHolder); + }); + } + + function div_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + select = $$value; + $$invalidate(3, select); + }); + } + + $$self.$$set = $$props => { + if ('callback' in $$props) $$invalidate(1, callback = $$props.callback); + if ('options' in $$props) $$invalidate(2, options = $$props.options); + if ('value' in $$props) $$invalidate(0, value = $$props.value); + if ('valueindex' in $$props) $$invalidate(11, valueindex = $$props.valueindex); + }; + + $$self.$capture_state = () => ({ + onMount, + px2rem, + getTextWidth, + getCanvasFont, + callback, + options, + value, + valueindex, + root, + select, + optionsHolder, + optionButtons, + currentOption, + currentOptionButton, + init, + key, + obs, + setKeyValue, + setKeyIndex, + indexToValue, + changeVisibility, + changeOption, + hideSelect, + changeOptionsWidth + }); + + $$self.$inject_state = $$props => { + if ('callback' in $$props) $$invalidate(1, callback = $$props.callback); + if ('options' in $$props) $$invalidate(2, options = $$props.options); + if ('value' in $$props) $$invalidate(0, value = $$props.value); + if ('valueindex' in $$props) $$invalidate(11, valueindex = $$props.valueindex); + if ('root' in $$props) root = $$props.root; + if ('select' in $$props) $$invalidate(3, select = $$props.select); + if ('optionsHolder' in $$props) $$invalidate(4, optionsHolder = $$props.optionsHolder); + if ('optionButtons' in $$props) $$invalidate(5, optionButtons = $$props.optionButtons); + if ('currentOption' in $$props) $$invalidate(6, currentOption = $$props.currentOption); + if ('currentOptionButton' in $$props) $$invalidate(7, currentOptionButton = $$props.currentOptionButton); + if ('init' in $$props) init = $$props.init; + if ('key' in $$props) $$invalidate(8, key = $$props.key); + if ('obs' in $$props) obs = $$props.obs; + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*value, options*/ 5) { + setKeyValue(value, options); + } + + if ($$self.$$.dirty & /*valueindex, options*/ 2052) { + setKeyIndex(valueindex, options); + } + + if ($$self.$$.dirty & /*select, optionsHolder*/ 24) { + changeOptionsWidth(select, optionsHolder); + } + }; + + return [ + value, + callback, + options, + select, + optionsHolder, + optionButtons, + currentOption, + currentOptionButton, + key, + changeVisibility, + changeOption, + valueindex, + span_binding, + button_binding, + button_binding_1, + click_handler, + div1_binding, + div_binding + ]; +} + +class Select_component extends SvelteElement { + constructor(options) { + super(); + this.shadowRoot.innerHTML = ``; + + init( + this, + { + target: this.shadowRoot, + props: attribute_to_object(this.attributes), + customElement: true + }, + instance, + create_fragment, + safe_not_equal, + { + callback: 1, + options: 2, + value: 0, + valueindex: 11 + }, + null + ); + + if (options) { + if (options.target) { + insert_dev(options.target, this, options.anchor); + } + + if (options.props) { + this.$set(options.props); + flush(); + } + } + } + + static get observedAttributes() { + return ["callback", "options", "value", "valueindex"]; + } + + get callback() { + return this.$$.ctx[1]; + } + + set callback(callback) { + this.$$set({ callback }); + flush(); + } + + get options() { + return this.$$.ctx[2]; + } + + set options(options) { + this.$$set({ options }); + flush(); + } + + get value() { + return this.$$.ctx[0]; + } + + set value(value) { + this.$$set({ value }); + flush(); + } + + get valueindex() { + return this.$$.ctx[11]; + } + + set valueindex(valueindex) { + this.$$set({ valueindex }); + flush(); + } +} + +customElements.define("select-component", Select_component); + +export { Select_component as default }; diff --git a/Server/public/js/components/switch-component.js b/Server/public/js/components/switch-component.js index bd960dc..6bc83b3 100644 --- a/Server/public/js/components/switch-component.js +++ b/Server/public/js/components/switch-component.js @@ -1 +1,209 @@ -import{S as t,i as e,a as s,b as c,u as i,s as a,f as r,g as o,n as h,h as n,l,q as d,d as u,r as p,o as b}from"./index-4348483d.js";import"../../../../../../../../../js/libraries/miscTools.js";function k(t){let e,s,i,a,b,k;return{c(){e=r("label"),s=r("input"),i=o(),a=r("span"),this.c=h,n(s,"type","checkbox"),n(a,"class","switch-span"),n(e,"class","switch")},m(r,o){c(r,e,o),l(e,s),s.checked=t[0],l(e,i),l(e,a),b||(k=[d(s,"change",t[4]),d(s,"click",t[1])],b=!0)},p(t,[e]){1&e&&(s.checked=t[0])},i:h,o:h,d(t){t&&u(e),b=!1,p(k)}}}function g(t,e,s){let{callback:c=null}=e,{checked:i=!1}=e;const a=()=>{setTimeout((()=>{null!=c?(s(0,i=!i),c()):a()}),100)};return b((()=>{})),t.$$set=t=>{"callback"in t&&s(2,c=t.callback),"checked"in t&&s(0,i=t.checked)},[i,function(){null!=c&&(s(0,i=!i),c())},c,a,function(){i=this.checked,s(0,i)}]}class m extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:s(this.attributes),customElement:!0},g,k,a,{callback:2,checked:0,toggle:3},null),t&&(t.target&&c(t.target,this,t.anchor),t.props&&(this.$set(t.props),i()))}static get observedAttributes(){return["callback","checked","toggle"]}get callback(){return this.$$.ctx[2]}set callback(t){this.$$set({callback:t}),i()}get checked(){return this.$$.ctx[0]}set checked(t){this.$$set({checked:t}),i()}get toggle(){return this.$$.ctx[3]}}customElements.define("switch-component",m);export{m as default}; + +(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document); +import { S as SvelteElement, i as init, a as attribute_to_object, b as insert_dev, B as flush, s as safe_not_equal, d as dispatch_dev, v as validate_slots, o as onMount, k as element, l as space, n as noop, p as attr_dev, m as add_location, u as append_dev, y as listen_dev, h as detach_dev, z as run_all } from './index-d19aafba.js'; +import { px2rem, getTextWidth, getCanvasFont } from '../../../../../../../../../js/libraries/miscTools.js'; + +/* src\components\switch-component.svelte generated by Svelte v3.52.0 */ +const file = "src\\components\\switch-component.svelte"; + +function create_fragment(ctx) { + let label; + let input; + let t; + let span; + let mounted; + let dispose; + + const block = { + c: function create() { + label = element("label"); + input = element("input"); + t = space(); + span = element("span"); + this.c = noop; + attr_dev(input, "type", "checkbox"); + add_location(input, file, 39, 4, 804); + attr_dev(span, "class", "switch-span"); + add_location(span, file, 40, 4, 880); + attr_dev(label, "class", "switch"); + add_location(label, file, 38, 0, 776); + }, + l: function claim(nodes) { + throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); + }, + m: function mount(target, anchor) { + insert_dev(target, label, anchor); + append_dev(label, input); + input.checked = /*checked*/ ctx[0]; + append_dev(label, t); + append_dev(label, span); + + if (!mounted) { + dispose = [ + listen_dev(input, "change", /*input_change_handler*/ ctx[4]), + listen_dev(input, "click", /*toggleClick*/ ctx[1], false, false, false) + ]; + + mounted = true; + } + }, + p: function update(ctx, [dirty]) { + if (dirty & /*checked*/ 1) { + input.checked = /*checked*/ ctx[0]; + } + }, + i: noop, + o: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(label); + mounted = false; + run_all(dispose); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment.name, + type: "component", + source: "", + ctx + }); + + return block; +} + +function instance($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots('switch-component', slots, []); + let { callback = null } = $$props; + let { checked = false } = $$props; + + const toggle = () => { + let f = () => { + if (callback != null) { + $$invalidate(0, checked = !checked); + callback(); + } else { + toggle(); + } + }; + + setTimeout(f, 100); + }; + + function toggleClick() { + if (callback != null) { + $$invalidate(0, checked = !checked); + callback(); + } + } + + // Main code + onMount(() => { + + }); + + const writable_props = ['callback', 'checked']; + + Object.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); + }); + + function input_change_handler() { + checked = this.checked; + $$invalidate(0, checked); + } + + $$self.$$set = $$props => { + if ('callback' in $$props) $$invalidate(2, callback = $$props.callback); + if ('checked' in $$props) $$invalidate(0, checked = $$props.checked); + }; + + $$self.$capture_state = () => ({ + onMount, + px2rem, + getTextWidth, + getCanvasFont, + callback, + checked, + toggle, + toggleClick + }); + + $$self.$inject_state = $$props => { + if ('callback' in $$props) $$invalidate(2, callback = $$props.callback); + if ('checked' in $$props) $$invalidate(0, checked = $$props.checked); + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [checked, toggleClick, callback, toggle, input_change_handler]; +} + +class Switch_component extends SvelteElement { + constructor(options) { + super(); + this.shadowRoot.innerHTML = ``; + + init( + this, + { + target: this.shadowRoot, + props: attribute_to_object(this.attributes), + customElement: true + }, + instance, + create_fragment, + safe_not_equal, + { callback: 2, checked: 0, toggle: 3 }, + null + ); + + if (options) { + if (options.target) { + insert_dev(options.target, this, options.anchor); + } + + if (options.props) { + this.$set(options.props); + flush(); + } + } + } + + static get observedAttributes() { + return ["callback", "checked", "toggle"]; + } + + get callback() { + return this.$$.ctx[2]; + } + + set callback(callback) { + this.$$set({ callback }); + flush(); + } + + get checked() { + return this.$$.ctx[0]; + } + + set checked(checked) { + this.$$set({ checked }); + flush(); + } + + get toggle() { + return this.$$.ctx[3]; + } + + set toggle(value) { + throw new Error(": Cannot set read-only property 'toggle'"); + } +} + +customElements.define("switch-component", Switch_component); + +export { Switch_component as default }; diff --git a/Server/public/js/coops.js b/Server/public/js/coops.js index 1b6038b..8338fcc 100644 --- a/Server/public/js/coops.js +++ b/Server/public/js/coops.js @@ -2,7 +2,7 @@ export let coops = [ { logo: "chiron_logo", name: "Chiron Health", - location: [["Estonia","KohtlaJarve"],[59.41038769769602, 27.287802936242034]], + location: [["Estonia","Kohtla-Järve"],[59.41038769769602, 27.287802936242034]], market: "wellnessAndHealth", workers: 2, status: "inDevelopment", @@ -13,7 +13,7 @@ export let coops = [ { logo: "kuusk_logo", name: "Kuusk", - location: [["Estonia","KohtlaJarve"],[59.399947051803004, 27.277159931677055]], + location: [["Estonia","Kohtla-Järve"],[59.399947051803004, 27.277159931677055]], market: "herbalTeas", workers: 1, status: "inDevelopment", @@ -36,7 +36,7 @@ for (let g of coops) { export let coopsMarkersLayer = L.layerGroup() -export function addMarkersCoops(map,content) { +export function addMarkersCoops(map,content,locale) { for (let g of coops) { let coordinates let text = ""+content["Cooperative"]+"
" @@ -56,7 +56,13 @@ export function addMarkersCoops(map,content) { } else if (field=="location") { let location = g[field][0] - let locationString = location.map(x => content[x]).join(", ") + let locationString + if (locale=="en") { + locationString = location.map(x => x).join(", ") + } + else { + locationString = location.map(x => content[x]).join(", ") + } text += fieldText + locationString + "
" coordinates = g[field][1] } diff --git a/Server/public/js/groups.js b/Server/public/js/groups.js index 3aef913..95b2c52 100644 --- a/Server/public/js/groups.js +++ b/Server/public/js/groups.js @@ -25,7 +25,7 @@ export let groups = [ contact: ["https://discord.gg/Qk8KUk787z","DiscordInviteLink"] }, { - location: [["Estonia","KohtlaJarve"], [59.40629447076191, 27.280605339416322]], + location: [["Estonia","Kohtla-Järve"], [59.40629447076191, 27.280605339416322]], members: 3, contact: ["https://discord.gg/Qk8KUk787z","DiscordInviteLink"] }, @@ -93,7 +93,7 @@ let groupsMarkersLayerIn = L.layerGroup() let contactGeneral =["https://discord.gg/4BUau4AZre","DiscordInviteLink"] -function addMarkersToLayer(g,layer,content) { +function addMarkersToLayer(g,layer,content,locale) { let coordinates let text = ""+content["Group"]+"
" for (let field in g) { @@ -103,7 +103,13 @@ function addMarkersToLayer(g,layer,content) { } else if (field=="location") { let location = g[field][0] - let locationString = location.map(x => content[x]).join(", ") + let locationString + if (locale=="en") { + locationString = location.map(x => x).join(", ") + } + else { + locationString = location.map(x => content[x]).join(", ") + } text += fieldText + locationString + "
" coordinates = g[field][1] } @@ -123,15 +129,15 @@ function addMarkersToLayer(g,layer,content) { marker.addTo(layer).bindPopup(text) } -export function addMarkersGroups(map,content) { +export function addMarkersGroups(map,content,locale) { for (let g of groups) { - addMarkersToLayer(g,groupsMarkersLayerIn,content) + addMarkersToLayer(g,groupsMarkersLayerIn,content,locale) } for (let gs of Object.values(groupsByCountry)) { if (gs.length==1) { let g = {...gs[0]} g.location[0] = [g.location[0][0]] - addMarkersToLayer(g,groupsMarkersLayerOut,content) + addMarkersToLayer(g,groupsMarkersLayerOut,content,locale) } else { let locationName = [gs[0].location[0][0]] @@ -153,7 +159,7 @@ export function addMarkersGroups(map,content) { members: members, contact: contact } - addMarkersToLayer(gNew,groupsMarkersLayerOut,content) + addMarkersToLayer(gNew,groupsMarkersLayerOut,content,locale) } } groupsMarkersLayerOut.addTo(groupsMarkersLayer) @@ -172,37 +178,5 @@ function onZoomEnd(map) { groupsMarkersLayerIn.addTo(groupsMarkersLayer) } } -/* -function reverseGeocode(latitude, longitude) { - let url = `https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=${latitude}&lon=${longitude}`; - - // Create a new XMLHttpRequest object - let xhr = new XMLHttpRequest(); - - // Set up the AJAX request - xhr.open('GET', url, true); - - // Define the onload function - xhr.onload = function() { - if (xhr.status === 200) { - // Parse the response JSON - let response = JSON.parse(xhr.responseText); - - // Extract the address information from the response - let address = response.address; - let city = address.city || address.town || address.village || address.hamlet; - let country = address.country; - let fullAddress = city + ', ' + country; - - // Do something with the address - console.log(fullAddress); - } - }; - - // Send the AJAX request - xhr.send(); - } + -let latitude = 123.456; // Replace with your latitude -let longitude = 78.901; // Replace with your longitude -reverseGeocode(latitude, longitude);*/ \ No newline at end of file diff --git a/Server/public/js/libraries/serverTools.js b/Server/public/js/libraries/serverTools.js index 76df3ab..6e85d01 100644 --- a/Server/public/js/libraries/serverTools.js +++ b/Server/public/js/libraries/serverTools.js @@ -1,17 +1,17 @@ // Get data from server export function getData(path,callback) { - var xhr = new XMLHttpRequest(); - xhr.overrideMimeType("application/json"); - xhr.open('GET', path, true); + let xhr = new XMLHttpRequest(); + xhr.overrideMimeType("application/json") + xhr.open('GET', path, true) xhr.onreadystatechange = function () { - if (xhr.readyState == 4 && xhr.status == "200") { + if (xhr.readyState == 4 && xhr.status == "200") { if (callback !== undefined) { - callback(xhr.responseText); + callback(xhr.responseText) } - } + } }; - xhr.send(null); + xhr.send() } // Parse JSON from given path into a given variable under a given key @@ -35,6 +35,7 @@ export function sendData(route,data,callback) { callback(xhr.responseText) } } else { + console.log("Request gave an error") // Oh no! There has been an error with the request! } } diff --git a/Server/public/js/parties.js b/Server/public/js/parties.js index 22a775b..5921eb9 100644 --- a/Server/public/js/parties.js +++ b/Server/public/js/parties.js @@ -22,7 +22,7 @@ for (let g of parties) { export let partiesMarkersLayer = L.layerGroup() -export function addMarkersParties(map,content) { +export function addMarkersParties(map,content,locale) { for (let g of parties) { let coordinates let text = ""+content["Party"]+"
" @@ -42,7 +42,13 @@ export function addMarkersParties(map,content) { } else if (field=="location") { let location = g[field][0] - let locationString = location + let locationString + if (locale=="en") { + locationString = location + } + else { + locationString = content[location] + } text += fieldText + locationString + "
" coordinates = g[field][1] } diff --git a/Server/public/locales/countries.csv b/Server/public/locales/countries.csv new file mode 100644 index 0000000..e69de29 diff --git a/Server/public/locales/en/countries.json b/Server/public/locales/en/countries.json index 3680dc3..8919b1b 100644 --- a/Server/public/locales/en/countries.json +++ b/Server/public/locales/en/countries.json @@ -1,29 +1,3 @@ { - "map-prompt": "Want to appear on our map? Contact us!", - "Online": "Online", - "Denmark": "Denmark", - "Estonia": "Estonia", - "Greece": "Greece", - "Latvia": "Latvia", - "Canada": "Canada", - "Germany": "Germany", - "Copenhagen": "Copenhagen", - "Ireland": "Ireland", - "USA": "USA", - "Bulgaria": "Bulgaria", - "Colorado": "Colorado", - "Georgia": "Georgia", - "Ohio": "Ohio", - "Montreal": "Montreal", - "Kolding": "Kolding", - "KohtlaJarve": "Kohtla-Järve", - "Athens": "Athens", - "Riga": "Riga", - "Halifax": "Halifax", - "Wiesbaden": "Wiesbaden", - "Florida": "Florida", - "Tallinn": "Tallinn", - "Varna": "Varna", - "Louisville": "Louisville", - "Toronto": "Toronto" + "map-prompt": "Want to appear on our map? Contact us!" } \ No newline at end of file diff --git a/Server/public/locales/ru/countries.json b/Server/public/locales/ru/countries.json index 5cf1964..08eec1d 100644 --- a/Server/public/locales/ru/countries.json +++ b/Server/public/locales/ru/countries.json @@ -15,7 +15,7 @@ "Ohio": "Огайо", "Copenhagen": "Копенгаген", "Kolding": "Колдинг", - "KohtlaJarve": "Кохтла-Ярве", + "Kohtla-Järve": "Кохтла-Ярве", "Athens": "Афины", "Riga": "Рига", "Halifax": "Галифакс", diff --git a/Server/routes.jl b/Server/routes.jl index e964a87..94b5019 100644 --- a/Server/routes.jl +++ b/Server/routes.jl @@ -11,6 +11,10 @@ route("/:locale/join-us/*", BasicController.join_us, named = :join_us) route("/:locale/groups/*", BasicController.groups, named = :groups) +route("/:locale/groups-add/*", BasicController.groups_add, named = :groups_add) + +route("/:locale/groups-add-post/*", BasicController.groups_add_post, method = POST, named = :groups_add_post) + route("/:locale/cooperatives/*", BasicController.cooperatives, named = :cooperatives) route("/:locale/communes/*", BasicController.communes, named = :communes)