"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
function _export(target, all) {
    for(var name in all)Object.defineProperty(target, name, {
        enumerable: true,
        get: Object.getOwnPropertyDescriptor(all, name).get
    });
}
_export(exports, {
    get IconContainer () {
        return IconContainer;
    },
    get LoadWrap () {
        return LoadWrap;
    },
    get Loader () {
        return Loader;
    },
    get StyledSpinner () {
        return StyledSpinner;
    },
    get base () {
        return base;
    }
});
const _styledcomponents = /*#__PURE__*/ _interop_require_wildcard(require("styled-components"));
const _mixins = require("../../../mixins");
const _engines = require("../../../engines");
const _Spinner = require("../../Spinner");
const _EmbeddedButtontokens = require("./EmbeddedButton.tokens");
function _getRequireWildcardCache(nodeInterop) {
    if (typeof WeakMap !== "function") return null;
    var cacheBabelInterop = new WeakMap();
    var cacheNodeInterop = new WeakMap();
    return (_getRequireWildcardCache = function(nodeInterop) {
        return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
    })(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
    if (!nodeInterop && obj && obj.__esModule) {
        return obj;
    }
    if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
        return {
            default: obj
        };
    }
    var cache = _getRequireWildcardCache(nodeInterop);
    if (cache && cache.has(obj)) {
        return cache.get(obj);
    }
    var newObj = {
        __proto__: null
    };
    var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
    for(var key in obj){
        if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
            var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
            if (desc && (desc.get || desc.set)) {
                Object.defineProperty(newObj, key, desc);
            } else {
                newObj[key] = obj[key];
            }
        }
    }
    newObj.default = obj;
    if (cache) {
        cache.set(obj, newObj);
    }
    return newObj;
}
const mergedConfig = (0, _engines.mergeConfig)(_Spinner.spinnerConfig);
const Spinner = (0, _engines.component)(mergedConfig);
const positionAlignItems = {
    center: 'center',
    'center-left': 'center',
    'center-right': 'center',
    top: 'start',
    'top-left': 'start',
    'top-right': 'start',
    bottom: 'end',
    'bottom-left': 'end',
    'bottom-right': 'end'
};
const positionJustifyItems = {
    center: 'center',
    'center-left': 'start',
    'center-right': 'end',
    top: 'center',
    'top-left': 'start',
    'top-right': 'end',
    bottom: 'center',
    'bottom-left': 'start',
    'bottom-right': 'end'
};
const LoadWrap = _styledcomponents.default.div.withConfig({
    displayName: "EmbeddedButton.styles__LoadWrap",
    componentId: "sc-311bee48-0"
})([
    `opacity:`,
    `;display:grid;width:100%;height:100%;align-items:`,
    `;justify-items:`,
    `;`
], ({ isLoading })=>isLoading ? `var(${_EmbeddedButtontokens.tokens.loadingIconOpacity})` : '1', ({ position })=>positionAlignItems[position], ({ position })=>positionJustifyItems[position]);
const IconContainer = _styledcomponents.default.div.withConfig({
    displayName: "EmbeddedButton.styles__IconContainer",
    componentId: "sc-311bee48-1"
})([
    `display:flex;align-items:center;justify-content:center;flex-shrink:0;`
]);
const Loader = _styledcomponents.default.div.withConfig({
    displayName: "EmbeddedButton.styles__Loader",
    componentId: "sc-311bee48-2"
})([
    `position:absolute;inset:0;display:flex;align-items:center;justify-content:center;`
]);
const StyledSpinner = (0, _styledcomponents.default)(Spinner).withConfig({
    displayName: "EmbeddedButton.styles__StyledSpinner",
    componentId: "sc-311bee48-3"
})([
    ``,
    `:var(`,
    `);`,
    `:var(`,
    `);`
], _Spinner.spinnerTokens.size, _EmbeddedButtontokens.tokens.spinnerSize, _Spinner.spinnerTokens.color, _EmbeddedButtontokens.tokens.spinnerColor);
const base = (0, _styledcomponents.css)([
    `position:relative;display:block;width:100%;height:100%;border-radius:var(`,
    `);box-sizing:border-box;appearance:none;border:none;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0);background:transparent;padding:0;a&{text-decoration:none;}:focus-visible{outline:none;}`,
    ``
], _EmbeddedButtontokens.tokens.borderRadius, (0, _mixins.addFocus)({
    outlineOffset: '0.125rem',
    outlineSize: '0.0625rem',
    outlineRadius: `var(${_EmbeddedButtontokens.tokens.borderRadius})`,
    outlineColor: `var(${_EmbeddedButtontokens.tokens.focusColor})`
}));
