/**
     * Overrides the inline template for a component - other configuration remains unchanged.
     *
     * @param {Type} component
     * @param {string} template
     */
setInlineTemplate(component: Type, template: string): void;


/**
     * Overrides a directive from the component {@link ViewMetadata}.
     *
     * @param {Type} component
     * @param {Type} from
     * @param {Type} to
     */
overrideViewDirective(component: Type, from: Type, to: Type): void;


/**
     * Returns the {@link ViewMetadata} for a component:
     * - Set the {@link ViewMetadata} to the overridden view when it exists or fallback to the default
     * `ViewResolver`,
     *   see `setView`.
     * - Override the directives, see `overrideViewDirective`.
     * - Override the @View definition, see `setInlineTemplate`.
     *
     * @param component
     * @returns {ViewDefinition}
     */
resolve(component: Type): ViewMetadata;


@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.scss']
})
export class HomeComponent {
  constructor() { }
}


@Injectable()
export class ItemsService {
  constructor(@InjectModel('Item') private readonly itemModel: Model<Item>) {}

  async findAll(): Promise<Item[]> {
    return await this.itemModel.find();
  }

  async findOne(id: string): Promise<Item> {
    return await this.itemModel.findOne({ _id: id });
  }

  async create(item:Item):Promise<Item>{
    const newItem = new this.itemModel(item)
    return await newItem.save()
  }

  async delete(id: string):Promise<Item>{
    return await this.itemModel.findByIdAndRemove(id)
  }

  async update(id: string, item:Item ):Promise<Item>{
    return await this.itemModel.findByIdAndUpdate(id, item,{new:true})
  }

}


async findAll(): Promise<Item[]> {
    return await this.itemModel.find();
  }


async findOne(id: string): Promise<Item> {
    return await this.itemModel.findOne({ _id: id });
  }


async create(item:Item):Promise<Item>{
    const newItem = new this.itemModel(item)
    return await newItem.save()
  }


async delete(id: string):Promise<Item>{
    return await this.itemModel.findByIdAndRemove(id)
  }


async update(id: string, item:Item ):Promise<Item>{
    return await this.itemModel.findByIdAndUpdate(id, item,{new:true})
  }


export interface IPropagationChartItem {
    cumpercent: number;
    cumulative: number;
    dx: number;
    frequency: number;
    x: number;
    y: number;
}


/**
 * Keep track of the fact that we attempted to install a package into an interpreter.
 * (don't care whether it was successful or not).
 */
export async function trackPackageInstalledIntoInterpreter(
    memento: Memento,
    product: Product,
    interpreter: InterpreterUri
) {
    if (isResource(interpreter)) {
        return;
    }
    const key = `${getInterpreterHash(interpreter)}#${ProductNames.get(product)}`;
    await memento.update(key, true);
}


export async function clearInstalledIntoInterpreterMemento(memento: Memento, product: Product, interpreterPath: Uri) {
    const key = `${getInterpreterHash({ uri: interpreterPath })}#${ProductNames.get(product)}`;
    await memento.update(key, undefined);
}


export function isModulePresentInEnvironmentCache(memento: Memento, product: Product, interpreter: PythonEnvironment) {
    const key = `${getInterpreterHash(interpreter)}#${ProductNames.get(product)}`;
    return memento.get<boolean>(key, false);
}


export interface Constants {
    babe: {
      [index: string]: Codec;
      epochDuration: u64 & ConstantCodec;
      expectedBlockTime: Moment & ConstantCodec;
    };
    timestamp: {
      [index: string]: Codec;
      minimumPeriod: Moment & ConstantCodec;
    };
    balances: {
      [index: string]: Codec;
      existentialDeposit: Balance & ConstantCodec;
      transferFee: Balance & ConstantCodec;
      creationFee: Balance & ConstantCodec;
    };
    transactionPayment: {
      [index: string]: Codec;
      transactionBaseFee: BalanceOf & ConstantCodec;
      transactionByteFee: BalanceOf & ConstantCodec;
    };
    staking: {
      [index: string]: Codec;
      sessionsPerEra: SessionIndex & ConstantCodec;
      bondingDuration: EraIndex & ConstantCodec;
    };
    session: {
      [index: string]: Codec;
      dedupKeyPrefix: Bytes & ConstantCodec;
    };
    democracy: {
      [index: string]: Codec;
      enactmentPeriod: BlockNumber & ConstantCodec;
      launchPeriod: BlockNumber & ConstantCodec;
      votingPeriod: BlockNumber & ConstantCodec;
      minimumDeposit: BalanceOf & ConstantCodec;
      emergencyVotingPeriod: BlockNumber & ConstantCodec;
      cooloffPeriod: BlockNumber & ConstantCodec;
    };
    elections: {
      [index: string]: Codec;
      candidacyBond: BalanceOf & ConstantCodec;
      votingBond: BalanceOf & ConstantCodec;
      desiredMembers: u32 & ConstantCodec;
      desiredRunnersUp: u32 & ConstantCodec;
      termDuration: BlockNumber & ConstantCodec;
    };
    finalityTracker: {
      [index: string]: Codec;
      windowSize: BlockNumber & ConstantCodec;
      reportLatency: BlockNumber & ConstantCodec;
    };
    treasury: {
      [index: string]: Codec;
      proposalBond: Permill & ConstantCodec;
      proposalBondMinimum: BalanceOf & ConstantCodec;
      spendPeriod: BlockNumber & ConstantCodec;
      burn: Permill & ConstantCodec;
    };
    contracts: {
      [index: string]: Codec;
      signedClaimHandicap: BlockNumber & ConstantCodec;
      tombstoneDeposit: BalanceOf & ConstantCodec;
      storageSizeOffset: u32 & ConstantCodec;
      rentByteFee: BalanceOf & ConstantCodec;
      rentDepositOffset: BalanceOf & ConstantCodec;
      surchargeReward: BalanceOf & ConstantCodec;
      transferFee: BalanceOf & ConstantCodec;
      creationFee: BalanceOf & ConstantCodec;
      transactionBaseFee: BalanceOf & ConstantCodec;
      transactionByteFee: BalanceOf & ConstantCodec;
      contractFee: BalanceOf & ConstantCodec;
      callBaseFee: Gas & ConstantCodec;
      instantiateBaseFee: Gas & ConstantCodec;
      maxDepth: u32 & ConstantCodec;
      maxValueSize: u32 & ConstantCodec;
      blockGasLimit: Gas & ConstantCodec;
    };
    nicks: {
      [index: string]: Codec;
      reservationFee: BalanceOf & ConstantCodec;
      minLength: u32 & ConstantCodec;
      maxLength: u32 & ConstantCodec;
    };
  }


() =>
        originalRenderPage({
          enhanceApp: (App: React.FC) => (props: unknown) =>
            sheet.collectStyles(<App {...props} />),
        })


(App: React.FC) => (props: unknown) =>
            sheet.collectStyles(<App {...props} />)


(props: unknown) =>
            sheet.collectStyles(<App {...props} />)


export default class MyDocument extends Document {
  static async getInitialProps(ctx: DocumentContext) {
    const sheet = new ServerStyleSheet();
    const originalRenderPage = ctx.renderPage;

    try {
      ctx.renderPage = () =>
        originalRenderPage({
          enhanceApp: (App: React.FC) => (props: unknown) =>
            sheet.collectStyles(<App {...props} />),
        });

      const initialProps = await Document.getInitialProps(ctx);

      return {
        ...initialProps,
        styles: (
          <>
            {initialProps.styles}
            {sheet.getStyleElement()}
          </>
        ),
      };
    }


static async getInitialProps(ctx: DocumentContext) {
    const sheet = new ServerStyleSheet();
    const originalRenderPage = ctx.renderPage;

    try {
      ctx.renderPage = () =>
        originalRenderPage({
          enhanceApp: (App: React.FC) => (props: unknown) =>
            sheet.collectStyles(<App {...props} />),
        });

      const initialProps = await Document.getInitialProps(ctx);

      return {
        ...initialProps,
        styles: (
          <>
            {initialProps.styles}
            {sheet.getStyleElement()}
          </>
        ),
      };
    }


(data: Question[]) => {
          return data;
        }


@Injectable({
  providedIn: 'root'
})
export class QuestionService {

  private CHALLENGING_ORDER = [
    'literacy',
    'numeracy',
    'digital_skills'
  ];

  constructor(private commonService: CommonService) { }

  getQuestions(interestid: number, scenarioid: number): Observable<Question[]> {
    if (interestid === undefined) {
      interestid = -1;
    } else if (scenarioid === undefined) {
      scenarioid = -1;
    } else {
      const url = `/interests/${interestid}/scenarios/${scenarioid}/questions`;
      return this.commonService.getAPICaller(url)
        .pipe(map( (data: Question[]) => {
          return data;
        })
      );
    }
  }

  getQuestionsByCategory(categoryid: number, interestid: number, scenarioid: number): Observable<Question[]> {
    if (categoryid === undefined) {
      categoryid = -1;
    } else if (interestid === undefined) {
      interestid = -1;
    } else if (scenarioid === undefined) {
      scenarioid = -1;
    } else {
      const url = `/categories/${categoryid}/interests/${interestid}/scenarios/${scenarioid}/questions`;
      return this.commonService.getAPICaller(url)
        .pipe(map( (data: Question[]) => {
          return data;
        })
      );
    }
  }

  getChallengingOrder(): string[] {
    return this.CHALLENGING_ORDER;
  }

  getQuestionInOrder(questions: Question[], questionindex: number, questionOrder: string[]): Question {
    let r: Question = null;
    // tslint:disable-next-line:prefer-for-of
    for (let i = 0; i < questions.length; i++) {
      if (questions[i].pedagogical_type === questionOrder[questionindex]) {
        r = questions[i];
        break;
      }
    }
    return r;
  }

}


getQuestions(interestid: number, scenarioid: number): Observable<Question[]> {
    if (interestid === undefined) {
      interestid = -1;
    } else if (scenarioid === undefined) {
      scenarioid = -1;
    } else {
      const url = `/interests/${interestid}/scenarios/${scenarioid}/questions`;
      return this.commonService.getAPICaller(url)
        .pipe(map( (data: Question[]) => {
          return data;
        })
      );
    }
  }


getQuestionsByCategory(categoryid: number, interestid: number, scenarioid: number): Observable<Question[]> {
    if (categoryid === undefined) {
      categoryid = -1;
    } else if (interestid === undefined) {
      interestid = -1;
    } else if (scenarioid === undefined) {
      scenarioid = -1;
    } else {
      const url = `/categories/${categoryid}/interests/${interestid}/scenarios/${scenarioid}/questions`;
      return this.commonService.getAPICaller(url)
        .pipe(map( (data: Question[]) => {
          return data;
        })
      );
    }
  }


getChallengingOrder(): string[] {
    return this.CHALLENGING_ORDER;
  }


getQuestionInOrder(questions: Question[], questionindex: number, questionOrder: string[]): Question {
    let r: Question = null;
    // tslint:disable-next-line:prefer-for-of
    for (let i = 0; i < questions.length; i++) {
      if (questions[i].pedagogical_type === questionOrder[questionindex]) {
        r = questions[i];
        break;
      }
    }
    return r;
  }


() => {
  const menuProps = useConst<IContextualMenuProps>(() => ({
    shouldFocusOnMount: true,
    items: [
      {
        key: 'Later Today',
        iconProps: { iconName: 'Clock' },
        text: 'Later Today',
        secondaryText: '7:00 PM',
      },
      {
        key: 'Tomorrow',
        iconProps: { iconName: 'Coffeescript' },
        text: 'Tomorrow',
        secondaryText: 'Thu. 8:00 AM',
      },
      {
        key: 'This Weekend',
        iconProps: { iconName: 'Vacation' },
        text: 'This Weekend',
        secondaryText: 'Sat. 10:00 AM',
      },
      {
        key: 'Next Week',
        iconProps: { iconName: 'Suitcase' },
        text: 'Next Week',
        secondaryText: 'Mon. 8:00 AM',
      },
    ],
  }));
  return <DefaultButton text="Click for ContextualMenu" menuProps={menuProps} />;
}


() => ({
    shouldFocusOnMount: true,
    items: [
      {
        key: 'Later Today',
        iconProps: { iconName: 'Clock' },
        text: 'Later Today',
        secondaryText: '7:00 PM',
      },
      {
        key: 'Tomorrow',
        iconProps: { iconName: 'Coffeescript' },
        text: 'Tomorrow',
        secondaryText: 'Thu. 8:00 AM',
      },
      {
        key: 'This Weekend',
        iconProps: { iconName: 'Vacation' },
        text: 'This Weekend',
        secondaryText: 'Sat. 10:00 AM',
      },
      {
        key: 'Next Week',
        iconProps: { iconName: 'Suitcase' },
        text: 'Next Week',
        secondaryText: 'Mon. 8:00 AM',
      },
    ],
  })


() => DaterangepickerDirective


(range: any) => {
      this.rangeClicked.emit(range);
    }


(range: any) => {
      this.datesUpdated.emit(range);
    }


(change: any) => {
      if (change) {
        const value = {};
        value[this._startKey] = change.startDate;
        value[this._endKey] = change.endDate;
        this.value = value;
        this.onChange.emit(value);
        if (typeof change.chosenLabel === 'string') {
          this._el.nativeElement.value = change.chosenLabel;
        }
      }
    }


() => {
      this.setPosition();
    }


ngOnInit() {
    this.picker.rangeClicked.asObservable().subscribe((range: any) => {
      this.rangeClicked.emit(range);
    });
    this.picker.datesUpdated.asObservable().subscribe((range: any) => {
      this.datesUpdated.emit(range);
    });
    this.picker.choosedDate.asObservable().subscribe((change: any) => {
      if (change) {
        const value = {};
        value[this._startKey] = change.startDate;
        value[this._endKey] = change.endDate;
        this.value = value;
        this.onChange.emit(value);
        if (typeof change.chosenLabel === 'string') {
          this._el.nativeElement.value = change.chosenLabel;
        }
      }
    });
    this.picker.firstMonthDayClass = this.firstMonthDayClass;
    this.picker.lastMonthDayClass = this.lastMonthDayClass;
    this.picker.emptyWeekRowClass = this.emptyWeekRowClass;
    this.picker.firstDayOfNextMonthClass = this.firstDayOfNextMonthClass;
    this.picker.lastDayOfPreviousMonthClass = this.lastDayOfPreviousMonthClass;
    this.picker.drops = this.drops;
    this.picker.opens = this.opens;
    this.localeDiffer = this.differs.find(this.locale).create();
    this.picker.closeOnAutoApply = this.closeOnAutoApply;
  }


ngOnChanges(changes: SimpleChanges): void  {
    for (const change in changes) {
      if (changes.hasOwnProperty(change)) {
        if (this.notForChangesProperty.indexOf(change) === -1) {
          this.picker[change] = changes[change].currentValue;
        }
      }
    }
  }


ngDoCheck() {
    if (this.localeDiffer) {
      const changes = this.localeDiffer.diff(this.locale);
      if (changes) {
        this.picker.updateLocale(this.locale);
      }
    }
  }


onBlur() {
    this._onTouched();
  }


open(event?: any) {
    this.picker.show(event);
    setTimeout(() => {
      this.setPosition();
    });
  }


hide(e?) {
    this.picker.hide(e);
  }


toggle(e?) {
    if (this.picker.isShown) {
      this.hide(e);
    } else {
      this.open(e);
    }
  }


clear() {
    this.picker.clear();
  }


writeValue(value) {
    this.setValue(value);
  }


registerOnChange(fn) {
    this._onChange = fn;
  }


registerOnTouched(fn) {
    this._onTouched = fn;
  }


private setValue(val: any) {
    if (val) {
      this.value = val;
      if (val[this._startKey]) {
        this.picker.setStartDate(val[this._startKey]);
      }
      if (val[this._endKey]) {
        this.picker.setEndDate(val[this._endKey]);
      }
      this.picker.calculateChosenLabel();
      if (this.picker.chosenLabel) {
        this._el.nativeElement.value = this.picker.chosenLabel;
      }
    } else {
      this.picker.clear();
    }
  }


/**
   * Set position of the calendar
   */
setPosition() {
    let style;
    let containerTop;
    const container = this.picker.pickerContainer.nativeElement;
    const element = this._el.nativeElement;
    if (this.drops && this.drops === 'up') {
      containerTop = (element.offsetTop - container.clientHeight) + 'px';
    } else {
      containerTop = 'auto';
    }
    if (this.opens === 'left') {
      style = {
          top: containerTop,
          left: (element.offsetLeft - container.clientWidth + element.clientWidth) + 'px',
          right: 'auto'
      };
    } else if (this.opens === 'center') {
        style = {
          top: containerTop,
          left: (element.offsetLeft  +  element.clientWidth / 2
                  - container.clientWidth / 2) + 'px',
          right: 'auto'
        };
    } else if (this.opens === 'right') {
        style = {
          top: containerTop,
          left: element.offsetLeft  + 'px',
          right: 'auto'
        };
    } else {
      const position = element.offsetLeft  +  element.clientWidth / 2 - container.clientWidth / 2;
      if (position < 0) {
        style = {
          top: containerTop,
          left: element.offsetLeft + 'px',
          right: 'auto'
        };
      }
      else {
        style = {
            top: containerTop,
            left: position + 'px',
            right: 'auto'
        };
      }
    }
    if (style) {
      this._renderer.setStyle(container, 'top', style.top);
      this._renderer.setStyle(container, 'left', style.left);
      this._renderer.setStyle(container, 'right', style.right);
    }
  }


inputChanged(e) {
    if (e.target.tagName.toLowerCase() !== 'input') {
      return;
    }
    if (!e.target.value.length) {
      return;
    }
    const dateString = e.target.value.split(this.picker.locale.separator);
    let start = null, end = null;
    if (dateString.length === 2) {
      start = moment(dateString[0], this.picker.locale.format);
      end = moment(dateString[1], this.picker.locale.format);
    }
    if (this.singleDatePicker || start === null || end === null) {
      start = moment(e.target.value, this.picker.locale.format);
      end = start;
    }
    if (!start.isValid() || !end.isValid()) {
      return;
    }
    this.picker.setStartDate(start);
    this.picker.setEndDate(end);
    this.picker.updateView();

  }


/**
   * For click outside of the calendar's container
   * @param event event object
   */
@HostListener('document:click', ['$event'])
  outsideClick(event): void {
    if (!event.target) {
      return;
    }

    if (event.target.classList.contains('ngx-daterangepicker-action')) {
      return;
    }

    if (!this.elementRef.nativeElement.contains(event.target)) {
      this.hide();
    }
  }


() => ({
  getOctokit: jest.fn(),
  context: { repo: { owner: "genericOwner", repo: "genericRepo" } },
})


(toMock: string[]) => {
  const originalConsole = { ...console };
  debugger;
  toMock.forEach((mock) => {
    (console as any)[mock] = jest.fn();
  });
  consoleMock = console as jest.Mocked<Console>;
  return () => {
    global.console = originalConsole;
  };
}


(mock) => {
    (console as any)[mock] = jest.fn();
  }


() => {
    global.console = originalConsole;
  }


() => {
  it("returns empty array on empty string", () => {
    const list = "";
    const pkgArray = packageListToArray(list);
    expect(pkgArray.length).toBe(0);
  });

  it("splits on comma", () => {
    const list = "package1,package2,package3";
    const pkgArray = packageListToArray(list);
    expect(pkgArray[0]).toBe("package1");
    expect(pkgArray[1]).toBe("package2");
    expect(pkgArray[2]).toBe("package3");
  });

  it("considers a single package", () => {
    const list = "package17";
    const pkgArray = packageListToArray(list);
    expect(pkgArray[0]).toBe("package17");
    expect(pkgArray[1]).toBe(undefined);
  });
}


() => {
    const list = "";
    const pkgArray = packageListToArray(list);
    expect(pkgArray.length).toBe(0);
  }


() => {
    const list = "package1,package2,package3";
    const pkgArray = packageListToArray(list);
    expect(pkgArray[0]).toBe("package1");
    expect(pkgArray[1]).toBe("package2");
    expect(pkgArray[2]).toBe("package3");
  }


() => {
    const list = "package17";
    const pkgArray = packageListToArray(list);
    expect(pkgArray[0]).toBe("package17");
    expect(pkgArray[1]).toBe(undefined);
  }


() => {
  it("mocks core getInput", () => {
    jest
      .spyOn(core, "getInput")
      .mockImplementationOnce((arg) => `This returns ${arg}`);
    const test = core.getInput("test");
    expect(test).toBe("This returns test");
  });

  it("mocks github context", () => {
    jest
      .spyOn(github, "getOctokit")
      //@ts-ignore
      .mockImplementationOnce((arg) => ({
        context: { repo: { owner: "genericOwner", repo: "genericRepo" } },
      }));
    const octokit = github.getOctokit("token");
    expect(octokit).toEqual({
      context: { repo: { owner: "genericOwner", repo: "genericRepo" } },
    });
  });

  it("mocks octokit createRelease", () => {
    jest.spyOn(github, "getOctokit").mockImplementationOnce((arg) => ({
      //@ts-ignore
      repos: { createRelease: (obj) => obj },
    }));
    const octokit = github.getOctokit("token");
    //@ts-ignore
    const releaseResponse = octokit.repos.createRelease({ body: "text" });
    expect(releaseResponse).toEqual({ body: "text" });
  });
}


() => {
    jest
      .spyOn(core, "getInput")
      .mockImplementationOnce((arg) => `This returns ${arg}`);
    const test = core.getInput("test");
    expect(test).toBe("This returns test");
  }


(arg) => `This returns ${arg}`


() => {
    jest
      .spyOn(github, "getOctokit")
      //@ts-ignore
      .mockImplementationOnce((arg) => ({
        context: { repo: { owner: "genericOwner", repo: "genericRepo" } },
      }));
    const octokit = github.getOctokit("token");
    expect(octokit).toEqual({
      context: { repo: { owner: "genericOwner", repo: "genericRepo" } },
    });
  }


(arg) => ({
        context: { repo: { owner: "genericOwner", repo: "genericRepo" } },
      })


() => {
    jest.spyOn(github, "getOctokit").mockImplementationOnce((arg) => ({
      //@ts-ignore
      repos: { createRelease: (obj) => obj },
    }));
    const octokit = github.getOctokit("token");
    //@ts-ignore
    const releaseResponse = octokit.repos.createRelease({ body: "text" });
    expect(releaseResponse).toEqual({ body: "text" });
  }


(arg) => ({
      //@ts-ignore
      repos: { createRelease: (obj) => obj },
    })


(obj) => obj


() => {
    restoreConsole = mockConsole(["log", "dir", "info", "error"]);
    jest.clearAllMocks();
  }


() => {
    restoreConsole();
  }


() => {
    it("output", async () => {
      const cwd: string = f.copy("integration.js-with-complex-commands");

      const input: { [k: string]: string } = {
        command: "status",
        cwd: cwd,
        createRelease: "false",
        draftRelease: "false",
        token: "randomsequenceofcharactersforsecurity",
      };

      jest.spyOn(core, "getInput").mockImplementation((arg) => input[arg]);

      const covectoredAction = await run(covector());
      expect(core.setOutput).toHaveBeenCalledWith("commandRan", "status");
      expect(core.setOutput).toHaveBeenCalledWith("status", "No changes.");
    });
  }


async () => {
      const cwd: string = f.copy("integration.js-with-complex-commands");

      const input: { [k: string]: string } = {
        command: "status",
        cwd: cwd,
        createRelease: "false",
        draftRelease: "false",
        token: "randomsequenceofcharactersforsecurity",
      };

      jest.spyOn(core, "getInput").mockImplementation((arg) => input[arg]);

      const covectoredAction = await run(covector());
      expect(core.setOutput).toHaveBeenCalledWith("commandRan", "status");
      expect(core.setOutput).toHaveBeenCalledWith("status", "No changes.");
    }


(arg) => input[arg]


() => {
    it("output", async () => {
      const cwd: string = f.copy("integration.js-with-complex-commands");

      const input: { [k: string]: string } = {
        command: "version",
        cwd: cwd,
        createRelease: "false",
        draftRelease: "false",
        token: "randomsequenceofcharactersforsecurity",
      };

      jest.spyOn(core, "getInput").mockImplementation((arg) => input[arg]);

      const covectoredAction = await run(covector());
      expect(core.setOutput).toHaveBeenCalledWith("status", "No changes.");
      expect(core.setOutput).toHaveBeenCalledWith("commandRan", "version");
      // to cover template pipe
      expect(core.setOutput).toMatchSnapshot();
    });
  }


async () => {
      const cwd: string = f.copy("integration.js-with-complex-commands");

      const input: { [k: string]: string } = {
        command: "version",
        cwd: cwd,
        createRelease: "false",
        draftRelease: "false",
        token: "randomsequenceofcharactersforsecurity",
      };

      jest.spyOn(core, "getInput").mockImplementation((arg) => input[arg]);

      const covectoredAction = await run(covector());
      expect(core.setOutput).toHaveBeenCalledWith("status", "No changes.");
      expect(core.setOutput).toHaveBeenCalledWith("commandRan", "version");
      // to cover template pipe
      expect(core.setOutput).toMatchSnapshot();
    }


(token: string) => ({
        context: { repo: { owner: "genericOwner", repo: "genericRepo" } },
        repos: {
          listReleases: jest.fn().mockResolvedValue({
            data: [],
          }),
          updateRelease: jest
            .fn()
            .mockImplementation((input) => Promise.resolve({ data: input })),
          createRelease: jest
            .fn()
            .mockImplementation((input) => Promise.resolve({ data: input })),
          uploadReleaseAsset: jest
            .fn()
            .mockImplementation((input) => Promise.resolve({ data: input })),
        },
      })


(input) => Promise.resolve({ data: input })


async () => {
      const cwd: string = f.copy("integration.js-with-complex-commands");

      const input: { [k: string]: string } = {
        command: "publish",
        cwd: cwd,
        createRelease: "true",
        draftRelease: "false",
        token: "randomsequenceofcharactersforsecurity",
      };

      jest.spyOn(core, "getInput").mockImplementation((arg) => input[arg]);

      const covectoredAction = await run(covector());
      expect({
        consoleLog: consoleMock.log.mock.calls,
        consoleDir: consoleMock.dir.mock.calls,
      }).toMatchSnapshot();
      expect(core.setOutput).toHaveBeenCalledWith(
        "templatePipe",
        expect.stringContaining("2.3.1")
      );
      expect(core.setOutput).toHaveBeenCalledWith(
        "templatePipe",
        expect.stringContaining("1.9.0")
      );
    }


async () => {
      const cwd: string = f.copy("integration.js-with-complex-commands");

      const input: { [k: string]: string } = {
        command: "publish",
        cwd: cwd,
        createRelease: "false",
        draftRelease: "false",
        token: "randomsequenceofcharactersforsecurity",
      };

      jest.spyOn(core, "getInput").mockImplementation((arg) => input[arg]);

      const covectoredAction = await run(covector());
      expect(core.setOutput).toHaveBeenCalledWith("status", "No changes.");
      expect(core.setOutput).toHaveBeenCalledWith("commandRan", "publish");
      expect(core.setOutput).toHaveBeenCalledWith("successfulPublish", true);
      expect(core.setOutput).toHaveBeenCalledWith(
        "packagesPublished",
        "package-one,package-two"
      );
      expect(core.setOutput).toHaveBeenCalledWith(
        "templatePipe",
        expect.stringContaining("2.3.1")
      );
      expect(core.setOutput).toHaveBeenCalledWith(
        "templatePipe",
        expect.stringContaining("1.9.0")
      );
    }


async () => {
      const cwd: string = f.copy("integration.js-with-complex-commands");

      const input: { [k: string]: string } = {
        command: "publish",
        cwd: cwd,
        createRelease: "true",
        draftRelease: "false",
        token: "randomsequenceofcharactersforsecurity",
      };

      jest.spyOn(core, "getInput").mockImplementation((arg) => input[arg]);
      const octokit = jest
        .spyOn(github, "getOctokit")
        // @ts-ignore
        .mockImplementation((token: string) => ({
          context: { repo: { owner: "genericOwner", repo: "genericRepo" } },
          repos: {
            listReleases: jest.fn().mockResolvedValue({
              data: [
                {
                  draft: true,
                  body: "some stuff",
                  id: 15,
                  tag_name: "package-one-v2.3.1",
                },
                {
                  draft: true,
                  body: "other stuff",
                  id: 22,
                  tag_name: "package-two-v1.9.0",
                },
              ],
            }) as jest.MockedFunction<any>,
            updateRelease: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
            createRelease: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
            uploadReleaseAsset: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
          },
        }));

      const covectoredAction = await run(covector());
      expect(octokit).toHaveBeenCalledWith(input.token);
      const {
        listReleases,
        createRelease,
        updateRelease,
        // @ts-ignore
      } = github.getOctokit.mock.results[0].value.repos;
      expect(listReleases).toHaveBeenCalledWith({
        owner: "genericOwner",
        repo: "genericRepo",
      });
      expect(listReleases).toHaveBeenCalledWith({
        owner: "genericOwner",
        repo: "genericRepo",
      });

      expect(updateRelease).toHaveBeenCalledWith({
        owner: "genericOwner",
        repo: "genericRepo",
        release_id: 15,
        draft: false,
        body:
          "some stuff\n## \\[2.3.1]\n\n- Added some cool things.\n\npublish\n\n",
      });
      expect(updateRelease).toHaveBeenCalledWith({
        owner: "genericOwner",
        repo: "genericRepo",
        release_id: 22,
        draft: false,
        body:
          "other stuff\n## \\[1.9.0]\n\n- Added some even cooler things.\n\npublish\n\n",
      });

      expect(createRelease).toHaveBeenCalledTimes(0);
    }


(token: string) => ({
          context: { repo: { owner: "genericOwner", repo: "genericRepo" } },
          repos: {
            listReleases: jest.fn().mockResolvedValue({
              data: [
                {
                  draft: true,
                  body: "some stuff",
                  id: 15,
                  tag_name: "package-one-v2.3.1",
                },
                {
                  draft: true,
                  body: "other stuff",
                  id: 22,
                  tag_name: "package-two-v1.9.0",
                },
              ],
            }) as jest.MockedFunction<any>,
            updateRelease: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
            createRelease: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
            uploadReleaseAsset: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
          },
        })


async () => {
      const cwd: string = f.copy("integration.js-with-complex-commands");

      const input: { [k: string]: string } = {
        command: "publish",
        cwd: cwd,
        createRelease: "true",
        draftRelease: "false",
        token: "randomsequenceofcharactersforsecurity",
      };

      jest.spyOn(core, "getInput").mockImplementation((arg) => input[arg]);
      const octokit = jest
        .spyOn(github, "getOctokit")
        // @ts-ignore
        .mockImplementation((token: string) => ({
          context: { repo: { owner: "genericOwner", repo: "genericRepo" } },
          repos: {
            listReleases: jest.fn().mockResolvedValue({
              data: [
                {
                  draft: false,
                  body: "some stuff",
                  id: 15,
                  tag_name: "package-one-v2.3.0",
                },
                {
                  draft: false,
                  body: "other stuff",
                  id: 22,
                  tag_name: "package-two-v1.8.7",
                },
              ],
            }) as jest.MockedFunction<any>,
            updateRelease: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
            createRelease: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
            uploadReleaseAsset: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
          },
        }));

      const covectoredAction = await run(covector());
      expect(octokit).toHaveBeenCalledWith(input.token);
      const {
        listReleases,
        createRelease,
        updateRelease,
        // @ts-ignore
      } = github.getOctokit.mock.results[0].value.repos;

      expect(listReleases).toHaveBeenCalledWith({
        owner: "genericOwner",
        repo: "genericRepo",
      });
      expect(listReleases).toHaveBeenCalledWith({
        owner: "genericOwner",
        repo: "genericRepo",
      });

      expect(createRelease).toHaveBeenCalledWith({
        owner: "genericOwner",
        repo: "genericRepo",
        name: "package-one v2.3.1",
        tag_name: "package-one-v2.3.1",
        draft: false,
        body: "## \\[2.3.1]\n\n- Added some cool things.\n\npublish\n\n",
      });
      expect(createRelease).toHaveBeenCalledWith({
        owner: "genericOwner",
        repo: "genericRepo",
        name: "package-two v1.9.0",
        tag_name: "package-two-v1.9.0",
        draft: false,
        body: "## \\[1.9.0]\n\n- Added some even cooler things.\n\npublish\n\n",
      });

      expect(updateRelease).toHaveBeenCalledTimes(0);
    }


(token: string) => ({
          context: { repo: { owner: "genericOwner", repo: "genericRepo" } },
          repos: {
            listReleases: jest.fn().mockResolvedValue({
              data: [
                {
                  draft: false,
                  body: "some stuff",
                  id: 15,
                  tag_name: "package-one-v2.3.0",
                },
                {
                  draft: false,
                  body: "other stuff",
                  id: 22,
                  tag_name: "package-two-v1.8.7",
                },
              ],
            }) as jest.MockedFunction<any>,
            updateRelease: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
            createRelease: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
            uploadReleaseAsset: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
          },
        })


async () => {
      const cwd: string = f.copy("integration.js-with-single-github-release");

      const input: { [k: string]: string } = {
        command: "publish",
        cwd: cwd,
        createRelease: "true",
        draftRelease: "false",
        token: "randomsequenceofcharactersforsecurity",
      };

      jest.spyOn(core, "getInput").mockImplementation((arg) => input[arg]);
      const octokit = jest
        .spyOn(github, "getOctokit")
        // @ts-ignore
        .mockImplementation((token: string) => ({
          context: { repo: { owner: "genericOwner", repo: "genericRepo" } },
          repos: {
            listReleases: jest.fn().mockResolvedValue({
              data: [
                {
                  draft: true,
                  body: "some stuff",
                  id: 15,
                  tag_name: "v2.3.1",
                },
              ],
            }) as jest.MockedFunction<any>,
            updateRelease: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
            createRelease: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
            uploadReleaseAsset: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
          },
        }));

      const covectoredAction = await run(covector());
      expect(octokit).toHaveBeenCalledWith(input.token);
      const {
        listReleases,
        createRelease,
        updateRelease,
        // @ts-ignore
      } = github.getOctokit.mock.results[0].value.repos;
      expect(listReleases).toHaveBeenCalledWith({
        owner: "genericOwner",
        repo: "genericRepo",
      });
      expect(listReleases).toHaveBeenCalledWith({
        owner: "genericOwner",
        repo: "genericRepo",
      });

      expect(updateRelease).toHaveBeenCalledWith({
        owner: "genericOwner",
        repo: "genericRepo",
        release_id: 15,
        draft: false,
        body:
          "some stuff\n## \\[2.3.1]\n\n- Added some cool things.\n\npublish\n\n",
      });

      expect(updateRelease).toHaveBeenCalledTimes(1);
      expect(createRelease).toHaveBeenCalledTimes(0);
    }


(token: string) => ({
          context: { repo: { owner: "genericOwner", repo: "genericRepo" } },
          repos: {
            listReleases: jest.fn().mockResolvedValue({
              data: [
                {
                  draft: true,
                  body: "some stuff",
                  id: 15,
                  tag_name: "v2.3.1",
                },
              ],
            }) as jest.MockedFunction<any>,
            updateRelease: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
            createRelease: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
            uploadReleaseAsset: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
          },
        })


async () => {
      const cwd: string = f.copy("integration.js-with-single-github-release");

      const input: { [k: string]: string } = {
        command: "publish",
        cwd: cwd,
        createRelease: "true",
        draftRelease: "false",
        token: "randomsequenceofcharactersforsecurity",
      };

      jest.spyOn(core, "getInput").mockImplementation((arg) => input[arg]);
      const octokit = jest
        .spyOn(github, "getOctokit")
        // @ts-ignore
        .mockImplementation((token: string) => ({
          context: { repo: { owner: "genericOwner", repo: "genericRepo" } },
          repos: {
            listReleases: jest.fn().mockResolvedValue({
              data: [],
            }) as jest.MockedFunction<any>,
            updateRelease: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
            createRelease: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
            uploadReleaseAsset: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
          },
        }));

      const covectoredAction = await run(covector());
      expect(octokit).toHaveBeenCalledWith(input.token);
      const {
        listReleases,
        createRelease,
        updateRelease,
        // @ts-ignore
      } = github.getOctokit.mock.results[0].value.repos;

      expect(listReleases).toHaveBeenCalledWith({
        owner: "genericOwner",
        repo: "genericRepo",
      });
      expect(listReleases).toHaveBeenCalledWith({
        owner: "genericOwner",
        repo: "genericRepo",
      });

      expect(createRelease).toHaveBeenCalledWith({
        owner: "genericOwner",
        repo: "genericRepo",
        name: "package-one v2.3.1",
        tag_name: "v2.3.1",
        draft: false,
        body: "## \\[2.3.1]\n\n- Added some cool things.\n\npublish\n\n",
      });

      expect(createRelease).toHaveBeenCalledTimes(1);
      expect(updateRelease).toHaveBeenCalledTimes(0);
    }


(token: string) => ({
          context: { repo: { owner: "genericOwner", repo: "genericRepo" } },
          repos: {
            listReleases: jest.fn().mockResolvedValue({
              data: [],
            }) as jest.MockedFunction<any>,
            updateRelease: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
            createRelease: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
            uploadReleaseAsset: jest
              .fn()
              .mockImplementation((input) => Promise.resolve({ data: input })),
          },
        })


/**
 *

 *          Returns the direct dependencies for a package version. The dependencies are returned as
 *
 *                PackageDependency
 *
 *           objects. CodeArtifact extracts the dependencies for a package version from the metadata file for the package
 *           format (for example, the package.json file for npm packages and the pom.xml file
 *         for Maven). Any package version dependencies that are not listed in the configuration file are not returned.
 *

 */
export class ListPackageVersionDependenciesCommand extends $Command<
  ListPackageVersionDependenciesCommandInput,
  ListPackageVersionDependenciesCommandOutput,
  CodeartifactClientResolvedConfig
> {
  // Start section: command_properties
  // End section: command_properties

  constructor(readonly input: ListPackageVersionDependenciesCommandInput) {
    // Start section: command_constructor
    super();
    // End section: command_constructor
  }

  /**
   * @internal
   */
  resolveMiddleware(
    clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
    configuration: CodeartifactClientResolvedConfig,
    options?: __HttpHandlerOptions
  ): Handler<ListPackageVersionDependenciesCommandInput, ListPackageVersionDependenciesCommandOutput> {
    this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));

    const stack = clientStack.concat(this.middlewareStack);

    const { logger } = configuration;
    const clientName = "CodeartifactClient";
    const commandName = "ListPackageVersionDependenciesCommand";
    const handlerExecutionContext: HandlerExecutionContext = {
      logger,
      clientName,
      commandName,
      inputFilterSensitiveLog: ListPackageVersionDependenciesRequest.filterSensitiveLog,
      outputFilterSensitiveLog: ListPackageVersionDependenciesResult.filterSensitiveLog,
    };
    const { requestHandler } = configuration;
    return stack.resolve(
      (request: FinalizeHandlerArguments<any>) =>
        requestHandler.handle(request.request as __HttpRequest, options || {}),
      handlerExecutionContext
    );
  }

  private serialize(
    input: ListPackageVersionDependenciesCommandInput,
    context: __SerdeContext
  ): Promise<__HttpRequest> {
    return serializeAws_restJson1ListPackageVersionDependenciesCommand(input, context);
  }

  private deserialize(
    output: __HttpResponse,
    context: __SerdeContext
  ): Promise<ListPackageVersionDependenciesCommandOutput> {
    return deserializeAws_restJson1ListPackageVersionDependenciesCommand(output, context);
  }

  // Start section: command_body_extra
  // End section: command_body_extra
}


export type ListPackageVersionDependenciesCommandInput = ListPackageVersionDependenciesRequest;


export type ListPackageVersionDependenciesCommandOutput = ListPackageVersionDependenciesResult & __MetadataBearer;


/**
   * @internal
   */
resolveMiddleware(
    clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
    configuration: CodeartifactClientResolvedConfig,
    options?: __HttpHandlerOptions
  ): Handler<ListPackageVersionDependenciesCommandInput, ListPackageVersionDependenciesCommandOutput> {
    this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));

    const stack = clientStack.concat(this.middlewareStack);

    const { logger } = configuration;
    const clientName = "CodeartifactClient";
    const commandName = "ListPackageVersionDependenciesCommand";
    const handlerExecutionContext: HandlerExecutionContext = {
      logger,
      clientName,
      commandName,
      inputFilterSensitiveLog: ListPackageVersionDependenciesRequest.filterSensitiveLog,
      outputFilterSensitiveLog: ListPackageVersionDependenciesResult.filterSensitiveLog,
    };
    const { requestHandler } = configuration;
    return stack.resolve(
      (request: FinalizeHandlerArguments<any>) =>
        requestHandler.handle(request.request as __HttpRequest, options || {}),
      handlerExecutionContext
    );
  }


private serialize(
    input: ListPackageVersionDependenciesCommandInput,
    context: __SerdeContext
  ): Promise<__HttpRequest> {
    return serializeAws_restJson1ListPackageVersionDependenciesCommand(input, context);
  }


private deserialize(
    output: __HttpResponse,
    context: __SerdeContext
  ): Promise<ListPackageVersionDependenciesCommandOutput> {
    return deserializeAws_restJson1ListPackageVersionDependenciesCommand(output, context);
  }


<T>(parser: Parser<T>) => seq([inputStart, parser])


<T>(parser: Parser<T>) => seq([parser, inputEnd])


(parser: Parser<string>) =>
    seq([lineStart, parser, lineEnd])


<T>(parser: Parser<T>) =>
    seq([inputStart, parser, inputEnd])


(output: any) => output


export class TagResourceCommand extends $Command<
  TagResourceCommandInput,
  TagResourceCommandOutput,
  KMSClientResolvedConfig
> {
  // Start section: command_properties
  // End section: command_properties

  constructor(readonly input: TagResourceCommandInput) {
    // Start section: command_constructor
    super();
    // End section: command_constructor
  }

  resolveMiddleware(
    clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
    configuration: KMSClientResolvedConfig,
    options?: __HttpHandlerOptions
  ): Handler<TagResourceCommandInput, TagResourceCommandOutput> {
    this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));

    const stack = clientStack.concat(this.middlewareStack);

    const { logger } = configuration;
    const handlerExecutionContext: HandlerExecutionContext = {
      logger,
      inputFilterSensitiveLog: TagResourceRequest.filterSensitiveLog,
      outputFilterSensitiveLog: (output: any) => output,
    };
    const { requestHandler } = configuration;
    return stack.resolve(
      (request: FinalizeHandlerArguments<any>) =>
        requestHandler.handle(request.request as __HttpRequest, options || {}),
      handlerExecutionContext
    );
  }

  private serialize(input: TagResourceCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
    return serializeAws_json1_1TagResourceCommand(input, context);
  }

  private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<TagResourceCommandOutput> {
    return deserializeAws_json1_1TagResourceCommand(output, context);
  }

  // Start section: command_body_extra
  // End section: command_body_extra
}


export type TagResourceCommandInput = TagResourceRequest;


export type TagResourceCommandOutput = __MetadataBearer;


resolveMiddleware(
    clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
    configuration: KMSClientResolvedConfig,
    options?: __HttpHandlerOptions
  ): Handler<TagResourceCommandInput, TagResourceCommandOutput> {
    this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));

    const stack = clientStack.concat(this.middlewareStack);

    const { logger } = configuration;
    const handlerExecutionContext: HandlerExecutionContext = {
      logger,
      inputFilterSensitiveLog: TagResourceRequest.filterSensitiveLog,
      outputFilterSensitiveLog: (output: any) => output,
    };
    const { requestHandler } = configuration;
    return stack.resolve(
      (request: FinalizeHandlerArguments<any>) =>
        requestHandler.handle(request.request as __HttpRequest, options || {}),
      handlerExecutionContext
    );
  }


private serialize(input: TagResourceCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
    return serializeAws_json1_1TagResourceCommand(input, context);
  }


private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<TagResourceCommandOutput> {
    return deserializeAws_json1_1TagResourceCommand(output, context);
  }


@NgModule({
    declarations: [FormComponent, ListComponent],
    imports: [CommonModule, ClientsRoutingModule, FormsModule],
    exports: [FormComponent, ListComponent],
})
export class ClientsModule {}


(router: Router): void => {
  router.route('/survey')
    .post(adaptMiddleware(makeAuthMiddleware('admin')), adaptController(makeAddSurveyController()))
    .get(adaptMiddleware(makeAuthMiddleware()), adaptController(makeListSurveysController()))
}


function test_fetchRetryWithUrlString() {
    const options: fetchRetry.Options = {
        retryOptions: {
            retryMaxDuration: 10000,
            retryInitialDelay: 3000,
            retryOnHttpResponse: (_response: Response): boolean => (true),
            retryBackoff: 2,
            socketTimeout: 60000,
            forceSocketTimeout: false
        }
    };

    fetchRetry("http://something.com/", options);
}


function test_fetchRetryWithRequestString() {
    const request = new Request("http://something.com", {
        method: "GET",
        headers: {
            "Content-Type" : "application/json"
        }
    });

    const options: fetchRetry.Options = {
        retryOptions: {
            retryMaxDuration: 10000,
            retryInitialDelay: 3000,
            retryOnHttpResponse: (_response: Response): boolean => true,
            retryBackoff: 2,
            socketTimeout: 60000,
            forceSocketTimeout: false,
        },
    };

    fetchRetry(request, options);
}


function test_fetchRetryWithUrlStringAndFurtherOptions() {
    const options: fetchRetry.Options = {
        headers: {
            "Content-Type" : "application/json"
        },
        method: "GET",
        retryOptions: {
            retryMaxDuration: 10000,
            retryInitialDelay: 3000,
            retryOnHttpResponse: (_response: Response): boolean => true,
            retryBackoff: 2,
            socketTimeout: 60000,
            forceSocketTimeout: false,
        },
    };

    fetchRetry('http://something.com/', options);
}


(_response: Response): boolean => (true)


(_response: Response): boolean => true


export type UserState = {
    voice: boolean;
    unmuted: boolean;
    raised_hand: number;
}


() => {
  it('checkMissingSteamIds', async () => {
    const players = [
      createPlayer('Test1', '1'),
      createPlayer('Test2', '2'),
      createPlayer('Test3', '3'),
      createPlayer('Test4', '4'),
    ];
    players[0].setSteamId('123');

    const res = await checkMissingSteamIds(players);
    expect(res.length).toEqual(3);
  });
  afterAll(() => {
    getClientReference().destroy();
  });
}


async () => {
    const players = [
      createPlayer('Test1', '1'),
      createPlayer('Test2', '2'),
      createPlayer('Test3', '3'),
      createPlayer('Test4', '4'),
    ];
    players[0].setSteamId('123');

    const res = await checkMissingSteamIds(players);
    expect(res.length).toEqual(3);
  }


() => {
    getClientReference().destroy();
  }


(config: BudgetsClientConfig) => {
  const browserDefaults = getBrowserRuntimeConfig(config);
  return {
    ...browserDefaults,
    ...config,
    runtime: "react-native",
    sha256: config?.sha256 ?? Sha256,
  };
}


() => {
  it('rejects with left if TaskEither is left', async () => {
    const task = tryCatch(() => Promise.reject(new Error('whoops')), String);

    await expect(toPromise(task)).rejects.toEqual('Error: whoops');
  });

  it('resolves with right if TaskEither is right', async () => {
    const task = tryCatch(() => Promise.resolve('success'), String);

    await expect(toPromise(task)).resolves.toEqual('success');
  });
}


async () => {
    const task = tryCatch(() => Promise.reject(new Error('whoops')), String);

    await expect(toPromise(task)).rejects.toEqual('Error: whoops');
  }


() => Promise.reject(new Error('whoops'))


async () => {
    const task = tryCatch(() => Promise.resolve('success'), String);

    await expect(toPromise(task)).resolves.toEqual('success');
  }


() => Promise.resolve('success')


export class HelloWorldTask extends TaskBase<IMessage> {
  public async execute(message: IMessage): Promise<IMessage> {
    const { properties } = message;

    console.log(`Executing task: ${properties.activityId}`);
    console.log(`${properties.bpmnProcessId}::${properties.processInstanceId} Servus!`);

    const response = await axios.get('https://jsonplaceholder.typicode.com/todos/1');

    console.log('\ndata:');
    console.log(response.data);

    return message;
  }
}


public async execute(message: IMessage): Promise<IMessage> {
    const { properties } = message;

    console.log(`Executing task: ${properties.activityId}`);
    console.log(`${properties.bpmnProcessId}::${properties.processInstanceId} Servus!`);

    const response = await axios.get('https://jsonplaceholder.typicode.com/todos/1');

    console.log('\ndata:');
    console.log(response.data);

    return message;
  }


export default function shuffle<T>(a: Array<T>): Array<T> {
  let j, x, i;
  for (i = a.length - 1; i > 0; i--) {
    j = Math.floor(Math.random() * (i + 1));
    x = a[i];
    a[i] = a[j];
    a[j] = x;
  }
  return a;
}


() => {
  beforeEach(() => {
    TestBed.configureTestingModule({
      providers: [AdminAuthGuardService]
    });
  });

  it('should be created', inject([AdminAuthGuardService], (service: AdminAuthGuardService) => {
    expect(service).toBeTruthy();
  }));
}


() => {
    TestBed.configureTestingModule({
      providers: [AdminAuthGuardService]
    });
  }


(service: AdminAuthGuardService) => {
    expect(service).toBeTruthy();
  }


@Component({
  selector: 'app-post',
  templateUrl: './post.component.html',
  styleUrls: ['./post.component.scss']
})
export class PostComponent implements OnInit {

  constructor(public override:OverrideService) { }

  ngOnInit(): void {
  }

}


export declare function GetChildIndex<T extends IGameObject>(child: T): number;


export function generateUUID(): string {
  return crypto.randomBytes(16).toString('hex');
}


async ({ context }, use) => {
    await context.addInitScript(() =>
      window.addEventListener('beforeunload', () =>
        (window as any).collectIstanbulCoverage(JSON.stringify((window as any).__coverage__))
      ),
    );
    await fs.promises.mkdir(istanbulCLIOutput, { recursive: true });
    await context.exposeFunction('collectIstanbulCoverage', (coverageJSON: string) => {
      if (coverageJSON)
        fs.writeFileSync(path.join(istanbulCLIOutput, `playwright_coverage_${generateUUID()}.json`), coverageJSON);
    });
    await use(context);
    for (const page of context.pages()) {
      await page.evaluate(() => (window as any).collectIstanbulCoverage(JSON.stringify((window as any).__coverage__)))
      await page.close();
    }
  }


() =>
      window.addEventListener('beforeunload', () =>
        (window as any).collectIstanbulCoverage(JSON.stringify((window as any).__coverage__))
      )


() =>
        (window as any).collectIstanbulCoverage(JSON.stringify((window as any).__coverage__))


(coverageJSON: string) => {
      if (coverageJSON)
        fs.writeFileSync(path.join(istanbulCLIOutput, `playwright_coverage_${generateUUID()}.json`), coverageJSON);
    }


() => (window as any).collectIstanbulCoverage(JSON.stringify((window as any).__coverage__))


frame => JSON.stringify(frame)


export class Recorder {
  private isPaused: boolean = false;
  private childProcess: pty.IPty;
  private onDataHandlers: ((data: string) => void)[] = [];
  private onExitHandlers: ((exitCode: number, signal: string | number) => void)[] = [];
  private startTime: number;
  private recording: Recording;
  private cwd: string;
  private exitCode: number | undefined;
  constructor(
    private cmd: string,
    private args: string[],
    private options: any,
    cwd?: string,
    private cols: number = 120,
    private rows: number = 30,
  ) {
    this.exitCode = undefined;
    this.cwd = options.cwd || process.cwd();
    this.recording = {
      header: {
        version: 2,
        width: cols,
        height: rows,
        timestamp: null,
        title: 'Recording',
        env: {},
      },
      frames: [],
    };
  }

  run() {
    this.startTime = Date.now();
    if (this.exitCode !== undefined) {
      throw new Error('Already executed. Please start a new instance');
    }
    this.childProcess = pty.spawn(this.cmd, this.args, {
      name: 'xterm-color',
      cols: this.cols,
      rows: this.rows,
      cwd: this.cwd,
      ...this.options,
    });
    this.addFrame(this.renderPrompt(this.cwd, this.cmd, this.args));
    this.childProcess.onData(this.onData.bind(this));
    this.childProcess.onExit(this.onExit.bind(this));
  }

  write(data: string): void {
    if (this.childProcess && this.exitCode === undefined) {
      this.childProcess.write(data);
      return;
    }
    throw new Error('Can not write data. Program is either already executed or has not been run');
  }

  addOnDataHandler(fn: (content: string) => void) {
    this.onDataHandlers.push(fn);
  }

  addOnExitHandlers(fn: (code: number, signal: string | number) => void) {
    this.onExitHandlers.push(fn);
  }
  removeOnExitHandlers(fn: (code: number, signal: string | number) => void): boolean {
    const idx = this.onExitHandlers.indexOf(fn);
    if (idx === -1) {
      return false;
    }
    this.onExitHandlers.splice(idx, 1);
    return true;
  }

  getRecording(): string {
    return [JSON.stringify(this.recording.header), ...this.recording.frames.map(frame => JSON.stringify(frame))].join('\n');
  }

  pauseRecording(): void {
    this.isPaused = true;
  }

  kill() {
    this.childProcess.kill();
  }

  sendEof() {
    this.childProcess.write('\x04'); // ^D
  }

  resumeRecording(): void {
    this.isPaused = false;
  }

  private onData(data: string) {
    if (!this.isPaused) {
      this.addFrame(data);
    }
    for (let handler of this.onDataHandlers) {
      try {
        handler(data);
      } catch (e) {
        // swallow
      }
    }
  }

  private onExit(status: { exitCode: number; signal: string | number }) {
    this.exitCode = status.exitCode;
    const length = (Date.now() - this.startTime) / 1000;
    this.addFrame(this.renderPrompt(this.cwd));
    this.recording.header.timestamp = length;
    for (let handler of this.onExitHandlers) {
      try {
        handler(this.exitCode, status.signal);
      } catch (e) {
        // don't crash the recorder
      }
    }
  }

  private addFrame(data: string) {
    this.recording.frames.push([(Date.now() - this.startTime) / 1000, 'o', data]);
  }

  private renderPrompt(cwd: string, cmd?: string, args?: string[]) {
    const separator = '\u2b80';
    const basePrompt = `${chalk.bgBlack('user@host') + chalk.black(separator)}${chalk.bgBlue(cwd) + chalk.blue(separator)}`;
    const cmdPrompt = cmd ? `${cmd} ${args.length ? args.join(' ') : ''}` : '';
    return `${basePrompt} ${cmdPrompt}\r\n`;
  }
}


export type RecordingHeader = {
  version: 2;
  width: number;
  height: number;
  timestamp: number | null;
  title: string;
  env: any;
};


export type RecordingFrame = [number, 'o' | 'i', string];


export type Recording = {
  header: RecordingHeader;
  frames: RecordingFrame[];
};


run() {
    this.startTime = Date.now();
    if (this.exitCode !== undefined) {
      throw new Error('Already executed. Please start a new instance');
    }
    this.childProcess = pty.spawn(this.cmd, this.args, {
      name: 'xterm-color',
      cols: this.cols,
      rows: this.rows,
      cwd: this.cwd,
      ...this.options,
    });
    this.addFrame(this.renderPrompt(this.cwd, this.cmd, this.args));
    this.childProcess.onData(this.onData.bind(this));
    this.childProcess.onExit(this.onExit.bind(this));
  }


write(data: string): void {
    if (this.childProcess && this.exitCode === undefined) {
      this.childProcess.write(data);
      return;
    }
    throw new Error('Can not write data. Program is either already executed or has not been run');
  }


addOnDataHandler(fn: (content: string) => void) {
    this.onDataHandlers.push(fn);
  }


addOnExitHandlers(fn: (code: number, signal: string | number) => void) {
    this.onExitHandlers.push(fn);
  }


removeOnExitHandlers(fn: (code: number, signal: string | number) => void): boolean {
    const idx = this.onExitHandlers.indexOf(fn);
    if (idx === -1) {
      return false;
    }
    this.onExitHandlers.splice(idx, 1);
    return true;
  }


getRecording(): string {
    return [JSON.stringify(this.recording.header), ...this.recording.frames.map(frame => JSON.stringify(frame))].join('\n');
  }


pauseRecording(): void {
    this.isPaused = true;
  }


kill() {
    this.childProcess.kill();
  }


sendEof() {
    this.childProcess.write('\x04'); // ^D
  }


resumeRecording(): void {
    this.isPaused = false;
  }


private onData(data: string) {
    if (!this.isPaused) {
      this.addFrame(data);
    }
    for (let handler of this.onDataHandlers) {
      try {
        handler(data);
      } catch (e) {
        // swallow
      }
    }
  }


private onExit(status: { exitCode: number; signal: string | number }) {
    this.exitCode = status.exitCode;
    const length = (Date.now() - this.startTime) / 1000;
    this.addFrame(this.renderPrompt(this.cwd));
    this.recording.header.timestamp = length;
    for (let handler of this.onExitHandlers) {
      try {
        handler(this.exitCode, status.signal);
      } catch (e) {
        // don't crash the recorder
      }
    }
  }


private addFrame(data: string) {
    this.recording.frames.push([(Date.now() - this.startTime) / 1000, 'o', data]);
  }


private renderPrompt(cwd: string, cmd?: string, args?: string[]) {
    const separator = '\u2b80';
    const basePrompt = `${chalk.bgBlack('user@host') + chalk.black(separator)}${chalk.bgBlue(cwd) + chalk.blue(separator)}`;
    const cmdPrompt = cmd ? `${cmd} ${args.length ? args.join(' ') : ''}` : '';
    return `${basePrompt} ${cmdPrompt}\r\n`;
  }


export interface IGraphRequestModel {
    component_id: string;
    nodes: IGraphRequestModel[];
}


export function getStylesFromClasses(
  names: string | string[],
  elementType: string = 'div'
): { [key: string]: string | number } {
  let elem = document.createElement(elementType);
  (typeof names == 'string' ? [names] : names).forEach(c => elem.classList.add(c));
  let result = {};
  for (let i = 0; i < document.styleSheets.length; i++) {
    let sheet = document.styleSheets[i] as CSSStyleSheet;
    let rules = sheet.rules || sheet.cssRules;
    for (let j = 0; j < rules.length; j++) {
      if (rules[j].type == CSSRule.STYLE_RULE) {
        let styleRule = rules[j] as CSSStyleRule;
        if (elem.matches(styleRule.selectorText)) {
          for (let k = 0; k < styleRule.style.length; k++) {
            result[styleRule.style[k]] = styleRule.style[styleRule.style[k]];
          }
        }
      }
    }
  }
  return result;
}


c => elem.classList.add(c)


export class RequestsRepository {
  // @ts-ignore
  constructor(private baseurl: string) {
  }
}


(item: any) => !item.isLayout


(item: any, index: number) => (
                  <Route key={index}


class EventLayout extends React.Component<any> {
  render() {
    const {
      location: { pathname },
    } = this.props;

    return (
      <DocumentTitle title={utils.getPageTitle(pathname)}>
        <Col className="container">

              <LanguageSelect />

            <Switch>
              {userRouter
                .filter((item: any) => !item.isLayout)
                .map((item: any, index: number) => (
                  <Route key={index} path={item.path} component={item.component} exact={item.exact} />
                ))}

              <Redirect from="/user" to="/user/login" />
            </Switch>

        </Col>
      </DocumentTitle>
    );
  }
}


render() {
    const {
      location: { pathname },
    } = this.props;

    return (
      <DocumentTitle title={utils.getPageTitle(pathname)}>
        <Col className="container">

              <LanguageSelect />

            <Switch>
              {userRouter
                .filter((item: any) => !item.isLayout)
                .map((item: any, index: number) => (
                  <Route key={index} path={item.path} component={item.component} exact={item.exact} />
                ))}

              <Redirect from="/user" to="/user/login" />
            </Switch>

        </Col>
      </DocumentTitle>
    );
  }


@ObjectType()
class Category {
  @Field()
  name: String;
  @Field()
  description: String;
  @Field()
  _id: String;
}


() => {
    console.log('meow');
    // return 'meow';
  }


() => {
    console.log('bark');
  }


// taken from: https://github.com/heruan/aurelia-breadcrumbs
@au.customElement("md-breadcrumbs")
@au.autoinject
export class MdBreadcrumbs {
	constructor(private element: Element, private aureliaRouter: au.Router) { }

	@au.bindable
	router: au.Router;

	childRouter: au.Router;

	bind() {
		if (!this.router) {
			this.router = this.aureliaRouter;
		}
		this.childRouter = this.router;
		let router = this.router;
		while (router.parent) {
			router = router.parent;
		}
		this.router = router;
	}

	navigate(navigationInstruction: au.NavigationInstruction) {
		this.childRouter.navigateToRoute(navigationInstruction.config.name);
	}
}


bind() {
		if (!this.router) {
			this.router = this.aureliaRouter;
		}
		this.childRouter = this.router;
		let router = this.router;
		while (router.parent) {
			router = router.parent;
		}
		this.router = router;
	}


navigate(navigationInstruction: au.NavigationInstruction) {
		this.childRouter.navigateToRoute(navigationInstruction.config.name);
	}


export interface TabItem {
  name: string;
  url: string;
}


export interface TabGroup {
  id: string;
  name: string;
  tabs: TabItem[];
}


export interface StorageConfig {
  lang: Lang;
  theme: Theme;
  tabs: TabGroup[];
}


export type Theme = 'light' | 'dark' | 'system';


export type Lang = 'EN' | 'CN';


@Module({
  imports: [],
  controllers: [UsersController],
  providers: [],
})
export class AppModule { }


/**
 * A concrete Geometry for supporting drawArrays.
 */
export declare class GeometryArrays extends GeometryBase {
    /**
     *
     */
    private mode;
    /**
     * The first parameter in the drawArrays call.
     * This is currently hard-code to zero because this class only supportes buffering one primitive.
     */
    private first;
    /**
     * The count parameter in the drawArrays call.
     * This is currently maintained at this level because this class only supportes buffering one primitive.
     */
    private count;
    /**
     * The number of bytes for each element.
     *
     * This is used in the vertexAttribPointer method.
     * Normally, we will use gl.FLOAT for each number which takes 4 bytes.
     */
    private stride;
    /**
     *
     */
    private pointers;
    /**
     *
     */
    private vbo;
    /**
     *
     */
    constructor(contextManager: ContextManager, primitive: Primitive, options?: {
        order?: string[];
    }, levelUp?: number);
    /**
     *
     */
    protected resurrector(levelUp: number): void;
    /**
     *
     */
    protected destructor(levelUp: number): void;
    bind(material: Material): this;
    draw(): this;
    unbind(material: Material): this;
}


/**
     *
     */
protected resurrector(levelUp: number): void;


/**
     *
     */
protected destructor(levelUp: number): void;


bind(material: Material): this;


draw(): this;


unbind(material: Material): this;


export interface AccessoriesInterface {
    id: number;
    name: string;
    owner: number;
}


() => NovoChipsElement


(result) => {
          for (const value of result) {
            if (value.hasOwnProperty('label')) {
              this.items.push({
                value,
                label: value.label,
              });
            } else if (this.source.options && Array.isArray(this.source.options)) {
              this.items.push(this.getLabelFromOptions(value));
            } else {
              this.items.push(value);
            }
          }
          this._items.next(this.items);
        }


(val) => val.value === value


(val) => val.value === value.id


(i) => i.value


@Component({
  selector: 'chip,novo-chip',
  template: `

            <ng-content></ng-content>

    `,
})
export class NovoChipElement {
  @Input()
  set type(type: string) {
    this._type = type ? type.toLowerCase() : null;
  }

  @Input()
  disabled: boolean = false;

  @Output()
  select: EventEmitter<any> = new EventEmitter();
  @Output()
  remove: EventEmitter<any> = new EventEmitter();
  @Output()
  deselect: EventEmitter<any> = new EventEmitter();

  entity: string;
  _type: string;

  onRemove(e) {
    if (e) {
      e.stopPropagation();
      e.preventDefault();
    }
    this.remove.emit(e);
    return false;
  }

  onSelect(e) {
    if (e) {
      e.stopPropagation();
      e.preventDefault();
    }
    this.select.emit(e);
    return false;
  }

  onDeselect(e) {
    if (e) {
      e.stopPropagation();
      e.preventDefault();
    }
    this.deselect.emit(e);
    return false;
  }
}


onRemove(e) {
    if (e) {
      e.stopPropagation();
      e.preventDefault();
    }
    this.remove.emit(e);
    return false;
  }


onSelect(e) {
    if (e) {
      e.stopPropagation();
      e.preventDefault();
    }
    this.select.emit(e);
    return false;
  }


onDeselect(e) {
    if (e) {
      e.stopPropagation();
      e.preventDefault();
    }
    this.deselect.emit(e);
    return false;
  }


ngOnInit() {
    this.setItems();
  }


clearValue() {
    this.items = [];
    this._items.next(this.items);
    this.value = null;
    this.changed.emit({ value: this.value, rawValue: this.items });
    this.onModelChange(this.value);
  }


setItems() {
    this.items = [];
    if (this.model && Array.isArray(this.model)) {
      const noLabels = [];
      for (const value of this.model) {
        let label;
        if (this.source && this.source.format && Helpers.validateInterpolationProps(this.source.format, value)) {
          label = Helpers.interpolate(this.source.format, value);
        }
        if (this.source && label && label !== this.source.format) {
          this.items.push({
            value,
            label,
          });
        } else if (this.source.getLabels && typeof this.source.getLabels === 'function') {
          noLabels.push(value);
        } else if (this.source.options && Array.isArray(this.source.options)) {
          this.items.push(this.getLabelFromOptions(value));
        } else if (this.source.categoryMap && this.source.categoryMap.size) {
          this.items.push(value);
        } else {
          this.items.push({
            value,
            label: value,
          });
        }
      }
      if (noLabels.length > 0 && this.source && this.source.getLabels && typeof this.source.getLabels === 'function') {
        this.source.getLabels(noLabels).then((result) => {
          for (const value of result) {
            if (value.hasOwnProperty('label')) {
              this.items.push({
                value,
                label: value.label,
              });
            } else if (this.source.options && Array.isArray(this.source.options)) {
              this.items.push(this.getLabelFromOptions(value));
            } else {
              this.items.push(value);
            }
          }
          this._items.next(this.items);
        });
      }
    }
    this.changed.emit({ value: this.model, rawValue: this.items });
    this._items.next(this.items);
  }


getLabelFromOptions(value) {
    let id = value;
    let optLabel = this.source.options.find((val) => val.value === value);
    if (!optLabel && value.hasOwnProperty('id')) {
      optLabel = this.source.options.find((val) => val.value === value.id);
      id = value.id;
    }
    return {
      value: id,
      label: optLabel ? optLabel.label : value,
    };
  }


deselectAll(event?) {
    this.selected = null;
    this.hidePreview();
  }


select(event?, item?) {
    this.blur.emit(event);
    this.deselectAll();
    this.selected = item;
    this.showPreview();
  }


deselect(event?, item?) {
    this.blur.emit(event);
    this.deselectAll();
  }


onTyping(event?) {
    this.typing.emit(event);
  }


onFocus(event?) {
    this.deselectAll();
    this.element.nativeElement.classList.add('selected');
    this.focus.emit(event);
  }


add(event) {
    if (event && !(event instanceof Event)) {
      this.items.push(event);
      this.value = this.source && this.source.valueFormatter ? this.source.valueFormatter(this.items) : this.items.map((i) => i.value);
      // Set focus on the picker
      const input = this.element.nativeElement.querySelector('novo-picker > input');
      if (input) {
        input.focus();
      }
    }
    this._items.next(this.items);
  }


remove(event, item) {
    if (event) {
      event.stopPropagation();
      event.preventDefault();
    }
    this.items.splice(this.items.indexOf(item), 1);
    this.deselectAll();
    this.value = this.source && this.source.valueFormatter ? this.source.valueFormatter(this.items) : this.items.map((i) => i.value);
    this.changed.emit({ value: this.value.length ? this.value : '', rawValue: this.items });
    this.onModelChange(this.value.length ? this.value : '');
    this._items.next(this.items);
  }


onKeyDown(event) {
    if (event.keyCode === KeyCodes.BACKSPACE) {
      if (event.target && event.target.value.length === 0 && this.items.length) {
        if (event) {
          event.stopPropagation();
          event.preventDefault();
        }
        if (this.selected) {
          this.remove(event, this.selected);
        } else {
          this.select(event, this.items[this.items.length - 1]);
        }
      }
    }
  }


// Set touched on blur
onTouched(e) {
    this.element.nativeElement.classList.remove('selected');
    this.onModelTouched();
    this.blur.emit(e);
  }


writeValue(model: any): void {
    this.model = model;
    this.setItems();
  }


registerOnChange(fn: Function): void {
    this.onModelChange = fn;
  }


registerOnTouched(fn: Function): void {
    this.onModelTouched = fn;
  }


setDisabledState(disabled: boolean): void {
    this._disablePickerInput = disabled;
  }


/**
   * @description This method creates an instance of the preview (called popup) and adds all the bindings to that
   * instance. Will reuse the popup or create a new one if it does not already exist. Will only work if there is
   * a previewTemplate given in the config.
   */
showPreview() {
    if (this.source.previewTemplate) {
      if (!this.popup) {
        this.popup = this.componentUtils.append(this.source.previewTemplate, this.preview);
      }
      this.popup.instance.match = this.selected;
    }
  }


/**
   * @description - This method deletes the preview popup from the DOM.
   */
hidePreview() {
    if (this.popup) {
      this.popup.destroy();
      this.popup = null;
    }
  }


/*
 * application/x-www-form-urlencoded代表参数以键值对传递给后台
 * application/json代表参数以json字符串传递给后台
 * */
function normalizeHeaderName(headers: any, normalizedName: string): void {
  if (!headers) {
    return
  }
  Object.keys(headers).forEach(name => {
    if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
      headers[normalizedName] = headers[name]
      delete headers[name]
    }
  })
}


export function processHeaders(headers: any, data: any): any {
  normalizeHeaderName(headers, 'Content-Type')

  if (isPlainObject(data)) {
    if (headers && !headers['Content-Type']) {
      headers['Content-Type'] = 'application/json;charset=utf-8'
    }
  }
  return headers
}


export function parseHeaders(headers: string): any {
  let parsed = Object.create(null)
  if (!headers) {
    return parsed
  }

  headers.split('\r\n').forEach(line => {
    let [key, val] = line.split(':')
    key = key.trim().toLowerCase()
    if (!key) {
      return
    }
    if (val) {
      val = val.trim()
    }
    parsed[key] = val
  })

  return parsed
}


name => {
    if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
      headers[normalizedName] = headers[name]
      delete headers[name]
    }
  }


line => {
    let [key, val] = line.split(':')
    key = key.trim().toLowerCase()
    if (!key) {
      return
    }
    if (val) {
      val = val.trim()
    }
    parsed[key] = val
  }


// Ids is a JavaScript project, but we define TypeScript declarations so we can
// confirm our code is type safe, and to support TypeScript users.
export default class IdsSwitch extends HTMLElement {
  /** Sets the checked state to true or false */
  checked: boolean;

  /** Sets checkbox to disabled * */
  disabled: boolean;

  /** Sets the checkbox label text * */
  label: string;

  /** Sets the checkbox label font size (rarely used) * */
  labelFontSize: 10 | 12 | 14 | 16 | 20 | 24 | 28 | 32 | 40 | 48 | 60 | 72 |
    'xs' | 'sm ' | 'lg' | 'xl' | string | number;

  /** Sets the checkbox `value` attribute * */
  value: string;
}


(games: GameModel[]) => {
        this.games = games;
        this.performFilter(this.parentListFilter);
      }

angular 8/Demos/08 child components/game-catalog/src/app/games/game-list/game-list.component.ts


(g: GameModel) => g.name.toLocaleLowerCase()
            .indexOf(filterBy.toLocaleLowerCase()) !== -1


@Component({
  selector: 'app-game-list',
  templateUrl: './game-list.component.html',
  styleUrls: ['./game-list.component.css']
})
export class GameListComponent implements OnInit, AfterViewInit {
  includeDetail = true;
  showImage: boolean;
  imageWidth = 50;
  imageMargin = 2;

  @ViewChild(CriteriaComponent, { static: false })filterComponent: CriteriaComponent;
  parentListFilter;

  filteredGames: GameModel[];
  games: GameModel[];

  constructor(private gameService: GameService) {

  }

  ngAfterViewInit(): void {
    this.parentListFilter = this.filterComponent.listFilter;
  }

  ngOnInit() {
    this.gameService.getGames().subscribe(
      (games: GameModel[]) => {
        this.games = games;
        this.performFilter(this.parentListFilter);
      }
    )
  }

  onValueChange(value: string): void {
    this.performFilter(value);
  }

  performFilter(filterBy?: string): void {
    if (filterBy) {
      this.filteredGames = this.games
        .filter(
          (g: GameModel) => g.name.toLocaleLowerCase()
            .indexOf(filterBy.toLocaleLowerCase()) !== -1
        );
    } else {
      this.filteredGames = this.games;
    }
  }

  toggleImage(): void {
    this.showImage = !this.showImage;
  }
}


ngAfterViewInit(): void {
    this.parentListFilter = this.filterComponent.listFilter;
  }


ngOnInit() {
    this.gameService.getGames().subscribe(
      (games: GameModel[]) => {
        this.games = games;
        this.performFilter(this.parentListFilter);
      }
    )
  }


onValueChange(value: string): void {
    this.performFilter(value);
  }


performFilter(filterBy?: string): void {
    if (filterBy) {
      this.filteredGames = this.games
        .filter(
          (g: GameModel) => g.name.toLocaleLowerCase()
            .indexOf(filterBy.toLocaleLowerCase()) !== -1
        );
    } else {
      this.filteredGames = this.games;
    }
  }


toggleImage(): void {
    this.showImage = !this.showImage;
  }


class TodoApi {
    public static prefix = '/todos';
    public fetchTodo(userId: string) {
        return request.get(`${TodoApi.prefix}/${userId}/all`);
    }
    public addTodo(userId: string, content: string) {
        return request.post(`${TodoApi.prefix}`, {
            userId,
            content,
        });
    }
    public searchTodo(userId: string, q: string) {
        return request.post(`${TodoApi.prefix}/search`, {
            userId,
            q,
        });
    }
    public deleteTodo(todoId: string) {
        return request.delete(`${TodoApi.prefix}/${todoId}`);
    }
    public updateTodoStatus(todoId: string) {
        return request.put(`${TodoApi.prefix}/status`, {
            todoId,
        });
    }
    public updateTodoContent(todoId: string, content: string) {
        console.log(todoId,content);
        return request.put(`${TodoApi.prefix}/content`, {
            todoId,
            content,
        });
    }
}


public fetchTodo(userId: string) {
        return request.get(`${TodoApi.prefix}/${userId}/all`);
    }


public addTodo(userId: string, content: string) {
        return request.post(`${TodoApi.prefix}`, {
            userId,
            content,
        });
    }


public searchTodo(userId: string, q: string) {
        return request.post(`${TodoApi.prefix}/search`, {
            userId,
            q,
        });
    }


public deleteTodo(todoId: string) {
        return request.delete(`${TodoApi.prefix}/${todoId}`);
    }


public updateTodoStatus(todoId: string) {
        return request.put(`${TodoApi.prefix}/status`, {
            todoId,
        });
    }


public updateTodoContent(todoId: string, content: string) {
        console.log(todoId,content);
        return request.put(`${TodoApi.prefix}/content`, {
            todoId,
            content,
        });
    }


/**
 * @internal
 */
export function isResourceFileEdit(thing: any): thing is ResourceFileEdit {
	return isObject(thing) && (Boolean((<ResourceFileEdit>thing).newUri) || Boolean((<ResourceFileEdit>thing).oldUri));
}


/**
 * @internal
 */
export function isResourceTextEdit(thing: any): thing is ResourceTextEdit {
	return isObject(thing) && (<ResourceTextEdit>thing).resource && Array.isArray((<ResourceTextEdit>thing).edits);
}


/**
 * @internal
 */
export class LanguageIdentifier {

	/**
	 * A string identifier. Unique across languages. e.g. 'javascript'.
	 */
	public readonly language: string;

	/**
	 * A numeric identifier. Unique across languages. e.g. 5
	 * Will vary at runtime based on registration order, etc.
	 */
	public readonly id: LanguageId;

	constructor(language: string, id: LanguageId) {
		this.language = language;
		this.id = id;
	}
}


/**
 * @internal
 */
export class TokenMetadata {

	public static getLanguageId(metadata: number): LanguageId {
		return (metadata & MetadataConsts.LANGUAGEID_MASK) >>> MetadataConsts.LANGUAGEID_OFFSET;
	}

	public static getTokenType(metadata: number): StandardTokenType {
		return (metadata & MetadataConsts.TOKEN_TYPE_MASK) >>> MetadataConsts.TOKEN_TYPE_OFFSET;
	}

	public static getFontStyle(metadata: number): FontStyle {
		return (metadata & MetadataConsts.FONT_STYLE_MASK) >>> MetadataConsts.FONT_STYLE_OFFSET;
	}

	public static getForeground(metadata: number): ColorId {
		return (metadata & MetadataConsts.FOREGROUND_MASK) >>> MetadataConsts.FOREGROUND_OFFSET;
	}

	public static getBackground(metadata: number): ColorId {
		return (metadata & MetadataConsts.BACKGROUND_MASK) >>> MetadataConsts.BACKGROUND_OFFSET;
	}

	public static getClassNameFromMetadata(metadata: number): string {
		let foreground = this.getForeground(metadata);
		let className = 'mtk' + foreground;

		let fontStyle = this.getFontStyle(metadata);
		if (fontStyle & FontStyle.Italic) {
			className += ' mtki';
		}
		if (fontStyle & FontStyle.Bold) {
			className += ' mtkb';
		}
		if (fontStyle & FontStyle.Underline) {
			className += ' mtku';
		}

		return className;
	}

	public static getInlineStyleFromMetadata(metadata: number, colorMap: string[]): string {
		const foreground = this.getForeground(metadata);
		const fontStyle = this.getFontStyle(metadata);

		let result = `color: ${colorMap[foreground]};`;
		if (fontStyle & FontStyle.Italic) {
			result += 'font-style: italic;';
		}
		if (fontStyle & FontStyle.Bold) {
			result += 'font-weight: bold;';
		}
		if (fontStyle & FontStyle.Underline) {
			result += 'text-decoration: underline;';
		}
		return result;
	}
}


export class FoldingRangeKind {
	/**
	 * Kind for folding range representing a comment. The value of the kind is 'comment'.
	 */
	static readonly Comment = new FoldingRangeKind('comment');
	/**
	 * Kind for folding range representing a import. The value of the kind is 'imports'.
	 */
	static readonly Imports = new FoldingRangeKind('imports');
	/**
	 * Kind for folding range representing regions (for example marked by `#region`, `#endregion`).
	 * The value of the kind is 'region'.
	 */
	static readonly Region = new FoldingRangeKind('region');

	/**
	 * Creates a new [FoldingRangeKind](#FoldingRangeKind).
	 *
	 * @param value of the kind.
	 */
	public constructor(public value: string) {
	}
}


/**
 * A mode. Will soon be obsolete.
 * @internal
 */
export interface IMode {

	getId(): string;

	getLanguageIdentifier(): LanguageIdentifier;

}


/**
 * @internal
 */
export interface ITokenizationSupport {

	getInitialState(): IState;

	// add offsetDelta to each of the returned indices
	tokenize(line: string, state: IState, offsetDelta: number): TokenizationResult;

	tokenize2(line: string, state: IState, offsetDelta: number): TokenizationResult2;
}


/**
 * The state of the tokenizer between two lines.
 * It is useful to store flags such as in multiline comment, etc.
 * The model will clone the previous line's state and pass it in to tokenize the next line.
 */
export interface IState {
	clone(): IState;
	equals(other: IState): boolean;
}


/**
 * A hover represents additional information for a symbol or word. Hovers are
 * rendered in a tooltip-like widget.
 */
export interface Hover {
	/**
	 * The contents of this hover.
	 */
	contents: IMarkdownString[];

	/**
	 * The range to which this hover applies. When missing, the
	 * editor will use the range at the current position or the
	 * current position itself.
	 */
	range?: IRange;
}


/**
 * The hover provider interface defines the contract between extensions and
 * the [hover](https://code.visualstudio.com/docs/editor/intellisense)-feature.
 */
export interface HoverProvider {
	/**
	 * Provide a hover for the given position and document. Multiple hovers at the same
	 * position will be merged by the editor. A hover can have a range which defaults
	 * to the word range at the position when omitted.
	 */
	provideHover(model: model.ITextModel, position: Position, token: CancellationToken): Hover | Thenable<Hover>;
}


/**
 * @internal
 */
export interface ISuggestion {
	label: string;
	insertText: string;
	type: SuggestionType;
	detail?: string;
	documentation?: string | IMarkdownString;
	filterText?: string;
	sortText?: string;
	preselect?: boolean;
	noAutoAccept?: boolean;
	commitCharacters?: string[];
	overwriteBefore?: number;
	overwriteAfter?: number;
	additionalTextEdits?: model.ISingleEditOperation[];
	command?: Command;
	snippetType?: SnippetType;
}


/**
 * @internal
 */
export interface ISuggestResult {
	suggestions: ISuggestion[];
	incomplete?: boolean;
	dispose?(): void;
}


/**
 * @internal
 */
export interface SuggestContext {
	triggerKind: SuggestTriggerKind;
	triggerCharacter?: string;
}


/**
 * @internal
 */
export interface ISuggestSupport {

	triggerCharacters?: string[];

	provideCompletionItems(model: model.ITextModel, position: Position, context: SuggestContext, token: CancellationToken): ISuggestResult | Thenable<ISuggestResult>;

	resolveCompletionItem?(model: model.ITextModel, position: Position, item: ISuggestion, token: CancellationToken): ISuggestion | Thenable<ISuggestion>;
}


export interface CodeAction {
	title: string;
	command?: Command;
	edit?: WorkspaceEdit;
	diagnostics?: IMarkerData[];
	kind?: string;
}


/**
 * @internal
 */
export interface CodeActionContext {
	only?: string;
	trigger: CodeActionTrigger;
}


/**
 * The code action interface defines the contract between extensions and
 * the [light bulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) feature.
 * @internal
 */
export interface CodeActionProvider {
	/**
	 * Provide commands for the given document and range.
	 */
	provideCodeActions(model: model.ITextModel, range: Range | Selection, context: CodeActionContext, token: CancellationToken): CodeAction[] | Thenable<CodeAction[]>;

	/**
	 * Optional list of of CodeActionKinds that this provider returns.
	 */
	providedCodeActionKinds?: string[];
}


/**
 * Represents a parameter of a callable-signature. A parameter can
 * have a label and a doc-comment.
 */
export interface ParameterInformation {
	/**
	 * The label of this signature. Will be shown in
	 * the UI.
	 */
	label: string;
	/**
	 * The human-readable doc-comment of this signature. Will be shown
	 * in the UI but can be omitted.
	 */
	documentation?: string | IMarkdownString;
}


/**
 * Represents the signature of something callable. A signature
 * can have a label, like a function-name, a doc-comment, and
 * a set of parameters.
 */
export interface SignatureInformation {
	/**
	 * The label of this signature. Will be shown in
	 * the UI.
	 */
	label: string;
	/**
	 * The human-readable doc-comment of this signature. Will be shown
	 * in the UI but can be omitted.
	 */
	documentation?: string | IMarkdownString;
	/**
	 * The parameters of this signature.
	 */
	parameters: ParameterInformation[];
}


/**
 * Signature help represents the signature of something
 * callable. There can be multiple signatures but only one
 * active and only one active parameter.
 */
export interface SignatureHelp {
	/**
	 * One or more signatures.
	 */
	signatures: SignatureInformation[];
	/**
	 * The active signature.
	 */
	activeSignature: number;
	/**
	 * The active parameter of the active signature.
	 */
	activeParameter: number;
}


/**
 * The signature help provider interface defines the contract between extensions and
 * the [parameter hints](https://code.visualstudio.com/docs/editor/intellisense)-feature.
 */
export interface SignatureHelpProvider {

	signatureHelpTriggerCharacters: string[];

	/**
	 * Provide help for the signature at the given position and document.
	 */
	provideSignatureHelp(model: model.ITextModel, position: Position, token: CancellationToken): SignatureHelp | Thenable<SignatureHelp>;
}


/**
 * A document highlight is a range inside a text document which deserves
 * special attention. Usually a document highlight is visualized by changing
 * the background color of its range.
 */
export interface DocumentHighlight {
	/**
	 * The range this highlight applies to.
	 */
	range: IRange;
	/**
	 * The highlight kind, default is [text](#DocumentHighlightKind.Text).
	 */
	kind: DocumentHighlightKind;
}


/**
 * The document highlight provider interface defines the contract between extensions and
 * the word-highlight-feature.
 */
export interface DocumentHighlightProvider {
	/**
	 * Provide a set of document highlights, like all occurrences of a variable or
	 * all exit-points of a function.
	 */
	provideDocumentHighlights(model: model.ITextModel, position: Position, token: CancellationToken): DocumentHighlight[] | Thenable<DocumentHighlight[]>;
}


/**
 * Value-object that contains additional information when
 * requesting references.
 */
export interface ReferenceContext {
	/**
	 * Include the declaration of the current symbol.
	 */
	includeDeclaration: boolean;
}


/**
 * The reference provider interface defines the contract between extensions and
 * the [find references](https://code.visualstudio.com/docs/editor/editingevolved#_peek)-feature.
 */
export interface ReferenceProvider {
	/**
	 * Provide a set of project-wide references for the given position and document.
	 */
	provideReferences(model: model.ITextModel, position: Position, context: ReferenceContext, token: CancellationToken): Location[] | Thenable<Location[]>;
}


/**
 * Represents a location inside a resource, such as a line
 * inside a text file.
 */
export interface Location {
	/**
	 * The resource identifier of this location.
	 */
	uri: URI;
	/**
	 * The document range of this locations.
	 */
	range: IRange;
}


export interface DefinitionLink {
	origin?: IRange;
	uri: URI;
	range: IRange;
	selectionRange?: IRange;
}


/**
 * The definition provider interface defines the contract between extensions and
 * the [go to definition](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition)
 * and peek definition features.
 */
export interface DefinitionProvider {
	/**
	 * Provide the definition of the symbol at the given position and document.
	 */
	provideDefinition(model: model.ITextModel, position: Position, token: CancellationToken): DefinitionLink | Thenable<DefinitionLink[]>;
}


/**
 * The implementation provider interface defines the contract between extensions and
 * the go to implementation feature.
 */
export interface ImplementationProvider {
	/**
	 * Provide the implementation of the symbol at the given position and document.
	 */
	provideImplementation(model: model.ITextModel, position: Position, token: CancellationToken): Definition | Thenable<Definition>;
}


/**
 * The type definition provider interface defines the contract between extensions and
 * the go to type definition feature.
 */
export interface TypeDefinitionProvider {
	/**
	 * Provide the type definition of the symbol at the given position and document.
	 */
	provideTypeDefinition(model: model.ITextModel, position: Position, token: CancellationToken): Definition | Thenable<Definition>;
}


export interface DocumentSymbol {
	name: string;
	detail: string;
	kind: SymbolKind;
	containerName?: string;
	range: IRange;
	selectionRange: IRange;
	children?: DocumentSymbol[];
}


/**
 * The document symbol provider interface defines the contract between extensions and
 * the [go to symbol](https://code.visualstudio.com/docs/editor/editingevolved#_goto-symbol)-feature.
 */
export interface DocumentSymbolProvider {

	displayName?: string;

	/**
	 * Provide symbol information for the given document.
	 */
	provideDocumentSymbols(model: model.ITextModel, token: CancellationToken): DocumentSymbol[] | Thenable<DocumentSymbol[]>;
}


export interface TextEdit {
	range: IRange;
	text: string;
	eol?: model.EndOfLineSequence;
}


/**
 * Interface used to format a model
 */
export interface FormattingOptions {
	/**
	 * Size of a tab in spaces.
	 */
	tabSize: number;
	/**
	 * Prefer spaces over tabs.
	 */
	insertSpaces: boolean;
}


/**
 * The document formatting provider interface defines the contract between extensions and
 * the formatting-feature.
 */
export interface DocumentFormattingEditProvider {
	/**
	 * Provide formatting edits for a whole document.
	 */
	provideDocumentFormattingEdits(model: model.ITextModel, options: FormattingOptions, token: CancellationToken): TextEdit[] | Thenable<TextEdit[]>;
}


/**
 * The document formatting provider interface defines the contract between extensions and
 * the formatting-feature.
 */
export interface DocumentRangeFormattingEditProvider {
	/**
	 * Provide formatting edits for a range in a document.
	 *
	 * The given range is a hint and providers can decide to format a smaller
	 * or larger range. Often this is done by adjusting the start and end
	 * of the range to full syntax nodes.
	 */
	provideDocumentRangeFormattingEdits(model: model.ITextModel, range: Range, options: FormattingOptions, token: CancellationToken): TextEdit[] | Thenable<TextEdit[]>;
}


/**
 * The document formatting provider interface defines the contract between extensions and
 * the formatting-feature.
 */
export interface OnTypeFormattingEditProvider {
	autoFormatTriggerCharacters: string[];
	/**
	 * Provide formatting edits after a character has been typed.
	 *
	 * The given position and character should hint to the provider
	 * what range the position to expand to, like find the matching `{`
	 * when `}` has been entered.
	 */
	provideOnTypeFormattingEdits(model: model.ITextModel, position: Position, ch: string, options: FormattingOptions, token: CancellationToken): TextEdit[] | Thenable<TextEdit[]>;
}


/**
 * @internal
 */
export interface IInplaceReplaceSupportResult {
	value: string;
	range: IRange;
}


/**
 * A link inside the editor.
 */
export interface ILink {
	range: IRange;
	url?: string;
}


/**
 * A provider of links.
 */
export interface LinkProvider {
	provideLinks(model: model.ITextModel, token: CancellationToken): ILink[] | Thenable<ILink[]>;
	resolveLink?: (link: ILink, token: CancellationToken) => ILink | Thenable<ILink>;
}


/**
 * A color in RGBA format.
 */
export interface IColor {

	/**
	 * The red component in the range [0-1].
	 */
	readonly red: number;

	/**
	 * The green component in the range [0-1].
	 */
	readonly green: number;

	/**
	 * The blue component in the range [0-1].
	 */
	readonly blue: number;

	/**
	 * The alpha component in the range [0-1].
	 */
	readonly alpha: number;
}


/**
 * String representations for a color
 */
export interface IColorPresentation {
	/**
	 * The label of this color presentation. It will be shown on the color
	 * picker header. By default this is also the text that is inserted when selecting
	 * this color presentation.
	 */
	label: string;
	/**
	 * An [edit](#TextEdit) which is applied to a document when selecting
	 * this presentation for the color.
	 */
	textEdit?: TextEdit;
	/**
	 * An optional array of additional [text edits](#TextEdit) that are applied when
	 * selecting this color presentation.
	 */
	additionalTextEdits?: TextEdit[];
}


/**
 * A color range is a range in a text model which represents a color.
 */
export interface IColorInformation {

	/**
	 * The range within the model.
	 */
	range: IRange;

	/**
	 * The color represented in this range.
	 */
	color: IColor;
}


/**
 * A provider of colors for editor models.
 */
export interface DocumentColorProvider {
	/**
	 * Provides the color ranges for a specific model.
	 */
	provideDocumentColors(model: model.ITextModel, token: CancellationToken): IColorInformation[] | Thenable<IColorInformation[]>;
	/**
	 * Provide the string representations for a color.
	 */
	provideColorPresentations(model: model.ITextModel, colorInfo: IColorInformation, token: CancellationToken): IColorPresentation[] | Thenable<IColorPresentation[]>;
}


export interface FoldingContext {
}


/**
 * A provider of colors for editor models.
 */
export interface FoldingRangeProvider {
	/**
	 * Provides the color ranges for a specific model.
	 */
	provideFoldingRanges(model: model.ITextModel, context: FoldingContext, token: CancellationToken): FoldingRange[] | Thenable<FoldingRange[]>;
}


export interface FoldingRange {

	/**
	 * The zero-based start line of the range to fold. The folded area starts after the line's last character.
	 */
	start: number;

	/**
	 * The zero-based end line of the range to fold. The folded area ends with the line's last character.
	 */
	end: number;

	/**
	 * Describes the [Kind](#FoldingRangeKind) of the folding range such as [Comment](#FoldingRangeKind.Comment) or
	 * [Region](#FoldingRangeKind.Region). The kind is used to categorize folding ranges and used by commands
	 * like 'Fold all comments'. See
	 * [FoldingRangeKind](#FoldingRangeKind) for an enumeration of standardized kinds.
	 */
	kind?: FoldingRangeKind;
}