import { lu as GEO_TYPES_LABEL_MAP, lv as GEO_TYPE_THUMB_MAP, b as __awaiter, c as __generator, I as Icon, ar as Tooltip, X as map, aq as Button, t as toastApi } from './MapEditView-24782753.js';
import React__default, { useCallback } from 'react';
import { t as thumbListContext, a as i18n, b as prefixCls } from './index-3505e026.js';
import { observer } from 'mobx-react';
import 'react-dom';
import 'react-dnd-html5-backend';
import 'classnames';
import 'perfect-scrollbar';
import 'react-virtualized';
import dayjs from 'dayjs';
import { get } from 'lodash';
import 'maptalks';
import 'uuid';
import 'mobx';
import 'lz-string';
import 'react-is';
import '@loadable/component';
import 'js-beautify';
import 'axios';
import 'superstruct';
import '@tanem/react-nprogress';
import 'jquery';
import 'chroma-js';
import 'js-cookie';
import 'is-email';
import 'is-uuid';
import 'is-url';
import 'anymatch';
import 'perf-request';
import '@syncpoint/wkx';
import 'buffer';
import '@turf/turf';
import '@mapbox/polylabel';
import 'turf-multipolygon';
import 'turf-polygon';
import 'gcoord';
import 'eventemitter2';
import 'geobuf';
import 'localforage';
import 'rc-menu';
import 'ahooks';
import 'jszip';
import 'file-saver';
import 'screenfull';
import 'sql-formatter-fork';
import 'array-move';
import 'turf-multilinestring';
import 'copy-to-clipboard';
import 'maptalks.three';
import 'ajv';
import 'spark-md5';
import 'react-draggable';
import 'turf-point';
import 'decamelize';
import 'rbush';
import 'qs';
import 'maptalks.snap';
import 'react-use';
import 'react-rnd';
import 'react-beautiful-dnd';
import 'react-contextmenu';
import 'coordtransform';
import './compact-6f8b3541.js';
import './useDataValue-8bdb351c.js';
import 'ali-react-table-fork';
import './Transfer-f55a5877.js';
import 'ismobilejs';

var FORMAT = 'YYYY/hh/mm';
var CollaborationSide = observer(function (_a) {
    var _b, _c;
    var onClose = _a.onClose;
    var Context = thumbListContext.getContext();
    var value = React__default.useContext(Context);
    var store = value.store;
    var totalCount = store.totalCount, packageItem = store.packageItem, deleteAllCol = store.deleteAllCol, onClearWillDeleteCollaborateInfo = store.onClearWillDeleteCollaborateInfo;
    var name = packageItem.name, _d = packageItem.geometryType, geometryType = _d === void 0 ? 'point' : _d, createTime = packageItem.createTime, updateTime = packageItem.updateTime;
    var menus = [
        { label: i18n.collaboration.type, value: GEO_TYPES_LABEL_MAP[geometryType] },
        { label: i18n.collaboration.rowCount, value: totalCount },
        {
            label: i18n.collaboration.createTime,
            value: createTime ? dayjs(createTime * 1000).format(FORMAT) : '-',
        },
        {
            label: i18n.collaboration.updateTime,
            value: updateTime ? dayjs(updateTime * 1000).format(FORMAT) : '-',
        },
    ];
    var icon = GEO_TYPE_THUMB_MAP[geometryType];
    var onDeleteAllColl = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
        var error_1, msg;
        var _a;
        return __generator(this, function (_b) {
            switch (_b.label) {
                case 0:
                    _b.trys.push([0, 2, , 3]);
                    return [4 /*yield*/, deleteAllCol()];
                case 1:
                    _b.sent();
                    onClearWillDeleteCollaborateInfo();
                    onClose();
                    return [3 /*break*/, 3];
                case 2:
                    error_1 = _b.sent();
                    console.log('error', error_1);
                    msg = (_a = get(error_1, 'response.message')) !== null && _a !== void 0 ? _a : get(error_1, 'response.data.message');
                    toastApi.error(msg !== null && msg !== void 0 ? msg : i18n.collaboration.deleteCollaborationError);
                    return [3 /*break*/, 3];
                case 3: return [2 /*return*/];
            }
        });
    }); }, [deleteAllCol, onClearWillDeleteCollaborateInfo, onClose]);
    return (React__default.createElement("div", { className: "".concat(prefixCls, "-side") },
        React__default.createElement("div", { className: "".concat(prefixCls, "-side-main") },
            React__default.createElement("div", { className: "".concat(prefixCls, "-side-img") },
                React__default.createElement(Icon, { icon: icon })),
            React__default.createElement("div", { className: "".concat(prefixCls, "-side-title") },
                React__default.createElement(Tooltip, { title: (_b = "".concat(name).concat(i18n.collaboration.package)) !== null && _b !== void 0 ? _b : '-' },
                    React__default.createElement("span", null, (_c = "".concat(name).concat(i18n.collaboration.package)) !== null && _c !== void 0 ? _c : '-'))),
            map(menus, function (it) {
                return (React__default.createElement("div", { className: "".concat(prefixCls, "-side-item"), key: it.label },
                    React__default.createElement("div", { className: "".concat(prefixCls, "-side-item-label") }, it.label),
                    React__default.createElement("div", { className: "".concat(prefixCls, "-side-item-value") }, it.value)));
            })),
        React__default.createElement(Button, { type: "assist-bg", block: true, disabled: true }, i18n.collaboration.batchStartCollaborationPackage),
        React__default.createElement(Button, { type: "assist-bg", block: true, onClick: onDeleteAllColl }, i18n.collaboration.deleteCollaboration)));
});
CollaborationSide.displayName = 'Collaboration';

export { CollaborationSide as default };
