import { EventEmitter, Output, Component, forwardRef, Input, ChangeDetectionStrategy } from '@angular/core';
import { delegateCombine } from "igniteui-angular-core";
import { IgxSeriesComponent } from "./igx-series-component";
import { IgxCalloutPlacementPositionsCollection } from "./igx-callout-placement-positions-collection";
import { AutoCalloutVisibilityMode_$type } from "./AutoCalloutVisibilityMode";
import { CalloutCollisionMode_$type } from "./CalloutCollisionMode";
import { IgxCalloutStyleUpdatingEventArgs } from "./igx-callout-style-updating-event-args";
import { IgxCalloutRenderStyleUpdatingEventArgs } from "./igx-callout-render-style-updating-event-args";
import { IgxCalloutContentUpdatingEventArgs } from "./igx-callout-content-updating-event-args";
import { IgxCalloutLabelUpdatingEventArgs } from "./igx-callout-label-updating-event-args";
import { IgxCalloutSeriesSelectingEventArgs } from "./igx-callout-series-selecting-event-args";
import { IgxAnnotationLayerComponent } from "./igx-annotation-layer-component";
import { CalloutLayer } from "./CalloutLayer";
import { ensureBool, ensureEnum, brushToString, stringToBrush } from "igniteui-angular-core";
import { CalloutPlacementPositionsCollection as CalloutPlacementPositionsCollection_internal } from "./CalloutPlacementPositionsCollection";
import { CalloutPlacementPositions_$type } from "./CalloutPlacementPositions";
import { SyncableObservableCollection$1 } from "igniteui-angular-core";
import * as i0 from "@angular/core";
/**
 * Represents an annotation layer that displays crosshair lines that cross through the closest value of the target series under the cursor.
*/
export let IgxCalloutLayerComponent = /*@__PURE__*/ (() => {
    class IgxCalloutLayerComponent extends IgxAnnotationLayerComponent {
        constructor() {
            super();
            this._allowedPositions = null;
            this._calloutStyleUpdating = null;
            this._calloutRenderStyleUpdating = null;
            this._calloutContentUpdating = null;
            this._calloutLabelUpdating = null;
            this._calloutSeriesSelecting = null;
        }
        createImplementation() {
            return new CalloutLayer();
        }
        /**
                                     * @hidden
                                     */
        get i() {
            return this._implementation;
        }
        /**
         * Gets whether the series is an callout annotation layer.
        */
        get isAnnotationCalloutLayer() {
            return this.i.c9;
        }
        /**
         * Gets or sets the label mapping property for the callouts.
        */
        get labelMemberPath() {
            return this.i.v1;
        }
        set labelMemberPath(v) {
            this.i.v1 = v;
        }
        /**
         * Gets or sets the label mapping property for the callouts.
        */
        get xMemberPath() {
            return this.i.wc;
        }
        set xMemberPath(v) {
            this.i.wc = v;
        }
        /**
         * Gets or sets the label mapping property for the callouts.
        */
        get yMemberPath() {
            return this.i.wf;
        }
        set yMemberPath(v) {
            this.i.wf = v;
        }
        /**
         * Gets or sets the key mapping property for the callouts.
        */
        get keyMemberPath() {
            return this.i.vy;
        }
        set keyMemberPath(v) {
            this.i.vy = v;
        }
        /**
         * Gets or sets whether to allow the callouts to be variable distances from the target points, for suppporting collision modes.
        */
        get isCalloutOffsettingEnabled() {
            return this.i.uf;
        }
        set isCalloutOffsettingEnabled(v) {
            this.i.uf = ensureBool(v);
        }
        /**
         * Gets or sets the content mapping property for the callouts.
        */
        get contentMemberPath() {
            return this.i.vr;
        }
        set contentMemberPath(v) {
            this.i.vr = v;
        }
        /**
         * Gets or sets the name of the series series to target this annotation to. If null, this annotation targets all series simultaneously.
        */
        get targetSeriesName() {
            return this.i.v3;
        }
        set targetSeriesName(v) {
            this.i.v3 = v;
        }
        /**
         * Gets or sets the series to target this annotation to. If null, this annotation targets all series simultaneously.
        */
        get targetSeries() {
            const r = this.i.tq;
            if (r == null) {
                return null;
            }
            if (!r.externalObject) {
                let e = IgxSeriesComponent._createFromInternal(r);
                if (e) {
                    e._implementation = r;
                }
                r.externalObject = e;
            }
            return r.externalObject;
        }
        set targetSeries(v) {
            if (v != null && this._stylingContainer && v._styling)
                v._styling(this._stylingContainer, this, this);
            v == null ? this.i.tq = null : this.i.tq = v.i;
        }
        /**
         * Gets or sets a channel name to identify other callout layers within the chart to share collision information with.
        */
        get collisionChannel() {
            return this.i.vo;
        }
        set collisionChannel(v) {
            this.i.vo = v;
        }
        /**
         * Gets or sets the allowed positions that the callout layer is allowed to use.
        */
        get allowedPositions() {
            if (this._allowedPositions === null) {
                let coll = new IgxCalloutPlacementPositionsCollection();
                let innerColl = this.i.tm;
                if (!innerColl) {
                    innerColl = new CalloutPlacementPositionsCollection_internal();
                }
                this._allowedPositions = coll._fromInner(innerColl);
                this.i.tm = innerColl;
            }
            return this._allowedPositions;
        }
        set allowedPositions(v) {
            if (this._allowedPositions !== null) {
                this._allowedPositions._setSyncTarget(null);
                this._allowedPositions = null;
            }
            let coll = new IgxCalloutPlacementPositionsCollection();
            this._allowedPositions = coll._fromOuter(v);
            let syncColl = new SyncableObservableCollection$1(CalloutPlacementPositions_$type);
            let innerColl = this.i.tm;
            if (!innerColl) {
                innerColl = new CalloutPlacementPositionsCollection_internal();
            }
            syncColl._inner = innerColl;
            syncColl.clear();
            this._allowedPositions._setSyncTarget(syncColl);
            this.i.tm = innerColl;
        }
        /**
         * Gets or sets how to select the final value to annotate.
        */
        get isAutoCalloutBehaviorEnabled() {
            return this.i.ue;
        }
        set isAutoCalloutBehaviorEnabled(v) {
            this.i.ue = ensureBool(v);
        }
        /**
         * Gets or sets whether to use values, rather than labels for auto callout labels.
        */
        get useInterpolatedValueForAutoCalloutLabels() {
            return this.i.ui;
        }
        set useInterpolatedValueForAutoCalloutLabels(v) {
            this.i.ui = ensureBool(v);
        }
        /**
         * Gets or sets whether to the series color as the outline of the callout.
        */
        get useSeriesColorForOutline() {
            return this.i.uj;
        }
        set useSeriesColorForOutline(v) {
            this.i.uj = ensureBool(v);
        }
        /**
         * Gets or sets whether to use values, rather than labels for auto callout labels.
        */
        get useValueForAutoCalloutLabels() {
            return this.i.uk;
        }
        set useValueForAutoCalloutLabels(v) {
            this.i.uk = ensureBool(v);
        }
        /**
         * Gets or sets the rules for when the callouts should be visible.
        */
        get autoCalloutVisibilityMode() {
            return this.i.tf;
        }
        set autoCalloutVisibilityMode(v) {
            this.i.tf = ensureEnum(AutoCalloutVisibilityMode_$type, v);
        }
        /**
         * Gets or sets the corner radius to use for the callout borders.
        */
        get calloutCornerRadius() {
            return this.i.uu;
        }
        set calloutCornerRadius(v) {
            this.i.uu = +v;
        }
        /**
         * Gets or sets whether to allow for custom callout styles.
        */
        get isCustomCalloutStyleEnabled() {
            return this.i.uh;
        }
        set isCustomCalloutStyleEnabled(v) {
            this.i.uh = ensureBool(v);
        }
        /**
         * Gets or sets whether to allow for custom callout styles.
        */
        get isCustomCalloutRenderStyleEnabled() {
            return this.i.ug;
        }
        set isCustomCalloutRenderStyleEnabled(v) {
            this.i.ug = ensureBool(v);
        }
        /**
         * Gets or sets the precision to use when values are used for the auto callout labels.
        */
        get autoCalloutLabelPrecision() {
            return this.i.u3;
        }
        set autoCalloutLabelPrecision(v) {
            this.i.u3 = +v;
        }
        /**
         * Gets or sets the color to use for the callout text. Leave unset for an automatic value.
        */
        get calloutTextColor() {
            return brushToString(this.i.xv);
        }
        set calloutTextColor(v) {
            this.i.xv = stringToBrush(v);
        }
        /**
         * Gets or sets the brush that specifies how the backgrounds for the callouts of the layer are painted. Leave unset for an automatic value.
        */
        get calloutBackground() {
            return brushToString(this.i.xs);
        }
        set calloutBackground(v) {
            this.i.xs = stringToBrush(v);
        }
        /**
         * Gets or sets the precision to use displaying values for interpolated crosshair positions.
        */
        get calloutInterpolatedValuePrecision() {
            return this.i.u4;
        }
        set calloutInterpolatedValuePrecision(v) {
            this.i.u4 = +v;
        }
        /**
         * Gets or sets the brush that specifies how the outlines for the callouts of the layer are painted.
        */
        get calloutOutline() {
            return brushToString(this.i.xu);
        }
        set calloutOutline(v) {
            this.i.xu = stringToBrush(v);
        }
        /**
         * Gets or sets the brush that specifies how the leader lines for the callouts of the layer are painted.
        */
        get calloutLeaderBrush() {
            return brushToString(this.i.xt);
        }
        set calloutLeaderBrush(v) {
            this.i.xt = stringToBrush(v);
        }
        /**
         * Gets or sets the left padding to use withing the callout. Leaving this NaN will use an automatic value related to the axis label margins.
        */
        get calloutPaddingLeft() {
            return this.i.uw;
        }
        set calloutPaddingLeft(v) {
            this.i.uw = +v;
        }
        /**
         * Gets or sets the top padding to use within the callout. Leaving this NaN will use an automatic value related to the axis label margins.
        */
        get calloutPaddingTop() {
            return this.i.uy;
        }
        set calloutPaddingTop(v) {
            this.i.uy = +v;
        }
        /**
         * Gets or sets the right padding to use within the callout. Leaving this NaN will use an automatic value related to the axis label margins.
        */
        get calloutPaddingRight() {
            return this.i.ux;
        }
        set calloutPaddingRight(v) {
            this.i.ux = +v;
        }
        /**
         * Gets or sets the bottom padding to use within the callout. Leaving this NaN will use an automatic value related to the axis label margins.
        */
        get calloutPaddingBottom() {
            return this.i.uv;
        }
        set calloutPaddingBottom(v) {
            this.i.uv = +v;
        }
        /**
         * Gets or sets the strategy to use for avoiding collisions between the callouts in this layer. Leave unset for an automatic value.
        */
        get calloutCollisionMode() {
            return this.i.th;
        }
        set calloutCollisionMode(v) {
            this.i.th = ensureEnum(CalloutCollisionMode_$type, v);
        }
        /**
         * Gets or sets the padding to add to the callout positioning. Leave unset for an automatic value.
        */
        get calloutPositionPadding() {
            return this.i.uz;
        }
        set calloutPositionPadding(v) {
            this.i.uz = +v;
        }
        /**
         * Gets or sets the stroke thickness for the callout backing. Leave unset for an automatic value.
        */
        get calloutStrokeThickness() {
            return this.i.u0;
        }
        set calloutStrokeThickness(v) {
            this.i.u0 = +v;
        }
        /**
         * Gets or sets the stroke thickness for the axis annotation backing. Leave unset for an automatic value.
        */
        get textStyle() {
            return this.i.v6;
        }
        set textStyle(v) {
            this.i.v6 = v;
        }
        findByName(name) {
            var baseResult = super.findByName(name);
            if (baseResult) {
                return baseResult;
            }
            if (this.targetSeries && this.targetSeries.name && this.targetSeries.name == name) {
                return this.targetSeries;
            }
            if (this.allowedPositions != null && this.allowedPositions.findByName && this.allowedPositions.findByName(name)) {
                return this.allowedPositions.findByName(name);
            }
            return null;
        }
        _styling(container, component, parent) {
            super._styling(container, component, parent);
            this._inStyling = true;
            if (this.targetSeries && this.targetSeries._styling) {
                this.targetSeries._styling(container, component, this);
            }
            this._inStyling = false;
        }
        getItemValue(item, memberPathName) {
            let iv = this.i.h1(item, memberPathName);
            return (iv);
        }
        /**
         * Invalidates content of callout layer
        
        */
        invalidateCalloutContent() {
            this.i.wp();
        }
        /**
         * Event raised when updating style of callout layer
        */
        get calloutStyleUpdating() {
            if (this._calloutStyleUpdating == null) {
                this._calloutStyleUpdating = new EventEmitter();
                this.i.calloutStyleUpdating = delegateCombine(this.i.calloutStyleUpdating, (o, e) => {
                    this._runInZone(() => {
                        let outerArgs = new IgxCalloutStyleUpdatingEventArgs();
                        outerArgs._provideImplementation(e);
                        if (this.beforeCalloutStyleUpdating) {
                            this.beforeCalloutStyleUpdating(this, outerArgs);
                        }
                        this._calloutStyleUpdating.emit({
                            sender: this,
                            args: outerArgs
                        });
                    });
                });
            }
            return this._calloutStyleUpdating;
        }
        /**
         * Event raised when updating style of callout layer
        */
        get calloutRenderStyleUpdating() {
            if (this._calloutRenderStyleUpdating == null) {
                this._calloutRenderStyleUpdating = new EventEmitter();
                this.i.calloutRenderStyleUpdating = delegateCombine(this.i.calloutRenderStyleUpdating, (o, e) => {
                    this._runInZone(() => {
                        let outerArgs = new IgxCalloutRenderStyleUpdatingEventArgs();
                        outerArgs._provideImplementation(e);
                        if (this.beforeCalloutRenderStyleUpdating) {
                            this.beforeCalloutRenderStyleUpdating(this, outerArgs);
                        }
                        this._calloutRenderStyleUpdating.emit({
                            sender: this,
                            args: outerArgs
                        });
                    });
                });
            }
            return this._calloutRenderStyleUpdating;
        }
        /**
         * Raised to allow you to decide on the content for an automatically created callout.
        */
        get calloutContentUpdating() {
            if (this._calloutContentUpdating == null) {
                this._calloutContentUpdating = new EventEmitter();
                this.i.calloutContentUpdating = delegateCombine(this.i.calloutContentUpdating, (o, e) => {
                    this._runInZone(() => {
                        let outerArgs = new IgxCalloutContentUpdatingEventArgs();
                        outerArgs._provideImplementation(e);
                        if (this.beforeCalloutContentUpdating) {
                            this.beforeCalloutContentUpdating(this, outerArgs);
                        }
                        this._calloutContentUpdating.emit({
                            sender: this,
                            args: outerArgs
                        });
                    });
                });
            }
            return this._calloutContentUpdating;
        }
        /**
         * Raised to allow you to decide on the label for an automatically created callout.
        */
        get calloutLabelUpdating() {
            if (this._calloutLabelUpdating == null) {
                this._calloutLabelUpdating = new EventEmitter();
                this.i.calloutLabelUpdating = delegateCombine(this.i.calloutLabelUpdating, (o, e) => {
                    this._runInZone(() => {
                        let outerArgs = new IgxCalloutLabelUpdatingEventArgs();
                        outerArgs._provideImplementation(e);
                        if (this.beforeCalloutLabelUpdating) {
                            this.beforeCalloutLabelUpdating(this, outerArgs);
                        }
                        this._calloutLabelUpdating.emit({
                            sender: this,
                            args: outerArgs
                        });
                    });
                });
            }
            return this._calloutLabelUpdating;
        }
        /**
         * Raised to allow you to select a target series for a data bound callout.
        */
        get calloutSeriesSelecting() {
            if (this._calloutSeriesSelecting == null) {
                this._calloutSeriesSelecting = new EventEmitter();
                this.i.calloutSeriesSelecting = delegateCombine(this.i.calloutSeriesSelecting, (o, e) => {
                    this._runInZone(() => {
                        let outerArgs = new IgxCalloutSeriesSelectingEventArgs();
                        outerArgs._provideImplementation(e);
                        if (this.beforeCalloutSeriesSelecting) {
                            this.beforeCalloutSeriesSelecting(this, outerArgs);
                        }
                        this._calloutSeriesSelecting.emit({
                            sender: this,
                            args: outerArgs
                        });
                    });
                });
            }
            return this._calloutSeriesSelecting;
        }
    }
    IgxCalloutLayerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: IgxCalloutLayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    IgxCalloutLayerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: IgxCalloutLayerComponent, selector: "igx-callout-layer", inputs: { labelMemberPath: "labelMemberPath", xMemberPath: "xMemberPath", yMemberPath: "yMemberPath", keyMemberPath: "keyMemberPath", isCalloutOffsettingEnabled: "isCalloutOffsettingEnabled", contentMemberPath: "contentMemberPath", targetSeriesName: "targetSeriesName", targetSeries: "targetSeries", collisionChannel: "collisionChannel", allowedPositions: "allowedPositions", isAutoCalloutBehaviorEnabled: "isAutoCalloutBehaviorEnabled", useInterpolatedValueForAutoCalloutLabels: "useInterpolatedValueForAutoCalloutLabels", useSeriesColorForOutline: "useSeriesColorForOutline", useValueForAutoCalloutLabels: "useValueForAutoCalloutLabels", autoCalloutVisibilityMode: "autoCalloutVisibilityMode", calloutCornerRadius: "calloutCornerRadius", isCustomCalloutStyleEnabled: "isCustomCalloutStyleEnabled", isCustomCalloutRenderStyleEnabled: "isCustomCalloutRenderStyleEnabled", autoCalloutLabelPrecision: "autoCalloutLabelPrecision", calloutTextColor: "calloutTextColor", calloutBackground: "calloutBackground", calloutInterpolatedValuePrecision: "calloutInterpolatedValuePrecision", calloutOutline: "calloutOutline", calloutLeaderBrush: "calloutLeaderBrush", calloutPaddingLeft: "calloutPaddingLeft", calloutPaddingTop: "calloutPaddingTop", calloutPaddingRight: "calloutPaddingRight", calloutPaddingBottom: "calloutPaddingBottom", calloutCollisionMode: "calloutCollisionMode", calloutPositionPadding: "calloutPositionPadding", calloutStrokeThickness: "calloutStrokeThickness", textStyle: "textStyle" }, outputs: { calloutStyleUpdating: "calloutStyleUpdating", calloutRenderStyleUpdating: "calloutRenderStyleUpdating", calloutContentUpdating: "calloutContentUpdating", calloutLabelUpdating: "calloutLabelUpdating", calloutSeriesSelecting: "calloutSeriesSelecting" }, providers: [{ provide: IgxAnnotationLayerComponent, useExisting: forwardRef(() => IgxCalloutLayerComponent) }, { provide: IgxSeriesComponent, useExisting: forwardRef(() => IgxCalloutLayerComponent) }], usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
    return IgxCalloutLayerComponent;
})();
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: IgxCalloutLayerComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'igx-callout-layer',
                    template: ``,
                    providers: [{ provide: IgxAnnotationLayerComponent, useExisting: forwardRef(() => IgxCalloutLayerComponent) }, { provide: IgxSeriesComponent, useExisting: forwardRef(() => IgxCalloutLayerComponent) }],
                    changeDetection: ChangeDetectionStrategy.OnPush
                }]
        }], ctorParameters: function () { return []; }, propDecorators: { labelMemberPath: [{
                type: Input
            }], xMemberPath: [{
                type: Input
            }], yMemberPath: [{
                type: Input
            }], keyMemberPath: [{
                type: Input
            }], isCalloutOffsettingEnabled: [{
                type: Input
            }], contentMemberPath: [{
                type: Input
            }], targetSeriesName: [{
                type: Input
            }], targetSeries: [{
                type: Input
            }], collisionChannel: [{
                type: Input
            }], allowedPositions: [{
                type: Input
            }], isAutoCalloutBehaviorEnabled: [{
                type: Input
            }], useInterpolatedValueForAutoCalloutLabels: [{
                type: Input
            }], useSeriesColorForOutline: [{
                type: Input
            }], useValueForAutoCalloutLabels: [{
                type: Input
            }], autoCalloutVisibilityMode: [{
                type: Input
            }], calloutCornerRadius: [{
                type: Input
            }], isCustomCalloutStyleEnabled: [{
                type: Input
            }], isCustomCalloutRenderStyleEnabled: [{
                type: Input
            }], autoCalloutLabelPrecision: [{
                type: Input
            }], calloutTextColor: [{
                type: Input
            }], calloutBackground: [{
                type: Input
            }], calloutInterpolatedValuePrecision: [{
                type: Input
            }], calloutOutline: [{
                type: Input
            }], calloutLeaderBrush: [{
                type: Input
            }], calloutPaddingLeft: [{
                type: Input
            }], calloutPaddingTop: [{
                type: Input
            }], calloutPaddingRight: [{
                type: Input
            }], calloutPaddingBottom: [{
                type: Input
            }], calloutCollisionMode: [{
                type: Input
            }], calloutPositionPadding: [{
                type: Input
            }], calloutStrokeThickness: [{
                type: Input
            }], textStyle: [{
                type: Input
            }], calloutStyleUpdating: [{
                type: Output
            }], calloutRenderStyleUpdating: [{
                type: Output
            }], calloutContentUpdating: [{
                type: Output
            }], calloutLabelUpdating: [{
                type: Output
            }], calloutSeriesSelecting: [{
                type: Output
            }] } });
