@aiquants/auth-react-router 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/admin.mjs CHANGED
@@ -1,2 +1,2 @@
1
- var R={title:"Users & Groups",locale:"en-US",timeZone:"UTC",heading:"\u{1F464} User administration",common:{add:"Add",create:"Create",edit:"Edit",delete:"Delete",save:"Save",cancel:"Cancel",actions:"Actions",status:"Status",id:"ID",readOnly:"Read-only",managedUpstream:"Managed upstream",idTemplate:"#{id}",none:"-"},errors:{forbidden:"You do not have permission for this operation."},permissions:{label:"Your permissions:",canWrite:"Editable",canRead:"Read only",none:"No access",unknown:"Unknown"},tabs:{users:"\u{1F464} Users",groups:"\u{1F465} Groups",groupMembers:"\u{1F517} Members",allowlist:"\u2709\uFE0F Allowlist",directory:"\u{1F504} Directory"},usersView:{title:"Users",searchPlaceholder:"Search by name or email...",searchLabel:"Search users",addUser:"\uFF0B Add user",editUser:"Edit user",displayName:"Name",email:"Email",active:"Active",inactive:"Inactive",activate:"Activate",deactivate:"Deactivate",editUserAria:"Edit {user}",activateAria:"Activate {user}",deactivateAria:"Deactivate {user}",confirmDeactivate:"Deactivate this user? They will no longer be able to sign in.",empty:"No matching users"},groupsView:{emptyFiltered:"No group matches this search",title:"Groups",searchPlaceholder:"Search by group name or key...",searchLabel:"Search groups",addGroup:"\uFF0B Add group",editGroup:"Edit group",groupKey:"Group key",name:"Name",description:"Description",memberCountTemplate:"{count} members",confirmDelete:"Delete this group?",noDescription:"No description",groupKeyPlaceholder:"e.g. dev-team",namePlaceholder:"e.g. Development team",empty:"No groups registered"},groupMembersView:{title:"Group members",selectGroup:"Select a group",selectPrompt:"Select a group to manage its members",actionAdd:"Add",actionRemove:"Remove",actionAddAria:"Add {user} to this group",actionRemoveAria:"Remove {user} from this group",upstreamNotice:"Membership of this group is owned by the upstream directory. Edit it there \u2014 a local change would be reverted at the next synchronization.",membersOfTemplate:"Members of {group}",groupKeyLabel:"Group key"},allowlistView:{title:"Sign-in allowlist",addEntry:"\uFF0B Add pattern",pattern:"Pattern (e.g. @example.com or user@example.com)",type:"Type",emailType:"Exact email match",domainType:"Domain match",emailTypeShort:"Email",domainTypeShort:"Domain",groupTypeShort:"Group",target:"Target",description:"Description",deploymentOwner:"Deployment-wide",confirmDelete:"Remove this allowlist entry? Anyone who could sign in only through it will be locked out.",deleteAria:"Remove the allowlist entry for {target}",empty:"No allowlist entries registered"},directoryView:{title:"Directory synchronization",source:"Source",localSource:"Local",membershipMode:"Membership",directMode:"Direct only",transitiveMode:"Nested expanded",lastSynced:"Last synced",neverSynced:"Never",unresolvedTemplate:"{count} unresolved",syncPaused:"Paused",syncEnabled:"Active",syncNow:"Sync now",syncQueued:"Queued",staleWarning:"Synchronization is overdue. Until it runs, people removed upstream keep their access.",disabledWarning:"Directory synchronization is not wired for this deployment. Existing memberships remain in force and are no longer being refreshed.",pausedTemplate:"{paused} of {total} links are paused",erroredTemplate:"Last synchronization failed for {groups}",erroredItemTemplate:"{group}: {reason}",listSeparator:", ",oldestSyncedTemplate:"oldest successful sync: {at}",pendingTemplate:"{count} sync requests are queued",nothingToLink:"Every group is already linked to a directory.",notWiredNotice:"Directory synchronization is not wired for this deployment, so links cannot be created or changed here.",syncNowAria:"Synchronize {group} now",pauseAria:"Pause synchronization of {group}",resumeAria:"Resume synchronization of {group}",allowGroupAria:"Allow members of {group} to sign in",disallowGroupAria:"Stop allowing members of {group} to sign in",unlinkAria:"Unlink {group} from the directory",confirmDisallow:"Stop allowing this group to sign in? Anyone who could sign in only through it will be locked out.",link:"Link to a directory group",unlink:"Unlink",externalKey:"Upstream group",empty:"No groups are linked to a directory",erroredWarning:"Last synchronization failed for",oldestSyncedAt:"Oldest successful sync",selectGroup:"Group to link",externalKeyPlaceholder:"e.g. dev-team@example.com",confirmUnlink:"Unlink this group? Its member ledger and group-based sign-in permission are removed.",pause:"Pause",resume:"Resume",allowGroup:"Allow sign-in",disallowGroup:"Stop allowing sign-in",groupOptionTemplate:"{name} ({key})"}},ge={title:"\u30E6\u30FC\u30B6\u30FC\u30FB\u30B0\u30EB\u30FC\u30D7\u7BA1\u7406",locale:"ja-JP",timeZone:"Asia/Tokyo",heading:"\u{1F464} \u30E6\u30FC\u30B6\u30FC\u7BA1\u7406",common:{add:"\u8FFD\u52A0",create:"\u4F5C\u6210",edit:"\u7DE8\u96C6",delete:"\u524A\u9664",save:"\u4FDD\u5B58",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",actions:"\u64CD\u4F5C",status:"\u72B6\u614B",id:"ID",readOnly:"\u5909\u66F4\u4E0D\u53EF",managedUpstream:"\u4E0A\u6D41\u304C\u6240\u6709",idTemplate:"#{id}",none:"-"},errors:{forbidden:"\u3053\u306E\u64CD\u4F5C\u3092\u884C\u3046\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002"},permissions:{label:"\u3042\u306A\u305F\u306E\u6A29\u9650:",canWrite:"\u7DE8\u96C6\u53EF",canRead:"\u95B2\u89A7\u306E\u307F",none:"\u6A29\u9650\u306A\u3057",unknown:"\u6A29\u9650\u4E0D\u660E"},tabs:{users:"\u{1F464} \u30E6\u30FC\u30B6\u30FC\u4E00\u89A7",groups:"\u{1F465} \u30E6\u30FC\u30B6\u30FC\u30B0\u30EB\u30FC\u30D7",groupMembers:"\u{1F517} \u30B0\u30EB\u30FC\u30D7\u30E1\u30F3\u30D0\u30FC",allowlist:"\u2709\uFE0F \u30A2\u30AF\u30BB\u30B9\u8A31\u53EF\u30EA\u30B9\u30C8",directory:"\u{1F504} \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u9023\u643A"},usersView:{title:"\u30E6\u30FC\u30B6\u30FC\u7BA1\u7406",searchPlaceholder:"\u8868\u793A\u540D\u3084 Email \u3067\u691C\u7D22...",searchLabel:"\u30E6\u30FC\u30B6\u30FC\u3092\u691C\u7D22",addUser:"\uFF0B \u30E6\u30FC\u30B6\u30FC\u8FFD\u52A0",editUser:"\u30E6\u30FC\u30B6\u30FC\u7DE8\u96C6",displayName:"\u8868\u793A\u540D",email:"Email",active:"\u6709\u52B9",inactive:"\u7121\u52B9",activate:"\u6709\u52B9\u5316",deactivate:"\u7121\u52B9\u5316",editUserAria:"{user} \u3092\u7DE8\u96C6",activateAria:"{user} \u3092\u6709\u52B9\u5316",deactivateAria:"{user} \u3092\u7121\u52B9\u5316",confirmDeactivate:"\u3053\u306E\u30E6\u30FC\u30B6\u30FC\u3092\u7121\u52B9\u5316\u3057\u307E\u3059\u304B\uFF1F \u4EE5\u5F8C\u30B5\u30A4\u30F3\u30A4\u30F3\u3067\u304D\u306A\u304F\u306A\u308A\u307E\u3059\u3002",empty:"\u8A72\u5F53\u3059\u308B\u30E6\u30FC\u30B6\u30FC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093"},groupsView:{emptyFiltered:"\u691C\u7D22\u6761\u4EF6\u306B\u4E00\u81F4\u3059\u308B\u30B0\u30EB\u30FC\u30D7\u306F\u3042\u308A\u307E\u305B\u3093",title:"\u30E6\u30FC\u30B6\u30FC\u30B0\u30EB\u30FC\u30D7\u7BA1\u7406",searchPlaceholder:"\u30B0\u30EB\u30FC\u30D7\u540D\u3084\u30AD\u30FC\u3067\u691C\u7D22...",searchLabel:"\u30B0\u30EB\u30FC\u30D7\u3092\u691C\u7D22",addGroup:"\uFF0B \u30B0\u30EB\u30FC\u30D7\u8FFD\u52A0",editGroup:"\u30B0\u30EB\u30FC\u30D7\u7DE8\u96C6",groupKey:"\u30B0\u30EB\u30FC\u30D7\u30AD\u30FC",name:"\u540D\u79F0",description:"\u8AAC\u660E",memberCountTemplate:"\u6240\u5C5E {count} \u540D",confirmDelete:"\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u3092\u524A\u9664\u3057\u307E\u3059\u304B\uFF1F",noDescription:"\u8AAC\u660E\u306A\u3057",groupKeyPlaceholder:"\u4F8B: dev-team",namePlaceholder:"\u4F8B: \u958B\u767A\u30C1\u30FC\u30E0",empty:"\u30E6\u30FC\u30B6\u30FC\u30B0\u30EB\u30FC\u30D7\u304C\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},groupMembersView:{title:"\u30B0\u30EB\u30FC\u30D7\u30E1\u30F3\u30D0\u30FC\u7BA1\u7406",selectGroup:"\u30B0\u30EB\u30FC\u30D7\u9078\u629E",selectPrompt:"\u30B0\u30EB\u30FC\u30D7\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",actionAdd:"\u8FFD\u52A0",actionRemove:"\u9664\u5916",actionAddAria:"{user} \u3092\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u3078\u8FFD\u52A0",actionRemoveAria:"{user} \u3092\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u304B\u3089\u9664\u5916",upstreamNotice:"\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u306E\u6240\u5C5E\u306F\u4E0A\u6D41\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u6240\u6709\u3057\u3066\u3044\u307E\u3059\u3002\u5909\u66F4\u306F\u4E0A\u6D41\u3067\u884C\u3063\u3066\u304F\u3060\u3055\u3044 (\u3053\u3053\u3067\u5909\u3048\u3066\u3082\u6B21\u306E\u540C\u671F\u3067\u5143\u306B\u623B\u308A\u307E\u3059)\u3002",membersOfTemplate:"{group} \u306E\u6240\u5C5E\u30E1\u30F3\u30D0\u30FC",groupKeyLabel:"\u30B0\u30EB\u30FC\u30D7\u30AD\u30FC"},allowlistView:{title:"\u30B5\u30A4\u30F3\u30A4\u30F3\u8A31\u53EF\u30EA\u30B9\u30C8",addEntry:"\uFF0B \u30D1\u30BF\u30FC\u30F3\u8FFD\u52A0",pattern:"\u30D1\u30BF\u30FC\u30F3 (\u4F8B: @example.com \u307E\u305F\u306F user@example.com)",type:"\u7A2E\u5225",emailType:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u5B8C\u5168\u4E00\u81F4",domainType:"\u30C9\u30E1\u30A4\u30F3\u4E00\u81F4",emailTypeShort:"\u30E1\u30FC\u30EB",domainTypeShort:"\u30C9\u30E1\u30A4\u30F3",groupTypeShort:"\u30B0\u30EB\u30FC\u30D7",target:"\u5BFE\u8C61",description:"\u8AAC\u660E / \u5099\u8003",deploymentOwner:"\u914D\u5099\u5171\u901A",confirmDelete:"\u3053\u306E\u8A31\u53EF\u3092\u524A\u9664\u3057\u307E\u3059\u304B\uFF1F \u3053\u308C\u3067\u3057\u304B\u30B5\u30A4\u30F3\u30A4\u30F3\u3067\u304D\u306A\u3044\u4EBA\u306F\u30ED\u30B0\u30A4\u30F3\u3067\u304D\u306A\u304F\u306A\u308A\u307E\u3059\u3002",deleteAria:"{target} \u306E\u8A31\u53EF\u3092\u524A\u9664",empty:"\u30A2\u30ED\u30EF\u30EA\u30B9\u30C8\u30A8\u30F3\u30C8\u30EA\u304C\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},directoryView:{title:"\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u540C\u671F",source:"\u51FA\u6240",localSource:"\u30ED\u30FC\u30AB\u30EB\u7BA1\u7406",membershipMode:"\u6240\u5C5E\u306E\u5C55\u958B",directMode:"\u76F4\u63A5\u6240\u5C5E\u306E\u307F",transitiveMode:"\u5165\u308C\u5B50\u3092\u5C55\u958B",lastSynced:"\u6700\u7D42\u540C\u671F",neverSynced:"\u672A\u5B9F\u884C",unresolvedTemplate:"{count} \u4EF6\u304C\u672A\u89E3\u6C7A",syncPaused:"\u505C\u6B62\u4E2D",syncEnabled:"\u6709\u52B9",syncNow:"\u4ECA\u3059\u3050\u540C\u671F",syncQueued:"\u540C\u671F\u3092\u8981\u6C42\u3057\u307E\u3057\u305F",staleWarning:"\u540C\u671F\u304C\u6EDE\u3063\u3066\u3044\u307E\u3059\u3002\u5B9F\u884C\u3055\u308C\u308B\u307E\u3067\u3001\u4E0A\u6D41\u304B\u3089\u5916\u308C\u305F\u4EBA\u306E\u30A2\u30AF\u30BB\u30B9\u306F\u6B8B\u308A\u7D9A\u3051\u307E\u3059\u3002",disabledWarning:"\u3053\u306E\u914D\u5099\u3067\u306F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u540C\u671F\u304C\u7D50\u7DDA\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u65E2\u5B58\u306E\u6240\u5C5E\u306F\u305D\u306E\u307E\u307E\u6709\u52B9\u3067\u3001\u66F4\u65B0\u3060\u3051\u304C\u6B62\u307E\u3063\u3066\u3044\u307E\u3059\u3002",pausedTemplate:"\u9023\u643A {total} \u4EF6\u306E\u3046\u3061 {paused} \u4EF6\u304C\u505C\u6B62\u4E2D",erroredTemplate:"\u76F4\u8FD1\u306E\u540C\u671F\u306B\u5931\u6557\u3057\u305F\u30B0\u30EB\u30FC\u30D7: {groups}",erroredItemTemplate:"{group}: {reason}",listSeparator:" / ",oldestSyncedTemplate:"\u6700\u3082\u53E4\u3044\u540C\u671F\u6210\u529F: {at}",pendingTemplate:"{count} \u4EF6\u306E\u540C\u671F\u8981\u6C42\u304C\u672A\u51E6\u7406",nothingToLink:"\u3059\u3079\u3066\u306E\u30B0\u30EB\u30FC\u30D7\u304C\u65E2\u306B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3068\u9023\u643A\u3057\u3066\u3044\u307E\u3059\u3002",notWiredNotice:"\u3053\u306E\u914D\u5099\u3067\u306F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u540C\u671F\u304C\u7D50\u7DDA\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u3053\u3053\u304B\u3089\u9023\u643A\u306E\u4F5C\u6210\u30FB\u5909\u66F4\u306F\u3067\u304D\u307E\u305B\u3093\u3002",syncNowAria:"{group} \u3092\u4ECA\u3059\u3050\u540C\u671F",pauseAria:"{group} \u306E\u540C\u671F\u3092\u4E00\u6642\u505C\u6B62",resumeAria:"{group} \u306E\u540C\u671F\u3092\u518D\u958B",allowGroupAria:"{group} \u306E\u30E1\u30F3\u30D0\u30FC\u306E\u30B5\u30A4\u30F3\u30A4\u30F3\u3092\u8A31\u53EF",disallowGroupAria:"{group} \u306E\u30E1\u30F3\u30D0\u30FC\u306E\u30B5\u30A4\u30F3\u30A4\u30F3\u8A31\u53EF\u3092\u5916\u3059",unlinkAria:"{group} \u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u9023\u643A\u3092\u89E3\u9664",confirmDisallow:"\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u306E\u30B5\u30A4\u30F3\u30A4\u30F3\u8A31\u53EF\u3092\u5916\u3057\u307E\u3059\u304B\uFF1F \u3053\u308C\u3067\u3057\u304B\u30B5\u30A4\u30F3\u30A4\u30F3\u3067\u304D\u306A\u3044\u4EBA\u306F\u30ED\u30B0\u30A4\u30F3\u3067\u304D\u306A\u304F\u306A\u308A\u307E\u3059\u3002",link:"\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30B0\u30EB\u30FC\u30D7\u3068\u9023\u643A\u3059\u308B",unlink:"\u9023\u643A\u3092\u89E3\u9664",externalKey:"\u4E0A\u6D41\u30B0\u30EB\u30FC\u30D7",empty:"\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3068\u9023\u643A\u3057\u3066\u3044\u308B\u30B0\u30EB\u30FC\u30D7\u306F\u3042\u308A\u307E\u305B\u3093",erroredWarning:"\u76F4\u8FD1\u306E\u540C\u671F\u306B\u5931\u6557\u3057\u305F\u30B0\u30EB\u30FC\u30D7",oldestSyncedAt:"\u6700\u3082\u53E4\u3044\u540C\u671F\u6210\u529F",selectGroup:"\u9023\u643A\u3059\u308B\u30B0\u30EB\u30FC\u30D7",externalKeyPlaceholder:"\u4F8B: dev-team@example.com",confirmUnlink:"\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u306E\u9023\u643A\u3092\u89E3\u9664\u3057\u307E\u3059\u304B\uFF1F \u30E1\u30F3\u30D0\u30FC\u53F0\u5E33\u3068\u30B0\u30EB\u30FC\u30D7\u5358\u4F4D\u306E\u30B5\u30A4\u30F3\u30A4\u30F3\u8A31\u53EF\u304C\u5931\u308F\u308C\u307E\u3059\u3002",pause:"\u4E00\u6642\u505C\u6B62",resume:"\u518D\u958B",allowGroup:"\u30B5\u30A4\u30F3\u30A4\u30F3\u3092\u8A31\u53EF",disallowGroup:"\u30B5\u30A4\u30F3\u30A4\u30F3\u8A31\u53EF\u3092\u5916\u3059",groupOptionTemplate:"{name} ({key})"}};function q(r){let n=R;return r?{title:r.title??n.title,locale:r.locale??n.locale,timeZone:r.timeZone??n.timeZone,heading:r.heading??n.heading,common:{...n.common,...r.common},errors:{...n.errors,...r.errors},permissions:{...n.permissions,...r.permissions},tabs:{...n.tabs,...r.tabs},usersView:{...n.usersView,...r.usersView},groupsView:{...n.groupsView,...r.groupsView},groupMembersView:{...n.groupMembersView,...r.groupMembersView},allowlistView:{...n.allowlistView,...r.allowlistView},directoryView:{...n.directoryView,...r.directoryView}}:n}import{data as J}from"react-router";function xe(r){let n=r?.users??[{id:1,email:"admin@example.com",displayName:"\u30B7\u30B9\u30C6\u30E0\u7BA1\u7406\u8005",isActive:!0},{id:2,email:"user1@example.com",displayName:"\u958B\u767A \u592A\u90CE",isActive:!0},{id:3,email:"user2@example.com",displayName:"\u55B6\u696D \u82B1\u5B50",isActive:!0}],s=r?.groups??[{id:1,groupKey:"dev-team",name:"\u958B\u767A\u30C1\u30FC\u30E0",description:"\u30B7\u30B9\u30C6\u30E0\u958B\u767A\u62C5\u5F53\u30B0\u30EB\u30FC\u30D7",isActive:!0,readOnly:!1},{id:2,groupKey:"sales-dept",name:"\u55B6\u696D\u90E8",description:"\u55B6\u696D\u30BD\u30EA\u30E5\u30FC\u30B7\u30E7\u30F3\u62C5\u5F53",isActive:!0,readOnly:!1}],i=r?.groupMembers??[{id:1,groupId:1,userId:2},{id:2,groupId:2,userId:3}],o=r?.allowlist??[{id:1,pattern:"admin@example.com",type:"email",description:"\u521D\u671F\u7BA1\u7406\u8005",owner:{kind:"tenant",tenantId:"default"},readOnly:!1},{id:2,pattern:"@example.com",type:"domain",description:"\u793E\u5185\u30C9\u30E1\u30A4\u30F3",owner:{kind:"tenant",tenantId:"default"},readOnly:!1}];return{async listUsers(){return[...n]},async createUser(a){let t={id:Math.max(...n.map(d=>d.id),0)+1,email:a.email,displayName:a.displayName,isActive:!0};return n.push(t),t},async updateUser(a,t){let d=n.findIndex(p=>p.id===a);if(d===-1)throw new Error(`User not found: ${a}`);return n[d]={...n[d],displayName:t.displayName,email:t.email},n[d]},async toggleUserActive(a,t){let d=n.findIndex(p=>p.id===a);if(d===-1)throw new Error(`User not found: ${a}`);return n[d]={...n[d],isActive:t},n[d]},async listGroups(){return[...s]},async createGroup(a){let t={id:Math.max(...s.map(d=>d.id),0)+1,groupKey:a.groupKey,name:a.name,description:a.description,isActive:!0,readOnly:!1};return s.push(t),t},async updateGroup(a,t){let d=s.findIndex(p=>p.id===a);if(d===-1)throw new Error(`Group not found: ${a}`);return s[d]={...s[d],name:t.name,description:t.description},s[d]},async deleteGroup(a){s=s.filter(t=>t.id!==a),i=i.filter(t=>t.groupId!==a)},async listGroupMembers(){return[...i]},async addGroupMember(a,t){let d=i.find(g=>g.groupId===a&&g.userId===t);if(d)return d;let p={id:Math.max(...i.map(g=>g.id),0)+1,groupId:a,userId:t};return i.push(p),p},async removeGroupMember(a,t){i=i.filter(d=>!(d.groupId===a&&d.userId===t))},async listAllowlist(){return[...o]},async addAllowlistEntry(a){let t={id:Math.max(...o.map(d=>d.id),0)+1,pattern:a.pattern,type:a.type,description:a.description,owner:{kind:"tenant",tenantId:"default"},readOnly:!1};return o.push(t),t},async removeAllowlistEntry(a){o=o.filter(t=>t.id!==a)},async addAllowlistGroup(a,t){let d=s.find(p=>p.id===a);if(!d)throw new Error(`Group not found: ${a}`);o=[...o,{id:Math.max(...o.map(p=>p.id),0)+1,type:"group",groupId:a,groupKey:d.groupKey,groupName:d.name,description:t,owner:{kind:"tenant",tenantId:"default"},readOnly:!1}]},async removeAllowlistGroup(a){o=o.filter(t=>!(t.type==="group"&&t.id===a))},async linkDirectoryGroup(){throw new Error("This in-memory store has no upstream directory; inject a real store to link groups.")},async unlinkDirectoryGroup(){throw new Error("This in-memory store has no upstream directory; inject a real store to unlink groups.")},async setDirectorySyncEnabled(){throw new Error("This in-memory store has no upstream directory; inject a real store to pause synchronization.")},async requestDirectorySync(){throw new Error("This in-memory store has no upstream directory; inject a real store to request a sync.")},async getDirectoryStatus(){return{isEnabled:!1,provider:"",linkedGroupCount:0,isStale:!1,pausedGroupCount:0,stalenessThresholdSec:0,erroredGroupIds:[],pendingRequestCount:0}}}}function X(r){return typeof r=="object"&&r!==null&&r.status===403}var ee=new Map([["createUser",["create"]],["updateUser",["update"]],["toggleUserActive",["update"]],["createGroup",["create"]],["updateGroup",["update"]],["deleteGroup",["delete"]],["addGroupMember",["create"]],["removeGroupMember",["delete"]],["addAllowlistEntry",["create"]],["removeAllowlistEntry",["delete"]],["addAllowlistGroup",["create"]],["removeAllowlistGroup",["delete"]],["linkDirectoryGroup",["update","create","delete"]],["unlinkDirectoryGroup",["update","delete"]],["setDirectorySyncEnabled",["update"]],["requestDirectorySync",["update"]]]);function S(r,n){let s=r.get(n),i=Number(s);if(s===null||String(s).trim()===""||!Number.isInteger(i)||i<=0)throw new Error(`Invalid or missing "${n}"`);return i}function U(r,n){let s=String(r.get(n)??"").trim();if(s==="")throw new Error(`Invalid or missing "${n}"`);return s}function re(r,n){let s=String(r.get(n)??"");if(s!=="true"&&s!=="false")throw new Error(`Invalid or missing "${n}"`);return s==="true"}function te(r){let n=String(r.get("membershipMode")??"");if(n!=="direct"&&n!=="transitive")throw new Error('Invalid or missing "membershipMode"');return n}function F(r,n){let s=String(r.get(n)??"").trim();return s===""?void 0:s}function he(r){let n=q(r.labels);async function s({request:a}){await r.guards.requireAccess(a,{action:"read",intent:"loader"});let d=new URL(a.url).pathname.split("/").filter(Boolean),p=d[d.length-1]??"users",[g,y,f,w,x,c]=await Promise.all([r.store.listUsers(),r.store.listGroups(),r.store.listGroupMembers(),r.store.listAllowlist(),r.store.getDirectoryStatus(),r.getMyPermissions?r.getMyPermissions(a).catch(A=>(console.error("[@aiquants/auth-react-router] getMyPermissions failed; rendering the permission badge as unknown:",A),null)):Promise.resolve(null)]);return{resourceLabels:r.resourceLabels,segment:["groups","group_members","allowlist","directory"].includes(p)?p:"users",users:g,groups:y,groupMembers:f,allowlist:w,directoryStatus:x,myPermissions:c,labels:n}}async function i({request:a}){let t=await a.formData(),d=String(t.get("intent")??""),p=ee.get(d);if(!p)return{ok:!1,error:`Unknown intent: ${d}`};try{for(let g of p)await r.guards.requireAccess(a,{action:g,intent:d})}catch(g){if(!X(g))throw g;return r.guards.onDenied?.({intent:d,actions:p,error:g}),J({ok:!1,error:n.errors.forbidden},{status:403})}try{return await o(d,t)}catch(g){if(g instanceof Response)throw g;return{ok:!1,error:g instanceof Error?g.message:String(g)}}}async function o(a,t){if(a==="createUser")return await r.store.createUser({displayName:U(t,"displayName"),email:U(t,"email")}),{ok:!0};if(a==="updateUser")return await r.store.updateUser(S(t,"userId"),{displayName:U(t,"displayName"),email:U(t,"email")}),{ok:!0};if(a==="toggleUserActive"){let d=String(t.get("isActive")??"");if(d!=="true"&&d!=="false")throw new Error('Invalid or missing "isActive"');return await r.store.toggleUserActive(S(t,"userId"),d==="true"),{ok:!0}}if(a==="createGroup")return await r.store.createGroup({groupKey:U(t,"groupKey"),name:U(t,"name"),description:F(t,"description")}),{ok:!0};if(a==="updateGroup")return await r.store.updateGroup(S(t,"groupId"),{name:U(t,"name"),description:F(t,"description")}),{ok:!0};if(a==="deleteGroup")return await r.store.deleteGroup(S(t,"groupId")),{ok:!0};if(a==="addGroupMember")return await r.store.addGroupMember(S(t,"groupId"),S(t,"userId")),{ok:!0};if(a==="removeGroupMember")return await r.store.removeGroupMember(S(t,"groupId"),S(t,"userId")),{ok:!0};if(a==="addAllowlistEntry"){let d=t.get("type")==="domain"?"domain":"email";return await r.store.addAllowlistEntry({pattern:U(t,"pattern"),type:d,description:F(t,"description")}),{ok:!0}}if(a==="addAllowlistGroup")return await r.store.addAllowlistGroup(S(t,"groupId"),F(t,"description")),{ok:!0};if(a==="removeAllowlistGroup")return await r.store.removeAllowlistGroup(S(t,"entryId")),{ok:!0};if(a==="linkDirectoryGroup")return await r.store.linkDirectoryGroup(S(t,"groupId"),{provider:U(t,"provider"),externalKey:U(t,"externalKey"),membershipMode:te(t)}),{ok:!0};if(a==="unlinkDirectoryGroup")return await r.store.unlinkDirectoryGroup(S(t,"groupId")),{ok:!0};if(a==="setDirectorySyncEnabled")return await r.store.setDirectorySyncEnabled(S(t,"groupId"),re(t,"isSyncEnabled")),{ok:!0};if(a==="requestDirectorySync"){let d=String(t.get("groupId")??"").trim();return await r.store.requestDirectorySync(d===""?null:S(t,"groupId")),{ok:!0}}return a==="removeAllowlistEntry"?(await r.store.removeAllowlistEntry(S(t,"entryId")),{ok:!0}):{ok:!1,error:`Unknown intent: ${a}`}}return{loader:s,action:i}}import{Link as oe,useLoaderData as ie}from"react-router";function h(r,n){return Object.entries(n).reduce((s,[i,o])=>s.replaceAll(`{${i}}`,String(o)),r)}function W(r,n){return new Intl.DateTimeFormat(n.locale,{timeZone:n.timeZone,dateStyle:"medium",timeStyle:"short"}).format(new Date(r))}import{jsx as k,jsxs as M}from"react/jsx-runtime";function j({label:r,summary:n}){return M("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.18rem",fontSize:"0.65rem",padding:"0.08rem 0.35rem",borderRadius:"9999px",backgroundColor:n.bgColor,color:n.color,border:`1px solid ${n.borderColor}`,fontWeight:600,lineHeight:"1.2"},children:[M("span",{children:[r,":"]}),k("span",{children:n.text})]})}function ne({status:r,labels:n,groups:s}){if(!r||r.linkedGroupCount===0)return null;let i=n.directoryView,o=[];if(r.isEnabled||o.push({id:"disabled",text:i.disabledWarning}),r.pausedGroupCount>0&&o.push({id:"paused",text:h(i.pausedTemplate,{paused:r.pausedGroupCount,total:r.linkedGroupCount})}),r.isStale){let a=r.oldestSyncedAt?W(r.oldestSyncedAt,n):i.neverSynced;o.push({id:"stale",text:`${i.staleWarning} ${h(i.oldestSyncedTemplate,{at:a})}`})}if(r.erroredGroupIds.length>0){let a=r.erroredGroupIds.map(t=>{let d=s.find(g=>g.id===t);if(!d)return h(n.common.idTemplate,{id:t});let p=d.externalLink?.syncError;return p?h(i.erroredItemTemplate,{group:d.name,reason:p}):d.name});o.push({id:"errored",text:h(i.erroredTemplate,{groups:a.join(i.listSeparator)})})}return r.pendingRequestCount>0&&o.push({id:"pending",text:h(i.pendingTemplate,{count:r.pendingRequestCount})}),o.length===0?null:M("section",{"aria-labelledby":"directory-sync-heading","data-testid":"directory-sync-banner",style:{display:"flex",flexDirection:"column",gap:"0.35rem",padding:"0.7rem 1rem",marginBottom:"1rem",borderRadius:"6px",border:"1px solid #fde68a",backgroundColor:"#fffbeb",color:"#92400e",fontSize:"0.85rem"},children:[k("h2",{id:"directory-sync-heading",style:{margin:0,fontSize:"0.9rem",fontWeight:700},children:i.title}),o.map(a=>k("span",{"data-directory-warning":a.id,children:a.text},a.id))]})}function Q({children:r,renderHeader:n}){let s=ie(),i=s?.segment??"users",o=s?.labels??R,a=s?.myPermissions??null,t=s?.resourceLabels??{},d=x=>Object.hasOwn(t,x)?t[x]:x,p=[{key:"users",label:o.tabs.users,href:"/users"},{key:"groups",label:o.tabs.groups,href:"/users/groups"},{key:"group_members",label:o.tabs.groupMembers,href:"/users/group_members"},{key:"allowlist",label:o.tabs.allowlist,href:"/users/allowlist"}];s?.directoryStatus&&(s.directoryStatus.isEnabled||s.directoryStatus.linkedGroupCount>0)&&p.push({key:"directory",label:o.tabs.directory,href:"/users/directory"});let g=Object.entries(a??{}),y=x=>x?.canWrite?{text:o.permissions.canWrite,color:"#047857",bgColor:"#ecfdf5",borderColor:"#a7f3d0"}:x?.canRead?{text:o.permissions.canRead,color:"#1d4ed8",bgColor:"#eff6ff",borderColor:"#bfdbfe"}:{text:o.permissions.none,color:"#475569",bgColor:"#f1f5f9",borderColor:"#cbd5e1"},f={text:o.permissions.unknown,color:"#92400e",bgColor:"#fffbeb",borderColor:"#fde68a"},w=M("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem"},"data-testid":"user-admin-header-annotation",children:[k("span",{style:{fontSize:"0.75rem",backgroundColor:"#e0f2fe",color:"#0369a1",padding:"2px 8px",borderRadius:"12px",fontWeight:600},children:o.heading}),M("div",{style:{display:"inline-flex",alignItems:"center",gap:"0.25rem",fontSize:"0.68rem",color:"#475569"},"data-testid":"user-admin-permissions-badge",children:[k("span",{style:{fontWeight:600,color:"#334155"},children:o.permissions.label}),k("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.18rem"},children:g.length===0?k("span",{"data-testid":"user-admin-permission-unavailable",children:k(j,{label:o.heading,summary:f})}):g.map(([x,c])=>k(j,{label:d(x),summary:y(c)},x))})]})]});return M("div",{"data-testid":"user-admin-shell",style:{width:"100%",minHeight:"100vh",backgroundColor:"#f8fafc",padding:"1.5rem",boxSizing:"border-box"},children:[n?n({title:o.title,annotation:w}):M("div",{style:{marginBottom:"1.5rem",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[k("h1",{style:{margin:0,fontSize:"1.5rem",fontWeight:700,color:"#0f172a"},children:o.title}),w]}),k("nav",{"aria-label":o.title,style:{display:"flex",gap:"0.5rem",marginBottom:"1.2rem",borderBottom:"2px solid #e2e8f0",paddingBottom:"0.5rem"},children:p.map(x=>{let c=i===x.key;return k(oe,{to:x.href,"data-testid":`user-admin-tab-${x.key}`,"aria-current":c?"page":void 0,style:{padding:"0.5rem 1rem",borderRadius:"6px 6px 0 0",fontSize:"0.88rem",fontWeight:c?700:500,color:c?"#0284c7":"#64748b",backgroundColor:c?"#ffffff":"transparent",textDecoration:"none",borderBottom:c?"3px solid #0284c7":"3px solid transparent",transition:"all 0.15s ease"},children:x.label},x.key)})}),k(ne,{status:s?.directoryStatus,labels:o,groups:s?.groups??[]}),k("main",{children:r})]})}import{useEffect as Z,useRef as O,useState as v}from"react";import{useFetcher as D,useLoaderData as L}from"react-router";import{Fragment as me,jsx as e,jsxs as l}from"react/jsx-runtime";function V({fetcher:r,id:n}){let s=r.data;return s?.ok!==!1||!s.error?null:e("div",{id:n,"data-testid":"user-admin-action-error",role:"alert",style:{gridColumn:"1 / -1",padding:"0.7rem 1rem",borderRadius:"6px",border:"1px solid #fecaca",backgroundColor:"#fef2f2",color:"#b91c1c",fontSize:"0.85rem"},children:s.error})}function P(r){let n=O(null);return Z(()=>{if(r.state!=="idle"||r.data===void 0)return;let s=n.current;s&&(n.current=null,r.data.ok===!0&&s())},[r.state,r.data]),(s,i)=>{n.current=i??null,r.submit(s,{method:"post"})}}function B(r,n){let s=O(null),i=O(n);return i.current=n,Z(()=>{if(!r)return;let o=s.current,a=document.activeElement,t=()=>Array.from(o?.querySelectorAll('a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])')??[]);t()[0]?.focus();let d=p=>{if(p.key==="Escape"){p.preventDefault(),i.current();return}if(p.key!=="Tab")return;let g=t();if(g.length===0)return;let y=g[0],f=g[g.length-1],w=document.activeElement,x=!o?.contains(w);p.shiftKey&&(w===y||x)?(p.preventDefault(),f.focus()):!p.shiftKey&&(w===f||x)&&(p.preventDefault(),y.focus())};return document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d),a?.focus?.()}},[r]),s}function H(){let r=L(),n=D(),s=P(n),i=r.labels??R,[o,a]=v(""),[t,d]=v(null),[p,g]=v(!1),[y,f]=v(""),[w,x]=v(""),c=B(p,()=>g(!1)),A=B(t!==null,()=>d(null)),C=n.state!=="idle",I=r.users.filter(u=>u.displayName.toLowerCase().includes(o.toLowerCase())||u.email.toLowerCase().includes(o.toLowerCase())),E=u=>{u.isActive&&!window.confirm(i.usersView.confirmDeactivate)||s({intent:"toggleUserActive",userId:String(u.id),isActive:String(!u.isActive)})},T=u=>{u.preventDefault(),y&&w&&s({intent:"createUser",displayName:y,email:w},()=>{f(""),x(""),g(!1)})},m=u=>{u.preventDefault(),t&&s({intent:"updateUser",userId:String(t.id),displayName:t.displayName,email:t.email},()=>d(null))};return l("section",{"data-testid":"users-view-section",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[e("h2",{style:N,children:i.usersView.title}),!(p||t)&&e(V,{fetcher:n}),l("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"#ffffff",padding:"1rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:[e("input",{type:"text","aria-label":i.usersView.searchLabel,placeholder:i.usersView.searchPlaceholder,value:o,onChange:u=>a(u.target.value),"data-testid":"users-search-input",style:{padding:"6px 12px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",width:"260px"}}),e("button",{type:"button",onClick:()=>g(!0),"data-testid":"users-add-button",style:{padding:"6px 14px",borderRadius:"6px",backgroundColor:"#0284c7",color:"#ffffff",border:"none",fontSize:"0.85rem",fontWeight:600,cursor:"pointer"},children:i.usersView.addUser})]}),e("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0",overflow:"hidden"},children:l("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"0.85rem",textAlign:"left"},children:[e("thead",{children:l("tr",{style:{backgroundColor:"#f8fafc",borderBottom:"1px solid #e2e8f0",color:"#475569"},children:[e("th",{style:{padding:"10px 14px"},children:i.common.id}),e("th",{style:{padding:"10px 14px"},children:i.usersView.displayName}),e("th",{style:{padding:"10px 14px"},children:i.usersView.email}),e("th",{style:{padding:"10px 14px"},children:i.common.status}),e("th",{style:{padding:"10px 14px",textAlign:"right"},children:i.common.actions})]})}),l("tbody",{children:[I.map(u=>l("tr",{style:{borderBottom:"1px solid #f1f5f9"},"data-testid":`user-row-${u.id}`,children:[e("td",{style:{padding:"10px 14px",color:"#475569"},children:h(i.common.idTemplate,{id:u.id})}),e("td",{style:{padding:"10px 14px",fontWeight:600,color:"#0f172a"},children:u.displayName}),e("td",{style:{padding:"10px 14px",color:"#475569"},children:u.email}),e("td",{style:{padding:"10px 14px"},children:e("span",{style:{fontSize:"0.75rem",padding:"2px 8px",borderRadius:"10px",backgroundColor:u.isActive?"#dcfce7":"#fee2e2",color:u.isActive?"#15803d":"#b91c1c",fontWeight:600},children:u.isActive?i.usersView.active:i.usersView.inactive})}),l("td",{style:{padding:"10px 14px",textAlign:"right"},children:[e("button",{type:"button",onClick:()=>d(u),"aria-label":h(i.usersView.editUserAria,{user:u.displayName}),"data-testid":`edit-user-btn-${u.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"0.78rem",cursor:"pointer",marginRight:"6px"},children:i.common.edit}),e("button",{type:"button",onClick:()=>E(u),disabled:C,"aria-busy":C,"aria-label":h(u.isActive?i.usersView.deactivateAria:i.usersView.activateAria,{user:u.displayName}),"data-testid":`toggle-user-btn-${u.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"0.78rem",cursor:C?"default":"pointer",color:u.isActive?"#b91c1c":"#15803d"},children:u.isActive?i.usersView.deactivate:i.usersView.activate})]})]},u.id)),I.length===0&&e("tr",{children:e("td",{colSpan:5,style:{padding:"2rem",textAlign:"center",color:"#475569"},children:i.usersView.empty})})]})]})}),p&&e("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},children:l("form",{ref:c,onSubmit:T,role:"dialog","aria-modal":"true","aria-labelledby":"create-user-title","aria-describedby":"create-user-error","data-testid":"user-create-modal",style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[e("h3",{id:"create-user-title",style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:i.usersView.addUser}),e(V,{fetcher:n,id:"create-user-error"}),l("div",{style:{marginBottom:"1rem"},children:[e("label",{htmlFor:"create-user-display-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:i.usersView.displayName}),e("input",{id:"create-user-display-name-input",type:"text",value:y,onChange:u=>f(u.target.value),required:!0,"data-testid":"create-user-display-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),l("div",{style:{marginBottom:"1.2rem"},children:[e("label",{htmlFor:"create-user-email-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:i.usersView.email}),e("input",{id:"create-user-email-input",type:"email",value:w,onChange:u=>x(u.target.value),required:!0,"data-testid":"create-user-email",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),l("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[e("button",{type:"button",onClick:()=>g(!1),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:"\u30AD\u30E3\u30F3\u30BB\u30EB"}),e("button",{type:"submit","data-testid":"submit-create-user",disabled:C,"aria-busy":C,style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#0284c7",color:"#ffffff",border:"none",cursor:"pointer"},children:"\u4F5C\u6210"})]})]})}),t&&e("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},children:l("form",{ref:A,onSubmit:m,role:"dialog","aria-modal":"true","aria-labelledby":"edit-user-title","aria-describedby":"edit-user-error","data-testid":"user-edit-modal",style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[e("h3",{id:"edit-user-title",style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:i.usersView.editUser}),e(V,{fetcher:n,id:"edit-user-error"}),l("div",{style:{marginBottom:"1rem"},children:[e("label",{htmlFor:"edit-user-display-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:i.usersView.displayName}),e("input",{id:"edit-user-display-name-input",type:"text",value:t.displayName,onChange:u=>d({...t,displayName:u.target.value}),required:!0,"data-testid":"edit-user-display-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),l("div",{style:{marginBottom:"1.2rem"},children:[e("label",{htmlFor:"edit-user-email-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:i.usersView.email}),e("input",{id:"edit-user-email-input",type:"email",value:t.email,onChange:u=>d({...t,email:u.target.value}),required:!0,"data-testid":"edit-user-email",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),l("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[e("button",{type:"button",onClick:()=>d(null),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:i.common.cancel}),e("button",{type:"submit","data-testid":"submit-edit-user",disabled:C,"aria-busy":C,style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#0284c7",color:"#ffffff",border:"none",cursor:"pointer"},children:i.common.save})]})]})})]})}function se(){let r=L(),n=D(),s=P(n),i=r.labels??R,[o,a]=v(""),[t,d]=v(!1),[p,g]=v(null),y=n.state!=="idle",[f,w]=v(""),[x,c]=v(""),[A,C]=v(""),I=B(t,()=>d(!1)),E=B(p!==null,()=>g(null)),T=r.groups.filter(b=>b.name.toLowerCase().includes(o.toLowerCase())||b.groupKey.toLowerCase().includes(o.toLowerCase())),m=b=>{b.preventDefault(),f&&x&&s({intent:"createGroup",groupKey:f,name:x,description:A},()=>{w(""),c(""),C(""),d(!1)})},u=b=>{b.preventDefault(),p&&s({intent:"updateGroup",groupId:String(p.id),name:p.name,description:p.description??""},()=>g(null))},z=b=>{window.confirm(i.groupsView.confirmDelete)&&s({intent:"deleteGroup",groupId:String(b)})};return l("section",{"data-testid":"groups-view-section",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[e("h2",{style:N,children:i.groupsView.title}),!(t||p)&&e(V,{fetcher:n}),l("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"#ffffff",padding:"1rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:[e("input",{type:"text","aria-label":i.groupsView.searchLabel,placeholder:i.groupsView.searchPlaceholder,value:o,onChange:b=>a(b.target.value),"data-testid":"groups-search-input",style:{padding:"6px 12px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",width:"260px"}}),e("button",{type:"button",onClick:()=>d(!0),"data-testid":"groups-add-button",style:{padding:"6px 14px",borderRadius:"6px",backgroundColor:"#4338ca",color:"#ffffff",border:"none",fontSize:"0.85rem",fontWeight:600,cursor:"pointer"},children:i.groupsView.addGroup})]}),e("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:"1rem"},children:T.map(b=>{let _=r.groupMembers.filter(Y=>Y.groupId===b.id).length;return l("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0",padding:"1rem",display:"flex",flexDirection:"column",justifyContent:"space-between"},"data-testid":`group-card-${b.id}`,"data-group-readonly":b.readOnly?"true":"false",children:[l("div",{children:[l("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.5rem"},children:[e("h4",{style:{margin:0,fontSize:"1rem",color:"#0f172a"},children:b.name}),e("span",{style:{fontSize:"0.72rem",backgroundColor:"#e0e7ff",color:"#4338ca",padding:"2px 6px",borderRadius:"4px",fontFamily:"monospace"},children:b.groupKey})]}),e("p",{style:{margin:"0 0 0.8rem 0",fontSize:"0.82rem",color:"#64748b",minHeight:"2.4em"},children:b.description||i.groupsView.noDescription}),b.externalLink&&l("div",{"data-testid":`group-source-${b.id}`,style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap",marginBottom:"0.6rem"},children:[e("span",{style:{fontSize:"0.72rem",padding:"2px 8px",borderRadius:"10px",backgroundColor:"#ede9fe",color:"#6d28d9",fontWeight:600},children:i.common.managedUpstream}),e("span",{style:{fontSize:"0.72rem",fontFamily:"monospace",color:"#64748b"},children:b.externalLink.externalKey}),b.externalLink.unresolvedCount>0&&e("span",{"data-testid":`group-unresolved-${b.id}`,style:{fontSize:"0.72rem",color:"#b45309"},children:h(i.directoryView.unresolvedTemplate,{count:b.externalLink.unresolvedCount})})]})]}),l("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",borderTop:"1px solid #f1f5f9",paddingTop:"0.6rem"},children:[e("span",{style:{fontSize:"0.78rem",color:"#475569"},"data-testid":`group-member-count-${b.id}`,children:h(i.groupsView.memberCountTemplate,{count:_})}),b.readOnly?e("span",{"data-testid":`readonly-group-${b.id}`,style:{fontSize:"0.75rem",color:"#475569"},children:i.common.readOnly}):l("div",{children:[e("button",{type:"button",onClick:()=>g(b),"data-testid":`edit-group-btn-${b.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"0.75rem",cursor:"pointer",marginRight:"4px"},children:i.common.edit}),e("button",{type:"button",onClick:()=>z(b.id),"data-testid":`delete-group-btn-${b.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #fee2e2",backgroundColor:"#fff5f5",color:"#b91c1c",fontSize:"0.75rem",cursor:"pointer"},children:i.common.delete})]})]})]},b.id)})}),T.length===0&&e("div",{"data-testid":"groups-empty",style:{padding:"2rem",textAlign:"center",color:"#475569",backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0"},children:r.groups.length===0?i.groupsView.empty:i.groupsView.emptyFiltered}),t&&e("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},children:l("form",{ref:I,onSubmit:m,role:"dialog","aria-modal":"true","aria-labelledby":"create-group-title","aria-describedby":"create-group-error","data-testid":"group-create-modal",style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[e("h3",{id:"create-group-title",style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:i.groupsView.addGroup}),e(V,{fetcher:n,id:"create-group-error"}),l("div",{style:{marginBottom:"1rem"},children:[e("label",{htmlFor:"create-group-key-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:i.groupsView.groupKey}),e("input",{id:"create-group-key-input",type:"text",value:f,onChange:b=>w(b.target.value),placeholder:i.groupsView.groupKeyPlaceholder,required:!0,"data-testid":"create-group-key",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),l("div",{style:{marginBottom:"1rem"},children:[e("label",{htmlFor:"create-group-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:i.groupsView.name}),e("input",{id:"create-group-name-input",type:"text",value:x,onChange:b=>c(b.target.value),placeholder:i.groupsView.namePlaceholder,required:!0,"data-testid":"create-group-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),l("div",{style:{marginBottom:"1.2rem"},children:[e("label",{htmlFor:"create-group-desc-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:i.groupsView.description}),e("textarea",{id:"create-group-desc-input",value:A,onChange:b=>C(b.target.value),"data-testid":"create-group-description",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box",height:"60px"}})]}),l("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[e("button",{type:"button",onClick:()=>d(!1),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:"\u30AD\u30E3\u30F3\u30BB\u30EB"}),e("button",{type:"submit","data-testid":"submit-create-group",disabled:y,"aria-busy":y,style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#4338ca",color:"#ffffff",border:"none",cursor:"pointer"},children:"\u4F5C\u6210"})]})]})}),p&&e("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},children:l("form",{ref:E,onSubmit:u,role:"dialog","aria-modal":"true","aria-labelledby":"edit-group-title","aria-describedby":"edit-group-error","data-testid":"group-edit-modal",style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[e("h3",{id:"edit-group-title",style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:i.groupsView.editGroup}),e(V,{fetcher:n,id:"edit-group-error"}),l("div",{style:{marginBottom:"1rem"},children:[e("label",{htmlFor:"edit-group-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:i.groupsView.name}),e("input",{id:"edit-group-name-input",type:"text",value:p.name,onChange:b=>g({...p,name:b.target.value}),required:!0,"data-testid":"edit-group-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),l("div",{style:{marginBottom:"1.2rem"},children:[e("label",{htmlFor:"edit-group-desc-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:i.groupsView.description}),e("textarea",{id:"edit-group-desc-input",value:p.description??"",onChange:b=>g({...p,description:b.target.value}),"data-testid":"edit-group-description",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box",height:"60px"}})]}),l("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[e("button",{type:"button",onClick:()=>g(null),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:i.common.cancel}),e("button",{type:"submit","data-testid":"submit-edit-group",disabled:y,"aria-busy":y,style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#4338ca",color:"#ffffff",border:"none",cursor:"pointer"},children:i.common.save})]})]})})]})}function ae(){let r=L(),n=D(),s=P(n),i=n.state!=="idle",o=r.labels??R,[a,t]=v(r.groups[0]?.id??0),d=r.groups.find(y=>y.id===a),p=new Set(r.groupMembers.filter(y=>y.groupId===a).map(y=>y.userId)),g=(y,f)=>{s(f?{intent:"removeGroupMember",groupId:String(a),userId:String(y)}:{intent:"addGroupMember",groupId:String(a),userId:String(y)})};return l("section",{"data-testid":"group-members-view-section",style:{display:"grid",gridTemplateColumns:"240px 1fr",gap:"1.2rem"},children:[e("h2",{style:{...N,gridColumn:"1 / -1"},children:o.groupMembersView.title}),e(V,{fetcher:n}),l("div",{style:{backgroundColor:"#ffffff",padding:"1rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:[e("h4",{style:{margin:"0 0 0.8rem 0",fontSize:"0.9rem",color:"#475569"},children:o.groupMembersView.selectGroup}),e("div",{style:{display:"flex",flexDirection:"column",gap:"0.4rem"},children:r.groups.map(y=>{let f=y.id===a;return l("button",{type:"button",onClick:()=>t(y.id),"data-testid":`select-group-btn-${y.id}`,style:{textAlign:"left",padding:"8px 10px",borderRadius:"6px",border:f?"1px solid #6366f1":"1px solid #e2e8f0",backgroundColor:f?"#e0e7ff":"#ffffff",color:f?"#3730a3":"#0f172a",cursor:"pointer",fontWeight:f?600:400,fontSize:"0.85rem"},children:[y.name,y.readOnly?e("span",{"data-testid":`group-upstream-marker-${y.id}`,style:{marginLeft:"6px",fontSize:"0.7rem",color:"#7c3aed"},children:o.common.managedUpstream}):null]},y.id)})})]}),e("div",{style:{backgroundColor:"#ffffff",padding:"1.2rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:d?l(me,{children:[l("div",{style:{marginBottom:"1rem",borderBottom:"1px solid #e2e8f0",paddingBottom:"0.8rem"},children:[e("h3",{style:{margin:0,fontSize:"1.1rem",color:"#0f172a"},children:h(o.groupMembersView.membersOfTemplate,{group:d.name})}),l("span",{style:{fontSize:"0.8rem",color:"#64748b"},children:[o.groupMembersView.groupKeyLabel,": ",d.groupKey]}),d.readOnly?e("div",{"data-testid":"group-members-upstream-notice",role:"note",style:{marginTop:"0.5rem",padding:"0.5rem 0.7rem",borderRadius:"6px",backgroundColor:"#f5f3ff",border:"1px solid #ddd6fe",color:"#5b21b6",fontSize:"0.8rem"},children:o.groupMembersView.upstreamNotice}):null]}),e("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:r.users.map(y=>{let f=p.has(y.id);return l("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 12px",borderRadius:"6px",border:"1px solid #f1f5f9",backgroundColor:f?"#f0fdf4":"#ffffff"},"data-testid":`member-row-${y.id}`,children:[l("div",{children:[e("span",{style:{fontWeight:600,fontSize:"0.88rem",color:"#0f172a",marginRight:"8px"},children:y.displayName}),l("span",{style:{fontSize:"0.78rem",color:"#64748b"},children:["(",y.email,")"]})]}),d.readOnly?f?e("span",{"data-testid":`member-readonly-${y.id}`,style:{fontSize:"0.75rem",color:"#475569"},children:o.common.managedUpstream}):null:e("button",{type:"button",onClick:()=>g(y.id,f),disabled:i,"aria-busy":i,"aria-label":h(f?o.groupMembersView.actionRemoveAria:o.groupMembersView.actionAddAria,{user:y.displayName}),"data-testid":`toggle-member-btn-${y.id}`,style:{padding:"4px 12px",borderRadius:"4px",border:f?"1px solid #b91c1c":"1px solid #0284c7",backgroundColor:f?"#ffffff":"#0284c7",color:f?"#b91c1c":"#ffffff",fontSize:"0.78rem",fontWeight:600,cursor:"pointer"},children:f?o.groupMembersView.actionRemove:o.groupMembersView.actionAdd})]},y.id)})})]}):e("div",{style:{color:"#475569",textAlign:"center",padding:"2rem"},children:o.groupMembersView.selectPrompt})})]})}function de(r){return r==="email"?{backgroundColor:"#e0f2fe",color:"#0369a1"}:r==="domain"?{backgroundColor:"#fef3c7",color:"#b45309"}:{backgroundColor:"#ede9fe",color:"#6d28d9"}}function le(r,n){return r==="email"?n.allowlistView.emailTypeShort:r==="domain"?n.allowlistView.domainTypeShort:n.allowlistView.groupTypeShort}function pe(){let r=L(),n=D(),s=r.labels??R,i=P(n),o=n.state!=="idle",[a,t]=v(""),[d,p]=v("email"),[g,y]=v(""),f=c=>{c.preventDefault(),a&&i({intent:"addAllowlistEntry",pattern:a,type:d,description:g},()=>{t(""),y("")})},w=c=>{i({intent:"removeAllowlistEntry",entryId:String(c)})},x=c=>{i({intent:"removeAllowlistGroup",entryId:String(c)})};return l("section",{"data-testid":"allowlist-view-section",style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[e("h2",{style:N,children:s.allowlistView.title}),e(V,{fetcher:n}),l("form",{onSubmit:f,style:{backgroundColor:"#ffffff",padding:"1.2rem",borderRadius:"8px",border:"1px solid #e2e8f0",display:"flex",flexWrap:"wrap",gap:"0.8rem",alignItems:"flex-end"},children:[l("div",{style:{flex:2,minWidth:"220px"},children:[e("label",{htmlFor:"allowlist-pattern-input-field",style:{display:"block",fontSize:"0.78rem",color:"#475569",marginBottom:"4px"},children:s.allowlistView.pattern}),e("input",{id:"allowlist-pattern-input-field",type:"text",value:a,onChange:c=>t(c.target.value),required:!0,"data-testid":"allowlist-pattern-input",style:{width:"100%",padding:"6px 10px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",boxSizing:"border-box"}})]}),l("div",{style:{flex:1,minWidth:"140px"},children:[e("label",{htmlFor:"allowlist-type-select-field",style:{display:"block",fontSize:"0.78rem",color:"#475569",marginBottom:"4px"},children:s.allowlistView.type}),l("select",{id:"allowlist-type-select-field",value:d,onChange:c=>p(c.target.value),"data-testid":"allowlist-type-select",style:{width:"100%",padding:"6px 10px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",boxSizing:"border-box"},children:[e("option",{value:"email",children:s.allowlistView.emailType}),e("option",{value:"domain",children:s.allowlistView.domainType})]})]}),l("div",{style:{flex:2,minWidth:"200px"},children:[e("label",{htmlFor:"allowlist-desc-input-field",style:{display:"block",fontSize:"0.78rem",color:"#475569",marginBottom:"4px"},children:s.allowlistView.description}),e("input",{id:"allowlist-desc-input-field",type:"text",value:g,onChange:c=>y(c.target.value),"data-testid":"allowlist-desc-input",style:{width:"100%",padding:"6px 10px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",boxSizing:"border-box"}})]}),e("button",{type:"submit","data-testid":"submit-allowlist-add",disabled:o,"aria-busy":o,style:{padding:"7px 16px",borderRadius:"6px",backgroundColor:"#047857",color:"#ffffff",border:"none",fontSize:"0.85rem",fontWeight:600,cursor:"pointer"},children:s.allowlistView.addEntry})]}),e("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0",overflow:"hidden"},children:l("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"0.85rem",textAlign:"left"},children:[e("thead",{children:l("tr",{style:{backgroundColor:"#f8fafc",borderBottom:"1px solid #e2e8f0",color:"#475569"},children:[e("th",{style:{padding:"10px 14px"},children:s.common.id}),e("th",{style:{padding:"10px 14px"},children:s.allowlistView.target}),e("th",{style:{padding:"10px 14px"},children:s.allowlistView.type}),e("th",{style:{padding:"10px 14px"},children:s.allowlistView.description}),e("th",{style:{padding:"10px 14px",textAlign:"right"},children:s.common.actions})]})}),l("tbody",{children:[r.allowlist.map(c=>l("tr",{style:{borderBottom:"1px solid #f1f5f9"},"data-testid":`allowlist-row-${c.type}-${c.id}`,"data-allowlist-type":c.type,children:[e("td",{style:{padding:"10px 14px",color:"#475569"},children:h(s.common.idTemplate,{id:c.id})}),e("td",{style:{padding:"10px 14px",fontWeight:600,color:"#0f172a"},children:c.type==="group"?l("span",{"data-testid":`allowlist-group-${c.type}-${c.id}`,children:[c.groupName,e("span",{style:{marginLeft:"6px",fontFamily:"monospace",fontSize:"0.78rem",color:"#64748b"},children:c.groupKey})]}):e("span",{style:{fontFamily:"monospace"},children:c.pattern})}),e("td",{style:{padding:"10px 14px"},children:e("span",{style:{fontSize:"0.75rem",padding:"2px 8px",borderRadius:"10px",...de(c.type),fontWeight:600},children:le(c.type,s)})}),l("td",{style:{padding:"10px 14px",color:"#475569"},children:[c.description||s.common.none,c.owner.kind==="deployment"&&e("span",{"data-testid":`allowlist-owner-${c.type}-${c.id}`,style:{marginLeft:"8px",fontSize:"0.72rem",color:"#475569"},children:s.allowlistView.deploymentOwner})]}),e("td",{style:{padding:"10px 14px",textAlign:"right"},children:c.readOnly?e("span",{"data-testid":`readonly-allowlist-${c.type}-${c.id}`,style:{fontSize:"0.75rem",color:"#475569"},children:s.common.readOnly}):e("button",{type:"button",onClick:()=>{window.confirm(s.allowlistView.confirmDelete)&&(c.type==="group"?x(c.id):w(c.id))},disabled:o,"aria-busy":o,"aria-label":h(s.allowlistView.deleteAria,{target:c.type==="group"?c.groupName:c.pattern}),"data-testid":`remove-allowlist-btn-${c.type}-${c.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #fee2e2",backgroundColor:"#fff5f5",color:"#b91c1c",fontSize:"0.78rem",cursor:"pointer"},children:s.common.delete})})]},`${c.type}-${c.id}`)),r.allowlist.length===0&&e("tr",{children:e("td",{colSpan:5,style:{padding:"2rem",textAlign:"center",color:"#475569"},children:s.allowlistView.empty})})]})]})})]})}function ue(){let r=L(),n=D(),s=P(n),i=r.labels??R,o=i.directoryView,a=r.groups.filter(m=>!m.externalLink),[t,d]=v(""),[p,g]=v(""),[y,f]=v("direct"),w=r.groups.filter(m=>m.externalLink),x=new Set(r.allowlist.filter(m=>m.type==="group").map(m=>m.groupId)),c=m=>r.allowlist.find(u=>u.type==="group"&&u.groupId===m),A=n.state!=="idle",[C,I]=v(null),E=r.directoryStatus.isEnabled,T=m=>{m.preventDefault(),t&&p&&s({intent:"linkDirectoryGroup",groupId:t,provider:r.directoryStatus.provider,externalKey:p,membershipMode:y},()=>{g(""),d("")})};return l("section",{"data-testid":"directory-view-section",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[e("h2",{style:N,children:o.title}),e(V,{fetcher:n}),!E&&e("p",{"data-testid":"directory-not-wired",style:{margin:0,padding:"0.7rem 1rem",borderRadius:"6px",border:"1px solid #e2e8f0",backgroundColor:"#f8fafc",color:"#475569",fontSize:"0.85rem"},children:o.notWiredNotice}),E&&a.length===0&&e("p",{"data-testid":"directory-nothing-to-link",style:{margin:0,padding:"0.7rem 1rem",borderRadius:"6px",border:"1px solid #e2e8f0",backgroundColor:"#f8fafc",color:"#475569",fontSize:"0.85rem"},children:o.nothingToLink}),E&&a.length>0&&l("form",{onSubmit:T,"data-testid":"directory-link-form",style:{display:"flex",gap:"0.75rem",flexWrap:"wrap",alignItems:"flex-end",backgroundColor:"#ffffff",padding:"1rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:[l("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem"},children:[e("label",{htmlFor:"directory-group-select-input",style:K,children:o.selectGroup}),l("select",{id:"directory-group-select-input","data-testid":"directory-group-select",value:t,onChange:m=>d(m.target.value),style:{padding:"0.5rem",borderRadius:"6px",border:"1px solid #cbd5e1"},children:[e("option",{value:"",children:o.selectGroup}),a.map(m=>e("option",{value:String(m.id),children:h(o.groupOptionTemplate,{name:m.name,key:m.groupKey})},m.id))]})]}),l("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem",flex:1,minWidth:"220px"},children:[e("label",{htmlFor:"directory-external-key-input",style:K,children:o.externalKey}),e("input",{id:"directory-external-key-input",type:"email",required:!0,"data-testid":"directory-external-key",placeholder:o.externalKeyPlaceholder,value:p,onChange:m=>g(m.target.value),style:{padding:"0.5rem",borderRadius:"6px",border:"1px solid #cbd5e1"}})]}),l("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem"},children:[e("label",{htmlFor:"directory-membership-mode-input",style:K,children:o.membershipMode}),l("select",{id:"directory-membership-mode-input","data-testid":"directory-membership-mode",value:y,onChange:m=>f(m.target.value),style:{padding:"0.5rem",borderRadius:"6px",border:"1px solid #cbd5e1"},children:[e("option",{value:"direct",children:o.directMode}),e("option",{value:"transitive",children:o.transitiveMode})]})]}),e("button",{type:"submit","data-testid":"directory-link-submit",disabled:!(t&&p)||A,"aria-busy":A,style:{padding:"0.5rem 1rem",borderRadius:"6px",border:"none",backgroundColor:t&&p&&!A?"#2563eb":"#94a3b8",color:"#fff",fontWeight:600},children:o.link})]}),w.length===0?e("div",{"data-testid":"directory-empty",style:{padding:"2rem",textAlign:"center",color:"#64748b",backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0"},children:o.empty}):l("table",{"data-testid":"directory-table",style:{width:"100%",borderCollapse:"collapse",backgroundColor:"#ffffff",borderRadius:"8px",overflow:"hidden",border:"1px solid #e2e8f0"},children:[e("thead",{children:l("tr",{style:{backgroundColor:"#f8fafc",textAlign:"left"},children:[e("th",{style:G,children:i.groupsView.name}),e("th",{style:G,children:o.externalKey}),e("th",{style:G,children:o.membershipMode}),e("th",{style:G,children:o.lastSynced}),e("th",{style:G,children:i.common.status}),e("th",{style:G,children:i.common.actions})]})}),e("tbody",{children:w.map(m=>{let u=m.externalLink,z=x.has(m.id);return l("tr",{"data-testid":`directory-row-${m.id}`,"data-sync-enabled":String(u.isSyncEnabled),style:{borderTop:"1px solid #e2e8f0"},children:[l("td",{style:G,children:[m.name,e("div",{style:{fontSize:"0.75rem",color:"#64748b"},children:m.groupKey})]}),e("td",{style:G,"data-testid":`directory-external-${m.id}`,children:u.externalKey}),e("td",{style:G,children:u.membershipMode==="direct"?o.directMode:o.transitiveMode}),l("td",{style:G,"data-testid":`directory-synced-${m.id}`,children:[u.syncedAt?W(u.syncedAt,i):o.neverSynced,u.unresolvedCount>0?e("div",{style:{fontSize:"0.75rem",color:"#b45309"},"data-testid":`directory-unresolved-${m.id}`,children:h(o.unresolvedTemplate,{count:u.unresolvedCount})}):null]}),l("td",{style:G,children:[e("span",{"data-testid":`directory-status-${m.id}`,style:{fontSize:"0.75rem",padding:"2px 8px",borderRadius:"10px",backgroundColor:u.isSyncEnabled?"#dcfce7":"#fee2e2",color:u.isSyncEnabled?"#166534":"#b91c1c",fontWeight:600},children:u.isSyncEnabled?o.syncEnabled:o.syncPaused}),u.syncError?e("div",{style:{fontSize:"0.75rem",color:"#b91c1c",marginTop:"0.25rem"},"data-testid":`directory-error-${m.id}`,children:u.syncError}):null]}),e("td",{style:G,children:l("div",{style:{display:"flex",gap:"0.35rem",flexWrap:"wrap"},children:[e("button",{type:"button","data-testid":`directory-sync-now-${m.id}`,disabled:A,"aria-busy":A,"aria-label":h(o.syncNowAria,{group:m.name}),onClick:()=>s({intent:"requestDirectorySync",groupId:String(m.id)},()=>I(m.id)),style:$,children:C===m.id?o.syncQueued:o.syncNow}),e("button",{type:"button","data-testid":`directory-toggle-sync-${m.id}`,disabled:A,"aria-busy":A,"aria-label":h(u.isSyncEnabled?o.pauseAria:o.resumeAria,{group:m.name}),onClick:()=>s({intent:"setDirectorySyncEnabled",groupId:String(m.id),isSyncEnabled:String(!u.isSyncEnabled)}),style:$,children:u.isSyncEnabled?o.pause:o.resume}),e("button",{type:"button","data-testid":`directory-allow-${m.id}`,disabled:A,"aria-busy":A,"aria-label":h(z?o.disallowGroupAria:o.allowGroupAria,{group:m.name}),onClick:()=>{let b=c(m.id);if(z&&b){if(!window.confirm(o.confirmDisallow))return;s({intent:"removeAllowlistGroup",entryId:String(b.id)})}else s({intent:"addAllowlistGroup",groupId:String(m.id)})},style:$,children:z?o.disallowGroup:o.allowGroup}),e("button",{type:"button","data-testid":`directory-unlink-${m.id}`,disabled:A,"aria-busy":A,"aria-label":h(o.unlinkAria,{group:m.name}),onClick:()=>{window.confirm(o.confirmUnlink)&&s({intent:"unlinkDirectoryGroup",groupId:String(m.id)})},style:{...$,color:"#b91c1c",borderColor:"#fecaca"},children:o.unlink})]})})]},m.id)})})]})]})}var K={fontSize:"0.78rem",color:"#475569",fontWeight:600},N={margin:0,fontSize:"1.05rem",fontWeight:700,color:"#0f172a"},G={padding:"0.6rem 0.75rem",fontSize:"0.85rem",verticalAlign:"top"},$={padding:"0.25rem 0.6rem",fontSize:"0.75rem",borderRadius:"6px",border:"1px solid #cbd5e1",backgroundColor:"#fff",cursor:"pointer"},ce={users:H,groups:se,group_members:ae,allowlist:pe,directory:ue};function Ie({renderHeader:r}={}){let s=L()?.segment??"users",i=ce[s]??H;return e(Q,{renderHeader:r,children:e(i,{})})}export{pe as AllowlistView,Ie as AuthUserAdminAppView,ue as DirectoryView,ae as GroupMembersView,se as GroupsView,Q as UserAdminShell,H as UsersView,xe as createInMemoryUserAdminStore,he as createUserAdminApp,R as defaultUserAdminLabels,ge as jaUserAdminLabels,q as resolveUserAdminLabels};
1
+ var L={title:"Users & Groups",locale:"en-US",timeZone:"UTC",heading:"\u{1F464} User administration",common:{create:"Create",edit:"Edit",delete:"Delete",save:"Save",cancel:"Cancel",actions:"Actions",status:"Status",id:"ID",readOnly:"Read-only",managedUpstream:"Managed upstream",idTemplate:"#{id}",none:"-"},errors:{forbidden:"You do not have permission for this operation."},permissions:{label:"Your permissions:",canWrite:"Editable",canRead:"Read only",none:"No access",unknown:"Unknown"},tabs:{users:"\u{1F464} Users",groups:"\u{1F465} Groups",groupMembers:"\u{1F517} Members",allowlist:"\u2709\uFE0F Allowlist",directory:"\u{1F504} Directory"},usersView:{title:"Users",searchPlaceholder:"Search by name or email...",searchLabel:"Search users",addUser:"\uFF0B Add user",editUser:"Edit user",displayName:"Name",email:"Email",active:"Active",inactive:"Inactive",activate:"Activate",deactivate:"Deactivate",editUserAria:"Edit {user}",activateAria:"Activate {user}",deactivateAria:"Deactivate {user}",confirmDeactivate:"Deactivate this user? They will no longer be able to sign in.",empty:"No matching users"},groupsView:{emptyFiltered:"No group matches this search",title:"Groups",searchPlaceholder:"Search by group name or key...",searchLabel:"Search groups",addGroup:"\uFF0B Add group",editGroup:"Edit group",groupKey:"Group key",name:"Name",description:"Description",memberCountTemplate:"{count} members",confirmDelete:"Delete this group?",editGroupAria:"Edit {group}",deleteGroupAria:"Delete {group}",noDescription:"No description",groupKeyPlaceholder:"e.g. dev-team",namePlaceholder:"e.g. Development team",empty:"No groups registered"},groupMembersView:{title:"Group members",selectGroup:"Select a group",selectPrompt:"Select a group to manage its members",actionAdd:"Add",actionRemove:"Remove",actionAddAria:"Add {user} to this group",actionRemoveAria:"Remove {user} from this group",upstreamNotice:"Membership of this group is owned by the upstream directory. Edit it there \u2014 a local change would be reverted at the next synchronization.",membersOfTemplate:"Members of {group}",groupKeyLabel:"Group key"},allowlistView:{title:"Sign-in allowlist",addEntry:"\uFF0B Add pattern",pattern:"Pattern (e.g. @example.com or user@example.com)",type:"Type",emailType:"Exact email match",domainType:"Domain match",emailTypeShort:"Email",domainTypeShort:"Domain",groupTypeShort:"Group",target:"Target",description:"Description",deploymentOwner:"Deployment-wide",confirmDelete:"Remove this allowlist entry? Anyone who could sign in only through it will be locked out.",deleteAria:"Remove the allowlist entry for {target}",empty:"No allowlist entries registered"},directoryView:{title:"Directory synchronization",membershipMode:"Membership",directMode:"Direct only",transitiveMode:"Nested expanded",lastSynced:"Last synced",neverSynced:"Never",unresolvedTemplate:"{count} unresolved",syncPaused:"Paused",syncEnabled:"Active",syncNow:"Sync now",syncQueued:"Queued",staleWarning:"Synchronization is overdue. Until it runs, people removed upstream keep their access.",disabledWarning:"Directory synchronization is not wired for this deployment. Existing memberships remain in force and are no longer being refreshed.",pausedTemplate:"{paused} of {total} links are paused",erroredTemplate:"Last synchronization failed for {groups}",erroredItemTemplate:"{group}: {reason}",listSeparator:", ",oldestSyncedTemplate:"oldest successful sync: {at}",pendingTemplate:"{count} sync requests are queued",nothingToLink:"Every group is already linked to a directory.",notWiredNotice:"Directory synchronization is not wired for this deployment, so links cannot be created or changed here.",syncNowAria:"Synchronize {group} now",syncQueuedAria:"A synchronization of {group} is queued",pauseAria:"Pause synchronization of {group}",resumeAria:"Resume synchronization of {group}",allowGroupAria:"Allow members of {group} to sign in",disallowGroupAria:"Stop allowing members of {group} to sign in",unlinkAria:"Unlink {group} from the directory",confirmDisallow:"Stop allowing this group to sign in? Anyone who could sign in only through it will be locked out.",link:"Link to a directory group",unlink:"Unlink",externalKey:"Upstream group",empty:"No groups are linked to a directory",selectGroup:"Group to link",externalKeyPlaceholder:"e.g. dev-team@example.com",confirmUnlink:"Unlink this group? Its member ledger and group-based sign-in permission are removed.",pause:"Pause",resume:"Resume",allowGroup:"Allow sign-in",disallowGroup:"Stop allowing sign-in",groupOptionTemplate:"{name} ({key})"}},he={title:"\u30E6\u30FC\u30B6\u30FC\u30FB\u30B0\u30EB\u30FC\u30D7\u7BA1\u7406",locale:"ja-JP",timeZone:"Asia/Tokyo",heading:"\u{1F464} \u30E6\u30FC\u30B6\u30FC\u7BA1\u7406",common:{create:"\u4F5C\u6210",edit:"\u7DE8\u96C6",delete:"\u524A\u9664",save:"\u4FDD\u5B58",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",actions:"\u64CD\u4F5C",status:"\u72B6\u614B",id:"ID",readOnly:"\u5909\u66F4\u4E0D\u53EF",managedUpstream:"\u4E0A\u6D41\u304C\u6240\u6709",idTemplate:"#{id}",none:"-"},errors:{forbidden:"\u3053\u306E\u64CD\u4F5C\u3092\u884C\u3046\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002"},permissions:{label:"\u3042\u306A\u305F\u306E\u6A29\u9650:",canWrite:"\u7DE8\u96C6\u53EF",canRead:"\u95B2\u89A7\u306E\u307F",none:"\u6A29\u9650\u306A\u3057",unknown:"\u6A29\u9650\u4E0D\u660E"},tabs:{users:"\u{1F464} \u30E6\u30FC\u30B6\u30FC\u4E00\u89A7",groups:"\u{1F465} \u30E6\u30FC\u30B6\u30FC\u30B0\u30EB\u30FC\u30D7",groupMembers:"\u{1F517} \u30B0\u30EB\u30FC\u30D7\u30E1\u30F3\u30D0\u30FC",allowlist:"\u2709\uFE0F \u30A2\u30AF\u30BB\u30B9\u8A31\u53EF\u30EA\u30B9\u30C8",directory:"\u{1F504} \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u9023\u643A"},usersView:{title:"\u30E6\u30FC\u30B6\u30FC\u7BA1\u7406",searchPlaceholder:"\u8868\u793A\u540D\u3084 Email \u3067\u691C\u7D22...",searchLabel:"\u30E6\u30FC\u30B6\u30FC\u3092\u691C\u7D22",addUser:"\uFF0B \u30E6\u30FC\u30B6\u30FC\u8FFD\u52A0",editUser:"\u30E6\u30FC\u30B6\u30FC\u7DE8\u96C6",displayName:"\u8868\u793A\u540D",email:"Email",active:"\u6709\u52B9",inactive:"\u7121\u52B9",activate:"\u6709\u52B9\u5316",deactivate:"\u7121\u52B9\u5316",editUserAria:"{user} \u3092\u7DE8\u96C6",activateAria:"{user} \u3092\u6709\u52B9\u5316",deactivateAria:"{user} \u3092\u7121\u52B9\u5316",confirmDeactivate:"\u3053\u306E\u30E6\u30FC\u30B6\u30FC\u3092\u7121\u52B9\u5316\u3057\u307E\u3059\u304B\uFF1F \u4EE5\u5F8C\u30B5\u30A4\u30F3\u30A4\u30F3\u3067\u304D\u306A\u304F\u306A\u308A\u307E\u3059\u3002",empty:"\u8A72\u5F53\u3059\u308B\u30E6\u30FC\u30B6\u30FC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093"},groupsView:{emptyFiltered:"\u691C\u7D22\u6761\u4EF6\u306B\u4E00\u81F4\u3059\u308B\u30B0\u30EB\u30FC\u30D7\u306F\u3042\u308A\u307E\u305B\u3093",title:"\u30E6\u30FC\u30B6\u30FC\u30B0\u30EB\u30FC\u30D7\u7BA1\u7406",searchPlaceholder:"\u30B0\u30EB\u30FC\u30D7\u540D\u3084\u30AD\u30FC\u3067\u691C\u7D22...",searchLabel:"\u30B0\u30EB\u30FC\u30D7\u3092\u691C\u7D22",addGroup:"\uFF0B \u30B0\u30EB\u30FC\u30D7\u8FFD\u52A0",editGroup:"\u30B0\u30EB\u30FC\u30D7\u7DE8\u96C6",groupKey:"\u30B0\u30EB\u30FC\u30D7\u30AD\u30FC",name:"\u540D\u79F0",description:"\u8AAC\u660E",memberCountTemplate:"\u6240\u5C5E {count} \u540D",confirmDelete:"\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u3092\u524A\u9664\u3057\u307E\u3059\u304B\uFF1F",editGroupAria:"{group} \u3092\u7DE8\u96C6",deleteGroupAria:"{group} \u3092\u524A\u9664",noDescription:"\u8AAC\u660E\u306A\u3057",groupKeyPlaceholder:"\u4F8B: dev-team",namePlaceholder:"\u4F8B: \u958B\u767A\u30C1\u30FC\u30E0",empty:"\u30E6\u30FC\u30B6\u30FC\u30B0\u30EB\u30FC\u30D7\u304C\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},groupMembersView:{title:"\u30B0\u30EB\u30FC\u30D7\u30E1\u30F3\u30D0\u30FC\u7BA1\u7406",selectGroup:"\u30B0\u30EB\u30FC\u30D7\u9078\u629E",selectPrompt:"\u30B0\u30EB\u30FC\u30D7\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",actionAdd:"\u8FFD\u52A0",actionRemove:"\u9664\u5916",actionAddAria:"{user} \u3092\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u3078\u8FFD\u52A0",actionRemoveAria:"{user} \u3092\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u304B\u3089\u9664\u5916",upstreamNotice:"\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u306E\u6240\u5C5E\u306F\u4E0A\u6D41\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u6240\u6709\u3057\u3066\u3044\u307E\u3059\u3002\u5909\u66F4\u306F\u4E0A\u6D41\u3067\u884C\u3063\u3066\u304F\u3060\u3055\u3044 (\u3053\u3053\u3067\u5909\u3048\u3066\u3082\u6B21\u306E\u540C\u671F\u3067\u5143\u306B\u623B\u308A\u307E\u3059)\u3002",membersOfTemplate:"{group} \u306E\u6240\u5C5E\u30E1\u30F3\u30D0\u30FC",groupKeyLabel:"\u30B0\u30EB\u30FC\u30D7\u30AD\u30FC"},allowlistView:{title:"\u30B5\u30A4\u30F3\u30A4\u30F3\u8A31\u53EF\u30EA\u30B9\u30C8",addEntry:"\uFF0B \u30D1\u30BF\u30FC\u30F3\u8FFD\u52A0",pattern:"\u30D1\u30BF\u30FC\u30F3 (\u4F8B: @example.com \u307E\u305F\u306F user@example.com)",type:"\u7A2E\u5225",emailType:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u5B8C\u5168\u4E00\u81F4",domainType:"\u30C9\u30E1\u30A4\u30F3\u4E00\u81F4",emailTypeShort:"\u30E1\u30FC\u30EB",domainTypeShort:"\u30C9\u30E1\u30A4\u30F3",groupTypeShort:"\u30B0\u30EB\u30FC\u30D7",target:"\u5BFE\u8C61",description:"\u8AAC\u660E / \u5099\u8003",deploymentOwner:"\u914D\u5099\u5171\u901A",confirmDelete:"\u3053\u306E\u8A31\u53EF\u3092\u524A\u9664\u3057\u307E\u3059\u304B\uFF1F \u3053\u308C\u3067\u3057\u304B\u30B5\u30A4\u30F3\u30A4\u30F3\u3067\u304D\u306A\u3044\u4EBA\u306F\u30ED\u30B0\u30A4\u30F3\u3067\u304D\u306A\u304F\u306A\u308A\u307E\u3059\u3002",deleteAria:"{target} \u306E\u8A31\u53EF\u3092\u524A\u9664",empty:"\u30A2\u30ED\u30EF\u30EA\u30B9\u30C8\u30A8\u30F3\u30C8\u30EA\u304C\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},directoryView:{title:"\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u540C\u671F",membershipMode:"\u6240\u5C5E\u306E\u5C55\u958B",directMode:"\u76F4\u63A5\u6240\u5C5E\u306E\u307F",transitiveMode:"\u5165\u308C\u5B50\u3092\u5C55\u958B",lastSynced:"\u6700\u7D42\u540C\u671F",neverSynced:"\u672A\u5B9F\u884C",unresolvedTemplate:"{count} \u4EF6\u304C\u672A\u89E3\u6C7A",syncPaused:"\u505C\u6B62\u4E2D",syncEnabled:"\u6709\u52B9",syncNow:"\u4ECA\u3059\u3050\u540C\u671F",syncQueued:"\u540C\u671F\u3092\u8981\u6C42\u3057\u307E\u3057\u305F",staleWarning:"\u540C\u671F\u304C\u6EDE\u3063\u3066\u3044\u307E\u3059\u3002\u5B9F\u884C\u3055\u308C\u308B\u307E\u3067\u3001\u4E0A\u6D41\u304B\u3089\u5916\u308C\u305F\u4EBA\u306E\u30A2\u30AF\u30BB\u30B9\u306F\u6B8B\u308A\u7D9A\u3051\u307E\u3059\u3002",disabledWarning:"\u3053\u306E\u914D\u5099\u3067\u306F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u540C\u671F\u304C\u7D50\u7DDA\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u65E2\u5B58\u306E\u6240\u5C5E\u306F\u305D\u306E\u307E\u307E\u6709\u52B9\u3067\u3001\u66F4\u65B0\u3060\u3051\u304C\u6B62\u307E\u3063\u3066\u3044\u307E\u3059\u3002",pausedTemplate:"\u9023\u643A {total} \u4EF6\u306E\u3046\u3061 {paused} \u4EF6\u304C\u505C\u6B62\u4E2D",erroredTemplate:"\u76F4\u8FD1\u306E\u540C\u671F\u306B\u5931\u6557\u3057\u305F\u30B0\u30EB\u30FC\u30D7: {groups}",erroredItemTemplate:"{group}: {reason}",listSeparator:" / ",oldestSyncedTemplate:"\u6700\u3082\u53E4\u3044\u540C\u671F\u6210\u529F: {at}",pendingTemplate:"{count} \u4EF6\u306E\u540C\u671F\u8981\u6C42\u304C\u672A\u51E6\u7406",nothingToLink:"\u3059\u3079\u3066\u306E\u30B0\u30EB\u30FC\u30D7\u304C\u65E2\u306B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3068\u9023\u643A\u3057\u3066\u3044\u307E\u3059\u3002",notWiredNotice:"\u3053\u306E\u914D\u5099\u3067\u306F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u540C\u671F\u304C\u7D50\u7DDA\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u3053\u3053\u304B\u3089\u9023\u643A\u306E\u4F5C\u6210\u30FB\u5909\u66F4\u306F\u3067\u304D\u307E\u305B\u3093\u3002",syncNowAria:"{group} \u3092\u4ECA\u3059\u3050\u540C\u671F",syncQueuedAria:"{group} \u306E\u540C\u671F\u3092\u8981\u6C42\u6E08\u307F",pauseAria:"{group} \u306E\u540C\u671F\u3092\u4E00\u6642\u505C\u6B62",resumeAria:"{group} \u306E\u540C\u671F\u3092\u518D\u958B",allowGroupAria:"{group} \u306E\u30E1\u30F3\u30D0\u30FC\u306E\u30B5\u30A4\u30F3\u30A4\u30F3\u3092\u8A31\u53EF",disallowGroupAria:"{group} \u306E\u30E1\u30F3\u30D0\u30FC\u306E\u30B5\u30A4\u30F3\u30A4\u30F3\u8A31\u53EF\u3092\u5916\u3059",unlinkAria:"{group} \u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u9023\u643A\u3092\u89E3\u9664",confirmDisallow:"\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u306E\u30B5\u30A4\u30F3\u30A4\u30F3\u8A31\u53EF\u3092\u5916\u3057\u307E\u3059\u304B\uFF1F \u3053\u308C\u3067\u3057\u304B\u30B5\u30A4\u30F3\u30A4\u30F3\u3067\u304D\u306A\u3044\u4EBA\u306F\u30ED\u30B0\u30A4\u30F3\u3067\u304D\u306A\u304F\u306A\u308A\u307E\u3059\u3002",link:"\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30B0\u30EB\u30FC\u30D7\u3068\u9023\u643A\u3059\u308B",unlink:"\u9023\u643A\u3092\u89E3\u9664",externalKey:"\u4E0A\u6D41\u30B0\u30EB\u30FC\u30D7",empty:"\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3068\u9023\u643A\u3057\u3066\u3044\u308B\u30B0\u30EB\u30FC\u30D7\u306F\u3042\u308A\u307E\u305B\u3093",selectGroup:"\u9023\u643A\u3059\u308B\u30B0\u30EB\u30FC\u30D7",externalKeyPlaceholder:"\u4F8B: dev-team@example.com",confirmUnlink:"\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u306E\u9023\u643A\u3092\u89E3\u9664\u3057\u307E\u3059\u304B\uFF1F \u30E1\u30F3\u30D0\u30FC\u53F0\u5E33\u3068\u30B0\u30EB\u30FC\u30D7\u5358\u4F4D\u306E\u30B5\u30A4\u30F3\u30A4\u30F3\u8A31\u53EF\u304C\u5931\u308F\u308C\u307E\u3059\u3002",pause:"\u4E00\u6642\u505C\u6B62",resume:"\u518D\u958B",allowGroup:"\u30B5\u30A4\u30F3\u30A4\u30F3\u3092\u8A31\u53EF",disallowGroup:"\u30B5\u30A4\u30F3\u30A4\u30F3\u8A31\u53EF\u3092\u5916\u3059",groupOptionTemplate:"{name} ({key})"}};function J(r){let o=L;return r?{title:r.title??o.title,locale:r.locale??o.locale,timeZone:r.timeZone??o.timeZone,heading:r.heading??o.heading,common:{...o.common,...r.common},errors:{...o.errors,...r.errors},permissions:{...o.permissions,...r.permissions},tabs:{...o.tabs,...r.tabs},usersView:{...o.usersView,...r.usersView},groupsView:{...o.groupsView,...r.groupsView},groupMembersView:{...o.groupMembersView,...r.groupMembersView},allowlistView:{...o.allowlistView,...r.allowlistView},directoryView:{...o.directoryView,...r.directoryView}}:o}import{data as ie}from"react-router";function ke(r){let o=r?.users??[{id:1,email:"admin@example.com",displayName:"\u30B7\u30B9\u30C6\u30E0\u7BA1\u7406\u8005",isActive:!0},{id:2,email:"user1@example.com",displayName:"\u958B\u767A \u592A\u90CE",isActive:!0},{id:3,email:"user2@example.com",displayName:"\u55B6\u696D \u82B1\u5B50",isActive:!0}],n=r?.groups??[{id:1,groupKey:"dev-team",name:"\u958B\u767A\u30C1\u30FC\u30E0",description:"\u30B7\u30B9\u30C6\u30E0\u958B\u767A\u62C5\u5F53\u30B0\u30EB\u30FC\u30D7",isActive:!0,readOnly:!1},{id:2,groupKey:"sales-dept",name:"\u55B6\u696D\u90E8",description:"\u55B6\u696D\u30BD\u30EA\u30E5\u30FC\u30B7\u30E7\u30F3\u62C5\u5F53",isActive:!0,readOnly:!1}],y=r?.groupMembers??[{id:1,groupId:1,userId:2},{id:2,groupId:2,userId:3}],d=r?.allowlist??[{id:1,pattern:"admin@example.com",type:"email",description:"\u521D\u671F\u7BA1\u7406\u8005",owner:{kind:"tenant",tenantId:"default"},readOnly:!1},{id:2,pattern:"@example.com",type:"domain",description:"\u793E\u5185\u30C9\u30E1\u30A4\u30F3",owner:{kind:"tenant",tenantId:"default"},readOnly:!1}];return{async listUsers(){return[...o]},async createUser(e){let i={id:Math.max(...o.map(s=>s.id),0)+1,email:e.email,displayName:e.displayName,isActive:!0};return o.push(i),i},async updateUser(e,i){let s=o.findIndex(m=>m.id===e);if(s===-1)throw new Error(`User not found: ${e}`);return o[s]={...o[s],displayName:i.displayName,email:i.email},o[s]},async toggleUserActive(e,i){let s=o.findIndex(m=>m.id===e);if(s===-1)throw new Error(`User not found: ${e}`);return o[s]={...o[s],isActive:i},o[s]},async listGroups(){return[...n]},async createGroup(e){let i={id:Math.max(...n.map(s=>s.id),0)+1,groupKey:e.groupKey,name:e.name,description:e.description,isActive:!0,readOnly:!1};return n.push(i),i},async updateGroup(e,i){let s=n.findIndex(m=>m.id===e);if(s===-1)throw new Error(`Group not found: ${e}`);return n[s]={...n[s],name:i.name,description:i.description},n[s]},async deleteGroup(e){n=n.filter(i=>i.id!==e),y=y.filter(i=>i.groupId!==e)},async listGroupMembers(){return[...y]},async addGroupMember(e,i){let s=y.find(c=>c.groupId===e&&c.userId===i);if(s)return s;let m={id:Math.max(...y.map(c=>c.id),0)+1,groupId:e,userId:i};return y.push(m),m},async removeGroupMember(e,i){y=y.filter(s=>!(s.groupId===e&&s.userId===i))},async listAllowlist(){return[...d]},async addAllowlistEntry(e){let i={id:Math.max(...d.map(s=>s.id),0)+1,pattern:e.pattern,type:e.type,description:e.description,owner:{kind:"tenant",tenantId:"default"},readOnly:!1};return d.push(i),i},async removeAllowlistEntry(e){d=d.filter(i=>i.id!==e)},async addAllowlistGroup(e,i){let s=n.find(m=>m.id===e);if(!s)throw new Error(`Group not found: ${e}`);d=[...d,{id:Math.max(...d.map(m=>m.id),0)+1,type:"group",groupId:e,groupKey:s.groupKey,groupName:s.name,description:i,owner:{kind:"tenant",tenantId:"default"},readOnly:!1}]},async removeAllowlistGroup(e){d=d.filter(i=>!(i.type==="group"&&i.id===e))},async linkDirectoryGroup(){throw new Error("This in-memory store has no upstream directory; inject a real store to link groups.")},async unlinkDirectoryGroup(){throw new Error("This in-memory store has no upstream directory; inject a real store to unlink groups.")},async setDirectorySyncEnabled(){throw new Error("This in-memory store has no upstream directory; inject a real store to pause synchronization.")},async requestDirectorySync(){throw new Error("This in-memory store has no upstream directory; inject a real store to request a sync.")},async getDirectoryStatus(){return{isEnabled:!1,provider:"",linkedGroupCount:0,isStale:!1,pausedGroupCount:0,stalenessThresholdSec:0,erroredGroupIds:[],pendingRequestCount:0}}}}function oe(r){return typeof r=="object"&&r!==null&&r.status===403}function ne(r){let o=String(r.get("type")??"");if(o==="email"||o==="domain")return o;throw new Error(`type \u306F "email" \u307E\u305F\u306F "domain" \u306E\u3044\u305A\u308C\u304B\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044 (\u53D7\u3051\u53D6\u3063\u305F\u5024: ${JSON.stringify(o)})`)}var se=new Map([["createUser",["create"]],["updateUser",["update"]],["toggleUserActive",["update"]],["createGroup",["create"]],["updateGroup",["update"]],["deleteGroup",["delete"]],["addGroupMember",["create"]],["removeGroupMember",["delete"]],["addAllowlistEntry",["create"]],["removeAllowlistEntry",["delete"]],["addAllowlistGroup",["create"]],["removeAllowlistGroup",["delete"]],["linkDirectoryGroup",["update","create","delete"]],["unlinkDirectoryGroup",["update","delete"]],["setDirectorySyncEnabled",["update"]],["requestDirectorySync",["update"]]]);function R(r,o){let n=r.get(o),y=Number(n);if(n===null||String(n).trim()===""||!Number.isInteger(y)||y<=0)throw new Error(`Invalid or missing "${o}"`);return y}function I(r,o){let n=String(r.get(o)??"").trim();if(n==="")throw new Error(`Invalid or missing "${o}"`);return n}function ae(r,o){let n=String(r.get(o)??"");if(n!=="true"&&n!=="false")throw new Error(`Invalid or missing "${o}"`);return n==="true"}function de(r){let o=String(r.get("membershipMode")??"");if(o!=="direct"&&o!=="transitive")throw new Error('Invalid or missing "membershipMode"');return o}function j(r,o){let n=String(r.get(o)??"").trim();return n===""?void 0:n}function Se(r){let o=J(r.labels);async function n({request:e}){await r.guards.requireAccess(e,{action:"read",intent:"loader"});let s=new URL(e.url).pathname.split("/").filter(Boolean),m=s[s.length-1]??"users",[c,f,l,h,k,x]=await Promise.all([r.store.listUsers(),r.store.listGroups(),r.store.listGroupMembers(),r.store.listAllowlist(),r.store.getDirectoryStatus(),r.getMyPermissions?r.getMyPermissions(e).catch(p=>(console.error("[@aiquants/auth-react-router] getMyPermissions failed; rendering the permission badge as unknown:",p),null)):Promise.resolve(null)]);return{resourceLabels:r.resourceLabels,segment:["groups","group_members","allowlist","directory"].includes(m)?m:"users",users:c,groups:f,groupMembers:l,allowlist:h,directoryStatus:k,myPermissions:x,labels:o}}async function y({request:e}){let i=await e.formData(),s=String(i.get("intent")??""),m=se.get(s);if(!m)return{ok:!1,error:`Unknown intent: ${s}`};let c=l=>oe(l),f=l=>{try{r.guards.onDenied?.({intent:s,actions:m,error:l})}catch{}return ie({ok:!1,error:o.errors.forbidden},{status:403})};try{for(let l of m)await r.guards.requireAccess(e,{action:l,intent:s})}catch(l){if(!c(l))throw l;return f(l)}try{return await d(s,i)}catch(l){if(c(l))return f(l);if(l instanceof Response)throw l;return{ok:!1,error:l instanceof Error?l.message:String(l)}}}async function d(e,i){if(e==="createUser")return await r.store.createUser({displayName:I(i,"displayName"),email:I(i,"email")}),{ok:!0};if(e==="updateUser")return await r.store.updateUser(R(i,"userId"),{displayName:I(i,"displayName"),email:I(i,"email")}),{ok:!0};if(e==="toggleUserActive"){let s=String(i.get("isActive")??"");if(s!=="true"&&s!=="false")throw new Error('Invalid or missing "isActive"');return await r.store.toggleUserActive(R(i,"userId"),s==="true"),{ok:!0}}if(e==="createGroup")return await r.store.createGroup({groupKey:I(i,"groupKey"),name:I(i,"name"),description:j(i,"description")}),{ok:!0};if(e==="updateGroup")return await r.store.updateGroup(R(i,"groupId"),{name:I(i,"name"),description:j(i,"description")}),{ok:!0};if(e==="deleteGroup")return await r.store.deleteGroup(R(i,"groupId")),{ok:!0};if(e==="addGroupMember")return await r.store.addGroupMember(R(i,"groupId"),R(i,"userId")),{ok:!0};if(e==="removeGroupMember")return await r.store.removeGroupMember(R(i,"groupId"),R(i,"userId")),{ok:!0};if(e==="addAllowlistEntry"){let s=ne(i);return await r.store.addAllowlistEntry({pattern:I(i,"pattern"),type:s,description:j(i,"description")}),{ok:!0}}if(e==="addAllowlistGroup")return await r.store.addAllowlistGroup(R(i,"groupId"),j(i,"description")),{ok:!0};if(e==="removeAllowlistGroup")return await r.store.removeAllowlistGroup(R(i,"entryId")),{ok:!0};if(e==="linkDirectoryGroup")return await r.store.linkDirectoryGroup(R(i,"groupId"),{provider:I(i,"provider"),externalKey:I(i,"externalKey"),membershipMode:de(i)}),{ok:!0};if(e==="unlinkDirectoryGroup")return await r.store.unlinkDirectoryGroup(R(i,"groupId")),{ok:!0};if(e==="setDirectorySyncEnabled")return await r.store.setDirectorySyncEnabled(R(i,"groupId"),ae(i,"isSyncEnabled")),{ok:!0};if(e==="requestDirectorySync"){let s=String(i.get("groupId")??"").trim();return await r.store.requestDirectorySync(s===""?null:R(i,"groupId")),{ok:!0}}return e==="removeAllowlistEntry"?(await r.store.removeAllowlistEntry(R(i,"entryId")),{ok:!0}):{ok:!1,error:`Unknown intent: ${e}`}}return{loader:n,action:y}}import{Link as le,useLoaderData as pe}from"react-router";function v(r,o){return Object.entries(o).reduce((n,[y,d])=>n.replaceAll(`{${y}}`,String(d)),r)}function Q(r,o){let n=/(?:Z|[+-]\d{2}:?\d{2})$/.test(r)?r:`${r}Z`;try{return new Intl.DateTimeFormat(o.locale,{timeZone:o.timeZone,dateStyle:"medium",timeStyle:"short"}).format(new Date(n))}catch{return r}}import{jsx as U,jsxs as F}from"react/jsx-runtime";function Y({label:r,summary:o}){return F("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.18rem",fontSize:"0.65rem",padding:"0.08rem 0.35rem",borderRadius:"9999px",backgroundColor:o.bgColor,color:o.color,border:`1px solid ${o.borderColor}`,fontWeight:600,lineHeight:"1.2"},children:[F("span",{children:[r,":"]}),U("span",{children:o.text})]})}function ue({status:r,labels:o,groups:n}){if(!r||r.linkedGroupCount===0)return null;let y=o.directoryView,d=[];if(r.isEnabled||d.push({id:"disabled",text:y.disabledWarning}),r.pausedGroupCount>0&&d.push({id:"paused",text:v(y.pausedTemplate,{paused:r.pausedGroupCount,total:r.linkedGroupCount})}),r.isStale){let e=r.oldestSyncedAt?Q(r.oldestSyncedAt,o):y.neverSynced;d.push({id:"stale",text:`${y.staleWarning} ${v(y.oldestSyncedTemplate,{at:e})}`})}if(r.erroredGroupIds.length>0){let e=r.erroredGroupIds.map(i=>{let s=n.find(c=>c.id===i);if(!s)return v(o.common.idTemplate,{id:i});let m=s.externalLink?.syncError;return m?v(y.erroredItemTemplate,{group:s.name,reason:m}):s.name});d.push({id:"errored",text:v(y.erroredTemplate,{groups:e.join(y.listSeparator)})})}return r.pendingRequestCount>0&&d.push({id:"pending",text:v(y.pendingTemplate,{count:r.pendingRequestCount})}),d.length===0?null:F("section",{"aria-labelledby":"directory-sync-heading","data-testid":"directory-sync-banner",style:{display:"flex",flexDirection:"column",gap:"0.35rem",padding:"0.7rem 1rem",marginBottom:"1rem",borderRadius:"6px",border:"1px solid #fde68a",backgroundColor:"#fffbeb",color:"#92400e",fontSize:"0.85rem"},children:[U("h2",{id:"directory-sync-heading",style:{margin:0,fontSize:"0.9rem",fontWeight:700},children:y.title}),d.map(e=>U("span",{"data-directory-warning":e.id,children:e.text},e.id))]})}function X({children:r,renderHeader:o}){let n=pe(),y=n?.segment??"users",d=n?.labels??L,e=n?.myPermissions??null,i=n?.resourceLabels??{},s=x=>Object.hasOwn(i,x)?i[x]:x,m=[{key:"users",label:d.tabs.users,href:"/users"},{key:"groups",label:d.tabs.groups,href:"/users/groups"},{key:"group_members",label:d.tabs.groupMembers,href:"/users/group_members"},{key:"allowlist",label:d.tabs.allowlist,href:"/users/allowlist"}],c=(n?.groups??[]).some(x=>x.externalLink);(n?.directoryStatus?.isEnabled||(n?.directoryStatus?.linkedGroupCount??0)>0||c)&&m.push({key:"directory",label:d.tabs.directory,href:"/users/directory"});let f=Object.entries(e??{}),l=x=>x?.canWrite?{text:d.permissions.canWrite,color:"#047857",bgColor:"#ecfdf5",borderColor:"#a7f3d0"}:x?.canRead?{text:d.permissions.canRead,color:"#1d4ed8",bgColor:"#eff6ff",borderColor:"#bfdbfe"}:{text:d.permissions.none,color:"#475569",bgColor:"#f1f5f9",borderColor:"#cbd5e1"},h={text:d.permissions.unknown,color:"#92400e",bgColor:"#fffbeb",borderColor:"#fde68a"},k=F("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem"},"data-testid":"user-admin-header-annotation",children:[U("span",{style:{fontSize:"0.75rem",backgroundColor:"#e0f2fe",color:"#0369a1",padding:"2px 8px",borderRadius:"12px",fontWeight:600},children:d.heading}),F("div",{style:{display:"inline-flex",alignItems:"center",gap:"0.25rem",fontSize:"0.68rem",color:"#475569"},"data-testid":"user-admin-permissions-badge",children:[U("span",{style:{fontWeight:600,color:"#334155"},children:d.permissions.label}),U("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.18rem"},children:f.length===0?U("span",{"data-testid":"user-admin-permission-unavailable",children:U(Y,{label:d.heading,summary:h})}):f.map(([x,p])=>U(Y,{label:s(x),summary:l(p)},x))})]})]});return F("div",{"data-testid":"user-admin-shell",style:{width:"100%",minHeight:"100vh",backgroundColor:"#f8fafc",padding:"1.5rem",boxSizing:"border-box"},children:[o?o({title:d.title,annotation:k}):F("div",{style:{marginBottom:"1.5rem",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[U("h1",{style:{margin:0,fontSize:"1.5rem",fontWeight:700,color:"#0f172a"},children:d.title}),k]}),U("nav",{"aria-label":d.title,style:{display:"flex",gap:"0.5rem",marginBottom:"1.2rem",borderBottom:"2px solid #e2e8f0",paddingBottom:"0.5rem"},children:m.map(x=>{let p=y===x.key;return U(le,{to:x.href,"data-testid":`user-admin-tab-${x.key}`,"aria-current":p?"page":void 0,style:{padding:"0.5rem 1rem",borderRadius:"6px 6px 0 0",fontSize:"0.88rem",fontWeight:p?700:500,color:p?"#0284c7":"#64748b",backgroundColor:p?"#ffffff":"transparent",textDecoration:"none",borderBottom:p?"3px solid #0284c7":"3px solid transparent",transition:"all 0.15s ease"},children:x.label},x.key)})}),U(ue,{status:n?.directoryStatus,labels:d,groups:n?.groups??[]}),U("main",{children:r})]})}import{useEffect as te,useRef as B,useState as S}from"react";import{useFetcher as W,useLoaderData as K}from"react-router";import{Fragment as xe,jsx as t,jsxs as a}from"react/jsx-runtime";function D({result:r,id:o}){let n=r;return n?.ok!==!1||!n.error?null:t("div",{id:o,"data-testid":"user-admin-action-error",role:"alert",style:{gridColumn:"1 / -1",padding:"0.7rem 1rem",borderRadius:"6px",border:"1px solid #fecaca",backgroundColor:"#fef2f2",color:"#b91c1c",fontSize:"0.85rem"},children:n.error})}function O(r){let o=B(null),[n,y]=S(void 0),d=r.data===n?void 0:r.data;return te(()=>{if(r.state!=="idle"||r.data===void 0)return;let s=o.current;s&&(o.current=null,r.data.ok===!0&&s())},[r.state,r.data]),{submit:(s,m)=>{o.current=m??null,y(void 0),r.submit(s,{method:"post"})},resetResult:()=>y(r.data),result:d}}function Z(r,o,n){let y=B(null),d=B(o);return d.current=o,te(()=>{if(!r)return;let e=y.current,i=n?.current??document.activeElement,s=()=>Array.from(e?.querySelectorAll('a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])')??[]);s()[0]?.focus();let m=c=>{if(c.key==="Escape"){if(c.isComposing||c.keyCode===229)return;c.preventDefault(),d.current();return}if(c.key!=="Tab")return;let f=s();if(f.length===0)return;let l=f[0],h=f[f.length-1],k=document.activeElement,x=!e?.contains(k);c.shiftKey&&(k===l||x)?(c.preventDefault(),h.focus()):!c.shiftKey&&(k===h||x)&&(c.preventDefault(),l.focus())};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m),i?.focus?.()}},[r,n]),y}function re(){let r=K(),o=W(),{submit:n,resetResult:y,result:d}=O(o),e=r.labels??L,[i,s]=S(""),[m,c]=S(null),f=m?.kind==="edit"?m.user:null,l=m?.kind==="create",h=B(null),k=(b,P)=>{h.current=P.currentTarget,y(),c(b)},[x,p]=S(""),[A,G]=S(""),N=Z(l,()=>c(null),h),z=Z(f!==null,()=>c(null),h),M=o.state!=="idle",u=r.users.filter(b=>b.displayName.toLowerCase().includes(i.toLowerCase())||b.email.toLowerCase().includes(i.toLowerCase())),w=b=>{b.isActive&&!window.confirm(e.usersView.confirmDeactivate)||n({intent:"toggleUserActive",userId:String(b.id),isActive:String(!b.isActive)})},T=b=>{if(b.preventDefault(),!(x&&A))return;let P=x,g=A;n({intent:"createUser",displayName:P,email:g},()=>{p(C=>C===P?"":C),G(C=>C===g?"":C),c(null)})},$=b=>{b.preventDefault(),f&&n({intent:"updateUser",userId:String(f.id),displayName:f.displayName,email:f.email},()=>c(null))};return a("section",{"data-testid":"users-view-section",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[t("h2",{style:q,children:e.usersView.title}),!m&&t(D,{result:d}),a("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"#ffffff",padding:"1rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:[t("input",{type:"text","aria-label":e.usersView.searchLabel,placeholder:e.usersView.searchPlaceholder,value:i,onChange:b=>s(b.target.value),"data-testid":"users-search-input",style:{padding:"6px 12px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",width:"260px"}}),t("button",{type:"button",onClick:b=>k({kind:"create"},b),"data-testid":"users-add-button",style:{padding:"6px 14px",borderRadius:"6px",backgroundColor:"#0284c7",color:"#ffffff",border:"none",fontSize:"0.85rem",fontWeight:600,cursor:"pointer"},children:e.usersView.addUser})]}),t("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0",overflow:"hidden"},children:a("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"0.85rem",textAlign:"left"},children:[t("thead",{children:a("tr",{style:{backgroundColor:"#f8fafc",borderBottom:"1px solid #e2e8f0",color:"#475569"},children:[t("th",{style:{padding:"10px 14px"},children:e.common.id}),t("th",{style:{padding:"10px 14px"},children:e.usersView.displayName}),t("th",{style:{padding:"10px 14px"},children:e.usersView.email}),t("th",{style:{padding:"10px 14px"},children:e.common.status}),t("th",{style:{padding:"10px 14px",textAlign:"right"},children:e.common.actions})]})}),a("tbody",{children:[u.map(b=>a("tr",{style:{borderBottom:"1px solid #f1f5f9"},"data-testid":`user-row-${b.id}`,children:[t("td",{style:{padding:"10px 14px",color:"#475569"},children:v(e.common.idTemplate,{id:b.id})}),t("td",{style:{padding:"10px 14px",fontWeight:600,color:"#0f172a"},children:b.displayName}),t("td",{style:{padding:"10px 14px",color:"#475569"},children:b.email}),t("td",{style:{padding:"10px 14px"},children:t("span",{style:{fontSize:"0.75rem",padding:"2px 8px",borderRadius:"10px",backgroundColor:b.isActive?"#dcfce7":"#fee2e2",color:b.isActive?"#15803d":"#b91c1c",fontWeight:600},children:b.isActive?e.usersView.active:e.usersView.inactive})}),a("td",{style:{padding:"10px 14px",textAlign:"right"},children:[t("button",{type:"button",onClick:P=>k({kind:"edit",user:b},P),"aria-label":v(e.usersView.editUserAria,{user:b.displayName}),"data-testid":`edit-user-btn-${b.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"0.78rem",cursor:"pointer",marginRight:"6px"},children:e.common.edit}),t("button",{type:"button",onClick:()=>w(b),disabled:M,"aria-busy":M,"aria-label":v(b.isActive?e.usersView.deactivateAria:e.usersView.activateAria,{user:b.displayName}),"data-testid":`toggle-user-btn-${b.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"0.78rem",cursor:M?"default":"pointer",color:b.isActive?"#b91c1c":"#15803d"},children:b.isActive?e.usersView.deactivate:e.usersView.activate})]})]},b.id)),u.length===0&&t("tr",{children:t("td",{colSpan:5,style:{padding:"2rem",textAlign:"center",color:"#475569"},children:e.usersView.empty})})]})]})}),l&&t("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},children:a("form",{ref:N,onSubmit:T,role:"dialog","aria-modal":"true","aria-labelledby":"create-user-title","aria-describedby":"create-user-error","data-testid":"user-create-modal",style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[t("h3",{id:"create-user-title",style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:e.usersView.addUser}),t(D,{result:d,id:"create-user-error"}),a("div",{style:{marginBottom:"1rem"},children:[t("label",{htmlFor:"create-user-display-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:e.usersView.displayName}),t("input",{id:"create-user-display-name-input",type:"text",value:x,onChange:b=>p(b.target.value),required:!0,"data-testid":"create-user-display-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),a("div",{style:{marginBottom:"1.2rem"},children:[t("label",{htmlFor:"create-user-email-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:e.usersView.email}),t("input",{id:"create-user-email-input",type:"email",value:A,onChange:b=>G(b.target.value),required:!0,"data-testid":"create-user-email",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),a("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[t("button",{type:"button",onClick:()=>c(null),"data-testid":"cancel-create-user",style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:e.common.cancel}),t("button",{type:"submit","data-testid":"submit-create-user",disabled:M,"aria-busy":M,style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#0284c7",color:"#ffffff",border:"none",cursor:"pointer"},children:e.common.create})]})]})}),f&&t("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},children:a("form",{ref:z,onSubmit:$,role:"dialog","aria-modal":"true","aria-labelledby":"edit-user-title","aria-describedby":"edit-user-error","data-testid":"user-edit-modal",style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[t("h3",{id:"edit-user-title",style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:e.usersView.editUser}),t(D,{result:d,id:"edit-user-error"}),a("div",{style:{marginBottom:"1rem"},children:[t("label",{htmlFor:"edit-user-display-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:e.usersView.displayName}),t("input",{id:"edit-user-display-name-input",type:"text",value:f.displayName,onChange:b=>c({kind:"edit",user:{...f,displayName:b.target.value}}),required:!0,"data-testid":"edit-user-display-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),a("div",{style:{marginBottom:"1.2rem"},children:[t("label",{htmlFor:"edit-user-email-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:e.usersView.email}),t("input",{id:"edit-user-email-input",type:"email",value:f.email,onChange:b=>c({kind:"edit",user:{...f,email:b.target.value}}),required:!0,"data-testid":"edit-user-email",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),a("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[t("button",{type:"button",onClick:()=>c(null),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:e.common.cancel}),t("button",{type:"submit","data-testid":"submit-edit-user",disabled:M,"aria-busy":M,style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#0284c7",color:"#ffffff",border:"none",cursor:"pointer"},children:e.common.save})]})]})})]})}function ce(){let r=K(),o=W(),{submit:n,resetResult:y,result:d}=O(o),e=r.labels??L,[i,s]=S(""),[m,c]=S(null),f=m?.kind==="edit"?m.group:null,l=m?.kind==="create",h=B(null),k=(g,C)=>{h.current=C.currentTarget,y(),c(g)},x=o.state!=="idle",[p,A]=S(""),[G,N]=S(""),[z,M]=S(""),u=Z(l,()=>c(null),h),w=Z(f!==null,()=>c(null),h),T=r.groups.filter(g=>g.name.toLowerCase().includes(i.toLowerCase())||g.groupKey.toLowerCase().includes(i.toLowerCase())),$=g=>{if(g.preventDefault(),!(p&&G))return;let C={key:p,name:G,description:z};n({intent:"createGroup",groupKey:C.key,name:C.name,description:C.description},()=>{A(E=>E===C.key?"":E),N(E=>E===C.name?"":E),M(E=>E===C.description?"":E),c(null)})},b=g=>{g.preventDefault(),f&&n({intent:"updateGroup",groupId:String(f.id),name:f.name,description:f.description??""},()=>c(null))},P=g=>{window.confirm(e.groupsView.confirmDelete)&&n({intent:"deleteGroup",groupId:String(g)})};return a("section",{"data-testid":"groups-view-section",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[t("h2",{style:q,children:e.groupsView.title}),!m&&t(D,{result:d}),a("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"#ffffff",padding:"1rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:[t("input",{type:"text","aria-label":e.groupsView.searchLabel,placeholder:e.groupsView.searchPlaceholder,value:i,onChange:g=>s(g.target.value),"data-testid":"groups-search-input",style:{padding:"6px 12px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",width:"260px"}}),t("button",{type:"button",onClick:g=>k({kind:"create"},g),"data-testid":"groups-add-button",style:{padding:"6px 14px",borderRadius:"6px",backgroundColor:"#4338ca",color:"#ffffff",border:"none",fontSize:"0.85rem",fontWeight:600,cursor:"pointer"},children:e.groupsView.addGroup})]}),t("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:"1rem"},children:T.map(g=>{let C=r.groupMembers.filter(E=>E.groupId===g.id).length;return a("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0",padding:"1rem",display:"flex",flexDirection:"column",justifyContent:"space-between"},"data-testid":`group-card-${g.id}`,"data-group-readonly":g.readOnly?"true":"false",children:[a("div",{children:[a("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.5rem"},children:[t("h4",{style:{margin:0,fontSize:"1rem",color:"#0f172a"},children:g.name}),t("span",{style:{fontSize:"0.72rem",backgroundColor:"#e0e7ff",color:"#4338ca",padding:"2px 6px",borderRadius:"4px",fontFamily:"monospace"},children:g.groupKey})]}),t("p",{style:{margin:"0 0 0.8rem 0",fontSize:"0.82rem",color:"#64748b",minHeight:"2.4em"},children:g.description||e.groupsView.noDescription}),g.externalLink&&a("div",{"data-testid":`group-source-${g.id}`,style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap",marginBottom:"0.6rem"},children:[t("span",{style:{fontSize:"0.72rem",padding:"2px 8px",borderRadius:"10px",backgroundColor:"#ede9fe",color:"#6d28d9",fontWeight:600},children:e.common.managedUpstream}),t("span",{style:{fontSize:"0.72rem",fontFamily:"monospace",color:"#64748b"},children:g.externalLink.externalKey}),g.externalLink.unresolvedCount>0&&t("span",{"data-testid":`group-unresolved-${g.id}`,style:{fontSize:"0.72rem",color:"#b45309"},children:v(e.directoryView.unresolvedTemplate,{count:g.externalLink.unresolvedCount})})]})]}),a("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",borderTop:"1px solid #f1f5f9",paddingTop:"0.6rem"},children:[t("span",{style:{fontSize:"0.78rem",color:"#475569"},"data-testid":`group-member-count-${g.id}`,children:v(e.groupsView.memberCountTemplate,{count:C})}),g.readOnly?t("span",{"data-testid":`readonly-group-${g.id}`,style:{fontSize:"0.75rem",color:"#475569"},children:e.common.readOnly}):a("div",{children:[t("button",{type:"button",onClick:E=>k({kind:"edit",group:g},E),disabled:x,"aria-busy":x,"aria-label":v(e.groupsView.editGroupAria,{group:g.name}),"data-testid":`edit-group-btn-${g.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"0.75rem",cursor:"pointer",marginRight:"4px"},children:e.common.edit}),t("button",{type:"button",onClick:()=>P(g.id),disabled:x,"aria-busy":x,"aria-label":v(e.groupsView.deleteGroupAria,{group:g.name}),"data-testid":`delete-group-btn-${g.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #fee2e2",backgroundColor:"#fff5f5",color:"#b91c1c",fontSize:"0.75rem",cursor:"pointer"},children:e.common.delete})]})]})]},g.id)})}),T.length===0&&t("div",{"data-testid":"groups-empty",style:{padding:"2rem",textAlign:"center",color:"#475569",backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0"},children:r.groups.length===0?e.groupsView.empty:e.groupsView.emptyFiltered}),l&&t("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},children:a("form",{ref:u,onSubmit:$,role:"dialog","aria-modal":"true","aria-labelledby":"create-group-title","aria-describedby":"create-group-error","data-testid":"group-create-modal",style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[t("h3",{id:"create-group-title",style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:e.groupsView.addGroup}),t(D,{result:d,id:"create-group-error"}),a("div",{style:{marginBottom:"1rem"},children:[t("label",{htmlFor:"create-group-key-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:e.groupsView.groupKey}),t("input",{id:"create-group-key-input",type:"text",value:p,onChange:g=>A(g.target.value),placeholder:e.groupsView.groupKeyPlaceholder,required:!0,"data-testid":"create-group-key",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),a("div",{style:{marginBottom:"1rem"},children:[t("label",{htmlFor:"create-group-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:e.groupsView.name}),t("input",{id:"create-group-name-input",type:"text",value:G,onChange:g=>N(g.target.value),placeholder:e.groupsView.namePlaceholder,required:!0,"data-testid":"create-group-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),a("div",{style:{marginBottom:"1.2rem"},children:[t("label",{htmlFor:"create-group-desc-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:e.groupsView.description}),t("textarea",{id:"create-group-desc-input",value:z,onChange:g=>M(g.target.value),"data-testid":"create-group-description",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box",height:"60px"}})]}),a("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[t("button",{type:"button",onClick:()=>c(null),"data-testid":"cancel-create-group",style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:e.common.cancel}),t("button",{type:"submit","data-testid":"submit-create-group",disabled:x,"aria-busy":x,style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#4338ca",color:"#ffffff",border:"none",cursor:"pointer"},children:e.common.create})]})]})}),f&&t("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},children:a("form",{ref:w,onSubmit:b,role:"dialog","aria-modal":"true","aria-labelledby":"edit-group-title","aria-describedby":"edit-group-error","data-testid":"group-edit-modal",style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[t("h3",{id:"edit-group-title",style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:e.groupsView.editGroup}),t(D,{result:d,id:"edit-group-error"}),a("div",{style:{marginBottom:"1rem"},children:[t("label",{htmlFor:"edit-group-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:e.groupsView.name}),t("input",{id:"edit-group-name-input",type:"text",value:f.name,onChange:g=>c({kind:"edit",group:{...f,name:g.target.value}}),required:!0,"data-testid":"edit-group-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),a("div",{style:{marginBottom:"1.2rem"},children:[t("label",{htmlFor:"edit-group-desc-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:e.groupsView.description}),t("textarea",{id:"edit-group-desc-input",value:f.description??"",onChange:g=>c({kind:"edit",group:{...f,description:g.target.value}}),"data-testid":"edit-group-description",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box",height:"60px"}})]}),a("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[t("button",{type:"button",onClick:()=>c(null),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:e.common.cancel}),t("button",{type:"submit","data-testid":"submit-edit-group",disabled:x,"aria-busy":x,style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#4338ca",color:"#ffffff",border:"none",cursor:"pointer"},children:e.common.save})]})]})})]})}function me(){let r=K(),o=W(),{submit:n,result:y}=O(o),d=o.state!=="idle",e=r.labels??L,[i,s]=S(r.groups[0]?.id??0),m=r.groups.find(l=>l.id===i)??r.groups[0],c=new Set(r.groupMembers.filter(l=>l.groupId===i).map(l=>l.userId)),f=(l,h)=>{n(h?{intent:"removeGroupMember",groupId:String(i),userId:String(l)}:{intent:"addGroupMember",groupId:String(i),userId:String(l)})};return a("section",{"data-testid":"group-members-view-section",style:{display:"grid",gridTemplateColumns:"240px 1fr",gap:"1.2rem"},children:[t("h2",{style:{...q,gridColumn:"1 / -1"},children:e.groupMembersView.title}),t(D,{result:y}),a("div",{style:{backgroundColor:"#ffffff",padding:"1rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:[t("h4",{style:{margin:"0 0 0.8rem 0",fontSize:"0.9rem",color:"#475569"},children:e.groupMembersView.selectGroup}),t("div",{style:{display:"flex",flexDirection:"column",gap:"0.4rem"},children:r.groups.map(l=>{let h=l.id===i;return a("button",{type:"button",onClick:()=>s(l.id),"data-testid":`select-group-btn-${l.id}`,style:{textAlign:"left",padding:"8px 10px",borderRadius:"6px",border:h?"1px solid #6366f1":"1px solid #e2e8f0",backgroundColor:h?"#e0e7ff":"#ffffff",color:h?"#3730a3":"#0f172a",cursor:"pointer",fontWeight:h?600:400,fontSize:"0.85rem"},children:[l.name,l.readOnly?t("span",{"data-testid":`group-upstream-marker-${l.id}`,style:{marginLeft:"6px",fontSize:"0.7rem",color:"#7c3aed"},children:e.common.managedUpstream}):null]},l.id)})})]}),t("div",{style:{backgroundColor:"#ffffff",padding:"1.2rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:m?a(xe,{children:[a("div",{style:{marginBottom:"1rem",borderBottom:"1px solid #e2e8f0",paddingBottom:"0.8rem"},children:[t("h3",{style:{margin:0,fontSize:"1.1rem",color:"#0f172a"},children:v(e.groupMembersView.membersOfTemplate,{group:m.name})}),a("span",{style:{fontSize:"0.8rem",color:"#64748b"},children:[e.groupMembersView.groupKeyLabel,": ",m.groupKey]}),m.readOnly?t("div",{"data-testid":"group-members-upstream-notice",role:"note",style:{marginTop:"0.5rem",padding:"0.5rem 0.7rem",borderRadius:"6px",backgroundColor:"#f5f3ff",border:"1px solid #ddd6fe",color:"#5b21b6",fontSize:"0.8rem"},children:e.groupMembersView.upstreamNotice}):null]}),t("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:r.users.map(l=>{let h=c.has(l.id);return a("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 12px",borderRadius:"6px",border:"1px solid #f1f5f9",backgroundColor:h?"#f0fdf4":"#ffffff"},"data-testid":`member-row-${l.id}`,children:[a("div",{children:[t("span",{style:{fontWeight:600,fontSize:"0.88rem",color:"#0f172a",marginRight:"8px"},children:l.displayName}),a("span",{style:{fontSize:"0.78rem",color:"#64748b"},children:["(",l.email,")"]})]}),m.readOnly?h?t("span",{"data-testid":`member-readonly-${l.id}`,style:{fontSize:"0.75rem",color:"#475569"},children:e.common.managedUpstream}):null:t("button",{type:"button",onClick:()=>f(l.id,h),disabled:d,"aria-busy":d,"aria-label":v(h?e.groupMembersView.actionRemoveAria:e.groupMembersView.actionAddAria,{user:l.displayName}),"data-testid":`toggle-member-btn-${l.id}`,style:{padding:"4px 12px",borderRadius:"4px",border:h?"1px solid #b91c1c":"1px solid #0284c7",backgroundColor:h?"#ffffff":"#0284c7",color:h?"#b91c1c":"#ffffff",fontSize:"0.78rem",fontWeight:600,cursor:"pointer"},children:h?e.groupMembersView.actionRemove:e.groupMembersView.actionAdd})]},l.id)})})]}):t("div",{style:{color:"#475569",textAlign:"center",padding:"2rem"},children:e.groupMembersView.selectPrompt})})]})}function ge(r){return r==="email"?{backgroundColor:"#e0f2fe",color:"#0369a1"}:r==="domain"?{backgroundColor:"#fef3c7",color:"#b45309"}:{backgroundColor:"#ede9fe",color:"#6d28d9"}}function ye(r,o){return r==="email"?o.allowlistView.emailTypeShort:r==="domain"?o.allowlistView.domainTypeShort:o.allowlistView.groupTypeShort}function be(){let r=K(),o=W(),n=r.labels??L,{submit:y,result:d}=O(o),e=o.state!=="idle",[i,s]=S(""),[m,c]=S("email"),[f,l]=S(""),h=p=>{if(p.preventDefault(),!i)return;let A={pattern:i,description:f};y({intent:"addAllowlistEntry",pattern:A.pattern,type:m,description:A.description},()=>{s(G=>G===A.pattern?"":G),l(G=>G===A.description?"":G)})},k=p=>{y({intent:"removeAllowlistEntry",entryId:String(p)})},x=p=>{y({intent:"removeAllowlistGroup",entryId:String(p)})};return a("section",{"data-testid":"allowlist-view-section",style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[t("h2",{style:q,children:n.allowlistView.title}),t(D,{result:d}),a("form",{onSubmit:h,style:{backgroundColor:"#ffffff",padding:"1.2rem",borderRadius:"8px",border:"1px solid #e2e8f0",display:"flex",flexWrap:"wrap",gap:"0.8rem",alignItems:"flex-end"},children:[a("div",{style:{flex:2,minWidth:"220px"},children:[t("label",{htmlFor:"allowlist-pattern-input-field",style:{display:"block",fontSize:"0.78rem",color:"#475569",marginBottom:"4px"},children:n.allowlistView.pattern}),t("input",{id:"allowlist-pattern-input-field",type:"text",value:i,onChange:p=>s(p.target.value),required:!0,"data-testid":"allowlist-pattern-input",style:{width:"100%",padding:"6px 10px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",boxSizing:"border-box"}})]}),a("div",{style:{flex:1,minWidth:"140px"},children:[t("label",{htmlFor:"allowlist-type-select-field",style:{display:"block",fontSize:"0.78rem",color:"#475569",marginBottom:"4px"},children:n.allowlistView.type}),a("select",{id:"allowlist-type-select-field",value:m,onChange:p=>c(p.target.value),"data-testid":"allowlist-type-select",style:{width:"100%",padding:"6px 10px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",boxSizing:"border-box"},children:[t("option",{value:"email",children:n.allowlistView.emailType}),t("option",{value:"domain",children:n.allowlistView.domainType})]})]}),a("div",{style:{flex:2,minWidth:"200px"},children:[t("label",{htmlFor:"allowlist-desc-input-field",style:{display:"block",fontSize:"0.78rem",color:"#475569",marginBottom:"4px"},children:n.allowlistView.description}),t("input",{id:"allowlist-desc-input-field",type:"text",value:f,onChange:p=>l(p.target.value),"data-testid":"allowlist-desc-input",style:{width:"100%",padding:"6px 10px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",boxSizing:"border-box"}})]}),t("button",{type:"submit","data-testid":"submit-allowlist-add",disabled:e,"aria-busy":e,style:{padding:"7px 16px",borderRadius:"6px",backgroundColor:"#047857",color:"#ffffff",border:"none",fontSize:"0.85rem",fontWeight:600,cursor:"pointer"},children:n.allowlistView.addEntry})]}),t("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0",overflow:"hidden"},children:a("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"0.85rem",textAlign:"left"},children:[t("thead",{children:a("tr",{style:{backgroundColor:"#f8fafc",borderBottom:"1px solid #e2e8f0",color:"#475569"},children:[t("th",{style:{padding:"10px 14px"},children:n.common.id}),t("th",{style:{padding:"10px 14px"},children:n.allowlistView.target}),t("th",{style:{padding:"10px 14px"},children:n.allowlistView.type}),t("th",{style:{padding:"10px 14px"},children:n.allowlistView.description}),t("th",{style:{padding:"10px 14px",textAlign:"right"},children:n.common.actions})]})}),a("tbody",{children:[r.allowlist.map(p=>a("tr",{style:{borderBottom:"1px solid #f1f5f9"},"data-testid":`allowlist-row-${p.type}-${p.id}`,"data-allowlist-type":p.type,children:[t("td",{style:{padding:"10px 14px",color:"#475569"},children:v(n.common.idTemplate,{id:p.id})}),t("td",{style:{padding:"10px 14px",fontWeight:600,color:"#0f172a"},children:p.type==="group"?a("span",{"data-testid":`allowlist-group-${p.type}-${p.id}`,children:[p.groupName,t("span",{style:{marginLeft:"6px",fontFamily:"monospace",fontSize:"0.78rem",color:"#64748b"},children:p.groupKey})]}):t("span",{style:{fontFamily:"monospace"},children:p.pattern})}),t("td",{style:{padding:"10px 14px"},children:t("span",{style:{fontSize:"0.75rem",padding:"2px 8px",borderRadius:"10px",...ge(p.type),fontWeight:600},children:ye(p.type,n)})}),a("td",{style:{padding:"10px 14px",color:"#475569"},children:[p.description||n.common.none,p.owner.kind==="deployment"&&t("span",{"data-testid":`allowlist-owner-${p.type}-${p.id}`,style:{marginLeft:"8px",fontSize:"0.72rem",color:"#475569"},children:n.allowlistView.deploymentOwner})]}),t("td",{style:{padding:"10px 14px",textAlign:"right"},children:p.readOnly?t("span",{"data-testid":`readonly-allowlist-${p.type}-${p.id}`,style:{fontSize:"0.75rem",color:"#475569"},children:n.common.readOnly}):t("button",{type:"button",onClick:()=>{window.confirm(n.allowlistView.confirmDelete)&&(p.type==="group"?x(p.id):k(p.id))},disabled:e,"aria-busy":e,"aria-label":v(n.allowlistView.deleteAria,{target:p.type==="group"?p.groupName:p.pattern}),"data-testid":`remove-allowlist-btn-${p.type}-${p.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #fee2e2",backgroundColor:"#fff5f5",color:"#b91c1c",fontSize:"0.78rem",cursor:"pointer"},children:n.common.delete})})]},`${p.type}-${p.id}`)),r.allowlist.length===0&&t("tr",{children:t("td",{colSpan:5,style:{padding:"2rem",textAlign:"center",color:"#475569"},children:n.allowlistView.empty})})]})]})})]})}function fe(){let r=K(),o=W(),{submit:n,result:y}=O(o),d=r.labels??L,e=d.directoryView,i=r.groups.filter(u=>!u.externalLink),[s,m]=S(""),[c,f]=S(""),[l,h]=S("direct"),k=r.groups.filter(u=>u.externalLink),x=new Set(r.allowlist.filter(u=>u.type==="group").map(u=>u.groupId)),p=u=>r.allowlist.find(w=>w.type==="group"&&w.groupId===u),A=o.state!=="idle",[G,N]=S(null),z=r.directoryStatus.isEnabled&&r.directoryStatus.provider!=="",M=u=>{if(u.preventDefault(),!(s&&c))return;let w=c;n({intent:"linkDirectoryGroup",groupId:s,provider:r.directoryStatus.provider,externalKey:w,membershipMode:l},()=>{f(T=>T===w?"":T),m("")})};return a("section",{"data-testid":"directory-view-section",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[t("h2",{style:q,children:e.title}),t(D,{result:y}),!z&&t("p",{"data-testid":"directory-not-wired",style:{margin:0,padding:"0.7rem 1rem",borderRadius:"6px",border:"1px solid #e2e8f0",backgroundColor:"#f8fafc",color:"#475569",fontSize:"0.85rem"},children:e.notWiredNotice}),z&&i.length===0&&t("p",{"data-testid":"directory-nothing-to-link",style:{margin:0,padding:"0.7rem 1rem",borderRadius:"6px",border:"1px solid #e2e8f0",backgroundColor:"#f8fafc",color:"#475569",fontSize:"0.85rem"},children:e.nothingToLink}),z&&i.length>0&&a("form",{onSubmit:M,"data-testid":"directory-link-form",style:{display:"flex",gap:"0.75rem",flexWrap:"wrap",alignItems:"flex-end",backgroundColor:"#ffffff",padding:"1rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:[a("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem"},children:[t("label",{htmlFor:"directory-group-select-input",style:_,children:e.selectGroup}),a("select",{id:"directory-group-select-input","data-testid":"directory-group-select",value:s,onChange:u=>m(u.target.value),style:{padding:"0.5rem",borderRadius:"6px",border:"1px solid #cbd5e1"},children:[t("option",{value:"",children:e.selectGroup}),i.map(u=>t("option",{value:String(u.id),children:v(e.groupOptionTemplate,{name:u.name,key:u.groupKey})},u.id))]})]}),a("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem",flex:1,minWidth:"220px"},children:[t("label",{htmlFor:"directory-external-key-input",style:_,children:e.externalKey}),t("input",{id:"directory-external-key-input",type:"email",required:!0,"data-testid":"directory-external-key",placeholder:e.externalKeyPlaceholder,value:c,onChange:u=>f(u.target.value),style:{padding:"0.5rem",borderRadius:"6px",border:"1px solid #cbd5e1"}})]}),a("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem"},children:[t("label",{htmlFor:"directory-membership-mode-input",style:_,children:e.membershipMode}),a("select",{id:"directory-membership-mode-input","data-testid":"directory-membership-mode",value:l,onChange:u=>h(u.target.value),style:{padding:"0.5rem",borderRadius:"6px",border:"1px solid #cbd5e1"},children:[t("option",{value:"direct",children:e.directMode}),t("option",{value:"transitive",children:e.transitiveMode})]})]}),t("button",{type:"submit","data-testid":"directory-link-submit",disabled:!(s&&c)||A,"aria-busy":A,style:{padding:"0.5rem 1rem",borderRadius:"6px",border:"none",backgroundColor:s&&c&&!A?"#2563eb":"#94a3b8",color:"#fff",fontWeight:600},children:e.link})]}),k.length===0?t("div",{"data-testid":"directory-empty",style:{padding:"2rem",textAlign:"center",color:"#64748b",backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0"},children:e.empty}):a("table",{"data-testid":"directory-table",style:{width:"100%",borderCollapse:"collapse",backgroundColor:"#ffffff",borderRadius:"8px",overflow:"hidden",border:"1px solid #e2e8f0"},children:[t("thead",{children:a("tr",{style:{backgroundColor:"#f8fafc",textAlign:"left"},children:[t("th",{style:V,children:d.groupsView.name}),t("th",{style:V,children:e.externalKey}),t("th",{style:V,children:e.membershipMode}),t("th",{style:V,children:e.lastSynced}),t("th",{style:V,children:d.common.status}),t("th",{style:V,children:d.common.actions})]})}),t("tbody",{children:k.map(u=>{let w=u.externalLink,T=x.has(u.id);return a("tr",{"data-testid":`directory-row-${u.id}`,"data-sync-enabled":String(w.isSyncEnabled),style:{borderTop:"1px solid #e2e8f0"},children:[a("td",{style:V,children:[u.name,t("div",{style:{fontSize:"0.75rem",color:"#64748b"},children:u.groupKey})]}),t("td",{style:V,"data-testid":`directory-external-${u.id}`,children:w.externalKey}),t("td",{style:V,children:w.membershipMode==="direct"?e.directMode:e.transitiveMode}),a("td",{style:V,"data-testid":`directory-synced-${u.id}`,children:[w.syncedAt?Q(w.syncedAt,d):e.neverSynced,w.unresolvedCount>0?t("div",{style:{fontSize:"0.75rem",color:"#b45309"},"data-testid":`directory-unresolved-${u.id}`,children:v(e.unresolvedTemplate,{count:w.unresolvedCount})}):null]}),a("td",{style:V,children:[t("span",{"data-testid":`directory-status-${u.id}`,style:{fontSize:"0.75rem",padding:"2px 8px",borderRadius:"10px",backgroundColor:w.isSyncEnabled?"#dcfce7":"#fee2e2",color:w.isSyncEnabled?"#166534":"#b91c1c",fontWeight:600},children:w.isSyncEnabled?e.syncEnabled:e.syncPaused}),w.syncError?t("div",{style:{fontSize:"0.75rem",color:"#b91c1c",marginTop:"0.25rem"},"data-testid":`directory-error-${u.id}`,children:w.syncError}):null]}),t("td",{style:V,children:a("div",{style:{display:"flex",gap:"0.35rem",flexWrap:"wrap"},children:[t("button",{type:"button","data-testid":`directory-sync-now-${u.id}`,disabled:A,"aria-busy":A,"aria-label":v(G===u.id?e.syncQueuedAria:e.syncNowAria,{group:u.name}),onClick:()=>n({intent:"requestDirectorySync",groupId:String(u.id)},()=>N(u.id)),style:H,children:G===u.id?e.syncQueued:e.syncNow}),t("button",{type:"button","data-testid":`directory-toggle-sync-${u.id}`,disabled:A,"aria-busy":A,"aria-label":v(w.isSyncEnabled?e.pauseAria:e.resumeAria,{group:u.name}),onClick:()=>{N(null),n({intent:"setDirectorySyncEnabled",groupId:String(u.id),isSyncEnabled:String(!w.isSyncEnabled)})},style:H,children:w.isSyncEnabled?e.pause:e.resume}),t("button",{type:"button","data-testid":`directory-allow-${u.id}`,disabled:A,"aria-busy":A,"aria-label":v(T?e.disallowGroupAria:e.allowGroupAria,{group:u.name}),onClick:()=>{let $=p(u.id);if(T&&$){if(!window.confirm(e.confirmDisallow))return;n({intent:"removeAllowlistGroup",entryId:String($.id)})}else n({intent:"addAllowlistGroup",groupId:String(u.id)})},style:H,children:T?e.disallowGroup:e.allowGroup}),t("button",{type:"button","data-testid":`directory-unlink-${u.id}`,disabled:A,"aria-busy":A,"aria-label":v(e.unlinkAria,{group:u.name}),onClick:()=>{window.confirm(e.confirmUnlink)&&n({intent:"unlinkDirectoryGroup",groupId:String(u.id)})},style:{...H,color:"#b91c1c",borderColor:"#fecaca"},children:e.unlink})]})})]},u.id)})})]})]})}var _={fontSize:"0.78rem",color:"#475569",fontWeight:600},q={margin:0,fontSize:"1.05rem",fontWeight:700,color:"#0f172a"},V={padding:"0.6rem 0.75rem",fontSize:"0.85rem",verticalAlign:"top"},H={padding:"0.25rem 0.6rem",fontSize:"0.75rem",borderRadius:"6px",border:"1px solid #cbd5e1",backgroundColor:"#fff",cursor:"pointer"},ee={users:re,groups:ce,group_members:me,allowlist:be,directory:fe};function Pe({renderHeader:r}={}){let n=K()?.segment??"users",y=Object.hasOwn(ee,n)?ee[n]:re;return t(X,{renderHeader:r,children:t(y,{})})}export{be as AllowlistView,Pe as AuthUserAdminAppView,fe as DirectoryView,me as GroupMembersView,ce as GroupsView,X as UserAdminShell,re as UsersView,ke as createInMemoryUserAdminStore,Se as createUserAdminApp,L as defaultUserAdminLabels,he as jaUserAdminLabels,J as resolveUserAdminLabels};
2
2
  //# sourceMappingURL=admin.mjs.map