c2pa-react-cawg-component 0.1.12 → 0.1.13

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.
@@ -38,7 +38,9 @@ var o = "<svg width=\"34\" height=\"34\" viewBox=\"0 0 34 34\" fill=\"none\" xml
38
38
  if (typeof e == "object" && !Array.isArray(e) && (e = [e]), !e || e.length === 0) return "Unknown";
39
39
  let t = e.sort((e, t) => c(e.type) - c(t.type))[0];
40
40
  return !t || l.includes(t.type) ? "Unknown" : t.name;
41
- }, d = {
41
+ }, d = (e) => {
42
+ if (e) return e.signer_payload ?? e.c2paAsset;
43
+ }, f = {
42
44
  "cawg.creator": "Creator",
43
45
  "cawg.contributor": "Contributor",
44
46
  "cawg.editor": "Editor",
@@ -47,8 +49,8 @@ var o = "<svg width=\"34\" height=\"34\" viewBox=\"0 0 34 34\" fill=\"none\" xml
47
49
  "cawg.sponsor": "Sponsor",
48
50
  "cawg.translator": "Translator"
49
51
  };
50
- function f({ className: e, manifest: t, moreInfo: n }) {
51
- let r = t.title, o = t.claimGenerator ?? t.claimGeneratorInfo?.[0]?.name ?? "Unknown", c = u(t.assertions?.["cawg.identity"]?.verifiedIdentities), l = o.split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", f = (t.assertions?.["cawg.identity"])?.signer_payload?.role ?? [];
52
+ function p({ className: e, manifest: t, moreInfo: n }) {
53
+ let r = t.title, o = t.claimGenerator ?? t.claimGeneratorInfo?.[0]?.name ?? "Unknown", c = u(t.assertions?.["cawg.identity"]?.verifiedIdentities), l = o.split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", p = t.assertions?.["cawg.identity"], m = d(p)?.role ?? [];
52
54
  return /* @__PURE__ */ a("div", {
53
55
  className: `cawg-card ${e ?? ""}`,
54
56
  children: [
@@ -79,11 +81,11 @@ function f({ className: e, manifest: t, moreInfo: n }) {
79
81
  })]
80
82
  })]
81
83
  }),
82
- f.length > 0 && /* @__PURE__ */ i("div", {
84
+ m.length > 0 && /* @__PURE__ */ i("div", {
83
85
  className: "cawg-roles",
84
- children: f.map((e) => /* @__PURE__ */ i("span", {
86
+ children: m.map((e) => /* @__PURE__ */ i("span", {
85
87
  className: "cawg-role-badge",
86
- children: d[e] ?? e
88
+ children: f[e] ?? e
87
89
  }, e))
88
90
  }),
89
91
  n && /* @__PURE__ */ i("div", {
@@ -99,17 +101,17 @@ function f({ className: e, manifest: t, moreInfo: n }) {
99
101
  }
100
102
  //#endregion
101
103
  //#region src/components/Cawg/helper/trqp.ts
102
- async function p() {
104
+ async function m() {
103
105
  throw Error("No trust registry query function configured. Call `setTrustRegistryQueryFn` (or pass a `queryFn` prop to TrustBadge) with a function that queries a real TRQP endpoint.");
104
106
  }
105
- var m = p;
106
- function h(e) {
107
- m = e;
107
+ var h = m;
108
+ function g(e) {
109
+ h = e;
108
110
  }
109
- function g() {
110
- return m;
111
+ function _() {
112
+ return h;
111
113
  }
112
- function _(e, r, i, a = g()) {
114
+ function v(e, r, i, a = _()) {
113
115
  let [o, s] = n("idle"), [c, l] = n(null), [u, d] = n(null);
114
116
  return t(() => {
115
117
  if (!e) {
@@ -141,7 +143,7 @@ function _(e, r, i, a = g()) {
141
143
  }
142
144
  //#endregion
143
145
  //#region src/components/Cawg/helper/TrustBadge.tsx
144
- function v(e) {
146
+ function y(e) {
145
147
  try {
146
148
  return new Date(e).toLocaleDateString(void 0, {
147
149
  year: "numeric",
@@ -152,9 +154,9 @@ function v(e) {
152
154
  return e;
153
155
  }
154
156
  }
155
- var y = "Identity Verified by Trust Registry", b = "Identity Unable to be Verified by Trust Registry";
156
- function x({ entityId: e, action: t, resource: n, variant: r = "full", queryFn: o }) {
157
- let { status: s, result: c, error: l } = _(e, t, n, o);
157
+ var b = "Identity Verified by Trust Registry", x = "Identity Unable to be Verified by Trust Registry";
158
+ function S({ entityId: e, action: t, resource: n, variant: r = "full", queryFn: o }) {
159
+ let { status: s, result: c, error: l } = v(e, t, n, o);
158
160
  if (!e) return null;
159
161
  if (s === "error") return /* @__PURE__ */ i("span", {
160
162
  className: "cawg-trust-badge cawg-trust-unverified",
@@ -167,8 +169,8 @@ function x({ entityId: e, action: t, resource: n, variant: r = "full", queryFn:
167
169
  });
168
170
  let u = /* @__PURE__ */ i("span", {
169
171
  className: c.authorized ? "cawg-trust-badge cawg-trust-verified" : "cawg-trust-badge cawg-trust-unverified",
170
- title: c.authorized ? `Recognized by ${c.authority_id} · checked ${v(c.time_evaluated)}` : c.message,
171
- children: c.authorized ? y : b
172
+ title: c.authorized ? `Recognized by ${c.authority_id} · checked ${y(c.time_evaluated)}` : c.message,
173
+ children: c.authorized ? b : x
172
174
  });
173
175
  return r === "compact" ? u : /* @__PURE__ */ a("div", {
174
176
  className: "cawg-trust-status",
@@ -177,7 +179,7 @@ function x({ entityId: e, action: t, resource: n, variant: r = "full", queryFn:
177
179
  children: [
178
180
  c.authority_id,
179
181
  " · checked ",
180
- v(c.time_evaluated)
182
+ y(c.time_evaluated)
181
183
  ]
182
184
  }) : c.message && /* @__PURE__ */ i("div", {
183
185
  className: "cawg-trust-message",
@@ -187,7 +189,7 @@ function x({ entityId: e, action: t, resource: n, variant: r = "full", queryFn:
187
189
  }
188
190
  //#endregion
189
191
  //#region src/components/Cawg/levels/L2/CAWGL2.tsx
190
- var S = {
192
+ var C = {
191
193
  "cawg.creator": "Creator",
192
194
  "cawg.contributor": "Contributor",
193
195
  "cawg.editor": "Editor",
@@ -195,27 +197,27 @@ var S = {
195
197
  "cawg.publisher": "Publisher",
196
198
  "cawg.sponsor": "Sponsor",
197
199
  "cawg.translator": "Translator"
198
- }, C = {
200
+ }, w = {
199
201
  "cawg.document_verification": "ID Verified",
200
202
  "cawg.web_site": "Website",
201
203
  "cawg.affiliation": "Affiliation",
202
204
  "cawg.social_media": "Social Media",
203
205
  "cawg.crypto_wallet": "Crypto Wallet"
204
- }, w = {
206
+ }, T = {
205
207
  "cawg.data_mining": "Data Mining",
206
208
  "cawg.ai_inference": "AI Inference",
207
209
  "cawg.ai_training": "AI Training",
208
210
  "cawg.ai_generative_training": "AI Generative Training"
209
- }, T = {
211
+ }, E = {
210
212
  allowed: "cawg-use-badge cawg-use-allowed",
211
213
  notAllowed: "cawg-use-badge cawg-use-not-allowed",
212
214
  constrained: "cawg-use-badge cawg-use-constrained"
213
- }, E = {
215
+ }, D = {
214
216
  allowed: "Allowed",
215
217
  notAllowed: "Not Allowed",
216
218
  constrained: "Constrained"
217
219
  };
218
- function D(e) {
220
+ function O(e) {
219
221
  try {
220
222
  return new Date(e).toLocaleDateString(void 0, {
221
223
  year: "numeric",
@@ -226,11 +228,11 @@ function D(e) {
226
228
  return e;
227
229
  }
228
230
  }
229
- function O(e) {
231
+ function k(e) {
230
232
  return Array.isArray(e) ? e.filter((e) => typeof e == "string").join(", ") : typeof e == "string" ? e : "";
231
233
  }
232
- function k({ className: e, manifest: t, moreInfo: n }) {
233
- let o = t.title, c = (t.claimGenerator ?? t.claimGeneratorInfo?.[0]?.name ?? "Unknown").split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", l = u(t.assertions?.["cawg.identity"]?.verifiedIdentities), d = t.assertions?.["cawg.identity"], f = d?.signer_payload?.role ?? [], p = d?.verifiedIdentities ?? [], m = d?.issuer, h = t.assertions?.["cawg.training-mining"]?.entries ?? {}, g = t.assertions?.["cawg.metadata"], _ = O(g?.["dc:creator"]), v = g?.["xmp:CreateDate"];
234
+ function A({ className: e, manifest: t, moreInfo: n }) {
235
+ let o = t.title, c = (t.claimGenerator ?? t.claimGeneratorInfo?.[0]?.name ?? "Unknown").split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", l = u(t.assertions?.["cawg.identity"]?.verifiedIdentities), f = t.assertions?.["cawg.identity"], p = d(f)?.role ?? [], m = f?.verifiedIdentities ?? [], h = f?.issuer, g = t.assertions?.["cawg.training-mining"]?.entries ?? {}, _ = t.assertions?.["cawg.metadata"], v = k(_?.["dc:creator"]), y = _?.["xmp:CreateDate"];
234
236
  return /* @__PURE__ */ a("div", {
235
237
  className: `cawg-card ${e ?? ""}`,
236
238
  children: [
@@ -261,14 +263,14 @@ function k({ className: e, manifest: t, moreInfo: n }) {
261
263
  })]
262
264
  })]
263
265
  }),
264
- f.length > 0 && /* @__PURE__ */ i("div", {
266
+ p.length > 0 && /* @__PURE__ */ i("div", {
265
267
  className: "cawg-roles",
266
- children: f.map((e) => /* @__PURE__ */ i("span", {
268
+ children: p.map((e) => /* @__PURE__ */ i("span", {
267
269
  className: "cawg-role-badge",
268
- children: S[e] ?? e
270
+ children: C[e] ?? e
269
271
  }, e))
270
272
  }),
271
- p.length > 0 && /* @__PURE__ */ a(r, { children: [
273
+ m.length > 0 && /* @__PURE__ */ a(r, { children: [
272
274
  /* @__PURE__ */ i("div", { className: "cawg-divider" }),
273
275
  /* @__PURE__ */ a("div", {
274
276
  className: "cawg-section-title",
@@ -278,8 +280,8 @@ function k({ className: e, manifest: t, moreInfo: n }) {
278
280
  justifyContent: "space-between",
279
281
  gap: 8
280
282
  },
281
- children: [/* @__PURE__ */ i("span", { children: "Identity" }), /* @__PURE__ */ i(x, {
282
- entityId: m,
283
+ children: [/* @__PURE__ */ i("span", { children: "Identity" }), /* @__PURE__ */ i(S, {
284
+ entityId: h,
283
285
  action: "issue",
284
286
  resource: "cawg.identity",
285
287
  variant: "compact"
@@ -287,7 +289,7 @@ function k({ className: e, manifest: t, moreInfo: n }) {
287
289
  }),
288
290
  /* @__PURE__ */ i("div", {
289
291
  className: "cawg-identity-list",
290
- children: p.map((e, t) => {
292
+ children: m.map((e, t) => {
291
293
  let n = e.type, r = e.name ?? e.username, o = e.provider;
292
294
  return /* @__PURE__ */ i("div", {
293
295
  className: "cawg-identity-item",
@@ -296,7 +298,7 @@ function k({ className: e, manifest: t, moreInfo: n }) {
296
298
  children: [
297
299
  /* @__PURE__ */ i("div", {
298
300
  className: "cawg-identity-type-label",
299
- children: C[n] ?? n
301
+ children: w[n] ?? n
300
302
  }),
301
303
  r && /* @__PURE__ */ i("div", {
302
304
  className: "cawg-identity-name",
@@ -312,7 +314,7 @@ function k({ className: e, manifest: t, moreInfo: n }) {
312
314
  })
313
315
  })
314
316
  ] }),
315
- Object.keys(h).length > 0 && /* @__PURE__ */ a(r, { children: [
317
+ Object.keys(g).length > 0 && /* @__PURE__ */ a(r, { children: [
316
318
  /* @__PURE__ */ i("div", { className: "cawg-divider" }),
317
319
  /* @__PURE__ */ i("div", {
318
320
  className: "cawg-section-title",
@@ -320,42 +322,42 @@ function k({ className: e, manifest: t, moreInfo: n }) {
320
322
  }),
321
323
  /* @__PURE__ */ i("div", {
322
324
  className: "cawg-training-list",
323
- children: Object.entries(h).map(([e, t]) => /* @__PURE__ */ a("div", {
325
+ children: Object.entries(g).map(([e, t]) => /* @__PURE__ */ a("div", {
324
326
  className: "cawg-training-item",
325
327
  children: [/* @__PURE__ */ i("span", {
326
328
  className: "cawg-training-label",
327
- children: w[e] ?? e
329
+ children: T[e] ?? e
328
330
  }), /* @__PURE__ */ i("span", {
329
- className: T[t.use] ?? "cawg-use-badge",
330
- children: E[t.use] ?? t.use
331
+ className: E[t.use] ?? "cawg-use-badge",
332
+ children: D[t.use] ?? t.use
331
333
  })]
332
334
  }, e))
333
335
  })
334
336
  ] }),
335
- (_ || v) && /* @__PURE__ */ a(r, { children: [
337
+ (v || y) && /* @__PURE__ */ a(r, { children: [
336
338
  /* @__PURE__ */ i("div", { className: "cawg-divider" }),
337
339
  /* @__PURE__ */ i("div", {
338
340
  className: "cawg-section-title",
339
341
  children: "Creator"
340
342
  }),
341
- _ && /* @__PURE__ */ a("div", {
343
+ v && /* @__PURE__ */ a("div", {
342
344
  className: "cawg-key-value",
343
345
  children: [/* @__PURE__ */ i("div", {
344
346
  className: "cawg-key-value-label",
345
347
  children: "Name"
346
348
  }), /* @__PURE__ */ i("div", {
347
349
  className: "cawg-key-value-value",
348
- children: _
350
+ children: v
349
351
  })]
350
352
  }),
351
- v && /* @__PURE__ */ a("div", {
353
+ y && /* @__PURE__ */ a("div", {
352
354
  className: "cawg-key-value",
353
355
  children: [/* @__PURE__ */ i("div", {
354
356
  className: "cawg-key-value-label",
355
357
  children: "Date Created"
356
358
  }), /* @__PURE__ */ i("div", {
357
359
  className: "cawg-key-value-value",
358
- children: D(v)
360
+ children: O(y)
359
361
  })]
360
362
  })
361
363
  ] }),
@@ -372,7 +374,7 @@ function k({ className: e, manifest: t, moreInfo: n }) {
372
374
  }
373
375
  //#endregion
374
376
  //#region src/components/Cawg/levels/L3/CAWGL3.tsx
375
- var A = {
377
+ var j = {
376
378
  "cawg.creator": "Creator",
377
379
  "cawg.contributor": "Contributor",
378
380
  "cawg.editor": "Editor",
@@ -380,31 +382,31 @@ var A = {
380
382
  "cawg.publisher": "Publisher",
381
383
  "cawg.sponsor": "Sponsor",
382
384
  "cawg.translator": "Translator"
383
- }, j = {
385
+ }, M = {
384
386
  "cawg.document_verification": "ID Verified",
385
387
  "cawg.web_site": "Website",
386
388
  "cawg.affiliation": "Affiliation",
387
389
  "cawg.social_media": "Social Media",
388
390
  "cawg.crypto_wallet": "Crypto Wallet"
389
- }, M = {
391
+ }, N = {
390
392
  "cawg.data_mining": "Data Mining",
391
393
  "cawg.ai_inference": "AI Inference",
392
394
  "cawg.ai_training": "AI Training",
393
395
  "cawg.ai_generative_training": "AI Generative Training"
394
- }, N = {
396
+ }, P = {
395
397
  allowed: "cawg-use-badge cawg-use-allowed",
396
398
  notAllowed: "cawg-use-badge cawg-use-not-allowed",
397
399
  constrained: "cawg-use-badge cawg-use-constrained"
398
- }, P = {
400
+ }, F = {
399
401
  allowed: "Allowed",
400
402
  notAllowed: "Not Allowed",
401
403
  constrained: "Constrained"
402
- }, F = {
404
+ }, I = {
403
405
  "cawg.identity_claims_aggregation": "Identity Claims Aggregation",
404
406
  "cawg.x509.cose": "X.509 Certificate",
405
407
  "cawg.verifiable_credential_binding": "Verifiable Credential"
406
408
  };
407
- function I(e) {
409
+ function L(e) {
408
410
  try {
409
411
  return new Date(e).toLocaleDateString(void 0, {
410
412
  year: "numeric",
@@ -415,11 +417,11 @@ function I(e) {
415
417
  return e;
416
418
  }
417
419
  }
418
- function L(e) {
419
- return e == null ? "" : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? e.map((e) => L(e)).filter(Boolean).join(", ") : typeof e == "object" ? Object.entries(e).filter(([e]) => !e.startsWith("@")).map(([e, t]) => `${e}: ${L(t)}`).join("; ") : String(e);
420
+ function R(e) {
421
+ return e == null ? "" : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? e.map((e) => R(e)).filter(Boolean).join(", ") : typeof e == "object" ? Object.entries(e).filter(([e]) => !e.startsWith("@")).map(([e, t]) => `${e}: ${R(t)}`).join("; ") : String(e);
420
422
  }
421
- function R({ className: e, manifest: t, moreInfo: n }) {
422
- let o = t.title, c = t.claimGenerator ?? t.claimGeneratorInfo?.[0]?.name ?? "Unknown", l = u(t.assertions?.["cawg.identity"]?.verifiedIdentities), d = c.split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", f = t.assertions?.["cawg.identity"], p = f?.signer_payload?.role ?? [], m = f?.verifiedIdentities ?? [], h = f?.signer_payload?.sig_type, g = f?.issuer, _ = t.assertions?.["cawg.training-mining"]?.entries ?? {}, v = t.assertions?.["cawg.metadata"], y = v ? Object.entries(v).filter(([e]) => !e.startsWith("@")) : [];
423
+ function z({ className: e, manifest: t, moreInfo: n }) {
424
+ let o = t.title, c = t.claimGenerator ?? t.claimGeneratorInfo?.[0]?.name ?? "Unknown", l = u(t.assertions?.["cawg.identity"]?.verifiedIdentities), f = c.split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", p = t.assertions?.["cawg.identity"], m = d(p), h = m?.role ?? [], g = p?.verifiedIdentities ?? [], _ = m?.sig_type, v = p?.issuer, y = t.assertions?.["cawg.training-mining"]?.entries ?? {}, b = t.assertions?.["cawg.metadata"], x = b ? Object.entries(b).filter(([e]) => !e.startsWith("@")) : [];
423
425
  return /* @__PURE__ */ a("div", {
424
426
  className: `cawg-card ${e ?? ""}`,
425
427
  children: [
@@ -434,7 +436,7 @@ function R({ className: e, manifest: t, moreInfo: n }) {
434
436
  className: "cawg-square",
435
437
  children: /* @__PURE__ */ i("span", {
436
438
  className: "cawg-logo-text",
437
- children: d
439
+ children: f
438
440
  })
439
441
  }), /* @__PURE__ */ a("div", {
440
442
  style: {
@@ -450,37 +452,37 @@ function R({ className: e, manifest: t, moreInfo: n }) {
450
452
  })]
451
453
  })]
452
454
  }),
453
- p.length > 0 && /* @__PURE__ */ i("div", {
455
+ h.length > 0 && /* @__PURE__ */ i("div", {
454
456
  className: "cawg-roles",
455
- children: p.map((e) => /* @__PURE__ */ i("span", {
457
+ children: h.map((e) => /* @__PURE__ */ i("span", {
456
458
  className: "cawg-role-badge",
457
- children: A[e] ?? e
459
+ children: j[e] ?? e
458
460
  }, e))
459
461
  }),
460
- f && /* @__PURE__ */ a(r, { children: [
462
+ p && /* @__PURE__ */ a(r, { children: [
461
463
  /* @__PURE__ */ i("div", { className: "cawg-divider" }),
462
464
  /* @__PURE__ */ i("div", {
463
465
  className: "cawg-section-title",
464
466
  children: "Identity Assertion"
465
467
  }),
466
- h && /* @__PURE__ */ a("div", {
468
+ _ && /* @__PURE__ */ a("div", {
467
469
  className: "cawg-key-value",
468
470
  children: [/* @__PURE__ */ i("div", {
469
471
  className: "cawg-key-value-label",
470
472
  children: "Credential Type"
471
473
  }), /* @__PURE__ */ i("div", {
472
474
  className: "cawg-key-value-value",
473
- children: F[h] ?? h
475
+ children: I[_] ?? _
474
476
  })]
475
477
  }),
476
- g && /* @__PURE__ */ a("div", {
478
+ v && /* @__PURE__ */ a("div", {
477
479
  className: "cawg-key-value",
478
480
  children: [/* @__PURE__ */ i("div", {
479
481
  className: "cawg-key-value-label",
480
482
  children: "Issuer"
481
483
  }), /* @__PURE__ */ i("div", {
482
484
  className: "cawg-key-value-value",
483
- children: g
485
+ children: v
484
486
  })]
485
487
  }),
486
488
  /* @__PURE__ */ a("div", {
@@ -488,17 +490,17 @@ function R({ className: e, manifest: t, moreInfo: n }) {
488
490
  children: [/* @__PURE__ */ i("div", {
489
491
  className: "cawg-key-value-label",
490
492
  children: "Trust Registry"
491
- }), /* @__PURE__ */ i(x, {
492
- entityId: g,
493
+ }), /* @__PURE__ */ i(S, {
494
+ entityId: v,
493
495
  action: "issue",
494
496
  resource: "cawg.identity",
495
497
  variant: "full"
496
498
  })]
497
499
  }),
498
- m.length > 0 && /* @__PURE__ */ i("div", {
500
+ g.length > 0 && /* @__PURE__ */ i("div", {
499
501
  className: "cawg-identity-list",
500
502
  style: { marginTop: 12 },
501
- children: m.map((e, t) => {
503
+ children: g.map((e, t) => {
502
504
  let n = e.type, r = e.name ?? e.username ?? e.address, o = e.provider, s = e.uri, c = e.verifiedAt;
503
505
  return /* @__PURE__ */ i("div", {
504
506
  className: "cawg-identity-item",
@@ -507,7 +509,7 @@ function R({ className: e, manifest: t, moreInfo: n }) {
507
509
  children: [
508
510
  /* @__PURE__ */ i("div", {
509
511
  className: "cawg-identity-type-label",
510
- children: j[n] ?? n
512
+ children: M[n] ?? n
511
513
  }),
512
514
  r && /* @__PURE__ */ i("div", {
513
515
  className: "cawg-identity-name",
@@ -526,7 +528,7 @@ function R({ className: e, manifest: t, moreInfo: n }) {
526
528
  }),
527
529
  c && /* @__PURE__ */ a("div", {
528
530
  className: "cawg-identity-meta",
529
- children: ["Verified ", I(c)]
531
+ children: ["Verified ", L(c)]
530
532
  })
531
533
  ]
532
534
  })
@@ -534,7 +536,7 @@ function R({ className: e, manifest: t, moreInfo: n }) {
534
536
  })
535
537
  })
536
538
  ] }),
537
- Object.keys(_).length > 0 && /* @__PURE__ */ a(r, { children: [
539
+ Object.keys(y).length > 0 && /* @__PURE__ */ a(r, { children: [
538
540
  /* @__PURE__ */ i("div", { className: "cawg-divider" }),
539
541
  /* @__PURE__ */ i("div", {
540
542
  className: "cawg-section-title",
@@ -542,7 +544,7 @@ function R({ className: e, manifest: t, moreInfo: n }) {
542
544
  }),
543
545
  /* @__PURE__ */ i("div", {
544
546
  className: "cawg-training-list",
545
- children: Object.entries(_).map(([e, t]) => /* @__PURE__ */ a("div", {
547
+ children: Object.entries(y).map(([e, t]) => /* @__PURE__ */ a("div", {
546
548
  className: "cawg-training-item",
547
549
  style: {
548
550
  flexDirection: "column",
@@ -556,10 +558,10 @@ function R({ className: e, manifest: t, moreInfo: n }) {
556
558
  },
557
559
  children: [/* @__PURE__ */ i("span", {
558
560
  className: "cawg-training-label",
559
- children: M[e] ?? e
561
+ children: N[e] ?? e
560
562
  }), /* @__PURE__ */ i("span", {
561
- className: N[t.use] ?? "cawg-use-badge",
562
- children: P[t.use] ?? t.use
563
+ className: P[t.use] ?? "cawg-use-badge",
564
+ children: F[t.use] ?? t.use
563
565
  })]
564
566
  }), t.constraint_info && /* @__PURE__ */ i("div", {
565
567
  className: "cawg-constraint-info",
@@ -568,14 +570,14 @@ function R({ className: e, manifest: t, moreInfo: n }) {
568
570
  }, e))
569
571
  })
570
572
  ] }),
571
- y.length > 0 && /* @__PURE__ */ a(r, { children: [
573
+ x.length > 0 && /* @__PURE__ */ a(r, { children: [
572
574
  /* @__PURE__ */ i("div", { className: "cawg-divider" }),
573
575
  /* @__PURE__ */ i("div", {
574
576
  className: "cawg-section-title",
575
577
  children: "Metadata"
576
578
  }),
577
- y.map(([e, t]) => {
578
- let n = L(t);
579
+ x.map(([e, t]) => {
580
+ let n = R(t);
579
581
  return n ? /* @__PURE__ */ a("div", {
580
582
  className: "cawg-key-value",
581
583
  children: [/* @__PURE__ */ i("div", {
@@ -601,7 +603,7 @@ function R({ className: e, manifest: t, moreInfo: n }) {
601
603
  }
602
604
  //#endregion
603
605
  //#region src/components/Cawg/Cawg.tsx
604
- function z(e) {
606
+ function B(e) {
605
607
  return {
606
608
  id: e.id ?? "",
607
609
  title: e.title ?? "",
@@ -623,26 +625,26 @@ function z(e) {
623
625
  ingredients: e.ingredients ?? []
624
626
  };
625
627
  }
626
- var B = ({ manifest: t, entry: n, level: r, className: a }) => {
627
- let o = t.manifestStore?.activeManifest, s = n == null ? t.manifests.find((e) => e.id === o || e.instanceId === o) ?? (o ? t.manifestStore.manifests[o] : void 0) ?? t.manifests[0] : z(n);
628
+ var V = ({ manifest: t, entry: n, level: r, className: a }) => {
629
+ let o = t.manifestStore?.activeManifest, s = n == null ? t.manifests.find((e) => e.id === o || e.instanceId === o) ?? (o ? t.manifestStore.manifests[o] : void 0) ?? t.manifests[0] : B(n);
628
630
  if (!s || !(s.assertions?.["cawg.identity"] != null || s.assertions?.["cawg.training-mining"] != null || s.assertions?.["cawg.metadata"] != null)) return null;
629
631
  let [c, l] = e.useState(r || 1);
630
632
  switch (c) {
631
- case 1: return /* @__PURE__ */ i(f, {
633
+ case 1: return /* @__PURE__ */ i(p, {
632
634
  className: a,
633
635
  manifest: s,
634
636
  moreInfo: () => {
635
637
  l(2);
636
638
  }
637
639
  });
638
- case 2: return /* @__PURE__ */ i(k, {
640
+ case 2: return /* @__PURE__ */ i(A, {
639
641
  className: a,
640
642
  manifest: s,
641
643
  moreInfo: () => {
642
644
  l(3);
643
645
  }
644
646
  });
645
- case 3: return /* @__PURE__ */ i(R, {
647
+ case 3: return /* @__PURE__ */ i(z, {
646
648
  className: a,
647
649
  manifest: s,
648
650
  moreInfo: () => {
@@ -652,7 +654,7 @@ var B = ({ manifest: t, entry: n, level: r, className: a }) => {
652
654
  }
653
655
  return /* @__PURE__ */ i("div", { children: "Level Of Detail Not Selected" });
654
656
  };
655
- B.knownAssertions = [
657
+ V.knownAssertions = [
656
658
  "cawg.identity",
657
659
  "cawg.training-mining",
658
660
  "cawg.metadata",
@@ -670,4 +672,4 @@ B.knownAssertions = [
670
672
  "cawg.crypto_wallet"
671
673
  ];
672
674
  //#endregion
673
- export { B as CAWGManifest, x as TrustBadge, g as getTrustRegistryQueryFn, p as queryTrustRegistry, h as setTrustRegistryQueryFn, _ as useTrustRegistryQuery };
675
+ export { V as CAWGManifest, S as TrustBadge, _ as getTrustRegistryQueryFn, m as queryTrustRegistry, g as setTrustRegistryQueryFn, v as useTrustRegistryQuery };
@@ -7,4 +7,4 @@
7
7
  <rect width="34" height="34" fill="black"/>
8
8
  </clipPath>
9
9
  </defs>
10
- </svg>`,d=()=>(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,marginBottom:`16px`},children:[(0,n.jsx)(`div`,{dangerouslySetInnerHTML:{__html:u},style:{width:`24px`,height:`24px`,display:`flex`,alignItems:`center`}}),(0,n.jsx)(`span`,{style:{fontSize:`14px`,fontWeight:600,color:`#333`,display:`flex`,alignItems:`center`},children:`Creator Assertions Working Group`})]}),f=e=>{switch(e){case`cawg.document_verification`:return 0;case`cawg.social_media`:return 10;case`cawg.web_site`:return 20;case`cawg.affiliation`:return 1e6;default:return 1e5}},p=[`cawg.affiliation`],m=e=>{if(typeof e==`object`&&!Array.isArray(e)&&(e=[e]),!e||e.length===0)return`Unknown`;let t=e.sort((e,t)=>f(e.type)-f(t.type))[0];return!t||p.includes(t.type)?`Unknown`:t.name},h={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`};function g({className:e,manifest:t,moreInfo:r}){let i=t.title,a=t.claimGenerator??t.claimGeneratorInfo?.[0]?.name??`Unknown`,o=m(t.assertions?.[`cawg.identity`]?.verifiedIdentities),s=a.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,c=(t.assertions?.[`cawg.identity`])?.signer_payload?.role??[];return(0,n.jsxs)(`div`,{className:`cawg-card ${e??``}`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[t.thumbnail?(0,n.jsx)(`img`,{src:t.thumbnail,alt:`Thumbnail`,className:`cawg-thumbnail`}):(0,n.jsx)(`div`,{className:`cawg-square`,children:(0,n.jsx)(`span`,{className:`cawg-logo-text`,children:s})}),(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,n.jsx)(`span`,{className:`cawg-media-title`,children:i}),(0,n.jsx)(`span`,{className:`cawg-creators-name`,children:o})]})]}),c.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:c.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:h[e]??e},e))}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`More Info`})})]})}async function _(){throw Error("No trust registry query function configured. Call `setTrustRegistryQueryFn` (or pass a `queryFn` prop to TrustBadge) with a function that queries a real TRQP endpoint.")}var v=_;function y(e){v=e}function b(){return v}function x(e,n,r,i=b()){let[a,o]=(0,t.useState)(`idle`),[s,c]=(0,t.useState)(null),[l,u]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if(!e){o(`idle`),c(null),u(null);return}let t=!1;return o(`loading`),u(null),i({entityId:e,action:n,resource:r}).then(e=>{t||(c(e),o(`done`))},e=>{t||(c(null),u(e instanceof Error?e:Error(String(e))),o(`error`))}),()=>{t=!0}},[e,n,r,i]),{status:a,result:s,error:l}}function S(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}var C=`Identity Verified by Trust Registry`,w=`Identity Unable to be Verified by Trust Registry`;function T({entityId:e,action:t,resource:r,variant:i=`full`,queryFn:a}){let{status:o,result:s,error:c}=x(e,t,r,a);if(!e)return null;if(o===`error`)return(0,n.jsx)(`span`,{className:`cawg-trust-badge cawg-trust-unverified`,title:c?.message,children:`Unable to reach trust registry`});if(o!==`done`||!s)return(0,n.jsx)(`span`,{className:`cawg-trust-badge cawg-trust-pending`,children:`Checking trust registry…`});let l=(0,n.jsx)(`span`,{className:s.authorized?`cawg-trust-badge cawg-trust-verified`:`cawg-trust-badge cawg-trust-unverified`,title:s.authorized?`Recognized by ${s.authority_id} · checked ${S(s.time_evaluated)}`:s.message,children:s.authorized?C:w});return i===`compact`?l:(0,n.jsxs)(`div`,{className:`cawg-trust-status`,children:[l,s.authorized?(0,n.jsxs)(`div`,{className:`cawg-trust-meta`,children:[s.authority_id,` · checked `,S(s.time_evaluated)]}):s.message&&(0,n.jsx)(`div`,{className:`cawg-trust-message`,children:s.message})]})}var E={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},D={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},O={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},k={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},A={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`};function j(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}function M(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`).join(`, `):typeof e==`string`?e:``}function N({className:e,manifest:t,moreInfo:r}){let i=t.title,a=(t.claimGenerator??t.claimGeneratorInfo?.[0]?.name??`Unknown`).split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,o=m(t.assertions?.[`cawg.identity`]?.verifiedIdentities),s=t.assertions?.[`cawg.identity`],c=s?.signer_payload?.role??[],l=s?.verifiedIdentities??[],u=s?.issuer,f=t.assertions?.[`cawg.training-mining`]?.entries??{},p=t.assertions?.[`cawg.metadata`],h=M(p?.[`dc:creator`]),g=p?.[`xmp:CreateDate`];return(0,n.jsxs)(`div`,{className:`cawg-card ${e??``}`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[t.thumbnail?(0,n.jsx)(`img`,{src:t.thumbnail,alt:`Thumbnail`,className:`cawg-thumbnail`}):(0,n.jsx)(`div`,{className:`cawg-square`,children:(0,n.jsx)(`span`,{className:`cawg-logo-text`,children:a})}),(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,n.jsx)(`span`,{className:`cawg-media-title`,children:i}),(0,n.jsx)(`span`,{className:`cawg-creators-name`,children:o})]})]}),c.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:c.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:E[e]??e},e))}),l.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsxs)(`div`,{className:`cawg-section-title`,style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8},children:[(0,n.jsx)(`span`,{children:`Identity`}),(0,n.jsx)(T,{entityId:u,action:`issue`,resource:`cawg.identity`,variant:`compact`})]}),(0,n.jsx)(`div`,{className:`cawg-identity-list`,children:l.map((e,t)=>{let r=e.type,i=e.name??e.username,a=e.provider;return(0,n.jsx)(`div`,{className:`cawg-identity-item`,children:(0,n.jsxs)(`div`,{style:{flex:1},children:[(0,n.jsx)(`div`,{className:`cawg-identity-type-label`,children:D[r]??r}),i&&(0,n.jsx)(`div`,{className:`cawg-identity-name`,children:i}),a?.name&&(0,n.jsx)(`div`,{className:`cawg-identity-provider`,children:a.name})]})},t)})})]}),Object.keys(f).length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Training & Data Mining`}),(0,n.jsx)(`div`,{className:`cawg-training-list`,children:Object.entries(f).map(([e,t])=>(0,n.jsxs)(`div`,{className:`cawg-training-item`,children:[(0,n.jsx)(`span`,{className:`cawg-training-label`,children:O[e]??e}),(0,n.jsx)(`span`,{className:k[t.use]??`cawg-use-badge`,children:A[t.use]??t.use})]},e))})]}),(h||g)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Creator`}),h&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Name`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:h})]}),g&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Date Created`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:j(g)})]})]}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`More Info`})})]})}var P={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},F={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},I={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},L={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},R={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`},z={"cawg.identity_claims_aggregation":`Identity Claims Aggregation`,"cawg.x509.cose":`X.509 Certificate`,"cawg.verifiable_credential_binding":`Verifiable Credential`};function B(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}function V(e){return e==null?``:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.map(e=>V(e)).filter(Boolean).join(`, `):typeof e==`object`?Object.entries(e).filter(([e])=>!e.startsWith(`@`)).map(([e,t])=>`${e}: ${V(t)}`).join(`; `):String(e)}function H({className:e,manifest:t,moreInfo:r}){let i=t.title,a=t.claimGenerator??t.claimGeneratorInfo?.[0]?.name??`Unknown`,o=m(t.assertions?.[`cawg.identity`]?.verifiedIdentities),s=a.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,c=t.assertions?.[`cawg.identity`],l=c?.signer_payload?.role??[],u=c?.verifiedIdentities??[],f=c?.signer_payload?.sig_type,p=c?.issuer,h=t.assertions?.[`cawg.training-mining`]?.entries??{},g=t.assertions?.[`cawg.metadata`],_=g?Object.entries(g).filter(([e])=>!e.startsWith(`@`)):[];return(0,n.jsxs)(`div`,{className:`cawg-card ${e??``}`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[t.thumbnail?(0,n.jsx)(`img`,{src:t.thumbnail,alt:`Thumbnail`,className:`cawg-thumbnail`}):(0,n.jsx)(`div`,{className:`cawg-square`,children:(0,n.jsx)(`span`,{className:`cawg-logo-text`,children:s})}),(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,n.jsx)(`span`,{className:`cawg-media-title`,children:i}),(0,n.jsx)(`span`,{className:`cawg-creators-name`,children:o})]})]}),l.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:l.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:P[e]??e},e))}),c&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Identity Assertion`}),f&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Credential Type`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:z[f]??f})]}),p&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Issuer`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:p})]}),(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Trust Registry`}),(0,n.jsx)(T,{entityId:p,action:`issue`,resource:`cawg.identity`,variant:`full`})]}),u.length>0&&(0,n.jsx)(`div`,{className:`cawg-identity-list`,style:{marginTop:12},children:u.map((e,t)=>{let r=e.type,i=e.name??e.username??e.address,a=e.provider,o=e.uri,s=e.verifiedAt;return(0,n.jsx)(`div`,{className:`cawg-identity-item`,children:(0,n.jsxs)(`div`,{style:{flex:1},children:[(0,n.jsx)(`div`,{className:`cawg-identity-type-label`,children:F[r]??r}),i&&(0,n.jsx)(`div`,{className:`cawg-identity-name`,children:i}),a?.name&&(0,n.jsxs)(`div`,{className:`cawg-identity-provider`,children:[`via `,a.name]}),o&&(0,n.jsx)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,className:`cawg-identity-link`,children:o}),s&&(0,n.jsxs)(`div`,{className:`cawg-identity-meta`,children:[`Verified `,B(s)]})]})},t)})})]}),Object.keys(h).length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Training & Data Mining`}),(0,n.jsx)(`div`,{className:`cawg-training-list`,children:Object.entries(h).map(([e,t])=>(0,n.jsxs)(`div`,{className:`cawg-training-item`,style:{flexDirection:`column`,alignItems:`flex-start`},children:[(0,n.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,width:`100%`},children:[(0,n.jsx)(`span`,{className:`cawg-training-label`,children:I[e]??e}),(0,n.jsx)(`span`,{className:L[t.use]??`cawg-use-badge`,children:R[t.use]??t.use})]}),t.constraint_info&&(0,n.jsx)(`div`,{className:`cawg-constraint-info`,children:t.constraint_info})]},e))})]}),_.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Metadata`}),_.map(([e,t])=>{let r=V(t);return r?(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:e}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:r})]},e):null})]}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`Small View`})})]})}function U(e){return{id:e.id??``,title:e.title??``,claimGenerator:e.claimGenerator??null,claimGeneratorInfo:(e.claimGeneratorInfo??[]).map(e=>({name:e.name,"org.contentauth.c2pa_rs":e[`org.contentauth.c2pa_rs`]??``})),instanceId:e.instanceId??``,signatureInfo:{alg:e.signatureInfo?.alg??``,issuer:e.signatureInfo?.issuer??``,common_name:e.signatureInfo?.common_name??``,cert_serial_number:e.signatureInfo?.cert_serial_number??``},assertions:e.assertions??{},credentials:e.credentials??[],thumbnail:typeof e.thumbnail==`string`?e.thumbnail:null,ingredients:e.ingredients??[]}}var W=({manifest:e,entry:r,level:i,className:a})=>{let o=e.manifestStore?.activeManifest,s=r==null?e.manifests.find(e=>e.id===o||e.instanceId===o)??(o?e.manifestStore.manifests[o]:void 0)??e.manifests[0]:U(r);if(!s||!(s.assertions?.[`cawg.identity`]!=null||s.assertions?.[`cawg.training-mining`]!=null||s.assertions?.[`cawg.metadata`]!=null))return null;let[c,l]=t.default.useState(i||1);switch(c){case 1:return(0,n.jsx)(g,{className:a,manifest:s,moreInfo:()=>{l(2)}});case 2:return(0,n.jsx)(N,{className:a,manifest:s,moreInfo:()=>{l(3)}});case 3:return(0,n.jsx)(H,{className:a,manifest:s,moreInfo:()=>{l(1)}})}return(0,n.jsx)(`div`,{children:`Level Of Detail Not Selected`})};W.knownAssertions=[`cawg.identity`,`cawg.training-mining`,`cawg.metadata`,`cawg.creator`,`cawg.contributor`,`cawg.editor`,`cawg.producer`,`cawg.publisher`,`cawg.sponsor`,`cawg.translator`,`cawg.document_verification`,`cawg.web_site`,`cawg.affiliation`,`cawg.social_media`,`cawg.crypto_wallet`],e.CAWGManifest=W,e.TrustBadge=T,e.getTrustRegistryQueryFn=b,e.queryTrustRegistry=_,e.setTrustRegistryQueryFn=y,e.useTrustRegistryQuery=x});
10
+ </svg>`,d=()=>(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,marginBottom:`16px`},children:[(0,n.jsx)(`div`,{dangerouslySetInnerHTML:{__html:u},style:{width:`24px`,height:`24px`,display:`flex`,alignItems:`center`}}),(0,n.jsx)(`span`,{style:{fontSize:`14px`,fontWeight:600,color:`#333`,display:`flex`,alignItems:`center`},children:`Creator Assertions Working Group`})]}),f=e=>{switch(e){case`cawg.document_verification`:return 0;case`cawg.social_media`:return 10;case`cawg.web_site`:return 20;case`cawg.affiliation`:return 1e6;default:return 1e5}},p=[`cawg.affiliation`],m=e=>{if(typeof e==`object`&&!Array.isArray(e)&&(e=[e]),!e||e.length===0)return`Unknown`;let t=e.sort((e,t)=>f(e.type)-f(t.type))[0];return!t||p.includes(t.type)?`Unknown`:t.name},h=e=>{if(e)return e.signer_payload??e.c2paAsset},g={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`};function _({className:e,manifest:t,moreInfo:r}){let i=t.title,a=t.claimGenerator??t.claimGeneratorInfo?.[0]?.name??`Unknown`,o=m(t.assertions?.[`cawg.identity`]?.verifiedIdentities),s=a.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,c=t.assertions?.[`cawg.identity`],l=h(c)?.role??[];return(0,n.jsxs)(`div`,{className:`cawg-card ${e??``}`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[t.thumbnail?(0,n.jsx)(`img`,{src:t.thumbnail,alt:`Thumbnail`,className:`cawg-thumbnail`}):(0,n.jsx)(`div`,{className:`cawg-square`,children:(0,n.jsx)(`span`,{className:`cawg-logo-text`,children:s})}),(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,n.jsx)(`span`,{className:`cawg-media-title`,children:i}),(0,n.jsx)(`span`,{className:`cawg-creators-name`,children:o})]})]}),l.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:l.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:g[e]??e},e))}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`More Info`})})]})}async function v(){throw Error("No trust registry query function configured. Call `setTrustRegistryQueryFn` (or pass a `queryFn` prop to TrustBadge) with a function that queries a real TRQP endpoint.")}var y=v;function b(e){y=e}function x(){return y}function S(e,n,r,i=x()){let[a,o]=(0,t.useState)(`idle`),[s,c]=(0,t.useState)(null),[l,u]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if(!e){o(`idle`),c(null),u(null);return}let t=!1;return o(`loading`),u(null),i({entityId:e,action:n,resource:r}).then(e=>{t||(c(e),o(`done`))},e=>{t||(c(null),u(e instanceof Error?e:Error(String(e))),o(`error`))}),()=>{t=!0}},[e,n,r,i]),{status:a,result:s,error:l}}function C(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}var w=`Identity Verified by Trust Registry`,T=`Identity Unable to be Verified by Trust Registry`;function E({entityId:e,action:t,resource:r,variant:i=`full`,queryFn:a}){let{status:o,result:s,error:c}=S(e,t,r,a);if(!e)return null;if(o===`error`)return(0,n.jsx)(`span`,{className:`cawg-trust-badge cawg-trust-unverified`,title:c?.message,children:`Unable to reach trust registry`});if(o!==`done`||!s)return(0,n.jsx)(`span`,{className:`cawg-trust-badge cawg-trust-pending`,children:`Checking trust registry…`});let l=(0,n.jsx)(`span`,{className:s.authorized?`cawg-trust-badge cawg-trust-verified`:`cawg-trust-badge cawg-trust-unverified`,title:s.authorized?`Recognized by ${s.authority_id} · checked ${C(s.time_evaluated)}`:s.message,children:s.authorized?w:T});return i===`compact`?l:(0,n.jsxs)(`div`,{className:`cawg-trust-status`,children:[l,s.authorized?(0,n.jsxs)(`div`,{className:`cawg-trust-meta`,children:[s.authority_id,` · checked `,C(s.time_evaluated)]}):s.message&&(0,n.jsx)(`div`,{className:`cawg-trust-message`,children:s.message})]})}var D={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},O={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},k={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},A={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},j={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`};function M(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}function N(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`).join(`, `):typeof e==`string`?e:``}function P({className:e,manifest:t,moreInfo:r}){let i=t.title,a=(t.claimGenerator??t.claimGeneratorInfo?.[0]?.name??`Unknown`).split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,o=m(t.assertions?.[`cawg.identity`]?.verifiedIdentities),s=t.assertions?.[`cawg.identity`],c=h(s)?.role??[],l=s?.verifiedIdentities??[],u=s?.issuer,f=t.assertions?.[`cawg.training-mining`]?.entries??{},p=t.assertions?.[`cawg.metadata`],g=N(p?.[`dc:creator`]),_=p?.[`xmp:CreateDate`];return(0,n.jsxs)(`div`,{className:`cawg-card ${e??``}`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[t.thumbnail?(0,n.jsx)(`img`,{src:t.thumbnail,alt:`Thumbnail`,className:`cawg-thumbnail`}):(0,n.jsx)(`div`,{className:`cawg-square`,children:(0,n.jsx)(`span`,{className:`cawg-logo-text`,children:a})}),(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,n.jsx)(`span`,{className:`cawg-media-title`,children:i}),(0,n.jsx)(`span`,{className:`cawg-creators-name`,children:o})]})]}),c.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:c.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:D[e]??e},e))}),l.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsxs)(`div`,{className:`cawg-section-title`,style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8},children:[(0,n.jsx)(`span`,{children:`Identity`}),(0,n.jsx)(E,{entityId:u,action:`issue`,resource:`cawg.identity`,variant:`compact`})]}),(0,n.jsx)(`div`,{className:`cawg-identity-list`,children:l.map((e,t)=>{let r=e.type,i=e.name??e.username,a=e.provider;return(0,n.jsx)(`div`,{className:`cawg-identity-item`,children:(0,n.jsxs)(`div`,{style:{flex:1},children:[(0,n.jsx)(`div`,{className:`cawg-identity-type-label`,children:O[r]??r}),i&&(0,n.jsx)(`div`,{className:`cawg-identity-name`,children:i}),a?.name&&(0,n.jsx)(`div`,{className:`cawg-identity-provider`,children:a.name})]})},t)})})]}),Object.keys(f).length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Training & Data Mining`}),(0,n.jsx)(`div`,{className:`cawg-training-list`,children:Object.entries(f).map(([e,t])=>(0,n.jsxs)(`div`,{className:`cawg-training-item`,children:[(0,n.jsx)(`span`,{className:`cawg-training-label`,children:k[e]??e}),(0,n.jsx)(`span`,{className:A[t.use]??`cawg-use-badge`,children:j[t.use]??t.use})]},e))})]}),(g||_)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Creator`}),g&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Name`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:g})]}),_&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Date Created`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:M(_)})]})]}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`More Info`})})]})}var F={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},I={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},L={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},R={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},z={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`},B={"cawg.identity_claims_aggregation":`Identity Claims Aggregation`,"cawg.x509.cose":`X.509 Certificate`,"cawg.verifiable_credential_binding":`Verifiable Credential`};function V(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}function H(e){return e==null?``:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.map(e=>H(e)).filter(Boolean).join(`, `):typeof e==`object`?Object.entries(e).filter(([e])=>!e.startsWith(`@`)).map(([e,t])=>`${e}: ${H(t)}`).join(`; `):String(e)}function U({className:e,manifest:t,moreInfo:r}){let i=t.title,a=t.claimGenerator??t.claimGeneratorInfo?.[0]?.name??`Unknown`,o=m(t.assertions?.[`cawg.identity`]?.verifiedIdentities),s=a.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,c=t.assertions?.[`cawg.identity`],l=h(c),u=l?.role??[],f=c?.verifiedIdentities??[],p=l?.sig_type,g=c?.issuer,_=t.assertions?.[`cawg.training-mining`]?.entries??{},v=t.assertions?.[`cawg.metadata`],y=v?Object.entries(v).filter(([e])=>!e.startsWith(`@`)):[];return(0,n.jsxs)(`div`,{className:`cawg-card ${e??``}`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[t.thumbnail?(0,n.jsx)(`img`,{src:t.thumbnail,alt:`Thumbnail`,className:`cawg-thumbnail`}):(0,n.jsx)(`div`,{className:`cawg-square`,children:(0,n.jsx)(`span`,{className:`cawg-logo-text`,children:s})}),(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,n.jsx)(`span`,{className:`cawg-media-title`,children:i}),(0,n.jsx)(`span`,{className:`cawg-creators-name`,children:o})]})]}),u.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:u.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:F[e]??e},e))}),c&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Identity Assertion`}),p&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Credential Type`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:B[p]??p})]}),g&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Issuer`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:g})]}),(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Trust Registry`}),(0,n.jsx)(E,{entityId:g,action:`issue`,resource:`cawg.identity`,variant:`full`})]}),f.length>0&&(0,n.jsx)(`div`,{className:`cawg-identity-list`,style:{marginTop:12},children:f.map((e,t)=>{let r=e.type,i=e.name??e.username??e.address,a=e.provider,o=e.uri,s=e.verifiedAt;return(0,n.jsx)(`div`,{className:`cawg-identity-item`,children:(0,n.jsxs)(`div`,{style:{flex:1},children:[(0,n.jsx)(`div`,{className:`cawg-identity-type-label`,children:I[r]??r}),i&&(0,n.jsx)(`div`,{className:`cawg-identity-name`,children:i}),a?.name&&(0,n.jsxs)(`div`,{className:`cawg-identity-provider`,children:[`via `,a.name]}),o&&(0,n.jsx)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,className:`cawg-identity-link`,children:o}),s&&(0,n.jsxs)(`div`,{className:`cawg-identity-meta`,children:[`Verified `,V(s)]})]})},t)})})]}),Object.keys(_).length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Training & Data Mining`}),(0,n.jsx)(`div`,{className:`cawg-training-list`,children:Object.entries(_).map(([e,t])=>(0,n.jsxs)(`div`,{className:`cawg-training-item`,style:{flexDirection:`column`,alignItems:`flex-start`},children:[(0,n.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,width:`100%`},children:[(0,n.jsx)(`span`,{className:`cawg-training-label`,children:L[e]??e}),(0,n.jsx)(`span`,{className:R[t.use]??`cawg-use-badge`,children:z[t.use]??t.use})]}),t.constraint_info&&(0,n.jsx)(`div`,{className:`cawg-constraint-info`,children:t.constraint_info})]},e))})]}),y.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Metadata`}),y.map(([e,t])=>{let r=H(t);return r?(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:e}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:r})]},e):null})]}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`Small View`})})]})}function W(e){return{id:e.id??``,title:e.title??``,claimGenerator:e.claimGenerator??null,claimGeneratorInfo:(e.claimGeneratorInfo??[]).map(e=>({name:e.name,"org.contentauth.c2pa_rs":e[`org.contentauth.c2pa_rs`]??``})),instanceId:e.instanceId??``,signatureInfo:{alg:e.signatureInfo?.alg??``,issuer:e.signatureInfo?.issuer??``,common_name:e.signatureInfo?.common_name??``,cert_serial_number:e.signatureInfo?.cert_serial_number??``},assertions:e.assertions??{},credentials:e.credentials??[],thumbnail:typeof e.thumbnail==`string`?e.thumbnail:null,ingredients:e.ingredients??[]}}var G=({manifest:e,entry:r,level:i,className:a})=>{let o=e.manifestStore?.activeManifest,s=r==null?e.manifests.find(e=>e.id===o||e.instanceId===o)??(o?e.manifestStore.manifests[o]:void 0)??e.manifests[0]:W(r);if(!s||!(s.assertions?.[`cawg.identity`]!=null||s.assertions?.[`cawg.training-mining`]!=null||s.assertions?.[`cawg.metadata`]!=null))return null;let[c,l]=t.default.useState(i||1);switch(c){case 1:return(0,n.jsx)(_,{className:a,manifest:s,moreInfo:()=>{l(2)}});case 2:return(0,n.jsx)(P,{className:a,manifest:s,moreInfo:()=>{l(3)}});case 3:return(0,n.jsx)(U,{className:a,manifest:s,moreInfo:()=>{l(1)}})}return(0,n.jsx)(`div`,{children:`Level Of Detail Not Selected`})};G.knownAssertions=[`cawg.identity`,`cawg.training-mining`,`cawg.metadata`,`cawg.creator`,`cawg.contributor`,`cawg.editor`,`cawg.producer`,`cawg.publisher`,`cawg.sponsor`,`cawg.translator`,`cawg.document_verification`,`cawg.web_site`,`cawg.affiliation`,`cawg.social_media`,`cawg.crypto_wallet`],e.CAWGManifest=G,e.TrustBadge=E,e.getTrustRegistryQueryFn=x,e.queryTrustRegistry=v,e.setTrustRegistryQueryFn=b,e.useTrustRegistryQuery=S});
@@ -0,0 +1,18 @@
1
+ export type SignerPayload = {
2
+ sig_type?: string;
3
+ role?: string[];
4
+ referenced_assertions?: unknown[];
5
+ };
6
+ /**
7
+ * The cawg.identity assertion's role/sig_type/referenced_assertions data
8
+ * lives under different keys depending on which identity path signed it:
9
+ * the X.509/COSE path puts it at `signer_payload` (there's no VC wrapper,
10
+ * so the assertion data *is* the signer_payload); the ICA (Identity Claims
11
+ * Aggregation) path puts the same data at `c2paAsset` instead — that's the
12
+ * actual field name the CAWG spec uses for it under `credentialSubject`
13
+ * (see credentialSubject.c2paAsset in the Identity Claims Aggregation
14
+ * spec). Consumers that only checked `signer_payload` would see roles for
15
+ * X.509-signed assertions but never for ICA-signed ones, even though the
16
+ * data is there under `c2paAsset`.
17
+ */
18
+ export declare const getSignerPayload: (identityAssertion: Record<string, unknown> | undefined) => SignerPayload | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2pa-react-cawg-component",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "A React plugin for c2pa-react-component that renders Creator Assertions Working Group (CAWG) data — identity credentials, metadata, and training permissions.",
5
5
  "type": "module",
6
6
  "main": "./dist/c2pa-react-cawg-component.umd.cjs",