var v = (t) => { throw TypeError(t); }; var h = (t, e, n) => e.has(t) || v("Cannot " + n); var m = (t, e, n) => (h(t, e, "read from private field"), n ? n.call(t) : e.get(t)), g = (t, e, n) => e.has(t) ? v("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), E = (t, e, n, s) => (h(t, e, "write to private field"), s ? s.call(t, n) : e.set(t, n), n), u = (t, e, n) => (h(t, e, "access private method"), n); import { S as r, i as k, e as S, D as F, f as R, h as B, p as z, c as P, j as b, t as H, l as U, m as G, n as j, o as N, P as V } from "./index.B_XvPxIW.js"; import { l as Y } from "./styled-components.browser.esm.BqRwOR0p.js"; import { r as C } from "./style-util.DZ2F-cWF.js"; import { _ as q, e as X } from "./en.Ct9u9Eaq.js"; import { u as Z } from "./language.DS95o8hG.js"; import { t as K } from "./tokens.CKbL8mrq.js"; import { c as W } from "./name.ycbMfsr4.js"; const J = (t) => { if (!t || t.length === 0) return ""; const e = t.toLowerCase(); return e.substring(0, 1).toUpperCase() + e.substring(1, e.length); }, T = (t) => { var n; const e = ((n = t == null ? void 0 : t.replace(/([A-Z])+/g, J)) == null ? void 0 : n.split(/(?=[A-Z])|[\.\-\s_]/).map((s) => s.toLowerCase())) ?? []; return e.length === 0 ? "" : e.length === 1 ? e[0] : e.reduce((s, i) => `${s}${i.charAt(0).toUpperCase()}${i.slice(1)}`); }, x = { name: "name", honorificPrefix: "honorific-prefix", givenName: "given-name", additionalName: "additional-name", familyName: "family-name", honorificSuffix: "honorific-suffix", nickname: "nickname", email: "email", username: "username", organizationTitle: "organization-title", organization: "organization", streetAddress: "street-address", addressLine1: "address-line1", addressLine2: "address-line2", addressLine3: "address-line3", addressLevel4: "address-level4", addressLevel3: "address-level3", addressLevel2: "address-level2", addressLevel1: "address-level1", country: "country", countryName: "country-name", postalCode: "postal-code", ccName: "cc-name", ccGivenName: "cc-given-name", ccAdditionalName: "cc-additional-name", ccFamilyName: "cc-family-name", ccNumber: "cc-number", ccExpiry: "cc-expiry", ccExpiryMonth: "cc-expiry-month", ccExpiryYear: "cc-expiry-year", ccCsc: "cc-csc", ccType: "cc-type", transactionCurrency: "transaction-currency", transactionAmount: "transaction-amount", language: "language", bday: "bday", bdayDay: "bday-day", bdayMonth: "bday-month", bdayYear: "bday-year", sex: "sex", tel: "tel", telCountryCode: "tel-country-code", telNational: "tel-national", telAreaCode: "tel-area-code", telLocal: "tel-local", telExtension: "tel-extension", url: "url", // 手動でそれっぽいやつを追加 firstName: "given-name", lastName: "family-name", zip: "postal-code", phone: "tel", birthday: "bday", state: "address-level1", province: "address-level1", region: "address-level1", prefecture: "address-level1", city: "address-level2", district: "address-level3", street: "street-address", building: "address-line1" }, Q = (t) => { if (t.autocomplete) return; let e; if (t.name && (e = x[T(t.name)]), !e && t.type && (e = x[T(t.type)]), !e && t.id && (e = x[T(t.id)]), !e && t.classList.length > 0) { for (const n of Array.from(t.classList)) if (e = x[T(n)], e) break; } e && t.setAttribute("autocomplete", e); }, tt = (t) => { k(t) && Q(t); }, et = { name: r.ADD_AUTOCOMPLETE_TO_INPUT, execute: tt }, nt = (t) => t.tabIndex < 0, st = () => { const t = (n) => { const s = n.target; if (!S(s) || nt(s)) return; window.getComputedStyle(s).outlineStyle === "none" && s.setAttribute(F, ""); }; return document.addEventListener("focusin", t), () => { document.removeEventListener("focusin", t); }; }, at = { name: r.ADD_FOCUS_VISIBLE_STYLE, register: st }, rt = 30, ot = 50, it = (t) => { const e = t.match(/[\u3040-\u309F\u30A0-\u30FF\u4E00-\u9FAF]/g), n = e ? e.length : 0, s = t.length; return n / s * 100 > ot; }, ct = () => { var n; if (document.documentElement.lang) return; const e = (((n = document.querySelector("body")) == null ? void 0 : n.textContent) || "").replace(/\s+/g, ""); e.length < rt || it(e) && (document.documentElement.lang = "ja"); }, lt = { name: r.ADD_LANG_TO_HTML, execute: ct }, mt = (t) => t.src.split(".").pop() === "svg", ut = (t) => { t.role || t.getAttribute("alt") !== "" && (t.role = "img"); }, pt = (t) => { R(t) && mt(t) && ut(t); }, dt = { name: r.ADD_ROLE_IMG_TO_SVG, execute: pt }, ft = (t) => { t.role || (t.role = "presentation"); }, gt = (t) => { B(t) && ft(t); }, yt = { name: r.ADD_ROLE_PRESENTATION_TO_BR, execute: gt }, Et = Y` input:focus, textarea:focus, select:focus { outline: 3px solid black !important; outline-offset: -2px !important; &:focus-visible { box-shadow: 0 0 0 3px rgba(255, 255, 255, .9) !important; } } input:is([type="button"], [type="checkbox"], [type="file"], [type="hidden"], [type="image"], [type="radio"], [type="reset"], [type="search"], [type="submit"]):focus, input[type="file"]:focus::file-selector-button { outline-offset: 2px !important; box-shadow: 0 0 0 7px rgba(255, 255, 255, .9) !important; } :focus-visible { outline: 3px solid black !important; outline-offset: 2px !important; box-shadow: 0 0 0 7px rgba(255, 255, 255, .9) !important; } `, Tt = () => { z(`${Et}`); }, xt = { name: r.EMPATHIZE_FOCUS, execute: Tt }, bt = () => { z(`${C}`), P(`${C}`); }, ht = { name: r.REDUCE_MOTION, execute: bt }, At = (t) => t.href !== "", Lt = (t) => t.getAttribute("tabIndex") !== null, _t = (t) => { b(t) && (At(t) || Lt(t) || (t.tabIndex = 0)); }, vt = { name: r.ADD_TABINDEX_TO_LINK, execute: _t }, Nt = "Untitled Page", Ct = () => window.location.pathname.split("/").filter(Boolean).map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" "), Ot = () => { var n, s, i; let t = document.querySelector("title"); if (t && ((n = t.textContent) == null ? void 0 : n.trim()) !== "") return; t || (t = document.createElement("title"), document.head.appendChild(t)); const e = ((s = document.querySelector("h1")) == null ? void 0 : s.textContent) || ((i = document.querySelector("h2")) == null ? void 0 : i.textContent) || Ct() || Nt; t.textContent = e; }, St = { name: r.ADD_TITLE, execute: Ot }; let A; const zt = { name: r.DEL_MISMATCH_LANG_ATTR, execute: async (t) => { A || (A = (await import("./del-mismatche-lang-attr.lazy.DAQMvPeS.js")).delMismatchLangAttr), await A(t); } }, It = async () => { const t = Z.getState().lang, [e, n] = await H(() => q(/* @__PURE__ */ Object.assign({ "./translations/ar.ts": () => import("./ar.qSaSVIYg.js"), "./translations/az.ts": () => import("./az.lyVyyiPn.js"), "./translations/bg.ts": () => import("./bg.C6Zyjmk0.js"), "./translations/bn.ts": () => import("./bn.BiAtKWbF.js"), "./translations/ca.ts": () => import("./ca.DVvjd5pN.js"), "./translations/ceb.ts": () => import("./ceb.CdEfJHcn.js"), "./translations/cs.ts": () => import("./cs.0YQASKgc.js"), "./translations/da.ts": () => import("./da.DBALG-EB.js"), "./translations/de.ts": () => import("./de.DddQXM9u.js"), "./translations/el.ts": () => import("./el.BSgPow80.js"), "./translations/en.ts": () => import("./en.Ct9u9Eaq.js").then((s) => s.a), "./translations/es.ts": () => import("./es.BAxCb1hz.js"), "./translations/eu.ts": () => import("./eu.BZnhzL0Z.js"), "./translations/fa.ts": () => import("./fa.BIuj8ouC.js"), "./translations/fi.ts": () => import("./fi.D-yzMDI-.js"), "./translations/fr.ts": () => import("./fr.ktL8QGJ6.js"), "./translations/gl.ts": () => import("./gl.DkayJriZ.js"), "./translations/gu.ts": () => import("./gu.D4Txx2ck.js"), "./translations/he.ts": () => import("./he.DggJpX7F.js"), "./translations/hi.ts": () => import("./hi.2DAnYJFZ.js"), "./translations/hr.ts": () => import("./hr.G6zrrx1Z.js"), "./translations/ht.ts": () => import("./ht.Crqh5nuJ.js"), "./translations/hu.ts": () => import("./hu.Cxm1Db28.js"), "./translations/id.ts": () => import("./id.F8MqLFYR.js"), "./translations/it.ts": () => import("./it.bq6I1uZB.js"), "./translations/ja.ts": () => import("./ja.B9q8NGyb.js"), "./translations/jv.ts": () => import("./jv.CEIp4x12.js"), "./translations/ka.ts": () => import("./ka.C6Z6anrv.js"), "./translations/km.ts": () => import("./km.CsfnPgZO.js"), "./translations/kn.ts": () => import("./kn.xBrwjjUS.js"), "./translations/ko.ts": () => import("./ko.DmhVmW24.js"), "./translations/lt.ts": () => import("./lt.D5fb8dNf.js"), "./translations/lv.ts": () => import("./lv.DTJk9t9K.js"), "./translations/ml.ts": () => import("./ml.C6D5lEUC.js"), "./translations/mn.ts": () => import("./mn.Dl31024x.js"), "./translations/mr.ts": () => import("./mr.CfXhHS7O.js"), "./translations/ms.ts": () => import("./ms.dZLOsUf9.js"), "./translations/my.ts": () => import("./my.CBcAU1Vb.js"), "./translations/ne.ts": () => import("./ne.H6zctopA.js"), "./translations/nl.ts": () => import("./nl.DjvIT7ow.js"), "./translations/no.ts": () => import("./no.CtBs6ual.js"), "./translations/pa.ts": () => import("./pa.rIxaPJ3r.js"), "./translations/pl.ts": () => import("./pl.dvu_hMce.js"), "./translations/pt.ts": () => import("./pt.BJ1vmnyr.js"), "./translations/ro.ts": () => import("./ro.FvrIE9PA.js"), "./translations/ru.ts": () => import("./ru.DDXT-oUM.js"), "./translations/si.ts": () => import("./si.BJ9xiymP.js"), "./translations/sk.ts": () => import("./sk.CeFGSG9C.js"), "./translations/sl.ts": () => import("./sl.CN90eN6B.js"), "./translations/sr.ts": () => import("./sr.BnYLHnIU.js"), "./translations/su.ts": () => import("./su.C2CwJ1VW.js"), "./translations/sv.ts": () => import("./sv.DoFIwOwG.js"), "./translations/sw.ts": () => import("./sw.o3iDSv-i.js"), "./translations/ta.ts": () => import("./ta.Cvi7FX4r.js"), "./translations/te.ts": () => import("./te.L5l4iOYN.js"), "./translations/th.ts": () => import("./th.B6W-ZkH8.js"), "./translations/tl.ts": () => import("./tl.CeqR_oLr.js"), "./translations/tr.ts": () => import("./tr.R4mN0MPh.js"), "./translations/uk.ts": () => import("./uk.WV7h7ULh.js"), "./translations/ur.ts": () => import("./ur.D9H6FBBT.js"), "./translations/uz.ts": () => import("./uz.RG55CRXn.js"), "./translations/vi.ts": () => import("./vi.BEy258uz.js"), "./translations/zh.ts": () => import("./zh.1PCsxroW.js"), "./translations/zh_TW.ts": () => import("./zh_TW.w2_Hb8C4.js") }), `./translations/${t}.ts`, 3))(); return e || (n == null ? void 0 : n[t]) === void 0 ? (console.error("Failed to import translation:", e), (s) => X[s] || s) : (s) => n[t][s] || s; }, Mt = (t) => t.target === "_blank", Dt = (t, e) => { t.getAttribute("aria-label") || t.setAttribute("aria-label", `${wt(t)} - ${e(K.common.openNewTab)}`); }, wt = (t) => { if ((t.textContent || "").trim() !== "") return t.textContent; let e = ""; const n = t.querySelectorAll("img"); for (const s of Array.from(n)) e += (e ? " " : "") + s.alt; return e !== "" ? e : ""; }, $t = async (t) => { const e = await It(); Dt(t, e); }, kt = async (t) => { b(t) && Mt(t) && await $t(t); }, Ft = { name: r.OPTIMIZE_TARGET_BLANK_LINK, execute: kt }, Rt = 100, Bt = ["x", "X", ">", "<", ">", "<"], Pt = (t) => t.hasAttribute("aria-label"), Ht = (t, e) => t.toLowerCase().includes(e.toLowerCase()), I = (t) => { let e = ""; for (const n of t.childNodes) n.nodeType === Node.TEXT_NODE ? e += n.textContent : n.nodeType === Node.ELEMENT_NODE && !j(n) && (e += I(n)); return e.trim(); }, Ut = (t) => { if (!b(t) && !U(t) || !Pt(t) || b(t) && G(t)) return; const e = W(t), n = I(t); Bt.includes(n) || n.length > Rt || e && n && !Ht(e, n) && t.setAttribute("aria-label", n); }, O = { name: r.SYNC_ACCESSIBLE_NAME_WITH_LABEL, execute: Ut }, Gt = { IMG: [dt], A: [Ft, vt, O], BR: [yt], BUTTON: [O], INPUT: [et] }, jt = { lang: [zt] }, Vt = [ ht, lt, St, xt ], Yt = [at], qt = (t) => { const e = Vt.filter((a) => !t.includes(a.name)), n = () => { for (const a of e) a.execute(); }, s = N(Gt, (a, c) => [a, c.filter((f) => !t.includes(f.name))]), i = N(jt, (a, c) => [a, c.filter((f) => !t.includes(f.name))]); return { useGlobal: n, useElement: (a) => { for (const c of s[a.tagName] || []) c.execute(a); for (const c of a.attributes) for (const f of i[c.name] || []) f.execute(a); }, registerEvent: () => { for (const a of Yt) a.register(); } }; }; var p, d, y, o, _, M, D, w; const l = class l { constructor() { g(this, o); g(this, d); g(this, y, []); E(this, d, u(this, o, M).bind(this)); } static getInstance() { return m(l, p) || E(l, p, new l()), m(l, p); } useOptimizer(e) { E(this, y, e), u(this, o, _).call(this), u(this, o, D).call(this); } }; p = new WeakMap(), d = new WeakMap(), y = new WeakMap(), o = new WeakSet(), _ = async function(e = !1) { const n = qt(m(this, y)); e || n.useGlobal(), u(this, o, w).call(this).forEach((s) => { S(s) && n.useElement(s); }), n.registerEvent(); }, M = function() { setTimeout(() => u(this, o, _).call(this, !0), 500); }, D = function() { window.addEventListener(V, m(this, d)), window.addEventListener("popstate", m(this, d)); }, w = function() { return document.querySelectorAll("body *"); }, g(l, p); let L = l; const se = L.getInstance(); export { se as SiteOptimizeController };