Add 27.0 js src

This commit is contained in:
√(noham)²
2026-09-17 13:47:07 +02:00
parent c768a1667c
commit 897293bc5f
39 changed files with 24598 additions and 1 deletions

View File

@@ -0,0 +1,177 @@
//# sourceURL=__InjectedScript_AutoFillBootstrapper.js
/* Copyright (c) 2026 Apple Inc. All rights reserved. */
"use strict";
function initAutoFillBootstrapper() {
function e(e) {
return (
e.isContentEditable && "textbox" === e.role && "true" !== e.ariaMultiLine
);
}
function t(t) {
if (t instanceof HTMLTextAreaElement) return !0;
if (e(t)) return !0;
if (!(t instanceof HTMLInputElement)) return !1;
const n = {
date: !0,
"datetime-local": !0,
email: !0,
isindex: !0,
month: !0,
number: !0,
password: !0,
search: !0,
tel: !0,
telephone: !0,
text: !0,
time: !0,
url: !0,
week: !0,
};
var a = t.type;
return !a || a in n;
}
function n(e) {
const n = e.composedPath()[0];
return t(n) ? n : null;
}
function a(e) {
const n = e.composedPath()[0];
return !t(n) || n instanceof HTMLTextAreaElement ? null : n;
}
class i {
#e = [];
#t = null;
#n(e) {
switch (e.type) {
case "webkitsubmit":
return e.target;
case "webkitautofillrequest":
case "webkitbeforefocus":
case "webkitbeforeblur":
case "keydown":
return a(e);
case "webkitusertextinput":
return n(e);
default:
return null;
}
}
processAndEnqueue(e, t = !0) {
const n = this.#n(e);
if (!n) return;
let a = null;
"keydown" === e.type && (a = { key: e.key, shiftKey: e.shiftKey });
const i = { target: n, type: e.type, data: a };
this.#t
? this.#t.dispatchEvent(i)
: (this.#e.push(i), t && o.scheduleIfNeeded());
}
setDelegate(e) {
this.#t = e;
for (const e of this.#e) this.#t.dispatchEvent(e);
this.#e.length = 0;
}
}
globalThis.eventQueue = new i();
class s {
#a = null;
#i = !1;
scheduleIfNeeded() {
this.#i ||
this.#a ||
("complete" === document.readyState
? this.requestImmediately()
: (this.#a = setTimeout(this.requestImmediately.bind(this), 100)));
}
requestImmediately() {
if (this.#i) return;
if (((this.#i = !0), (this.#a = null), !window.webkit.evaluateScript))
return void window.webkit.messageHandlers.controller.postMessage({
name: "loadMainScriptRequest",
});
const e = {
"safari://FormMetadataContactsAutoFillMappings.js":
window.webkit.buffers.FormMetadataContactsAutoFillMappings,
"safari://passwordRulesParserJS.js":
window.webkit.buffers.PasswordRulesParserJS,
"safari://PatternRegexpToPasswordRulesConverter.js":
window.webkit.buffers.PatternRegexpToPasswordRulesConverter,
"safari://FormMetadataClassification.js":
window.webkit.buffers.FormMetadataClassification,
"safari://FormMetadata.js": window.webkit.buffers.FormMetadata,
"safari://FormMetadataJSController.js":
window.webkit.buffers.FormMetadataJSController,
"safari://FormMetadataUtilities.js":
window.webkit.buffers.FormMetadataUtilities,
"safari://AutomaticPasswords.js":
window.webkit.buffers.AutomaticPasswords,
};
window.webkit.buffers.NodePath &&
(e["safari://NodePath.js"] = window.webkit.buffers.NodePath);
for (const t in e) {
let n = e[t].asLatin1String();
(AutoFillControllerConfig.isEngineeringBuild &&
(n = new TextDecoder("utf8").decode(
new Uint8Array([...n].map((e) => e.codePointAt(0))),
)),
window.webkit.evaluateScript(n, t));
}
}
}
const o = new s();
((globalThis.evaluateMainScripts = function () {
o.requestImmediately();
}),
(globalThis.addGlobalEventHandler = function (e, t, n = !1, a = !1) {
const i = [];
(n &&
i.push(function (t) {
return function (n) {
const i = n;
window.addEventListener(
e,
function (e) {
e === i && (e.defaultPrevented || t(e));
},
{ once: !0, capture: !1, webkitTrustedOnly: a },
);
};
}),
e.startsWith("webkit") &&
i.push(function (e) {
return function (t) {
(t.stopImmediatePropagation(), e(t));
};
}));
let s = t;
for (const e of i) s = e(s);
window.addEventListener(e, s, { capture: !0, webkitTrustedOnly: a });
}),
(globalThis.addEventListeners = function () {
(addGlobalEventHandler("webkitbeforefocus", (e) =>
eventQueue.processAndEnqueue(e, AutoFillControllerConfig.isMac),
),
addGlobalEventHandler("webkitbeforeblur", (e) =>
eventQueue.processAndEnqueue(e),
),
addGlobalEventHandler("webkitusertextinput", (e) =>
eventQueue.processAndEnqueue(e),
),
addGlobalEventHandler(
"keydown",
(e) => eventQueue.processAndEnqueue(e),
!0,
!0,
),
addGlobalEventHandler("webkitsubmit", (e) =>
eventQueue.processAndEnqueue(e),
),
addGlobalEventHandler("webkitautofillrequest", (e) =>
eventQueue.processAndEnqueue(e),
));
}));
}
(void 0 === globalThis.autoFillBootstrapperInited &&
(initAutoFillBootstrapper(), (globalThis.autoFillBootstrapperInited = !0)),
globalThis.addEventListeners());
0;

View File

@@ -0,0 +1,31 @@
//# sourceURL=__InjectedScript_AutomaticPasswords.js
/* Copyright (c) 2026 Apple Inc. All rights reserved. */
"use strict";
class AutomaticPasswords {
removeAutomaticPasswordElements(t, e, o) {
for (let e of t)
FormMetadataJS.removeAutomaticStrongPasswordFromPasswordElement(e);
if (!o) return;
let r = document.activeElement,
a = e ? FormMetadataJS.formControlWithUniqueID(e) : null;
(a && a.blur(), a && a === r && a.focus());
}
blurControlWithID(t) {
let e = t ? FormMetadataJS.formControlWithUniqueID(t) : null;
e && e.blur();
}
setStrongPasswordElementViewableIfAppropriate(t, e) {
for (let o of t) {
let t = FormMetadataJS.formControlWithUniqueID(o);
if (!t) return;
if ("text" === t.type)
return (
FormMetadataJSController.setInputElementAutoFilledAndViewable(t, !1),
void FormMetadataJSController.setInputElementAutofilled(t, !1)
);
FormMetadataJSController.setInputElementAutoFilledAndViewable(t, e);
}
}
}
var AutomaticPasswordsJS = new AutomaticPasswords();
0;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,923 @@
//# sourceURL=__InjectedScript_FormMetadataClassification.js
/* Copyright (c) 2026 Apple Inc. All rights reserved. */
"use strict";
function datePlaceholderParser(e) {
const t = [];
for (const o of e)
"d" !== o || t.includes("day")
? "M" !== o || t.includes("month")
? "y" !== o || t.includes("year") || t.push("year")
: t.push("month")
: t.push("day");
return e.includes("d")
? e.includes("yyyy")
? {
format: { year: "numeric", month: "2-digit", day: "2-digit" },
order: t,
}
: {
format: { year: "2-digit", month: "2-digit", day: "2-digit" },
order: t,
}
: e.includes("M")
? e.includes("yyyy")
? { format: { year: "numeric", month: "2-digit" }, order: t }
: { format: { year: "2-digit", month: "2-digit" }, order: t }
: e.includes("y")
? e.includes("yyyy")
? { format: { year: "numeric" }, order: t }
: { format: { year: "2-digit" }, order: t }
: null;
}
function referenceDateToDateFormat(e) {
let t = e.replace("12", "MM");
return (
(t = t.replace("30", "dd")),
(t = t.replace("1999", "y")),
(t = t.replace("99", "yy")),
t
);
}
function referenceDatePartsToOrderedDateFormat(e, t) {
const o = {};
let r = "";
for (const t of e)
switch (t.type) {
case "day":
o.day = "dd";
break;
case "month":
o.month = "MM";
break;
case "year":
o.year = "1999" === t.value ? "yyyy" : "yy";
break;
case "literal":
r = t.value;
}
let n = "";
for (const [e, i] of t.entries())
(o[i] && (n += o[i]), e < t.length - 1 && r && (n += r));
return n;
}
const WBSABAddressProperty = "Address",
WBSABPhoneProperty = "Phone",
_WBSABAddressZIPKey = "ZIP",
WBSFormControlMetadataDefaultMaxLength = 524288,
WBSIgnoredClassificationToken = "-sf-ignored",
WBSDateDayOrderedPartToken = "-sf-day",
WBSDateMonthOrderedPartToken = "-sf-month",
WBSDateYearOrderedPartToken = "-sf-year",
WBSGivenNameOrderedPartToken = "given-name",
WBSAdditionalNameOrderedPartToken = "additional-name",
WBSFamilyNameOrderedPartToken = "family-name",
WBSLocaleForCreditCardExpirationDate = "en-US-POSIX",
WBSCreditCardTypeClassificationToken = "cc-type",
WBSCreditCardHolderNameClassificationToken = "cc-name",
WBSCreditCardNumberClassificationToken = "cc-number",
WBSCreditCardExpirationClassificationToken = "cc-exp",
WBSCreditCardSecurityCodeClassificationToken = "cc-csc",
WBSCreditCardHolderNameClassificationDefaultOrderedParts = [
WBSGivenNameOrderedPartToken,
WBSAdditionalNameOrderedPartToken,
WBSFamilyNameOrderedPartToken,
],
WBSCreditCardExpirationClassificationDefaultOrderedParts = [
WBSDateMonthOrderedPartToken,
WBSDateYearOrderedPartToken,
],
WBSCredentialUsernameClassificationToken = "username",
WBSCredentialCurrentPasswordClassificationToken = "current-password",
WBSCredentialNewPasswordClassificationToken = "new-password",
WBSContactNameClassificationToken = "name",
WBSContactNameClassificationDefaultOrderedParts = [
WBSGivenNameOrderedPartToken,
WBSAdditionalNameOrderedPartToken,
WBSFamilyNameOrderedPartToken,
],
WBSNameOrderedPartTokensSet = new Set(
WBSContactNameClassificationDefaultOrderedParts,
),
WBSContactInstantMessageClassificationToken = "-sf-instant-message",
WBSContactPostalCodeClassificationToken = "postal-code",
WBSContactStreetAddressClassificationToken = "street-address",
WBSContactStreetAddressLine1OrderedPartToken = "address-line1",
WBSContactStreetAddressLine2OrderedPartToken = "address-line2",
WBSContactStreetAddressLine3OrderedPartToken = "address-line3",
WBSContactTelephoneClassificationToken = "tel",
WBSTelephoneCountryCodeOrderedPartToken = "tel-country-code",
WBSTelephoneAreaCodeOrderedPartToken = "tel-area-code",
WBSTelephoneLocalPrefixOrderedPartToken = "tel-local-prefix",
WBSTelephoneLocalSuffixOrderedPartToken = "tel-local-suffix",
WBSTelephoneExtensionOrderedPartToken = "tel-extension",
WBSTelephoneDefaultOrderedParts = [
WBSTelephoneCountryCodeOrderedPartToken,
WBSTelephoneAreaCodeOrderedPartToken,
WBSTelephoneLocalPrefixOrderedPartToken,
WBSTelephoneLocalSuffixOrderedPartToken,
WBSTelephoneExtensionOrderedPartToken,
],
WBSContactBirthdayClassificationToken = "bday",
WBSContactEmailClassificationToken = "email",
WBSDeviceEIDClassificationToken = "device-eid",
WBSDeviceIMEIClassificationToken = "device-imei",
WBSDeviceIMEI1ClassificationToken = "device-imei1",
WBSDeviceIMEI2ClassificationToken = "device-imei2",
WBSDeviceNALClassificationToken = "device-nal",
AllowedControlTagsForStandaloneCreditCardCompositeExpirationControl = new Set(
["input", "select", "textarea"],
);
class JSFieldLabelPatternMatcher {
constructor(e, t) {
((this.dfa = e),
(this.characters = t.toLowerCase()),
(this.allowEndOfWordMatch = e.charCodeAt(1)));
const o = e.charCodeAt(0),
r = 2,
n = 2;
this.transitionsBegin = r + n * o;
}
static transitionsEndMatchSentinel = 0;
longestMatch() {
let e,
t = 0;
const o = this.characters.length;
let r = this.search(t, o, o);
for (; r.length;) {
for (const o of r)
((!e || o.end - o.begin > e.end - e.begin) && (e = o),
(t = o.begin + 1));
r = this.search(t, o, o);
}
if (e) return [e.identifier, this.characters.substring(e.begin, e.end)];
}
searchReverse() {
let e = 0;
const t = this.characters.length;
let o,
r = this.search(e, t, t);
for (; r.length;) {
for (const t of r) ((!o || t.end > o.end) && (o = t), (e = t.begin + 1));
r = this.search(e, t, t);
}
if (o) return [o.identifier, this.characters.substring(o.begin, o.end)];
}
exactMatch() {
const e = this.characters.length,
t = this.search(0, e, 1);
for (const o of t) if (0 == o.begin && o.end == e) return o.identifier;
}
static isWordCharacter(e) {
return (
(e >= 97 && e <= 122) ||
(e >= 65 && e <= 90) ||
(e >= 48 && e <= 57) ||
95 == e
);
}
isWordBoundary(e) {
return (
!!this.characters.length &&
(0 === e
? JSFieldLabelPatternMatcher.isWordCharacter(
this.characters.charCodeAt(0),
)
: e === this.characters.length
? JSFieldLabelPatternMatcher.isWordCharacter(
this.characters.charCodeAt(e - 1),
)
: JSFieldLabelPatternMatcher.isWordCharacter(
this.characters.charCodeAt(e - 1),
) !=
JSFieldLabelPatternMatcher.isWordCharacter(
this.characters.charCodeAt(e),
))
);
}
passesWordBoundaryCheck(e, t) {
return (
!(
!this.allowEndOfWordMatch &&
JSFieldLabelPatternMatcher.isWordCharacter(
this.characters.charCodeAt(e),
) &&
!this.isWordBoundary(e)
) &&
(!JSFieldLabelPatternMatcher.isWordCharacter(
this.characters.charCodeAt(t),
) ||
this.isWordBoundary(t + 1))
);
}
search(e, t, o) {
let r = [];
for (var n = e; n < o; n++) {
let e = 0;
for (
var i = this.stateTransitionBegin(e),
a = this.stateTransitionEnd(e),
s = n;
s < t;
s++
) {
((i = this.stateTransitionBegin(e)), (a = this.stateTransitionEnd(e)));
const t = this.characters.charCodeAt(s);
let o = !1;
for (var d = i, l = a - 1; d <= l;) {
const r = ((d + l) / 2) | 0,
n = this.transitionCharacter(r);
if (n == t) {
((e = this.transitionStateIndex(r)),
(i = this.stateTransitionBegin(e)),
(a = this.stateTransitionEnd(e)),
(o = !0));
break;
}
n > t ? (l = r - 1) : (d = r + 1);
}
if (!o) break;
for (; a == JSFieldLabelPatternMatcher.transitionsEndMatchSentinel;)
(this.passesWordBoundaryCheck(n, s) &&
r.push({ identifier: i, begin: n, end: s + 1 }),
e++,
(i = this.stateTransitionBegin(e)),
(a = this.stateTransitionEnd(e)));
}
}
return r;
}
stateTransitionBegin(e) {
const t = 2,
o = 2;
return this.dfa.charCodeAt(t + o * e);
}
stateTransitionEnd(e) {
const t = 2,
o = 2;
return this.dfa.charCodeAt(t + o * e + 1);
}
transitionCharacter(e) {
const t = 2;
return this.dfa.charCodeAt(this.transitionsBegin + t * e);
}
transitionStateIndex(e) {
const t = 2;
return this.dfa.charCodeAt(this.transitionsBegin + t * e + 1);
}
}
class FormMetadataClassification {
#e(e) {
return null != e && "object" == typeof e;
}
#t(e) {
return this.#e(e) && "string" == typeof e.ControlTagName;
}
#o(e) {
return this.#e(e) && "string" == typeof e.property;
}
fieldLooksLikeDateField(e) {
return !!(
e.ControlLooksLikeDayField ||
e.ControlLooksLikeMonthField ||
e.ControlLooksLikeYearField
);
}
#r(e) {
let t = e.ControlMaxLength;
return (
(void 0 === t || t < 0 || t > WBSFormControlMetadataDefaultMaxLength) &&
(t = WBSFormControlMetadataDefaultMaxLength),
t
);
}
fieldLooksLikeItExpectsDataOfSize(e, t) {
return (e.ControlSize ?? 0) <= t || this.#r(e) <= t;
}
fieldCouldBeCreditCardNumberContinuation(e, t) {
const o = 4;
if (t.length >= o) return !1;
if (!t[0]?.ControlLooksLikeCreditCardNumberField) return !1;
const r = 2;
if (e.ControlMaxLength === r) return !1;
if (e.ControlLooksLikeCreditCardNumberField) return !0;
if (e.ControlLooksLikeCreditCardSecurityCodeField) return !1;
if (e.ControlLooksLikeCreditCardCompositeExpirationDateField) return !1;
const n = 6;
if (!this.fieldLooksLikeItExpectsDataOfSize(e, n)) return !1;
const i = t.at(-1);
return !(i && !this.fieldLooksLikeItExpectsDataOfSize(i, n));
}
labelsCouldRepresentContinuation(e, t, o, r) {
return (
!(!e || !o) &&
(e === o ||
(!!t &&
(!r ||
(t.property === r.property &&
(!r.component || t.component === r.component)))))
);
}
#n(e) {
const t = [
WBSContactStreetAddressLine1OrderedPartToken,
WBSContactStreetAddressLine2OrderedPartToken,
WBSContactStreetAddressLine3OrderedPartToken,
],
o = [
WBSContactStreetAddressLine2OrderedPartToken,
WBSContactStreetAddressLine3OrderedPartToken,
];
if (e.AutocompleteTokens)
for (let o of e.AutocompleteTokens)
switch (o) {
case "street-address":
return t;
case "address-line1":
return [WBSContactStreetAddressLine1OrderedPartToken];
case "address-line2":
case "address-level2":
return [WBSContactStreetAddressLine2OrderedPartToken];
case "address-line3":
case "address-level1":
return [WBSContactStreetAddressLine3OrderedPartToken];
}
let r = e.ControlFieldName,
n = r?.indexOf("1") ?? -1,
i = r?.indexOf("2") ?? -1;
return -1 === n
? -1 === i
? t
: o
: -1 === i || n < i
? [WBSContactStreetAddressLine1OrderedPartToken]
: o;
}
fieldCouldBePhoneNumberContinuation(e, t) {
const o = 5;
if (t.length >= o) return !1;
if (t[0]?.AddressBookValueSpecifier?.property !== WBSABPhoneProperty)
return !1;
const r = 5;
return !!this.fieldLooksLikeItExpectsDataOfSize(e, r);
}
fieldCouldBePostCodeContinuation(e, t) {
const o = 3;
if (t.length >= o) return !1;
if (t[0]?.AddressBookValueSpecifier?.component != _WBSABAddressZIPKey)
return !1;
const r = 6;
return !!this.fieldLooksLikeItExpectsDataOfSize(e, r);
}
fieldLooksLikeSameDataType(e, t) {
const o = t.at(-1);
return (
!!this.labelsCouldRepresentContinuation(
o?.AddressBookLabel,
o?.AddressBookValueSpecifier,
e?.AddressBookLabel,
e?.AddressBookValueSpecifier,
) ||
!!(
o &&
this.fieldLooksLikeDateField(o) &&
this.fieldLooksLikeDateField(e)
) ||
!!this.fieldCouldBePhoneNumberContinuation(e, t) ||
!!this.fieldCouldBePostCodeContinuation(e, t) ||
!!this.fieldCouldBeCreditCardNumberContinuation(e, t)
);
}
#i(e) {
if (
(globalThis.DOMRect ||
(globalThis.DOMRect = class {
constructor(e, t, o, r) {
((this.left = e),
(this.right = e + o),
(this.top = t),
(this.bottom = t + r),
(this.width = o),
(this.height = r));
}
}),
e.ControlRectLeft ||
e.ControlRectTop ||
e.ControlRectWidth ||
e.ControlRectHeight)
)
return new DOMRect(
e.ControlRectLeft,
e.ControlRectTop,
e.ControlRectWidth,
e.ControlRectHeight,
);
let t = globalThis.FormMetadataJS?.formControlWithUniqueID(
e.ControlUniqueID,
);
return t ? t.getBoundingClientRect() : new DOMRect(0, 0, 0, 0);
}
fieldLooksLikeContinuation(e, t, o) {
if (!e.ControlIsTextField && "SELECT" !== e.ControlTagName.toUpperCase())
return !1;
if (!this.fieldLooksLikeSameDataType(e, t)) return !1;
if (o) return !0;
const r = this.#i(t.at(-1)),
n = this.#i(e);
if (Math.abs(r.top - n.top) > 3) return !1;
let i, a;
return (
r.left < n.left ? ((i = r), (a = n)) : ((i = n), (a = r)),
!(a.left - i.right > 60)
);
}
continuingFieldsInFormControls(e, t, o, r) {
const n = [e[t]];
for (let i = t + 1; i < e.length; ++i) {
const t = e[i];
if (o && !t.ControlIsTextField) break;
if (!this.fieldLooksLikeContinuation(t, n, r)) break;
n.push(t);
}
return n;
}
classifyControlsRelatedToNameParts(e, t, o) {
const r = e[t];
((r.ControlClassification = o),
(r.ControlOrderedParts = [r.AddressBookValueSpecifier?.classification]));
const n = new Set([r.AddressBookValueSpecifier?.classification]),
i = [e[t]];
for (let r = t + 1; r < e.length; ++r) {
const t = e[r];
if (!t.ControlIsTextField) break;
const a = t.AddressBookValueSpecifier?.classification;
if (!a) break;
if (!WBSNameOrderedPartTokensSet.has(a) || n.has(a)) break;
((t.ControlClassification = o),
(t.ControlOrderedParts = [a]),
n.add(a),
i.push(t));
}
return i;
}
identifyDateFields(e) {
let t,
o,
r,
n = !1;
for (let i of e)
if (i.ControlLooksLikeDayField) {
if (t) return [!1, null, null, null];
((t = i), (n = !0));
} else if (i.ControlLooksLikeMonthField) {
if (o) return [!1, null, null, null];
((o = i), (n = !0));
} else if (i.ControlLooksLikeYearField) {
if (r) return [!1, null, null, null];
((r = i), (n = !0));
}
return [n, r, o, t];
}
canonicalizedDateTemplate(e) {
if (!e) return;
if (!(e = e.replace(/\s/g, "")).length) return;
const t = [
{
dateFormatCharactersRegex: /^[dmy\/.-]*$/i,
dayRegex: /D/g,
monthRegex: /m/g,
yearRegex: /Y/g,
},
{
dateFormatCharactersRegex: /^[jma\/.-]*$/i,
dayRegex: /j/gi,
monthRegex: /m/g,
yearRegex: /a/gi,
},
{
dateFormatCharactersRegex: /^[dma\/.-]*$/i,
dayRegex: /D/g,
monthRegex: /m/g,
yearRegex: /a/gi,
},
{
dateFormatCharactersRegex: /^[tmj\/.-]*$/i,
dayRegex: /t/gi,
monthRegex: /m/g,
yearRegex: /j/gi,
},
{
dateFormatCharactersRegex: /^[gma\/.-]*$/i,
dayRegex: /g/gi,
monthRegex: /m/g,
yearRegex: /a/gi,
},
];
for (const {
dateFormatCharactersRegex: o,
dayRegex: r,
monthRegex: n,
yearRegex: i,
} of t)
if (o.test(e))
return (e = (e = (e = e.replace(r, "d")).replace(n, "M")).replace(
i,
"y",
));
}
classifyDateFields(e, t, o, r, n, i, a) {
if (e.length > 3) return !1;
if ((a || (a = navigator.language), 1 === e.length)) {
if (!e[0].ControlIsTextField) return !1;
let i = e[0].ControlRequiredFormatForDateTimeInput;
if (!i) {
const t = new Date(1999, 11, 30);
let o = this.#r(e[0]),
r = this.canonicalizedDateTemplate(e[0].ControlPlaceholder),
s = "";
if (r?.length) {
const e = datePlaceholderParser(r);
if (e) {
const o = new Intl.DateTimeFormat(a, e.format);
s = o.format(t);
i = referenceDatePartsToOrderedDateFormat(
o.formatToParts(t),
e.order,
);
}
}
if (!s || s.length > o) {
const e = n
? [
{ year: "numeric", month: "2-digit", day: "2-digit" },
{ year: "2-digit", month: "2-digit", day: "2-digit" },
]
: [{ year: "2-digit", month: "2-digit" }];
for (const r of e)
if (
((s = new Intl.DateTimeFormat(a, r).format(t)),
(i = referenceDateToDateFormat(s)),
s.length <= o)
)
break;
}
if (s.length > o) return !1;
}
const s = [];
for (const e of i) {
let t;
("y" === e ? (t = o) : "M" === e ? (t = r) : "d" === e && (t = n),
t && !s.includes(t) && s.push(t));
}
return (
(e[0].ControlClassification = t),
(e[0].ControlOrderedParts = s),
(e[0].ControlRequiredFormatForDateTimeInput = i),
!0
);
}
let [s, d, l, c] = this.identifyDateFields(e);
if (!s) return !1;
if (c && !l) return !1;
let C = 0;
for (const a of e)
((a.ControlClassification = t),
(a.ControlContinuationID = i),
(a.ControlContinuationIndex = C++),
a === c
? (a.ControlOrderedParts = [n])
: a === l
? (a.ControlOrderedParts = [r])
: a === d && (a.ControlOrderedParts = [o]));
return !0;
}
static specifierForAutocompleteTokensAndAddressBookLabel(e, t) {
if (e) {
if (!Array.isArray(e))
throw new Error("Expected an array of autocomplete tokens");
for (let t of e) {
const e = new JSFieldLabelPatternMatcher(
FormMetadataJSController.autocompleteTokenMapDFA(),
t,
).exactMatch();
if (void 0 !== e) return FormMetadataJSController.getValueSpecifiers(e);
}
}
if (t) {
const e = new JSFieldLabelPatternMatcher(
FormMetadataJSController.fieldLabelMapDFA(),
t,
).exactMatch();
if (void 0 !== e) return FormMetadataJSController.getValueSpecifiers(e);
}
return null;
}
classify(e) {
const t = e.FormControls,
o = t.length,
r = e.AutoFillFormType === WBSAutoFillFormTypeNewAccount,
n = e.AutoFillFormType === WBSAutoFillFormTypeChangePassword,
i = e.UsernameElementUniqueID,
a = e.PasswordElementUniqueID,
s = e.OldPasswordElementUniqueID,
d = e.ConfirmPasswordElementUniqueID;
for (let e of t)
(e.AutocompleteTokens || e.AddressBookLabel) &&
(e.AddressBookValueSpecifier =
FormMetadataClassification.specifierForAutocompleteTokensAndAddressBookLabel(
e.AutocompleteTokens,
e.AddressBookLabel,
));
let l = !1,
c = !1,
C = !1,
f = !1,
h = !1,
u = 0;
for (let k = 0, S = 1; k < o; k += S, S = 1) {
const o = t[k];
if (o.ControlLooksLikeIgnoredDataTypeField) {
o.ControlClassification = WBSIgnoredClassificationToken;
continue;
}
const T = o.ControlUniqueID;
if (T === a || T === d) {
o.ControlClassification =
r || n
? WBSCredentialNewPasswordClassificationToken
: WBSCredentialCurrentPasswordClassificationToken;
continue;
}
if (T === s) {
o.ControlClassification =
WBSCredentialCurrentPasswordClassificationToken;
continue;
}
const B = o.AddressBookValueSpecifier?.classification;
if (B === WBSContactEmailClassificationToken) {
o.ControlClassification = WBSContactEmailClassificationToken;
continue;
}
if (T === i) {
o.ControlClassification = WBSCredentialUsernameClassificationToken;
continue;
}
if (!c && o.ControlLooksLikeCreditCardCardholderField) {
if (((c = !0), B && WBSNameOrderedPartTokensSet.has(B))) {
const e = this.classifyControlsRelatedToNameParts(
t,
k,
WBSCreditCardHolderNameClassificationToken,
);
if (e.length > 1) {
let t = ++u,
o = 0;
for (let r of e)
((r.ControlContinuationID = t),
(r.ControlContinuationIndex = o++));
}
S = e.length;
continue;
}
((o.ControlClassification = WBSCreditCardHolderNameClassificationToken),
(o.ControlOrderedParts =
WBSCreditCardHolderNameClassificationDefaultOrderedParts));
continue;
}
if (!l && o.ControlLooksLikeCreditCardNumberField) {
l = !0;
const e = this.continuingFieldsInFormControls(t, k, !0, !1);
let o = 0,
r = e.length > 1 ? ++u : 0;
for (let t of e)
((t.ControlClassification = WBSCreditCardNumberClassificationToken),
(t.ControlContinuationID = r),
(t.ControlContinuationIndex = o++));
S = e.length;
continue;
}
const g =
this.fieldLooksLikeDateField(o) ||
o.ControlLooksLikeCreditCardCompositeExpirationDateField;
if (!C && g) {
let e = f || c || l;
if (
((e ||=
!o.ControlLooksLikeOneTimeCodeField &&
1 ===
t.filter((e) =>
AllowedControlTagsForStandaloneCreditCardCompositeExpirationControl.has(
e.ControlTagName.toLowerCase(),
),
).length),
e)
) {
C = !0;
const e = this.continuingFieldsInFormControls(t, k, !1, !0);
let o = e.length > 1 ? ++u : 0;
(this.classifyDateFields(
e,
WBSCreditCardExpirationClassificationToken,
WBSDateYearOrderedPartToken,
WBSDateMonthOrderedPartToken,
void 0,
o,
WBSLocaleForCreditCardExpirationDate,
),
(S = e.length));
continue;
}
}
if (h || !o.ControlLooksLikeCreditCardSecurityCodeField)
if (f || !o.ControlLooksLikeCreditCardTypeField)
if (B) {
const r = o.AddressBookValueSpecifier.classificationHint;
if (B === WBSContactNameClassificationToken) {
((o.ControlClassification = B),
(o.ControlOrderedParts =
WBSContactNameClassificationDefaultOrderedParts));
continue;
}
if (WBSNameOrderedPartTokensSet.has(B)) {
const e = this.classifyControlsRelatedToNameParts(
t,
k,
WBSContactNameClassificationToken,
);
if (e.length > 1) {
let t = ++u,
o = 0;
for (let r of e)
((r.ControlContinuationID = t),
(r.ControlContinuationIndex = o++));
}
S = e.length;
continue;
}
if (B === WBSContactPostalCodeClassificationToken) {
const e = this.continuingFieldsInFormControls(t, k, !0, !1);
let o = e.length > 1 ? ++u : 0,
r = 0;
for (let t of e)
((t.ControlClassification =
WBSContactPostalCodeClassificationToken),
(t.ControlContinuationID = o),
(t.ControlContinuationIndex = r++));
S = e.length;
continue;
}
if (B === WBSContactStreetAddressClassificationToken) {
const e = this.continuingFieldsInFormControls(t, k, !0, !0);
let o = e.length > 1 ? ++u : 0,
r = 0;
for (let t of e)
((t.ControlClassification =
WBSContactStreetAddressClassificationToken),
(t.ControlContinuationID = o),
(t.ControlContinuationIndex = r++));
if (1 === e.length) {
let t = e[0];
t.ControlOrderedParts = this.#n(t);
} else
2 === e.length
? ((e[0].ControlOrderedParts = [
WBSContactStreetAddressLine1OrderedPartToken,
]),
(e[1].ControlOrderedParts = [
WBSContactStreetAddressLine2OrderedPartToken,
WBSContactStreetAddressLine3OrderedPartToken,
]))
: e.length >= 3 &&
((e[0].ControlOrderedParts = [
WBSContactStreetAddressLine1OrderedPartToken,
]),
(e[1].ControlOrderedParts = [
WBSContactStreetAddressLine2OrderedPartToken,
]),
(e[2].ControlOrderedParts = [
WBSContactStreetAddressLine3OrderedPartToken,
]));
S = e.length;
continue;
}
if (B === WBSContactInstantMessageClassificationToken) {
const e = this.continuingFieldsInFormControls(t, k, !0, !0);
(1 === e.length &&
((e[0].ControlClassification =
WBSContactInstantMessageClassificationToken),
r && (e[0].ControlClassificationHints = [r])),
(S = e.length));
continue;
}
if (B.startsWith(WBSContactTelephoneClassificationToken)) {
const e = this.continuingFieldsInFormControls(t, k, !0, !1);
if (1 == e.length) {
((e[0].ControlClassification =
WBSContactTelephoneClassificationToken),
(e[0].ControlOrderedParts = WBSTelephoneDefaultOrderedParts),
r && (e[0].ControlClassificationHints = [r]));
continue;
}
let o = ++u,
n = 0;
for (let t of e)
((t.ControlClassification =
WBSContactTelephoneClassificationToken),
(t.ControlContinuationID = o),
(t.ControlContinuationIndex = n++),
r && (t.ControlClassificationHints = [r]));
(2 === e.length
? ((e[0].ControlOrderedParts = [
WBSTelephoneAreaCodeOrderedPartToken,
]),
(e[1].ControlOrderedParts = [
WBSTelephoneLocalPrefixOrderedPartToken,
WBSTelephoneLocalSuffixOrderedPartToken,
]))
: 3 === e.length
? ((e[0].ControlOrderedParts = [
WBSTelephoneAreaCodeOrderedPartToken,
]),
(e[1].ControlOrderedParts = [
WBSTelephoneLocalPrefixOrderedPartToken,
]),
(e[2].ControlOrderedParts = [
WBSTelephoneLocalSuffixOrderedPartToken,
]))
: 4 === e.length
? ((e[0].ControlOrderedParts = [
WBSTelephoneCountryCodeOrderedPartToken,
]),
(e[1].ControlOrderedParts = [
WBSTelephoneAreaCodeOrderedPartToken,
]),
(e[2].ControlOrderedParts = [
WBSTelephoneLocalPrefixOrderedPartToken,
]),
(e[3].ControlOrderedParts = [
WBSTelephoneLocalSuffixOrderedPartToken,
]))
: ((e[0].ControlOrderedParts = [
WBSTelephoneCountryCodeOrderedPartToken,
]),
(e[1].ControlOrderedParts = [
WBSTelephoneAreaCodeOrderedPartToken,
]),
(e[2].ControlOrderedParts = [
WBSTelephoneLocalPrefixOrderedPartToken,
]),
(e[3].ControlOrderedParts = [
WBSTelephoneLocalSuffixOrderedPartToken,
]),
(e[4].ControlOrderedParts = [
WBSTelephoneExtensionOrderedPartToken,
])),
(S = e.length));
continue;
}
if (B === WBSContactBirthdayClassificationToken) {
const o = this.continuingFieldsInFormControls(t, k, !1, !1),
r = o.length > 1 ? ++u : void 0,
n =
e.RequestType === WBSFormMetadataRequestTesting
? "en-US"
: void 0;
(this.classifyDateFields(
o,
WBSContactBirthdayClassificationToken,
WBSDateYearOrderedPartToken,
WBSDateMonthOrderedPartToken,
WBSDateDayOrderedPartToken,
r,
n,
),
(S = o.length));
continue;
}
o.ControlClassification = B;
} else
o.ControlLooksLikeEIDField
? (o.ControlClassification = WBSDeviceEIDClassificationToken)
: o.ControlLooksLikeIMEIField
? (o.ControlClassification = WBSDeviceIMEIClassificationToken)
: o.ControlLooksLikeIMEI1Field
? (o.ControlClassification =
WBSDeviceIMEI1ClassificationToken)
: o.ControlLooksLikeIMEI2Field
? (o.ControlClassification =
WBSDeviceIMEI2ClassificationToken)
: o.ControlLooksLikeNALField &&
(o.ControlClassification =
WBSDeviceNALClassificationToken);
else
((f = !0),
(o.ControlClassification = WBSCreditCardTypeClassificationToken));
else
((h = !0),
(o.ControlClassification =
WBSCreditCardSecurityCodeClassificationToken));
}
return e;
}
}
globalThis.FormMetadataClassificationJS = new FormMetadataClassification();
0;

View File

@@ -0,0 +1,309 @@
//# sourceURL=__InjectedScript_FormMetadataContactsAutoFillMappings.js
/* Copyright (c) 2026 Apple Inc. All rights reserved. */
// Copyright (C) 2018-2025 Apple Inc. All rights reserved.
function newAddressBookFieldLabelPatternMatchers() {
return [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.addressBookFieldLabelPatternMatchers0,
),
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.addressBookFieldLabelPatternMatchers1,
),
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.addressBookFieldLabelPatternMatchers2,
),
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.addressBookFieldLabelPatternMatchers3,
),
];
}
function newEmailFieldLabelPatternMatchers() {
return [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.emailFieldLabelPatternMatchers,
),
];
}
class ValueSpecifier {
constructor(e, n, l, a, t, s, r) {
((this.property = e),
(this.component = n),
(this.label = l),
(this.category = a),
(this.parentProperty = t),
(this.classification = s),
(this.classificationHint = r));
}
}
var valueSpecifiers = [
new ValueSpecifier(
"FullNameComposite",
null,
null,
"FullNameComposite",
null,
"name",
null,
),
new ValueSpecifier(
"First",
null,
null,
"First",
"FullNameComposite",
"given-name",
null,
),
new ValueSpecifier(
"Middle",
null,
null,
"Middle",
"FullNameComposite",
"additional-name",
null,
),
new ValueSpecifier(
"Last",
null,
null,
"Last",
"FullNameComposite",
"family-name",
null,
),
new ValueSpecifier("Birthday", null, null, "Birthday", null, "bday", null),
new ValueSpecifier(
"JobTitle",
null,
null,
"JobTitle",
null,
"organization-title",
null,
),
new ValueSpecifier("Email", null, null, "Email", null, "email", null),
new ValueSpecifier(
"Address",
"Street",
null,
"AddressStreet",
null,
"street-address",
null,
),
new ValueSpecifier(
"Address",
"City",
null,
"AddressCity",
null,
"address-level2",
null,
),
new ValueSpecifier(
"Address",
"State",
null,
"AddressState",
null,
"address-level1",
null,
),
new ValueSpecifier(
"Address",
"ZIP",
null,
"AddressZIP",
null,
"postal-code",
null,
),
new ValueSpecifier(
"Address",
"Country",
null,
"AddressCountry",
null,
"country",
null,
),
new ValueSpecifier(
"Phone",
null,
null,
"Phone",
null,
"tel-area-code",
null,
),
new ValueSpecifier("Phone", null, null, "Phone", null, "tel", null),
new ValueSpecifier(
"Organization",
null,
null,
"Organization",
null,
"organization",
null,
),
new ValueSpecifier(
"URLs",
null,
"_$!<HomePage>!$_",
"URLs_$!<HomePage>!$_",
null,
"url",
null,
),
new ValueSpecifier(
"Phone",
null,
"_$!<Home>!$_",
"Phone_$!<Home>!$_",
null,
"tel",
"home",
),
new ValueSpecifier(
"Phone",
null,
"_$!<Work>!$_",
"Phone_$!<Work>!$_",
null,
"tel",
"work",
),
new ValueSpecifier(
"Phone",
null,
"_$!<Mobile>!$_",
"Phone_$!<Mobile>!$_",
null,
"tel",
"mobile",
),
new ValueSpecifier(
"Phone",
null,
"_$!<Pager>!$_",
"Phone_$!<Pager>!$_",
null,
"tel",
"pager",
),
new ValueSpecifier("Phone", null, null, "Phone", null, "tel", "fax"),
new ValueSpecifier("<Invalid>", null, null, "<Invalid>", null, null, null),
new ValueSpecifier(
"InstantMessage",
"AIMInstant",
null,
"InstantMessageAIMInstant",
null,
"-sf-instant-message",
"-sf-aim",
),
new ValueSpecifier(
"InstantMessage",
"ICQInstant",
null,
"InstantMessageICQInstant",
null,
"-sf-instant-message",
"-sf-icq",
),
new ValueSpecifier(
"InstantMessage",
"JabberInstant",
null,
"InstantMessageJabberInstant",
null,
"-sf-instant-message",
"-sf-jabber",
),
new ValueSpecifier(
"InstantMessage",
"MSNInstant",
null,
"InstantMessageMSNInstant",
null,
"-sf-instant-message",
"-sf-msn",
),
new ValueSpecifier(
"InstantMessage",
"QQInstant",
null,
"InstantMessageQQInstant",
null,
"-sf-instant-message",
"-sf-qq",
),
new ValueSpecifier(
"InstantMessage",
"SkypeInstant",
null,
"InstantMessageSkypeInstant",
null,
"-sf-instant-message",
"-sf-skype",
),
],
FormAutoFillKeywords = {
NonAutoFillableFormTypeRegularExpressions: ["[\\b-]import[\\b-]"],
LoginFormTypeKeywords: {
"@me": 1,
"welcome back": 1,
"log on": 1,
log_on: 1,
"sign on": 1,
login: 1,
signon: 1,
"log in": 1,
"sign in": 1,
signin: 1,
"forgot user": 1,
"enter your current password": 2,
"enter your password": 2,
reauth: 2,
"\u767b\u5f55": 1,
"\u767b\u5165": 1,
"iniciar sesi\xf3n": 1,
anmelden: 1,
absenden: 1,
connexion: 1,
"logg inn": 1,
"\u0e40\u0e02\u0e49\u0e32\u0e2a\u0e39\u0e48\u0e23\u0e30\u0e1a\u0e1a": 1,
},
NewAccountFormTypeKeywords: {
"set up": 1,
setup: 1,
signup: 1,
"sign up": 1,
create: 1,
"create account": 1,
"create an account": 1,
enrollment: 1,
reg: 1,
activate: 1,
"\u6ce8\u518c": 1,
"\u0e2a\u0e21\u0e31\u0e04\u0e23\u0e2a\u0e21\u0e32\u0e0a\u0e34\u0e01": 1,
},
ChangePasswordFormTypeKeywords: {
forgotpassword: 1,
"forgot password": 1,
reset: 1,
update: 1,
change: 1,
"\u518d\u8a2d\u5b9a": 1,
cambiar: 1,
},
ForgotPasswordAffordanceRegularExpressions: [
"^forgot.*password",
"^log.*in.*email",
"request.*password",
],
ForgotUserNameAffordanceRegularExpressions: ["^forgot.*user.*name"],
ForgotEmailAffordanceRegularExpressions: ["^forgot.*email", "email\\?$"],
};
0;

View File

@@ -0,0 +1,657 @@
//# sourceURL=__InjectedScript_FormMetadataJSController.js
/* Copyright (c) 2026 Apple Inc. All rights reserved. */
"use strict";
const WBSMinimumLogicalWidthToShowManualAutoFillButton = 100,
WKInputFieldActionTypeMoveUp = 0,
WKInputFieldActionTypeMoveDown = 1,
WKInputFieldActionTypeCancel = 2,
WKInputFieldActionTypeInsertTab = 3,
WKInputFieldActionTypeInsertBacktab = 4,
WKInputFieldActionTypeInsertNewline = 5,
WKInputFieldActionTypeInsertDelete = 6,
textDidChangeCoalescingTime = 100;
class FormMetadataFieldPatternMatcher {
searchRegularExpression;
constructor(e) {
this.buffer = e;
}
dfa() {
return this.buffer.asUTF16String();
}
}
class FormMetadataJSController {
static isDebugConsoleLoggingEnabled =
AutoFillControllerConfig.isDebugConsoleLoggingEnabled;
static collectAllFields = AutoFillControllerConfig.collectAllFields;
static _nextControlUniqueID = 1;
static get nextControlUniqueID() {
return this._nextControlUniqueID++;
}
static _nextFormUniqueID = 1;
static get nextFormUniqueID() {
return this._nextFormUniqueID++;
}
static regularExpressionsIndicatingNonAutoFillableFormType =
FormAutoFillKeywords.NonAutoFillableFormTypeRegularExpressions;
static loginFormTypePatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.keywordsIndicatingLoginFormTypeToScoreForMatching,
),
];
static oneTimeCodeFieldLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.oneTimeCodeFieldLabels,
),
];
static nonAccountPasswordSecureTextEntryFieldLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.nonAccountPasswordSecureTextEntryFieldLabels,
),
];
static ignoredDataTypeFieldLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.ignoredDataTypeFieldLabels,
),
];
static genericAdditionalClassificationLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.genericAdditionalClassificationLabels,
),
];
static additionalClassificationControlLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.additionalClassificationControlLabels,
),
];
static oldPasswordFieldLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.oldPasswordFieldLabels,
),
];
static confirmPasswordFieldLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.confirmPasswordFieldLabels,
),
];
static confirmEmailFieldLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.confirmEmailFieldLabels,
),
];
static showHideButtonLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.showHideButtonLabels,
),
];
static searchFieldLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.searchFieldLabels,
),
];
static nonUsernameFieldLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.nonUsernameFieldLabels,
),
];
static passwordFieldLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.passwordFieldLabels,
),
];
static usernameFieldLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.usernameFieldLabels,
),
];
static nonEmailFieldLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.nonEmailFieldLabels,
),
];
static weakOneTimeCodeFieldLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.WeakOneTimeCodeFieldLabels,
),
];
static codeButNotOneTimeCodeFieldLabelsPatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.CodeButNotOneTimeCodeFieldLabels,
),
];
static dayFieldLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(window.webkit.buffers.dayFieldLabels),
];
static monthFieldLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(window.webkit.buffers.monthFieldLabels),
];
static yearFieldLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(window.webkit.buffers.yearFieldLabels),
];
static addressBookFieldLabelPatternMatchers =
newAddressBookFieldLabelPatternMatchers();
static emailFieldLabelPatternMatchers = newEmailFieldLabelPatternMatchers();
static creditCardNumberFieldLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.creditCardNumberFieldLabels,
),
];
static creditCardSecurityCodeFieldLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.creditCardSecurityCodeFieldLabels,
),
];
static creditCardCardholderFieldLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.creditCardCardholderFieldLabels,
),
];
static creditCardTypeFieldLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.creditCardTypeFieldLabels,
),
];
static nonCreditCardCardNumberFieldLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.nonCreditCardCardNumberFieldLabels,
),
];
static creditCardCompositeExpirationDateFieldLabelPatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.creditCardCompositeExpirationDateFieldLabels,
),
];
static newAccountFormTypePatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers
.keywordsIndicatingNewAccountFormTypeToScoreForMatching,
),
];
static federatedSignInAffordancePatternMatchers = [
new FormMetadataFieldPatternMatcher(
window.webkit.buffers.federatedSignInAffordanceLabels,
),
];
static mapOfKeywordsIndicatingLoginFormTypeToScoreForMatching =
FormAutoFillKeywords.LoginFormTypeKeywords;
static mapOfKeywordsIndicatingNewAccountFormTypeToScoreForMatching =
FormAutoFillKeywords.NewAccountFormTypeKeywords;
static mapOfKeywordsIndicatingChangePasswordFormTypeToScoreForMatching =
FormAutoFillKeywords.ChangePasswordFormTypeKeywords;
static regularExpressionsForForgotPasswordAffordance =
FormAutoFillKeywords.ForgotPasswordAffordanceRegularExpressions;
static regularExpressionsForForgotUserNameAffordance =
FormAutoFillKeywords.ForgotUserNameAffordanceRegularExpressions;
static regularExpressionsForForgotEmailAffordance =
FormAutoFillKeywords.ForgotEmailAffordanceRegularExpressions;
autoFillButtonManager;
focusManager;
didAssociateFormControlsTimeout;
constructor() {
((this.focusManager = new FocusManager(this)),
this.focusManager.addEventListeners(),
(this.autoFillButtonManager = new AutoFillButtonManager(this)),
this.autoFillButtonManager.addEventListeners(),
(this.didAssociateFormControlsTimeout = null),
addGlobalEventHandler(
"webkitassociateformcontrols",
this.didAssociateFormControls.bind(this),
),
(this.shouldNotifyOnFormChanges = !1),
window.addEventListener("pagehide", () => {
this.focusManager.cleanUp();
let e = null;
(document.activeElement instanceof HTMLInputElement &&
(e = FormMetadataJS.textFieldOrSelectElementMetadata(
document.activeElement,
WBSFormMetadataRequestNormal,
)[0]),
window.webkit.messageHandlers.controller.postMessage({
name: "pageHide",
focusedControlMetadata: e,
}));
}));
}
didAssociateFormControls(e) {
if (!this.shouldNotifyOnFormChanges) return;
if (this.didAssociateFormControlsTimeout) return;
const t = e.composedPath()[0];
if ("hidden" === t.type || "button" === t.type) return;
const [a, o] = FormMetadataJS.formsAndMetadata(
WBSFormMetadataRequestPreFill,
);
this.didAssociateFormControlsTimeout = setTimeout(
this.sendDidAssociateFormControlsMessage.bind(this),
0,
);
}
sendDidAssociateFormControlsMessage() {
((this.didAssociateFormControlsTimeout = null),
window.webkit.messageHandlers.controller.postMessage({
name: "didAssociateFormControls",
}));
}
textEditingStatus() {
const [e, t] = FormMetadataJS.visibleNonEmptyFormTextControls(),
a = e.filter((e) => e.lastChangeWasUserEdit),
o = t.filter((e) => e.lastChangeWasUserEdit),
r = document.body.onbeforeunload,
n = null != r;
return {
numberOfTextInputElements: a.length,
numberOfTextAreaElements: o.length,
hasOnBeforeUnloadEventHandler: n,
};
}
async fillFormWithPassword(e, t, a, o) {
const r = await FormMetadataJS.fillFormWithPassword(e, a, t);
if (r)
for (const e of r) {
const t = FormMetadataJS.formControlWithUniqueID(e);
t && (t.autofillVisibility = o ? "hidden" : "visible");
}
o && AutomaticPasswordsJS.blurControlWithID(t);
let n = null;
const i = FormMetadataJS.formsAndMetadata(WBSFormMetadataRequestNormal)[1];
for (const t of i)
if (t.FormID === e) {
n = t;
break;
}
return { controlIDs: r, formMetadata: n };
}
static #e(e) {
const t = getComputedStyle(e).writingMode,
a = !("horizontal-tb" === t || "horizontal-bt" === t),
o = e.getBoundingClientRect();
return (
(a ? o.height : o.width) >=
WBSMinimumLogicalWidthToShowManualAutoFillButton
);
}
static #t(e) {
return !!FormMetadataJSController.#e(e) && e === innermostActiveElement();
}
static autocompleteTokenMapDFA() {
return window.webkit.buffers.autocompleteTokenMapMatcher.asUTF16String();
}
static fieldLabelMapDFA() {
return window.webkit.buffers.fieldLabelMapMatcher.asUTF16String();
}
static getValueSpecifiers(e) {
return valueSpecifiers[e];
}
showAutoFillButtonInControl(e, t) {
const a = FormMetadataJS.formControlWithUniqueID(e);
(FormMetadataJSController.#t(a) || "none" === t) &&
a._setAutofillButtonType(t);
}
hideAutoFillButtonInControl(e) {
FormMetadataJS.formControlWithUniqueID(e)._setAutofillButtonType("none");
}
setAutofillAvailable(e, t) {
const a = FormMetadataJS.formControlWithUniqueID(e);
a && (a.autofillAvailable = t);
}
setControlsAsAutoFilled(e, t) {
this.#a(e).forEach((e) => {
FormMetadataJSController.setInputElementAutofilled(e, t);
});
}
blurControls(e) {
this.#a(e).forEach((e) => e.blur());
}
clearControls(e) {
e.forEach((e) => FormMetadataJS.clearField(e));
}
annotateForm(e, t) {
FormMetadataJS.annotateFormWithID(e, t);
}
formsMetadata(e) {
(e !== WBSFormMetadataRequestPreFill &&
e !== WBSFormMetadataRequestTesting) ||
(this.shouldNotifyOnFormChanges = !0);
let [t, a] = FormMetadataJS.formsAndMetadata(e);
for (const e of a)
for (const t of e.FormControls) {
const e = FormMetadataJS.formControlWithUniqueID(t.ControlUniqueID);
this.populateRectFieldsInFormElementMetadata(t, e);
}
return a;
}
getMetadataForFocusedElement(e = WBSFormMetadataRequestNormal) {
const t = innermostActiveElement();
return t ? this._getMetadataForControl(t, e) : [null, null];
}
getMetadataForControl(e, t = WBSFormMetadataRequestNormal) {
const a = FormMetadataJS.formControlWithUniqueID(e);
return a ? this._getMetadataForControl(a, t) : [null, null];
}
static #o(e) {
let t = 0;
const a = e.FirstCreditCardCardholderFieldOrCreditCardNumberFieldUniqueID,
o = e.UserNameElementUniqueID,
r = e.PasswordElementUniqueID,
n = e.ConfirmPasswordElementUniqueID,
i = 1,
l = 10;
if ((a && (t += i), o && (t += i), r && (t += i), n && (t += i), !t))
return t;
for (const i of e.FormControls) {
const e = i.ControlUniqueID;
if (e === a || e === o || e === r || e === n) {
i.ControlValue && (t += l);
}
}
return t;
}
getMetadataForForm(e) {
const [t, a] = FormMetadataJS.formsAndMetadata(
WBSFormMetadataRequestNormal,
);
let o = -1,
r = null;
for (let n = 0; n < t.length; n++)
if (t[n] === e) {
const e = a[n],
t = FormMetadataJSController.#o(e);
t > o && ((o = t), (r = e));
}
return r;
}
_getMetadataForControl(e, t) {
let [a, o] = FormMetadataJS.textFieldOrSelectElementMetadata(e, t);
return (this.populateRectFieldsInFormElementMetadata(a, e), [a, o]);
}
focusControl(e, t = !1) {
FormMetadataJS.focusControl(e, t);
}
replaceRangeInControl(e, t, a, o, r) {
FormMetadataJS.replaceFormFieldRangeAndSelectTail(e, t, a, o, r);
const n = FormMetadataJS.formControlWithUniqueID(e);
if (n)
return FormMetadataJS.textFieldOrSelectElementMetadata(
n,
WBSFormMetadataRequestNormal,
);
}
selectRangeInControl(e, t, a) {
FormMetadataJS.setFormFieldSelection(e, t, a);
}
static setInputElementSpellCheckEnabled(e, t) {
e.autofillSpellcheck = !!t;
}
static setInputElementAutofilled(e, t) {
((e.autofilled = t),
t && FormMetadataJSController.autoFilledFieldWithMetadata(e));
}
static setInputElementAutoFilledAndViewable(e, t) {
e.autofilledAndViewable = t;
}
static setInputElementAutofilledAndObscured(e, t) {
((e.autofilledAndObscured = t),
t && FormMetadataJSController.autoFilledFieldWithMetadata(e));
}
populateRectFieldsInFormElementMetadata(e, t) {
const a = t.getBoundingClientRect();
((e.ControlRectLeft = a.left),
(e.ControlRectTop = a.top),
(e.ControlRectWidth = a.width),
(e.ControlRectHeight = a.height));
}
#a(e) {
return e.flatMap((e) => FormMetadataJS.formControlWithUniqueID(e));
}
static autoFilledFieldWithMetadata(e) {
let [t, a] = FormMetadataJS.textFieldOrSelectElementMetadata(
e,
WBSFormMetadataRequestNormal,
);
window.webkit.messageHandlers.controller.postMessage({
name: "autoFilledFieldWithMetadata",
controlMetadata: t,
formMetadata: a,
});
}
static logicalFormObservedChangeIndicatingFormSubmission(e, t) {
window.webkit.messageHandlers.controller.postMessage({
name: "formObservedChangeIndicatingFormSubmission",
formMetadata: e,
removedControlsMetadata: t,
});
}
static logicalFormObservedNewControlsWereAdded(e) {
window.webkit.messageHandlers.controller.postMessage({
name: "formObservedNewControlsWereAdded",
formMetadata: e,
});
}
static fieldLabelToInfo(e) {
if (void 0 === e) return null;
const [t, a] = e;
if (t === 65535) return [a, "", "", ""];
const o = valueSpecifiers[t];
return [a, o.property, o.category, o.parentProperty];
}
}
class FieldMovementChecker {
textField;
textFieldMetadata;
formMetadata;
numberOfTimesFieldMovementTimerHasFired;
checkForFieldMovementTimeout;
pollingIntervals;
onFieldMoved;
constructor(e) {
((this.textField = null),
(this.textFieldMetadata = null),
(this.numberOfTimesFieldMovementTimerHasFired = 0),
(this.checkForFieldMovementTimeout = null),
(this.pollingIntervals = [10, 50, 100, 850]),
(this.onFieldMoved = e));
}
setTextFieldToMonitor(e, t, a) {
((this.textField = e),
(this.textFieldMetadata = t),
(this.formMetadata = a));
}
performNextCheckForFieldMovement() {
if (
((this.checkForFieldMovementTimeout = null),
!this.textField || !this.textFieldMetadata)
)
return void this.reset();
const e = this.textField.getBoundingClientRect();
(this.textFieldMetadata.ControlRectLeft != e.left ||
this.textFieldMetadata.ControlRectTop != e.top ||
this.textFieldMetadata.ControlRectWidth != e.width ||
this.textFieldMetadata.ControlRectHeight != e.height
? (this.onFieldMoved(
this.textField,
this.textFieldMetadata,
this.formMetadata,
),
(this.numberOfTimesFieldMovementTimerHasFired = 0))
: (this.numberOfTimesFieldMovementTimerHasFired += 1),
this.numberOfTimesFieldMovementTimerHasFired >=
this.pollingIntervals.length
? this.reset()
: this.scheduleNextCheckForFieldMovement());
}
reset() {
(this.checkForFieldMovementTimeout &&
window.clearTimeout(this.checkForFieldMovementTimeout),
(this.checkForFieldMovementTimeout = null));
}
scheduleNextCheckForFieldMovement() {
this.reset();
const e =
this.pollingIntervals[this.numberOfTimesFieldMovementTimerHasFired];
this.checkForFieldMovementTimeout = window.setTimeout(
this.performNextCheckForFieldMovement.bind(this),
e,
);
}
}
class EventDispatcher {
#r = new Map();
addGlobalListener(e, t) {
(this.#r.has(e) || this.#r.set(e, new Set()), this.#r.get(e).add(t));
}
dispatchEvent(e) {
if (this.#r.has(e.type))
for (const t of this.#r.get(e.type)) t(e.target, e.data);
}
}
const formMetadataEventDispatcher = new EventDispatcher();
class FocusManager {
jsController;
fieldMovementChecker;
#n = null;
constructor(e) {
((this.jsController = e),
(this.fieldMovementChecker = new FieldMovementChecker(
this.handleElementFocused.bind(this),
)));
}
addEventListeners() {
(formMetadataEventDispatcher.addGlobalListener(
"webkitsubmit",
this.submitEventHandler.bind(this),
),
formMetadataEventDispatcher.addGlobalListener(
"webkitbeforefocus",
this.focusInEventHandler.bind(this),
),
formMetadataEventDispatcher.addGlobalListener(
"webkitbeforeblur",
this.focusOutEventHandler.bind(this),
),
formMetadataEventDispatcher.addGlobalListener(
"webkitusertextinput",
this.inputEventHandler.bind(this),
),
formMetadataEventDispatcher.addGlobalListener(
"keydown",
this.keydownEventHandler.bind(this),
));
}
focusInEventHandler(e) {
this.fieldMovementChecker.reset();
let [t, a] = FormMetadataJS.textFieldOrSelectElementMetadata(
e,
WBSFormMetadataRequestNormal,
);
t &&
(e.setUserInfo({ form: a, textField: t }),
this.fieldMovementChecker.setTextFieldToMonitor(e, t, a),
this.fieldMovementChecker.scheduleNextCheckForFieldMovement(),
this.handleElementFocused(e, t, a));
}
handleElementFocused(e, t, a) {
(this.jsController.populateRectFieldsInFormElementMetadata(t, e),
window.webkit.messageHandlers.controller.postMessage({
name: "elementFocused",
focusedElementMetadata: t,
formMetadata: a,
}));
}
focusOutEventHandler(e) {
this.fieldMovementChecker.reset();
let [t, a] = FormMetadataJS.textFieldOrSelectElementMetadata(
e,
WBSFormMetadataRequestNormal,
);
t &&
window.webkit.messageHandlers.controller.postMessage({
name: "elementBlurred",
focusedElementMetadata: t,
formMetadata: a,
});
}
cleanUp() {
this.#n && (clearTimeout(this.#n), (this.#n = null));
}
inputEventHandler(e) {
(this.#n && clearTimeout(this.#n),
(this.#n = setTimeout(() => {
this.#i(e);
}, textDidChangeCoalescingTime)));
}
#i(e) {
let [t, a] = FormMetadataJS.textFieldOrSelectElementMetadata(
e,
WBSFormMetadataRequestTextChange,
);
t &&
(this.jsController.populateRectFieldsInFormElementMetadata(t, e),
window.webkit.messageHandlers.controller.postMessage({
name: "elementInput",
focusedElementMetadata: t,
formMetadata: a,
}));
}
static #l(e, t) {
switch (e) {
case "ArrowUp":
return WKInputFieldActionTypeMoveUp;
case "ArrowDown":
return WKInputFieldActionTypeMoveDown;
case "Escape":
return WKInputFieldActionTypeCancel;
case "Tab":
return t
? WKInputFieldActionTypeInsertBacktab
: WKInputFieldActionTypeInsertTab;
case "Enter":
return WKInputFieldActionTypeInsertNewline;
case "Backspace":
return WKInputFieldActionTypeInsertDelete;
default:
return null;
}
}
keydownEventHandler(e, t) {
const a = FocusManager.#l(t.key, t.shiftKey);
if (null === a) return;
const [o, r] = this.jsController._getMetadataForControl(
e,
WBSFormMetadataRequestNormal,
);
window.webkit.messageHandlers.controller.postMessage({
name: "observedActionInFormTextField",
action: a,
controlMetadata: o,
formMetadata: r,
});
}
submitEventHandler(e) {
const t = this.jsController.getMetadataForForm(e);
e.setUserInfo(t);
}
}
class AutoFillButtonManager {
jsController;
constructor(e) {
this.jsController = e;
}
addEventListeners() {
formMetadataEventDispatcher.addGlobalListener(
"webkitautofillrequest",
this.webKitAutofillRequestEventHandler.bind(this),
);
}
webKitAutofillRequestEventHandler(e) {
let [t, a] = this.jsController._getMetadataForControl(
e,
WBSFormMetadataRequestNormal,
);
window.webkit.messageHandlers.controller.postMessage({
name: "manualAutoFillRequest",
focusedElementMetadata: t,
formMetadata: a,
});
}
}
let formMetadataJSController = new FormMetadataJSController();
eventQueue.setDelegate(formMetadataEventDispatcher);
0;

View File

@@ -0,0 +1,43 @@
//# sourceURL=__InjectedScript_FormMetadataUtilities.js
/* Copyright (c) 2026 Apple Inc. All rights reserved. */
// Copyright (c) 2025 Apple Inc. All rights reserved.
"use strict";
globalThis.FormMetadataUtilitiesJS = class {
static #t(t, e) {
const n = /([A-Za-z0-9])/;
let o = null,
s = -1,
i = -1;
const l = t.replaceAll(".", "").toLowerCase();
for (let t = 0; t < e.length; t++) {
const r = e[t].replaceAll(".", "").toLowerCase(),
a = r.indexOf(l);
if (-1 === a) continue;
if (a > 0 && n.test(r.charAt(a - 1))) continue;
let c = a + l.length;
(c < r.length && n.test(r.charAt(c))) ||
((!o || r.length < o.length) && ((o = r), (s = t), (i = a)));
}
return { index: s, startPosition: i };
}
static bestIndexToFillSelectControl(t, e) {
const n = t.length,
o = [];
for (let e = 0; e < n; e++) {
const n = t[e][1];
o.push(n);
}
let s = -1,
i = Number.MAX_SAFE_INTEGER;
for (let t = e.length - 1; t >= 0; t--) {
const n = e[t];
Number.MAX_SAFE_INTEGER;
const l = this.#t(n, o);
-1 !== l.index &&
l.startPosition < i &&
((i = l.startPosition), (s = l.index));
}
return -1 === s ? -1 : t[s][0];
}
};
0;

View File

@@ -0,0 +1,387 @@
//# sourceURL=__InjectedScript_PasswordRulesParserJS.js
/* Copyright (c) 2026 Apple Inc. All rights reserved. */
// Copyright (c) 2019 - 2026 Apple Inc. Licensed under MIT License.
"use strict";
function _isIdentifierCharacter(e) {
return (e >= "a" && e <= "z") || (e >= "A" && e <= "Z") || "-" === e;
}
function _isASCIIDigit(e) {
return e >= "0" && e <= "9";
}
function _isASCIIPrintableCharacter(e) {
return e >= " " && e <= "~";
}
function _isASCIIWhitespace(e) {
return " " === e || "\f" === e || "\n" === e || "\r" === e || "\t" === e;
}
function _bitSetIndexForCharacter(e) {
return e.codePointAt(0) - SPACE_CODE_POINT;
}
function _characterAtBitSetIndex(e) {
return String.fromCodePoint(e + SPACE_CODE_POINT);
}
function _markBitsForNamedCharacterClass(e, r) {
r.name === Identifier.UPPER
? e.fill(
!0,
_bitSetIndexForCharacter("A"),
_bitSetIndexForCharacter("Z") + 1,
)
: r.name === Identifier.LOWER
? e.fill(
!0,
_bitSetIndexForCharacter("a"),
_bitSetIndexForCharacter("z") + 1,
)
: r.name === Identifier.DIGIT
? e.fill(
!0,
_bitSetIndexForCharacter("0"),
_bitSetIndexForCharacter("9") + 1,
)
: r.name === Identifier.SPECIAL &&
(e.fill(
!0,
_bitSetIndexForCharacter(" "),
_bitSetIndexForCharacter("/") + 1,
),
e.fill(
!0,
_bitSetIndexForCharacter(":"),
_bitSetIndexForCharacter("@") + 1,
),
e.fill(
!0,
_bitSetIndexForCharacter("["),
_bitSetIndexForCharacter("`") + 1,
),
e.fill(
!0,
_bitSetIndexForCharacter("{"),
_bitSetIndexForCharacter("~") + 1,
));
}
function _markBitsForCustomCharacterClass(e, r) {
for (let t of r.characters) e[_bitSetIndexForCharacter(t)] = !0;
}
function _canonicalizedPropertyValues(e, r) {
function t(e, r) {
let t = [];
for (
let n = _bitSetIndexForCharacter(e);
n <= _bitSetIndexForCharacter(r);
++n
)
a[n] && t.push(_characterAtBitSetIndex(n));
let i =
t.length ===
_bitSetIndexForCharacter(r) - _bitSetIndexForCharacter(e) + 1;
return (i || (n = n.concat(t)), i);
}
let a = new Array("~".codePointAt(0) - " ".codePointAt(0) + 1);
for (let r of e)
if (r instanceof NamedCharacterClass) {
if (r.name === Identifier.UNICODE)
return [new NamedCharacterClass(Identifier.UNICODE)];
if (r.name === Identifier.ASCII_PRINTABLE)
return [new NamedCharacterClass(Identifier.ASCII_PRINTABLE)];
_markBitsForNamedCharacterClass(a, r);
} else
r instanceof CustomCharacterClass &&
_markBitsForCustomCharacterClass(a, r);
let n = [],
i = t("A", "Z"),
l = t("a", "z"),
s = t("0", "9"),
u = !1,
c = !1,
o = !1,
_ = [];
for (
let e = _bitSetIndexForCharacter(" ");
e <= _bitSetIndexForCharacter("/");
++e
) {
if (!a[e]) continue;
let t = _characterAtBitSetIndex(e);
r && "-" === t ? (c = !0) : _.push(t);
}
for (
let e = _bitSetIndexForCharacter(":");
e <= _bitSetIndexForCharacter("@");
++e
)
a[e] && _.push(_characterAtBitSetIndex(e));
for (
let e = _bitSetIndexForCharacter("[");
e <= _bitSetIndexForCharacter("`");
++e
) {
if (!a[e]) continue;
let t = _characterAtBitSetIndex(e);
r && "]" === t ? (o = !0) : _.push(t);
}
for (
let e = _bitSetIndexForCharacter("{");
e <= _bitSetIndexForCharacter("~");
++e
)
a[e] && _.push(_characterAtBitSetIndex(e));
(c && _.unshift("-"), o && _.push("]"));
let C =
_bitSetIndexForCharacter("/") -
_bitSetIndexForCharacter(" ") +
1 +
(_bitSetIndexForCharacter("@") - _bitSetIndexForCharacter(":") + 1) +
(_bitSetIndexForCharacter("`") - _bitSetIndexForCharacter("[") + 1) +
(_bitSetIndexForCharacter("~") - _bitSetIndexForCharacter("{") + 1);
((u = _.length === C), u || (n = n.concat(_)));
let h = [];
return i && l && s && u
? [new NamedCharacterClass(Identifier.ASCII_PRINTABLE)]
: (i && h.push(new NamedCharacterClass(Identifier.UPPER)),
l && h.push(new NamedCharacterClass(Identifier.LOWER)),
s && h.push(new NamedCharacterClass(Identifier.DIGIT)),
u && h.push(new NamedCharacterClass(Identifier.SPECIAL)),
n.length && h.push(new CustomCharacterClass(n)),
h);
}
function _indexOfNonWhitespaceCharacter(e, r = 0) {
let t = e.length;
for (; r < t && _isASCIIWhitespace(e[r]);) ++r;
return r;
}
function _parseIdentifier(e, r) {
let t = e.length,
a = [];
do {
let t = e[r];
if (!_isIdentifierCharacter(t)) break;
(a.push(t), ++r);
} while (r < t);
return [a.join(""), r];
}
function _isValidRequiredOrAllowedPropertyValueIdentifier(e) {
return e && Object.values(Identifier).includes(e.toLowerCase());
}
function _parseCustomCharacterClass(e, r) {
let t = e.length;
if (++r >= t) return [null, r];
let a = r,
n = [];
do {
let t = e[r];
if (_isASCIIPrintableCharacter(t)) {
if ("-" === t && r - a > 0) ++r;
else if ((n.push(t), ++r, t === CHARACTER_CLASS_END_SENTINEL)) break;
} else ++r;
} while (r < t);
if (
(r < t && e[r] !== CHARACTER_CLASS_END_SENTINEL) ||
(r == t && e[r - 1] == CHARACTER_CLASS_END_SENTINEL)
) {
if ((n.pop(), r < t)) {
let t = e[r];
_isASCIIWhitespace(t);
}
return [n, r];
}
return r < t && e[r] == CHARACTER_CLASS_END_SENTINEL ? [n, r + 1] : [null, r];
}
function _parsePasswordRequiredOrAllowedPropertyValue(e, r) {
let t = e.length,
a = [];
for (;;) {
if (_isIdentifierCharacter(e[r])) {
let t = r;
var [n, r] = _parseIdentifier(e, r);
if (!_isValidRequiredOrAllowedPropertyValueIdentifier(n))
return [null, t];
a.push(new NamedCharacterClass(n));
} else {
if (e[r] != CHARACTER_CLASS_START_SENTINEL) return [null, r];
var [n, r] = _parseCustomCharacterClass(e, r);
n && n.length && a.push(new CustomCharacterClass(n));
}
if (
(r = _indexOfNonWhitespaceCharacter(e, r)) >= t ||
e[r] === PROPERTY_SEPARATOR
)
break;
if (e[r] !== PROPERTY_VALUE_SEPARATOR) return [null, r];
if ((r = _indexOfNonWhitespaceCharacter(e, r + 1)) >= t) return [null, r];
}
return [a, r];
}
function _parsePasswordRule(e, r) {
let t = e.length;
var a = r,
[n, r] = _parseIdentifier(e, r);
if (!Object.values(RuleName).includes(n)) return [null, a];
if (r >= t) return [null, r];
if (e[r] !== PROPERTY_VALUE_START_SENTINEL) return [null, r];
let i = { name: n, value: null };
if (
(r = _indexOfNonWhitespaceCharacter(e, r + 1)) >= t ||
e[r] === PROPERTY_SEPARATOR
)
return [new Rule(i.name, i.value), r];
switch (n) {
case RuleName.ALLOWED:
case RuleName.REQUIRED:
var [l, r] = _parsePasswordRequiredOrAllowedPropertyValue(e, r);
return (l && (i.value = l), [new Rule(i.name, i.value), r]);
case RuleName.MAX_CONSECUTIVE:
var [l, r] = _parseMaxConsecutivePropertyValue(e, r);
return (l && (i.value = l), [new Rule(i.name, i.value), r]);
case RuleName.MIN_LENGTH:
case RuleName.MAX_LENGTH:
var [l, r] = _parseMinLengthMaxLengthPropertyValue(e, r);
return (l && (i.value = l), [new Rule(i.name, i.value), r]);
}
}
function _parseMinLengthMaxLengthPropertyValue(e, r) {
return _parseInteger(e, r);
}
function _parseMaxConsecutivePropertyValue(e, r) {
return _parseInteger(e, r);
}
function _parseInteger(e, r) {
if (!_isASCIIDigit(e[r])) return [null, r];
let t = e.length,
a = 0;
do {
((a = 10 * a + parseInt(e[r], 10)), ++r);
} while (r < t && e[r] !== PROPERTY_SEPARATOR && _isASCIIDigit(e[r]));
return r >= t || e[r] === PROPERTY_SEPARATOR ? [a, r] : [null, r];
}
function _parsePasswordRulesInternal(e) {
let r = [],
t = e.length;
for (var a = _indexOfNonWhitespaceCharacter(e); a < t;) {
if (!_isIdentifierCharacter(e[a])) return r;
var [n, a] = _parsePasswordRule(e, a);
if (
(n && n.value && r.push(n),
(a = _indexOfNonWhitespaceCharacter(e, a)) >= t)
)
break;
if (e[a] !== PROPERTY_SEPARATOR) return null;
if ((a = _indexOfNonWhitespaceCharacter(e, a + 1)) >= t) return r;
}
return r;
}
function parsePasswordRules(e, r) {
let t = _parsePasswordRulesInternal(e) || [],
a = r,
n = [],
i = [],
l = null,
s = 0,
u = null;
for (let e of t)
switch (e.name) {
case RuleName.MAX_CONSECUTIVE:
l = l ? Math.min(e.value, l) : e.value;
break;
case RuleName.MIN_LENGTH:
s = Math.max(e.value, s);
break;
case RuleName.MAX_LENGTH:
u = u ? Math.min(e.value, u) : e.value;
break;
case RuleName.REQUIRED:
((e.value = _canonicalizedPropertyValues(e.value, r)),
n.push(e),
a || (i = i.concat(e.value)));
break;
case RuleName.ALLOWED:
i = i.concat(e.value);
}
return (
(i = _canonicalizedPropertyValues(i, a)),
a ||
i.length ||
(i = [new NamedCharacterClass(Identifier.ASCII_PRINTABLE)]),
i.length && n.push(new Rule(RuleName.ALLOWED, i)),
null !== l && n.push(new Rule(RuleName.MAX_CONSECUTIVE, l)),
s > 0 && n.push(new Rule(RuleName.MIN_LENGTH, s)),
null !== u && n.push(new Rule(RuleName.MAX_LENGTH, u)),
n
);
}
console ||
(console = {
assert: function () {},
error: function () {},
warn: function () {},
});
const Identifier = {
ASCII_PRINTABLE: "ascii-printable",
DIGIT: "digit",
LOWER: "lower",
SPECIAL: "special",
UNICODE: "unicode",
UPPER: "upper",
},
RuleName = {
ALLOWED: "allowed",
MAX_CONSECUTIVE: "max-consecutive",
REQUIRED: "required",
MIN_LENGTH: "minlength",
MAX_LENGTH: "maxlength",
},
HTMLEntity = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#x27;",
},
CHARACTER_CLASS_START_SENTINEL = "[",
CHARACTER_CLASS_END_SENTINEL = "]",
PROPERTY_VALUE_SEPARATOR = ",",
PROPERTY_SEPARATOR = ";",
PROPERTY_VALUE_START_SENTINEL = ":",
SPACE_CODE_POINT = " ".codePointAt(0),
SHOULD_NOT_BE_REACHED = "Should not be reached";
class Rule {
constructor(e, r) {
((this._name = e), (this.value = r));
}
get name() {
return this._name;
}
toString() {
return JSON.stringify(this);
}
}
class NamedCharacterClass {
constructor(e) {
this._name = e;
}
get name() {
return this._name.toLowerCase();
}
toString() {
return this._name;
}
toHTMLString() {
return this._name;
}
}
class CustomCharacterClass {
constructor(e) {
this._characters = e;
}
get characters() {
return this._characters;
}
toString() {
return `[${this._characters.join("")}]`;
}
toHTMLString() {
return `[${this._characters.join("").replace(/[&<>"']/g, (e) => HTMLEntity[e])}]`;
}
}
0;

View File

@@ -0,0 +1,152 @@
//# sourceURL=__InjectedScript_PatternRegexpToPasswordRulesConverter.js
/* Copyright (c) 2026 Apple Inc. All rights reserved. */
// Copyright (c) 2026 Apple Inc. Licensed under MIT License.
"use strict";
class PatternRegexpToPasswordRulesConverter {
static convert(t) {
try {
return this.#t(t);
} catch (t) {
return null;
}
}
static #t(t) {
const e = this.#e(t),
r = this.#r(e);
if (r) return r;
let s = e;
const a = this.#s(s);
if (((s = this.#a(s)), !this.#n(a))) return null;
const n = s.match(/^\.[\*\+]?(?:\{(\d+),(\d*)\})?$/);
if (n) {
const t = this.#l(a),
{ min: e, max: r } = this.#i(n, 1, 2);
return this.#c(t, null, e, r);
}
const l = s.match(/^\[((?:[^\]\\]|\\.)*)\](?:\{(\d+),(\d*)\})?$/);
if (!l) return null;
const i = this.#l(a),
c = this.#o(l, i),
{ min: o, max: u } = this.#i(l, 2, 3);
return this.#c(i, c, o, u);
}
static #e(t) {
let e = t.trim();
return (
e.startsWith("^") && (e = e.substring(1)),
e.endsWith("$") &&
!e.endsWith("\\$") &&
(e = e.substring(0, e.length - 1)),
e
);
}
static #r(t) {
return "\\d*" === t || "\\d+" === t || "[0-9]*" === t || "[0-9]+" === t
? "required: digit;"
: "[a-z]*" === t || "[a-z]+" === t
? "required: lower;"
: "[A-Z]*" === t || "[A-Z]+" === t
? "required: upper;"
: null;
}
static #s(t) {
const e = [],
r = /\(\?=\.\*(?:\[((?:[^\]\\]|\\.)*)\]|(\\[dDwWsS]))\)/g;
let s;
for (; (s = r.exec(t));)
void 0 !== s[1] ? e.push(s[1]) : e.push(this.#u(s[2]));
return e;
}
static #n(t) {
for (const e of t)
for (const t of ["(?", "|", "\\D", "\\W", "\\S", "\\s"])
if (e.includes(t)) return !1;
return !0;
}
static #l(t) {
const e = [];
for (let r of t) {
((r = r.replace(/\\d/g, "0-9")), (r = r.replace(/\\w/g, "a-zA-Z0-9_")));
const t = [];
let s = r;
(s.includes("0-9") && (t.push("digit"), (s = s.replace(/0-9/g, ""))),
s.includes("A-Z") && (t.push("upper"), (s = s.replace(/A-Z/g, ""))),
s.includes("a-z") && (t.push("lower"), (s = s.replace(/a-z/g, ""))),
(s = s.replace(/[a-zA-Z0-9]/g, "")),
t.length > 0 && 0 === s.length
? e.push(t.join(", "))
: 0 === t.length && s.length > 0
? e.push(this.#h(s))
: t.length > 0 &&
s.length > 0 &&
(t.push(this.#h(s)), e.push(t.join(", "))));
}
return e;
}
static #u(t) {
return { "\\d": "0-9", "\\w": "a-zA-Z0-9_" }[t] || t;
}
static #a(t) {
let e = t.replace(/\(\?=\.\*\[((?:[^\]\\]|\\.)*)\]\)/g, "");
return ((e = e.replace(/\(\?=\.\*(\\[dDwWsS])\)/g, "")), e);
}
static #h(t) {
let e = t.replace(/\\\]/g, "]").split(""),
r = !1,
s = !1,
a = [];
for (const t of e) "-" === t ? (r = !0) : "]" === t ? (s = !0) : a.push(t);
let n = "";
return (r && (n += "-"), (n += a.join("")), s && (n += "]"), `[${n}]`);
}
static #o(t, e) {
let r = t[1];
const s = [];
((r = r.replace(/\\d/g, "0-9")), (r = r.replace(/\\w/g, "a-zA-Z0-9_")));
const a = (t) => e.some((e) => e === t || e.split(", ").includes(t));
(r.includes("a-z") && !a("lower") && s.push("lower"),
r.includes("A-Z") && !a("upper") && s.push("upper"),
r.includes("0-9") && !a("digit") && s.push("digit"));
let n = r;
if (
((n = n.replace(/a-z/g, "")),
(n = n.replace(/A-Z/g, "")),
(n = n.replace(/0-9/g, "")),
(n = n.replace(/[a-zA-Z0-9]/g, "")),
(n = n.replace(/\\(.)/g, "$1")),
n)
) {
const t = this.#h(n),
r = (t) => {
const e = t.match(/^\[(.*)\]$/);
return e ? "[" + [...e[1]].sort().join("") + "]" : t;
};
e.some((e) => r(e) === r(t)) || s.push(t);
}
return s.length ? s.join(", ") : null;
}
static #i(t, e, r) {
let s = null,
a = null;
if (t[e]) {
const r = parseInt(t[e], 10);
isNaN(r) || (s = r);
}
if (t[r]) {
const e = parseInt(t[r], 10);
isNaN(e) || (a = e);
}
return { min: s, max: a };
}
static #c(t, e, r, s) {
const a = [];
for (const e of t) a.push(`required: ${e}`);
return (
e && a.push(`allowed: ${e}`),
null !== r && a.push(`minlength: ${r}`),
null !== s && a.push(`maxlength: ${s}`),
a.join("; ") + ";"
);
}
}
0;