/** * Reacton v4.0.12 * (c) 2022-2024 | github.com/reacton-js * Released under the MIT License. **/ var Rtn = function () { 'use strict'; const regFile = /\.\w+$/; const regUpName = /[A-Z]/g; const regParams = /:(\w+)/g; const regSubtins = /{{([^{}]*?)}}/; const regQuote = /('|"|`)[^]*?\1/g; const regLeft = /;|\bof\b|\bin\b/; const regVars = /\b[A-Za-z_]\w*?\b/g; const SERVICE = new WeakMap(); const newDocument = new DOMParser().parseFromString('', 'text/html'); const globKeys = 'window,location,history,document,navigation,screen,arguments'; const mainKeys = '$host,$shadow,$data,$state,$event,$router,$,$$,$entities'; const getVars = str => str.replace(regQuote, '').split(regLeft)[0].match(regVars).join(); const regEntities = [[/&/g, '&'], [//g, '>'], [/"/g, '"'], [/'/g, ''']]; const methNames = ['push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse', 'toString', 'add', 'set', 'delete', 'clear']; const methProxy = methNames.reduce((obj, prop) => (obj[prop] = true, obj), {}); const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor; const getNameKebab = (char, pos) => (pos > 0 ? '-' : '') + char; const loadEvent = new DocumentFragment(); const rootStorage = new Set(); const propService = Symbol(); const propAnchor = Symbol(); const propRouter = Symbol(); const propState = Symbol(); const propCycle = Symbol(); const propOwner = Symbol(); const propView = Symbol(); const propFunc = Symbol(); const propDeps = Symbol(); const getTarget = Symbol(); const getEvents = Symbol(); const getAlias = Symbol(); const getBools = Symbol(); const getProps = Symbol(); const getObser = Symbol(); const getDeps = Symbol(); const getRoot = Symbol(); const hasRoot = Symbol(); const isObject = Symbol(); const isLight = Symbol(); class propHooks { constructor(state) { this[propState] = state; } get(_, prop) { return this[propState][prop]; } set(_, prop, value) { this[propState][prop] = value; return true; } } const stateHooks = { get: (target, prop) => target[prop], set: (target, prop, value) => (target[prop] = value, true) }; const configMutations = { childList: true, subtree: true }; async function _rtn(...args) { for (let arg of args) { if (arg instanceof HTMLTemplateElement) { const content = arg.content; const scripts = [...content.querySelectorAll('script')].map(script => content.removeChild(script).innerHTML).join(''); const _class = await (scripts ? new AsyncFunction(scripts)() : null); if (typeof _class !== 'function') { console.error(`Error: return value "${_class}" is not a class`); continue; } _class.template = arg.innerHTML; arg = _class; } else if (typeof arg !== 'function') { console.error(`Error: argument "${arg}" is not a class or