Answered
How can I ensure newly created object styles are unique?
Object styles seem to allow duplicate names as long as they're in different groups.
The condition
"if(!d.objectStyles.itemByName(a1).isValid)" doesn't appear to check for "a1" within its own group.
Instead, it requires this approach:
if(!d.objectStyleGroups.itemByName(“AA”).objectStyles.itemByName(a1).isValid))
Since I don't know all group names, is there a way to check if the style `a1` exists in any group or outside all groups?

