"use strict";

Object.defineProperty(exports, "__esModule", {
    value: !0
}), exports.Env = void 0;

class Env {
    static get mode() {
        return Env._mode || (Env._mode = defaultMode()), Env._mode;
    }
    static set mode(mode) {
        Env._mode = mode;
    }
    static RegisterCreateCanvas(func) {
        Env.CreateCanvas = func;
    }
    static RegisterLoadImage(func) {
        Env.LoadImage = func;
    }
    static GetCreateCanvasFunc() {
        return Env.CreateCanvas ? Env.CreateCanvas : "worker" === Env.mode ? (width = 200, height = 200) => new OffscreenCanvas(width, height) : void 0;
    }
    static RegisterRequestAnimationFrame(func) {
        Env.RequestAnimationFrame = func();
    }
    static GetRequestAnimationFrame() {
        if (Env.RequestAnimationFrame) return Env.RequestAnimationFrame;
    }
    static RegisterCancelAnimationFrame(func) {
        Env.CancelAnimationFrame = func();
    }
    static GetCancelAnimationFrame() {
        if (Env.CancelAnimationFrame) return Env.CancelAnimationFrame;
    }
}

function defaultMode() {
    let mode = "browser";
    try {
        "node" === window.type ? mode = "node" : "undefined" == typeof window || window.performance ? "undefined" == typeof window && (mode = "node") : mode = "miniApp";
    } catch (err) {
        mode = "node";
    }
    return mode;
}

//# sourceMappingURL=env.js.map
exports.Env = Env, Env.dpr = 0;