export default function responsiveFontSizes(
  theme: Theme,
  options?: ResponsiveFontSizesOptions,
): Theme;


export interface ResponsiveFontSizesOptions {
  breakpoints?: Breakpoint[];
  disableAlign?: boolean;
  factor?: number;
  variants?: ThemeStyle[];
}


async (socket) => {
  const pc = new RTCPeerConnection({});
  pc.iceConnectionStateChange.subscribe((v) =>
    console.log("pc.iceConnectionStateChange", v)
  );
  pc.addTransceiver("video", { direction: "recvonly" }).onTrack.subscribe(
    (track) =>
      track.onReceiveRtp.subscribe((packet) => {
        udp.send(packet.serialize(), 4002, "127.0.0.1");
      })
  );

  await pc.setLocalDescription(await pc.createOffer());
  const sdp = JSON.stringify(pc.localDescription);
  socket.send(sdp);

  socket.on("message", (data: any) => {
    pc.setRemoteDescription(JSON.parse(data));
  });
}


(v) =>
    console.log("pc.iceConnectionStateChange", v)


(track) =>
      track.onReceiveRtp.subscribe((packet) => {
        udp.send(packet.serialize(), 4002, "127.0.0.1");
      })


(packet) => {
        udp.send(packet.serialize(), 4002, "127.0.0.1");
      }


(data: any) => {
    pc.setRemoteDescription(JSON.parse(data));
  }


class LinkHashes {
  private linksInfo: Record<string, number> = {};

  ensureHashGenerated(link: string, data: ArrayBuffer) {
    if (!this.linksInfo[link]) {
      this.linksInfo[link] = XXHash32.hash(0, data).toNumber();
    }
  }

  isSame(link: string, data: ArrayBuffer) {
    const fileHash = XXHash32.hash(0, data).toNumber();
    return this.linksInfo[link] == fileHash;
  }
}


ensureHashGenerated(link: string, data: ArrayBuffer) {
    if (!this.linksInfo[link]) {
      this.linksInfo[link] = XXHash32.hash(0, data).toNumber();
    }
  }


isSame(link: string, data: ArrayBuffer) {
    const fileHash = XXHash32.hash(0, data).toNumber();
    return this.linksInfo[link] == fileHash;
  }


export default function renderExpandableColumn(
  cx: WithStylesProps['cx'],
  styles: WithStylesProps['styles'],
  expandedRows: Set<number>,
  expandRow: (newExpandedRowIndex: number) => (event: any) => void,
) {
  const cellRenderer = (row: TableRow) => {
    const { children, originalIndex } = row.rowData.metadata;

    if (children && children.length > 0) {
      return (
        <div
          className={cx(styles.expand_caret)}
          role="button"
          tabIndex={0}
          onClick={expandRow(originalIndex)}
          onKeyPress={expandRow(originalIndex)}
        >
          <Spacing left={1.5}>
            <ExpandableIcon expanded={expandedRows.has(originalIndex)} size="1.6em" />
          </Spacing>
        </div>
      );
    }


(row: TableRow) => {
    const { children, originalIndex } = row.rowData.metadata;

    if (children && children.length > 0) {
      return (
        <div
          className={cx(styles.expand_caret)}
          role="button"
          tabIndex={0}
          onClick={expandRow(originalIndex)}
          onKeyPress={expandRow(originalIndex)}
        >
          <Spacing left={1.5}>
            <ExpandableIcon expanded={expandedRows.has(originalIndex)} size="1.6em" />
          </Spacing>
        </div>


expandRow(originalIndex)


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

  constructor(private http: HttpClient) { }

  getSignalScores(signals: any): Observable<any> {

    const data = {
      signals
    };

    return this.http.post(`${BASE_URL}api/backtest/score-signals`, data, {});
  }

  getPop(bullishIndicators: string[], bearishIndicators: string[], signals: any): Observable<any> {
    const data = {
      bullishActiveIndicators: bullishIndicators,
      bearishActiveIndicators: bearishIndicators,
      signals
    };

    return this.http.post(`${BASE_URL}api/backtest/pop`, data, {});
  }
}


getSignalScores(signals: any): Observable<any> {

    const data = {
      signals
    };

    return this.http.post(`${BASE_URL}api/backtest/score-signals`, data, {});
  }


getPop(bullishIndicators: string[], bearishIndicators: string[], signals: any): Observable<any> {
    const data = {
      bullishActiveIndicators: bullishIndicators,
      bearishActiveIndicators: bearishIndicators,
      signals
    };

    return this.http.post(`${BASE_URL}api/backtest/pop`, data, {});
  }


(name: string, type: string, urn: string): pulumi.ProviderResource => {
        if (type !== "pulumi:providers:oci") {
            throw new Error(`unknown provider type ${type}`);
        }
        return new Provider(name, <any>undefined, { urn });
    }


/**
 * Acccept the area Spirit Healer's resurrection in battlegrounds
 * @see https://wow.gamepedia.com/API_AcceptAreaSpiritHeal
 */
declare function AcceptAreaSpiritHeal(): void;


/**
 * Confirms entry into a Battleground you are queued for that is ready
 * @param index The battlefield in queue to enter
 * @param accept Whether or not to accept entry to the battlefield
 * @protected HARDWARE_EVENT
 * @see https://wow.gamepedia.com/API_AcceptBattlefieldPort
 */
declare function AcceptBattlefieldPort(index: number, accept: boolean): void;


/**
 * Cancels the area Spirit Healer's resurrection in battlegrounds
 * @see https://wow.gamepedia.com/API_CancelAreaSpiritHeal
 */
declare function CancelAreaSpiritHeal(): void;


/**
 * Returns, whether the player can join a battlefield as group or not
 * @return returns true, if the player can join the battlefield as group
 * @see https://wow.gamepedia.com/API_CanJoinBattlefieldAsGroup
 */
declare function CanJoinBattlefieldAsGroup(): boolean;


/**
 * Gets the time left until the next resurrection cast.
 * @return Seconds until the Spirit Guide casts its next Area Resurrection. Returns 0 if player is not dead
 * @see https://wow.gamepedia.com/API_GetAreaSpiritHealerTime
 */
declare function GetAreaSpiritHealerTime(): number;


/**
 * Get estimated wait time for a Battlefield's availability
 * @returns Milliseconds until Battlefield opening is available (estimated)
 * @see https://wow.gamepedia.com/API_GetBattlefieldEstimatedWaitTime
 */
declare function GetBattlefieldEstimatedWaitTime(): number;


/**
 * Used to position the flag icon on the world map and the battlefield minimap
 * @param index Index to get the flag position from
 * @see https://wow.gamepedia.com/API_GetBattlefieldFlagPosition
 * @tupleReturn
 */
declare function GetBattlefieldFlagPosition(index: number): [number, number, string];


/**
 * Get shutdown timer for the battlefield instance
 * @returns the number of milliseconds before the Battlefield will close after a battle is finished. This is 0 before the battle is finished
 * @see https://wow.gamepedia.com/API_GetBattlefieldInstanceExpiration
 */
declare function GetBattlefieldInstanceExpiration(): number;


/**
 * Returns the time passed since the battleground started
 * @returns miliseconds passed since the battle started
 * @see https://wow.gamepedia.com/API_GetBattlefieldInstanceRunTime
 */
declare function GetBattlefieldInstanceRunTime(): number;


/**
 * Returns the remaining seconds of a battlefield port
 * @param index Index of queue to get the expiration from
 * @returns Remaining time of battlefield port in seconds
 * @see https://wow.gamepedia.com/API_GetBattlefieldPortExpiration
 */
declare function GetBattlefieldPortExpiration(index: number): number;


/**
 * Returns information about a player's score in battlegrounds
 * @param playerIndex The characters index in battlegrounds, going from 1 to GetNumBattlefieldScores().
 * @see https://wow.gamepedia.com/API_GetBattlefieldScore
 * @tupleReturn
 */
declare function GetBattlefieldScore(
  playerIndex: number,
): [string, number, number, number, number, number, string, string, string, number, number, string];


/**
 * Get data from the custom battlefield scoreboard columns
 * @param playerIndex Player you want to grab the data for
 * @param columnIndex Column you want to grab the data from
 * @description Used to retrieve data from battleground specific scoreboard columns like flag captures in Warsong Gulch.
 * If you want to make sure you have the most recent data you will have to call RequestBattlefieldScoreData and then wait for UPDATE_BATTLEFIELD_SCORE
 * @see https://wow.gamepedia.com/API_GetBattlefieldStatData
 */
declare function GetBattlefieldStatData(playerIndex: number, columnIndex: number): WoWAPI.Unknown;


/**
 * Get list of battleground specific columns on the scoreboard
 * @param columnIndex Column to get data for
 * @see https://wow.gamepedia.com/API_GetBattlefieldStatInfo
 * @tupleReturn
 */
declare function GetBattlefieldStatInfo(columnIndex: number): [string, string, string];


/**
 * Get the status of the arena, battleground, or wargame that the player is either queued for or inside
 * @param battlefieldIndex Index of the battlefield you wish to view, in the range of 1 to GetMaxBattlefieldID()
 * @see https://wow.gamepedia.com/API_GetBattlefieldStatus
 * @tupleReturn
 */
// tslint:disable-next-line max-line-length
declare function GetBattlefieldStatus(
  battlefieldIndex: number,
): [
  WoWAPI.BattlefieldStatusType,
  string,
  WoWAPI.BattlefieldTeamSize,
  number,
  WoWAPI.Unknown,
  WoWAPI.BattlefieldType,
  WoWAPI.Unknown,
  WoWAPI.UnitRoleType,
];


/**
 * Get time this player's been in the queue in milliseconds
 * @param battlegroundQueuePosition The queue position
 * @see https://wow.gamepedia.com/API_GetBattlefieldTimeWaited
 */
declare function GetBattlefieldTimeWaited(battlegroundQueuePosition: number): number;


/**
 * Get the winner of the battlefield
 * @returns Faction/team that has won the battlefield. Results are: nil if nobody has won, 0 for Horde, 1 for Alliance and 255
 * for a draw in a battleground, 0 for Green Team and 1 for Yellow in an arena
 * @see https://wow.gamepedia.com/API_GetBattlefieldWinner
 */
declare function GetBattlefieldWinner(): WoWAPI.BattlefieldWinType;


/**
 * Returns information about a battleground type
 * @param battlegroundTypeIndex battleground type index, 1 to GetNumBattlegroundTypes().
 * @see https://wow.gamepedia.com/API_GetBattlegroundInfo
 * @tupleReturn
 */
declare function GetBattlegroundInfo(
  battlegroundTypeIndex: number,
): [string, WoWAPI.Flag, WoWAPI.Flag, WoWAPI.Flag, number, string];


/**
 * Returns the max number of battlefields you can queue for
 * @returns Max number of Battlefields
 * @see https://wow.gamepedia.com/API_GetMaxBattlefieldID
 * @since 4.3.0
 */
declare function GetMaxBattlefieldID(): number;


/**
 * Appears to return the number of scores in the battleground/field scoreboard
 * @see https://wow.gamepedia.com/API_GetNumBattlefieldScores
 */
declare function GetNumBattlefieldScores(): WoWAPI.Unknown;


/**
 * Appears to return the number of columns in the battleground/field scoreboard, other than the common ones (Killing Blows, Kills, Deaths, Bonus Honour):
 * @returns Number of columns available for the battleground (2 for Warsong Gulch and Arathi Basin, 7 for Alterac Valley)
 * @see https://wow.gamepedia.com/API_GetNumBattlefieldStats
 */
declare function GetNumBattlefieldStats(): number;


/**
 * Returns the number of world state UI elements. These are displayed in the WorldStateFrame at the top center of the screen
 * @see https://wow.gamepedia.com/API_GetNumWorldStateUI
 */
declare function GetNumWorldStateUI(): number;


/**
 * Get score and flag status within a battlefield
 * @param worldUiStateIndex between 1 and GetNumWorldStateUI().
 * @see https://wow.gamepedia.com/API_GetWorldStateUIInfo
 * @tupleReturn
 */
// tslint:disable-next-line max-line-length
declare function GetWorldStateUIInfo(
  worldUiStateIndex: number,
): [
  number,
  WoWAPI.BattlefieldUiStateType,
  boolean,
  string,
  string,
  string,
  string,
  string,
  string,
  number,
  number,
  number,
];


/**
 * Queues the player, or the player's group, for a battlefield instance
 * @param battlefieldIndex Which battlefield instance to queue for (0 for first available), or which arena bracket to queue for
 * @param asGroup If true-equivalent, the player's group is queued for the battlefield, otherwise, only the player is queued
 * @param isRated If true-equivalent, and queueing for an arena bracket, the group is queued for a rated match as opposed to a skirmish
 * @deprecated
 * @protected Protected functions can only be called from a secure execution path.
 */
declare function JoinBattlefield(battlefieldIndex: number, asGroup?: boolean, isRated?: boolean): void;


/**
 * Leaves the current battlefield
 * @description Leaves the current battlefield the player is inside, pre-2.0.1 this would only leave the battlefield if it had been won or
 * lost this was changed in 2.0.1 to exit you from the battlefield regardless if it was finished or not and will give you deserter.
 * @see https://wow.gamepedia.com/API_LeaveBattlefield
 */
declare function LeaveBattlefield(): void;


/**
 * Requests the lastest battlefield score data from the server
 * @event UPDATE_BATTLEFIELD_SCORE
 * @see https://wow.gamepedia.com/API_RequestBattlefieldScoreData
 */
declare function RequestBattlefieldScoreData(): void;


/**
 * Requests information about the available instances of a particular battleground
 * @param instanceIndex Index of the battleground type to request instance information for; valid indices start from 1 and go up to GetNumBattlegroundTypes().
 * @event PVPQUEUE_ANYWHERE_SHOW
 * @description Calling JoinBattlefield after calling this function, but before PVPQUEUE_ANYWHERE_SHOW, will fail silently; you must wait for
 * the instance list to become available before you can queue for an instance.
 * @see https://wow.gamepedia.com/API_RequestBattlegroundInstanceInfo
 */
declare function RequestBattlegroundInstanceInfo(instanceIndex: number): void;


/**
 * Set the faction to show on the battlefield scoreboard
 * @param faction nil = All, 0 = Horde, 1 = Alliance
 * @see https://wow.gamepedia.com/API_SetBattlefieldScoreFaction
 */
declare function SetBattlefieldScoreFaction(faction?: WoWAPI.BattlefieldFaction): void;


type BattlefieldStatusType = 'queued' | 'confirm' | 'active' | 'none' | 'error';


type BattlefieldTeamSize = 0 | 2 | 3 | 5;


type BattlefieldType = 'ARENA' | 'BATTLEGROUND' | 'WARGAME';


type BattlefieldWinType = null | 0 | 1 | 255;


type BattlefieldUiStateType = 0 | 1 | 2;


type BattlefieldFaction = null | undefined | void | 0 | 1;


() => {
    return this.container;
  }


(container: HTMLDivElement) => {
    this.container = container;
  }


class DrawerTester extends React.Component {
  private container: HTMLDivElement;

  public getContainer = () => {
    return this.container;
  };
  public saveContainer = (container: HTMLDivElement) => {
    this.container = container;
  };

  public render() {
    return (

        <Drawer width="20vw" getContainer={this.getContainer}>
          <Menu
            defaultSelectedKeys={['1']}
            defaultOpenKeys={['sub1']}
            mode="inline"
          >
            <SubMenu
              key="sub1"
              title={

                  <MailOutlined />
                  Navigation One

              }


public render() {
    return (

        <Drawer width="20vw" getContainer={this.getContainer}>
          <Menu
            defaultSelectedKeys={['1']}
            defaultOpenKeys={['sub1']}
            mode="inline"
          >
            <SubMenu
              key="sub1"
              title={

                  <MailOutlined />
                  Navigation One

              }


() => {
  const { t } = useTranslation()

  return (

        {t('home:about.i-am')}{' '}

          Divlo

{t('home:about.description')}


t('home:about.i-am')


t('home:about.description')


(data: CreatableUser) => {
  return pipe(
    data,
    registerUserAdapter(db.createUserInDBAdapter),
    TE.chain(user => pipe(
      TE.tryCatch(()=> jwt.generateTokenAdapter({id: user.id}), E.toError),
      TE.map(token => ({user, token}))
      )
    ),
    TE.map(getUserResponse),
    TE.mapLeft((error) => getErrorsMessages(error.message))
  );
}


user => pipe(
      TE.tryCatch(()=> jwt.generateTokenAdapter({id: user.id}), E.toError),
      TE.map(token => ({user, token}))
      )


()=> jwt.generateTokenAdapter({id: user.id})


token => ({user, token})


(error) => getErrorsMessages(error.message)


(data: LoginUser) => {
  return pipe(
    TE.tryCatch(() => db.login(data), E.toError),
    TE.chain(user => pipe(
      TE.tryCatch(()=> jwt.generateTokenAdapter({id: user.id}), E.toError),
      TE.map(token => ({user, token}))
    )),
    TE.map(getUserResponse),
    TE.mapLeft((error) => getErrorsMessages(error.message))
  );
}


() => db.login(data)


user => pipe(
      TE.tryCatch(()=> jwt.generateTokenAdapter({id: user.id}), E.toError),
      TE.map(token => ({user, token}))
    )


(token: TokenInformation) => {
  const userID = token.payload['id'] as AuthorID
  return pipe(
    TE.tryCatch(() => db.getCurrentUserAdapter(userID), E.toError),
    TE.map((user) => getUserResponse({user, token: jwt.extractToken(token.authHeader)})),
    TE.mapLeft((errors) => getErrorsMessages(errors.message))
  );
}


() => db.getCurrentUserAdapter(userID)


(user) => getUserResponse({user, token: jwt.extractToken(token.authHeader)})


(errors) => getErrorsMessages(errors.message)


(username: string) => {
  return pipe(
    TE.tryCatch(()=>db.getUserProfileAdapter(username), E.toError),
    // TODO: Implement following
    TE.map((user) => ({profile: {...user, following: false}})),
    TE.mapLeft((errors) => getErrorsMessages(errors.message))
  );
}


()=>db.getUserProfileAdapter(username)


(user) => ({profile: {...user, following: false}})


(token: TokenInformation) => (data: UpdatableUser) => {
  const userID = token.payload['id'] as AuthorID
  return pipe(
    userID,
    updateUserCoreAdapter(db.updateUserAdapter)(data),
    TE.map((user) => getUserResponse({user, token: jwt.extractToken(token.authHeader)})),
    TE.mapLeft((errors) => getErrorsMessages(errors.message))
  );
}


(data: UpdatableUser) => {
  const userID = token.payload['id'] as AuthorID
  return pipe(
    userID,
    updateUserCoreAdapter(db.updateUserAdapter)(data),
    TE.map((user) => getUserResponse({user, token: jwt.extractToken(token.authHeader)})),
    TE.mapLeft((errors) => getErrorsMessages(errors.message))
  );
}


({user, token}: GetUserResponseInput): {user: UserOutput} => {
  return {
    user: {
      email: user.email,
      username: user.username,
      bio: user.bio ?? '',
      image: user.image ?? '',
      token
    }
  }
}


type TokenInformation = { payload: jwt.JWTPayload; authHeader: string }


type GetUserResponseInput = {
  user: db.database.DBUser,
  token: string
}


function showConfirm() {
    confirm({
      title: '退出页面提示！',
      content: '画布已经修改未保存，是否离开？',
      okText: '保存并退出',
      cancelText: ' 取消',
      onOk() {
        console.log('OK');
        // @ts-ignore
        editorRef?.current.handleSaveData()
      },
      onCancel() {
        console.log('Cancel');
      },
    });
  }


()=>{
    // 获取数据
    const formData = new FormData()
    formData.append("mappingId","23233")
    formData.append("mappingType","107")
    const instance = axios.create({
      baseURL:'http://qt.test.bicisims.com',
      timeout:10000000,
      maxContentLength:1000000000
    });
    // 获取面板数据
    instance.get("/api/applications/newBoard/detail",{
      method:'get',
      headers: {
        'X-Requested-With': 'XMLHttpRequest',
        'token':'development_of_special_token_by_star_quest',
        'Content-Type':'application/json'
      },
      params: {
        id: '1a99aa5c58144a7b8ce8230ace2c53b6'
      }
    }).then((res)=>{
      console.log("detail",res)
      if(res.data?.data!=null){
        if(res.data.data.property!=null&&res.data.data.property!=null){
          const getEditorData = JSON.parse(decodeURIComponent(escape(window.atob(res.data.data.property))));
          setEditorData(getEditorData)
        }
      }
    })
    // 获取获取当前租户下 上传的背景图片
    instance.post("/api/applications/custom/component/componentList",{mappingType:"107"},{
      method:'post',
      headers: {
        'token':'development_of_special_token_by_star_quest',
        'Content-Type':'application/json'
      }
    }).then((res)=>{
      console.log("背景图片=",res)
    })
    // 获取获取当前租户下 指定自定义组件图片列表
    instance.post("/api/applications/custom/component/componentList",{mappingType:"106"},{
      method:'post',
      headers: {
        'token':'development_of_special_token_by_star_quest',
        'Content-Type':'application/json'
      }
    }).then((res)=>{
      console.log("组件图片列表=",res);
      (res.data.data||[]).map((image:any)=>{
        const newImg = {
          ...image,
          name:image.name.replace(/\.(jpg|png)$/g,''),
          width:100,height:100,type:'image',key:image.id
        }
        selfIndustrialLibrary.push(newImg)
        return null;
      })
    })
  }


(res)=>{
      console.log("detail",res)
      if(res.data?.data!=null){
        if(res.data.data.property!=null&&res.data.data.property!=null){
          const getEditorData = JSON.parse(decodeURIComponent(escape(window.atob(res.data.data.property))));
          setEditorData(getEditorData)
        }
      }
    }


(res)=>{
      console.log("背景图片=",res)
    }


(res)=>{
      console.log("组件图片列表=",res);
      (res.data.data||[]).map((image:any)=>{
        const newImg = {
          ...image,
          name:image.name.replace(/\.(jpg|png)$/g,''),
          width:100,height:100,type:'image',key:image.id
        }
        selfIndustrialLibrary.push(newImg)
        return null;
      })
    }


(image:any)=>{
        const newImg = {
          ...image,
          name:image.name.replace(/\.(jpg|png)$/g,''),
          width:100,height:100,type:'image',key:image.id
        }
        selfIndustrialLibrary.push(newImg)
        return null;
      }


(data:any)=>{
    console.log(data)
    const api = axios.create({ headers: { 'Content-Type': 'multipart/form-data' } })
    const formData = new FormData()
    api.defaults.headers.common['token'] = "development_of_special_token_by_star_quest"
    formData.append('file', data.screenshot)
    formData.append('mappingId', "ooip6ffe388d487db754b885b8aa65b9")

    formData.append('mappingType', "107")
    api.post(`http://qt.test.bicisims.com//api/file/file/uploadReturnPath`, formData)

    const instance = axios.create({
      baseURL:'http://qt.test.bicisims.com',
      timeout:10000000,
      maxContentLength:1000000000
    })
    instance.post("/api/applications/newBoard/updateProperty",{
      "id":"1a99aa5c58144a7b8ce8230ace2c53b6",
      "property":window.btoa(unescape(encodeURIComponent(JSON.stringify(data.data))))
    },{
      method:'POST',
      headers: {
        'X-Requested-With': 'XMLHttpRequest',
        'token':'development_of_special_token_by_star_quest',
        'Content-Type':'application/json;charset=UTF-8'
      }
    }).then((res)=>{
      console.log("update==",res)
    })
  }


(res)=>{
      console.log("update==",res)
    }


(data:any)=>{
    console.log(data)
    html2canvas(document.querySelector(".haha") as HTMLElement).then(canvas => {
      console.log(canvas)
      document?.querySelector(".haha")?.appendChild(canvas)
      var imgData = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");
      console.log(imgData)
    });
  }


canvas => {
      console.log(canvas)
      document?.querySelector(".haha")?.appendChild(canvas)
      var imgData = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");
      console.log(imgData)
    }


()=>{
    // @ts-ignore
    const isSave = editorRef?.current.getIsSave()
      if(!isSave){
        showConfirm()
      }

  }


() => {
    setExtraVisible(false)
  }


()=>{
    setExtraVisible(true)
  }


()=>{
    return (
      <Modal
        title="额外配置"
        className="extra-modal"
        visible={extraVisible}
        onOk={handleExtraOk}
        onCancel={handleExtraCancel}
        okText="确认"
        cancelText="取消"
      >

这是额外配置

      </Modal>


onOk() {
        console.log('OK');
        // @ts-ignore
        editorRef?.current.handleSaveData()
      }


onCancel() {
        console.log('Cancel');
      }


class Text extends React.Component<PropsInterface> {
    static propTypes = {
        styling: PropTypes.oneOf(['heading', 'subheading', 'text', 'caption']),
        tag: PropTypes.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'span', 'div']).isRequired,
        fontWeight: PropTypes.oneOf([300, 400, 500, 600, 700]).isRequired,
        children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node, PropTypes.string]).isRequired,
        align: PropTypes.oneOf(['center', 'left', 'right', 'initial']),
        name: PropTypes.string,
        onClick: PropTypes.func
    };

    static defaultProps = {
        styling: 'text',
        align: 'initial',
        name: '',
        onClick: () => {}
    };

    get className(): string {
        const {
            styling, fontWeight, align, name
        } = this.props;
        const FONT_WEIGHT = {
            300: 'light',
            400: 'normal',
            500: 'medium',
            600: 'semibold',
            700: 'bold'
        };

        return convert_obj_to_string({
            [`${name}`]: true,
            'ui-atomic-text': true,
            [`ui-atomic-text--style-${styling}`]: true,
            [`ui-atomic-text--font-weight-${FONT_WEIGHT[fontWeight]}`]: true,
            [`ui-atomic-text--align-${align}`]: true
        });
    }

    render(): React.ReactNode {
        const { children, tag, onClick } = this.props;
        const { className } = this;

        return React.createElement(tag, { className, onClick }, children);
    }
}


render(): React.ReactNode {
        const { children, tag, onClick } = this.props;
        const { className } = this;

        return React.createElement(tag, { className, onClick }, children);
    }


export function initServicesIfNeeded() {
  if (initialized) {
    return;
  }
  initialized = true;
  const services = isDevMode() ? createDebugServices() : createProdServices();
  Services.setCurrentNode = services.setCurrentNode;
  Services.createRootView = services.createRootView;
  Services.createEmbeddedView = services.createEmbeddedView;
  Services.createComponentView = services.createComponentView;
  Services.createNgModuleRef = services.createNgModuleRef;
  Services.overrideProvider = services.overrideProvider;
  Services.overrideComponentView = services.overrideComponentView;
  Services.clearOverrides = services.clearOverrides;
  Services.checkAndUpdateView = services.checkAndUpdateView;
  Services.checkNoChangesView = services.checkNoChangesView;
  Services.destroyView = services.destroyView;
  Services.resolveDep = resolveDep;
  Services.createDebugContext = services.createDebugContext;
  Services.handleEvent = services.handleEvent;
  Services.updateDirectives = services.updateDirectives;
  Services.updateRenderer = services.updateRenderer;
  Services.dirtyParentQueries = dirtyParentQueries;
}


function createProdServices() {
  return {
    setCurrentNode: () => {},
    createRootView: createProdRootView,
    createEmbeddedView: createEmbeddedView,
    createComponentView: createComponentView,
    createNgModuleRef: createNgModuleRef,
    overrideProvider: NOOP,
    overrideComponentView: NOOP,
    clearOverrides: NOOP,
    checkAndUpdateView: checkAndUpdateView,
    checkNoChangesView: checkNoChangesView,
    destroyView: destroyView,
    createDebugContext: (view: ViewData, nodeIndex: number) => new DebugContext_(view, nodeIndex),
    handleEvent: (view: ViewData, nodeIndex: number, eventName: string, event: any) =>
                     view.def.handleEvent(view, nodeIndex, eventName, event),
    updateDirectives: (view: ViewData, checkType: CheckType) => view.def.updateDirectives(
                          checkType === CheckType.CheckAndUpdate ? prodCheckAndUpdateNode :
                                                                   prodCheckNoChangesNode,
                          view),
    updateRenderer: (view: ViewData, checkType: CheckType) => view.def.updateRenderer(
                        checkType === CheckType.CheckAndUpdate ? prodCheckAndUpdateNode :
                                                                 prodCheckNoChangesNode,
                        view),
  };
}


function createDebugServices() {
  return {
    setCurrentNode: debugSetCurrentNode,
    createRootView: debugCreateRootView,
    createEmbeddedView: debugCreateEmbeddedView,
    createComponentView: debugCreateComponentView,
    createNgModuleRef: debugCreateNgModuleRef,
    overrideProvider: debugOverrideProvider,
    overrideComponentView: debugOverrideComponentView,
    clearOverrides: debugClearOverrides,
    checkAndUpdateView: debugCheckAndUpdateView,
    checkNoChangesView: debugCheckNoChangesView,
    destroyView: debugDestroyView,
    createDebugContext: (view: ViewData, nodeIndex: number) => new DebugContext_(view, nodeIndex),
    handleEvent: debugHandleEvent,
    updateDirectives: debugUpdateDirectives,
    updateRenderer: debugUpdateRenderer,
  };
}


function createProdRootView(
    elInjector: Injector, projectableNodes: any[][], rootSelectorOrNode: string | any,
    def: ViewDefinition, ngModule: NgModuleRef<any>, context?: any): ViewData {
  const rendererFactory: RendererFactory2 = ngModule.injector.get(RendererFactory2);
  return createRootView(
      createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode),
      def, context);
}


function debugCreateRootView(
    elInjector: Injector, projectableNodes: any[][], rootSelectorOrNode: string | any,
    def: ViewDefinition, ngModule: NgModuleRef<any>, context?: any): ViewData {
  const rendererFactory: RendererFactory2 = ngModule.injector.get(RendererFactory2);
  const root = createRootData(
      elInjector, ngModule, new DebugRendererFactory2(rendererFactory), projectableNodes,
      rootSelectorOrNode);
  const defWithOverride = applyProviderOverridesToView(def);
  return callWithDebugContext(
      DebugAction.create, createRootView, null, [root, defWithOverride, context]);
}


function createRootData(
    elInjector: Injector, ngModule: NgModuleRef<any>, rendererFactory: RendererFactory2,
    projectableNodes: any[][], rootSelectorOrNode: any): RootData {
  const sanitizer = ngModule.injector.get(Sanitizer);
  const errorHandler = ngModule.injector.get(ErrorHandler);
  const renderer = rendererFactory.createRenderer(null, null);
  return {
    ngModule,
    injector: elInjector, projectableNodes,
    selectorOrNode: rootSelectorOrNode, sanitizer, rendererFactory, renderer, errorHandler
  };
}


function debugCreateEmbeddedView(
    parentView: ViewData, anchorDef: NodeDef, viewDef: ViewDefinition, context?: any): ViewData {
  const defWithOverride = applyProviderOverridesToView(viewDef);
  return callWithDebugContext(
      DebugAction.create, createEmbeddedView, null,
      [parentView, anchorDef, defWithOverride, context]);
}


function debugCreateComponentView(
    parentView: ViewData, nodeDef: NodeDef, viewDef: ViewDefinition, hostElement: any): ViewData {
  const overrideComponentView =
      viewDefOverrides.get(nodeDef.element !.componentProvider !.provider !.token);
  if (overrideComponentView) {
    viewDef = overrideComponentView;
  } else {
    viewDef = applyProviderOverridesToView(viewDef);
  }
  return callWithDebugContext(
      DebugAction.create, createComponentView, null, [parentView, nodeDef, viewDef, hostElement]);
}


function debugCreateNgModuleRef(
    moduleType: Type<any>, parentInjector: Injector, bootstrapComponents: Type<any>[],
    def: NgModuleDefinition): NgModuleRef<any> {
  const defWithOverride = applyProviderOverridesToNgModule(def);
  return createNgModuleRef(moduleType, parentInjector, bootstrapComponents, defWithOverride);
}


function debugOverrideProvider(override: ProviderOverride) {
  providerOverrides.set(override.token, override);
  let injectableDef: InjectableDef<any>|null;
  if (typeof override.token === 'function' && (injectableDef = getInjectableDef(override.token)) &&
      typeof injectableDef.providedIn === 'function') {
    providerOverridesWithScope.set(override.token as InjectableType<any>, override);
  }
}


function debugOverrideComponentView(comp: any, compFactory: ComponentFactory<any>) {
  const hostViewDef = resolveDefinition(getComponentViewDefinitionFactory(compFactory));
  const compViewDef = resolveDefinition(hostViewDef.nodes[0].element !.componentView !);
  viewDefOverrides.set(comp, compViewDef);
}


function debugClearOverrides() {
  providerOverrides.clear();
  providerOverridesWithScope.clear();
  viewDefOverrides.clear();
}


// Notes about the algorithm:
// 1) Locate the providers of an element and check if one of them was overwritten
// 2) Change the providers of that element
//
// We only create new datastructures if we need to, to keep perf impact
// reasonable.
function applyProviderOverridesToView(def: ViewDefinition): ViewDefinition {
  if (providerOverrides.size === 0) {
    return def;
  }
  const elementIndicesWithOverwrittenProviders = findElementIndicesWithOverwrittenProviders(def);
  if (elementIndicesWithOverwrittenProviders.length === 0) {
    return def;
  }
  // clone the whole view definition,
  // as it maintains references between the nodes that are hard to update.
  def = def.factory !(() => NOOP);
  for (let i = 0; i < elementIndicesWithOverwrittenProviders.length; i++) {
    applyProviderOverridesToElement(def, elementIndicesWithOverwrittenProviders[i]);
  }
  return def;

  function findElementIndicesWithOverwrittenProviders(def: ViewDefinition): number[] {
    const elIndicesWithOverwrittenProviders: number[] = [];
    let lastElementDef: NodeDef|null = null;
    for (let i = 0; i < def.nodes.length; i++) {
      const nodeDef = def.nodes[i];
      if (nodeDef.flags & NodeFlags.TypeElement) {
        lastElementDef = nodeDef;
      }
      if (lastElementDef && nodeDef.flags & NodeFlags.CatProviderNoDirective &&
          providerOverrides.has(nodeDef.provider !.token)) {
        elIndicesWithOverwrittenProviders.push(lastElementDef !.nodeIndex);
        lastElementDef = null;
      }
    }
    return elIndicesWithOverwrittenProviders;
  }

  function applyProviderOverridesToElement(viewDef: ViewDefinition, elIndex: number) {
    for (let i = elIndex + 1; i < viewDef.nodes.length; i++) {
      const nodeDef = viewDef.nodes[i];
      if (nodeDef.flags & NodeFlags.TypeElement) {
        // stop at the next element
        return;
      }
      if (nodeDef.flags & NodeFlags.CatProviderNoDirective) {
        const provider = nodeDef.provider !;
        const override = providerOverrides.get(provider.token);
        if (override) {
          nodeDef.flags = (nodeDef.flags & ~NodeFlags.CatProviderNoDirective) | override.flags;
          provider.deps = splitDepsDsl(override.deps);
          provider.value = override.value;
        }
      }
    }
  }
}


function findElementIndicesWithOverwrittenProviders(def: ViewDefinition): number[] {
    const elIndicesWithOverwrittenProviders: number[] = [];
    let lastElementDef: NodeDef|null = null;
    for (let i = 0; i < def.nodes.length; i++) {
      const nodeDef = def.nodes[i];
      if (nodeDef.flags & NodeFlags.TypeElement) {
        lastElementDef = nodeDef;
      }
      if (lastElementDef && nodeDef.flags & NodeFlags.CatProviderNoDirective &&
          providerOverrides.has(nodeDef.provider !.token)) {
        elIndicesWithOverwrittenProviders.push(lastElementDef !.nodeIndex);
        lastElementDef = null;
      }
    }
    return elIndicesWithOverwrittenProviders;
  }


function applyProviderOverridesToElement(viewDef: ViewDefinition, elIndex: number) {
    for (let i = elIndex + 1; i < viewDef.nodes.length; i++) {
      const nodeDef = viewDef.nodes[i];
      if (nodeDef.flags & NodeFlags.TypeElement) {
        // stop at the next element
        return;
      }
      if (nodeDef.flags & NodeFlags.CatProviderNoDirective) {
        const provider = nodeDef.provider !;
        const override = providerOverrides.get(provider.token);
        if (override) {
          nodeDef.flags = (nodeDef.flags & ~NodeFlags.CatProviderNoDirective) | override.flags;
          provider.deps = splitDepsDsl(override.deps);
          provider.value = override.value;
        }
      }
    }
  }


// Notes about the algorithm:
// We only create new datastructures if we need to, to keep perf impact
// reasonable.
function applyProviderOverridesToNgModule(def: NgModuleDefinition): NgModuleDefinition {
  const {hasOverrides, hasDeprecatedOverrides} = calcHasOverrides(def);
  if (!hasOverrides) {
    return def;
  }
  // clone the whole view definition,
  // as it maintains references between the nodes that are hard to update.
  def = def.factory !(() => NOOP);
  applyProviderOverrides(def);
  return def;

  function calcHasOverrides(def: NgModuleDefinition):
      {hasOverrides: boolean, hasDeprecatedOverrides: boolean} {
    let hasOverrides = false;
    let hasDeprecatedOverrides = false;
    if (providerOverrides.size === 0) {
      return {hasOverrides, hasDeprecatedOverrides};
    }
    def.providers.forEach(node => {
      const override = providerOverrides.get(node.token);
      if ((node.flags & NodeFlags.CatProviderNoDirective) && override) {
        hasOverrides = true;
        hasDeprecatedOverrides = hasDeprecatedOverrides || override.deprecatedBehavior;
      }
    });
    def.modules.forEach(module => {
      providerOverridesWithScope.forEach((override, token) => {
        if (getInjectableDef(token) !.providedIn === module) {
          hasOverrides = true;
          hasDeprecatedOverrides = hasDeprecatedOverrides || override.deprecatedBehavior;
        }
      });
    });
    return {hasOverrides, hasDeprecatedOverrides};
  }

  function applyProviderOverrides(def: NgModuleDefinition) {
    for (let i = 0; i < def.providers.length; i++) {
      const provider = def.providers[i];
      if (hasDeprecatedOverrides) {
        // We had a bug where me made
        // all providers lazy. Keep this logic behind a flag
        // for migrating existing users.
        provider.flags |= NodeFlags.LazyProvider;
      }
      const override = providerOverrides.get(provider.token);
      if (override) {
        provider.flags = (provider.flags & ~NodeFlags.CatProviderNoDirective) | override.flags;
        provider.deps = splitDepsDsl(override.deps);
        provider.value = override.value;
      }
    }
    if (providerOverridesWithScope.size > 0) {
      let moduleSet = new Set<any>(def.modules);
      providerOverridesWithScope.forEach((override, token) => {
        if (moduleSet.has(getInjectableDef(token) !.providedIn)) {
          let provider = {
            token: token,
            flags:
                override.flags | (hasDeprecatedOverrides ? NodeFlags.LazyProvider : NodeFlags.None),
            deps: splitDepsDsl(override.deps),
            value: override.value,
            index: def.providers.length,
          };
          def.providers.push(provider);
          def.providersByKey[tokenKey(token)] = provider;
        }
      });
    }
  }
}


function calcHasOverrides(def: NgModuleDefinition):
      {hasOverrides: boolean, hasDeprecatedOverrides: boolean} {
    let hasOverrides = false;
    let hasDeprecatedOverrides = false;
    if (providerOverrides.size === 0) {
      return {hasOverrides, hasDeprecatedOverrides};
    }
    def.providers.forEach(node => {
      const override = providerOverrides.get(node.token);
      if ((node.flags & NodeFlags.CatProviderNoDirective) && override) {
        hasOverrides = true;
        hasDeprecatedOverrides = hasDeprecatedOverrides || override.deprecatedBehavior;
      }
    });
    def.modules.forEach(module => {
      providerOverridesWithScope.forEach((override, token) => {
        if (getInjectableDef(token) !.providedIn === module) {
          hasOverrides = true;
          hasDeprecatedOverrides = hasDeprecatedOverrides || override.deprecatedBehavior;
        }
      });
    });
    return {hasOverrides, hasDeprecatedOverrides};
  }


function applyProviderOverrides(def: NgModuleDefinition) {
    for (let i = 0; i < def.providers.length; i++) {
      const provider = def.providers[i];
      if (hasDeprecatedOverrides) {
        // We had a bug where me made
        // all providers lazy. Keep this logic behind a flag
        // for migrating existing users.
        provider.flags |= NodeFlags.LazyProvider;
      }
      const override = providerOverrides.get(provider.token);
      if (override) {
        provider.flags = (provider.flags & ~NodeFlags.CatProviderNoDirective) | override.flags;
        provider.deps = splitDepsDsl(override.deps);
        provider.value = override.value;
      }
    }
    if (providerOverridesWithScope.size > 0) {
      let moduleSet = new Set<any>(def.modules);
      providerOverridesWithScope.forEach((override, token) => {
        if (moduleSet.has(getInjectableDef(token) !.providedIn)) {
          let provider = {
            token: token,
            flags:
                override.flags | (hasDeprecatedOverrides ? NodeFlags.LazyProvider : NodeFlags.None),
            deps: splitDepsDsl(override.deps),
            value: override.value,
            index: def.providers.length,
          };
          def.providers.push(provider);
          def.providersByKey[tokenKey(token)] = provider;
        }
      });
    }
  }


function prodCheckAndUpdateNode(
    view: ViewData, checkIndex: number, argStyle: ArgumentType, v0?: any, v1?: any, v2?: any,
    v3?: any, v4?: any, v5?: any, v6?: any, v7?: any, v8?: any, v9?: any): any {
  const nodeDef = view.def.nodes[checkIndex];
  checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
  return (nodeDef.flags & NodeFlags.CatPureExpression) ?
      asPureExpressionData(view, checkIndex).value :
      undefined;
}


function prodCheckNoChangesNode(
    view: ViewData, checkIndex: number, argStyle: ArgumentType, v0?: any, v1?: any, v2?: any,
    v3?: any, v4?: any, v5?: any, v6?: any, v7?: any, v8?: any, v9?: any): any {
  const nodeDef = view.def.nodes[checkIndex];
  checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
  return (nodeDef.flags & NodeFlags.CatPureExpression) ?
      asPureExpressionData(view, checkIndex).value :
      undefined;
}


function debugCheckAndUpdateView(view: ViewData) {
  return callWithDebugContext(DebugAction.detectChanges, checkAndUpdateView, null, [view]);
}


function debugCheckNoChangesView(view: ViewData) {
  return callWithDebugContext(DebugAction.checkNoChanges, checkNoChangesView, null, [view]);
}


function debugDestroyView(view: ViewData) {
  return callWithDebugContext(DebugAction.destroy, destroyView, null, [view]);
}


function debugSetCurrentNode(view: ViewData, nodeIndex: number | null) {
  _currentView = view;
  _currentNodeIndex = nodeIndex;
}


function debugHandleEvent(view: ViewData, nodeIndex: number, eventName: string, event: any) {
  debugSetCurrentNode(view, nodeIndex);
  return callWithDebugContext(
      DebugAction.handleEvent, view.def.handleEvent, null, [view, nodeIndex, eventName, event]);
}


function debugUpdateDirectives(view: ViewData, checkType: CheckType) {
  if (view.state & ViewState.Destroyed) {
    throw viewDestroyedError(DebugAction[_currentAction]);
  }
  debugSetCurrentNode(view, nextDirectiveWithBinding(view, 0));
  return view.def.updateDirectives(debugCheckDirectivesFn, view);

  function debugCheckDirectivesFn(
      view: ViewData, nodeIndex: number, argStyle: ArgumentType, ...values: any[]) {
    const nodeDef = view.def.nodes[nodeIndex];
    if (checkType === CheckType.CheckAndUpdate) {
      debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
    } else {
      debugCheckNoChangesNode(view, nodeDef, argStyle, values);
    }
    if (nodeDef.flags & NodeFlags.TypeDirective) {
      debugSetCurrentNode(view, nextDirectiveWithBinding(view, nodeIndex));
    }
    return (nodeDef.flags & NodeFlags.CatPureExpression) ?
        asPureExpressionData(view, nodeDef.nodeIndex).value :
        undefined;
  }
}


function debugCheckDirectivesFn(
      view: ViewData, nodeIndex: number, argStyle: ArgumentType, ...values: any[]) {
    const nodeDef = view.def.nodes[nodeIndex];
    if (checkType === CheckType.CheckAndUpdate) {
      debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
    } else {
      debugCheckNoChangesNode(view, nodeDef, argStyle, values);
    }
    if (nodeDef.flags & NodeFlags.TypeDirective) {
      debugSetCurrentNode(view, nextDirectiveWithBinding(view, nodeIndex));
    }
    return (nodeDef.flags & NodeFlags.CatPureExpression) ?
        asPureExpressionData(view, nodeDef.nodeIndex).value :
        undefined;
  }


function debugUpdateRenderer(view: ViewData, checkType: CheckType) {
  if (view.state & ViewState.Destroyed) {
    throw viewDestroyedError(DebugAction[_currentAction]);
  }
  debugSetCurrentNode(view, nextRenderNodeWithBinding(view, 0));
  return view.def.updateRenderer(debugCheckRenderNodeFn, view);

  function debugCheckRenderNodeFn(
      view: ViewData, nodeIndex: number, argStyle: ArgumentType, ...values: any[]) {
    const nodeDef = view.def.nodes[nodeIndex];
    if (checkType === CheckType.CheckAndUpdate) {
      debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
    } else {
      debugCheckNoChangesNode(view, nodeDef, argStyle, values);
    }
    if (nodeDef.flags & NodeFlags.CatRenderNode) {
      debugSetCurrentNode(view, nextRenderNodeWithBinding(view, nodeIndex));
    }
    return (nodeDef.flags & NodeFlags.CatPureExpression) ?
        asPureExpressionData(view, nodeDef.nodeIndex).value :
        undefined;
  }
}


function debugCheckRenderNodeFn(
      view: ViewData, nodeIndex: number, argStyle: ArgumentType, ...values: any[]) {
    const nodeDef = view.def.nodes[nodeIndex];
    if (checkType === CheckType.CheckAndUpdate) {
      debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
    } else {
      debugCheckNoChangesNode(view, nodeDef, argStyle, values);
    }
    if (nodeDef.flags & NodeFlags.CatRenderNode) {
      debugSetCurrentNode(view, nextRenderNodeWithBinding(view, nodeIndex));
    }
    return (nodeDef.flags & NodeFlags.CatPureExpression) ?
        asPureExpressionData(view, nodeDef.nodeIndex).value :
        undefined;
  }


function debugCheckAndUpdateNode(
    view: ViewData, nodeDef: NodeDef, argStyle: ArgumentType, givenValues: any[]): void {
  const changed = (<any>checkAndUpdateNode)(view, nodeDef, argStyle, ...givenValues);
  if (changed) {
    const values = argStyle === ArgumentType.Dynamic ? givenValues[0] : givenValues;
    if (nodeDef.flags & NodeFlags.TypeDirective) {
      const bindingValues: {[key: string]: string} = {};
      for (let i = 0; i < nodeDef.bindings.length; i++) {
        const binding = nodeDef.bindings[i];
        const value = values[i];
        if (binding.flags & BindingFlags.TypeProperty) {
          bindingValues[normalizeDebugBindingName(binding.nonMinifiedName !)] =
              normalizeDebugBindingValue(value);
        }
      }
      const elDef = nodeDef.parent !;
      const el = asElementData(view, elDef.nodeIndex).renderElement;
      if (!elDef.element !.name) {
        // a comment.
        view.renderer.setValue(el, `bindings=${JSON.stringify(bindingValues, null, 2)}`);
      } else {
        // a regular element.
        for (let attr in bindingValues) {
          const value = bindingValues[attr];
          if (value != null) {
            view.renderer.setAttribute(el, attr, value);
          } else {
            view.renderer.removeAttribute(el, attr);
          }
        }
      }
    }
  }
}


function debugCheckNoChangesNode(
    view: ViewData, nodeDef: NodeDef, argStyle: ArgumentType, values: any[]): void {
  (<any>checkNoChangesNode)(view, nodeDef, argStyle, ...values);
}


function nextDirectiveWithBinding(view: ViewData, nodeIndex: number): number|null {
  for (let i = nodeIndex; i < view.def.nodes.length; i++) {
    const nodeDef = view.def.nodes[i];
    if (nodeDef.flags & NodeFlags.TypeDirective && nodeDef.bindings && nodeDef.bindings.length) {
      return i;
    }
  }
  return null;
}


function nextRenderNodeWithBinding(view: ViewData, nodeIndex: number): number|null {
  for (let i = nodeIndex; i < view.def.nodes.length; i++) {
    const nodeDef = view.def.nodes[i];
    if ((nodeDef.flags & NodeFlags.CatRenderNode) && nodeDef.bindings && nodeDef.bindings.length) {
      return i;
    }
  }
  return null;
}


function getRenderNodeIndex(viewDef: ViewDefinition, nodeIndex: number): number {
  let renderNodeIndex = -1;
  for (let i = 0; i <= nodeIndex; i++) {
    const nodeDef = viewDef.nodes[i];
    if (nodeDef.flags & NodeFlags.CatRenderNode) {
      renderNodeIndex++;
    }
  }
  return renderNodeIndex;
}


function findHostElement(view: ViewData): ElementData|null {
  while (view && !isComponentView(view)) {
    view = view.parent !;
  }
  if (view.parent) {
    return asElementData(view.parent, viewParentEl(view) !.nodeIndex);
  }
  return null;
}


function collectReferences(view: ViewData, nodeDef: NodeDef, references: {[key: string]: any}) {
  for (let refName in nodeDef.references) {
    references[refName] = getQueryValue(view, nodeDef, nodeDef.references[refName]);
  }
}


function callWithDebugContext(action: DebugAction, fn: any, self: any, args: any[]) {
  const oldAction = _currentAction;
  const oldView = _currentView;
  const oldNodeIndex = _currentNodeIndex;
  try {
    _currentAction = action;
    const result = fn.apply(self, args);
    _currentView = oldView;
    _currentNodeIndex = oldNodeIndex;
    _currentAction = oldAction;
    return result;
  } catch (e) {
    if (isViewDebugError(e) || !_currentView) {
      throw e;
    }
    throw viewWrappedDebugError(e, getCurrentDebugContext() !);
  }
}


export function getCurrentDebugContext(): DebugContext|null {
  return _currentView ? new DebugContext_(_currentView, _currentNodeIndex) : null;
}


(view: ViewData, nodeIndex: number) => new DebugContext_(view, nodeIndex)


(view: ViewData, nodeIndex: number, eventName: string, event: any) =>
                     view.def.handleEvent(view, nodeIndex, eventName, event)


(view: ViewData, checkType: CheckType) => view.def.updateDirectives(
                          checkType === CheckType.CheckAndUpdate ? prodCheckAndUpdateNode :
                                                                   prodCheckNoChangesNode,
                          view)


(view: ViewData, checkType: CheckType) => view.def.updateRenderer(
                        checkType === CheckType.CheckAndUpdate ? prodCheckAndUpdateNode :
                                                                 prodCheckNoChangesNode,
                        view)


() => NOOP


node => {
      const override = providerOverrides.get(node.token);
      if ((node.flags & NodeFlags.CatProviderNoDirective) && override) {
        hasOverrides = true;
        hasDeprecatedOverrides = hasDeprecatedOverrides || override.deprecatedBehavior;
      }
    }


module => {
      providerOverridesWithScope.forEach((override, token) => {
        if (getInjectableDef(token) !.providedIn === module) {
          hasOverrides = true;
          hasDeprecatedOverrides = hasDeprecatedOverrides || override.deprecatedBehavior;
        }
      });
    }


(override, token) => {
        if (getInjectableDef(token) !.providedIn === module) {
          hasOverrides = true;
          hasDeprecatedOverrides = hasDeprecatedOverrides || override.deprecatedBehavior;
        }
      }


(override, token) => {
        if (moduleSet.has(getInjectableDef(token) !.providedIn)) {
          let provider = {
            token: token,
            flags:
                override.flags | (hasDeprecatedOverrides ? NodeFlags.LazyProvider : NodeFlags.None),
            deps: splitDepsDsl(override.deps),
            value: override.value,
            index: def.providers.length,
          };
          def.providers.push(provider);
          def.providersByKey[tokenKey(token)] = provider;
        }
      }


() => {
      currRenderNodeIndex++;
      if (currRenderNodeIndex === renderNodeIndex) {
        return console.error.bind(console, ...values);
      } else {
        return NOOP;
      }
    }


class DebugContext_ implements DebugContext {
  private nodeDef: NodeDef;
  private elView: ViewData;
  private elDef: NodeDef;

  constructor(public view: ViewData, public nodeIndex: number|null) {
    if (nodeIndex == null) {
      this.nodeIndex = nodeIndex = 0;
    }
    this.nodeDef = view.def.nodes[nodeIndex];
    let elDef = this.nodeDef;
    let elView = view;
    while (elDef && (elDef.flags & NodeFlags.TypeElement) === 0) {
      elDef = elDef.parent !;
    }
    if (!elDef) {
      while (!elDef && elView) {
        elDef = viewParentEl(elView) !;
        elView = elView.parent !;
      }
    }
    this.elDef = elDef;
    this.elView = elView;
  }

  private get elOrCompView() {
    // Has to be done lazily as we use the DebugContext also during creation of elements...
    return asElementData(this.elView, this.elDef.nodeIndex).componentView || this.view;
  }

  get injector(): Injector { return createInjector(this.elView, this.elDef); }

  get component(): any { return this.elOrCompView.component; }

  get context(): any { return this.elOrCompView.context; }

  get providerTokens(): any[] {
    const tokens: any[] = [];
    if (this.elDef) {
      for (let i = this.elDef.nodeIndex + 1; i <= this.elDef.nodeIndex + this.elDef.childCount;
           i++) {
        const childDef = this.elView.def.nodes[i];
        if (childDef.flags & NodeFlags.CatProvider) {
          tokens.push(childDef.provider !.token);
        }
        i += childDef.childCount;
      }
    }
    return tokens;
  }

  get references(): {[key: string]: any} {
    const references: {[key: string]: any} = {};
    if (this.elDef) {
      collectReferences(this.elView, this.elDef, references);

      for (let i = this.elDef.nodeIndex + 1; i <= this.elDef.nodeIndex + this.elDef.childCount;
           i++) {
        const childDef = this.elView.def.nodes[i];
        if (childDef.flags & NodeFlags.CatProvider) {
          collectReferences(this.elView, childDef, references);
        }
        i += childDef.childCount;
      }
    }
    return references;
  }

  get componentRenderElement() {
    const elData = findHostElement(this.elOrCompView);
    return elData ? elData.renderElement : undefined;
  }

  get renderNode(): any {
    return this.nodeDef.flags & NodeFlags.TypeText ? renderNode(this.view, this.nodeDef) :
                                                     renderNode(this.elView, this.elDef);
  }

  logError(console: Console, ...values: any[]) {
    let logViewDef: ViewDefinition;
    let logNodeIndex: number;
    if (this.nodeDef.flags & NodeFlags.TypeText) {
      logViewDef = this.view.def;
      logNodeIndex = this.nodeDef.nodeIndex;
    } else {
      logViewDef = this.elView.def;
      logNodeIndex = this.elDef.nodeIndex;
    }
    // Note: we only generate a log function for text and element nodes
    // to make the generated code as small as possible.
    const renderNodeIndex = getRenderNodeIndex(logViewDef, logNodeIndex);
    let currRenderNodeIndex = -1;
    let nodeLogger: NodeLogger = () => {
      currRenderNodeIndex++;
      if (currRenderNodeIndex === renderNodeIndex) {
        return console.error.bind(console, ...values);
      } else {
        return NOOP;
      }
    };
    logViewDef.factory !(nodeLogger);
    if (currRenderNodeIndex < renderNodeIndex) {
      console.error('Illegal state: the ViewDefinitionFactory did not call the logger!');
      (<any>console.error)(...values);
    }
  }
}


export class DebugRendererFactory2 implements RendererFactory2 {
  constructor(private delegate: RendererFactory2) {}

  createRenderer(element: any, renderData: RendererType2|null): Renderer2 {
    return new DebugRenderer2(this.delegate.createRenderer(element, renderData));
  }

  begin() {
    if (this.delegate.begin) {
      this.delegate.begin();
    }
  }
  end() {
    if (this.delegate.end) {
      this.delegate.end();
    }
  }

  whenRenderingDone(): Promise<any> {
    if (this.delegate.whenRenderingDone) {
      return this.delegate.whenRenderingDone();
    }
    return Promise.resolve(null);
  }
}


export class DebugRenderer2 implements Renderer2 {
  readonly data: {[key: string]: any};

  private createDebugContext(nativeElement: any) { return this.debugContextFactory(nativeElement); }

  /**
   * Factory function used to create a `DebugContext` when a node is created.
   *
   * The `DebugContext` allows to retrieve information about the nodes that are useful in tests.
   *
   * The factory is configurable so that the `DebugRenderer2` could instantiate either a View Engine
   * or a Render context.
   */
  debugContextFactory: (nativeElement?: any) => DebugContext | null = getCurrentDebugContext;

  constructor(private delegate: Renderer2) { this.data = this.delegate.data; }

  destroyNode(node: any) {
    removeDebugNodeFromIndex(getDebugNode(node) !);
    if (this.delegate.destroyNode) {
      this.delegate.destroyNode(node);
    }
  }

  destroy() { this.delegate.destroy(); }

  createElement(name: string, namespace?: string): any {
    const el = this.delegate.createElement(name, namespace);
    const debugCtx = this.createDebugContext(el);
    if (debugCtx) {
      const debugEl = new DebugElement__PRE_R3__(el, null, debugCtx);
      (debugEl as{name: string}).name = name;
      indexDebugNode(debugEl);
    }
    return el;
  }

  createComment(value: string): any {
    const comment = this.delegate.createComment(value);
    const debugCtx = this.createDebugContext(comment);
    if (debugCtx) {
      indexDebugNode(new DebugNode__PRE_R3__(comment, null, debugCtx));
    }
    return comment;
  }

  createText(value: string): any {
    const text = this.delegate.createText(value);
    const debugCtx = this.createDebugContext(text);
    if (debugCtx) {
      indexDebugNode(new DebugNode__PRE_R3__(text, null, debugCtx));
    }
    return text;
  }

  appendChild(parent: any, newChild: any): void {
    const debugEl = getDebugNode(parent);
    const debugChildEl = getDebugNode(newChild);
    if (debugEl && debugChildEl && debugEl instanceof DebugElement__PRE_R3__) {
      debugEl.addChild(debugChildEl);
    }
    this.delegate.appendChild(parent, newChild);
  }

  insertBefore(parent: any, newChild: any, refChild: any): void {
    const debugEl = getDebugNode(parent);
    const debugChildEl = getDebugNode(newChild);
    const debugRefEl = getDebugNode(refChild) !;
    if (debugEl && debugChildEl && debugEl instanceof DebugElement__PRE_R3__) {
      debugEl.insertBefore(debugRefEl, debugChildEl);
    }

    this.delegate.insertBefore(parent, newChild, refChild);
  }

  removeChild(parent: any, oldChild: any): void {
    const debugEl = getDebugNode(parent);
    const debugChildEl = getDebugNode(oldChild);
    if (debugEl && debugChildEl && debugEl instanceof DebugElement__PRE_R3__) {
      debugEl.removeChild(debugChildEl);
    }
    this.delegate.removeChild(parent, oldChild);
  }

  selectRootElement(selectorOrNode: string|any, preserveContent?: boolean): any {
    const el = this.delegate.selectRootElement(selectorOrNode, preserveContent);
    const debugCtx = getCurrentDebugContext();
    if (debugCtx) {
      indexDebugNode(new DebugElement__PRE_R3__(el, null, debugCtx));
    }
    return el;
  }

  setAttribute(el: any, name: string, value: string, namespace?: string): void {
    const debugEl = getDebugNode(el);
    if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
      const fullName = namespace ? namespace + ':' + name : name;
      debugEl.attributes[fullName] = value;
    }
    this.delegate.setAttribute(el, name, value, namespace);
  }

  removeAttribute(el: any, name: string, namespace?: string): void {
    const debugEl = getDebugNode(el);
    if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
      const fullName = namespace ? namespace + ':' + name : name;
      debugEl.attributes[fullName] = null;
    }
    this.delegate.removeAttribute(el, name, namespace);
  }

  addClass(el: any, name: string): void {
    const debugEl = getDebugNode(el);
    if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
      debugEl.classes[name] = true;
    }
    this.delegate.addClass(el, name);
  }

  removeClass(el: any, name: string): void {
    const debugEl = getDebugNode(el);
    if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
      debugEl.classes[name] = false;
    }
    this.delegate.removeClass(el, name);
  }

  setStyle(el: any, style: string, value: any, flags: RendererStyleFlags2): void {
    const debugEl = getDebugNode(el);
    if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
      debugEl.styles[style] = value;
    }
    this.delegate.setStyle(el, style, value, flags);
  }

  removeStyle(el: any, style: string, flags: RendererStyleFlags2): void {
    const debugEl = getDebugNode(el);
    if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
      debugEl.styles[style] = null;
    }
    this.delegate.removeStyle(el, style, flags);
  }

  setProperty(el: any, name: string, value: any): void {
    const debugEl = getDebugNode(el);
    if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
      debugEl.properties[name] = value;
    }
    this.delegate.setProperty(el, name, value);
  }

  listen(
      target: 'document'|'windows'|'body'|any, eventName: string,
      callback: (event: any) => boolean): () => void {
    if (typeof target !== 'string') {
      const debugEl = getDebugNode(target);
      if (debugEl) {
        debugEl.listeners.push(new EventListener(eventName, callback));
      }
    }

    return this.delegate.listen(target, eventName, callback);
  }

  parentNode(node: any): any { return this.delegate.parentNode(node); }
  nextSibling(node: any): any { return this.delegate.nextSibling(node); }
  setValue(node: any, value: string): void { return this.delegate.setValue(node, value); }
}


enum DebugAction {
  create,
  detectChanges,
  checkNoChanges,
  destroy,
  handleEvent
}


logError(console: Console, ...values: any[]) {
    let logViewDef: ViewDefinition;
    let logNodeIndex: number;
    if (this.nodeDef.flags & NodeFlags.TypeText) {
      logViewDef = this.view.def;
      logNodeIndex = this.nodeDef.nodeIndex;
    } else {
      logViewDef = this.elView.def;
      logNodeIndex = this.elDef.nodeIndex;
    }
    // Note: we only generate a log function for text and element nodes
    // to make the generated code as small as possible.
    const renderNodeIndex = getRenderNodeIndex(logViewDef, logNodeIndex);
    let currRenderNodeIndex = -1;
    let nodeLogger: NodeLogger = () => {
      currRenderNodeIndex++;
      if (currRenderNodeIndex === renderNodeIndex) {
        return console.error.bind(console, ...values);
      } else {
        return NOOP;
      }
    };
    logViewDef.factory !(nodeLogger);
    if (currRenderNodeIndex < renderNodeIndex) {
      console.error('Illegal state: the ViewDefinitionFactory did not call the logger!');
      (<any>console.error)(...values);
    }
  }


createRenderer(element: any, renderData: RendererType2|null): Renderer2 {
    return new DebugRenderer2(this.delegate.createRenderer(element, renderData));
  }


begin() {
    if (this.delegate.begin) {
      this.delegate.begin();
    }
  }


end() {
    if (this.delegate.end) {
      this.delegate.end();
    }
  }


whenRenderingDone(): Promise<any> {
    if (this.delegate.whenRenderingDone) {
      return this.delegate.whenRenderingDone();
    }
    return Promise.resolve(null);
  }


private createDebugContext(nativeElement: any) { return this.debugContextFactory(nativeElement); }


destroyNode(node: any) {
    removeDebugNodeFromIndex(getDebugNode(node) !);
    if (this.delegate.destroyNode) {
      this.delegate.destroyNode(node);
    }
  }


destroy() { this.delegate.destroy(); }


createElement(name: string, namespace?: string): any {
    const el = this.delegate.createElement(name, namespace);
    const debugCtx = this.createDebugContext(el);
    if (debugCtx) {
      const debugEl = new DebugElement__PRE_R3__(el, null, debugCtx);
      (debugEl as{name: string}).name = name;
      indexDebugNode(debugEl);
    }
    return el;
  }


createComment(value: string): any {
    const comment = this.delegate.createComment(value);
    const debugCtx = this.createDebugContext(comment);
    if (debugCtx) {
      indexDebugNode(new DebugNode__PRE_R3__(comment, null, debugCtx));
    }
    return comment;
  }


createText(value: string): any {
    const text = this.delegate.createText(value);
    const debugCtx = this.createDebugContext(text);
    if (debugCtx) {
      indexDebugNode(new DebugNode__PRE_R3__(text, null, debugCtx));
    }
    return text;
  }


appendChild(parent: any, newChild: any): void {
    const debugEl = getDebugNode(parent);
    const debugChildEl = getDebugNode(newChild);
    if (debugEl && debugChildEl && debugEl instanceof DebugElement__PRE_R3__) {
      debugEl.addChild(debugChildEl);
    }
    this.delegate.appendChild(parent, newChild);
  }


insertBefore(parent: any, newChild: any, refChild: any): void {
    const debugEl = getDebugNode(parent);
    const debugChildEl = getDebugNode(newChild);
    const debugRefEl = getDebugNode(refChild) !;
    if (debugEl && debugChildEl && debugEl instanceof DebugElement__PRE_R3__) {
      debugEl.insertBefore(debugRefEl, debugChildEl);
    }

    this.delegate.insertBefore(parent, newChild, refChild);
  }


removeChild(parent: any, oldChild: any): void {
    const debugEl = getDebugNode(parent);
    const debugChildEl = getDebugNode(oldChild);
    if (debugEl && debugChildEl && debugEl instanceof DebugElement__PRE_R3__) {
      debugEl.removeChild(debugChildEl);
    }
    this.delegate.removeChild(parent, oldChild);
  }


selectRootElement(selectorOrNode: string|any, preserveContent?: boolean): any {
    const el = this.delegate.selectRootElement(selectorOrNode, preserveContent);
    const debugCtx = getCurrentDebugContext();
    if (debugCtx) {
      indexDebugNode(new DebugElement__PRE_R3__(el, null, debugCtx));
    }
    return el;
  }


setAttribute(el: any, name: string, value: string, namespace?: string): void {
    const debugEl = getDebugNode(el);
    if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
      const fullName = namespace ? namespace + ':' + name : name;
      debugEl.attributes[fullName] = value;
    }
    this.delegate.setAttribute(el, name, value, namespace);
  }


removeAttribute(el: any, name: string, namespace?: string): void {
    const debugEl = getDebugNode(el);
    if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
      const fullName = namespace ? namespace + ':' + name : name;
      debugEl.attributes[fullName] = null;
    }
    this.delegate.removeAttribute(el, name, namespace);
  }


addClass(el: any, name: string): void {
    const debugEl = getDebugNode(el);
    if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
      debugEl.classes[name] = true;
    }
    this.delegate.addClass(el, name);
  }


removeClass(el: any, name: string): void {
    const debugEl = getDebugNode(el);
    if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
      debugEl.classes[name] = false;
    }
    this.delegate.removeClass(el, name);
  }


setStyle(el: any, style: string, value: any, flags: RendererStyleFlags2): void {
    const debugEl = getDebugNode(el);
    if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
      debugEl.styles[style] = value;
    }
    this.delegate.setStyle(el, style, value, flags);
  }


removeStyle(el: any, style: string, flags: RendererStyleFlags2): void {
    const debugEl = getDebugNode(el);
    if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
      debugEl.styles[style] = null;
    }
    this.delegate.removeStyle(el, style, flags);
  }


setProperty(el: any, name: string, value: any): void {
    const debugEl = getDebugNode(el);
    if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
      debugEl.properties[name] = value;
    }
    this.delegate.setProperty(el, name, value);
  }


listen(
      target: 'document'|'windows'|'body'|any, eventName: string,
      callback: (event: any) => boolean): () => void {
    if (typeof target !== 'string') {
      const debugEl = getDebugNode(target);
      if (debugEl) {
        debugEl.listeners.push(new EventListener(eventName, callback));
      }
    }

    return this.delegate.listen(target, eventName, callback);
  }


parentNode(node: any): any { return this.delegate.parentNode(node); }


nextSibling(node: any): any { return this.delegate.nextSibling(node); }


setValue(node: any, value: string): void { return this.delegate.setValue(node, value); }


(oletus: 2333 tai testnet: 12333)


(oletus: 2332 or testnet: 12332)


(oletus: 127.0.0.1)


(oletus: 100)


@NgModule({
  declarations: [
    AppComponent,
    LoginComponent,
    LoginPopupComponent,
    DashboardComponent,
    CardComponent,
    RegisterComponent,
    ChatComponent,
    AboutComponent,
     NavComponent, UseritemComponent,
     UserlistComponent, ChatitemComponent,
     ChatlistComponent, EmojiPickerComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    RouterModule,
    RouterModule.forRoot(routes),
    NgSelectModule,
    ToastrModule.forRoot(),
    BrowserAnimationsModule //required for toastr
  ],
  providers: [AuthService],
  bootstrap: [AppComponent],
  schemas: [ NO_ERRORS_SCHEMA]
})
export class AppModule { }


export function* loadCartItems() {
  try {
    const token = getToken();
    if (token) {
      const response = yield call(() => getRequest(routes.cartList));
      yield put(recvCart(response.data));
    }
  } catch (e) {
    yield put(getFailure(e));
  }
}


export function* syncCartItems() {
  const cartItems = yield select(getCartFromState);
  const userId = yield select(getUserId);
  cartItems.map((item: CartItemModel) => {
    postRequest(routes.addToCart, {
      ...item,
      userId,
    });
  });
}


function* getCartItems() {
  try {
    yield put(loading());
    yield loadCartItems();
    yield calculateOrderPrice();
    yield put(loaded());
  } catch (e) {
    yield put(loaded());
    yield put(getFailure(e));
  }
}


function* addToCart(action: AddToCart) {
  try {
    yield put(loading());
    yield syncProductOnAdd(action.payload);
    yield put(addedToCart(action.payload));
    yield calculateOrderPrice();
    message.success('Product is added to cart!');
    yield put(loaded());
  } catch (e) {
    yield put(loaded());
    yield put(getFailure(e));
  }
}


function* syncProductOnAdd(action: ProductModel) {
  try {
    const token = getToken();
    if (!token) {
      return;
    }

    const params = {
      productId: action.id,
      userId: yield select(getUserId),
      title: action.title,
      price: action.price,
      quantity: action.quantity ? action.quantity : 1,
    };
    yield call(() => postRequest(routes.addToCart, params));
  } catch (e) {
    yield put(getFailure(e));
  }
}


function* removeFromCartSaga(action: RemoveFromCartProps) {
  try {
    yield put(loading());

    const url = routes.removeFromCart.replace(':id', action.payload);
    yield call(() => deleteRequest(url));
    yield put(itemRemoved(action.payload));
    message.success('Product was removed from cart!');
    yield calculateOrderPrice();
    yield put(loaded());
  } catch (e) {
    yield put(loaded());
    yield put(getFailure(e));
    message.error('Unable to remove product from cart!');
  }
}


function* cartRecalculate(action: RecalculateProps) {
  try {
    const token = getToken();
    if (token) {
      yield call(() =>
        patchRequest(routes.cartRecalculate, {
          id: action.payload.id,
          quantity: action.payload.quantity,
        }),
      );
    }
    yield put(recalculated(action.payload));

    yield calculateOrderPrice();
  } catch (e) {
    yield put(getFailure(e));
  }
}


function* calculateOrderPrice() {
  try {
    const cartItems = yield select(getCartFromState);

    let price = 0;
    cartItems.map((item: any) => {
      price = price + parseFloat(item.quantity) * parseFloat(item.price);
    });
    yield put(checkoutCalc(price.toFixed(2)));
  } catch (e) {
    yield put(getFailure(e));
  }
}


export function* cartAddWatcher() {
  yield takeLatest(ADD_TO_CART, addToCart);
}


export function* watchCart() {
  yield takeLatest(GET_CART, getCartItems);
}


export function* watchRemoveFromCart() {
  yield takeLatest(REMOVE_FROM_CART, removeFromCartSaga);
}


export function* watchRecalculate() {
  yield takeLatest(RECALCULATE_CART, cartRecalculate);
}


(state: any) => state.auth.user.id


(state: any) => state.cart.cartItems


() => getRequest(routes.cartList)


(item: CartItemModel) => {
    postRequest(routes.addToCart, {
      ...item,
      userId,
    });
  }


() => postRequest(routes.addToCart, params)


() => deleteRequest(url)


() =>
        patchRequest(routes.cartRecalculate, {
          id: action.payload.id,
          quantity: action.payload.quantity,
        })


(item: any) => {
      price = price + parseFloat(item.quantity) * parseFloat(item.price);
    }


interface AddToCart {
  type: string;
  payload: ProductModel;
}


interface RemoveFromCartProps {
  type: string;
  payload: string;
}


interface RecalculateProps {
  type: string;
  payload: {
    id: string;
    quantity: number;
  };
}


() => {
  const { matomoTrackEvent } = useTracking();

  const handleClick = () => {
    matomoTrackEvent({
      action: actions.CLICK_EXTERNAL_NAVIGATION,
      name: `${eventNames.LOGO} - ${sections.HEADER}`,
    });
  };

  const homeLink =
    process.env.NODE_ENV === "production"
      ? "https://amsterdam.nl/"
      : routes.home;

  return (
    <StyledHeader
      css={StyledHeaderWrapper}
      homeLink=""
      logo={()


() => {
    matomoTrackEvent({
      action: actions.CLICK_EXTERNAL_NAVIGATION,
      name: `${eventNames.LOGO} - ${sections.HEADER}`,
    });
  }


() => {
    console.log('HTTP REST API Server running at http://localhost:' + httpServer.address().port);
}


export interface IMenuButton {
    name: string;
    icon?: string;
    children?: IMenuItem[];
    expand?: boolean;
    disable?: boolean;
    onTapped?: () => void;
}


export interface IMenuDivide {
}


export type IMenuItem = IMenuButton | IMenuDivide;


export type MenuEvent = (item: IMenuButton) => void;


() => {
  let component: Comp452Component;
  let fixture: ComponentFixture<Comp452Component>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [ Comp452Component ]
    })
    .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(Comp452Component);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });
}


() => {
    TestBed.configureTestingModule({
      declarations: [ Comp452Component ]
    })
    .compileComponents();
  }


() => {
    fixture = TestBed.createComponent(Comp452Component);
    component = fixture.componentInstance;
    fixture.detectChanges();
  }


async () => {
    await add_md_label(utils, await utils.getIssues(1))
    console.log(utils.sectionMap.get(Constant.AGG_EACH_LABEL))

    expect(utils.sectionMap.get(Constant.AGG_EACH_LABEL)).not.toContain('links')
    // worst case
}


() => loyaltyAccountSchema


/** A request to create a new loyalty account. */
export interface CreateLoyaltyAccountRequest {
  /**
   * Describes a loyalty account. For more information, see
   * [Loyalty Overview](https://developer.squareup.com/docs/loyalty/overview).
   */
  loyaltyAccount: LoyaltyAccount;
  /**
   * A unique string that identifies this `CreateLoyaltyAccount` request.
   * Keys can be any valid string, but must be unique for every request.
   */
  idempotencyKey: string;
}


export class NoTTYReport extends CLIReport {
  protected maxPathDisplay: number;
  protected maxFormatDisplay: number;
  protected currentLine: string;

  public update(context: Context): void {
    const completed: SizeMap = super.getUpdated(context);
    if (this.silent) {
      return;
    }

    for (const complete of completed) {
      const [path, sizeMapValue] = complete;
      const displayPath = context.originalPaths.get(path) || path;
      let failure = 0;

      this.currentLine = ` ${displayPath
        .substring(displayPath.length - this.maxPathDisplay)
        .padEnd(this.maxPathDisplay)}  `;
      for (let i = 0; i < OrderedCompressionValues.length; i++) {
        failure += this.displaySize(sizeMapValue[i]).failure;
      }

      if (failure > 0) {
        this.currentLine = `  ${kleur.red(ICONS['cross'])}${this.currentLine}`;
      } else {
        this.currentLine = `  ${kleur.dim().green(ICONS['tick'])}${this.currentLine}`;
      }

      write(this.currentLine + '\n');
    }
  }
}


public update(context: Context): void {
    const completed: SizeMap = super.getUpdated(context);
    if (this.silent) {
      return;
    }

    for (const complete of completed) {
      const [path, sizeMapValue] = complete;
      const displayPath = context.originalPaths.get(path) || path;
      let failure = 0;

      this.currentLine = ` ${displayPath
        .substring(displayPath.length - this.maxPathDisplay)
        .padEnd(this.maxPathDisplay)}  `;
      for (let i = 0; i < OrderedCompressionValues.length; i++) {
        failure += this.displaySize(sizeMapValue[i]).failure;
      }

      if (failure > 0) {
        this.currentLine = `  ${kleur.red(ICONS['cross'])}${this.currentLine}`;
      } else {
        this.currentLine = `  ${kleur.dim().green(ICONS['tick'])}${this.currentLine}`;
      }

      write(this.currentLine + '\n');
    }
  }


function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}


function alignMemory(size,factor){if(!factor)factor=STACK_ALIGN;return Math.ceil(size/factor)*factor}


function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;err(text)}}


function convertJsFunctionToWasm(func,sig){if(typeof WebAssembly.Function==="function"){var typeNames={"i":"i32","j":"i64","f":"f32","d":"f64"};var type={parameters:[],results:sig[0]=="v"?[]:[typeNames[sig[0]]]};for(var i=1;i<sig.length;++i){type.parameters.push(typeNames[sig[i]])}return new WebAssembly.Function(type,func)}var typeSection=[1,0,1,96];var sigRet=sig.slice(0,1);var sigParam=sig.slice(1);var typeCodes={"i":127,"j":126,"f":125,"d":124};typeSection.push(sigParam.length);for(var i=0;i<sigParam.length;++i){typeSection.push(typeCodes[sigParam[i]])}if(sigRet=="v"){typeSection.push(0)}else{typeSection=typeSection.concat([1,typeCodes[sigRet]])}typeSection[1]=typeSection.length-2;var bytes=new Uint8Array([0,97,115,109,1,0,0,0].concat(typeSection,[2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0]));var module=new WebAssembly.Module(bytes);var instance=new WebAssembly.Instance(module,{"e":{"f":func}});var wrappedFunc=instance.exports["f"];return wrappedFunc}


function getEmptyTableSlot(){if(freeTableIndexes.length){return freeTableIndexes.pop()}try{wasmTable.grow(1)}catch(err){if(!(err instanceof RangeError)){throw err}throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."}return wasmTable.length-1}


function addFunctionWasm(func,sig){if(!functionsInTableMap){functionsInTableMap=new WeakMap;for(var i=0;i<wasmTable.length;i++){var item=wasmTable.get(i);if(item){functionsInTableMap.set(item,i)}}}if(functionsInTableMap.has(func)){return functionsInTableMap.get(func)}var ret=getEmptyTableSlot();try{wasmTable.set(ret,func)}catch(err){if(!(err instanceof TypeError)){throw err}var wrapped=convertJsFunctionToWasm(func,sig);wasmTable.set(ret,wrapped)}functionsInTableMap.set(func,ret);return ret}


function assert(condition,text){if(!condition){abort("Assertion failed: "+text)}}


function getCFunc(ident){var func=Module["_"+ident];assert(func,"Cannot call unknown function "+ident+", make sure it is exported");return func}


function ccall(ident,returnType,argTypes,args,opts){var toC={"string":function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},"array":function(arr){var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string")return UTF8ToString(ret);if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i<args.length;i++){var converter=toC[argTypes[i]];if(converter){if(stack===0)stack=stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func.apply(null,cArgs);ret=convertReturnValue(ret);if(stack!==0)stackRestore(stack);return ret}


function convertReturnValue(ret){if(returnType==="string")return UTF8ToString(ret);if(returnType==="boolean")return Boolean(ret);return ret}


function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}


function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}


function lengthBytesUTF8(str){var len=0;for(var i=0;i<str.length;++i){var u=str.charCodeAt(i);if(u>=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127)++len;else if(u<=2047)len+=2;else if(u<=65535)len+=3;else len+=4}return len}


function allocateUTF8OnStack(str){var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8Array(str,HEAP8,ret,size);return ret}


function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}


function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i<str.length;++i){HEAP8[buffer++>>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}


function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}


function initRuntime(){runtimeInitialized=true;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();TTY.init();callRuntimeCallbacks(__ATINIT__)}


function preMain(){FS.ignorePermissions=false;callRuntimeCallbacks(__ATMAIN__)}


function exitRuntime(){runtimeExited=true}


function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}


function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}


function getUniqueRunDependency(id){return id}


function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}


function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what+="";err(what);ABORT=true;EXITSTATUS=1;what="abort("+what+"). Build with -s ASSERTIONS=1 for more info.";var e=new WebAssembly.RuntimeError(what);throw e}


function hasPrefix(str,prefix){return String.prototype.startsWith?str.startsWith(prefix):str.indexOf(prefix)===0}


function isDataURI(filename){return hasPrefix(filename,dataURIPrefix)}


function isFileURI(filename){return hasPrefix(filename,fileURIPrefix)}


function getBinary(){try{if(wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(wasmBinaryFile)}else{throw"both async and sync fetching of the wasm failed"}}catch(err){abort(err)}}


function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)&&typeof fetch==="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary()})}return Promise.resolve().then(getBinary)}


function createWasm(){var info={"env":asmLibraryArg,"wasi_snapshot_preview1":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmTable=Module["asm"]["__indirect_function_table"];removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiatedSource(output){receiveInstance(output["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming==="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch==="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiatedSource,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiatedSource)})})}else{return instantiateArrayBuffer(receiveInstantiatedSource)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}


function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmTable=Module["asm"]["__indirect_function_table"];removeRunDependency("wasm-instantiate")}


function receiveInstantiatedSource(output){receiveInstance(output["instance"])}


function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}


function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming==="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch==="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiatedSource,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiatedSource)})})}else{return instantiateArrayBuffer(receiveInstantiatedSource)}}


function demangle(func){return func}


function demangleAll(text){var regex=/\b_Z[\w\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+" ["+x+"]"})}


function dynCallLegacy(sig,ptr,args){if(args&&args.length){return Module["dynCall_"+sig].apply(null,[ptr].concat(args))}return Module["dynCall_"+sig].call(null,ptr)}


function jsStackTrace(){var error=new Error;if(!error.stack){try{throw new Error}catch(e){error=e}if(!error.stack){return"(no stack trace available)"}}return error.stack.toString()}


function ___assert_fail(condition,filename,line,func){abort("Assertion failed: "+UTF8ToString(condition)+", at: "+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"])}


function setErrNo(value){HEAP32[___errno_location()>>2]=value;return value}


function getRandomDevice(){if(typeof crypto==="object"&&typeof crypto["getRandomValues"]==="function"){var randomBuffer=new Uint8Array(1);return function(){crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else if(ENVIRONMENT_IS_NODE){try{var crypto_module=require("crypto");return function(){return crypto_module["randomBytes"](1)[0]}}catch(e){}}return function(){abort("randomDevice")}}


function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}


function mmapAlloc(size){var alignedSize=alignMemory(size,16384);var ptr=_malloc(alignedSize);while(size<alignedSize)HEAP8[ptr+size++]=0;return ptr}


function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}


function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}


function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}


function finish(byteArray){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}


function finish(){if(fail==0)onload();else onerror()}


function ___sys_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-28}var newStream;newStream=FS.open(stream.path,stream.flags,0,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0}case 12:{var arg=SYSCALLS.get();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 13:case 14:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}


function ___sys_getcwd(buf,size){try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd);if(size<cwdLengthInBytes+1)return-68;stringToUTF8(cwd,buf,size);return buf}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}


function ___sys_ioctl(fd,op,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(op){case 21509:case 21505:{if(!stream.tty)return-59;return 0}case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:{if(!stream.tty)return-59;return 0}case 21519:{if(!stream.tty)return-59;var argp=SYSCALLS.get();HEAP32[argp>>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;return 0}case 21524:{if(!stream.tty)return-59;return 0}default:abort("bad ioctl syscall "+op)}}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}


function ___sys_mmap2(addr,len,prot,flags,fd,off){try{return syscallMmap2(addr,len,prot,flags,fd,off)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}


function ___sys_munmap(addr,len){try{return syscallMunmap(addr,len)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}


function ___sys_open(path,flags,varargs){SYSCALLS.varargs=varargs;try{var pathname=SYSCALLS.getStr(path);var mode=SYSCALLS.get();var stream=FS.open(pathname,flags,mode);return stream.fd}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}


function ___sys_stat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.stat,path,buf)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}


function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}


function abortOnCannotGrowMemory(requestedSize){abort("OOM")}


function _emscripten_resize_heap(requestedSize){requestedSize=requestedSize>>>0;abortOnCannotGrowMemory(requestedSize)}


function getExecutableName(){return thisProgram||"./this.program"}


function getEnvStrings(){if(!getEnvStrings.strings){var lang=(typeof navigator==="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={"USER":"web_user","LOGNAME":"web_user","PATH":"/","PWD":"/","HOME":"/home/web_user","LANG":lang,"_":getExecutableName()};for(var x in ENV){env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(x+"="+env[x])}getEnvStrings.strings=strings}return getEnvStrings.strings}


function _environ_get(__environ,environ_buf){try{var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAP32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return e.errno}}


function _environ_sizes_get(penviron_count,penviron_buf_size){try{var strings=getEnvStrings();HEAP32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAP32[penviron_buf_size>>2]=bufSize;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return e.errno}}


function _exit(status){exit(status)}


function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return e.errno}}


function _fd_read(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=SYSCALLS.doReadv(stream,iov,iovcnt);HEAP32[pnum>>2]=num;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return e.errno}}


function _fd_write(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=SYSCALLS.doWritev(stream,iov,iovcnt);HEAP32[pnum>>2]=num;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return e.errno}}


function _gettimeofday(ptr){var now=Date.now();HEAP32[ptr>>2]=now/1e3|0;HEAP32[ptr+4>>2]=now%1e3*1e3|0;return 0}


function _setTempRet0($i){setTempRet0($i|0)}


function _time(ptr){var ret=Date.now()/1e3|0;if(ptr){HEAP32[ptr>>2]=ret}return ret}


function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}


function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}


function callMain(args){var entryFunction=Module["_main"];args=args||[];var argc=args.length+1;var argv=stackAlloc((argc+1)*4);HEAP32[argv>>2]=allocateUTF8OnStack(thisProgram);for(var i=1;i<argc;i++){HEAP32[(argv>>2)+i]=allocateUTF8OnStack(args[i-1])}HEAP32[(argv>>2)+argc]=0;try{var ret=entryFunction(argc,argv);exit(ret,true)}catch(e){if(e instanceof ExitStatus){return}else if(e=="unwind"){noExitRuntime=true;return}else{var toLog=e;if(e&&typeof e==="object"&&e.stack){toLog=[e,e.stack]}err("exception thrown: "+toLog);quit_(1,e)}}finally{calledMain=true}}


export interface options {
    xml: string;
    schema: string | string[];
    format: string;
    TOTAL_MEMORY: number;
}


/**
 * Generated class for the AppsappInputDateComponent component.
 *
 * See https://angular.io/api/core/Component for more info on Angular
 * Components.
 */
export declare class AppsappInputDateComponent extends AppsappInputAbstractComponent {
    beforeModelChanges(model: any, property: any, value: any): boolean;
    /**
     *
     * @param {ConfigModel} config
     */
    afterInit(config: any): void;
}


beforeModelChanges(model: any, property: any, value: any): boolean;


/**
     *
     * @param {ConfigModel} config
     */
afterInit(config: any): void;


() => {
  let div: HTMLDivElement;
  let service: BindingService;

  beforeEach(() => {
    div = document.createElement('div');
    document.body.appendChild(div);
  });

  afterEach(() => {
    div.remove();
    jest.clearAllMocks();
  });

  it('should add a binding for an input and call a value change and expect a mocked object to have the reflected value', () => {
    const mockCallback = jest.fn();
    const mockObj = { name: 'John', age: 20 };
    const elm = document.createElement('input');
    elm.className = 'custom-class';
    div.appendChild(elm);

    service = new BindingService({ variable: mockObj, property: 'name' });
    service.bind(elm, 'value', 'change', mockCallback);
    elm.value = 'Jane';
    const mockEvent = new CustomEvent('change', { bubbles: true, detail: { target: { value: 'Jane' } } });
    elm.dispatchEvent(mockEvent);

    expect(service.property).toBe('name');
    expect(mockObj.name).toBe('Jane');
    expect(mockCallback).toHaveBeenCalled();
  });

  it('should return same input value when object property is not found', () => {
    const mockCallback = jest.fn();
    const mockObj = { name: 'John', age: 20 };
    const elm = document.createElement('input');
    elm.className = 'custom-class';
    div.appendChild(elm);

    service = new BindingService({ variable: mockObj, property: 'invalidProperty' });
    service.bind(elm, 'value', 'change', mockCallback);
    elm.value = 'Jane';
    const mockEvent = new CustomEvent('change', { bubbles: true, detail: { target: { value: 'Jane' } } });
    elm.dispatchEvent(mockEvent);

    expect(service.property).toBe('invalidProperty');
    expect(mockObj.name).toBe('John');
    expect(mockCallback).toHaveBeenCalled();
  });

  it('should add a binding for a mocked object and expect the value to be reflected in the element input value', () => {
    const mockCallback = jest.fn();
    const mockObj = { name: 'John', age: 20 };
    const elm = document.createElement('input');
    elm.className = 'custom-class';
    div.appendChild(elm);

    service = new BindingService({ variable: mockObj, property: 'name' });
    service.bind(elm, 'value', 'change', mockCallback);
    mockObj.name = 'Jane';

    expect(service.property).toBe('name');
    expect(elm.value).toBe('Jane');
  });

  it('should unbind an event from an element', () => {
    const mockElm = { addEventListener: jest.fn(), removeEventListener: jest.fn() } as unknown as HTMLElement;
    const mockCallback = jest.fn();
    const removeEventSpy = jest.spyOn(mockElm, 'removeEventListener');
    const mockObj = { name: 'John', age: 20 };
    const elm = document.createElement('input');
    div.appendChild(elm);

    service = new BindingService({ variable: mockObj, property: 'name' });
    service.bind(mockElm, 'value', 'keyup');
    service.unbind(mockElm, 'click', mockCallback, false, service.boundedEventWithListeners[0].uid);

    expect(service.property).toBe('name');
    expect(removeEventSpy).toHaveBeenCalledWith('click', mockCallback, false);
  });

  it('should call unbindAll and expect a single unbind element being called', () => {
    const mockElm = { addEventListener: jest.fn(), removeEventListener: jest.fn() } as unknown as HTMLElement;
    const removeEventSpy = jest.spyOn(mockElm, 'removeEventListener');
    const mockObj = { name: 'John', age: 20 };
    const elm = document.createElement('input');
    div.appendChild(elm);

    service = new BindingService({ variable: mockObj, property: 'name' });
    service.bind(mockElm, 'value', 'keyup');
    service.unbindAll();

    expect(service.property).toBe('name');
    expect(removeEventSpy).toHaveBeenCalledWith('keyup', expect.toBeFunction(), undefined);
  });
}


() => {
    div = document.createElement('div');
    document.body.appendChild(div);
  }


() => {
    div.remove();
    jest.clearAllMocks();
  }