() => {
    const ck = new Checker();
    const origin = Point3d.create(1, 2, 3);
    const points = Sample.createSquareWave(origin, 2, 1, 3, 3, 5);    // This has a single closure point !!
    const wrapper = new Point3dArrayCarrier(points);
    const originalCount = wrapper.length;
    const originalTrim = originalCount - 1;
    GrowableXYZArray.removeClosure(wrapper);
    ck.testExactNumber(originalTrim, points.length, "original closure point=>no change");
    GrowableXYZArray.removeClosure(wrapper);
    ck.testExactNumber(originalTrim, points.length, "no closure point=>no change");
    for (const numAdd of [1, 3]) {
      for (let i = 0; i < numAdd; i++)
        wrapper.push(origin);
      ck.testExactNumber(originalTrim + numAdd, wrapper.length, `after adding  ${numAdd} closure points`);
      GrowableXYZArray.removeClosure(wrapper);
      ck.testExactNumber(originalTrim, wrapper.length, `after removeClosure ${numAdd}`);
    }

  }


() => {
  let service: AutocompleteService;

  beforeEach(() => {
    TestBed.configureTestingModule({});
    service = TestBed.inject(AutocompleteService);
  });

  it('should be created', () => {
    expect(service).toBeTruthy();
  });
}


() => {
    TestBed.configureTestingModule({});
    service = TestBed.inject(AutocompleteService);
  }


export class ContributionDescValidator implements Validator<ContributionDesc> {

  static INSTANCE = new ContributionDescValidator();

  validate(obj: ContributionDesc): string[] {
    if (!obj) {
      return ['Contribution cannot be empty'];
    }

    if (obj.authors.length < 1) {
      return ['At least one author is required'];
    }
    return [];
  }

  protected ContributionDescValidator() {
  }
}


validate(obj: ContributionDesc): string[] {
    if (!obj) {
      return ['Contribution cannot be empty'];
    }

    if (obj.authors.length < 1) {
      return ['At least one author is required'];
    }
    return [];
  }


protected ContributionDescValidator() {
  }


export type SocialMedia = {
  readonly github: string;
  readonly linkedin: string;
};


// Create one shift
(callback) => {
                this._persistence.create(
                    null,
                    SHIFT1,
                    (err, shift) => {
                        assert.isNull(err);

                        assert.isObject(shift);
                        assert.equal(shift.org_id, SHIFT1.org_id);
                        assert.equal(shift.start, SHIFT1.start);
                        assert.equal(shift.name, SHIFT1.name);

                        callback();
                    }
                );
            }


(err, shift) => {
                        assert.isNull(err);

                        assert.isObject(shift);
                        assert.equal(shift.org_id, SHIFT1.org_id);
                        assert.equal(shift.start, SHIFT1.start);
                        assert.equal(shift.name, SHIFT1.name);

                        callback();
                    }


// Create another shift
(callback) => {
                this._persistence.create(
                    null,
                    SHIFT2,
                    (err, shift) => {
                        assert.isNull(err);

                        assert.isObject(shift);
                        assert.equal(shift.org_id, SHIFT2.org_id);
                        assert.equal(shift.start, SHIFT2.start);
                        assert.equal(shift.name, SHIFT2.name);

                        callback();
                    }
                );
            }


(err, shift) => {
                        assert.isNull(err);

                        assert.isObject(shift);
                        assert.equal(shift.org_id, SHIFT2.org_id);
                        assert.equal(shift.start, SHIFT2.start);
                        assert.equal(shift.name, SHIFT2.name);

                        callback();
                    }


// Create yet another shift
(callback) => {
                this._persistence.create(
                    null,
                    SHIFT3,
                    (err, shift) => {
                        assert.isNull(err);

                        assert.isObject(shift);
                        assert.equal(shift.org_id, SHIFT3.org_id);
                        assert.equal(shift.start, SHIFT3.start);
                        assert.equal(shift.name, SHIFT3.name);

                        callback();
                    }
                );
            }


(err, shift) => {
                        assert.isNull(err);

                        assert.isObject(shift);
                        assert.equal(shift.org_id, SHIFT3.org_id);
                        assert.equal(shift.start, SHIFT3.start);
                        assert.equal(shift.name, SHIFT3.name);

                        callback();
                    }


// Create items
(callback) => {
                this.testCreateShifts(callback);
            }


// Get all shifts
(callback) => {
                this._persistence.getPageByFilter(
                    null,
                    new FilterParams(),
                    new PagingParams(),
                    (err, page) => {
                        assert.isNull(err);

                        assert.isObject(page);
                        assert.lengthOf(page.data, 3);

                        shift1 = page.data[0];

                        callback();
                    }
                );
            }


(err, page) => {
                        assert.isNull(err);

                        assert.isObject(page);
                        assert.lengthOf(page.data, 3);

                        shift1 = page.data[0];

                        callback();
                    }


// Update the shift
(callback) => {
                shift1.name = 'Updated shift 1';

                this._persistence.update(
                    null,
                    shift1,
                    (err, shift) => {
                        assert.isNull(err);

                        assert.isObject(shift);
                        assert.equal(shift.name, 'Updated shift 1');
                        assert.equal(shift.id, shift1.id);

                        callback();
                    }
                );
            }


(err, shift) => {
                        assert.isNull(err);

                        assert.isObject(shift);
                        assert.equal(shift.name, 'Updated shift 1');
                        assert.equal(shift.id, shift1.id);

                        callback();
                    }


// Delete shift
(callback) => {
                this._persistence.deleteById(
                    null,
                    shift1.id,
                    (err) => {
                        assert.isNull(err);

                        callback();
                    }
                );
            }


(err) => {
                        assert.isNull(err);

                        callback();
                    }


// Try to get delete shift
(callback) => {
                this._persistence.getOneById(
                    null,
                    shift1.id,
                    (err, shift) => {
                        assert.isNull(err);

                        assert.isNull(shift || null);

                        callback();
                    }
                );
            }


(err, shift) => {
                        assert.isNull(err);

                        assert.isNull(shift || null);

                        callback();
                    }


// Create shifts
(callback) => {
                this.testCreateShifts(callback);
            }


// Get shifts filtered by org_id
(callback) => {
                this._persistence.getPageByFilter(
                    null,
                    FilterParams.fromValue({
                        org_id: '1'
                    }),
                    new PagingParams(),
                    (err, shifts) => {
                        assert.isNull(err);

                        assert.isObject(shifts);
                        assert.lengthOf(shifts.data, 2);

                        callback();
                    }
                );
            }


(err, shifts) => {
                        assert.isNull(err);

                        assert.isObject(shifts);
                        assert.lengthOf(shifts.data, 2);

                        callback();
                    }


// Get shifts filtered by search
(callback) => {
                this._persistence.getPageByFilter(
                    null,
                    FilterParams.fromValue({
                        search: 'test'
                    }),
                    new PagingParams(),
                    (err, shifts) => {
                        assert.isNull(err);

                        assert.isObject(shifts);
                        assert.lengthOf(shifts.data, 3);

                        callback();
                    }
                );
            }


(err, shifts) => {
                        assert.isNull(err);

                        assert.isObject(shifts);
                        assert.lengthOf(shifts.data, 3);

                        callback();
                    }


export class ShiftsPersistenceFixture {
    private _persistence: IShiftsPersistence;

    constructor(persistence) {
        assert.isNotNull(persistence);
        this._persistence = persistence;
    }

    private testCreateShifts(done) {
        async.series([
        // Create one shift
            (callback) => {
                this._persistence.create(
                    null,
                    SHIFT1,
                    (err, shift) => {
                        assert.isNull(err);

                        assert.isObject(shift);
                        assert.equal(shift.org_id, SHIFT1.org_id);
                        assert.equal(shift.start, SHIFT1.start);
                        assert.equal(shift.name, SHIFT1.name);

                        callback();
                    }
                );
            },
        // Create another shift
            (callback) => {
                this._persistence.create(
                    null,
                    SHIFT2,
                    (err, shift) => {
                        assert.isNull(err);

                        assert.isObject(shift);
                        assert.equal(shift.org_id, SHIFT2.org_id);
                        assert.equal(shift.start, SHIFT2.start);
                        assert.equal(shift.name, SHIFT2.name);

                        callback();
                    }
                );
            },
        // Create yet another shift
            (callback) => {
                this._persistence.create(
                    null,
                    SHIFT3,
                    (err, shift) => {
                        assert.isNull(err);

                        assert.isObject(shift);
                        assert.equal(shift.org_id, SHIFT3.org_id);
                        assert.equal(shift.start, SHIFT3.start);
                        assert.equal(shift.name, SHIFT3.name);

                        callback();
                    }
                );
            }
        ], done);
    }

    public testCrudOperations(done) {
        let shift1: ShiftV1;

        async.series([
        // Create items
            (callback) => {
                this.testCreateShifts(callback);
            },
        // Get all shifts
            (callback) => {
                this._persistence.getPageByFilter(
                    null,
                    new FilterParams(),
                    new PagingParams(),
                    (err, page) => {
                        assert.isNull(err);

                        assert.isObject(page);
                        assert.lengthOf(page.data, 3);

                        shift1 = page.data[0];

                        callback();
                    }
                );
            },
        // Update the shift
            (callback) => {
                shift1.name = 'Updated shift 1';

                this._persistence.update(
                    null,
                    shift1,
                    (err, shift) => {
                        assert.isNull(err);

                        assert.isObject(shift);
                        assert.equal(shift.name, 'Updated shift 1');
                        assert.equal(shift.id, shift1.id);

                        callback();
                    }
                );
            },
        // Delete shift
            (callback) => {
                this._persistence.deleteById(
                    null,
                    shift1.id,
                    (err) => {
                        assert.isNull(err);

                        callback();
                    }
                );
            },
        // Try to get delete shift
            (callback) => {
                this._persistence.getOneById(
                    null,
                    shift1.id,
                    (err, shift) => {
                        assert.isNull(err);

                        assert.isNull(shift || null);

                        callback();
                    }
                );
            }
        ], done);
    }

    public testGetWithFilter(done) {
        async.series([
        // Create shifts
            (callback) => {
                this.testCreateShifts(callback);
            },
        // Get shifts filtered by org_id
            (callback) => {
                this._persistence.getPageByFilter(
                    null,
                    FilterParams.fromValue({
                        org_id: '1'
                    }),
                    new PagingParams(),
                    (err, shifts) => {
                        assert.isNull(err);

                        assert.isObject(shifts);
                        assert.lengthOf(shifts.data, 2);

                        callback();
                    }
                );
            },
        // Get shifts filtered by search
            (callback) => {
                this._persistence.getPageByFilter(
                    null,
                    FilterParams.fromValue({
                        search: 'test'
                    }),
                    new PagingParams(),
                    (err, shifts) => {
                        assert.isNull(err);

                        assert.isObject(shifts);
                        assert.lengthOf(shifts.data, 3);

                        callback();
                    }
                );
            },
        ], done);
    }

}


private testCreateShifts(done) {
        async.series([
        // Create one shift
            (callback) => {
                this._persistence.create(
                    null,
                    SHIFT1,
                    (err, shift) => {
                        assert.isNull(err);

                        assert.isObject(shift);
                        assert.equal(shift.org_id, SHIFT1.org_id);
                        assert.equal(shift.start, SHIFT1.start);
                        assert.equal(shift.name, SHIFT1.name);

                        callback();
                    }
                );
            },
        // Create another shift
            (callback) => {
                this._persistence.create(
                    null,
                    SHIFT2,
                    (err, shift) => {
                        assert.isNull(err);

                        assert.isObject(shift);
                        assert.equal(shift.org_id, SHIFT2.org_id);
                        assert.equal(shift.start, SHIFT2.start);
                        assert.equal(shift.name, SHIFT2.name);

                        callback();
                    }
                );
            },
        // Create yet another shift
            (callback) => {
                this._persistence.create(
                    null,
                    SHIFT3,
                    (err, shift) => {
                        assert.isNull(err);

                        assert.isObject(shift);
                        assert.equal(shift.org_id, SHIFT3.org_id);
                        assert.equal(shift.start, SHIFT3.start);
                        assert.equal(shift.name, SHIFT3.name);

                        callback();
                    }
                );
            }
        ], done);
    }


public testCrudOperations(done) {
        let shift1: ShiftV1;

        async.series([
        // Create items
            (callback) => {
                this.testCreateShifts(callback);
            },
        // Get all shifts
            (callback) => {
                this._persistence.getPageByFilter(
                    null,
                    new FilterParams(),
                    new PagingParams(),
                    (err, page) => {
                        assert.isNull(err);

                        assert.isObject(page);
                        assert.lengthOf(page.data, 3);

                        shift1 = page.data[0];

                        callback();
                    }
                );
            },
        // Update the shift
            (callback) => {
                shift1.name = 'Updated shift 1';

                this._persistence.update(
                    null,
                    shift1,
                    (err, shift) => {
                        assert.isNull(err);

                        assert.isObject(shift);
                        assert.equal(shift.name, 'Updated shift 1');
                        assert.equal(shift.id, shift1.id);

                        callback();
                    }
                );
            },
        // Delete shift
            (callback) => {
                this._persistence.deleteById(
                    null,
                    shift1.id,
                    (err) => {
                        assert.isNull(err);

                        callback();
                    }
                );
            },
        // Try to get delete shift
            (callback) => {
                this._persistence.getOneById(
                    null,
                    shift1.id,
                    (err, shift) => {
                        assert.isNull(err);

                        assert.isNull(shift || null);

                        callback();
                    }
                );
            }
        ], done);
    }


public testGetWithFilter(done) {
        async.series([
        // Create shifts
            (callback) => {
                this.testCreateShifts(callback);
            },
        // Get shifts filtered by org_id
            (callback) => {
                this._persistence.getPageByFilter(
                    null,
                    FilterParams.fromValue({
                        org_id: '1'
                    }),
                    new PagingParams(),
                    (err, shifts) => {
                        assert.isNull(err);

                        assert.isObject(shifts);
                        assert.lengthOf(shifts.data, 2);

                        callback();
                    }
                );
            },
        // Get shifts filtered by search
            (callback) => {
                this._persistence.getPageByFilter(
                    null,
                    FilterParams.fromValue({
                        search: 'test'
                    }),
                    new PagingParams(),
                    (err, shifts) => {
                        assert.isNull(err);

                        assert.isObject(shifts);
                        assert.lengthOf(shifts.data, 3);

                        callback();
                    }
                );
            },
        ], done);
    }


(기본값: 127.0.0.1)


(기본값: 100)


function toSeconds(value: string) {
  let seconds = 0;
  const modifiers = [1, 60, 3600];

  for (const [index, part] of value.trim().split(":").reverse().entries()) {
    if (index <= 2 && /^\d+$/.test(part)) {
      seconds += Number(part) * modifiers[index];
    } else {
      throw new Error("improper format");
    }
  }

  return seconds;
}


function toText(value: number) {
  let hours = 0;
  let minutes = 0;
  let seconds = 0;

  hours = Math.floor(value / 3600);
  value -= hours * 3600;
  minutes = Math.floor(value / 60);
  value -= minutes * 60;
  seconds = Math.floor(value);

  return [hours, minutes, seconds]
    .map((x) => String(x).padStart(2, "0"))
    .join(":");
}


(x) => String(x).padStart(2, "0")


() => {
        const view = this.root.children[0];

        if (!(view instanceof TimerView)) {
          throw new Error("could not find view");
        }

        view.seconds--;

        if (view.seconds <= 0) {
          alarm.play();
          view.seconds = 0;
          window.clearInterval(this.interval);
          this.running = false;
        }
      }


@element("timer-view")
class TimerView extends Component {
  @property seconds = 0;
  @property editable = false;

  rawValue = "0";

  reset() {
    this.seconds = toSeconds(this.rawValue);
  }

  @bound
  onChange(event: Event) {
    const oldSeconds = this.seconds;
    const oldRawValue = this.rawValue;

    if (event.target instanceof HTMLDivElement) {
      this.rawValue = event.target.textContent || "";
    }

    this.editable = false;

    try {
      this.seconds = toSeconds(this.rawValue);
    } catch (error) {
      this.rawValue = oldRawValue;
      this.seconds = oldSeconds;
    }
  }

  @bound
  onClick(event: Event) {
    if (this.parentElement instanceof TimerApp && this.parentElement.running) {
      return;
    }

    this.editable = true;

    if (event.target instanceof HTMLDivElement) {
      event.target.focus();
    }
  }

  render() {
    return html`
      <div
        contenteditable=${this.editable}
        onblur=${this.onChange}
        onclick=${this.onClick}
      >
        ${toText(this.seconds)}
      </div>
    `;
  }
}


@element("timer-app")
class TimerApp extends Component {
  running: boolean = false;
  interval?: number = undefined;

  @bound
  onStartStop() {
    if (this.running) {
      window.clearInterval(this.interval);
      this.running = false;
    } else {
      this.running = true;
      this.interval = window.setInterval(() => {
        const view = this.root.children[0];

        if (!(view instanceof TimerView)) {
          throw new Error("could not find view");
        }

        view.seconds--;

        if (view.seconds <= 0) {
          alarm.play();
          view.seconds = 0;
          window.clearInterval(this.interval);
          this.running = false;
        }
      }, 1000);
    }
  }

  @bound
  onReset() {
    alarm.pause();

    const view = this.root.children[0];

    if (!(view instanceof TimerView)) {
      throw new Error("could not find view");
    }

    view.reset();
  }

  render() {
    return html`
      <timer-view></timer-view>
      <div>
        <input type="button" value="Start/Stop" onclick=${this.onStartStop} />
        <input type="button" value="Reset" onclick=${this.onReset} />
      </div>
    `;
  }
}


reset() {
    this.seconds = toSeconds(this.rawValue);
  }


@bound
  onChange(event: Event) {
    const oldSeconds = this.seconds;
    const oldRawValue = this.rawValue;

    if (event.target instanceof HTMLDivElement) {
      this.rawValue = event.target.textContent || "";
    }

    this.editable = false;

    try {
      this.seconds = toSeconds(this.rawValue);
    } catch (error) {
      this.rawValue = oldRawValue;
      this.seconds = oldSeconds;
    }
  }


@bound
  onClick(event: Event) {
    if (this.parentElement instanceof TimerApp && this.parentElement.running) {
      return;
    }

    this.editable = true;

    if (event.target instanceof HTMLDivElement) {
      event.target.focus();
    }
  }


render() {
    return html`
      <div
        contenteditable=${this.editable}
        onblur=${this.onChange}
        onclick=${this.onClick}
      >
        ${toText(this.seconds)}
      </div>
    `;
  }


@bound
  onStartStop() {
    if (this.running) {
      window.clearInterval(this.interval);
      this.running = false;
    } else {
      this.running = true;
      this.interval = window.setInterval(() => {
        const view = this.root.children[0];

        if (!(view instanceof TimerView)) {
          throw new Error("could not find view");
        }

        view.seconds--;

        if (view.seconds <= 0) {
          alarm.play();
          view.seconds = 0;
          window.clearInterval(this.interval);
          this.running = false;
        }
      }, 1000);
    }
  }


@bound
  onReset() {
    alarm.pause();

    const view = this.root.children[0];

    if (!(view instanceof TimerView)) {
      throw new Error("could not find view");
    }

    view.reset();
  }


render() {
    return html`
      <timer-view></timer-view>
      <div>
        <input type="button" value="Start/Stop" onclick=${this.onStartStop} />
        <input type="button" value="Reset" onclick=${this.onReset} />
      </div>
    `;
  }


(storyFn) => (
    <div style={


() => {
    return (
      <AntiVirusErrorPage
        antivirus="Kaspersky"
        article={specificArticle}
        onCloseClicked={action('On Close Clicked')}
        onViewAVList={linkTo('Modules/Error Pages/Pages', 'Generic Anti-Virus Error - Initial')}
      />


() => {
    return (
      <AntiVirusErrorPage
        antivirus="Kaspersky"
        article={specificArticle}
        fallthrough={true}
        onCloseClicked={action('On Close Clicked')}
        onViewAVList={linkTo('Modules/Error Pages/Pages', 'Generic Anti-Virus Error - Initial')}
      />


() => {
    return (
      <AntiVirusErrorPage
        articleList={articleList}
        onCloseClicked={action('On Close Clicked')}
        onViewArticle={linkTo('Modules/Error Pages/Pages', 'Specific Anti-Virus Error - Initial')}
        onViewAVList={linkTo('Modules/Error Pages/Pages', 'Generic Anti-Virus Error - Initial')}
      />


() => {
    return (
      <AntiVirusErrorPage
        articleList={articleList}
        onCloseClicked={action('On Close Clicked')}
        fallthrough={true}
        onViewArticle={linkTo('Modules/Error Pages/Pages', 'Specific Anti-Virus Error - Initial')}
        onViewAVList={linkTo('Modules/Error Pages/Pages', 'Generic Anti-Virus Error - Initial')}
      />


storyFn()


action('On Close Clicked')


linkTo('Modules/Error Pages/Pages', 'Generic Anti-Virus Error - Initial')


linkTo('Modules/Error Pages/Pages', 'Specific Anti-Virus Error - Initial')


() => {
  const div = document.createElement('div');
  ReactDOM.render(<App />, div);
  ReactDOM.unmountComponentAtNode(div);
}


@NgModule({
    imports: [HttpClientModule],
    exports: [],
    declarations: [],
    providers: [
        Title,
        {
            provide: LOCALE_ID,
            useValue: 'de-CH'
        },
        { provide: NgbDateAdapter, useClass: NgbDateMomentAdapter },
        DatePipe
    ]
})
export class ZeusCoreModule {
    constructor() {
        registerLocaleData(locale);
    }
}


key => (key ? key : '""')


(val, index) => {
        if (index > 0) {
          arrayWrapperSpan.appendChild(createElement('span', 'array-comma', ','));
        }
        arrayWrapperSpan.appendChild(createElement('span', 'number', val));
      }


() => {
        const key = this.keys[index];
        const formatter = new JsonExplorer(this.json[key], this.open - 1, this.config, key);
        children.appendChild(formatter.render());

        index += 1;

        if (index < this.keys.length) {
          if (index > MAX_ANIMATED_TOGGLE_ITEMS) {
            addAChild();
          } else {
            requestAnimationFrame(addAChild);
          }
        }
      }


key => {
        const formatter = new JsonExplorer(this.json[key], this.open - 1, this.config, key);
        children.appendChild(formatter.render());
      }


() => {
        if (childrenElement && childrenElement.children.length) {
          childrenElement.removeChild(childrenElement.children[0]);
          childrenRemoved += 1;
          if (childrenRemoved > MAX_ANIMATED_TOGGLE_ITEMS) {
            removeAChild();
          } else {
            requestAnimationFrame(removeAChild);
          }
        }
      }


export interface JsonExplorerConfig {
  animateOpen?: boolean;
  animateClose?: boolean;
  theme?: string;
}


/**
   * Toggles `isOpen` state
   *
   */
toggleOpen() {
    this.isOpen = !this.isOpen;

    if (this.element) {
      if (this.isOpen) {
        this.appendChildren(this.config.animateOpen);
      } else {
        this.removeChildren(this.config.animateClose);
      }
      this.element.classList.toggle(cssClass('open'));
    }
  }


/**
   * Open all children up to a certain depth.
   * Allows actions such as expand all/collapse all
   *
   */
openAtDepth(depth = 1) {
    if (depth < 0) {
      return;
    }

    this.open = depth;
    this.isOpen = depth !== 0;

    if (this.element) {
      this.removeChildren(false);

      if (depth === 0) {
        this.element.classList.remove(cssClass('open'));
      } else {
        this.appendChildren(this.config.animateOpen);
        this.element.classList.add(cssClass('open'));
      }
    }
  }


isNumberArray() {
    return this.json.length > 0 && this.json.length < 4 && (_.isNumber(this.json[0]) || _.isNumber(this.json[1]));
  }


renderArray() {
    const arrayWrapperSpan = createElement('span');
    arrayWrapperSpan.appendChild(createElement('span', 'bracket', '['));

    // some pretty handling of number arrays
    if (this.isNumberArray()) {
      this.json.forEach((val, index) => {
        if (index > 0) {
          arrayWrapperSpan.appendChild(createElement('span', 'array-comma', ','));
        }
        arrayWrapperSpan.appendChild(createElement('span', 'number', val));
      });
      this.skipChildren = true;
    } else {
      arrayWrapperSpan.appendChild(createElement('span', 'number', this.json.length));
    }

    arrayWrapperSpan.appendChild(createElement('span', 'bracket', ']'));
    return arrayWrapperSpan;
  }


/**
   * Renders an HTML element and installs event listeners
   *
   * @returns {HTMLDivElement}
   */
render(skipRoot = false): HTMLDivElement {
    // construct the root element and assign it to this.element
    this.element = createElement('div', 'row');

    // construct the toggler link
    const togglerLink = createElement('a', 'toggler-link');
    const togglerIcon = createElement('span', 'toggler');

    // if this is an object we need a wrapper span (toggler)
    if (this.isObject) {
      togglerLink.appendChild(togglerIcon);
    }

    // if this is child of a parent formatter we need to append the key
    if (this.hasKey) {
      togglerLink.appendChild(createElement('span', 'key', `${this.key}:`));
    }

    // Value for objects and arrays
    if (this.isObject) {
      // construct the value holder element
      const value = createElement('span', 'value');

      // we need a wrapper span for objects
      const objectWrapperSpan = createElement('span');

      // get constructor name and append it to wrapper span
      var constructorName = createElement('span', 'constructor-name', this.constructorName);
      objectWrapperSpan.appendChild(constructorName);

      // if it's an array append the array specific elements like brackets and length
      if (this.isArray) {
        const arrayWrapperSpan = this.renderArray();
        objectWrapperSpan.appendChild(arrayWrapperSpan);
      }

      // append object wrapper span to toggler link
      value.appendChild(objectWrapperSpan);
      togglerLink.appendChild(value);
      // Primitive values
    } else {
      // make a value holder element
      const value = this.isUrl ? createElement('a') : createElement('span');

      // add type and other type related CSS classes
      value.classList.add(cssClass(this.type));
      if (this.isDate) {
        value.classList.add(cssClass('date'));
      }
      if (this.isUrl) {
        value.classList.add(cssClass('url'));
        value.setAttribute('href', this.json);
      }

      // Append value content to value element
      const valuePreview = getValuePreview(this.json, this.json);
      value.appendChild(document.createTextNode(valuePreview));

      // append the value element to toggler link
      togglerLink.appendChild(value);
    }

    // construct a children element
    const children = createElement('div', 'children');

    // set CSS classes for children
    if (this.isObject) {
      children.classList.add(cssClass('object'));
    }
    if (this.isArray) {
      children.classList.add(cssClass('array'));
    }
    if (this.isEmpty) {
      children.classList.add(cssClass('empty'));
    }

    // set CSS classes for root element
    if (this.config && this.config.theme) {
      this.element.classList.add(cssClass(this.config.theme));
    }
    if (this.isOpen) {
      this.element.classList.add(cssClass('open'));
    }

    // append toggler and children elements to root element
    if (!skipRoot) {
      this.element.appendChild(togglerLink);
    }

    if (!this.skipChildren) {
      this.element.appendChild(children);
    } else {
      // remove togglerIcon
      togglerLink.removeChild(togglerIcon);
    }

    // if formatter is set to be open call appendChildren
    if (this.isObject && this.isOpen) {
      this.appendChildren();
    }

    // add event listener for toggling
    if (this.isObject) {
      togglerLink.addEventListener('click', this.toggleOpen.bind(this));
    }

    return this.element as HTMLDivElement;
  }


/**
   * Appends all the children to children element
   * Animated option is used when user triggers this via a click
   */
appendChildren(animated = false) {
    const children = this.element.querySelector(`div.${cssClass('children')}`);

    if (!children || this.isEmpty) {
      return;
    }

    if (animated) {
      let index = 0;
      const addAChild = () => {
        const key = this.keys[index];
        const formatter = new JsonExplorer(this.json[key], this.open - 1, this.config, key);
        children.appendChild(formatter.render());

        index += 1;

        if (index < this.keys.length) {
          if (index > MAX_ANIMATED_TOGGLE_ITEMS) {
            addAChild();
          } else {
            requestAnimationFrame(addAChild);
          }
        }
      };

      requestAnimationFrame(addAChild);
    } else {
      this.keys.forEach(key => {
        const formatter = new JsonExplorer(this.json[key], this.open - 1, this.config, key);
        children.appendChild(formatter.render());
      });
    }
  }


/**
   * Removes all the children from children element
   * Animated option is used when user triggers this via a click
   */
removeChildren(animated = false) {
    const childrenElement = this.element.querySelector(`div.${cssClass('children')}`) as HTMLDivElement;

    if (animated) {
      let childrenRemoved = 0;
      const removeAChild = () => {
        if (childrenElement && childrenElement.children.length) {
          childrenElement.removeChild(childrenElement.children[0]);
          childrenRemoved += 1;
          if (childrenRemoved > MAX_ANIMATED_TOGGLE_ITEMS) {
            removeAChild();
          } else {
            requestAnimationFrame(removeAChild);
          }
        }
      };
      requestAnimationFrame(removeAChild);
    } else {
      if (childrenElement) {
        childrenElement.innerHTML = '';
      }
    }
  }


({
    visible,
    selectedSubSections,
    onSubsectionChange,
    config,
    sites,
    isRemote,
}) => {
    const siteInfos = useMemo(() => {
        return sites.map((swa) => {
            return swa.site;
        });
    }, [sites]);

    return (
        <>
            <Fade in={visible}>

enable jira features to see settings

            </Fade>

            <Fade in={visible}>

                    <Grid container spacing={3} direction="column">
                        <Grid item>
                            <AuthPanel
                                visible={visible}
                                expanded={selectedSubSections.includes(ConfigSubSection.Auth)}
                                onSubsectionChange={onSubsectionChange}
                                isRemote={isRemote}
                                sites={sites}
                                product={ProductJira}
                                section={ConfigSection.Jira}
                            />
                        </Grid>
                        <Grid item>
                            <JiraExplorerPanel
                                visible={visible}
                                expanded={selectedSubSections.includes(ConfigSubSection.Issues)}
                                onSubsectionChange={onSubsectionChange}
                                sites={siteInfos}
                                jqlList={config[`${ConfigSection.Jira}.jqlList`]}
                                enabled={config[`${ConfigSection.Jira}.explorer.enabled`]}
                                nestSubtasks={config[`${ConfigSection.Jira}.explorer.nestSubtasks`]}
                                fetchAllQueryResults={config[`${ConfigSection.Jira}.explorer.fetchAllQueryResults`]}
                                monitorEnabled={config[`${ConfigSection.Jira}.explorer.monitorEnabled`]}
                                refreshInterval={config[`${ConfigSection.Jira}.explorer.refreshInterval`]}
                            />
                        </Grid>
                        <Grid item>
                            <JiraHoversPanel
                                visible={visible}
                                expanded={selectedSubSections.includes(ConfigSubSection.Hovers)}
                                onSubsectionChange={onSubsectionChange}
                                enabled={config[`${ConfigSection.Jira}.hover.enabled`]}
                            />
                        </Grid>
                        <Grid item>
                            <JiraTriggersPanel
                                visible={visible}
                                expanded={selectedSubSections.includes(ConfigSubSection.Triggers)}
                                onSubsectionChange={onSubsectionChange}
                                enabled={config[`${ConfigSection.Jira}.todoIssues.enabled`]}
                                triggers={config[`${ConfigSection.Jira}.todoIssues.triggers`]}
                            />
                        </Grid>
                        <Grid item>
                            <StartWorkPanel
                                visible={visible}
                                expanded={selectedSubSections.includes(ConfigSubSection.StartWork)}
                                onSubsectionChange={onSubsectionChange}
                                customPrefixes={config[`${ConfigSection.Jira}.startWorkBranchTemplate.customPrefixes`]}
                                customTemplate={config[`${ConfigSection.Jira}.startWorkBranchTemplate.customTemplate`]}
                            />
                        </Grid>
                        <Grid item>
                            <StatusBarPanel
                                visible={visible}
                                expanded={selectedSubSections.includes(ConfigSubSection.Status)}
                                onSubsectionChange={onSubsectionChange}
                                configSection={ConfigSection.Jira}
                                productName={ProductJira.name}
                                enabled={config[`${ConfigSection.Jira}.statusbar.enabled`]}
                                showProduct={config[`${ConfigSection.Jira}.statusbar.showProduct`]}
                                showUser={config[`${ConfigSection.Jira}.statusbar.showUser`]}
                                showLogin={config[`${ConfigSection.Jira}.statusbar.showLogin`]}
                            />
                        </Grid>
                    </Grid>

            </Fade>
        </>


() => {
        return sites.map((swa) => {
            return swa.site;
        });
    }


(swa) => {
            return swa.site;
        }


type JiraPanelProps = CommonPanelProps & {
    config: { [key: string]: any };
    sites: SiteWithAuthInfo[];
    isRemote: boolean;
    onSubsectionChange: (subSection: ConfigSubSection, expanded: boolean) => void;
};


export class AssessmentReportModelBuilderFactory {
    public create(
        assessmentsProvider: AssessmentsProvider,
        assessmentStoreData: AssessmentStoreData,
        targetAppInfo: TargetAppData,
        reportDate: Date,
        assessmentDefaultMessageGenerator: AssessmentDefaultMessageGenerator,
    ): AssessmentReportModelBuilder {
        return new AssessmentReportModelBuilder(
            assessmentsProvider,
            assessmentStoreData,
            targetAppInfo,
            reportDate,
            assessmentDefaultMessageGenerator,
        );
    }
}


public create(
        assessmentsProvider: AssessmentsProvider,
        assessmentStoreData: AssessmentStoreData,
        targetAppInfo: TargetAppData,
        reportDate: Date,
        assessmentDefaultMessageGenerator: AssessmentDefaultMessageGenerator,
    ): AssessmentReportModelBuilder {
        return new AssessmentReportModelBuilder(
            assessmentsProvider,
            assessmentStoreData,
            targetAppInfo,
            reportDate,
            assessmentDefaultMessageGenerator,
        );
    }


() => ({
		template: `

Ordered List

One

Two

Three

Unordered List

One

Two

Three

		`
	})


() => ({
		template: `

Ordered List

					One

Nested one

Nested two

Nested three

Two

Three

Unordered List

					One

Nested one

Nested two

Nested three

Two

Three

		`
	})


() => ({
		template: `
			<ibm-documentation src="documentation/directives/List.html"></ibm-documentation>
		`
	})


function testFix(input: string, expected: string) {
  testRuleFixSingle(input, expected, new UnusedVariables());
}


async function runMulti(files: MemoryFile[]): Promise<Issue[]> {
  const reg = new Registry().addFiles(files);
  await reg.parseAsync();
  const rule = new UnusedVariables().initialize(reg);
  let issues: Issue[] = [];
  for (const o of reg.getObjects()) {
    issues = issues.concat(rule.run(o));
  }
  return issues;
}


async function runSingle(abap: string): Promise<Issue[]> {
  const reg = new Registry().addFile(new MemoryFile("zfoo.prog.abap", abap));
  await reg.parseAsync();
  return new UnusedVariables().initialize(reg).run(reg.getFirstObject()!);
}


async () => {
    const abap = "parser error";
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = "parser error.";
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = "WRITE bar.";
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = "DATA foo.";
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(1);
  }


async () => {
    const abap = "DATA foo.\nWRITE foo.";
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap =
`CLASS lcl_foo DEFINITION.
  PRIVATE SECTION.
    METHODS bar.
    DATA: mv_bits TYPE string.
ENDCLASS.

CLASS lcl_foo IMPLEMENTATION.
  METHOD bar.
    mv_bits = '123'.
  ENDMETHOD.
ENDCLASS.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
CLASS lcl_abapgit_zlib_stream DEFINITION.
  PUBLIC SECTION.
    METHODS take_int
      IMPORTING
        !iv_length    TYPE i
      RETURNING
        VALUE(rv_int) TYPE i.
ENDCLASS.

CLASS lcl_abapgit_zlib_stream IMPLEMENTATION.
  METHOD take_int.
    WRITE iv_length TO rv_int.
  ENDMETHOD.
ENDCLASS.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
    DATA lt_bar TYPE STANDARD TABLE OF i.
    APPEND sdfsdf TO lt_bar.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    testFix("DATA foo.", "");
  }


async () => {
    testFix("DATA foo TYPE i.", "");
  }


async () => {
    const abap = `
CLASS lcl_bar DEFINITION.
  PRIVATE SECTION.
    METHODS m1.
    DATA field TYPE string.
ENDCLASS.

CLASS lcl_bar IMPLEMENTATION.
  METHOD m1.
  ENDMETHOD.
ENDCLASS.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(1);
  }


async () => {
    const abap = `
CLASS lcl_bar DEFINITION.
  PRIVATE SECTION.
    METHODS m1.
    DATA field TYPE string.
ENDCLASS.

CLASS lcl_bar IMPLEMENTATION.
  METHOD m1.
    WRITE me->field.
  ENDMETHOD.
ENDCLASS.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
  DATA: lo_zip TYPE REF TO cl_abap_zip.
  lo_zip->save( ).`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
  DATA: lo_zip TYPE REF TO cl_abap_zip.
  CREATE OBJECT lo_zip.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
    DATA lv_task TYPE c.
    CALL FUNCTION 'ZFOOBAR' STARTING NEW TASK lv_task.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `DATA dummy-name TYPE i.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(1);
    expect(issues[0].getMessage()).to.include("dummy-name");
  }


async () => {
    const abap = `
  DATA obj TYPE REF TO object.
  FIELD-SYMBOLS <tab> TYPE ANY TABLE.
  CALL METHOD obj->('METHOD') PARAMETER-TABLE <tab>.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
    DATA foo TYPE c LENGTH 1.
    NEW cl_void( foo ).`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
  DATA val TYPE abap_bool.
  DATA date TYPE d.
  date = SWITCH #( val
    WHEN abap_true  THEN sy-datum + 1
    WHEN abap_false THEN sy-datum - 1 ).`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
  DATA lv_text TYPE c LENGTH 10.
  UPDATE voided SET areat = lv_text.
  `;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
  DATA obj TYPE REF TO object.
  DATA lv_clsname TYPE string.
  CREATE OBJECT obj TYPE (lv_clsname).
  `;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap1 = `INCLUDE zabapgit_forms.`;
    const abap2 = `
    DATA bar TYPE c.
    FORM run.
      DATA lv_ind TYPE string.
    ENDFORM.
    `;
    const xml2 = `
    <?xml version="1.0" encoding="utf-8"?>
    <abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
     <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
      <asx:values>
       <PROGDIR>
        <NAME>ZABAPGIT_FORMS</NAME>
        <SUBC>I</SUBC>
        <RLOAD>E</RLOAD>
        <UCCHECK>X</UCCHECK>
       </PROGDIR>
      </asx:values>
     </asx:abap>
    </abapGit>`;
    const issues = await runMulti([
      new MemoryFile("zabapgit.prog.abap", abap1),
      new MemoryFile("zabapgit_forms.prog.abap", abap2),
      new MemoryFile("zabapgit_forms.prog.xml", xml2),
    ]);
    expect(issues.length).to.equal(2);
  }


async () => {
    const intf = `
INTERFACE zif_bar.
  DATA moo TYPE c LENGTH 1.
  METHODS m1 IMPORTING bar TYPE string.
ENDINTERFACE.`;
    const clas = `
CLASS zcl_bar DEFINITION.
  PRIVATE SECTION.
    INTERFACES: zif_bar.
    DATA foo TYPE c LENGTH 1.
ENDCLASS.

CLASS zcl_bar IMPLEMENTATION.
  METHOD zif_bar~m1.
  ENDMETHOD.
ENDCLASS.`;
    const issues = await runMulti([
      new MemoryFile("zcl_bar.clas.abap", clas),
      new MemoryFile("zif_bar.intf.abap", intf),
    ]);
    // todo, interfaces are currently ignored
    expect(issues.length).to.equal(1);
  }


async () => {
    testFix(`DATA: foo, bar.
WRITE bar.`, `DATA:  bar.
WRITE bar.`);
  }


async () => {
    const abap = `
    DATA lv_index1 TYPE i.
    DATA lv_index2 TYPE i.
    lv_index1 = lv_index2 = 2.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
  DATA lv_int1 TYPE i.
  DATA lv_int2 TYPE i.
  WHILE lv_int1 < lv_int2.
  ENDWHILE.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
  DATA lv_name TYPE string VALUE 'TADIR-DEVCLASS'.
  SELECT-OPTIONS s_devcl FOR (lv_name).
  CLEAR s_devcl.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
    DATA rb_langa TYPE c.
    DATA(language) = COND #( WHEN rb_langa = abap_true THEN '%' ELSE 'a' ).
    WRITE language.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
DATA:
  lt_values TYPE TABLE OF string,
  lv_id   TYPE c,
  lv_test TYPE string.

EXPORT values = lt_values TO DATABASE rsix(zz) FROM lv_test ID lv_id.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
    DATA r_result TYPE string.
    SELECT column INTO @r_result UP TO 1 ROWS FROM voided_table.
    ENDSELECT.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
    DATA bar TYPE abap_bool.
    CHECK bar = abap_false.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
    DATA tab TYPE STANDARD TABLE OF i.
    DATA index TYPE i.
    WRITE tab[ index ].`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
CLASS lcl_bar DEFINITION.
  PUBLIC SECTION.
    METHODS constructor.
  PRIVATE SECTION.
    DATA order TYPE string.
ENDCLASS.
CLASS lcl_bar IMPLEMENTATION.
  METHOD constructor.
    me->order = '2'.
  ENDMETHOD.
ENDCLASS.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
    DATA str TYPE string.
    WRITE CONV string( str ).`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
    DATA foo TYPE i.
    DATA bar LIKE foo.
    WRITE bar.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
    DATA foo TYPE c LENGTH 1.
    DATA(ref) = REF #( foo ).
    CLEAR ref.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
  CONSTANTS foo TYPE c VALUE 'F'.
  CONSTANTS bar TYPE c VALUE 'B'.
  LOG-POINT ID zvoid SUBKEY foo FIELDS bar.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
  DATA lc_func TYPE funcname VALUE 'SDFSDF'.
  CALL FUNCTION lc_func.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
FORM foo.
  TYPES: BEGIN OF ty_stru,
           bar TYPE i,
         END OF ty_stru.
  DATA tree TYPE ty_stru.
  DATA structure LIKE tree.
  MOVE-CORRESPONDING structure TO tree.
ENDFORM.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
  DATA lv_action TYPE string.
  RAISE EVENT foobar
    EXPORTING
      action = lv_action.`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


async () => {
    const abap = `
  CLASS lcl_bar DEFINITION.
  ENDCLASS.
  CLASS lcl_bar IMPLEMENTATION.
  ENDCLASS.
  DATA lv_action TYPE string.
  NEW lcl_bar( lv_action ).`;
    const issues = await runSingle(abap);
    expect(issues.length).to.equal(0);
  }


/**
 * Gets a fixed {@link (PaletteDirectionValue:variable)} from {@link PaletteDirection} which may be a function that needs to be resolved.
 *
 * @param direction - A fixed palette direction value or a function that resolves to one
 * @returns A fixed palette direction value
 *
 * @public
 */
export function resolvePaletteDirection(
    direction: PaletteDirection
): PaletteDirectionValue {
    if (typeof direction === "function") {
        return direction();
    } else {
        return direction;
    }
}


(value: T) => contrast(reference, value) >= contrastTarget


(previous, next) =>
            Math.abs(next.relativeLuminance - reference.relativeLuminance) <
            Math.abs(previous.relativeLuminance - reference.relativeLuminance)
                ? next
                : previous


/**
 * A base {@link Palette} with a common implementation of the interface. Use PaletteRGB for an implementation
 * of a palette generation algorithm that is ready to be used directly, or extend this class to generate custom Swatches.
 *
 * @public
 */
export class BasePalette<T extends Swatch> implements Palette<T> {
    /**
     * {@inheritdoc Palette.source}
     */
    readonly source: T;
    /**
     * {@inheritdoc Palette.swatches}
     */
    readonly swatches: ReadonlyArray<T>;

    /**
     * An index pointer to the end of the palette.
     */
    readonly lastIndex: number;

    /**
     * A copy of the `Swatch`es in reverse order, used for optimized searching.
     */
    readonly reversedSwatches: ReadonlyArray<T>;

    /**
     * Cache from `relativeLuminance` to `Swatch` index in the `Palette`.
     */
    readonly closestIndexCache = new Map<number, number>();

    /**
     * Creates a new Palette.
     *
     * @param source - The source color for the Palette
     * @param swatches - All Swatches in the Palette
     */
    constructor(source: T, swatches: ReadonlyArray<T>) {
        this.source = source;
        this.swatches = swatches;

        this.reversedSwatches = Object.freeze([...this.swatches].reverse());
        this.lastIndex = this.swatches.length - 1;
    }

    /**
     * {@inheritdoc Palette.colorContrast}
     */
    colorContrast(
        reference: RelativeLuminance,
        contrastTarget: number,
        initialSearchIndex?: number,
        direction: PaletteDirection = directionByIsDark(reference)
    ): T {
        if (initialSearchIndex === undefined) {
            initialSearchIndex = this.closestIndexOf(reference);
        }

        let source: ReadonlyArray<T> = this.swatches;
        const endSearchIndex = this.lastIndex;
        let startSearchIndex = initialSearchIndex;

        const condition = (value: T) => contrast(reference, value) >= contrastTarget;

        if (direction === PaletteDirectionValue.lighter) {
            source = this.reversedSwatches;
            startSearchIndex = endSearchIndex - startSearchIndex;
        }

        return binarySearch(source, condition, startSearchIndex, endSearchIndex);
    }

    /**
     * {@inheritdoc Palette.delta}
     */
    delta(reference: RelativeLuminance, delta: number, direction: PaletteDirection): T {
        const dir = resolvePaletteDirection(direction);
        return this.get(this.closestIndexOf(reference) + dir * delta);
    }

    /**
     * {@inheritdoc Palette.closestIndexOf}
     */
    closestIndexOf(reference: RelativeLuminance): number {
        if (this.closestIndexCache.has(reference.relativeLuminance)) {
            /* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
            return this.closestIndexCache.get(reference.relativeLuminance)!;
        }

        let index = this.swatches.indexOf(reference as T);

        if (index !== -1) {
            this.closestIndexCache.set(reference.relativeLuminance, index);
            return index;
        }

        const closest = this.swatches.reduce((previous, next) =>
            Math.abs(next.relativeLuminance - reference.relativeLuminance) <
            Math.abs(previous.relativeLuminance - reference.relativeLuminance)
                ? next
                : previous
        );

        index = this.swatches.indexOf(closest);
        this.closestIndexCache.set(reference.relativeLuminance, index);

        return index;
    }

    /**
     * {@inheritdoc Palette.get}
     */
    get(index: number): T {
        return this.swatches[index] || this.swatches[clamp(index, 0, this.lastIndex)];
    }
}


/**
 * A collection of {@link Swatch}es that form a luminance gradient from light (index 0) to dark.
 *
 * @public
 */
export interface Palette<T extends Swatch = Swatch> {
    /**
     * The Swatch used to create the full palette.
     */
    readonly source: T;

    /**
     * The array of all Swatches from light to dark.
     */
    readonly swatches: ReadonlyArray<T>;

    /**
     * Returns a Swatch from the Palette that most closely meets
     * the `minContrast` ratio for to the `reference`.
     *
     * @param reference - The relative luminance of the reference
     * @param minContrast - The minimum amount of contrast from the `reference`
     * @param initialIndex - Optional starting point for the search
     * @param direction - Optional control for the direction of the search
     * @returns The Swatch that meets the provided contrast
     */
    colorContrast(
        reference: RelativeLuminance,
        minContrast: number,
        initialIndex?: number,
        direction?: PaletteDirection
    ): T;

    /**
     * Returns a Swatch from the Palette that's the specified position and direction away from the `reference`.
     *
     * @param reference - The relative luminance of the reference
     * @param delta - The number of Swatches away from `reference`
     * @param direction - The direction to go from `reference`, 1 goes darker, -1 goes lighter
     */
    delta(reference: RelativeLuminance, delta: number, direction: PaletteDirection): T;

    /**
     * Returns the index of the Palette that most closely matches
     * the provided relative luminance.
     *
     * @param reference - The relative luminance of the reference
     * @returns The index
     */
    closestIndexOf(reference: RelativeLuminance): number;

    /**
     * Gets a Swatch by index. Index is clamped to the limits
     * of the Palette so a Swatch will always be returned.
     *
     * @param index - The index
     * @returns The Swatch
     */
    get(index: number): T;
}


/**
 * Directional values for navigating {@link Swatch}es in {@link Palette}.
 *
 * @public
 */
export type PaletteDirectionValue = typeof PaletteDirectionValue[keyof typeof PaletteDirectionValue];


// I know we like to avoid enums so I tried to make it an object, but I'm not sure how to make this work with the type and function below.
// export const PaletteDirectionValue = {
//     darker: 1,
//     lighter: -1
// } as const;
/**
 * Convenience type to allow a fixed {@link (PaletteDirectionValue:variable)} or a function that resolves to one.
 *
 * @public
 */
export type PaletteDirection = PaletteDirectionValue | (() => PaletteDirectionValue);


/**
     * {@inheritdoc Palette.colorContrast}
     */
colorContrast(
        reference: RelativeLuminance,
        contrastTarget: number,
        initialSearchIndex?: number,
        direction: PaletteDirection = directionByIsDark(reference)
    ): T {
        if (initialSearchIndex === undefined) {
            initialSearchIndex = this.closestIndexOf(reference);
        }

        let source: ReadonlyArray<T> = this.swatches;
        const endSearchIndex = this.lastIndex;
        let startSearchIndex = initialSearchIndex;

        const condition = (value: T) => contrast(reference, value) >= contrastTarget;

        if (direction === PaletteDirectionValue.lighter) {
            source = this.reversedSwatches;
            startSearchIndex = endSearchIndex - startSearchIndex;
        }

        return binarySearch(source, condition, startSearchIndex, endSearchIndex);
    }


/**
     * {@inheritdoc Palette.delta}
     */
delta(reference: RelativeLuminance, delta: number, direction: PaletteDirection): T {
        const dir = resolvePaletteDirection(direction);
        return this.get(this.closestIndexOf(reference) + dir * delta);
    }


/**
     * {@inheritdoc Palette.closestIndexOf}
     */
closestIndexOf(reference: RelativeLuminance): number {
        if (this.closestIndexCache.has(reference.relativeLuminance)) {
            /* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
            return this.closestIndexCache.get(reference.relativeLuminance)!;
        }

        let index = this.swatches.indexOf(reference as T);

        if (index !== -1) {
            this.closestIndexCache.set(reference.relativeLuminance, index);
            return index;
        }

        const closest = this.swatches.reduce((previous, next) =>
            Math.abs(next.relativeLuminance - reference.relativeLuminance) <
            Math.abs(previous.relativeLuminance - reference.relativeLuminance)
                ? next
                : previous
        );

        index = this.swatches.indexOf(closest);
        this.closestIndexCache.set(reference.relativeLuminance, index);

        return index;
    }


/**
     * {@inheritdoc Palette.get}
     */
get(index: number): T {
        return this.swatches[index] || this.swatches[clamp(index, 0, this.lastIndex)];
    }


message => this.onHeartbeatMessage(message)


() => this.emit('timeout')


() => {
      if (this.timeout) { clearTimeout(this.timeout); }
      this.timeout = undefined;

      this.pingTimer = setTimeout(() => {
        this.pingTimer = undefined;
        this.ping();
      }, this.intervalValue * 1000);
    }


() => {
        this.pingTimer = undefined;
        this.ping();
      }


/**
 * @category Controllers
 */
export class HeartbeatController extends BaseController<
  HeartbeatChannel, HeartbeatControllerEvents
> {

  private readonly DEFAULT_INTERVAL = 5; // seconds
  private readonly TIMEOUT_FACTOR = 3; // timeouts after 3 intervals

  private pingTimer: Timeout | undefined;
  private timeout: Timeout | undefined;
  private intervalValue = this.DEFAULT_INTERVAL;

  constructor(client?: Client, sourceId?: string, destinationId?: string) {
    super(client, sourceId, destinationId, Namespaces.Heartbeat);

    this.on('message', message => this.onHeartbeatMessage(message));
    this.once('close', this.onHeartbeatClose);
  }

  private onHeartbeatMessage(message: BaseControllerMessage<HeartbeatChannel['message']>) {
    if (message.data.type === 'PONG') {
      this.emit('pong');
    }
  }

  private onHeartbeatClose() {
    this.removeListener('message', this.onHeartbeatMessage);
    this.stop();
  }

  // TODO: refactor this, () => () => not elegant and can lead to scope/context issues
  private ping(): void {
    if (this.timeout) {
      // We already have a ping in progress.
      return;
    }

    this.timeout = setTimeout(
      () => this.emit('timeout'),
      this.intervalValue * 1000 * this.TIMEOUT_FACTOR,
    );

    this.once('pong', () => {
      if (this.timeout) { clearTimeout(this.timeout); }
      this.timeout = undefined;

      this.pingTimer = setTimeout(() => {
        this.pingTimer = undefined;
        this.ping();
      }, this.intervalValue * 1000);
    });

    this.send({ type: 'PING' });
  }

  public start(intervalValue?: number): void {
    if (intervalValue) { this.intervalValue = intervalValue; }

    this.ping();
  }

  public stop(): void {
    if (this.pingTimer) { clearTimeout(this.pingTimer); }
    if (this.timeout) { clearTimeout(this.timeout); }

    this.removeAllListeners('pong');
  }

}


export interface HeartbeatControllerEvents {
  pong: () => void;
  timeout: () => void;
}


type Timeout = ReturnType<typeof setTimeout>;


private onHeartbeatMessage(message: BaseControllerMessage<HeartbeatChannel['message']>) {
    if (message.data.type === 'PONG') {
      this.emit('pong');
    }
  }


private onHeartbeatClose() {
    this.removeListener('message', this.onHeartbeatMessage);
    this.stop();
  }


// TODO: refactor this, () => () => not elegant and can lead to scope/context issues
private ping(): void {
    if (this.timeout) {
      // We already have a ping in progress.
      return;
    }

    this.timeout = setTimeout(
      () => this.emit('timeout'),
      this.intervalValue * 1000 * this.TIMEOUT_FACTOR,
    );

    this.once('pong', () => {
      if (this.timeout) { clearTimeout(this.timeout); }
      this.timeout = undefined;

      this.pingTimer = setTimeout(() => {
        this.pingTimer = undefined;
        this.ping();
      }, this.intervalValue * 1000);
    });

    this.send({ type: 'PING' });
  }


public start(intervalValue?: number): void {
    if (intervalValue) { this.intervalValue = intervalValue; }

    this.ping();
  }


public stop(): void {
    if (this.pingTimer) { clearTimeout(this.pingTimer); }
    if (this.timeout) { clearTimeout(this.timeout); }

    this.removeAllListeners('pong');
  }


export class TypeormUserRepository implements IUsersRepository {
  private repository: Repository<User>;

  constructor() {
    this.repository = getRepository(User);
  }

  async create({ email, name }: ICreateUserDTO): Promise<User> {
    const user = this.repository.create({
      name,
      email,
    });

    await this.repository.save(user);

    return user;
  }

  async findByEmail(email: string): Promise<User | undefined> {
    return this.repository.findOne({ where: { email } });
  }
}


async create({ email, name }: ICreateUserDTO): Promise<User> {
    const user = this.repository.create({
      name,
      email,
    });

    await this.repository.save(user);

    return user;
  }


async findByEmail(email: string): Promise<User | undefined> {
    return this.repository.findOne({ where: { email } });
  }


export class RenameClientForm extends Form<FormGroup, UpdateClientDto, ClientDto> {
    constructor(formBuilder: FormBuilder) {
        super(formBuilder.group({
            name: ['',
                [
                    Validators.required
                ]
            ]
        }));
    }
}


export class AddClientForm extends Form<FormGroup, CreateClientDto> {
    public hasNoId = hasNoValue$(this.form.controls['id']);

    constructor(formBuilder: FormBuilder) {
        super(formBuilder.group({
            id: ['',
                [
                    Validators.maxLength(40),
                    ValidatorsEx.pattern('[a-z0-9]+(\-[a-z0-9]+)*', 'i18n:clients.clientIdValidationMessage')
                ]
            ]
        }));
    }
}


@NgModule({
  declarations: [RegistrationComponent],
  imports: [
    CommonModule,
    FormsModule,
    ReactiveFormsModule,
    IonicModule,
    RouterModule.forChild(routes)
  ]
})
export class RegistrationModule { }


// Some common format strings
interface DateFormatMasks {
  "default": string;
  shortDate: string;
  mediumDate: string;
  longDate: string;
  fullDate: string;
  shortTime: string;
  mediumTime: string;
  longTime: string;
  isoDate: string;
  isoTime: string;
  isoDateTime: string;
  isoUtcDateTime: string;
}


// Internationalization strings
interface DateFormatI18n {
  dayNames: string[];
  monthNames: string[];
}


({ element, defaultAccordionValue }) => {
    const handler = useEventActionHandler();

    // Let's preserve backwards compatibility by extracting href and newTab properties from deprecated
    //  "link" element object if it exists, otherwise we'll use the newer "action" element object
    let href: string, newTab: boolean;

    if (element.data?.link && !element.data?.action) {
        href = element.data?.link?.href;
        newTab = element.data?.link?.newTab;
    } else {
        href = element.data?.action?.href;
        newTab = element.data?.action?.newTab;
    }

    const { clickHandler, actionType, parameters } = element.data?.action || {};

    const updateElement = (element: PbEditorElement) => {
        handler.trigger(
            new UpdateElementActionEvent({
                element,
                history: true
            })
        );
    };

    const updateSettings = data => {
        const attrKey = `data.action`;
        const newElement: PbEditorElement = merge(element, attrKey, data);
        updateElement(newElement);
    };

    const clickHandlers = useMemo(
        () =>
            plugins.byType<PbButtonElementClickHandlerPlugin>(
                "pb-page-element-button-click-handler"
            ),
        []
    );

    return (
        <Accordion title={"Action"} defaultValue={defaultAccordionValue}>
            <Form
                data={{ href, newTab, clickHandler, actionType, parameters }}
                onChange={updateSettings}
            >
                {({ Bind })


(element: PbEditorElement) => {
        handler.trigger(
            new UpdateElementActionEvent({
                element,
                history: true
            })
        );
    }


data => {
        const attrKey = `data.action`;
        const newElement: PbEditorElement = merge(element, attrKey, data);
        updateElement(newElement);
    }


() =>
            plugins.byType<PbButtonElementClickHandlerPlugin>(
                "pb-page-element-button-click-handler"
            )


({ id, name }) => (
                                                    <Radio
                                                        key={id}


plugin => {
                                                    return {
                                                        id: plugin.name,
                                                        name: plugin.title
                                                    };
                                                }


option => option.id === value


handler => clickHandler === handler.name


(parameter, index) => {
                                                                    return (
                                                                        <InputField
                                                                            key={index}
                                                                            description={
                                                                                parameter.label
                                                                            }
                                                                            value={value[index]}
                                                                            placeholder={
                                                                                parameter.label
                                                                            }
                                                                            onChange={val => {
                                                                                const tempArray = [
                                                                                ...value
                                                                                ];
                                                                                tempArray[index] =
                                                                                val;
                                                                                onChange(tempArray);
                                                                            }}


type ActionSettingsPropsType = {
    element: PbEditorElement;
};


getValue(id)


onChange(id)


parameters ? (
                                                            selectedHandler


q => q.id === id


c => c.id === id


export default class QueryStore extends Store<QueryState> {
  constructor() {
    super();
    this.state = {
      setting: Setting.getDefault(),
      queries: [],
      dataSources: [],
      charts: [],
      selectedQueryId: null,
      editor: {
        height: null,
        line: null
      }
    };
  }

  reduce(type: string, payload: any): StateBuilder<QueryState> {
    switch (type) {
      case "initialize": {
        return this.merge("setting", payload.setting)
          .mergeList("queries", payload.queries)
          .mergeList("charts", payload.charts)
          .mergeList("dataSources", payload.dataSources);
      }
      case "selectQuery": {
        const idx = this.findQueryIndex(payload.id);
        return this.set("selectedQueryId", payload.id)
          .set("editor.line", null)
          .merge(`queries.${idx}`, payload.query);
      }
      case "addNewQuery": {
        return this.set("selectedQueryId", payload.query.id)
          .set("editor.line", null)
          .prepend("queries", payload.query);
      }
      case "updateQuery": {
        const idx = this.findQueryIndex(payload.id);
        return this.merge(`queries.${idx}`, payload.params);
      }
      case "deleteQuery": {
        const idx = this.findQueryIndex(payload.id);
        return this.set("selectedQueryId", null)
          .set("editor.line", null)
          .del(`queries.${idx}`);
      }
      case "updateEditor": {
        return this.merge("editor", payload);
      }
      case "selectResultTab": {
        const idx = this.findQueryIndex(payload.id);
        return this.set(`queries.${idx}.selectedTab`, payload.name);
      }
      case "addChart": {
        return this.append("charts", payload.chart);
      }
      case "updateChart": {
        const idx = this.findChartIndex(payload.id);
        return this.merge(`charts.${idx}`, payload.params);
      }
      default: {
        throw new Error("Invalid type");
      }
    }
  }

  findQueryIndex(id: number): number {
    const idx = this.state.queries.findIndex(q => q.id === id);

    if (idx === -1) {
      throw new Error(`query id:${id} not found`);
    }

    return idx;
  }

  findChartIndex(id: number): number {
    const idx = this.state.charts.findIndex(c => c.id === id);

    if (idx === -1) {
      throw new Error(`chart id:${id} not found`);
    }

    return idx;
  }
}


export interface QueryState {
  setting: SettingType;
  queries: QueryType[];
  dataSources: DataSourceType[];
  charts: ChartType[];
  selectedQueryId: number | null;
  editor: {
    height: number | null;
    line: number | null;
  };
}


reduce(type: string, payload: any): StateBuilder<QueryState> {
    switch (type) {
      case "initialize": {
        return this.merge("setting", payload.setting)
          .mergeList("queries", payload.queries)
          .mergeList("charts", payload.charts)
          .mergeList("dataSources", payload.dataSources);
      }
      case "selectQuery": {
        const idx = this.findQueryIndex(payload.id);
        return this.set("selectedQueryId", payload.id)
          .set("editor.line", null)
          .merge(`queries.${idx}`, payload.query);
      }
      case "addNewQuery": {
        return this.set("selectedQueryId", payload.query.id)
          .set("editor.line", null)
          .prepend("queries", payload.query);
      }
      case "updateQuery": {
        const idx = this.findQueryIndex(payload.id);
        return this.merge(`queries.${idx}`, payload.params);
      }
      case "deleteQuery": {
        const idx = this.findQueryIndex(payload.id);
        return this.set("selectedQueryId", null)
          .set("editor.line", null)
          .del(`queries.${idx}`);
      }
      case "updateEditor": {
        return this.merge("editor", payload);
      }
      case "selectResultTab": {
        const idx = this.findQueryIndex(payload.id);
        return this.set(`queries.${idx}.selectedTab`, payload.name);
      }
      case "addChart": {
        return this.append("charts", payload.chart);
      }
      case "updateChart": {
        const idx = this.findChartIndex(payload.id);
        return this.merge(`charts.${idx}`, payload.params);
      }
      default: {
        throw new Error("Invalid type");
      }
    }
  }


findQueryIndex(id: number): number {
    const idx = this.state.queries.findIndex(q => q.id === id);

    if (idx === -1) {
      throw new Error(`query id:${id} not found`);
    }

    return idx;
  }


findChartIndex(id: number): number {
    const idx = this.state.charts.findIndex(c => c.id === id);

    if (idx === -1) {
      throw new Error(`chart id:${id} not found`);
    }

    return idx;
  }


({name,label,example,typing,...rest}) => {
  return(

		{label}
		<input type={typing} id={name} placeholder={example}{...rest}/>


/*
	src/components/input/index.tsx, 11/18/2020
	Author: Weslley Borges dos Santos
	Este arquivo é o HTML do componente input
*/
interface InputProps extends InputHTMLAttributes<HTMLInputElement>{
	name: string
	label: string
	example?: string
	typing: string
}


@Component({
  selector: 'app-server-element',
  templateUrl: './server-element.component.html',
  styleUrls: ['./server-element.component.css']
})
export class ServerElementComponent implements OnInit {
  @Input('srvElement') element: {type: string, name: string, content: string};

  constructor() { }

  ngOnInit() {
  }

}


export function HardwareAuthenticator({
  addMethod,
  setAddMethod,
  setShowDefaultFooter,
  onSuccess,
}: AddAccountMethodProps & {
  addMethod: AddAccountMethodTypes
  setShowDefaultFooter: (show: boolean) => void
}) {
  const isCreate = addMethod === AddAccountMethodTypes.createAuthenticator

  React.useEffect(() => {
    setShowDefaultFooter(false)
    return () => {
      setShowDefaultFooter(true)
    }
  }, [setShowDefaultFooter])

  return isCreate ? (
    <CreateContextProvider>
      <CreateFlow setAddMethod={setAddMethod} onSuccess={onSuccess} />
    </CreateContextProvider>
  ) : (
    <ImportFlow setAddMethod={setAddMethod} onSuccess={onSuccess} />
  )
}


() => {
    setShowDefaultFooter(false)
    return () => {
      setShowDefaultFooter(true)
    }
  }


() => {
      setShowDefaultFooter(true)
    }


export async function postinstall(cwd: string, shouldFix: boolean) {
  const config = initConfig(requireSource(CONFIG_PATH).default);

  const { keystone, graphQLSchema } = createSystem(config);

  if (shouldFix) {
    await generateCommittedArtifacts(graphQLSchema, keystone, cwd);
    console.log('✨ Generated GraphQL and Prisma schemas');
  } else {
    await validateCommittedArtifacts(graphQLSchema, keystone, cwd);
    console.log('✨ GraphQL and Prisma schemas are up to date');
  }
  await generateNodeModulesArtifacts(graphQLSchema, keystone, cwd);
}


(getDefaultMiddleware) =>
    getDefaultMiddleware({
      serializableCheck: {
        // this is used because of https://github.com/rt2zz/redux-persist/issues/988
        ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER],
      },
    })


export type RootState = ReturnType<typeof store.getState>;


/**
 * Inferred type from reducers
 */
export type AppDispatch = typeof store.dispatch;


export default function AppLayout(props: Props) {
  const { children } = props;

  return (
    <Layout style={{ minHeight: '100vh' }}


type Props = {
  children: ReactNode;
};


(context: Context, locations: UniformLocations): FillUniformsType => ({
    'u_matrix': new UniformMatrix4f(context, locations.u_matrix)
})


(context: Context, locations: UniformLocations): FillPatternUniformsType => ({
    'u_matrix': new UniformMatrix4f(context, locations.u_matrix),
    'u_image': new Uniform1i(context, locations.u_image),
    'u_texsize': new Uniform2f(context, locations.u_texsize),
    'u_pixel_coord_upper': new Uniform2f(context, locations.u_pixel_coord_upper),
    'u_pixel_coord_lower': new Uniform2f(context, locations.u_pixel_coord_lower),
    'u_scale': new Uniform3f(context, locations.u_scale),
    'u_fade': new Uniform1f(context, locations.u_fade)
})


(context: Context, locations: UniformLocations): FillOutlineUniformsType => ({
    'u_matrix': new UniformMatrix4f(context, locations.u_matrix),
    'u_world': new Uniform2f(context, locations.u_world)
})


(context: Context, locations: UniformLocations): FillOutlinePatternUniformsType => ({
    'u_matrix': new UniformMatrix4f(context, locations.u_matrix),
    'u_world': new Uniform2f(context, locations.u_world),
    'u_image': new Uniform1i(context, locations.u_image),
    'u_texsize': new Uniform2f(context, locations.u_texsize),
    'u_pixel_coord_upper': new Uniform2f(context, locations.u_pixel_coord_upper),
    'u_pixel_coord_lower': new Uniform2f(context, locations.u_pixel_coord_lower),
    'u_scale': new Uniform3f(context, locations.u_scale),
    'u_fade': new Uniform1f(context, locations.u_fade)
})


(matrix: mat4): UniformValues<FillUniformsType> => ({
    'u_matrix': matrix
})


(
    matrix: mat4,
    painter: Painter,
    crossfade: CrossfadeParameters,
    tile: Tile
): UniformValues<FillPatternUniformsType> => extend(
    fillUniformValues(matrix),
    patternUniformValues(crossfade, painter, tile)
)


(matrix: mat4, drawingBufferSize: [number, number]): UniformValues<FillOutlineUniformsType> => ({
    'u_matrix': matrix,
    'u_world': drawingBufferSize
})


(
    matrix: mat4,
    painter: Painter,
    crossfade: CrossfadeParameters,
    tile: Tile,
    drawingBufferSize: [number, number]
): UniformValues<FillOutlinePatternUniformsType> => extend(
    fillPatternUniformValues(matrix, painter, crossfade, tile),
    {
        'u_world': drawingBufferSize
    }
)


export type FillUniformsType = {
    'u_matrix': UniformMatrix4f;
};


export type FillOutlineUniformsType = {
    'u_matrix': UniformMatrix4f;
    'u_world': Uniform2f;
};


export type FillPatternUniformsType = {
    'u_matrix': UniformMatrix4f;
    // pattern uniforms:
    'u_texsize': Uniform2f;
    'u_image': Uniform1i;
    'u_pixel_coord_upper': Uniform2f;
    'u_pixel_coord_lower': Uniform2f;
    'u_scale': Uniform3f;
    'u_fade': Uniform1f;
};


export type FillOutlinePatternUniformsType = {
    'u_matrix': UniformMatrix4f;
    'u_world': Uniform2f;
    // pattern uniforms:
    'u_texsize': Uniform2f;
    'u_image': Uniform1i;
    'u_pixel_coord_upper': Uniform2f;
    'u_pixel_coord_lower': Uniform2f;
    'u_scale': Uniform3f;
    'u_fade': Uniform1f;
};


export class JsonReturnData {

}


function renderNode(node: Node, getChildren: (node: Node) => (Node[])): JSX.Element {
            const children = getChildren(node);
            const className = "nodeText" + (node === selectedNode ? " " + cssConstants.treeViewer.selectedNodeClass : "");
            const kindName = getSyntaxKindName(api, node.kind);
            const label = (<div onClick={() => onSelectNode(node)}


n => renderNode(n, getChildren)


export class TreeViewer extends React.Component<TreeViewerProps> {
    render() {
        const { sourceFile, selectedNode, onSelectNode, mode, api } = this.props;
        let i = 0;

        return (

{renderNode(this.props.sourceFile, getChildrenFunction(mode, sourceFile))}

        );

        function renderNode(node: Node, getChildren: (node: Node) => (Node[])): JSX.Element {
            const children = getChildren(node);
            const className = "nodeText" + (node === selectedNode ? " " + cssConstants.treeViewer.selectedNodeClass : "");
            const kindName = getSyntaxKindName(api, node.kind);
            const label = (
 onSelectNode(node)} className={className}>{kindName}
);
            if (children.length === 0)
                return (
                    <div key={i++} className="endNode" data


export interface TreeViewerProps {
    api: CompilerApi;
    sourceFile: SourceFile;
    selectedNode: Node;
    onSelectNode: (node: Node) => void;
    mode: TreeMode;
}


render() {
        const { sourceFile, selectedNode, onSelectNode, mode, api } = this.props;
        let i = 0;

        return (

{renderNode(this.props.sourceFile, getChildrenFunction(mode, sourceFile))}

        );

        function renderNode(node: Node, getChildren: (node: Node) => (Node[])): JSX.Element {
            const children = getChildren(node);
            const className = "nodeText" + (node === selectedNode ? " " + cssConstants.treeViewer.selectedNodeClass : "");
            const kindName = getSyntaxKindName(api, node.kind);
            const label = (
 onSelectNode(node)} className={className}>{kindName}
);
            if (children.length === 0)
                return (
                    <div key={i++}


renderNode(this


getChildrenFunction(mode, sourceFile)


(data: m_groupusers[]) => {
        this.m_groupusers = data;
        console.log(this.m_groupusers);
    }


// import * as $ from 'jquery';
// import 'datatables.net'
@Component({
  selector: 'app-groupuser-list',
  templateUrl: './groupuser-list.component.html',
  styleUrls: ['./groupuser-list.component.scss']
})
export class GroupuserListComponent implements OnInit {
  dtOptions: DataTables.Settings = {};
  m_groupusers : m_groupusers[];

  constructor(private groupuserService : MGroupusersService) { }

  ngOnInit() {
    // this.dtOptions = {
    //   pagingType: 'full_numbers'
    // };

    this.groupuserService
      .getGroupusers()
      .subscribe((data: m_groupusers[]) => {
        this.m_groupusers = data;
        console.log(this.m_groupusers);
    });
  }

  add(){

  }

}


ngOnInit() {
    // this.dtOptions = {
    //   pagingType: 'full_numbers'
    // };

    this.groupuserService
      .getGroupusers()
      .subscribe((data: m_groupusers[]) => {
        this.m_groupusers = data;
        console.log(this.m_groupusers);
    });
  }


add(){

  }


e => {
			if (e.affectsConfiguration(TERMINAL_CONFIG_SECTION)) {
				this._updateConfig();
			}
		}


v => '"' + v + '"'


k => `${k}:${envConfigValue.workspace![k]}`


() => this.setWorkspaceShellAllowed(true)


() => this.setWorkspaceShellAllowed(false)


() => {
								/* __GDPR__
								"terminalLaunchRecommendation:popup" : {
									"userReaction" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
									"extensionId": { "classification": "PublicNonPersonalData", "purpose": "FeatureInsight" }
								}
								*/
								this.telemetryService.publicLog('terminalLaunchRecommendation:popup', { userReaction: 'install', extId });
								this.instantiationService.createInstance(InstallRecommendedExtensionAction, extId).run();
							}


() => {
							/* __GDPR__
								"terminalLaunchRecommendation:popup" : {
									"userReaction" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
								}
							*/
							this.telemetryService.publicLog('terminalLaunchRecommendation:popup', { userReaction: 'cancelled' });
						}


extensions => {
			return extensions.some(e => e.identifier.id === id);
		}


e => e.identifier.id === id


private _updateConfig(): void {
		this.config = this._configurationService.getValue<ITerminalConfiguration>(TERMINAL_CONFIG_SECTION);
	}


public configFontIsMonospace(): boolean {
		const fontSize = 15;
		const fontFamily = this.config.fontFamily || this._configurationService.getValue<IEditorOptions>('editor').fontFamily || EDITOR_FONT_DEFAULTS.fontFamily;
		const i_rect = this._getBoundingRectFor('i', fontFamily, fontSize);
		const w_rect = this._getBoundingRectFor('w', fontFamily, fontSize);

		// Check for invalid bounds, there is no reason to believe the font is not monospace
		if (!i_rect || !w_rect || !i_rect.width || !w_rect.width) {
			return true;
		}

		return i_rect.width === w_rect.width;
	}


private _createCharMeasureElementIfNecessary(): HTMLElement {
		if (!this.panelContainer) {
			throw new Error('Cannot measure element when terminal is not attached');
		}
		// Create charMeasureElement if it hasn't been created or if it was orphaned by its parent
		if (!this._charMeasureElement || !this._charMeasureElement.parentElement) {
			this._charMeasureElement = document.createElement('div');
			this.panelContainer.appendChild(this._charMeasureElement);
		}
		return this._charMeasureElement;
	}


private _getBoundingRectFor(char: string, fontFamily: string, fontSize: number): ClientRect | DOMRect | undefined {
		let charMeasureElement: HTMLElement;
		try {
			charMeasureElement = this._createCharMeasureElementIfNecessary();
		} catch {
			return undefined;
		}
		const style = charMeasureElement.style;
		style.display = 'inline-block';
		style.fontFamily = fontFamily;
		style.fontSize = fontSize + 'px';
		style.lineHeight = 'normal';
		charMeasureElement.innerText = char;
		const rect = charMeasureElement.getBoundingClientRect();
		style.display = 'none';

		return rect;
	}


private _measureFont(fontFamily: string, fontSize: number, letterSpacing: number, lineHeight: number): ITerminalFont {
		const rect = this._getBoundingRectFor('X', fontFamily, fontSize);

		// Bounding client rect was invalid, use last font measurement if available.
		if (this._lastFontMeasurement && (!rect || !rect.width || !rect.height)) {
			return this._lastFontMeasurement;
		}

		this._lastFontMeasurement = {
			fontFamily,
			fontSize,
			letterSpacing,
			lineHeight,
			charWidth: rect && rect.width ? rect.width : 0,
			charHeight: rect && rect.height ? Math.ceil(rect.height) : 0
		};
		return this._lastFontMeasurement;
	}


/**
	 * Gets the font information based on the terminal.integrated.fontFamily
	 * terminal.integrated.fontSize, terminal.integrated.lineHeight configuration properties
	 */
public getFont(xterm?: XTermTerminal, excludeDimensions?: boolean): ITerminalFont {
		const editorConfig = this._configurationService.getValue<IEditorOptions>('editor');

		let fontFamily = this.config.fontFamily || editorConfig.fontFamily || EDITOR_FONT_DEFAULTS.fontFamily;
		let fontSize = this._toInteger(this.config.fontSize, MINIMUM_FONT_SIZE, MAXIMUM_FONT_SIZE, EDITOR_FONT_DEFAULTS.fontSize);

		// Work around bad font on Fedora/Ubuntu
		if (!this.config.fontFamily) {
			if (this._linuxDistro === LinuxDistro.Fedora) {
				fontFamily = '\'DejaVu Sans Mono\', monospace';
			}
			if (this._linuxDistro === LinuxDistro.Ubuntu) {
				fontFamily = '\'Ubuntu Mono\', monospace';

				// Ubuntu mono is somehow smaller, so set fontSize a bit larger to get the same perceived size.
				fontSize = this._toInteger(fontSize + 2, MINIMUM_FONT_SIZE, MAXIMUM_FONT_SIZE, EDITOR_FONT_DEFAULTS.fontSize);
			}
		}

		const letterSpacing = this.config.letterSpacing ? Math.max(Math.floor(this.config.letterSpacing), MINIMUM_LETTER_SPACING) : DEFAULT_LETTER_SPACING;
		const lineHeight = this.config.lineHeight ? Math.max(this.config.lineHeight, 1) : DEFAULT_LINE_HEIGHT;

		if (excludeDimensions) {
			return {
				fontFamily,
				fontSize,
				letterSpacing,
				lineHeight
			};
		}

		// Get the character dimensions from xterm if it's available
		if (xterm) {
			if (xterm._core._charSizeService && xterm._core._charSizeService.width && xterm._core._charSizeService.height) {
				return {
					fontFamily,
					fontSize,
					letterSpacing,
					lineHeight,
					charHeight: xterm._core._charSizeService.height,
					charWidth: xterm._core._charSizeService.width
				};
			}
		}

		// Fall back to measuring the font ourselves
		return this._measureFont(fontFamily, fontSize, letterSpacing, lineHeight);
	}


public setWorkspaceShellAllowed(isAllowed: boolean): void {
		this._onWorkspacePermissionsChanged.fire(isAllowed);
		this._storageService.store(IS_WORKSPACE_SHELL_ALLOWED_STORAGE_KEY, isAllowed, StorageScope.WORKSPACE);
	}


public isWorkspaceShellAllowed(defaultValue: boolean | undefined = undefined): boolean | undefined {
		return this._storageService.getBoolean(IS_WORKSPACE_SHELL_ALLOWED_STORAGE_KEY, StorageScope.WORKSPACE, defaultValue);
	}


public checkWorkspaceShellPermissions(osOverride: platform.OperatingSystem = platform.OS): boolean {
		// Check whether there is a workspace setting
		const platformKey = osOverride === platform.OperatingSystem.Windows ? 'windows' : osOverride === platform.OperatingSystem.Macintosh ? 'osx' : 'linux';
		const shellConfigValue = this._configurationService.inspect<string>(`terminal.integrated.shell.${platformKey}`);
		const shellArgsConfigValue = this._configurationService.inspect<string[]>(`terminal.integrated.shellArgs.${platformKey}`);
		const envConfigValue = this._configurationService.inspect<{ [key: string]: string }>(`terminal.integrated.env.${platformKey}`);

		// Check if workspace setting exists and whether it's whitelisted
		let isWorkspaceShellAllowed: boolean | undefined = false;
		if (shellConfigValue.workspace !== undefined || shellArgsConfigValue.workspace !== undefined || envConfigValue.workspace !== undefined) {
			isWorkspaceShellAllowed = this.isWorkspaceShellAllowed(undefined);
		}

		// Always allow [] args as it would lead to an odd error message and should not be dangerous
		if (shellConfigValue.workspace === undefined && envConfigValue.workspace === undefined &&
			shellArgsConfigValue.workspace && shellArgsConfigValue.workspace.length === 0) {
			isWorkspaceShellAllowed = true;
		}

		// Check if the value is neither blacklisted (false) or whitelisted (true) and ask for
		// permission
		if (isWorkspaceShellAllowed === undefined) {
			let shellString: string | undefined;
			if (shellConfigValue.workspace) {
				shellString = `shell: "${shellConfigValue.workspace}"`;
			}
			let argsString: string | undefined;
			if (shellArgsConfigValue.workspace) {
				argsString = `shellArgs: [${shellArgsConfigValue.workspace.map(v => '"' + v + '"').join(', ')}]`;
			}
			let envString: string | undefined;
			if (envConfigValue.workspace) {
				envString = `env: {${Object.keys(envConfigValue.workspace).map(k => `${k}:${envConfigValue.workspace![k]}`).join(', ')}}`;
			}
			// Should not be localized as it's json-like syntax referencing settings keys
			const workspaceConfigStrings: string[] = [];
			if (shellString) {
				workspaceConfigStrings.push(shellString);
			}
			if (argsString) {
				workspaceConfigStrings.push(argsString);
			}
			if (envString) {
				workspaceConfigStrings.push(envString);
			}
			const workspaceConfigString = workspaceConfigStrings.join(', ');
			this._notificationService.prompt(Severity.Info, nls.localize('terminal.integrated.allowWorkspaceShell', "Do you allow this workspace to modify your terminal shell? {0}", workspaceConfigString),
				[{
					label: nls.localize('allow', "Allow"),
					run: () => this.setWorkspaceShellAllowed(true)
				},
				{
					label: nls.localize('disallow', "Disallow"),
					run: () => this.setWorkspaceShellAllowed(false)
				}]
			);
		}
		return !!isWorkspaceShellAllowed;
	}


private _toInteger(source: any, minimum: number, maximum: number, fallback: number): number {
		let r = parseInt(source, 10);
		if (isNaN(r)) {
			return fallback;
		}
		if (typeof minimum === 'number') {
			r = Math.max(minimum, r);
		}
		if (typeof maximum === 'number') {
			r = Math.min(maximum, r);
		}
		return r;
	}


public async showRecommendations(shellLaunchConfig: IShellLaunchConfig): Promise<void> {
		if (this.recommendationsShown) {
			return;
		}
		this.recommendationsShown = true;

		if (platform.isWindows && shellLaunchConfig.executable && basename(shellLaunchConfig.executable).toLowerCase() === 'wsl.exe') {
			const exeBasedExtensionTips = this.productService.exeBasedExtensionTips;
			if (!exeBasedExtensionTips || !exeBasedExtensionTips.wsl) {
				return;
			}
			const extId = exeBasedExtensionTips.wsl.recommendations[0];
			if (extId && ! await this.isExtensionInstalled(extId)) {
				this._notificationService.prompt(
					Severity.Info,
					nls.localize(
						'useWslExtension.title', "The '{0}' extension is recommended for opening a terminal in WSL.", exeBasedExtensionTips.wsl.friendlyName),
					[
						{
							label: nls.localize('install', 'Install'),
							run: () => {
								/* __GDPR__
								"terminalLaunchRecommendation:popup" : {
									"userReaction" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
									"extensionId": { "classification": "PublicNonPersonalData", "purpose": "FeatureInsight" }
								}
								*/
								this.telemetryService.publicLog('terminalLaunchRecommendation:popup', { userReaction: 'install', extId });
								this.instantiationService.createInstance(InstallRecommendedExtensionAction, extId).run();
							}
						}
					],
					{
						sticky: true,
						neverShowAgain: { id: 'terminalConfigHelper/launchRecommendationsIgnore', scope: NeverShowAgainScope.WORKSPACE },
						onCancel: () => {
							/* __GDPR__
								"terminalLaunchRecommendation:popup" : {
									"userReaction" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
								}
							*/
							this.telemetryService.publicLog('terminalLaunchRecommendation:popup', { userReaction: 'cancelled' });
						}
					}
				);
			}
		}
	}


private isExtensionInstalled(id: string): Promise<boolean> {
		return this._extensionManagementService.getInstalled(ExtensionType.User).then(extensions => {
			return extensions.some(e => e.identifier.id === id);
		});
	}


export default async function speakerImages(req: NextApiRequest, res: NextApiResponse) {
  let url: string;
  const { slug } = req.query || {};
  const squared = req.query?.format === 'square' ?? false;

  if (slug) {
    const slugString = slug.toString();
    const speaker = await getSpeaker(slugString);

    if (!speaker?.slug) {
      res.statusCode = 404;
      return res.end('Not Found');
    }

    url = `${SITE_URL}/speaker-image?slug=${encodeURIComponent(slugString)}${
      squared ? '&format=squared' : ''
    }`;

    if (speaker?.name) {
      url = `${url}&name=${encodeURIComponent(speaker.name)}`;
    }

    if (speaker?.title) {
      url = `${url}&title=${encodeURIComponent(speaker.title)}`;
    }

    if (speaker?.company) {
      url = `${url}&company=${encodeURIComponent(speaker.company)}`;
    }

    const imageUrl = speaker?.cardPortrait?.url ?? speaker?.image?.url ?? null;
    if (imageUrl) {
      url = `${url}&image=${encodeURIComponent(
        imageUrl.replace('?auto=compress,format&q=40', '')
      )}`;
    }

    if (speaker?.talk?.title) {
      url = `${url}&talk=${encodeURIComponent(speaker.talk.title)}`;
    }

    const dimensions = {
      ...(squared && {
        width: 1000,
        height: 1000
      })
    };

    const file = await screenshot(url, dimensions);
    res.setHeader('Content-Type', `image/png`);
    res.setHeader(
      'Cache-Control',
      `public, immutable, no-transform, s-maxage=31536000, max-age=31536000`
    );
    res.statusCode = 200;
    res.end(file);
  } else {
    res.status(404).send('Not Found');
  }
}


export class IndexStatus {
    indexStatus: IndexStatusEnum;
    projectId: string;
    branchName: string;
    startTime: Date;
    numberOfIndexedDocuments: Number;
    numberOfAllDocuments: Number;
}


(): UserContext => useContext(UserContext)