cask "firefox" do
  version "122.0.1"

  language "af" do
    sha256 "a523af6189eabc9ddd0a9d014c07520d306ac82c44c832e8883afb272dc92f54"
    "af"
  end
  language "ar" do
    sha256 "8c467e92572261cb7ad8df52714dcb4f5b84614be0042306fe8d85dee8770609"
    "ar"
  end
  language "be" do
    sha256 "9d400130dca8de579730a3e85ffd1b876a473e40d72697620718793be853c019"
    "be"
  end
  language "bg" do
    sha256 "5afbea27421d1bdb9bcb6b21b853f97df7ed12534f6606f730968cf112d4f3db"
    "bg"
  end
  language "bn" do
    sha256 "a2effabe763b6598fc8cab1eac1f6e71d86309b7d17cfe9103f7b56b2b2ecea4"
    "bn"
  end
  language "ca" do
    sha256 "87d8e1ccab315b0ddae8a68029cb7a7d7b022f0bd100391f38974a047090f5d2"
    "ca"
  end
  language "cs" do
    sha256 "13d5dbef14ab214b650471e09b0d821b2e6228cea821fd60843a7aba6f7f3620"
    "cs"
  end
  language "de" do
    sha256 "9533fedc29c28dde4d3d8c119d23d832f92e462b8a3e78e366f83df3a3e3313f"
    "de"
  end
  language "en-CA" do
    sha256 "1cd4607ee4598f388a2ba7d32976dd0743fa829498d4814d7c5a81ef0ec60ca3"
    "en-CA"
  end
  language "en-GB" do
    sha256 "67770df0c76e845beea53695390d2914f50e4d1572ed7b839ecf10d570b2ac22"
    "en-GB"
  end
  language "en", default: true do
    sha256 "42721425ca279d48b729eab8e443ce2ad83465ada46dee367d84a103791deb2a"
    "en-US"
  end
  language "eo" do
    sha256 "c8e86a04500115bc39eac942f73896941eaa18835fb463baa7cf9cf1707fce63"
    "eo"
  end
  language "es-AR" do
    sha256 "d1e72c217ede306956112f262ba4f859769221c2c29a669160f5c8430e5caecb"
    "es-AR"
  end
  language "es-CL" do
    sha256 "fd6b913f28c8486a3434dad1c1a93879ee968bacf289c3ec4f023cd9cae748d1"
    "es-CL"
  end
  language "es-ES" do
    sha256 "57ba55343162415722119a1ed25bd8e034b71512dbdbebf503eed7c0c7495058"
    "es-ES"
  end
  language "fa" do
    sha256 "575a2e04019915510df25ed80d1914c992fe137e0cf7c45bb0bf4414a14354ab"
    "fa"
  end
  language "ff" do
    sha256 "7eb5134579f46d7c389193c37b4a9c25e9db4e40b6e4b67012932c39f1a47420"
    "ff"
  end
  language "fi" do
    sha256 "1ab9daf00d92b2dc8b25e778c67d03b18de79770a9801b1f36a133355afe0d18"
    "fi"
  end
  language "fr" do
    sha256 "5f8bd38f3548c3a4c446d21287c09a7ed6c51daafa7cd5f81b405bc5c9a26069"
    "fr"
  end
  language "gl" do
    sha256 "d97be5d0ddb7c5f749a26e3540c449f34008161729e543109ba6c6eaa392127d"
    "gl"
  end
  language "gn" do
    sha256 "ea0103b10f1d0f2c0e16f631e530f8466718f3bc66e5c29e477bc4dd354544bb"
    "gn"
  end
  language "gu" do
    sha256 "098dad9cd6a93a51df3cdebda11e91b23be8a82aeaac544ca6122561dbe19064"
    "gu-IN"
  end
  language "he" do
    sha256 "aed9597c7d5902829aaa8dc558c5e27e540f0b2f07ac5b0a3ec58039a69d3aaa"
    "he"
  end
  language "hi" do
    sha256 "ab1ed4826b8d1bd84a494f39878af92c21258652b11a132856dc0d2107399547"
    "hi-IN"
  end
  language "in" do
    sha256 "ab1ed4826b8d1bd84a494f39878af92c21258652b11a132856dc0d2107399547"
    "hi-IN"
  end
  language "it" do
    sha256 "6cbb35553b644d415e3817cff546e1ef36d2d0d134a94f06fd046f3066100013"
    "it"
  end
  language "ja" do
    sha256 "033409bf14fd16d60fe3aa128ba5c80892c47aa707f438a00fc7409fb0c50684"
    "ja-JP-mac"
  end
  language "ka" do
    sha256 "e8677ebf25b17148441e4124fb72bdb85c2d9279780840d347888085f2ecb9c4"
    "ka"
  end
  language "ko" do
    sha256 "78d467f60396ac82be105c3316e36bf85919bdbb12ef30bb3e28eff43b0a1a41"
    "ko"
  end
  language "mr" do
    sha256 "a51a50791cbf68e1878c0b0880bc13916905947df21ab2c5785ff9f703d4b8b4"
    "mr"
  end
  language "my" do
    sha256 "d868c7ebc8588ae46ec3e400a1e4ae055a0df6ef18e66f10774f80a4158c2d73"
    "my"
  end
  language "ne" do
    sha256 "3874ccb536d4b9d3601c60049266526c1c315f34c51bb6d9fee1ecef01420243"
    "ne-NP"
  end
  language "nl" do
    sha256 "ed8adc72d55ea55c668a5027123f46db895024e5eae65f890b3711818075ce3c"
    "nl"
  end
  language "pa-IN" do
    sha256 "66d18cf84c1cff802f82f00b9f058b6cf3dc76dd398c324e0911b89c0cb5a278"
    "pa-IN"
  end
  language "pl" do
    sha256 "4ba91cc28f2304cc5e172303edfe2f3bfeee2ca10208c44aa157fa3f92eeff93"
    "pl"
  end
  language "pt-BR" do
    sha256 "a06f83fa4374d235a3bdb5f97b8d9444276e2e3d01f6100bbc3a3516474e1046"
    "pt-BR"
  end
  language "pt" do
    sha256 "6f806b141d92a584aa6fe5294bf1fd7cf848a9c6dabaac61a917dda97ac0e248"
    "pt-PT"
  end
  language "ru" do
    sha256 "0edf84b466f347f59e4a09e6261917cf21ad435edb8be8a0027b2449c3b7494e"
    "ru"
  end
  language "si" do
    sha256 "85f0073278325c2e6a203622c3c76e0195985df9ff1e5802e791306000fa1313"
    "si"
  end
  language "sq" do
    sha256 "6741f75a5b6b14b1fca6ee245e0865f0c786c3a79a1b490d50c7150db7c3cb09"
    "sq"
  end
  language "sr" do
    sha256 "5211906055e933e7f941f828e60d6bbf3756ed746572dc100a06b4f03b53e315"
    "sr"
  end
  language "sv" do
    sha256 "f1e43978ffe982ab7f01c1018f5b25ec449641d8f5e60ffca3cf5fc8523ab4d2"
    "sv-SE"
  end
  language "ta" do
    sha256 "dde6fe99b7a1bbe57e773678fdc0e8cecb77033e8f61e68f8a1640117af8fe99"
    "ta"
  end
  language "te" do
    sha256 "68b00d7c5c9b66646338ea36a84970d84877d2375bc9183b7f0866a2af6ea7c5"
    "te"
  end
  language "th" do
    sha256 "5f43221dd9cea2fd810281f0818a2481bee199b74166075a02183b40bdd9a300"
    "th"
  end
  language "tl" do
    sha256 "57c4b28dbd3aa3e645858095c38209d3446fb309a0bd15bbecb0f44efdac0230"
    "tl"
  end
  language "tr" do
    sha256 "0b1cd830d74a92d4c8b29467c86b2dd2714ac6340723e7b9fb5d604575a218c8"
    "tr"
  end
  language "uk" do
    sha256 "e93a07801ebe2be04a4f30065341ee217660ad5f4f39c504ae4e5c3526be7221"
    "uk"
  end
  language "ur" do
    sha256 "87e5039ce5239f8cc0b887c0ac7ff9f5e84df5ac606a65148eb72f927a7fb4e3"
    "ur"
  end
  language "zh-TW" do
    sha256 "be423e55a6be163c0489f352ec57034675f65615f3450bc31ec08a91f7a5ad36"
    "zh-TW"
  end
  language "zh" do
    sha256 "2fa8859ed218e2999176b8a0eedef59c2f43b0ad9f413f9cab5af4fc436650cb"
    "zh-CN"
  end

  url "https://download-installer.cdn.mozilla.net/pub/firefox/releases/#{version}/mac/#{language}/Firefox%20#{version}.dmg",
      verified: "download-installer.cdn.mozilla.net/pub/firefox/releases/"
  name "Mozilla Firefox"
  desc "Web browser"
  homepage "https://www.mozilla.org/firefox/"

  livecheck do
    url "https://download.mozilla.org/?product=firefox-latest-ssl&os=osx"
    strategy :header_match
  end

  auto_updates true
  conflicts_with cask: [
    "homebrew/cask-versions/firefox-beta",
    "homebrew/cask-versions/firefox-cn",
    "homebrew/cask-versions/firefox-esr",
  ]
  depends_on macos: ">= :catalina"

  app "Firefox.app"
  # shim script (https://github.com/Homebrew/homebrew-cask/issues/18809)
  shimscript = "#{staged_path}/firefox.wrapper.sh"
  binary shimscript, target: "firefox"

  preflight do
    File.write shimscript, <<~EOS
      #!/bin/bash
      exec '#{appdir}/Firefox.app/Contents/MacOS/firefox' "$@"
    EOS
  end

  uninstall quit: "org.mozilla.firefox"

  zap trash: [
        "/Library/Logs/DiagnosticReports/firefox_*",
        "~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/org.mozilla.firefox.sfl*",
        "~/Library/Application Support/CrashReporter/firefox_*",
        "~/Library/Application Support/Firefox",
        "~/Library/Caches/Firefox",
        "~/Library/Caches/Mozilla/updates/Applications/Firefox",
        "~/Library/Caches/org.mozilla.crashreporter",
        "~/Library/Caches/org.mozilla.firefox",
        "~/Library/Preferences/org.mozilla.crashreporter.plist",
        "~/Library/Preferences/org.mozilla.firefox.plist",
        "~/Library/Saved Application State/org.mozilla.firefox.savedState",
        "~/Library/WebKit/org.mozilla.firefox",
      ],
      rmdir: [
        "~/Library/Application Support/Mozilla", #  May also contain non-Firefox data
        "~/Library/Caches/Mozilla",
        "~/Library/Caches/Mozilla/updates",
        "~/Library/Caches/Mozilla/updates/Applications",
      ]
end
