'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-a1121663.js');
require('./BaseField-f50bb8f0.js');
require('./_commonjsHelpers-206db00d.js');
require('./kimlikApi-6a581864.js');
require('./data-transfer-field-025bce2f.js');
require('./filter-52876f3c.js');
const cookie = require('./cookie-8a49bf23.js');
const services = require('./services-895a8d1d.js');
const damgaApi = require('./damga-api-ea5e3386.js');

const devingenProductDamgaDomainTableListDnsRecordCss = ".sc-devingen-product-damga-domain-table-list-dns-record-h{display:block;padding:6px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}";

const damgaProxyIPs = {
  '18.192.241.137': 'eu-central-2.damga.devingen.io',
  '52.29.141.76': 'eu-central-1a.damga.devingen.io',
};
const DevingenProductDamgaDomainTableListDnsRecord = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
  }
  async componentWillLoad() {
    const jwt = new cookie.CookieStorage().getAll().jwt;
    const headers = {
      Authorization: jwt ? `Bearer ${new cookie.CookieStorage().getAll().jwt}` : undefined,
    };
    const dnsRecord = await new damgaApi.DamgaApi(`${services.prod.damga}/${services.prod.base}`, headers)
      .getDnsRecord(this.item.domain).catch(e => {
      console.log('Getting dns record failed', e);
    });
    if (!dnsRecord)
      return;
    this.dnsRecord = dnsRecord;
  }
  render() {
    var _a, _b;
    return (index.h(index.Host, null, damgaProxyIPs[(_a = this.dnsRecord) === null || _a === void 0 ? void 0 : _a.record] || ((_b = this.dnsRecord) === null || _b === void 0 ? void 0 : _b.record) || '-'));
  }
};
DevingenProductDamgaDomainTableListDnsRecord.style = devingenProductDamgaDomainTableListDnsRecordCss;

exports.devingen_product_damga_domain_table_list_dns_record = DevingenProductDamgaDomainTableListDnsRecord;
