input:b0003v0627p0001e0001-e0,1,2,3,4,k110,111,112,r8,B,a0,1,m4,lsfw
  /   ˆ{‹„„-i[D<†ªoZƒ›Ù«Â425_‘I|¥‰ÓMdœv ©ƒ†ü+=ÂÁ ©    ‹      �“]OÛ0†ïù_ì®9í@ÇK*­Ri«„¦iNì$iÙ.…ýú%u'ÊD7¶›|ùyOžãzš,âôër_Ò›,ï>Ï¦1�âý(FLÒÄŒƒaˆ8™ •sí%âv»¶£@›ÓVn]�Ñ:£r';¡ý7v´’\tw N¹Z²i#äèPoœUBŽQÈGÌ6–¢'ºîC4Óâ¹¯þ1×ï~À³]¼4Œº
y­Ê&"N·„Qµ.Áš<"¨rÝXÌjÞ<¥*ðÚEäÛ4^|ï8tUŸf”Ced‘Oq4¿ZD×„ÍùZRäo37ž™që`­…*”Gá[ßªÇ&žI¤Í�j�ÒÍŠ]‹‡­æº¶-ïzýØuP™CÊ#âo³ÁóW“±¼^Mæi2]ù)}‰»×«@Ø’Ù8H”‘¹Óæy/êSšÌ¶W¿^a¯aTY9Â ð&ùî…®…4‡öÇ¼76ëlûë¡áoJgÃ³óAFC/.Ç ÿåþÎÕÁý¾¥¸ÛíýÉù	«E–œ       ˆÀ¿Ã513¾ÂÁ     ‹      Õ•]oÓ0†ï÷+¾à.9IÚÖ9A£©D¥®­º"„Nì$ù’cVÆ¯Çi2­›Ö1.�ÚûØ~�ó¼Î‘}.'›¯«)|Ú\Ïaõùã|6b!~LÃMØmÇEœ.�LëzŒ¸ÝnííÀ®TŠ›5fºÈ‡Øh%cmsÍIpFÛ½àh&73P-u.‚YÉÅ/¨Àê§n$¬³ßÙ.ÅNar°O¢QÅïÚ»ÜóÌñî,Ú¥·¡
¨Îà–å2-}¢«šT)4*ö	Ê¸*ŒrVþ°S™`¹öÉ·ÙdùÝèPgmv@dJ$>ù0ñ—KÿŠVŠìyÍu§™³FCQq™HÁŠo:ñ�ü}øÂ°Ó„¢‰•¬µ¬Ê)‹ûVã*ojf¼ž™ÚWuþ·×`ñ£ÇX]­§‹M8[wOÂÛ+èÿ¬˜¥†P*ëJÝõ ]ÖÛ2jêËû%ôJ¦™&€Ï*ÿ�=©r.Ô>ý!nCË£Ô ÷Á>ç0Ïñ–ëXÞ<gì\ …SY�Ån™ÌÛr7Nžl¼ìhd¹®å]€3»çGâ(©c£_Ãî‚ó~<	»("Á}7Ÿ^5Å¹4ôíx‚ìéŽ==EvV³8žá¿�þ¿‡Wvìû(Å]÷¥Øuò?ñë+’,    C   ˆl–Ü4ý('ÜZÔâ€vàZ¸ÓJbÑ¿�þYÖq²7#î6ë¢jOçÅ‚x Ä_�uÐb&=LyZËcõÄÃ *    # Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/

class Service::AI::Ticket::EmbedBase < Service::Base
  class ContentTooLargeError < StandardError; end

  def initialize(ticket:)
    @ticket = ticket
  end

  private

  attr_reader :ticket

  def check_content_size!(content)
    tokens = Service::AI::VectorDB::Content::Chunks::Strategy::Base.estimate_tokens(content)
    limit  = embedding_provider.embedding_input_limit

    return if tokens <= limit

    raise ContentTooLargeError, "Content is too large to embed: estimated #{tokens} tokens exceeds model limit of #{limit}."
  end

  def embedding_provider
    @embedding_provider ||= AI::ProviderConnection.for_embeddings&.provider_instance ||
                            raise(__('AI provider is not configured.'))
  end
end
  J   	ˆl–Ãa¾”ªn-ji@5pÜm•1hßŽþZygÈC(]$hÏÇ72Æa–ßi~” T¾R( 	Å€ÁLZ7ÿÅ  H    	; configuration for php xml module
; priority=20
extension=xmlreader.so
  6   ˆl–Ãa¾”ªi?u8 ¸Û71hß�þBû`YÇÌc!BF†ÏóÉƒq§�ÈÁ¿Æ P    # Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/

class Service::AI::Ticket::PreProcessArticleContent < Service::Base
  IMAGE_MIME_TYPES = %w[image/jpeg image/jpg image/png image/gif image/tiff image/bmp image/webp].freeze
  MARKER_START     = "[OCR_TEXT_START]\n".freeze
  MARKER_END       = "\n[OCR_TEXT_END]".freeze

  attr_reader :articles, :skip_quotes_strip_first_article, :keep_quotes, :skip_ocr, :link_style

  # @param skip_ocr [Boolean] no OCR even when an OCR connection is configured, for callers that must not start
  #   an AI call per image
  # @param keep_quotes [Boolean] keeps the quotes and signatures of every email, for callers that read a message whole
  def initialize(articles:, skip_quotes_strip_first_article: false, keep_quotes: false, skip_ocr: false, link_style: :markdown)
    @articles                        = articles
    @skip_quotes_strip_first_article = skip_quotes_strip_first_article
    @keep_quotes                     = keep_quotes
    @skip_ocr                        = skip_ocr
    @link_style                      = link_style
  end

  def execute
    return prepared_articles if !use_ocr

    images = collect_all_images(prepared_articles)
    image_texts = recognize_image_texts(images)
    articles_with_recognized_texts(image_texts, prepared_articles)
  end

  private

  def use_ocr
    return @use_ocr if defined?(@use_ocr)

    @use_ocr = !skip_ocr && AI::ProviderConnection.for_ocr.present?
  end

  def non_plain_article?(article)
    article.content_type && article.content_type !~ %r{text/plain}i
  end

  def prepared_articles
    @prepared_articles ||= articles.map do |article|
      if use_ocr
        inline_images = select_inline_image_attachments(article)
        image_attachments = select_image_attachments(article, inline_images)
      end

      text = article.body || 