<commit_before>import {
  AfterViewInit,
  ChangeDetectionStrategy,
  ChangeDetectorRef,
  Component,
  ElementRef,
  EventEmitter,
  forwardRef,
  Injector,
  Input,
  OnDestroy,
  OnInit,
  Optional,
  Output,
  TemplateRef,
  Type,
  ViewChild,
} from '@angular/core';

import {
  AbstractControl,
  ControlValueAccessor,
  FormControl,
  NgControl,
  NgModel,
  NG_VALIDATORS,
  ValidationErrors,
  Validator,
} from '@angular/forms';

import { SkyAppWindowRef } from '@skyux/core';

import { SkyThemeService } from '@skyux/theme';

import { SkyInputBoxHostService } from '@skyux/forms';

import 'intl-tel-input';

import { fromEvent, Subject } from 'rxjs';

import { takeUntil } from 'rxjs/operators';

import { SkyAutocompleteSelectionChange } from '../autocomplete/types/autocomplete-selection-change';

import { SkyAutocompleteInputDirective } from '../autocomplete/autocomplete-input.directive';

import { SkyCountryFieldCountry } from './types/country';

// tslint:disable:no-forward-ref no-use-before-declare
const SKY_COUNTRY_FIELD_VALIDATOR = {
  provide: NG_VALIDATORS,
  useExisting: forwardRef(() => SkyCountryFieldComponent),
  multi: true,
};

// tslint:enable
let uniqueId: number = 0;

@Component({
  selector: 'sky-country-field',
  templateUrl: './country-field.component.html',
  styleUrls: ['./country-field.component.scss'],
  providers: [SKY_COUNTRY_FIELD_VALIDATOR],
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class SkyCountryFieldComponent
  implements AfterViewInit, ControlValueAccessor, OnDestroy, OnInit, Validator
{
  /**
   * Specifies the value for the `autocomplete` attribute on the form input.
   * @default "off"
   */
  @Input()
  public autocompleteAttribute: string;

  /**
   * Specifies the [International Organization for Standardization Alpha 2](https://www.nationsonline.org/oneworld/country_code_list.htm)
   * country code for the default country.
   * When search results include the default country, it appears at the top of the list.
   * @default "us"
   */
  @Input()
  public set defaultCountry(value: string) {
    if (value !== this._defaultCountry) {
      this._defaultCountry = value.toLowerCase();

      this.defaultCountryData = this.countries.find(
        (country) => country.iso2 === this._defaultCountry
      );

      this.sortCountriesWithSelectedAndDefault(this.selectedCountry);
    }
  }

  public get defaultCountry(): string {
    return this._defaultCountry;
  }

  /**
   * Indicates whether to disable the country field.
   */
  @Input()
  public set disabled(isDisabled: boolean) {
    this.removeEventListeners();

    if (!isDisabled) {
      this.addEventListeners();
    }

    this._disabled = isDisabled;

    this.changeDetector.markForCheck();
  }

  public get disabled(): boolean {
    return this._disabled;
  }
<commit_msg>Add country field disabled default (#253)<commit_after>import {
  AfterViewInit,
  ChangeDetectionStrategy,
  ChangeDetectorRef,
  Component,
  ElementRef,
  EventEmitter,
  forwardRef,
  Injector,
  Input,
  OnDestroy,
  OnInit,
  Optional,
  Output,
  TemplateRef,
  Type,
  ViewChild,
} from '@angular/core';

import {
  AbstractControl,
  ControlValueAccessor,
  FormControl,
  NgControl,
  NgModel,
  NG_VALIDATORS,
  ValidationErrors,
  Validator,
} from '@angular/forms';

import { SkyAppWindowRef } from '@skyux/core';

import { SkyThemeService } from '@skyux/theme';

import { SkyInputBoxHostService } from '@skyux/forms';

import 'intl-tel-input';

import { fromEvent, Subject } from 'rxjs';

import { takeUntil } from 'rxjs/operators';

import { SkyAutocompleteSelectionChange } from '../autocomplete/types/autocomplete-selection-change';

import { SkyAutocompleteInputDirective } from '../autocomplete/autocomplete-input.directive';

import { SkyCountryFieldCountry } from './types/country';

// tslint:disable:no-forward-ref no-use-before-declare
const SKY_COUNTRY_FIELD_VALIDATOR = {
  provide: NG_VALIDATORS,
  useExisting: forwardRef(() => SkyCountryFieldComponent),
  multi: true,
};

// tslint:enable
let uniqueId: number = 0;

@Component({
  selector: 'sky-country-field',
  templateUrl: './country-field.component.html',
  styleUrls: ['./country-field.component.scss'],
  providers: [SKY_COUNTRY_FIELD_VALIDATOR],
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class SkyCountryFieldComponent
  implements AfterViewInit, ControlValueAccessor, OnDestroy, OnInit, Validator
{
  /**
   * Specifies the value for the `autocomplete` attribute on the form input.
   * @default "off"
   */
  @Input()
  public autocompleteAttribute: string;

  /**
   * Specifies the [International Organization for Standardization Alpha 2](https://www.nationsonline.org/oneworld/country_code_list.htm)
   * country code for the default country.
   * When search results include the default country, it appears at the top of the list.
   * @default "us"
   */
  @Input()
  public set defaultCountry(value: string) {
    if (value !== this._defaultCountry) {
      this._defaultCountry = value.toLowerCase();

      this.defaultCountryData = this.countries.find(
        (country) => country.iso2 === this._defaultCountry
      );

      this.sortCountriesWithSelectedAndDefault(this.selectedCountry);
    }
  }

  public get defaultCountry(): string {
    return this._defaultCountry;
  }

  /**
   * Indicates whether to disable the country field.
   * @default false
   */
  @Input()
  public set disabled(isDisabled: boolean) {
    this.removeEventListeners();

    if (!isDisabled) {
      this.addEventListeners();
    }

    this._disabled = isDisabled;

    this.changeDetector.markForCheck();
  }

  public get disabled(): boolean {
    return this._disabled;
  }

{'fraction_non_alphanumeric': 0.11358067903395169, 'fraction_numerical': 0.001575078753937697, 'mean_word_length': 4.057522123893805, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3638455', 'n_tokens_mistral': 1765, 'n_tokens_neox': 1726, 'n_words': 399}