(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() { } const identity = x => x; 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'); } let src_url_equal_anchor; function src_url_equal(element_src, url) { if (!src_url_equal_anchor) { src_url_equal_anchor = document.createElement('a'); } src_url_equal_anchor.href = url; return element_src === src_url_equal_anchor.href; } function is_empty(obj) { return Object.keys(obj).length === 0; } function 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 compute_slots(slots) { const result = {}; for (const key in slots) { result[key] = true; } return result; } function null_to_empty(value) { return value == null ? '' : value; } const is_client = typeof window !== 'undefined'; let now = is_client ? () => window.performance.now() : () => Date.now(); let raf = is_client ? cb => requestAnimationFrame(cb) : noop; const tasks = new Set(); function run_tasks(now) { tasks.forEach(task => { if (!task.c(now)) { tasks.delete(task); task.f(); } }); if (tasks.size !== 0) raf(run_tasks); } /** * Creates a new task that runs on each raf frame * until it returns a falsy value or is aborted */ function loop(callback) { let task; if (tasks.size === 0) raf(run_tasks); return { promise: new Promise(fulfill => { tasks.add(task = { c: callback, f: fulfill }); }), abort() { tasks.delete(task); } }; } const globals = (typeof window !== 'undefined' ? window : typeof globalThis !== 'undefined' ? globalThis : global); function append(target, node) { target.appendChild(node); } function get_root_for_style(node) { if (!node) return document; const root = node.getRootNode ? node.getRootNode() : node.ownerDocument; if (root && root.host) { return root; } return node.ownerDocument; } function append_empty_stylesheet(node) { const style_element = element('style'); append_stylesheet(get_root_for_style(node), style_element); return style_element.sheet; } function append_stylesheet(node, style) { append(node.head || node, style); return style.sheet; } function insert(target, node, anchor) { target.insertBefore(node, anchor || null); } function detach(node) { if (node.parentNode) { 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 comment(content) { return document.createComment(content); } 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 set_style(node, key, value, important) { if (value == null) { node.style.removeProperty(key); } else { node.style.setProperty(key, value, important ? 'important' : ''); } } function select_option(select, value, mounting) { for (let i = 0; i < select.options.length; i += 1) { const option = select.options[i]; if (option.__value === value) { option.selected = true; return; } } if (!mounting || value !== undefined) { select.selectedIndex = -1; // no option should be selected } } function select_value(select) { const selected_option = select.querySelector(':checked'); return selected_option && selected_option.__value; } function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) { const e = document.createEvent('CustomEvent'); e.initCustomEvent(type, bubbles, cancelable, detail); return e; } // we need to store the information for multiple documents because a Svelte application could also contain iframes // https://github.com/sveltejs/svelte/issues/3624 const managed_styles = new Map(); let active = 0; // https://github.com/darkskyapp/string-hash/blob/master/index.js function hash(str) { let hash = 5381; let i = str.length; while (i--) hash = ((hash << 5) - hash) ^ str.charCodeAt(i); return hash >>> 0; } function create_style_information(doc, node) { const info = { stylesheet: append_empty_stylesheet(node), rules: {} }; managed_styles.set(doc, info); return info; } function create_rule(node, a, b, duration, delay, ease, fn, uid = 0) { const step = 16.666 / duration; let keyframes = '{\n'; for (let p = 0; p <= 1; p += step) { const t = a + (b - a) * ease(p); keyframes += p * 100 + `%{${fn(t, 1 - t)}}\n`; } const rule = keyframes + `100% {${fn(b, 1 - b)}}\n}`; const name = `__svelte_${hash(rule)}_${uid}`; const doc = get_root_for_style(node); const { stylesheet, rules } = managed_styles.get(doc) || create_style_information(doc, node); if (!rules[name]) { rules[name] = true; stylesheet.insertRule(`@keyframes ${name} ${rule}`, stylesheet.cssRules.length); } const animation = node.style.animation || ''; node.style.animation = `${animation ? `${animation}, ` : ''}${name} ${duration}ms linear ${delay}ms 1 both`; active += 1; return name; } function delete_rule(node, name) { const previous = (node.style.animation || '').split(', '); const next = previous.filter(name ? anim => anim.indexOf(name) < 0 // remove specific animation : anim => anim.indexOf('__svelte') === -1 // remove all Svelte animations ); const deleted = previous.length - next.length; if (deleted) { node.style.animation = next.join(', '); active -= deleted; if (!active) clear_rules(); } } function clear_rules() { raf(() => { if (active) return; managed_styles.forEach(info => { const { ownerNode } = info.stylesheet; // there is no ownerNode if it runs on jsdom. if (ownerNode) detach(ownerNode); }); managed_styles.clear(); }); } 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; } /** * The `onMount` function schedules a callback to run as soon as the component has been mounted to the DOM. * It must be called during the component's initialisation (but doesn't need to live *inside* the component; * it can be called from an external module). * * `onMount` does not run inside a [server-side component](/docs#run-time-server-side-component-api). * * https://svelte.dev/docs#run-time-svelte-onmount */ function onMount(fn) { get_current_component().$$.on_mount.push(fn); } /** * Schedules a callback to run immediately before the component is unmounted. * * Out of `onMount`, `beforeUpdate`, `afterUpdate` and `onDestroy`, this is the * only one that runs inside a server-side component. * * https://svelte.dev/docs#run-time-svelte-ondestroy */ function onDestroy(fn) { get_current_component().$$.on_destroy.push(fn); } /** * Creates an event dispatcher that can be used to dispatch [component events](/docs#template-syntax-component-directives-on-eventname). * Event dispatchers are functions that can take two arguments: `name` and `detail`. * * Component events created with `createEventDispatcher` create a * [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent). * These events do not [bubble](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture). * The `detail` argument corresponds to the [CustomEvent.detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail) * property and can contain any type of data. * * https://svelte.dev/docs#run-time-svelte-createeventdispatcher */ function createEventDispatcher() { const component = get_current_component(); return (type, detail, { cancelable = false } = {}) => { const callbacks = component.$$.callbacks[type]; if (callbacks) { // TODO are there situations where events could be dispatched // in a server (non-DOM) environment? const event = custom_event(type, detail, { cancelable }); callbacks.slice().forEach(fn => { fn.call(component, event); }); return !event.defaultPrevented; } return true; }; } // 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 = []; let render_callbacks = []; const flush_callbacks = []; const resolved_promise = /* @__PURE__ */ Promise.resolve(); let update_scheduled = false; function schedule_update() { if (!update_scheduled) { update_scheduled = true; resolved_promise.then(flush); } } function add_render_callback(fn) { render_callbacks.push(fn); } // flush() calls callbacks in this order: // 1. All beforeUpdate callbacks, in order: parents before children // 2. All bind:this callbacks, in reverse order: children before parents. // 3. All afterUpdate callbacks, in order: parents before children. EXCEPT // for afterUpdates called during the initial onMount, which are called in // reverse order: children before parents. // Since callbacks might update component values, which could trigger another // call to flush(), the following steps guard against this: // 1. During beforeUpdate, any updated components will be added to the // dirty_components array and will cause a reentrant call to flush(). Because // the flush index is kept outside the function, the reentrant call will pick // up where the earlier call left off and go through all dirty components. The // current_component value is saved and restored so that the reentrant call will // not interfere with the "parent" flush() call. // 2. bind:this callbacks cannot trigger new flush() calls. // 3. During afterUpdate, any updated components will NOT have their afterUpdate // callback called a second time; the seen_callbacks set, outside the flush() // function, guarantees this behavior. const seen_callbacks = new Set(); let flushidx = 0; // Do *not* move this inside the flush() function function flush() { // Do not reenter flush while dirty components are updated, as this can // result in an infinite loop. Instead, let the inner flush handle it. // Reentrancy is ok afterwards for bindings etc. if (flushidx !== 0) { return; } const saved_component = current_component; do { // first, call beforeUpdate functions // and update components try { while (flushidx < dirty_components.length) { const component = dirty_components[flushidx]; flushidx++; set_current_component(component); update(component.$$); } } catch (e) { // reset dirty state to not end up in a deadlocked state and then rethrow dirty_components.length = 0; flushidx = 0; throw e; } 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); } } /** * Useful for example to execute remaining `afterUpdate` callbacks before executing `destroy`. */ function flush_render_callbacks(fns) { const filtered = []; const targets = []; render_callbacks.forEach((c) => fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c)); targets.forEach((c) => c()); render_callbacks = filtered; } let promise; function wait() { if (!promise) { promise = Promise.resolve(); promise.then(() => { promise = null; }); } return promise; } function dispatch(node, direction, kind) { node.dispatchEvent(custom_event(`${direction ? 'intro' : 'outro'}${kind}`)); } 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); } else if (callback) { callback(); } } const null_transition = { duration: 0 }; function create_in_transition(node, fn, params) { const options = { direction: 'in' }; let config = fn(node, params, options); let running = false; let animation_name; let task; let uid = 0; function cleanup() { if (animation_name) delete_rule(node, animation_name); } function go() { const { delay = 0, duration = 300, easing = identity, tick = noop, css } = config || null_transition; if (css) animation_name = create_rule(node, 0, 1, duration, delay, easing, css, uid++); tick(0, 1); const start_time = now() + delay; const end_time = start_time + duration; if (task) task.abort(); running = true; add_render_callback(() => dispatch(node, true, 'start')); task = loop(now => { if (running) { if (now >= end_time) { tick(1, 0); dispatch(node, true, 'end'); cleanup(); return running = false; } if (now >= start_time) { const t = easing((now - start_time) / duration); tick(t, 1 - t); } } return running; }); } let started = false; return { start() { if (started) return; started = true; delete_rule(node); if (is_function(config)) { config = config(options); wait().then(go); } else { go(); } }, invalidate() { started = false; }, end() { if (running) { cleanup(); running = false; } } }; } function destroy_block(block, lookup) { block.d(1); lookup.delete(block.key); } function outro_and_destroy_block(block, lookup) { transition_out(block, 1, 1, () => { lookup.delete(block.key); }); } function update_keyed_each(old_blocks, dirty, get_key, dynamic, ctx, list, lookup, node, destroy, create_each_block, next, get_context) { let o = old_blocks.length; let n = list.length; let i = o; const old_indexes = {}; while (i--) old_indexes[old_blocks[i].key] = i; const new_blocks = []; const new_lookup = new Map(); const deltas = new Map(); const updates = []; i = n; while (i--) { const child_ctx = get_context(ctx, list, i); const key = get_key(child_ctx); let block = lookup.get(key); if (!block) { block = create_each_block(key, child_ctx); block.c(); } else if (dynamic) { // defer updates until all the DOM shuffling is done updates.push(() => block.p(child_ctx, dirty)); } new_lookup.set(key, new_blocks[i] = block); if (key in old_indexes) deltas.set(key, Math.abs(i - old_indexes[key])); } const will_move = new Set(); const did_move = new Set(); function insert(block) { transition_in(block, 1); block.m(node, next); lookup.set(block.key, block); next = block.first; n--; } while (o && n) { const new_block = new_blocks[n - 1]; const old_block = old_blocks[o - 1]; const new_key = new_block.key; const old_key = old_block.key; if (new_block === old_block) { // do nothing next = new_block.first; o--; n--; } else if (!new_lookup.has(old_key)) { // remove old block destroy(old_block, lookup); o--; } else if (!lookup.has(new_key) || will_move.has(new_key)) { insert(new_block); } else if (did_move.has(old_key)) { o--; } else if (deltas.get(new_key) > deltas.get(old_key)) { did_move.add(new_key); insert(new_block); } else { will_move.add(old_key); o--; } } while (o--) { const old_block = old_blocks[o]; if (!new_lookup.has(old_block.key)) destroy(old_block, lookup); } while (n) insert(new_blocks[n - 1]); run_all(updates); return new_blocks; } function validate_each_keys(ctx, list, get_context, get_key) { const keys = new Set(); for (let i = 0; i < list.length; i++) { const key = get_key(get_context(ctx, list, i)); if (keys.has(key)) { throw new Error('Cannot have duplicate keys in a keyed each'); } keys.add(key); } } function create_component(block) { block && block.c(); } function mount_component(component, target, anchor, customElement) { const { fragment, after_update } = component.$$; fragment && fragment.m(target, anchor); if (!customElement) { // onMount happens before the initial afterUpdate add_render_callback(() => { const new_on_destroy = component.$$.on_mount.map(run).filter(is_function); // if the component was destroyed immediately // it will update the `$$.on_destroy` reference to `null`. // the destructured on_destroy may still reference to the old array if (component.$$.on_destroy) { component.$$.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) { flush_render_callbacks($$.after_update); 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: [], // 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) { if (!is_function(callback)) { return noop; } 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.59.2' }, detail), { bubbles: 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, has_stop_immediate_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'); if (has_stop_immediate_propagation) modifiers.push('stopImmediatePropagation'); 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.data === 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() { } } /* src\VideoGradioComponentBrainstorming.svelte generated by Svelte v3.59.2 */ const { console: console_1$3 } = globals; const file$c = "src\\VideoGradioComponentBrainstorming.svelte"; function get_each_context$3(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[15] = list[i]; return child_ctx; } // (85:4) {#each kitchenOptions as option} function create_each_block$3(ctx) { let option; let t_value = /*option*/ ctx[15] + ""; let t; const block = { c: function create() { option = element("option"); t = text(t_value); option.__value = /*option*/ ctx[15]; option.value = option.__value; add_location(option, file$c, 85, 6, 2561); }, m: function mount(target, anchor) { insert_dev(target, option, anchor); append_dev(option, t); }, p: noop, d: function destroy(detaching) { if (detaching) detach_dev(option); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$3.name, type: "each", source: "(85:4) {#each kitchenOptions as option}", ctx }); return block; } function create_fragment$c(ctx) { let h1; let t1; let div1; let video; let track; let track_src_value; let t2; let div0; let t3; let t4; let t5; let canvas_1; let t6; let input; let t7; let div2; let button; let t9; let select; let mounted; let dispose; let each_value = /*kitchenOptions*/ ctx[4]; validate_each_argument(each_value); let each_blocks = []; for (let i = 0; i < each_value.length; i += 1) { each_blocks[i] = create_each_block$3(get_each_context$3(ctx, each_value, i)); } const block = { c: function create() { h1 = element("h1"); h1.textContent = "AI Vision Assistant - Auto prompt HF agent + Cohere + Object detection - Text write on screen test"; t1 = space(); div1 = element("div"); video = element("video"); track = element("track"); t2 = space(); div0 = element("div"); t3 = text("Text Overlay Test and "); t4 = text(/*TestVerb*/ ctx[3]); t5 = space(); canvas_1 = element("canvas"); t6 = space(); input = element("input"); t7 = space(); div2 = element("div"); button = element("button"); button.textContent = "Verb Test"; t9 = space(); select = element("select"); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } add_location(h1, file$c, 66, 0, 1800); attr_dev(track, "kind", "captions"); if (!src_url_equal(track.src, track_src_value = "path/to/your/captions/file.vtt")) attr_dev(track, "src", track_src_value); attr_dev(track, "srclang", "en"); attr_dev(track, "label", "English"); add_location(track, file$c, 72, 4, 2006); attr_dev(video, "id", "videoCanvas"); video.autoplay = true; attr_dev(video, "class", "svelte-ufd3fo"); add_location(video, file$c, 70, 2, 1965); attr_dev(div0, "id", "overlayText"); attr_dev(div0, "class", "svelte-ufd3fo"); add_location(div0, file$c, 74, 2, 2111); attr_dev(div1, "id", "videoContainer"); attr_dev(div1, "class", "svelte-ufd3fo"); add_location(div1, file$c, 68, 0, 1911); attr_dev(canvas_1, "id", "myCanvas"); set_style(canvas_1, "border", "2px solid black"); attr_dev(canvas_1, "width", "500"); attr_dev(canvas_1, "height", "500"); add_location(canvas_1, file$c, 77, 0, 2186); attr_dev(input, "type", "text"); add_location(input, file$c, 78, 0, 2294); add_location(button, file$c, 82, 2, 2429); if (/*selectedOption*/ ctx[0] === void 0) add_render_callback(() => /*select_change_handler*/ ctx[9].call(select)); add_location(select, file$c, 83, 2, 2479); attr_dev(div2, "id", "frameForButtons"); add_location(div2, file$c, 81, 0, 2399); }, 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, h1, anchor); insert_dev(target, t1, anchor); insert_dev(target, div1, anchor); append_dev(div1, video); append_dev(video, track); append_dev(div1, t2); append_dev(div1, div0); append_dev(div0, t3); append_dev(div0, t4); insert_dev(target, t5, anchor); insert_dev(target, canvas_1, anchor); /*canvas_1_binding*/ ctx[7](canvas_1); insert_dev(target, t6, anchor); insert_dev(target, input, anchor); set_input_value(input, /*textToDisplay*/ ctx[2]); insert_dev(target, t7, anchor); insert_dev(target, div2, anchor); append_dev(div2, button); append_dev(div2, t9); append_dev(div2, select); for (let i = 0; i < each_blocks.length; i += 1) { if (each_blocks[i]) { each_blocks[i].m(select, null); } } select_option(select, /*selectedOption*/ ctx[0], true); if (!mounted) { dispose = [ listen_dev(input, "input", /*input_input_handler*/ ctx[8]), listen_dev(input, "input", /*updateText*/ ctx[6], false, false, false, false), listen_dev(button, "click", /*testText*/ ctx[5], false, false, false, false), listen_dev(select, "change", /*select_change_handler*/ ctx[9]) ]; mounted = true; } }, p: function update(ctx, [dirty]) { if (dirty & /*TestVerb*/ 8) set_data_dev(t4, /*TestVerb*/ ctx[3]); if (dirty & /*textToDisplay*/ 4 && input.value !== /*textToDisplay*/ ctx[2]) { set_input_value(input, /*textToDisplay*/ ctx[2]); } if (dirty & /*kitchenOptions*/ 16) { each_value = /*kitchenOptions*/ ctx[4]; validate_each_argument(each_value); let i; for (i = 0; i < each_value.length; i += 1) { const child_ctx = get_each_context$3(ctx, each_value, 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(select, null); } } for (; i < each_blocks.length; i += 1) { each_blocks[i].d(1); } each_blocks.length = each_value.length; } if (dirty & /*selectedOption, kitchenOptions*/ 17) { select_option(select, /*selectedOption*/ ctx[0]); } }, i: noop, o: noop, d: function destroy(detaching) { if (detaching) detach_dev(h1); if (detaching) detach_dev(t1); if (detaching) detach_dev(div1); if (detaching) detach_dev(t5); if (detaching) detach_dev(canvas_1); /*canvas_1_binding*/ ctx[7](null); if (detaching) detach_dev(t6); if (detaching) detach_dev(input); if (detaching) detach_dev(t7); if (detaching) detach_dev(div2); destroy_each(each_blocks, detaching); mounted = false; run_all(dispose); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$c.name, type: "component", source: "", ctx }); return block; } function ocrTest() { } // Logic for 'Test OCR' button function instance$c($$self, $$props, $$invalidate) { let { $$slots: slots = {}, $$scope } = $$props; validate_slots('VideoGradioComponentBrainstorming', slots, []); let selectedOption = 'Stove - lu'; // default value let kitchenOptions = ['Stove - lu', 'Refrigerator - bingxiang', 'Spoon - shao']; /* ... other options ... */ let canvas; let ctx; let textToDisplay = 'Initial Text'; let counter = 0; let hud_text; let TestVerb = "|Test verb|"; // Functions for button commands function testText() { // Logic for 'verb test' button const randomIndex = Math.floor(Math.random() * kitchenOptions.length); $$invalidate(3, TestVerb = kitchenOptions[randomIndex]); } // Image source let imageSrc = 'path_to_your_image/Blooms-Taxonomy-650x366.jpg'; // Video stream setup onMount(() => { // Initialize video stream here ctx = canvas.getContext('2d'); setInterval( () => { drawText(textToDisplay); }, 1000 ); // Update every second }); function drawText(hud_info) { if (ctx) { hud_text = "HUD Info Update: " + counter++ + " " + hud_info; ctx.clearRect(0, 0, canvas.width, canvas.height); // Clear the canvas ctx.font = '30px Arial'; ctx.fillStyle = 'black'; ctx.fillText(hud_text, 50, 50); } } function updateText(event) { $$invalidate(2, textToDisplay = event.target.value); drawText(); } // Camera as Video Stream navigator.mediaDevices.getUserMedia({ video: true }).then(stream => { const video = document.getElementById('videoCanvas'); video.srcObject = stream; }).catch(err => { console.error("Error accessing the camera: ", err); }); const writable_props = []; Object.keys($$props).forEach(key => { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console_1$3.warn(` was created with unknown prop '${key}'`); }); function canvas_1_binding($$value) { binding_callbacks[$$value ? 'unshift' : 'push'](() => { canvas = $$value; $$invalidate(1, canvas); }); } function input_input_handler() { textToDisplay = this.value; $$invalidate(2, textToDisplay); } function select_change_handler() { selectedOption = select_value(this); $$invalidate(0, selectedOption); $$invalidate(4, kitchenOptions); } $$self.$capture_state = () => ({ onMount, selectedOption, kitchenOptions, canvas, ctx, textToDisplay, counter, hud_text, TestVerb, testText, ocrTest, imageSrc, drawText, updateText }); $$self.$inject_state = $$props => { if ('selectedOption' in $$props) $$invalidate(0, selectedOption = $$props.selectedOption); if ('kitchenOptions' in $$props) $$invalidate(4, kitchenOptions = $$props.kitchenOptions); if ('canvas' in $$props) $$invalidate(1, canvas = $$props.canvas); if ('ctx' in $$props) ctx = $$props.ctx; if ('textToDisplay' in $$props) $$invalidate(2, textToDisplay = $$props.textToDisplay); if ('counter' in $$props) counter = $$props.counter; if ('hud_text' in $$props) hud_text = $$props.hud_text; if ('TestVerb' in $$props) $$invalidate(3, TestVerb = $$props.TestVerb); if ('imageSrc' in $$props) imageSrc = $$props.imageSrc; }; if ($$props && "$$inject" in $$props) { $$self.$inject_state($$props.$$inject); } return [ selectedOption, canvas, textToDisplay, TestVerb, kitchenOptions, testText, updateText, canvas_1_binding, input_input_handler, select_change_handler ]; } class VideoGradioComponentBrainstorming extends SvelteComponentDev { constructor(options) { super(options); init(this, options, instance$c, create_fragment$c, safe_not_equal, {}); dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "VideoGradioComponentBrainstorming", options, id: create_fragment$c.name }); } } // Unique ID creation requires a high quality random # generator. In the browser we therefore // require the crypto API and do not support built-in fallback to lower quality random number // generators (like Math.random()). let getRandomValues; const rnds8 = new Uint8Array(16); function rng() { // lazy load so that environments that need to polyfill have a chance to do so if (!getRandomValues) { // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); if (!getRandomValues) { throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); } } return getRandomValues(rnds8); } /** * Convert array of 16 byte values to UUID string format of the form: * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX */ const byteToHex = []; for (let i = 0; i < 256; ++i) { byteToHex.push((i + 0x100).toString(16).slice(1)); } function unsafeStringify(arr, offset = 0) { // Note: Be careful editing this code! It's been tuned for performance // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; } const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto); var native = { randomUUID }; function v4(options, buf, offset) { if (native.randomUUID && !buf && !options) { return native.randomUUID(); } options = options || {}; const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` rnds[6] = rnds[6] & 0x0f | 0x40; rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided if (buf) { offset = offset || 0; for (let i = 0; i < 16; ++i) { buf[offset + i] = rnds[i]; } return buf; } return unsafeStringify(rnds); } /* src\NestedCommentsTestfromReact.svelte generated by Svelte v3.59.2 */ const file$b = "src\\NestedCommentsTestfromReact.svelte"; function get_each_context$2(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[6] = list[i]; return child_ctx; } function get_each_context_1$1(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[9] = list[i]; return child_ctx; } // (29:12) {#if comment.items} function create_if_block$6(ctx) { let each_1_anchor; let each_value_1 = /*comment*/ ctx[6].items; 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$1(get_each_context_1$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) { if (each_blocks[i]) { each_blocks[i].m(target, anchor); } } insert_dev(target, each_1_anchor, anchor); }, p: function update(ctx, dirty) { if (dirty & /*comments*/ 1) { each_value_1 = /*comment*/ ctx[6].items; 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$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$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_if_block$6.name, type: "if", source: "(29:12) {#if comment.items}", ctx }); return block; } // (30:16) {#each comment.items as item} function create_each_block_1$1(ctx) { let t0_value = /*item*/ ctx[9].title + ""; let t0; let t1; const block = { c: function create() { t0 = text(t0_value); t1 = text(" | \r\n "); }, m: function mount(target, anchor) { insert_dev(target, t0, anchor); insert_dev(target, t1, anchor); }, p: function update(ctx, dirty) { if (dirty & /*comments*/ 1 && t0_value !== (t0_value = /*item*/ ctx[9].title + "")) set_data_dev(t0, t0_value); }, d: function destroy(detaching) { if (detaching) detach_dev(t0); if (detaching) detach_dev(t1); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block_1$1.name, type: "each", source: "(30:16) {#each comment.items as item}", ctx }); return block; } // (23:4) {#each comments as comment} function create_each_block$2(ctx) { let div1; let div0; let span; let t0_value = /*comment*/ ctx[6].title + ""; let t0; let t1; let button; let t3; let t4; let div1_key_value; let mounted; let dispose; function click_handler() { return /*click_handler*/ ctx[5](/*comment*/ ctx[6]); } let if_block = /*comment*/ ctx[6].items && create_if_block$6(ctx); const block = { c: function create() { div1 = element("div"); div0 = element("div"); span = element("span"); t0 = text(t0_value); t1 = space(); button = element("button"); button.textContent = "Add Reply"; t3 = space(); if (if_block) if_block.c(); t4 = space(); attr_dev(span, "class", "text"); add_location(span, file$b, 25, 16, 818); add_location(button, file$b, 26, 16, 877); attr_dev(div0, "class", "card"); add_location(div0, file$b, 24, 12, 782); attr_dev(div1, "key", div1_key_value = /*comment*/ ctx[6].id); set_style(div1, "margin-left", "20px"); add_location(div1, file$b, 23, 8, 719); }, m: function mount(target, anchor) { insert_dev(target, div1, anchor); append_dev(div1, div0); append_dev(div0, span); append_dev(span, t0); append_dev(div0, t1); append_dev(div0, button); append_dev(div1, t3); if (if_block) if_block.m(div1, null); append_dev(div1, t4); if (!mounted) { dispose = listen_dev(button, "click", click_handler, false, false, false, false); mounted = true; } }, p: function update(new_ctx, dirty) { ctx = new_ctx; if (dirty & /*comments*/ 1 && t0_value !== (t0_value = /*comment*/ ctx[6].title + "")) set_data_dev(t0, t0_value); if (/*comment*/ ctx[6].items) { if (if_block) { if_block.p(ctx, dirty); } else { if_block = create_if_block$6(ctx); if_block.c(); if_block.m(div1, t4); } } else if (if_block) { if_block.d(1); if_block = null; } if (dirty & /*comments*/ 1 && div1_key_value !== (div1_key_value = /*comment*/ ctx[6].id)) { attr_dev(div1, "key", div1_key_value); } }, d: function destroy(detaching) { if (detaching) detach_dev(div1); if (if_block) if_block.d(); mounted = false; dispose(); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$2.name, type: "each", source: "(23:4) {#each comments as comment}", ctx }); return block; } function create_fragment$b(ctx) { let div1; let div0; let input; let t0; let button; let t2; let mounted; let dispose; let each_value = /*comments*/ ctx[0]; validate_each_argument(each_value); let each_blocks = []; for (let i = 0; i < each_value.length; i += 1) { each_blocks[i] = create_each_block$2(get_each_context$2(ctx, each_value, i)); } const block = { c: function create() { div1 = element("div"); div0 = element("div"); input = element("input"); t0 = space(); button = element("button"); button.textContent = "Post Comment"; t2 = space(); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } attr_dev(input, "type", "text"); attr_dev(input, "placeholder", "Add a comment"); add_location(input, file$b, 19, 8, 530); add_location(button, file$b, 20, 8, 613); add_location(div0, file$b, 18, 4, 515); attr_dev(div1, "id", "comment-container"); add_location(div1, file$b, 17, 0, 481); }, l: function claim(nodes) { throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); }, m: function mount(target, anchor) { insert_dev(target, div1, anchor); append_dev(div1, div0); append_dev(div0, input); set_input_value(input, /*newComment*/ ctx[1]); append_dev(div0, t0); append_dev(div0, button); append_dev(div1, t2); for (let i = 0; i < each_blocks.length; i += 1) { if (each_blocks[i]) { each_blocks[i].m(div1, null); } } if (!mounted) { dispose = [ listen_dev(input, "input", /*input_input_handler*/ ctx[4]), listen_dev(button, "click", /*addComment*/ ctx[2], false, false, false, false) ]; mounted = true; } }, p: function update(ctx, [dirty]) { if (dirty & /*newComment*/ 2 && input.value !== /*newComment*/ ctx[1]) { set_input_value(input, /*newComment*/ ctx[1]); } if (dirty & /*comments, addReply, prompt*/ 9) { each_value = /*comments*/ ctx[0]; validate_each_argument(each_value); let i; for (i = 0; i < each_value.length; i += 1) { const child_ctx = get_each_context$2(ctx, each_value, 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(div1, null); } } for (; i < each_blocks.length; i += 1) { each_blocks[i].d(1); } each_blocks.length = each_value.length; } }, i: noop, o: noop, d: function destroy(detaching) { if (detaching) detach_dev(div1); destroy_each(each_blocks, detaching); mounted = false; run_all(dispose); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$b.name, type: "component", source: "", ctx }); return block; } function instance$b($$self, $$props, $$invalidate) { let { $$slots: slots = {}, $$scope } = $$props; validate_slots('NestedCommentsTestfromReact', slots, []); let comments = []; let newComment = ''; const addComment = () => { $$invalidate(0, comments = [ ...comments, { id: v4(), title: newComment, items: [] } ]); $$invalidate(1, newComment = ''); }; const addReply = (comment, replyText) => { comment.items.push({ id: v4(), title: replyText, items: [] }); $$invalidate(0, comments = [...comments]); }; const writable_props = []; Object.keys($$props).forEach(key => { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); }); function input_input_handler() { newComment = this.value; $$invalidate(1, newComment); } const click_handler = comment => addReply(comment, prompt('Enter your reply')); $$self.$capture_state = () => ({ comment, uuidv4: v4, comments, newComment, addComment, addReply }); $$self.$inject_state = $$props => { if ('comments' in $$props) $$invalidate(0, comments = $$props.comments); if ('newComment' in $$props) $$invalidate(1, newComment = $$props.newComment); }; if ($$props && "$$inject" in $$props) { $$self.$inject_state($$props.$$inject); } return [comments, newComment, addComment, addReply, input_input_handler, click_handler]; } class NestedCommentsTestfromReact extends SvelteComponentDev { constructor(options) { super(options); init(this, options, instance$b, create_fragment$b, safe_not_equal, {}); dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "NestedCommentsTestfromReact", options, id: create_fragment$b.name }); } } const subscriber_queue = []; /** * Create a `Writable` store that allows both updating and reading by subscription. * @param {*=}value initial value * @param {StartStopNotifier=} start */ 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(); stop = null; } }; } return { set, update, subscribe }; } /* src\MovingDotPortfromReact.svelte generated by Svelte v3.59.2 */ const file$a = "src\\MovingDotPortfromReact.svelte"; function create_fragment$a(ctx) { let div; const block = { c: function create() { div = element("div"); attr_dev(div, "class", "MovingDot svelte-12o76ak"); set_style(div, "left", /*position*/ ctx[0].x + "px"); set_style(div, "top", /*position*/ ctx[0].y + "px"); add_location(div, file$a, 47, 0, 1709); }, 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); }, p: function update(ctx, [dirty]) { if (dirty & /*position*/ 1) { set_style(div, "left", /*position*/ ctx[0].x + "px"); } if (dirty & /*position*/ 1) { set_style(div, "top", /*position*/ ctx[0].y + "px"); } }, i: noop, o: noop, d: function destroy(detaching) { if (detaching) detach_dev(div); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$a.name, type: "component", source: "", ctx }); return block; } const step = 10; function instance$a($$self, $$props, $$invalidate) { let { $$slots: slots = {}, $$scope } = $$props; validate_slots('MovingDotPortfromReact', slots, []); let { position = { x: 0, y: 0 } } = $$props; let { boundaries = { minX: 0, maxX: 100, minY: 0, maxY: 100 } } = $$props; const dispatch = createEventDispatcher(); function moveDot(newX, newY) { // Calculate new position here let newPosition = { x: newX, y: newY }; // Update position with a new object for Svelte reactivity let boundedX = Math.max(boundaries.minX, Math.min(newX, boundaries.maxX)); let boundedY = Math.max(boundaries.minY, Math.min(newY, boundaries.maxY)); // Update position $$invalidate(0, position = { x: boundedX, y: boundedY }); // Dispatch the move event with the new position dispatch('move', newPosition); } const handleKeyPress = e => { e.preventDefault(); let newX = position.x; let newY = position.y; switch (e.key) { case 'ArrowLeft': newX -= step; break; case 'ArrowRight': newX += step; break; case 'ArrowUp': newY -= step; break; case 'ArrowDown': newY += step; break; } moveDot(newX, newY); }; // // Restrict movement within boundaries // if (newX >= boundaries.minX && newX <= boundaries.maxX) position.x = newX; // if (newY >= boundaries.minY && newY <= boundaries.maxY) position.y = newY; onMount(() => { window.addEventListener('keydown', handleKeyPress); return () => { window.removeEventListener('keydown', handleKeyPress); }; }); const writable_props = ['position', 'boundaries']; Object.keys($$props).forEach(key => { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); }); $$self.$$set = $$props => { if ('position' in $$props) $$invalidate(0, position = $$props.position); if ('boundaries' in $$props) $$invalidate(1, boundaries = $$props.boundaries); }; $$self.$capture_state = () => ({ onMount, createEventDispatcher, position, boundaries, step, dispatch, moveDot, handleKeyPress }); $$self.$inject_state = $$props => { if ('position' in $$props) $$invalidate(0, position = $$props.position); if ('boundaries' in $$props) $$invalidate(1, boundaries = $$props.boundaries); }; if ($$props && "$$inject" in $$props) { $$self.$inject_state($$props.$$inject); } return [position, boundaries]; } class MovingDotPortfromReact extends SvelteComponentDev { constructor(options) { super(options); init(this, options, instance$a, create_fragment$a, safe_not_equal, { position: 0, boundaries: 1 }); dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "MovingDotPortfromReact", options, id: create_fragment$a.name }); } get position() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set position(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } get boundaries() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set boundaries(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } } /* src\MovingDotTargetPortfromReact.svelte generated by Svelte v3.59.2 */ const file$9 = "src\\MovingDotTargetPortfromReact.svelte"; function create_fragment$9(ctx) { let div; const block = { c: function create() { div = element("div"); attr_dev(div, "class", "target svelte-4yc66h"); set_style(div, "left", /*position*/ ctx[0].x + "px"); set_style(div, "top", /*position*/ ctx[0].y + "px"); add_location(div, file$9, 4, 0, 49); }, 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); }, p: function update(ctx, [dirty]) { if (dirty & /*position*/ 1) { set_style(div, "left", /*position*/ ctx[0].x + "px"); } if (dirty & /*position*/ 1) { set_style(div, "top", /*position*/ ctx[0].y + "px"); } }, i: noop, o: noop, d: function destroy(detaching) { if (detaching) detach_dev(div); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$9.name, type: "component", source: "", ctx }); return block; } function instance$9($$self, $$props, $$invalidate) { let { $$slots: slots = {}, $$scope } = $$props; validate_slots('MovingDotTargetPortfromReact', slots, []); let { position } = $$props; $$self.$$.on_mount.push(function () { if (position === undefined && !('position' in $$props || $$self.$$.bound[$$self.$$.props['position']])) { console.warn(" was created without expected prop 'position'"); } }); const writable_props = ['position']; Object.keys($$props).forEach(key => { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); }); $$self.$$set = $$props => { if ('position' in $$props) $$invalidate(0, position = $$props.position); }; $$self.$capture_state = () => ({ position }); $$self.$inject_state = $$props => { if ('position' in $$props) $$invalidate(0, position = $$props.position); }; if ($$props && "$$inject" in $$props) { $$self.$inject_state($$props.$$inject); } return [position]; } class MovingDotTargetPortfromReact extends SvelteComponentDev { constructor(options) { super(options); init(this, options, instance$9, create_fragment$9, safe_not_equal, { position: 0 }); dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "MovingDotTargetPortfromReact", options, id: create_fragment$9.name }); } get position() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set position(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } } /* src\MovingDotSpacePortfromReact.svelte generated by Svelte v3.59.2 */ const { console: console_1$2 } = globals; const file$8 = "src\\MovingDotSpacePortfromReact.svelte"; function get_each_context$1(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[13] = list[i]; return child_ctx; } // (70:4) {#each $targets as target (target.name)} function create_each_block$1(key_1, ctx) { let first; let target; let t0; let span; let t1_value = /*target*/ ctx[13].name + ""; let t1; let current; target = new MovingDotTargetPortfromReact({ props: { position: /*target*/ ctx[13] }, $$inline: true }); const block = { key: key_1, first: null, c: function create() { first = empty(); create_component(target.$$.fragment); t0 = space(); span = element("span"); t1 = text(t1_value); set_style(span, "position", "absolute"); set_style(span, "left", /*target*/ ctx[13].x + "px"); set_style(span, "top", /*target*/ ctx[13].y + "px"); add_location(span, file$8, 71, 8, 3555); this.first = first; }, m: function mount(target$1, anchor) { insert_dev(target$1, first, anchor); mount_component(target, target$1, anchor); insert_dev(target$1, t0, anchor); insert_dev(target$1, span, anchor); append_dev(span, t1); current = true; }, p: function update(new_ctx, dirty) { ctx = new_ctx; const target_changes = {}; if (dirty & /*$targets*/ 8) target_changes.position = /*target*/ ctx[13]; target.$set(target_changes); if ((!current || dirty & /*$targets*/ 8) && t1_value !== (t1_value = /*target*/ ctx[13].name + "")) set_data_dev(t1, t1_value); if (!current || dirty & /*$targets*/ 8) { set_style(span, "left", /*target*/ ctx[13].x + "px"); } if (!current || dirty & /*$targets*/ 8) { set_style(span, "top", /*target*/ ctx[13].y + "px"); } }, i: function intro(local) { if (current) return; transition_in(target.$$.fragment, local); current = true; }, o: function outro(local) { transition_out(target.$$.fragment, local); current = false; }, d: function destroy(detaching) { if (detaching) detach_dev(first); destroy_component(target, detaching); if (detaching) detach_dev(t0); if (detaching) detach_dev(span); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$1.name, type: "each", source: "(70:4) {#each $targets as target (target.name)}", ctx }); return block; } // (76:4) {#if isModalOpen} function create_if_block$5(ctx) { const block = { c: noop, m: noop, d: noop }; dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$5.name, type: "if", source: "(76:4) {#if isModalOpen}", ctx }); return block; } function create_fragment$8(ctx) { let div1; let div0; let t0; let t1_value = /*$dotPosition*/ ctx[0].x + ""; let t1; let t2; let t3_value = /*$dotPosition*/ ctx[0].y + ""; let t3; let t4; let canvas_1; let t5; let movingdot; let t6; let each_blocks = []; let each_1_lookup = new Map(); let t7; let current; movingdot = new MovingDotPortfromReact({ props: { position: /*$dotPosition*/ ctx[0], boundaries: /*boundaries*/ ctx[6] }, $$inline: true }); movingdot.$on("move", /*move_handler*/ ctx[10]); let each_value = /*$targets*/ ctx[3]; validate_each_argument(each_value); const get_key = ctx => /*target*/ ctx[13].name; validate_each_keys(ctx, each_value, get_each_context$1, get_key); for (let i = 0; i < each_value.length; i += 1) { let child_ctx = get_each_context$1(ctx, each_value, i); let key = get_key(child_ctx); each_1_lookup.set(key, each_blocks[i] = create_each_block$1(key, child_ctx)); } let if_block = /*isModalOpen*/ ctx[2] && create_if_block$5(ctx); const block = { c: function create() { div1 = element("div"); div0 = element("div"); t0 = text("Minor Game Events Log for player ||| Position for Developer "); t1 = text(t1_value); t2 = space(); t3 = text(t3_value); t4 = space(); canvas_1 = element("canvas"); t5 = space(); create_component(movingdot.$$.fragment); t6 = space(); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } t7 = space(); if (if_block) if_block.c(); attr_dev(div0, "id", "overlayText"); attr_dev(div0, "class", "svelte-e0peue"); add_location(div0, file$8, 66, 4, 3145); attr_dev(canvas_1, "width", "100%"); attr_dev(canvas_1, "height", "100%"); attr_dev(canvas_1, "tabindex", "0"); add_location(canvas_1, file$8, 67, 4, 3273); attr_dev(div1, "style", /*spaceStyle*/ ctx[8]); add_location(div1, file$8, 65, 0, 3115); }, l: function claim(nodes) { throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); }, m: function mount(target, anchor) { insert_dev(target, div1, anchor); append_dev(div1, div0); append_dev(div0, t0); append_dev(div0, t1); append_dev(div0, t2); append_dev(div0, t3); append_dev(div1, t4); append_dev(div1, canvas_1); /*canvas_1_binding*/ ctx[9](canvas_1); append_dev(div1, t5); mount_component(movingdot, div1, null); append_dev(div1, t6); for (let i = 0; i < each_blocks.length; i += 1) { if (each_blocks[i]) { each_blocks[i].m(div1, null); } } append_dev(div1, t7); if (if_block) if_block.m(div1, null); current = true; }, p: function update(ctx, [dirty]) { if ((!current || dirty & /*$dotPosition*/ 1) && t1_value !== (t1_value = /*$dotPosition*/ ctx[0].x + "")) set_data_dev(t1, t1_value); if ((!current || dirty & /*$dotPosition*/ 1) && t3_value !== (t3_value = /*$dotPosition*/ ctx[0].y + "")) set_data_dev(t3, t3_value); const movingdot_changes = {}; if (dirty & /*$dotPosition*/ 1) movingdot_changes.position = /*$dotPosition*/ ctx[0]; movingdot.$set(movingdot_changes); if (dirty & /*$targets*/ 8) { each_value = /*$targets*/ ctx[3]; validate_each_argument(each_value); group_outros(); validate_each_keys(ctx, each_value, get_each_context$1, get_key); each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, div1, outro_and_destroy_block, create_each_block$1, t7, get_each_context$1); check_outros(); } if (/*isModalOpen*/ ctx[2]) { if (if_block) ; else { if_block = create_if_block$5(ctx); if_block.c(); if_block.m(div1, null); } } else if (if_block) { if_block.d(1); if_block = null; } }, i: function intro(local) { if (current) return; transition_in(movingdot.$$.fragment, local); for (let i = 0; i < each_value.length; i += 1) { transition_in(each_blocks[i]); } current = true; }, o: function outro(local) { transition_out(movingdot.$$.fragment, local); for (let i = 0; i < each_blocks.length; i += 1) { transition_out(each_blocks[i]); } current = false; }, d: function destroy(detaching) { if (detaching) detach_dev(div1); /*canvas_1_binding*/ ctx[9](null); destroy_component(movingdot); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].d(); } if (if_block) if_block.d(); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$8.name, type: "component", source: "", ctx }); return block; } function instance$8($$self, $$props, $$invalidate) { let $dotPosition; let $targets; let { $$slots: slots = {}, $$scope } = $$props; validate_slots('MovingDotSpacePortfromReact', slots, []); let canvas; let dotPosition = writable({ x: 900, y: 450 }); validate_store(dotPosition, 'dotPosition'); component_subscribe($$self, dotPosition, value => $$invalidate(0, $dotPosition = value)); let targets = writable([ { name: "Target 1", x: 50, y: 50, collisionType: "alert", collisiontext: "First Test" }, { name: "Target 2", x: 100, y: 100, collisionType: "", collisiontext: "" }, { name: "Entrance", x: 995, y: 660, collisionType: "", collisiontext: "" }, // Add more targets as needed { name: "Market Stall", x: 200, y: 300, collisionType: "", collisiontext: "" }, { name: "Inn Entrance", // A market stall in the bustling market area. x: 400, y: 450, collisionType: "", collisiontext: "" }, { name: "Town Hall", // The entrance to the inn for rest or information. x: 600, y: 350, collisionType: "", collisiontext: "" }, { name: "Fountain", // The entrance to the town hall for quests. x: 500, y: 500, collisionType: "", collisiontext: "" }, { name: "Bridge", // A fountain in the town square as a meeting point. x: 1100, y: 700, collisionType: "", collisiontext: "" }, { name: "Waterfall", // A bridge in the mystical forest area. x: 1300, y: 800, collisionType: "", collisiontext: "" }, { name: "Mountain Peak", // A waterfall that could hide secrets or treasures. x: 1500, y: 100, collisionType: "", collisiontext: "" } ]); validate_store(targets, 'targets'); component_subscribe($$self, targets, value => $$invalidate(3, $targets = value)); let boundaries = { maxX: 1885, maxY: 900, minX: 0, minY: 0 }; let isModalOpen = false; function updateDotPosition(newX, newY) { dotPosition.set({ x: newX, y: newY }); } // Collision check function const checkCollision = dotPos => { $targets.forEach(target => { if (dotPos.x < target.x + 10 && dotPos.x + 10 > target.x && dotPos.y < target.y + 10 && dotPos.y + 10 > target.y) { handleCollision(target); } }); }; // Handle collision based on the target object const handleCollision = target => { switch (target.collisionType) { case "": console.log("Nothing Happenedddd"); break; case "alert": alert(target.collisiontext); break; case "modal": $$invalidate(2, isModalOpen = true); break; } // Handle other permanent UI elements here }; // ... const spaceStyle = `position: relative; width: 100%; height: 100vh; border: 1px solid black; overflow: hidden; background-image: url('/AutoGameBackgrounds/1stGameLoc123.png'); background-size: cover; background-position: center;`; const writable_props = []; Object.keys($$props).forEach(key => { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console_1$2.warn(` was created with unknown prop '${key}'`); }); function canvas_1_binding($$value) { binding_callbacks[$$value ? 'unshift' : 'push'](() => { canvas = $$value; $$invalidate(1, canvas); }); } const move_handler = e => updateDotPosition(e.detail.x, e.detail.y); $$self.$capture_state = () => ({ onMount, writable, MovingDot: MovingDotPortfromReact, Target: MovingDotTargetPortfromReact, canvas, dotPosition, targets, boundaries, isModalOpen, updateDotPosition, checkCollision, handleCollision, spaceStyle, $dotPosition, $targets }); $$self.$inject_state = $$props => { if ('canvas' in $$props) $$invalidate(1, canvas = $$props.canvas); if ('dotPosition' in $$props) $$invalidate(4, dotPosition = $$props.dotPosition); if ('targets' in $$props) $$invalidate(5, targets = $$props.targets); if ('boundaries' in $$props) $$invalidate(6, boundaries = $$props.boundaries); if ('isModalOpen' in $$props) $$invalidate(2, isModalOpen = $$props.isModalOpen); }; if ($$props && "$$inject" in $$props) { $$self.$inject_state($$props.$$inject); } $$self.$$.update = () => { if ($$self.$$.dirty & /*$dotPosition*/ 1) { // Reactive statement to check collision whenever dotPosition changes $dotPosition && checkCollision($dotPosition); } }; return [ $dotPosition, canvas, isModalOpen, $targets, dotPosition, targets, boundaries, updateDotPosition, spaceStyle, canvas_1_binding, move_handler ]; } class MovingDotSpacePortfromReact extends SvelteComponentDev { constructor(options) { super(options); init(this, options, instance$8, create_fragment$8, safe_not_equal, {}); dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "MovingDotSpacePortfromReact", options, id: create_fragment$8.name }); } } /* node_modules\svelte-youtube-embed\Button.svelte generated by Svelte v3.59.2 */ const file$7 = "node_modules\\svelte-youtube-embed\\Button.svelte"; // (9:0) {:else} function create_else_block$1(ctx) { let button; let svg; let path; let mounted; let dispose; const block = { c: function create() { button = element("button"); svg = svg_element("svg"); path = svg_element("path"); attr_dev(path, "fill", "#ff4e45"); attr_dev(path, "d", "m10 15 5.19-3L10 9v6m11.56-7.83c.13.47.22 1.1.28 1.9.07.8.1 1.49.1 2.09L22 12c0 2.19-.16 3.8-.44 4.83-.25.9-.83 1.48-1.73 1.73-.47.13-1.33.22-2.65.28-1.3.07-2.49.1-3.59.1L12 19c-4.19 0-6.8-.16-7.83-.44-.9-.25-1.48-.83-1.73-1.73-.13-.47-.22-1.1-.28-1.9-.07-.8-.1-1.49-.1-2.09L2 12c0-2.19.16-3.8.44-4.83.25-.9.83-1.48 1.73-1.73.47-.13 1.33-.22 2.65-.28 1.3-.07 2.49-.1 3.59-.1L12 5c4.19 0 6.8.16 7.83.44.9.25 1.48.83 1.73 1.73Z"); add_location(path, file$7, 16, 6, 407); attr_dev(svg, "xmlns", "http://www.w3.org/2000/svg"); attr_dev(svg, "aria-hidden", "true"); attr_dev(svg, "class", "iconify iconify--mdi"); attr_dev(svg, "viewBox", "0 0 24 24"); add_location(svg, file$7, 10, 5, 263); attr_dev(button, "class", "play__btn svelte-1srk8gt"); attr_dev(button, "aria-label", "Play YouTube video"); add_location(button, file$7, 9, 2, 191); }, m: function mount(target, anchor) { insert_dev(target, button, anchor); append_dev(button, svg); append_dev(svg, path); if (!mounted) { dispose = listen_dev(button, "click", /*click_handler_1*/ ctx[4], false, false, false, false); mounted = true; } }, p: noop, i: noop, o: noop, d: function destroy(detaching) { if (detaching) detach_dev(button); mounted = false; dispose(); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_else_block$1.name, type: "else", source: "(9:0) {:else}", ctx }); return block; } // (5:0) {#if isCustomPlayButton} function create_if_block$4(ctx) { let button; let current; let mounted; let dispose; 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() { button = element("button"); if (default_slot) default_slot.c(); attr_dev(button, "class", "custom__play__btn svelte-1srk8gt"); attr_dev(button, "aria-label", "Play YouTube video"); add_location(button, file$7, 5, 2, 80); }, m: function mount(target, anchor) { insert_dev(target, button, anchor); if (default_slot) { default_slot.m(button, null); } current = true; if (!mounted) { dispose = listen_dev(button, "click", /*click_handler*/ ctx[3], false, false, false, false); mounted = true; } }, p: function update(ctx, dirty) { 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(button); if (default_slot) default_slot.d(detaching); mounted = false; dispose(); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$4.name, type: "if", source: "(5:0) {#if isCustomPlayButton}", ctx }); return block; } function create_fragment$7(ctx) { let current_block_type_index; let if_block; let if_block_anchor; let current; const if_block_creators = [create_if_block$4, create_else_block$1]; const if_blocks = []; function select_block_type(ctx, dirty) { if (/*isCustomPlayButton*/ ctx[0]) return 0; return 1; } current_block_type_index = select_block_type(ctx); if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); const block = { c: function create() { 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_blocks[current_block_type_index].m(target, anchor); insert_dev(target, if_block_anchor, anchor); current = true; }, p: function update(ctx, [dirty]) { let previous_block_index = current_block_type_index; current_block_type_index = select_block_type(ctx); if (current_block_type_index === previous_block_index) { if_blocks[current_block_type_index].p(ctx, dirty); } else { group_outros(); transition_out(if_blocks[previous_block_index], 1, 1, () => { if_blocks[previous_block_index] = null; }); check_outros(); if_block = if_blocks[current_block_type_index]; if (!if_block) { if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); if_block.c(); } else { if_block.p(ctx, dirty); } transition_in(if_block, 1); if_block.m(if_block_anchor.parentNode, if_block_anchor); } }, 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_blocks[current_block_type_index].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('Button', slots, ['default']); let { isCustomPlayButton } = $$props; $$self.$$.on_mount.push(function () { if (isCustomPlayButton === undefined && !('isCustomPlayButton' in $$props || $$self.$$.bound[$$self.$$.props['isCustomPlayButton']])) { console.warn("