auto
      ˆ¾‘äÇò 8àHé%•–_?ŸÃƒh¹ÂÁÀ      disabled
  J   	ˆl–Ãa¾”ªi?u8 ¸Û71hß�þcŒ8àYŒd(BñüÿÄƒï‹Ã_“I|¥ŽõHºl=$¤�zTÖ™	ÃÂ °    	// Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/

import { onActivated, onMounted, ref } from 'vue'

import { waitForImagesToLoad } from '#shared/utils/dom.ts'
import { waitForAnimationFrame } from '#shared/utils/helpers.ts'

export const useArticleToggleMore = () => {
  const MIN_HEIGHT = 60
  const MAX_HEIGHT = 320
  let heightHidden = 0

  const bubbleElement = ref<HTMLDivElement>()
  const hasShowMore = ref(true)
  const shownMore = ref(false)

  // A hidden tab is detached from the document, where nothing has a height.
  let measureOnActivation = false

  const getSignatureMarker = (element: HTMLElement): HTMLElement | null => {
    const marker = element.querySelector('.js-signatureMarker') as HTMLElement
    if (marker) return marker

    return element.querySelector('div [data-signature=true]')
  }

  const setHeight = async () => {
    if (!bubbleElement.value) return

    const styles = bubbleElement.value.style

    await waitForAnimationFrame()

    // it's possible it was remounted somehow
    if (!bubbleElement.value) return

    if (!bubbleElement.value.isConnected) {
      measureOnActivation = true
      return
    }

    // The content height, whatever the element is constrained to right now: measuring this way
    // never shows the full content in between, e.g. when a translation replaces the body.
    const previousHeight = styles.height
    styles.height = 'auto'
    const height = bubbleElement.value.scrollHeight
    styles.height = previousHeight

    const signatureMarker = getSignatureMarker(bubbleElement.value)

    const offsetTop = signatureMarker?.offsetTop || 0

    if (offsetTop > 0 && offsetTop < MAX_HEIGHT) {
      heightHidden = offsetTop < MIN_HEIGHT ? MIN_HEIGHT : offsetTop
      hasShowMore.value = true
    } else if (height > MAX_HEIGHT) {
      heightHidden = MAX_HEIGHT
      hasShowMore.value = true
    } else {
      hasShowMore.value = false
      heightHidden = 0
    }

    styles.height = heightHidden ? `${heightHidden}px` : ''
  }

  // Measures once the content, inline images included, is there; a swapped body calls it again.
  const recalculateHeight = async () => {
    if (!bubbleElement.value) return

    // Wait for inline images to load before calculating height
    // Resolved immediately if no images are present
    await waitForImagesToLoad(bubbleElement)

    await setHeight()

    if (shownMore.value && bubbleElement.value) bubbleElement.value.style.height = 'auto'
  }

  onMounted(recalculateHeight)

  onActivated(() => {
    if (!measureOnActivation) return

    measureOnActivation = false
    recalculateHeight()
  })

  const toggleShowMore = () => {
    if (!bubbleElement.value) return

    shownMore.value = !shownMore.value

    const styles = bubbleElement.value.style

    styles.height = shownMore.value ? 'auto' : `${heightHidden}px`
  }

  return {
    toggleShowMore,
    recalculateHeight,
    hasShowMore,
    shownMore,
    bubbleElement,
  }
}
  /   ˆ{‹„„-i[D<†ªoZƒ›Ù«Æ423_‘I|¥‰ÓMdœv ©ƒ†ü+=ÆÅ §    ‹      �“_oÓ0Åß÷).~à­¹Í:`Ú£‘T¢R×V]Bˆ7vb‹$ŽlCŸž¤jA«øóÇ÷w®Î¹¶é³l�æ6sx›ß/aóîÍr‘™ ¾Ÿ¥ˆYž…ÂU4�ç+DyßÝ î÷ûh?‹Œ­0ß¢òM}…Î[]øHxAØöØP%¹è¿@½öµd‹VÈo`J@óÅ;-ä+ç(†jÏã( ;#‡>ñYM_:4æ»ƒtXZF½‚¯¼ÖU›o:Â¨n*p¶HêÂ´w5o?G•.	ðÚ'äã"]ê9ôjP3ÊAYY&äuš¬n×Éa+ÞHŠüiæ>0Kî<4FèRKq~ðƒþ~¾a˜LºÂêÎkÓQì#žF-Lí:Þg}Ñ'Pö”
ˆøÓ4xñË06wÛù*ÏÛ01´8º;ž aneë!ÓVÞØÇÑdP<ow®»ýù£«+å	˜À“ä?ø.M-¤=u~Îs#‰Þð¸8õù›±Ëi|=™¾œÄSˆ_Ý\^üW‚¿<o.ÅÃ]§ÞÌ
ÄÁ–        ˆÃ‘äÇò 8àHé%•×%#¿ÏÈƒh¹ÇÆÅ      disabled
  6   ˆl–Ðz¾”ªC]Šq@=q¦®41hß�þC+ë8Ø�@�|/ÿ?É505ÈÂÇÆ ù    // Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/

import { computed } from 'vue'

import { useApplicationStore } from '#shared/stores/application.ts'

export const useBaseUrl = () => {
  const application = useApplicationStore()

  const baseUrl = computed(() => {
    const { http_type: httpType, fqd