import { lu as GEO_TYPES_LABEL_MAP, a as __awaiter, I as Icon, am as Tooltip, O as map, al as Button, lv as GEO_TYPE_THUMB_MAP, t as toastApi } from './MapEditView-f6381866.js';
import React__default, { useCallback } from 'react';
import { t as thumbListContext, a as i18n, b as prefixCls } from './index-0b8bebb4.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 '@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-f89fbdd0.js';
import './useDataValue-6bd3790f.js';
import 'ali-react-table-fork';
import './Transfer-b219601e.js';
import 'ismobilejs';

const FORMAT = 'YYYY/hh/mm';
const CollaborationSide = observer(({ onClose }) => {
    var _a, _b;
    const Context = thumbListContext.getContext();
    const value = React__default.useContext(Context);
    const { store } = value;
    const { totalCount, packageItem, deleteAllCol, onClearWillDeleteCollaborateInfo } = store;
    const { name, geometryType = 'point', createTime, updateTime } = packageItem;
    const 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) : '-',
        },
    ];
    const icon = GEO_TYPE_THUMB_MAP[geometryType];
    const onDeleteAllColl = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
        var _c;
        try {
            yield deleteAllCol();
            onClearWillDeleteCollaborateInfo();
            onClose();
        }
        catch (error) {
            console.log('error', error);
            const msg = (_c = get(error, 'response.message')) !== null && _c !== void 0 ? _c : get(error, 'response.data.message');
            toastApi.error(msg !== null && msg !== void 0 ? msg : i18n.collaboration.deleteCollaborationError);
        }
    }), [deleteAllCol, onClearWillDeleteCollaborateInfo, onClose]);
    return (React__default.createElement("div", { className: `${prefixCls}-side` },
        React__default.createElement("div", { className: `${prefixCls}-side-main` },
            React__default.createElement("div", { className: `${prefixCls}-side-img` },
                React__default.createElement(Icon, { icon: icon })),
            React__default.createElement("div", { className: `${prefixCls}-side-title` },
                React__default.createElement(Tooltip, { title: (_a = `${name}${i18n.collaboration.package}`) !== null && _a !== void 0 ? _a : '-' },
                    React__default.createElement("span", null, (_b = `${name}${i18n.collaboration.package}`) !== null && _b !== void 0 ? _b : '-'))),
            map(menus, (it) => {
                return (React__default.createElement("div", { className: `${prefixCls}-side-item`, key: it.label },
                    React__default.createElement("div", { className: `${prefixCls}-side-item-label` }, it.label),
                    React__default.createElement("div", { className: `${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 };
