Files
IoTManager/data_svelte/build/bundle.js

6457 lines
265 KiB
JavaScript
Raw Normal View History

(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);
var app = (function () {
'use strict';
function noop() { }
function assign(tar, src) {
// @ts-ignore
for (const k in src)
tar[k] = src[k];
return tar;
}
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');
}
function is_empty(obj) {
return Object.keys(obj).length === 0;
}
function validate_store(store, name) {
if (store != null && typeof store.subscribe !== 'function') {
throw new Error(`'${name}' is not a store with a 'subscribe' method`);
}
}
function subscribe(store, ...callbacks) {
if (store == null) {
return noop;
}
const unsub = store.subscribe(...callbacks);
return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
}
function component_subscribe(component, store, callback) {
component.$$.on_destroy.push(subscribe(store, callback));
}
function create_slot(definition, ctx, $$scope, fn) {
if (definition) {
const slot_ctx = get_slot_context(definition, ctx, $$scope, fn);
return definition[0](slot_ctx);
}
}
function get_slot_context(definition, ctx, $$scope, fn) {
return definition[1] && fn
? assign($$scope.ctx.slice(), definition[1](fn(ctx)))
: $$scope.ctx;
}
function get_slot_changes(definition, $$scope, dirty, fn) {
if (definition[2] && fn) {
const lets = definition[2](fn(dirty));
if ($$scope.dirty === undefined) {
return lets;
}
if (typeof lets === 'object') {
const merged = [];
const len = Math.max($$scope.dirty.length, lets.length);
for (let i = 0; i < len; i += 1) {
merged[i] = $$scope.dirty[i] | lets[i];
}
return merged;
}
return $$scope.dirty | lets;
}
return $$scope.dirty;
}
function update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn) {
if (slot_changes) {
const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);
slot.p(slot_context, slot_changes);
}
}
function get_all_dirty_from_scope($$scope) {
if ($$scope.ctx.length > 32) {
const dirty = [];
const length = $$scope.ctx.length / 32;
for (let i = 0; i < length; i++) {
dirty[i] = -1;
}
return dirty;
}
return -1;
}
function append(target, node) {
target.appendChild(node);
}
function insert(target, node, anchor) {
target.insertBefore(node, anchor || null);
}
function detach(node) {
node.parentNode.removeChild(node);
}
function destroy_each(iterations, detaching) {
for (let i = 0; i < iterations.length; i += 1) {
if (iterations[i])
iterations[i].d(detaching);
}
}
function element(name) {
return document.createElement(name);
}
function svg_element(name) {
return document.createElementNS('http://www.w3.org/2000/svg', name);
}
function text(data) {
return document.createTextNode(data);
}
function space() {
return text(' ');
}
function empty() {
return text('');
}
function listen(node, event, handler, options) {
node.addEventListener(event, handler, options);
return () => node.removeEventListener(event, handler, options);
}
function attr(node, attribute, value) {
if (value == null)
node.removeAttribute(attribute);
else if (node.getAttribute(attribute) !== value)
node.setAttribute(attribute, value);
}
function to_number(value) {
return value === '' ? null : +value;
}
function children(element) {
return Array.from(element.childNodes);
}
function set_input_value(input, value) {
input.value = value == null ? '' : value;
}
function select_option(select, value) {
for (let i = 0; i < select.options.length; i += 1) {
const option = select.options[i];
if (option.__value === value) {
option.selected = true;
return;
}
}
select.selectedIndex = -1; // no option should be selected
}
function select_value(select) {
const selected_option = select.querySelector(':checked') || select.options[0];
return selected_option && selected_option.__value;
}
function custom_event(type, detail, bubbles = false) {
const e = document.createEvent('CustomEvent');
e.initCustomEvent(type, bubbles, false, detail);
return e;
}
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);
}
function setContext(key, context) {
get_current_component().$$.context.set(key, context);
}
function getContext(key) {
return get_current_component().$$.context.get(key);
}
// TODO figure out if we still want to support
// shorthand events, or if we want to implement
// a real bubbling mechanism
function bubble(component, event) {
const callbacks = component.$$.callbacks[event.type];
if (callbacks) {
// @ts-ignore
callbacks.slice().forEach(fn => fn.call(this, event));
}
}
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 tick() {
schedule_update();
return resolved_promise;
}
function add_render_callback(fn) {
render_callbacks.push(fn);
}
function add_flush_callback(fn) {
flush_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();
let outros;
function group_outros() {
outros = {
r: 0,
c: [],
p: outros // parent group
};
}
function check_outros() {
if (!outros.r) {
run_all(outros.c);
}
outros = outros.p;
}
function transition_in(block, local) {
if (block && block.i) {
outroing.delete(block);
block.i(local);
}
}
function transition_out(block, local, detach, callback) {
if (block && block.o) {
if (outroing.has(block))
return;
outroing.add(block);
outros.c.push(() => {
outroing.delete(block);
if (callback) {
if (detach)
block.d(1);
callback();
}
});
block.o(local);
}
}
const globals = (typeof window !== 'undefined'
? window
: typeof globalThis !== 'undefined'
? globalThis
: global);
function bind(component, name, callback) {
const index = component.$$.props[name];
if (index !== undefined) {
component.$$.bound[index] = callback;
callback(component.$$.ctx[index]);
}
}
function create_component(block) {
block && block.c();
}
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);
}
/**
* Base class for Svelte components. Used when dev=false.
*/
class SvelteComponent {
$destroy() {
destroy_component(this, 1);
this.$destroy = noop;
}
$on(type, callback) {
const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));
callbacks.push(callback);
return () => {
const index = callbacks.indexOf(callback);
if (index !== -1)
callbacks.splice(index, 1);
};
}
$set($$props) {
if (this.$$set && !is_empty($$props)) {
this.$$.skip_bound = true;
this.$$set($$props);
this.$$.skip_bound = false;
}
}
}
function dispatch_dev(type, detail) {
document.dispatchEvent(custom_event(type, Object.assign({ version: '3.44.3' }, detail), true));
}
function append_dev(target, node) {
dispatch_dev('SvelteDOMInsert', { target, node });
append(target, node);
}
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 listen_dev(node, event, handler, options, has_prevent_default, has_stop_propagation) {
const modifiers = options === true ? ['capture'] : options ? Array.from(Object.keys(options)) : [];
if (has_prevent_default)
modifiers.push('preventDefault');
if (has_stop_propagation)
modifiers.push('stopPropagation');
dispatch_dev('SvelteDOMAddEventListener', { node, event, handler, modifiers });
const dispose = listen(node, event, handler, options);
return () => {
dispatch_dev('SvelteDOMRemoveEventListener', { node, event, handler, modifiers });
dispose();
};
}
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 prop_dev(node, property, value) {
node[property] = value;
dispatch_dev('SvelteDOMSetProperty', { node, property, value });
}
function set_data_dev(text, data) {
data = '' + data;
if (text.wholeText === data)
return;
dispatch_dev('SvelteDOMSetData', { node: text, data });
text.data = data;
}
function validate_each_argument(arg) {
if (typeof arg !== 'string' && !(arg && typeof arg === 'object' && 'length' in arg)) {
let msg = '{#each} only iterates over array-like objects.';
if (typeof Symbol === 'function' && arg && Symbol.iterator in arg) {
msg += ' You can use a spread to convert this iterable into an array.';
}
throw new Error(msg);
}
}
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}".`);
}
}
}
/**
* Base class for Svelte components with some minor dev-enhancements. Used when dev=true.
*/
class SvelteComponentDev extends SvelteComponent {
constructor(options) {
if (!options || (!options.target && !options.$$inline)) {
throw new Error("'target' is a required option");
}
super();
}
$destroy() {
super.$destroy();
this.$destroy = () => {
console.warn('Component was already destroyed'); // eslint-disable-line no-console
};
}
$capture_state() { }
$inject_state() { }
}
const subscriber_queue = [];
/**
* Create a `Writable` store that allows both updating and reading by subscription.
* @param {*=}value initial value
* @param {StartStopNotifier=}start start and stop notifications for subscriptions
*/
function writable(value, start = noop) {
let stop;
const subscribers = new Set();
function set(new_value) {
if (safe_not_equal(value, new_value)) {
value = new_value;
if (stop) { // store is ready
const run_queue = !subscriber_queue.length;
for (const subscriber of subscribers) {
subscriber[1]();
subscriber_queue.push(subscriber, value);
}
if (run_queue) {
for (let i = 0; i < subscriber_queue.length; i += 2) {
subscriber_queue[i][0](subscriber_queue[i + 1]);
}
subscriber_queue.length = 0;
}
}
}
}
function update(fn) {
set(fn(value));
}
function subscribe(run, invalidate = noop) {
const subscriber = [run, invalidate];
subscribers.add(subscriber);
if (subscribers.size === 1) {
stop = start(set) || noop;
}
run(value);
return () => {
subscribers.delete(subscriber);
if (subscribers.size === 0) {
stop();
stop = null;
}
};
}
return { set, update, subscribe };
}
function d(e,n=!1){return e=e.slice(e.startsWith("/#")?2:0,e.endsWith("/*")?-2:void 0),e.startsWith("/")||(e="/"+e),e==="/"&&(e=""),n&&!e.endsWith("/")&&(e+="/"),e}function b(e,n){e=d(e,!0),n=d(n,!0);let a=[],r={},t=!0,o=e.split("/").map(i=>i.startsWith(":")?(a.push(i.slice(1)),"([^\\/]+)"):i).join("\\/"),c=n.match(new RegExp(`^${o}$`));return c||(t=!1,c=n.match(new RegExp(`^${o}`))),c?(a.forEach((i,w)=>r[i]=c[w+1]),{exact:t,params:r,part:c[0].slice(0,-1)}):null}function x(e,n,a){if(a==="")return e;if(a[0]==="/")return a;let r=c=>c.split("/").filter(i=>i!==""),t=r(e),o=n?r(n):[];return "/"+o.map((c,i)=>t[i]).join("/")+"/"+a}function h(e,n,a,r){let t=[n,"data-"+n].reduce((o,c)=>{let i=e.getAttribute(c);return a&&e.removeAttribute(c),i===null?o:i},!1);return !r&&t===""?!0:t||r||!1}function v(e){let n=e.split("&").map(a=>a.split("=")).reduce((a,r)=>{let t=r[0];if(!t)return a;let o=r.length>1?r[r.length-1]:!0;return typeof o=="string"&&o.includes(",")&&(o=o.split(",")),a[t]===void 0?a[t]=[o]:a[t].push(o),a},{});return Object.entries(n).reduce((a,r)=>(a[r[0]]=r[1].length>1?r[1]:r[1][0],a),{})}function S(e){throw new Error("[Tinro] "+e)}var k=1,y=2,M=3,j=4;function C(e,n,a,r){return e===k?n&&n():e===y?a&&a():r&&r()}function W(){return !window||window.location.pathname==="srcdoc"?M:k}var s={HISTORY:k,HASH:y,MEMORY:M,OFF:j,run:C,getDeafault:W};var O,R,l=z();function z(){let e=s.getDeafault(),n,a=o=>window.onhashchange=window.onpopstate=R=null,r=o=>n&&n(_(e));function t(o){o&&(e=o),a(),e!==s.OFF&&s.run(e,c=>window.onpopstate=r,c=>window.onhashchange=r)&&r();}return {mode:o=>t(o),get:o=>_(e),go(o,c){D(e,o,c),r();},start(o){n=o,t();},stop(){n=null,t(s.OFF);}}}function D(e,n,a){let r=t=>history[a?"replaceState":"pushState"]({},"",t);s.run(e,t=>r(n),t=>r(`#${n}`),t=>R=n);}function _(e){let n=O,a=O=s.run(e,t=>window.location.pathname+window.location.search,t=>String(window.location.hash.slice(1)||"/"),t=>R||"/"),r=a.match(/^([^?#]+)(?:\?([^#]+))?(?:\#(.+))?$/);return {url:a,from:n,path:r[1]||"",query:v(r[2]||""),hash:r[3]||""}}function $(e){let n=getContext("tinro");n&&(n.exact||n.fallback)&&S(`${e.fallback?"<Route fallback>":`<Route path="${e.path}">`} can't be inside ${n.fallback?"<Route fallback>":`<Route path="${n.path||"/"}"> with exact path`}`);let a=e.fallback?"fallbacks":"childs",r=writable({}),t={router:{},exact:!1,pattern:null,meta:{},parent:n,fallback:e.fallback,redirect:!1,firstmatch:!1,breadcrumb:null,matched:!1,childs:new Set,activeChilds:new Set,fallbacks:new Set,update(o){t.exact=!o.path.endsWith("/*"),t.pattern=d(`${t.parent&&t.parent.pattern||""}${o.path}`),t.redirect=o.redirect,t.firstmatch=o.firstmatch,t.breadcrumb=o.breadcrumb,t.match();},register:()=>{if(!!t.parent)return t.parent[a].add(t),()=>{t.parent[a].delete(t),t.router.un&&t.router.un();}},show:()=>{e.onShow(),!t.fallback&&t.parent&&t.parent.activeChilds.add(t);},hide:()=>{e.onHide(),!t.fallback&&t.parent&&t.parent.activeChilds.delete(t);},match:async()=>{t.matched=!1;let{path:o,url:c,from:i,query:w}=t.router,u=b(t.pattern,o);if(!t.fallback&&u&&t.redirect&&(!t.exact||t.exact&&u.exact)){await tick();let m=x(o,t.parent&&t.parent.pattern,t.redirect);return f.goto(m,!0)}if(t.meta=u&&{from:i,url:c,query:w,match:u.part,pattern:t.pattern,breadcrumbs:t.parent&&t.parent.meta&&t.parent.meta.breadcrumbs.slice()||[],params:u.params,subscribe:r.subscribe},t.breadcrumb&&t.meta&&t.meta.breadcrumbs.push({name:t.breadcrumb,path:u.part}),r.set(t.meta),u&&!t.fallback&&(!t.exact||t.exact&&u.exact)&&(!t.parent||!t.parent.firstmatch||!t.parent.matched)?(e.onMeta(t.meta),t.parent&&(t.parent.matched=!0),t.show()):t.hide(),await tick(),u&&!t.fallback&&(t.childs.size>0&&t.activeChilds.size==0||t.childs.size==0&&t.fallbacks.size>0)){let m=t;for(;m.fallbacks.size==0;)if(m=m.parent,!m)return;m&&m.fallbacks.forEach(p=>{if(p.redirect){let H=x("/",p.parent&&p.parent.pattern,p.redirect);f.goto(H,!0);}else p.show();});}}};return setContext("tinro",t),onMount(()=>t.register()),t.router.un=f.subscribe(o=>{t.router.path=o.path,t.router.url=o.url,t.router.query=o.query,t.router.from=o.fr
/* node_modules\tinro\cmp\Route.svelte generated by Svelte v3.44.3 */
const get_default_slot_changes = dirty => ({
params: dirty & /*params*/ 2,
meta: dirty & /*meta*/ 4
});
const get_default_slot_context = ctx => ({
params: /*params*/ ctx[1],
meta: /*meta*/ ctx[2]
});
// (32:0) {#if showContent}
function create_if_block$4(ctx) {
let current;
const default_slot_template = /*#slots*/ ctx[9].default;
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[8], get_default_slot_context);
const block = {
c: function create() {
if (default_slot) default_slot.c();
},
m: function mount(target, anchor) {
if (default_slot) {
default_slot.m(target, anchor);
}
current = true;
},
p: function update(ctx, dirty) {
if (default_slot) {
if (default_slot.p && (!current || dirty & /*$$scope, params, meta*/ 262)) {
update_slot_base(
default_slot,
default_slot_template,
ctx,
/*$$scope*/ ctx[8],
!current
? get_all_dirty_from_scope(/*$$scope*/ ctx[8])
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[8], dirty, get_default_slot_changes),
get_default_slot_context
);
}
}
},
i: function intro(local) {
if (current) return;
transition_in(default_slot, local);
current = true;
},
o: function outro(local) {
transition_out(default_slot, local);
current = false;
},
d: function destroy(detaching) {
if (default_slot) default_slot.d(detaching);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_if_block$4.name,
type: "if",
source: "(32:0) {#if showContent}",
ctx
});
return block;
}
function create_fragment$7(ctx) {
let if_block_anchor;
let current;
let if_block = /*showContent*/ ctx[0] && create_if_block$4(ctx);
const block = {
c: function create() {
if (if_block) if_block.c();
if_block_anchor = empty();
},
l: function claim(nodes) {
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
},
m: function mount(target, anchor) {
if (if_block) if_block.m(target, anchor);
insert_dev(target, if_block_anchor, anchor);
current = true;
},
p: function update(ctx, [dirty]) {
if (/*showContent*/ ctx[0]) {
if (if_block) {
if_block.p(ctx, dirty);
if (dirty & /*showContent*/ 1) {
transition_in(if_block, 1);
}
} else {
if_block = create_if_block$4(ctx);
if_block.c();
transition_in(if_block, 1);
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
group_outros();
transition_out(if_block, 1, 1, () => {
if_block = null;
});
check_outros();
}
},
i: function intro(local) {
if (current) return;
transition_in(if_block);
current = true;
},
o: function outro(local) {
transition_out(if_block);
current = false;
},
d: function destroy(detaching) {
if (if_block) if_block.d(detaching);
if (detaching) detach_dev(if_block_anchor);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_fragment$7.name,
type: "component",
source: "",
ctx
});
return block;
}
function instance$7($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
validate_slots('Route', slots, ['default']);
let { path = '/*' } = $$props;
let { fallback = false } = $$props;
let { redirect = false } = $$props;
let { firstmatch = false } = $$props;
let { breadcrumb = null } = $$props;
let showContent = false;
let params = {}; /* DEPRECATED */
let meta = {};
const route = $({
fallback,
onShow() {
$$invalidate(0, showContent = true);
},
onHide() {
$$invalidate(0, showContent = false);
},
onMeta(newmeta) {
$$invalidate(2, meta = newmeta);
$$invalidate(1, params = meta.params); /* DEPRECATED */
}
});
const writable_props = ['path', 'fallback', 'redirect', 'firstmatch', 'breadcrumb'];
Object.keys($$props).forEach(key => {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Route> was created with unknown prop '${key}'`);
});
$$self.$$set = $$props => {
if ('path' in $$props) $$invalidate(3, path = $$props.path);
if ('fallback' in $$props) $$invalidate(4, fallback = $$props.fallback);
if ('redirect' in $$props) $$invalidate(5, redirect = $$props.redirect);
if ('firstmatch' in $$props) $$invalidate(6, firstmatch = $$props.firstmatch);
if ('breadcrumb' in $$props) $$invalidate(7, breadcrumb = $$props.breadcrumb);
if ('$$scope' in $$props) $$invalidate(8, $$scope = $$props.$$scope);
};
$$self.$capture_state = () => ({
createRouteObject: $,
path,
fallback,
redirect,
firstmatch,
breadcrumb,
showContent,
params,
meta,
route
});
$$self.$inject_state = $$props => {
if ('path' in $$props) $$invalidate(3, path = $$props.path);
if ('fallback' in $$props) $$invalidate(4, fallback = $$props.fallback);
if ('redirect' in $$props) $$invalidate(5, redirect = $$props.redirect);
if ('firstmatch' in $$props) $$invalidate(6, firstmatch = $$props.firstmatch);
if ('breadcrumb' in $$props) $$invalidate(7, breadcrumb = $$props.breadcrumb);
if ('showContent' in $$props) $$invalidate(0, showContent = $$props.showContent);
if ('params' in $$props) $$invalidate(1, params = $$props.params);
if ('meta' in $$props) $$invalidate(2, meta = $$props.meta);
};
if ($$props && "$$inject" in $$props) {
$$self.$inject_state($$props.$$inject);
}
$$self.$$.update = () => {
if ($$self.$$.dirty & /*path, redirect, firstmatch, breadcrumb*/ 232) {
route.update({ path, redirect, firstmatch, breadcrumb });
}
};
return [
showContent,
params,
meta,
path,
fallback,
redirect,
firstmatch,
breadcrumb,
$$scope,
slots
];
}
class Route extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$7, create_fragment$7, safe_not_equal, {
path: 3,
fallback: 4,
redirect: 5,
firstmatch: 6,
breadcrumb: 7
});
dispatch_dev("SvelteRegisterComponent", {
component: this,
tagName: "Route",
options,
id: create_fragment$7.name
});
}
get path() {
throw new Error("<Route>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set path(value) {
throw new Error("<Route>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get fallback() {
throw new Error("<Route>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set fallback(value) {
throw new Error("<Route>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get redirect() {
throw new Error("<Route>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set redirect(value) {
throw new Error("<Route>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get firstmatch() {
throw new Error("<Route>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set firstmatch(value) {
throw new Error("<Route>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get breadcrumb() {
throw new Error("<Route>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set breadcrumb(value) {
throw new Error("<Route>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function createCommonjsModule(fn) {
var module = { exports: {} };
return fn(module, module.exports), module.exports;
}
var frappeCharts_min_umd = createCommonjsModule(function (module, exports) {
!function(t,e){module.exports=e();}(commonjsGlobal,function(){function t(t,e){return "string"==typeof t?(e||document).querySelector(t):t||null}function e(t){var e=t.getBoundingClientRect();return {top:e.top+(document.documentElement.scrollTop||document.body.scrollTop),left:e.left+(document.documentElement.scrollLeft||document.body.scrollLeft)}}function i(t){return null===t.offsetParent}function n(t){var e=t.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}function a(t){var e=window.getComputedStyle(t),i=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight);return t.clientWidth-i}function s(t,e,i){var n=document.createEvent("HTMLEvents");n.initEvent(e,!0,!0);for(var a in i)n[a]=i[a];return t.dispatchEvent(n)}function r(t){return t.titleHeight+t.margins.top+t.paddings.top}function o(t){return t.margins.left+t.paddings.left}function l(t){return t.margins.top+t.margins.bottom+t.paddings.top+t.paddings.bottom+t.titleHeight+t.legendHeight}function u(t){return t.margins.left+t.margins.right+t.paddings.left+t.paddings.right}function h(t){return parseFloat(t.toFixed(2))}function c(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];i||(i=n?t[0]:t[t.length-1]);var a=new Array(Math.abs(e)).fill(i);return t=n?a.concat(t):t.concat(a)}function d(t,e){return (t+"").length*e}function p(t,e){return {x:Math.sin(t*Zt)*e,y:Math.cos(t*Zt)*e}}function f(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return !Number.isNaN(t)&&(void 0!==t&&(!!Number.isFinite(t)&&!(e&&t<0)))}function v(t){return Number(Math.round(t+"e4")+"e-4")}function g(t){var e=void 0,i=void 0,n=void 0;if(t instanceof Date)return new Date(t.getTime());if("object"!==(void 0===t?"undefined":Ft(t))||null===t)return t;e=Array.isArray(t)?[]:{};for(n in t)i=t[n],e[n]=g(i);return e}function m(t,e){var i=void 0,n=void 0;return t<=e?(i=e-t,n=t):(i=t-e,n=e),[i,n]}function y(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length-t.length;return i>0?t=c(t,i):e=c(e,i),[t,e]}function b(t,e){if(t)return t.length>e?t.slice(0,e-3)+"...":t}function x(t){var e=void 0;if("number"==typeof t)e=t;else if("string"==typeof t&&(e=Number(t),Number.isNaN(e)))return t;var i=Math.floor(Math.log10(Math.abs(e)));if(i<=2)return e;var n=Math.floor(i/3),a=Math.pow(10,i-3*n)*+(e/Math.pow(10,i)).toFixed(1);return Math.round(100*a)/100+" "+["","K","M","B","T"][n]}function k(t,e){for(var i=[],n=0;n<t.length;n++)i.push([t[n],e[n]]);var a=function(t,e){var i=e[0]-t[0],n=e[1]-t[1];return {length:Math.sqrt(Math.pow(i,2)+Math.pow(n,2)),angle:Math.atan2(n,i)}},s=function(t,e,i,n){var s=a(e||t,i||t),r=s.angle+(n?Math.PI:0),o=.2*s.length;return [t[0]+Math.cos(r)*o,t[1]+Math.sin(r)*o]};return function(t,e){return t.reduce(function(t,i,n,a){return 0===n?i[0]+","+i[1]:t+" "+e(i,n,a)},"")}(i,function(t,e,i){var n=s(i[e-1],i[e-2],t),a=s(t,i[e-1],i[e+1],!0);return "C "+n[0]+","+n[1]+" "+a[0]+","+a[1]+" "+t[0]+","+t[1]})}function w(t){return t>255?255:t<0?0:t}function A(t,e){var i=ie(t),n=!1;"#"==i[0]&&(i=i.slice(1),n=!0);var a=parseInt(i,16),s=w((a>>16)+e),r=w((a>>8&255)+e),o=w((255&a)+e);return (n?"#":"")+(o|r<<8|s<<16).toString(16)}function P(t){var e=/(^\s*)(rgb|hsl)(a?)[(]\s*([\d.]+\s*%?)\s*,\s*([\d.]+\s*%?)\s*,\s*([\d.]+\s*%?)\s*(?:,\s*([\d.]+)\s*)?[)]$/i;return /(^\s*)(#)((?:[A-Fa-f0-9]{3}){1,2})$/i.test(t)||e.test(t)}function T(t,e){return "string"==typeof t?(e||document).querySelector(t):t||null}function L(t,e){var i=document.createElementNS("http://www.w3.org/2000/svg",t);for(var n in e){var a=e[n];if("inside"===n)T(a).appendChild(i);else if("around"===n){var s=T(a);s.parentNode.insertBefore(i,s),i.appendChild(s);}else "styles"===n?"object"===(void 0===a?"undefined":Ft(a))&&Object.keys(a).map(function(t){i.style[t]=a[t];}):("className"===n&&(n="class"),"innerHTML"===n?i.textContent=a:i.setAttribute(n,a));}return i}function O(t,e){return L("linearGradient",{inside:t,id:e,x1:0,x2:0,y1:0,y2:1})}function M(t,e,i,n){return L("st
});
/* node_modules\svelte-frappe-charts\src\components\base.svelte generated by Svelte v3.44.3 */
const file$6 = "node_modules\\svelte-frappe-charts\\src\\components\\base.svelte";
function create_fragment$6(ctx) {
let div;
let mounted;
let dispose;
const block = {
c: function create() {
div = element("div");
add_location(div, file$6, 89, 0, 2072);
},
l: function claim(nodes) {
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
/*div_binding*/ ctx[18](div);
if (!mounted) {
dispose = listen_dev(div, "data-select", /*data_select_handler*/ ctx[17], false, false, false);
mounted = true;
}
},
p: noop,
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) detach_dev(div);
/*div_binding*/ ctx[18](null);
mounted = false;
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_fragment$6.name,
type: "component",
source: "",
ctx
});
return block;
}
function instance$6($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
validate_slots('Base', slots, []);
let { data = {
labels: [],
datasets: [{ values: [] }],
yMarkers: {},
yRegions: []
} } = $$props;
let { title = '' } = $$props;
let { type = 'line' } = $$props;
let { height = 300 } = $$props;
let { animate = true } = $$props;
let { axisOptions = {} } = $$props;
let { barOptions = {} } = $$props;
let { lineOptions = {} } = $$props;
let { tooltipOptions = {} } = $$props;
let { colors = [] } = $$props;
let { valuesOverPoints = 0 } = $$props;
let { isNavigable = false } = $$props;
let { maxSlices = 3 } = $$props;
/**
* COMPONENT
*/
// The Chart returned from frappe
let chart = null;
// DOM node for frappe to latch onto
let chartRef;
// Helper HOF for calling a fn only if chart exists
function ifChartThen(fn) {
return function ifChart(...args) {
if (chart) {
return fn(...args);
}
};
}
const addDataPoint = ifChartThen((label, valueFromEachDataset, index) => chart.addDataPoint(label, valueFromEachDataset, index));
const removeDataPoint = ifChartThen(index => chart.removeDataPoint(index));
const exportChart = ifChartThen(() => chart.export());
// Update the chart when incoming data changes
const updateChart = ifChartThen(newData => chart.update(newData));
/**
* Handle initializing the chart when this Svelte component mounts
*/
onMount(() => {
chart = new frappeCharts_min_umd.Chart(chartRef,
{
data,
title,
type,
height,
animate,
colors,
axisOptions,
barOptions,
lineOptions,
tooltipOptions,
valuesOverPoints,
isNavigable,
maxSlices
});
});
// Mark Chart references for garbage collection when component is unmounted
onDestroy(() => {
chart = null;
});
const writable_props = [
'data',
'title',
'type',
'height',
'animate',
'axisOptions',
'barOptions',
'lineOptions',
'tooltipOptions',
'colors',
'valuesOverPoints',
'isNavigable',
'maxSlices'
];
Object.keys($$props).forEach(key => {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Base> was created with unknown prop '${key}'`);
});
function data_select_handler(event) {
bubble.call(this, $$self, event);
}
function div_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
chartRef = $$value;
$$invalidate(0, chartRef);
});
}
$$self.$$set = $$props => {
if ('data' in $$props) $$invalidate(1, data = $$props.data);
if ('title' in $$props) $$invalidate(2, title = $$props.title);
if ('type' in $$props) $$invalidate(3, type = $$props.type);
if ('height' in $$props) $$invalidate(4, height = $$props.height);
if ('animate' in $$props) $$invalidate(5, animate = $$props.animate);
if ('axisOptions' in $$props) $$invalidate(6, axisOptions = $$props.axisOptions);
if ('barOptions' in $$props) $$invalidate(7, barOptions = $$props.barOptions);
if ('lineOptions' in $$props) $$invalidate(8, lineOptions = $$props.lineOptions);
if ('tooltipOptions' in $$props) $$invalidate(9, tooltipOptions = $$props.tooltipOptions);
if ('colors' in $$props) $$invalidate(10, colors = $$props.colors);
if ('valuesOverPoints' in $$props) $$invalidate(11, valuesOverPoints = $$props.valuesOverPoints);
if ('isNavigable' in $$props) $$invalidate(12, isNavigable = $$props.isNavigable);
if ('maxSlices' in $$props) $$invalidate(13, maxSlices = $$props.maxSlices);
};
$$self.$capture_state = () => ({
onMount,
onDestroy,
Chart: frappeCharts_min_umd.Chart,
data,
title,
type,
height,
animate,
axisOptions,
barOptions,
lineOptions,
tooltipOptions,
colors,
valuesOverPoints,
isNavigable,
maxSlices,
chart,
chartRef,
ifChartThen,
addDataPoint,
removeDataPoint,
exportChart,
updateChart
});
$$self.$inject_state = $$props => {
if ('data' in $$props) $$invalidate(1, data = $$props.data);
if ('title' in $$props) $$invalidate(2, title = $$props.title);
if ('type' in $$props) $$invalidate(3, type = $$props.type);
if ('height' in $$props) $$invalidate(4, height = $$props.height);
if ('animate' in $$props) $$invalidate(5, animate = $$props.animate);
if ('axisOptions' in $$props) $$invalidate(6, axisOptions = $$props.axisOptions);
if ('barOptions' in $$props) $$invalidate(7, barOptions = $$props.barOptions);
if ('lineOptions' in $$props) $$invalidate(8, lineOptions = $$props.lineOptions);
if ('tooltipOptions' in $$props) $$invalidate(9, tooltipOptions = $$props.tooltipOptions);
if ('colors' in $$props) $$invalidate(10, colors = $$props.colors);
if ('valuesOverPoints' in $$props) $$invalidate(11, valuesOverPoints = $$props.valuesOverPoints);
if ('isNavigable' in $$props) $$invalidate(12, isNavigable = $$props.isNavigable);
if ('maxSlices' in $$props) $$invalidate(13, maxSlices = $$props.maxSlices);
if ('chart' in $$props) chart = $$props.chart;
if ('chartRef' in $$props) $$invalidate(0, chartRef = $$props.chartRef);
};
if ($$props && "$$inject" in $$props) {
$$self.$inject_state($$props.$$inject);
}
$$self.$$.update = () => {
if ($$self.$$.dirty & /*data*/ 2) {
updateChart(data);
}
};
return [
chartRef,
data,
title,
type,
height,
animate,
axisOptions,
barOptions,
lineOptions,
tooltipOptions,
colors,
valuesOverPoints,
isNavigable,
maxSlices,
addDataPoint,
removeDataPoint,
exportChart,
data_select_handler,
div_binding
];
}
class Base extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$6, create_fragment$6, safe_not_equal, {
data: 1,
title: 2,
type: 3,
height: 4,
animate: 5,
axisOptions: 6,
barOptions: 7,
lineOptions: 8,
tooltipOptions: 9,
colors: 10,
valuesOverPoints: 11,
isNavigable: 12,
maxSlices: 13,
addDataPoint: 14,
removeDataPoint: 15,
exportChart: 16
});
dispatch_dev("SvelteRegisterComponent", {
component: this,
tagName: "Base",
options,
id: create_fragment$6.name
});
}
get data() {
throw new Error("<Base>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set data(value) {
throw new Error("<Base>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get title() {
throw new Error("<Base>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set title(value) {
throw new Error("<Base>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get type() {
throw new Error("<Base>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set type(value) {
throw new Error("<Base>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get height() {
throw new Error("<Base>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set height(value) {
throw new Error("<Base>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get animate() {
throw new Error("<Base>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set animate(value) {
throw new Error("<Base>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get axisOptions() {
throw new Error("<Base>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set axisOptions(value) {
throw new Error("<Base>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get barOptions() {
throw new Error("<Base>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set barOptions(value) {
throw new Error("<Base>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get lineOptions() {
throw new Error("<Base>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set lineOptions(value) {
throw new Error("<Base>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get tooltipOptions() {
throw new Error("<Base>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set tooltipOptions(value) {
throw new Error("<Base>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get colors() {
throw new Error("<Base>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set colors(value) {
throw new Error("<Base>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get valuesOverPoints() {
throw new Error("<Base>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set valuesOverPoints(value) {
throw new Error("<Base>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get isNavigable() {
throw new Error("<Base>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set isNavigable(value) {
throw new Error("<Base>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get maxSlices() {
throw new Error("<Base>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set maxSlices(value) {
throw new Error("<Base>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get addDataPoint() {
return this.$$.ctx[14];
}
set addDataPoint(value) {
throw new Error("<Base>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get removeDataPoint() {
return this.$$.ctx[15];
}
set removeDataPoint(value) {
throw new Error("<Base>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get exportChart() {
return this.$$.ctx[16];
}
set exportChart(value) {
throw new Error("<Base>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
var Base$1 = Base;
/* src\components\Card.svelte generated by Svelte v3.44.3 */
const file$5 = "src\\components\\Card.svelte";
// (6:2) {#if title}
function create_if_block$3(ctx) {
let h1;
let t;
const block = {
c: function create() {
h1 = element("h1");
t = text(/*title*/ ctx[0]);
attr_dev(h1, "class", "crd-hdr");
add_location(h1, file$5, 6, 4, 82);
},
m: function mount(target, anchor) {
insert_dev(target, h1, anchor);
append_dev(h1, t);
},
p: function update(ctx, dirty) {
if (dirty & /*title*/ 1) set_data_dev(t, /*title*/ ctx[0]);
},
d: function destroy(detaching) {
if (detaching) detach_dev(h1);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_if_block$3.name,
type: "if",
source: "(6:2) {#if title}",
ctx
});
return block;
}
function create_fragment$5(ctx) {
let div;
let t;
let current;
let if_block = /*title*/ ctx[0] && create_if_block$3(ctx);
const default_slot_template = /*#slots*/ ctx[2].default;
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[1], null);
const block = {
c: function create() {
div = element("div");
if (if_block) if_block.c();
t = space();
if (default_slot) default_slot.c();
attr_dev(div, "class", "crd");
add_location(div, file$5, 4, 0, 44);
},
l: function claim(nodes) {
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
if (if_block) if_block.m(div, null);
append_dev(div, t);
if (default_slot) {
default_slot.m(div, null);
}
current = true;
},
p: function update(ctx, [dirty]) {
if (/*title*/ ctx[0]) {
if (if_block) {
if_block.p(ctx, dirty);
} else {
if_block = create_if_block$3(ctx);
if_block.c();
if_block.m(div, t);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
if (default_slot) {
if (default_slot.p && (!current || dirty & /*$$scope*/ 2)) {
update_slot_base(
default_slot,
default_slot_template,
ctx,
/*$$scope*/ ctx[1],
!current
? get_all_dirty_from_scope(/*$$scope*/ ctx[1])
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[1], dirty, null),
null
);
}
}
},
i: function intro(local) {
if (current) return;
transition_in(default_slot, local);
current = true;
},
o: function outro(local) {
transition_out(default_slot, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) detach_dev(div);
if (if_block) if_block.d();
if (default_slot) default_slot.d(detaching);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_fragment$5.name,
type: "component",
source: "",
ctx
});
return block;
}
function instance$5($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
validate_slots('Card', slots, ['default']);
let { title } = $$props;
const writable_props = ['title'];
Object.keys($$props).forEach(key => {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Card> was created with unknown prop '${key}'`);
});
$$self.$$set = $$props => {
if ('title' in $$props) $$invalidate(0, title = $$props.title);
if ('$$scope' in $$props) $$invalidate(1, $$scope = $$props.$$scope);
};
$$self.$capture_state = () => ({ title });
$$self.$inject_state = $$props => {
if ('title' in $$props) $$invalidate(0, title = $$props.title);
};
if ($$props && "$$inject" in $$props) {
$$self.$inject_state($$props.$$inject);
}
return [title, $$scope, slots];
}
class Card extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$5, create_fragment$5, safe_not_equal, { title: 0 });
dispatch_dev("SvelteRegisterComponent", {
component: this,
tagName: "Card",
options,
id: create_fragment$5.name
});
const { ctx } = this.$$;
const props = options.props || {};
if (/*title*/ ctx[0] === undefined && !('title' in props)) {
console.warn("<Card> was created without expected prop 'title'");
}
}
get title() {
throw new Error("<Card>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set title(value) {
throw new Error("<Card>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\components\Modal.svelte generated by Svelte v3.44.3 */
const file$4 = "src\\components\\Modal.svelte";
// (8:2) {#if show}
function create_if_block$2(ctx) {
let div8;
let div7;
let div0;
let t0;
let span;
let t2;
let div6;
let div4;
let div3;
let div2;
let h3;
let t3;
let t4;
let div1;
let p;
let t5;
let t6;
let div5;
let button0;
let t8;
let button1;
let mounted;
let dispose;
const block = {
c: function create() {
div8 = element("div");
div7 = element("div");
div0 = element("div");
t0 = space();
span = element("span");
span.textContent = "";
t2 = space();
div6 = element("div");
div4 = element("div");
div3 = element("div");
div2 = element("div");
h3 = element("h3");
t3 = text(/*header*/ ctx[1]);
t4 = space();
div1 = element("div");
p = element("p");
t5 = text(/*text*/ ctx[2]);
t6 = space();
div5 = element("div");
button0 = element("button");
button0.textContent = "Deactivate";
t8 = space();
button1 = element("button");
button1.textContent = "Cancel";
attr_dev(div0, "class", "fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity");
attr_dev(div0, "aria-hidden", "true");
add_location(div0, file$4, 11, 8, 427);
attr_dev(span, "class", "hidden sm:inline-block sm:align-middle sm:h-screen");
attr_dev(span, "aria-hidden", "true");
add_location(span, file$4, 13, 8, 620);
attr_dev(h3, "class", "text-lg leading-6 font-medium text-gray-900");
attr_dev(h3, "id", "modal-title");
add_location(h3, file$4, 18, 16, 1101);
attr_dev(p, "class", "text-sm text-gray-500");
add_location(p, file$4, 20, 18, 1243);
attr_dev(div1, "class", "mt-2");
add_location(div1, file$4, 19, 16, 1205);
attr_dev(div2, "class", "mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left");
add_location(div2, file$4, 17, 14, 1024);
attr_dev(div3, "class", "sm:flex sm:items-start");
add_location(div3, file$4, 16, 12, 972);
attr_dev(div4, "class", "bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4");
add_location(div4, file$4, 15, 10, 906);
attr_dev(button0, "type", "button");
attr_dev(button0, "class", "w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm");
add_location(button0, file$4, 26, 12, 1466);
attr_dev(button1, "type", "button");
attr_dev(button1, "class", "mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm");
add_location(button1, file$4, 27, 12, 1783);
attr_dev(div5, "class", "bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse");
add_location(div5, file$4, 25, 10, 1382);
attr_dev(div6, "class", "inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full");
add_location(div6, file$4, 14, 8, 728);
attr_dev(div7, "class", "flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0");
add_location(div7, file$4, 10, 6, 317);
attr_dev(div8, "class", "fixed z-10 inset-0 overflow-y-auto");
attr_dev(div8, "aria-labelledby", "modal-title");
attr_dev(div8, "role", "dialog");
attr_dev(div8, "aria-modal", "true");
add_location(div8, file$4, 9, 4, 199);
},
m: function mount(target, anchor) {
insert_dev(target, div8, anchor);
append_dev(div8, div7);
append_dev(div7, div0);
append_dev(div7, t0);
append_dev(div7, span);
append_dev(div7, t2);
append_dev(div7, div6);
append_dev(div6, div4);
append_dev(div4, div3);
append_dev(div3, div2);
append_dev(div2, h3);
append_dev(h3, t3);
append_dev(div2, t4);
append_dev(div2, div1);
append_dev(div1, p);
append_dev(p, t5);
append_dev(div6, t6);
append_dev(div6, div5);
append_dev(div5, button0);
append_dev(div5, t8);
append_dev(div5, button1);
if (!mounted) {
dispose = listen_dev(button1, "click", /*click_handler*/ ctx[3], false, false, false);
mounted = true;
}
},
p: function update(ctx, dirty) {
if (dirty & /*header*/ 2) set_data_dev(t3, /*header*/ ctx[1]);
if (dirty & /*text*/ 4) set_data_dev(t5, /*text*/ ctx[2]);
},
d: function destroy(detaching) {
if (detaching) detach_dev(div8);
mounted = false;
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_if_block$2.name,
type: "if",
source: "(8:2) {#if show}",
ctx
});
return block;
}
function create_fragment$4(ctx) {
let div;
let if_block = /*show*/ ctx[0] && create_if_block$2(ctx);
const block = {
c: function create() {
div = element("div");
if (if_block) if_block.c();
attr_dev(div, "class", "modal");
add_location(div, file$4, 6, 0, 105);
},
l: function claim(nodes) {
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
if (if_block) if_block.m(div, null);
},
p: function update(ctx, [dirty]) {
if (/*show*/ ctx[0]) {
if (if_block) {
if_block.p(ctx, dirty);
} else {
if_block = create_if_block$2(ctx);
if_block.c();
if_block.m(div, null);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
},
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) detach_dev(div);
if (if_block) if_block.d();
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_fragment$4.name,
type: "component",
source: "",
ctx
});
return block;
}
function instance$4($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
validate_slots('Modal', slots, []);
let { show } = $$props;
let { header = "header" } = $$props;
let { text = "text" } = $$props;
const writable_props = ['show', 'header', 'text'];
Object.keys($$props).forEach(key => {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Modal> was created with unknown prop '${key}'`);
});
const click_handler = () => $$invalidate(0, show = false);
$$self.$$set = $$props => {
if ('show' in $$props) $$invalidate(0, show = $$props.show);
if ('header' in $$props) $$invalidate(1, header = $$props.header);
if ('text' in $$props) $$invalidate(2, text = $$props.text);
};
$$self.$capture_state = () => ({ show, header, text });
$$self.$inject_state = $$props => {
if ('show' in $$props) $$invalidate(0, show = $$props.show);
if ('header' in $$props) $$invalidate(1, header = $$props.header);
if ('text' in $$props) $$invalidate(2, text = $$props.text);
};
if ($$props && "$$inject" in $$props) {
$$self.$inject_state($$props.$$inject);
}
return [show, header, text, click_handler];
}
class Modal extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$4, create_fragment$4, safe_not_equal, { show: 0, header: 1, text: 2 });
dispatch_dev("SvelteRegisterComponent", {
component: this,
tagName: "Modal",
options,
id: create_fragment$4.name
});
const { ctx } = this.$$;
const props = options.props || {};
if (/*show*/ ctx[0] === undefined && !('show' in props)) {
console.warn("<Modal> was created without expected prop 'show'");
}
}
get show() {
throw new Error("<Modal>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set show(value) {
throw new Error("<Modal>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get header() {
throw new Error("<Modal>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set header(value) {
throw new Error("<Modal>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get text() {
throw new Error("<Modal>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set text(value) {
throw new Error("<Modal>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\widgets\Input.svelte generated by Svelte v3.44.3 */
const file$3 = "src\\widgets\\Input.svelte";
// (14:4) {#if widget.type == "number"}
function create_if_block_3$1(ctx) {
let input;
let input_class_value;
let mounted;
let dispose;
const block = {
c: function create() {
input = element("input");
attr_dev(input, "class", input_class_value = /*widget*/ ctx[0]["send"] == true
? "wgt-ipt border-red-500"
: "wgt-ipt focus:border-indigo-500");
attr_dev(input, "step", "0.1");
attr_dev(input, "type", "number");
add_location(input, file$3, 14, 6, 406);
},
m: function mount(target, anchor) {
insert_dev(target, input, anchor);
set_input_value(input, /*widget*/ ctx[0].status);
if (!mounted) {
dispose = [
listen_dev(input, "change", /*change_handler*/ ctx[3], false, false, false),
listen_dev(input, "input", /*input_input_handler*/ ctx[4])
];
mounted = true;
}
},
p: function update(ctx, dirty) {
if (dirty & /*widget*/ 1 && input_class_value !== (input_class_value = /*widget*/ ctx[0]["send"] == true
? "wgt-ipt border-red-500"
: "wgt-ipt focus:border-indigo-500")) {
attr_dev(input, "class", input_class_value);
}
if (dirty & /*widget*/ 1 && to_number(input.value) !== /*widget*/ ctx[0].status) {
set_input_value(input, /*widget*/ ctx[0].status);
}
},
d: function destroy(detaching) {
if (detaching) detach_dev(input);
mounted = false;
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_if_block_3$1.name,
type: "if",
source: "(14:4) {#if widget.type == \\\"number\\\"}",
ctx
});
return block;
}
// (17:4) {#if widget.type == "text"}
function create_if_block_2$1(ctx) {
let input;
let input_class_value;
let mounted;
let dispose;
const block = {
c: function create() {
input = element("input");
attr_dev(input, "class", input_class_value = /*widget*/ ctx[0]["send"] == true
? "wgt-ipt border-red-500"
: "wgt-ipt focus:border-indigo-500");
attr_dev(input, "type", "text");
add_location(input, file$3, 17, 6, 709);
},
m: function mount(target, anchor) {
insert_dev(target, input, anchor);
set_input_value(input, /*widget*/ ctx[0].status);
if (!mounted) {
dispose = [
listen_dev(input, "change", /*change_handler_1*/ ctx[5], false, false, false),
listen_dev(input, "input", /*input_input_handler_1*/ ctx[6])
];
mounted = true;
}
},
p: function update(ctx, dirty) {
if (dirty & /*widget*/ 1 && input_class_value !== (input_class_value = /*widget*/ ctx[0]["send"] == true
? "wgt-ipt border-red-500"
: "wgt-ipt focus:border-indigo-500")) {
attr_dev(input, "class", input_class_value);
}
if (dirty & /*widget*/ 1 && input.value !== /*widget*/ ctx[0].status) {
set_input_value(input, /*widget*/ ctx[0].status);
}
},
d: function destroy(detaching) {
if (detaching) detach_dev(input);
mounted = false;
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_if_block_2$1.name,
type: "if",
source: "(17:4) {#if widget.type == \\\"text\\\"}",
ctx
});
return block;
}
// (20:4) {#if widget.type == "date"}
function create_if_block_1$1(ctx) {
let input;
let input_class_value;
let mounted;
let dispose;
const block = {
c: function create() {
input = element("input");
attr_dev(input, "class", input_class_value = /*widget*/ ctx[0]["send"] == true
? "wgt-ipt border-red-500"
: "wgt-ipt focus:border-indigo-500");
attr_dev(input, "type", "date");
add_location(input, file$3, 20, 6, 999);
},
m: function mount(target, anchor) {
insert_dev(target, input, anchor);
set_input_value(input, /*widget*/ ctx[0].status);
if (!mounted) {
dispose = [
listen_dev(input, "change", /*change_handler_2*/ ctx[7], false, false, false),
listen_dev(input, "input", /*input_input_handler_2*/ ctx[8])
];
mounted = true;
}
},
p: function update(ctx, dirty) {
if (dirty & /*widget*/ 1 && input_class_value !== (input_class_value = /*widget*/ ctx[0]["send"] == true
? "wgt-ipt border-red-500"
: "wgt-ipt focus:border-indigo-500")) {
attr_dev(input, "class", input_class_value);
}
if (dirty & /*widget*/ 1) {
set_input_value(input, /*widget*/ ctx[0].status);
}
},
d: function destroy(detaching) {
if (detaching) detach_dev(input);
mounted = false;
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_if_block_1$1.name,
type: "if",
source: "(20:4) {#if widget.type == \\\"date\\\"}",
ctx
});
return block;
}
// (23:4) {#if widget.type == "time"}
function create_if_block$1(ctx) {
let input;
let input_class_value;
let mounted;
let dispose;
const block = {
c: function create() {
input = element("input");
attr_dev(input, "class", input_class_value = /*widget*/ ctx[0]["send"] == true
? "wgt-ipt border-red-500"
: "wgt-ipt focus:border-indigo-500");
attr_dev(input, "type", "time");
add_location(input, file$3, 23, 6, 1289);
},
m: function mount(target, anchor) {
insert_dev(target, input, anchor);
set_input_value(input, /*widget*/ ctx[0].status);
if (!mounted) {
dispose = [
listen_dev(input, "change", /*change_handler_3*/ ctx[9], false, false, false),
listen_dev(input, "input", /*input_input_handler_3*/ ctx[10])
];
mounted = true;
}
},
p: function update(ctx, dirty) {
if (dirty & /*widget*/ 1 && input_class_value !== (input_class_value = /*widget*/ ctx[0]["send"] == true
? "wgt-ipt border-red-500"
: "wgt-ipt focus:border-indigo-500")) {
attr_dev(input, "class", input_class_value);
}
if (dirty & /*widget*/ 1) {
set_input_value(input, /*widget*/ ctx[0].status);
}
},
d: function destroy(detaching) {
if (detaching) detach_dev(input);
mounted = false;
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_if_block$1.name,
type: "if",
source: "(23:4) {#if widget.type == \\\"time\\\"}",
ctx
});
return block;
}
function create_fragment$3(ctx) {
let div2;
let div0;
let label;
let t0_value = (!/*widget*/ ctx[0].descr ? "" : /*widget*/ ctx[0].descr) + "";
let t0;
let t1;
let div1;
let t2;
let t3;
let t4;
let if_block0 = /*widget*/ ctx[0].type == "number" && create_if_block_3$1(ctx);
let if_block1 = /*widget*/ ctx[0].type == "text" && create_if_block_2$1(ctx);
let if_block2 = /*widget*/ ctx[0].type == "date" && create_if_block_1$1(ctx);
let if_block3 = /*widget*/ ctx[0].type == "time" && create_if_block$1(ctx);
const block = {
c: function create() {
div2 = element("div");
div0 = element("div");
label = element("label");
t0 = text(t0_value);
t1 = space();
div1 = element("div");
if (if_block0) if_block0.c();
t2 = space();
if (if_block1) if_block1.c();
t3 = space();
if (if_block2) if_block2.c();
t4 = space();
if (if_block3) if_block3.c();
attr_dev(label, "class", "wgt-dscr-stl");
add_location(label, file$3, 10, 4, 259);
attr_dev(div0, "class", "wgt-dscr-w");
add_location(div0, file$3, 8, 2, 167);
attr_dev(div1, "class", "wgt-w");
add_location(div1, file$3, 12, 2, 344);
attr_dev(div2, "class", "crd-itm-psn");
add_location(div2, file$3, 7, 0, 138);
},
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, div2, anchor);
append_dev(div2, div0);
append_dev(div0, label);
append_dev(label, t0);
append_dev(div2, t1);
append_dev(div2, div1);
if (if_block0) if_block0.m(div1, null);
append_dev(div1, t2);
if (if_block1) if_block1.m(div1, null);
append_dev(div1, t3);
if (if_block2) if_block2.m(div1, null);
append_dev(div1, t4);
if (if_block3) if_block3.m(div1, null);
},
p: function update(ctx, [dirty]) {
if (dirty & /*widget*/ 1 && t0_value !== (t0_value = (!/*widget*/ ctx[0].descr ? "" : /*widget*/ ctx[0].descr) + "")) set_data_dev(t0, t0_value);
if (/*widget*/ ctx[0].type == "number") {
if (if_block0) {
if_block0.p(ctx, dirty);
} else {
if_block0 = create_if_block_3$1(ctx);
if_block0.c();
if_block0.m(div1, t2);
}
} else if (if_block0) {
if_block0.d(1);
if_block0 = null;
}
if (/*widget*/ ctx[0].type == "text") {
if (if_block1) {
if_block1.p(ctx, dirty);
} else {
if_block1 = create_if_block_2$1(ctx);
if_block1.c();
if_block1.m(div1, t3);
}
} else if (if_block1) {
if_block1.d(1);
if_block1 = null;
}
if (/*widget*/ ctx[0].type == "date") {
if (if_block2) {
if_block2.p(ctx, dirty);
} else {
if_block2 = create_if_block_1$1(ctx);
if_block2.c();
if_block2.m(div1, t4);
}
} else if (if_block2) {
if_block2.d(1);
if_block2 = null;
}
if (/*widget*/ ctx[0].type == "time") {
if (if_block3) {
if_block3.p(ctx, dirty);
} else {
if_block3 = create_if_block$1(ctx);
if_block3.c();
if_block3.m(div1, null);
}
} else if (if_block3) {
if_block3.d(1);
if_block3 = null;
}
},
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) detach_dev(div2);
if (if_block0) if_block0.d();
if (if_block1) if_block1.d();
if (if_block2) if_block2.d();
if (if_block3) if_block3.d();
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_fragment$3.name,
type: "component",
source: "",
ctx
});
return block;
}
function instance$3($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
validate_slots('Input', slots, []);
let { widget } = $$props;
let { wsPushProp = (ws, topic, status) => {
} } = $$props;
let { value } = $$props;
value = value;
const writable_props = ['widget', 'wsPushProp', 'value'];
Object.keys($$props).forEach(key => {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Input> was created with unknown prop '${key}'`);
});
const change_handler = () => ($$invalidate(0, widget["send"] = true, widget), wsPushProp(widget.ws, widget.topic, widget.status));
function input_input_handler() {
widget.status = to_number(this.value);
$$invalidate(0, widget);
}
const change_handler_1 = () => ($$invalidate(0, widget["send"] = true, widget), wsPushProp(widget.ws, widget.topic, widget.status));
function input_input_handler_1() {
widget.status = this.value;
$$invalidate(0, widget);
}
const change_handler_2 = () => ($$invalidate(0, widget["send"] = true, widget), wsPushProp(widget.ws, widget.topic, widget.status));
function input_input_handler_2() {
widget.status = this.value;
$$invalidate(0, widget);
}
const change_handler_3 = () => ($$invalidate(0, widget["send"] = true, widget), wsPushProp(widget.ws, widget.topic, widget.status));
function input_input_handler_3() {
widget.status = this.value;
$$invalidate(0, widget);
}
$$self.$$set = $$props => {
if ('widget' in $$props) $$invalidate(0, widget = $$props.widget);
if ('wsPushProp' in $$props) $$invalidate(1, wsPushProp = $$props.wsPushProp);
if ('value' in $$props) $$invalidate(2, value = $$props.value);
};
$$self.$capture_state = () => ({ widget, wsPushProp, value });
$$self.$inject_state = $$props => {
if ('widget' in $$props) $$invalidate(0, widget = $$props.widget);
if ('wsPushProp' in $$props) $$invalidate(1, wsPushProp = $$props.wsPushProp);
if ('value' in $$props) $$invalidate(2, value = $$props.value);
};
if ($$props && "$$inject" in $$props) {
$$self.$inject_state($$props.$$inject);
}
return [
widget,
wsPushProp,
value,
change_handler,
input_input_handler,
change_handler_1,
input_input_handler_1,
change_handler_2,
input_input_handler_2,
change_handler_3,
input_input_handler_3
];
}
class Input extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$3, create_fragment$3, safe_not_equal, { widget: 0, wsPushProp: 1, value: 2 });
dispatch_dev("SvelteRegisterComponent", {
component: this,
tagName: "Input",
options,
id: create_fragment$3.name
});
const { ctx } = this.$$;
const props = options.props || {};
if (/*widget*/ ctx[0] === undefined && !('widget' in props)) {
console.warn("<Input> was created without expected prop 'widget'");
}
if (/*value*/ ctx[2] === undefined && !('value' in props)) {
console.warn("<Input> was created without expected prop 'value'");
}
}
get widget() {
throw new Error("<Input>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set widget(value) {
throw new Error("<Input>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get wsPushProp() {
throw new Error("<Input>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set wsPushProp(value) {
throw new Error("<Input>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get value() {
throw new Error("<Input>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set value(value) {
throw new Error("<Input>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\widgets\Toggle.svelte generated by Svelte v3.44.3 */
const file$2 = "src\\widgets\\Toggle.svelte";
function create_fragment$2(ctx) {
let div5;
let div0;
let label0;
let t0_value = (!/*widget*/ ctx[0].descr ? "" : /*widget*/ ctx[0].descr) + "";
let t0;
let t1;
let div4;
let label1;
let div3;
let input;
let input_id_value;
let t2;
let div1;
let t3;
let div2;
let div2_class_value;
let label1_for_value;
let mounted;
let dispose;
const block = {
c: function create() {
div5 = element("div");
div0 = element("div");
label0 = element("label");
t0 = text(t0_value);
t1 = space();
div4 = element("div");
label1 = element("label");
div3 = element("div");
input = element("input");
t2 = space();
div1 = element("div");
t3 = space();
div2 = element("div");
attr_dev(label0, "class", "wgt-dscr-stl");
add_location(label0, file$2, 10, 4, 259);
attr_dev(div0, "class", "wgt-dscr-w");
add_location(div0, file$2, 8, 2, 167);
attr_dev(input, "id", input_id_value = /*widget*/ ctx[0].topic);
attr_dev(input, "type", "checkbox");
attr_dev(input, "class", "sr-only");
add_location(input, file$2, 15, 8, 471);
attr_dev(div1, "class", "block bg-gray-600 w-10 h-6 rounded-full");
add_location(div1, file$2, 16, 8, 663);
attr_dev(div2, "class", div2_class_value = "dot " + (/*widget*/ ctx[0]['send'] == true
? 'bg-red-400'
: 'bg-white') + " absolute left-1 top-1 w-4 h-4 rounded-full transition");
add_location(div2, file$2, 17, 8, 728);
attr_dev(div3, "class", "relative");
add_location(div3, file$2, 14, 6, 439);
attr_dev(label1, "for", label1_for_value = /*widget*/ ctx[0].topic);
attr_dev(label1, "class", "items-center cursor-pointer");
add_location(label1, file$2, 13, 4, 369);
attr_dev(div4, "class", "wgt-w");
add_location(div4, file$2, 12, 2, 344);
attr_dev(div5, "class", "crd-itm-psn");
add_location(div5, file$2, 7, 0, 138);
},
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, div5, anchor);
append_dev(div5, div0);
append_dev(div0, label0);
append_dev(label0, t0);
append_dev(div5, t1);
append_dev(div5, div4);
append_dev(div4, label1);
append_dev(label1, div3);
append_dev(div3, input);
set_input_value(input, /*widget*/ ctx[0].status);
append_dev(div3, t2);
append_dev(div3, div1);
append_dev(div3, t3);
append_dev(div3, div2);
if (!mounted) {
dispose = [
listen_dev(input, "change", /*change_handler*/ ctx[3], false, false, false),
listen_dev(input, "change", /*input_change_handler*/ ctx[4])
];
mounted = true;
}
},
p: function update(ctx, [dirty]) {
if (dirty & /*widget*/ 1 && t0_value !== (t0_value = (!/*widget*/ ctx[0].descr ? "" : /*widget*/ ctx[0].descr) + "")) set_data_dev(t0, t0_value);
if (dirty & /*widget*/ 1 && input_id_value !== (input_id_value = /*widget*/ ctx[0].topic)) {
attr_dev(input, "id", input_id_value);
}
if (dirty & /*widget*/ 1) {
set_input_value(input, /*widget*/ ctx[0].status);
}
if (dirty & /*widget*/ 1 && div2_class_value !== (div2_class_value = "dot " + (/*widget*/ ctx[0]['send'] == true
? 'bg-red-400'
: 'bg-white') + " absolute left-1 top-1 w-4 h-4 rounded-full transition")) {
attr_dev(div2, "class", div2_class_value);
}
if (dirty & /*widget*/ 1 && label1_for_value !== (label1_for_value = /*widget*/ ctx[0].topic)) {
attr_dev(label1, "for", label1_for_value);
}
},
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) detach_dev(div5);
mounted = false;
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_fragment$2.name,
type: "component",
source: "",
ctx
});
return block;
}
function instance$2($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
validate_slots('Toggle', slots, []);
let { widget } = $$props;
let { value } = $$props;
value = value;
let { wsPushProp = (ws, topic, status) => {
} } = $$props;
const writable_props = ['widget', 'value', 'wsPushProp'];
Object.keys($$props).forEach(key => {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Toggle> was created with unknown prop '${key}'`);
});
const change_handler = () => ($$invalidate(0, widget["send"] = true, widget), wsPushProp(widget.ws, widget.topic, widget.status));
function input_change_handler() {
widget.status = this.value;
$$invalidate(0, widget);
}
$$self.$$set = $$props => {
if ('widget' in $$props) $$invalidate(0, widget = $$props.widget);
if ('value' in $$props) $$invalidate(2, value = $$props.value);
if ('wsPushProp' in $$props) $$invalidate(1, wsPushProp = $$props.wsPushProp);
};
$$self.$capture_state = () => ({ widget, value, wsPushProp });
$$self.$inject_state = $$props => {
if ('widget' in $$props) $$invalidate(0, widget = $$props.widget);
if ('value' in $$props) $$invalidate(2, value = $$props.value);
if ('wsPushProp' in $$props) $$invalidate(1, wsPushProp = $$props.wsPushProp);
};
if ($$props && "$$inject" in $$props) {
$$self.$inject_state($$props.$$inject);
}
return [widget, wsPushProp, value, change_handler, input_change_handler];
}
class Toggle extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$2, create_fragment$2, safe_not_equal, { widget: 0, value: 2, wsPushProp: 1 });
dispatch_dev("SvelteRegisterComponent", {
component: this,
tagName: "Toggle",
options,
id: create_fragment$2.name
});
const { ctx } = this.$$;
const props = options.props || {};
if (/*widget*/ ctx[0] === undefined && !('widget' in props)) {
console.warn("<Toggle> was created without expected prop 'widget'");
}
if (/*value*/ ctx[2] === undefined && !('value' in props)) {
console.warn("<Toggle> was created without expected prop 'value'");
}
}
get widget() {
throw new Error("<Toggle>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set widget(value) {
throw new Error("<Toggle>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get value() {
throw new Error("<Toggle>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set value(value) {
throw new Error("<Toggle>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get wsPushProp() {
throw new Error("<Toggle>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set wsPushProp(value) {
throw new Error("<Toggle>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\widgets\Anydata.svelte generated by Svelte v3.44.3 */
const file$1 = "src\\widgets\\Anydata.svelte";
function create_fragment$1(ctx) {
let div2;
let div0;
let label0;
let t0_value = (!/*widget*/ ctx[0].descr ? "" : /*widget*/ ctx[0].descr) + "";
let t0;
let t1;
let div1;
let label1;
let t2_value = (!/*widget*/ ctx[0].status
? ""
: /*widget*/ ctx[0].status) + "";
let t2;
let t3;
let label2;
let t4;
let t5_value = (!/*widget*/ ctx[0].after ? "" : /*widget*/ ctx[0].after) + "";
let t5;
const block = {
c: function create() {
div2 = element("div");
div0 = element("div");
label0 = element("label");
t0 = text(t0_value);
t1 = space();
div1 = element("div");
label1 = element("label");
t2 = text(t2_value);
t3 = space();
label2 = element("label");
t4 = text(" ");
t5 = text(t5_value);
attr_dev(label0, "class", "wgt-dscr-stl");
add_location(label0, file$1, 9, 4, 205);
attr_dev(div0, "class", "wgt-dscr-w");
add_location(div0, file$1, 7, 2, 113);
attr_dev(label1, "class", "wgt-adt-stl");
add_location(label1, file$1, 13, 4, 377);
attr_dev(label2, "class", "wgt-adt-stl");
add_location(label2, file$1, 15, 4, 517);
attr_dev(div1, "class", "wgt-w");
add_location(div1, file$1, 11, 2, 290);
attr_dev(div2, "class", "crd-itm-psn");
add_location(div2, file$1, 6, 0, 84);
},
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, div2, anchor);
append_dev(div2, div0);
append_dev(div0, label0);
append_dev(label0, t0);
append_dev(div2, t1);
append_dev(div2, div1);
append_dev(div1, label1);
append_dev(label1, t2);
append_dev(div1, t3);
append_dev(div1, label2);
append_dev(label2, t4);
append_dev(label2, t5);
},
p: function update(ctx, [dirty]) {
if (dirty & /*widget*/ 1 && t0_value !== (t0_value = (!/*widget*/ ctx[0].descr ? "" : /*widget*/ ctx[0].descr) + "")) set_data_dev(t0, t0_value);
if (dirty & /*widget*/ 1 && t2_value !== (t2_value = (!/*widget*/ ctx[0].status
? ""
: /*widget*/ ctx[0].status) + "")) set_data_dev(t2, t2_value);
if (dirty & /*widget*/ 1 && t5_value !== (t5_value = (!/*widget*/ ctx[0].after ? "" : /*widget*/ ctx[0].after) + "")) set_data_dev(t5, t5_value);
},
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) detach_dev(div2);
}
};
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('Anydata', slots, []);
let { widget } = $$props;
let { value } = $$props;
value = value;
const writable_props = ['widget', 'value'];
Object.keys($$props).forEach(key => {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Anydata> was created with unknown prop '${key}'`);
});
$$self.$$set = $$props => {
if ('widget' in $$props) $$invalidate(0, widget = $$props.widget);
if ('value' in $$props) $$invalidate(1, value = $$props.value);
};
$$self.$capture_state = () => ({ widget, value });
$$self.$inject_state = $$props => {
if ('widget' in $$props) $$invalidate(0, widget = $$props.widget);
if ('value' in $$props) $$invalidate(1, value = $$props.value);
};
if ($$props && "$$inject" in $$props) {
$$self.$inject_state($$props.$$inject);
}
return [widget, value];
}
class Anydata extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$1, create_fragment$1, safe_not_equal, { widget: 0, value: 1 });
dispatch_dev("SvelteRegisterComponent", {
component: this,
tagName: "Anydata",
options,
id: create_fragment$1.name
});
const { ctx } = this.$$;
const props = options.props || {};
if (/*widget*/ ctx[0] === undefined && !('widget' in props)) {
console.warn("<Anydata> was created without expected prop 'widget'");
}
if (/*value*/ ctx[1] === undefined && !('value' in props)) {
console.warn("<Anydata> was created without expected prop 'value'");
}
}
get widget() {
throw new Error("<Anydata>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set widget(value) {
throw new Error("<Anydata>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get value() {
throw new Error("<Anydata>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set value(value) {
throw new Error("<Anydata>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\App.svelte generated by Svelte v3.44.3 */
const { Object: Object_1, console: console_1 } = globals;
const file = "src\\App.svelte";
function get_each_context(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[67] = list[i];
return child_ctx;
}
function get_each_context_1(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[70] = list[i];
child_ctx[72] = i;
return child_ctx;
}
function get_each_context_2(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[73] = list[i];
child_ctx[74] = list;
child_ctx[75] = i;
return child_ctx;
}
function get_each_context_3(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[76] = list[i][0];
child_ctx[77] = list[i][1];
child_ctx[78] = list;
child_ctx[79] = i;
return child_ctx;
}
function get_each_context_4(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[80] = list[i];
return child_ctx;
}
function get_each_context_5(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[83] = list[i];
child_ctx[72] = i;
return child_ctx;
}
function get_each_context_6(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[80] = list[i];
child_ctx[85] = list;
child_ctx[72] = i;
return child_ctx;
}
function get_each_context_7(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[67] = list[i];
return child_ctx;
}
// (595:10) {#each deviceList as device}
function create_each_block_7(ctx) {
let option;
let t0_value = /*device*/ ctx[67].name + "";
let t0;
let t1;
let option_value_value;
const block = {
c: function create() {
option = element("option");
t0 = text(t0_value);
t1 = space();
option.__value = option_value_value = /*device*/ ctx[67];
option.value = option.__value;
add_location(option, file, 595, 12, 17217);
},
m: function mount(target, anchor) {
insert_dev(target, option, anchor);
append_dev(option, t0);
append_dev(option, t1);
},
p: function update(ctx, dirty) {
if (dirty[0] & /*deviceList*/ 512 && t0_value !== (t0_value = /*device*/ ctx[67].name + "")) set_data_dev(t0, t0_value);
if (dirty[0] & /*deviceList*/ 512 && option_value_value !== (option_value_value = /*device*/ ctx[67])) {
prop_dev(option, "__value", option_value_value);
option.value = option.__value;
}
},
d: function destroy(detaching) {
if (detaching) detach_dev(option);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_each_block_7.name,
type: "each",
source: "(595:10) {#each deviceList as device}",
ctx
});
return block;
}
// (644:16) {#if widget.page === pagesName.page}
function create_if_block_3(ctx) {
let t0;
let t1;
let if_block2_anchor;
let current;
let if_block0 = /*widget*/ ctx[80].widget === "input" && create_if_block_6(ctx);
let if_block1 = /*widget*/ ctx[80].widget === "toggle" && create_if_block_5(ctx);
let if_block2 = /*widget*/ ctx[80].widget === "anydata" && create_if_block_4(ctx);
const block = {
c: function create() {
if (if_block0) if_block0.c();
t0 = space();
if (if_block1) if_block1.c();
t1 = space();
if (if_block2) if_block2.c();
if_block2_anchor = empty();
},
m: function mount(target, anchor) {
if (if_block0) if_block0.m(target, anchor);
insert_dev(target, t0, anchor);
if (if_block1) if_block1.m(target, anchor);
insert_dev(target, t1, anchor);
if (if_block2) if_block2.m(target, anchor);
insert_dev(target, if_block2_anchor, anchor);
current = true;
},
p: function update(ctx, dirty) {
if (/*widget*/ ctx[80].widget === "input") {
if (if_block0) {
if_block0.p(ctx, dirty);
if (dirty[0] & /*wigets*/ 8) {
transition_in(if_block0, 1);
}
} else {
if_block0 = create_if_block_6(ctx);
if_block0.c();
transition_in(if_block0, 1);
if_block0.m(t0.parentNode, t0);
}
} else if (if_block0) {
group_outros();
transition_out(if_block0, 1, 1, () => {
if_block0 = null;
});
check_outros();
}
if (/*widget*/ ctx[80].widget === "toggle") {
if (if_block1) {
if_block1.p(ctx, dirty);
if (dirty[0] & /*wigets*/ 8) {
transition_in(if_block1, 1);
}
} else {
if_block1 = create_if_block_5(ctx);
if_block1.c();
transition_in(if_block1, 1);
if_block1.m(t1.parentNode, t1);
}
} else if (if_block1) {
group_outros();
transition_out(if_block1, 1, 1, () => {
if_block1 = null;
});
check_outros();
}
if (/*widget*/ ctx[80].widget === "anydata") {
if (if_block2) {
if_block2.p(ctx, dirty);
if (dirty[0] & /*wigets*/ 8) {
transition_in(if_block2, 1);
}
} else {
if_block2 = create_if_block_4(ctx);
if_block2.c();
transition_in(if_block2, 1);
if_block2.m(if_block2_anchor.parentNode, if_block2_anchor);
}
} else if (if_block2) {
group_outros();
transition_out(if_block2, 1, 1, () => {
if_block2 = null;
});
check_outros();
}
},
i: function intro(local) {
if (current) return;
transition_in(if_block0);
transition_in(if_block1);
transition_in(if_block2);
current = true;
},
o: function outro(local) {
transition_out(if_block0);
transition_out(if_block1);
transition_out(if_block2);
current = false;
},
d: function destroy(detaching) {
if (if_block0) if_block0.d(detaching);
if (detaching) detach_dev(t0);
if (if_block1) if_block1.d(detaching);
if (detaching) detach_dev(t1);
if (if_block2) if_block2.d(detaching);
if (detaching) detach_dev(if_block2_anchor);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_if_block_3.name,
type: "if",
source: "(644:16) {#if widget.page === pagesName.page}",
ctx
});
return block;
}
// (645:18) {#if widget.widget === "input"}
function create_if_block_6(ctx) {
let input;
let updating_value;
let current;
function input_value_binding(value) {
/*input_value_binding*/ ctx[23](value, /*widget*/ ctx[80]);
}
let input_props = {
widget: /*widget*/ ctx[80],
wsPushProp: /*func*/ ctx[22]
};
if (/*widget*/ ctx[80].status !== void 0) {
input_props.value = /*widget*/ ctx[80].status;
}
input = new Input({ props: input_props, $$inline: true });
binding_callbacks.push(() => bind(input, 'value', input_value_binding));
const block = {
c: function create() {
create_component(input.$$.fragment);
},
m: function mount(target, anchor) {
mount_component(input, target, anchor);
current = true;
},
p: function update(new_ctx, dirty) {
ctx = new_ctx;
const input_changes = {};
if (dirty[0] & /*wigets*/ 8) input_changes.widget = /*widget*/ ctx[80];
if (!updating_value && dirty[0] & /*wigets*/ 8) {
updating_value = true;
input_changes.value = /*widget*/ ctx[80].status;
add_flush_callback(() => updating_value = false);
}
input.$set(input_changes);
},
i: function intro(local) {
if (current) return;
transition_in(input.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(input.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(input, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_if_block_6.name,
type: "if",
source: "(645:18) {#if widget.widget === \\\"input\\\"}",
ctx
});
return block;
}
// (648:18) {#if widget.widget === "toggle"}
function create_if_block_5(ctx) {
let toggle;
let updating_value;
let current;
function toggle_value_binding(value) {
/*toggle_value_binding*/ ctx[25](value, /*widget*/ ctx[80]);
}
let toggle_props = {
widget: /*widget*/ ctx[80],
wsPushProp: /*func_1*/ ctx[24]
};
if (/*widget*/ ctx[80].status !== void 0) {
toggle_props.value = /*widget*/ ctx[80].status;
}
toggle = new Toggle({ props: toggle_props, $$inline: true });
binding_callbacks.push(() => bind(toggle, 'value', toggle_value_binding));
const block = {
c: function create() {
create_component(toggle.$$.fragment);
},
m: function mount(target, anchor) {
mount_component(toggle, target, anchor);
current = true;
},
p: function update(new_ctx, dirty) {
ctx = new_ctx;
const toggle_changes = {};
if (dirty[0] & /*wigets*/ 8) toggle_changes.widget = /*widget*/ ctx[80];
if (!updating_value && dirty[0] & /*wigets*/ 8) {
updating_value = true;
toggle_changes.value = /*widget*/ ctx[80].status;
add_flush_callback(() => updating_value = false);
}
toggle.$set(toggle_changes);
},
i: function intro(local) {
if (current) return;
transition_in(toggle.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(toggle.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(toggle, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_if_block_5.name,
type: "if",
source: "(648:18) {#if widget.widget === \\\"toggle\\\"}",
ctx
});
return block;
}
// (651:18) {#if widget.widget === "anydata"}
function create_if_block_4(ctx) {
let anydata;
let updating_value;
let current;
function anydata_value_binding(value) {
/*anydata_value_binding*/ ctx[26](value, /*widget*/ ctx[80]);
}
let anydata_props = { widget: /*widget*/ ctx[80] };
if (/*widget*/ ctx[80].status !== void 0) {
anydata_props.value = /*widget*/ ctx[80].status;
}
anydata = new Anydata({ props: anydata_props, $$inline: true });
binding_callbacks.push(() => bind(anydata, 'value', anydata_value_binding));
const block = {
c: function create() {
create_component(anydata.$$.fragment);
},
m: function mount(target, anchor) {
mount_component(anydata, target, anchor);
current = true;
},
p: function update(new_ctx, dirty) {
ctx = new_ctx;
const anydata_changes = {};
if (dirty[0] & /*wigets*/ 8) anydata_changes.widget = /*widget*/ ctx[80];
if (!updating_value && dirty[0] & /*wigets*/ 8) {
updating_value = true;
anydata_changes.value = /*widget*/ ctx[80].status;
add_flush_callback(() => updating_value = false);
}
anydata.$set(anydata_changes);
},
i: function intro(local) {
if (current) return;
transition_in(anydata.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(anydata.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(anydata, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_if_block_4.name,
type: "if",
source: "(651:18) {#if widget.widget === \\\"anydata\\\"}",
ctx
});
return block;
}
// (643:14) {#each wigets as widget, i}
function create_each_block_6(ctx) {
let if_block_anchor;
let current;
let if_block = /*widget*/ ctx[80].page === /*pagesName*/ ctx[83].page && create_if_block_3(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);
current = true;
},
p: function update(ctx, dirty) {
if (/*widget*/ ctx[80].page === /*pagesName*/ ctx[83].page) {
if (if_block) {
if_block.p(ctx, dirty);
if (dirty[0] & /*wigets, pages*/ 24) {
transition_in(if_block, 1);
}
} else {
if_block = create_if_block_3(ctx);
if_block.c();
transition_in(if_block, 1);
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
group_outros();
transition_out(if_block, 1, 1, () => {
if_block = null;
});
check_outros();
}
},
i: function intro(local) {
if (current) return;
transition_in(if_block);
current = true;
},
o: function outro(local) {
transition_out(if_block);
current = false;
},
d: function destroy(detaching) {
if (if_block) if_block.d(detaching);
if (detaching) detach_dev(if_block_anchor);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_each_block_6.name,
type: "each",
source: "(643:14) {#each wigets as widget, i}",
ctx
});
return block;
}
// (642:12) <Card title={pagesName.page}>
function create_default_slot_12(ctx) {
let each_1_anchor;
let current;
let each_value_6 = /*wigets*/ ctx[3];
validate_each_argument(each_value_6);
let each_blocks = [];
for (let i = 0; i < each_value_6.length; i += 1) {
each_blocks[i] = create_each_block_6(get_each_context_6(ctx, each_value_6, i));
}
const out = i => transition_out(each_blocks[i], 1, 1, () => {
each_blocks[i] = null;
});
const block = {
c: function create() {
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
each_1_anchor = empty();
},
m: function mount(target, anchor) {
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(target, anchor);
}
insert_dev(target, each_1_anchor, anchor);
current = true;
},
p: function update(ctx, dirty) {
if (dirty[0] & /*wigets, wsPush, pages*/ 16408) {
each_value_6 = /*wigets*/ ctx[3];
validate_each_argument(each_value_6);
let i;
for (i = 0; i < each_value_6.length; i += 1) {
const child_ctx = get_each_context_6(ctx, each_value_6, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
transition_in(each_blocks[i], 1);
} else {
each_blocks[i] = create_each_block_6(child_ctx);
each_blocks[i].c();
transition_in(each_blocks[i], 1);
each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
}
}
group_outros();
for (i = each_value_6.length; i < each_blocks.length; i += 1) {
out(i);
}
check_outros();
}
},
i: function intro(local) {
if (current) return;
for (let i = 0; i < each_value_6.length; i += 1) {
transition_in(each_blocks[i]);
}
current = true;
},
o: function outro(local) {
each_blocks = each_blocks.filter(Boolean);
for (let i = 0; i < each_blocks.length; i += 1) {
transition_out(each_blocks[i]);
}
current = false;
},
d: function destroy(detaching) {
destroy_each(each_blocks, detaching);
if (detaching) detach_dev(each_1_anchor);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_default_slot_12.name,
type: "slot",
source: "(642:12) <Card title={pagesName.page}>",
ctx
});
return block;
}
// (641:10) {#each pages as pagesName, i}
function create_each_block_5(ctx) {
let card;
let current;
card = new Card({
props: {
title: /*pagesName*/ ctx[83].page,
$$slots: { default: [create_default_slot_12] },
$$scope: { ctx }
},
$$inline: true
});
const block = {
c: function create() {
create_component(card.$$.fragment);
},
m: function mount(target, anchor) {
mount_component(card, target, anchor);
current = true;
},
p: function update(ctx, dirty) {
const card_changes = {};
if (dirty[0] & /*pages*/ 16) card_changes.title = /*pagesName*/ ctx[83].page;
if (dirty[0] & /*wigets, pages*/ 24 | dirty[2] & /*$$scope*/ 67108864) {
card_changes.$$scope = { dirty, ctx };
}
card.$set(card_changes);
},
i: function intro(local) {
if (current) return;
transition_in(card.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(card.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(card, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_each_block_5.name,
type: "each",
source: "(641:10) {#each pages as pagesName, i}",
ctx
});
return block;
}
// (659:10) <Card title="Редактор JSON">
function create_default_slot_11(ctx) {
let textarea;
let textarea_value_value;
let mounted;
let dispose;
const block = {
c: function create() {
textarea = element("textarea");
attr_dev(textarea, "rows", "10");
attr_dev(textarea, "class", "jsn-ipt w-full");
attr_dev(textarea, "id", "text1");
textarea.value = textarea_value_value = /*syntaxHighlight*/ ctx[18](JSON.stringify(/*wigets*/ ctx[3]));
add_location(textarea, file, 659, 12, 19534);
},
m: function mount(target, anchor) {
insert_dev(target, textarea, anchor);
if (!mounted) {
dispose = listen_dev(textarea, "input", /*wigetsUpdate*/ ctx[15], false, false, false);
mounted = true;
}
},
p: function update(ctx, dirty) {
if (dirty[0] & /*wigets*/ 8 && textarea_value_value !== (textarea_value_value = /*syntaxHighlight*/ ctx[18](JSON.stringify(/*wigets*/ ctx[3])))) {
prop_dev(textarea, "value", textarea_value_value);
}
},
d: function destroy(detaching) {
if (detaching) detach_dev(textarea);
mounted = false;
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_default_slot_11.name,
type: "slot",
source: "(659:10) <Card title=\\\"Редактор JSON\\\">",
ctx
});
return block;
}
// (639:6) <Route path="/">
function create_default_slot_10(ctx) {
let div;
let t;
let card;
let current;
let each_value_5 = /*pages*/ ctx[4];
validate_each_argument(each_value_5);
let each_blocks = [];
for (let i = 0; i < each_value_5.length; i += 1) {
each_blocks[i] = create_each_block_5(get_each_context_5(ctx, each_value_5, i));
}
const out = i => transition_out(each_blocks[i], 1, 1, () => {
each_blocks[i] = null;
});
card = new Card({
props: {
title: "Редактор JSON",
$$slots: { default: [create_default_slot_11] },
$$scope: { ctx }
},
$$inline: true
});
const block = {
c: function create() {
div = element("div");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
t = space();
create_component(card.$$.fragment);
attr_dev(div, "class", "crd-grd");
add_location(div, file, 639, 8, 18610);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(div, null);
}
append_dev(div, t);
mount_component(card, div, null);
current = true;
},
p: function update(ctx, dirty) {
if (dirty[0] & /*pages, wigets, wsPush*/ 16408) {
each_value_5 = /*pages*/ ctx[4];
validate_each_argument(each_value_5);
let i;
for (i = 0; i < each_value_5.length; i += 1) {
const child_ctx = get_each_context_5(ctx, each_value_5, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
transition_in(each_blocks[i], 1);
} else {
each_blocks[i] = create_each_block_5(child_ctx);
each_blocks[i].c();
transition_in(each_blocks[i], 1);
each_blocks[i].m(div, t);
}
}
group_outros();
for (i = each_value_5.length; i < each_blocks.length; i += 1) {
out(i);
}
check_outros();
}
const card_changes = {};
if (dirty[0] & /*wigets*/ 8 | dirty[2] & /*$$scope*/ 67108864) {
card_changes.$$scope = { dirty, ctx };
}
card.$set(card_changes);
},
i: function intro(local) {
if (current) return;
for (let i = 0; i < each_value_5.length; i += 1) {
transition_in(each_blocks[i]);
}
transition_in(card.$$.fragment, local);
current = true;
},
o: function outro(local) {
each_blocks = each_blocks.filter(Boolean);
for (let i = 0; i < each_blocks.length; i += 1) {
transition_out(each_blocks[i]);
}
transition_out(card.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) detach_dev(div);
destroy_each(each_blocks, detaching);
destroy_component(card);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_default_slot_10.name,
type: "slot",
source: "(639:6) <Route path=\\\"/\\\">",
ctx
});
return block;
}
// (688:24) {#each widgetCollection as widget}
function create_each_block_4(ctx) {
let option;
let t0_value = /*widget*/ ctx[80].val + "";
let t0;
let t1;
let option_value_value;
const block = {
c: function create() {
option = element("option");
t0 = text(t0_value);
t1 = space();
option.__value = option_value_value = /*widget*/ ctx[80].id;
option.value = option.__value;
add_location(option, file, 688, 26, 21000);
},
m: function mount(target, anchor) {
insert_dev(target, option, anchor);
append_dev(option, t0);
append_dev(option, t1);
},
p: function update(ctx, dirty) {
if (dirty[0] & /*widgetCollection*/ 64 && t0_value !== (t0_value = /*widget*/ ctx[80].val + "")) set_data_dev(t0, t0_value);
if (dirty[0] & /*widgetCollection*/ 64 && option_value_value !== (option_value_value = /*widget*/ ctx[80].id)) {
prop_dev(option, "__value", option_value_value);
option.value = option.__value;
}
},
d: function destroy(detaching) {
if (detaching) detach_dev(option);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_each_block_4.name,
type: "each",
source: "(688:24) {#each widgetCollection as widget}",
ctx
});
return block;
}
// (699:18) {#if !hideAllSubParams}
function create_if_block_1(ctx) {
let t;
let each_value_3 = Object.entries(/*element*/ ctx[73]);
validate_each_argument(each_value_3);
let each_blocks = [];
for (let i = 0; i < each_value_3.length; i += 1) {
each_blocks[i] = create_each_block_3(get_each_context_3(ctx, each_value_3, i));
}
const block = {
c: function create() {
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
t = space();
},
m: function mount(target, anchor) {
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(target, anchor);
}
insert_dev(target, t, anchor);
},
p: function update(ctx, dirty) {
if (dirty[0] & /*configJson*/ 32) {
each_value_3 = Object.entries(/*element*/ ctx[73]);
validate_each_argument(each_value_3);
let i;
for (i = 0; i < each_value_3.length; i += 1) {
const child_ctx = get_each_context_3(ctx, each_value_3, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block_3(child_ctx);
each_blocks[i].c();
each_blocks[i].m(t.parentNode, t);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value_3.length;
}
},
d: function destroy(detaching) {
destroy_each(each_blocks, detaching);
if (detaching) detach_dev(t);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_if_block_1.name,
type: "if",
source: "(699:18) {#if !hideAllSubParams}",
ctx
});
return block;
}
// (701:22) {#if key != "type" && key != "subtype" && key != "id" && key != "widget" && key != "page" && key != "descr"}
function create_if_block_2(ctx) {
let tr;
let td0;
let t0;
let td1;
let t1;
let td2;
let t2;
let td3;
let p;
let t3_value = /*key*/ ctx[76] + "";
let t3;
let t4;
let td4;
let input;
let mounted;
let dispose;
function input_input_handler() {
/*input_input_handler*/ ctx[32].call(input, /*key*/ ctx[76], /*each_value_2*/ ctx[74], /*element_index*/ ctx[75]);
}
const block = {
c: function create() {
tr = element("tr");
td0 = element("td");
t0 = space();
td1 = element("td");
t1 = space();
td2 = element("td");
t2 = space();
td3 = element("td");
p = element("p");
t3 = text(t3_value);
t4 = space();
td4 = element("td");
input = element("input");
add_location(td0, file, 702, 26, 22475);
add_location(td1, file, 703, 26, 22509);
add_location(td2, file, 704, 26, 22543);
attr_dev(p, "class", "tbl-s-txt");
add_location(p, file, 706, 28, 22640);
attr_dev(td3, "class", "tbl-s-bdy text-right");
add_location(td3, file, 705, 26, 22577);
attr_dev(input, "class", "tbl-s-ipt w-full");
attr_dev(input, "type", "text");
add_location(input, file, 709, 28, 22795);
attr_dev(td4, "class", "tbl-s-bdy text-center");
add_location(td4, file, 708, 26, 22731);
attr_dev(tr, "class", "tbl-txt-sz tbl-txt-p");
add_location(tr, file, 701, 24, 22414);
},
m: function mount(target, anchor) {
insert_dev(target, tr, anchor);
append_dev(tr, td0);
append_dev(tr, t0);
append_dev(tr, td1);
append_dev(tr, t1);
append_dev(tr, td2);
append_dev(tr, t2);
append_dev(tr, td3);
append_dev(td3, p);
append_dev(p, t3);
append_dev(tr, t4);
append_dev(tr, td4);
append_dev(td4, input);
set_input_value(input, /*element*/ ctx[73][/*key*/ ctx[76]]);
if (!mounted) {
dispose = listen_dev(input, "input", input_input_handler);
mounted = true;
}
},
p: function update(new_ctx, dirty) {
ctx = new_ctx;
if (dirty[0] & /*configJson*/ 32 && t3_value !== (t3_value = /*key*/ ctx[76] + "")) set_data_dev(t3, t3_value);
if (dirty[0] & /*configJson, widgetCollection*/ 96 && input.value !== /*element*/ ctx[73][/*key*/ ctx[76]]) {
set_input_value(input, /*element*/ ctx[73][/*key*/ ctx[76]]);
}
},
d: function destroy(detaching) {
if (detaching) detach_dev(tr);
mounted = false;
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_if_block_2.name,
type: "if",
source: "(701:22) {#if key != \\\"type\\\" && key != \\\"subtype\\\" && key != \\\"id\\\" && key != \\\"widget\\\" && key != \\\"page\\\" && key != \\\"descr\\\"}",
ctx
});
return block;
}
// (700:20) {#each Object.entries(element) as [key, param]}
function create_each_block_3(ctx) {
let if_block_anchor;
let if_block = /*key*/ ctx[76] != "type" && /*key*/ ctx[76] != "subtype" && /*key*/ ctx[76] != "id" && /*key*/ ctx[76] != "widget" && /*key*/ ctx[76] != "page" && /*key*/ ctx[76] != "descr" && create_if_block_2(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 (/*key*/ ctx[76] != "type" && /*key*/ ctx[76] != "subtype" && /*key*/ ctx[76] != "id" && /*key*/ ctx[76] != "widget" && /*key*/ ctx[76] != "page" && /*key*/ ctx[76] != "descr") {
if (if_block) {
if_block.p(ctx, dirty);
} else {
if_block = create_if_block_2(ctx);
if_block.c();
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
},
d: function destroy(detaching) {
if (if_block) if_block.d(detaching);
if (detaching) detach_dev(if_block_anchor);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_each_block_3.name,
type: "each",
source: "(700:20) {#each Object.entries(element) as [key, param]}",
ctx
});
return block;
}
// (682:16) {#each configJson as element}
function create_each_block_2(ctx) {
let tr;
let td0;
let t0_value = /*element*/ ctx[73].subtype + "";
let t0;
let t1;
let td1;
let input0;
let t2;
let td2;
let select;
let t3;
let td3;
let input1;
let t4;
let td4;
let input2;
let t5;
let td5;
let svg0;
let path;
let circle0;
let circle1;
let circle2;
let t6;
let td6;
let svg1;
let line0;
let line1;
let t7;
let if_block_anchor;
let mounted;
let dispose;
function input0_input_handler() {
/*input0_input_handler*/ ctx[27].call(input0, /*each_value_2*/ ctx[74], /*element_index*/ ctx[75]);
}
let each_value_4 = /*widgetCollection*/ ctx[6];
validate_each_argument(each_value_4);
let each_blocks = [];
for (let i = 0; i < each_value_4.length; i += 1) {
each_blocks[i] = create_each_block_4(get_each_context_4(ctx, each_value_4, i));
}
function select_change_handler_1() {
/*select_change_handler_1*/ ctx[28].call(select, /*each_value_2*/ ctx[74], /*element_index*/ ctx[75]);
}
function input1_input_handler() {
/*input1_input_handler*/ ctx[29].call(input1, /*each_value_2*/ ctx[74], /*element_index*/ ctx[75]);
}
function input2_input_handler() {
/*input2_input_handler*/ ctx[30].call(input2, /*each_value_2*/ ctx[74], /*element_index*/ ctx[75]);
}
let if_block = !/*hideAllSubParams*/ ctx[2] && create_if_block_1(ctx);
const block = {
c: function create() {
tr = element("tr");
td0 = element("td");
t0 = text(t0_value);
t1 = space();
td1 = element("td");
input0 = element("input");
t2 = space();
td2 = element("td");
select = element("select");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
t3 = space();
td3 = element("td");
input1 = element("input");
t4 = space();
td4 = element("td");
input2 = element("input");
t5 = space();
td5 = element("td");
svg0 = svg_element("svg");
path = svg_element("path");
circle0 = svg_element("circle");
circle1 = svg_element("circle");
circle2 = svg_element("circle");
t6 = space();
td6 = element("td");
svg1 = svg_element("svg");
line0 = svg_element("line");
line1 = svg_element("line");
t7 = space();
if (if_block) if_block.c();
if_block_anchor = empty();
attr_dev(td0, "class", "tbl-bdy");
add_location(td0, file, 683, 20, 20630);
attr_dev(input0, "class", "tbl-ipt w-full");
attr_dev(input0, "type", "text");
add_location(input0, file, 684, 40, 20714);
attr_dev(td1, "class", "tbl-bdy");
add_location(td1, file, 684, 20, 20694);
attr_dev(select, "class", "tbl-ipt w-full");
if (/*element*/ ctx[73].widget === void 0) add_render_callback(select_change_handler_1);
add_location(select, file, 686, 23, 20853);
attr_dev(td2, "class", "tbl-bdy");
add_location(td2, file, 685, 20, 20809);
attr_dev(input1, "class", "tbl-ipt w-full");
attr_dev(input1, "type", "text");
add_location(input1, file, 693, 40, 21218);
attr_dev(td3, "class", "tbl-bdy");
add_location(td3, file, 693, 20, 21198);
attr_dev(input2, "class", "tbl-ipt w-full");
attr_dev(input2, "type", "text");
add_location(input2, file, 694, 40, 21335);
attr_dev(td4, "class", "tbl-bdy");
add_location(td4, file, 694, 20, 21315);
attr_dev(path, "stroke", "none");
attr_dev(path, "d", "M0 0h24v24H0z");
add_location(path, file, 695, 274, 21687);
attr_dev(circle0, "cx", "5");
attr_dev(circle0, "cy", "12");
attr_dev(circle0, "r", "1");
add_location(circle0, file, 695, 315, 21728);
attr_dev(circle1, "cx", "12");
attr_dev(circle1, "cy", "12");
attr_dev(circle1, "r", "1");
add_location(circle1, file, 695, 347, 21760);
attr_dev(circle2, "cx", "19");
attr_dev(circle2, "cy", "12");
attr_dev(circle2, "r", "1");
add_location(circle2, file, 695, 380, 21793);
attr_dev(svg0, "class", "h-6 w-6 text-green-400");
attr_dev(svg0, "width", "24");
attr_dev(svg0, "height", "24");
attr_dev(svg0, "viewBox", "0 0 24 24");
attr_dev(svg0, "stroke-width", "2");
attr_dev(svg0, "stroke", "currentColor");
attr_dev(svg0, "fill", "none");
attr_dev(svg0, "stroke-linecap", "round");
attr_dev(svg0, "stroke-linejoin", "round");
add_location(svg0, file, 695, 40, 21453);
attr_dev(td5, "class", "tbl-bdy");
add_location(td5, file, 695, 20, 21433);
attr_dev(line0, "x1", "18");
attr_dev(line0, "y1", "6");
attr_dev(line0, "x2", "6");
attr_dev(line0, "y2", "18");
add_location(line0, file, 696, 193, 22031);
attr_dev(line1, "x1", "6");
attr_dev(line1, "y1", "6");
attr_dev(line1, "x2", "18");
attr_dev(line1, "y2", "18");
add_location(line1, file, 696, 232, 22070);
attr_dev(svg1, "class", "h-6 w-6 text-red-400");
attr_dev(svg1, "viewBox", "0 0 24 24");
attr_dev(svg1, "fill", "none");
attr_dev(svg1, "stroke", "currentColor");
attr_dev(svg1, "stroke-width", "2");
attr_dev(svg1, "stroke-linecap", "round");
attr_dev(svg1, "stroke-linejoin", "round");
add_location(svg1, file, 696, 40, 21878);
attr_dev(td6, "class", "tbl-bdy");
add_location(td6, file, 696, 20, 21858);
attr_dev(tr, "class", "tbl-txt-sz tbl-txt-p");
add_location(tr, file, 682, 18, 20575);
},
m: function mount(target, anchor) {
insert_dev(target, tr, anchor);
append_dev(tr, td0);
append_dev(td0, t0);
append_dev(tr, t1);
append_dev(tr, td1);
append_dev(td1, input0);
set_input_value(input0, /*element*/ ctx[73].id);
append_dev(tr, t2);
append_dev(tr, td2);
append_dev(td2, select);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(select, null);
}
select_option(select, /*element*/ ctx[73].widget);
append_dev(tr, t3);
append_dev(tr, td3);
append_dev(td3, input1);
set_input_value(input1, /*element*/ ctx[73].page);
append_dev(tr, t4);
append_dev(tr, td4);
append_dev(td4, input2);
set_input_value(input2, /*element*/ ctx[73].descr);
append_dev(tr, t5);
append_dev(tr, td5);
append_dev(td5, svg0);
append_dev(svg0, path);
append_dev(svg0, circle0);
append_dev(svg0, circle1);
append_dev(svg0, circle2);
append_dev(tr, t6);
append_dev(tr, td6);
append_dev(td6, svg1);
append_dev(svg1, line0);
append_dev(svg1, line1);
insert_dev(target, t7, anchor);
if (if_block) if_block.m(target, anchor);
insert_dev(target, if_block_anchor, anchor);
if (!mounted) {
dispose = [
listen_dev(input0, "input", input0_input_handler),
listen_dev(select, "change", select_change_handler_1),
listen_dev(input1, "input", input1_input_handler),
listen_dev(input2, "input", input2_input_handler),
listen_dev(svg0, "click", /*click_handler*/ ctx[31], false, false, false)
];
mounted = true;
}
},
p: function update(new_ctx, dirty) {
ctx = new_ctx;
if (dirty[0] & /*configJson*/ 32 && t0_value !== (t0_value = /*element*/ ctx[73].subtype + "")) set_data_dev(t0, t0_value);
if (dirty[0] & /*configJson, widgetCollection*/ 96 && input0.value !== /*element*/ ctx[73].id) {
set_input_value(input0, /*element*/ ctx[73].id);
}
if (dirty[0] & /*widgetCollection*/ 64) {
each_value_4 = /*widgetCollection*/ ctx[6];
validate_each_argument(each_value_4);
let i;
for (i = 0; i < each_value_4.length; i += 1) {
const child_ctx = get_each_context_4(ctx, each_value_4, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block_4(child_ctx);
each_blocks[i].c();
each_blocks[i].m(select, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value_4.length;
}
if (dirty[0] & /*configJson, widgetCollection*/ 96) {
select_option(select, /*element*/ ctx[73].widget);
}
if (dirty[0] & /*configJson, widgetCollection*/ 96 && input1.value !== /*element*/ ctx[73].page) {
set_input_value(input1, /*element*/ ctx[73].page);
}
if (dirty[0] & /*configJson, widgetCollection*/ 96 && input2.value !== /*element*/ ctx[73].descr) {
set_input_value(input2, /*element*/ ctx[73].descr);
}
if (!/*hideAllSubParams*/ ctx[2]) {
if (if_block) {
if_block.p(ctx, dirty);
} else {
if_block = create_if_block_1(ctx);
if_block.c();
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
},
d: function destroy(detaching) {
if (detaching) detach_dev(tr);
destroy_each(each_blocks, detaching);
if (detaching) detach_dev(t7);
if (if_block) if_block.d(detaching);
if (detaching) detach_dev(if_block_anchor);
mounted = false;
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_each_block_2.name,
type: "each",
source: "(682:16) {#each configJson as element}",
ctx
});
return block;
}
// (666:10) <Card>
function create_default_slot_9(ctx) {
let table;
let thead;
let tr;
let th0;
let t1;
let th1;
let t3;
let th2;
let t5;
let th3;
let t7;
let th4;
let t9;
let th5;
let t10;
let th6;
let t11;
let tbody;
let t12;
let button;
let mounted;
let dispose;
let each_value_2 = /*configJson*/ ctx[5];
validate_each_argument(each_value_2);
let each_blocks = [];
for (let i = 0; i < each_value_2.length; i += 1) {
each_blocks[i] = create_each_block_2(get_each_context_2(ctx, each_value_2, i));
}
const block = {
c: function create() {
table = element("table");
thead = element("thead");
tr = element("tr");
th0 = element("th");
th0.textContent = "Тип";
t1 = space();
th1 = element("th");
th1.textContent = "Id";
t3 = space();
th2 = element("th");
th2.textContent = "Виджет";
t5 = space();
th3 = element("th");
th3.textContent = "Вкладка";
t7 = space();
th4 = element("th");
th4.textContent = "Название";
t9 = space();
th5 = element("th");
t10 = space();
th6 = element("th");
t11 = space();
tbody = element("tbody");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
t12 = space();
button = element("button");
button.textContent = `${"Сохранить"}`;
attr_dev(th0, "class", "tbl-hd");
add_location(th0, file, 671, 18, 20105);
attr_dev(th1, "class", "tbl-hd");
add_location(th1, file, 672, 18, 20152);
attr_dev(th2, "class", "tbl-hd");
add_location(th2, file, 673, 18, 20198);
attr_dev(th3, "class", "tbl-hd");
add_location(th3, file, 674, 18, 20248);
attr_dev(th4, "class", "tbl-hd");
add_location(th4, file, 675, 18, 20299);
attr_dev(th5, "class", "tbl-hd w-7");
add_location(th5, file, 676, 18, 20351);
attr_dev(th6, "class", "tbl-hd w-7");
add_location(th6, file, 677, 18, 20396);
attr_dev(tr, "class", "tbl-txt-sz tbl-txt-p");
add_location(tr, file, 670, 16, 20052);
attr_dev(thead, "class", "bg-gray-50");
add_location(thead, file, 669, 14, 20008);
attr_dev(tbody, "class", "bg-white");
add_location(tbody, file, 680, 14, 20484);
attr_dev(table, "class", "table-fixed w-full");
add_location(table, file, 668, 12, 19958);
attr_dev(button, "class", "btn-lg");
add_location(button, file, 719, 12, 23134);
},
m: function mount(target, anchor) {
insert_dev(target, table, anchor);
append_dev(table, thead);
append_dev(thead, tr);
append_dev(tr, th0);
append_dev(tr, t1);
append_dev(tr, th1);
append_dev(tr, t3);
append_dev(tr, th2);
append_dev(tr, t5);
append_dev(tr, th3);
append_dev(tr, t7);
append_dev(tr, th4);
append_dev(tr, t9);
append_dev(tr, th5);
append_dev(tr, t10);
append_dev(tr, th6);
append_dev(table, t11);
append_dev(table, tbody);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(tbody, null);
}
insert_dev(target, t12, anchor);
insert_dev(target, button, anchor);
if (!mounted) {
dispose = listen_dev(button, "click", /*click_handler_1*/ ctx[33], false, false, false);
mounted = true;
}
},
p: function update(ctx, dirty) {
if (dirty[0] & /*configJson, hideAllSubParams, widgetCollection*/ 100) {
each_value_2 = /*configJson*/ ctx[5];
validate_each_argument(each_value_2);
let i;
for (i = 0; i < each_value_2.length; i += 1) {
const child_ctx = get_each_context_2(ctx, each_value_2, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block_2(child_ctx);
each_blocks[i].c();
each_blocks[i].m(tbody, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value_2.length;
}
},
d: function destroy(detaching) {
if (detaching) detach_dev(table);
destroy_each(each_blocks, detaching);
if (detaching) detach_dev(t12);
if (detaching) detach_dev(button);
mounted = false;
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_default_slot_9.name,
type: "slot",
source: "(666:10) <Card>",
ctx
});
return block;
}
// (664:6) <Route path="/config">
function create_default_slot_8(ctx) {
let div;
let card;
let current;
card = new Card({
props: {
$$slots: { default: [create_default_slot_9] },
$$scope: { ctx }
},
$$inline: true
});
const block = {
c: function create() {
div = element("div");
create_component(card.$$.fragment);
attr_dev(div, "class", "crd-grd-ln");
add_location(div, file, 664, 8, 19755);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
mount_component(card, div, null);
current = true;
},
p: function update(ctx, dirty) {
const card_changes = {};
if (dirty[0] & /*configJson, hideAllSubParams, widgetCollection*/ 100 | dirty[2] & /*$$scope*/ 67108864) {
card_changes.$$scope = { dirty, ctx };
}
card.$set(card_changes);
},
i: function intro(local) {
if (current) return;
transition_in(card.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(card.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) detach_dev(div);
destroy_component(card);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_default_slot_8.name,
type: "slot",
source: "(664:6) <Route path=\\\"/config\\\">",
ctx
});
return block;
}
// (724:6) <Route path="/connection">
function create_default_slot_7(ctx) {
let div;
let card0;
let t;
let card1;
let current;
card0 = new Card({
props: { title: "Подключение к WiFi роутеру" },
$$inline: true
});
card1 = new Card({
props: { title: "Подключение к MQTT брокеру" },
$$inline: true
});
const block = {
c: function create() {
div = element("div");
create_component(card0.$$.fragment);
t = space();
create_component(card1.$$.fragment);
attr_dev(div, "class", "crd-grd");
add_location(div, file, 724, 8, 23308);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
mount_component(card0, div, null);
append_dev(div, t);
mount_component(card1, div, null);
current = true;
},
p: noop,
i: function intro(local) {
if (current) return;
transition_in(card0.$$.fragment, local);
transition_in(card1.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(card0.$$.fragment, local);
transition_out(card1.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) detach_dev(div);
destroy_component(card0);
destroy_component(card1);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_default_slot_7.name,
type: "slot",
source: "(724:6) <Route path=\\\"/connection\\\">",
ctx
});
return block;
}
// (731:8) <Card title={"Пример графика"}>
function create_default_slot_6(ctx) {
let chart;
let current;
chart = new Base$1({
props: {
data: /*datachart*/ ctx[12],
type: "line"
},
$$inline: true
});
const block = {
c: function create() {
create_component(chart.$$.fragment);
},
m: function mount(target, anchor) {
mount_component(chart, target, anchor);
current = true;
},
p: noop,
i: function intro(local) {
if (current) return;
transition_in(chart.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(chart.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(chart, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_default_slot_6.name,
type: "slot",
source: "(731:8) <Card title={\\\"Пример графика\\\"}>",
ctx
});
return block;
}
// (730:6) <Route path="/utilities">
function create_default_slot_5(ctx) {
let card;
let current;
card = new Card({
props: {
title: "Пример графика",
$$slots: { default: [create_default_slot_6] },
$$scope: { ctx }
},
$$inline: true
});
const block = {
c: function create() {
create_component(card.$$.fragment);
},
m: function mount(target, anchor) {
mount_component(card, target, anchor);
current = true;
},
p: function update(ctx, dirty) {
const card_changes = {};
if (dirty[2] & /*$$scope*/ 67108864) {
card_changes.$$scope = { dirty, ctx };
}
card.$set(card_changes);
},
i: function intro(local) {
if (current) return;
transition_in(card.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(card.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(card, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_default_slot_5.name,
type: "slot",
source: "(730:6) <Route path=\\\"/utilities\\\">",
ctx
});
return block;
}
// (737:10) {#each coreMessages as message, i}
function create_each_block_1(ctx) {
let div;
let t_value = /*message*/ ctx[70].msg + "";
let t;
let div_class_value;
const block = {
c: function create() {
div = element("div");
t = text(t_value);
attr_dev(div, "class", div_class_value = /*message*/ ctx[70].msg.toString().includes("[E]")
? "text-red-500"
: "text-black");
add_location(div, file, 737, 12, 23745);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
append_dev(div, t);
},
p: function update(ctx, dirty) {
if (dirty[0] & /*coreMessages*/ 2048 && t_value !== (t_value = /*message*/ ctx[70].msg + "")) set_data_dev(t, t_value);
if (dirty[0] & /*coreMessages*/ 2048 && div_class_value !== (div_class_value = /*message*/ ctx[70].msg.toString().includes("[E]")
? "text-red-500"
: "text-black")) {
attr_dev(div, "class", div_class_value);
}
},
d: function destroy(detaching) {
if (detaching) detach_dev(div);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_each_block_1.name,
type: "each",
source: "(737:10) {#each coreMessages as message, i}",
ctx
});
return block;
}
// (736:8) <Card title={"Лог"}>
function create_default_slot_4(ctx) {
let each_1_anchor;
let each_value_1 = /*coreMessages*/ ctx[11];
validate_each_argument(each_value_1);
let each_blocks = [];
for (let i = 0; i < each_value_1.length; i += 1) {
each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i));
}
const block = {
c: function create() {
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
each_1_anchor = empty();
},
m: function mount(target, anchor) {
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(target, anchor);
}
insert_dev(target, each_1_anchor, anchor);
},
p: function update(ctx, dirty) {
if (dirty[0] & /*coreMessages*/ 2048) {
each_value_1 = /*coreMessages*/ ctx[11];
validate_each_argument(each_value_1);
let i;
for (i = 0; i < each_value_1.length; i += 1) {
const child_ctx = get_each_context_1(ctx, each_value_1, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block_1(child_ctx);
each_blocks[i].c();
each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value_1.length;
}
},
d: function destroy(detaching) {
destroy_each(each_blocks, detaching);
if (detaching) detach_dev(each_1_anchor);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_default_slot_4.name,
type: "slot",
source: "(736:8) <Card title={\\\"Лог\\\"}>",
ctx
});
return block;
}
// (735:6) <Route path="/log">
function create_default_slot_3(ctx) {
let card;
let current;
card = new Card({
props: {
title: "Лог",
$$slots: { default: [create_default_slot_4] },
$$scope: { ctx }
},
$$inline: true
});
const block = {
c: function create() {
create_component(card.$$.fragment);
},
m: function mount(target, anchor) {
mount_component(card, target, anchor);
current = true;
},
p: function update(ctx, dirty) {
const card_changes = {};
if (dirty[0] & /*coreMessages*/ 2048 | dirty[2] & /*$$scope*/ 67108864) {
card_changes.$$scope = { dirty, ctx };
}
card.$set(card_changes);
},
i: function intro(local) {
if (current) return;
transition_in(card.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(card.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(card, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_default_slot_3.name,
type: "slot",
source: "(735:6) <Route path=\\\"/log\\\">",
ctx
});
return block;
}
// (754:14) {#each deviceList as device}
function create_each_block(ctx) {
let tr;
let td0;
let t0_value = /*device*/ ctx[67].name + "";
let t0;
let t1;
let td1;
let a;
let t2_value = /*device*/ ctx[67].ip + "";
let t2;
let a_href_value;
let t3;
let td2;
let t4_value = /*device*/ ctx[67].id + "";
let t4;
let t5;
let td3;
let t6_value = (/*device*/ ctx[67].status ? "online" : "offline") + "";
let t6;
let td3_class_value;
const block = {
c: function create() {
tr = element("tr");
td0 = element("td");
t0 = text(t0_value);
t1 = space();
td1 = element("td");
a = element("a");
t2 = text(t2_value);
t3 = space();
td2 = element("td");
t4 = text(t4_value);
t5 = space();
td3 = element("td");
t6 = text(t6_value);
attr_dev(td0, "class", "tbl-bdy");
add_location(td0, file, 755, 18, 24520);
attr_dev(a, "href", a_href_value = "http://" + /*device*/ ctx[67].ip);
add_location(a, file, 756, 38, 24598);
attr_dev(td1, "class", "tbl-bdy");
add_location(td1, file, 756, 18, 24578);
attr_dev(td2, "class", "tbl-bdy");
add_location(td2, file, 757, 18, 24670);
attr_dev(td3, "class", td3_class_value = "tbl-bdy " + (/*device*/ ctx[67].status ? 'bg-green-50' : 'bg-red-50'));
add_location(td3, file, 758, 18, 24726);
attr_dev(tr, "class", "tbl-txt-sz tbl-txt-p");
add_location(tr, file, 754, 16, 24467);
},
m: function mount(target, anchor) {
insert_dev(target, tr, anchor);
append_dev(tr, td0);
append_dev(td0, t0);
append_dev(tr, t1);
append_dev(tr, td1);
append_dev(td1, a);
append_dev(a, t2);
append_dev(tr, t3);
append_dev(tr, td2);
append_dev(td2, t4);
append_dev(tr, t5);
append_dev(tr, td3);
append_dev(td3, t6);
},
p: function update(ctx, dirty) {
if (dirty[0] & /*deviceList*/ 512 && t0_value !== (t0_value = /*device*/ ctx[67].name + "")) set_data_dev(t0, t0_value);
if (dirty[0] & /*deviceList*/ 512 && t2_value !== (t2_value = /*device*/ ctx[67].ip + "")) set_data_dev(t2, t2_value);
if (dirty[0] & /*deviceList*/ 512 && a_href_value !== (a_href_value = "http://" + /*device*/ ctx[67].ip)) {
attr_dev(a, "href", a_href_value);
}
if (dirty[0] & /*deviceList*/ 512 && t4_value !== (t4_value = /*device*/ ctx[67].id + "")) set_data_dev(t4, t4_value);
if (dirty[0] & /*deviceList*/ 512 && t6_value !== (t6_value = (/*device*/ ctx[67].status ? "online" : "offline") + "")) set_data_dev(t6, t6_value);
if (dirty[0] & /*deviceList*/ 512 && td3_class_value !== (td3_class_value = "tbl-bdy " + (/*device*/ ctx[67].status ? 'bg-green-50' : 'bg-red-50'))) {
attr_dev(td3, "class", td3_class_value);
}
},
d: function destroy(detaching) {
if (detaching) detach_dev(tr);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_each_block.name,
type: "each",
source: "(754:14) {#each deviceList as device}",
ctx
});
return block;
}
// (762:14) {#if showInput}
function create_if_block(ctx) {
let tr;
let td0;
let input0;
let t0;
let td1;
let input1;
let t1;
let td2;
let input2;
let t2;
let td3;
let mounted;
let dispose;
const block = {
c: function create() {
tr = element("tr");
td0 = element("td");
input0 = element("input");
t0 = space();
td1 = element("td");
input1 = element("input");
t1 = space();
td2 = element("td");
input2 = element("input");
t2 = space();
td3 = element("td");
attr_dev(input0, "class", "tbl-ipt w-full");
attr_dev(input0, "type", "text");
add_location(input0, file, 763, 38, 25003);
attr_dev(td0, "class", "tbl-bdy");
add_location(td0, file, 763, 18, 24983);
attr_dev(input1, "class", "tbl-ipt w-full");
attr_dev(input1, "type", "text");
add_location(input1, file, 764, 38, 25120);
attr_dev(td1, "class", "tbl-bdy");
add_location(td1, file, 764, 18, 25100);
attr_dev(input2, "class", "tbl-ipt w-full");
attr_dev(input2, "type", "text");
add_location(input2, file, 765, 38, 25235);
attr_dev(td2, "class", "tbl-bdy");
add_location(td2, file, 765, 18, 25215);
attr_dev(td3, "class", "tbl-bdy");
add_location(td3, file, 766, 18, 25330);
attr_dev(tr, "class", "tbl-txt-sz tbl-txt-p");
add_location(tr, file, 762, 16, 24930);
},
m: function mount(target, anchor) {
insert_dev(target, tr, anchor);
append_dev(tr, td0);
append_dev(td0, input0);
set_input_value(input0, /*newDevice*/ ctx[10].name);
append_dev(tr, t0);
append_dev(tr, td1);
append_dev(td1, input1);
set_input_value(input1, /*newDevice*/ ctx[10].ip);
append_dev(tr, t1);
append_dev(tr, td2);
append_dev(td2, input2);
set_input_value(input2, /*newDevice*/ ctx[10].id);
append_dev(tr, t2);
append_dev(tr, td3);
if (!mounted) {
dispose = [
listen_dev(input0, "input", /*input0_input_handler_1*/ ctx[34]),
listen_dev(input1, "input", /*input1_input_handler_1*/ ctx[35]),
listen_dev(input2, "input", /*input2_input_handler_1*/ ctx[36])
];
mounted = true;
}
},
p: function update(ctx, dirty) {
if (dirty[0] & /*newDevice*/ 1024 && input0.value !== /*newDevice*/ ctx[10].name) {
set_input_value(input0, /*newDevice*/ ctx[10].name);
}
if (dirty[0] & /*newDevice*/ 1024 && input1.value !== /*newDevice*/ ctx[10].ip) {
set_input_value(input1, /*newDevice*/ ctx[10].ip);
}
if (dirty[0] & /*newDevice*/ 1024 && input2.value !== /*newDevice*/ ctx[10].id) {
set_input_value(input2, /*newDevice*/ ctx[10].id);
}
},
d: function destroy(detaching) {
if (detaching) detach_dev(tr);
mounted = false;
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_if_block.name,
type: "if",
source: "(762:14) {#if showInput}",
ctx
});
return block;
}
// (743:8) <Card title={"Список устройств"}>
function create_default_slot_2(ctx) {
let table;
let thead;
let tr;
let th0;
let t1;
let th1;
let t3;
let th2;
let t5;
let th3;
let t7;
let tbody;
let t8;
let t9;
let button;
let t10_value = (/*showInput*/ ctx[0]
? "Сохранить"
: "Добавить устройство") + "";
let t10;
let mounted;
let dispose;
let each_value = /*deviceList*/ ctx[9];
validate_each_argument(each_value);
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
}
let if_block = /*showInput*/ ctx[0] && create_if_block(ctx);
const block = {
c: function create() {
table = element("table");
thead = element("thead");
tr = element("tr");
th0 = element("th");
th0.textContent = "Название устройства";
t1 = space();
th1 = element("th");
th1.textContent = "IP адрес";
t3 = space();
th2 = element("th");
th2.textContent = "Идентификатор";
t5 = space();
th3 = element("th");
th3.textContent = "Состояние";
t7 = space();
tbody = element("tbody");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
t8 = space();
if (if_block) if_block.c();
t9 = space();
button = element("button");
t10 = text(t10_value);
attr_dev(th0, "class", "tbl-hd");
add_location(th0, file, 746, 16, 24125);
attr_dev(th1, "class", "tbl-hd");
add_location(th1, file, 747, 16, 24186);
attr_dev(th2, "class", "tbl-hd");
add_location(th2, file, 748, 16, 24236);
attr_dev(th3, "class", "tbl-hd");
add_location(th3, file, 749, 16, 24291);
attr_dev(tr, "class", "tbl-txt-sz tbl-txt-p");
add_location(tr, file, 745, 14, 24074);
attr_dev(thead, "class", "bg-gray-50 ");
add_location(thead, file, 744, 12, 24031);
attr_dev(tbody, "class", "bg-white");
add_location(tbody, file, 752, 12, 24381);
attr_dev(table, "class", "table-fixed w-full");
add_location(table, file, 743, 10, 23983);
attr_dev(button, "class", "btn-lg");
add_location(button, file, 771, 10, 25450);
},
m: function mount(target, anchor) {
insert_dev(target, table, anchor);
append_dev(table, thead);
append_dev(thead, tr);
append_dev(tr, th0);
append_dev(tr, t1);
append_dev(tr, th1);
append_dev(tr, t3);
append_dev(tr, th2);
append_dev(tr, t5);
append_dev(tr, th3);
append_dev(table, t7);
append_dev(table, tbody);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(tbody, null);
}
append_dev(tbody, t8);
if (if_block) if_block.m(tbody, null);
insert_dev(target, t9, anchor);
insert_dev(target, button, anchor);
append_dev(button, t10);
if (!mounted) {
dispose = listen_dev(button, "click", /*click_handler_2*/ ctx[37], false, false, false);
mounted = true;
}
},
p: function update(ctx, dirty) {
if (dirty[0] & /*deviceList*/ 512) {
each_value = /*deviceList*/ ctx[9];
validate_each_argument(each_value);
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context(ctx, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block(child_ctx);
each_blocks[i].c();
each_blocks[i].m(tbody, t8);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value.length;
}
if (/*showInput*/ ctx[0]) {
if (if_block) {
if_block.p(ctx, dirty);
} else {
if_block = create_if_block(ctx);
if_block.c();
if_block.m(tbody, null);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
if (dirty[0] & /*showInput*/ 1 && t10_value !== (t10_value = (/*showInput*/ ctx[0]
? "Сохранить"
: "Добавить устройство") + "")) set_data_dev(t10, t10_value);
},
d: function destroy(detaching) {
if (detaching) detach_dev(table);
destroy_each(each_blocks, detaching);
if (if_block) if_block.d();
if (detaching) detach_dev(t9);
if (detaching) detach_dev(button);
mounted = false;
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_default_slot_2.name,
type: "slot",
source: "(743:8) <Card title={\\\"Список устройств\\\"}>",
ctx
});
return block;
}
// (742:6) <Route path="/list">
function create_default_slot_1(ctx) {
let card;
let current;
card = new Card({
props: {
title: "Список устройств",
$$slots: { default: [create_default_slot_2] },
$$scope: { ctx }
},
$$inline: true
});
const block = {
c: function create() {
create_component(card.$$.fragment);
},
m: function mount(target, anchor) {
mount_component(card, target, anchor);
current = true;
},
p: function update(ctx, dirty) {
const card_changes = {};
if (dirty[0] & /*showInput, newDevice, deviceList*/ 1537 | dirty[2] & /*$$scope*/ 67108864) {
card_changes.$$scope = { dirty, ctx };
}
card.$set(card_changes);
},
i: function intro(local) {
if (current) return;
transition_in(card.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(card.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(card, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_default_slot_1.name,
type: "slot",
source: "(742:6) <Route path=\\\"/list\\\">",
ctx
});
return block;
}
// (775:6) <Route path="/about">
function create_default_slot(ctx) {
let button;
let mounted;
let dispose;
const block = {
c: function create() {
button = element("button");
button.textContent = "Toggle modal";
attr_dev(button, "type", "button");
add_location(button, file, 775, 8, 25662);
},
m: function mount(target, anchor) {
insert_dev(target, button, anchor);
if (!mounted) {
dispose = listen_dev(button, "click", /*click_handler_3*/ ctx[38], false, false, false);
mounted = true;
}
},
p: noop,
d: function destroy(detaching) {
if (detaching) detach_dev(button);
mounted = false;
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_default_slot.name,
type: "slot",
source: "(775:6) <Route path=\\\"/about\\\">",
ctx
});
return block;
}
function create_fragment(ctx) {
let main;
let modal;
let t0;
let div3;
let div2;
let div0;
let select;
let t1;
let div1;
let svg;
let path0;
let path1;
let svg_class_value;
let t2;
let input;
let t3;
let label;
let span;
let t4;
let ul0;
let li0;
let a0;
let t6;
let li1;
let a1;
let t8;
let li2;
let a2;
let t10;
let li3;
let a3;
let t12;
let li4;
let a4;
let t14;
let li5;
let a5;
let t16;
let li6;
let a6;
let t18;
let ul1;
let div4;
let route0;
let t19;
let route1;
let t20;
let route2;
let t21;
let route3;
let t22;
let route4;
let t23;
let route5;
let t24;
let route6;
let current;
let mounted;
let dispose;
modal = new Modal({
props: { show: /*showModalFlag*/ ctx[1] },
$$inline: true
});
let each_value_7 = /*deviceList*/ ctx[9];
validate_each_argument(each_value_7);
let each_blocks = [];
for (let i = 0; i < each_value_7.length; i += 1) {
each_blocks[i] = create_each_block_7(get_each_context_7(ctx, each_value_7, i));
}
route0 = new Route({
props: {
path: "/",
$$slots: { default: [create_default_slot_10] },
$$scope: { ctx }
},
$$inline: true
});
route1 = new Route({
props: {
path: "/config",
$$slots: { default: [create_default_slot_8] },
$$scope: { ctx }
},
$$inline: true
});
route2 = new Route({
props: {
path: "/connection",
$$slots: { default: [create_default_slot_7] },
$$scope: { ctx }
},
$$inline: true
});
route3 = new Route({
props: {
path: "/utilities",
$$slots: { default: [create_default_slot_5] },
$$scope: { ctx }
},
$$inline: true
});
route4 = new Route({
props: {
path: "/log",
$$slots: { default: [create_default_slot_3] },
$$scope: { ctx }
},
$$inline: true
});
route5 = new Route({
props: {
path: "/list",
$$slots: { default: [create_default_slot_1] },
$$scope: { ctx }
},
$$inline: true
});
route6 = new Route({
props: {
path: "/about",
$$slots: { default: [create_default_slot] },
$$scope: { ctx }
},
$$inline: true
});
const block = {
c: function create() {
main = element("main");
create_component(modal.$$.fragment);
t0 = space();
div3 = element("div");
div2 = element("div");
div0 = element("div");
select = element("select");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
t1 = space();
div1 = element("div");
svg = svg_element("svg");
path0 = svg_element("path");
path1 = svg_element("path");
t2 = space();
input = element("input");
t3 = space();
label = element("label");
span = element("span");
t4 = space();
ul0 = element("ul");
li0 = element("li");
a0 = element("a");
a0.textContent = `${"Управление"}`;
t6 = space();
li1 = element("li");
a1 = element("a");
a1.textContent = `${"Конфигуратор"}`;
t8 = space();
li2 = element("li");
a2 = element("a");
a2.textContent = `${"Подключение"}`;
t10 = space();
li3 = element("li");
a3 = element("a");
a3.textContent = `${"Утилиты"}`;
t12 = space();
li4 = element("li");
a4 = element("a");
a4.textContent = `${"Лог"}`;
t14 = space();
li5 = element("li");
a5 = element("a");
a5.textContent = `${"Устройства"}`;
t16 = space();
li6 = element("li");
a6 = element("a");
a6.textContent = `${"О проекте"}`;
t18 = space();
ul1 = element("ul");
div4 = element("div");
create_component(route0.$$.fragment);
t19 = space();
create_component(route1.$$.fragment);
t20 = space();
create_component(route2.$$.fragment);
t21 = space();
create_component(route3.$$.fragment);
t22 = space();
create_component(route4.$$.fragment);
t23 = space();
create_component(route5.$$.fragment);
t24 = space();
create_component(route6.$$.fragment);
if (/*selectedDeviceData*/ ctx[8] === void 0) add_render_callback(() => /*select_change_handler*/ ctx[20].call(select));
add_location(select, file, 593, 8, 17088);
attr_dev(div0, "class", "px-15 py-2");
add_location(div0, file, 592, 6, 17054);
attr_dev(path0, "stroke", "none");
attr_dev(path0, "d", "M0 0h24v24H0z");
add_location(path0, file, 602, 234, 17611);
attr_dev(path1, "d", "M7 18a4.6 4.4 0 0 1 0 -9h0a5 4.5 0 0 1 11 2h1a3.5 3.5 0 0 1 0 7h-12");
add_location(path1, file, 602, 275, 17652);
attr_dev(svg, "class", svg_class_value = "h-8 w-8 " + (/*socketConnected*/ ctx[7] === true
? 'text-green-500'
: 'text-red-500'));
attr_dev(svg, "width", "24");
attr_dev(svg, "height", "24");
attr_dev(svg, "viewBox", "0 0 24 24");
attr_dev(svg, "stroke-width", "2");
attr_dev(svg, "stroke", "currentColor");
attr_dev(svg, "fill", "none");
attr_dev(svg, "stroke-linecap", "round");
attr_dev(svg, "stroke-linejoin", "round");
add_location(svg, file, 602, 8, 17385);
attr_dev(div1, "class", "px-5 py-1");
add_location(div1, file, 601, 6, 17352);
attr_dev(div2, "class", "flex justify-end content-center");
add_location(div2, file, 591, 4, 17001);
attr_dev(div3, "class", "fixed m-0 h-10 w-full bg-gray-100 shadow-md");
add_location(div3, file, 590, 2, 16938);
attr_dev(input, "id", "menu__toggle");
attr_dev(input, "type", "checkbox");
add_location(input, file, 607, 2, 17780);
add_location(span, file, 609, 4, 17877);
attr_dev(label, "class", "menu__btn");
attr_dev(label, "for", "menu__toggle");
add_location(label, file, 608, 2, 17827);
attr_dev(a0, "class", "menu__item");
attr_dev(a0, "href", "/");
add_location(a0, file, 614, 6, 17943);
add_location(li0, file, 613, 4, 17931);
attr_dev(a1, "class", "menu__item");
attr_dev(a1, "href", "/config");
add_location(a1, file, 617, 6, 18021);
add_location(li1, file, 616, 4, 18009);
attr_dev(a2, "class", "menu__item");
attr_dev(a2, "href", "/connection");
add_location(a2, file, 620, 6, 18107);
add_location(li2, file, 619, 4, 18095);
attr_dev(a3, "class", "menu__item");
attr_dev(a3, "href", "/utilities");
add_location(a3, file, 623, 6, 18196);
add_location(li3, file, 622, 4, 18184);
attr_dev(a4, "class", "menu__item");
attr_dev(a4, "href", "/log");
add_location(a4, file, 626, 6, 18280);
add_location(li4, file, 625, 4, 18268);
attr_dev(a5, "class", "menu__item");
attr_dev(a5, "href", "/list");
add_location(a5, file, 629, 6, 18354);
add_location(li5, file, 628, 4, 18342);
attr_dev(a6, "class", "menu__item");
attr_dev(a6, "href", "/about");
add_location(a6, file, 632, 6, 18436);
add_location(li6, file, 631, 4, 18424);
attr_dev(ul0, "class", "menu__box");
add_location(ul0, file, 612, 2, 17903);
attr_dev(div4, "class", "bg-cover pt-8 px-4");
add_location(div4, file, 637, 4, 18544);
attr_dev(ul1, "class", "menu__main");
add_location(ul1, file, 636, 2, 18515);
add_location(main, file, 588, 0, 16894);
},
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);
mount_component(modal, main, null);
append_dev(main, t0);
append_dev(main, div3);
append_dev(div3, div2);
append_dev(div2, div0);
append_dev(div0, select);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(select, null);
}
select_option(select, /*selectedDeviceData*/ ctx[8]);
append_dev(div2, t1);
append_dev(div2, div1);
append_dev(div1, svg);
append_dev(svg, path0);
append_dev(svg, path1);
append_dev(main, t2);
append_dev(main, input);
append_dev(main, t3);
append_dev(main, label);
append_dev(label, span);
append_dev(main, t4);
append_dev(main, ul0);
append_dev(ul0, li0);
append_dev(li0, a0);
append_dev(ul0, t6);
append_dev(ul0, li1);
append_dev(li1, a1);
append_dev(ul0, t8);
append_dev(ul0, li2);
append_dev(li2, a2);
append_dev(ul0, t10);
append_dev(ul0, li3);
append_dev(li3, a3);
append_dev(ul0, t12);
append_dev(ul0, li4);
append_dev(li4, a4);
append_dev(ul0, t14);
append_dev(ul0, li5);
append_dev(li5, a5);
append_dev(ul0, t16);
append_dev(ul0, li6);
append_dev(li6, a6);
append_dev(main, t18);
append_dev(main, ul1);
append_dev(ul1, div4);
mount_component(route0, div4, null);
append_dev(div4, t19);
mount_component(route1, div4, null);
append_dev(div4, t20);
mount_component(route2, div4, null);
append_dev(div4, t21);
mount_component(route3, div4, null);
append_dev(div4, t22);
mount_component(route4, div4, null);
append_dev(div4, t23);
mount_component(route5, div4, null);
append_dev(div4, t24);
mount_component(route6, div4, null);
current = true;
if (!mounted) {
dispose = [
listen_dev(select, "change", /*select_change_handler*/ ctx[20]),
listen_dev(select, "change", /*change_handler*/ ctx[21], false, false, false)
];
mounted = true;
}
},
p: function update(ctx, dirty) {
const modal_changes = {};
if (dirty[0] & /*showModalFlag*/ 2) modal_changes.show = /*showModalFlag*/ ctx[1];
modal.$set(modal_changes);
if (dirty[0] & /*deviceList*/ 512) {
each_value_7 = /*deviceList*/ ctx[9];
validate_each_argument(each_value_7);
let i;
for (i = 0; i < each_value_7.length; i += 1) {
const child_ctx = get_each_context_7(ctx, each_value_7, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block_7(child_ctx);
each_blocks[i].c();
each_blocks[i].m(select, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value_7.length;
}
if (dirty[0] & /*selectedDeviceData, deviceList*/ 768) {
select_option(select, /*selectedDeviceData*/ ctx[8]);
}
if (!current || dirty[0] & /*socketConnected*/ 128 && svg_class_value !== (svg_class_value = "h-8 w-8 " + (/*socketConnected*/ ctx[7] === true
? 'text-green-500'
: 'text-red-500'))) {
attr_dev(svg, "class", svg_class_value);
}
const route0_changes = {};
if (dirty[0] & /*wigets, pages*/ 24 | dirty[2] & /*$$scope*/ 67108864) {
route0_changes.$$scope = { dirty, ctx };
}
route0.$set(route0_changes);
const route1_changes = {};
if (dirty[0] & /*configJson, hideAllSubParams, widgetCollection*/ 100 | dirty[2] & /*$$scope*/ 67108864) {
route1_changes.$$scope = { dirty, ctx };
}
route1.$set(route1_changes);
const route2_changes = {};
if (dirty[2] & /*$$scope*/ 67108864) {
route2_changes.$$scope = { dirty, ctx };
}
route2.$set(route2_changes);
const route3_changes = {};
if (dirty[2] & /*$$scope*/ 67108864) {
route3_changes.$$scope = { dirty, ctx };
}
route3.$set(route3_changes);
const route4_changes = {};
if (dirty[0] & /*coreMessages*/ 2048 | dirty[2] & /*$$scope*/ 67108864) {
route4_changes.$$scope = { dirty, ctx };
}
route4.$set(route4_changes);
const route5_changes = {};
if (dirty[0] & /*showInput, newDevice, deviceList*/ 1537 | dirty[2] & /*$$scope*/ 67108864) {
route5_changes.$$scope = { dirty, ctx };
}
route5.$set(route5_changes);
const route6_changes = {};
if (dirty[2] & /*$$scope*/ 67108864) {
route6_changes.$$scope = { dirty, ctx };
}
route6.$set(route6_changes);
},
i: function intro(local) {
if (current) return;
transition_in(modal.$$.fragment, local);
transition_in(route0.$$.fragment, local);
transition_in(route1.$$.fragment, local);
transition_in(route2.$$.fragment, local);
transition_in(route3.$$.fragment, local);
transition_in(route4.$$.fragment, local);
transition_in(route5.$$.fragment, local);
transition_in(route6.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(modal.$$.fragment, local);
transition_out(route0.$$.fragment, local);
transition_out(route1.$$.fragment, local);
transition_out(route2.$$.fragment, local);
transition_out(route3.$$.fragment, local);
transition_out(route4.$$.fragment, local);
transition_out(route5.$$.fragment, local);
transition_out(route6.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) detach_dev(main);
destroy_component(modal);
destroy_each(each_blocks, detaching);
destroy_component(route0);
destroy_component(route1);
destroy_component(route2);
destroy_component(route3);
destroy_component(route4);
destroy_component(route5);
destroy_component(route6);
mounted = false;
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_fragment.name,
type: "component",
source: "",
ctx
});
return block;
}
function getJsonObject(array, number) {
let num = 0;
let out = {};
array.forEach(object => {
if (num === number) {
out = object;
}
num++;
});
return out;
}
function IsJsonParse(str) {
try {
JSON.parse(str);
} catch(e) {
return false;
}
return true;
}
async function handleSubmit(url) {
try {
console.log(url);
let res = await fetch(url, { mode: "no-cors", method: "GET" });
if (res.ok) {
console.log("OK", res.status);
} else {
console.log("error", res.status); //console.log(url);
} //console.log(url);
} catch(e) {
console.log(e);
}
}
async function getRequestJson(url) {
let res = await fetch(url, { mode: "no-cors", method: "GET" });
if (res.ok) {
configSetupJson = await res.json();
} else {
console.log("error", res.status);
}
}
function instance($$self, $$props, $$invalidate) {
let $router;
validate_store(f, 'router');
component_subscribe($$self, f, $$value => $$invalidate(46, $router = $$value));
let { $$slots: slots = {}, $$scope } = $$props;
validate_slots('App', slots, []);
f.mode.hash(); // enables hash navigation method
//как ставить и удалять
//npm install --save svelte-simple-modal
//npm uninstall svelte-simple-modal
//****************************************************constants section*********************************************************/
//******************************************************************************************************************************/
let debug = true;
let LOG_MAX_MESSAGES = 10;
let reconnectTimeout = 60000;
//****************************************************variable section**********************************************************/
//******************************************************************************************************************************/
let myip = document.location.hostname;
//Flags
let showInput = false;
let showModalFlag = false;
let hideAllSubParams = true;
let additionalParams = false;
//dashboard
let wigets = [];
let pages = [];
wigets = [
{
widget: "input",
type: "date",
status: "2021-10-17",
page: "Inputs",
order: "4",
descr: "Switch on boiler date",
topic: "/prefix/00000-00004/date1",
ws: 0
},
{
widget: "input",
type: "time",
status: "12:00",
page: "Inputs",
order: "1",
descr: "Switch on boiler time",
topic: "/prefix/00000-00001/time",
ws: 0
},
{
widget: "input",
type: "number",
status: "30.5",
after: "°С",
page: "Inputs",
order: "2",
descr: "Boiler temperature",
topic: "/prefix/00000-00002/temp",
ws: 0
},
{
widget: "input",
type: "text",
status: "Hello",
page: "Inputs",
order: "3",
descr: "Message to be send",
topic: "/prefix/00000-00003/text",
ws: 0
},
{
widget: "toggle",
status: 0,
page: "Toggles",
order: "3",
descr: "Light in my room",
topic: "/prefix/00000-00003/btn1",
ws: 0
},
{
widget: "toggle",
status: 0,
page: "Toggles",
order: "3",
descr: "Light in my room",
topic: "/prefix/00000-00003/btn2",
ws: 0
},
{
widget: "toggle",
status: 0,
page: "Toggles",
order: "3",
descr: "Light in my room",
topic: "/prefix/00000-00003/btn3",
ws: 0
},
{
widget: "anydata",
status: 30.5,
after: "°С",
page: "Any data",
order: "3",
descr: "Temperature",
topic: "/prefix/00000-00003/tmp10",
ws: 0
},
{
widget: "anydata",
status: 1032,
after: "mm",
page: "Any data",
order: "3",
descr: "Pressure",
topic: "/prefix/00000-00003/tmp10",
ws: 0
},
{
widget: "anydata",
status: 50,
after: "%",
page: "Any data",
order: "3",
descr: "Level",
topic: "/prefix/00000-00003/tmp10",
ws: 0
},
{
widget: "anydata",
status: "opened",
page: "Any data",
order: "3",
descr: "Status",
topic: "/prefix/00000-00003/tmp10",
ws: 0
}
];
let datachart = {
labels: ["Sun", "Mon", "Tues", "Wed", "Thurs", "Fri", "Sat"],
datasets: [{ values: [10, 12, 3, 9, 8, 15, 9] }]
};
//configuration
let configJson = [];
let configJsonBuf = [];
let widgetCollection = [];
let widgetCollectionBuf = [];
//widgetCollection = [
// {
// id: "toggle",
// val: "Переключатель",
// },
// {
// id: "btn",
// val: "Кнопка",
// },
// {
// id: "select",
// val: "Кнопка переключатель",
// },
// {
// id: "range",
// val: "Ползунок",
// },
// {
// id: "anydata",
// val: "Текст",
// },
// {
// id: "inputDigit",
// val: "Ввод цифры",
// },
//];
//web sockets
let socket = [];
let socketConnected = false;
let selectedDeviceData = undefined;
let deviceList = [];
let flag = true;
let newDevice = {};
let coreMessages = [];
let wsSelected = undefined;
deviceList = [
{
name: "Устройство 1",
id: "987654321",
ip: "192.168.88.235",
status: false
},
{
name: "Устройство 2",
id: "987654321",
ip: "192.168.88.233",
status: false
}
];
//navigation
let currentPageName = undefined;
f.subscribe(handleNavigation);
//****************************************************functions section********************************************************/
//*****************************************************************************************************************************/
//****************************************************web sockets section******************************************************/
function connectToAllDevices() {
//closeAllConnection();
//socket = [];
let ws = 0;
deviceList.forEach(device => {
//if (debug) console.log("[i]", device.name, ws, device.ip, device.id);
device.ws = ws;
if (!device.status) {
wsConnect(ws);
wsEventAdd(ws);
}
ws++;
});
$$invalidate(9, deviceList);
$$invalidate(7, socketConnected = selectedDeviceData.status);
}
function closeAllConnection() {
let s;
for (s in socket) {
socket[s].close();
}
}
function markDeviceStatus(ws, status) {
deviceList.forEach(device => {
if (device.ws === ws) {
device.status = status;
if (debug) {
if (device.status) {
console.log("[i]", device.ip, "status online");
} else {
console.log("[i]", device.ip, "status offline");
}
}
}
});
$$invalidate(9, deviceList);
$$invalidate(7, socketConnected = selectedDeviceData.status);
}
function getDeviceStatus(ws) {
let ret = false;
deviceList.forEach(device => {
if (ws === device.ws) {
ret = device.status;
}
});
return ret;
}
function wsConnect(ws) {
let ip = getIP(ws);
if (ip === "error") {
if (debug) console.log("[e]", "device list wrong");
} else {
socket[ws] = new WebSocket("ws://" + ip + ":81");
//socket[ws] = new WebSocket("ws://" + ip + "/ws");
if (debug) console.log("[i]", ip, "started connecting...");
}
}
function getIP(ws) {
let ret = "error";
deviceList.forEach(device => {
if (ws === device.ws) {
ret = device.ip;
}
});
return ret;
}
function wsEventAdd(ws) {
if (socket[ws]) {
let ip = getIP(ws);
if (debug) console.log("[i]", ip, "web socket events added");
socket[ws].addEventListener("open", function (event) {
if (debug) console.log("[i]", ip, "completed connecting");
markDeviceStatus(ws, true);
sendCurrentPageName();
}); //socket[ws].send("HELLO");
socket[ws].addEventListener("message", function (event) {
let data = event.data.toString();
//if (debug) console.log("[i]", "data:", data);
if (data.includes("[log]")) {
data = data.replace("[log]", "");
addCoreMsg(data);
} else if (data.includes("/config.json")) {
data = data.replace("/config.json", ""); //if (debug) console.log("[i]", "log data:", data);
configJsonBuf = configJsonBuf + data;
if (data.includes("]}")) {
configJsonBuf = configJsonBuf.replace("]}", "]");
if (IsJsonParse(configJsonBuf)) {
$$invalidate(5, configJson = JSON.parse(configJsonBuf));
configJsonBuf = [];
$$invalidate(5, configJson);
if (debug) console.log("[i]", "configJson parsed");
}
}
} else if (data.includes("/widgets.json")) {
data = data.replace("/widgets.json", "");
widgetCollectionBuf = widgetCollectionBuf + data;
if (data.includes("]}")) {
widgetCollectionBuf = widgetCollectionBuf.replace("]}", "]");
if (IsJsonParse(widgetCollectionBuf)) {
$$invalidate(6, widgetCollection = JSON.parse(widgetCollectionBuf));
widgetCollectionBuf = [];
$$invalidate(6, widgetCollection);
if (debug) console.log("[i]", "widgetCollection parsed");
}
}
}
});
socket[ws].addEventListener("close", event => {
if (debug) console.log("[e]", ip, "connection closed");
markDeviceStatus(ws, false);
});
socket[ws].addEventListener("error", function (event) {
if (debug) console.log("[e]", ip, "connection error");
markDeviceStatus(ws, false);
});
} else {
if (debug) console.log("[e]", "socket not exist");
}
}
function sendConfigJson() {
wsSendMsg(wsSelected, "/gifnoc.json" + JSON.stringify(configJson));
clearData();
sendCurrentPageName();
}
//function sendWidgetCollection() {
// wsSendMsg(wsSelected, "/tegdiw.json" + JSON.stringify(widgetCollection));
// clearData();
// sendCurrentPageName();
//}
function clearData() {
$$invalidate(5, configJson = []);
configJsonBuf = [];
$$invalidate(6, widgetCollection = []);
widgetCollectionBuf = [];
}
function wsPush(ws, topic, status) {
let msg = topic + " " + status;
if (debug) console.log("[i]", "send to ws msg:", msg);
wsSendMsg(ws, msg);
}
function wsTestMsgTask() {
setTimeout(wsTestMsgTask, reconnectTimeout);
if (debug) console.log("[i]", "----timer tick----");
if (!flag) {
deviceList.forEach(device => {
if (!getDeviceStatus(device.ws)) {
wsConnect(device.ws);
wsEventAdd(device.ws);
} else {
wsSendMsg(device.ws, "tst");
}
});
}
flag = false;
}
function wsSendMsg(ws, msg) {
if (socket[ws] && socket[ws].readyState === 1) {
socket[ws].send(msg);
if (debug) console.log("[i]", getIP(ws), "msg send success", msg);
} else {
if (debug) console.log("[e]", getIP(ws), "msg not send", msg);
}
}
//***********************************************************dashboard************************************************************/
function findNewPage() {
$$invalidate(4, pages = []);
const newPage = Array.from(new Set(Array.from(wigets, ({ page }) => page)));
newPage.forEach(function (item, i, arr) {
$$invalidate(4, pages = [...pages, JSON.parse(JSON.stringify({ page: item }))]);
});
pages.sort(function (a, b) {
if (a.page < b.page) {
return -1;
}
if (a.page > b.page) {
return 1;
}
return 0;
});
}
function wigetsUpdate() {
$$invalidate(3, wigets = JSON.parse(document.getElementById("text1").value));
findNewPage();
}
//***********************************************************logging************************************************************/
const addCoreMsg = msg => {
if (coreMessages.length > Number(LOG_MAX_MESSAGES)) {
$$invalidate(11, coreMessages = coreMessages.slice(0));
}
const time = new Date().getTime();
$$invalidate(11, coreMessages = [...coreMessages, { time, msg }]);
coreMessages.sort(function (a, b) {
if (a.time > b.time) {
return -1;
}
if (a.time < b.time) {
return 1;
}
return 0;
});
};
//***********************************************************dev list************************************************************/
function dropdownChange() {
$$invalidate(7, socketConnected = selectedDeviceData.status);
wsSelected = selectedDeviceData.ws;
clearData();
sendCurrentPageName();
if (debug) console.log("[i]", "user selected device:", selectedDeviceData.name);
if (selectedDeviceData.ip === myip) {
if (debug) console.log("[i]", "user selected original device", selectedDeviceData.name);
}
}
function devListSave() {
if (!showInput) {
if (newDevice.name !== undefined && newDevice.ip !== undefined && newDevice.id !== undefined) {
$$invalidate(10, newDevice.status = false, newDevice);
deviceList.push(newDevice);
$$invalidate(9, deviceList);
$$invalidate(10, newDevice = {});
connectToAllDevices();
if (debug) console.log("[i]", "selected device:", selectedDeviceData);
} else //socketConnected = socketConnected;
{
if (debug) console.log("[e]", "wrong data"); //socketConnected = selectedDeviceData.status;
}
}
}
//***********************************************************navigation************************************************************/
function handleNavigation() {
clearData();
currentPageName = $router.path.toString();
console.log("[i]", "user on page:", currentPageName);
sendCurrentPageName();
}
function sendCurrentPageName() {
if (wsSelected !== undefined) {
wsSendMsg(wsSelected, currentPageName);
}
}
const syntaxHighlight = json => {
try {
json = JSON.stringify(JSON.parse(json), null, 4);
} catch(e) {
return json;
}
json = json.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
json = json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
return match;
});
return json;
};
//**********************************************************post and get************************************************************/
//editRequest("192.168.88.235", "data data data data", "file.json")
function editRequest(url, data, filename) {
if (debug) console.log("[i]", "request for edit file");
var xmlHttp = new XMLHttpRequest();
var formData = new FormData();
formData.append("data", new Blob([data], { type: "text/json" }), "/" + filename);
xmlHttp.open("POST", "http://" + url + "/edit");
xmlHttp.onload = function () {
}; //во время загрузки
xmlHttp.send(formData);
}
function showAdditionalParams(id) {
additionalParams = true;
if (debug) console.log("[i]", "user open add params ", id);
}
function showModal() {
$$invalidate(1, showModalFlag = !showModalFlag);
}
//initialisation=======================================================================================
onMount(async () => {
console.log("[i]", "mounted");
connectToAllDevices();
wsTestMsgTask();
$$invalidate(7, socketConnected = selectedDeviceData.status);
dropdownChange();
findNewPage();
});
const writable_props = [];
Object_1.keys($$props).forEach(key => {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console_1.warn(`<App> was created with unknown prop '${key}'`);
});
function select_change_handler() {
selectedDeviceData = select_value(this);
$$invalidate(8, selectedDeviceData);
$$invalidate(9, deviceList);
}
const change_handler = () => dropdownChange();
const func = (ws, topic, status) => wsPush(ws, topic, status);
function input_value_binding(value, widget) {
if ($$self.$$.not_equal(widget.status, value)) {
widget.status = value;
$$invalidate(3, wigets);
}
}
const func_1 = (ws, topic, status) => wsPush(ws, topic, status);
function toggle_value_binding(value, widget) {
if ($$self.$$.not_equal(widget.status, value)) {
widget.status = value;
$$invalidate(3, wigets);
}
}
function anydata_value_binding(value, widget) {
if ($$self.$$.not_equal(widget.status, value)) {
widget.status = value;
$$invalidate(3, wigets);
}
}
function input0_input_handler(each_value_2, element_index) {
each_value_2[element_index].id = this.value;
$$invalidate(5, configJson);
$$invalidate(6, widgetCollection);
}
function select_change_handler_1(each_value_2, element_index) {
each_value_2[element_index].widget = select_value(this);
$$invalidate(5, configJson);
$$invalidate(6, widgetCollection);
}
function input1_input_handler(each_value_2, element_index) {
each_value_2[element_index].page = this.value;
$$invalidate(5, configJson);
$$invalidate(6, widgetCollection);
}
function input2_input_handler(each_value_2, element_index) {
each_value_2[element_index].descr = this.value;
$$invalidate(5, configJson);
$$invalidate(6, widgetCollection);
}
const click_handler = () => $$invalidate(2, hideAllSubParams = !hideAllSubParams);
function input_input_handler(key, each_value_2, element_index) {
each_value_2[element_index][key] = this.value;
$$invalidate(5, configJson);
$$invalidate(6, widgetCollection);
}
const click_handler_1 = () => sendConfigJson();
function input0_input_handler_1() {
newDevice.name = this.value;
$$invalidate(10, newDevice);
}
function input1_input_handler_1() {
newDevice.ip = this.value;
$$invalidate(10, newDevice);
}
function input2_input_handler_1() {
newDevice.id = this.value;
$$invalidate(10, newDevice);
}
const click_handler_2 = () => ($$invalidate(0, showInput = !showInput), devListSave());
const click_handler_3 = () => showModal();
$$self.$capture_state = () => ({
onMount,
Route,
router: f,
active: A,
Chart: Base$1,
Card,
Modal,
Input,
Toggle,
Anydata,
debug,
LOG_MAX_MESSAGES,
reconnectTimeout,
myip,
showInput,
showModalFlag,
hideAllSubParams,
additionalParams,
wigets,
pages,
datachart,
configJson,
configJsonBuf,
widgetCollection,
widgetCollectionBuf,
socket,
socketConnected,
selectedDeviceData,
deviceList,
flag,
newDevice,
coreMessages,
wsSelected,
currentPageName,
connectToAllDevices,
closeAllConnection,
markDeviceStatus,
getDeviceStatus,
wsConnect,
getIP,
wsEventAdd,
sendConfigJson,
clearData,
wsPush,
wsTestMsgTask,
wsSendMsg,
findNewPage,
wigetsUpdate,
addCoreMsg,
dropdownChange,
devListSave,
handleNavigation,
sendCurrentPageName,
getJsonObject,
syntaxHighlight,
IsJsonParse,
editRequest,
handleSubmit,
getRequestJson,
showAdditionalParams,
showModal,
$router
});
$$self.$inject_state = $$props => {
if ('debug' in $$props) debug = $$props.debug;
if ('LOG_MAX_MESSAGES' in $$props) LOG_MAX_MESSAGES = $$props.LOG_MAX_MESSAGES;
if ('reconnectTimeout' in $$props) reconnectTimeout = $$props.reconnectTimeout;
if ('myip' in $$props) myip = $$props.myip;
if ('showInput' in $$props) $$invalidate(0, showInput = $$props.showInput);
if ('showModalFlag' in $$props) $$invalidate(1, showModalFlag = $$props.showModalFlag);
if ('hideAllSubParams' in $$props) $$invalidate(2, hideAllSubParams = $$props.hideAllSubParams);
if ('additionalParams' in $$props) additionalParams = $$props.additionalParams;
if ('wigets' in $$props) $$invalidate(3, wigets = $$props.wigets);
if ('pages' in $$props) $$invalidate(4, pages = $$props.pages);
if ('datachart' in $$props) $$invalidate(12, datachart = $$props.datachart);
if ('configJson' in $$props) $$invalidate(5, configJson = $$props.configJson);
if ('configJsonBuf' in $$props) configJsonBuf = $$props.configJsonBuf;
if ('widgetCollection' in $$props) $$invalidate(6, widgetCollection = $$props.widgetCollection);
if ('widgetCollectionBuf' in $$props) widgetCollectionBuf = $$props.widgetCollectionBuf;
if ('socket' in $$props) socket = $$props.socket;
if ('socketConnected' in $$props) $$invalidate(7, socketConnected = $$props.socketConnected);
if ('selectedDeviceData' in $$props) $$invalidate(8, selectedDeviceData = $$props.selectedDeviceData);
if ('deviceList' in $$props) $$invalidate(9, deviceList = $$props.deviceList);
if ('flag' in $$props) flag = $$props.flag;
if ('newDevice' in $$props) $$invalidate(10, newDevice = $$props.newDevice);
if ('coreMessages' in $$props) $$invalidate(11, coreMessages = $$props.coreMessages);
if ('wsSelected' in $$props) wsSelected = $$props.wsSelected;
if ('currentPageName' in $$props) currentPageName = $$props.currentPageName;
};
if ($$props && "$$inject" in $$props) {
$$self.$inject_state($$props.$$inject);
}
return [
showInput,
showModalFlag,
hideAllSubParams,
wigets,
pages,
configJson,
widgetCollection,
socketConnected,
selectedDeviceData,
deviceList,
newDevice,
coreMessages,
datachart,
sendConfigJson,
wsPush,
wigetsUpdate,
dropdownChange,
devListSave,
syntaxHighlight,
showModal,
select_change_handler,
change_handler,
func,
input_value_binding,
func_1,
toggle_value_binding,
anydata_value_binding,
input0_input_handler,
select_change_handler_1,
input1_input_handler,
input2_input_handler,
click_handler,
input_input_handler,
click_handler_1,
input0_input_handler_1,
input1_input_handler_1,
input2_input_handler_1,
click_handler_2,
click_handler_3
];
}
class App extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance, create_fragment, safe_not_equal, {}, null, [-1, -1, -1]);
dispatch_dev("SvelteRegisterComponent", {
component: this,
tagName: "App",
options,
id: create_fragment.name
});
}
}
const app = new App({
target: document.body,
props: {
name: 'world'
}
});
return app;
})();
//# sourceMappingURL=bundle.js.map