(e: Types.SyntheticEvent) => {
        if (this._isHoverStarted && !this._isMouseOver) {
            this._isHoverStarted = false;

            if (this.props.onHoverEnd) {
                this.props.onHoverEnd(e);
            }
        }
    }


() => {
        if (!this._isMounted || !this._buttonElement) {
            return;
        }

        this._buttonElement.setNativeProps({
            style: [{
                backgroundColor: _underlayInactive
            }, this.props.style]
        });
    }


export interface ButtonContext {
    hasRxButtonAscendant?: boolean;
    focusArbitrator?: FocusArbitratorProvider;
}


protected _render(internalProps: RN.ViewProps, onMount: (btn: any) => void): JSX.Element {
        return (
            <RN.Animated.View { ...internalProps } ref={ onMount }>
                { this.props.children }
            </RN.Animated.View>
        );
    }


render() {
        // Accessibility props.
        const importantForAccessibility = AccessibilityUtil.importantForAccessibilityToString(this.props.importantForAccessibility,
            _defaultImportantForAccessibility);
        const accessibilityTrait = AccessibilityUtil.accessibilityTraitToString(this.props.accessibilityTraits,
             _defaultAccessibilityTrait, true);
        const accessibilityComponentType = AccessibilityUtil.accessibilityComponentTypeToString(this.props.accessibilityTraits,
            _defaultAccessibilityTrait);

        const opacityStyle = !this.props.disableTouchOpacityAnimation && this._opacityAnimatedStyle;
        let disabledStyle = this.props.disabled && _styles.disabled;

        if (this.props.disabled && this.props.disabledOpacity !== undefined) {
            disabledStyle = Styles.createButtonStyle({
                opacity: this.props.disabledOpacity
            }, false);
        }

        let extendedProps: RN.ExtendedViewProps = {
            onAccessibilityTapIOS: this.props.onAccessibilityTapIOS,
            onMouseEnter: this._onMouseEnter,
            onMouseLeave: this._onMouseLeave,
            tooltip: this.props.title,
            style: Styles.combine([_styles.defaultButton, this.props.style, opacityStyle,
                disabledStyle]) as RN.StyleProp<RN.ViewStyle>,
            accessibilityLabel: this.props.accessibilityLabel || this.props.title,
            accessibilityTraits: accessibilityTrait,
            accessibilityComponentType: accessibilityComponentType,
            importantForAccessibility: importantForAccessibility,
            onStartShouldSetResponder: this.touchableHandleStartShouldSetResponder,
            onResponderTerminationRequest: this.touchableHandleResponderTerminationRequest,
            onResponderGrant: this.touchableHandleResponderGrant,
            onResponderMove: this.touchableHandleResponderMove,
            onResponderRelease: this.touchableHandleResponderRelease,
            onResponderTerminate: this.touchableHandleResponderTerminate,
            shouldRasterizeIOS: this.props.shouldRasterizeIOS,
            testID: this.props.testId
        };

        return this._render(extendedProps, this._onMount);
    }


componentDidMount() {
        this._mixin_componentDidMount();
        this._isMounted = true;

        if (this.props.autoFocus) {
            this.requestFocus();
        }
    }


componentWillUnmount() {
        this._mixin_componentWillUnmount();
        this._isMounted = false;
    }


componentWillReceiveProps(nextProps: Types.ButtonProps) {
        if (!isEqual(this.props, nextProps)) {
            // If opacity got updated as a part of props update, we need to reflect that in the opacity animation value
           this._setOpacityStyles(nextProps, this.props);
        }
    }


getChildContext(): ButtonContext {
        return { hasRxButtonAscendant: true };
    }


setNativeProps(nativeProps: RN.ViewProps) {
        if (this._buttonElement) {
            this._buttonElement.setNativeProps(nativeProps);
        }
    }


requestFocus() {
        FocusArbitratorProvider.requestFocus(
            this,
            () => this.focus(),
            () => this._isMounted
        );
    }


blur() {
         // native mobile platforms doesn't have the notion of blur for buttons, so ignore.
    }


focus() {
        if (this._isMounted) {
            AccessibilityUtil.setAccessibilityFocus(this);
        }
    }


private _setOpacityStyles(props: Types.ButtonProps, prevProps?: Types.ButtonProps) {
        const opacityValueFromProps = this._getDefaultOpacityValue(props);
        if (this._defaultOpacityValue !== opacityValueFromProps || (prevProps && props.disabled !== prevProps.disabled)) {
            this._defaultOpacityValue = opacityValueFromProps;
            this._opacityAnimatedValue = new Animated.Value(this._defaultOpacityValue);
            this._opacityAnimatedStyle = Styles.createAnimatedViewStyle({
                opacity: this._opacityAnimatedValue
            });
        }
    }


private _isTouchFeedbackApplicable() {
        return this._isMounted && this._hasPressHandler() && this._buttonElement;
    }


private _opacityActive(duration: number) {
        this.setOpacityTo(this.props.activeOpacity || _defaultActiveOpacity, duration);
    }


private _opacityInactive(duration: number) {
        this.setOpacityTo(this._defaultOpacityValue!!!, duration);
    }


private _getDefaultOpacityValue(props: Types.ButtonProps): number {
        let flattenedStyles: { [key: string]: any }|undefined;
        if (props && props.style) {
            flattenedStyles = RN.StyleSheet.flatten(props.style as RN.StyleProp<RN.ViewProps>);
        }

        return flattenedStyles && (flattenedStyles as Types.ButtonStyle).opacity || 1;
    }


/**
    * Animate the touchable to a new opacity.
    */
setOpacityTo(value: number, duration: number) {
       Animated.timing(
            this._opacityAnimatedValue!!!,
            {
                toValue: value,
                duration: duration,
                easing: Animated.Easing.InOut()
            }
        ).start();
    }


private _hasPressHandler() {
        return !!(
            this.props.onPress ||
            this.props.onPressIn ||
            this.props.onPressOut ||
            this.props.onLongPress
        );
    }


private _showUnderlay() {
        if (!this._buttonElement) {
            return;
        }

        this._buttonElement.setNativeProps({
            style: {
                backgroundColor: this.props.underlayColor
            }
        });
    }


/**
   * Groups Migration API
   *
   * Groups Migration Api.
   *
   * @example
   * const google = require('googleapis');
   * const groupsmigration = google.groupsmigration('v1');
   *
   * @namespace groupsmigration
   * @type {Function}
   * @version v1
   * @variation v1
   * @param {object=} options Options for Groupsmigration
   */
export class Groupsmigration {
    _options: GlobalOptions;
    google: GoogleApis;
    root = this;

    archive: Resource$Archive;

    constructor(options: GlobalOptions, google: GoogleApis) {
      this._options = options || {};
      this.google = google;
      this.getRoot.bind(this);

      this.archive = new Resource$Archive(this);
    }

    getRoot() {
      return this.root;
    }
  }


export class Resource$Archive {
    root: Groupsmigration;
    constructor(root: Groupsmigration) {
      this.root = root;
      this.getRoot.bind(this);
    }

    getRoot() {
      return this.root;
    }

    /**
     * groupsmigration.archive.insert
     * @desc Inserts a new mail into the archive of the Google group.
     * @alias groupsmigration.archive.insert
     * @memberOf! ()
     *
     * @param {object} params Parameters for request
     * @param {string} params.groupId The group ID
     * @param {object} params.media Media object
     * @param {string} params.media.mimeType Media mime-type
     * @param {string|object} params.media.body Media body contents
     * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
     * @param {callback} callback The callback that handles the response.
     * @return {object} Request object
     */
    insert(params?: any, options?: MethodOptions): AxiosPromise<Schema$Groups>;
    insert(
        params?: any,
        options?: MethodOptions|BodyResponseCallback<Schema$Groups>,
        callback?: BodyResponseCallback<Schema$Groups>): void;
    insert(
        params?: any,
        options?: MethodOptions|BodyResponseCallback<Schema$Groups>,
        callback?: BodyResponseCallback<Schema$Groups>):
        void|AxiosPromise<Schema$Groups> {
      if (typeof options === 'function') {
        callback = options;
        options = {};
      }
      if (typeof params === 'function') {
        callback = params;
        params = {};
      }
      options = options || {};
      const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
      const parameters = {
        options: Object.assign(
            {
              url: (rootUrl + '/groups/v1/groups/{groupId}/archive')
                       .replace(/([^:]\/)\/+/g, '$1'),
              method: 'POST'
            },
            options),
        params,
        mediaUrl: (rootUrl + '/upload/groups/v1/groups/{groupId}/archive')
                      .replace(/([^:]\/)\/+/g, '$1'),
        requiredParams: ['groupId'],
        pathParams: ['groupId'],
        context: this.getRoot()
      };
      if (callback) {
        createAPIRequest<Schema$Groups>(parameters, callback);
      } else {
        return createAPIRequest<Schema$Groups>(parameters);
      }
    }
  }


/**
   * JSON response template for groups migration API.
   */
export interface Schema$Groups {
    /**
     * The kind of insert resource this is.
     */
    kind: string;
    /**
     * The status of the insert request.
     */
    responseCode: string;
  }


getRoot() {
      return this.root;
    }


/**
     * groupsmigration.archive.insert
     * @desc Inserts a new mail into the archive of the Google group.
     * @alias groupsmigration.archive.insert
     * @memberOf! ()
     *
     * @param {object} params Parameters for request
     * @param {string} params.groupId The group ID
     * @param {object} params.media Media object
     * @param {string} params.media.mimeType Media mime-type
     * @param {string|object} params.media.body Media body contents
     * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
     * @param {callback} callback The callback that handles the response.
     * @return {object} Request object
     */
insert(params?: any, options?: MethodOptions): AxiosPromise<Schema$Groups>;


insert(
        params?: any,
        options?: MethodOptions|BodyResponseCallback<Schema$Groups>,
        callback?: BodyResponseCallback<Schema$Groups>): void;


insert(
        params?: any,
        options?: MethodOptions|BodyResponseCallback<Schema$Groups>,
        callback?: BodyResponseCallback<Schema$Groups>):
        void|AxiosPromise<Schema$Groups> {
      if (typeof options === 'function') {
        callback = options;
        options = {};
      }
      if (typeof params === 'function') {
        callback = params;
        params = {};
      }
      options = options || {};
      const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
      const parameters = {
        options: Object.assign(
            {
              url: (rootUrl + '/groups/v1/groups/{groupId}/archive')
                       .replace(/([^:]\/)\/+/g, '$1'),
              method: 'POST'
            },
            options),
        params,
        mediaUrl: (rootUrl + '/upload/groups/v1/groups/{groupId}/archive')
                      .replace(/([^:]\/)\/+/g, '$1'),
        requiredParams: ['groupId'],
        pathParams: ['groupId'],
        context: this.getRoot()
      };
      if (callback) {
        createAPIRequest<Schema$Groups>(parameters, callback);
      } else {
        return createAPIRequest<Schema$Groups>(parameters);
      }
    }


export default class RunWithJsonOutput extends RunnerOptionsDecorator{
    constructor(builder: RunnerOptionsBuilder, private readonly commandOptions: string | undefined) {
        super(builder);
    }
    async build(): Promise<RunnerOptions> {
        const options = await this.builder.build();
        const jsonOutputOption = "-json";
        // is not defined already as an arg and not provided in command options input
        if((!options.args || (options.args && options.args.indexOf(jsonOutputOption) === -1)) && (!this.commandOptions || !this.commandOptions.includes(jsonOutputOption))){
            options.args.push(jsonOutputOption);
        }
        return options;
    }
}


interface RunnerOptionsBuilder {
        withJsonOutput(this: RunnerOptionsBuilder, commandOptions: string | undefined): RunnerOptionsBuilder;
    }


async build(): Promise<RunnerOptions> {
        const options = await this.builder.build();
        const jsonOutputOption = "-json";
        // is not defined already as an arg and not provided in command options input
        if((!options.args || (options.args && options.args.indexOf(jsonOutputOption) === -1)) && (!this.commandOptions || !this.commandOptions.includes(jsonOutputOption))){
            options.args.push(jsonOutputOption);
        }
        return options;
    }


data=> {
      if(data.result){
        this.isNoResult = false;
        this.apiResponse = data.data;
        console.log(data);
      }else{
        this.isNoResult = true;
      }
      this.isSearching = false;
      this.cd.markForCheck();
      }


@Component({
  selector: 'anms-search',
  templateUrl: './search.component.html',
  styleUrls: ['./search.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class SearchComponent implements OnInit {

  // @ViewChild('docSearchInput', { static: true }) movieSearchInput: ElementRef;
  apiResponse: any;
  isSearching: boolean;
  isNoResult: boolean;
  newSearch = '';

  routeAnimationsElements = ROUTE_ANIMATIONS_ELEMENTS;

  constructor(public recordService: PmisService, private cd: ChangeDetectorRef) {
    this.isSearching = false;
    this.isNoResult = false;
    this.apiResponse = [];
  }

  get isSearchDisabled() {
    return this.newSearch.length < 4;
  }

  onNewSearchChange(newSearch: string) {
    this.newSearch = newSearch;
  }

  onSearch(){
    this.isSearching = true;
    this.apiResponse  = [];
    this.recordService.searchDoc(this.newSearch).subscribe(data=> {
      if(data.result){
        this.isNoResult = false;
        this.apiResponse = data.data;
        console.log(data);
      }else{
        this.isNoResult = true;
      }
      this.isSearching = false;
      this.cd.markForCheck();
      })
  }

  ngOnInit() {}

}


onNewSearchChange(newSearch: string) {
    this.newSearch = newSearch;
  }


onSearch(){
    this.isSearching = true;
    this.apiResponse  = [];
    this.recordService.searchDoc(this.newSearch).subscribe(data=> {
      if(data.result){
        this.isNoResult = false;
        this.apiResponse = data.data;
        console.log(data);
      }else{
        this.isNoResult = true;
      }
      this.isSearching = false;
      this.cd.markForCheck();
      })
  }


export interface IUserRepository extends Repository<EduUserEntity> {
}


// Type predicate to assert that a 'T[]' is a 'NonEmptyArray<T>'
export function isNonEmpty<T>(arr: T[]): arr is NonEmptyArray<T> {
        return arr.length > 0;
    }


// creates a list of the desired length, filling it with values produced by the given function
export function generate<T>(length: number, func: (i: number) => T): T[] {
        const result: T[] = new Array(length);
        for (let i = 0; i < length; i++) {
            result[i] = func(i);
        }
        return result;
    }


// create a 1-dimensional array containing all of the elements from a 2-dimensional array
export function flatten<T>(arr: T[][]): T[] {
        return arr.reduce((acc, x) => acc.concat(x), []);
    }


export function isRectangle<T>(matrix: T[][]): boolean {
        return matrix.every(row => row.length === matrix[0].length);
    }


(acc, x) => acc.concat(x)


row => row.length === matrix[0].length


// enforces compile-tile check that an array have at least one element
export type NonEmptyArray<T> = [T, ...T[]];


/**
 * The set of arguments for constructing a AndroidMAMPolicyByName resource.
 */
export interface AndroidMAMPolicyByNameArgs {
    readonly accessRecheckOfflineTimeout?: pulumi.Input<string>;
    readonly accessRecheckOnlineTimeout?: pulumi.Input<string>;
    readonly appSharingFromLevel?: pulumi.Input<string>;
    readonly appSharingToLevel?: pulumi.Input<string>;
    readonly authentication?: pulumi.Input<string>;
    readonly clipboardSharingLevel?: pulumi.Input<string>;
    readonly dataBackup?: pulumi.Input<string>;
    readonly description?: pulumi.Input<string>;
    readonly deviceCompliance?: pulumi.Input<string>;
    readonly fileEncryption?: pulumi.Input<string>;
    readonly fileSharingSaveAs?: pulumi.Input<string>;
    readonly friendlyName: pulumi.Input<string>;
    /**
     * Location hostName for the tenant
     */
    readonly hostName: pulumi.Input<string>;
    /**
     * Resource Location
     */
    readonly location?: pulumi.Input<string>;
    readonly managedBrowser?: pulumi.Input<string>;
    readonly offlineWipeTimeout?: pulumi.Input<string>;
    readonly pin?: pulumi.Input<string>;
    readonly pinNumRetry?: pulumi.Input<number>;
    /**
     * Unique name for the policy
     */
    readonly policyName?: pulumi.Input<string>;
    readonly screenCapture?: pulumi.Input<string>;
    /**
     * Resource Tags
     */
    readonly tags?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
}


/**
     * Get an existing AndroidMAMPolicyByName resource's state with the given name, ID, and optional extra
     * properties used to qualify the lookup.
     *
     * @param name The _unique_ name of the resulting resource.
     * @param id The _unique_ provider ID of the resource to lookup.
     * @param opts Optional settings to control the behavior of the CustomResource.
     */
public static get(name: string, id: pulumi.Input<pulumi.ID>, opts?: pulumi.CustomResourceOptions): AndroidMAMPolicyByName {
        return new AndroidMAMPolicyByName(name, undefined as any, { ...opts, id: id });
    }


/**
     * Returns true if the given object is an instance of AndroidMAMPolicyByName.  This is designed to work even
     * when multiple copies of the Pulumi SDK have been loaded into the same process.
     */
public static isInstance(obj: any): obj is AndroidMAMPolicyByName {
        if (obj === undefined || obj === null) {
            return false;
        }
        return obj['__pulumiType'] === AndroidMAMPolicyByName.__pulumiType;
    }


(res: Array<Order>) => {
      this.orderData = res;
      this.loader.stop();
      this.isLoaded = true;
    }


(err: HttpErrorResponse) => {
      this.loader.stop();
    }


@Component({
  selector: 'orders',
  templateUrl: './orders.component.html'
})
export class OrdersComponent extends BaseComponent implements OnInit {

  public isLoaded: boolean = false;
  public orderData: Array<Order> = new Array<Order>();

  constructor(private injector: Injector,
              private ordersService: OrdersService) {
    super(injector);
  }

  async ngOnInit(): Promise<void> {
    await this.loadOrders();
  }

  public async loadOrders() {
    this.loader.start();
    await this.ordersService.getOrders().then((res: Array<Order>) => {
      this.orderData = res;
      this.loader.stop();
      this.isLoaded = true;
    }).catch((err: HttpErrorResponse) => {
      this.loader.stop();
    });
  }
}


async ngOnInit(): Promise<void> {
    await this.loadOrders();
  }


public async loadOrders() {
    this.loader.start();
    await this.ordersService.getOrders().then((res: Array<Order>) => {
      this.orderData = res;
      this.loader.stop();
      this.isLoaded = true;
    }).catch((err: HttpErrorResponse) => {
      this.loader.stop();
    });
  }


() => {
  return (
    <div className="main-container">
      <Dialogs/>
      <Messages/>
    </div>


@InputType()
export class DoctorInput {
  @Field()
  readonly name: string;

  @Field()
  readonly address: string;

  @Field()
  readonly hospital_id: number;
}


() => {
    it('Selection', () => {
      assert.deepStrictEqual(Select.Selection(Select.SelectText, Select.defaultSelectSettings), {
        strategy: { _tag: 'SelectText' },
        settings: { depth: O.none }
      })
    })

    it('SelectOne', () => {
      assert.deepStrictEqual(Select.SelectOne('a', RA.empty), {
        _tag: 'SelectOne',
        tag: 'a',
        predicates: RA.empty
      })
    })

    it('SelectAny', () => {
      assert.deepStrictEqual(Select.SelectAny(RA.empty), {
        _tag: 'SelectAny',
        predicates: RA.empty
      })
    })

    it('SelectText', () => {
      assert.deepStrictEqual(Select.SelectText, { _tag: 'SelectText' })
    })

    it('SelectSettings', () => {
      assert.deepStrictEqual(Select.SelectSettings(O.some(5)), {
        depth: O.some(5)
      })

      assert.deepStrictEqual(Select.defaultSelectSettings, { depth: O.none })
    })

    it('SelectContext', () => {
      assert.deepStrictEqual(Select.SelectContext(0, false), { position: 0, inChroot: false })
    })
  }


() => {
      assert.deepStrictEqual(Select.Selection(Select.SelectText, Select.defaultSelectSettings), {
        strategy: { _tag: 'SelectText' },
        settings: { depth: O.none }
      })
    }


() => {
      assert.deepStrictEqual(Select.SelectOne('a', RA.empty), {
        _tag: 'SelectOne',
        tag: 'a',
        predicates: RA.empty
      })
    }


() => {
      assert.deepStrictEqual(Select.SelectAny(RA.empty), {
        _tag: 'SelectAny',
        predicates: RA.empty
      })
    }


() => {
      assert.deepStrictEqual(Select.SelectText, { _tag: 'SelectText' })
    }


() => {
      assert.deepStrictEqual(Select.SelectSettings(O.some(5)), {
        depth: O.some(5)
      })

      assert.deepStrictEqual(Select.defaultSelectSettings, { depth: O.none })
    }


() => {
      assert.deepStrictEqual(Select.SelectContext(0, false), { position: 0, inChroot: false })
    }


() => {
    it('foldStrategy', () => {
      const fold = Select.foldStrategy({
        SelectOne: () => 'SelectOne',
        SelectAny: () => 'SelectAny',
        SelectText: () => 'SelectText'
      })

      assert.deepStrictEqual(fold(Select.SelectOne('a', RA.empty)), 'SelectOne')
      assert.deepStrictEqual(fold(Select.SelectAny(RA.empty)), 'SelectAny')
      assert.deepStrictEqual(fold(Select.SelectText), 'SelectText')
      assert.throws(() => {
        // @ts-expect-error valid SelectStrategy required
        fold({})
      })
    })
  }


() => {
      const fold = Select.foldStrategy({
        SelectOne: () => 'SelectOne',
        SelectAny: () => 'SelectAny',
        SelectText: () => 'SelectText'
      })

      assert.deepStrictEqual(fold(Select.SelectOne('a', RA.empty)), 'SelectOne')
      assert.deepStrictEqual(fold(Select.SelectAny(RA.empty)), 'SelectAny')
      assert.deepStrictEqual(fold(Select.SelectText), 'SelectText')
      assert.throws(() => {
        // @ts-expect-error valid SelectStrategy required
        fold({})
      })
    }


() => 'SelectOne'


() => 'SelectAny'


() => 'SelectText'


() => {
        // @ts-expect-error valid SelectStrategy required
        fold({})
      }


() => {
      it('should select the specified tag', () => {
        scrapeTest('1', E.right('1'), Scrape.text(Select.tag('a')))
      })

      it('should allow lowercase selectors to match any case tag', () => {
        scrapeTest('foobar', E.right(['foo', 'bar']), Scrape.texts(Select.tag('a')))
      })

      it('should allow uppercase selectors to match any case tag', () => {
        scrapeTest('foobar', E.right(['foo', 'bar']), Scrape.texts(Select.tag('A')))
      })
    }


() => {
        scrapeTest('1', E.right('1'), Scrape.text(Select.tag('a')))
      }


() => {
        scrapeTest('foobar', E.right(['foo', 'bar']), Scrape.texts(Select.tag('a')))
      }


() => {
        scrapeTest('foobar', E.right(['foo', 'bar']), Scrape.texts(Select.tag('A')))
      }


() => {
      it('should select any node', () => {
        scrapeTest('1', E.right('1'), Scrape.text(Select.any))
      })

      it('should match the root node', () => {
        scrapeTest('12<c>3</c>45', E.right('12345'), Scrape.text(Select.any))
      })

      it('should select text nodes', () => {
        scrapeTest(
          '1234<c>5</c>67',
          E.right(['1', '2', '3', '456', '7']),
          Scrape.texts(pipe(Select.any, Select.atDepth(0)))
        )
      })
    }


() => {
        scrapeTest('1', E.right('1'), Scrape.text(Select.any))
      }


() => {
        scrapeTest('12<c>3</c>45', E.right('12345'), Scrape.text(Select.any))
      }


() => {
        scrapeTest(
          '1234<c>5</c>67',
          E.right(['1', '2', '3', '456', '7']),
          Scrape.texts(pipe(Select.any, Select.atDepth(0)))
        )
      }


() => {
      it('should select a text node', () => {
        scrapeTest('1', E.right('1'), Scrape.text(Select.text))
      })

      it('should select each text node', () => {
        scrapeTest(
          '1234<c>5</c>67',
          E.right(['1', '2', '3', '4', '5', '6', '7']),
          Scrape.texts(Select.text)
        )
      })
    }


() => {
        scrapeTest('1', E.right('1'), Scrape.text(Select.text))
      }


() => {
        scrapeTest(
          '1234<c>5</c>67',
          E.right(['1', '2', '3', '4', '5', '6', '7']),
          Scrape.texts(Select.text)
        )
      }


() => {
      it('should obey attribute predicates', () => {
        scrapeTest(
          'foobar',
          E.right(['bar']),
          Scrape.htmls(Select.withAttributes('a', [Select.attribute('key', 'value')]))
        )
      })
    }


() => {
        scrapeTest(
          'foobar',
          E.right(['bar']),
          Scrape.htmls(Select.withAttributes('a', [Select.attribute('key', 'value')]))
        )
      }


() => {
      it('should match any tag with the corresponding attributes', () => {
        scrapeTest(
          'foobar',
          E.right(['foo', 'bar']),
          Scrape.htmls(Select.anyWithAttributes([Select.anyAttribute('value')]))
        )
      })

      it('should not match any tag that is missing the corresponding attributes', () => {
        scrapeTest(
          'foobar',
          E.right(['bar']),
          Scrape.htmls(Select.anyWithAttributes([Select.anyAttribute('value')]))
        )
      })
    }


() => {
        scrapeTest(
          'foobar',
          E.right(['foo', 'bar']),
          Scrape.htmls(Select.anyWithAttributes([Select.anyAttribute('value')]))
        )
      }


() => {
        scrapeTest(
          'foobar',
          E.right(['bar']),
          Scrape.htmls(Select.anyWithAttributes([Select.anyAttribute('value')]))
        )
      }


() => {
      it('should perform case-insensitive matching on attribute keys', () => {
        scrapeTest(
          'foo',
          E.right(['foo']),
          Scrape.texts(Select.withAttributes('A', [Select.attribute('b', 'C')]))
        )
      })

      it('should perform case-sensitive matching on attribute values', () => {
        scrapeTest(
          'foo',
          E.right([]),
          Scrape.texts(Select.withAttributes('A', [Select.attribute('b', 'c')]))
        )
      })

      it('should invert attribute value matching when combined with `notP`', () => {
        scrapeTest(
          'foobarbaz',
          E.right(['foo', 'baz']),
          Scrape.texts(Select.withAttributes('a', [Select.notP(Select.attribute('b', 'C'))]))
        )
      })
    }


() => {
        scrapeTest(
          'foo',
          E.right(['foo']),
          Scrape.texts(Select.withAttributes('A', [Select.attribute('b', 'C')]))
        )
      }


() => {
        scrapeTest(
          'foo',
          E.right([]),
          Scrape.texts(Select.withAttributes('A', [Select.attribute('b', 'c')]))
        )
      }


() => {
        scrapeTest(
          'foobarbaz',
          E.right(['foo', 'baz']),
          Scrape.texts(Select.withAttributes('a', [Select.notP(Select.attribute('b', 'C'))]))
        )
      }


() => {
      it('should match any attribute key', () => {
        scrapeTest(
          'foobar',
          E.right(['foo', 'bar']),
          Scrape.htmls(Select.withAttributes('a', [Select.anyAttribute('value')]))
        )
      })

      it('should not match any attribute value', () => {
        scrapeTest(
          'foobar',
          E.right(['bar']),
          Scrape.htmls(Select.withAttributes('a', [Select.anyAttribute('value')]))
        )
      })
    }


() => {
        scrapeTest(
          'foobar',
          E.right(['foo', 'bar']),
          Scrape.htmls(Select.withAttributes('a', [Select.anyAttribute('value')]))
        )
      }


() => {
        scrapeTest(
          'foobar',
          E.right(['bar']),
          Scrape.htmls(Select.withAttributes('a', [Select.anyAttribute('value')]))
        )
      }


() => {
      it('should match an attribute value using a regular expression', () => {
        scrapeTest(
          'foo',
          E.right(['foo']),
          Scrape.htmls(
            Select.withAttributes('a', [Select.attributeRegex('key', /va(foo|bar|lu)e/)])
          )
        )
      })
    }


() => {
        scrapeTest(
          'foo',
          E.right(['foo']),
          Scrape.htmls(
            Select.withAttributes('a', [Select.attributeRegex('key', /va(foo|bar|lu)e/)])
          )
        )
      }


() => {
      it('should match any attribute key', () => {
        scrapeTest(
          'foobar',
          E.right(['foo', 'bar']),
          Scrape.htmls(Select.withAttributes('a', [Select.anyAttributeRegex(/va(foo|bar|lu)e/)]))
        )
      })

      it('should not match any attribute value', () => {
        scrapeTest(
          'foobar',
          E.right(['bar']),
          Scrape.htmls(Select.withAttributes('a', [Select.anyAttributeRegex(/va(foo|bar|lu)e/)]))
        )
      })
    }


() => {
        scrapeTest(
          'foobar',
          E.right(['foo', 'bar']),
          Scrape.htmls(Select.withAttributes('a', [Select.anyAttributeRegex(/va(foo|bar|lu)e/)]))
        )
      }


() => {
        scrapeTest(
          'foobar',
          E.right(['bar']),
          Scrape.htmls(Select.withAttributes('a', [Select.anyAttributeRegex(/va(foo|bar|lu)e/)]))
        )
      }


() => {
      it('should select children at the specified depth', () => {
        scrapeTest(
          '1<c>2</c>',
          E.right(['2']),
          Scrape.texts(
            pipe(Select.tag('a'), Select.nested(pipe(Select.tag('b'), Select.atDepth(2))))
          )
        )

        scrapeTest(
          '1<c>2</c>',
          E.right(['2']),
          Scrape.texts(
            pipe(Select.tag('a'), Select.nested(pipe(Select.tag('b'))), Select.atDepth(2))
          )
        )
      })

      it('should have no effect when there is no selector specified', () => {
        scrapeTest(
          '1<c>2</c>',
          E.right(['12']),
          Scrape.texts(pipe(Select.tag('a'), Select.nested(pipe(RA.empty, Select.atDepth(2)))))
        )
      })

      it('should compose with attribute predicates', () => {
        scrapeTest(
          "1<c>2</c>",
          E.right(['2']),
          Scrape.texts(
            pipe(
              Select.tag('a'),
              Select.nested(
                pipe(Select.withAttributes('b', [Select.hasClass('foo')]), Select.atDepth(2))
              )
            )
          )
        )
      })

      it('should handle tags closed out of order (full context)', () => {
        // Depth should handle malformed HTML correctly. Below  and <c> are not
        // closed in the proper order, but since <d> is nested within both in the
        // context of , <d> is still at depth 3.
        scrapeTest(
          '<c><d>1</d></c>',
          E.right(['1']),
          Scrape.texts(
            pipe(Select.tag('a'), Select.nested(pipe(Select.tag('d'), Select.atDepth(3))))
          )
        )
      })

      it('should cull matches exceeding the specified depth', () => {
        scrapeTest(
          '<c>1</c><c></c>',
          E.right([]),
          pipe(
            Select.tag('a'),
            Select.nested(pipe(Select.tag('b'), Select.atDepth(2))),
            Select.nested(Select.tag('c')),
            Scrape.html,
            Serial.seekNext,
            Serial.repeat,
            Serial.inSerial
          )
        )
      })

      // TODO: determine a better method for handling malformed self-closing tags
      it('should handle tags closed out of order (partial context)', () => {
        // However, from the context of , <d> is only at depth 1 because there is
        // no closing <c> tag within the  tag so the <c> tag is assumed to be
        // self-closing.
        //   scrapeTest(
        //     '<c><d>2</d></c>',
        //     E.right(['2']),
        //     Scrape.texts(
        //       pipe(Select.tag('b'), Select.nested(pipe(Select.tag('d'), Select.atDepth(1))))
        //     )
        //   )
      })

      // TODO: determine a better method for handling malformed self-closing tags
      it('should treat out of focus closing tags as immediately closed', () => {
        // scrapeTest(
        //   '<c><d>2</d></c>',
        //   E.right(['2']),
        //   Scrape.texts(
        //     pipe(Select.tag('a'), Select.nested(pipe(Select.tag('d'), Select.atDepth(2))))
        //   )
        // )
      })
    }


() => {
        scrapeTest(
          '1<c>2</c>',
          E.right(['2']),
          Scrape.texts(
            pipe(Select.tag('a'), Select.nested(pipe(Select.tag('b'), Select.atDepth(2))))
          )
        )

        scrapeTest(
          '1<c>2</c>',
          E.right(['2']),
          Scrape.texts(
            pipe(Select.tag('a'), Select.nested(pipe(Select.tag('b'))), Select.atDepth(2))
          )
        )
      }


() => {
        scrapeTest(
          '1<c>2</c>',
          E.right(['12']),
          Scrape.texts(pipe(Select.tag('a'), Select.nested(pipe(RA.empty, Select.atDepth(2)))))
        )
      }


() => {
        scrapeTest(
          "1<c>2</c>",
          E.right(['2']),
          Scrape.texts(
            pipe(
              Select.tag('a'),
              Select.nested(
                pipe(Select.withAttributes('b', [Select.hasClass('foo')]), Select.atDepth(2))
              )
            )
          )
        )
      }


() => {
        // Depth should handle malformed HTML correctly. Below  and <c> are not
        // closed in the proper order, but since <d> is nested within both in the
        // context of , <d> is still at depth 3.
        scrapeTest(
          '<c><d>1</d></c>',
          E.right(['1']),
          Scrape.texts(
            pipe(Select.tag('a'), Select.nested(pipe(Select.tag('d'), Select.atDepth(3))))
          )
        )
      }


() => {
        scrapeTest(
          '<c>1</c><c></c>',
          E.right([]),
          pipe(
            Select.tag('a'),
            Select.nested(pipe(Select.tag('b'), Select.atDepth(2))),
            Select.nested(Select.tag('c')),
            Scrape.html,
            Serial.seekNext,
            Serial.repeat,
            Serial.inSerial
          )
        )
      }


() => {
        // However, from the context of , <d> is only at depth 1 because there is
        // no closing <c> tag within the  tag so the <c> tag is assumed to be
        // self-closing.
        //   scrapeTest(
        //     '<c><d>2</d></c>',
        //     E.right(['2']),
        //     Scrape.texts(
        //       pipe(Select.tag('b'), Select.nested(pipe(Select.tag('d'), Select.atDepth(1))))
        //     )
        //   )
      }


() => {
        // scrapeTest(
        //   '<c><d>2</d></c>',
        //   E.right(['2']),
        //   Scrape.texts(
        //     pipe(Select.tag('a'), Select.nested(pipe(Select.tag('d'), Select.atDepth(2))))
        //   )
        // )
      }


() => {
      it('should match the deepest node', () => {
        scrapeTest(
          '<c>foo</c>',
          E.right(['<c>foo</c>']),
          Scrape.htmls(
            pipe(Select.tag('a'), Select.nested(Select.tag('b')), Select.nested(Select.tag('c')))
          )
        )
      })

      it('should skip irrelevant nodes', () => {
        scrapeTest(
          '<c>foo</c><c><d>bar</d></c>baz',
          E.right(['foo', 'bar']),
          Scrape.htmls(pipe(Select.tag('a'), Select.nested(Select.tag('b'))))
        )
      })

      it('nested should force a descent before matching', () => {
        scrapeTest(
          '

inner text

',
          E.right(['inner']),
          Scrape.attrs('id', pipe(Select.tag('div'), Select.nested(Select.tag('div'))))
        )
      })

      it('should match div/div/div twice when selecting a div nested beneath a div', () => {
        scrapeTest(
          '

',
          E.right(['b', 'c']),
          Scrape.attrs('id', pipe(Select.tag('div'), Select.nested(Select.tag('div'))))
        )
      })

      it('should handle tags closed out of order', () => {
        scrapeTest(
          '<c><d>2</d></c>',
          E.right(['2']),
          Scrape.texts(pipe(Select.tag('b'), Select.nested(Select.tag('d'))))
        )
      })

      it('should handle tags closed out of order for the root (1)', () => {
        scrapeTest(
          '<c><d>2</d></c>',
          E.right(['2']),
          Scrape.texts(pipe(Select.tag('b'), Select.nested(Select.tag('d'))))
        )
      })

      it('should handle tags closed out of order for the root (2)', () => {
        scrapeTest(
          '<c><d>2</d></c>',
          E.right(['2']),
          Scrape.texts(pipe(Select.tag('c'), Select.nested(Select.tag('d'))))
        )
      })
    }


() => {
        scrapeTest(
          '<c>foo</c>',
          E.right(['<c>foo</c>']),
          Scrape.htmls(
            pipe(Select.tag('a'), Select.nested(Select.tag('b')), Select.nested(Select.tag('c')))
          )
        )
      }


() => {
        scrapeTest(
          '<c>foo</c><c><d>bar</d></c>baz',
          E.right(['foo', 'bar']),
          Scrape.htmls(pipe(Select.tag('a'), Select.nested(Select.tag('b'))))
        )
      }


() => {
        scrapeTest(
          '

inner text

',
          E.right(['inner']),
          Scrape.attrs('id', pipe(Select.tag('div'), Select.nested(Select.tag('div'))))
        )
      }


() => {
        scrapeTest(
          '

',
          E.right(['b', 'c']),
          Scrape.attrs('id', pipe(Select.tag('div'), Select.nested(Select.tag('div'))))
        )
      }


() => {
        scrapeTest(
          '<c><d>2</d></c>',
          E.right(['2']),
          Scrape.texts(pipe(Select.tag('b'), Select.nested(Select.tag('d'))))
        )
      }


() => {
        scrapeTest(
          '<b><c><d>2</d></b></c>',
          E.right(['2']),
          Scrape.texts(pipe(Select.tag('b'), Select.nested(Select.tag('d'))))
        )
      }


() => {
        scrapeTest(
          '<b><c><d>2</d></b></c>',
          E.right(['2']),
          Scrape.texts(pipe(Select.tag('c'), Select.nested(Select.tag('d'))))
        )
      }


() => {
      it('should match tags with multiple classes', () => {
        scrapeTest(
          'foo',
          E.right(['foo']),
          Scrape.htmls(Select.withAttributes('a', [Select.hasClass('a')]))
        )
      })

      it('should not match tags that do not contain the specified class', () => {
        scrapeTest(
          'foo',
          E.right([]),
          Scrape.htmls(Select.withAttributes('a', [Select.hasClass('c')]))
        )
      })
    }


() => {
        scrapeTest(
          'foo',
          E.right(['foo']),
          Scrape.htmls(Select.withAttributes('a', [Select.hasClass('a')]))
        )
      }


() => {
        scrapeTest(
          'foo',
          E.right([]),
          Scrape.htmls(Select.withAttributes('a', [Select.hasClass('c')]))
        )
      }


() => {
      it('should negate an attribute predicate', () => {
        scrapeTest(
          'foobarbaz',
          E.right(['foo', 'baz']),
          Scrape.texts(Select.withAttributes('a', [Select.notP(Select.hasClass('a'))]))
        )
      })
    }


() => {
        scrapeTest(
          'foobarbaz',
          E.right(['foo', 'baz']),
          Scrape.texts(Select.withAttributes('a', [Select.notP(Select.hasClass('a'))]))
        )
      }


() => {
      it('should allow for custom attribute predicates', () => {
        scrapeTest(
          '123',
          E.right(['2', '3']),
          Scrape.htmls(Select.anyWithAttributes([Select.match(Eq.eqString.equals)]))
        )
      })
    }


() => {
        scrapeTest(
          '123',
          E.right(['2', '3']),
          Scrape.htmls(Select.anyWithAttributes([Select.match(Eq.eqString.equals)]))
        )
      }


() => {
    describe('checkSettings', () => {
      it('should return MatchOk on empty current hierarchy', () => {
        const tags = T.parse('')
        const curr = TS.tagsToSpec(tags)
        const root = TS.tagsToSpec(tags)

        assert.strictEqual(
          Select.checkSettings(Select.SelectSettings(O.some(1)), curr, root),
          MR.MatchOk
        )
      })
    })

    describe('liftSiblings', () => {
      it('should return an empty array if no valid siblings are found within the parent node', () => {
        const tagForest: TagForest = [Tree.make(TF.TagSpan(4, 10), [])]
        assert.deepStrictEqual(Select.liftSiblings([])(3, 9)(tagForest), RA.empty)
      })

      it('should lift valid siblings out of the span of the current parent node', () => {
        const tagForest: TagForest = [Tree.make(TF.TagSpan(5, 6), [])]

        assert.deepStrictEqual(Select.liftSiblings([])(3, 9)(tagForest), [
          Tree.make(TF.TagSpan(5, 6))
        ])
      })

      it('should lift valid siblings out of child subforests within the current parent node', () => {
        const tagForest: TagForest = [
          Tree.make(TF.TagSpan(4, 10), [Tree.make(TF.TagSpan(5, 6)), Tree.make(TF.TagSpan(7, 8))])
        ]

        assert.deepStrictEqual(Select.liftSiblings([])(3, 9)(tagForest), [
          Tree.make(TF.TagSpan(5, 6)),
          Tree.make(TF.TagSpan(7, 8))
        ])
      })
    })
  }


() => {
      it('should return MatchOk on empty current hierarchy', () => {
        const tags = T.parse('')
        const curr = TS.tagsToSpec(tags)
        const root = TS.tagsToSpec(tags)

        assert.strictEqual(
          Select.checkSettings(Select.SelectSettings(O.some(1)), curr, root),
          MR.MatchOk
        )
      })
    }


() => {
        const tags = T.parse('')
        const curr = TS.tagsToSpec(tags)
        const root = TS.tagsToSpec(tags)

        assert.strictEqual(
          Select.checkSettings(Select.SelectSettings(O.some(1)), curr, root),
          MR.MatchOk
        )
      }


() => {
      it('should return an empty array if no valid siblings are found within the parent node', () => {
        const tagForest: TagForest = [Tree.make(TF.TagSpan(4, 10), [])]
        assert.deepStrictEqual(Select.liftSiblings([])(3, 9)(tagForest), RA.empty)
      })

      it('should lift valid siblings out of the span of the current parent node', () => {
        const tagForest: TagForest = [Tree.make(TF.TagSpan(5, 6), [])]

        assert.deepStrictEqual(Select.liftSiblings([])(3, 9)(tagForest), [
          Tree.make(TF.TagSpan(5, 6))
        ])
      })

      it('should lift valid siblings out of child subforests within the current parent node', () => {
        const tagForest: TagForest = [
          Tree.make(TF.TagSpan(4, 10), [Tree.make(TF.TagSpan(5, 6)), Tree.make(TF.TagSpan(7, 8))])
        ]

        assert.deepStrictEqual(Select.liftSiblings([])(3, 9)(tagForest), [
          Tree.make(TF.TagSpan(5, 6)),
          Tree.make(TF.TagSpan(7, 8))
        ])
      })
    }


() => {
        const tagForest: TagForest = [Tree.make(TF.TagSpan(4, 10), [])]
        assert.deepStrictEqual(Select.liftSiblings([])(3, 9)(tagForest), RA.empty)
      }


() => {
        const tagForest: TagForest = [Tree.make(TF.TagSpan(5, 6), [])]

        assert.deepStrictEqual(Select.liftSiblings([])(3, 9)(tagForest), [
          Tree.make(TF.TagSpan(5, 6))
        ])
      }


() => {
        const tagForest: TagForest = [
          Tree.make(TF.TagSpan(4, 10), [Tree.make(TF.TagSpan(5, 6)), Tree.make(TF.TagSpan(7, 8))])
        ]

        assert.deepStrictEqual(Select.liftSiblings([])(3, 9)(tagForest), [
          Tree.make(TF.TagSpan(5, 6)),
          Tree.make(TF.TagSpan(7, 8))
        ])
      }


() => {
    it('should traverse selectors in a depth first manner (1)', () => {
      scrapeTest(
        '

p1

p2

p3

p4
',
        E.right(['p1', 'p2', 'p3', 'p4']),
        Scrape.texts(Select.tag('p'))
      )
    })

    it('should traverse selectors in a depth first manner (2)', () => {
      scrapeTest(
        '123',
        E.right(['1', '2', '3']),
        Scrape.texts(Select.tag('a'))
      )
    })

    it('should traverse selectors in a depth first manner (3)', () => {
      scrapeTest(
        '123',
        E.right(['1', '2', '3']),
        Scrape.texts(pipe(Select.tag('a'), Select.nested(Select.tag('b'))))
      )
    })

    it('should traverse selectors in a depth first manner (4)', () => {
      scrapeTest(
        '123',
        E.right(['1', '2', '3']),
        Scrape.texts(Select.tag('b'))
      )
    })
  }


() => {
      scrapeTest(
        '

p1

p2

p3

p4
',
        E.right(['p1', 'p2', 'p3', 'p4']),
        Scrape.texts(Select.tag('p'))
      )
    }


() => {
      scrapeTest(
        '123',
        E.right(['1', '2', '3']),
        Scrape.texts(Select.tag('a'))
      )
    }


() => {
      scrapeTest(
        '123',
        E.right(['1', '2', '3']),
        Scrape.texts(pipe(Select.tag('a'), Select.nested(Select.tag('b'))))
      )
    }


() => {
      scrapeTest(
        '123',
        E.right(['1', '2', '3']),
        Scrape.texts(Select.tag('b'))
      )
    }


@NgModule({
	imports: [
		CommonModule,
		ThemeModule,
		FormWizardModule,
		Ng2SmartTableModule,
		TranslateModule.forChild(),
		NbSpinnerModule,
	],
	declarations: [WarehouseMainInfoViewComponent],
	exports: [WarehouseMainInfoViewComponent],
})
export class WarehouseMainInfoViewModule {}


variables => predefinedProps => ({
  variables: mergeComponentVariables(variables, predefinedProps.variables),
})


predefinedProps => ({
  variables: mergeComponentVariables(variables, predefinedProps.variables),
})


(row: TableRowProps, index: number) => {
      const props = {
        compact,
        onClick: (e, props) => {
          _.invoke(row, 'onClick', e, props)
        },
      } as TableRowProps
      const overrideProps = handleVariablesOverrides(variables)
      return TableRow.create(row, {
        defaultProps: () => ({
          ...props,
          accessibility: accessibility.childBehaviors
            ? accessibility.childBehaviors.row
            : undefined,
        }),
        overrideProps,
      })
    }


(e, props) => {
          _.invoke(row, 'onClick', e, props)
        }


() => ({
          ...props,
          accessibility: accessibility.childBehaviors
            ? accessibility.childBehaviors.row
            : undefined,
        })


() => ({
        ...headerRowProps,
        accessibility: accessibility.childBehaviors ? accessibility.childBehaviors.row : undefined,
      })


class Table extends UIComponent<WithAsProp<TableProps>> {
  static displayName = 'Table'
  static className = 'ui-table'

  static Cell = TableCell
  static Row = TableRow

  static slotClassNames: TableSlotClassNames = {
    header: `${Table.className}__header`,
  }

  static propTypes = {
    ...commonPropTypes.createCommon({
      content: false,
    }),
    content: customPropTypes.every([
      customPropTypes.disallow(['children']),
      PropTypes.oneOfType([
        PropTypes.arrayOf(customPropTypes.nodeContent),
        customPropTypes.nodeContent,
      ]),
    ]),
    header: customPropTypes.itemShorthand,
    rows: customPropTypes.collectionShorthand,
    compact: PropTypes.bool,
  }

  static defaultProps = {
    as: 'div',
    accessibility: tableBehavior as Accessibility,
  }

  renderRows(accessibility: ReactAccessibilityBehavior, variables: ComponentVariablesObject) {
    const { rows, compact } = this.props

    return _.map(rows, (row: TableRowProps, index: number) => {
      const props = {
        compact,
        onClick: (e, props) => {
          _.invoke(row, 'onClick', e, props)
        },
      } as TableRowProps
      const overrideProps = handleVariablesOverrides(variables)
      return TableRow.create(row, {
        defaultProps: () => ({
          ...props,
          accessibility: accessibility.childBehaviors
            ? accessibility.childBehaviors.row
            : undefined,
        }),
        overrideProps,
      })
    })
  }

  renderHeader(accessibility: ReactAccessibilityBehavior, variables: ComponentVariablesObject) {
    const { header, compact } = this.props
    if (!header) {
      return null
    }

    const headerRowProps = {
      header: true,
      compact,
      className: Table.slotClassNames.header,
    } as TableRowProps

    const overrideProps = handleVariablesOverrides(variables)

    return TableRow.create(header, {
      defaultProps: () => ({
        ...headerRowProps,
        accessibility: accessibility.childBehaviors ? accessibility.childBehaviors.row : undefined,
      }),
      overrideProps,
    })
  }

  renderComponent({
    accessibility,
    ElementType,
    classes,
    variables,
    unhandledProps,
  }: RenderResultConfig<any>): React.ReactNode {
    const { children } = this.props
    const hasChildren = childrenExist(children)

    return (
      <ElementType
        className={classes.root}
        {...accessibility.attributes.root}
        {...unhandledProps}
        {...applyAccessibilityKeyHandlers(accessibility.keyHandlers.root, unhandledProps)}
      >
        {hasChildren && children}


export interface TableSlotClassNames {
  header: string
}


export interface TableProps extends UIComponentProps, ChildrenComponentProps {
  /**
   * Accessibility behavior if overridden by the user.
   * */
  accessibility?: Accessibility

  /** The columns of the Table with a space-separated list of values.
   */
  header?: ShorthandValue<TableRowProps>

  /** The rows of the Table with a space-separated list of values.
   */
  rows?: ShorthandCollection<TableRowProps>

  /**
   * Render table in compact mode
   */
  compact?: boolean
}


renderRows(accessibility: ReactAccessibilityBehavior, variables: ComponentVariablesObject) {
    const { rows, compact } = this.props

    return _.map(rows, (row: TableRowProps, index: number) => {
      const props = {
        compact,
        onClick: (e, props) => {
          _.invoke(row, 'onClick', e, props)
        },
      } as TableRowProps
      const overrideProps = handleVariablesOverrides(variables)
      return TableRow.create(row, {
        defaultProps: () => ({
          ...props,
          accessibility: accessibility.childBehaviors
            ? accessibility.childBehaviors.row
            : undefined,
        }),
        overrideProps,
      })
    })
  }


renderHeader(accessibility: ReactAccessibilityBehavior, variables: ComponentVariablesObject) {
    const { header, compact } = this.props
    if (!header) {
      return null
    }

    const headerRowProps = {
      header: true,
      compact,
      className: Table.slotClassNames.header,
    } as TableRowProps

    const overrideProps = handleVariablesOverrides(variables)

    return TableRow.create(header, {
      defaultProps: () => ({
        ...headerRowProps,
        accessibility: accessibility.childBehaviors ? accessibility.childBehaviors.row : undefined,
      }),
      overrideProps,
    })
  }


renderComponent({
    accessibility,
    ElementType,
    classes,
    variables,
    unhandledProps,
  }: RenderResultConfig<any>): React.ReactNode {
    const { children } = this.props
    const hasChildren = childrenExist(children)

    return (
      <ElementType
        className={classes.root}
        {...accessibility.attributes.root}
        {...unhandledProps}
        {...applyAccessibilityKeyHandlers(accessibility.keyHandlers.root, unhandledProps)}
      >
        {hasChildren && children}


c => c !== this


() => {
            if (this.service.isOpen) {
                this._element.nativeElement.focus();
            }
        }


() => this.childrenUpdated()


c => c.service


s => this.service.registerChild(s)


@Directive({
    selector: "[suiDropdown]"
})
export class SuiDropdown implements AfterContentInit {
    public service:DropdownService;

    @ContentChild(SuiDropdownMenu)
    private _menu:SuiDropdownMenu;

    @ContentChildren(SuiDropdown, { descendants: true })
    private _children:QueryList<SuiDropdown>;

    public get children():SuiDropdown[] {
        // @ContentChildren includes the current element by default.
        return this._children.filter(c => c !== this);
    }

    @Output()
    public get isOpenChange():EventEmitter<boolean> {
        return this.service.isOpenChange;
    }

    @HostBinding("class.active")
    public get isActive():boolean {
        // This is to ensure nested dropdowns don't get made bold.
        return this.service.isOpen && !this.service.isNested;
    }

    @Input()
    public get isOpen():boolean {
        return this.service.isOpen;
    }

    public set isOpen(value:boolean) {
        // If we are opening the dropdown, we want to always open its parents.
        this.service.setOpenState(value, !!value);
    }

    @HostBinding("class.disabled")
    @Input()
    public get isDisabled():boolean {
        return this.service.isDisabled;
    }

    public set isDisabled(value:boolean) {
        this.service.setDisabledState(value);
    }

    @Input("tabindex")
    private _tabIndex?:number;

    @HostBinding("attr.tabindex")
    public get tabIndex():number | undefined {
        if (this.isDisabled || this.service.isNested) {
            // If disabled, remove from tabindex.
            return undefined;
        }
        if (this._tabIndex != undefined) {
            // If custom tabindex, default to that.
            return this._tabIndex;
        }
        // Otherwise, return default of 0.
        return 0;
    }

    @Input()
    public get autoClose():DropdownAutoCloseType {
        return this.service.autoCloseMode;
    }

    public set autoClose(value:DropdownAutoCloseType) {
        this.service.autoCloseMode = value;
    }

    constructor(private _element:ElementRef) {
        this.service = new DropdownService();
        this.service.isOpenChange.subscribe(() => {
            if (this.service.isOpen) {
                this._element.nativeElement.focus();
            }
        });
    }

    public ngAfterContentInit():void {
        if (!this._menu) {
            throw new Error("You must set [suiDropdownMenu] on the menu element.");
        }
        this._menu.service = this.service;

        this.childrenUpdated();
        this._children.changes
            .subscribe(() => this.childrenUpdated());
    }

    private childrenUpdated():void {
        // Reregister child dropdowns each time the menu content changes.
        this.children
            .map(c => c.service)
            .forEach(s => this.service.registerChild(s));
    }

    @HostListener("click", ["$event"])
    public onClick(e:HandledEvent):void {
        if (!e.eventHandled) {
            e.eventHandled = true;

            this.service.toggleOpenState();
        }
    }

    @HostListener("focusout", ["$event"])
    private onFocusOut(e:IFocusEvent):void {
        if (!this._element.nativeElement.contains(e.relatedTarget)) {
            this.externallyClose();
        }
    }

    @HostListener("keypress", ["$event"])
    public onKeypress(e:HandledEvent & KeyboardEvent):void {
        // Block the keyboard event from being fired on parent dropdowns.
        if (!e.eventHandled) {

            if (e.keyCode === KeyCode.Enter) {
                e.eventHandled = true;

                this.service.setOpenState(true);
            }
        }
    }

    private externallyClose():void {
        if (this.service.autoCloseMode === DropdownAutoCloseType.ItemClick ||
                this.service.autoCloseMode === DropdownAutoCloseType.OutsideClick) {
                // No need to reflect in parent since they are also bound to document.
            this.service.setOpenState(false);
        }
    }
}


public ngAfterContentInit():void {
        if (!this._menu) {
            throw new Error("You must set [suiDropdownMenu] on the menu element.");
        }
        this._menu.service = this.service;

        this.childrenUpdated();
        this._children.changes
            .subscribe(() => this.childrenUpdated());
    }


private childrenUpdated():void {
        // Reregister child dropdowns each time the menu content changes.
        this.children
            .map(c => c.service)
            .forEach(s => this.service.registerChild(s));
    }


@HostListener("click", ["$event"])
    public onClick(e:HandledEvent):void {
        if (!e.eventHandled) {
            e.eventHandled = true;

            this.service.toggleOpenState();
        }
    }


@HostListener("focusout", ["$event"])
    private onFocusOut(e:IFocusEvent):void {
        if (!this._element.nativeElement.contains(e.relatedTarget)) {
            this.externallyClose();
        }
    }


@HostListener("keypress", ["$event"])
    public onKeypress(e:HandledEvent & KeyboardEvent):void {
        // Block the keyboard event from being fired on parent dropdowns.
        if (!e.eventHandled) {

            if (e.keyCode === KeyCode.Enter) {
                e.eventHandled = true;

                this.service.setOpenState(true);
            }
        }
    }


private externallyClose():void {
        if (this.service.autoCloseMode === DropdownAutoCloseType.ItemClick ||
                this.service.autoCloseMode === DropdownAutoCloseType.OutsideClick) {
                // No need to reflect in parent since they are also bound to document.
            this.service.setOpenState(false);
        }
    }


@Component({
  selector: 'app-model-result',
  templateUrl: './model-result.component.html',
  styleUrls: ['./model-result.component.css'],
})
export class ModelResultComponent {
  @Input() name: string;
  @Input() model: ResultModelModel;
}


@customElement('app-card')
export class CardComponent extends LitElement {
  @property() details: Details;

  static styles = css`${unsafeCSS(cardCss)}`;

  protected render():TemplateResult {
    const { details } = this;

    return html`

${details.headingText}

${unsafeHTML(details.bodyText || '')}

${details.headingText}

    `;
  }
}


protected render():TemplateResult {
    const { details } = this;

    return html`

${details.headingText}

${unsafeHTML(details.bodyText || '')}

${details.headingText}

    `;
  }


// Deep object merge taken from this post:
// URL: https://stackoverflow.com/questions/27936772/how-to-deep-merge-instead-of-shallow-merge
function isObject(item) {
    return (item && typeof item === 'object' && !Array.isArray(item));
}


function mergeDeep(target, ...sources) {
    if (!sources.length) return target;
    const source = sources.shift();

    if (isObject(target) && isObject(source)) {
      for (const key in source) {
        if (isObject(source[key])) {
          if (!target[key]) Object.assign(target, { [key]: {} });
          mergeDeep(target[key], source[key]);
        } else {
          Object.assign(target, { [key]: source[key] });
        }
      }
    }

    return mergeDeep(target, ...sources);
}


function prepareReplaceString(replaceString: string) {
    let pluginPath = __dirname;
    pluginPath = JSON.stringify(pluginPath);
    pluginPath = pluginPath.substring(1, pluginPath.length - 1);
    replaceString = replaceString.replace("[plugin_path]", pluginPath);
    return replaceString;
}


function applyPatches(patches: any[], content: string) {
    for(let patch of patches) {
        let replace = prepareReplaceString(patch.replace);
        if(patch.isFindRegExp) {
            let findRegExp = new RegExp(patch.find, path.findRegExpFlags);
            content = content.replace(findRegExp, replace);
        } else {
            content = content.replace(patch.find, replace);
        }
    }
    return content;
}


function shouldBeRuleApplied(testPattern: string, filename: string) {
    let testRegExp = new RegExp(testPattern);
    return testRegExp.test(filename)
}


function transformContentForRule(rule: any, filename: string, content: string) {
    if(shouldBeRuleApplied(rule.test, filename)) {
        return applyPatches(rule.patches, content);
    } else {
        return content;
    }
}


function transformContent(options: any, filename: string, content: string) {
    for(let ruleName in options) {
        content = transformContentForRule(options[ruleName], filename, content);
    }
    return content;
}


function loadDefaultOptions() {
    const modulePath = path.dirname(require.resolve(loaderPackageName));
    const filePath = path.join(modulePath, defaultOptionFile);
    if(fs.existsSync(filePath) == false) {
        console.log("Warning: default options file was not found.");
        return {};
    }
    let options = fs.readFileSync(filePath).toString();
    options = JSON.parse(options);
    validate({name: "ElectronNativePatchLoader", schema: patchConfigSchema, target: options});
    return options;
}


function loadOptionsFromFile(filePath: string) {
    if(fs.existsSync(filePath) == false) {
        console.log(`File "${filePath}" containing options was not found.`);
        return {};
    }
    let options = fs.readFileSync(filePath).toString();
    return JSON.parse(options);
}


function loadOptionsFromFiles(files: string[]) {
    // To prevent loading options from files again and again
    if(optionsLoadedFlag)
        return;
    // load and merge options
    for(let file of files) {
        let options = loadOptionsFromFile(file);
        let targetOptions = {};
        mergeDeep(targetOptions, optionsFromFiles, options);
        optionsFromFiles = targetOptions;
    }
    // set the loaded flag
    optionsLoadedFlag = true;
}


export default function(source) {
    // get options and set defaults
    let options = getOptions(this);
    options = options || {};
    options.files = options.files || [];
    options.custom = options.custom || {};
    validate({name: "ElectronNativePatchLoader", schema: optionsSchema, target: options});

    // load options from file
    loadOptionsFromFiles(options.files);

    // merge patch options from various sources
    let patchOptions = {};
    mergeDeep(patchOptions, defaultOptions, optionsFromFiles, options.custom);
    validate({name: "ElectronNativePatchLoader", schema: patchConfigSchema, target: patchOptions});

    let target = transformContent(patchOptions, this.resourcePath, source)
    return target;
}


() => {
  it("renders", async () => {
    const page = await newSpecPage({
      components: [BerserkerComponent],
      html: `<ms-berserker></ms-berserker>`,
      includeAnnotations: true,
    });

    expect(page.root).toHaveClass("hydrated");
  });
}


async () => {
    const page = await newSpecPage({
      components: [BerserkerComponent],
      html: `<ms-berserker></ms-berserker>`,
      includeAnnotations: true,
    });

    expect(page.root).toHaveClass("hydrated");
  }


() => {
  test('Working', () => {
    const $ = { find: ((selector: string) => ({ attr: (attr: string) => '/index.php?page=post&s=view&id=3548989' })) } as Cheerio;
    expect(getID($)).toBe(3548989);
  });
}


() => {
    const $ = { find: ((selector: string) => ({ attr: (attr: string) => '/index.php?page=post&s=view&id=3548989' })) } as Cheerio;
    expect(getID($)).toBe(3548989);
  }


(selector: string) => ({ attr: (attr: string) => '/index.php?page=post&s=view&id=3548989' })


(attr: string) => '/index.php?page=post&s=view&id=3548989'


export default class Input__SvelteComponent_ extends __sveltets_1_createSvelte2TsxComponent(__sveltets_1_partial(__sveltets_1_with_any_event(render()))) {
}


export interface MANOprovider {
  apiEndpoint?: string;
  authorizationBasicHeader?: string;
  description?: string;
  enabledForONBOARDING?: boolean;
  id?: number;
  name?: string;
  password?: string;
  supportedMANOplatform?: MANOplatform;
  username?: string;
}


@EventSubscriber()
export class DetailSubscriber implements EntitySubscriberInterface<Details> {
    listenTo() {
        return Details;
    }

    async afterInsert(event: InsertEvent<Details>) {
        const { quantity, product } = event.entity;
        const newStock = product.stock - quantity;
        await getRepository(Product)
            .createQueryBuilder()
            .update(Product)
            .set({ stock:  newStock})
            .where('id = :id', { id: product.id })
            .execute();
    }

    async beforeRemove(event: RemoveEvent<Details>) {
        const { product, quantity } = event.entity;
        const updatedStock = product.stock + quantity;
        await getRepository(Product)
            .createQueryBuilder('product')
            .update(Product)
            .set({ stock:  updatedStock})
            .where('product.id = :id', { id: product.id })
            .execute();
    }
}


listenTo() {
        return Details;
    }


async afterInsert(event: InsertEvent<Details>) {
        const { quantity, product } = event.entity;
        const newStock = product.stock - quantity;
        await getRepository(Product)
            .createQueryBuilder()
            .update(Product)
            .set({ stock:  newStock})
            .where('id = :id', { id: product.id })
            .execute();
    }


async beforeRemove(event: RemoveEvent<Details>) {
        const { product, quantity } = event.entity;
        const updatedStock = product.stock + quantity;
        await getRepository(Product)
            .createQueryBuilder('product')
            .update(Product)
            .set({ stock:  updatedStock})
            .where('product.id = :id', { id: product.id })
            .execute();
    }


export interface SofarValue {
  timestamp: string;
  value: number;
}


export interface SofarDailyData {
  reef: { id: number };
  date: Date;
  dailyAlertLevel?: number;
  weeklyAlertLevel?: number;
  minBottomTemperature?: number;
  maxBottomTemperature?: number;
  avgBottomTemperature?: number;
  surfaceTemperature?: number;
  satelliteTemperature?: number;
  degreeHeatingDays?: number;
  minWaveHeight?: number;
  maxWaveHeight?: number;
  avgWaveHeight?: number;
  waveDirection?: number;
  wavePeriod?: number;
  minWindSpeed?: number;
  maxWindSpeed?: number;
  avgWindSpeed?: number;
  windDirection?: number;
}


export interface SofarLiveData {
  reef: { id: number };
  dailyAlertLevel?: number;
  weeklyAlertLevel?: number;
  bottomTemperature?: SofarValue;
  surfaceTemperature?: SofarValue;
  satelliteTemperature?: SofarValue;
  degreeHeatingDays?: SofarValue;
  waveHeight?: SofarValue;
  waveDirection?: SofarValue;
  wavePeriod?: SofarValue;
  windSpeed?: SofarValue;
  windDirection?: SofarValue;
  spotterPosition?: {
    latitude: SofarValue;
    longitude: SofarValue;
  };
}


export interface SpotterData {
  surfaceTemperature: SofarValue[];
  bottomTemperature: SofarValue[];
  significantWaveHeight: SofarValue[];
  wavePeakPeriod: SofarValue[];
  waveMeanDirection: SofarValue[];
  latitude?: SofarValue[];
  longitude?: SofarValue[];
}


({ match }) => (
    <Layout>
        <Layout.Content style={


({ path, component }) => component && <Route path


export default function ExpandedIcon(
  props: Props
): React.ReactElement<React.ComponentProps<any>, any> {
  return (
    <Icon {...props}>
      <path d="M8.23823905,10.6097108 L11.207376,14.4695888 C11.54411,14.907343 12.1719566,14.989236 12.6097108,14.652502 C12.6783439,14.5997073 12.7398293,14.538222 12.792624,14.4695888 L15.761761,10.6097108 C16.0984949,10.1719566 16.0166019,9.54410997 15.5788477,9.20737601 C15.4040391,9.07290785 15.1896811,9 14.969137,9 L9.03086304,9 C8.47857829,9 8.03086304,9.44771525 8.03086304,10 C8.03086304,10.2205442 8.10377089,10.4349022 8.23823905,10.6097108 Z" />
    </Icon>
  );
}


@Module({
  imports: [TypeOrmModule.forFeature([SurveyDiscRepository])],
  controllers: [SurveyDiscController],
  providers: [SurveyDiscService],
})
export class SurveyDiscModule {}


(req, file, cb) => {
      cb(null, path.join(__dirname, '../../uploads'));
    }


(req, file, cb) => {
      let fileExt = path.extname(file.originalname);
      cb(null, 'user-' + Date.now() + fileExt);
    }


@UseGuards(AuthGuard('jwt'))
@Controller('users')
export class UserController {
  constructor(private userService: UserService) {}

  @Post()
  @UseInterceptors(FileInterceptor('profileImage', storage))
  async createUser(
    @UploadedFile() file: Express.Multer.File,
    @Body() payload: UserDto,
    @GetUser() currentUser: User,
  ) {
    const payLoadWithProfileImage = { ...payload, profileImage: file.filename };
    return await this.userService.create(payLoadWithProfileImage, currentUser);
  }

  @Get('/:id')
  async getUser(@Param('id') id) {
    return await this.userService.read(id);
  }

  @Get()
  async getAllUsers(
    @Query('page') page: number,
    @Query('pageSize') pageSize: number,
  ) {
    return await this.userService.readAll(page, pageSize);
  }

  @Put('/:id')
  async updateUser(
    @Param('id') id,
    @Body() payload: UserDto,
    @GetUser() currentUser: User,
  ) {
    return await this.userService.update(id, payload, currentUser);
  }

  @Delete('/:id')
  async deleteUser(@Param('id') id) {
    await this.userService.drop(id);
  }
}


@Post()
  @UseInterceptors(FileInterceptor('profileImage', storage))
  async createUser(
    @UploadedFile() file: Express.Multer.File,
    @Body() payload: UserDto,
    @GetUser() currentUser: User,
  ) {
    const payLoadWithProfileImage = { ...payload, profileImage: file.filename };
    return await this.userService.create(payLoadWithProfileImage, currentUser);
  }


@Get('/:id')
  async getUser(@Param('id') id) {
    return await this.userService.read(id);
  }


@Get()
  async getAllUsers(
    @Query('page') page: number,
    @Query('pageSize') pageSize: number,
  ) {
    return await this.userService.readAll(page, pageSize);
  }


@Put('/:id')
  async updateUser(
    @Param('id') id,
    @Body() payload: UserDto,
    @GetUser() currentUser: User,
  ) {
    return await this.userService.update(id, payload, currentUser);
  }


@Delete('/:id')
  async deleteUser(@Param('id') id) {
    await this.userService.drop(id);
  }


export type TNativePannerNodeFactory = (nativeContext: TNativeContext, options: IPannerOptions) => TNativePannerNode;


/**
 * oclif CLI entrypoint
 */
export function run(command: string[], options: AppOptions) {
	return CustomMain.run(command).then(
		() => {
			if (!options.noFlush) {
				return require('@oclif/command/flush');
			}
		},
		(error: Error) => {
			// oclif sometimes exits with ExitError code 0 (not an error)
			if (error instanceof ExitError && error.oclif.exit === 0) {
				return;
			}
			handleError(error);
		},
	);
}


() => {
			if (!options.noFlush) {
				return require('@oclif/command/flush');
			}
		}


(error: Error) => {
			// oclif sometimes exits with ExitError code 0 (not an error)
			if (error instanceof ExitError && error.oclif.exit === 0) {
				return;
			}
			handleError(error);
		}


class CustomMain extends Main {
	protected _helpOverride(): boolean {
		// Disable oclif's default handler for the 'version' command
		if (['-v', '--version', 'version'].includes(this.argv[0])) {
			return false;
		} else {
			return super._helpOverride();
		}
	}
}


protected _helpOverride(): boolean {
		// Disable oclif's default handler for the 'version' command
		if (['-v', '--version', 'version'].includes(this.argv[0])) {
			return false;
		} else {
			return super._helpOverride();
		}
	}


export function TaskList() {
  const [tasks, setTasks] = useState<Task[]>([]);
  const [newTaskTitle, setNewTaskTitle] = useState('');

  function handleCreateNewTask() {
    // Crie uma nova task com um id random, não permita criar caso o título seja vazio.
    if(!newTaskTitle) return;
    setTasks([...tasks,{id:Math.random(), title: newTaskTitle, isComplete:false}]);
  }

  function handleToggleTaskCompletion(id: number) {
    // Altere entre `true` ou `false` o campo `isComplete` de uma task com dado ID
    const toogle = tasks.map((task)=> {
      if(task.id === id) task.isComplete = !task.isComplete;
      return task;
    });
    setTasks(toogle);
  }

  function handleRemoveTask(id: number) {
    // Remova uma task da listagem pelo ID
    const remove = tasks.filter((task)=> task.id !== id);
    setTasks(remove);
  }

  return (

Minhas tasks

          <input
            type="text"
            placeholder="Adicionar novo todo"
            onChange={(e) => setNewTaskTitle(e.target.value)}


function handleCreateNewTask() {
    // Crie uma nova task com um id random, não permita criar caso o título seja vazio.
    if(!newTaskTitle) return;
    setTasks([...tasks,{id:Math.random(), title: newTaskTitle, isComplete:false}]);
  }


function handleToggleTaskCompletion(id: number) {
    // Altere entre `true` ou `false` o campo `isComplete` de uma task com dado ID
    const toogle = tasks.map((task)=> {
      if(task.id === id) task.isComplete = !task.isComplete;
      return task;
    });
    setTasks(toogle);
  }


function handleRemoveTask(id: number) {
    // Remova uma task da listagem pelo ID
    const remove = tasks.filter((task)=> task.id !== id);
    setTasks(remove);
  }


(task)=> {
      if(task.id === id) task.isComplete = !task.isComplete;
      return task;
    }


(task)=> task.id !== id


(study: Study) => study.id.toLowerCase().includes(query)


item => item.id === study.id


@Component({
  selector: 'gb-study-constraint',
  templateUrl: './gb-study-constraint.component.html',
  styleUrls: ['./gb-study-constraint.component.css', '../gb-constraint/gb-constraint.component.css']
})
export class GbStudyConstraintComponent extends GbConstraintComponent implements OnInit {

  @ViewChild('autoComplete') autoComplete: AutoComplete;

  searchResults: Study[];

  ngOnInit() {
  }

  get selectedStudies(): Study[] {
    return (<StudyConstraint>this.constraint).studies;
  }

  set selectedStudies(value: Study[]) {
    (<StudyConstraint>this.constraint).studies = value;
  }

  onSearch(event) {
    let studies = this.studyService.studies;
    let query = event.query.toLowerCase();
    if (query) {
      this.searchResults = studies.filter((study: Study) => study.id.toLowerCase().includes(query));
    } else {
      this.searchResults = studies;
    }
  }

  onDropdown(event) {
    this.searchResults = this.studyService.studies.slice(0);
    UIHelper.removePrimeNgLoaderIcon(this.element, 200);
  }

  onDrop(event: DragEvent) {
    const selectedNode: GbTreeNode = this.treeNodeService.selectedTreeNode;
    if (selectedNode && selectedNode.type === 'STUDY') {
      const droppedConstraint = this.treeNodeService.generateConstraintFromTreeNode(selectedNode);
      if (droppedConstraint && droppedConstraint.className === 'StudyConstraint') {
        let study = (<StudyConstraint>droppedConstraint).studies[0];
        let studies = (<StudyConstraint>this.constraint).studies;
        studies = studies.filter(item => item.id === study.id);
        if (studies.length === 0) {
          (<StudyConstraint>this.constraint).studies.push(study);
          this.update();
        }
        this.treeNodeService.selectedTreeNode = null;
        event.stopPropagation();
      }
    }
  }

}


onSearch(event) {
    let studies = this.studyService.studies;
    let query = event.query.toLowerCase();
    if (query) {
      this.searchResults = studies.filter((study: Study) => study.id.toLowerCase().includes(query));
    } else {
      this.searchResults = studies;
    }
  }


onDropdown(event) {
    this.searchResults = this.studyService.studies.slice(0);
    UIHelper.removePrimeNgLoaderIcon(this.element, 200);
  }


onDrop(event: DragEvent) {
    const selectedNode: GbTreeNode = this.treeNodeService.selectedTreeNode;
    if (selectedNode && selectedNode.type === 'STUDY') {
      const droppedConstraint = this.treeNodeService.generateConstraintFromTreeNode(selectedNode);
      if (droppedConstraint && droppedConstraint.className === 'StudyConstraint') {
        let study = (<StudyConstraint>droppedConstraint).studies[0];
        let studies = (<StudyConstraint>this.constraint).studies;
        studies = studies.filter(item => item.id === study.id);
        if (studies.length === 0) {
          (<StudyConstraint>this.constraint).studies.push(study);
          this.update();
        }
        this.treeNodeService.selectedTreeNode = null;
        event.stopPropagation();
      }
    }
  }


(resolve, reject) => {
            let oauth2Client = new Auth.OAuth2Client(this.creds.client_id, this.creds.client_secret, this.creds.redirect_uri);
            const authorizeUrl = oauth2Client.generateAuthUrl({
                access_type: 'offline',
                scope: this.scopes.join(' '),
            });

            const server = http.createServer(async (req: http.IncomingMessage, res: http.ServerResponse) => {
                try {
                    if (req.url === undefined) {
                        throw new Error("URL not filled for incoming request.");
                    }

                    if (req.url.indexOf('/oauth2callback') > -1) {
                        const qs = new url.URL(req.url, "http://localhost:3000")
                            .searchParams;
                        res.end('Authentication successful! Please return to the console.');
                        server.close();
                        let code = qs.get('code');
                        if (code === null) {
                            throw Error("Unable to read code from Oauth2 callback.");
                        }
                        const { tokens } = await oauth2Client.getToken(code);
                        oauth2Client.credentials = tokens; // eslint-disable-line require-atomic-updates
                        resolve(oauth2Client);
                    }
                } catch (e) {
                    reject(e);
                }
            })
                .listen(3000, () => {
                    // open the browser to the authorize url to start the workflow
                    console.log(authorizeUrl);
                    //opn(authorizeUrl, { wait: false }).then(cp => cp.unref());
                });
        }


async (req: http.IncomingMessage, res: http.ServerResponse) => {
                try {
                    if (req.url === undefined) {
                        throw new Error("URL not filled for incoming request.");
                    }

                    if (req.url.indexOf('/oauth2callback') > -1) {
                        const qs = new url.URL(req.url, "http://localhost:3000")
                            .searchParams;
                        res.end('Authentication successful! Please return to the console.');
                        server.close();
                        let code = qs.get('code');
                        if (code === null) {
                            throw Error("Unable to read code from Oauth2 callback.");
                        }
                        const { tokens } = await oauth2Client.getToken(code);
                        oauth2Client.credentials = tokens; // eslint-disable-line require-atomic-updates
                        resolve(oauth2Client);
                    }
                } catch (e) {
                    reject(e);
                }
            }


() => {
                    // open the browser to the authorize url to start the workflow
                    console.log(authorizeUrl);
                    //opn(authorizeUrl, { wait: false }).then(cp => cp.unref());
                }


class YouTubeCreds {
    constructor(public client_id: string,
        public client_secret: string,
        public redirect_uri: string) { }
}


export class YoutubeCredentialsNanny {
    private scopes = [
        'https://www.googleapis.com/auth/youtube.readonly',
        'https://www.googleapis.com/auth/youtube',
        'https://www.googleapis.com/auth/youtube.force-ssl',
    ];
    private creds: YouTubeCreds;
    private authProvider: Promise<Auth.OAuth2Client>;

    constructor(credentials_file: string) {
        const rawdata = fs.readFileSync(credentials_file);
        let parsed = JSON.parse(rawdata.toString());
        this.creds = new YouTubeCreds(parsed.web.client_id as string,
            parsed.web.client_secret as string,
            parsed.web.redirect_uris[0] as string
        );
    }

    private async authenticate(): Promise<Auth.OAuth2Client> {
        return new Promise<Auth.OAuth2Client>((resolve, reject) => {
            let oauth2Client = new Auth.OAuth2Client(this.creds.client_id, this.creds.client_secret, this.creds.redirect_uri);
            const authorizeUrl = oauth2Client.generateAuthUrl({
                access_type: 'offline',
                scope: this.scopes.join(' '),
            });

            const server = http.createServer(async (req: http.IncomingMessage, res: http.ServerResponse) => {
                try {
                    if (req.url === undefined) {
                        throw new Error("URL not filled for incoming request.");
                    }

                    if (req.url.indexOf('/oauth2callback') > -1) {
                        const qs = new url.URL(req.url, "http://localhost:3000")
                            .searchParams;
                        res.end('Authentication successful! Please return to the console.');
                        server.close();
                        let code = qs.get('code');
                        if (code === null) {
                            throw Error("Unable to read code from Oauth2 callback.");
                        }
                        const { tokens } = await oauth2Client.getToken(code);
                        oauth2Client.credentials = tokens; // eslint-disable-line require-atomic-updates
                        resolve(oauth2Client);
                    }
                } catch (e) {
                    reject(e);
                }
            })
                .listen(3000, () => {
                    // open the browser to the authorize url to start the workflow
                    console.log(authorizeUrl);
                    //opn(authorizeUrl, { wait: false }).then(cp => cp.unref());
                });
        });
    }

    async getApiClient(): Promise<Auth.OAuth2Client> {
        if (this.authProvider) {
            return this.authProvider;
        }
        this.authProvider = this.authenticate();
        return this.authProvider;
    }
}


private async authenticate(): Promise<Auth.OAuth2Client> {
        return new Promise<Auth.OAuth2Client>((resolve, reject) => {
            let oauth2Client = new Auth.OAuth2Client(this.creds.client_id, this.creds.client_secret, this.creds.redirect_uri);
            const authorizeUrl = oauth2Client.generateAuthUrl({
                access_type: 'offline',
                scope: this.scopes.join(' '),
            });

            const server = http.createServer(async (req: http.IncomingMessage, res: http.ServerResponse) => {
                try {
                    if (req.url === undefined) {
                        throw new Error("URL not filled for incoming request.");
                    }

                    if (req.url.indexOf('/oauth2callback') > -1) {
                        const qs = new url.URL(req.url, "http://localhost:3000")
                            .searchParams;
                        res.end('Authentication successful! Please return to the console.');
                        server.close();
                        let code = qs.get('code');
                        if (code === null) {
                            throw Error("Unable to read code from Oauth2 callback.");
                        }
                        const { tokens } = await oauth2Client.getToken(code);
                        oauth2Client.credentials = tokens; // eslint-disable-line require-atomic-updates
                        resolve(oauth2Client);
                    }
                } catch (e) {
                    reject(e);
                }
            })
                .listen(3000, () => {
                    // open the browser to the authorize url to start the workflow
                    console.log(authorizeUrl);
                    //opn(authorizeUrl, { wait: false }).then(cp => cp.unref());
                });
        });
    }


async getApiClient(): Promise<Auth.OAuth2Client> {
        if (this.authProvider) {
            return this.authProvider;
        }
        this.authProvider = this.authenticate();
        return this.authProvider;
    }


@NgModule({
  declarations: [],
  imports: [
    CommonModule
  ],
  exports:[
    ButtonModule,
    InputTextModule,
    MenubarModule,
    CardModule,
    SliderModule,
    DropdownModule,
    InputSwitchModule,
    TableModule,
    SelectButtonModule,
    RadioButtonModule,
    TooltipModule
  ]
})
export class PrimeNgModule { }


export function createSerializer(options: SerializerOptions) {
  const mandatory = options.mandatory || []
  const optional = options.optional || []
  const serializable = options.serializable || []

  return function (unserialized: any) {
    if (!unserialized) {
      return unserialized
    }

    const asArray = castArray(unserialized)

    if (!asArray.every((item) => mandatory.every((value) => get(item, value) !== undefined))) {
      return unserialized
    }

    const serialized = asArray.map((item) => {
      const segments = pick(item, mandatory.concat(optional))
      const remotes = {}

      serializable.forEach(({ type, field }) => {
        set(remotes, field, type(get(item, field)))
      })

      return { ...segments, ...remotes }
    })

    return Array.isArray(unserialized) ? serialized : serialized[0]
  }
}


export async function expressLogger(req: Request, res: Response, next: NextFunction) {
  req.reqId = (req.headers['x-request-id'] as string) || uuidv4()
  req.log = log.child({
    id: req.reqId,
    user: req.user?.id,
    clientIp: req.headers['x-forwarded-for'] || req.socket.remoteAddress,
  })

  res.error = (code: number, error: any) => {
    req.log.warn(error[0], error[1])
    return res.status(code || 500).json({
      message: error[1],
    })
  }

  res.setHeader('x-request-id', req.reqId)

  await new Promise((resolve) => morganLog(req, res, resolve))

  next()
}


export async function expressErrorHandler(
  err: StatusError & { logger: any },
  req: Request,
  res: Response,
  _next: NextFunction
) {
  if (!err.code) {
    throw err
  }

  const code = typeof err.code === 'number' && err.code > 100 && err.code < 600 ? err.code : 500
  const localLogger = err.logger || req.log

  localLogger.warn(err.data, err.message)
  return res.status(err.code || 500).json({
    message: err.message,
  })
}


(k) => keys.includes(k)


(key) => `${key}=${this.representValue(attributes[key])}`


(item) => mandatory.every((value) => get(item, value) !== undefined)


(value) => get(item, value) !== undefined


(item) => {
      const segments = pick(item, mandatory.concat(optional))
      const remotes = {}

      serializable.forEach(({ type, field }) => {
        set(remotes, field, type(get(item, field)))
      })

      return { ...segments, ...remotes }
    }


({ type, field }) => {
        set(remotes, field, type(get(item, field)))
      }


(tokens, req, res) => {
    req.log.trace(
      {
        url: tokens.url(req, res),
        method: tokens.method(req, res),
        'response-time': tokens['response-time'](req, res),
        status: tokens.status(req, res),
      },
      tokens.dev(morgan, req, res)
    )

    return ''
  }


(req, _res) => {
      return ['/_next/', '/__nextjs'].some((val) => req.originalUrl.startsWith(val))
    }


(val) => req.originalUrl.startsWith(val)


(code: number, error: any) => {
    req.log.warn(error[0], error[1])
    return res.status(code || 500).json({
      message: error[1],
    })
  }


(resolve) => morganLog(req, res, resolve)


class Writer {
  basepath: string

  constructor({ basepath }: { basepath: string }) {
    this.basepath = basepath + sep
  }

  getLevel(level) {
    switch (level) {
      case 10:
        return chalk.gray('trace')
      case 20:
        return 'debug'
      case 30:
        return chalk.cyan('info ')
      case 40:
        return chalk.yellow('warn ')
      case 50:
        return chalk.red('error')
      case 60:
        return chalk.redBright('fatal')
      default:
        return String(level)
    }
  }

  getSrc(src) {
    const line = src.file.replace(this.basepath, '')
    return `${line}:${src.line}`
  }

  representValue(value: any) {
    return typeof value === 'object' ? inspect(value) : String(value)
  }

  getAttributes(data) {
    let attributes = omit(data, [
      'name',
      'hostname',
      'pid',
      'level',
      'msg',
      'time',
      'src',
      'v',
      'user',
      'timestamp',
      'clientIp',
    ])
    let keys = Object.keys(attributes)

    if (['id', 'url', 'method', 'response-time', 'status'].every((k) => keys.includes(k))) {
      // this is probably a req object.
      attributes = omit(attributes, ['id', 'url', 'method', 'response-time', 'status'])
      keys = Object.keys(attributes)
    }

    if (keys.includes('id')) {
      // don't show id if it's a uuid
      if (/^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(attributes.id)) {
        attributes = omit(attributes, ['id'])
        keys = Object.keys(attributes)
      }
    }

    if (!keys.length) {
      return ''
    }

    return keys.map((key) => `${key}=${this.representValue(attributes[key])}`).join(' ')
  }

  write(data) {
    const level = this.getLevel(data.level)
    const src = this.getSrc(data.src)
    const attributes = this.getAttributes(data)
    const formattedAttributes = attributes.length ? ` (${attributes})` : ''

    const message = `${level} - (${src}): ${data.msg}${formattedAttributes}`

    const pipe = data.level >= 40 ? 'stderr' : 'stdout'
    process[pipe].write(message + '\n')
  }
}


export interface SerializerOptions {
  mandatory?: Array<string>
  optional?: Array<string>
  serializable?: Array<any>
}


getLevel(level) {
    switch (level) {
      case 10:
        return chalk.gray('trace')
      case 20:
        return 'debug'
      case 30:
        return chalk.cyan('info ')
      case 40:
        return chalk.yellow('warn ')
      case 50:
        return chalk.red('error')
      case 60:
        return chalk.redBright('fatal')
      default:
        return String(level)
    }
  }


getSrc(src) {
    const line = src.file.replace(this.basepath, '')
    return `${line}:${src.line}`
  }


representValue(value: any) {
    return typeof value === 'object' ? inspect(value) : String(value)
  }


getAttributes(data) {
    let attributes = omit(data, [
      'name',
      'hostname',
      'pid',
      'level',
      'msg',
      'time',
      'src',
      'v',
      'user',
      'timestamp',
      'clientIp',
    ])
    let keys = Object.keys(attributes)

    if (['id', 'url', 'method', 'response-time', 'status'].every((k) => keys.includes(k))) {
      // this is probably a req object.
      attributes = omit(attributes, ['id', 'url', 'method', 'response-time', 'status'])
      keys = Object.keys(attributes)
    }

    if (keys.includes('id')) {
      // don't show id if it's a uuid
      if (/^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(attributes.id)) {
        attributes = omit(attributes, ['id'])
        keys = Object.keys(attributes)
      }
    }

    if (!keys.length) {
      return ''
    }

    return keys.map((key) => `${key}=${this.representValue(attributes[key])}`).join(' ')
  }


write(data) {
    const level = this.getLevel(data.level)
    const src = this.getSrc(data.src)
    const attributes = this.getAttributes(data)
    const formattedAttributes = attributes.length ? ` (${attributes})` : ''

    const message = `${level} - (${src}): ${data.msg}${formattedAttributes}`

    const pipe = data.level >= 40 ? 'stderr' : 'stdout'
    process[pipe].write(message + '\n')
  }


export default function useWindowSize() {
  const [windowSize, setWindowSize] = useState({
    width: window.innerWidth,
    height: window.innerHeight,
  });

  useEffect(() => {
    function handleResize() {
      setWindowSize({
        width: window.innerWidth,
        height: window.innerHeight,
      });
    }

    window.addEventListener('resize', handleResize);

    return () => {
      window.removeEventListener('resize', handleResize);
    };
  }, []);

  return windowSize;
}


function handleResize() {
      setWindowSize({
        width: window.innerWidth,
        height: window.innerHeight,
      });
    }


export function useBreakpoint(): size {
  const { width } = useWindowSize();

  const breakpoint = useMemo(() => {
    if (width >= size.desktop) {
      return size.desktop;
    }

    if (width >= size.tablet) {
      return size.tablet;
    }

    if (width >= size.mobileLarge) {
      return size.mobileLarge;
    }

    return size.mobile;
  }, [width]);

  return breakpoint;
}


() => {
    function handleResize() {
      setWindowSize({
        width: window.innerWidth,
        height: window.innerHeight,
      });
    }

    window.addEventListener('resize', handleResize);

    return () => {
      window.removeEventListener('resize', handleResize);
    };
  }


() => {
      window.removeEventListener('resize', handleResize);
    }


() => {
    if (width >= size.desktop) {
      return size.desktop;
    }

    if (width >= size.tablet) {
      return size.tablet;
    }

    if (width >= size.mobileLarge) {
      return size.mobileLarge;
    }

    return size.mobile;
  }


async function bootstrap() {
  const app = createApp(App);

  // Configure store
  setupStore(app);

  // Initialize internal system configuration
  initAppConfigStore();

  // Register global components
  registerGlobComp(app);

  // Multilingual configuration
  await setupI18n(app);

  // Configure routing
  setupRouter(app);

  // router-guard
  setupRouterGuard(router);

  // Register global directive
  setupGlobDirectives(app);

  // Configure global error handling
  setupErrorHandle(app);

  // Mount when the route is ready
  // https://next.router.vuejs.org/api/#isready
  await router.isReady();

  app.mount('#app', true);
}


async () => {
    const demo: Demo = new Demo();
    await demo.init();
    const detections: Detection[] = await demo.detect('resources/images/test.jpg');

    console.log(detections);

}


export class Demo {

    public readonly logger: Logging;

    private readonly modelLoader: Loader;
    private detector: Detector;

    constructor() {
        ImageUtils.userStoragePath = require('os').homedir();

        this.logger = new Logging();
        this.modelLoader = new Loader(this.logger);
    }

    public async init(): Promise<void> {
        this.detector = await this.modelLoader.loadCoco();
    }

    public async detect(imagePath: string): Promise<Detection[]> {
        let image: Image = await ImageUtils.createImage(path.resolve(imagePath));
        return this.detector.detect(image, true);
    }
}


public async init(): Promise<void> {
        this.detector = await this.modelLoader.loadCoco();
    }


public async detect(imagePath: string): Promise<Detection[]> {
        let image: Image = await ImageUtils.createImage(path.resolve(imagePath));
        return this.detector.detect(image, true);
    }


export class Condition{

  id: number;
  input: string;
  operator: string;
  values: any;
  editing: boolean

  constructor() {
    this.id = -1;
    this.input = "State";
    this.operator = '=';
    this.values = "NC";
  }
}


() => {
	const defaultState = {
		category: {
			categoryTitle: '',
		},
	};
	const [state, setState] = useState(defaultState);
	const navigation = useNavigation();

	const getButtonStatus = (): boolean => {
		return (
			state.category.categoryTitle === ''
		);
	};
	const addCategory = () => {
		axios
			.post(`${Environment.API_URL}/api/category/add`, state.category)
			.then((res: any) => {
				showToastWithGravity('Task Category Successfully Added');
				setState(defaultState);

				// @ts-ignore
				navigation.navigate('Category');
			}).catch((error: any) => {
			showToastWithGravity('An Error Has Occurred!!!');
			console.error('/api/category/add',error);
		});
	};
	return  (
		<View>
			<View style={{
				height: 150, width: '100%', justifyContent: 'center', alignItems: 'center',
				backgroundColor: '#3a436c'

			}}


(): boolean => {
		return (
			state.category.categoryTitle === ''
		);
	}


() => {
		axios
			.post(`${Environment.API_URL}/api/category/add`, state.category)
			.then((res: any) => {
				showToastWithGravity('Task Category Successfully Added');
				setState(defaultState);

				// @ts-ignore
				navigation.navigate('Category');
			}).catch((error: any) => {
			showToastWithGravity('An Error Has Occurred!!!');
			console.error('/api/category/add',error);
		});
	}


(res: any) => {
				showToastWithGravity('Task Category Successfully Added');
				setState(defaultState);

				// @ts-ignore
				navigation.navigate('Category');
			}


(error: any) => {
			showToastWithGravity('An Error Has Occurred!!!');
			console.error('/api/category/add',error);
		}


(prevState: any) => {
								let category = Object.assign({}, prevState.category);
								category.categoryTitle = text;
								return {category};
							}


getButtonStatus()


/**
 * @example Click {@link https://docs.cloud.oracle.com/en-us/iaas/tools/typescript-sdk-examples/latest/osmanagement/CreateSoftwareSource.ts.html |here} to see how to use CreateSoftwareSourceRequest.
 */
export interface CreateSoftwareSourceRequest extends common.BaseRequest {
  /**
   * Details about a Sofware Source to create
   */
  "createSoftwareSourceDetails": model.CreateSoftwareSourceDetails;
  /**
   * The client request ID for tracing.
   */
  "opcRequestId"?: string;
  /**
   * A token that uniquely identifies a request so it can be retried in case of a timeout or
   * server error without risk of executing that same action again. Retry tokens expire after 24
   * hours, but can be invalidated before then due to conflicting operations. For example, if a resource
   * has been deleted and purged from the system, then a retry of the original creation request
   * might be rejected.
   *
   */
  "opcRetryToken"?: string;
}