@luigi-project/container
Advanced tools
Comparing version 0.0.1 to 0.0.3
1472
bundle.js
@@ -1,1472 +0,2 @@ | ||
(function(l, r) { | ||
if (!l || l.getElementById('livereloadscript')) return; | ||
r = l.createElement('script'); | ||
r.async = 1; | ||
r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; | ||
r.id = 'livereloadscript'; | ||
l.getElementsByTagName('head')[0].appendChild(r); | ||
})(self.document); | ||
function noop() {} | ||
function add_location(element, file, line, column, char) { | ||
element.__svelte_meta = { | ||
loc: { file, line, column, char } | ||
}; | ||
} | ||
function run(fn) { | ||
return fn(); | ||
} | ||
function blank_object() { | ||
return Object.create(null); | ||
} | ||
function run_all(fns) { | ||
fns.forEach(run); | ||
} | ||
function is_function(thing) { | ||
return typeof thing === 'function'; | ||
} | ||
function safe_not_equal(a, b) { | ||
return a != a ? b == b : a !== b || (a && typeof a === 'object') || typeof a === '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; | ||
} | ||
function is_empty(obj) { | ||
return Object.keys(obj).length === 0; | ||
} | ||
function insert(target, node, anchor) { | ||
target.insertBefore(node, anchor || null); | ||
} | ||
function detach(node) { | ||
node.parentNode.removeChild(node); | ||
} | ||
function element(name) { | ||
return document.createElement(name); | ||
} | ||
function text(data) { | ||
return document.createTextNode(data); | ||
} | ||
function empty() { | ||
return text(''); | ||
} | ||
function attr(node, attribute, value) { | ||
if (value == null) node.removeAttribute(attribute); | ||
else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value); | ||
} | ||
function children(element) { | ||
return Array.from(element.childNodes); | ||
} | ||
function custom_event(type, detail, bubbles = false) { | ||
const e = document.createEvent('CustomEvent'); | ||
e.initCustomEvent(type, bubbles, false, detail); | ||
return e; | ||
} | ||
function attribute_to_object(attributes) { | ||
const result = {}; | ||
for (const attribute of attributes) { | ||
result[attribute.name] = attribute.value; | ||
} | ||
return result; | ||
} | ||
let current_component; | ||
function set_current_component(component) { | ||
current_component = component; | ||
} | ||
function get_current_component() { | ||
if (!current_component) throw new Error('Function called outside component initialization'); | ||
return current_component; | ||
} | ||
function onMount(fn) { | ||
get_current_component().$$.on_mount.push(fn); | ||
} | ||
function onDestroy(fn) { | ||
get_current_component().$$.on_destroy.push(fn); | ||
} | ||
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); | ||
} | ||
} | ||
function add_render_callback(fn) { | ||
render_callbacks.push(fn); | ||
} | ||
// flush() calls callbacks in this order: | ||
// 1. All beforeUpdate callbacks, in order: parents before children | ||
// 2. All bind:this callbacks, in reverse order: children before parents. | ||
// 3. All afterUpdate callbacks, in order: parents before children. EXCEPT | ||
// for afterUpdates called during the initial onMount, which are called in | ||
// reverse order: children before parents. | ||
// Since callbacks might update component values, which could trigger another | ||
// call to flush(), the following steps guard against this: | ||
// 1. During beforeUpdate, any updated components will be added to the | ||
// dirty_components array and will cause a reentrant call to flush(). Because | ||
// the flush index is kept outside the function, the reentrant call will pick | ||
// up where the earlier call left off and go through all dirty components. The | ||
// current_component value is saved and restored so that the reentrant call will | ||
// not interfere with the "parent" flush() call. | ||
// 2. bind:this callbacks cannot trigger new flush() calls. | ||
// 3. During afterUpdate, any updated components will NOT have their afterUpdate | ||
// callback called a second time; the seen_callbacks set, outside the flush() | ||
// function, guarantees this behavior. | ||
const seen_callbacks = new Set(); | ||
let flushidx = 0; // Do *not* move this inside the flush() function | ||
function flush() { | ||
const saved_component = current_component; | ||
do { | ||
// first, call beforeUpdate functions | ||
// and update components | ||
while (flushidx < dirty_components.length) { | ||
const component = dirty_components[flushidx]; | ||
flushidx++; | ||
set_current_component(component); | ||
update(component.$$); | ||
} | ||
set_current_component(null); | ||
dirty_components.length = 0; | ||
flushidx = 0; | ||
while (binding_callbacks.length) binding_callbacks.pop()(); | ||
// then, once components are updated, call | ||
// afterUpdate functions. This may cause | ||
// subsequent updates... | ||
for (let i = 0; i < render_callbacks.length; i += 1) { | ||
const callback = render_callbacks[i]; | ||
if (!seen_callbacks.has(callback)) { | ||
// ...so guard against infinite loops | ||
seen_callbacks.add(callback); | ||
callback(); | ||
} | ||
} | ||
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); | ||
} | ||
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); | ||
} | ||
} | ||
const outroing = new Set(); | ||
function transition_in(block, local) { | ||
if (block && block.i) { | ||
outroing.delete(block); | ||
block.i(local); | ||
} | ||
} | ||
const globals = typeof window !== 'undefined' ? window : typeof globalThis !== 'undefined' ? globalThis : global; | ||
function mount_component(component, target, anchor, customElement) { | ||
const { fragment, on_mount, on_destroy, after_update } = component.$$; | ||
fragment && fragment.m(target, anchor); | ||
if (!customElement) { | ||
// onMount happens before the initial afterUpdate | ||
add_render_callback(() => { | ||
const new_on_destroy = on_mount.map(run).filter(is_function); | ||
if (on_destroy) { | ||
on_destroy.push(...new_on_destroy); | ||
} else { | ||
// Edge case - component was destroyed immediately, | ||
// most likely as a result of a binding initialising | ||
run_all(new_on_destroy); | ||
} | ||
component.$$.on_mount = []; | ||
}); | ||
} | ||
after_update.forEach(add_render_callback); | ||
} | ||
function destroy_component(component, detaching) { | ||
const $$ = component.$$; | ||
if ($$.fragment !== null) { | ||
run_all($$.on_destroy); | ||
$$.fragment && $$.fragment.d(detaching); | ||
// TODO null out other refs, including component.$$ (but need to | ||
// preserve final state?) | ||
$$.on_destroy = $$.fragment = null; | ||
$$.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 init(component, options, instance, create_fragment, not_equal, props, append_styles, dirty = [-1]) { | ||
const parent_component = current_component; | ||
set_current_component(component); | ||
const $$ = (component.$$ = { | ||
fragment: null, | ||
ctx: null, | ||
// state | ||
props, | ||
update: noop, | ||
not_equal, | ||
bound: blank_object(), | ||
// lifecycle | ||
on_mount: [], | ||
on_destroy: [], | ||
on_disconnect: [], | ||
before_update: [], | ||
after_update: [], | ||
context: new Map(options.context || (parent_component ? parent_component.$$.context : [])), | ||
// everything else | ||
callbacks: blank_object(), | ||
dirty, | ||
skip_bound: false, | ||
root: options.target || parent_component.$$.root | ||
}); | ||
append_styles && append_styles($$.root); | ||
let ready = false; | ||
$$.ctx = instance | ||
? instance(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); | ||
// `false` as a special case of no DOM component | ||
$$.fragment = create_fragment ? create_fragment($$.ctx) : false; | ||
if (options.target) { | ||
if (options.hydrate) { | ||
const nodes = children(options.target); | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
$$.fragment && $$.fragment.l(nodes); | ||
nodes.forEach(detach); | ||
} else { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
$$.fragment && $$.fragment.c(); | ||
} | ||
if (options.intro) transition_in(component.$$.fragment); | ||
mount_component(component, options.target, options.anchor, options.customElement); | ||
flush(); | ||
} | ||
set_current_component(parent_component); | ||
} | ||
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); | ||
// @ts-ignore todo: improve typings | ||
for (const key in this.$$.slotted) { | ||
// @ts-ignore todo: improve typings | ||
this.appendChild(this.$$.slotted[key]); | ||
} | ||
} | ||
attributeChangedCallback(attr, _oldValue, newValue) { | ||
this[attr] = newValue; | ||
} | ||
disconnectedCallback() { | ||
run_all(this.$$.on_disconnect); | ||
} | ||
$destroy() { | ||
destroy_component(this, 1); | ||
this.$destroy = noop; | ||
} | ||
$on(type, callback) { | ||
// TODO should this delegate to addEventListener? | ||
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 dispatch_dev(type, detail) { | ||
document.dispatchEvent(custom_event(type, Object.assign({ version: '3.46.4' }, detail), true)); | ||
} | ||
function insert_dev(target, node, anchor) { | ||
dispatch_dev('SvelteDOMInsert', { target, node, anchor }); | ||
insert(target, node, anchor); | ||
} | ||
function detach_dev(node) { | ||
dispatch_dev('SvelteDOMRemove', { node }); | ||
detach(node); | ||
} | ||
function attr_dev(node, attribute, value) { | ||
attr(node, attribute, value); | ||
if (value == null) dispatch_dev('SvelteDOMRemoveAttribute', { node, attribute }); | ||
else dispatch_dev('SvelteDOMSetAttribute', { node, attribute, value }); | ||
} | ||
function validate_slots(name, slot, keys) { | ||
for (const slot_key of Object.keys(slot)) { | ||
if (!~keys.indexOf(slot_key)) { | ||
console.warn(`<${name}> received an unexpected slot "${slot_key}".`); | ||
} | ||
} | ||
} | ||
class ContainerService { | ||
constructor() {} | ||
isVisible(component) { | ||
return !!(component.offsetWidth || component.offsetHeight || component.getClientRects().length); | ||
} | ||
dispatch(msg, targetCnt, data, callback) { | ||
let ev = new CustomEvent(msg, { detail: data }); | ||
ev.luigiCallback = data => { | ||
if (callback) { | ||
callback(data); | ||
} | ||
}; | ||
targetCnt.dispatchEvent(ev); | ||
console.log('Dispatch WC event:', msg, targetCnt, data); | ||
} | ||
getTargetContainer(event) { | ||
let cnt; | ||
globalThis.__luigi_container_manager.container.forEach(element => { | ||
var _a; | ||
if ( | ||
((_a = element.iframeHandle) === null || _a === void 0 ? void 0 : _a.iframe) && | ||
element.iframeHandle.iframe.contentWindow === event.source | ||
) { | ||
cnt = element; | ||
} | ||
}); | ||
return cnt; | ||
} | ||
getContainerManager() { | ||
if (!globalThis.__luigi_container_manager) { | ||
globalThis.__luigi_container_manager = { | ||
container: [], | ||
messageListener: event => { | ||
var _a, _b, _c, _d; | ||
const targetCnt = this.getTargetContainer(event); | ||
const target = | ||
(_b = | ||
(_a = targetCnt === null || targetCnt === void 0 ? void 0 : targetCnt.iframeHandle) === null || | ||
_a === void 0 | ||
? void 0 | ||
: _a.iframe) === null || _b === void 0 | ||
? void 0 | ||
: _b.contentWindow; | ||
console.log('Container event', event, targetCnt); | ||
if ( | ||
target === event.source && | ||
((_d = (_c = event.data) === null || _c === void 0 ? void 0 : _c.msg) === null || _d === void 0 | ||
? void 0 | ||
: _d.indexOf('luigi.')) === 0 | ||
) { | ||
const msg = event.data.msg; | ||
switch (msg) { | ||
case 'luigi.get-context': | ||
target.postMessage({ msg: 'luigi.init', context: targetCnt.context, internal: {} }, '*'); | ||
break; | ||
case 'luigi.navigation.open': | ||
this.dispatch('navigation-request', targetCnt, event.data.params); | ||
break; | ||
case 'luigi.ux.alert.show': | ||
this.dispatch('alert-request', targetCnt, event.data.params); | ||
break; | ||
default: | ||
console.warn('Functionality not yet implemented: ', msg); | ||
break; | ||
} | ||
} | ||
} | ||
}; | ||
window.addEventListener('message', globalThis.__luigi_container_manager.messageListener); | ||
} | ||
return globalThis.__luigi_container_manager; | ||
} | ||
registerContainer(container) { | ||
this.getContainerManager().container.push(container); | ||
} | ||
} | ||
/** | ||
* Default compound renderer. | ||
*/ | ||
class DefaultCompoundRenderer { | ||
constructor(rendererObj) { | ||
if (rendererObj) { | ||
this.rendererObject = rendererObj; | ||
this.config = rendererObj.config || {}; | ||
} else { | ||
this.config = {}; | ||
} | ||
} | ||
createCompoundContainer() { | ||
return document.createElement('div'); | ||
} | ||
createCompoundItemContainer(layoutConfig) { | ||
return document.createElement('div'); | ||
} | ||
attachCompoundItem(compoundCnt, compoundItemCnt) { | ||
compoundCnt.appendChild(compoundItemCnt); | ||
} | ||
} | ||
/** | ||
* Compound Renderer for custom rendering as defined in luigi config. | ||
*/ | ||
class CustomCompoundRenderer extends DefaultCompoundRenderer { | ||
constructor(rendererObj) { | ||
super(rendererObj || { use: {} }); | ||
if (rendererObj && rendererObj.use && rendererObj.use.extends) { | ||
this.superRenderer = resolveRenderer({ | ||
use: rendererObj.use.extends, | ||
config: rendererObj.config | ||
}); | ||
} | ||
} | ||
createCompoundContainer() { | ||
if (this.rendererObject.use.createCompoundContainer) { | ||
return this.rendererObject.use.createCompoundContainer(this.config, this.superRenderer); | ||
} else if (this.superRenderer) { | ||
return this.superRenderer.createCompoundContainer(); | ||
} | ||
return super.createCompoundContainer(); | ||
} | ||
createCompoundItemContainer(layoutConfig) { | ||
if (this.rendererObject.use.createCompoundItemContainer) { | ||
return this.rendererObject.use.createCompoundItemContainer(layoutConfig, this.config, this.superRenderer); | ||
} else if (this.superRenderer) { | ||
return this.superRenderer.createCompoundItemContainer(layoutConfig); | ||
} | ||
return super.createCompoundItemContainer(layoutConfig); | ||
} | ||
attachCompoundItem(compoundCnt, compoundItemCnt) { | ||
if (this.rendererObject.use.attachCompoundItem) { | ||
this.rendererObject.use.attachCompoundItem(compoundCnt, compoundItemCnt, this.superRenderer); | ||
} else if (this.superRenderer) { | ||
this.superRenderer.attachCompoundItem(compoundCnt, compoundItemCnt); | ||
} else { | ||
super.attachCompoundItem(compoundCnt, compoundItemCnt); | ||
} | ||
} | ||
} | ||
/** | ||
* Compound Renderer for a css grid compound view. | ||
*/ | ||
class GridCompoundRenderer extends DefaultCompoundRenderer { | ||
createCompoundContainer() { | ||
const containerClass = '__lui_compound_' + new Date().getTime(); | ||
const compoundCnt = document.createElement('div'); | ||
compoundCnt.classList.add(containerClass); | ||
let mediaQueries = ''; | ||
if (this.config.layouts) { | ||
this.config.layouts.forEach(el => { | ||
if (el.minWidth || el.maxWidth) { | ||
let mq = '@media only screen '; | ||
if (el.minWidth != null) { | ||
mq += `and (min-width: ${el.minWidth}px) `; | ||
} | ||
if (el.maxWidth != null) { | ||
mq += `and (max-width: ${el.maxWidth}px) `; | ||
} | ||
mq += `{ | ||
.${containerClass} { | ||
grid-template-columns: ${el.columns || 'auto'}; | ||
grid-template-rows: ${el.rows || 'auto'}; | ||
grid-gap: ${el.gap || '0'}; | ||
} | ||
} | ||
`; | ||
mediaQueries += mq; | ||
} | ||
}); | ||
} | ||
compoundCnt.innerHTML = /*html*/ ` | ||
<style scoped> | ||
.${containerClass} { | ||
display: grid; | ||
grid-template-columns: ${this.config.columns || 'auto'}; | ||
grid-template-rows: ${this.config.rows || 'auto'}; | ||
grid-gap: ${this.config.gap || '0'}; | ||
min-height: ${this.config.minHeight || 'auto'}; | ||
} | ||
${mediaQueries} | ||
</style> | ||
`; | ||
return compoundCnt; | ||
} | ||
createCompoundItemContainer(layoutConfig) { | ||
const config = layoutConfig || {}; | ||
const compoundItemCnt = document.createElement('div'); | ||
compoundItemCnt.setAttribute('style', `grid-row: ${config.row || 'auto'}; grid-column: ${config.column || 'auto'}`); | ||
return compoundItemCnt; | ||
} | ||
} | ||
/** | ||
* Returns the compound renderer class for a given config. | ||
* If no specific one is found, {DefaultCompoundRenderer} is returned. | ||
* | ||
* @param {*} rendererConfig the renderer config object defined in luigi config | ||
*/ | ||
const resolveRenderer = rendererConfig => { | ||
const rendererDef = rendererConfig.use; | ||
if (!rendererDef) { | ||
return new DefaultCompoundRenderer(rendererConfig); | ||
} else if (rendererDef === 'grid') { | ||
return new GridCompoundRenderer(rendererConfig); | ||
} else if ( | ||
rendererDef.createCompoundContainer || | ||
rendererDef.createCompoundItemContainer || | ||
rendererDef.attachCompoundItem | ||
) { | ||
return new CustomCompoundRenderer(rendererConfig); | ||
} | ||
return new DefaultCompoundRenderer(rendererConfig); | ||
}; | ||
/** | ||
* Registers event listeners defined at the navNode. | ||
* | ||
* @param {*} eventbusListeners a map of event listener arrays with event id as key | ||
* @param {*} navNode the web component node configuration object | ||
* @param {*} nodeId the web component node id | ||
* @param {*} wcElement the web component element - optional | ||
*/ | ||
const registerEventListeners = (eventbusListeners, navNode, nodeId, wcElement) => { | ||
if (navNode === null || navNode === void 0 ? void 0 : navNode.eventListeners) { | ||
navNode.eventListeners.forEach(el => { | ||
const evID = el.source + '.' + el.name; | ||
const listenerList = eventbusListeners[evID]; | ||
const listenerInfo = { | ||
wcElementId: nodeId, | ||
wcElement: wcElement, | ||
action: el.action, | ||
converter: el.dataConverter | ||
}; | ||
if (listenerList) { | ||
listenerList.push(listenerInfo); | ||
} else { | ||
eventbusListeners[evID] = [listenerInfo]; | ||
} | ||
}); | ||
} | ||
}; | ||
/** Methods for dealing with web components based micro frontend handling */ | ||
class WebComponentService { | ||
constructor() { | ||
this.containerService = new ContainerService(); | ||
} | ||
dynamicImport(viewUrl) { | ||
return import(viewUrl); | ||
} | ||
processViewUrl(viewUrl, data) { | ||
return viewUrl; | ||
} | ||
/** Creates a web component with tagname wc_id and adds it to wcItemContainer, | ||
* if attached to wc_container | ||
*/ | ||
attachWC(wc_id, wcItemPlaceholder, wc_container, ctx, viewUrl, nodeId) { | ||
if (wc_container && wc_container.contains(wcItemPlaceholder)) { | ||
const wc = document.createElement(wc_id); | ||
if (nodeId) { | ||
wc.setAttribute('nodeId', nodeId); | ||
} | ||
this.initWC(wc, wc_id, wc_container, viewUrl, ctx, nodeId); | ||
wc_container.replaceChild(wc, wcItemPlaceholder); | ||
} | ||
} | ||
createClientAPI(eventBusElement, nodeId, wc_id) { | ||
return { | ||
linkManager: () => {}, | ||
uxManager: () => { | ||
return { | ||
showAlert: alertSettings => {}, | ||
showConfirmationModal: async settings => { | ||
return new Promise((resolve, reject) => { | ||
resolve(true); | ||
}); | ||
} | ||
}; | ||
}, | ||
getCurrentLocale: () => {}, | ||
publishEvent: ev => { | ||
// if (eventBusElement.eventBus) { | ||
// eventBusElement.eventBus.onPublishEvent(ev, nodeId, wc_id); | ||
// } | ||
} | ||
}; | ||
} | ||
initWC(wc, wc_id, eventBusElement, viewUrl, ctx, nodeId) { | ||
const clientAPI = this.createClientAPI(eventBusElement, nodeId, wc_id); | ||
if (wc.__postProcess) { | ||
const url = | ||
new URL(document.baseURI).origin === new URL(viewUrl, document.baseURI).origin // TODO: check if needed | ||
? new URL('./', new URL(viewUrl, document.baseURI)) | ||
: new URL('./', viewUrl); | ||
wc.__postProcess(ctx, clientAPI, url.origin + url.pathname); | ||
} else { | ||
wc.context = ctx; | ||
wc.LuigiClient = clientAPI; | ||
} | ||
} | ||
/** Generates a unique web component id (tagname) based on the viewUrl | ||
* returns a string that can be used as part of a tagname, only alphanumeric | ||
* characters and no whitespaces. | ||
*/ | ||
generateWCId(viewUrl) { | ||
let charRep = ''; | ||
for (let i = 0; i < viewUrl.length; i++) { | ||
charRep += viewUrl.charCodeAt(i).toString(16); | ||
} | ||
return 'luigi-wc-' + charRep; | ||
} | ||
/** Does a module import from viewUrl and defines a new web component | ||
* with the default export of the module or the first export extending HTMLElement if no default is | ||
* specified. | ||
* @returns a promise that gets resolved after successfull import */ | ||
registerWCFromUrl(viewUrl, wc_id) { | ||
const i18nViewUrl = this.processViewUrl(viewUrl); | ||
return new Promise((resolve, reject) => { | ||
if (this.checkWCUrl(i18nViewUrl)) { | ||
this.dynamicImport(i18nViewUrl) | ||
.then(module => { | ||
try { | ||
if (!window.customElements.get(wc_id)) { | ||
let cmpClazz = module.default; | ||
if (!HTMLElement.isPrototypeOf(cmpClazz)) { | ||
let props = Object.keys(module); | ||
for (let i = 0; i < props.length; i++) { | ||
cmpClazz = module[props[i]]; | ||
if (HTMLElement.isPrototypeOf(cmpClazz)) { | ||
break; | ||
} | ||
} | ||
} | ||
window.customElements.define(wc_id, cmpClazz); | ||
} | ||
resolve(1); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
}) | ||
.catch(err => reject(err)); | ||
} else { | ||
console.warn(`View URL '${i18nViewUrl}' not allowed to be included`); | ||
reject(`View URL '${i18nViewUrl}' not allowed`); | ||
} | ||
}); | ||
} | ||
/** | ||
* Handles the import of self registered web component bundles, i.e. the web component | ||
* is added to the customElements registry by the bundle code rather than by luigi. | ||
* | ||
* @param {*} node the corresponding navigation node | ||
* @param {*} viewUrl the source of the wc bundle | ||
* @param {*} onload callback function executed after script attached and loaded | ||
*/ | ||
includeSelfRegisteredWCFromUrl(node, viewUrl, onload) { | ||
if (this.checkWCUrl(viewUrl)) { | ||
/** Append reg function to luigi object if not present */ | ||
if (!this.containerService.getContainerManager()._registerWebcomponent) { | ||
this.containerService.getContainerManager()._registerWebcomponent = (srcString, el) => { | ||
window.customElements.define(this.generateWCId(srcString), el); | ||
}; | ||
} | ||
let scriptTag = document.createElement('script'); | ||
scriptTag.setAttribute('src', viewUrl); | ||
if (node.webcomponent.type === 'module') { | ||
scriptTag.setAttribute('type', 'module'); | ||
} | ||
scriptTag.setAttribute('defer', 'true'); | ||
scriptTag.addEventListener('load', () => { | ||
onload(); | ||
}); | ||
document.body.appendChild(scriptTag); | ||
} else { | ||
console.warn(`View URL '${viewUrl}' not allowed to be included`); | ||
} | ||
} | ||
/** | ||
* Checks if a url is allowed to be included, based on 'navigation.validWebcomponentUrls' in luigi config. | ||
* Returns true, if allowed. | ||
* | ||
* @param {*} url the url string to check | ||
*/ | ||
checkWCUrl(url) { | ||
// if (url.indexOf('://') > 0 || url.trim().indexOf('//') === 0) { | ||
// const ur = new URL(url); | ||
// if (ur.host === window.location.host) { | ||
// return true; // same host is okay | ||
// } | ||
// const valids = LuigiConfig.getConfigValue('navigation.validWebcomponentUrls'); | ||
// if (valids && valids.length > 0) { | ||
// for (let el of valids) { | ||
// try { | ||
// if (new RegExp(el).test(url)) { | ||
// return true; | ||
// } | ||
// } catch (e) { | ||
// console.error(e); | ||
// } | ||
// } | ||
// } | ||
// return false; | ||
// } | ||
// relative URL is okay | ||
return true; | ||
} | ||
/** Adds a web component defined by viewUrl to the wc_container and sets the node context. | ||
* If the web component is not defined yet, it gets imported. | ||
*/ | ||
renderWebComponent(viewUrl, wc_container, context, node, nodeId) { | ||
const i18nViewUrl = this.processViewUrl(viewUrl, { context }); | ||
const wc_id = | ||
node.webcomponent && node.webcomponent.tagName ? node.webcomponent.tagName : this.generateWCId(i18nViewUrl); | ||
const wcItemPlaceholder = document.createElement('div'); | ||
wc_container.appendChild(wcItemPlaceholder); | ||
wc_container._luigi_node = node; | ||
if (window.customElements.get(wc_id)) { | ||
this.attachWC(wc_id, wcItemPlaceholder, wc_container, context, i18nViewUrl, nodeId); | ||
} else { | ||
/** Custom import function, if defined */ | ||
if (window.luigiWCFn) { | ||
window.luigiWCFn(i18nViewUrl, wc_id, wcItemPlaceholder, () => { | ||
this.attachWC(wc_id, wcItemPlaceholder, wc_container, context, i18nViewUrl, nodeId); | ||
}); | ||
} else if (node.webcomponent && node.webcomponent.selfRegistered) { | ||
this.includeSelfRegisteredWCFromUrl(node, i18nViewUrl, () => { | ||
this.attachWC(wc_id, wcItemPlaceholder, wc_container, context, i18nViewUrl, nodeId); | ||
}); | ||
} else { | ||
this.registerWCFromUrl(i18nViewUrl, wc_id).then(() => { | ||
this.attachWC(wc_id, wcItemPlaceholder, wc_container, context, i18nViewUrl, nodeId); | ||
}); | ||
} | ||
} | ||
} | ||
/** | ||
* Creates a compound container according to the given renderer. | ||
* Returns a promise that gets resolved with the created container DOM element. | ||
* | ||
* @param {DefaultCompoundRenderer} renderer | ||
*/ | ||
createCompoundContainerAsync(renderer, ctx) { | ||
return new Promise((resolve, reject) => { | ||
if (renderer.viewUrl) { | ||
try { | ||
const wc_id = this.generateWCId(renderer.viewUrl); | ||
this.registerWCFromUrl(renderer.viewUrl, wc_id).then(() => { | ||
const wc = document.createElement(wc_id); | ||
this.initWC(wc, wc_id, wc, renderer.viewUrl, ctx, '_root'); | ||
resolve(wc); | ||
}); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
} else { | ||
resolve(renderer.createCompoundContainer()); | ||
} | ||
}); | ||
} | ||
/** | ||
* Responsible for rendering web component compounds based on a renderer or a nesting | ||
* micro frontend. | ||
* | ||
* @param {*} navNode the navigation node defining the compound | ||
* @param {*} wc_container the web component container dom element | ||
* @param {*} context the luigi node context | ||
*/ | ||
renderWebComponentCompound(navNode, wc_container, context) { | ||
var _a; | ||
let renderer; | ||
if (navNode.webcomponent && navNode.viewUrl) { | ||
renderer = new DefaultCompoundRenderer(); | ||
renderer.viewUrl = this.processViewUrl(navNode.viewUrl, { context }); | ||
renderer.createCompoundItemContainer = layoutConfig => { | ||
var cnt = document.createElement('div'); | ||
if (layoutConfig && layoutConfig.slot) { | ||
cnt.setAttribute('slot', layoutConfig.slot); | ||
} | ||
return cnt; | ||
}; | ||
} else if ((_a = navNode.compound) === null || _a === void 0 ? void 0 : _a.renderer) { | ||
renderer = resolveRenderer(navNode.compound.renderer); | ||
} | ||
renderer = renderer || new DefaultCompoundRenderer(); | ||
return new Promise(resolve => { | ||
this.createCompoundContainerAsync(renderer, context).then(compoundCnt => { | ||
var _a; | ||
const ebListeners = {}; | ||
compoundCnt.eventBus = { | ||
listeners: ebListeners, | ||
onPublishEvent: (event, srcNodeId, wcId) => { | ||
const listeners = ebListeners[srcNodeId + '.' + event.type] || []; | ||
listeners.push(...(ebListeners['*.' + event.type] || [])); | ||
listeners.forEach(listenerInfo => { | ||
const target = | ||
listenerInfo.wcElement || compoundCnt.querySelector('[nodeId=' + listenerInfo.wcElementId + ']'); | ||
if (target) { | ||
target.dispatchEvent( | ||
new CustomEvent(listenerInfo.action, { | ||
detail: listenerInfo.converter ? listenerInfo.converter(event.detail) : event.detail | ||
}) | ||
); | ||
} else { | ||
console.debug('Could not find event target', listenerInfo); | ||
} | ||
}); | ||
} | ||
}; | ||
(_a = navNode.compound) === null || _a === void 0 | ||
? void 0 | ||
: _a.children.forEach((wc, index) => { | ||
const ctx = Object.assign(Object.assign({}, context), wc.context); | ||
const compoundItemCnt = renderer.createCompoundItemContainer(wc.layoutConfig); | ||
compoundItemCnt.eventBus = compoundCnt.eventBus; | ||
renderer.attachCompoundItem(compoundCnt, compoundItemCnt); | ||
const nodeId = wc.id || 'gen_' + index; | ||
this.renderWebComponent(wc.viewUrl, compoundItemCnt, ctx, wc, nodeId); | ||
registerEventListeners(ebListeners, wc, nodeId); | ||
}); | ||
wc_container.appendChild(compoundCnt); | ||
// listener for nesting wc | ||
registerEventListeners(ebListeners, navNode.compound, '_root', compoundCnt); | ||
resolve(compoundCnt); | ||
}); | ||
}); | ||
} | ||
} | ||
/* src/LuigiContainer.svelte generated by Svelte v3.46.4 */ | ||
const { console: console_1$1 } = globals; | ||
const file$1 = 'src/LuigiContainer.svelte'; | ||
// (87:1) {#if !deferInit} | ||
function create_if_block(ctx) { | ||
let show_if = !(/*isWebComponent*/ ctx[5]()); | ||
let if_block_anchor; | ||
let if_block = show_if && create_if_block_1(ctx); | ||
const block = { | ||
c: function create() { | ||
if (if_block) if_block.c(); | ||
if_block_anchor = empty(); | ||
}, | ||
m: function mount(target, anchor) { | ||
if (if_block) if_block.m(target, anchor); | ||
insert_dev(target, if_block_anchor, anchor); | ||
}, | ||
p: function update(ctx, dirty) { | ||
if (show_if) if_block.p(ctx, dirty); | ||
}, | ||
d: function destroy(detaching) { | ||
if (if_block) if_block.d(detaching); | ||
if (detaching) detach_dev(if_block_anchor); | ||
} | ||
}; | ||
dispatch_dev('SvelteRegisterBlock', { | ||
block, | ||
id: create_if_block.name, | ||
type: 'if', | ||
source: '(87:1) {#if !deferInit}', | ||
ctx | ||
}); | ||
return block; | ||
} | ||
// (88:2) {#if !isWebComponent()} | ||
function create_if_block_1(ctx) { | ||
let iframe; | ||
let iframe_src_value; | ||
const block = { | ||
c: function create() { | ||
iframe = element('iframe'); | ||
if (!src_url_equal(iframe.src, (iframe_src_value = /*viewurl*/ ctx[0]))) | ||
attr_dev(iframe, 'src', iframe_src_value); | ||
attr_dev(iframe, 'title', /*label*/ ctx[1]); | ||
add_location(iframe, file$1, 88, 3, 2288); | ||
}, | ||
m: function mount(target, anchor) { | ||
insert_dev(target, iframe, anchor); | ||
/*iframe_binding*/ ctx[8](iframe); | ||
}, | ||
p: function update(ctx, dirty) { | ||
if (dirty & /*viewurl*/ 1 && !src_url_equal(iframe.src, (iframe_src_value = /*viewurl*/ ctx[0]))) { | ||
attr_dev(iframe, 'src', iframe_src_value); | ||
} | ||
if (dirty & /*label*/ 2) { | ||
attr_dev(iframe, 'title', /*label*/ ctx[1]); | ||
} | ||
}, | ||
d: function destroy(detaching) { | ||
if (detaching) detach_dev(iframe); | ||
/*iframe_binding*/ ctx[8](null); | ||
} | ||
}; | ||
dispatch_dev('SvelteRegisterBlock', { | ||
block, | ||
id: create_if_block_1.name, | ||
type: 'if', | ||
source: '(88:2) {#if !isWebComponent()}', | ||
ctx | ||
}); | ||
return block; | ||
} | ||
function create_fragment$1(ctx) { | ||
let main; | ||
let if_block = !(/*deferInit*/ ctx[4]) && create_if_block(ctx); | ||
const block = { | ||
c: function create() { | ||
main = element('main'); | ||
if (if_block) if_block.c(); | ||
this.c = noop; | ||
attr_dev(main, 'class', /*isWebComponent*/ ctx[5]() ? undefined : 'lui-isolated'); | ||
add_location(main, file$1, 85, 0, 2154); | ||
}, | ||
l: function claim(nodes) { | ||
throw new Error('options.hydrate only works if the component was compiled with the `hydratable: true` option'); | ||
}, | ||
m: function mount(target, anchor) { | ||
insert_dev(target, main, anchor); | ||
if (if_block) if_block.m(main, null); | ||
/*main_binding*/ ctx[9](main); | ||
}, | ||
p: function update(ctx, [dirty]) { | ||
if (!(/*deferInit*/ ctx[4])) { | ||
if (if_block) { | ||
if_block.p(ctx, dirty); | ||
} else { | ||
if_block = create_if_block(ctx); | ||
if_block.c(); | ||
if_block.m(main, null); | ||
} | ||
} else if (if_block) { | ||
if_block.d(1); | ||
if_block = null; | ||
} | ||
}, | ||
i: noop, | ||
o: noop, | ||
d: function destroy(detaching) { | ||
if (detaching) detach_dev(main); | ||
if (if_block) if_block.d(); | ||
/*main_binding*/ ctx[9](null); | ||
} | ||
}; | ||
dispatch_dev('SvelteRegisterBlock', { | ||
block, | ||
id: create_fragment$1.name, | ||
type: 'component', | ||
source: '', | ||
ctx | ||
}); | ||
return block; | ||
} | ||
function instance$1($$self, $$props, $$invalidate) { | ||
let { $$slots: slots = {}, $$scope } = $$props; | ||
validate_slots('undefined', slots, []); | ||
let { viewurl } = $$props; | ||
let { context } = $$props; | ||
let { label } = $$props; | ||
let { webcomponent } = $$props; | ||
let iframeHandle = {}; | ||
let mainComponent; | ||
const containerService = new ContainerService(); | ||
const webcomponentService = new WebComponentService(); | ||
webcomponentService.createClientAPI = (eventBusElement, nodeId, wc_id) => { | ||
return { | ||
linkManager: () => { | ||
return { | ||
navigate: route => { | ||
dispatchLuigiEvent('navigation-request', { link: route }); | ||
} | ||
}; | ||
}, | ||
uxManager: () => { | ||
return { | ||
showAlert: alertSettings => { | ||
dispatchLuigiEvent('alert-request', alertSettings); | ||
}, | ||
showConfirmationModal: async settings => { | ||
return new Promise((resolve, reject) => { | ||
dispatchLuigiEvent('confirmation-request', settings, data => { | ||
if (data) { | ||
resolve(data); | ||
} else { | ||
reject(); | ||
} | ||
}); | ||
}); | ||
} | ||
}; | ||
}, //window.Luigi.ux, | ||
getCurrentLocale: () => {}, //() => window.Luigi.i18n().getCurrentLocale(), | ||
publishEvent: ev => {} // if (eventBusElement.eventBus) { | ||
// eventBusElement.eventBus.onPublishEvent(ev, nodeId, wc_id); | ||
// } | ||
}; | ||
}; | ||
const thisComponent = get_current_component(); | ||
thisComponent.iframeHandle = iframeHandle; | ||
let deferInit = !!thisComponent.attributes['defer-init']; | ||
thisComponent.init = () => { | ||
$$invalidate(4, (deferInit = false)); | ||
}; | ||
containerService.registerContainer(thisComponent); | ||
function dispatchLuigiEvent(msg, data, callback) { | ||
containerService.dispatch(msg, thisComponent, data, callback); | ||
} | ||
function isWebComponent() { | ||
return !!webcomponent; | ||
} | ||
onMount(async () => { | ||
const ctx = context ? JSON.parse(context) : undefined; | ||
console.log(ctx); | ||
if (isWebComponent()) { | ||
$$invalidate(3, (mainComponent.innerHTML = ''), mainComponent); | ||
webcomponentService.renderWebComponent(viewurl, mainComponent, ctx, {}); | ||
} | ||
}); | ||
onDestroy(async () => {}); | ||
const writable_props = ['viewurl', 'context', 'label', 'webcomponent']; | ||
Object.keys($$props).forEach(key => { | ||
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') | ||
console_1$1.warn(`<undefined> was created with unknown prop '${key}'`); | ||
}); | ||
function iframe_binding($$value) { | ||
binding_callbacks[$$value ? 'unshift' : 'push'](() => { | ||
iframeHandle.iframe = $$value; | ||
$$invalidate(2, iframeHandle); | ||
}); | ||
} | ||
function main_binding($$value) { | ||
binding_callbacks[$$value ? 'unshift' : 'push'](() => { | ||
mainComponent = $$value; | ||
$$invalidate(3, mainComponent); | ||
}); | ||
} | ||
$$self.$$set = $$props => { | ||
if ('viewurl' in $$props) $$invalidate(0, (viewurl = $$props.viewurl)); | ||
if ('context' in $$props) $$invalidate(6, (context = $$props.context)); | ||
if ('label' in $$props) $$invalidate(1, (label = $$props.label)); | ||
if ('webcomponent' in $$props) $$invalidate(7, (webcomponent = $$props.webcomponent)); | ||
}; | ||
$$self.$capture_state = () => ({ | ||
viewurl, | ||
context, | ||
label, | ||
webcomponent, | ||
iframeHandle, | ||
mainComponent, | ||
onMount, | ||
onDestroy, | ||
get_current_component, | ||
ContainerService, | ||
WebComponentService, | ||
containerService, | ||
webcomponentService, | ||
thisComponent, | ||
deferInit, | ||
dispatchLuigiEvent, | ||
isWebComponent | ||
}); | ||
$$self.$inject_state = $$props => { | ||
if ('viewurl' in $$props) $$invalidate(0, (viewurl = $$props.viewurl)); | ||
if ('context' in $$props) $$invalidate(6, (context = $$props.context)); | ||
if ('label' in $$props) $$invalidate(1, (label = $$props.label)); | ||
if ('webcomponent' in $$props) $$invalidate(7, (webcomponent = $$props.webcomponent)); | ||
if ('iframeHandle' in $$props) $$invalidate(2, (iframeHandle = $$props.iframeHandle)); | ||
if ('mainComponent' in $$props) $$invalidate(3, (mainComponent = $$props.mainComponent)); | ||
if ('deferInit' in $$props) $$invalidate(4, (deferInit = $$props.deferInit)); | ||
}; | ||
if ($$props && '$$inject' in $$props) { | ||
$$self.$inject_state($$props.$$inject); | ||
} | ||
return [ | ||
viewurl, | ||
label, | ||
iframeHandle, | ||
mainComponent, | ||
deferInit, | ||
isWebComponent, | ||
context, | ||
webcomponent, | ||
iframe_binding, | ||
main_binding | ||
]; | ||
} | ||
class LuigiContainer extends SvelteElement { | ||
constructor(options) { | ||
super(); | ||
this.shadowRoot.innerHTML = `<style>main,iframe{width:100%;height:100%;border:none}main.lui-isolated{line-height:0}</style>`; | ||
init( | ||
this, | ||
{ | ||
target: this.shadowRoot, | ||
props: attribute_to_object(this.attributes), | ||
customElement: true | ||
}, | ||
instance$1, | ||
create_fragment$1, | ||
safe_not_equal, | ||
{ | ||
viewurl: 0, | ||
context: 6, | ||
label: 1, | ||
webcomponent: 7 | ||
}, | ||
null | ||
); | ||
const { ctx } = this.$$; | ||
const props = this.attributes; | ||
if (/*viewurl*/ ctx[0] === undefined && !('viewurl' in props)) { | ||
console_1$1.warn("<undefined> was created without expected prop 'viewurl'"); | ||
} | ||
if (/*context*/ ctx[6] === undefined && !('context' in props)) { | ||
console_1$1.warn("<undefined> was created without expected prop 'context'"); | ||
} | ||
if (/*label*/ ctx[1] === undefined && !('label' in props)) { | ||
console_1$1.warn("<undefined> was created without expected prop 'label'"); | ||
} | ||
if (/*webcomponent*/ ctx[7] === undefined && !('webcomponent' in props)) { | ||
console_1$1.warn("<undefined> was created without expected prop 'webcomponent'"); | ||
} | ||
if (options) { | ||
if (options.target) { | ||
insert_dev(options.target, this, options.anchor); | ||
} | ||
if (options.props) { | ||
this.$set(options.props); | ||
flush(); | ||
} | ||
} | ||
} | ||
static get observedAttributes() { | ||
return ['viewurl', 'context', 'label', 'webcomponent']; | ||
} | ||
get viewurl() { | ||
return this.$$.ctx[0]; | ||
} | ||
set viewurl(viewurl) { | ||
this.$$set({ viewurl }); | ||
flush(); | ||
} | ||
get context() { | ||
return this.$$.ctx[6]; | ||
} | ||
set context(context) { | ||
this.$$set({ context }); | ||
flush(); | ||
} | ||
get label() { | ||
return this.$$.ctx[1]; | ||
} | ||
set label(label) { | ||
this.$$set({ label }); | ||
flush(); | ||
} | ||
get webcomponent() { | ||
return this.$$.ctx[7]; | ||
} | ||
set webcomponent(webcomponent) { | ||
this.$$set({ webcomponent }); | ||
flush(); | ||
} | ||
} | ||
/* src/LuigiCompoundContainer.svelte generated by Svelte v3.46.4 */ | ||
const { console: console_1 } = globals; | ||
const file = 'src/LuigiCompoundContainer.svelte'; | ||
function create_fragment(ctx) { | ||
let main; | ||
const block = { | ||
c: function create() { | ||
main = element('main'); | ||
this.c = noop; | ||
add_location(main, file, 77, 0, 2189); | ||
}, | ||
l: function claim(nodes) { | ||
throw new Error('options.hydrate only works if the component was compiled with the `hydratable: true` option'); | ||
}, | ||
m: function mount(target, anchor) { | ||
insert_dev(target, main, anchor); | ||
/*main_binding*/ ctx[2](main); | ||
}, | ||
p: noop, | ||
i: noop, | ||
o: noop, | ||
d: function destroy(detaching) { | ||
if (detaching) detach_dev(main); | ||
/*main_binding*/ ctx[2](null); | ||
} | ||
}; | ||
dispatch_dev('SvelteRegisterBlock', { | ||
block, | ||
id: create_fragment.name, | ||
type: 'component', | ||
source: '', | ||
ctx | ||
}); | ||
return block; | ||
} | ||
function instance($$self, $$props, $$invalidate) { | ||
let { $$slots: slots = {}, $$scope } = $$props; | ||
validate_slots('undefined', slots, []); | ||
let { context } = $$props; | ||
// export let label; | ||
let compoundConfig; | ||
let initialized = false; | ||
let mainComponent; | ||
let eventBusElement; | ||
const containerService = new ContainerService(); | ||
const webcomponentService = new WebComponentService(); | ||
webcomponentService.createClientAPI = (eventBusElement, nodeId, wc_id) => { | ||
return { | ||
linkManager: () => {}, //window.Luigi.navigation, | ||
uxManager: () => { | ||
return { | ||
showAlert: alertSettings => { | ||
dispatchLuigiEvent('alert-request', alertSettings); | ||
}, | ||
showConfirmationModal: async settings => { | ||
return new Promise((resolve, reject) => { | ||
dispatchLuigiEvent('confirmation-request', settings, data => { | ||
if (data) { | ||
resolve(data); | ||
} else { | ||
reject(); | ||
} | ||
}); | ||
}); | ||
} | ||
}; | ||
}, //window.Luigi.ux, | ||
getCurrentLocale: () => {}, //() => window.Luigi.i18n().getCurrentLocale(), | ||
publishEvent: ev => { | ||
console.log('pub', ev); | ||
if (eventBusElement && eventBusElement.eventBus) { | ||
eventBusElement.eventBus.onPublishEvent(ev, nodeId, wc_id); | ||
} | ||
} | ||
}; | ||
}; | ||
const thisComponent = get_current_component(); | ||
let deferInit = !!thisComponent.attributes['defer-init']; | ||
thisComponent.init = () => { | ||
if (!thisComponent.compoundConfig || initialized) return; | ||
deferInit = false; | ||
console.log('init compound'); | ||
const node = { compound: thisComponent.compoundConfig }; // TODO: fill with sth | ||
webcomponentService.renderWebComponentCompound(node, mainComponent, context).then(compCnt => { | ||
eventBusElement = compCnt; | ||
}); | ||
initialized = true; | ||
}; | ||
containerService.registerContainer(thisComponent); | ||
function dispatchLuigiEvent(msg, data, callback) { | ||
containerService.dispatch(msg, thisComponent, data, callback); | ||
} | ||
onMount(async () => { | ||
const ctx = context ? JSON.parse(context) : undefined; | ||
console.log(ctx); | ||
}); | ||
const writable_props = ['context']; | ||
Object.keys($$props).forEach(key => { | ||
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') | ||
console_1.warn(`<undefined> was created with unknown prop '${key}'`); | ||
}); | ||
function main_binding($$value) { | ||
binding_callbacks[$$value ? 'unshift' : 'push'](() => { | ||
mainComponent = $$value; | ||
$$invalidate(0, mainComponent); | ||
}); | ||
} | ||
$$self.$$set = $$props => { | ||
if ('context' in $$props) $$invalidate(1, (context = $$props.context)); | ||
}; | ||
$$self.$capture_state = () => ({ | ||
context, | ||
compoundConfig, | ||
initialized, | ||
mainComponent, | ||
eventBusElement, | ||
onMount, | ||
get_current_component, | ||
ContainerService, | ||
WebComponentService, | ||
containerService, | ||
webcomponentService, | ||
thisComponent, | ||
deferInit, | ||
dispatchLuigiEvent | ||
}); | ||
$$self.$inject_state = $$props => { | ||
if ('context' in $$props) $$invalidate(1, (context = $$props.context)); | ||
if ('compoundConfig' in $$props) compoundConfig = $$props.compoundConfig; | ||
if ('initialized' in $$props) initialized = $$props.initialized; | ||
if ('mainComponent' in $$props) $$invalidate(0, (mainComponent = $$props.mainComponent)); | ||
if ('eventBusElement' in $$props) eventBusElement = $$props.eventBusElement; | ||
if ('deferInit' in $$props) deferInit = $$props.deferInit; | ||
}; | ||
if ($$props && '$$inject' in $$props) { | ||
$$self.$inject_state($$props.$$inject); | ||
} | ||
return [mainComponent, context, main_binding]; | ||
} | ||
class LuigiCompoundContainer extends SvelteElement { | ||
constructor(options) { | ||
super(); | ||
this.shadowRoot.innerHTML = `<style>main{width:100%;height:100%;border:none}</style>`; | ||
init( | ||
this, | ||
{ | ||
target: this.shadowRoot, | ||
props: attribute_to_object(this.attributes), | ||
customElement: true | ||
}, | ||
instance, | ||
create_fragment, | ||
safe_not_equal, | ||
{ context: 1 }, | ||
null | ||
); | ||
const { ctx } = this.$$; | ||
const props = this.attributes; | ||
if (/*context*/ ctx[1] === undefined && !('context' in props)) { | ||
console_1.warn("<undefined> was created without expected prop 'context'"); | ||
} | ||
if (options) { | ||
if (options.target) { | ||
insert_dev(options.target, this, options.anchor); | ||
} | ||
if (options.props) { | ||
this.$set(options.props); | ||
flush(); | ||
} | ||
} | ||
} | ||
static get observedAttributes() { | ||
return ['context']; | ||
} | ||
get context() { | ||
return this.$$.ctx[1]; | ||
} | ||
set context(context) { | ||
this.$$set({ context }); | ||
flush(); | ||
} | ||
} | ||
export { LuigiCompoundContainer, LuigiContainer }; | ||
function t(){}function e(t){return t()}function n(){return Object.create(null)}function o(t){t.forEach(e)}function r(t){return"function"==typeof t}function i(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}let c,s;function u(t,e){return c||(c=document.createElement("a")),c.href=e,t===c.href}function a(t,e,n){t.insertBefore(e,n||null)}function l(t){t.parentNode.removeChild(t)}function d(t){return document.createElement(t)}function f(){return t="",document.createTextNode(t);var t}function p(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function h(t){const e={};for(const n of t)e[n.name]=n.value;return e}function m(t){s=t}function _(){if(!s)throw new Error("Function called outside component initialization");return s}const g=[],b=[],y=[],v=[],w=Promise.resolve();let $=!1;function C(t){y.push(t)}const x=new Set;let F=0;function E(){const t=s;do{for(;F<g.length;){const t=g[F];F++,m(t),k(t.$$)}for(m(null),g.length=0,F=0;b.length;)b.pop()();for(let t=0;t<y.length;t+=1){const e=y[t];x.has(e)||(x.add(e),e())}y.length=0}while(g.length);for(;v.length;)v.pop()();$=!1,x.clear(),m(t)}function k(t){if(null!==t.fragment){t.update(),o(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(C)}}const S=new Set;function O(t,e){-1===t.$$.dirty[0]&&(g.push(t),$||($=!0,w.then(E)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function M(i,c,u,a,d,f,p,h=[-1]){const _=s;m(i);const g=i.$$={fragment:null,ctx:null,props:f,update:t,not_equal:d,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(c.context||(_?_.$$.context:[])),callbacks:n(),dirty:h,skip_bound:!1,root:c.target||_.$$.root};p&&p(g.root);let b=!1;if(g.ctx=u?u(i,c.props||{},((t,e,...n)=>{const o=n.length?n[0]:e;return g.ctx&&d(g.ctx[t],g.ctx[t]=o)&&(!g.skip_bound&&g.bound[t]&&g.bound[t](o),b&&O(i,t)),e})):[],g.update(),b=!0,o(g.before_update),g.fragment=!!a&&a(g.ctx),c.target){if(c.hydrate){const t=function(t){return Array.from(t.childNodes)}(c.target);g.fragment&&g.fragment.l(t),t.forEach(l)}else g.fragment&&g.fragment.c();c.intro&&((y=i.$$.fragment)&&y.i&&(S.delete(y),y.i(v))),function(t,n,i,c){const{fragment:s,on_mount:u,on_destroy:a,after_update:l}=t.$$;s&&s.m(n,i),c||C((()=>{const n=u.map(e).filter(r);a?a.push(...n):o(n),t.$$.on_mount=[]})),l.forEach(C)}(i,c.target,c.anchor,c.customElement),E()}var y,v;m(_)}let j;"function"==typeof HTMLElement&&(j=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(e).filter(r);for(const t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(t,e,n){this[t]=n}disconnectedCallback(){o(this.$$.on_disconnect)}$destroy(){!function(t,e){const n=t.$$;null!==n.fragment&&(o(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});var A="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function I(t){var e={exports:{}};return t(e,e.exports),e.exports}var P=I((function(t,e){function n(){}Object.defineProperty(e,"__esModule",{value:!0});const o=t=>t;function r(t,e){for(const n in e)t[n]=e[n];return t}function i(t){return t&&"object"==typeof t&&"function"==typeof t.then}function c(t){return t()}function s(){return Object.create(null)}function u(t){t.forEach(c)}function a(t){return"function"==typeof t}let l;function d(t){return 0===Object.keys(t).length}function f(t,...e){if(null==t)return n;const o=t.subscribe(...e);return o.unsubscribe?()=>o.unsubscribe():o}function p(t,e,n,o){return t[1]&&o?r(n.ctx.slice(),t[1](o(e))):n.ctx}function h(t,e,n,o){if(t[2]&&o){const r=t[2](o(n));if(void 0===e.dirty)return r;if("object"==typeof r){const t=[],n=Math.max(e.dirty.length,r.length);for(let o=0;o<n;o+=1)t[o]=e.dirty[o]|r[o];return t}return e.dirty|r}return e.dirty}function m(t,e,n,o,r,i){if(r){const c=p(e,n,o,i);t.p(c,r)}}const _=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const g="undefined"!=typeof window;e.now=g?()=>window.performance.now():()=>Date.now(),e.raf=g?t=>requestAnimationFrame(t):n;const b=new Set;function y(t){b.forEach((e=>{e.c(t)||(b.delete(e),e.f())})),0!==b.size&&e.raf(y)}function v(t){let n;return 0===b.size&&e.raf(y),{promise:new Promise((e=>{b.add(n={c:t,f:e})})),abort(){b.delete(n)}}}let w,$=!1;function C(){$=!0}function x(){$=!1}function F(t,e,n,o){for(;t<e;){const r=t+(e-t>>1);n(r)<=o?t=r+1:e=r}return t}function E(t,e){t.appendChild(e)}function k(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function S(t){const e=T("style");return O(k(t),e),e.sheet}function O(t,e){E(t.head||t,e)}function M(t,e){if($){for(!function(t){if(t.hydrate_init)return;t.hydrate_init=!0;let e=t.childNodes;if("HEAD"===t.nodeName){const t=[];for(let n=0;n<e.length;n++){const o=e[n];void 0!==o.claim_order&&t.push(o)}e=t}const n=new Int32Array(e.length+1),o=new Int32Array(e.length);n[0]=-1;let r=0;for(let t=0;t<e.length;t++){const i=e[t].claim_order,c=(r>0&&e[n[r]].claim_order<=i?r+1:F(1,r,(t=>e[n[t]].claim_order),i))-1;o[t]=n[c]+1;const s=c+1;n[s]=t,r=Math.max(s,r)}const i=[],c=[];let s=e.length-1;for(let t=n[r]+1;0!=t;t=o[t-1]){for(i.push(e[t-1]);s>=t;s--)c.push(e[s]);s--}for(;s>=0;s--)c.push(e[s]);i.reverse(),c.sort(((t,e)=>t.claim_order-e.claim_order));for(let e=0,n=0;e<c.length;e++){for(;n<i.length&&c[e].claim_order>=i[n].claim_order;)n++;const o=n<i.length?i[n]:null;t.insertBefore(c[e],o)}}(t),(void 0===t.actual_end_child||null!==t.actual_end_child&&t.actual_end_child.parentElement!==t)&&(t.actual_end_child=t.firstChild);null!==t.actual_end_child&&void 0===t.actual_end_child.claim_order;)t.actual_end_child=t.actual_end_child.nextSibling;e!==t.actual_end_child?void 0===e.claim_order&&e.parentNode===t||t.insertBefore(e,t.actual_end_child):t.actual_end_child=e.nextSibling}else e.parentNode===t&&null===e.nextSibling||t.appendChild(e)}function j(t,e,n){t.insertBefore(e,n||null)}function I(t,e,n){$&&!n?M(t,e):e.parentNode===t&&e.nextSibling==n||t.insertBefore(e,n||null)}function P(t){t.parentNode.removeChild(t)}function T(t){return document.createElement(t)}function R(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function W(t){return document.createTextNode(t)}function D(t,e,n,o){return t.addEventListener(e,n,o),()=>t.removeEventListener(e,n,o)}function L(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function U(t){return Array.from(t.childNodes)}function N(t){void 0===t.claim_info&&(t.claim_info={last_index:0,total_claimed:0})}function H(t,e,n,o,r=!1){N(t);const i=(()=>{for(let o=t.claim_info.last_index;o<t.length;o++){const i=t[o];if(e(i)){const e=n(i);return void 0===e?t.splice(o,1):t[o]=e,r||(t.claim_info.last_index=o),i}}for(let o=t.claim_info.last_index-1;o>=0;o--){const i=t[o];if(e(i)){const e=n(i);return void 0===e?t.splice(o,1):t[o]=e,r?void 0===e&&t.claim_info.last_index--:t.claim_info.last_index=o,i}}return o()})();return i.claim_order=t.claim_info.total_claimed,t.claim_info.total_claimed+=1,i}function q(t,e,n,o){return H(t,(t=>t.nodeName===e),(t=>{const e=[];for(let o=0;o<t.attributes.length;o++){const r=t.attributes[o];n[r.name]||e.push(r.name)}e.forEach((e=>t.removeAttribute(e)))}),(()=>o(e)))}function B(t,e){return H(t,(t=>3===t.nodeType),(t=>{const n=""+e;if(t.data.startsWith(n)){if(t.data.length!==n.length)return t.splitText(n.length)}else t.data=n}),(()=>W(e)),!0)}function z(t,e,n){for(let o=n;o<t.length;o+=1){const n=t[o];if(8===n.nodeType&&n.textContent.trim()===e)return o}return t.length}function V(){if(void 0===w){w=!1;try{"undefined"!=typeof window&&window.parent&&window.parent.document}catch(t){w=!0}}return w}function G(t,e,n=!1){const o=document.createEvent("CustomEvent");return o.initCustomEvent(t,n,!1,e),o}class J{constructor(){this.e=this.n=null}c(t){this.h(t)}m(t,e,n=null){this.e||(this.e=T(e.nodeName),this.t=e,this.c(t)),this.i(n)}h(t){this.e.innerHTML=t,this.n=Array.from(this.e.childNodes)}i(t){for(let e=0;e<this.n.length;e+=1)j(this.t,this.n[e],t)}p(t){this.d(),this.h(t),this.i(this.a)}d(){this.n.forEach(P)}}class Y extends J{constructor(t){super(),this.e=this.n=null,this.l=t}c(t){this.l?this.n=this.l:super.c(t)}i(t){for(let e=0;e<this.n.length;e+=1)I(this.t,this.n[e],t)}}const K=new Map;let Q=0;function X(t,e,n,o,r,i,c,s=0){const u=16.666/o;let a="{\n";for(let t=0;t<=1;t+=u){const o=e+(n-e)*i(t);a+=100*t+`%{${c(o,1-o)}}\n`}const l=a+`100% {${c(n,1-n)}}\n}`,d=`__svelte_${function(t){let e=5381,n=t.length;for(;n--;)e=(e<<5)-e^t.charCodeAt(n);return e>>>0}(l)}_${s}`,f=k(t),{stylesheet:p,rules:h}=K.get(f)||function(t,e){const n={stylesheet:S(e),rules:{}};return K.set(t,n),n}(f,t);h[d]||(h[d]=!0,p.insertRule(`@keyframes ${d} ${l}`,p.cssRules.length));const m=t.style.animation||"";return t.style.animation=`${m?`${m}, `:""}${d} ${o}ms linear ${r}ms 1 both`,Q+=1,d}function Z(t,n){const o=(t.style.animation||"").split(", "),r=o.filter(n?t=>t.indexOf(n)<0:t=>-1===t.indexOf("__svelte")),i=o.length-r.length;i&&(t.style.animation=r.join(", "),Q-=i,Q||e.raf((()=>{Q||(K.forEach((t=>{const{stylesheet:e}=t;let n=e.cssRules.length;for(;n--;)e.deleteRule(n);t.rules={}})),K.clear())})))}function tt(t,e){const n=t.getBoundingClientRect();if(e.left!==n.left||e.top!==n.top){const o=getComputedStyle(t),r="none"===o.transform?"":o.transform;t.style.transform=`${r} translate(${e.left-n.left}px, ${e.top-n.top}px)`}}function et(t){e.current_component=t}function nt(){if(!e.current_component)throw new Error("Function called outside component initialization");return e.current_component}const ot=[],rt=[],it=[],ct=[],st=Promise.resolve();let ut=!1;function at(){ut||(ut=!0,st.then(ht))}function lt(t){it.push(t)}const dt=new Set;let ft,pt=0;function ht(){const t=e.current_component;do{for(;pt<ot.length;){const t=ot[pt];pt++,et(t),mt(t.$$)}for(et(null),ot.length=0,pt=0;rt.length;)rt.pop()();for(let t=0;t<it.length;t+=1){const e=it[t];dt.has(e)||(dt.add(e),e())}it.length=0}while(ot.length);for(;ct.length;)ct.pop()();ut=!1,dt.clear(),et(t)}function mt(t){if(null!==t.fragment){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(lt)}}function _t(){return ft||(ft=Promise.resolve(),ft.then((()=>{ft=null}))),ft}function gt(t,e,n){t.dispatchEvent(G(`${e?"intro":"outro"}${n}`))}const bt=new Set;let yt;function vt(){yt={r:0,c:[],p:yt}}function wt(){yt.r||u(yt.c),yt=yt.p}function $t(t,e){t&&t.i&&(bt.delete(t),t.i(e))}function Ct(t,e,n,o){if(t&&t.o){if(bt.has(t))return;bt.add(t),yt.c.push((()=>{bt.delete(t),o&&(n&&t.d(1),o())})),t.o(e)}}const xt={duration:0};const Ft="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:A;function Et(t,e){t.d(1),e.delete(t.key)}function kt(t,e){Ct(t,1,1,(()=>{e.delete(t.key)}))}const St=new Set(["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"]),Ot=/[\s'">/=\u{FDD0}-\u{FDEF}\u{FFFE}\u{FFFF}\u{1FFFE}\u{1FFFF}\u{2FFFE}\u{2FFFF}\u{3FFFE}\u{3FFFF}\u{4FFFE}\u{4FFFF}\u{5FFFE}\u{5FFFF}\u{6FFFE}\u{6FFFF}\u{7FFFE}\u{7FFFF}\u{8FFFE}\u{8FFFF}\u{9FFFE}\u{9FFFF}\u{AFFFE}\u{AFFFF}\u{BFFFE}\u{BFFFF}\u{CFFFE}\u{CFFFF}\u{DFFFE}\u{DFFFF}\u{EFFFE}\u{EFFFF}\u{FFFFE}\u{FFFFF}\u{10FFFE}\u{10FFFF}]/u;function Mt(t,e){const n={};for(const e of t.split(";")){const t=e.indexOf(":"),o=e.slice(0,t).trim(),r=e.slice(t+1).trim();o&&(n[o]=r)}for(const t in e){const o=e[t];o?n[t]=o:delete n[t]}return n}const jt={'"':""","'":"'","&":"&","<":"<",">":">"};function At(t){return String(t).replace(/["'&<>]/g,(t=>jt[t]))}function It(t){return"string"==typeof t?At(t):t}let Pt;function Tt(t){return Object.keys(t).filter((e=>t[e])).map((e=>`${e}: ${t[e]};`)).join(" ")}function Rt(t,e,n,o){const{fragment:r,on_mount:i,on_destroy:s,after_update:l}=t.$$;r&&r.m(e,n),o||lt((()=>{const e=i.map(c).filter(a);s?s.push(...e):u(e),t.$$.on_mount=[]})),l.forEach(lt)}function Wt(t,e){const n=t.$$;null!==n.fragment&&(u(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}"function"==typeof HTMLElement&&(e.SvelteElement=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(c).filter(a);for(const t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(t,e,n){this[t]=n}disconnectedCallback(){u(this.$$.on_disconnect)}$destroy(){Wt(this,1),this.$destroy=n}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){this.$$set&&!d(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});class Dt{$destroy(){Wt(this,1),this.$destroy=n}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){this.$$set&&!d(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function Lt(t,e){document.dispatchEvent(G(t,Object.assign({version:"3.46.4"},e),!0))}function Ut(t){Lt("SvelteDOMRemove",{node:t}),P(t)}class Nt extends Dt{constructor(t){if(!t||!t.target&&!t.$$inline)throw new Error("'target' is a required option");super()}$destroy(){super.$destroy(),this.$destroy=()=>{console.warn("Component was already destroyed")}}$capture_state(){}$inject_state(){}}e.HtmlTag=J,e.HtmlTagHydration=Y,e.SvelteComponent=Dt,e.SvelteComponentDev=Nt,e.SvelteComponentTyped=class extends Nt{constructor(t){super(t)}},e.action_destroyer=function(t){return t&&a(t.destroy)?t.destroy:n},e.add_attribute=function(t,e,n){return null==e||n&&!e?"":` ${t}${!0===e&&St.has(t)?"":`=${"string"==typeof e?JSON.stringify(At(e)):`"${e}"`}`}`},e.add_classes=function(t){return t?` class="${t}"`:""},e.add_flush_callback=function(t){ct.push(t)},e.add_location=function(t,e,n,o,r){t.__svelte_meta={loc:{file:e,line:n,column:o,char:r}}},e.add_render_callback=lt,e.add_resize_listener=function(t,e){"static"===getComputedStyle(t).position&&(t.style.position="relative");const n=T("iframe");n.setAttribute("style","display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;"),n.setAttribute("aria-hidden","true"),n.tabIndex=-1;const o=V();let r;return o?(n.src="data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}<\/script>",r=D(window,"message",(t=>{t.source===n.contentWindow&&e()}))):(n.src="about:blank",n.onload=()=>{r=D(n.contentWindow,"resize",e)}),E(t,n),()=>{(o||r&&n.contentWindow)&&r(),P(n)}},e.add_styles=function(t){const e=Tt(t);return e?` style="${e}"`:""},e.add_transform=tt,e.afterUpdate=function(t){nt().$$.after_update.push(t)},e.append=E,e.append_dev=function(t,e){Lt("SvelteDOMInsert",{target:t,node:e}),E(t,e)},e.append_empty_stylesheet=S,e.append_hydration=M,e.append_hydration_dev=function(t,e){Lt("SvelteDOMInsert",{target:t,node:e}),M(t,e)},e.append_styles=function(t,e,n){const o=k(t);if(!o.getElementById(e)){const t=T("style");t.id=e,t.textContent=n,O(o,t)}},e.assign=r,e.attr=L,e.attr_dev=function(t,e,n){L(t,e,n),null==n?Lt("SvelteDOMRemoveAttribute",{node:t,attribute:e}):Lt("SvelteDOMSetAttribute",{node:t,attribute:e,value:n})},e.attribute_to_object=function(t){const e={};for(const n of t)e[n.name]=n.value;return e},e.beforeUpdate=function(t){nt().$$.before_update.push(t)},e.bind=function(t,e,n){const o=t.$$.props[e];void 0!==o&&(t.$$.bound[o]=n,n(t.$$.ctx[o]))},e.binding_callbacks=rt,e.blank_object=s,e.bubble=function(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach((t=>t.call(this,e)))},e.check_outros=wt,e.children=U,e.claim_component=function(t,e){t&&t.l(e)},e.claim_element=function(t,e,n){return q(t,e,n,T)},e.claim_html_tag=function(t){const e=z(t,"HTML_TAG_START",0),n=z(t,"HTML_TAG_END",e);if(e===n)return new Y;N(t);const o=t.splice(e,n-e+1);P(o[0]),P(o[o.length-1]);const r=o.slice(1,o.length-1);for(const e of r)e.claim_order=t.claim_info.total_claimed,t.claim_info.total_claimed+=1;return new Y(r)},e.claim_space=function(t){return B(t," ")},e.claim_svg_element=function(t,e,n){return q(t,e,n,R)},e.claim_text=B,e.clear_loops=function(){b.clear()},e.component_subscribe=function(t,e,n){t.$$.on_destroy.push(f(e,n))},e.compute_rest_props=function(t,e){const n={};e=new Set(e);for(const o in t)e.has(o)||"$"===o[0]||(n[o]=t[o]);return n},e.compute_slots=function(t){const e={};for(const n in t)e[n]=!0;return e},e.createEventDispatcher=function(){const t=nt();return(e,n)=>{const o=t.$$.callbacks[e];if(o){const r=G(e,n);o.slice().forEach((e=>{e.call(t,r)}))}}},e.create_animation=function(t,r,i,c){if(!r)return n;const s=t.getBoundingClientRect();if(r.left===s.left&&r.right===s.right&&r.top===s.top&&r.bottom===s.bottom)return n;const{delay:u=0,duration:a=300,easing:l=o,start:d=e.now()+u,end:f=d+a,tick:p=n,css:h}=i(t,{from:r,to:s},c);let m,_=!0,g=!1;function b(){h&&Z(t,m),_=!1}return v((t=>{if(!g&&t>=d&&(g=!0),g&&t>=f&&(p(1,0),b()),!_)return!1;if(g){const e=0+1*l((t-d)/a);p(e,1-e)}return!0})),h&&(m=X(t,0,1,a,u,l,h)),u||(g=!0),p(0,1),b},e.create_bidirectional_transition=function(t,r,i,c){let s=r(t,i),l=c?0:1,d=null,f=null,p=null;function h(){p&&Z(t,p)}function m(t,e){const n=t.b-l;return e*=Math.abs(n),{a:l,b:t.b,d:n,duration:e,start:t.start,end:t.start+e,group:t.group}}function _(r){const{delay:i=0,duration:c=300,easing:a=o,tick:_=n,css:g}=s||xt,b={start:e.now()+i,b:r};r||(b.group=yt,yt.r+=1),d||f?f=b:(g&&(h(),p=X(t,l,r,c,i,a,g)),r&&_(0,1),d=m(b,c),lt((()=>gt(t,r,"start"))),v((e=>{if(f&&e>f.start&&(d=m(f,c),f=null,gt(t,d.b,"start"),g&&(h(),p=X(t,l,d.b,d.duration,0,a,s.css))),d)if(e>=d.end)_(l=d.b,1-l),gt(t,d.b,"end"),f||(d.b?h():--d.group.r||u(d.group.c)),d=null;else if(e>=d.start){const t=e-d.start;l=d.a+d.d*a(t/d.duration),_(l,1-l)}return!(!d&&!f)})))}return{run(t){a(s)?_t().then((()=>{s=s(),_(t)})):_(t)},end(){h(),d=f=null}}},e.create_component=function(t){t&&t.c()},e.create_in_transition=function(t,r,i){let c,s,u=r(t,i),l=!1,d=0;function f(){c&&Z(t,c)}function p(){const{delay:r=0,duration:i=300,easing:a=o,tick:p=n,css:h}=u||xt;h&&(c=X(t,0,1,i,r,a,h,d++)),p(0,1);const m=e.now()+r,_=m+i;s&&s.abort(),l=!0,lt((()=>gt(t,!0,"start"))),s=v((e=>{if(l){if(e>=_)return p(1,0),gt(t,!0,"end"),f(),l=!1;if(e>=m){const t=a((e-m)/i);p(t,1-t)}}return l}))}let h=!1;return{start(){h||(h=!0,Z(t),a(u)?(u=u(),_t().then(p)):p())},invalidate(){h=!1},end(){l&&(f(),l=!1)}}},e.create_out_transition=function(t,r,i){let c,s=r(t,i),l=!0;const d=yt;function f(){const{delay:r=0,duration:i=300,easing:a=o,tick:f=n,css:p}=s||xt;p&&(c=X(t,1,0,i,r,a,p));const h=e.now()+r,m=h+i;lt((()=>gt(t,!1,"start"))),v((e=>{if(l){if(e>=m)return f(0,1),gt(t,!1,"end"),--d.r||u(d.c),!1;if(e>=h){const t=a((e-h)/i);f(1-t,t)}}return l}))}return d.r+=1,a(s)?_t().then((()=>{s=s(),f()})):f(),{end(e){e&&s.tick&&s.tick(1,0),l&&(c&&Z(t,c),l=!1)}}},e.create_slot=function(t,e,n,o){if(t){const r=p(t,e,n,o);return t[0](r)}},e.create_ssr_component=function(t){function n(n,o,r,i,c){const u=e.current_component;et({$$:{on_destroy:Pt,context:new Map(c||(u?u.$$.context:[])),on_mount:[],before_update:[],after_update:[],callbacks:s()}});const a=t(n,o,r,i);return et(u),a}return{render:(t={},{$$slots:e={},context:o=new Map}={})=>{Pt=[];const r={title:"",head:"",css:new Set},i=n(r,t,{},e,o);return u(Pt),{html:i,css:{code:Array.from(r.css).map((t=>t.code)).join("\n"),map:null},head:r.title+r.head}},$$render:n}},e.custom_event=G,e.dataset_dev=function(t,e,n){t.dataset[e]=n,Lt("SvelteDOMSetDataset",{node:t,property:e,value:n})},e.debug=function(t,e,n,o){return console.log(`{@debug} ${t?t+" ":""}(${e}:${n})`),console.log(o),""},e.destroy_block=Et,e.destroy_component=Wt,e.destroy_each=function(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)},e.detach=P,e.detach_after_dev=function(t){for(;t.nextSibling;)Ut(t.nextSibling)},e.detach_before_dev=function(t){for(;t.previousSibling;)Ut(t.previousSibling)},e.detach_between_dev=function(t,e){for(;t.nextSibling&&t.nextSibling!==e;)Ut(t.nextSibling)},e.detach_dev=Ut,e.dirty_components=ot,e.dispatch_dev=Lt,e.each=function(t,e){let n="";for(let o=0;o<t.length;o+=1)n+=e(t[o],o);return n},e.element=T,e.element_is=function(t,e){return document.createElement(t,{is:e})},e.empty=function(){return W("")},e.end_hydrating=x,e.escape=At,e.escape_attribute_value=It,e.escape_object=function(t){const e={};for(const n in t)e[n]=It(t[n]);return e},e.escaped=jt,e.exclude_internal_props=function(t){const e={};for(const n in t)"$"!==n[0]&&(e[n]=t[n]);return e},e.fix_and_destroy_block=function(t,e){t.f(),Et(t,e)},e.fix_and_outro_and_destroy_block=function(t,e){t.f(),kt(t,e)},e.fix_position=function(t){const e=getComputedStyle(t);if("absolute"!==e.position&&"fixed"!==e.position){const{width:n,height:o}=e,r=t.getBoundingClientRect();t.style.position="absolute",t.style.width=n,t.style.height=o,tt(t,r)}},e.flush=ht,e.getAllContexts=function(){return nt().$$.context},e.getContext=function(t){return nt().$$.context.get(t)},e.get_all_dirty_from_scope=function(t){if(t.ctx.length>32){const e=[],n=t.ctx.length/32;for(let t=0;t<n;t++)e[t]=-1;return e}return-1},e.get_binding_group_value=function(t,e,n){const o=new Set;for(let e=0;e<t.length;e+=1)t[e].checked&&o.add(t[e].__value);return n||o.delete(e),Array.from(o)},e.get_current_component=nt,e.get_custom_elements_slots=function(t){const e={};return t.childNodes.forEach((t=>{e[t.slot||"default"]=!0})),e},e.get_root_for_style=k,e.get_slot_changes=h,e.get_spread_object=function(t){return"object"==typeof t&&null!==t?t:{}},e.get_spread_update=function(t,e){const n={},o={},r={$$scope:1};let i=t.length;for(;i--;){const c=t[i],s=e[i];if(s){for(const t in c)t in s||(o[t]=1);for(const t in s)r[t]||(n[t]=s[t],r[t]=1);t[i]=s}else for(const t in c)r[t]=1}for(const t in o)t in n||(n[t]=void 0);return n},e.get_store_value=function(t){let e;return f(t,(t=>e=t))(),e},e.globals=Ft,e.group_outros=vt,e.handle_promise=function(t,e){const n=e.token={};function o(t,o,r,i){if(e.token!==n)return;e.resolved=i;let c=e.ctx;void 0!==r&&(c=c.slice(),c[r]=i);const s=t&&(e.current=t)(c);let u=!1;e.block&&(e.blocks?e.blocks.forEach(((t,n)=>{n!==o&&t&&(vt(),Ct(t,1,1,(()=>{e.blocks[n]===t&&(e.blocks[n]=null)})),wt())})):e.block.d(1),s.c(),$t(s,1),s.m(e.mount(),e.anchor),u=!0),e.block=s,e.blocks&&(e.blocks[o]=s),u&&ht()}if(i(t)){const n=nt();if(t.then((t=>{et(n),o(e.then,1,e.value,t),et(null)}),(t=>{if(et(n),o(e.catch,2,e.error,t),et(null),!e.hasCatch)throw t})),e.current!==e.pending)return o(e.pending,0),!0}else{if(e.current!==e.then)return o(e.then,1,e.value,t),!0;e.resolved=t}},e.hasContext=function(t){return nt().$$.context.has(t)},e.has_prop=_,e.identity=o,e.init=function(t,o,r,i,c,a,l,d=[-1]){const f=e.current_component;et(t);const p=t.$$={fragment:null,ctx:null,props:a,update:n,not_equal:c,bound:s(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(o.context||(f?f.$$.context:[])),callbacks:s(),dirty:d,skip_bound:!1,root:o.target||f.$$.root};l&&l(p.root);let h=!1;if(p.ctx=r?r(t,o.props||{},((e,n,...o)=>{const r=o.length?o[0]:n;return p.ctx&&c(p.ctx[e],p.ctx[e]=r)&&(!p.skip_bound&&p.bound[e]&&p.bound[e](r),h&&function(t,e){-1===t.$$.dirty[0]&&(ot.push(t),at(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}(t,e)),n})):[],p.update(),h=!0,u(p.before_update),p.fragment=!!i&&i(p.ctx),o.target){if(o.hydrate){C();const t=U(o.target);p.fragment&&p.fragment.l(t),t.forEach(P)}else p.fragment&&p.fragment.c();o.intro&&$t(t.$$.fragment),Rt(t,o.target,o.anchor,o.customElement),x(),ht()}et(f)},e.insert=j,e.insert_dev=function(t,e,n){Lt("SvelteDOMInsert",{target:t,node:e,anchor:n}),j(t,e,n)},e.insert_hydration=I,e.insert_hydration_dev=function(t,e,n){Lt("SvelteDOMInsert",{target:t,node:e,anchor:n}),I(t,e,n)},e.intros={enabled:!1},e.invalid_attribute_name_character=Ot,e.is_client=g,e.is_crossorigin=V,e.is_empty=d,e.is_function=a,e.is_promise=i,e.listen=D,e.listen_dev=function(t,e,n,o,r,i){const c=!0===o?["capture"]:o?Array.from(Object.keys(o)):[];r&&c.push("preventDefault"),i&&c.push("stopPropagation"),Lt("SvelteDOMAddEventListener",{node:t,event:e,handler:n,modifiers:c});const s=D(t,e,n,o);return()=>{Lt("SvelteDOMRemoveEventListener",{node:t,event:e,handler:n,modifiers:c}),s()}},e.loop=v,e.loop_guard=function(t){const e=Date.now();return()=>{if(Date.now()-e>t)throw new Error("Infinite loop detected")}},e.merge_ssr_styles=Mt,e.missing_component={$$render:()=>""},e.mount_component=Rt,e.noop=n,e.not_equal=function(t,e){return t!=t?e==e:t!==e},e.null_to_empty=function(t){return null==t?"":t},e.object_without_properties=function(t,e){const n={};for(const o in t)_(t,o)&&-1===e.indexOf(o)&&(n[o]=t[o]);return n},e.onDestroy=function(t){nt().$$.on_destroy.push(t)},e.onMount=function(t){nt().$$.on_mount.push(t)},e.once=function(t){let e=!1;return function(...n){e||(e=!0,t.call(this,...n))}},e.outro_and_destroy_block=kt,e.prevent_default=function(t){return function(e){return e.preventDefault(),t.call(this,e)}},e.prop_dev=function(t,e,n){t[e]=n,Lt("SvelteDOMSetProperty",{node:t,property:e,value:n})},e.query_selector_all=function(t,e=document.body){return Array.from(e.querySelectorAll(t))},e.run=c,e.run_all=u,e.safe_not_equal=function(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t},e.schedule_update=at,e.select_multiple_value=function(t){return[].map.call(t.querySelectorAll(":checked"),(t=>t.__value))},e.select_option=function(t,e){for(let n=0;n<t.options.length;n+=1){const o=t.options[n];if(o.__value===e)return void(o.selected=!0)}t.selectedIndex=-1},e.select_options=function(t,e){for(let n=0;n<t.options.length;n+=1){const o=t.options[n];o.selected=~e.indexOf(o.__value)}},e.select_value=function(t){const e=t.querySelector(":checked")||t.options[0];return e&&e.__value},e.self=function(t){return function(e){e.target===this&&t.call(this,e)}},e.setContext=function(t,e){nt().$$.context.set(t,e)},e.set_attributes=function(t,e){const n=Object.getOwnPropertyDescriptors(t.__proto__);for(const o in e)null==e[o]?t.removeAttribute(o):"style"===o?t.style.cssText=e[o]:"__value"===o?t.value=t[o]=e[o]:n[o]&&n[o].set?t[o]=e[o]:L(t,o,e[o])},e.set_current_component=et,e.set_custom_element_data=function(t,e,n){e in t?t[e]="boolean"==typeof t[e]&&""===n||n:L(t,e,n)},e.set_data=function(t,e){e=""+e,t.wholeText!==e&&(t.data=e)},e.set_data_dev=function(t,e){e=""+e,t.wholeText!==e&&(Lt("SvelteDOMSetData",{node:t,data:e}),t.data=e)},e.set_input_type=function(t,e){try{t.type=e}catch(t){}},e.set_input_value=function(t,e){t.value=null==e?"":e},e.set_now=function(t){e.now=t},e.set_raf=function(t){e.raf=t},e.set_store_value=function(t,e,n){return t.set(n),e},e.set_style=function(t,e,n,o){null===n?t.style.removeProperty(e):t.style.setProperty(e,n,o?"important":"")},e.set_svg_attributes=function(t,e){for(const n in e)L(t,n,e[n])},e.space=function(){return W(" ")},e.spread=function(t,e){const n=Object.assign({},...t);if(e){const t=e.classes,o=e.styles;t&&(null==n.class?n.class=t:n.class+=" "+t),o&&(null==n.style?n.style=Tt(o):n.style=Tt(Mt(n.style,o)))}let o="";return Object.keys(n).forEach((t=>{if(Ot.test(t))return;const e=n[t];!0===e?o+=" "+t:St.has(t.toLowerCase())?e&&(o+=" "+t):null!=e&&(o+=` ${t}="${e}"`)})),o},e.src_url_equal=function(t,e){return l||(l=document.createElement("a")),l.href=e,t===l.href},e.start_hydrating=C,e.stop_propagation=function(t){return function(e){return e.stopPropagation(),t.call(this,e)}},e.subscribe=f,e.svg_element=R,e.text=W,e.tick=function(){return at(),st},e.time_ranges_to_array=function(t){const e=[];for(let n=0;n<t.length;n+=1)e.push({start:t.start(n),end:t.end(n)});return e},e.to_number=function(t){return""===t?null:+t},e.toggle_class=function(t,e,n){t.classList[n?"add":"remove"](e)},e.transition_in=$t,e.transition_out=Ct,e.trusted=function(t){return function(e){e.isTrusted&&t.call(this,e)}},e.update_await_block_branch=function(t,e,n){const o=e.slice(),{resolved:r}=t;t.current===t.then&&(o[t.value]=r),t.current===t.catch&&(o[t.error]=r),t.block.p(o,n)},e.update_keyed_each=function(t,e,n,o,r,i,c,s,u,a,l,d){let f=t.length,p=i.length,h=f;const m={};for(;h--;)m[t[h].key]=h;const _=[],g=new Map,b=new Map;for(h=p;h--;){const t=d(r,i,h),s=n(t);let u=c.get(s);u?o&&u.p(t,e):(u=a(s,t),u.c()),g.set(s,_[h]=u),s in m&&b.set(s,Math.abs(h-m[s]))}const y=new Set,v=new Set;function w(t){$t(t,1),t.m(s,l),c.set(t.key,t),l=t.first,p--}for(;f&&p;){const e=_[p-1],n=t[f-1],o=e.key,r=n.key;e===n?(l=e.first,f--,p--):g.has(r)?!c.has(o)||y.has(o)?w(e):v.has(r)?f--:b.get(o)>b.get(r)?(v.add(o),w(e)):(y.add(r),f--):(u(n,c),f--)}for(;f--;){const e=t[f];g.has(e.key)||u(e,c)}for(;p;)w(_[p-1]);return _},e.update_slot=function(t,e,n,o,r,i,c){m(t,e,n,o,h(e,o,r,i),c)},e.update_slot_base=m,e.validate_component=function(t,e){if(!t||!t.$$render)throw"svelte:component"===e&&(e+=" this={...}"),new Error(`<${e}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules`);return t},e.validate_each_argument=function(t){if(!("string"==typeof t||t&&"object"==typeof t&&"length"in t)){let e="{#each} only iterates over array-like objects.";throw"function"==typeof Symbol&&t&&Symbol.iterator in t&&(e+=" You can use a spread to convert this iterable into an array."),new Error(e)}},e.validate_each_keys=function(t,e,n,o){const r=new Set;for(let i=0;i<e.length;i++){const c=o(n(t,e,i));if(r.has(c))throw new Error("Cannot have duplicate keys in a keyed each");r.add(c)}},e.validate_slots=function(t,e,n){for(const o of Object.keys(e))~n.indexOf(o)||console.warn(`<${t}> received an unexpected slot "${o}".`)},e.validate_store=function(t,e){if(null!=t&&"function"!=typeof t.subscribe)throw new Error(`'${e}' is not a store with a 'subscribe' method`)},e.xlink_attr=function(t,e,n){t.setAttributeNS("http://www.w3.org/1999/xlink",e,n)}})),T=I((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"SvelteComponent",{enumerable:!0,get:function(){return P.SvelteComponentDev}}),Object.defineProperty(e,"SvelteComponentTyped",{enumerable:!0,get:function(){return P.SvelteComponentTyped}}),Object.defineProperty(e,"afterUpdate",{enumerable:!0,get:function(){return P.afterUpdate}}),Object.defineProperty(e,"beforeUpdate",{enumerable:!0,get:function(){return P.beforeUpdate}}),Object.defineProperty(e,"createEventDispatcher",{enumerable:!0,get:function(){return P.createEventDispatcher}}),Object.defineProperty(e,"getAllContexts",{enumerable:!0,get:function(){return P.getAllContexts}}),Object.defineProperty(e,"getContext",{enumerable:!0,get:function(){return P.getContext}}),Object.defineProperty(e,"hasContext",{enumerable:!0,get:function(){return P.hasContext}}),Object.defineProperty(e,"onDestroy",{enumerable:!0,get:function(){return P.onDestroy}}),Object.defineProperty(e,"onMount",{enumerable:!0,get:function(){return P.onMount}}),Object.defineProperty(e,"setContext",{enumerable:!0,get:function(){return P.setContext}}),Object.defineProperty(e,"tick",{enumerable:!0,get:function(){return P.tick}})})),R=function(){function t(){}return t.prototype.isVisible=function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)},t.prototype.dispatch=function(t,e,n,o){var r=new CustomEvent(t,{detail:n});r.luigiCallback=function(t){o&&o(t)},e.dispatchEvent(r),console.log("Dispatch WC event:",t,e,n)},t.prototype.getTargetContainer=function(t){var e;return globalThis.__luigi_container_manager.container.forEach((function(n){var o;(null===(o=n.iframeHandle)||void 0===o?void 0:o.iframe)&&n.iframeHandle.iframe.contentWindow===t.source&&(e=n)})),e},t.prototype.getContainerManager=function(){var t=this;return globalThis.__luigi_container_manager||(globalThis.__luigi_container_manager={container:[],messageListener:function(e){var n,o,r,i,c=t.getTargetContainer(e),s=null===(o=null===(n=null==c?void 0:c.iframeHandle)||void 0===n?void 0:n.iframe)||void 0===o?void 0:o.contentWindow;if(console.log("Container event",e,c),s===e.source&&0===(null===(i=null===(r=e.data)||void 0===r?void 0:r.msg)||void 0===i?void 0:i.indexOf("luigi."))){var u=e.data.msg;switch(u){case"luigi.get-context":s.postMessage({msg:"luigi.init",context:c.context,internal:{}},"*");break;case"luigi.navigation.open":t.dispatch("navigation-request",c,e.data.params);break;case"luigi.ux.alert.show":t.dispatch("alert-request",c,e.data.params);break;default:console.warn("Functionality not yet implemented: ",u)}}}},window.addEventListener("message",globalThis.__luigi_container_manager.messageListener)),globalThis.__luigi_container_manager},t.prototype.registerContainer=function(t){this.getContainerManager().container.push(t)},t}(),W=function(t,e){return W=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},W(t,e)};function D(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}W(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var L=function(){return L=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},L.apply(this,arguments)};function U(t,e,n,o){return new(n||(n=Promise))((function(r,i){function c(t){try{u(o.next(t))}catch(t){i(t)}}function s(t){try{u(o.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,s)}u((o=o.apply(t,e||[])).next())}))}function N(t,e){var n,o,r,i,c={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,o=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(r=c.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){c=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){c.label=i[1];break}if(6===i[0]&&c.label<r[1]){c.label=r[1],r=i;break}if(r&&c.label<r[2]){c.label=r[2],c.ops.push(i);break}r[2]&&c.ops.pop(),c.trys.pop();continue}i=e.call(t,c)}catch(t){i=[6,t],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}var H=function(){function t(t){t?(this.rendererObject=t,this.config=t.config||{}):this.config={}}return t.prototype.createCompoundContainer=function(){return document.createElement("div")},t.prototype.createCompoundItemContainer=function(t){return document.createElement("div")},t.prototype.attachCompoundItem=function(t,e){t.appendChild(e)},t}(),q=function(t){function e(e){var n=t.call(this,e||{use:{}})||this;return e&&e.use&&e.use.extends&&(n.superRenderer=z({use:e.use.extends,config:e.config})),n}return D(e,t),e.prototype.createCompoundContainer=function(){return this.rendererObject.use.createCompoundContainer?this.rendererObject.use.createCompoundContainer(this.config,this.superRenderer):this.superRenderer?this.superRenderer.createCompoundContainer():t.prototype.createCompoundContainer.call(this)},e.prototype.createCompoundItemContainer=function(e){return this.rendererObject.use.createCompoundItemContainer?this.rendererObject.use.createCompoundItemContainer(e,this.config,this.superRenderer):this.superRenderer?this.superRenderer.createCompoundItemContainer(e):t.prototype.createCompoundItemContainer.call(this,e)},e.prototype.attachCompoundItem=function(e,n){this.rendererObject.use.attachCompoundItem?this.rendererObject.use.attachCompoundItem(e,n,this.superRenderer):this.superRenderer?this.superRenderer.attachCompoundItem(e,n):t.prototype.attachCompoundItem.call(this,e,n)},e}(H),B=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return D(e,t),e.prototype.createCompoundContainer=function(){var t="__lui_compound_"+(new Date).getTime(),e=document.createElement("div");e.classList.add(t);var n="";return this.config.layouts&&this.config.layouts.forEach((function(e){if(e.minWidth||e.maxWidth){var o="@media only screen ";null!=e.minWidth&&(o+="and (min-width: ".concat(e.minWidth,"px) ")),null!=e.maxWidth&&(o+="and (max-width: ".concat(e.maxWidth,"px) ")),o+="{\n .".concat(t," {\n grid-template-columns: ").concat(e.columns||"auto",";\n grid-template-rows: ").concat(e.rows||"auto",";\n grid-gap: ").concat(e.gap||"0",";\n }\n }\n "),n+=o}})),e.innerHTML="\n <style scoped>\n .".concat(t," {\n display: grid;\n grid-template-columns: ").concat(this.config.columns||"auto",";\n grid-template-rows: ").concat(this.config.rows||"auto",";\n grid-gap: ").concat(this.config.gap||"0",";\n min-height: ").concat(this.config.minHeight||"auto",";\n }\n ").concat(n,"\n </style>\n "),e},e.prototype.createCompoundItemContainer=function(t){var e=t||{},n=document.createElement("div");return n.setAttribute("style","grid-row: ".concat(e.row||"auto","; grid-column: ").concat(e.column||"auto")),n},e}(H),z=function(t){var e=t.use;return e?"grid"===e?new B(t):e.createCompoundContainer||e.createCompoundItemContainer||e.attachCompoundItem?new q(t):new H(t):new H(t)},V=function(t,e,n,o){(null==e?void 0:e.eventListeners)&&e.eventListeners.forEach((function(e){var r=e.source+"."+e.name,i=t[r],c={wcElementId:n,wcElement:o,action:e.action,converter:e.dataConverter};i?i.push(c):t[r]=[c]}))},G=function(){function t(){this.containerService=new R}return t.prototype.dynamicImport=function(t){return import(t)},t.prototype.processViewUrl=function(t,e){return t},t.prototype.attachWC=function(t,e,n,o,r,i){if(n&&n.contains(e)){var c=document.createElement(t);i&&c.setAttribute("nodeId",i),this.initWC(c,t,n,r,o,i),n.replaceChild(c,e)}},t.prototype.createClientAPI=function(t,e,n){var o=this;return{linkManager:function(){},uxManager:function(){return{showAlert:function(t){},showConfirmationModal:function(t){return U(o,void 0,void 0,(function(){return N(this,(function(t){return[2,new Promise((function(t,e){t(!0)}))]}))}))}}},getCurrentLocale:function(){},publishEvent:function(t){}}},t.prototype.initWC=function(t,e,n,o,r,i){var c=this.createClientAPI(n,i,e);if(t.__postProcess){var s=new URL(document.baseURI).origin===new URL(o,document.baseURI).origin?new URL("./",new URL(o,document.baseURI)):new URL("./",o);t.__postProcess(r,c,s.origin+s.pathname)}else t.context=r,t.LuigiClient=c},t.prototype.generateWCId=function(t){for(var e="",n=0;n<t.length;n++)e+=t.charCodeAt(n).toString(16);return"luigi-wc-"+e},t.prototype.registerWCFromUrl=function(t,e){var n=this,o=this.processViewUrl(t);return new Promise((function(t,r){n.checkWCUrl(o)?n.dynamicImport(o).then((function(n){try{if(!window.customElements.get(e)){var o=n.default;if(!HTMLElement.isPrototypeOf(o))for(var i=Object.keys(n),c=0;c<i.length&&(o=n[i[c]],!HTMLElement.isPrototypeOf(o));c++);window.customElements.define(e,o)}t(1)}catch(t){r(t)}})).catch((function(t){return r(t)})):(console.warn("View URL '".concat(o,"' not allowed to be included")),r("View URL '".concat(o,"' not allowed")))}))},t.prototype.includeSelfRegisteredWCFromUrl=function(t,e,n){var o=this;if(this.checkWCUrl(e)){this.containerService.getContainerManager()._registerWebcomponent||(this.containerService.getContainerManager()._registerWebcomponent=function(t,e){window.customElements.define(o.generateWCId(t),e)});var r=document.createElement("script");r.setAttribute("src",e),"module"===t.webcomponent.type&&r.setAttribute("type","module"),r.setAttribute("defer","true"),r.addEventListener("load",(function(){n()})),document.body.appendChild(r)}else console.warn("View URL '".concat(e,"' not allowed to be included"))},t.prototype.checkWCUrl=function(t){return!0},t.prototype.renderWebComponent=function(t,e,n,o,r){var i=this,c=this.processViewUrl(t,{context:n}),s=o.webcomponent&&o.webcomponent.tagName?o.webcomponent.tagName:this.generateWCId(c),u=document.createElement("div");e.appendChild(u),e._luigi_node=o,window.customElements.get(s)?this.attachWC(s,u,e,n,c,r):window.luigiWCFn?window.luigiWCFn(c,s,u,(function(){i.attachWC(s,u,e,n,c,r)})):o.webcomponent&&o.webcomponent.selfRegistered?this.includeSelfRegisteredWCFromUrl(o,c,(function(){i.attachWC(s,u,e,n,c,r)})):this.registerWCFromUrl(c,s).then((function(){i.attachWC(s,u,e,n,c,r)}))},t.prototype.createCompoundContainerAsync=function(t,e){var n=this;return new Promise((function(o,r){if(t.viewUrl)try{var i=n.generateWCId(t.viewUrl);n.registerWCFromUrl(t.viewUrl,i).then((function(){var r=document.createElement(i);n.initWC(r,i,r,t.viewUrl,e,"_root"),o(r)}))}catch(t){r(t)}else o(t.createCompoundContainer())}))},t.prototype.renderWebComponentCompound=function(t,e,n){var o,r,i=this;return t.webcomponent&&t.viewUrl?((r=new H).viewUrl=this.processViewUrl(t.viewUrl,{context:n}),r.createCompoundItemContainer=function(t){var e=document.createElement("div");return t&&t.slot&&e.setAttribute("slot",t.slot),e}):(null===(o=t.compound)||void 0===o?void 0:o.renderer)&&(r=z(t.compound.renderer)),r=r||new H,new Promise((function(o){i.createCompoundContainerAsync(r,n).then((function(c){var s,u={};c.eventBus={listeners:u,onPublishEvent:function(t,e,n){var o=u[e+"."+t.type]||[];o.push.apply(o,u["*."+t.type]||[]),o.forEach((function(e){var n=e.wcElement||c.querySelector("[nodeId="+e.wcElementId+"]");n?n.dispatchEvent(new CustomEvent(e.action,{detail:e.converter?e.converter(t.detail):t.detail})):console.debug("Could not find event target",e)}))}},null===(s=t.compound)||void 0===s||s.children.forEach((function(t,e){var o=L(L({},n),t.context),s=r.createCompoundItemContainer(t.layoutConfig);s.eventBus=c.eventBus,r.attachCompoundItem(c,s);var a=t.id||"gen_"+e;i.renderWebComponent(t.viewUrl,s,o,t,a),V(u,t,a)})),e.appendChild(c),V(u,t.compound,"_root",c),o(c)}))}))},t}();function J(t){let e,n=!t[5](),o=n&&function(t){let e,n;return{c(){e=d("iframe"),u(e.src,n=t[0])||p(e,"src",n),p(e,"title",t[1])},m(n,o){a(n,e,o),t[8](e)},p(t,o){1&o&&!u(e.src,n=t[0])&&p(e,"src",n),2&o&&p(e,"title",t[1])},d(n){n&&l(e),t[8](null)}}}(t);return{c(){o&&o.c(),e=f()},m(t,n){o&&o.m(t,n),a(t,e,n)},p(t,e){n&&o.p(t,e)},d(t){o&&o.d(t),t&&l(e)}}}function Y(e){let n,o=!e[4]&&J(e);return{c(){n=d("main"),o&&o.c(),this.c=t,p(n,"class",e[5]()?void 0:"lui-isolated")},m(t,r){a(t,n,r),o&&o.m(n,null),e[9](n)},p(t,[e]){t[4]?o&&(o.d(1),o=null):o?o.p(t,e):(o=J(t),o.c(),o.m(n,null))},i:t,o:t,d(t){t&&l(n),o&&o.d(),e[9](null)}}}function K(t,e,n){let o,{viewurl:r}=e,{context:i}=e,{label:c}=e,{webcomponent:s}=e,u={};const a=new R,l=new G;l.createClientAPI=(t,e,n)=>({linkManager:()=>({navigate:t=>{p("navigation-request",{link:t})}}),uxManager:()=>({showAlert:t=>{p("alert-request",t)},showConfirmationModal:async t=>new Promise(((e,n)=>{p("confirmation-request",t,(t=>{t?e(t):n()}))}))}),getCurrentLocale:()=>{},publishEvent:t=>{}});const d=_();d.iframeHandle=u;let f=!!d.attributes["defer-init"];function p(t,e,n){a.dispatch(t,d,e,n)}function h(){return!!s}return d.init=()=>{n(4,f=!1)},a.registerContainer(d),T.onMount((async()=>{const t=i?JSON.parse(i):void 0;console.log(t),h()&&(n(3,o.innerHTML="",o),l.renderWebComponent(r,o,t,{}))})),T.onDestroy((async()=>{})),t.$$set=t=>{"viewurl"in t&&n(0,r=t.viewurl),"context"in t&&n(6,i=t.context),"label"in t&&n(1,c=t.label),"webcomponent"in t&&n(7,s=t.webcomponent)},[r,c,u,o,f,h,i,s,function(t){b[t?"unshift":"push"]((()=>{u.iframe=t,n(2,u)}))},function(t){b[t?"unshift":"push"]((()=>{o=t,n(3,o)}))}]}class Q extends j{constructor(t){super(),this.shadowRoot.innerHTML="<style>main,iframe{width:100%;height:100%;border:none}main.lui-isolated{line-height:0}</style>",M(this,{target:this.shadowRoot,props:h(this.attributes),customElement:!0},K,Y,i,{viewurl:0,context:6,label:1,webcomponent:7},null),t&&(t.target&&a(t.target,this,t.anchor),t.props&&(this.$set(t.props),E()))}static get observedAttributes(){return["viewurl","context","label","webcomponent"]}get viewurl(){return this.$$.ctx[0]}set viewurl(t){this.$$set({viewurl:t}),E()}get context(){return this.$$.ctx[6]}set context(t){this.$$set({context:t}),E()}get label(){return this.$$.ctx[1]}set label(t){this.$$set({label:t}),E()}get webcomponent(){return this.$$.ctx[7]}set webcomponent(t){this.$$set({webcomponent:t}),E()}}function X(e){let n;return{c(){n=d("main"),this.c=t},m(t,o){a(t,n,o),e[2](n)},p:t,i:t,o:t,d(t){t&&l(n),e[2](null)}}}function Z(t,e,n){let o,{context:r}=e,i=!1;const c=new R,s=new G;s.createClientAPI=(t,e,n)=>({linkManager:()=>{},uxManager:()=>({showAlert:t=>{a("alert-request",t)},showConfirmationModal:async t=>new Promise(((e,n)=>{a("confirmation-request",t,(t=>{t?e(t):n()}))}))}),getCurrentLocale:()=>{},publishEvent:o=>{console.log("pub",o),t&&t.eventBus&&t.eventBus.onPublishEvent(o,e,n)}});const u=_();function a(t,e,n){c.dispatch(t,u,e,n)}return u.attributes["defer-init"],u.init=()=>{if(!u.compoundConfig||i)return;console.log("init compound");const t={compound:u.compoundConfig};s.renderWebComponentCompound(t,o,r).then((t=>{})),i=!0},c.registerContainer(u),T.onMount((async()=>{const t=r?JSON.parse(r):void 0;console.log(t)})),t.$$set=t=>{"context"in t&&n(1,r=t.context)},[o,r,function(t){b[t?"unshift":"push"]((()=>{o=t,n(0,o)}))}]}class tt extends j{constructor(t){super(),this.shadowRoot.innerHTML="<style>main{width:100%;height:100%;border:none}</style>",M(this,{target:this.shadowRoot,props:h(this.attributes),customElement:!0},Z,X,i,{context:1},null),t&&(t.target&&a(t.target,this,t.anchor),t.props&&(this.$set(t.props),E()))}static get observedAttributes(){return["context"]}get context(){return this.$$.ctx[1]}set context(t){this.$$set({context:t}),E()}}export{tt as LuigiCompoundContainer,Q as LuigiContainer}; | ||
//# sourceMappingURL=bundle.js.map |
@@ -6,2 +6,3 @@ { | ||
"main": "bundle.js", | ||
"types": "public/bundle.d.ts", | ||
"repository": { | ||
@@ -22,3 +23,3 @@ "type": "git", | ||
], | ||
"version": "0.0.1" | ||
"version": "0.0.3" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
367665
6
1
4
1153
1