import { Pipe, inject } from '@angular/core';
import { extend } from '@jscrpt/common';
import { LAYOUT_DEFAULTS_OVERRIDE } from '../../misc/tokens';
import * as i0 from "@angular/core";
/**
 * Transforms ComponentsPaletteItem item to LayoutComponentDragData
 */
export class ToLayoutDragDataSAPipe {
    constructor() {
        //######################### protected properties #########################
        /**
         * Default options override service
         */
        this._defaultsOverride = inject(LAYOUT_DEFAULTS_OVERRIDE, { optional: true });
    }
    //######################### public methods - implementation of PipeTransform #########################
    /**
     * Transforms ComponentsPaletteItem item to LayoutComponentDragData
     * @param value - Palette item to be transformed
     */
    transform(value) {
        var _a, _b, _c, _d, _e;
        return {
            metadata: {
                id: '',
                displayName: ((_a = this._defaultsOverride) === null || _a === void 0 ? void 0 : _a.getDisplayName(value.itemSource.package, value.itemSource.name)) || '',
                package: value.itemSource.package,
                name: value.itemSource.name,
                options: extend(true, {}, (_d = (_b = this._defaultsOverride) === null || _b === void 0 ? void 0 : _b.getOptions(value.itemSource.package, value.itemSource.name, (_c = value.metadata.metaInfo) === null || _c === void 0 ? void 0 : _c.defaultOptions)) !== null && _d !== void 0 ? _d : (_e = value.metadata.metaInfo) === null || _e === void 0 ? void 0 : _e.defaultOptions),
            },
            parentId: null,
            index: null,
        };
    }
}
ToLayoutDragDataSAPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ToLayoutDragDataSAPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
ToLayoutDragDataSAPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.0.4", ngImport: i0, type: ToLayoutDragDataSAPipe, isStandalone: true, name: "toLayoutDragData" });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ToLayoutDragDataSAPipe, decorators: [{
            type: Pipe,
            args: [{ name: 'toLayoutDragData', standalone: true }]
        }] });
//# sourceMappingURL=toLayoutDragData.pipe.js.map