() => {
    it(
      'should be possible to type a full word that has a perfect match',
      suppressConsoleLogs(async () => {
        renderTemplate({
          template: html`
            <Listbox v-model="value">
              <ListboxButton>Trigger</ListboxButton>
              <ListboxOptions>
                <ListboxOption value="alice">alice</ListboxOption>
                <ListboxOption value="bob">bob</ListboxOption>
                <ListboxOption value="charlie">charlie</ListboxOption>
              </ListboxOptions>
            </Listbox>
          `,
          setup: () => ({ value: ref(null) }),
        })

        // Open listbox
        await click(getListboxButton())

        let options = getListboxOptions()

        // We should be able to go to the second option
        await type(word('bob'))
        assertActiveListboxOption(options[1])

        // We should be able to go to the first option
        await type(word('alice'))
        assertActiveListboxOption(options[0])

        // We should be able to go to the last option
        await type(word('charlie'))
        assertActiveListboxOption(options[2])
      })
    )

    it(
      'should be possible to type a partial of a word',
      suppressConsoleLogs(async () => {
        renderTemplate({
          template: html`
            <Listbox v-model="value">
              <ListboxButton>Trigger</ListboxButton>
              <ListboxOptions>
                <ListboxOption value="alice">alice</ListboxOption>
                <ListboxOption value="bob">bob</ListboxOption>
                <ListboxOption value="charlie">charlie</ListboxOption>
              </ListboxOptions>
            </Listbox>
          `,
          setup: () => ({ value: ref(null) }),
        })

        // Focus the button
        getListboxButton()?.focus()

        // Open listbox
        await press(Keys.ArrowUp)

        let options = getListboxOptions()

        // We should be on the last option
        assertActiveListboxOption(options[2])

        // We should be able to go to the second option
        await type(word('bo'))
        assertActiveListboxOption(options[1])

        // We should be able to go to the first option
        await type(word('ali'))
        assertActiveListboxOption(options[0])

        // We should be able to go to the last option
        await type(word('char'))
        assertActiveListboxOption(options[2])
      })
    )

    it(
      'should be possible to type words with spaces',
      suppressConsoleLogs(async () => {
        renderTemplate({
          template: html`
            <Listbox v-model="value">
              <ListboxButton>Trigger</ListboxButton>
              <ListboxOptions>
                <ListboxOption value="a">value a</ListboxOption>
                <ListboxOption value="b">value b</ListboxOption>
                <ListboxOption value="c">value c</ListboxOption>
              </ListboxOptions>
            </Listbox>
          `,
          setup: () => ({ value: ref(null) }),
        })

        // Focus the button
        getListboxButton()?.focus()

        // Open listbox
        await press(Keys.ArrowUp)

        let options = getListboxOptions()

        // We should be on the last option
        assertActiveListboxOption(options[2])

        // We should be able to go to the second option
        await type(word('value b'))
        assertActiveListboxOption(options[1])

        // We should be able to go to the first option
        await type(word('value a'))
        assertActiveListboxOption(options[0])

        // We should be able to go to the last option
        await type(word('value c'))
        assertActiveListboxOption(options[2])
      })
    )

    it(
      'should not be possible to search for a disabled option',
      suppressConsoleLogs(async () => {
        renderTemplate({
          template: html`
            <Listbox v-model="value">
              <ListboxButton>Trigger</ListboxButton>
              <ListboxOptions>
                <ListboxOption value="alice">alice</ListboxOption>
                <ListboxOption disabled value="bob">
                  bob
                </ListboxOption>
                <ListboxOption value="charlie">charlie</ListboxOption>
              </ListboxOptions>
            </Listbox>
          `,
          setup: () => ({ value: ref(null) }),
        })

        // Focus the button
        getListboxButton()?.focus()

        // Open listbox
        await press(Keys.ArrowUp)

        let options = getListboxOptions()

        // We should be on the last option
        assertActiveListboxOption(options[2])

        // We should not be able to go to the disabled option
        await type(word('bo'))

        // We should still be on the last option
        assertActiveListboxOption(options[2])
      })
    )

    it(
      'should be possible to search for a word (case insensitive)',
      suppressConsoleLogs(async () => {
        renderTemplate({
          template: html`
            <Listbox v-model="value">
              <ListboxButton>Trigger</ListboxButton>
              <ListboxOptions>
                <ListboxOption value="alice">alice</ListboxOption>
                <ListboxOption value="bob">bob</ListboxOption>
                <ListboxOption value="charlie">charlie</ListboxOption>
              </ListboxOptions>
            </Listbox>
          `,
          setup: () => ({ value: ref(null) }),
        })

        // Focus the button
        getListboxButton()?.focus()

        // Open listbox
        await press(Keys.ArrowUp)

        let options = getListboxOptions()

        // We should be on the last option
        assertActiveListboxOption(options[2])

        // Search for bob in a different casing
        await type(word('BO'))

        // We should be on `bob`
        assertActiveListboxOption(options[1])
      })
    )
  }


async () => {
        renderTemplate({
          template: html`
            <Listbox v-model="value">
              <ListboxButton>Trigger</ListboxButton>
              <ListboxOptions>
                <ListboxOption value="alice">alice</ListboxOption>
                <ListboxOption value="bob">bob</ListboxOption>
                <ListboxOption value="charlie">charlie</ListboxOption>
              </ListboxOptions>
            </Listbox>
          `,
          setup: () => ({ value: ref(null) }),
        })

        // Open listbox
        await click(getListboxButton())

        let options = getListboxOptions()

        // We should be able to go to the second option
        await type(word('bob'))
        assertActiveListboxOption(options[1])

        // We should be able to go to the first option
        await type(word('alice'))
        assertActiveListboxOption(options[0])

        // We should be able to go to the last option
        await type(word('charlie'))
        assertActiveListboxOption(options[2])
      }


async () => {
        renderTemplate({
          template: html`
            <Listbox v-model="value">
              <ListboxButton>Trigger</ListboxButton>
              <ListboxOptions>
                <ListboxOption value="alice">alice</ListboxOption>
                <ListboxOption value="bob">bob</ListboxOption>
                <ListboxOption value="charlie">charlie</ListboxOption>
              </ListboxOptions>
            </Listbox>
          `,
          setup: () => ({ value: ref(null) }),
        })

        // Focus the button
        getListboxButton()?.focus()

        // Open listbox
        await press(Keys.ArrowUp)

        let options = getListboxOptions()

        // We should be on the last option
        assertActiveListboxOption(options[2])

        // We should be able to go to the second option
        await type(word('bo'))
        assertActiveListboxOption(options[1])

        // We should be able to go to the first option
        await type(word('ali'))
        assertActiveListboxOption(options[0])

        // We should be able to go to the last option
        await type(word('char'))
        assertActiveListboxOption(options[2])
      }


async () => {
        renderTemplate({
          template: html`
            <Listbox v-model="value">
              <ListboxButton>Trigger</ListboxButton>
              <ListboxOptions>
                <ListboxOption value="a">value a</ListboxOption>
                <ListboxOption value="b">value b</ListboxOption>
                <ListboxOption value="c">value c</ListboxOption>
              </ListboxOptions>
            </Listbox>
          `,
          setup: () => ({ value: ref(null) }),
        })

        // Focus the button
        getListboxButton()?.focus()

        // Open listbox
        await press(Keys.ArrowUp)

        let options = getListboxOptions()

        // We should be on the last option
        assertActiveListboxOption(options[2])

        // We should be able to go to the second option
        await type(word('value b'))
        assertActiveListboxOption(options[1])

        // We should be able to go to the first option
        await type(word('value a'))
        assertActiveListboxOption(options[0])

        // We should be able to go to the last option
        await type(word('value c'))
        assertActiveListboxOption(options[2])
      }


async () => {
        renderTemplate({
          template: html`
            <Listbox v-model="value">
              <ListboxButton>Trigger</ListboxButton>
              <ListboxOptions>
                <ListboxOption value="alice">alice</ListboxOption>
                <ListboxOption disabled value="bob">
                  bob
                </ListboxOption>
                <ListboxOption value="charlie">charlie</ListboxOption>
              </ListboxOptions>
            </Listbox>
          `,
          setup: () => ({ value: ref(null) }),
        })

        // Focus the button
        getListboxButton()?.focus()

        // Open listbox
        await press(Keys.ArrowUp)

        let options = getListboxOptions()

        // We should be on the last option
        assertActiveListboxOption(options[2])

        // We should not be able to go to the disabled option
        await type(word('bo'))

        // We should still be on the last option
        assertActiveListboxOption(options[2])
      }


async () => {
        renderTemplate({
          template: html`
            <Listbox v-model="value">
              <ListboxButton>Trigger</ListboxButton>
              <ListboxOptions>
                <ListboxOption value="alice">alice</ListboxOption>
                <ListboxOption value="bob">bob</ListboxOption>
                <ListboxOption value="charlie">charlie</ListboxOption>
              </ListboxOptions>
            </Listbox>
          `,
          setup: () => ({ value: ref(null) }),
        })

        // Focus the button
        getListboxButton()?.focus()

        // Open listbox
        await press(Keys.ArrowUp)

        let options = getListboxOptions()

        // We should be on the last option
        assertActiveListboxOption(options[2])

        // Search for bob in a different casing
        await type(word('BO'))

        // We should be on `bob`
        assertActiveListboxOption(options[1])
      }


async () => {
      renderTemplate({
        template: html`
          <Listbox v-model="value">
            <ListboxLabel>Label</ListboxLabel>
            <ListboxButton>Trigger</ListboxButton>
            <ListboxOptions>
              <ListboxOption value="a">Option A</ListboxOption>
              <ListboxOption value="b">Option B</ListboxOption>
              <ListboxOption value="c">Option C</ListboxOption>
            </ListboxOptions>
          </Listbox>
        `,
        setup: () => ({ value: ref(null) }),
      })

      // Ensure the button is not focused yet
      assertActiveElement(document.body)

      // Focus the label
      await click(getListboxLabel())

      // Ensure that the actual button is focused instead
      assertActiveElement(getListboxButton())
    }


async () => {
      renderTemplate({
        template: html`
          <Listbox v-model="value">
            <ListboxLabel>Label</ListboxLabel>
            <ListboxButton>Trigger</ListboxButton>
            <ListboxOptions>
              <ListboxOption value="a">Option A</ListboxOption>
              <ListboxOption value="b">Option B</ListboxOption>
              <ListboxOption value="c">Option C</ListboxOption>
            </ListboxOptions>
          </Listbox>
        `,
        setup: () => ({ value: ref(null) }),
      })

      // Ensure the button is not focused yet
      assertActiveElement(document.body)

      // Focus the label
      await click(getListboxLabel(), MouseButton.Right)

      // Ensure that the body is still active
      assertActiveElement(document.body)
    }


async () => {
      renderTemplate({
        template: html`
          <Listbox v-model="value">
            <ListboxButton>Trigger</ListboxButton>
            <ListboxOptions>
              <ListboxOption value="a">Option A</ListboxOption>
              <ListboxOption value="b">Option B</ListboxOption>
              <ListboxOption value="c">Option C</ListboxOption>
            </ListboxOptions>
          </Listbox>
        `,
        setup: () => ({ value: ref(null) }),
      })

      assertListboxButton({
        state: ListboxState.InvisibleUnmounted,
        attributes: { id: 'headlessui-listbox-button-1' },
      })
      assertListbox({ state: ListboxState.InvisibleUnmounted })

      // Open listbox
      await click(getListboxButton())

      // Verify it is open
      assertListboxButton({ state: ListboxState.Visible })
      assertListbox({
        state: ListboxState.Visible,
        attributes: { id: 'headlessui-listbox-options-2' },
      })
      assertActiveElement(getListbox())
      assertListboxButtonLinkedWithListbox()

      // Verify we have listbox options
      let options = getListboxOptions()
      expect(options).toHaveLength(3)
      options.forEach(option => assertListboxOption(option))
    }


async () => {
      renderTemplate({
        template: html`
          <Listbox v-model="value">
            <ListboxButton>Trigger</ListboxButton>
            <ListboxOptions>
              <ListboxOption value="a">Option A</ListboxOption>
              <ListboxOption value="b">Option B</ListboxOption>
              <ListboxOption value="c">Option C</ListboxOption>
            </ListboxOptions>
          </Listbox>
        `,
        setup: () => ({ value: ref(null) }),
      })

      assertListboxButton({
        state: ListboxState.InvisibleUnmounted,
        attributes: { id: 'headlessui-listbox-button-1' },
      })
      assertListbox({ state: ListboxState.InvisibleUnmounted })

      // Try to open the menu
      await click(getListboxButton(), MouseButton.Right)

      // Verify it is still closed
      assertListboxButton({ state: ListboxState.InvisibleUnmounted })
    }


async () => {
      renderTemplate({
        template: html`
          <Listbox v-model="value" disabled>
            <ListboxButton>Trigger</ListboxButton>
            <ListboxOptions>
              <ListboxOption value="a">Option A</ListboxOption>
              <ListboxOption value="b">Option B</ListboxOption>
              <ListboxOption value="c">Option C</ListboxOption>
            </ListboxOptions>
          </Listbox>
        `,
        setup: () => ({ value: ref(null) }),
      })

      assertListboxButton({
        state: ListboxState.InvisibleUnmounted,
        attributes: { id: 'headlessui-listbox-button-1' },
      })
      assertListbox({ state: ListboxState.InvisibleUnmounted })

      // Try to open the listbox
      await click(getListboxButton())

      // Verify it is still closed
      assertListboxButton({
        state: ListboxState.InvisibleUnmounted,
        attributes: { id: 'headlessui-listbox-button-1' },
      })
      assertListbox({ state: ListboxState.InvisibleUnmounted })
    }


async () => {
      renderTemplate({
        template: html`
          <Listbox v-model="value">
            <ListboxButton>Trigger</ListboxButton>
            <ListboxOptions>
              <ListboxOption value="a">Option A</ListboxOption>
              <ListboxOption value="b">Option B</ListboxOption>
              <ListboxOption value="c">Option C</ListboxOption>
            </ListboxOptions>
          </Listbox>
        `,
        setup: () => ({ value: ref('b') }),
      })

      assertListboxButton({
        state: ListboxState.InvisibleUnmounted,
        attributes: { id: 'headlessui-listbox-button-1' },
      })
      assertListbox({ state: ListboxState.InvisibleUnmounted })

      // Open listbox
      await click(getListboxButton())

      // Verify it is open
      assertListboxButton({ state: ListboxState.Visible })
      assertListbox({
        state: ListboxState.Visible,
        attributes: { id: 'headlessui-listbox-options-2' },
      })
      assertActiveElement(getListbox())
      assertListboxButtonLinkedWithListbox()

      // Verify we have listbox options
      let options = getListboxOptions()
      expect(options).toHaveLength(3)
      options.forEach((option, i) => assertListboxOption(option, { selected: i === 1 }))

      // Verify that the second listbox option is active (because it is already selected)
      assertActiveListboxOption(options[1])
    }


async () => {
      renderTemplate({
        template: html`
          <Listbox v-model="value">
            <ListboxButton>Trigger</ListboxButton>
            <ListboxOptions>
              <ListboxOption value="a">Option A</ListboxOption>
              <ListboxOption value="b">Option B</ListboxOption>
              <ListboxOption value="c">Option C</ListboxOption>
            </ListboxOptions>
          </Listbox>
        `,
        setup: () => ({ value: ref(null) }),
      })

      // Open listbox
      await click(getListboxButton())

      // Verify it is open
      assertListboxButton({ state: ListboxState.Visible })

      // Click to close
      await click(getListboxButton())

      // Verify it is closed
      assertListboxButton({ state: ListboxState.InvisibleUnmounted })
      assertListbox({ state: ListboxState.InvisibleUnmounted })
    }


async () => {
      renderTemplate({
        template: html`
          <Listbox v-model="value">
            <ListboxButton>Trigger</ListboxButton>
            <ListboxOptions>
              <ListboxOption value="alice">alice</ListboxOption>
              <ListboxOption value="bob">bob</ListboxOption>
              <ListboxOption value="charlie">charlie</ListboxOption>
            </ListboxOptions>
          </Listbox>
        `,
        setup: () => ({ value: ref(null) }),
      })

      // Verify that the window is closed
      assertListbox({ state: ListboxState.InvisibleUnmounted })

      // Click something that is not related to the listbox
      await click(document.body)

      // Should still be closed
      assertListbox({ state: ListboxState.InvisibleUnmounted })
    }


async () => {
      renderTemplate({
        template: html`
          <Listbox v-model="value">
            <ListboxButton>Trigger</ListboxButton>
            <ListboxOptions>
              <ListboxOption value="alice">alice</ListboxOption>
              <ListboxOption value="bob">bob</ListboxOption>
              <ListboxOption value="charlie">charlie</ListboxOption>
            </ListboxOptions>
          </Listbox>
        `,
        setup: () => ({ value: ref(null) }),
      })

      // Open listbox
      await click(getListboxButton())
      assertListbox({ state: ListboxState.Visible })
      assertActiveElement(getListbox())

      // Click something that is not related to the listbox
      await click(document.body)

      // Should be closed now
      assertListbox({ state: ListboxState.InvisibleUnmounted })

      // Verify the button is focused again
      assertActiveElement(getListboxButton())
    }


async () => {
      renderTemplate({
        template: html`
          <div>
            <Listbox v-model="value">
              <ListboxButton>Trigger</ListboxButton>
              <ListboxOptions>
                <ListboxOption value="alice">alice</ListboxOption>
                <ListboxOption value="bob">bob</ListboxOption>
                <ListboxOption value="charlie">charlie</ListboxOption>
              </ListboxOptions>
            </Listbox>

            <Listbox v-model="value">
              <ListboxButton>Trigger</ListboxButton>
              <ListboxOptions>
                <ListboxOption value="alice">alice</ListboxOption>
                <ListboxOption value="bob">bob</ListboxOption>
                <ListboxOption value="charlie">charlie</ListboxOption>
              </ListboxOptions>
            </Listbox>
          </div>
        `,
        setup: () => ({ value: ref(null) }),
      })

      let [button1, button2] = getListboxButtons()

      // Click the first menu button
      await click(button1)
      expect(getListboxes()).toHaveLength(1) // Only 1 menu should be visible

      // Ensure the open menu is linked to the first button
      assertListboxButtonLinkedWithListbox(button1, getListbox())

      // Click the second menu button
      await click(button2)

      expect(getListboxes()).toHaveLength(1) // Only 1 menu should be visible

      // Ensure the open menu is linked to the second button
      assertListboxButtonLinkedWithListbox(button2, getListbox())
    }


async () => {
      renderTemplate({
        template: html`
          <Listbox v-model="value">
            <ListboxButton>Trigger</ListboxButton>
            <ListboxOptions>
              <ListboxOption value="alice">alice</ListboxOption>
              <ListboxOption value="bob">bob</ListboxOption>
              <ListboxOption value="charlie">charlie</ListboxOption>
            </ListboxOptions>
          </Listbox>
        `,
        setup: () => ({ value: ref(null) }),
      })

      // Open listbox
      await click(getListboxButton())
      assertListbox({ state: ListboxState.Visible })
      assertActiveElement(getListbox())

      // Click the listbox button again
      await click(getListboxButton())

      // Should be closed now
      assertListbox({ state: ListboxState.InvisibleUnmounted })

      // Verify the button is focused again
      assertActiveElement(getListboxButton())
    }


async () => {
      renderTemplate({
        template: html`
          <Listbox v-model="value">
            <ListboxButton>Trigger</ListboxButton>
            <ListboxOptions>
              <ListboxOption value="alice">alice</ListboxOption>
              <ListboxOption value="bob">bob</ListboxOption>
              <ListboxOption value="charlie">charlie</ListboxOption>
            </ListboxOptions>
          </Listbox>
        `,
        setup: () => ({ value: ref(null) }),
      })

      // Open listbox
      await click(getListboxButton())

      let options = getListboxOptions()
      // We should be able to go to the second option
      await mouseMove(options[1])
      assertActiveListboxOption(options[1])

      // We should be able to go to the first option
      await mouseMove(options[0])
      assertActiveListboxOption(options[0])

      // We should be able to go to the last option
      await mouseMove(options[2])
      assertActiveListboxOption(options[2])
    }


async () => {
      renderTemplate({
        template: html`
          <Listbox v-model="value">
            <ListboxButton>Trigger</ListboxButton>
            <ListboxOptions>
              <ListboxOption value="alice">alice</ListboxOption>
              <ListboxOption value="bob">bob</ListboxOption>
              <ListboxOption value="charlie">charlie</ListboxOption>
            </ListboxOptions>
          </Listbox>
        `,
        setup: () => ({ value: ref(null) }),
      })

      // Open listbox
      await click(getListboxButton())

      let options = getListboxOptions()
      // We should be able to go to the second option
      await mouseMove(options[1])
      assertActiveListboxOption(options[1])
    }


async () => {
      renderTemplate({
        template: html`
          <Listbox v-model="value">
            <ListboxButton>Trigger</ListboxButton>
            <ListboxOptions>
              <ListboxOption value="alice">alice</ListboxOption>
              <ListboxOption value="bob">bob</ListboxOption>
              <ListboxOption value="charlie">charlie</ListboxOption>
            </ListboxOptions>
          </Listbox>
        `,
        setup: () => ({ value: ref(null) }),
      })

      // Open listbox
      await click(getListboxButton())

      let options = getListboxOptions()

      // We should be able to go to the second option
      await mouseMove(options[1])
      assertActiveListboxOption(options[1])

      await mouseMove(options[1])

      // Nothing should be changed
      assertActiveListboxOption(options[1])
    }


async () => {
      renderTemplate({
        template: html`
          <Listbox v-model="value">
            <ListboxButton>Trigger</ListboxButton>
            <ListboxOptions>
              <ListboxOption value="alice">alice</ListboxOption>
              <ListboxOption disabled value="bob">
                bob
              </ListboxOption>
              <ListboxOption value="charlie">charlie</ListboxOption>
            </ListboxOptions>
          </Listbox>
        `,
        setup: () => ({ value: ref(null) }),
      })

      // Open listbox
      await click(getListboxButton())

      let options = getListboxOptions()

      await mouseMove(options[1])
      assertNoActiveListboxOption()
    }


async () => {
      renderTemplate({
        template: html`
          <Listbox v-model="value">
            <ListboxButton>Trigger</ListboxButton>
            <ListboxOptions>
              <ListboxOption value="alice">alice</ListboxOption>
              <ListboxOption disabled value="bob">
                bob
              </ListboxOption>
              <ListboxOption value="charlie">charlie</ListboxOption>
            </ListboxOptions>
          </Listbox>
        `,
        setup: () => ({ value: ref(null) }),
      })

      // Open listbox
      await click(getListboxButton())

      let options = getListboxOptions()

      // Try to hover over option 1, which is disabled
      await mouseMove(options[1])

      // We should not have an active option now
      assertNoActiveListboxOption()
    }


async () => {
      renderTemplate({
        template: html`
          <Listbox v-model="value">
            <ListboxButton>Trigger</ListboxButton>
            <ListboxOptions>
              <ListboxOption value="alice">alice</ListboxOption>
              <ListboxOption value="bob">bob</ListboxOption>
              <ListboxOption value="charlie">charlie</ListboxOption>
            </ListboxOptions>
          </Listbox>
        `,
        setup: () => ({ value: ref(null) }),
      })

      // Open listbox
      await click(getListboxButton())

      let options = getListboxOptions()

      // We should be able to go to the second option
      await mouseMove(options[1])
      assertActiveListboxOption(options[1])

      await mouseLeave(options[1])
      assertNoActiveListboxOption()

      // We should be able to go to the first option
      await mouseMove(options[0])
      assertActiveListboxOption(options[0])

      await mouseLeave(options[0])
      assertNoActiveListboxOption()

      // We should be able to go to the last option
      await mouseMove(options[2])
      assertActiveListboxOption(options[2])

      await mouseLeave(options[2])
      assertNoActiveListboxOption()
    }


async () => {
      renderTemplate({
        template: html`
          <Listbox v-model="value">
            <ListboxButton>Trigger</ListboxButton>
            <ListboxOptions>
              <ListboxOption value="alice">alice</ListboxOption>
              <ListboxOption disabled value="bob">
                bob
              </ListboxOption>
              <ListboxOption value="charlie">charlie</ListboxOption>
            </ListboxOptions>
          </Listbox>
        `,
        setup: () => ({ value: ref(null) }),
      })

      // Open listbox
      await click(getListboxButton())

      let options = getListboxOptions()

      // Try to hover over option 1, which is disabled
      await mouseMove(options[1])
      assertNoActiveListboxOption()

      await mouseLeave(options[1])
      assertNoActiveListboxOption()
    }


async () => {
      let handleChange = jest.fn()
      renderTemplate({
        template: html`
          <Listbox v-model="value">
            <ListboxButton>Trigger</ListboxButton>
            <ListboxOptions>
              <ListboxOption value="alice">alice</ListboxOption>
              <ListboxOption value="bob">bob</ListboxOption>
              <ListboxOption value="charlie">charlie</ListboxOption>
            </ListboxOptions>
          </Listbox>
        `,
        setup() {
          let value = ref(null)
          watch([value], () => handleChange(value.value))
          return { value }
        },
      })

      // Open listbox
      await click(getListboxButton())
      assertListbox({ state: ListboxState.Visible })
      assertActiveElement(getListbox())

      let options = getListboxOptions()

      // We should be able to click the first option
      await click(options[1])
      assertListbox({ state: ListboxState.InvisibleUnmounted })
      expect(handleChange).toHaveBeenCalledTimes(1)
      expect(handleChange).toHaveBeenCalledWith('bob')

      // Verify the button is focused again
      assertActiveElement(getListboxButton())

      // Open listbox again
      await click(getListboxButton())

      // Verify the active option is the previously selected one
      assertActiveListboxOption(getListboxOptions()[1])
    }


async () => {
      let handleChange = jest.fn()
      renderTemplate({
        template: html`
          <Listbox v-model="value">
            <ListboxButton>Trigger</ListboxButton>
            <ListboxOptions>
              <ListboxOption value="alice">alice</ListboxOption>
              <ListboxOption disabled value="bob">
                bob
              </ListboxOption>
              <ListboxOption value="charlie">charlie</ListboxOption>
            </ListboxOptions>
          </Listbox>
        `,
        setup() {
          let value = ref(null)
          watch([value], () => handleChange(value.value))
          return { value }
        },
      })

      // Open listbox
      await click(getListboxButton())
      assertListbox({ state: ListboxState.Visible })
      assertActiveElement(getListbox())

      let options = getListboxOptions()

      // We should be able to click the first option
      await click(options[1])
      assertListbox({ state: ListboxState.Visible })
      assertActiveElement(getListbox())
      expect(handleChange).toHaveBeenCalledTimes(0)

      // Close the listbox
      await click(getListboxButton())

      // Open listbox again
      await click(getListboxButton())

      // Verify the active option is non existing
      assertNoActiveListboxOption()
    }


async () => {
      renderTemplate({
        template: html`
          <Listbox v-model="value">
            <ListboxButton>Trigger</ListboxButton>
            <ListboxOptions>
              <ListboxOption value="alice">alice</ListboxOption>
              <ListboxOption value="bob">bob</ListboxOption>
              <ListboxOption value="charlie">charlie</ListboxOption>
            </ListboxOptions>
          </Listbox>
        `,
        setup: () => ({ value: ref(null) }),
      })

      // Open listbox
      await click(getListboxButton())
      assertListbox({ state: ListboxState.Visible })
      assertActiveElement(getListbox())

      let options = getListboxOptions()

      // Verify that nothing is active yet
      assertNoActiveListboxOption()

      // We should be able to focus the first option
      await focus(options[1])
      assertActiveListboxOption(options[1])
    }


async () => {
      renderTemplate({
        template: html`
          <Listbox v-model="value">
            <ListboxButton>Trigger</ListboxButton>
            <ListboxOptions>
              <ListboxOption value="alice">alice</ListboxOption>
              <ListboxOption disabled value="bob">
                bob
              </ListboxOption>
              <ListboxOption value="charlie">charlie</ListboxOption>
            </ListboxOptions>
          </Listbox>
        `,
        setup: () => ({ value: ref(null) }),
      })

      // Open listbox
      await click(getListboxButton())
      assertListbox({ state: ListboxState.Visible })
      assertActiveElement(getListbox())

      let options = getListboxOptions()

      // We should not be able to focus the first option
      await focus(options[1])
      assertNoActiveListboxOption()
    }


setup(props, { slots }) {
      useOpenClosedProvider(ref(props.open ? State.Open : State.Closed))
      return () => slots.default?.()
    }


setup(_, { slots, emit }) {
      let state = useOpenClosed()
      watch([state], ([value]) => emit('read', value))
      return () => slots.default?.()
    }


setup() {
          return { value: ref(null), readFn }
        }


setup() {
            let value = ref(null)
            watch([value], () => handleChange(value.value))
            return { value }
          }


setup() {
          let value = ref(null)
          watch([value], () => handleChange(value.value))
          return { value }
        }


function prepareRequestOptions(resource: string, clientId?: string): PipelineRequestOptions {
  const body: any = {
    resource
  };

  if (clientId) {
    body.client_id = clientId;
  }

  // This error should not bubble up, since we verify that this environment variable is defined in the isAvailable() method defined below.
  if (!process.env.MSI_ENDPOINT) {
    throw new Error("Missing environment variable: MSI_ENDPOINT");
  }

  return {
    url: process.env.MSI_ENDPOINT,
    method: "POST",
    body: qs.stringify(body),
    headers: createHttpHeaders({
      Accept: "application/json",
      Metadata: "true",
      "Content-Type": "application/x-www-form-urlencoded"
    })
  };
}


async isAvailable(): Promise<boolean> {
    const result = Boolean(process.env.MSI_ENDPOINT);
    if (!result) {
      logger.info("The Azure Cloud Shell MSI is unavailable.");
    }
    return result;
  }


async getToken(
    identityClient: IdentityClient,
    resource: string,
    clientId?: string,
    getTokenOptions: GetTokenOptions = {}
  ): Promise<AccessToken | null> {
    logger.info(
      `Using the endpoint coming form the environment variable MSI_ENDPOINT=${process.env.MSI_ENDPOINT}, and using the Cloud Shell to proceed with the authentication.`
    );

    return msiGenericGetToken(
      identityClient,
      prepareRequestOptions(resource, clientId),
      expiresInParser,
      getTokenOptions
    );
  }


export default function SettingsItem(props: SettingsItemProps) {
  return (
    <ClickableBox
      onClick={props.onClick}
      style={Styles.collapseStyles([
        styles.item,
        props.selected
          ? {
              borderLeftColor: Styles.globalColors.blue,
              borderLeftStyle: 'solid',
              borderLeftWidth: 3,
            }
          : {},
      ])}
    >
      {props.icon && (
        <Icon
          type={props.icon}
          color={Styles.globalColors.black_20}
          style={{marginRight: Styles.isMobile ? Styles.globalMargins.small : Styles.globalMargins.tiny}}


type SettingsItemProps = {
  badgeNumber?: number
  icon?: IconType
  inProgress?: boolean
  largerBadgeMinWidthFix?: boolean
  onClick: () => void
  text: string
  textColor?: Styles.Color
  selected?: boolean
}


@Component({
  selector: 'app-formulario',
  templateUrl: './formulario.component.html',
  styleUrls: ['./formulario.component.css']
})
export class FormularioComponent implements OnInit {
  public nombre: string;
  public idea: string;
  public aIdea: Array<string>;

  constructor() { }

  aniadir(){
    this.aIdea.push(this.idea);
  }

  aniadir2(elemento: string){
    this.aIdea.push(elemento);
  }

  ngOnInit() {
    this.aIdea=[];
  }

}


aniadir(){
    this.aIdea.push(this.idea);
  }


aniadir2(elemento: string){
    this.aIdea.push(elemento);
  }


ngOnInit() {
    this.aIdea=[];
  }


export function showJwtInputDialog(data?: any): Promise<JwtInputResult> {
  const url = getDialogUrl(JwtInputDialogUrl);
  return showDialog<JwtInputResult>(url, { height: 38, width: 35 }, data);
}


export function showPrimaryKeyDialog(data?: any): Promise<PrimaryKeyInputResult> {
  const url = getDialogUrl(PrimaryKeyDialogUrl);
  return showPKDialog<PrimaryKeyInputResult>(url, { height: 38, width: 35 }, data);
}


function getDialogUrl(dialogPage: string): string {
  const currentPage = getCurrentPage();
  const url = window.location.href.replace(currentPage, dialogPage);
  return removeSearchPart(url);
}


function removeSearchPart(url: string) {
  return url.substr(0, url.length - window.location.search.length);
}


function getCurrentPage(): string {
  return window.location.pathname.substr(window.location.pathname.lastIndexOf("/") + 1);
}


async (region: string, options?: any) =>
  getRegionInfo(region, {
    ...options,
    signingService: "aws-marketplace",
    regionHash,
    partitionHash,
  })


/**
 * If the user's security policy overrides normal type checking for this
 * attribute binding, returns a (possibly empty) array of diagnostics.
 *
 * If the security policy does not apply to this binding, then
 */
export function isAssignableBindingUnderSecuritySystem(
	htmlAttr: HtmlNodeAttr,
	{ typeA, typeB }: { typeA: SimpleType; typeB: SimpleType },
	context: RuleModuleContext
): boolean | undefined {
	const securityPolicy = context.config.securitySystem;
	switch (securityPolicy) {
		case "off":
			return undefined; // No security checks apply.
		case "ClosureSafeTypes":
			return checkClosureSecurityAssignability(typeB, htmlAttr, context);
		default: {
			const never: never = securityPolicy;
			context.logger.error(`Unexpected security policy: ${never}`);
			return undefined;
		}
	}
}


function checkClosureSecurityAssignability(typeB: SimpleType, htmlAttr: HtmlNodeAttr, context: RuleModuleContext): boolean | undefined {
	const scopedOverride = closureScopedOverrides[htmlAttr.htmlNode.tagName];
	const overriddenTypes = (scopedOverride && scopedOverride[htmlAttr.name]) || closureGlobalOverrides[htmlAttr.name];
	if (overriddenTypes === undefined) {
		return undefined;
	}
	// Directives are responsible for their own security.
	if (isLitDirective(typeB)) {
		return undefined;
	}

	const typeMatch = matchesAtLeastOneNominalType(overriddenTypes, typeB);
	if (typeMatch === false) {
		/*const nominalType: SimpleType = {
			kind: SimpleTypeKind.INTERFACE,
			members: [],
			name: "A security type"
		};*/

		context.report({
			location: rangeFromHtmlNodeAttr(htmlAttr),
			message: `Type '${typeToString(typeB)}' is not assignable to '${overriddenTypes.join(" | ")}'. This is due to Closure Safe Type enforcement.`
		});
		return false;
	}

	return true;
}


function normalizeTypeName(typeName: string) {
	// Attempt to take a clutz type name for a goog.module type, which looks like
	// module$contents$goog$html$SafeUrl_SafeUrl and extract the
	// actual type name (SafeUrl in that case)
	const match = typeName.match(/module\$.*_(.*)/);
	if (match == null) {
		return undefined;
	}
	return match[1];
}


function matchesAtLeastOneNominalType(typeNames: string[], typeB: SimpleType): boolean {
	// Check if typeB.name is in typeNames, either before or after normalization.
	const typeBName = typeB.name;
	if (typeBName !== undefined) {
		if (typeNames.includes(typeBName)) {
			return true;
		}
		const normalized = normalizeTypeName(typeBName);
		if (normalized !== undefined && typeNames.includes(typeBName)) {
			return true;
		}
	}
	// Otherwise, check for other cases beyond just a simple named type.
	switch (typeB.kind) {
		case "UNION":
			return typeB.types.every(t => matchesAtLeastOneNominalType(typeNames, t));
		case "STRING_LITERAL":
		case "STRING":
			return typeNames.includes("string");
		case "GENERIC_ARGUMENTS":
			return matchesAtLeastOneNominalType(typeNames, typeB.target);
		default:
			return false;
	}
}


t => matchesAtLeastOneNominalType(typeNames, t)


interface TagNameToSecurityOverrideMap {
	[tagName: string]: SecurityOverrideMap | undefined;
}


// A map from attribute/property names to an array of type names.
// Assignments to the given attribute must match one of the given types.
interface SecurityOverrideMap {
	[attributeName: string]: string[] | undefined;
}


(r: RepositoryEntry) => {
    if (r.commitId) {
        return r.commitId;
    }
    return r.branch || 'master';
}


(orgName: ConcordKey, projectName: ConcordKey, row: RepositoryEntry) => {
    return (
        <Table.Row key={row.id}>
            <Table.Cell>
                <Popup
                    trigger={
                        <Icon
                            name={row.disabled ? 'power off' : 'power'}
                            color={row.disabled ? 'grey' : 'green'}
                        />
                    }>
                    {row.disabled ? 'Disabled' : 'Enabled'}
                </Popup>
            </Table.Cell>
            <Table.Cell singleLine={true}>
                <Link to={`/org/${orgName}/project/${projectName}/repository/${row.name}`}>
                    {row.name}
                </Link>
            </Table.Cell>
            <Table.Cell>
                <GitHubLink url={row.url} text={row.url} />
            </Table.Cell>
            <Table.Cell>{getSource(row)}</Table.Cell>
            <Table.Cell>{row.path || '/'}</Table.Cell>
            <Table.Cell>{row.secretName}</Table.Cell>
            <Table.Cell>
                <RepositoryActionDropdown orgName={orgName} projectName={projectName} repo={row} />
            </Table.Cell>
        </Table.Row>


(r) => renderTableRow(orgName, projectName, r)


class RepositoryList extends React.PureComponent<Props> {
    render() {
        const { data, orgName, projectName } = this.props;

        if (data.length === 0) {
            return
No repositories found.
;
        }

        return (

Name

Repository URL

Branch/Commit ID

Path

Secret

{data.map((r) => renderTableRow(orgName, projectName, r))}

        );
    }
}


interface Props {
    orgName: ConcordKey;
    projectName: ConcordKey;
    data: RepositoryEntry[];
}


getSource(row)


render() {
        const { data, orgName, projectName } = this.props;

        if (data.length === 0) {
            return
No repositories found.
;
        }

        return (

Name

Repository URL

Branch/Commit ID

Path

Secret

{data.map((r) => renderTableRow(orgName, projectName, r))}

        );
    }


export interface GlobalComponents {
    Footer: typeof import('./src\components\Footer.vue')['default']
    README: typeof import('./src\components\README.md')['default']
  }


() => {
  test('getByTestId', () => {
    const App = () => (
        <>
          <View testID="a">hello, world!</View>
        </>
      );
    const wrapper = render(<App />);
    const view = wrapper.getByTestId('a');
    expect(view).toBeTruthy();
    expect(view.props.children).toBe('hello, world!');
    expect(() => wrapper.getByTestId('z')).toThrow();
  }


() => {
    const App = () => (
        <>
          <View testID="a">hello, world!</View>
        </>


() => (
        <>
          <View testID="a">hello


() => wrapper.getByTestId('z')


(predvolené: lokalizácia systému)


(predvolené: 15714 alebo testovaciasieť: 25714)


(predvolené: 15715 alebo testovaciasieť: 25715)


@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class ChartDonutRoutingModule { }


(source, options) => {
      let factory = createTemplate(source);
      let template = factory.create(options);
      let builder = template.asWrappedLayout();
      return {
        handle: builder.compile(),
        symbolTable: builder.symbolTable
      };
    }


export class EmberishCurlyComponent extends GlimmerObject {
  public static positionalParams: string[] | string = [];

  public dirtinessTag: TagWrapper<DirtyableTag> = DirtyableTag.create();
  public layout: { name: string, handle: number };
  public name: string;
  public tagName: Option<string> = null;
  public attributeBindings: Option<string[]> = null;
  public attrs: Attrs;
  public element: Element;
  public bounds: Bounds;
  public parentView: Option<EmberishCurlyComponent> = null;
  public args: CapturedNamedArguments;

  static create(args: { attrs: Attrs }): EmberishCurlyComponent {
    return super.create(args) as EmberishCurlyComponent;
  }

  recompute() {
    this.dirtinessTag.inner.dirty();
  }

  didInitAttrs(_options: { attrs: Attrs }) { }
  didUpdateAttrs(_diff: AttrsDiff) { }
  didReceiveAttrs(_diff: AttrsDiff) { }
  willInsertElement() { }
  willUpdate() { }
  willRender() { }
  didInsertElement() { }
  didUpdate() { }
  didRender() { }
}


export class EmberishCurlyComponentManager implements
  WithDynamicTagName<EmberishCurlyComponent>,
  WithDynamicLayout<EmberishCurlyComponent, TemplateMeta, LazyRuntimeResolver> {

  getCapabilities(state: TestComponentDefinitionState) {
    return state.capabilities;
  }

  getLayout(state: EmberishCurlyComponentDefinitionState, resolver: EagerRuntimeResolver): Invocation {
    let handle = resolver.getVMHandle(expect(state.locator, 'expected locator'));
    return {
      handle,
      symbolTable: state.symbolTable! as ProgramSymbolTable
    };
  }

  getDynamicLayout({ layout }: EmberishCurlyComponent, resolver: LazyRuntimeResolver): Invocation {
    if (!layout) {
      throw new Error('BUG: missing dynamic layout');
    }

    let handle = resolver.lookup('template-source', layout.name);

    if (!handle) {
      throw new Error('BUG: missing dynamic layout');
    }

    return resolver.compileTemplate(handle, layout.name, (source, options) => {
      let factory = createTemplate(source);
      let template = factory.create(options);
      let builder = template.asWrappedLayout();
      return {
        handle: builder.compile(),
        symbolTable: builder.symbolTable
      };
    });
  }

  prepareArgs(state: EmberishCurlyComponentDefinitionState, args: Arguments): Option<PreparedArguments> {
    const { positionalParams } = state.ComponentClass || BaseEmberishCurlyComponent;

    if (typeof positionalParams === 'string') {
      if (args.named.has(positionalParams)) {
        if (args.positional.length === 0) {
          return null;
        } else {
          throw new Error(`You cannot specify positional parameters and the hash argument \`${positionalParams}\`.`);
        }
      }

      let named = Object.assign({}, args.named.capture().map);
      named[positionalParams] = args.positional.capture();

      return { positional: EMPTY_ARRAY, named };
    } else if (Array.isArray(positionalParams)) {
      let named = Object.assign({}, args.named.capture().map);
      let count = Math.min(positionalParams.length, args.positional.length);

      for (let i=0; i<count; i++) {
        let name = positionalParams[i];

        if (named[name]) {
          throw new Error(`You cannot specify both a positional param (at position ${i}) and the hash argument \`${name}\`.`);
        }

        named[name] = args.positional.at(i);
      }

      return { positional: EMPTY_ARRAY, named };
    } else {
      return null;
    }
  }

  create(_environment: Environment, state: EmberishCurlyComponentDefinitionState, _args: Arguments, dynamicScope: DynamicScope, callerSelf: PathReference<Opaque>, hasDefaultBlock: boolean): EmberishCurlyComponent {
    let klass = state.ComponentClass || BaseEmberishCurlyComponent;
    let self = callerSelf.value();
    let args = _args.named.capture();
    let attrs = args.value();
    let merged = assign({}, attrs, { attrs }, { args }, { targetObject: self }, { HAS_BLOCK: hasDefaultBlock });
    let component = klass.create(merged);

    component.name = state.name;
    component.args = args;

    if (state.layout) {
      component.layout = { name: component.name, handle: state.layout };
    }

    let dyn: Option<string[]> = state.ComponentClass ? state.ComponentClass['fromDynamicScope'] : null;

    if (dyn) {
      for (let i = 0; i < dyn.length; i++) {
        let name = dyn[i];
        component.set(name, dynamicScope.get(name).value());
      }
    }

    component.didInitAttrs({ attrs });
    component.didReceiveAttrs({ oldAttrs: null, newAttrs: attrs });
    component.willInsertElement();
    component.willRender();

    return component;
  }

  getTag({ args: { tag }, dirtinessTag }: EmberishCurlyComponent): Tag {
    return combine([tag, dirtinessTag]);
  }

  getSelf(component: EmberishCurlyComponent): PathReference<Opaque> {
    return new UpdatableReference(component);
  }

  getTagName({ tagName }: EmberishCurlyComponent): Option<string> {
    if (tagName) {
      return tagName;
    } else if (tagName === null) {
      return 'div';
    } else {
      return null;
    }
  }

  didCreateElement(component: EmberishCurlyComponent, element: Element, operations: ElementOperations): void {
    component.element = element;

    operations.setAttribute('id', PrimitiveReference.create(`ember${component._guid}`), false, null);
    operations.setAttribute('class', PrimitiveReference.create('ember-view'), false, null);

    let bindings = component.attributeBindings;
    let rootRef = new UpdatableReference(component);

    if (bindings) {
      for (let i = 0; i < bindings.length; i++) {
        let attribute = bindings[i];
        let reference = rootRef.get(attribute) as PathReference<string>;

        operations.setAttribute(attribute, reference, false, null);
      }
    }
  }

  didRenderLayout(component: EmberishCurlyComponent, bounds: Bounds): void {
    component.bounds = bounds;
  }

  didCreate(component: EmberishCurlyComponent): void {
    component.didInsertElement();
    component.didRender();
  }

  update(component: EmberishCurlyComponent): void {
    let oldAttrs = component.attrs;
    let newAttrs = component.args.value();
    let merged = assign({}, newAttrs, { attrs: newAttrs });

    component.setProperties(merged);
    component.didUpdateAttrs({ oldAttrs, newAttrs });
    component.didReceiveAttrs({ oldAttrs, newAttrs });
    component.willUpdate();
    component.willRender();
  }

  didUpdateLayout(): void { }

  didUpdate(component: EmberishCurlyComponent): void {
    component.didUpdate();
    component.didRender();
  }

  getDestructor(component: EmberishCurlyComponent): Destroyable {
    return {
      destroy() {
        component.destroy();
      }
    };
  }
}


export interface EmberishCurlyComponentFactory {
  positionalParams: Option<string | string[]>;
  create(options: { attrs: Attrs, targetObject: any }): EmberishCurlyComponent;
}


export interface EmberishCurlyComponentDefinitionState {
  name: string;
  ComponentClass: EmberishCurlyComponentFactory;
  locator: ModuleLocator;
  layout: Option<number>;
  symbolTable?: ProgramSymbolTable;
}


static create(args: { attrs: Attrs }): EmberishCurlyComponent {
    return super.create(args) as EmberishCurlyComponent;
  }


recompute() {
    this.dirtinessTag.inner.dirty();
  }


didInitAttrs(_options: { attrs: Attrs }) { }


didUpdateAttrs(_diff: AttrsDiff) { }


didReceiveAttrs(_diff: AttrsDiff) { }


willInsertElement() { }


willUpdate() { }


willRender() { }


didInsertElement() { }


didUpdate() { }


didRender() { }


getCapabilities(state: TestComponentDefinitionState) {
    return state.capabilities;
  }


getLayout(state: EmberishCurlyComponentDefinitionState, resolver: EagerRuntimeResolver): Invocation {
    let handle = resolver.getVMHandle(expect(state.locator, 'expected locator'));
    return {
      handle,
      symbolTable: state.symbolTable! as ProgramSymbolTable
    };
  }


getDynamicLayout({ layout }: EmberishCurlyComponent, resolver: LazyRuntimeResolver): Invocation {
    if (!layout) {
      throw new Error('BUG: missing dynamic layout');
    }

    let handle = resolver.lookup('template-source', layout.name);

    if (!handle) {
      throw new Error('BUG: missing dynamic layout');
    }

    return resolver.compileTemplate(handle, layout.name, (source, options) => {
      let factory = createTemplate(source);
      let template = factory.create(options);
      let builder = template.asWrappedLayout();
      return {
        handle: builder.compile(),
        symbolTable: builder.symbolTable
      };
    });
  }


prepareArgs(state: EmberishCurlyComponentDefinitionState, args: Arguments): Option<PreparedArguments> {
    const { positionalParams } = state.ComponentClass || BaseEmberishCurlyComponent;

    if (typeof positionalParams === 'string') {
      if (args.named.has(positionalParams)) {
        if (args.positional.length === 0) {
          return null;
        } else {
          throw new Error(`You cannot specify positional parameters and the hash argument \`${positionalParams}\`.`);
        }
      }

      let named = Object.assign({}, args.named.capture().map);
      named[positionalParams] = args.positional.capture();

      return { positional: EMPTY_ARRAY, named };
    } else if (Array.isArray(positionalParams)) {
      let named = Object.assign({}, args.named.capture().map);
      let count = Math.min(positionalParams.length, args.positional.length);

      for (let i=0; i<count; i++) {
        let name = positionalParams[i];

        if (named[name]) {
          throw new Error(`You cannot specify both a positional param (at position ${i}) and the hash argument \`${name}\`.`);
        }

        named[name] = args.positional.at(i);
      }

      return { positional: EMPTY_ARRAY, named };
    } else {
      return null;
    }
  }


create(_environment: Environment, state: EmberishCurlyComponentDefinitionState, _args: Arguments, dynamicScope: DynamicScope, callerSelf: PathReference<Opaque>, hasDefaultBlock: boolean): EmberishCurlyComponent {
    let klass = state.ComponentClass || BaseEmberishCurlyComponent;
    let self = callerSelf.value();
    let args = _args.named.capture();
    let attrs = args.value();
    let merged = assign({}, attrs, { attrs }, { args }, { targetObject: self }, { HAS_BLOCK: hasDefaultBlock });
    let component = klass.create(merged);

    component.name = state.name;
    component.args = args;

    if (state.layout) {
      component.layout = { name: component.name, handle: state.layout };
    }

    let dyn: Option<string[]> = state.ComponentClass ? state.ComponentClass['fromDynamicScope'] : null;

    if (dyn) {
      for (let i = 0; i < dyn.length; i++) {
        let name = dyn[i];
        component.set(name, dynamicScope.get(name).value());
      }
    }

    component.didInitAttrs({ attrs });
    component.didReceiveAttrs({ oldAttrs: null, newAttrs: attrs });
    component.willInsertElement();
    component.willRender();

    return component;
  }


getTag({ args: { tag }, dirtinessTag }: EmberishCurlyComponent): Tag {
    return combine([tag, dirtinessTag]);
  }


getSelf(component: EmberishCurlyComponent): PathReference<Opaque> {
    return new UpdatableReference(component);
  }


getTagName({ tagName }: EmberishCurlyComponent): Option<string> {
    if (tagName) {
      return tagName;
    } else if (tagName === null) {
      return 'div';
    } else {
      return null;
    }
  }


didCreateElement(component: EmberishCurlyComponent, element: Element, operations: ElementOperations): void {
    component.element = element;

    operations.setAttribute('id', PrimitiveReference.create(`ember${component._guid}`), false, null);
    operations.setAttribute('class', PrimitiveReference.create('ember-view'), false, null);

    let bindings = component.attributeBindings;
    let rootRef = new UpdatableReference(component);

    if (bindings) {
      for (let i = 0; i < bindings.length; i++) {
        let attribute = bindings[i];
        let reference = rootRef.get(attribute) as PathReference<string>;

        operations.setAttribute(attribute, reference, false, null);
      }
    }
  }


didRenderLayout(component: EmberishCurlyComponent, bounds: Bounds): void {
    component.bounds = bounds;
  }


didCreate(component: EmberishCurlyComponent): void {
    component.didInsertElement();
    component.didRender();
  }


update(component: EmberishCurlyComponent): void {
    let oldAttrs = component.attrs;
    let newAttrs = component.args.value();
    let merged = assign({}, newAttrs, { attrs: newAttrs });

    component.setProperties(merged);
    component.didUpdateAttrs({ oldAttrs, newAttrs });
    component.didReceiveAttrs({ oldAttrs, newAttrs });
    component.willUpdate();
    component.willRender();
  }


didUpdateLayout(): void { }


didUpdate(component: EmberishCurlyComponent): void {
    component.didUpdate();
    component.didRender();
  }


getDestructor(component: EmberishCurlyComponent): Destroyable {
    return {
      destroy() {
        component.destroy();
      }
    };
  }


destroy() {
        component.destroy();
      }


() => {
	describe('seconds', () => {
		test('GIVEN 1 second THEN returns 1000 milliseconds', () => {
			expect(seconds(1)).toEqual(1_000);
		});
	});

	describe('seconds.fromMilliseconds', () => {
		test('GIVEN 1000 milliseconds THEN returns 1 second', () => {
			expect(seconds.fromMilliseconds(1_000)).toEqual(1);
		});

		test('GIVEN 12440 milliseconds THEN returns 12 seconds', () => {
			expect(seconds.fromMilliseconds(12_440)).toEqual(12);
		});

		test('GIVEN 12450 milliseconds THEN returns 12 seconds', () => {
			expect(seconds.fromMilliseconds(12_450)).toEqual(12);
		});

		test('GIVEN 12460 milliseconds THEN returns 12 seconds', () => {
			expect(seconds.fromMilliseconds(12_460)).toEqual(12);
		});

		test('GIVEN 12540 milliseconds THEN returns 13 seconds', () => {
			expect(seconds.fromMilliseconds(12_540)).toEqual(13);
		});

		test('GIVEN 12550 milliseconds THEN returns 13 seconds', () => {
			expect(seconds.fromMilliseconds(12_550)).toEqual(13);
		});

		test('GIVEN 12560 milliseconds THEN returns 13 seconds', () => {
			expect(seconds.fromMilliseconds(12_560)).toEqual(13);
		});
	});

	describe('minutes', () => {
		test('GIVEN 1 minute THEN returns 60000 milliseconds', () => {
			expect(minutes(1)).toEqual(60_000);
		});
	});

	describe('minutes.toSeconds', () => {
		test('GIVEN 1 minute THEN returns 60 seconds', () => {
			expect(minutes.toSeconds(1)).toEqual(60);
		});
	});

	describe('hours', () => {
		test('GIVEN 1 hour THEN returns 60000 milliseconds', () => {
			expect(hours(1)).toEqual(3_600_000);
		});
	});

	describe('days', () => {
		test('GIVEN 1 day THEN returns 60000 milliseconds', () => {
			expect(days(1)).toEqual(86_400_000);
		});
	});

	describe('months', () => {
		test('GIVEN 1 month THEN returns 60000 milliseconds', () => {
			expect(months(1)).toEqual(2_628_000_000);
		});
	});

	describe('years', () => {
		test('GIVEN 1 year THEN returns 60000 milliseconds', () => {
			expect(years(1)).toEqual(31_536_000_000);
		});
	});
}


() => {
		test('GIVEN 1 second THEN returns 1000 milliseconds', () => {
			expect(seconds(1)).toEqual(1_000);
		});
	}


() => {
			expect(seconds(1)).toEqual(1_000);
		}


() => {
		test('GIVEN 1000 milliseconds THEN returns 1 second', () => {
			expect(seconds.fromMilliseconds(1_000)).toEqual(1);
		});

		test('GIVEN 12440 milliseconds THEN returns 12 seconds', () => {
			expect(seconds.fromMilliseconds(12_440)).toEqual(12);
		});

		test('GIVEN 12450 milliseconds THEN returns 12 seconds', () => {
			expect(seconds.fromMilliseconds(12_450)).toEqual(12);
		});

		test('GIVEN 12460 milliseconds THEN returns 12 seconds', () => {
			expect(seconds.fromMilliseconds(12_460)).toEqual(12);
		});

		test('GIVEN 12540 milliseconds THEN returns 13 seconds', () => {
			expect(seconds.fromMilliseconds(12_540)).toEqual(13);
		});

		test('GIVEN 12550 milliseconds THEN returns 13 seconds', () => {
			expect(seconds.fromMilliseconds(12_550)).toEqual(13);
		});

		test('GIVEN 12560 milliseconds THEN returns 13 seconds', () => {
			expect(seconds.fromMilliseconds(12_560)).toEqual(13);
		});
	}


() => {
			expect(seconds.fromMilliseconds(1_000)).toEqual(1);
		}


() => {
			expect(seconds.fromMilliseconds(12_440)).toEqual(12);
		}


() => {
			expect(seconds.fromMilliseconds(12_450)).toEqual(12);
		}


() => {
			expect(seconds.fromMilliseconds(12_460)).toEqual(12);
		}


() => {
			expect(seconds.fromMilliseconds(12_540)).toEqual(13);
		}


() => {
			expect(seconds.fromMilliseconds(12_550)).toEqual(13);
		}


() => {
			expect(seconds.fromMilliseconds(12_560)).toEqual(13);
		}


() => {
		test('GIVEN 1 minute THEN returns 60000 milliseconds', () => {
			expect(minutes(1)).toEqual(60_000);
		});
	}


() => {
			expect(minutes(1)).toEqual(60_000);
		}


() => {
		test('GIVEN 1 minute THEN returns 60 seconds', () => {
			expect(minutes.toSeconds(1)).toEqual(60);
		});
	}


() => {
			expect(minutes.toSeconds(1)).toEqual(60);
		}


() => {
		test('GIVEN 1 hour THEN returns 60000 milliseconds', () => {
			expect(hours(1)).toEqual(3_600_000);
		});
	}


() => {
			expect(hours(1)).toEqual(3_600_000);
		}


() => {
		test('GIVEN 1 day THEN returns 60000 milliseconds', () => {
			expect(days(1)).toEqual(86_400_000);
		});
	}


() => {
			expect(days(1)).toEqual(86_400_000);
		}


() => {
		test('GIVEN 1 month THEN returns 60000 milliseconds', () => {
			expect(months(1)).toEqual(2_628_000_000);
		});
	}


() => {
			expect(months(1)).toEqual(2_628_000_000);
		}


() => {
		test('GIVEN 1 year THEN returns 60000 milliseconds', () => {
			expect(years(1)).toEqual(31_536_000_000);
		});
	}


() => {
			expect(years(1)).toEqual(31_536_000_000);
		}


() => {
    TestBed.configureTestingModule({
      declarations: [ AppComponent ],
      imports: [ FormsModule ]
    })
    .compileComponents();
  }


() => {
    fixture = TestBed.createComponent(AppComponent);
    comp = fixture.componentInstance;
    de = fixture.debugElement.query(By.css('h1'));
    de2 = fixture.debugElement.query(By.css('h2'));
    heroIdElement = fixture.debugElement.query(By.css('div.hero_id'));
    heroNameElement = fixture.debugElement.query(By.css('div.hero_name'));
  }


() => expect(comp).toBeDefined()


() => {
    fixture.detectChanges();
    const h1 = de.nativeElement;
    expect(h1.innerText).toMatch(/Tour of Heroes/i,
      '<h1> should say something about "Tour of Heroes"');
  }


() => expect(comp.hero).toBeDefined()


() => {
    fixture.detectChanges();
    const h2 = de2.nativeElement;
    expect(h2.innerText).toMatch(/WindStorm/i, '<h2> should say something about windstorm');
  }


() => {
    fixture.detectChanges();
    const heroId = heroIdElement.nativeElement;
    expect(heroId.innerText).toMatch(/1/i, '<div> should have hero\'s id');
  }


() => {
    fixture.detectChanges();
    const heroName = heroNameElement.nativeElement;
    expect(heroName.innerText).toMatch(/name/i, '<div> should have hero\'s id');
  }


/**
 * Generated class for the ChatsPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */
@IonicPage()
@Component({
  selector: 'page-chats',
  templateUrl: 'chats.html',
})
export class ChatsPage {

  constructor(public navCtrl: NavController,
    public navParams: NavParams,
    public pop: PopoverController,

   ) {
  }

  presentPopover(myEvent) {
    let popover = this.pop.create(HeadOptionsPage);
    popover.present({
      ev: myEvent
    });
  }

  contacts() {
    this.navCtrl.push('ContactlistPage');
  }

  texts(){
    this.navCtrl.setRoot('TextsPage');
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad ChatsPage');
  }

}


presentPopover(myEvent) {
    let popover = this.pop.create(HeadOptionsPage);
    popover.present({
      ev: myEvent
    });
  }


contacts() {
    this.navCtrl.push('ContactlistPage');
  }


texts(){
    this.navCtrl.setRoot('TextsPage');
  }


ionViewDidLoad() {
    console.log('ionViewDidLoad ChatsPage');
  }


data => {
this.editedPerson = data;
this.router.navigate(['person', this.editedPerson.id]);
}


params => {
    // FIXME: Should manage not found (interceptor).
    if (params.id) {
      this
      .api
      .getOne(params.id)
      .pipe(tap(e => this.id = e.id))
      .subscribe(e => this.form.patchValue(e));
    }
    }


e => this.id = e.id


e => this.form.patchValue(e)


@Component({
  selector: 'app-person-form',
  templateUrl: './person-form.component.html',
  styleUrls: ['./person-form.component.css']
})
export class PersonFormComponent implements OnInit {

  @Input()
  person = false;

  constructor(private readonly fb: FormBuilder,
              private readonly route: ActivatedRoute,
              private readonly api: PersonApiService,
              private readonly router: Router) { }

get isNew(): boolean { return this.id === null; }

get firstname(): AbstractControl { return this.form.controls.firstname; }
get lastname(): AbstractControl { return this.form.controls.lastname; }
get email(): AbstractControl { return this.form.controls.email; }
get cellPhone(): AbstractControl { return this.form.controls.cellPhone; }

id: number = null;
editedPerson: Person;

form = this.fb.group({
// id: [''],
sexCandidate: [''],
firstname: ['', Validators.required],
lastname: ['', Validators.required],
email: ['', Validators.required],
cellPhone: ['', Validators.required],
homePhone: [''],
commentary: [''],
rankingCandidate: [''],
statusCandidate: ['']
});

ngOnInit() {
  this.treatParameters();
}

onSubmit() {
// TODO: determine post/put
// TODO: send api

const person = this.form.value;

let request = null;

if (this.isNew) {
request = this.api.create(person).subscribe(data => {
this.editedPerson = data;
this.router.navigate(['person', this.editedPerson.id]);
});
} else {
request = this.api.edit(this.id, person).subscribe(data => {
this.editedPerson = data;
this.router.navigate(['person', this.editedPerson.id]);
});
}

return request;
}

  /** Initializes from route parameters. */
  private treatParameters() {
    this.route
    .params
    .subscribe(params => {
    // FIXME: Should manage not found (interceptor).
    if (params.id) {
      this
      .api
      .getOne(params.id)
      .pipe(tap(e => this.id = e.id))
      .subscribe(e => this.form.patchValue(e));
    }
    });
  }
}


ngOnInit() {
  this.treatParameters();
}


onSubmit() {
// TODO: determine post/put
// TODO: send api

const person = this.form.value;

let request = null;

if (this.isNew) {
request = this.api.create(person).subscribe(data => {
this.editedPerson = data;
this.router.navigate(['person', this.editedPerson.id]);
});
} else {
request = this.api.edit(this.id, person).subscribe(data => {
this.editedPerson = data;
this.router.navigate(['person', this.editedPerson.id]);
});
}

return request;
}


/** Initializes from route parameters. */
private treatParameters() {
    this.route
    .params
    .subscribe(params => {
    // FIXME: Should manage not found (interceptor).
    if (params.id) {
      this
      .api
      .getOne(params.id)
      .pipe(tap(e => this.id = e.id))
      .subscribe(e => this.form.patchValue(e));
    }
    });
  }


converterResult => {
                const interfacesString = stringifyInterfaces(converterResult);

                if (interfacesString.length === 0) {
                    return Promise.resolve();
                }

                return this.writeInterfaceIntoUrlPath(converterResult, args, interfacesString);
            }


export class UrlStructureInterfacesWriter implements InterfacesWriter {
    async writeInterfaces(interfacesData: Array<ConverterResult>, args: ApiDoc2InterfaceParameters): Promise<void> {
        await Promise
            .all(interfacesData.map(converterResult => {
                const interfacesString = stringifyInterfaces(converterResult);

                if (interfacesString.length === 0) {
                    return Promise.resolve();
                }

                return this.writeInterfaceIntoUrlPath(converterResult, args, interfacesString);
            }))
            .then(() => Promise.resolve());
    }

    private writeInterfaceIntoUrlPath(
        converterResult: ConverterResult,
        args: ApiDoc2InterfaceParameters,
        interfacesString: string,
    ) {
        const urlPath = getUrlWithoutParameters(converterResult.metadata.url);
        const filePath = path.join(args.output, urlPath, `${converterResult.metadata.name}.ts`);

        return writeFileToPath(filePath, interfacesString);
    }
}


async writeInterfaces(interfacesData: Array<ConverterResult>, args: ApiDoc2InterfaceParameters): Promise<void> {
        await Promise
            .all(interfacesData.map(converterResult => {
                const interfacesString = stringifyInterfaces(converterResult);

                if (interfacesString.length === 0) {
                    return Promise.resolve();
                }

                return this.writeInterfaceIntoUrlPath(converterResult, args, interfacesString);
            }))
            .then(() => Promise.resolve());
    }


private writeInterfaceIntoUrlPath(
        converterResult: ConverterResult,
        args: ApiDoc2InterfaceParameters,
        interfacesString: string,
    ) {
        const urlPath = getUrlWithoutParameters(converterResult.metadata.url);
        const filePath = path.join(args.output, urlPath, `${converterResult.metadata.name}.ts`);

        return writeFileToPath(filePath, interfacesString);
    }


export class NameCount {
  constructor(public name: string, public count: number) {}
}


() => {
  const [submitting, setSubmitting] = useState<boolean>(false);
  const activeBankConfig = useSelector(getActiveBankConfig);
  const dispatch = useDispatch<AppDispatch>();
  const history = useHistory();

  useEffect(() => {
    if (activeBankConfig) history.push(`/bank/${formatPathFromNode(activeBankConfig)}/overview`);
  }, [activeBankConfig, history]);

  const handleSubmit = async ({ipAddress, nickname, port, protocol}: FormValues): Promise<void> => {
    try {
      setSubmitting(true);
      const bankAddressData = {
        ip_address: ipAddress,
        port: protocol === Protocol.HTTPS ? undefined : parseInt(port, 10),
        protocol,
      };
      const response = await dispatch(connectAndStoreLocalData(bankAddressData, nickname));
      if (response?.error) {
        displayErrorToast(response.error);
      }
    } catch (error) {
      displayToast('An error occurred');
    } finally {
      setSubmitting(false);
    }
  };

  return (

        <Logo className="Connect__logo" size={30} />

thenewboston

Enter the address of a bank.

      <Form
        className="Connect__form"
        initialValues={initialValues}
        onSubmit={handleSubmit}
        validationSchema={validationSchema}
      >
        <FormSelect
          className="Connect__field"
          focused
          label="Protocol"
          name="protocol"
          options={protocolOptions}
          required
          searchable={false}
        />
        <FormInput className="Connect__field" label="IP Address" name="ipAddress" required />
        <FormInput className="Connect__field" label="Port" name="port" type="number" />
        <FormInput className="Connect__field" label="Nickname" name="nickname" />

        <FormButton ignoreDirty submitting={submitting} type={ButtonType.submit}>
          Connect
        </FormButton>
      </Form>


() => {
    if (activeBankConfig) history.push(`/bank/${formatPathFromNode(activeBankConfig)}/overview`);
  }


async ({ipAddress, nickname, port, protocol}: FormValues): Promise<void> => {
    try {
      setSubmitting(true);
      const bankAddressData = {
        ip_address: ipAddress,
        port: protocol === Protocol.HTTPS ? undefined : parseInt(port, 10),
        protocol,
      };
      const response = await dispatch(connectAndStoreLocalData(bankAddressData, nickname));
      if (response?.error) {
        displayErrorToast(response.error);
      }
    } catch (error) {
      displayToast('An error occurred');
    } finally {
      setSubmitting(false);
    }
  }


type FormValues = typeof initialValues;


function notify(message: string, type: 'success' | 'error' | 'info' | 'warning', displayTime?: number) {
    dxNotify({ message: message, closeOnClick: false, closeOnWipe: false, closeOnOutsideClick: false }, type, displayTime ?? defaultDisplayTime);
}


function success(message: string, displayTime?: number) {
    notify(message, 'success', displayTime);
}


function error(message: string, displayTime?: number) {
    notify(message, 'error', displayTime);
}


function info(message: string, displayTime?: number) {
    notify(message, 'info', displayTime);
}


function warning(message: string, displayTime?: number) {
    notify(message, 'warning', displayTime);
}


export interface AAAA {
  age: number;
}


export interface GetBaseDetailResponse {
            id: string;
            name: string;
            age: number;
          }


interface A {
  name: string;
}


interface B {
  age: number;
}


interface C {
  aa: A;
}


export interface SomeInterface_ {
  other1: string;
  other2: string | number;
  other3: Array<string | number>;
  other4: A;
  other5: A & B;
  other6: { some: string; some1: B };
  other7: C;
  other8: { a: Param.C.D.E.F.GetBaseDetailResponse };
}


interface Ddd {
  other3: string;
  other4: number;
  other5: Label;
}


interface Ccc {
  other1: Ddd;
  other2: string | number[];
}


interface Aaa {
  // 年龄
  age?: Label;
  // 姓名
  name: Ccc;
}


interface FFF {
  a: string;
}


interface GGG {
  b: string;
}


// type SomeInterface = number
interface FFF {
  name: string;
  age1?: number;
}


interface GGG {
  name: FFF;
  age: number;
}


export interface SomeInterface {
  [prop: string]: any;
}


// export namespace P {
//   export enum Label {
//     // 枚举
//     LABEL_OPTIONAL = 1,
//     LABEL_REQUIRED = 2,
//     LABEL_REPEATED = 3,
//   }
//   export interface A {
//     name: string
//   }
// }
export enum Label {
  // 枚举
  LABEL_OPTIONAL = 1,
  LABEL_REQUIRED = 2,
  LABEL_REPEATED = 3,
}


(name: string, type: string, urn: string): pulumi.Resource => {
        switch (type) {
            case "azure-nextgen:cache/v20210301:Database":
                return new Database(name, <any>undefined, { urn })
            case "azure-nextgen:cache/v20210301:PrivateEndpointConnection":
                return new PrivateEndpointConnection(name, <any>undefined, { urn })
            case "azure-nextgen:cache/v20210301:RedisEnterprise":
                return new RedisEnterprise(name, <any>undefined, { urn })
            default:
                throw new Error(`unknown resource type ${type}`);
        }
    }


({ children }: PropsWithChildren<{}>) => {
  const queryClient = new QueryClient({
    defaultOptions: {
      queries: {
        refetchOnWindowFocus: false,
      },
    },
  });

  return (
    <QueryClientProvider client={queryClient}>
      <BrowserRouter>{children}</BrowserRouter>
    </QueryClientProvider>


/**
 * Change recommendation class for the View
 *
 * Stores a motion including all (implicit) references
 * Provides "safe" access to variables and functions in {@link MotionChangeRecommendation}
 * @ignore
 */
export class ViewMotionChangeRecommendation
    extends BaseViewModel<MotionChangeRecommendation>
    implements ViewUnifiedChange {
    public static COLLECTION = MotionChangeRecommendation.COLLECTION;
    protected _collection = MotionChangeRecommendation.COLLECTION;

    public get changeRecommendation(): MotionChangeRecommendation {
        return this._model;
    }

    public updateChangeReco(type: ModificationType, text: string, internal: boolean): void {
        // @TODO HTML sanitazion
        this.changeRecommendation.type = type;
        this.changeRecommendation.text = text;
        this.changeRecommendation.internal = internal;
    }

    public getChangeId(): string {
        return 'recommendation-' + this.id.toString(10);
    }

    public getIdentifier(): string {
        return this.id.toString(10);
    }

    public getChangeType(): ViewUnifiedChangeType {
        return ViewUnifiedChangeType.TYPE_CHANGE_RECOMMENDATION;
    }

    public getLineFrom(): number {
        return this.line_from;
    }

    public getLineTo(): number {
        return this.line_to;
    }

    public getChangeNewText(): string {
        return this.text;
    }

    public isAccepted(): boolean {
        return !this.rejected;
    }

    public isRejected(): boolean {
        return this.rejected;
    }

    public showInDiffView(): boolean {
        return true;
    }

    public showInFinalView(): boolean {
        return !this.rejected;
    }

    public isTitleChange(): boolean {
        return this.line_from === 0 && this.line_to === 0;
    }
}


interface IMotionChangeRecommendationRelations {
    motion: ViewMotion;
}


export interface ViewMotionChangeRecommendation
    extends MotionChangeRecommendation,
        IMotionChangeRecommendationRelations,
        HasMeeting {}


public updateChangeReco(type: ModificationType, text: string, internal: boolean): void {
        // @TODO HTML sanitazion
        this.changeRecommendation.type = type;
        this.changeRecommendation.text = text;
        this.changeRecommendation.internal = internal;
    }


public getChangeId(): string {
        return 'recommendation-' + this.id.toString(10);
    }


public getIdentifier(): string {
        return this.id.toString(10);
    }


public getChangeType(): ViewUnifiedChangeType {
        return ViewUnifiedChangeType.TYPE_CHANGE_RECOMMENDATION;
    }


public getLineFrom(): number {
        return this.line_from;
    }


public getLineTo(): number {
        return this.line_to;
    }


public getChangeNewText(): string {
        return this.text;
    }


public isAccepted(): boolean {
        return !this.rejected;
    }


public isRejected(): boolean {
        return this.rejected;
    }


public showInDiffView(): boolean {
        return true;
    }


public showInFinalView(): boolean {
        return !this.rejected;
    }


public isTitleChange(): boolean {
        return this.line_from === 0 && this.line_to === 0;
    }


export class CommandReader {
    constructor(private readonly historyStore: HistoryStore,
                private readonly vsWindow: typeof vscode.window) {}

    async read() {
        const history = await this.historyStore.getAll();
        if (history.length === 0) {
            return this.vsWindow.showInputBox({
                placeHolder: 'Enter a command',
                prompt: 'No history available yet'
            });
        }

        const pickedCommand = await this.letUserToPickCommand(history);
        return this.letUserToModifyCommand(pickedCommand);
    }

    private letUserToPickCommand(history: string[]): Thenable<string | undefined> {
        const options = {placeHolder: 'Select a command to reuse or Cancel (Esc) to write a new command'};
        return this.vsWindow.showQuickPick(history.reverse(), options);
    }

    private letUserToModifyCommand(pickedCommand?: string) {
        const options = this.getInputBoxOption(pickedCommand);
        return this.vsWindow.showInputBox(options);
    }

    private getInputBoxOption(pickedCommand?: string) {
        if (!pickedCommand) {
            return {placeHolder: 'Enter a command'};
        }
        return {
            placeHolder: 'Enter a command',
            prompt: 'Edit the command if necessary',
            value: pickedCommand
        };
    }

}


async read() {
        const history = await this.historyStore.getAll();
        if (history.length === 0) {
            return this.vsWindow.showInputBox({
                placeHolder: 'Enter a command',
                prompt: 'No history available yet'
            });
        }

        const pickedCommand = await this.letUserToPickCommand(history);
        return this.letUserToModifyCommand(pickedCommand);
    }


private letUserToPickCommand(history: string[]): Thenable<string | undefined> {
        const options = {placeHolder: 'Select a command to reuse or Cancel (Esc) to write a new command'};
        return this.vsWindow.showQuickPick(history.reverse(), options);
    }


private letUserToModifyCommand(pickedCommand?: string) {
        const options = this.getInputBoxOption(pickedCommand);
        return this.vsWindow.showInputBox(options);
    }


private getInputBoxOption(pickedCommand?: string) {
        if (!pickedCommand) {
            return {placeHolder: 'Enter a command'};
        }
        return {
            placeHolder: 'Enter a command',
            prompt: 'Edit the command if necessary',
            value: pickedCommand
        };
    }


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

  //Declare the values for select temperature-type

  types: SelectItem[];
  SelectType = true;

  constructor(public TemperatureType: TemperatureType) {

    this.types = [
      { label: '°C', value: true },
      { label: '°F', value: false }
    ];
  }

  onSelectType(event) {
    this.TemperatureType.Celsius = event["value"];
  }
}


onSelectType(event) {
    this.TemperatureType.Celsius = event["value"];
  }


export default class Attachment {
  public type: string
  public payload: any

  constructor(attachment: IAttachment) {
    this.type = attachment.type
    this.payload = attachment.payload
  }
}


export interface IAttachment {
  type: string
  payload: any
}


@Injectable()
export class IncomeCategoryService {
  constructor(
    @InjectModel(IncomeCategory) private incomeCategory: typeof IncomeCategory,
    private userService: UsersService
  ) {}

  async create(createCategoryDto: CreateIncomeCategoryDto, userId: string): Promise<IncomeCategory> {
    const userExists = await this.userService.findUserById(userId);

    if (!userExists) {
      throw new BadRequestException("User does not exists");
    }

    const categoryExists = await this.incomeCategory.findOne({
      where: {
        name: createCategoryDto.name
      }
    });

    if (categoryExists) {
      throw new BadRequestException(`Category with name '${createCategoryDto.name}' already exists`);
    }

    const category = await this.incomeCategory.create({
      id: uuidv4(),
      name: createCategoryDto.name,
      userId: userId
    });

    return category;
  }

  async findOne(id: string): Promise<IncomeCategory> {
    const category = await this.incomeCategory.findByPk(id);

    if (!category) {
      throw new NotFoundException();
    }

    return category;
  }

  async findAll(userId: string): Promise<Array<IncomeCategory>> {

    const categorys = await this.incomeCategory.findAll({
      where: {
        userId: {
          [Op.or]: [userId, null]
        }
      },
    });

    return categorys;
  }

  async update(updateCategoryDto: UpdateIncomeCategoryDto, userId: string, categoryId: string): Promise<IncomeCategory> {

    const category = await this.incomeCategory.findOne({
      where: {
        id: categoryId,
      }
    });

    if (!category) {
      throw new NotFoundException("Category not found");
    }

    if (category.userId !== userId) {
      throw new BadRequestException('You can update only your own incomeCategory')
    }

    category.setAttributes({
      name: updateCategoryDto.name,
    });

    return category.save();
  }

  async delete(categoryId: string, userId: string): Promise<void> {

    const category = await this.incomeCategory.findOne({
      where: {
        id: categoryId
      }
    });

    if (!category) {
      throw new NotFoundException("Category not found");
    }

    if (category.userId !== userId) {
      throw new BadRequestException('You can delete only your own incomeCategory')
    }

    return await category.destroy();
  }

  findById(id: string): Promise<IncomeCategory | null> {
    return this.incomeCategory.findByPk(id);
  }
}


async create(createCategoryDto: CreateIncomeCategoryDto, userId: string): Promise<IncomeCategory> {
    const userExists = await this.userService.findUserById(userId);

    if (!userExists) {
      throw new BadRequestException("User does not exists");
    }

    const categoryExists = await this.incomeCategory.findOne({
      where: {
        name: createCategoryDto.name
      }
    });

    if (categoryExists) {
      throw new BadRequestException(`Category with name '${createCategoryDto.name}' already exists`);
    }

    const category = await this.incomeCategory.create({
      id: uuidv4(),
      name: createCategoryDto.name,
      userId: userId
    });

    return category;
  }


async findOne(id: string): Promise<IncomeCategory> {
    const category = await this.incomeCategory.findByPk(id);

    if (!category) {
      throw new NotFoundException();
    }

    return category;
  }


async findAll(userId: string): Promise<Array<IncomeCategory>> {

    const categorys = await this.incomeCategory.findAll({
      where: {
        userId: {
          [Op.or]: [userId, null]
        }
      },
    });

    return categorys;
  }


async update(updateCategoryDto: UpdateIncomeCategoryDto, userId: string, categoryId: string): Promise<IncomeCategory> {

    const category = await this.incomeCategory.findOne({
      where: {
        id: categoryId,
      }
    });

    if (!category) {
      throw new NotFoundException("Category not found");
    }

    if (category.userId !== userId) {
      throw new BadRequestException('You can update only your own incomeCategory')
    }

    category.setAttributes({
      name: updateCategoryDto.name,
    });

    return category.save();
  }


async delete(categoryId: string, userId: string): Promise<void> {

    const category = await this.incomeCategory.findOne({
      where: {
        id: categoryId
      }
    });

    if (!category) {
      throw new NotFoundException("Category not found");
    }

    if (category.userId !== userId) {
      throw new BadRequestException('You can delete only your own incomeCategory')
    }

    return await category.destroy();
  }


findById(id: string): Promise<IncomeCategory | null> {
    return this.incomeCategory.findByPk(id);
  }


export default class Profile extends React.PureComponent<Props> {
  componentWillMount() {
    const { avatar, address, onLoadProfile } = this.props
    if (!avatar) {
      onLoadProfile(address)
    }
  }

  render() {
    const { address, avatar, textOnly, imageOnly, size } = this.props
    const name = (avatar && avatar.name) || address.slice(0, 6)

    if (isEqual(address, LAND_POOL_ADDRESS)) {
      return (
        <span className={`Profile decentraland ${size}`} title={address}>
          <Logo />
          {imageOnly ? null : Decentraland}

      )
    }

    if (textOnly) {
      return name
    } else {
      return avatar ? (
        <span className={`Profile avatar ${size}`} title={address}>
          <AvatarFace size="tiny" inline avatar={avatar} />
          {imageOnly ? null : {name}}

      ) : (
        <span className={`Profile blockie ${size}`} title={address}>
          <Blockie seed=


componentWillMount() {
    const { avatar, address, onLoadProfile } = this.props
    if (!avatar) {
      onLoadProfile(address)
    }
  }


render() {
    const { address, avatar, textOnly, imageOnly, size } = this.props
    const name = (avatar && avatar.name) || address.slice(0, 6)

    if (isEqual(address, LAND_POOL_ADDRESS)) {
      return (
        <span className={`Profile decentraland ${size}`} title={address}>
          <Logo />
          {imageOnly ? null : Decentraland}

      )
    }

    if (textOnly) {
      return name
    } else {
      return avatar ? (
        <span className={`Profile avatar ${size}`} title={address}>
          <AvatarFace size="tiny" inline avatar={avatar} />
          {imageOnly ? null : {name}}

      ) : (
        <span className={`Profile blockie ${size}`}


({
  rpc,
  startBlock,
  endBlock,
  err,
  setErr,
  api,

  isSwitchingRpc,
  isLoading,

  fetchData,
  handleRpcChange,
  handleStartBlockChange,
  handleEndBlockChange,
}) => {
  const [isValidating, setIsValidating] = useState<boolean>(false);

  const validateFields = async () => {
    if (startBlock < 0) {
      setErr({ ...NO_ERR, start: 'start block must be greater than 0!' }); return false;
    }
    if (startBlock >= endBlock) {
      setErr({ ...NO_ERR, start: 'start block must be greater than end block!' }); return false;
    }
    if (endBlock < 0) {
      setErr({ ...NO_ERR, end: 'end block must be greater than 0!' }); return false;
    }
    if (endBlock - startBlock > 2000) {
      setErr({ ...NO_ERR, end: 'max interval is 2000!' }); return false;
    }

    const lastBlock = await getLastBlock(api);
    if (endBlock > lastBlock) {
      setErr({ ...NO_ERR, end: `end block must be less than last block ${lastBlock}!` }); return false;
    }

    return true;
  };

  const getRPCIcon = (): ReactElement => {
    if (isSwitchingRpc) return <SyncOutlined spin />;
    if (err.rpc) return <DisconnectOutlined />;
    return <WifiOutlined />;
  };

  const rpcInput: ReactElement = (
    <Form.Item
      validateStatus={ err.rpc ? ERROR : SUCCESS }
      help={ err.rpc }
    >
      <Input
        addonBefore={ (
          <div style={{ width: '100px' }}>
            { getRPCIcon() }
            RPC
          </div>


async () => {
    if (startBlock < 0) {
      setErr({ ...NO_ERR, start: 'start block must be greater than 0!' }); return false;
    }
    if (startBlock >= endBlock) {
      setErr({ ...NO_ERR, start: 'start block must be greater than end block!' }); return false;
    }
    if (endBlock < 0) {
      setErr({ ...NO_ERR, end: 'end block must be greater than 0!' }); return false;
    }
    if (endBlock - startBlock > 2000) {
      setErr({ ...NO_ERR, end: 'max interval is 2000!' }); return false;
    }

    const lastBlock = await getLastBlock(api);
    if (endBlock > lastBlock) {
      setErr({ ...NO_ERR, end: `end block must be less than last block ${lastBlock}!` }); return false;
    }

    return true;
  }


(): ReactElement => {
    if (isSwitchingRpc) return <SyncOutlined spin />;
    if (err.rpc) return <DisconnectOutlined />;
    return <WifiOutlined />;
  }


async () => {
    setIsValidating(true);
    const isFieldsValid = await validateFields();
    setIsValidating(false);

    if (isFieldsValid) fetchData();
  }


interface InputsProps {
  rpc: string,
  startBlock: number,
  endBlock: number,
  err: Err,
  setErr: React.Dispatch<React.SetStateAction<Err>>,
  api: ApiPromise,

  isSwitchingRpc: boolean,
  isLoading: boolean,

  fetchData: () => void,
  handleRpcChange: eventHandler,
  handleStartBlockChange: eventHandler,
  handleEndBlockChange: eventHandler,
}


getRPCIcon()


isValidating ? <SyncOutlined spin


export declare function Other(parser: TexParser, char: string): void;


export declare class BaseTags extends AbstractTags {
}


export enum RabbitMQ{
    UserQueue = 'users',

}


export enum UserMSG{
    CREATE = 'CREATE_USER',
    FIND_ALL='FIND_USERS',
    FIND_ONE= 'FIND_USER',
    UPDATE='UPDATE_USER',
    DELETE='DELETE_USER',
    VALID_USER='VALID_USER',
}


(settings) => [settings[GuildSettings.Channels.Logs.RoleUpdate], settings.getLanguage()]


(key) => t(`permissions:${key}`)


@ApplyOptions<ListenerOptions>({ event: Events.GuildRoleUpdate })
export class UserListener extends Listener<typeof Events.GuildRoleUpdate> {
	public async run(previous: Role, next: Role) {
		const [channelId, t] = await readSettings(next, (settings) => [settings[GuildSettings.Channels.Logs.RoleUpdate], settings.getLanguage()]);
		if (isNullish(channelId)) return;

		const channel = next.guild.channels.cache.get(channelId) as TextChannel | undefined;
		if (channel === undefined) {
			await writeSettings(next, [[GuildSettings.Channels.Logs.RoleUpdate, null]]);
			return;
		}

		const changes: string[] = [...this.differenceRole(t, previous, next)];
		if (changes.length === 0) return;

		const embed = new MessageEmbed()
			.setColor(Colors.Yellow)
			.setAuthor(`${next.name} (${next.id})`, channel.guild.iconURL({ size: 64, format: 'png', dynamic: true }) ?? undefined)
			.setDescription(changes.join('\n'))
			.setFooter(t(LanguageKeys.Events.Guilds.Logs.RoleUpdate))
			.setTimestamp();
		await channel.send({ embeds: [embed] });
	}

	private *differenceRole(t: TFunction, previous: Role, next: Role) {
		const [no, yes] = [t(LanguageKeys.Globals.No), t(LanguageKeys.Globals.Yes)];

		if (previous.color !== next.color) {
			yield t(LanguageKeys.Events.Guilds.Logs.RoleUpdateColor, {
				previous: previous.hexColor,
				next: next.hexColor
			});
		}

		if (previous.hoist !== next.hoist) {
			yield t(LanguageKeys.Events.Guilds.Logs.RoleUpdateHoist, {
				previous: previous.hoist ? yes : no,
				next: next.hoist ? yes : no
			});
		}

		if (previous.mentionable !== next.mentionable) {
			yield t(LanguageKeys.Events.Guilds.Logs.RoleUpdateMentionable, {
				previous: previous.mentionable ? yes : no,
				next: next.mentionable ? yes : no
			});
		}

		if (previous.name !== next.name) {
			yield t(LanguageKeys.Events.Guilds.Logs.RoleUpdateName, {
				previous: previous.name,
				next: next.name
			});
		}

		if (previous.permissions.bitfield !== next.permissions.bitfield) {
			const modified = differenceBitField(previous.permissions.bitfield, next.permissions.bitfield);
			if (modified.added) {
				const values = toPermissionsArray(modified.added).map((key) => t(`permissions:${key}`));
				yield t(LanguageKeys.Events.Guilds.Logs.RoleUpdatePermissionsAdded, { values, count: values.length });
			}

			if (modified.removed) {
				const values = toPermissionsArray(modified.removed).map((key) => t(`permissions:${key}`));
				yield t(LanguageKeys.Events.Guilds.Logs.RoleUpdatePermissionsRemoved, { values, count: values.length });
			}
		}

		if (previous.position !== next.position) {
			yield t(LanguageKeys.Events.Guilds.Logs.RoleUpdatePosition, {
				previous: previous.position,
				next: next.position
			});
		}
	}
}


public async run(previous: Role, next: Role) {
		const [channelId, t] = await readSettings(next, (settings) => [settings[GuildSettings.Channels.Logs.RoleUpdate], settings.getLanguage()]);
		if (isNullish(channelId)) return;

		const channel = next.guild.channels.cache.get(channelId) as TextChannel | undefined;
		if (channel === undefined) {
			await writeSettings(next, [[GuildSettings.Channels.Logs.RoleUpdate, null]]);
			return;
		}

		const changes: string[] = [...this.differenceRole(t, previous, next)];
		if (changes.length === 0) return;

		const embed = new MessageEmbed()
			.setColor(Colors.Yellow)
			.setAuthor(`${next.name} (${next.id})`, channel.guild.iconURL({ size: 64, format: 'png', dynamic: true }) ?? undefined)
			.setDescription(changes.join('\n'))
			.setFooter(t(LanguageKeys.Events.Guilds.Logs.RoleUpdate))
			.setTimestamp();
		await channel.send({ embeds: [embed] });
	}


private *differenceRole(t: TFunction, previous: Role, next: Role) {
		const [no, yes] = [t(LanguageKeys.Globals.No), t(LanguageKeys.Globals.Yes)];

		if (previous.color !== next.color) {
			yield t(LanguageKeys.Events.Guilds.Logs.RoleUpdateColor, {
				previous: previous.hexColor,
				next: next.hexColor
			});
		}

		if (previous.hoist !== next.hoist) {
			yield t(LanguageKeys.Events.Guilds.Logs.RoleUpdateHoist, {
				previous: previous.hoist ? yes : no,
				next: next.hoist ? yes : no
			});
		}

		if (previous.mentionable !== next.mentionable) {
			yield t(LanguageKeys.Events.Guilds.Logs.RoleUpdateMentionable, {
				previous: previous.mentionable ? yes : no,
				next: next.mentionable ? yes : no
			});
		}

		if (previous.name !== next.name) {
			yield t(LanguageKeys.Events.Guilds.Logs.RoleUpdateName, {
				previous: previous.name,
				next: next.name
			});
		}

		if (previous.permissions.bitfield !== next.permissions.bitfield) {
			const modified = differenceBitField(previous.permissions.bitfield, next.permissions.bitfield);
			if (modified.added) {
				const values = toPermissionsArray(modified.added).map((key) => t(`permissions:${key}`));
				yield t(LanguageKeys.Events.Guilds.Logs.RoleUpdatePermissionsAdded, { values, count: values.length });
			}

			if (modified.removed) {
				const values = toPermissionsArray(modified.removed).map((key) => t(`permissions:${key}`));
				yield t(LanguageKeys.Events.Guilds.Logs.RoleUpdatePermissionsRemoved, { values, count: values.length });
			}
		}

		if (previous.position !== next.position) {
			yield t(LanguageKeys.Events.Guilds.Logs.RoleUpdatePosition, {
				previous: previous.position,
				next: next.position
			});
		}
	}


() => {
  test('correctly gets bid orders with no incomingOrders', () => {
    const orders = OrderMocks;
    const currentOrders = getCurrentOrders(orders);

    expect(currentOrders).toEqual(ResultNoIncomingMock);
  });
  test('correctly gets bid orders', () => {
    const orders = OrderMocks;
    const incomingOrders = IncomingOrderMocks;

    const currentOrders = getCurrentOrders(orders, incomingOrders);

    expect(currentOrders).toEqual(ResultMock);
  });
  test('correctly gets ask orders', () => {
    const orders = OrderMocks;
    const incomingOrders = IncomingOrderMocks;
    const isAsk = true;

    const currentOrders = getCurrentOrders(orders, incomingOrders, isAsk);

    expect(currentOrders).toEqual(ResultAskMock);
  });
  test('correctly removes orders with zero size', () => {
    const orders = OrderMocks;
    const incomingOrders = IncomingOrderWithEmptyMocks;
    const isAsk = true;

    const currentOrders = getCurrentOrders(orders, incomingOrders, isAsk);

    expect(currentOrders).toEqual(ResultWithEmptySizesMock);
  });
}


() => {
    const orders = OrderMocks;
    const currentOrders = getCurrentOrders(orders);

    expect(currentOrders).toEqual(ResultNoIncomingMock);
  }


() => {
    const orders = OrderMocks;
    const incomingOrders = IncomingOrderMocks;

    const currentOrders = getCurrentOrders(orders, incomingOrders);

    expect(currentOrders).toEqual(ResultMock);
  }


() => {
    const orders = OrderMocks;
    const incomingOrders = IncomingOrderMocks;
    const isAsk = true;

    const currentOrders = getCurrentOrders(orders, incomingOrders, isAsk);

    expect(currentOrders).toEqual(ResultAskMock);
  }


() => {
    const orders = OrderMocks;
    const incomingOrders = IncomingOrderWithEmptyMocks;
    const isAsk = true;

    const currentOrders = getCurrentOrders(orders, incomingOrders, isAsk);

    expect(currentOrders).toEqual(ResultWithEmptySizesMock);
  }