"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.wrapUint8Array = exports.wrapArray = exports.wrapSharedRefArrayInterface = void 0;
const _1 = require("../Class/$");
const MethodNotImplementedError_1 = require("../exception/MethodNotImplementedError");
function wrapSharedRefArrayInterface(data, _system) {
    return {
        append(a) {
            const b = [];
            data.current.push(a);
            return;
        },
        put(i, data) {
            throw new MethodNotImplementedError_1.MethodNotImplementedError();
        },
        at(i) {
            throw new MethodNotImplementedError_1.MethodNotImplementedError();
        },
        length() {
            throw new MethodNotImplementedError_1.MethodNotImplementedError();
        },
        indexOf(a) {
            throw new MethodNotImplementedError_1.MethodNotImplementedError();
        },
    };
}
exports.wrapSharedRefArrayInterface = wrapSharedRefArrayInterface;
function wrapArray(array, system) {
    const _array = new (class Array extends _1.$ {
        constructor() {
            super(...arguments);
            this.__ = ['A'];
        }
        append(a) {
            return __awaiter(this, void 0, void 0, function* () {
                array.push(a);
            });
        }
        put(i, data) {
            throw new MethodNotImplementedError_1.MethodNotImplementedError();
        }
        at(i) {
            return __awaiter(this, void 0, void 0, function* () {
                return array[i];
            });
        }
        length() {
            return __awaiter(this, void 0, void 0, function* () {
                return array.length;
            });
        }
        indexOf(a) {
            throw new MethodNotImplementedError_1.MethodNotImplementedError();
        }
    })(system);
    return _array;
}
exports.wrapArray = wrapArray;
function wrapUint8Array(array, system) {
    const _array = new (class Array extends _1.$ {
        constructor() {
            super(...arguments);
            this.__ = ['A'];
        }
        append(a) {
            array[array.length] = a;
            return;
        }
        put(i, data) {
            return __awaiter(this, void 0, void 0, function* () {
                array[i] = data;
            });
        }
        at(i) {
            return __awaiter(this, void 0, void 0, function* () {
                return array[i];
            });
        }
        length() {
            return __awaiter(this, void 0, void 0, function* () {
                return array.length;
            });
        }
        indexOf(a) {
            throw new MethodNotImplementedError_1.MethodNotImplementedError();
        }
        raw() {
            return array;
        }
    })(system);
    return _array;
}
exports.wrapUint8Array = wrapUint8Array;
//# sourceMappingURL=Array.js.map