UNPKG

qcobjects

Version:

QCObjects is an Open-source framework that empowers full-stack developers to make micro-services and micro-frontends into an N-Tier architecture.

4 lines 406 kB
{ "version": 3, "sources": ["../../src/is_raw_class.ts", "../../src/ObjectName.ts", "../../src/getType.ts", "../../src/make_global.ts", "../../src/PrimaryCollections.ts", "../../src/Export.ts", "../../src/_import_.ts", "../../src/platform.ts", "../../src/Logger.ts", "../../src/Cast.ts", "../../src/DOMCreateElement.ts", "../../src/IncrementInstanceID.ts", "../../src/introspection.ts", "../../src/Package.ts", "../../src/InheritClass.ts", "../../src/isQCObjects.ts", "../../src/is_a.ts", "../../src/is_forbidden_name.ts", "../../src/LegacyCopy.ts", "../../src/Class.ts", "../../src/ClassFactory.ts", "../../src/Base64.ts", "../../src/basePath.ts", "../../src/DataStringify.ts", "../../src/domain.ts", "../../src/New.ts", "../../src/secretKey.ts", "../../src/Crypt.ts", "../../src/ConfigSettings.ts", "../../src/CONFIG.ts", "../../src/Processor.ts", "../../src/routings.ts", "../../src/asyncLoad.ts", "../../src/ComplexStorageCache.ts", "../../src/serviceLoader.ts", "../../src/tag_filter.ts", "../../src/componentLoader.ts", "../../src/Component.ts", "../../src/ComponentFactory.ts", "../../src/Service.ts", "../../src/globalSettings.ts", "../../src/top.ts", "../../src/captureFalseTouch.ts", "../../src/range.ts", "../../src/defaultProcessors.ts", "../../src/findPackageNodePath.ts", "../../src/Import.ts", "../../src/mathFunctions.ts", "../../src/NamespaceRef.ts", "../../src/Ready.ts", "../../src/ArrayCollection.ts", "../../src/Tag.ts", "../../src/shortCode.ts", "../../src/super.ts", "../../src/waitUntil.ts", "../../src/subelements.ts", "../../src/loadSDK.ts", "../../src/MainProcess.ts", "../../src/index.cts", "../../src/assign.ts", "../../src/QCObjects.ts", "../../src/BackendMicroservice.ts", "../../src/DefaultTemplateHandler.ts", "../../src/RegisterClass.ts", "../../src/SourceJS.ts", "../../src/SourceCSS.ts", "../../src/WidgetsFactory.ts", "../../src/Controller.ts", "../../src/View.ts", "../../src/VO.ts", "../../src/Effect.ts", "../../src/TransitionEffect.ts", "../../src/Timer.ts", "../../src/DDO.ts", "../../src/Toggle.ts", "../../src/DocumentLayout.ts"], "sourcesContent": ["export const __is_raw_class__ = (o_c: any): boolean => {\n return !!((typeof o_c === \"function\" && o_c.toString().startsWith(\"class\")));\n};\n", "/**\n * Returns the object or function name\n *\n * @param Object or function\n */\nexport const ObjectName = (o: any):string => {\n let ret = \"\";\n if (typeof o === \"function\" && Object.hasOwn(o, \"name\") && o.name !== \"\") {\n ret = o.name;\n } else if (typeof o !== \"undefined\" && typeof o.constructor === \"function\" && o.constructor.name !== \"\") {\n ret = o.constructor.name;\n } else if (typeof o !== \"undefined\" && typeof o.constructor === \"object\") {\n ret = o.constructor.toString().replace(/\\[(.*?)\\]/g, \"$1\").split(\" \").slice(1).join(\"\");\n }\n return ret;\n};", "import { __is_raw_class__ } from \"./is_raw_class\";\nimport { ObjectName } from \"./ObjectName\";\n\n/**\n * Determine the type of the Object for any QCObjects Object\n *\n * @param {Object} object\n */\nexport const __getType__ = function __getType__(o_c: any): any {\n let _ret_ = \"\";\n switch (true) {\n case typeof o_c === \"object\" &&\n (!!o_c.constructor &&\n !!o_c.constructor.name)\n && o_c.constructor.name !== \"\":\n _ret_ = o_c.constructor.name;\n break;\n case typeof o_c === \"function\" && !!o_c.name:\n _ret_ = o_c.name;\n break;\n case __is_raw_class__(o_c) && !!o_c.name:\n _ret_ = o_c.name;\n break;\n case (!!o_c && !!o_c.__classType) && o_c.__classType !== \"\":\n _ret_ = o_c.__classType;\n break;\n case (!!o_c && !!o_c.__definition) && (!!o_c.__definition.__classType) && o_c.__definition.__classType !== \"\":\n _ret_ = o_c.__definition.__classType;\n break;\n default:\n _ret_ = ObjectName(o_c);\n break;\n }\n return _ret_;\n};\n", "import { _top, set } from \"./top\";\ndeclare const global:any;\ndeclare const globalThis:any;\n\nexport const __make_global__ = (f:any):void => {\n if (!!f && !!f.name) {\n if (typeof _top !== \"undefined\" && typeof f !== \"undefined\" && _top !== null && !Object.hasOwn(_top,f.name)) {\n set(f.name, f);\n } else if (typeof global !== \"undefined\"){\n global[f.name] = f;\n } else if (typeof globalThis !== \"undefined\"){\n globalThis[f.name] = f;\n }\n \n }\n\n};", "import { T_QC_CLASSES, T_QC_PACKAGES } from \"types\";\nimport { __getType__ } from \"./getType\";\nimport { __make_global__ } from \"./make_global\";\n\nexport var _QC_CLASSES: T_QC_CLASSES = {};\nexport var _QC_PACKAGES: T_QC_PACKAGES = {};\nexport var _QC_PACKAGES_IMPORTED: any[] = [];\nexport var _QC_READY_LISTENERS: any[] = [];\n\nexport const __register_class__ = function (_class_: any, __namespace?: string): any {\n const __classType = __getType__(_class_);\n let name = _class_.name || __classType;\n if (name.toLowerCase() === \"function\") {\n name = __classType;\n }\n if (typeof _class_.__definition === \"undefined\") {\n _class_.__definition = {};\n }\n _class_.__definition.__classType = __classType;\n if (typeof __namespace !== \"undefined\") {\n _class_.__definition.__namespace = __namespace;\n }\n _QC_CLASSES[name] = _class_;\n __make_global__(_class_);\n return _QC_CLASSES[name];\n};\n\nexport const get_QC_CLASS = (name:string):any => {\n return _QC_CLASSES[name];\n};\n\nconst _get_packages_names = function <T>(_packages: any): T[] {\n let _keys: any[] = [];\n for (const _k of Object.keys(_packages)) {\n if (\n typeof _packages[_k] !== \"undefined\" &&\n typeof _packages[_k] !== \"function\" &&\n Object.hasOwn(_packages[_k], \"length\") &&\n _packages[_k].length > 0\n ) {\n _keys.push(_k);\n _keys = _keys.concat(_get_packages_names(_packages[_k]));\n }\n }\n return _keys as T[];\n};\n\n\nexport const getPackagesNamesList = (): any[] => {\n return _get_packages_names(_QC_PACKAGES);\n};\n\nexport const getPackagesList = (): any[] => {\n return [...getPackagesNamesList()].map(<T>(packagename: string): T => {\n const _classesList: any[] = _QC_PACKAGES[packagename] as any[];\n let _ret_: any = undefined;\n if (_classesList) {\n _ret_ = {\n packageName: packagename,\n classesList: _classesList.filter(function (): boolean {\n return true;\n })\n };\n }\n return _ret_ as T;\n }).filter(function (_p: any): boolean {\n return typeof _p !== \"undefined\";\n });\n};\n\nexport const getClassesList = (): any[] => {\n let _classesList: any[] = [];\n [...getPackagesList()].forEach(function <T>(_package_element: any): T {\n _classesList = _classesList.concat(_package_element.classesList.map(\n (_class_element: any) => {\n return {\n packageName: _package_element.packageName,\n className: `${_package_element.packageName}.${__getType__(_class_element)}`,\n classFactory: _class_element\n };\n }\n ));\n return _package_element as T;\n });\n\n return _classesList;\n};\n\nexport const getClassesNamesList = (): any[] => {\n return [...getClassesList()].map(<T>(_class_element: any): T => {\n return _class_element.className as T;\n });\n};\n\nexport const set_QC_PACKAGE = (packageName: string, _qc_packages: any[]):void => {\n _QC_PACKAGES[packageName] = _qc_packages;\n};\n\n", "import { __make_global__ } from \"./make_global\";\n\nexport const Export = function (f: any):void {\n return __make_global__(f);\n};\nExport.prototype.toString = function () {\n return \"Export(function or symbol) { [QCObjects native code] }\";\n};\n", "import { logger } from \"./Logger\";\n\nasync function _import_(name:string):Promise<any> {\n logger.debug(`Importing ${name}...`);\n function isPackage(name:string) {\n logger.debug(`Validating if ${name} is a package name...`);\n // Simple check to determine if the name is a package\n // This can be enhanced based on your specific needs\n return !name.startsWith(\".\") && !name.startsWith(\"/\") && !name.includes(\"/\");\n }\n \n try {\n // Ensure the name has a .js extension if it's not a package\n const hasExtension = /\\.[^/\\\\]+$/.test(name);\n if (!hasExtension && !isPackage(name)) {\n logger.debug(`${name} does not have an extension and is not a package. Adding js extension.`);\n name += \".js\";\n }\n \n const m:any = await import(name);\n return m;\n } catch (error:any) {\n logger.warn(`Failed to load module: ${error}`);\n }\n }\n \nexport {_import_};", "import { _import_ } from \"./_import_\";\nimport { logger } from \"./Logger\";\n\nexport const isDeno:boolean = (typeof window !== \"undefined\" && \"Deno\" in window);\nexport const isBrowser:boolean = (typeof window !== \"undefined\" && typeof window.self !== \"undefined\" && window === window.self) && !isDeno;\nexport const isNodeCommonJS:boolean = (typeof module !== \"undefined\");\n// eslint-disable-next-line no-unused-vars\nexport const deno_require = (name:string):void => { /* not yet implemented */};\nexport const _require_ = (name:string):any => {\n \n return (isDeno)?(deno_require(name)):(\n ( (name):any => {\n let r:any;\n try {\n (async () => {\n r = await _import_(name);\n })().then((m:any) => {\n r = (m && m.default) || m;\n })\n .catch ((e:any) => {\n logger.warn(`An error ocurred: ${e}`);\n });\n\n } catch (e:any) {\n logger.debug(`An error ocurred importing module. ${e}`);\n r = {export:{}};\n }\n return r;\n } ) (name)\n );\n};\ndeclare const cordova: any;\n\nexport const is_phonegap:boolean = (\n function () {\n return (typeof cordova !== \"undefined\");\n }\n)();", "import { Export } from \"./Export\";\nimport { isBrowser } from \"./platform\";\n\nexport class Logger {\n debugEnabled = true;\n infoEnabled = true;\n warnEnabled = true;\n debug(message: string): void {\n if (this.debugEnabled) {\n console.log(\"\\x1b[35m%s\\x1b[0m\", `[DEBUG][${performance.now().toLocaleString()}] ${message}`);\n }\n }\n\n info(message: string): void {\n let color;\n if (this.infoEnabled) {\n if (isBrowser) {\n color = \"\\x1b[103m%s\\x1b[0m\";\n } else {\n color = \"\\x1b[33m%s\\x1b[0m\";\n }\n console.info(color, `[INFO][${performance.now().toLocaleString()}] ${message}`);\n }\n }\n\n warn(message: string): void {\n if (this.warnEnabled) {\n console.warn(\"\\x1b[31m%s\\x1b[0m\", `[WARN][${performance.now().toLocaleString()}] ${message}`);\n }\n }\n}\n\nexport const logger: Logger = new Logger();\nExport(logger);", "import { logger } from \"./Logger\";\n\n/**\n * Casts an object to another object class type\n *\n * @param {Object} obj_source\n * @param {Object} obj_dest\n */\nexport const _Cast = function (obj_source: any, obj_dest: any):any {\n for (const v in obj_source) {\n if (typeof obj_source[v] !== \"undefined\") {\n try {\n obj_dest[v] = obj_source[v];\n } catch (e:any) {\n logger.debug(`An error ocurred: ${e}.`);\n logger.warn(`Unable to cast ${(typeof obj_source).toString()}.${typeof v.toString()} to ${(typeof obj_dest).toString()}.${typeof v.toString()}`);\n }\n }\n }\n return obj_dest;\n};\n\n/**\n * Casts an object to another object class type. Only properties\n *\n * @param {Object} obj_source\n * @param {Object} obj_dest\n */\nexport const _CastProps = function (obj_source: any, obj_dest: any, _ignoreError:boolean = true):any {\n for (const v in obj_source) {\n if (typeof obj_source[v] !== \"undefined\" && typeof obj_source[v] !== \"function\") {\n try {\n obj_dest[v] = obj_source[v];\n } catch (e:any) {\n if (!_ignoreError){\n logger.debug(`An error ocurred: ${e}.`);\n }\n }\n } else if (typeof obj_source[v] === \"function\") {\n try {\n obj_dest[v] = obj_source[v].bind(obj_dest);\n } catch (e:any) {\n logger.warn(e);\n }\n }\n }\n return obj_dest;\n};\n", "import { IQCObjectsElement } from \"types\";\nimport { isBrowser } from \"./platform\";\n\nexport const _DOMCreateElement = function (elementName: string, props?: any[], children?: any): IQCObjectsElement {\n let _ret_;\n if (isBrowser) {\n _ret_ = _DOMCreateComplexElement(elementName, props, children) as unknown as IQCObjectsElement;\n } else {\n _ret_ = {} as IQCObjectsElement;\n }\n return _ret_;\n};\n\n\nconst ComplexTypeCall = (_type: Function, { props, children }: { props?: any[], children?: any }): IQCObjectsElement => {\n return _type({ props, children }) as IQCObjectsElement;\n};\nexport const _DOMCreateComplexElement = (_type: string | Function, props?: any[], children?: any): HTMLElement | IQCObjectsElement => {\n\n if (typeof _type !== \"string\") {\n return ComplexTypeCall(_type, { props, children });\n }\n const element = document.createElement(_type);\n\n if (props) {\n Object.entries(props).forEach(([key, value]) => {\n if (typeof value === \"string\" || typeof value === \"number\") {\n element.setAttribute(key, value.toString());\n } else if (typeof value === \"function\" && key.toLowerCase().startsWith(\"on\")) {\n element.addEventListener(key.slice(2).toLowerCase(), value.bind(element));\n }\n });\n }\n\n if (Array.isArray(children)) {\n children.filter((child => child instanceof Node)).forEach(child => {\n element.appendChild(child);\n });\n } else if (children instanceof Node) {\n element.appendChild(children);\n } else if (typeof children === \"string\") {\n element.innerHTML = children;\n }\n\n return element;\n};\n", "/**\n * Primary instance ID of all objects\n */\nexport var __instanceID = 0;\n\nexport const IncrementInstanceID = (): void => {\n __instanceID = (typeof __instanceID === \"undefined\" || __instanceID === null) ? (0) : (__instanceID + 1);\n};\n", "export const _protected_code_ = (_: any): void => {\n const __oldtoString = (typeof _.prototype !== \"undefined\") ? (_.prototype.toString) : (function () {\n return \"\";\n });\n if (typeof _.prototype !== \"undefined\") {\n _.prototype.toString = function (): string {\n const _protected_symbols = [\n \"__qcobjects__\",\n \"__qcobjects_sdk__\",\n \"__loaded__\",\n \"ComplexStorageCache\",\n \"css\",\n \"append\",\n \"attachIn\",\n \"debug\",\n \"info\",\n \"warn\",\n \"QC_Append\",\n \"set\",\n \"get\",\n \"done\",\n \"componentDone\",\n \"_new_\",\n \"__new__\",\n \"Class\",\n \"ClassFactory\",\n \"New\",\n \"Export\",\n \"Package\",\n \"Import\",\n \"subelements\",\n \"componentLoader\",\n \"buildComponents\",\n \"Controller\",\n \"View\",\n \"VO\",\n \"Service\",\n \"serviceLoader\",\n \"JSONService\",\n \"ConfigService\",\n \"SourceJS\",\n \"SourceCSS\",\n \"ArrayList\",\n \"ArrayCollection\",\n \"Effect\",\n \"Timer\",\n \"sum\",\n \"avg\",\n \"table\",\n \"max\",\n \"min\",\n \"range\",\n \"matrix\",\n \"matrix2d\",\n \"matrix3d\",\n \"unique\",\n \"uniqueId\",\n \"shortCode\",\n \"NamespaceRef\"\n ];\n let _ret_;\n if (_protected_symbols.includes(this.name)) {\n _ret_ = this.name + \"{ [QCObjects native code] }\";\n } else {\n _ret_ = __oldtoString.call(this);\n }\n return _ret_ as string;\n };\n }\n};\n(_protected_code_)(Function);\nexport const _methods_ = function <T>(_: any): T[] {\n const _m = [];\n for (const i in _) {\n if ((typeof _[i]).toLowerCase() === \"function\") {\n _m.push(_[i]);\n }\n }\n return _m as T[];\n};\n", "import { __is_raw_class__ } from \"./is_raw_class\";\nimport {_QC_PACKAGES, set_QC_PACKAGE, __register_class__ } from \"./PrimaryCollections\";\n\n/**\n * Defines a package for Class classification\n *\n * @param {Object} namespace\n * @param {Object} classes\n */\nexport const Package = (namespace: string, classes: any[] = []): any[] => {\n\n if (Object.hasOwn(_QC_PACKAGES, namespace) &&\n typeof _QC_PACKAGES[namespace] !== \"undefined\" &&\n typeof _QC_PACKAGES[namespace] !== \"string\" &&\n Object.hasOwn(_QC_PACKAGES[namespace], \"length\") &&\n _QC_PACKAGES[namespace].length > 0 &&\n typeof classes !== \"undefined\" &&\n Object.hasOwn(classes, \"length\") &&\n classes.length > 0\n ) {\n classes.forEach((_class_: any) => {\n __register_class__(_class_, namespace);\n });\n set_QC_PACKAGE(namespace, _QC_PACKAGES[namespace].concat(classes));\n } else if (typeof classes !== \"undefined\"\n && typeof classes !== \"undefined\"\n && Object.hasOwn(classes, \"length\")\n && classes.length > 0) {\n classes.forEach((_class_: any) => {\n __register_class__(_class_, namespace);\n });\n set_QC_PACKAGE(namespace, classes);\n } else if (__is_raw_class__(classes)) {\n if (typeof (classes as any).__definition === \"undefined\") {\n (classes as any).__definition = {};\n }\n (classes as any).__definition.__namespace = namespace;\n (classes as any).__namespace = namespace;\n __register_class__(classes, namespace);\n set_QC_PACKAGE(namespace, [classes]);\n } else {\n throw new Error (`An error ocurred. It was not possible to add classes to ${namespace}.`);\n }\n return ((Object.hasOwn(_QC_PACKAGES, namespace)) ? (_QC_PACKAGES[namespace]) : []) as any[] | [];\n};\n", "import { type IInheritClass, type IQCObjectsElement, type TBody } from \"types\";\nimport { logger } from \"./Logger\";\nimport { __instanceID, IncrementInstanceID } from \"./IncrementInstanceID\";\nimport { _CastProps, _Cast } from \"./Cast\";\nimport { _DOMCreateElement } from \"./DOMCreateElement\";\nimport { __getType__ } from \"./getType\";\nimport { _methods_ } from \"./introspection\";\nimport { is_a } from \"./is_a\";\nimport { isBrowser } from \"./platform\";\nimport { _QC_CLASSES } from \"./PrimaryCollections\";\nimport { Package } from \"./Package\";\n\nexport class InheritClass implements IInheritClass {\n [key: string]: any;\n __definition: any;\n private _body: TBody;\n public get body(): TBody {\n return this._body;\n }\n public set body(value: TBody) {\n this._body = value;\n }\n childs: any;\n __instanceID!: number;\n\n constructor(_o_?: any) {\n\n if (typeof _o_ !== \"undefined\" && typeof _o_.__definition !== \"undefined\") {\n this.__definition = {\n ...(_o_.__definition)\n };\n }\n\n const self: this = this;\n if (typeof _o_ !== \"undefined\" && _o_ !== null) {\n Object.keys(_o_)\n .filter(function (k) {\n return isNaN(k as any) && ![\"__instanceID\", \"__classType\", \"__definition\"].includes(k);\n })\n .forEach(function (key) {\n if (typeof self[key] === \"function\") {\n self[key] = _o_[key].bind(self);\n } else {\n self[key] = _o_[key];\n }\n });\n }\n\n IncrementInstanceID();\n if (!self.__instanceID) {\n Object.defineProperty(self, \"__instanceID\", {\n value: __instanceID,\n writable: false\n });\n }\n\n if (typeof self.__definition !== \"undefined\") {\n Object.keys(self.__definition).filter(function (k) {\n return isNaN(k as any) && ![\"name\", \"__instanceID\", \"__classType\", \"__definition\"].includes(k);\n }).forEach(function (key) {\n if (typeof self.__definition[key] === \"function\") {\n self[key] = self.__definition[key].bind(self);\n } else {\n self[key] = self.__definition[key];\n }\n });\n }\n _methods_((_QC_CLASSES as any)[self.__classType]).map(function (m): any {\n self[(m as Function).name] = (m as Function).bind(self);\n return m;\n });\n _methods_(self.__definition).map(function (m): any {\n self[(m as Function).name] = (m as Function).bind(self);\n return m;\n });\n\n if (self.body) {\n if (typeof self.__definition === \"undefined\" || (!Object.hasOwn(self.__definition, \"body\")) || typeof self.__definition.body === \"undefined\") {\n try {\n if (isBrowser) {\n self.body = _DOMCreateElement(self.__definition.__classType);\n } else {\n self.body = {};\n }\n } catch (e: any) {\n logger.debug(`An error ocurred: ${e}.`);\n self.body = {};\n }\n } else if (Object.hasOwn(self.__definition, \"body\")) {\n self.body = self.__definition.body;\n }\n }\n\n\n try {\n self.__new__.call(self, _o_);\n if (typeof self === \"object\" && Object.hasOwn(self, \"_new_\") && typeof (self._new_ as any).isCalled === \"undefined\") {\n try {\n self._new_(_o_);\n (self._new_ as any).isCalled = true;\n } catch (e: any) {\n logger.warn(`${self.__classType}._new_() failed with error: ${e}`);\n }\n }\n } catch (e: any) {\n logger.warn(e);\n }\n }\n\n static get __classType(): any {\n return (Object.getPrototypeOf(this.constructor) as Function).name;\n }\n\n get __classType(): string {\n return this.constructor.name;\n }\n\n\n static hierarchy(__class__: any): any[] {\n const __classType = function (o_c: any): any {\n return (Object.hasOwn(o_c, \"__classType\")) ? (o_c.__classType) : (__getType__.call(__class__, o_c));\n };\n const __hierarchy__proto__ = (c: any): any[] => {\n return (typeof c !== \"undefined\" && typeof c.__proto__ !== \"undefined\" && c.__proto__ !== null) ? (((__classType(c) !== \"\") ? ([__classType(c)]) : ([])).concat(__hierarchy__proto__(c.__proto__))) : ([]);\n };\n\n if (typeof __class__ === \"undefined\" || __class__ === null) {\n __class__ = this;\n }\n let __hierarchy = [];\n __hierarchy.push(__classType(__class__));\n __hierarchy = __hierarchy.concat(__hierarchy__proto__(__class__.__proto__));\n return __hierarchy;\n }\n\n\n __namespace?: string | undefined;\n\n __new__(_o_: any): void {\n _CastProps(_o_, this);\n }\n\n // eslint-disable-next-line no-unused-vars\n _new_(_o_?: any): void { }\n\n static getParentClass(): any {\n return Object.getPrototypeOf(this.prototype.constructor);\n }\n getParentClass(): any {\n return (this.constructor as typeof InheritClass).getParentClass();\n }\n\n\n static getClass(): any {\n return Object.getPrototypeOf(this.constructor);\n }\n\n getClass(): any {\n return (this.constructor as typeof InheritClass).getClass();\n }\n\n css(_css: any): any {\n if (typeof this.body !== \"undefined\" && typeof this?.body !== \"string\" && typeof (this?.body as HTMLElement)?.style !== \"undefined\") {\n logger.debug(\"body style\");\n if (this.body) {\n (this.body as any).style = _Cast(_css, (this?.body as HTMLElement)?.style);\n }\n }\n return (typeof this.body !== \"string\") ? (this?.body as HTMLElement)?.style : {};\n }\n\n hierarchy(): any {\n const __instance__ = this;\n return (this.constructor as typeof InheritClass).hierarchy(__instance__);\n }\n\n\n append(_child?: any): void {\n const child: any = _child || this.body;\n logger.debug(\"append: start\");\n if (is_a(child, \"Component\")) {\n logger.debug(\"append: child is a Component\");\n logger.debug(`appending the body of ${child.name}`);\n }\n if (typeof this.body !== \"undefined\") {\n logger.debug(\"append element\");\n if (arguments.length > 0) {\n logger.debug(\"append to element\");\n if (typeof this.body !== \"string\") {\n if (typeof (this.body as IQCObjectsElement)?.append !== \"undefined\") {\n (this?.body as IQCObjectsElement)?.append(child);\n } else {\n throw Error(\"body.append is undefined. That means the body is not well formed.\");\n }\n } else {\n this.append(child);\n }\n if (typeof this.childs === \"undefined\") {\n this.childs = [];\n }\n this.childs.push(child);\n } else {\n if (isBrowser) {\n logger.debug(\"append to body\");\n document.body.append(child);\n }\n }\n }\n }\n\n attachIn(tag: any): void {\n if (isBrowser) {\n const tags = (document as any).subelements(tag);\n for (let i = 0, j = tags.length; i < j; i++) {\n tags[i].append(this as any);\n }\n } else {\n throw new Error(\"attachIn not yet implemented for non browser platforms\");\n }\n }\n\n}\n\nPackage(\"com.qcobjects\", [InheritClass]);", "import { InheritClass } from \"./InheritClass\";\n\nexport const isQCObjects_Object = function (_:any):boolean {\n return (!!((typeof _ === \"object\" &&\n Object.hasOwn(_, \"__classType\") &&\n (!!_.__instanceID) &&\n Object.hasOwn(_, \"__definition\") &&\n typeof _.__definition !== \"undefined\"\n ))) || _ instanceof InheritClass;\n };\n\n export const isQCObjects_Class = function (_:any):boolean {\n return (!!((typeof _ === \"function\" &&\n (!_.__instanceID) &&\n (!!_.__definition) &&\n typeof _.__definition !== \"undefined\" &&\n !!_.__definition.__classType\n ))) || _.prototype instanceof InheritClass;\n };\n", "import { __getType__ } from \"./getType\";\nimport { isQCObjects_Class, isQCObjects_Object } from \"./isQCObjects\";\nimport { ObjectName } from \"./ObjectName\";\n\n/**\n * Returns if a class or object is from a determinated type\n * @param {Object} object\n * @param {String} typeName\n */\nexport const is_a = (obj: any, typeName: string):boolean => {\n return !!((typeof obj !== \"undefined\" && obj !== null &&\n (((isQCObjects_Class(obj) || isQCObjects_Object(obj)) && (obj.hierarchy().includes(typeName))) ||\n __getType__(obj) === typeName ||\n ObjectName(obj) === typeName ||\n typeof obj === typeName)));\n};", "/**\n * Internal use to determine the forbidden names for classes\n * Reserved words\n *\n * @param {String} name\n * @param {Object} type\n * @param {Object} definition\n */\nexport const __is__forbidden_name__ = (name: string):boolean => {\n return ([\"__proto__\", \"prototype\", \"Object\", \"Map\", \"defineProperty\", \"indexOf\", \"toString\", \"__instanceID\", \"function\", \"Function\"].indexOf(name) !== -1);\n};\n", "import { __is_raw_class__ } from \"./is_raw_class\";\n\nexport const _LegacyCopy = function (obj:any, _ignore?:string[]):any {\n let _value_;\n switch (true) {\n case typeof obj === \"string\":\n _value_ = obj;\n break;\n case typeof obj === \"number\":\n _value_ = obj;\n break;\n case typeof obj === \"object\":\n _value_ = [{...Object.keys(obj).filter(k => !_ignore?.includes(k))}]\n .map(k => {return {[k as never]:obj[k as never]}; })\n .reduce ((p, c) => Object.assign(p, c)) as any;\n break;\n case typeof obj === \"function\":\n _value_ = obj.bind({});\n break;\n case __is_raw_class__(obj):\n _value_ = class extends obj { };\n break;\n default:\n break;\n }\n return _value_;\n };\n", "import { _QC_CLASSES } from \"./PrimaryCollections\";\nimport { _Cast, _CastProps } from \"./Cast\";\nimport { _DOMCreateElement } from \"./DOMCreateElement\";\nimport { __getType__ } from \"./getType\";\nimport { __instanceID, IncrementInstanceID } from \"./IncrementInstanceID\";\nimport { _methods_ } from \"./introspection\";\nimport { is_a } from \"./is_a\";\nimport { __is__forbidden_name__ } from \"./is_forbidden_name\";\nimport { _LegacyCopy } from \"./LegacyCopy\";\nimport { logger } from \"./Logger\";\nimport { isBrowser } from \"./platform\";\nimport { IQCObjectsElement, TBody, TClass } from \"types\";\nimport { InheritClass } from \"./InheritClass\";\nimport { _top } from \"./top\";\n\n/**\n * Creates new object class of another object\n *\n * @param {String} name\n * @param {Object} type\n * @param {Object} definition\n * \n * @example \n * Class (name, type, definition)\n * Class (name, type)\n * Class (name, definition)\n * Class ()\n * \n * \n * const MyClass = Class (\"MyComponent\", Component, {\n * name: \"one_component\",\n * method1 : () => {console.log (\"done\") }\n * })\n * const myClassInstance = new MyClass ({name: \"one_component\"})\n * \n * const MyClass = Class (\"MyService\",{\n * name: \"myservice\",\n * })\n * \n * const myClassInstance = new MyClass ({name: \"myservice\"})\n */\n\n\n\nexport const Class: TClass = (name?: string, _type?: unknown, _definition?: unknown): InheritClass => {\n const _types_ = {};\n let type: unknown, definition: unknown;\n\n switch (true) {\n case !name && !_type && !_definition:\n return class { } as unknown as InheritClass;\n case !!name && !_type && !_definition:\n type = class { };\n definition = {};\n break;\n case !!name && !_type && !!_definition:\n type = class { };\n definition = _definition;\n break;\n case !!name && !!_type && !!_definition:\n type = _type;\n definition = _definition;\n break;\n default:\n return class { } as unknown as InheritClass;\n }\n if (typeof name !== \"string\") {\n throw new Error(\"Class name must be a string\");\n }\n\n if (typeof type !== \"function\") {\n throw new Error(\"Class type must be a function or class\");\n }\n\n if (__is__forbidden_name__(name)) {\n throw new Error(`${name} is not an allowed word in the name of a class`);\n }\n\n if (typeof (type as any).__definition === \"object\"\n && (type as any).__definition\n && Object.keys((type as any).__definition).length !== 0) {\n (definition as any).__definition = Object.assign(_LegacyCopy((type as any).__definition,[\"name\"]), type);\n }\n\n (_types_ as any)[type.name] = type;\n\n if (typeof definition === \"undefined\" || definition === null) {\n definition = {};\n } else {\n definition = { ...definition };\n }\n\n /* hack to prevent duplicate __instanceID */\n if (typeof (definition as any).__instanceID !== \"undefined\") {\n delete (definition as any).__instanceID;\n }\n\n _QC_CLASSES[name] = class extends (_types_ as any)[type.name] {\n __instanceID!: number;\n __namespace?: string | undefined;\n __definition: any = {\n ...(definition as any)\n };\n childs: any;\n private _body: TBody;\n public get body(): TBody {\n return this._body;\n }\n public set body(value: TBody) {\n this._body = value;\n }\n\n static get __classType(): any {\n return (Object.getPrototypeOf(this.constructor) as Function).name;\n }\n\n get __classType(): string {\n return this.constructor.name;\n }\n\n static hierarchy(__class__: any): any[] {\n const __classType = function (o_c: any): any {\n return (Object.hasOwn(o_c, \"__classType\")) ? (o_c.__classType) : (__getType__.call(__class__, o_c));\n };\n const __hierarchy__proto__ = (c: any): any[] => {\n return (typeof c !== \"undefined\" && typeof c.__proto__ !== \"undefined\" && c.__proto__ !== null) ? (((__classType(c) !== \"\") ? ([__classType(c)]) : ([])).concat(__hierarchy__proto__(c.__proto__))) : ([]);\n };\n\n if (typeof __class__ === \"undefined\" || __class__ === null) {\n __class__ = this;\n }\n let __hierarchy = [];\n __hierarchy.push(__classType(__class__));\n __hierarchy = __hierarchy.concat(__hierarchy__proto__(__class__.__proto__));\n return __hierarchy;\n }\n\n static getParentClass(): any {\n return Object.getPrototypeOf(this.prototype.constructor);\n }\n\n constructor(_o_?: any) {\n super(_o_ || {});\n\n const self = this;\n IncrementInstanceID();\n if (!(self as any).__instanceID) {\n Object.defineProperty(self, \"__instanceID\", {\n value: __instanceID,\n writable: false\n });\n }\n\n if (typeof self.__definition !== \"undefined\") {\n Object.keys(self.__definition).filter(function (k) {\n return isNaN(k as any) && ![\"name\", \"__instanceID\", \"__classType\", \"__definition\"].includes(k);\n }).forEach(function (key) {\n if (typeof self.__definition[key] === \"function\") {\n self[key] = self.__definition[key].bind(self);\n } else {\n self[key] = self.__definition[key];\n }\n });\n }\n _methods_(_QC_CLASSES[self.__classType]).map(function <T>(m: unknown): T {\n self[(m as Function).name] = (m as Function).bind(self);\n return m as T;\n });\n _methods_(self.__definition).map(function (m): any {\n self[(m as Function).name] = (m as Function).bind(self);\n return m;\n });\n\n if (self.body) {\n if (typeof self.__definition === \"undefined\" || (!Object.hasOwn(self.__definition, \"body\")) || typeof self.__definition.body === \"undefined\") {\n try {\n if (isBrowser) {\n self.body = _DOMCreateElement(self.__definition.__classType);\n } else {\n self.body = {};\n }\n } catch (e: any) {\n logger.debug(`An error ocurred: ${e}.`);\n self.body = {};\n }\n } else if (Object.hasOwn(self.__definition, \"body\")) {\n self.body = self.__definition.body;\n }\n }\n\n\n try {\n if (typeof self.__new__ === \"function\") {\n self.__new__.call(self, _o_);\n } else if (typeof super.__new__ === \"function\") {\n self.__new__ = super.__new__.bind(self);\n self.__new__.call(self, _o_);\n }\n if (typeof self === \"object\" && Object.hasOwn(self, \"_new_\") && typeof (self._new_ as any).isCalled === \"undefined\") {\n try {\n self._new_(_o_);\n (self._new_ as any).isCalled = true;\n } catch (e: any) {\n logger.warn(`${self.__classType}._new_() failed with error: ${e}`);\n }\n }\n } catch (e: any) {\n logger.warn(e);\n }\n }\n\n __new__(_o_: any) {\n _CastProps(_o_, this);\n }\n\n // eslint-disable-next-line no-unused-vars\n _new_(_o_?: any) { }\n\n getClass(): any {\n return Object.getPrototypeOf(this.constructor);\n }\n\n css(_css: any): any {\n if (typeof this.body !== \"undefined\" && typeof this?.body !== \"string\" && typeof (this?.body as HTMLElement)?.style !== \"undefined\") {\n logger.debug(\"body style\");\n if (this.body) {\n (this.body as any).style = _Cast(_css, (this?.body as HTMLElement)?.style);\n }\n }\n return (typeof this.body !== \"string\") ? (this?.body as HTMLElement)?.style : {};\n }\n\n hierarchy(): any {\n const __instance__ = this;\n return this.getClass()?.hierarchy(__instance__);\n }\n\n\n append(_child?: any) {\n const child: any = _child || this.body;\n logger.debug(\"append: start\");\n if (is_a(child, \"Component\")) {\n logger.debug(\"append: child is a Component\");\n logger.debug(`appending the body of ${child.name}`);\n }\n if (typeof this.body !== \"undefined\") {\n logger.debug(\"append element\");\n if (arguments.length > 0) {\n logger.debug(\"append to element\");\n if (typeof this.body !== \"string\") {\n if (typeof (this.body as IQCObjectsElement)?.append !== \"undefined\") {\n (this?.body as IQCObjectsElement)?.append(child);\n } else {\n throw Error(\"body.append is undefined. That means the body is not well formed.\");\n }\n } else {\n this.append(child);\n }\n if (typeof this.childs === \"undefined\") {\n this.childs = [];\n }\n this.childs.push(child);\n } else {\n if (isBrowser) {\n logger.debug(\"append to body\");\n document.body.append(child);\n }\n }\n }\n }\n\n attachIn(tag: any) {\n if (isBrowser) {\n const tags = (document as any).subelements(tag);\n for (let i = 0, j = tags.length; i < j; i++) {\n tags[i].append(this as any);\n }\n } else {\n throw new Error(\"attachIn not yet implemented for non browser platforms\");\n }\n }\n\n };\n\n // remove the keys from definition that exist in the prototype\n\n _QC_CLASSES[name] = _CastProps(definition, _QC_CLASSES[name]);\n _QC_CLASSES[name].__definition = definition;\n _QC_CLASSES[name].__definition.__classType = name;\n\n (_top as any)[name] = _QC_CLASSES[name];\n\n return _QC_CLASSES[name] as InheritClass;\n};\nif (typeof Class.prototype !== \"undefined\") {\n Class.prototype.toString = function () {\n return \"Class(name, type, definition) { [QCObjects native code] }\";\n };\n}\n\n", "/**\n * Returns the QCObjects Class Factory of a given ClassName\n *\n * @param {String} name\n */\n\nimport { __is_raw_class__ } from \"./is_raw_class\";\nimport { _QC_CLASSES, _QC_PACKAGES, get_QC_CLASS } from \"./PrimaryCollections\";\nimport { TClassFactory } from \"types\";\n\nexport const ClassFactory:TClassFactory = (className:string):any => {\n let _classFactory;\n if (typeof className === \"undefined\" || className === null) {\n throw Error (\"You need to pass a parameter {className}\");\n }\n if (className !== null && className.indexOf(\".\") !== -1) {\n const packageName = className.split(\".\").slice(0, className.split(\".\").length - 1).join(\".\");\n const _className = className.split(\".\").slice(-1).join(\"\");\n const _package = _QC_PACKAGES[packageName] || [];\n const packageClasses = _package.filter((classFactory:any) => {\n return (__is_raw_class__(classFactory));\n }).reverse();\n if (packageClasses.length > 0) {\n _classFactory = packageClasses[0];\n } else {\n throw Error(`Class ${_className} not found. Found classes: ${JSON.stringify(packageClasses)} in package ${packageName}`);\n }\n } else if (className !== null) {\n _classFactory = get_QC_CLASS(className);\n if (typeof _classFactory === \"undefined\"){\n throw new Error (`${className} is undefined.`); \n }\n } else {\n throw Error(`className is null. Unable to retrieve the class factory.\\n Not found in: \\n ${Object.keys(_QC_CLASSES).join(\"\\n\")}`);\n }\n return _classFactory;\n};\n", "export class Base64 {\n static _keyStr: string = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n static encode(e: string): string {\n let t = \"\";\n let n: number, r: number, i: number, s: number, o: number, u: number, a: number;\n let f = 0;\n e = Base64._utf8_encode(e);\n while (f < e.length) {\n n = e.charCodeAt(f++);\n r = e.charCodeAt(f++);\n i = e.charCodeAt(f++);\n s = n >> 2;\n o = (n & 3) << 4 | r >> 4;\n u = (r & 15) << 2 | i >> 6;\n a = i & 63;\n if (isNaN(r)) {\n u = a = 64;\n } else if (isNaN(i)) {\n a = 64;\n }\n t = t + this._keyStr.charAt(s) + this._keyStr.charAt(o) + this._keyStr.charAt(u) + this._keyStr.charAt(a);\n }\n return t;\n }\n static decode(e: string): string {\n let t = \"\";\n let n: number, r: number, i: number;\n let s: number, o: number, u: number, a: number;\n let f = 0;\n e = e.replace(/[^A-Za-z0-9+/=]/g, \"\");\n while (f < e.length) {\n s = this._keyStr.indexOf(e.charAt(f++));\n o = this._keyStr.indexOf(e.charAt(f++));\n u = this._keyStr.indexOf(e.charAt(f++));\n a = this._keyStr.indexOf(e.charAt(f++));\n n = s << 2 | o >> 4;\n r = (o & 15) << 4 | u >> 2;\n i = (u & 3) << 6 | a;\n t = t + String.fromCharCode(n);\n if (u !== 64) {\n t = t + String.fromCharCode(r);\n }\n if (a !== 64) {\n t = t + String.fromCharCode(i);\n }\n }\n t = Base64._utf8_decode(t);\n return t;\n }\n static _utf8_encode(e: string): string {\n e = e.replace(/rn/g, \"n\");\n let t = \"\";\n for (let n = 0; n < e.length; n++) {\n const r = e.charCodeAt(n);\n if (r < 128) {\n t += String.fromCharCode(r);\n } else if (r > 127 && r < 2048) {\n t += String.fromCharCode(r >> 6 | 192);\n t += String.fromCharCode(r & 63 | 128);\n } else {\n t += String.fromCharCode(r >> 12 | 224);\n t += String.fromCharCode(r >> 6 & 63 | 128);\n t += String.fromCharCode(r & 63 | 128);\n }\n }\n return t;\n }\n static _utf8_decode(e: string): string {\n let t = \"\";\n let n = 0;\n let r = 0;\n let c2 = 0;\n let c3: number;\n while (n < e.length) {\n r = e.charCodeAt(n);\n if (r < 128) {\n t += String.fromCharCode(r);\n n++;\n } else if (r > 191 && r < 224) {\n c2 = e.charCodeAt(n + 1);\n t += String.fromCharCode((r & 31) << 6 | c2 & 63);\n n += 2;\n } else {\n c2 = e.charCodeAt(n + 1);\n c3 = e.charCodeAt(n + 2);\n t += String.fromCharCode((r & 15) << 12 | (c2 & 63) << 6 | c3 & 63);\n n += 3;\n }\n }\n return t;\n }\n};", "import { isBrowser } from \"./platform\";\nimport process from \"node:process\";\n\nexport var _basePath_:string = (\n function ():string {\n let _basePath:string = \"\";\n if (isBrowser) {\n const baseURI:string[] = document.baseURI.split(\"?\")[0].split(\"/\");\n baseURI.pop();\n _basePath = baseURI.join(\"/\") + \"/\";\n } else {\n if (typeof process !== \"undefined\") {\n _basePath = `${(process).cwd()}/`;\n } else {\n _basePath = \"\";\n }\n }\n return _basePath;\n }\n )();\n\nexport const setBasePath = (value:string):void => { _basePath_ = value;};", "import { _LegacyCopy } from \"./LegacyCopy\";\n\nexport const _DataStringify = (data: any): string => {\n const getCircularReplacer = function () {\n const seen = new WeakSet();\n let _level = 0;\n return function (key: string, value: any): any {\n if (typeof value === \"object\" && value !== null) {\n if (seen.has(value)) {\n _level += 1;\n return (_level <= 3) ? (_LegacyCopy(value)) : (null);\n }\n seen.add(value);\n }\n return value;\n };\n };\n return JSON.stringify(data, getCircularReplacer());\n};\n", "export const _domain_:string = (typeof location !== \"undefined\" && location.hostname !== \"\") ? (location.hostname) : (\"localhost\");\n", " /**\n * Creates an object from a Class definition\n *\n * @param {QC_Object} o\n * @param {Object} args\n */\n\n export const New = function (__class__:any, args = {}):any {\n args = (arguments.length > 1) ? (args) : ({});\n return (typeof __class__ === \"undefined\") ? (new Object()) : (new __class__(args));\n };\n \n New.prototype.toString = function () {\n return \"New(QCObjectsClassName, args) { [QCObjects native code] }\";\n };", "import { isBrowser } from \"./platform\";\n\nexport const _secretKey:string = (isBrowser)?(location.host):(\"secret\");", "import { _ICrypt } from \"types\";\nimport { Base64 } from \"./Base64\";\nimport { _DataStringify } from \"./DataStringify\";\nimport { InheritClass } from \"./InheritClass\";\nimport { Package } from \"./Package\";\nimport { _secretKey } from \"./secretKey\";\n\n\nexport class _Crypt extends InheritClass implements _ICrypt {\n string: string = \"\";\n key: string = \"\";\n // eslint-disable-next-line no-unused-vars\n encrypt(_string_: string, key: string): string {\n throw new Error(\"Method not implemented.\");\n }\n // eslint-disable-next-line no-unused-vars\n decrypt(_string_: string, key: string): string {\n throw new Error(\"Method not implemented.\");\n }\n last_string = \"\";\n last_key = \"\";\n construct = false;\n _new_(o: { string?: string; key: string; }):void {\n const string = o.string;\n let key: string = (Object.hasOwn(o, \"key\")) ? (o.key) : (\"\");\n this.__new__(o);\n key = (key === \"\") ? (this.__instanceID.toString()) : (key);\n this.last_key = key;\n this.last_string = string as string;\n this.construct = true;\n }\n _encrypt(): string {\n const string = this.string;\n const key = this.key;\n let result = \"\";\n let char;\n let keychar;\n for (let i = 0; i < string.length; i++) {\n char = string.substr(i, 1);\n keychar = key.substr((i % key.length) - 1, 1);\n char = String.fromCharCode(char.charCodeAt(0) + keychar.charCodeAt(0));\n result += char;\n }\n this.last_string = Base64.encode(result);\n return this.last_string;\n }\n _decrypt(): string {\n let string = this.string;\n const key = this.key;\n let result = \"\";\n let char;\n let keychar;\n string = Base64.decode(string);\n for (let i = 0; i < string.length; i++) {\n char = string.substr(i, 1);\n keychar = key.substr((i % key.length) - 1, 1);\n char = String.fromCharCode(char.charCodeAt(0) - keychar.charCodeAt(0));\n result += char;\n }\n\n this.last_string = result;\n return this.last_string;\n }\n static encrypt(string: string, key: string): string {\n const crypt = new _Crypt({\n string,\n key: (key !== \"\") ? (key) : (\"12345678ABC\")\n });\n return crypt._encrypt();\n }\n static decrypt(string: string, key: string):string {\n const crypt = new _Crypt({\n string,\n key: (key !== \"\") ? (key) : (\"12345678ABC\")\n });\n return crypt._decrypt();\n }\n}\n\nexport const _CryptObject = function (o: any): string {\n return _Crypt.encrypt(_DataStringify(o), _secretKey);\n};\nexport const _DecryptObject = function (s: string): any {\n return (s === \"\") ? ({}) : (JSON.parse(_Crypt.decrypt(s, _secretKey)));\n};\n\nPackage(\"com.qcobjects\", [_Crypt]);", "import { _basePath_ } from \"./basePath\";\nimport { InheritClass } from \"./InheritClass\";\nimport { Package } from \"./Package\";\n\ntype TConfigSettings = {\n [key: string]: any,\n relativeImportPath:string,\n remoteImportsPath:string,\n remoteSDKPath:string,\n asynchronousImportsLoad:boolean,\n removePackageScriptAfterLoading:boolean,\n componentsBasePath:string,\n delayForReady:number,\n preserveComponentBodyTag:false,\n useConfigService:false,\n routingWay:string,\n useSDK:boolean,\n useLocalSDK:boolean,\n basePath:string\n};\n\n\nexport class ConfigSettings extends InheritClass {\n public _CONFIG: TConfigSettings = {\n \"relativeImportPath\": \"\",\n \"remoteImportsPath\": \"\",\n \"remoteSDKPath\": \"https://sdk.qcobjects.dev/\",\n \"asynchronousImportsLoad\": false,\n \"removePackageScriptAfterLoading\": true,\n \"componentsBasePath\": \"\",\n \"delayForReady\": 0,\n \"preserveComponentBodyTag\": false,\n \"useConfigService\": false,\n \"routingWay\": \"hash\",\n \"useSDK\": true,\n \"useLocalSDK\": false,\n \"basePath\": _basePath_\n };\n protected static _instance: ConfigSettings;\n public _CONFIG_ENC = \"\";\n\n set(name:string, value:any):void {\n this._CONFIG[name] = value;\n }\n\n get(name:string, _defaultValue?:any):any {\n return this._CONFIG[name] || _de