(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, w as validate_store, x as component_subscribe, o as onMount, e as globals, y as empty, n as noop, p as detach_dev, A as validate_each_argument, f as element, B as text, h as space, j as add_location, k as attr_dev, u as src_url_equal, z as set_custom_element_data, l as append_dev, C as set_data_dev, D as destroy_each } from './index-998178c7.js'; import { w as writable } from './index-f9998ce7.js'; import { loadLocaleContent, getData } from '../../../../../../../../../js/libraries/serverTools.js'; import { addMarkersEntries, translate } from '../../../../../../../../../js/libraries/mapTools.js'; import { addCoopPinContent } from '../../../../../../../../../js/mapFuncs.js'; import '../../../../../../../../../js/components/map-component.js'; /* src\cooperatives-component.svelte generated by Svelte v3.52.0 */ const { Object: Object_1, console: console_1 } = globals; const file = "src\\cooperatives-component.svelte"; function get_each_context(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[12] = list[i][0]; child_ctx[3] = list[i][1]; return child_ctx; } function get_each_context_1(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[15] = list[i]; return child_ctx; } // (64:4) {#if $loaded==3} function create_if_block(ctx) { let div1; let div0; let h1; let t0_value = /*$content*/ ctx[1].cooperatives + ""; let t0; let t1; let img; let img_src_value; let t2; let p0; let t3_value = /*$content*/ ctx[1].p1 + ""; let t3; let t4; let h3; let t5_value = /*$content*/ ctx[1].subheading1 + ""; let t5; let t6; let map_component; let map_component_callback_value; let t7; let p1; let t8_value = /*$content*/ ctx[1]["map-prompt"] + ""; let t8; let t9; let each_value = Object.entries(/*entriesByCountry*/ 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() { 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, 66, 16, 2019); 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, 67, 16, 2069); attr_dev(p0, "class", "description"); add_location(p0, file, 68, 16, 2147); add_location(h3, file, 69, 16, 2205); 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, 70, 16, 2254); attr_dev(p1, "id", "add-prompt"); add_location(p1, file, 71, 16, 2377); attr_dev(div0, "id", "text-container"); add_location(div0, file, 65, 12, 1976); attr_dev(div1, "id", "container"); add_location(div1, file, 64, 8, 1942); }, 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*/ 2 && t0_value !== (t0_value = /*$content*/ ctx[1].cooperatives + "")) set_data_dev(t0, t0_value); if (dirty & /*$content*/ 2 && t3_value !== (t3_value = /*$content*/ ctx[1].p1 + "")) set_data_dev(t3, t3_value); if (dirty & /*$content*/ 2 && t5_value !== (t5_value = /*$content*/ ctx[1].subheading1 + "")) set_data_dev(t5, t5_value); if (dirty & /*$content*/ 2 && map_component_callback_value !== (map_component_callback_value = /*func*/ ctx[10])) { set_custom_element_data(map_component, "callback", map_component_callback_value); } if (dirty & /*$content*/ 2 && t8_value !== (t8_value = /*$content*/ ctx[1]["map-prompt"] + "")) set_data_dev(t8, t8_value); if (dirty & /*Object, entriesByCountry, $content, getAddress, console, getCountry*/ 771) { each_value = Object.entries(/*entriesByCountry*/ 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(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: "(64:4) {#if $loaded==3}", ctx }); return block; } // (76:24) {#each entries as entry} function create_each_block_1(ctx) { let t0_value = console.log(/*entry*/ ctx[15]) + ""; let t0; let t1; let div2; let div1; let div0; let p0; let b0; let t2_value = /*$content*/ ctx[1].name + ""; let t2; let t3; let t4_value = /*entry*/ ctx[15].name + ""; let t4; let t5; let p1; let b1; let t6_value = /*$content*/ ctx[1].location + ""; let t6; let t7; let t8_value = /*getAddress*/ ctx[9](/*entry*/ ctx[15]) + ""; let t8; let t9; let p2; let b2; let t10_value = /*$content*/ ctx[1].market + ""; let t10; let t11; let t12_value = /*entry*/ ctx[15].market + ""; let t12; let t13; let p3; let b3; let t14_value = /*$content*/ ctx[1].workers + ""; let t14; let t15; let t16_value = /*entry*/ ctx[15].workers + ""; let t16; let t17; let p4; let b4; let t18_value = /*$content*/ ctx[1].status + ""; let t18; let t19; let t20_value = /*entry*/ ctx[15].status + ""; let t20; let t21; let p5; let b5; let t22_value = /*$content*/ ctx[1].website + ""; let t22; let t23; let a0; let t24_value = /*entry*/ ctx[15].website + ""; let t24; let a0_href_value; let t25; let p6; let b6; let t26_value = /*$content*/ ctx[1].contact + ""; let t26; let t27; let a1; let t28_value = /*entry*/ ctx[15].contact + ""; let t28; let a1_href_value; let t29; let picture; let source0; let source0_srcset_value; let t30; let source1; let source1_srcset_value; let t31; let img; let t32; let p7; let b7; let t33_value = /*$content*/ ctx[1].description + ""; let t33; let t34; let t35_value = /*entry*/ ctx[15].description + ""; let t35; const block = { c: function create() { t0 = text(t0_value); t1 = space(); div2 = element("div"); div1 = element("div"); div0 = element("div"); p0 = element("p"); b0 = element("b"); t2 = text(t2_value); t3 = text(": "); t4 = text(t4_value); t5 = space(); p1 = element("p"); b1 = element("b"); t6 = text(t6_value); t7 = text(": "); t8 = text(t8_value); t9 = space(); p2 = element("p"); b2 = element("b"); t10 = text(t10_value); t11 = text(": "); t12 = text(t12_value); t13 = space(); p3 = element("p"); b3 = element("b"); t14 = text(t14_value); t15 = text(": "); t16 = text(t16_value); t17 = space(); p4 = element("p"); b4 = element("b"); t18 = text(t18_value); t19 = text(": "); t20 = text(t20_value); t21 = space(); p5 = element("p"); b5 = element("b"); t22 = text(t22_value); t23 = text(": "); a0 = element("a"); t24 = text(t24_value); t25 = space(); p6 = element("p"); b6 = element("b"); t26 = text(t26_value); t27 = text(": "); a1 = element("a"); t28 = text(t28_value); t29 = space(); picture = element("picture"); source0 = element("source"); t30 = space(); source1 = element("source"); t31 = space(); img = element("img"); t32 = space(); p7 = element("p"); b7 = element("b"); t33 = text(t33_value); t34 = text(": "); t35 = text(t35_value); add_location(b0, file, 80, 43, 2928); add_location(p0, file, 80, 40, 2925); add_location(b1, file, 81, 43, 3013); add_location(p1, file, 81, 40, 3010); add_location(b2, file, 82, 43, 3109); add_location(p2, file, 82, 40, 3106); add_location(b3, file, 83, 43, 3198); add_location(p3, file, 83, 40, 3195); add_location(b4, file, 84, 43, 3289); add_location(p4, file, 84, 40, 3286); add_location(b5, file, 85, 43, 3378); attr_dev(a0, "href", a0_href_value = /*entry*/ ctx[15].website); attr_dev(a0, "target", "_blank"); attr_dev(a0, "rel", "noreferrer"); add_location(a0, file, 85, 70, 3405); add_location(p5, file, 85, 40, 3375); add_location(b6, file, 86, 43, 3528); attr_dev(a1, "href", a1_href_value = /*entry*/ ctx[15].contact); attr_dev(a1, "target", ";_blank;"); attr_dev(a1, "rel", "noreferrer"); add_location(a1, file, 86, 70, 3555); add_location(p6, file, 86, 40, 3525); add_location(div0, file, 79, 36, 2878); attr_dev(source0, "srcset", source0_srcset_value = "/img/coops/" + /*entry*/ ctx[15].logo + ".webp"); add_location(source0, file, 89, 40, 3766); attr_dev(source1, "srcset", source1_srcset_value = "/img/coops/" + /*entry*/ ctx[15].logo + ".png"); add_location(source1, file, 90, 40, 3858); attr_dev(img, "class", "coop-logo"); attr_dev(img, "alt", "logo"); add_location(img, file, 91, 40, 3949); add_location(picture, file, 88, 36, 3715); attr_dev(div1, "class", "img-general-info"); add_location(div1, file, 78, 32, 2810); add_location(b7, file, 94, 35, 4108); add_location(p7, file, 94, 32, 4105); attr_dev(div2, "class", "location-info"); add_location(div2, file, 77, 28, 2749); }, m: function mount(target, anchor) { insert_dev(target, t0, anchor); insert_dev(target, t1, 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, t2); append_dev(b0, t3); append_dev(p0, t4); append_dev(div0, t5); append_dev(div0, p1); append_dev(p1, b1); append_dev(b1, t6); append_dev(b1, t7); append_dev(p1, t8); append_dev(div0, t9); append_dev(div0, p2); append_dev(p2, b2); append_dev(b2, t10); append_dev(b2, t11); append_dev(p2, t12); append_dev(div0, t13); append_dev(div0, p3); append_dev(p3, b3); append_dev(b3, t14); append_dev(b3, t15); append_dev(p3, t16); append_dev(div0, t17); append_dev(div0, p4); append_dev(p4, b4); append_dev(b4, t18); append_dev(b4, t19); append_dev(p4, t20); append_dev(div0, t21); append_dev(div0, p5); append_dev(p5, b5); append_dev(b5, t22); append_dev(b5, t23); append_dev(p5, a0); append_dev(a0, t24); append_dev(div0, t25); append_dev(div0, p6); append_dev(p6, b6); append_dev(b6, t26); append_dev(b6, t27); append_dev(p6, a1); append_dev(a1, t28); append_dev(div1, t29); append_dev(div1, picture); append_dev(picture, source0); append_dev(picture, t30); append_dev(picture, source1); append_dev(picture, t31); append_dev(picture, img); append_dev(div2, t32); append_dev(div2, p7); append_dev(p7, b7); append_dev(b7, t33); append_dev(b7, t34); append_dev(p7, t35); }, p: function update(ctx, dirty) { if (dirty & /*entriesByCountry*/ 1 && t0_value !== (t0_value = console.log(/*entry*/ ctx[15]) + "")) set_data_dev(t0, t0_value); if (dirty & /*$content*/ 2 && t2_value !== (t2_value = /*$content*/ ctx[1].name + "")) set_data_dev(t2, t2_value); if (dirty & /*entriesByCountry*/ 1 && t4_value !== (t4_value = /*entry*/ ctx[15].name + "")) set_data_dev(t4, t4_value); if (dirty & /*$content*/ 2 && t6_value !== (t6_value = /*$content*/ ctx[1].location + "")) set_data_dev(t6, t6_value); if (dirty & /*entriesByCountry*/ 1 && t8_value !== (t8_value = /*getAddress*/ ctx[9](/*entry*/ ctx[15]) + "")) set_data_dev(t8, t8_value); if (dirty & /*$content*/ 2 && t10_value !== (t10_value = /*$content*/ ctx[1].market + "")) set_data_dev(t10, t10_value); if (dirty & /*entriesByCountry*/ 1 && t12_value !== (t12_value = /*entry*/ ctx[15].market + "")) set_data_dev(t12, t12_value); if (dirty & /*$content*/ 2 && t14_value !== (t14_value = /*$content*/ ctx[1].workers + "")) set_data_dev(t14, t14_value); if (dirty & /*entriesByCountry*/ 1 && t16_value !== (t16_value = /*entry*/ ctx[15].workers + "")) set_data_dev(t16, t16_value); if (dirty & /*$content*/ 2 && t18_value !== (t18_value = /*$content*/ ctx[1].status + "")) set_data_dev(t18, t18_value); if (dirty & /*entriesByCountry*/ 1 && t20_value !== (t20_value = /*entry*/ ctx[15].status + "")) set_data_dev(t20, t20_value); if (dirty & /*$content*/ 2 && t22_value !== (t22_value = /*$content*/ ctx[1].website + "")) set_data_dev(t22, t22_value); if (dirty & /*entriesByCountry*/ 1 && t24_value !== (t24_value = /*entry*/ ctx[15].website + "")) set_data_dev(t24, t24_value); if (dirty & /*entriesByCountry*/ 1 && a0_href_value !== (a0_href_value = /*entry*/ ctx[15].website)) { attr_dev(a0, "href", a0_href_value); } if (dirty & /*$content*/ 2 && t26_value !== (t26_value = /*$content*/ ctx[1].contact + "")) set_data_dev(t26, t26_value); if (dirty & /*entriesByCountry*/ 1 && t28_value !== (t28_value = /*entry*/ ctx[15].contact + "")) set_data_dev(t28, t28_value); if (dirty & /*entriesByCountry*/ 1 && a1_href_value !== (a1_href_value = /*entry*/ ctx[15].contact)) { attr_dev(a1, "href", a1_href_value); } if (dirty & /*entriesByCountry*/ 1 && source0_srcset_value !== (source0_srcset_value = "/img/coops/" + /*entry*/ ctx[15].logo + ".webp")) { attr_dev(source0, "srcset", source0_srcset_value); } if (dirty & /*entriesByCountry*/ 1 && source1_srcset_value !== (source1_srcset_value = "/img/coops/" + /*entry*/ ctx[15].logo + ".png")) { attr_dev(source1, "srcset", source1_srcset_value); } if (dirty & /*$content*/ 2 && t33_value !== (t33_value = /*$content*/ ctx[1].description + "")) set_data_dev(t33, t33_value); if (dirty & /*entriesByCountry*/ 1 && t35_value !== (t35_value = /*entry*/ ctx[15].description + "")) set_data_dev(t35, t35_value); }, d: function destroy(detaching) { if (detaching) detach_dev(t0); if (detaching) detach_dev(t1); if (detaching) detach_dev(div2); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block_1.name, type: "each", source: "(76:24) {#each entries as entry}", ctx }); return block; } // (73:16) {#each Object.entries(entriesByCountry) as [name,entries]} function create_each_block(ctx) { let h4; let t0_value = /*getCountry*/ ctx[8](/*name*/ ctx[12]) + ""; let t0; let t1; let div; let t2; let each_value_1 = /*entries*/ ctx[3]; 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, 73, 20, 2522); attr_dev(div, "class", "country-block"); add_location(div, file, 74, 20, 2592); }, 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 & /*entriesByCountry*/ 1 && t0_value !== (t0_value = /*getCountry*/ ctx[8](/*name*/ ctx[12]) + "")) set_data_dev(t0, t0_value); if (dirty & /*Object, entriesByCountry, $content, getAddress, console*/ 515) { each_value_1 = /*entries*/ ctx[3]; 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: "(73:16) {#each Object.entries(entriesByCountry) as [name,entries]}", ctx }); return block; } // (63:0) {#key $loaded} function create_key_block(ctx) { let if_block_anchor; let if_block = /*$loaded*/ ctx[2] == 3 && 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] == 3) { 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: "(63: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 $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(2, $loaded = value)); let content = writable({}); validate_store(content, 'content'); component_subscribe($$self, content, value => $$invalidate(1, $content = value)); let entries; let entriesByCountry; let locale = loadLocaleContent(content, "cooperatives-component", loaded); loadLocaleContent(content, "countries", loaded); let callback = response => { $$invalidate(3, entries = JSON.parse(response)); $$invalidate(0, entriesByCountry = {}); for (let g of entries) { let country = g.country; if (g.contact == null) { g.contact = "https://discord.gg/Qk8KUk787z"; } if (country in entriesByCountry) { entriesByCountry[country].push(g); } else { $$invalidate(0, entriesByCountry[country] = [g], entriesByCountry); } } loaded.update(val => { return val + 1; }); }; getData("/assets/cooperatives.json", callback); function mapCallback(createMap, content, locale) { let map = createMap([22, 0], 2); addMarkersEntries(entries, entriesByCountry, map, content, locale, addCoopPinContent, "blue"); } function getCountry(x) { return locale == "en" ? x : translate($content, x); } function getAddress(g) { let location = [g.country, g.state, g.town].filter(x => x != null); return location.map(x => locale == "en" ? x : translate($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_1.warn(` was created with unknown prop '${key}'`); }); const func = createMap => mapCallback(createMap, $content, locale); $$self.$capture_state = () => ({ onMount, writable, loadLocaleContent, getData, addMarkersEntries, translate, addCoopPinContent, loaded, content, entries, entriesByCountry, locale, callback, mapCallback, getCountry, getAddress, $content, $loaded }); $$self.$inject_state = $$props => { if ('loaded' in $$props) $$invalidate(4, loaded = $$props.loaded); if ('content' in $$props) $$invalidate(5, content = $$props.content); if ('entries' in $$props) $$invalidate(3, entries = $$props.entries); if ('entriesByCountry' in $$props) $$invalidate(0, entriesByCountry = $$props.entriesByCountry); if ('locale' in $$props) $$invalidate(6, locale = $$props.locale); if ('callback' in $$props) callback = $$props.callback; }; if ($$props && "$$inject" in $$props) { $$self.$inject_state($$props.$$inject); } return [ entriesByCountry, $content, $loaded, entries, loaded, content, locale, mapCallback, 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 };