import { AXPValueWidgetComponent } from '@acorex/platform/layout/widget-core';
import * as i0 from '@angular/core';
import { computed, ChangeDetectionStrategy, Component } from '@angular/core';
import { A as AXMQuestionnaireBuilderComponent } from './acorex-modules-assessment-management-questionnaire-builder.component-DHGcsvkT.mjs';
import { t as toPrePostConfig } from './acorex-modules-assessment-management-acorex-modules-assessment-management-W8hHssaa.mjs';

//#region ----   Imports   ----
//#endregion
//#region ----   Widget Edit Component   ----
/**
 * Questionnaire Builder Widget Edit Component
 * Wraps the reusable AXMQuestionnaireBuilderComponent for use as a widget
 */
class AXMQuestionnaireBuilderWidgetEditComponent extends AXPValueWidgetComponent {
    constructor() {
        super(...arguments);
        /**
         * Pre/post config from parent form context (questionnaire entity).
         * Used for preview to show welcome, review, and summary.
         */
        this.prePostConfig = computed(() => {
            const parentPath = this.parentPath();
            const store = this.contextService;
            const root = parentPath ? store.getValue(parentPath) : store.snapshot?.();
            return toPrePostConfig(root ?? null);
        }, ...(ngDevMode ? [{ debugName: "prePostConfig" }] : []));
    }
    /**
     * Handle value change from the builder component
     */
    handleValueChange(value) {
        this.setValue(value);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMQuestionnaireBuilderWidgetEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: AXMQuestionnaireBuilderWidgetEditComponent, isStandalone: true, selector: "axm-questionnaire-builder-widget-edit", usesInheritance: true, ngImport: i0, template: `
        <axm-questionnaire-builder
            [value]="getValue()"
            [readonly]="options()['readonly'] || false"
            [prePostConfig]="prePostConfig()"
            (valueChange)="handleValueChange($event)">
        </axm-questionnaire-builder>
    `, isInline: true, dependencies: [{ kind: "component", type: AXMQuestionnaireBuilderComponent, selector: "axm-questionnaire-builder", inputs: ["value", "readonly", "prePostConfig"], outputs: ["valueChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMQuestionnaireBuilderWidgetEditComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'axm-questionnaire-builder-widget-edit',
                    template: `
        <axm-questionnaire-builder
            [value]="getValue()"
            [readonly]="options()['readonly'] || false"
            [prePostConfig]="prePostConfig()"
            (valueChange)="handleValueChange($event)">
        </axm-questionnaire-builder>
    `,
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    imports: [AXMQuestionnaireBuilderComponent],
                }]
        }] });

export { AXMQuestionnaireBuilderWidgetEditComponent };
//# sourceMappingURL=acorex-modules-assessment-management-questionnaire-builder-edit.component-DSOv1eQv.mjs.map
