"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.regionPicker = exports.getRegionTree = void 0;
var tslib_1 = require("tslib");
// 暂时把地区信息打包在本地, 后续移到COS桶内
var provinces_json_1 = (0, tslib_1.__importDefault)(require("./provinces.json"));
var cities_1 = require("./cities");
var regions_1 = require("./regions");
var weui_1 = (0, tslib_1.__importDefault)(require("../../../../utils/weui"));
var tree;
function getRegionTree() {
    if (!tree) {
        tree = provinces_json_1.default.map(function (province) {
            return {
                label: province.name,
                value: province.name,
                children: cities_1.CITIES.filter(function (city) { return city.parent_code === province.code; }).map(function (city) {
                    return {
                        label: city.name,
                        value: city.name,
                        children: regions_1.REGIONS.filter(function (region) { return region.parent_code === city.code; }).map(function (region) {
                            return {
                                label: region.name,
                                value: region.name,
                            };
                        }),
                    };
                }),
            };
        });
    }
    return tree;
}
exports.getRegionTree = getRegionTree;
function regionPicker(options) {
    weui_1.default.picker(getRegionTree(), options);
}
exports.regionPicker = regionPicker;
//# sourceMappingURL=index.js.map