"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generatePackageDependencies = void 0;
const cals_1 = require("@cloudbase/cals");
const BASE_DEPS = {
    'miniprogram-gesture': '^1.0.6',
    mobx: '^5',
    'lodash.get': '^4',
    'lodash.set': '^4',
};
/**
 * 注意锁版本
 */
const CLOUDBASE_DEPS = {
    '@cloudbase/oauth': '0.1.1-alpha.15',
    '@cloudbase/weda-client': '1.1.6',
    '@cloudbase/weda-cloud-sdk': '1.0.68',
};
function generatePackageDependencies({ importJSSDK, mode, officialLibVersion, uin, }) {
    const deps = {};
    if (importJSSDK) {
        deps['@cloudbase/js-sdk'] = '2.5.47-beta.0';
    }
    const mod = uin ? Number(uin) % 10 : undefined;
    if (mode === 'lib') {
        // eslint-disable-next-line no-restricted-syntax
        for (const key in CLOUDBASE_DEPS) {
            const version = CLOUDBASE_DEPS[key];
            /**
             * lib 模式下采用松散的引用
             */
            deps[key] = /^\d/.test(version) ? `^${version}` : version;
        }
        if (officialLibVersion) {
            deps[cals_1.OFFICIAL_LIB_MP_NPM_PACKAGENAME] = officialLibVersion;
        }
    }
    else {
        for (const key in CLOUDBASE_DEPS) {
            deps[key] = CLOUDBASE_DEPS[key];
        }
    }
    return {
        ...deps,
        ...BASE_DEPS,
    };
}
exports.generatePackageDependencies = generatePackageDependencies;
