//************************* FILE HEAD *************************//



//==========================================================================================//
// [ DEPENDENCIES ]
//==========================================================================================//

//-------------------------------------------//
// [ DEFAULT ]
//-------------------------------------------//

const neg = -1;
const nil = 0;
const pos = 1;
const two = 2;
const three = 3;
const tri = 3;
const four = 4;
const qua = 4;
const five = 5;
const qui = 5;
const hex = 6;
const sev = 7;
const oct = 8;
const nin = 9;
const ten = 10;
const pi = 3.14159;
const hun = 100;

const abs = 'absolute';
const all = 'all';
const auto = 'auto';
const block = 'block';
const bracket_c = ']';
const bracket_o = '[';
const breakl = '<span style=\"display:block;margin-top:12px;\"></span>';
const buffer = 'buffer';
const click = 'click';
const col = 'column';
const collapse = 'collapse';
const colon = ':';
const comma = ',';
const curly_c = '}';
const curly_o = '{';
const dash = '-';
const decimal = '.';
const element = 'DIV';
const empty = '';
const endl = '\r\n';
const epoch = 1000;
const equals = '=';
const expand = 'expand';
const fade = 'fade';
const fixed = 'fixed';
const fixedGlobal = 'fixed-global';
const fixedLocal = 'fixed-local';
const flex = 'flex';
const forward = 'forwards';
const full = '100%';
const fulli = '-100%';
const gradient = 'gradient';
const half = 0.5;
const hashtag = '#';
const hide = 'hidden';
const highlight = 'highlight';
const home = 'www';
const hover = 'hover';
const id = 'id';
const index = 'index';
const infinite = 'infinite';
const inherit = 'inherit';
const initial = 'initial';
const inline = 'inline';
const inlineblock = 'inline-block';
const inset = 'inset';
const jsx = '.jsx';
const jump = '___';
const kernel = 'kernel';
const magic = 'magic';
const Na = 'none';
const newl = '\n';
const npixel = '0px';
const opixel = '1px';
const parenth_c = ')';
const parenth_o = '(';
const percent = '%';
const pixel = 'px';
const pointer = 'pointer';
const qmark = '?';
const quarter = 0.25;
const quote_d = '\"';
const quote_s = '\'';
const redirect = 'redirect';
const refer = 'refer';
const relative = 'relative';
const routes = 'routes';
const row = 'row';
const scale = 'scale';
const scroll_ = 'scroll';
const scaleOffset = 1.025;
const show = 'visible';
const slashb = '\\';
const slashf = '/';
const semicolon = ';';
const solid = 'solid';
const space = ' ';
const split = ' | ';
const static = 'static';
const sticky = 'sticky';
const tab = '\t';
const text = 'text';
const total = 100;
const tpixel = '2px';
const underscore = '_';

const alpha = {
    a: 'a',
    b: 'b',
    c: 'c',
    d: 'd',
    e: 'e',
    f: 'f',
    g: 'g',
    h: 'h',
    i: 'i',
    j: 'j',
    k: 'k',
    l: 'l',
    m: 'm',
    n: 'n',
    o: 'o',
    p: 'p',
    q: 'q',
    r: 'r',
    s: 's',
    t: 't',
    u: 'u',
    v: 'v',
    w: 'w',
    x: 'x',
    y: 'y',
    z: 'z',
};

const color = {
    black: '#191919',
    blue: '#4db8ff',
    clear: 'transparent',
    gray: 'lightgray',
    grayLight: '#e6e6e6',
    white: 'white',
};

const delay = {
    cycle: 1024,
    fading: 512,
    invoke: 256,
    loading: 16,
    offset: 1024,
    resize: 512,
};

const direct = {
    b: 'bottom',
    c: 'center',
    h: 'horizontal',
    l: 'left',
    r: 'right',
    t: 'top',
    v: 'vertical'
};

const events = {
    moveto: { beg: 'translate(', end: 'px)', mid: 'px,', origin: 'translate(0px,0px)' },
    rotate: { beg: 'rotate(', end: 'deg)' },
    fade: {
        x: {
            in:'translate( 100%, 0% )',
            out:'translate(-100%, 0%)',
        },
        y: {
            in:'translate( 0%, -100%)',
            out:'translate( 0%, 100%)',
        }
    }
};

const fraction = {
    x02x50: 0.025,
    x25x00: 0.25,
    x50x00: 0.5,
    x95x00: 0.95,
};

const percentage = {
    x02x50: '2.5%',
    x15x00: '15%',
    x20x00: '20%',
    x25x00: '25%',
    x30x00: '30%',
    x35x00: '35%',
    x40x00: '40%',
    x50x00: '50%',
    x60x00: '60%',
    x95x00: '95%',
};

const system = {
    action: {
        fade: 'fade',
        highlight: 'highlight',
    },
    config: {
        pause: 'paused',
        pulse: '1s ease 0s 1 normal forwards running pulse',
        run: 'running',
    },
    error: {
        compat: 'keyword incompatible with module',
        denied: 'action denied',
        duplicate: 'duplicate item found - import skipped',
        ext: 'invalid extension',
        fail: 'action failed',
        failed: 'failed to load',
        focus: 'object fetch failed',
        format: 'invalid format',
        ignore: 'request ignored',
        kernel: 'kernel not found',
        keyword: 'invalid keyword',
        mismatch: 'mismatched parameters',
        missfire: 'missfire',
        module: 'invalid module',
        oor: 'out-of-range argument',
        param: 'invalid parameter type/keyword',
        program: 'program failed to load',
        require: 'missing requirements',
        token: { attach: 'token-attach-failed', buffer: 'token-buffer-failed', detach: 'token-detach-failed', join: 'token-join-failed', load: 'token-load-failed' },
        type: 'unmet strict-parameter-type',
        udf: 'undefined',
        unknown: 'keyword not known',
    },
    event: {
        fade: 'fade',
        highlight: 'highlight',
        underline: 'underline',
    },
    ext: {
        maxidx: 5,
        maxlen: 4,
        minidx: 4,
        minlen: 3,
    },
    major: {
        atlas: 'atlas',
        chronicle: 'chronicle',
        client: 'cache',
        client: 'client',
        config: 'config',
        driver: 'driver',
        linker: 'linker',
        loadbar: 'loadbar',
        main: 'main',
        manifest: 'manifest',
        network: 'network',
        program: 'program',
        registry: 'registry',
        runware: 'runware',
        scheduler: 'scheduler',
        source: 'source',
        stack: 'stack',
        thread: 'thread',
        token: 'token',
        worker: 'worker',
    },
    minor: {
        animate: 'animation',
        buffer: 'buffer',
        dropselect: 'dropselect',
        event: 'event',
        form: 'form',
        format: 'format',
        graphic: 'graphic',
        init: 'constructor',
        kill: 'shutdown',
        launch: 'launch',
        math: 'math',
        memory: 'memory',
        merge: 'merge',
        module: 'module',
        parse: 'parse',
        redir: 'redirect',
        result: 'result',
        route: 'route',
        get routes() { return routes; },
        sched: 'schedule',
        string: 'string',
        style: 'styles',
        type: 'type',
        update: 'update',
    },
    proto: {
        align: 'text-align',
        anchor: 'anchor',
        append: 'append',
        assets: 'assets',
        attach: 'attach',
        cache: 'cache',
        click: 'click',
        client: 'client',
        collapse: 'collapse',
        config: 'config',
        copy: 'copy',
        dims: 'dimension',
        ease: 'ease-in-out',
        elapse: 'all 0.5s ease-in-out',
        enter: 'enter',
        entry: 'entries',
        export: 'export',
        expand: 'expand',
        format: 'format',
        import: 'import',
        get index() { return index; },
        init: 'initial',
        invoke: 'invoke',
        jsx: 'jsx',
        jsxType: 'type/javascript',
        leave: 'leave',
        label: 'labels',
        onselect: 'onselect',
        opacity: 'opacity',
        options: 'options',
        pad: 'padding',
        pair: 'pair',
        pos: 'position',
        pulse: 'pulse',
        rotate: 'rotate',
        scroll: 'scroll',
        select: 'select',
        show: 'show',
        size: 'size',
        source: 'source',
        static: 'static',
        stroke: 'stroke',
        styles: 'styles',
        submit: 'submit',
        symbol: 'symbol',
        text: 'text',
        tokens: 'tokens',
        transfer: 'transfer',
        update: 'update',
    },
    style: {
        border: 'border',
        color: 'color',
        padding: 'padding',
        radius: 'radius',
        size: 'size',
        style: 'style',
    },
};

const type = new class {
    get bool() { return nil; }
    get int() { return pos; }
    get string() { return two; }
    get array() { return tri; }
    get object() { return qua; }
    get function() { return qui; }
    get node() { return hex; }
    //: 1,
    //: 2,
    //array: 3,
    //object: 4,
    //function: 5,
    //node: 6,
};

const CS_TYPESTR_B = 'boolean';
const CS_TYPESTR_F = 'function';
const CS_TYPESTR_N = 'number';
const CS_TYPESTR_O = 'object';
const CS_TYPESTR_S = 'string';

const typestr = new class {
    get bool() { return CS_TYPESTR_B; }
    get int() { return CS_TYPESTR_N; }
    get string() { return CS_TYPESTR_S; }
    get object() { return CS_TYPESTR_O; }
    get function() { return CS_TYPESTR_F; }
};

//==========================================================================================//
// [ DECLARATION ]: GLOBALS
//==========================================================================================//


const COVASCRIPT_DEF_CSS = '<style id="graphics" rel="stylesheet" type="text/css"> html { scroll-behavior: smooth; } body { style="height: auto; width: auto; padding: none; margin: 0 !important; overflow-x: hidden; overflow-y: initial;" } @keyframes pulse { 0% { box-shadow: inset 0 0 0 0 rgba(255, 0, 0, 0.4); } 70% { box-shadow: inset 0 0 10px 4px rgba(255, 0, 0, 0); } 100% { box-shadow: inset 0 0 0 0 rgba(255, 0, 0, 0); } } </style>';
const COVASCRIPT_DEF_SRC = document.getElementById( 'covascript' ).src.substr( 0, document.getElementById( 'covascript' ).src.indexOf( 'public' ) ); 


const cvl = {
    typeof( VAR ) {
        switch( typeof VAR ) {
            case typestr.object: if( VAR.length != undefined ) { return type.array; } return type.object;
            case typestr.string: return type.string;
            case typestr.int: return type.int;
            case typestr.bool: return type.bool;
            case typestr.function: return type.function;
        }
        return neg;
    },
    typecheck( VAR, KEY ) {
        switch( typeof VAR ) {
            case typestr.object: if( VAR.length != undefined ) { return ( KEY == type.array ); } return ( KEY == type.object );
            case typestr.string: return ( KEY == type.string );
            case typestr.int: return ( KEY == type.int );
            case typestr.bool: return ( KEY == type.bool );
            case typestr.function: return ( KEY == type.function );
        }
        return false;
    },
    typequery( OBJ, KEY ) {
        if( typeof OBJ == typestr.object ) {
            if( OBJ.length != undefined ) {
                for( var i = nil; i < OBJ.length; ++i ) {
                    if( this.typeof( OBJ[ i ] ) != KEY ) {
                        return false;
                    }
                }
            } else {
                for( var i in OBJ ) {
                    if( this.typeof( OBJ[ i ] ) != KEY ) {
                        return false;
                    }
                }
            }
            return true;
        }
        return this.typecheck( OBJ, KEY );
    },
};


//-------------------------------------------//
// [ Globals ]: System (CovaScript)
//-------------------------------------------//


const cache = new Object;

const firmware = {
    browser: undefined,
    device: undefined,
    display: undefined,
    keyboard: undefined,
    mouse: undefined,
    window: undefined,
};


//-------------------------------------------//
// [ Globals ]: Client (Website)
//-------------------------------------------//


// COVASCRIPT //

const covascript = {

    //-------------------------------------------//
    // [ A ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ B ]
    //-------------------------------------------//

    //======================================================================//
    // [  Class ]: Binares
    // [ Status ]: Complete (ongoing)
    // [ Tested ]: Yes
    // [ Sizeof ]: ...b
    // [ Author ]: Robert (Danial) Hickman
    // [ Architect ]: Robert (Danial) Hickman
    // [ Last-Update ]: 00/00/0000
    // [ Description ]:
    //
    //======================================================================//
    binares: {

        // [ A ]

        // [ B ]

        // [ C ]

        // [ D ]

        // [ E ]

        // [ F ]

        // [ G ]

        // [ H ]

        // [ I ]

        // [ J ]

        // [ K ]

        // [ L ]

        // [ M ]

        // [ N ]

        // [ O ]

        // [ P ]

        // [ Q ]

        // [ R ]

        // [ S ]

        // [ T ]

        // [ U ]

        // [ V ]

        // [ W ]

        // [ X ]

        // [ Y ]

        // [ Z ]

    },

    //-------------------------------------------//
    // [ C ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ D ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ E ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ F ]
    //-------------------------------------------//

    //======================================================================//
    // [ Library ]: Firmware
    // [ Status ]: Complete (ongoing)
    // [ Tested ]: Yes
    // [ Sizeof ]: ...b
    // [ Author ]: Robert (Danial) Hickman
    // [ Architect ]: Robert (Danial) Hickman
    // [ Last-Update ]: 00/00/0000
    // [ Description ]:
    //
    //======================================================================//
    firmware: {

        // [ A ]

        // [ B ]

        // [ C ]

        // [ D ]

        device: undefined,

        display: undefined,

        // [ E ]

        // [ F ]

        // [ G ]

        // [ H ]

        // [ I ]

        // [ J ]

        // [ K ]

        keyboard: undefined,

        // [ L ]

        // [ M ]

        mouse: undefined,

        // [ N ]

        // [ O ]

        // [ P ]

        // [ Q ]

        // [ R ]

        // [ S ]

        // [ T ]

        // [ U ]

        // [ V ]

        // [ W ]

        // [ X ]

        // [ Y ]

        // [ Z ]
        browser: undefined,
        
        
        
        window: undefined,
    },

    //-------------------------------------------//
    // [ G ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ H ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ I ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ J ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ K ]
    //-------------------------------------------//

    //======================================================================//
    // [  Class ]: Kernel
    // [ Status ]: Complete (ongoing)
    // [ Tested ]: Yes
    // [ Sizeof ]: ...b
    // [ Author ]: Robert (Danial) Hickman
    // [ Architect ]: Robert (Danial) Hickman
    // [ Last-Update ]: 00/00/0000
    // [ Description ]:
    //
    //======================================================================//
    kernel: {

        // [ A ]

        // [ B ]

        // [ C ]

        // [ D ]

        // [ E ]

        // [ F ]

        // [ G ]

        // [ H ]

        // [ I ]

        // [ J ]

        // [ K ]

        // [ L ]

        // [ M ]

        // [ N ]

        // [ O ]

        // [ P ]

        // [ Q ]

        // [ R ]

        // [ S ]

        // [ T ]

        // [ U ]

        // [ V ]

        // [ W ]

        // [ X ]

        // [ Y ]

        // [ Z ]

    },

    //-------------------------------------------//
    // [ L ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ M ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ N ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ O ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ P ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ Q ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ R ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ S ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ T ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ U ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ V ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ W ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ X ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ Y ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ Z ]
    //-------------------------------------------//

    
    
    
    modules: undefined,
};


const client = {
    cache: undefined,           // CLIENT SITE CACHED DATA
    config: undefined,          // CLIENT SITE IMPORT
    devmode: {                  // CLIENT CONFIGURATION SETTING (For Testing Purposes w/i Dev Environments)
        notifications: false,
        status: false,
    },
};


//==========================================================================================//
// [ DECLARATION ]: MAIN
//==========================================================================================//

//======================================================================//
// [ CLASS ]: covaMAIN_t
// [ DEV STATUS ]: Incomplete
// [ TESTED ]: No
// [ ARCHITECT ]: Danial Hickman
// [ AUTHOR ]: Danial Hickman
// [ LAST REVISION ]: 10/22/2020
//======================================================================//

const main = new class {

    //======================================================================//
    // [ PUBLIC ]: CONSTRUCTOR/DESTRUCTOR
    //======================================================================//

    //-------------------//
    //--- CONSTRUCTOR ---//
    //-------------------//

    constructor() {

        //-------------------------------------------//
        // [ PUBLIC ]: MEMORY ALLOCATION
        //-------------------------------------------//

        this.buffer = new Object;

        //======================================================================//
        // [ INIT ]
        //======================================================================//

        this.self = new class {

            constructor() {

                //-------------------------------------------//
                // [ CONFIG ]: INTERNAL PRESETS
                //-------------------------------------------//

                this.REGISTRY = {

                    SYSTEM: {

                        BINARIES: [
                            //"Canvas",
                            "Linker",
                            "Script",
                            "Style",
                            "Member",
                        ],

                        FIRMWARE: [
                            "Bank",
                            "Browser",
                            "Device",
                            "Display",
                            "Keyboard",
                            "Mouse",
                            "Ram",
                            "Thread",
                            "Window",
                        ],

                        KERNEL: [
                            //"Audio",
                            //"Calendar",
                            "Cell",
                            "Chart",
                            //"Clock",
                            //"Dropdown",
                            "Dropselect",
                            //"Editor",
                            "Element",
                            //"Explorer",
                            "Form",
                            "Graph",
                            "Image",
                            "Index",
                            "Input",
                            "Item",
                            "Link",
                            "List",
                            //"Media",
                            //"Popup",
                            "Row",
                            //"Search",
                            //"Slideshow",
                            "Svg",
                            "Table",
                            "Text",
                            "Textarea",
                            "Video",
                        ],

                        RUNWARE: [
                            "Atlas",
                            "Buffer",
                            "Column",
                            "Config",
                            "Domain",
                            'Extract',
                            "Format",
                            "Grid",
                            "Label",
                            "Math",
                            "Memory",
                            "Parse",
                            "Row",
                            "Runtime",
                            "Sort",
                            "String",
                            "Validate",
                        ],

                        SYSTEMS: [
                            "Cache",
                            "Chronicle",
                            "Client",
                            "Console",
                            "Gateway",
                            "Linker",
                            "Loadbar",
                            "Manifest",
                            "Notice",
                            "Overlay",
                            "Page",
                            "Program",
                            "Scheduler",
                            "Stack",
                            "Worker",
                        ],

                    },

                    SCRIPT: {
                        INDEX: COVASCRIPT_DEF_SRC + 'private',
                        MAJOR: 'COVASCRIPT',
                        MINOR: '___',
                        PROTO: '.jsx',
                        TAG: 'script',
                        TYPE: 'text/javascript',
                    },

                };

                //-------------------------------------------//
                // [ self ]: MEMORY ALLOCATION
                //-------------------------------------------//

                this.buffer = new Array(
                    new String,
                    new String,
                );

                this.linker = document.createElement( system.major.linker );

                this.linker.source = home;

                document.head.append( this.linker );

            }

            //-------------------------------------------//
            // [ self ]: FUNCTIONS
            //-------------------------------------------//

            checkin() {

                --window.progress;

            };

            import( Nx0 ) {
                //=== LOCAL MEMORY ===//

                var xN;

                //=== TASK IMPLEMENTATION ===//

                xN = document.createElement( this.REGISTRY.SCRIPT.TAG );

                xN.type = this.REGISTRY.SCRIPT.TYPE;

                xN.src = new String( this.buffer[ nil ] );

                xN.src += Nx0[ nil ];

                xN.src += slashf;

                xN.src += this.buffer[ pos ];

                xN.src += Nx0;

                xN.src += this.REGISTRY.SCRIPT.PROTO;

                xN.async = true;

                xN.onload = this.checkin;

                this.linker.append( xN );

            };

            import_Config( Nx0 ) {
                //=== LOCAL MEMORY ===//

                var xN;

                //=== TASK IMPLEMENTATION ===//

                ++window.progress;

                xN = document.createElement( this.REGISTRY.SCRIPT.TAG );

                xN.type = this.REGISTRY.SCRIPT.TYPE;

                xN.src = ( system.proto.client + slashf + system.proto.config + slashf + Nx0 + decimal + system.proto.jsx );

                xN.async = true;

                xN.onload = this.checkin;

                this.linker.append( xN );

            };

            launch() {

                if( window.progress == nil ) {

                    clearInterval( window.timing );

                    // COVASCRIPT VIRTUAL LIBRARY //

                    cvl.atlas = new covaATLAS_t,
                    cvl.buffer = new covaBuffer_t;
                    cvl.column = new covaCOL_t;
                    cvl.config = new covaConfig_t;
                    cvl.domain = new covaDomain_t;
                    cvl.extract = new covaExtract_t;
                    cvl.format = new covaFormat_t;
                    cvl.grid = new covaGRID_t;
                    cvl.label = new covaLabel_t;
                    cvl.math = new covaMath_t;
                    cvl.memory = new covaMemory_t;
                    cvl.parse = new covaParse_t;
                    cvl.row = new covaROW_t;
                    cvl.runtime = new covaRuntime_t;
                    cvl.sort = new covaSORT_t;
                    cvl.string = new covaString_t;
                    cvl.validate = new covaValidate_t;

                    firmware.browser = new covaBrowser_t;
                    //firmware.cache = new covaCache_t;
                    firmware.device = new covaDevice_t;
                    firmware.display = new covaDisplay_t;
                    firmware.keyboard = new covaKeyboard_t;
                    firmware.mouse = new covaMouse_t;
                    firmware.window = new covaWindow_t;
                    
                    cache.token = new covaCache_t;
                    
                    covascript.kernel.linker = COVASCRIPT_KERNEL_LINKER_OBJ;

                    window.system = {
                        cache: undefined,
                        chronicle: new covaChronicle_t,
                        console: undefined,
                        gateway: new covaGateway_t,
                        linker: undefined,
                        manifest: new covaManifest_t,
                        notice: new covaNotice_t,
                        overlay: new covaOverlay_t,
                        scheduler: new covaScheduler_t,
                        stack: new covaStack_t,
                    };

                    window.system.console = new covaConsole_t( window.system.notice );

                    window.system.cache = new covaRAM_t( window.registry );

                    window.registry.cache = window.system.cache;
                    
                    window.system.linker = new covaLinker_t( window.registry.atlas, window.system.cache );
                    
                    window.registry.linker = window.system.linker;
                    
                    window.system.scheduler.attach( new covaWorker_t );
                    //window.system.scheduler.attach( new covaWorker_t );
                    window.system.scheduler.launch();

                    window.loadbar = new covaLoadbar_t;
                    window.client = new covaClient_t( client.config );
                    //window.system.gateway.launch();

                    // CLEANUP

                    delete window.buffer;
                    delete window.progress;
                    delete window.timing;
                    delete main.self.REGISTRY.SYSTEM;
                    delete main.self.REGISTRY.SCRIPT;



                }

            };

        }

        //======================================================================//
        // [ ASSIGNMENT ]
        //======================================================================//

        //=== LOCAL MEMORY ===//

        var aN;
        var bN;

        //=== TASK IMPLEMENTATION ===//

        if( window.history.length > two ) {

            window.history.go( pos );

        }

        window.progress = new Number;

        window.registry = {
            atlas: new Object,
            cache: undefined,
            events: undefined,
            kernel: new Object,
            styles: new Object,
            config_Axis_X( MOD ) {

                MOD.style.display = inlineblock;

                MOD.style.position = system.proto.static;

            },

            config_Axis_X_Pos( MOD, PAD ) {
                //=== LOCAL MEMORY ===//

                var xN;

                //=== TASK IMPLEMENTATION ===//

                xN = PAD;

                for( var i = nil; i < MOD.children.length; ++i ) {

                    MOD.children[ i ].style.left = ( xN + pixel );

                    xN += cvl.parse.pixel( MOD.children[ i ].style.width );

                }

            },

            config_Axis_Y( MOD ) {

                MOD.style.display = block;

                MOD.style.position = system.proto.static;

            },

            config_Axis_Y_Pos( MOD ) {
                //=== LOCAL MEMORY ===//

                var xN;

                //=== TASK IMPLEMENTATION ===//

                xN = PAD;

                for( var i = nil; i < MOD.children.length; ++i ) {

                    MOD.children[ i ].style.top = ( xN + pixel );

                    xN += cvl.parse.pixel( MOD.children[ i ].style.height );

                }

            },

            config_Border( MOD, STYLE, COLOR, SIZE ) {

                MOD.style.borderStyle = STYLE;

                MOD.style.borderColor = COLOR;

                MOD.style.borderWidth = ( SIZE + pixel );

            },

            config_Border_Bottom( MOD, STYLE, COLOR, SIZE ) {

                MOD.style.borderBottomStyle = STYLE;

                MOD.style.borderBottomColor = COLOR;

                MOD.style.borderBottomWidth = ( SIZE + pixel );

            },

            config_Border_Left( MOD, STYLE, COLOR, SIZE ) {

                MOD.style.borderLeftStyle = STYLE;

                MOD.style.borderLeftColor = COLOR;

                MOD.style.borderLeftWidth = ( SIZE + pixel );

            },

            config_Border_Right( MOD, STYLE, COLOR, SIZE ) {

                MOD.style.borderRightStyle = STYLE;

                MOD.style.borderRightColor = COLOR;

                MOD.style.borderRightWidth = ( SIZE + pixel );

            },

            config_Border_Top( MOD, STYLE, COLOR, SIZE ) {

                MOD.style.borderTopStyle = STYLE;

                MOD.style.borderTopColor = COLOR;

                MOD.style.borderTopWidth = ( SIZE + pixel );

            },

            config_Color( MOD, COLOR ) {

                if( COLOR.indexOf( gradient ) == neg ) {

                    MOD.style.backgroundColor = COLOR;

                } else {

                    MOD.style.background = COLOR;

                }

            },

            config_Coords( MOD, X, Y ) {

                switch( cvl.typeof( X ) ) {
                    case type.string: MOD.style.left = X; break;
                    case type.int: MOD.style.left = ( X + pixel ); break;
                }

                switch( cvl.typeof( Y ) ) {
                    case type.string: MOD.style.top = Y; break;
                    case type.int: MOD.style.top = ( Y + pixel ); break;
                }

            },

            config_Coords_Inverse( MOD, X, Y ) {

                switch( cvl.typeof( X ) ) {
                    case type.string: MOD.style.right = X; break;
                    case type.int: MOD.style.right = ( X + pixel ); break;
                }

                switch( cvl.typeof( Y ) ) {
                    case type.string: MOD.style.bottom = Y; break;
                    case type.int: MOD.style.bottom = ( Y + pixel ); break;
                }

            },

            config_Display( MOD, ARG ) {

                MOD.style.display = ARG;

            },

            config_Event_Clear( MOD ) {

                MOD.style.transition = empty;

                MOD.style.transform = empty;

            },

            config_Event_Elapse( MOD, DURATION ) {

                MOD.style.transition = ( all + space + DURATION + alpha.s + space + system.proto.ease );

            },

            config_Event_Moveto( MOD, OFFSET_X, OFFSET_Y ) {

                if( MOD.style.transform != empty ) {

                    MOD.style.transform = ( space + events.movoto + parenth_o + ( OFFSET_X + pixel ) + comma + ( OFFSET_Y + pixel ) + parenth_c );

                } else {

                    MOD.style.transform = ( events.movoto + parenth_o + ( OFFSET_X + pixel ) + comma + ( OFFSET_Y + pixel ) + parenth_c );

                }

            },

            config_Event_Reset( MOD ) {

                MOD.style.transform = empty;

            },

            config_Input_Align( MOD, DIRECT ) {

                MOD = MOD.covaChild != undefined ? MOD.covaChild : MOD;

                MOD.style.textAlign = DIRECT;

            },

            config_Input_Locked( MOD, BOOL ) {

                MOD = MOD.covaChild != undefined ? MOD.covaChild : MOD;

                MOD.disabled = BOOL;

            },

            config_Input_Placeholder( MOD, ARG ) {

                MOD = MOD.covaChild != undefined ? MOD.covaChild : MOD;

                switch( MOD.style.textAlign ) {
                    case direct.r:
                        switch( cvl.typeof( ARG ) ) {
                            case type.int: MOD.placeholder = ARG.toString().padEnd( five, space ); break;
                            case type.string: MOD.placeholder = ARG.padEnd( five, space ); break;
                        }
                        break;
                    case direct.l:
                        switch( cvl.typeof( ARG ) ) {
                            case type.int: MOD.placeholder = ARG.toString().padStart( two, space ); break;
                            case type.string: MOD.placeholder = ARG.padStart( two, space ); break;
                        }
                        break;
                    default:
                        switch( cvl.typeof( ARG ) ) {
                            case type.int: MOD.placeholder = ARG.toString(); break;
                            case type.string: MOD.placeholder = ARG; break;
                        }
                        break;
                }

            },

            config_Input_Require( MOD, ARG ) {

                MOD = MOD.covaChild != undefined ? MOD.covaChild : MOD;

                MOD.covaRequire = ARG;

            },

            config_Input_Required( MOD ) {

                MOD = MOD.covaChild != undefined ? MOD.covaChild : MOD;

                if( MOD.covaRequire != undefined ) {

                    return MOD.covaChild.covaRequire;

                }

                return false;

            },

            config_Input_Value( MOD, ARG ) {

                MOD = MOD.covaChild != undefined ? MOD.covaChild : MOD;

                switch( MOD.style.textAlign ) {
                    case direct.r:
                        switch( cvl.typeof( ARG ) ) {
                            case type.int: MOD.value = ARG.toString().padEnd( two, space ); break;
                            case type.string: MOD.value = ARG.padEnd( two, space ); break;
                        }
                        break;
                    default:
                        switch( cvl.typeof( ARG ) ) {
                            case type.int: MOD.value = ARG.toString().padStart( two, space ); break;
                            case type.string: MOD.value = ARG.padStart( two, space ); break;
                        }
                        break;
                }

            },

            config_Opacity( MOD, OFFSET ) {

                MOD.style.opacity = OFFSET;

            },

            config_Overflow( MOD, BOOL ) {

                if( BOOL ) {

                    MOD.style.overflow = system.proto.scroll;

                } else {

                    MOD.style.overflow = hide;

                }

            },

            config_Size( MOD, X, Y ) {

                if( cvl.typeof( X ) == type.int ) {
                    MOD.style.width = ( X + pixel );
                } else {
                    MOD.style.width = X;
                }

                if( cvl.typeof( Y ) == type.int ) {
                    MOD.style.height = ( Y + pixel );
                } else {
                    MOD.style.height = Y;
                }

            },

            config_Text_Align( MOD, ARG ) {

                MOD.covaText.style.textAlign = ARG;

            },

            config_Text_Value( MOD, ARG ) {

                MOD.covaText.style.innerHTML = ARG;

            },
        };

        window.viewport = {
            minHeight: '100vh',
            minWidth: '100vw',
        };

        aN = this.self.REGISTRY;

        for( var key in aN.SYSTEM ) {

            bN = aN.SYSTEM[ key ];

            window.progress += bN.length;

            this.self.buffer[ nil ] = ( aN.SCRIPT.INDEX + slashf + key.toLowerCase() + slashf );

            this.self.buffer[ pos ] = ( aN.SCRIPT.MAJOR + underscore + key + aN.SCRIPT.MINOR );

            for( var i = nil; i < bN.length; ++i ) {

                this.self.import( bN[ i ] );

            }

        }

        this.self.import_Config( system.proto.config );
        this.self.import_Config( system.proto.styles );
        this.self.import_Config( system.proto.cache );

        window.timing = setInterval( this.self.launch, 100 );

        document.head.innerHTML += COVASCRIPT_DEF_CSS;

    }

    //======================================================================//
    // [ PUBLIC ]: FUNCTIONS
    //======================================================================//

    //-------------------------------------------//
    // [ A ]
    //-------------------------------------------//

    asset( Nx0, Nx1 ) {

        Nx0.src = ( system.proto.client + slashf + system.proto.source + slashf + this.self.linker.source + slashf + system.proto.assets + slashf + Nx1 );

    };

    //-------------------------------------------//
    // [ B ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ C ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ D ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ E ]
    //-------------------------------------------//

    error( HEADER, PROTOCOL = undefined, ERROR_MESSAGE = undefined ) {

        window.system.console.error( HEADER, PROTOCOL, ERROR_MESSAGE );

    };

    //-------------------------------------------//
    // [ F ]
    //-------------------------------------------//

    fatal( HEADER, PROTOCOL = undefined, ERROR_MESSAGE = undefined ) {

        window.system.console.fatal( HEADER, PROTOCOL, ERROR_MESSAGE );

    };

    //-------------------------------------------//
    // [ G ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ H ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ I ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ J ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ K ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ L ]
    //-------------------------------------------//

    log( HEADER, PROTOCOL = undefined, ERROR_MESSAGE = undefined ) {

        window.system.console.log( HEADER, PROTOCOL, ERROR_MESSAGE );

    };

    //-------------------------------------------//
    // [ M ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ N ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ O ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ P ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ Q ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ R ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ S ]
    //-------------------------------------------//

    schedule( KERNEL, PARAMS, TIMEOUT = undefined ) {

        window.system.scheduler.queue( KERNEL, PARAMS, TIMEOUT );

    };

    schedule_Block( Nx0 ) {

        switch( Nx0.length ) {

            case nil:

                return;

            case pos:

                window.system.scheduler.queue( Nx0[ nil ][ nil ], Nx0[ nil ][ pos ] );

                break;

            default:

                window.system.scheduler.queue_Block( Nx0 );

                break;

        }

    };

    schedule_Low_Priority( KERNEL, PARAMS, TIMEOUT = undefined ) {

        window.system.scheduler.queue_Low_Priority( KERNEL, PARAMS, TIMEOUT );

    };

    //-------------------------------------------//
    // [ T ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ U ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ V ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ W ]
    //-------------------------------------------//

    warn( HEADER, PROTOCOL = undefined, ERROR_MESSAGE = undefined ) {

        window.system.console.warn( HEADER, PROTOCOL, ERROR_MESSAGE );

    };

    //-------------------------------------------//
    // [ X ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ Y ]
    //-------------------------------------------//

    //-------------------------------------------//
    // [ Z ]
    //-------------------------------------------//

};

//==========================================================================================//
// [ DECLARATION ]: MAIN
//==========================================================================================//

var cvs = undefined;

var vec = [
    0, 400,
    70, 100,
    140, 280,
    210, 240,
    280, 200,
    350, 300,
    420, 180,
    490, 240,
    560, 120,
    630, 80,
    700, 160,
    770, 220,
];

// script -> client -> program -> driver ->
//                                loadbar ->

const clientImportCacheDataKernel = new Array(
    undefined,  // bool
    undefined,  // int
    function( NODE, DATA ) {
        let t = { text: { value: DATA } };
        window.system.linker.build( NODE, t );
    },  // string
    function( NODE, DATA ) {
        let t = { import: DATA };
        window.system.linker.build( NODE, t );
    },  // array
    undefined,  // object
    undefined,  // function
);

function MAIN() {

    setInterval( function() {

        if( client.cache != undefined ) {

            for( let i in client.cache ) {
                
                if( cvl.typeof( client.cache[ i ] ) == type.object ) {

                    let data = client.cache[ i ];

                    for( let key in data ) {

                        let n = document.getElementById( key );

                        if( ( n != undefined ) && ( n.kernel != undefined ) ) {

                            cvl.runtime.invoke_Kernel( n, clientImportCacheDataKernel, data[ key ] );

                            delete data[ key ];

                        }

                    }

                }

            }

        }

        //window.system.notice.message( 'You have successfully logged out.' );

    }, 500 );

};



//************************* FILE END *************************//