From 77bc1a9a43fff4770019b82329762bc71729a57d Mon Sep 17 00:00:00 2001 From: lesion Date: Thu, 13 Apr 2023 22:17:56 +0200 Subject: [PATCH] rebuild webcomponent --- assets/gancio-events.es.js | 1646 +++++++++------------------- docs/assets/js/gancio-events.es.js | 618 ++++++----- package.json | 2 +- static/gancio-events.es.js | 618 ++++++----- wp-plugin/js/gancio-events.es.js | 618 ++++++----- wp-plugin/js/gancio-events.js | 699 ++++++++++++ 6 files changed, 2196 insertions(+), 2005 deletions(-) create mode 100644 wp-plugin/js/gancio-events.js diff --git a/assets/gancio-events.es.js b/assets/gancio-events.es.js index c1fe9753..de0e2357 100644 --- a/assets/gancio-events.es.js +++ b/assets/gancio-events.es.js @@ -1,943 +1,522 @@ -function noop() { +function G() { } -function run(fn) { - return fn(); +function W(t) { + return t(); } -function blank_object() { +function Y() { return /* @__PURE__ */ Object.create(null); } -function run_all(fns) { - fns.forEach(run); +function U(t) { + t.forEach(W); } -function is_function(thing) { - return typeof thing === "function"; +function ge(t) { + return typeof t == "function"; } -function safe_not_equal(a, b) { - return a != a ? b == b : a !== b || (a && typeof a === "object" || typeof a === "function"); +function _e(t, e) { + return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function"; } -let src_url_equal_anchor; -function src_url_equal(element_src, url) { - if (!src_url_equal_anchor) { - src_url_equal_anchor = document.createElement("a"); - } - src_url_equal_anchor.href = url; - return element_src === src_url_equal_anchor.href; +let B; +function H(t, e) { + return B || (B = document.createElement("a")), B.href = e, t === B.href; } -function is_empty(obj) { - return Object.keys(obj).length === 0; +function ye(t) { + return Object.keys(t).length === 0; } -function append(target, node) { - target.appendChild(node); +function u(t, e) { + t.appendChild(e); } -function insert(target, node, anchor) { - target.insertBefore(node, anchor || null); +function p(t, e, i) { + t.insertBefore(e, i || null); } -function detach(node) { - node.parentNode.removeChild(node); +function k(t) { + t.parentNode.removeChild(t); } -function destroy_each(iterations, detaching) { - for (let i = 0; i < iterations.length; i += 1) { - if (iterations[i]) - iterations[i].d(detaching); - } +function be(t, e) { + for (let i = 0; i < t.length; i += 1) + t[i] && t[i].d(e); } -function element(name) { - return document.createElement(name); +function m(t) { + return document.createElement(t); } -function text(data) { - return document.createTextNode(data); +function $(t) { + return document.createTextNode(t); } -function space() { - return text(" "); +function M() { + return $(" "); } -function empty() { - return text(""); +function pe() { + return $(""); } -function attr(node, attribute, value) { - if (value == null) - node.removeAttribute(attribute); - else if (node.getAttribute(attribute) !== value) - node.setAttribute(attribute, value); +function a(t, e, i) { + i == null ? t.removeAttribute(e) : t.getAttribute(e) !== i && t.setAttribute(e, i); } -function children(element2) { - return Array.from(element2.childNodes); +function xe(t) { + return Array.from(t.childNodes); } -function set_data(text2, data) { - data = "" + data; - if (text2.wholeText !== data) - text2.data = data; +function T(t, e) { + e = "" + e, t.wholeText !== e && (t.data = e); } -function toggle_class(element2, name, toggle) { - element2.classList[toggle ? "add" : "remove"](name); +function L(t, e, i) { + t.classList[i ? "add" : "remove"](e); } -function attribute_to_object(attributes) { - const result = {}; - for (const attribute of attributes) { - result[attribute.name] = attribute.value; - } - return result; +function ve(t) { + const e = {}; + for (const i of t) + e[i.name] = i.value; + return e; } -let current_component; -function set_current_component(component) { - current_component = component; +let O; +function I(t) { + O = t; } -function get_current_component() { - if (!current_component) +function $e() { + if (!O) throw new Error("Function called outside component initialization"); - return current_component; + return O; } -function onMount(fn) { - get_current_component().$$.on_mount.push(fn); +function ke(t) { + $e().$$.on_mount.push(t); } -const dirty_components = []; -const binding_callbacks = []; -const render_callbacks = []; -const flush_callbacks = []; -const resolved_promise = Promise.resolve(); -let update_scheduled = false; -function schedule_update() { - if (!update_scheduled) { - update_scheduled = true; - resolved_promise.then(flush); - } +const R = [], Z = [], P = [], ee = [], Ee = Promise.resolve(); +let K = !1; +function je() { + K || (K = !0, Ee.then(x)); } -function add_render_callback(fn) { - render_callbacks.push(fn); +function Q(t) { + P.push(t); } -const seen_callbacks = /* @__PURE__ */ new Set(); -let flushidx = 0; -function flush() { - const saved_component = current_component; +const J = /* @__PURE__ */ new Set(); +let D = 0; +function x() { + const t = O; do { - while (flushidx < dirty_components.length) { - const component = dirty_components[flushidx]; - flushidx++; - set_current_component(component); - update(component.$$); + for (; D < R.length; ) { + const e = R[D]; + D++, I(e), Se(e.$$); } - set_current_component(null); - dirty_components.length = 0; - flushidx = 0; - while (binding_callbacks.length) - binding_callbacks.pop()(); - for (let i = 0; i < render_callbacks.length; i += 1) { - const callback = render_callbacks[i]; - if (!seen_callbacks.has(callback)) { - seen_callbacks.add(callback); - callback(); - } + for (I(null), R.length = 0, D = 0; Z.length; ) + Z.pop()(); + for (let e = 0; e < P.length; e += 1) { + const i = P[e]; + J.has(i) || (J.add(i), i()); } - render_callbacks.length = 0; - } while (dirty_components.length); - while (flush_callbacks.length) { - flush_callbacks.pop()(); - } - update_scheduled = false; - seen_callbacks.clear(); - set_current_component(saved_component); + P.length = 0; + } while (R.length); + for (; ee.length; ) + ee.pop()(); + K = !1, J.clear(), I(t); } -function update($$) { - if ($$.fragment !== null) { - $$.update(); - run_all($$.before_update); - const dirty = $$.dirty; - $$.dirty = [-1]; - $$.fragment && $$.fragment.p($$.ctx, dirty); - $$.after_update.forEach(add_render_callback); +function Se(t) { + if (t.fragment !== null) { + t.update(), U(t.before_update); + const e = t.dirty; + t.dirty = [-1], t.fragment && t.fragment.p(t.ctx, e), t.after_update.forEach(Q); } } -const outroing = /* @__PURE__ */ new Set(); -function transition_in(block, local) { - if (block && block.i) { - outroing.delete(block); - block.i(local); - } +const ze = /* @__PURE__ */ new Set(); +function Ce(t, e) { + t && t.i && (ze.delete(t), t.i(e)); } -function mount_component(component, target, anchor, customElement) { - const { fragment, on_mount, on_destroy, after_update } = component.$$; - fragment && fragment.m(target, anchor); - if (!customElement) { - add_render_callback(() => { - const new_on_destroy = on_mount.map(run).filter(is_function); - if (on_destroy) { - on_destroy.push(...new_on_destroy); - } else { - run_all(new_on_destroy); - } - component.$$.on_mount = []; - }); - } - after_update.forEach(add_render_callback); +function Ae(t, e, i, l) { + const { fragment: n, on_mount: r, on_destroy: o, after_update: f } = t.$$; + n && n.m(e, i), l || Q(() => { + const c = r.map(W).filter(ge); + o ? o.push(...c) : U(c), t.$$.on_mount = []; + }), f.forEach(Q); } -function destroy_component(component, detaching) { - const $$ = component.$$; - if ($$.fragment !== null) { - run_all($$.on_destroy); - $$.fragment && $$.fragment.d(detaching); - $$.on_destroy = $$.fragment = null; - $$.ctx = []; - } +function Me(t, e) { + const i = t.$$; + i.fragment !== null && (U(i.on_destroy), i.fragment && i.fragment.d(e), i.on_destroy = i.fragment = null, i.ctx = []); } -function make_dirty(component, i) { - if (component.$$.dirty[0] === -1) { - dirty_components.push(component); - schedule_update(); - component.$$.dirty.fill(0); - } - component.$$.dirty[i / 31 | 0] |= 1 << i % 31; +function Ne(t, e) { + t.$$.dirty[0] === -1 && (R.push(t), je(), t.$$.dirty.fill(0)), t.$$.dirty[e / 31 | 0] |= 1 << e % 31; } -function init(component, options, instance2, create_fragment2, not_equal, props, append_styles, dirty = [-1]) { - const parent_component = current_component; - set_current_component(component); - const $$ = component.$$ = { +function we(t, e, i, l, n, r, o, f = [-1]) { + const c = O; + I(t); + const s = t.$$ = { fragment: null, ctx: null, - props, - update: noop, - not_equal, - bound: blank_object(), + props: r, + update: G, + not_equal: n, + bound: Y(), on_mount: [], on_destroy: [], on_disconnect: [], before_update: [], after_update: [], - context: new Map(options.context || (parent_component ? parent_component.$$.context : [])), - callbacks: blank_object(), - dirty, - skip_bound: false, - root: options.target || parent_component.$$.root + context: new Map(e.context || (c ? c.$$.context : [])), + callbacks: Y(), + dirty: f, + skip_bound: !1, + root: e.target || c.$$.root }; - append_styles && append_styles($$.root); - let ready = false; - $$.ctx = instance2 ? instance2(component, options.props || {}, (i, ret, ...rest) => { - const value = rest.length ? rest[0] : ret; - if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { - if (!$$.skip_bound && $$.bound[i]) - $$.bound[i](value); - if (ready) - make_dirty(component, i); - } - return ret; - }) : []; - $$.update(); - ready = true; - run_all($$.before_update); - $$.fragment = create_fragment2 ? create_fragment2($$.ctx) : false; - if (options.target) { - if (options.hydrate) { - const nodes = children(options.target); - $$.fragment && $$.fragment.l(nodes); - nodes.forEach(detach); - } else { - $$.fragment && $$.fragment.c(); - } - if (options.intro) - transition_in(component.$$.fragment); - mount_component(component, options.target, options.anchor, options.customElement); - flush(); + o && o(s.root); + let w = !1; + if (s.ctx = i ? i(t, e.props || {}, (g, _, ...A) => { + const y = A.length ? A[0] : _; + return s.ctx && n(s.ctx[g], s.ctx[g] = y) && (!s.skip_bound && s.bound[g] && s.bound[g](y), w && Ne(t, g)), _; + }) : [], s.update(), w = !0, U(s.before_update), s.fragment = l ? l(s.ctx) : !1, e.target) { + if (e.hydrate) { + const g = xe(e.target); + s.fragment && s.fragment.l(g), g.forEach(k); + } else + s.fragment && s.fragment.c(); + e.intro && Ce(t.$$.fragment), Ae(t, e.target, e.anchor, e.customElement), x(); } - set_current_component(parent_component); + I(c); } -let SvelteElement; -if (typeof HTMLElement === "function") { - SvelteElement = class extends HTMLElement { - constructor() { - super(); - this.attachShadow({ mode: "open" }); - } - connectedCallback() { - const { on_mount } = this.$$; - this.$$.on_disconnect = on_mount.map(run).filter(is_function); - for (const key in this.$$.slotted) { - this.appendChild(this.$$.slotted[key]); - } - } - attributeChangedCallback(attr2, _oldValue, newValue) { - this[attr2] = newValue; - } - disconnectedCallback() { - run_all(this.$$.on_disconnect); - } - $destroy() { - destroy_component(this, 1); - this.$destroy = noop; - } - $on(type, callback) { - const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []); - callbacks.push(callback); - return () => { - const index = callbacks.indexOf(callback); - if (index !== -1) - callbacks.splice(index, 1); - }; - } - $set($$props) { - if (this.$$set && !is_empty($$props)) { - this.$$.skip_bound = true; - this.$$set($$props); - this.$$.skip_bound = false; - } - } - }; -} -function get_each_context(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[12] = list[i]; - return child_ctx; -} -function get_each_context_1(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[15] = list[i]; - return child_ctx; -} -function create_if_block_5(ctx) { - let link; - return { - c() { - link = element("link"); - attr(link, "rel", "stylesheet"); - attr(link, "href", ctx[4]); - }, - m(target, anchor) { - insert(target, link, anchor); - }, - p(ctx2, dirty) { - if (dirty & 16) { - attr(link, "href", ctx2[4]); - } - }, - d(detaching) { - if (detaching) - detach(link); - } - }; -} -function create_if_block$1(ctx) { - let div; - let t; - let if_block = ctx[1] && ctx[3] === "true" && create_if_block_4(ctx); - let each_value = ctx[5]; - 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)); +let X; +typeof HTMLElement == "function" && (X = class extends HTMLElement { + constructor() { + super(), this.attachShadow({ mode: "open" }); } - return { - c() { - div = element("div"); - if (if_block) - if_block.c(); - t = space(); - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - attr(div, "id", "gancioEvents"); - toggle_class(div, "dark", ctx[2] === "dark"); - toggle_class(div, "light", ctx[2] === "light"); - toggle_class(div, "sidebar", ctx[3] === "true"); - toggle_class(div, "nosidebar", ctx[3] !== "true"); - }, - m(target, anchor) { - insert(target, div, anchor); - if (if_block) - if_block.m(div, null); - append(div, t); - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(div, null); - } - }, - p(ctx2, dirty) { - if (ctx2[1] && ctx2[3] === "true") { - if (if_block) { - if_block.p(ctx2, dirty); - } else { - if_block = create_if_block_4(ctx2); - if_block.c(); - if_block.m(div, t); - } - } else if (if_block) { - if_block.d(1); - if_block = null; - } - if (dirty & 41) { - each_value = ctx2[5]; - let i; - for (i = 0; i < each_value.length; i += 1) { - const child_ctx = get_each_context(ctx2, 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; - } - if (dirty & 4) { - toggle_class(div, "dark", ctx2[2] === "dark"); - } - if (dirty & 4) { - toggle_class(div, "light", ctx2[2] === "light"); - } - if (dirty & 8) { - toggle_class(div, "sidebar", ctx2[3] === "true"); - } - if (dirty & 8) { - toggle_class(div, "nosidebar", ctx2[3] !== "true"); - } - }, - d(detaching) { - if (detaching) - detach(div); - if (if_block) - if_block.d(); - destroy_each(each_blocks, detaching); - } - }; -} -function create_if_block_4(ctx) { - let a; - let div1; - let div0; - let t0; - let t1; - let img; - let img_src_value; - return { - c() { - a = element("a"); - div1 = element("div"); - div0 = element("div"); - t0 = text(ctx[1]); - t1 = space(); - img = element("img"); - attr(div0, "class", "title"); - attr(img, "id", "logo"); - attr(img, "alt", "logo"); - if (!src_url_equal(img.src, img_src_value = ctx[0] + "/logo.png")) - attr(img, "src", img_src_value); - attr(div1, "class", "content"); - attr(a, "href", ctx[0]); - attr(a, "target", "_blank"); - attr(a, "id", "header"); - }, - m(target, anchor) { - insert(target, a, anchor); - append(a, div1); - append(div1, div0); - append(div0, t0); - append(div1, t1); - append(div1, img); - }, - p(ctx2, dirty) { - if (dirty & 2) - set_data(t0, ctx2[1]); - if (dirty & 1 && !src_url_equal(img.src, img_src_value = ctx2[0] + "/logo.png")) { - attr(img, "src", img_src_value); - } - if (dirty & 1) { - attr(a, "href", ctx2[0]); - } - }, - d(detaching) { - if (detaching) - detach(a); - } - }; -} -function create_if_block_2(ctx) { - let div; - function select_block_type(ctx2, dirty) { - if (ctx2[12].media.length) - return create_if_block_3; - return create_else_block; + connectedCallback() { + const { on_mount: t } = this.$$; + this.$$.on_disconnect = t.map(W).filter(ge); + for (const e in this.$$.slotted) + this.appendChild(this.$$.slotted[e]); } - let current_block_type = select_block_type(ctx); - let if_block = current_block_type(ctx); - return { - c() { - div = element("div"); - if_block.c(); - attr(div, "class", "img"); - }, - m(target, anchor) { - insert(target, div, anchor); - if_block.m(div, null); - }, - p(ctx2, dirty) { - if (current_block_type === (current_block_type = select_block_type(ctx2)) && if_block) { - if_block.p(ctx2, dirty); - } else { - if_block.d(1); - if_block = current_block_type(ctx2); - if (if_block) { - if_block.c(); - if_block.m(div, null); - } - } - }, - d(detaching) { - if (detaching) - detach(div); - if_block.d(); - } - }; -} -function create_else_block(ctx) { - let img; - let img_alt_value; - let img_src_value; - return { - c() { - img = element("img"); - attr(img, "style", "aspect-ratio=1.7778;"); - attr(img, "alt", img_alt_value = ctx[12].title); - if (!src_url_equal(img.src, img_src_value = ctx[0] + "/noimg.svg")) - attr(img, "src", img_src_value); - attr(img, "loading", "lazy"); - }, - m(target, anchor) { - insert(target, img, anchor); - }, - p(ctx2, dirty) { - if (dirty & 32 && img_alt_value !== (img_alt_value = ctx2[12].title)) { - attr(img, "alt", img_alt_value); - } - if (dirty & 1 && !src_url_equal(img.src, img_src_value = ctx2[0] + "/noimg.svg")) { - attr(img, "src", img_src_value); - } - }, - d(detaching) { - if (detaching) - detach(img); - } - }; -} -function create_if_block_3(ctx) { - let img; - let img_style_value; - let img_alt_value; - let img_src_value; - return { - c() { - img = element("img"); - attr(img, "style", img_style_value = "object-position: " + position$1(ctx[12]) + "; aspect-ratio=1.7778;"); - attr(img, "alt", img_alt_value = ctx[12].media[0].name); - if (!src_url_equal(img.src, img_src_value = ctx[0] + "/media/thumb/" + ctx[12].media[0].url)) - attr(img, "src", img_src_value); - attr(img, "loading", "lazy"); - }, - m(target, anchor) { - insert(target, img, anchor); - }, - p(ctx2, dirty) { - if (dirty & 32 && img_style_value !== (img_style_value = "object-position: " + position$1(ctx2[12]) + "; aspect-ratio=1.7778;")) { - attr(img, "style", img_style_value); - } - if (dirty & 32 && img_alt_value !== (img_alt_value = ctx2[12].media[0].name)) { - attr(img, "alt", img_alt_value); - } - if (dirty & 33 && !src_url_equal(img.src, img_src_value = ctx2[0] + "/media/thumb/" + ctx2[12].media[0].url)) { - attr(img, "src", img_src_value); - } - }, - d(detaching) { - if (detaching) - detach(img); - } - }; -} -function create_if_block_1$1(ctx) { - let div; - let each_value_1 = ctx[12].tags; - 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)); + attributeChangedCallback(t, e, i) { + this[t] = i; } - return { - c() { - div = element("div"); - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - attr(div, "class", "tags"); - }, - m(target, anchor) { - insert(target, div, anchor); - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(div, null); - } - }, - p(ctx2, dirty) { - if (dirty & 32) { - each_value_1 = ctx2[12].tags; - let i; - for (i = 0; i < each_value_1.length; i += 1) { - const child_ctx = get_each_context_1(ctx2, 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, null); - } - } - for (; i < each_blocks.length; i += 1) { - each_blocks[i].d(1); - } - each_blocks.length = each_value_1.length; - } - }, - d(detaching) { - if (detaching) - detach(div); - destroy_each(each_blocks, detaching); - } - }; -} -function create_each_block_1(ctx) { - let span; - let t0; - let t1_value = ctx[15] + ""; - let t1; - return { - c() { - span = element("span"); - t0 = text("#"); - t1 = text(t1_value); - attr(span, "class", "tag"); - }, - m(target, anchor) { - insert(target, span, anchor); - append(span, t0); - append(span, t1); - }, - p(ctx2, dirty) { - if (dirty & 32 && t1_value !== (t1_value = ctx2[15] + "")) - set_data(t1, t1_value); - }, - d(detaching) { - if (detaching) - detach(span); - } - }; -} -function create_each_block(ctx) { - let a; - let t0; - let div2; - let div0; - let t1_value = when$1(ctx[12].start_datetime) + ""; - let t1; - let t2; - let div1; - let t3_value = ctx[12].title + ""; - let t3; - let t4; - let span1; - let t5; - let t6_value = ctx[12].place.name + ""; - let t6; - let t7; - let span0; - let t8_value = ctx[12].place.address + ""; - let t8; - let t9; - let t10; - let a_href_value; - let a_title_value; - let if_block0 = ctx[3] !== "true" && create_if_block_2(ctx); - let if_block1 = ctx[12].tags.length && create_if_block_1$1(ctx); - return { - c() { - a = element("a"); - if (if_block0) - if_block0.c(); - t0 = space(); - div2 = element("div"); - div0 = element("div"); - t1 = text(t1_value); - t2 = space(); - div1 = element("div"); - t3 = text(t3_value); - t4 = space(); - span1 = element("span"); - t5 = text("@"); - t6 = text(t6_value); - t7 = space(); - span0 = element("span"); - t8 = text(t8_value); - t9 = space(); - if (if_block1) - if_block1.c(); - t10 = space(); - attr(div0, "class", "subtitle"); - attr(div1, "class", "title"); - attr(span0, "class", "subtitle"); - attr(span1, "class", "place"); - attr(div2, "class", "content"); - attr(a, "href", a_href_value = ctx[0] + "/event/" + (ctx[12].slug || ctx[12].id)); - attr(a, "class", "event"); - attr(a, "title", a_title_value = ctx[12].title); - attr(a, "target", "_blank"); - }, - m(target, anchor) { - insert(target, a, anchor); - if (if_block0) - if_block0.m(a, null); - append(a, t0); - append(a, div2); - append(div2, div0); - append(div0, t1); - append(div2, t2); - append(div2, div1); - append(div1, t3); - append(div2, t4); - append(div2, span1); - append(span1, t5); - append(span1, t6); - append(span1, t7); - append(span1, span0); - append(span0, t8); - append(div2, t9); - if (if_block1) - if_block1.m(div2, null); - append(a, t10); - }, - p(ctx2, dirty) { - if (ctx2[3] !== "true") { - if (if_block0) { - if_block0.p(ctx2, dirty); - } else { - if_block0 = create_if_block_2(ctx2); - if_block0.c(); - if_block0.m(a, t0); - } - } else if (if_block0) { - if_block0.d(1); - if_block0 = null; - } - if (dirty & 32 && t1_value !== (t1_value = when$1(ctx2[12].start_datetime) + "")) - set_data(t1, t1_value); - if (dirty & 32 && t3_value !== (t3_value = ctx2[12].title + "")) - set_data(t3, t3_value); - if (dirty & 32 && t6_value !== (t6_value = ctx2[12].place.name + "")) - set_data(t6, t6_value); - if (dirty & 32 && t8_value !== (t8_value = ctx2[12].place.address + "")) - set_data(t8, t8_value); - if (ctx2[12].tags.length) { - if (if_block1) { - if_block1.p(ctx2, dirty); - } else { - if_block1 = create_if_block_1$1(ctx2); - if_block1.c(); - if_block1.m(div2, null); - } - } else if (if_block1) { - if_block1.d(1); - if_block1 = null; - } - if (dirty & 33 && a_href_value !== (a_href_value = ctx2[0] + "/event/" + (ctx2[12].slug || ctx2[12].id))) { - attr(a, "href", a_href_value); - } - if (dirty & 32 && a_title_value !== (a_title_value = ctx2[12].title)) { - attr(a, "title", a_title_value); - } - }, - d(detaching) { - if (detaching) - detach(a); - if (if_block0) - if_block0.d(); - if (if_block1) - if_block1.d(); - } - }; -} -function create_fragment$1(ctx) { - let t; - let if_block1_anchor; - let if_block0 = ctx[4] && create_if_block_5(ctx); - let if_block1 = ctx[5].length && create_if_block$1(ctx); - return { - c() { - if (if_block0) - if_block0.c(); - t = space(); - if (if_block1) - if_block1.c(); - if_block1_anchor = empty(); - this.c = noop; - }, - m(target, anchor) { - if (if_block0) - if_block0.m(target, anchor); - insert(target, t, anchor); - if (if_block1) - if_block1.m(target, anchor); - insert(target, if_block1_anchor, anchor); - }, - p(ctx2, [dirty]) { - if (ctx2[4]) { - if (if_block0) { - if_block0.p(ctx2, dirty); - } else { - if_block0 = create_if_block_5(ctx2); - if_block0.c(); - if_block0.m(t.parentNode, t); - } - } else if (if_block0) { - if_block0.d(1); - if_block0 = null; - } - if (ctx2[5].length) { - if (if_block1) { - if_block1.p(ctx2, dirty); - } else { - if_block1 = create_if_block$1(ctx2); - if_block1.c(); - if_block1.m(if_block1_anchor.parentNode, if_block1_anchor); - } - } else if (if_block1) { - if_block1.d(1); - if_block1 = null; - } - }, - i: noop, - o: noop, - d(detaching) { - if (if_block0) - if_block0.d(detaching); - if (detaching) - detach(t); - if (if_block1) - if_block1.d(detaching); - if (detaching) - detach(if_block1_anchor); - } - }; -} -function position$1(event) { - if (event.media[0].focalpoint) { - const focalpoint = event.media[0].focalpoint; - return `${(focalpoint[0] + 1) * 50}% ${(focalpoint[1] + 1) * 50}%`; + disconnectedCallback() { + U(this.$$.on_disconnect); } - return "center center"; -} -function when$1(timestamp) { - return new Date(timestamp * 1e3).toLocaleDateString(void 0, { + $destroy() { + Me(this, 1), this.$destroy = G; + } + $on(t, e) { + const i = this.$$.callbacks[t] || (this.$$.callbacks[t] = []); + return i.push(e), () => { + const l = i.indexOf(e); + l !== -1 && i.splice(l, 1); + }; + } + $set(t) { + this.$$set && !ye(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1); + } +}); +function F(t, e = "long") { + const i = e === "long" ? { weekday: "long", month: "long", day: "numeric", hour: "2-digit", minute: "2-digit" - }); + } : { hour: "2-digit", minute: "2-digit" }; + return new Date(t * 1e3).toLocaleString(void 0, i); } -function instance$1($$self, $$props, $$invalidate) { - let { baseurl = "" } = $$props; - let { title = "" } = $$props; - let { maxlength = false } = $$props; - let { tags = "" } = $$props; - let { places = "" } = $$props; - let { theme = "light" } = $$props; - let { show_recurrent = false } = $$props; - let { sidebar = "true" } = $$props; - let { external_style = "" } = $$props; - let mounted = false; - let events = []; - function update2(v) { - if (!mounted) +function V(t) { + return t.multidate ? F(t.start_datetime) + " - " + F(t.end_datetime) : F(t.start_datetime) + (t.end_datetime ? "-" + F(t.end_datetime, "short") : ""); +} +function te(t, e, i) { + const l = t.slice(); + return l[12] = e[i], l; +} +function ie(t, e, i) { + const l = t.slice(); + return l[15] = e[i], l; +} +function le(t) { + let e; + return { + c() { + e = m("link"), a(e, "rel", "stylesheet"), a(e, "href", t[4]); + }, + m(i, l) { + p(i, e, l); + }, + p(i, l) { + l & 16 && a(e, "href", i[4]); + }, + d(i) { + i && k(e); + } + }; +} +function ne(t) { + let e, i, l = t[1] && t[3] === "true" && re(t), n = t[5], r = []; + for (let o = 0; o < n.length; o += 1) + r[o] = fe(te(t, n, o)); + return { + c() { + e = m("div"), l && l.c(), i = M(); + for (let o = 0; o < r.length; o += 1) + r[o].c(); + a(e, "id", "gancioEvents"), L(e, "dark", t[2] === "dark"), L(e, "light", t[2] === "light"), L(e, "sidebar", t[3] === "true"), L(e, "nosidebar", t[3] !== "true"); + }, + m(o, f) { + p(o, e, f), l && l.m(e, null), u(e, i); + for (let c = 0; c < r.length; c += 1) + r[c].m(e, null); + }, + p(o, f) { + if (o[1] && o[3] === "true" ? l ? l.p(o, f) : (l = re(o), l.c(), l.m(e, i)) : l && (l.d(1), l = null), f & 41) { + n = o[5]; + let c; + for (c = 0; c < n.length; c += 1) { + const s = te(o, n, c); + r[c] ? r[c].p(s, f) : (r[c] = fe(s), r[c].c(), r[c].m(e, null)); + } + for (; c < r.length; c += 1) + r[c].d(1); + r.length = n.length; + } + f & 4 && L(e, "dark", o[2] === "dark"), f & 4 && L(e, "light", o[2] === "light"), f & 8 && L(e, "sidebar", o[3] === "true"), f & 8 && L(e, "nosidebar", o[3] !== "true"); + }, + d(o) { + o && k(e), l && l.d(), be(r, o); + } + }; +} +function re(t) { + let e, i, l, n, r, o, f; + return { + c() { + e = m("a"), i = m("div"), l = m("div"), n = $(t[1]), r = M(), o = m("img"), a(l, "class", "title"), a(o, "id", "logo"), a(o, "alt", "logo"), H(o.src, f = t[0] + "/logo.png") || a(o, "src", f), a(i, "class", "content"), a(e, "href", t[0]), a(e, "target", "_blank"), a(e, "id", "header"); + }, + m(c, s) { + p(c, e, s), u(e, i), u(i, l), u(l, n), u(i, r), u(i, o); + }, + p(c, s) { + s & 2 && T(n, c[1]), s & 1 && !H(o.src, f = c[0] + "/logo.png") && a(o, "src", f), s & 1 && a(e, "href", c[0]); + }, + d(c) { + c && k(e); + } + }; +} +function oe(t) { + let e; + function i(r, o) { + return r[12].media.length ? Le : Te; + } + let l = i(t), n = l(t); + return { + c() { + e = m("div"), n.c(), a(e, "class", "img"); + }, + m(r, o) { + p(r, e, o), n.m(e, null); + }, + p(r, o) { + l === (l = i(r)) && n ? n.p(r, o) : (n.d(1), n = l(r), n && (n.c(), n.m(e, null))); + }, + d(r) { + r && k(e), n.d(); + } + }; +} +function Te(t) { + let e, i, l; + return { + c() { + e = m("img"), a(e, "style", "aspect-ratio=1.7778;"), a(e, "alt", i = t[12].title), H(e.src, l = t[0] + "/fallbackimage.png") || a(e, "src", l), a(e, "loading", "lazy"); + }, + m(n, r) { + p(n, e, r); + }, + p(n, r) { + r & 32 && i !== (i = n[12].title) && a(e, "alt", i), r & 1 && !H(e.src, l = n[0] + "/fallbackimage.png") && a(e, "src", l); + }, + d(n) { + n && k(e); + } + }; +} +function Le(t) { + let e, i, l, n; + return { + c() { + e = m("img"), a(e, "style", i = "object-position: " + ue(t[12]) + "; aspect-ratio=1.7778;"), a(e, "alt", l = t[12].media[0].name), H(e.src, n = t[0] + "/media/thumb/" + t[12].media[0].url) || a(e, "src", n), a(e, "loading", "lazy"); + }, + m(r, o) { + p(r, e, o); + }, + p(r, o) { + o & 32 && i !== (i = "object-position: " + ue(r[12]) + "; aspect-ratio=1.7778;") && a(e, "style", i), o & 32 && l !== (l = r[12].media[0].name) && a(e, "alt", l), o & 33 && !H(e.src, n = r[0] + "/media/thumb/" + r[12].media[0].url) && a(e, "src", n); + }, + d(r) { + r && k(e); + } + }; +} +function ae(t) { + let e, i = t[12].place.address + "", l; + return { + c() { + e = m("span"), l = $(i), a(e, "class", "subtitle"); + }, + m(n, r) { + p(n, e, r), u(e, l); + }, + p(n, r) { + r & 32 && i !== (i = n[12].place.address + "") && T(l, i); + }, + d(n) { + n && k(e); + } + }; +} +function se(t) { + let e, i = t[12].tags, l = []; + for (let n = 0; n < i.length; n += 1) + l[n] = ce(ie(t, i, n)); + return { + c() { + e = m("div"); + for (let n = 0; n < l.length; n += 1) + l[n].c(); + a(e, "class", "tags"); + }, + m(n, r) { + p(n, e, r); + for (let o = 0; o < l.length; o += 1) + l[o].m(e, null); + }, + p(n, r) { + if (r & 32) { + i = n[12].tags; + let o; + for (o = 0; o < i.length; o += 1) { + const f = ie(n, i, o); + l[o] ? l[o].p(f, r) : (l[o] = ce(f), l[o].c(), l[o].m(e, null)); + } + for (; o < l.length; o += 1) + l[o].d(1); + l.length = i.length; + } + }, + d(n) { + n && k(e), be(l, n); + } + }; +} +function ce(t) { + let e, i, l = t[15] + "", n; + return { + c() { + e = m("span"), i = $("#"), n = $(l), a(e, "class", "tag"); + }, + m(r, o) { + p(r, e, o), u(e, i), u(e, n); + }, + p(r, o) { + o & 32 && l !== (l = r[15] + "") && T(n, l); + }, + d(r) { + r && k(e); + } + }; +} +function fe(t) { + let e, i, l, n, r = V(t[12]) + "", o, f, c, s = t[12].title + "", w, g, _, A, y = t[12].place.name + "", d, z, h, v, C, q, E = t[3] !== "true" && oe(t), j = t[12].place.name !== "online" && ae(t), S = t[12].tags.length && se(t); + return { + c() { + e = m("a"), E && E.c(), i = M(), l = m("div"), n = m("div"), o = $(r), f = M(), c = m("div"), w = $(s), g = M(), _ = m("span"), A = $('@"'), d = $(y), z = $(`" + `), j && j.c(), h = M(), S && S.c(), v = M(), a(n, "class", "subtitle"), a(c, "class", "title"), a(_, "class", "place"), a(l, "class", "content"), a(e, "href", C = t[0] + "/event/" + (t[12].slug || t[12].id)), a(e, "class", "event"), a(e, "title", q = t[12].title), a(e, "target", "_blank"); + }, + m(b, N) { + p(b, e, N), E && E.m(e, null), u(e, i), u(e, l), u(l, n), u(n, o), u(l, f), u(l, c), u(c, w), u(l, g), u(l, _), u(_, A), u(_, d), u(_, z), j && j.m(_, null), u(l, h), S && S.m(l, null), u(e, v); + }, + p(b, N) { + b[3] !== "true" ? E ? E.p(b, N) : (E = oe(b), E.c(), E.m(e, i)) : E && (E.d(1), E = null), N & 32 && r !== (r = V(b[12]) + "") && T(o, r), N & 32 && s !== (s = b[12].title + "") && T(w, s), N & 32 && y !== (y = b[12].place.name + "") && T(d, y), b[12].place.name !== "online" ? j ? j.p(b, N) : (j = ae(b), j.c(), j.m(_, null)) : j && (j.d(1), j = null), b[12].tags.length ? S ? S.p(b, N) : (S = se(b), S.c(), S.m(l, null)) : S && (S.d(1), S = null), N & 33 && C !== (C = b[0] + "/event/" + (b[12].slug || b[12].id)) && a(e, "href", C), N & 32 && q !== (q = b[12].title) && a(e, "title", q); + }, + d(b) { + b && k(e), E && E.d(), j && j.d(), S && S.d(); + } + }; +} +function Ge(t) { + let e, i, l = t[4] && le(t), n = t[5].length && ne(t); + return { + c() { + l && l.c(), e = M(), n && n.c(), i = pe(), this.c = G; + }, + m(r, o) { + l && l.m(r, o), p(r, e, o), n && n.m(r, o), p(r, i, o); + }, + p(r, [o]) { + r[4] ? l ? l.p(r, o) : (l = le(r), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null), r[5].length ? n ? n.p(r, o) : (n = ne(r), n.c(), n.m(i.parentNode, i)) : n && (n.d(1), n = null); + }, + i: G, + o: G, + d(r) { + l && l.d(r), r && k(e), n && n.d(r), r && k(i); + } + }; +} +function ue(t) { + if (t.media && t.media[0].focalpoint) { + const e = t.media[0].focalpoint; + return `${(e[0] + 1) * 50}% ${(e[1] + 1) * 50}%`; + } + return "center center"; +} +function He(t, e, i) { + let { baseurl: l = "" } = e, { title: n = "" } = e, { maxlength: r = !1 } = e, { tags: o = "" } = e, { places: f = "" } = e, { theme: c = "light" } = e, { show_recurrent: s = !1 } = e, { sidebar: w = "true" } = e, { external_style: g = "" } = e, _ = !1, A = []; + function y(d) { + if (!_) return; - const params = []; - if (maxlength) { - params.push(`max=${maxlength}`); - } - if (tags) { - params.push(`tags=${tags}`); - } - if (places) { - params.push(`places=${places}`); - } - params.push(`show_recurrent=${show_recurrent ? "true" : "false"}`); - fetch(`${baseurl}/api/events?${params.join("&")}`).then((res) => res.json()).then((e) => { - $$invalidate(5, events = e); - }).catch((e) => { - console.error("Error loading Gancio API -> ", e); + const z = []; + r && z.push(`max=${r}`), o && z.push(`tags=${o}`), f && z.push(`places=${f}`), z.push(`show_recurrent=${s ? "true" : "false"}`), fetch(`${l}/api/events?${z.join("&")}`).then((h) => h.json()).then((h) => { + i(5, A = h); + }).catch((h) => { + console.error("Error loading Gancio API -> ", h); }); } - onMount(() => { - mounted = true; - update2(); - }); - $$self.$$set = ($$props2) => { - if ("baseurl" in $$props2) - $$invalidate(0, baseurl = $$props2.baseurl); - if ("title" in $$props2) - $$invalidate(1, title = $$props2.title); - if ("maxlength" in $$props2) - $$invalidate(6, maxlength = $$props2.maxlength); - if ("tags" in $$props2) - $$invalidate(7, tags = $$props2.tags); - if ("places" in $$props2) - $$invalidate(8, places = $$props2.places); - if ("theme" in $$props2) - $$invalidate(2, theme = $$props2.theme); - if ("show_recurrent" in $$props2) - $$invalidate(9, show_recurrent = $$props2.show_recurrent); - if ("sidebar" in $$props2) - $$invalidate(3, sidebar = $$props2.sidebar); - if ("external_style" in $$props2) - $$invalidate(4, external_style = $$props2.external_style); - }; - $$self.$$.update = () => { - if ($$self.$$.dirty & 974) { - update2(); - } - }; - return [ - baseurl, - title, - theme, - sidebar, - external_style, - events, - maxlength, - tags, - places, - show_recurrent + return ke(() => { + _ = !0, y(); + }), t.$$set = (d) => { + "baseurl" in d && i(0, l = d.baseurl), "title" in d && i(1, n = d.title), "maxlength" in d && i(6, r = d.maxlength), "tags" in d && i(7, o = d.tags), "places" in d && i(8, f = d.places), "theme" in d && i(2, c = d.theme), "show_recurrent" in d && i(9, s = d.show_recurrent), "sidebar" in d && i(3, w = d.sidebar), "external_style" in d && i(4, g = d.external_style); + }, t.$$.update = () => { + t.$$.dirty & 975 && y(); + }, [ + l, + n, + c, + w, + g, + A, + r, + o, + f, + s ]; } -class GancioEvents extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - init(this, { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, instance$1, create_fragment$1, safe_not_equal, { - baseurl: 0, - title: 1, - maxlength: 6, - tags: 7, - places: 8, - theme: 2, - show_recurrent: 9, - sidebar: 3, - external_style: 4 - }, null); - if (options) { - if (options.target) { - insert(options.target, this, options.anchor); - } - if (options.props) { - this.$set(options.props); - flush(); - } - } +class Re extends X { + constructor(e) { + super(), this.shadowRoot.innerHTML = ``, we( + this, + { + target: this.shadowRoot, + props: ve(this.attributes), + customElement: !0 + }, + He, + Ge, + _e, + { + baseurl: 0, + title: 1, + maxlength: 6, + tags: 7, + places: 8, + theme: 2, + show_recurrent: 9, + sidebar: 3, + external_style: 4 + }, + null + ), e && (e.target && p(e.target, this, e.anchor), e.props && (this.$set(e.props), x())); } static get observedAttributes() { return [ @@ -955,291 +534,152 @@ class GancioEvents extends SvelteElement { get baseurl() { return this.$$.ctx[0]; } - set baseurl(baseurl) { - this.$$set({ baseurl }); - flush(); + set baseurl(e) { + this.$$set({ baseurl: e }), x(); } get title() { return this.$$.ctx[1]; } - set title(title) { - this.$$set({ title }); - flush(); + set title(e) { + this.$$set({ title: e }), x(); } get maxlength() { return this.$$.ctx[6]; } - set maxlength(maxlength) { - this.$$set({ maxlength }); - flush(); + set maxlength(e) { + this.$$set({ maxlength: e }), x(); } get tags() { return this.$$.ctx[7]; } - set tags(tags) { - this.$$set({ tags }); - flush(); + set tags(e) { + this.$$set({ tags: e }), x(); } get places() { return this.$$.ctx[8]; } - set places(places) { - this.$$set({ places }); - flush(); + set places(e) { + this.$$set({ places: e }), x(); } get theme() { return this.$$.ctx[2]; } - set theme(theme) { - this.$$set({ theme }); - flush(); + set theme(e) { + this.$$set({ theme: e }), x(); } get show_recurrent() { return this.$$.ctx[9]; } - set show_recurrent(show_recurrent) { - this.$$set({ show_recurrent }); - flush(); + set show_recurrent(e) { + this.$$set({ show_recurrent: e }), x(); } get sidebar() { return this.$$.ctx[3]; } - set sidebar(sidebar) { - this.$$set({ sidebar }); - flush(); + set sidebar(e) { + this.$$set({ sidebar: e }), x(); } get external_style() { return this.$$.ctx[4]; } - set external_style(external_style) { - this.$$set({ external_style }); - flush(); + set external_style(e) { + this.$$set({ external_style: e }), x(); } } -customElements.define("gancio-events", GancioEvents); -function create_if_block(ctx) { - let a; - let t0; - let div2; - let strong; - let t1_value = ctx[1].title + ""; - let t1; - let t2; - let div0; - let t3_value = when(ctx[1]) + ""; - let t3; - let t4; - let div1; - let t5; - let t6_value = ctx[1].place.name + ""; - let t6; - let a_href_value; - let if_block = ctx[1].media.length && create_if_block_1(ctx); +customElements.define("gancio-events", Re); +function de(t) { + let e, i, l, n, r = t[1].title + "", o, f, c, s = V(t[1]) + "", w, g, _, A, y = t[1].place.name + "", d, z, h = t[1].media.length && he(t); return { c() { - a = element("a"); - if (if_block) - if_block.c(); - t0 = space(); - div2 = element("div"); - strong = element("strong"); - t1 = text(t1_value); - t2 = space(); - div0 = element("div"); - t3 = text(t3_value); - t4 = space(); - div1 = element("div"); - t5 = text("@"); - t6 = text(t6_value); - attr(div1, "class", "place"); - attr(div2, "class", "container"); - attr(a, "href", a_href_value = ctx[0] + "/event/" + (ctx[1].slug || ctx[1].id)); - attr(a, "class", "card"); - attr(a, "target", "_blank"); + e = m("a"), h && h.c(), i = M(), l = m("div"), n = m("strong"), o = $(r), f = M(), c = m("div"), w = $(s), g = M(), _ = m("div"), A = $("@"), d = $(y), a(_, "class", "place"), a(l, "class", "container"), a(e, "href", z = t[0] + "/event/" + (t[1].slug || t[1].id)), a(e, "class", "card"), a(e, "target", "_blank"); }, - m(target, anchor) { - insert(target, a, anchor); - if (if_block) - if_block.m(a, null); - append(a, t0); - append(a, div2); - append(div2, strong); - append(strong, t1); - append(div2, t2); - append(div2, div0); - append(div0, t3); - append(div2, t4); - append(div2, div1); - append(div1, t5); - append(div1, t6); + m(v, C) { + p(v, e, C), h && h.m(e, null), u(e, i), u(e, l), u(l, n), u(n, o), u(l, f), u(l, c), u(c, w), u(l, g), u(l, _), u(_, A), u(_, d); }, - p(ctx2, dirty) { - if (ctx2[1].media.length) { - if (if_block) { - if_block.p(ctx2, dirty); - } else { - if_block = create_if_block_1(ctx2); - if_block.c(); - if_block.m(a, t0); - } - } else if (if_block) { - if_block.d(1); - if_block = null; - } - if (dirty & 2 && t1_value !== (t1_value = ctx2[1].title + "")) - set_data(t1, t1_value); - if (dirty & 2 && t3_value !== (t3_value = when(ctx2[1]) + "")) - set_data(t3, t3_value); - if (dirty & 2 && t6_value !== (t6_value = ctx2[1].place.name + "")) - set_data(t6, t6_value); - if (dirty & 3 && a_href_value !== (a_href_value = ctx2[0] + "/event/" + (ctx2[1].slug || ctx2[1].id))) { - attr(a, "href", a_href_value); - } + p(v, C) { + v[1].media.length ? h ? h.p(v, C) : (h = he(v), h.c(), h.m(e, i)) : h && (h.d(1), h = null), C & 2 && r !== (r = v[1].title + "") && T(o, r), C & 2 && s !== (s = V(v[1]) + "") && T(w, s), C & 2 && y !== (y = v[1].place.name + "") && T(d, y), C & 3 && z !== (z = v[0] + "/event/" + (v[1].slug || v[1].id)) && a(e, "href", z); }, - d(detaching) { - if (detaching) - detach(a); - if (if_block) - if_block.d(); + d(v) { + v && k(e), h && h.d(); } }; } -function create_if_block_1(ctx) { - let img; - let img_src_value; - let img_alt_value; - let img_style_value; +function he(t) { + let e, i, l, n; return { c() { - img = element("img"); - if (!src_url_equal(img.src, img_src_value = ctx[2](ctx[1]))) - attr(img, "src", img_src_value); - attr(img, "alt", img_alt_value = ctx[1].media[0].name); - attr(img, "style", img_style_value = "object-position: " + position(ctx[1]) + "; aspect-ratio=1.7778;"); + e = m("img"), H(e.src, i = t[2](t[1])) || a(e, "src", i), a(e, "alt", l = t[1].media[0].name), a(e, "style", n = "object-position: " + me(t[1]) + "; aspect-ratio=1.7778;"); }, - m(target, anchor) { - insert(target, img, anchor); + m(r, o) { + p(r, e, o); }, - p(ctx2, dirty) { - if (dirty & 2 && !src_url_equal(img.src, img_src_value = ctx2[2](ctx2[1]))) { - attr(img, "src", img_src_value); - } - if (dirty & 2 && img_alt_value !== (img_alt_value = ctx2[1].media[0].name)) { - attr(img, "alt", img_alt_value); - } - if (dirty & 2 && img_style_value !== (img_style_value = "object-position: " + position(ctx2[1]) + "; aspect-ratio=1.7778;")) { - attr(img, "style", img_style_value); - } + p(r, o) { + o & 2 && !H(e.src, i = r[2](r[1])) && a(e, "src", i), o & 2 && l !== (l = r[1].media[0].name) && a(e, "alt", l), o & 2 && n !== (n = "object-position: " + me(r[1]) + "; aspect-ratio=1.7778;") && a(e, "style", n); }, - d(detaching) { - if (detaching) - detach(img); + d(r) { + r && k(e); } }; } -function create_fragment(ctx) { - let if_block_anchor; - let if_block = ctx[1] && create_if_block(ctx); +function Ie(t) { + let e, i = t[1] && de(t); return { c() { - if (if_block) - if_block.c(); - if_block_anchor = empty(); - this.c = noop; + i && i.c(), e = pe(), this.c = G; }, - m(target, anchor) { - if (if_block) - if_block.m(target, anchor); - insert(target, if_block_anchor, anchor); + m(l, n) { + i && i.m(l, n), p(l, e, n); }, - p(ctx2, [dirty]) { - if (ctx2[1]) { - if (if_block) { - if_block.p(ctx2, dirty); - } else { - if_block = create_if_block(ctx2); - if_block.c(); - if_block.m(if_block_anchor.parentNode, if_block_anchor); - } - } else if (if_block) { - if_block.d(1); - if_block = null; - } + p(l, [n]) { + l[1] ? i ? i.p(l, n) : (i = de(l), i.c(), i.m(e.parentNode, e)) : i && (i.d(1), i = null); }, - i: noop, - o: noop, - d(detaching) { - if (if_block) - if_block.d(detaching); - if (detaching) - detach(if_block_anchor); + i: G, + o: G, + d(l) { + i && i.d(l), l && k(e); } }; } -function when(event) { - return new Date(event.start_datetime * 1e3).toLocaleDateString(void 0, { - weekday: "long", - month: "short", - day: "numeric", - hour: "2-digit", - minute: "2-digit" - }); -} -function position(event) { - if (event.media[0].focalpoint) { - const focalpoint = event.media[0].focalpoint; - return `${(focalpoint[0] + 1) * 50}% ${(focalpoint[1] + 1) * 50}%`; +function me(t) { + if (t.media[0].focalpoint) { + const e = t.media[0].focalpoint; + return `${(e[0] + 1) * 50}% ${(e[1] + 1) * 50}%`; } return "center center"; } -function instance($$self, $$props, $$invalidate) { - let { baseurl = "https://demo.gancio.org" } = $$props; - let { id } = $$props; - let mounted = false; - let event; - function update2(id2, baseurl2) { - if (mounted) { - fetch(`${baseurl2}/api/event/${id2}`).then((res) => res.json()).then((e) => $$invalidate(1, event = e)); - } +function Oe(t, e, i) { + let { baseurl: l = "https://demo.gancio.org" } = e, { id: n } = e, r = !1, o; + function f(s, w) { + r && fetch(`${w}/api/event/detail/${s}`).then((g) => g.json()).then((g) => i(1, o = g)); } - onMount(() => { - mounted = true; - update2(id, baseurl); + ke(() => { + r = !0, f(n, l); }); - function thumbnail(event2) { - return `${baseurl}/media/thumb/${event2.media[0].url}`; + function c(s) { + return `${l}/media/thumb/${s.media[0].url}`; } - $$self.$$set = ($$props2) => { - if ("baseurl" in $$props2) - $$invalidate(0, baseurl = $$props2.baseurl); - if ("id" in $$props2) - $$invalidate(3, id = $$props2.id); - }; - $$self.$$.update = () => { - if ($$self.$$.dirty & 9) { - update2(id, baseurl); - } - }; - return [baseurl, event, thumbnail, id]; + return t.$$set = (s) => { + "baseurl" in s && i(0, l = s.baseurl), "id" in s && i(3, n = s.id); + }, t.$$.update = () => { + t.$$.dirty & 9 && f(n, l); + }, [l, o, c, n]; } -class GancioEvent 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, { baseurl: 0, id: 3 }, null); - if (options) { - if (options.target) { - insert(options.target, this, options.anchor); - } - if (options.props) { - this.$set(options.props); - flush(); - } - } +class Ue extends X { + constructor(e) { + super(), this.shadowRoot.innerHTML = ``, we( + this, + { + target: this.shadowRoot, + props: ve(this.attributes), + customElement: !0 + }, + Oe, + Ie, + _e, + { baseurl: 0, id: 3 }, + null + ), e && (e.target && p(e.target, this, e.anchor), e.props && (this.$set(e.props), x())); } static get observedAttributes() { return ["baseurl", "id"]; @@ -1247,16 +687,14 @@ class GancioEvent extends SvelteElement { get baseurl() { return this.$$.ctx[0]; } - set baseurl(baseurl) { - this.$$set({ baseurl }); - flush(); + set baseurl(e) { + this.$$set({ baseurl: e }), x(); } get id() { return this.$$.ctx[3]; } - set id(id) { - this.$$set({ id }); - flush(); + set id(e) { + this.$$set({ id: e }), x(); } } -customElements.define("gancio-event", GancioEvent); +customElements.define("gancio-event", Ue); diff --git a/docs/assets/js/gancio-events.es.js b/docs/assets/js/gancio-events.es.js index 7376dcbb..de0e2357 100644 --- a/docs/assets/js/gancio-events.es.js +++ b/docs/assets/js/gancio-events.es.js @@ -1,171 +1,171 @@ -function L() { +function G() { } function W(t) { return t(); } -function ee() { +function Y() { return /* @__PURE__ */ Object.create(null); } -function O(t) { +function U(t) { t.forEach(W); } -function _e(t) { +function ge(t) { return typeof t == "function"; } -function be(t, e) { +function _e(t, e) { return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function"; } let B; -function G(t, e) { +function H(t, e) { return B || (B = document.createElement("a")), B.href = e, t === B.href; } -function xe(t) { +function ye(t) { return Object.keys(t).length === 0; } function u(t, e) { t.appendChild(e); } -function v(t, e, i) { +function p(t, e, i) { t.insertBefore(e, i || null); } -function x(t) { +function k(t) { t.parentNode.removeChild(t); } -function pe(t, e) { +function be(t, e) { for (let i = 0; i < t.length; i += 1) t[i] && t[i].d(e); } -function g(t) { +function m(t) { return document.createElement(t); } -function j(t) { +function $(t) { return document.createTextNode(t); } -function z() { - return j(" "); +function M() { + return $(" "); } -function ve() { - return j(""); +function pe() { + return $(""); } function a(t, e, i) { i == null ? t.removeAttribute(e) : t.getAttribute(e) !== i && t.setAttribute(e, i); } -function $e(t) { +function xe(t) { return Array.from(t.childNodes); } -function N(t, e) { +function T(t, e) { e = "" + e, t.wholeText !== e && (t.data = e); } -function T(t, e, i) { +function L(t, e, i) { t.classList[i ? "add" : "remove"](e); } -function ke(t) { +function ve(t) { const e = {}; for (const i of t) e[i.name] = i.value; return e; } -let I; -function R(t) { - I = t; +let O; +function I(t) { + O = t; } -function Ee() { - if (!I) +function $e() { + if (!O) throw new Error("Function called outside component initialization"); - return I; + return O; } -function we(t) { - Ee().$$.on_mount.push(t); +function ke(t) { + $e().$$.on_mount.push(t); } -const H = [], te = [], P = [], ie = [], je = Promise.resolve(); +const R = [], Z = [], P = [], ee = [], Ee = Promise.resolve(); let K = !1; -function Se() { - K || (K = !0, je.then(y)); +function je() { + K || (K = !0, Ee.then(x)); } function Q(t) { P.push(t); } const J = /* @__PURE__ */ new Set(); let D = 0; -function y() { - const t = I; +function x() { + const t = O; do { - for (; D < H.length; ) { - const e = H[D]; - D++, R(e), ze(e.$$); + for (; D < R.length; ) { + const e = R[D]; + D++, I(e), Se(e.$$); } - for (R(null), H.length = 0, D = 0; te.length; ) - te.pop()(); + for (I(null), R.length = 0, D = 0; Z.length; ) + Z.pop()(); for (let e = 0; e < P.length; e += 1) { const i = P[e]; J.has(i) || (J.add(i), i()); } P.length = 0; - } while (H.length); - for (; ie.length; ) - ie.pop()(); - K = !1, J.clear(), R(t); + } while (R.length); + for (; ee.length; ) + ee.pop()(); + K = !1, J.clear(), I(t); } -function ze(t) { +function Se(t) { if (t.fragment !== null) { - t.update(), O(t.before_update); + t.update(), U(t.before_update); const e = t.dirty; t.dirty = [-1], t.fragment && t.fragment.p(t.ctx, e), t.after_update.forEach(Q); } } -const Ce = /* @__PURE__ */ new Set(); -function Ae(t, e) { - t && t.i && (Ce.delete(t), t.i(e)); +const ze = /* @__PURE__ */ new Set(); +function Ce(t, e) { + t && t.i && (ze.delete(t), t.i(e)); } -function Me(t, e, i, l) { - const { fragment: n, on_mount: o, on_destroy: r, after_update: f } = t.$$; +function Ae(t, e, i, l) { + const { fragment: n, on_mount: r, on_destroy: o, after_update: f } = t.$$; n && n.m(e, i), l || Q(() => { - const c = o.map(W).filter(_e); - r ? r.push(...c) : O(c), t.$$.on_mount = []; + const c = r.map(W).filter(ge); + o ? o.push(...c) : U(c), t.$$.on_mount = []; }), f.forEach(Q); } -function Ne(t, e) { +function Me(t, e) { const i = t.$$; - i.fragment !== null && (O(i.on_destroy), i.fragment && i.fragment.d(e), i.on_destroy = i.fragment = null, i.ctx = []); + i.fragment !== null && (U(i.on_destroy), i.fragment && i.fragment.d(e), i.on_destroy = i.fragment = null, i.ctx = []); } -function Te(t, e) { - t.$$.dirty[0] === -1 && (H.push(t), Se(), t.$$.dirty.fill(0)), t.$$.dirty[e / 31 | 0] |= 1 << e % 31; +function Ne(t, e) { + t.$$.dirty[0] === -1 && (R.push(t), je(), t.$$.dirty.fill(0)), t.$$.dirty[e / 31 | 0] |= 1 << e % 31; } -function ye(t, e, i, l, n, o, r, f = [-1]) { - const c = I; - R(t); +function we(t, e, i, l, n, r, o, f = [-1]) { + const c = O; + I(t); const s = t.$$ = { fragment: null, ctx: null, - props: o, - update: L, + props: r, + update: G, not_equal: n, - bound: ee(), + bound: Y(), on_mount: [], on_destroy: [], on_disconnect: [], before_update: [], after_update: [], context: new Map(e.context || (c ? c.$$.context : [])), - callbacks: ee(), + callbacks: Y(), dirty: f, skip_bound: !1, root: e.target || c.$$.root }; - r && r(s.root); - let k = !1; - if (s.ctx = i ? i(t, e.props || {}, (m, _, ...C) => { - const w = C.length ? C[0] : _; - return s.ctx && n(s.ctx[m], s.ctx[m] = w) && (!s.skip_bound && s.bound[m] && s.bound[m](w), k && Te(t, m)), _; - }) : [], s.update(), k = !0, O(s.before_update), s.fragment = l ? l(s.ctx) : !1, e.target) { + o && o(s.root); + let w = !1; + if (s.ctx = i ? i(t, e.props || {}, (g, _, ...A) => { + const y = A.length ? A[0] : _; + return s.ctx && n(s.ctx[g], s.ctx[g] = y) && (!s.skip_bound && s.bound[g] && s.bound[g](y), w && Ne(t, g)), _; + }) : [], s.update(), w = !0, U(s.before_update), s.fragment = l ? l(s.ctx) : !1, e.target) { if (e.hydrate) { - const m = $e(e.target); - s.fragment && s.fragment.l(m), m.forEach(x); + const g = xe(e.target); + s.fragment && s.fragment.l(g), g.forEach(k); } else s.fragment && s.fragment.c(); - e.intro && Ae(t.$$.fragment), Me(t, e.target, e.anchor, e.customElement), y(); + e.intro && Ce(t.$$.fragment), Ae(t, e.target, e.anchor, e.customElement), x(); } - R(c); + I(c); } let X; typeof HTMLElement == "function" && (X = class extends HTMLElement { @@ -174,7 +174,7 @@ typeof HTMLElement == "function" && (X = class extends HTMLElement { } connectedCallback() { const { on_mount: t } = this.$$; - this.$$.on_disconnect = t.map(W).filter(_e); + this.$$.on_disconnect = t.map(W).filter(ge); for (const e in this.$$.slotted) this.appendChild(this.$$.slotted[e]); } @@ -182,10 +182,10 @@ typeof HTMLElement == "function" && (X = class extends HTMLElement { this[t] = i; } disconnectedCallback() { - O(this.$$.on_disconnect); + U(this.$$.on_disconnect); } $destroy() { - Ne(this, 1), this.$destroy = L; + Me(this, 1), this.$destroy = G; } $on(t, e) { const i = this.$$.callbacks[t] || (this.$$.callbacks[t] = []); @@ -195,7 +195,7 @@ typeof HTMLElement == "function" && (X = class extends HTMLElement { }; } $set(t) { - this.$$set && !xe(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1); + this.$$set && !ye(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1); } }); function F(t, e = "long") { @@ -211,264 +211,282 @@ function F(t, e = "long") { function V(t) { return t.multidate ? F(t.start_datetime) + " - " + F(t.end_datetime) : F(t.start_datetime) + (t.end_datetime ? "-" + F(t.end_datetime, "short") : ""); } -function le(t, e, i) { +function te(t, e, i) { const l = t.slice(); return l[12] = e[i], l; } -function ne(t, e, i) { +function ie(t, e, i) { const l = t.slice(); return l[15] = e[i], l; } -function re(t) { +function le(t) { let e; return { c() { - e = g("link"), a(e, "rel", "stylesheet"), a(e, "href", t[4]); + e = m("link"), a(e, "rel", "stylesheet"), a(e, "href", t[4]); }, m(i, l) { - v(i, e, l); + p(i, e, l); }, p(i, l) { l & 16 && a(e, "href", i[4]); }, d(i) { - i && x(e); + i && k(e); + } + }; +} +function ne(t) { + let e, i, l = t[1] && t[3] === "true" && re(t), n = t[5], r = []; + for (let o = 0; o < n.length; o += 1) + r[o] = fe(te(t, n, o)); + return { + c() { + e = m("div"), l && l.c(), i = M(); + for (let o = 0; o < r.length; o += 1) + r[o].c(); + a(e, "id", "gancioEvents"), L(e, "dark", t[2] === "dark"), L(e, "light", t[2] === "light"), L(e, "sidebar", t[3] === "true"), L(e, "nosidebar", t[3] !== "true"); + }, + m(o, f) { + p(o, e, f), l && l.m(e, null), u(e, i); + for (let c = 0; c < r.length; c += 1) + r[c].m(e, null); + }, + p(o, f) { + if (o[1] && o[3] === "true" ? l ? l.p(o, f) : (l = re(o), l.c(), l.m(e, i)) : l && (l.d(1), l = null), f & 41) { + n = o[5]; + let c; + for (c = 0; c < n.length; c += 1) { + const s = te(o, n, c); + r[c] ? r[c].p(s, f) : (r[c] = fe(s), r[c].c(), r[c].m(e, null)); + } + for (; c < r.length; c += 1) + r[c].d(1); + r.length = n.length; + } + f & 4 && L(e, "dark", o[2] === "dark"), f & 4 && L(e, "light", o[2] === "light"), f & 8 && L(e, "sidebar", o[3] === "true"), f & 8 && L(e, "nosidebar", o[3] !== "true"); + }, + d(o) { + o && k(e), l && l.d(), be(r, o); + } + }; +} +function re(t) { + let e, i, l, n, r, o, f; + return { + c() { + e = m("a"), i = m("div"), l = m("div"), n = $(t[1]), r = M(), o = m("img"), a(l, "class", "title"), a(o, "id", "logo"), a(o, "alt", "logo"), H(o.src, f = t[0] + "/logo.png") || a(o, "src", f), a(i, "class", "content"), a(e, "href", t[0]), a(e, "target", "_blank"), a(e, "id", "header"); + }, + m(c, s) { + p(c, e, s), u(e, i), u(i, l), u(l, n), u(i, r), u(i, o); + }, + p(c, s) { + s & 2 && T(n, c[1]), s & 1 && !H(o.src, f = c[0] + "/logo.png") && a(o, "src", f), s & 1 && a(e, "href", c[0]); + }, + d(c) { + c && k(e); } }; } function oe(t) { - let e, i, l = t[1] && t[3] === "true" && ae(t), n = t[5], o = []; - for (let r = 0; r < n.length; r += 1) - o[r] = ue(le(t, n, r)); - return { - c() { - e = g("div"), l && l.c(), i = z(); - for (let r = 0; r < o.length; r += 1) - o[r].c(); - a(e, "id", "gancioEvents"), T(e, "dark", t[2] === "dark"), T(e, "light", t[2] === "light"), T(e, "sidebar", t[3] === "true"), T(e, "nosidebar", t[3] !== "true"); - }, - m(r, f) { - v(r, e, f), l && l.m(e, null), u(e, i); - for (let c = 0; c < o.length; c += 1) - o[c].m(e, null); - }, - p(r, f) { - if (r[1] && r[3] === "true" ? l ? l.p(r, f) : (l = ae(r), l.c(), l.m(e, i)) : l && (l.d(1), l = null), f & 41) { - n = r[5]; - let c; - for (c = 0; c < n.length; c += 1) { - const s = le(r, n, c); - o[c] ? o[c].p(s, f) : (o[c] = ue(s), o[c].c(), o[c].m(e, null)); - } - for (; c < o.length; c += 1) - o[c].d(1); - o.length = n.length; - } - f & 4 && T(e, "dark", r[2] === "dark"), f & 4 && T(e, "light", r[2] === "light"), f & 8 && T(e, "sidebar", r[3] === "true"), f & 8 && T(e, "nosidebar", r[3] !== "true"); - }, - d(r) { - r && x(e), l && l.d(), pe(o, r); - } - }; -} -function ae(t) { - let e, i, l, n, o, r, f; - return { - c() { - e = g("a"), i = g("div"), l = g("div"), n = j(t[1]), o = z(), r = g("img"), a(l, "class", "title"), a(r, "id", "logo"), a(r, "alt", "logo"), G(r.src, f = t[0] + "/logo.png") || a(r, "src", f), a(i, "class", "content"), a(e, "href", t[0]), a(e, "target", "_blank"), a(e, "id", "header"); - }, - m(c, s) { - v(c, e, s), u(e, i), u(i, l), u(l, n), u(i, o), u(i, r); - }, - p(c, s) { - s & 2 && N(n, c[1]), s & 1 && !G(r.src, f = c[0] + "/logo.png") && a(r, "src", f), s & 1 && a(e, "href", c[0]); - }, - d(c) { - c && x(e); - } - }; -} -function se(t) { let e; - function i(o, r) { - return o[12].media.length ? Ge : Le; + function i(r, o) { + return r[12].media.length ? Le : Te; } let l = i(t), n = l(t); return { c() { - e = g("div"), n.c(), a(e, "class", "img"); + e = m("div"), n.c(), a(e, "class", "img"); }, - m(o, r) { - v(o, e, r), n.m(e, null); + m(r, o) { + p(r, e, o), n.m(e, null); }, - p(o, r) { - l === (l = i(o)) && n ? n.p(o, r) : (n.d(1), n = l(o), n && (n.c(), n.m(e, null))); + p(r, o) { + l === (l = i(r)) && n ? n.p(r, o) : (n.d(1), n = l(r), n && (n.c(), n.m(e, null))); }, - d(o) { - o && x(e), n.d(); + d(r) { + r && k(e), n.d(); + } + }; +} +function Te(t) { + let e, i, l; + return { + c() { + e = m("img"), a(e, "style", "aspect-ratio=1.7778;"), a(e, "alt", i = t[12].title), H(e.src, l = t[0] + "/fallbackimage.png") || a(e, "src", l), a(e, "loading", "lazy"); + }, + m(n, r) { + p(n, e, r); + }, + p(n, r) { + r & 32 && i !== (i = n[12].title) && a(e, "alt", i), r & 1 && !H(e.src, l = n[0] + "/fallbackimage.png") && a(e, "src", l); + }, + d(n) { + n && k(e); } }; } function Le(t) { - let e, i, l; - return { - c() { - e = g("img"), a(e, "style", "aspect-ratio=1.7778;"), a(e, "alt", i = t[12].title), G(e.src, l = t[0] + "/fallbackimage.png") || a(e, "src", l), a(e, "loading", "lazy"); - }, - m(n, o) { - v(n, e, o); - }, - p(n, o) { - o & 32 && i !== (i = n[12].title) && a(e, "alt", i), o & 1 && !G(e.src, l = n[0] + "/fallbackimage.png") && a(e, "src", l); - }, - d(n) { - n && x(e); - } - }; -} -function Ge(t) { let e, i, l, n; return { c() { - e = g("img"), a(e, "style", i = "object-position: " + de(t[12]) + "; aspect-ratio=1.7778;"), a(e, "alt", l = t[12].media[0].name), G(e.src, n = t[0] + "/media/thumb/" + t[12].media[0].url) || a(e, "src", n), a(e, "loading", "lazy"); + e = m("img"), a(e, "style", i = "object-position: " + ue(t[12]) + "; aspect-ratio=1.7778;"), a(e, "alt", l = t[12].media[0].name), H(e.src, n = t[0] + "/media/thumb/" + t[12].media[0].url) || a(e, "src", n), a(e, "loading", "lazy"); }, - m(o, r) { - v(o, e, r); + m(r, o) { + p(r, e, o); }, - p(o, r) { - r & 32 && i !== (i = "object-position: " + de(o[12]) + "; aspect-ratio=1.7778;") && a(e, "style", i), r & 32 && l !== (l = o[12].media[0].name) && a(e, "alt", l), r & 33 && !G(e.src, n = o[0] + "/media/thumb/" + o[12].media[0].url) && a(e, "src", n); + p(r, o) { + o & 32 && i !== (i = "object-position: " + ue(r[12]) + "; aspect-ratio=1.7778;") && a(e, "style", i), o & 32 && l !== (l = r[12].media[0].name) && a(e, "alt", l), o & 33 && !H(e.src, n = r[0] + "/media/thumb/" + r[12].media[0].url) && a(e, "src", n); }, - d(o) { - o && x(e); + d(r) { + r && k(e); } }; } -function ce(t) { - let e, i = t[12].tags, l = []; - for (let n = 0; n < i.length; n += 1) - l[n] = fe(ne(t, i, n)); +function ae(t) { + let e, i = t[12].place.address + "", l; return { c() { - e = g("div"); + e = m("span"), l = $(i), a(e, "class", "subtitle"); + }, + m(n, r) { + p(n, e, r), u(e, l); + }, + p(n, r) { + r & 32 && i !== (i = n[12].place.address + "") && T(l, i); + }, + d(n) { + n && k(e); + } + }; +} +function se(t) { + let e, i = t[12].tags, l = []; + for (let n = 0; n < i.length; n += 1) + l[n] = ce(ie(t, i, n)); + return { + c() { + e = m("div"); for (let n = 0; n < l.length; n += 1) l[n].c(); a(e, "class", "tags"); }, - m(n, o) { - v(n, e, o); - for (let r = 0; r < l.length; r += 1) - l[r].m(e, null); + m(n, r) { + p(n, e, r); + for (let o = 0; o < l.length; o += 1) + l[o].m(e, null); }, - p(n, o) { - if (o & 32) { + p(n, r) { + if (r & 32) { i = n[12].tags; - let r; - for (r = 0; r < i.length; r += 1) { - const f = ne(n, i, r); - l[r] ? l[r].p(f, o) : (l[r] = fe(f), l[r].c(), l[r].m(e, null)); + let o; + for (o = 0; o < i.length; o += 1) { + const f = ie(n, i, o); + l[o] ? l[o].p(f, r) : (l[o] = ce(f), l[o].c(), l[o].m(e, null)); } - for (; r < l.length; r += 1) - l[r].d(1); + for (; o < l.length; o += 1) + l[o].d(1); l.length = i.length; } }, d(n) { - n && x(e), pe(l, n); + n && k(e), be(l, n); + } + }; +} +function ce(t) { + let e, i, l = t[15] + "", n; + return { + c() { + e = m("span"), i = $("#"), n = $(l), a(e, "class", "tag"); + }, + m(r, o) { + p(r, e, o), u(e, i), u(e, n); + }, + p(r, o) { + o & 32 && l !== (l = r[15] + "") && T(n, l); + }, + d(r) { + r && k(e); } }; } function fe(t) { - let e, i, l = t[15] + "", n; + let e, i, l, n, r = V(t[12]) + "", o, f, c, s = t[12].title + "", w, g, _, A, y = t[12].place.name + "", d, z, h, v, C, q, E = t[3] !== "true" && oe(t), j = t[12].place.name !== "online" && ae(t), S = t[12].tags.length && se(t); return { c() { - e = g("span"), i = j("#"), n = j(l), a(e, "class", "tag"); + e = m("a"), E && E.c(), i = M(), l = m("div"), n = m("div"), o = $(r), f = M(), c = m("div"), w = $(s), g = M(), _ = m("span"), A = $('@"'), d = $(y), z = $(`" + `), j && j.c(), h = M(), S && S.c(), v = M(), a(n, "class", "subtitle"), a(c, "class", "title"), a(_, "class", "place"), a(l, "class", "content"), a(e, "href", C = t[0] + "/event/" + (t[12].slug || t[12].id)), a(e, "class", "event"), a(e, "title", q = t[12].title), a(e, "target", "_blank"); }, - m(o, r) { - v(o, e, r), u(e, i), u(e, n); + m(b, N) { + p(b, e, N), E && E.m(e, null), u(e, i), u(e, l), u(l, n), u(n, o), u(l, f), u(l, c), u(c, w), u(l, g), u(l, _), u(_, A), u(_, d), u(_, z), j && j.m(_, null), u(l, h), S && S.m(l, null), u(e, v); }, - p(o, r) { - r & 32 && l !== (l = o[15] + "") && N(n, l); + p(b, N) { + b[3] !== "true" ? E ? E.p(b, N) : (E = oe(b), E.c(), E.m(e, i)) : E && (E.d(1), E = null), N & 32 && r !== (r = V(b[12]) + "") && T(o, r), N & 32 && s !== (s = b[12].title + "") && T(w, s), N & 32 && y !== (y = b[12].place.name + "") && T(d, y), b[12].place.name !== "online" ? j ? j.p(b, N) : (j = ae(b), j.c(), j.m(_, null)) : j && (j.d(1), j = null), b[12].tags.length ? S ? S.p(b, N) : (S = se(b), S.c(), S.m(l, null)) : S && (S.d(1), S = null), N & 33 && C !== (C = b[0] + "/event/" + (b[12].slug || b[12].id)) && a(e, "href", C), N & 32 && q !== (q = b[12].title) && a(e, "title", q); }, - d(o) { - o && x(e); + d(b) { + b && k(e), E && E.d(), j && j.d(), S && S.d(); + } + }; +} +function Ge(t) { + let e, i, l = t[4] && le(t), n = t[5].length && ne(t); + return { + c() { + l && l.c(), e = M(), n && n.c(), i = pe(), this.c = G; + }, + m(r, o) { + l && l.m(r, o), p(r, e, o), n && n.m(r, o), p(r, i, o); + }, + p(r, [o]) { + r[4] ? l ? l.p(r, o) : (l = le(r), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null), r[5].length ? n ? n.p(r, o) : (n = ne(r), n.c(), n.m(i.parentNode, i)) : n && (n.d(1), n = null); + }, + i: G, + o: G, + d(r) { + l && l.d(r), r && k(e), n && n.d(r), r && k(i); } }; } function ue(t) { - let e, i, l, n, o = V(t[12]) + "", r, f, c, s = t[12].title + "", k, m, _, C, w = t[12].place.name + "", d, S, h, b = t[12].place.address + "", A, Y, Z, U, q, $ = t[3] !== "true" && se(t), E = t[12].tags.length && ce(t); - return { - c() { - e = g("a"), $ && $.c(), i = z(), l = g("div"), n = g("div"), r = j(o), f = z(), c = g("div"), k = j(s), m = z(), _ = g("span"), C = j("@"), d = j(w), S = z(), h = g("span"), A = j(b), Y = z(), E && E.c(), Z = z(), a(n, "class", "subtitle"), a(c, "class", "title"), a(h, "class", "subtitle"), a(_, "class", "place"), a(l, "class", "content"), a(e, "href", U = t[0] + "/event/" + (t[12].slug || t[12].id)), a(e, "class", "event"), a(e, "title", q = t[12].title), a(e, "target", "_blank"); - }, - m(p, M) { - v(p, e, M), $ && $.m(e, null), u(e, i), u(e, l), u(l, n), u(n, r), u(l, f), u(l, c), u(c, k), u(l, m), u(l, _), u(_, C), u(_, d), u(_, S), u(_, h), u(h, A), u(l, Y), E && E.m(l, null), u(e, Z); - }, - p(p, M) { - p[3] !== "true" ? $ ? $.p(p, M) : ($ = se(p), $.c(), $.m(e, i)) : $ && ($.d(1), $ = null), M & 32 && o !== (o = V(p[12]) + "") && N(r, o), M & 32 && s !== (s = p[12].title + "") && N(k, s), M & 32 && w !== (w = p[12].place.name + "") && N(d, w), M & 32 && b !== (b = p[12].place.address + "") && N(A, b), p[12].tags.length ? E ? E.p(p, M) : (E = ce(p), E.c(), E.m(l, null)) : E && (E.d(1), E = null), M & 33 && U !== (U = p[0] + "/event/" + (p[12].slug || p[12].id)) && a(e, "href", U), M & 32 && q !== (q = p[12].title) && a(e, "title", q); - }, - d(p) { - p && x(e), $ && $.d(), E && E.d(); - } - }; -} -function He(t) { - let e, i, l = t[4] && re(t), n = t[5].length && oe(t); - return { - c() { - l && l.c(), e = z(), n && n.c(), i = ve(), this.c = L; - }, - m(o, r) { - l && l.m(o, r), v(o, e, r), n && n.m(o, r), v(o, i, r); - }, - p(o, [r]) { - o[4] ? l ? l.p(o, r) : (l = re(o), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null), o[5].length ? n ? n.p(o, r) : (n = oe(o), n.c(), n.m(i.parentNode, i)) : n && (n.d(1), n = null); - }, - i: L, - o: L, - d(o) { - l && l.d(o), o && x(e), n && n.d(o), o && x(i); - } - }; -} -function de(t) { if (t.media && t.media[0].focalpoint) { const e = t.media[0].focalpoint; return `${(e[0] + 1) * 50}% ${(e[1] + 1) * 50}%`; } return "center center"; } -function Re(t, e, i) { - let { baseurl: l = "" } = e, { title: n = "" } = e, { maxlength: o = !1 } = e, { tags: r = "" } = e, { places: f = "" } = e, { theme: c = "light" } = e, { show_recurrent: s = !1 } = e, { sidebar: k = "true" } = e, { external_style: m = "" } = e, _ = !1, C = []; - function w(d) { +function He(t, e, i) { + let { baseurl: l = "" } = e, { title: n = "" } = e, { maxlength: r = !1 } = e, { tags: o = "" } = e, { places: f = "" } = e, { theme: c = "light" } = e, { show_recurrent: s = !1 } = e, { sidebar: w = "true" } = e, { external_style: g = "" } = e, _ = !1, A = []; + function y(d) { if (!_) return; - const S = []; - o && S.push(`max=${o}`), r && S.push(`tags=${r}`), f && S.push(`places=${f}`), S.push(`show_recurrent=${s ? "true" : "false"}`), fetch(`${l}/api/events?${S.join("&")}`).then((h) => h.json()).then((h) => { - i(5, C = h); + const z = []; + r && z.push(`max=${r}`), o && z.push(`tags=${o}`), f && z.push(`places=${f}`), z.push(`show_recurrent=${s ? "true" : "false"}`), fetch(`${l}/api/events?${z.join("&")}`).then((h) => h.json()).then((h) => { + i(5, A = h); }).catch((h) => { console.error("Error loading Gancio API -> ", h); }); } - return we(() => { - _ = !0, w(); + return ke(() => { + _ = !0, y(); }), t.$$set = (d) => { - "baseurl" in d && i(0, l = d.baseurl), "title" in d && i(1, n = d.title), "maxlength" in d && i(6, o = d.maxlength), "tags" in d && i(7, r = d.tags), "places" in d && i(8, f = d.places), "theme" in d && i(2, c = d.theme), "show_recurrent" in d && i(9, s = d.show_recurrent), "sidebar" in d && i(3, k = d.sidebar), "external_style" in d && i(4, m = d.external_style); + "baseurl" in d && i(0, l = d.baseurl), "title" in d && i(1, n = d.title), "maxlength" in d && i(6, r = d.maxlength), "tags" in d && i(7, o = d.tags), "places" in d && i(8, f = d.places), "theme" in d && i(2, c = d.theme), "show_recurrent" in d && i(9, s = d.show_recurrent), "sidebar" in d && i(3, w = d.sidebar), "external_style" in d && i(4, g = d.external_style); }, t.$$.update = () => { - t.$$.dirty & 975 && w(); + t.$$.dirty & 975 && y(); }, [ l, n, c, - k, - m, - C, - o, + w, + g, + A, r, + o, f, s ]; } -class Ie extends X { +class Re extends X { constructor(e) { super(), this.shadowRoot.innerHTML = ``, ye( + padding 0.3s;box-sizing:content-box}a:hover .title,a:focus .title,a:active .title{text-decoration:underline}.dark{--bg-odd-color:#161616;--bg-even-color:#222;--bg-hover-color:#333;--text-color:white;--title-color:white;--line-color:rgba(120, 120, 120, 0.2)}.light{--bg-odd-color:#f5f5f5;--bg-even-color:#fafafa;--bg-hover-color:#eee;--text-color:#222;--title-color:black;--line-color:rgba(220, 220, 220, 0.9)}.sidebar a{background-color:var(--bg-even-color);border-bottom:1px solid var(--line-color)}.sidebar a:hover,.sidebar a:focus,.sidebar a:active{background-color:var(--bg-hover-color);padding-left:15px;padding-right:25px}.place{font-weight:400;font-size:1.2rem;line-height:1.4rem;color:orangered}.title{color:var(--title-color);font-weight:bold;font-size:1.3rem;line-height:1.1em}.nosidebar .title{font-size:1.9em;line-height:1.1em}.subtitle{font-size:1rem;line-height:1.1em;color:var(--title-color);opacity:0.9}.tag{margin-right:10px;display:inline-block}`, we( this, { target: this.shadowRoot, - props: ke(this.attributes), + props: ve(this.attributes), customElement: !0 }, - Re, He, - be, + Ge, + _e, { baseurl: 0, title: 1, @@ -498,7 +516,7 @@ class Ie extends X { external_style: 4 }, null - ), e && (e.target && v(e.target, this, e.anchor), e.props && (this.$set(e.props), y())); + ), e && (e.target && p(e.target, this, e.anchor), e.props && (this.$set(e.props), x())); } static get observedAttributes() { return [ @@ -517,108 +535,108 @@ class Ie extends X { return this.$$.ctx[0]; } set baseurl(e) { - this.$$set({ baseurl: e }), y(); + this.$$set({ baseurl: e }), x(); } get title() { return this.$$.ctx[1]; } set title(e) { - this.$$set({ title: e }), y(); + this.$$set({ title: e }), x(); } get maxlength() { return this.$$.ctx[6]; } set maxlength(e) { - this.$$set({ maxlength: e }), y(); + this.$$set({ maxlength: e }), x(); } get tags() { return this.$$.ctx[7]; } set tags(e) { - this.$$set({ tags: e }), y(); + this.$$set({ tags: e }), x(); } get places() { return this.$$.ctx[8]; } set places(e) { - this.$$set({ places: e }), y(); + this.$$set({ places: e }), x(); } get theme() { return this.$$.ctx[2]; } set theme(e) { - this.$$set({ theme: e }), y(); + this.$$set({ theme: e }), x(); } get show_recurrent() { return this.$$.ctx[9]; } set show_recurrent(e) { - this.$$set({ show_recurrent: e }), y(); + this.$$set({ show_recurrent: e }), x(); } get sidebar() { return this.$$.ctx[3]; } set sidebar(e) { - this.$$set({ sidebar: e }), y(); + this.$$set({ sidebar: e }), x(); } get external_style() { return this.$$.ctx[4]; } set external_style(e) { - this.$$set({ external_style: e }), y(); + this.$$set({ external_style: e }), x(); } } -customElements.define("gancio-events", Ie); -function he(t) { - let e, i, l, n, o = t[1].title + "", r, f, c, s = V(t[1]) + "", k, m, _, C, w = t[1].place.name + "", d, S, h = t[1].media.length && ge(t); +customElements.define("gancio-events", Re); +function de(t) { + let e, i, l, n, r = t[1].title + "", o, f, c, s = V(t[1]) + "", w, g, _, A, y = t[1].place.name + "", d, z, h = t[1].media.length && he(t); return { c() { - e = g("a"), h && h.c(), i = z(), l = g("div"), n = g("strong"), r = j(o), f = z(), c = g("div"), k = j(s), m = z(), _ = g("div"), C = j("@"), d = j(w), a(_, "class", "place"), a(l, "class", "container"), a(e, "href", S = t[0] + "/event/" + (t[1].slug || t[1].id)), a(e, "class", "card"), a(e, "target", "_blank"); + e = m("a"), h && h.c(), i = M(), l = m("div"), n = m("strong"), o = $(r), f = M(), c = m("div"), w = $(s), g = M(), _ = m("div"), A = $("@"), d = $(y), a(_, "class", "place"), a(l, "class", "container"), a(e, "href", z = t[0] + "/event/" + (t[1].slug || t[1].id)), a(e, "class", "card"), a(e, "target", "_blank"); }, - m(b, A) { - v(b, e, A), h && h.m(e, null), u(e, i), u(e, l), u(l, n), u(n, r), u(l, f), u(l, c), u(c, k), u(l, m), u(l, _), u(_, C), u(_, d); + m(v, C) { + p(v, e, C), h && h.m(e, null), u(e, i), u(e, l), u(l, n), u(n, o), u(l, f), u(l, c), u(c, w), u(l, g), u(l, _), u(_, A), u(_, d); }, - p(b, A) { - b[1].media.length ? h ? h.p(b, A) : (h = ge(b), h.c(), h.m(e, i)) : h && (h.d(1), h = null), A & 2 && o !== (o = b[1].title + "") && N(r, o), A & 2 && s !== (s = V(b[1]) + "") && N(k, s), A & 2 && w !== (w = b[1].place.name + "") && N(d, w), A & 3 && S !== (S = b[0] + "/event/" + (b[1].slug || b[1].id)) && a(e, "href", S); + p(v, C) { + v[1].media.length ? h ? h.p(v, C) : (h = he(v), h.c(), h.m(e, i)) : h && (h.d(1), h = null), C & 2 && r !== (r = v[1].title + "") && T(o, r), C & 2 && s !== (s = V(v[1]) + "") && T(w, s), C & 2 && y !== (y = v[1].place.name + "") && T(d, y), C & 3 && z !== (z = v[0] + "/event/" + (v[1].slug || v[1].id)) && a(e, "href", z); }, - d(b) { - b && x(e), h && h.d(); + d(v) { + v && k(e), h && h.d(); } }; } -function ge(t) { +function he(t) { let e, i, l, n; return { c() { - e = g("img"), G(e.src, i = t[2](t[1])) || a(e, "src", i), a(e, "alt", l = t[1].media[0].name), a(e, "style", n = "object-position: " + me(t[1]) + "; aspect-ratio=1.7778;"); + e = m("img"), H(e.src, i = t[2](t[1])) || a(e, "src", i), a(e, "alt", l = t[1].media[0].name), a(e, "style", n = "object-position: " + me(t[1]) + "; aspect-ratio=1.7778;"); }, - m(o, r) { - v(o, e, r); + m(r, o) { + p(r, e, o); }, - p(o, r) { - r & 2 && !G(e.src, i = o[2](o[1])) && a(e, "src", i), r & 2 && l !== (l = o[1].media[0].name) && a(e, "alt", l), r & 2 && n !== (n = "object-position: " + me(o[1]) + "; aspect-ratio=1.7778;") && a(e, "style", n); + p(r, o) { + o & 2 && !H(e.src, i = r[2](r[1])) && a(e, "src", i), o & 2 && l !== (l = r[1].media[0].name) && a(e, "alt", l), o & 2 && n !== (n = "object-position: " + me(r[1]) + "; aspect-ratio=1.7778;") && a(e, "style", n); }, - d(o) { - o && x(e); + d(r) { + r && k(e); } }; } -function Oe(t) { - let e, i = t[1] && he(t); +function Ie(t) { + let e, i = t[1] && de(t); return { c() { - i && i.c(), e = ve(), this.c = L; + i && i.c(), e = pe(), this.c = G; }, m(l, n) { - i && i.m(l, n), v(l, e, n); + i && i.m(l, n), p(l, e, n); }, p(l, [n]) { - l[1] ? i ? i.p(l, n) : (i = he(l), i.c(), i.m(e.parentNode, e)) : i && (i.d(1), i = null); + l[1] ? i ? i.p(l, n) : (i = de(l), i.c(), i.m(e.parentNode, e)) : i && (i.d(1), i = null); }, - i: L, - o: L, + i: G, + o: G, d(l) { - i && i.d(l), l && x(e); + i && i.d(l), l && k(e); } }; } @@ -629,13 +647,13 @@ function me(t) { } return "center center"; } -function Ue(t, e, i) { - let { baseurl: l = "https://demo.gancio.org" } = e, { id: n } = e, o = !1, r; - function f(s, k) { - o && fetch(`${k}/api/event/detail/${s}`).then((m) => m.json()).then((m) => i(1, r = m)); +function Oe(t, e, i) { + let { baseurl: l = "https://demo.gancio.org" } = e, { id: n } = e, r = !1, o; + function f(s, w) { + r && fetch(`${w}/api/event/detail/${s}`).then((g) => g.json()).then((g) => i(1, o = g)); } - we(() => { - o = !0, f(n, l); + ke(() => { + r = !0, f(n, l); }); function c(s) { return `${l}/media/thumb/${s.media[0].url}`; @@ -644,24 +662,24 @@ function Ue(t, e, i) { "baseurl" in s && i(0, l = s.baseurl), "id" in s && i(3, n = s.id); }, t.$$.update = () => { t.$$.dirty & 9 && f(n, l); - }, [l, r, c, n]; + }, [l, o, c, n]; } -class qe extends X { +class Ue extends X { constructor(e) { super(), this.shadowRoot.innerHTML = ``, ye( + sans-serif;box-shadow:0 4px 8px 0 rgba(0, 0, 0, 0.2);transition:0.3s;border-radius:5px;max-width:500px;text-decoration:none;color:white;background-color:#1e1e1e;overflow:hidden}img{border-radius:5px 5px 0 0;max-height:250px;min-height:160px;width:100%;object-fit:cover;object-position:top}.card:hover .container{padding-left:20px}.card:hover{box-shadow:0 8px 16px 0 rgba(0, 0, 0, 0.2)}.container{transition:padding-left 0.2s;padding:16px}.place{font-weight:600;color:#ff6e40}`, we( this, { target: this.shadowRoot, - props: ke(this.attributes), + props: ve(this.attributes), customElement: !0 }, - Ue, Oe, - be, + Ie, + _e, { baseurl: 0, id: 3 }, null - ), e && (e.target && v(e.target, this, e.anchor), e.props && (this.$set(e.props), y())); + ), e && (e.target && p(e.target, this, e.anchor), e.props && (this.$set(e.props), x())); } static get observedAttributes() { return ["baseurl", "id"]; @@ -670,13 +688,13 @@ class qe extends X { return this.$$.ctx[0]; } set baseurl(e) { - this.$$set({ baseurl: e }), y(); + this.$$set({ baseurl: e }), x(); } get id() { return this.$$.ctx[3]; } set id(e) { - this.$$set({ id: e }), y(); + this.$$set({ id: e }), x(); } } -customElements.define("gancio-event", qe); +customElements.define("gancio-event", Ue); diff --git a/package.json b/package.json index 5b71fa08..cd6f45d0 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "doc:dev": "cd docs && bundle exec jekyll s --drafts", "migrate": "NODE_ENV=production sequelize db:migrate", "migrate:dev": "sequelize db:migrate", - "build:wc": "cd webcomponents; yarn build:lib; cp dist/gancio-events.es.js ../wp-plugin/js/; cp dist/gancio-events.es.js ../assets/; cp dist/gancio-events.es.js ../docs/assets/js/" + "build:wc": "cd webcomponents; yarn build:lib; cp dist/gancio-events.js ../wp-plugin/js/gancio-events.es.js; cp dist/gancio-events.js ../assets/gancio-events.es.js; cp dist/gancio-events.js ../docs/assets/js/gancio-events.es.js; cp dist/gancio-events.js ../static/gancio-events.es.js;" }, "files": [ "server/", diff --git a/static/gancio-events.es.js b/static/gancio-events.es.js index 7376dcbb..de0e2357 100644 --- a/static/gancio-events.es.js +++ b/static/gancio-events.es.js @@ -1,171 +1,171 @@ -function L() { +function G() { } function W(t) { return t(); } -function ee() { +function Y() { return /* @__PURE__ */ Object.create(null); } -function O(t) { +function U(t) { t.forEach(W); } -function _e(t) { +function ge(t) { return typeof t == "function"; } -function be(t, e) { +function _e(t, e) { return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function"; } let B; -function G(t, e) { +function H(t, e) { return B || (B = document.createElement("a")), B.href = e, t === B.href; } -function xe(t) { +function ye(t) { return Object.keys(t).length === 0; } function u(t, e) { t.appendChild(e); } -function v(t, e, i) { +function p(t, e, i) { t.insertBefore(e, i || null); } -function x(t) { +function k(t) { t.parentNode.removeChild(t); } -function pe(t, e) { +function be(t, e) { for (let i = 0; i < t.length; i += 1) t[i] && t[i].d(e); } -function g(t) { +function m(t) { return document.createElement(t); } -function j(t) { +function $(t) { return document.createTextNode(t); } -function z() { - return j(" "); +function M() { + return $(" "); } -function ve() { - return j(""); +function pe() { + return $(""); } function a(t, e, i) { i == null ? t.removeAttribute(e) : t.getAttribute(e) !== i && t.setAttribute(e, i); } -function $e(t) { +function xe(t) { return Array.from(t.childNodes); } -function N(t, e) { +function T(t, e) { e = "" + e, t.wholeText !== e && (t.data = e); } -function T(t, e, i) { +function L(t, e, i) { t.classList[i ? "add" : "remove"](e); } -function ke(t) { +function ve(t) { const e = {}; for (const i of t) e[i.name] = i.value; return e; } -let I; -function R(t) { - I = t; +let O; +function I(t) { + O = t; } -function Ee() { - if (!I) +function $e() { + if (!O) throw new Error("Function called outside component initialization"); - return I; + return O; } -function we(t) { - Ee().$$.on_mount.push(t); +function ke(t) { + $e().$$.on_mount.push(t); } -const H = [], te = [], P = [], ie = [], je = Promise.resolve(); +const R = [], Z = [], P = [], ee = [], Ee = Promise.resolve(); let K = !1; -function Se() { - K || (K = !0, je.then(y)); +function je() { + K || (K = !0, Ee.then(x)); } function Q(t) { P.push(t); } const J = /* @__PURE__ */ new Set(); let D = 0; -function y() { - const t = I; +function x() { + const t = O; do { - for (; D < H.length; ) { - const e = H[D]; - D++, R(e), ze(e.$$); + for (; D < R.length; ) { + const e = R[D]; + D++, I(e), Se(e.$$); } - for (R(null), H.length = 0, D = 0; te.length; ) - te.pop()(); + for (I(null), R.length = 0, D = 0; Z.length; ) + Z.pop()(); for (let e = 0; e < P.length; e += 1) { const i = P[e]; J.has(i) || (J.add(i), i()); } P.length = 0; - } while (H.length); - for (; ie.length; ) - ie.pop()(); - K = !1, J.clear(), R(t); + } while (R.length); + for (; ee.length; ) + ee.pop()(); + K = !1, J.clear(), I(t); } -function ze(t) { +function Se(t) { if (t.fragment !== null) { - t.update(), O(t.before_update); + t.update(), U(t.before_update); const e = t.dirty; t.dirty = [-1], t.fragment && t.fragment.p(t.ctx, e), t.after_update.forEach(Q); } } -const Ce = /* @__PURE__ */ new Set(); -function Ae(t, e) { - t && t.i && (Ce.delete(t), t.i(e)); +const ze = /* @__PURE__ */ new Set(); +function Ce(t, e) { + t && t.i && (ze.delete(t), t.i(e)); } -function Me(t, e, i, l) { - const { fragment: n, on_mount: o, on_destroy: r, after_update: f } = t.$$; +function Ae(t, e, i, l) { + const { fragment: n, on_mount: r, on_destroy: o, after_update: f } = t.$$; n && n.m(e, i), l || Q(() => { - const c = o.map(W).filter(_e); - r ? r.push(...c) : O(c), t.$$.on_mount = []; + const c = r.map(W).filter(ge); + o ? o.push(...c) : U(c), t.$$.on_mount = []; }), f.forEach(Q); } -function Ne(t, e) { +function Me(t, e) { const i = t.$$; - i.fragment !== null && (O(i.on_destroy), i.fragment && i.fragment.d(e), i.on_destroy = i.fragment = null, i.ctx = []); + i.fragment !== null && (U(i.on_destroy), i.fragment && i.fragment.d(e), i.on_destroy = i.fragment = null, i.ctx = []); } -function Te(t, e) { - t.$$.dirty[0] === -1 && (H.push(t), Se(), t.$$.dirty.fill(0)), t.$$.dirty[e / 31 | 0] |= 1 << e % 31; +function Ne(t, e) { + t.$$.dirty[0] === -1 && (R.push(t), je(), t.$$.dirty.fill(0)), t.$$.dirty[e / 31 | 0] |= 1 << e % 31; } -function ye(t, e, i, l, n, o, r, f = [-1]) { - const c = I; - R(t); +function we(t, e, i, l, n, r, o, f = [-1]) { + const c = O; + I(t); const s = t.$$ = { fragment: null, ctx: null, - props: o, - update: L, + props: r, + update: G, not_equal: n, - bound: ee(), + bound: Y(), on_mount: [], on_destroy: [], on_disconnect: [], before_update: [], after_update: [], context: new Map(e.context || (c ? c.$$.context : [])), - callbacks: ee(), + callbacks: Y(), dirty: f, skip_bound: !1, root: e.target || c.$$.root }; - r && r(s.root); - let k = !1; - if (s.ctx = i ? i(t, e.props || {}, (m, _, ...C) => { - const w = C.length ? C[0] : _; - return s.ctx && n(s.ctx[m], s.ctx[m] = w) && (!s.skip_bound && s.bound[m] && s.bound[m](w), k && Te(t, m)), _; - }) : [], s.update(), k = !0, O(s.before_update), s.fragment = l ? l(s.ctx) : !1, e.target) { + o && o(s.root); + let w = !1; + if (s.ctx = i ? i(t, e.props || {}, (g, _, ...A) => { + const y = A.length ? A[0] : _; + return s.ctx && n(s.ctx[g], s.ctx[g] = y) && (!s.skip_bound && s.bound[g] && s.bound[g](y), w && Ne(t, g)), _; + }) : [], s.update(), w = !0, U(s.before_update), s.fragment = l ? l(s.ctx) : !1, e.target) { if (e.hydrate) { - const m = $e(e.target); - s.fragment && s.fragment.l(m), m.forEach(x); + const g = xe(e.target); + s.fragment && s.fragment.l(g), g.forEach(k); } else s.fragment && s.fragment.c(); - e.intro && Ae(t.$$.fragment), Me(t, e.target, e.anchor, e.customElement), y(); + e.intro && Ce(t.$$.fragment), Ae(t, e.target, e.anchor, e.customElement), x(); } - R(c); + I(c); } let X; typeof HTMLElement == "function" && (X = class extends HTMLElement { @@ -174,7 +174,7 @@ typeof HTMLElement == "function" && (X = class extends HTMLElement { } connectedCallback() { const { on_mount: t } = this.$$; - this.$$.on_disconnect = t.map(W).filter(_e); + this.$$.on_disconnect = t.map(W).filter(ge); for (const e in this.$$.slotted) this.appendChild(this.$$.slotted[e]); } @@ -182,10 +182,10 @@ typeof HTMLElement == "function" && (X = class extends HTMLElement { this[t] = i; } disconnectedCallback() { - O(this.$$.on_disconnect); + U(this.$$.on_disconnect); } $destroy() { - Ne(this, 1), this.$destroy = L; + Me(this, 1), this.$destroy = G; } $on(t, e) { const i = this.$$.callbacks[t] || (this.$$.callbacks[t] = []); @@ -195,7 +195,7 @@ typeof HTMLElement == "function" && (X = class extends HTMLElement { }; } $set(t) { - this.$$set && !xe(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1); + this.$$set && !ye(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1); } }); function F(t, e = "long") { @@ -211,264 +211,282 @@ function F(t, e = "long") { function V(t) { return t.multidate ? F(t.start_datetime) + " - " + F(t.end_datetime) : F(t.start_datetime) + (t.end_datetime ? "-" + F(t.end_datetime, "short") : ""); } -function le(t, e, i) { +function te(t, e, i) { const l = t.slice(); return l[12] = e[i], l; } -function ne(t, e, i) { +function ie(t, e, i) { const l = t.slice(); return l[15] = e[i], l; } -function re(t) { +function le(t) { let e; return { c() { - e = g("link"), a(e, "rel", "stylesheet"), a(e, "href", t[4]); + e = m("link"), a(e, "rel", "stylesheet"), a(e, "href", t[4]); }, m(i, l) { - v(i, e, l); + p(i, e, l); }, p(i, l) { l & 16 && a(e, "href", i[4]); }, d(i) { - i && x(e); + i && k(e); + } + }; +} +function ne(t) { + let e, i, l = t[1] && t[3] === "true" && re(t), n = t[5], r = []; + for (let o = 0; o < n.length; o += 1) + r[o] = fe(te(t, n, o)); + return { + c() { + e = m("div"), l && l.c(), i = M(); + for (let o = 0; o < r.length; o += 1) + r[o].c(); + a(e, "id", "gancioEvents"), L(e, "dark", t[2] === "dark"), L(e, "light", t[2] === "light"), L(e, "sidebar", t[3] === "true"), L(e, "nosidebar", t[3] !== "true"); + }, + m(o, f) { + p(o, e, f), l && l.m(e, null), u(e, i); + for (let c = 0; c < r.length; c += 1) + r[c].m(e, null); + }, + p(o, f) { + if (o[1] && o[3] === "true" ? l ? l.p(o, f) : (l = re(o), l.c(), l.m(e, i)) : l && (l.d(1), l = null), f & 41) { + n = o[5]; + let c; + for (c = 0; c < n.length; c += 1) { + const s = te(o, n, c); + r[c] ? r[c].p(s, f) : (r[c] = fe(s), r[c].c(), r[c].m(e, null)); + } + for (; c < r.length; c += 1) + r[c].d(1); + r.length = n.length; + } + f & 4 && L(e, "dark", o[2] === "dark"), f & 4 && L(e, "light", o[2] === "light"), f & 8 && L(e, "sidebar", o[3] === "true"), f & 8 && L(e, "nosidebar", o[3] !== "true"); + }, + d(o) { + o && k(e), l && l.d(), be(r, o); + } + }; +} +function re(t) { + let e, i, l, n, r, o, f; + return { + c() { + e = m("a"), i = m("div"), l = m("div"), n = $(t[1]), r = M(), o = m("img"), a(l, "class", "title"), a(o, "id", "logo"), a(o, "alt", "logo"), H(o.src, f = t[0] + "/logo.png") || a(o, "src", f), a(i, "class", "content"), a(e, "href", t[0]), a(e, "target", "_blank"), a(e, "id", "header"); + }, + m(c, s) { + p(c, e, s), u(e, i), u(i, l), u(l, n), u(i, r), u(i, o); + }, + p(c, s) { + s & 2 && T(n, c[1]), s & 1 && !H(o.src, f = c[0] + "/logo.png") && a(o, "src", f), s & 1 && a(e, "href", c[0]); + }, + d(c) { + c && k(e); } }; } function oe(t) { - let e, i, l = t[1] && t[3] === "true" && ae(t), n = t[5], o = []; - for (let r = 0; r < n.length; r += 1) - o[r] = ue(le(t, n, r)); - return { - c() { - e = g("div"), l && l.c(), i = z(); - for (let r = 0; r < o.length; r += 1) - o[r].c(); - a(e, "id", "gancioEvents"), T(e, "dark", t[2] === "dark"), T(e, "light", t[2] === "light"), T(e, "sidebar", t[3] === "true"), T(e, "nosidebar", t[3] !== "true"); - }, - m(r, f) { - v(r, e, f), l && l.m(e, null), u(e, i); - for (let c = 0; c < o.length; c += 1) - o[c].m(e, null); - }, - p(r, f) { - if (r[1] && r[3] === "true" ? l ? l.p(r, f) : (l = ae(r), l.c(), l.m(e, i)) : l && (l.d(1), l = null), f & 41) { - n = r[5]; - let c; - for (c = 0; c < n.length; c += 1) { - const s = le(r, n, c); - o[c] ? o[c].p(s, f) : (o[c] = ue(s), o[c].c(), o[c].m(e, null)); - } - for (; c < o.length; c += 1) - o[c].d(1); - o.length = n.length; - } - f & 4 && T(e, "dark", r[2] === "dark"), f & 4 && T(e, "light", r[2] === "light"), f & 8 && T(e, "sidebar", r[3] === "true"), f & 8 && T(e, "nosidebar", r[3] !== "true"); - }, - d(r) { - r && x(e), l && l.d(), pe(o, r); - } - }; -} -function ae(t) { - let e, i, l, n, o, r, f; - return { - c() { - e = g("a"), i = g("div"), l = g("div"), n = j(t[1]), o = z(), r = g("img"), a(l, "class", "title"), a(r, "id", "logo"), a(r, "alt", "logo"), G(r.src, f = t[0] + "/logo.png") || a(r, "src", f), a(i, "class", "content"), a(e, "href", t[0]), a(e, "target", "_blank"), a(e, "id", "header"); - }, - m(c, s) { - v(c, e, s), u(e, i), u(i, l), u(l, n), u(i, o), u(i, r); - }, - p(c, s) { - s & 2 && N(n, c[1]), s & 1 && !G(r.src, f = c[0] + "/logo.png") && a(r, "src", f), s & 1 && a(e, "href", c[0]); - }, - d(c) { - c && x(e); - } - }; -} -function se(t) { let e; - function i(o, r) { - return o[12].media.length ? Ge : Le; + function i(r, o) { + return r[12].media.length ? Le : Te; } let l = i(t), n = l(t); return { c() { - e = g("div"), n.c(), a(e, "class", "img"); + e = m("div"), n.c(), a(e, "class", "img"); }, - m(o, r) { - v(o, e, r), n.m(e, null); + m(r, o) { + p(r, e, o), n.m(e, null); }, - p(o, r) { - l === (l = i(o)) && n ? n.p(o, r) : (n.d(1), n = l(o), n && (n.c(), n.m(e, null))); + p(r, o) { + l === (l = i(r)) && n ? n.p(r, o) : (n.d(1), n = l(r), n && (n.c(), n.m(e, null))); }, - d(o) { - o && x(e), n.d(); + d(r) { + r && k(e), n.d(); + } + }; +} +function Te(t) { + let e, i, l; + return { + c() { + e = m("img"), a(e, "style", "aspect-ratio=1.7778;"), a(e, "alt", i = t[12].title), H(e.src, l = t[0] + "/fallbackimage.png") || a(e, "src", l), a(e, "loading", "lazy"); + }, + m(n, r) { + p(n, e, r); + }, + p(n, r) { + r & 32 && i !== (i = n[12].title) && a(e, "alt", i), r & 1 && !H(e.src, l = n[0] + "/fallbackimage.png") && a(e, "src", l); + }, + d(n) { + n && k(e); } }; } function Le(t) { - let e, i, l; - return { - c() { - e = g("img"), a(e, "style", "aspect-ratio=1.7778;"), a(e, "alt", i = t[12].title), G(e.src, l = t[0] + "/fallbackimage.png") || a(e, "src", l), a(e, "loading", "lazy"); - }, - m(n, o) { - v(n, e, o); - }, - p(n, o) { - o & 32 && i !== (i = n[12].title) && a(e, "alt", i), o & 1 && !G(e.src, l = n[0] + "/fallbackimage.png") && a(e, "src", l); - }, - d(n) { - n && x(e); - } - }; -} -function Ge(t) { let e, i, l, n; return { c() { - e = g("img"), a(e, "style", i = "object-position: " + de(t[12]) + "; aspect-ratio=1.7778;"), a(e, "alt", l = t[12].media[0].name), G(e.src, n = t[0] + "/media/thumb/" + t[12].media[0].url) || a(e, "src", n), a(e, "loading", "lazy"); + e = m("img"), a(e, "style", i = "object-position: " + ue(t[12]) + "; aspect-ratio=1.7778;"), a(e, "alt", l = t[12].media[0].name), H(e.src, n = t[0] + "/media/thumb/" + t[12].media[0].url) || a(e, "src", n), a(e, "loading", "lazy"); }, - m(o, r) { - v(o, e, r); + m(r, o) { + p(r, e, o); }, - p(o, r) { - r & 32 && i !== (i = "object-position: " + de(o[12]) + "; aspect-ratio=1.7778;") && a(e, "style", i), r & 32 && l !== (l = o[12].media[0].name) && a(e, "alt", l), r & 33 && !G(e.src, n = o[0] + "/media/thumb/" + o[12].media[0].url) && a(e, "src", n); + p(r, o) { + o & 32 && i !== (i = "object-position: " + ue(r[12]) + "; aspect-ratio=1.7778;") && a(e, "style", i), o & 32 && l !== (l = r[12].media[0].name) && a(e, "alt", l), o & 33 && !H(e.src, n = r[0] + "/media/thumb/" + r[12].media[0].url) && a(e, "src", n); }, - d(o) { - o && x(e); + d(r) { + r && k(e); } }; } -function ce(t) { - let e, i = t[12].tags, l = []; - for (let n = 0; n < i.length; n += 1) - l[n] = fe(ne(t, i, n)); +function ae(t) { + let e, i = t[12].place.address + "", l; return { c() { - e = g("div"); + e = m("span"), l = $(i), a(e, "class", "subtitle"); + }, + m(n, r) { + p(n, e, r), u(e, l); + }, + p(n, r) { + r & 32 && i !== (i = n[12].place.address + "") && T(l, i); + }, + d(n) { + n && k(e); + } + }; +} +function se(t) { + let e, i = t[12].tags, l = []; + for (let n = 0; n < i.length; n += 1) + l[n] = ce(ie(t, i, n)); + return { + c() { + e = m("div"); for (let n = 0; n < l.length; n += 1) l[n].c(); a(e, "class", "tags"); }, - m(n, o) { - v(n, e, o); - for (let r = 0; r < l.length; r += 1) - l[r].m(e, null); + m(n, r) { + p(n, e, r); + for (let o = 0; o < l.length; o += 1) + l[o].m(e, null); }, - p(n, o) { - if (o & 32) { + p(n, r) { + if (r & 32) { i = n[12].tags; - let r; - for (r = 0; r < i.length; r += 1) { - const f = ne(n, i, r); - l[r] ? l[r].p(f, o) : (l[r] = fe(f), l[r].c(), l[r].m(e, null)); + let o; + for (o = 0; o < i.length; o += 1) { + const f = ie(n, i, o); + l[o] ? l[o].p(f, r) : (l[o] = ce(f), l[o].c(), l[o].m(e, null)); } - for (; r < l.length; r += 1) - l[r].d(1); + for (; o < l.length; o += 1) + l[o].d(1); l.length = i.length; } }, d(n) { - n && x(e), pe(l, n); + n && k(e), be(l, n); + } + }; +} +function ce(t) { + let e, i, l = t[15] + "", n; + return { + c() { + e = m("span"), i = $("#"), n = $(l), a(e, "class", "tag"); + }, + m(r, o) { + p(r, e, o), u(e, i), u(e, n); + }, + p(r, o) { + o & 32 && l !== (l = r[15] + "") && T(n, l); + }, + d(r) { + r && k(e); } }; } function fe(t) { - let e, i, l = t[15] + "", n; + let e, i, l, n, r = V(t[12]) + "", o, f, c, s = t[12].title + "", w, g, _, A, y = t[12].place.name + "", d, z, h, v, C, q, E = t[3] !== "true" && oe(t), j = t[12].place.name !== "online" && ae(t), S = t[12].tags.length && se(t); return { c() { - e = g("span"), i = j("#"), n = j(l), a(e, "class", "tag"); + e = m("a"), E && E.c(), i = M(), l = m("div"), n = m("div"), o = $(r), f = M(), c = m("div"), w = $(s), g = M(), _ = m("span"), A = $('@"'), d = $(y), z = $(`" + `), j && j.c(), h = M(), S && S.c(), v = M(), a(n, "class", "subtitle"), a(c, "class", "title"), a(_, "class", "place"), a(l, "class", "content"), a(e, "href", C = t[0] + "/event/" + (t[12].slug || t[12].id)), a(e, "class", "event"), a(e, "title", q = t[12].title), a(e, "target", "_blank"); }, - m(o, r) { - v(o, e, r), u(e, i), u(e, n); + m(b, N) { + p(b, e, N), E && E.m(e, null), u(e, i), u(e, l), u(l, n), u(n, o), u(l, f), u(l, c), u(c, w), u(l, g), u(l, _), u(_, A), u(_, d), u(_, z), j && j.m(_, null), u(l, h), S && S.m(l, null), u(e, v); }, - p(o, r) { - r & 32 && l !== (l = o[15] + "") && N(n, l); + p(b, N) { + b[3] !== "true" ? E ? E.p(b, N) : (E = oe(b), E.c(), E.m(e, i)) : E && (E.d(1), E = null), N & 32 && r !== (r = V(b[12]) + "") && T(o, r), N & 32 && s !== (s = b[12].title + "") && T(w, s), N & 32 && y !== (y = b[12].place.name + "") && T(d, y), b[12].place.name !== "online" ? j ? j.p(b, N) : (j = ae(b), j.c(), j.m(_, null)) : j && (j.d(1), j = null), b[12].tags.length ? S ? S.p(b, N) : (S = se(b), S.c(), S.m(l, null)) : S && (S.d(1), S = null), N & 33 && C !== (C = b[0] + "/event/" + (b[12].slug || b[12].id)) && a(e, "href", C), N & 32 && q !== (q = b[12].title) && a(e, "title", q); }, - d(o) { - o && x(e); + d(b) { + b && k(e), E && E.d(), j && j.d(), S && S.d(); + } + }; +} +function Ge(t) { + let e, i, l = t[4] && le(t), n = t[5].length && ne(t); + return { + c() { + l && l.c(), e = M(), n && n.c(), i = pe(), this.c = G; + }, + m(r, o) { + l && l.m(r, o), p(r, e, o), n && n.m(r, o), p(r, i, o); + }, + p(r, [o]) { + r[4] ? l ? l.p(r, o) : (l = le(r), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null), r[5].length ? n ? n.p(r, o) : (n = ne(r), n.c(), n.m(i.parentNode, i)) : n && (n.d(1), n = null); + }, + i: G, + o: G, + d(r) { + l && l.d(r), r && k(e), n && n.d(r), r && k(i); } }; } function ue(t) { - let e, i, l, n, o = V(t[12]) + "", r, f, c, s = t[12].title + "", k, m, _, C, w = t[12].place.name + "", d, S, h, b = t[12].place.address + "", A, Y, Z, U, q, $ = t[3] !== "true" && se(t), E = t[12].tags.length && ce(t); - return { - c() { - e = g("a"), $ && $.c(), i = z(), l = g("div"), n = g("div"), r = j(o), f = z(), c = g("div"), k = j(s), m = z(), _ = g("span"), C = j("@"), d = j(w), S = z(), h = g("span"), A = j(b), Y = z(), E && E.c(), Z = z(), a(n, "class", "subtitle"), a(c, "class", "title"), a(h, "class", "subtitle"), a(_, "class", "place"), a(l, "class", "content"), a(e, "href", U = t[0] + "/event/" + (t[12].slug || t[12].id)), a(e, "class", "event"), a(e, "title", q = t[12].title), a(e, "target", "_blank"); - }, - m(p, M) { - v(p, e, M), $ && $.m(e, null), u(e, i), u(e, l), u(l, n), u(n, r), u(l, f), u(l, c), u(c, k), u(l, m), u(l, _), u(_, C), u(_, d), u(_, S), u(_, h), u(h, A), u(l, Y), E && E.m(l, null), u(e, Z); - }, - p(p, M) { - p[3] !== "true" ? $ ? $.p(p, M) : ($ = se(p), $.c(), $.m(e, i)) : $ && ($.d(1), $ = null), M & 32 && o !== (o = V(p[12]) + "") && N(r, o), M & 32 && s !== (s = p[12].title + "") && N(k, s), M & 32 && w !== (w = p[12].place.name + "") && N(d, w), M & 32 && b !== (b = p[12].place.address + "") && N(A, b), p[12].tags.length ? E ? E.p(p, M) : (E = ce(p), E.c(), E.m(l, null)) : E && (E.d(1), E = null), M & 33 && U !== (U = p[0] + "/event/" + (p[12].slug || p[12].id)) && a(e, "href", U), M & 32 && q !== (q = p[12].title) && a(e, "title", q); - }, - d(p) { - p && x(e), $ && $.d(), E && E.d(); - } - }; -} -function He(t) { - let e, i, l = t[4] && re(t), n = t[5].length && oe(t); - return { - c() { - l && l.c(), e = z(), n && n.c(), i = ve(), this.c = L; - }, - m(o, r) { - l && l.m(o, r), v(o, e, r), n && n.m(o, r), v(o, i, r); - }, - p(o, [r]) { - o[4] ? l ? l.p(o, r) : (l = re(o), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null), o[5].length ? n ? n.p(o, r) : (n = oe(o), n.c(), n.m(i.parentNode, i)) : n && (n.d(1), n = null); - }, - i: L, - o: L, - d(o) { - l && l.d(o), o && x(e), n && n.d(o), o && x(i); - } - }; -} -function de(t) { if (t.media && t.media[0].focalpoint) { const e = t.media[0].focalpoint; return `${(e[0] + 1) * 50}% ${(e[1] + 1) * 50}%`; } return "center center"; } -function Re(t, e, i) { - let { baseurl: l = "" } = e, { title: n = "" } = e, { maxlength: o = !1 } = e, { tags: r = "" } = e, { places: f = "" } = e, { theme: c = "light" } = e, { show_recurrent: s = !1 } = e, { sidebar: k = "true" } = e, { external_style: m = "" } = e, _ = !1, C = []; - function w(d) { +function He(t, e, i) { + let { baseurl: l = "" } = e, { title: n = "" } = e, { maxlength: r = !1 } = e, { tags: o = "" } = e, { places: f = "" } = e, { theme: c = "light" } = e, { show_recurrent: s = !1 } = e, { sidebar: w = "true" } = e, { external_style: g = "" } = e, _ = !1, A = []; + function y(d) { if (!_) return; - const S = []; - o && S.push(`max=${o}`), r && S.push(`tags=${r}`), f && S.push(`places=${f}`), S.push(`show_recurrent=${s ? "true" : "false"}`), fetch(`${l}/api/events?${S.join("&")}`).then((h) => h.json()).then((h) => { - i(5, C = h); + const z = []; + r && z.push(`max=${r}`), o && z.push(`tags=${o}`), f && z.push(`places=${f}`), z.push(`show_recurrent=${s ? "true" : "false"}`), fetch(`${l}/api/events?${z.join("&")}`).then((h) => h.json()).then((h) => { + i(5, A = h); }).catch((h) => { console.error("Error loading Gancio API -> ", h); }); } - return we(() => { - _ = !0, w(); + return ke(() => { + _ = !0, y(); }), t.$$set = (d) => { - "baseurl" in d && i(0, l = d.baseurl), "title" in d && i(1, n = d.title), "maxlength" in d && i(6, o = d.maxlength), "tags" in d && i(7, r = d.tags), "places" in d && i(8, f = d.places), "theme" in d && i(2, c = d.theme), "show_recurrent" in d && i(9, s = d.show_recurrent), "sidebar" in d && i(3, k = d.sidebar), "external_style" in d && i(4, m = d.external_style); + "baseurl" in d && i(0, l = d.baseurl), "title" in d && i(1, n = d.title), "maxlength" in d && i(6, r = d.maxlength), "tags" in d && i(7, o = d.tags), "places" in d && i(8, f = d.places), "theme" in d && i(2, c = d.theme), "show_recurrent" in d && i(9, s = d.show_recurrent), "sidebar" in d && i(3, w = d.sidebar), "external_style" in d && i(4, g = d.external_style); }, t.$$.update = () => { - t.$$.dirty & 975 && w(); + t.$$.dirty & 975 && y(); }, [ l, n, c, - k, - m, - C, - o, + w, + g, + A, r, + o, f, s ]; } -class Ie extends X { +class Re extends X { constructor(e) { super(), this.shadowRoot.innerHTML = ``, ye( + padding 0.3s;box-sizing:content-box}a:hover .title,a:focus .title,a:active .title{text-decoration:underline}.dark{--bg-odd-color:#161616;--bg-even-color:#222;--bg-hover-color:#333;--text-color:white;--title-color:white;--line-color:rgba(120, 120, 120, 0.2)}.light{--bg-odd-color:#f5f5f5;--bg-even-color:#fafafa;--bg-hover-color:#eee;--text-color:#222;--title-color:black;--line-color:rgba(220, 220, 220, 0.9)}.sidebar a{background-color:var(--bg-even-color);border-bottom:1px solid var(--line-color)}.sidebar a:hover,.sidebar a:focus,.sidebar a:active{background-color:var(--bg-hover-color);padding-left:15px;padding-right:25px}.place{font-weight:400;font-size:1.2rem;line-height:1.4rem;color:orangered}.title{color:var(--title-color);font-weight:bold;font-size:1.3rem;line-height:1.1em}.nosidebar .title{font-size:1.9em;line-height:1.1em}.subtitle{font-size:1rem;line-height:1.1em;color:var(--title-color);opacity:0.9}.tag{margin-right:10px;display:inline-block}`, we( this, { target: this.shadowRoot, - props: ke(this.attributes), + props: ve(this.attributes), customElement: !0 }, - Re, He, - be, + Ge, + _e, { baseurl: 0, title: 1, @@ -498,7 +516,7 @@ class Ie extends X { external_style: 4 }, null - ), e && (e.target && v(e.target, this, e.anchor), e.props && (this.$set(e.props), y())); + ), e && (e.target && p(e.target, this, e.anchor), e.props && (this.$set(e.props), x())); } static get observedAttributes() { return [ @@ -517,108 +535,108 @@ class Ie extends X { return this.$$.ctx[0]; } set baseurl(e) { - this.$$set({ baseurl: e }), y(); + this.$$set({ baseurl: e }), x(); } get title() { return this.$$.ctx[1]; } set title(e) { - this.$$set({ title: e }), y(); + this.$$set({ title: e }), x(); } get maxlength() { return this.$$.ctx[6]; } set maxlength(e) { - this.$$set({ maxlength: e }), y(); + this.$$set({ maxlength: e }), x(); } get tags() { return this.$$.ctx[7]; } set tags(e) { - this.$$set({ tags: e }), y(); + this.$$set({ tags: e }), x(); } get places() { return this.$$.ctx[8]; } set places(e) { - this.$$set({ places: e }), y(); + this.$$set({ places: e }), x(); } get theme() { return this.$$.ctx[2]; } set theme(e) { - this.$$set({ theme: e }), y(); + this.$$set({ theme: e }), x(); } get show_recurrent() { return this.$$.ctx[9]; } set show_recurrent(e) { - this.$$set({ show_recurrent: e }), y(); + this.$$set({ show_recurrent: e }), x(); } get sidebar() { return this.$$.ctx[3]; } set sidebar(e) { - this.$$set({ sidebar: e }), y(); + this.$$set({ sidebar: e }), x(); } get external_style() { return this.$$.ctx[4]; } set external_style(e) { - this.$$set({ external_style: e }), y(); + this.$$set({ external_style: e }), x(); } } -customElements.define("gancio-events", Ie); -function he(t) { - let e, i, l, n, o = t[1].title + "", r, f, c, s = V(t[1]) + "", k, m, _, C, w = t[1].place.name + "", d, S, h = t[1].media.length && ge(t); +customElements.define("gancio-events", Re); +function de(t) { + let e, i, l, n, r = t[1].title + "", o, f, c, s = V(t[1]) + "", w, g, _, A, y = t[1].place.name + "", d, z, h = t[1].media.length && he(t); return { c() { - e = g("a"), h && h.c(), i = z(), l = g("div"), n = g("strong"), r = j(o), f = z(), c = g("div"), k = j(s), m = z(), _ = g("div"), C = j("@"), d = j(w), a(_, "class", "place"), a(l, "class", "container"), a(e, "href", S = t[0] + "/event/" + (t[1].slug || t[1].id)), a(e, "class", "card"), a(e, "target", "_blank"); + e = m("a"), h && h.c(), i = M(), l = m("div"), n = m("strong"), o = $(r), f = M(), c = m("div"), w = $(s), g = M(), _ = m("div"), A = $("@"), d = $(y), a(_, "class", "place"), a(l, "class", "container"), a(e, "href", z = t[0] + "/event/" + (t[1].slug || t[1].id)), a(e, "class", "card"), a(e, "target", "_blank"); }, - m(b, A) { - v(b, e, A), h && h.m(e, null), u(e, i), u(e, l), u(l, n), u(n, r), u(l, f), u(l, c), u(c, k), u(l, m), u(l, _), u(_, C), u(_, d); + m(v, C) { + p(v, e, C), h && h.m(e, null), u(e, i), u(e, l), u(l, n), u(n, o), u(l, f), u(l, c), u(c, w), u(l, g), u(l, _), u(_, A), u(_, d); }, - p(b, A) { - b[1].media.length ? h ? h.p(b, A) : (h = ge(b), h.c(), h.m(e, i)) : h && (h.d(1), h = null), A & 2 && o !== (o = b[1].title + "") && N(r, o), A & 2 && s !== (s = V(b[1]) + "") && N(k, s), A & 2 && w !== (w = b[1].place.name + "") && N(d, w), A & 3 && S !== (S = b[0] + "/event/" + (b[1].slug || b[1].id)) && a(e, "href", S); + p(v, C) { + v[1].media.length ? h ? h.p(v, C) : (h = he(v), h.c(), h.m(e, i)) : h && (h.d(1), h = null), C & 2 && r !== (r = v[1].title + "") && T(o, r), C & 2 && s !== (s = V(v[1]) + "") && T(w, s), C & 2 && y !== (y = v[1].place.name + "") && T(d, y), C & 3 && z !== (z = v[0] + "/event/" + (v[1].slug || v[1].id)) && a(e, "href", z); }, - d(b) { - b && x(e), h && h.d(); + d(v) { + v && k(e), h && h.d(); } }; } -function ge(t) { +function he(t) { let e, i, l, n; return { c() { - e = g("img"), G(e.src, i = t[2](t[1])) || a(e, "src", i), a(e, "alt", l = t[1].media[0].name), a(e, "style", n = "object-position: " + me(t[1]) + "; aspect-ratio=1.7778;"); + e = m("img"), H(e.src, i = t[2](t[1])) || a(e, "src", i), a(e, "alt", l = t[1].media[0].name), a(e, "style", n = "object-position: " + me(t[1]) + "; aspect-ratio=1.7778;"); }, - m(o, r) { - v(o, e, r); + m(r, o) { + p(r, e, o); }, - p(o, r) { - r & 2 && !G(e.src, i = o[2](o[1])) && a(e, "src", i), r & 2 && l !== (l = o[1].media[0].name) && a(e, "alt", l), r & 2 && n !== (n = "object-position: " + me(o[1]) + "; aspect-ratio=1.7778;") && a(e, "style", n); + p(r, o) { + o & 2 && !H(e.src, i = r[2](r[1])) && a(e, "src", i), o & 2 && l !== (l = r[1].media[0].name) && a(e, "alt", l), o & 2 && n !== (n = "object-position: " + me(r[1]) + "; aspect-ratio=1.7778;") && a(e, "style", n); }, - d(o) { - o && x(e); + d(r) { + r && k(e); } }; } -function Oe(t) { - let e, i = t[1] && he(t); +function Ie(t) { + let e, i = t[1] && de(t); return { c() { - i && i.c(), e = ve(), this.c = L; + i && i.c(), e = pe(), this.c = G; }, m(l, n) { - i && i.m(l, n), v(l, e, n); + i && i.m(l, n), p(l, e, n); }, p(l, [n]) { - l[1] ? i ? i.p(l, n) : (i = he(l), i.c(), i.m(e.parentNode, e)) : i && (i.d(1), i = null); + l[1] ? i ? i.p(l, n) : (i = de(l), i.c(), i.m(e.parentNode, e)) : i && (i.d(1), i = null); }, - i: L, - o: L, + i: G, + o: G, d(l) { - i && i.d(l), l && x(e); + i && i.d(l), l && k(e); } }; } @@ -629,13 +647,13 @@ function me(t) { } return "center center"; } -function Ue(t, e, i) { - let { baseurl: l = "https://demo.gancio.org" } = e, { id: n } = e, o = !1, r; - function f(s, k) { - o && fetch(`${k}/api/event/detail/${s}`).then((m) => m.json()).then((m) => i(1, r = m)); +function Oe(t, e, i) { + let { baseurl: l = "https://demo.gancio.org" } = e, { id: n } = e, r = !1, o; + function f(s, w) { + r && fetch(`${w}/api/event/detail/${s}`).then((g) => g.json()).then((g) => i(1, o = g)); } - we(() => { - o = !0, f(n, l); + ke(() => { + r = !0, f(n, l); }); function c(s) { return `${l}/media/thumb/${s.media[0].url}`; @@ -644,24 +662,24 @@ function Ue(t, e, i) { "baseurl" in s && i(0, l = s.baseurl), "id" in s && i(3, n = s.id); }, t.$$.update = () => { t.$$.dirty & 9 && f(n, l); - }, [l, r, c, n]; + }, [l, o, c, n]; } -class qe extends X { +class Ue extends X { constructor(e) { super(), this.shadowRoot.innerHTML = ``, ye( + sans-serif;box-shadow:0 4px 8px 0 rgba(0, 0, 0, 0.2);transition:0.3s;border-radius:5px;max-width:500px;text-decoration:none;color:white;background-color:#1e1e1e;overflow:hidden}img{border-radius:5px 5px 0 0;max-height:250px;min-height:160px;width:100%;object-fit:cover;object-position:top}.card:hover .container{padding-left:20px}.card:hover{box-shadow:0 8px 16px 0 rgba(0, 0, 0, 0.2)}.container{transition:padding-left 0.2s;padding:16px}.place{font-weight:600;color:#ff6e40}`, we( this, { target: this.shadowRoot, - props: ke(this.attributes), + props: ve(this.attributes), customElement: !0 }, - Ue, Oe, - be, + Ie, + _e, { baseurl: 0, id: 3 }, null - ), e && (e.target && v(e.target, this, e.anchor), e.props && (this.$set(e.props), y())); + ), e && (e.target && p(e.target, this, e.anchor), e.props && (this.$set(e.props), x())); } static get observedAttributes() { return ["baseurl", "id"]; @@ -670,13 +688,13 @@ class qe extends X { return this.$$.ctx[0]; } set baseurl(e) { - this.$$set({ baseurl: e }), y(); + this.$$set({ baseurl: e }), x(); } get id() { return this.$$.ctx[3]; } set id(e) { - this.$$set({ id: e }), y(); + this.$$set({ id: e }), x(); } } -customElements.define("gancio-event", qe); +customElements.define("gancio-event", Ue); diff --git a/wp-plugin/js/gancio-events.es.js b/wp-plugin/js/gancio-events.es.js index 7376dcbb..de0e2357 100644 --- a/wp-plugin/js/gancio-events.es.js +++ b/wp-plugin/js/gancio-events.es.js @@ -1,171 +1,171 @@ -function L() { +function G() { } function W(t) { return t(); } -function ee() { +function Y() { return /* @__PURE__ */ Object.create(null); } -function O(t) { +function U(t) { t.forEach(W); } -function _e(t) { +function ge(t) { return typeof t == "function"; } -function be(t, e) { +function _e(t, e) { return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function"; } let B; -function G(t, e) { +function H(t, e) { return B || (B = document.createElement("a")), B.href = e, t === B.href; } -function xe(t) { +function ye(t) { return Object.keys(t).length === 0; } function u(t, e) { t.appendChild(e); } -function v(t, e, i) { +function p(t, e, i) { t.insertBefore(e, i || null); } -function x(t) { +function k(t) { t.parentNode.removeChild(t); } -function pe(t, e) { +function be(t, e) { for (let i = 0; i < t.length; i += 1) t[i] && t[i].d(e); } -function g(t) { +function m(t) { return document.createElement(t); } -function j(t) { +function $(t) { return document.createTextNode(t); } -function z() { - return j(" "); +function M() { + return $(" "); } -function ve() { - return j(""); +function pe() { + return $(""); } function a(t, e, i) { i == null ? t.removeAttribute(e) : t.getAttribute(e) !== i && t.setAttribute(e, i); } -function $e(t) { +function xe(t) { return Array.from(t.childNodes); } -function N(t, e) { +function T(t, e) { e = "" + e, t.wholeText !== e && (t.data = e); } -function T(t, e, i) { +function L(t, e, i) { t.classList[i ? "add" : "remove"](e); } -function ke(t) { +function ve(t) { const e = {}; for (const i of t) e[i.name] = i.value; return e; } -let I; -function R(t) { - I = t; +let O; +function I(t) { + O = t; } -function Ee() { - if (!I) +function $e() { + if (!O) throw new Error("Function called outside component initialization"); - return I; + return O; } -function we(t) { - Ee().$$.on_mount.push(t); +function ke(t) { + $e().$$.on_mount.push(t); } -const H = [], te = [], P = [], ie = [], je = Promise.resolve(); +const R = [], Z = [], P = [], ee = [], Ee = Promise.resolve(); let K = !1; -function Se() { - K || (K = !0, je.then(y)); +function je() { + K || (K = !0, Ee.then(x)); } function Q(t) { P.push(t); } const J = /* @__PURE__ */ new Set(); let D = 0; -function y() { - const t = I; +function x() { + const t = O; do { - for (; D < H.length; ) { - const e = H[D]; - D++, R(e), ze(e.$$); + for (; D < R.length; ) { + const e = R[D]; + D++, I(e), Se(e.$$); } - for (R(null), H.length = 0, D = 0; te.length; ) - te.pop()(); + for (I(null), R.length = 0, D = 0; Z.length; ) + Z.pop()(); for (let e = 0; e < P.length; e += 1) { const i = P[e]; J.has(i) || (J.add(i), i()); } P.length = 0; - } while (H.length); - for (; ie.length; ) - ie.pop()(); - K = !1, J.clear(), R(t); + } while (R.length); + for (; ee.length; ) + ee.pop()(); + K = !1, J.clear(), I(t); } -function ze(t) { +function Se(t) { if (t.fragment !== null) { - t.update(), O(t.before_update); + t.update(), U(t.before_update); const e = t.dirty; t.dirty = [-1], t.fragment && t.fragment.p(t.ctx, e), t.after_update.forEach(Q); } } -const Ce = /* @__PURE__ */ new Set(); -function Ae(t, e) { - t && t.i && (Ce.delete(t), t.i(e)); +const ze = /* @__PURE__ */ new Set(); +function Ce(t, e) { + t && t.i && (ze.delete(t), t.i(e)); } -function Me(t, e, i, l) { - const { fragment: n, on_mount: o, on_destroy: r, after_update: f } = t.$$; +function Ae(t, e, i, l) { + const { fragment: n, on_mount: r, on_destroy: o, after_update: f } = t.$$; n && n.m(e, i), l || Q(() => { - const c = o.map(W).filter(_e); - r ? r.push(...c) : O(c), t.$$.on_mount = []; + const c = r.map(W).filter(ge); + o ? o.push(...c) : U(c), t.$$.on_mount = []; }), f.forEach(Q); } -function Ne(t, e) { +function Me(t, e) { const i = t.$$; - i.fragment !== null && (O(i.on_destroy), i.fragment && i.fragment.d(e), i.on_destroy = i.fragment = null, i.ctx = []); + i.fragment !== null && (U(i.on_destroy), i.fragment && i.fragment.d(e), i.on_destroy = i.fragment = null, i.ctx = []); } -function Te(t, e) { - t.$$.dirty[0] === -1 && (H.push(t), Se(), t.$$.dirty.fill(0)), t.$$.dirty[e / 31 | 0] |= 1 << e % 31; +function Ne(t, e) { + t.$$.dirty[0] === -1 && (R.push(t), je(), t.$$.dirty.fill(0)), t.$$.dirty[e / 31 | 0] |= 1 << e % 31; } -function ye(t, e, i, l, n, o, r, f = [-1]) { - const c = I; - R(t); +function we(t, e, i, l, n, r, o, f = [-1]) { + const c = O; + I(t); const s = t.$$ = { fragment: null, ctx: null, - props: o, - update: L, + props: r, + update: G, not_equal: n, - bound: ee(), + bound: Y(), on_mount: [], on_destroy: [], on_disconnect: [], before_update: [], after_update: [], context: new Map(e.context || (c ? c.$$.context : [])), - callbacks: ee(), + callbacks: Y(), dirty: f, skip_bound: !1, root: e.target || c.$$.root }; - r && r(s.root); - let k = !1; - if (s.ctx = i ? i(t, e.props || {}, (m, _, ...C) => { - const w = C.length ? C[0] : _; - return s.ctx && n(s.ctx[m], s.ctx[m] = w) && (!s.skip_bound && s.bound[m] && s.bound[m](w), k && Te(t, m)), _; - }) : [], s.update(), k = !0, O(s.before_update), s.fragment = l ? l(s.ctx) : !1, e.target) { + o && o(s.root); + let w = !1; + if (s.ctx = i ? i(t, e.props || {}, (g, _, ...A) => { + const y = A.length ? A[0] : _; + return s.ctx && n(s.ctx[g], s.ctx[g] = y) && (!s.skip_bound && s.bound[g] && s.bound[g](y), w && Ne(t, g)), _; + }) : [], s.update(), w = !0, U(s.before_update), s.fragment = l ? l(s.ctx) : !1, e.target) { if (e.hydrate) { - const m = $e(e.target); - s.fragment && s.fragment.l(m), m.forEach(x); + const g = xe(e.target); + s.fragment && s.fragment.l(g), g.forEach(k); } else s.fragment && s.fragment.c(); - e.intro && Ae(t.$$.fragment), Me(t, e.target, e.anchor, e.customElement), y(); + e.intro && Ce(t.$$.fragment), Ae(t, e.target, e.anchor, e.customElement), x(); } - R(c); + I(c); } let X; typeof HTMLElement == "function" && (X = class extends HTMLElement { @@ -174,7 +174,7 @@ typeof HTMLElement == "function" && (X = class extends HTMLElement { } connectedCallback() { const { on_mount: t } = this.$$; - this.$$.on_disconnect = t.map(W).filter(_e); + this.$$.on_disconnect = t.map(W).filter(ge); for (const e in this.$$.slotted) this.appendChild(this.$$.slotted[e]); } @@ -182,10 +182,10 @@ typeof HTMLElement == "function" && (X = class extends HTMLElement { this[t] = i; } disconnectedCallback() { - O(this.$$.on_disconnect); + U(this.$$.on_disconnect); } $destroy() { - Ne(this, 1), this.$destroy = L; + Me(this, 1), this.$destroy = G; } $on(t, e) { const i = this.$$.callbacks[t] || (this.$$.callbacks[t] = []); @@ -195,7 +195,7 @@ typeof HTMLElement == "function" && (X = class extends HTMLElement { }; } $set(t) { - this.$$set && !xe(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1); + this.$$set && !ye(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1); } }); function F(t, e = "long") { @@ -211,264 +211,282 @@ function F(t, e = "long") { function V(t) { return t.multidate ? F(t.start_datetime) + " - " + F(t.end_datetime) : F(t.start_datetime) + (t.end_datetime ? "-" + F(t.end_datetime, "short") : ""); } -function le(t, e, i) { +function te(t, e, i) { const l = t.slice(); return l[12] = e[i], l; } -function ne(t, e, i) { +function ie(t, e, i) { const l = t.slice(); return l[15] = e[i], l; } -function re(t) { +function le(t) { let e; return { c() { - e = g("link"), a(e, "rel", "stylesheet"), a(e, "href", t[4]); + e = m("link"), a(e, "rel", "stylesheet"), a(e, "href", t[4]); }, m(i, l) { - v(i, e, l); + p(i, e, l); }, p(i, l) { l & 16 && a(e, "href", i[4]); }, d(i) { - i && x(e); + i && k(e); + } + }; +} +function ne(t) { + let e, i, l = t[1] && t[3] === "true" && re(t), n = t[5], r = []; + for (let o = 0; o < n.length; o += 1) + r[o] = fe(te(t, n, o)); + return { + c() { + e = m("div"), l && l.c(), i = M(); + for (let o = 0; o < r.length; o += 1) + r[o].c(); + a(e, "id", "gancioEvents"), L(e, "dark", t[2] === "dark"), L(e, "light", t[2] === "light"), L(e, "sidebar", t[3] === "true"), L(e, "nosidebar", t[3] !== "true"); + }, + m(o, f) { + p(o, e, f), l && l.m(e, null), u(e, i); + for (let c = 0; c < r.length; c += 1) + r[c].m(e, null); + }, + p(o, f) { + if (o[1] && o[3] === "true" ? l ? l.p(o, f) : (l = re(o), l.c(), l.m(e, i)) : l && (l.d(1), l = null), f & 41) { + n = o[5]; + let c; + for (c = 0; c < n.length; c += 1) { + const s = te(o, n, c); + r[c] ? r[c].p(s, f) : (r[c] = fe(s), r[c].c(), r[c].m(e, null)); + } + for (; c < r.length; c += 1) + r[c].d(1); + r.length = n.length; + } + f & 4 && L(e, "dark", o[2] === "dark"), f & 4 && L(e, "light", o[2] === "light"), f & 8 && L(e, "sidebar", o[3] === "true"), f & 8 && L(e, "nosidebar", o[3] !== "true"); + }, + d(o) { + o && k(e), l && l.d(), be(r, o); + } + }; +} +function re(t) { + let e, i, l, n, r, o, f; + return { + c() { + e = m("a"), i = m("div"), l = m("div"), n = $(t[1]), r = M(), o = m("img"), a(l, "class", "title"), a(o, "id", "logo"), a(o, "alt", "logo"), H(o.src, f = t[0] + "/logo.png") || a(o, "src", f), a(i, "class", "content"), a(e, "href", t[0]), a(e, "target", "_blank"), a(e, "id", "header"); + }, + m(c, s) { + p(c, e, s), u(e, i), u(i, l), u(l, n), u(i, r), u(i, o); + }, + p(c, s) { + s & 2 && T(n, c[1]), s & 1 && !H(o.src, f = c[0] + "/logo.png") && a(o, "src", f), s & 1 && a(e, "href", c[0]); + }, + d(c) { + c && k(e); } }; } function oe(t) { - let e, i, l = t[1] && t[3] === "true" && ae(t), n = t[5], o = []; - for (let r = 0; r < n.length; r += 1) - o[r] = ue(le(t, n, r)); - return { - c() { - e = g("div"), l && l.c(), i = z(); - for (let r = 0; r < o.length; r += 1) - o[r].c(); - a(e, "id", "gancioEvents"), T(e, "dark", t[2] === "dark"), T(e, "light", t[2] === "light"), T(e, "sidebar", t[3] === "true"), T(e, "nosidebar", t[3] !== "true"); - }, - m(r, f) { - v(r, e, f), l && l.m(e, null), u(e, i); - for (let c = 0; c < o.length; c += 1) - o[c].m(e, null); - }, - p(r, f) { - if (r[1] && r[3] === "true" ? l ? l.p(r, f) : (l = ae(r), l.c(), l.m(e, i)) : l && (l.d(1), l = null), f & 41) { - n = r[5]; - let c; - for (c = 0; c < n.length; c += 1) { - const s = le(r, n, c); - o[c] ? o[c].p(s, f) : (o[c] = ue(s), o[c].c(), o[c].m(e, null)); - } - for (; c < o.length; c += 1) - o[c].d(1); - o.length = n.length; - } - f & 4 && T(e, "dark", r[2] === "dark"), f & 4 && T(e, "light", r[2] === "light"), f & 8 && T(e, "sidebar", r[3] === "true"), f & 8 && T(e, "nosidebar", r[3] !== "true"); - }, - d(r) { - r && x(e), l && l.d(), pe(o, r); - } - }; -} -function ae(t) { - let e, i, l, n, o, r, f; - return { - c() { - e = g("a"), i = g("div"), l = g("div"), n = j(t[1]), o = z(), r = g("img"), a(l, "class", "title"), a(r, "id", "logo"), a(r, "alt", "logo"), G(r.src, f = t[0] + "/logo.png") || a(r, "src", f), a(i, "class", "content"), a(e, "href", t[0]), a(e, "target", "_blank"), a(e, "id", "header"); - }, - m(c, s) { - v(c, e, s), u(e, i), u(i, l), u(l, n), u(i, o), u(i, r); - }, - p(c, s) { - s & 2 && N(n, c[1]), s & 1 && !G(r.src, f = c[0] + "/logo.png") && a(r, "src", f), s & 1 && a(e, "href", c[0]); - }, - d(c) { - c && x(e); - } - }; -} -function se(t) { let e; - function i(o, r) { - return o[12].media.length ? Ge : Le; + function i(r, o) { + return r[12].media.length ? Le : Te; } let l = i(t), n = l(t); return { c() { - e = g("div"), n.c(), a(e, "class", "img"); + e = m("div"), n.c(), a(e, "class", "img"); }, - m(o, r) { - v(o, e, r), n.m(e, null); + m(r, o) { + p(r, e, o), n.m(e, null); }, - p(o, r) { - l === (l = i(o)) && n ? n.p(o, r) : (n.d(1), n = l(o), n && (n.c(), n.m(e, null))); + p(r, o) { + l === (l = i(r)) && n ? n.p(r, o) : (n.d(1), n = l(r), n && (n.c(), n.m(e, null))); }, - d(o) { - o && x(e), n.d(); + d(r) { + r && k(e), n.d(); + } + }; +} +function Te(t) { + let e, i, l; + return { + c() { + e = m("img"), a(e, "style", "aspect-ratio=1.7778;"), a(e, "alt", i = t[12].title), H(e.src, l = t[0] + "/fallbackimage.png") || a(e, "src", l), a(e, "loading", "lazy"); + }, + m(n, r) { + p(n, e, r); + }, + p(n, r) { + r & 32 && i !== (i = n[12].title) && a(e, "alt", i), r & 1 && !H(e.src, l = n[0] + "/fallbackimage.png") && a(e, "src", l); + }, + d(n) { + n && k(e); } }; } function Le(t) { - let e, i, l; - return { - c() { - e = g("img"), a(e, "style", "aspect-ratio=1.7778;"), a(e, "alt", i = t[12].title), G(e.src, l = t[0] + "/fallbackimage.png") || a(e, "src", l), a(e, "loading", "lazy"); - }, - m(n, o) { - v(n, e, o); - }, - p(n, o) { - o & 32 && i !== (i = n[12].title) && a(e, "alt", i), o & 1 && !G(e.src, l = n[0] + "/fallbackimage.png") && a(e, "src", l); - }, - d(n) { - n && x(e); - } - }; -} -function Ge(t) { let e, i, l, n; return { c() { - e = g("img"), a(e, "style", i = "object-position: " + de(t[12]) + "; aspect-ratio=1.7778;"), a(e, "alt", l = t[12].media[0].name), G(e.src, n = t[0] + "/media/thumb/" + t[12].media[0].url) || a(e, "src", n), a(e, "loading", "lazy"); + e = m("img"), a(e, "style", i = "object-position: " + ue(t[12]) + "; aspect-ratio=1.7778;"), a(e, "alt", l = t[12].media[0].name), H(e.src, n = t[0] + "/media/thumb/" + t[12].media[0].url) || a(e, "src", n), a(e, "loading", "lazy"); }, - m(o, r) { - v(o, e, r); + m(r, o) { + p(r, e, o); }, - p(o, r) { - r & 32 && i !== (i = "object-position: " + de(o[12]) + "; aspect-ratio=1.7778;") && a(e, "style", i), r & 32 && l !== (l = o[12].media[0].name) && a(e, "alt", l), r & 33 && !G(e.src, n = o[0] + "/media/thumb/" + o[12].media[0].url) && a(e, "src", n); + p(r, o) { + o & 32 && i !== (i = "object-position: " + ue(r[12]) + "; aspect-ratio=1.7778;") && a(e, "style", i), o & 32 && l !== (l = r[12].media[0].name) && a(e, "alt", l), o & 33 && !H(e.src, n = r[0] + "/media/thumb/" + r[12].media[0].url) && a(e, "src", n); }, - d(o) { - o && x(e); + d(r) { + r && k(e); } }; } -function ce(t) { - let e, i = t[12].tags, l = []; - for (let n = 0; n < i.length; n += 1) - l[n] = fe(ne(t, i, n)); +function ae(t) { + let e, i = t[12].place.address + "", l; return { c() { - e = g("div"); + e = m("span"), l = $(i), a(e, "class", "subtitle"); + }, + m(n, r) { + p(n, e, r), u(e, l); + }, + p(n, r) { + r & 32 && i !== (i = n[12].place.address + "") && T(l, i); + }, + d(n) { + n && k(e); + } + }; +} +function se(t) { + let e, i = t[12].tags, l = []; + for (let n = 0; n < i.length; n += 1) + l[n] = ce(ie(t, i, n)); + return { + c() { + e = m("div"); for (let n = 0; n < l.length; n += 1) l[n].c(); a(e, "class", "tags"); }, - m(n, o) { - v(n, e, o); - for (let r = 0; r < l.length; r += 1) - l[r].m(e, null); + m(n, r) { + p(n, e, r); + for (let o = 0; o < l.length; o += 1) + l[o].m(e, null); }, - p(n, o) { - if (o & 32) { + p(n, r) { + if (r & 32) { i = n[12].tags; - let r; - for (r = 0; r < i.length; r += 1) { - const f = ne(n, i, r); - l[r] ? l[r].p(f, o) : (l[r] = fe(f), l[r].c(), l[r].m(e, null)); + let o; + for (o = 0; o < i.length; o += 1) { + const f = ie(n, i, o); + l[o] ? l[o].p(f, r) : (l[o] = ce(f), l[o].c(), l[o].m(e, null)); } - for (; r < l.length; r += 1) - l[r].d(1); + for (; o < l.length; o += 1) + l[o].d(1); l.length = i.length; } }, d(n) { - n && x(e), pe(l, n); + n && k(e), be(l, n); + } + }; +} +function ce(t) { + let e, i, l = t[15] + "", n; + return { + c() { + e = m("span"), i = $("#"), n = $(l), a(e, "class", "tag"); + }, + m(r, o) { + p(r, e, o), u(e, i), u(e, n); + }, + p(r, o) { + o & 32 && l !== (l = r[15] + "") && T(n, l); + }, + d(r) { + r && k(e); } }; } function fe(t) { - let e, i, l = t[15] + "", n; + let e, i, l, n, r = V(t[12]) + "", o, f, c, s = t[12].title + "", w, g, _, A, y = t[12].place.name + "", d, z, h, v, C, q, E = t[3] !== "true" && oe(t), j = t[12].place.name !== "online" && ae(t), S = t[12].tags.length && se(t); return { c() { - e = g("span"), i = j("#"), n = j(l), a(e, "class", "tag"); + e = m("a"), E && E.c(), i = M(), l = m("div"), n = m("div"), o = $(r), f = M(), c = m("div"), w = $(s), g = M(), _ = m("span"), A = $('@"'), d = $(y), z = $(`" + `), j && j.c(), h = M(), S && S.c(), v = M(), a(n, "class", "subtitle"), a(c, "class", "title"), a(_, "class", "place"), a(l, "class", "content"), a(e, "href", C = t[0] + "/event/" + (t[12].slug || t[12].id)), a(e, "class", "event"), a(e, "title", q = t[12].title), a(e, "target", "_blank"); }, - m(o, r) { - v(o, e, r), u(e, i), u(e, n); + m(b, N) { + p(b, e, N), E && E.m(e, null), u(e, i), u(e, l), u(l, n), u(n, o), u(l, f), u(l, c), u(c, w), u(l, g), u(l, _), u(_, A), u(_, d), u(_, z), j && j.m(_, null), u(l, h), S && S.m(l, null), u(e, v); }, - p(o, r) { - r & 32 && l !== (l = o[15] + "") && N(n, l); + p(b, N) { + b[3] !== "true" ? E ? E.p(b, N) : (E = oe(b), E.c(), E.m(e, i)) : E && (E.d(1), E = null), N & 32 && r !== (r = V(b[12]) + "") && T(o, r), N & 32 && s !== (s = b[12].title + "") && T(w, s), N & 32 && y !== (y = b[12].place.name + "") && T(d, y), b[12].place.name !== "online" ? j ? j.p(b, N) : (j = ae(b), j.c(), j.m(_, null)) : j && (j.d(1), j = null), b[12].tags.length ? S ? S.p(b, N) : (S = se(b), S.c(), S.m(l, null)) : S && (S.d(1), S = null), N & 33 && C !== (C = b[0] + "/event/" + (b[12].slug || b[12].id)) && a(e, "href", C), N & 32 && q !== (q = b[12].title) && a(e, "title", q); }, - d(o) { - o && x(e); + d(b) { + b && k(e), E && E.d(), j && j.d(), S && S.d(); + } + }; +} +function Ge(t) { + let e, i, l = t[4] && le(t), n = t[5].length && ne(t); + return { + c() { + l && l.c(), e = M(), n && n.c(), i = pe(), this.c = G; + }, + m(r, o) { + l && l.m(r, o), p(r, e, o), n && n.m(r, o), p(r, i, o); + }, + p(r, [o]) { + r[4] ? l ? l.p(r, o) : (l = le(r), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null), r[5].length ? n ? n.p(r, o) : (n = ne(r), n.c(), n.m(i.parentNode, i)) : n && (n.d(1), n = null); + }, + i: G, + o: G, + d(r) { + l && l.d(r), r && k(e), n && n.d(r), r && k(i); } }; } function ue(t) { - let e, i, l, n, o = V(t[12]) + "", r, f, c, s = t[12].title + "", k, m, _, C, w = t[12].place.name + "", d, S, h, b = t[12].place.address + "", A, Y, Z, U, q, $ = t[3] !== "true" && se(t), E = t[12].tags.length && ce(t); - return { - c() { - e = g("a"), $ && $.c(), i = z(), l = g("div"), n = g("div"), r = j(o), f = z(), c = g("div"), k = j(s), m = z(), _ = g("span"), C = j("@"), d = j(w), S = z(), h = g("span"), A = j(b), Y = z(), E && E.c(), Z = z(), a(n, "class", "subtitle"), a(c, "class", "title"), a(h, "class", "subtitle"), a(_, "class", "place"), a(l, "class", "content"), a(e, "href", U = t[0] + "/event/" + (t[12].slug || t[12].id)), a(e, "class", "event"), a(e, "title", q = t[12].title), a(e, "target", "_blank"); - }, - m(p, M) { - v(p, e, M), $ && $.m(e, null), u(e, i), u(e, l), u(l, n), u(n, r), u(l, f), u(l, c), u(c, k), u(l, m), u(l, _), u(_, C), u(_, d), u(_, S), u(_, h), u(h, A), u(l, Y), E && E.m(l, null), u(e, Z); - }, - p(p, M) { - p[3] !== "true" ? $ ? $.p(p, M) : ($ = se(p), $.c(), $.m(e, i)) : $ && ($.d(1), $ = null), M & 32 && o !== (o = V(p[12]) + "") && N(r, o), M & 32 && s !== (s = p[12].title + "") && N(k, s), M & 32 && w !== (w = p[12].place.name + "") && N(d, w), M & 32 && b !== (b = p[12].place.address + "") && N(A, b), p[12].tags.length ? E ? E.p(p, M) : (E = ce(p), E.c(), E.m(l, null)) : E && (E.d(1), E = null), M & 33 && U !== (U = p[0] + "/event/" + (p[12].slug || p[12].id)) && a(e, "href", U), M & 32 && q !== (q = p[12].title) && a(e, "title", q); - }, - d(p) { - p && x(e), $ && $.d(), E && E.d(); - } - }; -} -function He(t) { - let e, i, l = t[4] && re(t), n = t[5].length && oe(t); - return { - c() { - l && l.c(), e = z(), n && n.c(), i = ve(), this.c = L; - }, - m(o, r) { - l && l.m(o, r), v(o, e, r), n && n.m(o, r), v(o, i, r); - }, - p(o, [r]) { - o[4] ? l ? l.p(o, r) : (l = re(o), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null), o[5].length ? n ? n.p(o, r) : (n = oe(o), n.c(), n.m(i.parentNode, i)) : n && (n.d(1), n = null); - }, - i: L, - o: L, - d(o) { - l && l.d(o), o && x(e), n && n.d(o), o && x(i); - } - }; -} -function de(t) { if (t.media && t.media[0].focalpoint) { const e = t.media[0].focalpoint; return `${(e[0] + 1) * 50}% ${(e[1] + 1) * 50}%`; } return "center center"; } -function Re(t, e, i) { - let { baseurl: l = "" } = e, { title: n = "" } = e, { maxlength: o = !1 } = e, { tags: r = "" } = e, { places: f = "" } = e, { theme: c = "light" } = e, { show_recurrent: s = !1 } = e, { sidebar: k = "true" } = e, { external_style: m = "" } = e, _ = !1, C = []; - function w(d) { +function He(t, e, i) { + let { baseurl: l = "" } = e, { title: n = "" } = e, { maxlength: r = !1 } = e, { tags: o = "" } = e, { places: f = "" } = e, { theme: c = "light" } = e, { show_recurrent: s = !1 } = e, { sidebar: w = "true" } = e, { external_style: g = "" } = e, _ = !1, A = []; + function y(d) { if (!_) return; - const S = []; - o && S.push(`max=${o}`), r && S.push(`tags=${r}`), f && S.push(`places=${f}`), S.push(`show_recurrent=${s ? "true" : "false"}`), fetch(`${l}/api/events?${S.join("&")}`).then((h) => h.json()).then((h) => { - i(5, C = h); + const z = []; + r && z.push(`max=${r}`), o && z.push(`tags=${o}`), f && z.push(`places=${f}`), z.push(`show_recurrent=${s ? "true" : "false"}`), fetch(`${l}/api/events?${z.join("&")}`).then((h) => h.json()).then((h) => { + i(5, A = h); }).catch((h) => { console.error("Error loading Gancio API -> ", h); }); } - return we(() => { - _ = !0, w(); + return ke(() => { + _ = !0, y(); }), t.$$set = (d) => { - "baseurl" in d && i(0, l = d.baseurl), "title" in d && i(1, n = d.title), "maxlength" in d && i(6, o = d.maxlength), "tags" in d && i(7, r = d.tags), "places" in d && i(8, f = d.places), "theme" in d && i(2, c = d.theme), "show_recurrent" in d && i(9, s = d.show_recurrent), "sidebar" in d && i(3, k = d.sidebar), "external_style" in d && i(4, m = d.external_style); + "baseurl" in d && i(0, l = d.baseurl), "title" in d && i(1, n = d.title), "maxlength" in d && i(6, r = d.maxlength), "tags" in d && i(7, o = d.tags), "places" in d && i(8, f = d.places), "theme" in d && i(2, c = d.theme), "show_recurrent" in d && i(9, s = d.show_recurrent), "sidebar" in d && i(3, w = d.sidebar), "external_style" in d && i(4, g = d.external_style); }, t.$$.update = () => { - t.$$.dirty & 975 && w(); + t.$$.dirty & 975 && y(); }, [ l, n, c, - k, - m, - C, - o, + w, + g, + A, r, + o, f, s ]; } -class Ie extends X { +class Re extends X { constructor(e) { super(), this.shadowRoot.innerHTML = ``, ye( + padding 0.3s;box-sizing:content-box}a:hover .title,a:focus .title,a:active .title{text-decoration:underline}.dark{--bg-odd-color:#161616;--bg-even-color:#222;--bg-hover-color:#333;--text-color:white;--title-color:white;--line-color:rgba(120, 120, 120, 0.2)}.light{--bg-odd-color:#f5f5f5;--bg-even-color:#fafafa;--bg-hover-color:#eee;--text-color:#222;--title-color:black;--line-color:rgba(220, 220, 220, 0.9)}.sidebar a{background-color:var(--bg-even-color);border-bottom:1px solid var(--line-color)}.sidebar a:hover,.sidebar a:focus,.sidebar a:active{background-color:var(--bg-hover-color);padding-left:15px;padding-right:25px}.place{font-weight:400;font-size:1.2rem;line-height:1.4rem;color:orangered}.title{color:var(--title-color);font-weight:bold;font-size:1.3rem;line-height:1.1em}.nosidebar .title{font-size:1.9em;line-height:1.1em}.subtitle{font-size:1rem;line-height:1.1em;color:var(--title-color);opacity:0.9}.tag{margin-right:10px;display:inline-block}`, we( this, { target: this.shadowRoot, - props: ke(this.attributes), + props: ve(this.attributes), customElement: !0 }, - Re, He, - be, + Ge, + _e, { baseurl: 0, title: 1, @@ -498,7 +516,7 @@ class Ie extends X { external_style: 4 }, null - ), e && (e.target && v(e.target, this, e.anchor), e.props && (this.$set(e.props), y())); + ), e && (e.target && p(e.target, this, e.anchor), e.props && (this.$set(e.props), x())); } static get observedAttributes() { return [ @@ -517,108 +535,108 @@ class Ie extends X { return this.$$.ctx[0]; } set baseurl(e) { - this.$$set({ baseurl: e }), y(); + this.$$set({ baseurl: e }), x(); } get title() { return this.$$.ctx[1]; } set title(e) { - this.$$set({ title: e }), y(); + this.$$set({ title: e }), x(); } get maxlength() { return this.$$.ctx[6]; } set maxlength(e) { - this.$$set({ maxlength: e }), y(); + this.$$set({ maxlength: e }), x(); } get tags() { return this.$$.ctx[7]; } set tags(e) { - this.$$set({ tags: e }), y(); + this.$$set({ tags: e }), x(); } get places() { return this.$$.ctx[8]; } set places(e) { - this.$$set({ places: e }), y(); + this.$$set({ places: e }), x(); } get theme() { return this.$$.ctx[2]; } set theme(e) { - this.$$set({ theme: e }), y(); + this.$$set({ theme: e }), x(); } get show_recurrent() { return this.$$.ctx[9]; } set show_recurrent(e) { - this.$$set({ show_recurrent: e }), y(); + this.$$set({ show_recurrent: e }), x(); } get sidebar() { return this.$$.ctx[3]; } set sidebar(e) { - this.$$set({ sidebar: e }), y(); + this.$$set({ sidebar: e }), x(); } get external_style() { return this.$$.ctx[4]; } set external_style(e) { - this.$$set({ external_style: e }), y(); + this.$$set({ external_style: e }), x(); } } -customElements.define("gancio-events", Ie); -function he(t) { - let e, i, l, n, o = t[1].title + "", r, f, c, s = V(t[1]) + "", k, m, _, C, w = t[1].place.name + "", d, S, h = t[1].media.length && ge(t); +customElements.define("gancio-events", Re); +function de(t) { + let e, i, l, n, r = t[1].title + "", o, f, c, s = V(t[1]) + "", w, g, _, A, y = t[1].place.name + "", d, z, h = t[1].media.length && he(t); return { c() { - e = g("a"), h && h.c(), i = z(), l = g("div"), n = g("strong"), r = j(o), f = z(), c = g("div"), k = j(s), m = z(), _ = g("div"), C = j("@"), d = j(w), a(_, "class", "place"), a(l, "class", "container"), a(e, "href", S = t[0] + "/event/" + (t[1].slug || t[1].id)), a(e, "class", "card"), a(e, "target", "_blank"); + e = m("a"), h && h.c(), i = M(), l = m("div"), n = m("strong"), o = $(r), f = M(), c = m("div"), w = $(s), g = M(), _ = m("div"), A = $("@"), d = $(y), a(_, "class", "place"), a(l, "class", "container"), a(e, "href", z = t[0] + "/event/" + (t[1].slug || t[1].id)), a(e, "class", "card"), a(e, "target", "_blank"); }, - m(b, A) { - v(b, e, A), h && h.m(e, null), u(e, i), u(e, l), u(l, n), u(n, r), u(l, f), u(l, c), u(c, k), u(l, m), u(l, _), u(_, C), u(_, d); + m(v, C) { + p(v, e, C), h && h.m(e, null), u(e, i), u(e, l), u(l, n), u(n, o), u(l, f), u(l, c), u(c, w), u(l, g), u(l, _), u(_, A), u(_, d); }, - p(b, A) { - b[1].media.length ? h ? h.p(b, A) : (h = ge(b), h.c(), h.m(e, i)) : h && (h.d(1), h = null), A & 2 && o !== (o = b[1].title + "") && N(r, o), A & 2 && s !== (s = V(b[1]) + "") && N(k, s), A & 2 && w !== (w = b[1].place.name + "") && N(d, w), A & 3 && S !== (S = b[0] + "/event/" + (b[1].slug || b[1].id)) && a(e, "href", S); + p(v, C) { + v[1].media.length ? h ? h.p(v, C) : (h = he(v), h.c(), h.m(e, i)) : h && (h.d(1), h = null), C & 2 && r !== (r = v[1].title + "") && T(o, r), C & 2 && s !== (s = V(v[1]) + "") && T(w, s), C & 2 && y !== (y = v[1].place.name + "") && T(d, y), C & 3 && z !== (z = v[0] + "/event/" + (v[1].slug || v[1].id)) && a(e, "href", z); }, - d(b) { - b && x(e), h && h.d(); + d(v) { + v && k(e), h && h.d(); } }; } -function ge(t) { +function he(t) { let e, i, l, n; return { c() { - e = g("img"), G(e.src, i = t[2](t[1])) || a(e, "src", i), a(e, "alt", l = t[1].media[0].name), a(e, "style", n = "object-position: " + me(t[1]) + "; aspect-ratio=1.7778;"); + e = m("img"), H(e.src, i = t[2](t[1])) || a(e, "src", i), a(e, "alt", l = t[1].media[0].name), a(e, "style", n = "object-position: " + me(t[1]) + "; aspect-ratio=1.7778;"); }, - m(o, r) { - v(o, e, r); + m(r, o) { + p(r, e, o); }, - p(o, r) { - r & 2 && !G(e.src, i = o[2](o[1])) && a(e, "src", i), r & 2 && l !== (l = o[1].media[0].name) && a(e, "alt", l), r & 2 && n !== (n = "object-position: " + me(o[1]) + "; aspect-ratio=1.7778;") && a(e, "style", n); + p(r, o) { + o & 2 && !H(e.src, i = r[2](r[1])) && a(e, "src", i), o & 2 && l !== (l = r[1].media[0].name) && a(e, "alt", l), o & 2 && n !== (n = "object-position: " + me(r[1]) + "; aspect-ratio=1.7778;") && a(e, "style", n); }, - d(o) { - o && x(e); + d(r) { + r && k(e); } }; } -function Oe(t) { - let e, i = t[1] && he(t); +function Ie(t) { + let e, i = t[1] && de(t); return { c() { - i && i.c(), e = ve(), this.c = L; + i && i.c(), e = pe(), this.c = G; }, m(l, n) { - i && i.m(l, n), v(l, e, n); + i && i.m(l, n), p(l, e, n); }, p(l, [n]) { - l[1] ? i ? i.p(l, n) : (i = he(l), i.c(), i.m(e.parentNode, e)) : i && (i.d(1), i = null); + l[1] ? i ? i.p(l, n) : (i = de(l), i.c(), i.m(e.parentNode, e)) : i && (i.d(1), i = null); }, - i: L, - o: L, + i: G, + o: G, d(l) { - i && i.d(l), l && x(e); + i && i.d(l), l && k(e); } }; } @@ -629,13 +647,13 @@ function me(t) { } return "center center"; } -function Ue(t, e, i) { - let { baseurl: l = "https://demo.gancio.org" } = e, { id: n } = e, o = !1, r; - function f(s, k) { - o && fetch(`${k}/api/event/detail/${s}`).then((m) => m.json()).then((m) => i(1, r = m)); +function Oe(t, e, i) { + let { baseurl: l = "https://demo.gancio.org" } = e, { id: n } = e, r = !1, o; + function f(s, w) { + r && fetch(`${w}/api/event/detail/${s}`).then((g) => g.json()).then((g) => i(1, o = g)); } - we(() => { - o = !0, f(n, l); + ke(() => { + r = !0, f(n, l); }); function c(s) { return `${l}/media/thumb/${s.media[0].url}`; @@ -644,24 +662,24 @@ function Ue(t, e, i) { "baseurl" in s && i(0, l = s.baseurl), "id" in s && i(3, n = s.id); }, t.$$.update = () => { t.$$.dirty & 9 && f(n, l); - }, [l, r, c, n]; + }, [l, o, c, n]; } -class qe extends X { +class Ue extends X { constructor(e) { super(), this.shadowRoot.innerHTML = ``, ye( + sans-serif;box-shadow:0 4px 8px 0 rgba(0, 0, 0, 0.2);transition:0.3s;border-radius:5px;max-width:500px;text-decoration:none;color:white;background-color:#1e1e1e;overflow:hidden}img{border-radius:5px 5px 0 0;max-height:250px;min-height:160px;width:100%;object-fit:cover;object-position:top}.card:hover .container{padding-left:20px}.card:hover{box-shadow:0 8px 16px 0 rgba(0, 0, 0, 0.2)}.container{transition:padding-left 0.2s;padding:16px}.place{font-weight:600;color:#ff6e40}`, we( this, { target: this.shadowRoot, - props: ke(this.attributes), + props: ve(this.attributes), customElement: !0 }, - Ue, Oe, - be, + Ie, + _e, { baseurl: 0, id: 3 }, null - ), e && (e.target && v(e.target, this, e.anchor), e.props && (this.$set(e.props), y())); + ), e && (e.target && p(e.target, this, e.anchor), e.props && (this.$set(e.props), x())); } static get observedAttributes() { return ["baseurl", "id"]; @@ -670,13 +688,13 @@ class qe extends X { return this.$$.ctx[0]; } set baseurl(e) { - this.$$set({ baseurl: e }), y(); + this.$$set({ baseurl: e }), x(); } get id() { return this.$$.ctx[3]; } set id(e) { - this.$$set({ id: e }), y(); + this.$$set({ id: e }), x(); } } -customElements.define("gancio-event", qe); +customElements.define("gancio-event", Ue); diff --git a/wp-plugin/js/gancio-events.js b/wp-plugin/js/gancio-events.js new file mode 100644 index 00000000..aaa6e37b --- /dev/null +++ b/wp-plugin/js/gancio-events.js @@ -0,0 +1,699 @@ +function G() { +} +function W(t) { + return t(); +} +function Y() { + return /* @__PURE__ */ Object.create(null); +} +function U(t) { + t.forEach(W); +} +function ge(t) { + return typeof t == "function"; +} +function _e(t, e) { + return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function"; +} +let B; +function H(t, e) { + return B || (B = document.createElement("a")), B.href = e, t === B.href; +} +function ye(t) { + return Object.keys(t).length === 0; +} +function u(t, e) { + t.appendChild(e); +} +function p(t, e, i) { + t.insertBefore(e, i || null); +} +function k(t) { + t.parentNode.removeChild(t); +} +function be(t, e) { + for (let i = 0; i < t.length; i += 1) + t[i] && t[i].d(e); +} +function m(t) { + return document.createElement(t); +} +function S(t) { + return document.createTextNode(t); +} +function A() { + return S(" "); +} +function pe() { + return S(""); +} +function a(t, e, i) { + i == null ? t.removeAttribute(e) : t.getAttribute(e) !== i && t.setAttribute(e, i); +} +function xe(t) { + return Array.from(t.childNodes); +} +function T(t, e) { + e = "" + e, t.wholeText !== e && (t.data = e); +} +function L(t, e, i) { + t.classList[i ? "add" : "remove"](e); +} +function ve(t) { + const e = {}; + for (const i of t) + e[i.name] = i.value; + return e; +} +let O; +function I(t) { + O = t; +} +function $e() { + if (!O) + throw new Error("Function called outside component initialization"); + return O; +} +function ke(t) { + $e().$$.on_mount.push(t); +} +const R = [], Z = [], P = [], ee = [], Ee = Promise.resolve(); +let K = !1; +function je() { + K || (K = !0, Ee.then(x)); +} +function Q(t) { + P.push(t); +} +const J = /* @__PURE__ */ new Set(); +let D = 0; +function x() { + const t = O; + do { + for (; D < R.length; ) { + const e = R[D]; + D++, I(e), Se(e.$$); + } + for (I(null), R.length = 0, D = 0; Z.length; ) + Z.pop()(); + for (let e = 0; e < P.length; e += 1) { + const i = P[e]; + J.has(i) || (J.add(i), i()); + } + P.length = 0; + } while (R.length); + for (; ee.length; ) + ee.pop()(); + K = !1, J.clear(), I(t); +} +function Se(t) { + if (t.fragment !== null) { + t.update(), U(t.before_update); + const e = t.dirty; + t.dirty = [-1], t.fragment && t.fragment.p(t.ctx, e), t.after_update.forEach(Q); + } +} +const ze = /* @__PURE__ */ new Set(); +function Ce(t, e) { + t && t.i && (ze.delete(t), t.i(e)); +} +function Ae(t, e, i, l) { + const { fragment: n, on_mount: r, on_destroy: o, after_update: f } = t.$$; + n && n.m(e, i), l || Q(() => { + const c = r.map(W).filter(ge); + o ? o.push(...c) : U(c), t.$$.on_mount = []; + }), f.forEach(Q); +} +function Me(t, e) { + const i = t.$$; + i.fragment !== null && (U(i.on_destroy), i.fragment && i.fragment.d(e), i.on_destroy = i.fragment = null, i.ctx = []); +} +function Ne(t, e) { + t.$$.dirty[0] === -1 && (R.push(t), je(), t.$$.dirty.fill(0)), t.$$.dirty[e / 31 | 0] |= 1 << e % 31; +} +function we(t, e, i, l, n, r, o, f = [-1]) { + const c = O; + I(t); + const s = t.$$ = { + fragment: null, + ctx: null, + props: r, + update: G, + not_equal: n, + bound: Y(), + on_mount: [], + on_destroy: [], + on_disconnect: [], + before_update: [], + after_update: [], + context: new Map(e.context || (c ? c.$$.context : [])), + callbacks: Y(), + dirty: f, + skip_bound: !1, + root: e.target || c.$$.root + }; + o && o(s.root); + let w = !1; + if (s.ctx = i ? i(t, e.props || {}, (g, _, ...M) => { + const y = M.length ? M[0] : _; + return s.ctx && n(s.ctx[g], s.ctx[g] = y) && (!s.skip_bound && s.bound[g] && s.bound[g](y), w && Ne(t, g)), _; + }) : [], s.update(), w = !0, U(s.before_update), s.fragment = l ? l(s.ctx) : !1, e.target) { + if (e.hydrate) { + const g = xe(e.target); + s.fragment && s.fragment.l(g), g.forEach(k); + } else + s.fragment && s.fragment.c(); + e.intro && Ce(t.$$.fragment), Ae(t, e.target, e.anchor, e.customElement), x(); + } + I(c); +} +let X; +typeof HTMLElement == "function" && (X = class extends HTMLElement { + constructor() { + super(), this.attachShadow({ mode: "open" }); + } + connectedCallback() { + const { on_mount: t } = this.$$; + this.$$.on_disconnect = t.map(W).filter(ge); + for (const e in this.$$.slotted) + this.appendChild(this.$$.slotted[e]); + } + attributeChangedCallback(t, e, i) { + this[t] = i; + } + disconnectedCallback() { + U(this.$$.on_disconnect); + } + $destroy() { + Me(this, 1), this.$destroy = G; + } + $on(t, e) { + const i = this.$$.callbacks[t] || (this.$$.callbacks[t] = []); + return i.push(e), () => { + const l = i.indexOf(e); + l !== -1 && i.splice(l, 1); + }; + } + $set(t) { + this.$$set && !ye(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1); + } +}); +function F(t, e = "long") { + const i = e === "long" ? { + weekday: "long", + month: "long", + day: "numeric", + hour: "2-digit", + minute: "2-digit" + } : { hour: "2-digit", minute: "2-digit" }; + return new Date(t * 1e3).toLocaleString(void 0, i); +} +function V(t) { + return t.multidate ? F(t.start_datetime) + " - " + F(t.end_datetime) : F(t.start_datetime) + (t.end_datetime ? "-" + F(t.end_datetime, "short") : ""); +} +function te(t, e, i) { + const l = t.slice(); + return l[12] = e[i], l; +} +function ie(t, e, i) { + const l = t.slice(); + return l[15] = e[i], l; +} +function le(t) { + let e; + return { + c() { + e = m("link"), a(e, "rel", "stylesheet"), a(e, "href", t[4]); + }, + m(i, l) { + p(i, e, l); + }, + p(i, l) { + l & 16 && a(e, "href", i[4]); + }, + d(i) { + i && k(e); + } + }; +} +function ne(t) { + let e, i, l = t[1] && t[3] === "true" && re(t), n = t[5], r = []; + for (let o = 0; o < n.length; o += 1) + r[o] = fe(te(t, n, o)); + return { + c() { + e = m("div"), l && l.c(), i = A(); + for (let o = 0; o < r.length; o += 1) + r[o].c(); + a(e, "id", "gancioEvents"), L(e, "dark", t[2] === "dark"), L(e, "light", t[2] === "light"), L(e, "sidebar", t[3] === "true"), L(e, "nosidebar", t[3] !== "true"); + }, + m(o, f) { + p(o, e, f), l && l.m(e, null), u(e, i); + for (let c = 0; c < r.length; c += 1) + r[c].m(e, null); + }, + p(o, f) { + if (o[1] && o[3] === "true" ? l ? l.p(o, f) : (l = re(o), l.c(), l.m(e, i)) : l && (l.d(1), l = null), f & 41) { + n = o[5]; + let c; + for (c = 0; c < n.length; c += 1) { + const s = te(o, n, c); + r[c] ? r[c].p(s, f) : (r[c] = fe(s), r[c].c(), r[c].m(e, null)); + } + for (; c < r.length; c += 1) + r[c].d(1); + r.length = n.length; + } + f & 4 && L(e, "dark", o[2] === "dark"), f & 4 && L(e, "light", o[2] === "light"), f & 8 && L(e, "sidebar", o[3] === "true"), f & 8 && L(e, "nosidebar", o[3] !== "true"); + }, + d(o) { + o && k(e), l && l.d(), be(r, o); + } + }; +} +function re(t) { + let e, i, l, n, r, o, f; + return { + c() { + e = m("a"), i = m("div"), l = m("div"), n = S(t[1]), r = A(), o = m("img"), a(l, "class", "title"), a(o, "id", "logo"), a(o, "alt", "logo"), H(o.src, f = t[0] + "/logo.png") || a(o, "src", f), a(i, "class", "content"), a(e, "href", t[0]), a(e, "target", "_blank"), a(e, "id", "header"); + }, + m(c, s) { + p(c, e, s), u(e, i), u(i, l), u(l, n), u(i, r), u(i, o); + }, + p(c, s) { + s & 2 && T(n, c[1]), s & 1 && !H(o.src, f = c[0] + "/logo.png") && a(o, "src", f), s & 1 && a(e, "href", c[0]); + }, + d(c) { + c && k(e); + } + }; +} +function oe(t) { + let e; + function i(r, o) { + return r[12].media.length ? Le : Te; + } + let l = i(t), n = l(t); + return { + c() { + e = m("div"), n.c(), a(e, "class", "img"); + }, + m(r, o) { + p(r, e, o), n.m(e, null); + }, + p(r, o) { + l === (l = i(r)) && n ? n.p(r, o) : (n.d(1), n = l(r), n && (n.c(), n.m(e, null))); + }, + d(r) { + r && k(e), n.d(); + } + }; +} +function Te(t) { + let e, i, l; + return { + c() { + e = m("img"), a(e, "style", "aspect-ratio=1.7778;"), a(e, "alt", i = t[12].title), H(e.src, l = t[0] + "/fallbackimage.png") || a(e, "src", l), a(e, "loading", "lazy"); + }, + m(n, r) { + p(n, e, r); + }, + p(n, r) { + r & 32 && i !== (i = n[12].title) && a(e, "alt", i), r & 1 && !H(e.src, l = n[0] + "/fallbackimage.png") && a(e, "src", l); + }, + d(n) { + n && k(e); + } + }; +} +function Le(t) { + let e, i, l, n; + return { + c() { + e = m("img"), a(e, "style", i = "object-position: " + ue(t[12]) + "; aspect-ratio=1.7778;"), a(e, "alt", l = t[12].media[0].name), H(e.src, n = t[0] + "/media/thumb/" + t[12].media[0].url) || a(e, "src", n), a(e, "loading", "lazy"); + }, + m(r, o) { + p(r, e, o); + }, + p(r, o) { + o & 32 && i !== (i = "object-position: " + ue(r[12]) + "; aspect-ratio=1.7778;") && a(e, "style", i), o & 32 && l !== (l = r[12].media[0].name) && a(e, "alt", l), o & 33 && !H(e.src, n = r[0] + "/media/thumb/" + r[12].media[0].url) && a(e, "src", n); + }, + d(r) { + r && k(e); + } + }; +} +function ae(t) { + let e, i = t[12].place.address + "", l; + return { + c() { + e = m("span"), l = S(i), a(e, "class", "subtitle"); + }, + m(n, r) { + p(n, e, r), u(e, l); + }, + p(n, r) { + r & 32 && i !== (i = n[12].place.address + "") && T(l, i); + }, + d(n) { + n && k(e); + } + }; +} +function se(t) { + let e, i = t[12].tags, l = []; + for (let n = 0; n < i.length; n += 1) + l[n] = ce(ie(t, i, n)); + return { + c() { + e = m("div"); + for (let n = 0; n < l.length; n += 1) + l[n].c(); + a(e, "class", "tags"); + }, + m(n, r) { + p(n, e, r); + for (let o = 0; o < l.length; o += 1) + l[o].m(e, null); + }, + p(n, r) { + if (r & 32) { + i = n[12].tags; + let o; + for (o = 0; o < i.length; o += 1) { + const f = ie(n, i, o); + l[o] ? l[o].p(f, r) : (l[o] = ce(f), l[o].c(), l[o].m(e, null)); + } + for (; o < l.length; o += 1) + l[o].d(1); + l.length = i.length; + } + }, + d(n) { + n && k(e), be(l, n); + } + }; +} +function ce(t) { + let e, i, l = t[15] + "", n; + return { + c() { + e = m("span"), i = S("#"), n = S(l), a(e, "class", "tag"); + }, + m(r, o) { + p(r, e, o), u(e, i), u(e, n); + }, + p(r, o) { + o & 32 && l !== (l = r[15] + "") && T(n, l); + }, + d(r) { + r && k(e); + } + }; +} +function fe(t) { + let e, i, l, n, r = V(t[12]) + "", o, f, c, s = t[12].title + "", w, g, _, M, y = t[12].place.name + "", d, z, h, v, C, q, $ = t[3] !== "true" && oe(t), E = t[12].place.name !== "online" && ae(t), j = t[12].tags.length && se(t); + return { + c() { + e = m("a"), $ && $.c(), i = A(), l = m("div"), n = m("div"), o = S(r), f = A(), c = m("div"), w = S(s), g = A(), _ = m("span"), M = S("@"), d = S(y), z = A(), E && E.c(), h = A(), j && j.c(), v = A(), a(n, "class", "subtitle"), a(c, "class", "title"), a(_, "class", "place"), a(l, "class", "content"), a(e, "href", C = t[0] + "/event/" + (t[12].slug || t[12].id)), a(e, "class", "event"), a(e, "title", q = t[12].title), a(e, "target", "_blank"); + }, + m(b, N) { + p(b, e, N), $ && $.m(e, null), u(e, i), u(e, l), u(l, n), u(n, o), u(l, f), u(l, c), u(c, w), u(l, g), u(l, _), u(_, M), u(_, d), u(_, z), E && E.m(_, null), u(l, h), j && j.m(l, null), u(e, v); + }, + p(b, N) { + b[3] !== "true" ? $ ? $.p(b, N) : ($ = oe(b), $.c(), $.m(e, i)) : $ && ($.d(1), $ = null), N & 32 && r !== (r = V(b[12]) + "") && T(o, r), N & 32 && s !== (s = b[12].title + "") && T(w, s), N & 32 && y !== (y = b[12].place.name + "") && T(d, y), b[12].place.name !== "online" ? E ? E.p(b, N) : (E = ae(b), E.c(), E.m(_, null)) : E && (E.d(1), E = null), b[12].tags.length ? j ? j.p(b, N) : (j = se(b), j.c(), j.m(l, null)) : j && (j.d(1), j = null), N & 33 && C !== (C = b[0] + "/event/" + (b[12].slug || b[12].id)) && a(e, "href", C), N & 32 && q !== (q = b[12].title) && a(e, "title", q); + }, + d(b) { + b && k(e), $ && $.d(), E && E.d(), j && j.d(); + } + }; +} +function Ge(t) { + let e, i, l = t[4] && le(t), n = t[5].length && ne(t); + return { + c() { + l && l.c(), e = A(), n && n.c(), i = pe(), this.c = G; + }, + m(r, o) { + l && l.m(r, o), p(r, e, o), n && n.m(r, o), p(r, i, o); + }, + p(r, [o]) { + r[4] ? l ? l.p(r, o) : (l = le(r), l.c(), l.m(e.parentNode, e)) : l && (l.d(1), l = null), r[5].length ? n ? n.p(r, o) : (n = ne(r), n.c(), n.m(i.parentNode, i)) : n && (n.d(1), n = null); + }, + i: G, + o: G, + d(r) { + l && l.d(r), r && k(e), n && n.d(r), r && k(i); + } + }; +} +function ue(t) { + if (t.media && t.media[0].focalpoint) { + const e = t.media[0].focalpoint; + return `${(e[0] + 1) * 50}% ${(e[1] + 1) * 50}%`; + } + return "center center"; +} +function He(t, e, i) { + let { baseurl: l = "" } = e, { title: n = "" } = e, { maxlength: r = !1 } = e, { tags: o = "" } = e, { places: f = "" } = e, { theme: c = "light" } = e, { show_recurrent: s = !1 } = e, { sidebar: w = "true" } = e, { external_style: g = "" } = e, _ = !1, M = []; + function y(d) { + if (!_) + return; + const z = []; + r && z.push(`max=${r}`), o && z.push(`tags=${o}`), f && z.push(`places=${f}`), z.push(`show_recurrent=${s ? "true" : "false"}`), fetch(`${l}/api/events?${z.join("&")}`).then((h) => h.json()).then((h) => { + i(5, M = h); + }).catch((h) => { + console.error("Error loading Gancio API -> ", h); + }); + } + return ke(() => { + _ = !0, y(); + }), t.$$set = (d) => { + "baseurl" in d && i(0, l = d.baseurl), "title" in d && i(1, n = d.title), "maxlength" in d && i(6, r = d.maxlength), "tags" in d && i(7, o = d.tags), "places" in d && i(8, f = d.places), "theme" in d && i(2, c = d.theme), "show_recurrent" in d && i(9, s = d.show_recurrent), "sidebar" in d && i(3, w = d.sidebar), "external_style" in d && i(4, g = d.external_style); + }, t.$$.update = () => { + t.$$.dirty & 975 && y(); + }, [ + l, + n, + c, + w, + g, + M, + r, + o, + f, + s + ]; +} +class Re extends X { + constructor(e) { + super(), this.shadowRoot.innerHTML = ``, we( + this, + { + target: this.shadowRoot, + props: ve(this.attributes), + customElement: !0 + }, + He, + Ge, + _e, + { + baseurl: 0, + title: 1, + maxlength: 6, + tags: 7, + places: 8, + theme: 2, + show_recurrent: 9, + sidebar: 3, + external_style: 4 + }, + null + ), e && (e.target && p(e.target, this, e.anchor), e.props && (this.$set(e.props), x())); + } + static get observedAttributes() { + return [ + "baseurl", + "title", + "maxlength", + "tags", + "places", + "theme", + "show_recurrent", + "sidebar", + "external_style" + ]; + } + get baseurl() { + return this.$$.ctx[0]; + } + set baseurl(e) { + this.$$set({ baseurl: e }), x(); + } + get title() { + return this.$$.ctx[1]; + } + set title(e) { + this.$$set({ title: e }), x(); + } + get maxlength() { + return this.$$.ctx[6]; + } + set maxlength(e) { + this.$$set({ maxlength: e }), x(); + } + get tags() { + return this.$$.ctx[7]; + } + set tags(e) { + this.$$set({ tags: e }), x(); + } + get places() { + return this.$$.ctx[8]; + } + set places(e) { + this.$$set({ places: e }), x(); + } + get theme() { + return this.$$.ctx[2]; + } + set theme(e) { + this.$$set({ theme: e }), x(); + } + get show_recurrent() { + return this.$$.ctx[9]; + } + set show_recurrent(e) { + this.$$set({ show_recurrent: e }), x(); + } + get sidebar() { + return this.$$.ctx[3]; + } + set sidebar(e) { + this.$$set({ sidebar: e }), x(); + } + get external_style() { + return this.$$.ctx[4]; + } + set external_style(e) { + this.$$set({ external_style: e }), x(); + } +} +customElements.define("gancio-events", Re); +function de(t) { + let e, i, l, n, r = t[1].title + "", o, f, c, s = V(t[1]) + "", w, g, _, M, y = t[1].place.name + "", d, z, h = t[1].media.length && he(t); + return { + c() { + e = m("a"), h && h.c(), i = A(), l = m("div"), n = m("strong"), o = S(r), f = A(), c = m("div"), w = S(s), g = A(), _ = m("div"), M = S("@"), d = S(y), a(_, "class", "place"), a(l, "class", "container"), a(e, "href", z = t[0] + "/event/" + (t[1].slug || t[1].id)), a(e, "class", "card"), a(e, "target", "_blank"); + }, + m(v, C) { + p(v, e, C), h && h.m(e, null), u(e, i), u(e, l), u(l, n), u(n, o), u(l, f), u(l, c), u(c, w), u(l, g), u(l, _), u(_, M), u(_, d); + }, + p(v, C) { + v[1].media.length ? h ? h.p(v, C) : (h = he(v), h.c(), h.m(e, i)) : h && (h.d(1), h = null), C & 2 && r !== (r = v[1].title + "") && T(o, r), C & 2 && s !== (s = V(v[1]) + "") && T(w, s), C & 2 && y !== (y = v[1].place.name + "") && T(d, y), C & 3 && z !== (z = v[0] + "/event/" + (v[1].slug || v[1].id)) && a(e, "href", z); + }, + d(v) { + v && k(e), h && h.d(); + } + }; +} +function he(t) { + let e, i, l, n; + return { + c() { + e = m("img"), H(e.src, i = t[2](t[1])) || a(e, "src", i), a(e, "alt", l = t[1].media[0].name), a(e, "style", n = "object-position: " + me(t[1]) + "; aspect-ratio=1.7778;"); + }, + m(r, o) { + p(r, e, o); + }, + p(r, o) { + o & 2 && !H(e.src, i = r[2](r[1])) && a(e, "src", i), o & 2 && l !== (l = r[1].media[0].name) && a(e, "alt", l), o & 2 && n !== (n = "object-position: " + me(r[1]) + "; aspect-ratio=1.7778;") && a(e, "style", n); + }, + d(r) { + r && k(e); + } + }; +} +function Ie(t) { + let e, i = t[1] && de(t); + return { + c() { + i && i.c(), e = pe(), this.c = G; + }, + m(l, n) { + i && i.m(l, n), p(l, e, n); + }, + p(l, [n]) { + l[1] ? i ? i.p(l, n) : (i = de(l), i.c(), i.m(e.parentNode, e)) : i && (i.d(1), i = null); + }, + i: G, + o: G, + d(l) { + i && i.d(l), l && k(e); + } + }; +} +function me(t) { + if (t.media[0].focalpoint) { + const e = t.media[0].focalpoint; + return `${(e[0] + 1) * 50}% ${(e[1] + 1) * 50}%`; + } + return "center center"; +} +function Oe(t, e, i) { + let { baseurl: l = "https://demo.gancio.org" } = e, { id: n } = e, r = !1, o; + function f(s, w) { + r && fetch(`${w}/api/event/detail/${s}`).then((g) => g.json()).then((g) => i(1, o = g)); + } + ke(() => { + r = !0, f(n, l); + }); + function c(s) { + return `${l}/media/thumb/${s.media[0].url}`; + } + return t.$$set = (s) => { + "baseurl" in s && i(0, l = s.baseurl), "id" in s && i(3, n = s.id); + }, t.$$.update = () => { + t.$$.dirty & 9 && f(n, l); + }, [l, o, c, n]; +} +class Ue extends X { + constructor(e) { + super(), this.shadowRoot.innerHTML = ``, we( + this, + { + target: this.shadowRoot, + props: ve(this.attributes), + customElement: !0 + }, + Oe, + Ie, + _e, + { baseurl: 0, id: 3 }, + null + ), e && (e.target && p(e.target, this, e.anchor), e.props && (this.$set(e.props), x())); + } + static get observedAttributes() { + return ["baseurl", "id"]; + } + get baseurl() { + return this.$$.ctx[0]; + } + set baseurl(e) { + this.$$set({ baseurl: e }), x(); + } + get id() { + return this.$$.ctx[3]; + } + set id(e) { + this.$$set({ id: e }), x(); + } +} +customElements.define("gancio-event", Ue);