c2pa-react-cawg-component 0.1.8 → 0.1.9

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.
@@ -35,23 +35,23 @@ var i = "<svg width=\"34\" height=\"34\" viewBox=\"0 0 34 34\" fill=\"none\" xml
35
35
  "cawg.sponsor": "Sponsor",
36
36
  "cawg.translator": "Translator"
37
37
  };
38
- function s({ manifest: e, moreInfo: t }) {
39
- let i = e.title, s = e.claimGenerator ?? e.claimGeneratorInfo?.[0]?.name ?? "Unknown", c = s.split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", l = (e.assertions?.["cawg.identity"])?.signer_payload?.role ?? [];
38
+ function s({ className: e, manifest: t, moreInfo: i }) {
39
+ let s = t.title, c = t.claimGenerator ?? t.claimGeneratorInfo?.[0]?.name ?? "Unknown", l = c.split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", u = (t.assertions?.["cawg.identity"])?.signer_payload?.role ?? [];
40
40
  return /* @__PURE__ */ r("div", {
41
- className: "cawg-card",
41
+ className: `cawg-card ${e ?? ""}`,
42
42
  children: [
43
43
  /* @__PURE__ */ n(a, {}),
44
44
  /* @__PURE__ */ r("div", {
45
45
  className: "cawg-container",
46
- children: [e.thumbnail ? /* @__PURE__ */ n("img", {
47
- src: e.thumbnail,
46
+ children: [t.thumbnail ? /* @__PURE__ */ n("img", {
47
+ src: t.thumbnail,
48
48
  alt: "Thumbnail",
49
49
  className: "cawg-thumbnail"
50
50
  }) : /* @__PURE__ */ n("div", {
51
51
  className: "cawg-square",
52
52
  children: /* @__PURE__ */ n("span", {
53
53
  className: "cawg-logo-text",
54
- children: c
54
+ children: l
55
55
  })
56
56
  }), /* @__PURE__ */ r("div", {
57
57
  style: {
@@ -60,24 +60,24 @@ function s({ manifest: e, moreInfo: t }) {
60
60
  },
61
61
  children: [/* @__PURE__ */ n("span", {
62
62
  className: "cawg-media-title",
63
- children: i
63
+ children: s
64
64
  }), /* @__PURE__ */ n("span", {
65
65
  className: "cawg-claim-generator",
66
- children: s
66
+ children: c
67
67
  })]
68
68
  })]
69
69
  }),
70
- l.length > 0 && /* @__PURE__ */ n("div", {
70
+ u.length > 0 && /* @__PURE__ */ n("div", {
71
71
  className: "cawg-roles",
72
- children: l.map((e) => /* @__PURE__ */ n("span", {
72
+ children: u.map((e) => /* @__PURE__ */ n("span", {
73
73
  className: "cawg-role-badge",
74
74
  children: o[e] ?? e
75
75
  }, e))
76
76
  }),
77
- t && /* @__PURE__ */ n("div", {
77
+ i && /* @__PURE__ */ n("div", {
78
78
  style: { marginTop: 16 },
79
79
  children: /* @__PURE__ */ n("button", {
80
- onClick: t,
80
+ onClick: i,
81
81
  className: "cawg-button",
82
82
  children: "More Info"
83
83
  })
@@ -115,23 +115,23 @@ var c = {
115
115
  notAllowed: "Not Allowed",
116
116
  constrained: "Constrained"
117
117
  };
118
- function p({ manifest: e, moreInfo: i }) {
119
- let o = e.title, s = e.claimGenerator ?? e.claimGeneratorInfo?.[0]?.name ?? "Unknown", p = s.split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", m = e.assertions?.["cawg.identity"], h = m?.signer_payload?.role ?? [], g = m?.verifiedIdentities ?? [], _ = e.assertions?.["cawg.training-mining"]?.entries ?? {};
118
+ function p({ className: e, manifest: i, moreInfo: o }) {
119
+ let s = i.title, p = i.claimGenerator ?? i.claimGeneratorInfo?.[0]?.name ?? "Unknown", m = p.split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", h = i.assertions?.["cawg.identity"], g = h?.signer_payload?.role ?? [], _ = h?.verifiedIdentities ?? [], v = i.assertions?.["cawg.training-mining"]?.entries ?? {};
120
120
  return /* @__PURE__ */ r("div", {
121
- className: "cawg-card",
121
+ className: `cawg-card ${e ?? ""}`,
122
122
  children: [
123
123
  /* @__PURE__ */ n(a, {}),
124
124
  /* @__PURE__ */ r("div", {
125
125
  className: "cawg-container",
126
- children: [e.thumbnail ? /* @__PURE__ */ n("img", {
127
- src: e.thumbnail,
126
+ children: [i.thumbnail ? /* @__PURE__ */ n("img", {
127
+ src: i.thumbnail,
128
128
  alt: "Thumbnail",
129
129
  className: "cawg-thumbnail"
130
130
  }) : /* @__PURE__ */ n("div", {
131
131
  className: "cawg-square",
132
132
  children: /* @__PURE__ */ n("span", {
133
133
  className: "cawg-logo-text",
134
- children: p
134
+ children: m
135
135
  })
136
136
  }), /* @__PURE__ */ r("div", {
137
137
  style: {
@@ -140,21 +140,21 @@ function p({ manifest: e, moreInfo: i }) {
140
140
  },
141
141
  children: [/* @__PURE__ */ n("span", {
142
142
  className: "cawg-media-title",
143
- children: o
143
+ children: s
144
144
  }), /* @__PURE__ */ n("span", {
145
145
  className: "cawg-claim-generator",
146
- children: s
146
+ children: p
147
147
  })]
148
148
  })]
149
149
  }),
150
- h.length > 0 && /* @__PURE__ */ n("div", {
150
+ g.length > 0 && /* @__PURE__ */ n("div", {
151
151
  className: "cawg-roles",
152
- children: h.map((e) => /* @__PURE__ */ n("span", {
152
+ children: g.map((e) => /* @__PURE__ */ n("span", {
153
153
  className: "cawg-role-badge",
154
154
  children: c[e] ?? e
155
155
  }, e))
156
156
  }),
157
- g.length > 0 && /* @__PURE__ */ r(t, { children: [
157
+ _.length > 0 && /* @__PURE__ */ r(t, { children: [
158
158
  /* @__PURE__ */ n("div", { className: "cawg-divider" }),
159
159
  /* @__PURE__ */ n("div", {
160
160
  className: "cawg-section-title",
@@ -162,7 +162,7 @@ function p({ manifest: e, moreInfo: i }) {
162
162
  }),
163
163
  /* @__PURE__ */ n("div", {
164
164
  className: "cawg-identity-list",
165
- children: g.map((e, t) => {
165
+ children: _.map((e, t) => {
166
166
  let i = e.type, a = e.name ?? e.username, o = e.provider;
167
167
  return /* @__PURE__ */ n("div", {
168
168
  className: "cawg-identity-item",
@@ -187,7 +187,7 @@ function p({ manifest: e, moreInfo: i }) {
187
187
  })
188
188
  })
189
189
  ] }),
190
- Object.keys(_).length > 0 && /* @__PURE__ */ r(t, { children: [
190
+ Object.keys(v).length > 0 && /* @__PURE__ */ r(t, { children: [
191
191
  /* @__PURE__ */ n("div", { className: "cawg-divider" }),
192
192
  /* @__PURE__ */ n("div", {
193
193
  className: "cawg-section-title",
@@ -195,7 +195,7 @@ function p({ manifest: e, moreInfo: i }) {
195
195
  }),
196
196
  /* @__PURE__ */ n("div", {
197
197
  className: "cawg-training-list",
198
- children: Object.entries(_).map(([e, t]) => /* @__PURE__ */ r("div", {
198
+ children: Object.entries(v).map(([e, t]) => /* @__PURE__ */ r("div", {
199
199
  className: "cawg-training-item",
200
200
  children: [/* @__PURE__ */ n("span", {
201
201
  className: "cawg-training-label",
@@ -207,10 +207,10 @@ function p({ manifest: e, moreInfo: i }) {
207
207
  }, e))
208
208
  })
209
209
  ] }),
210
- i && /* @__PURE__ */ n("div", {
210
+ o && /* @__PURE__ */ n("div", {
211
211
  style: { marginTop: 16 },
212
212
  children: /* @__PURE__ */ n("button", {
213
- onClick: i,
213
+ onClick: o,
214
214
  className: "cawg-button",
215
215
  children: "More Info"
216
216
  })
@@ -266,23 +266,23 @@ function b(e) {
266
266
  function x(e) {
267
267
  return e == null ? "" : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? e.map((e) => x(e)).filter(Boolean).join(", ") : typeof e == "object" ? Object.entries(e).filter(([e]) => !e.startsWith("@")).map(([e, t]) => `${e}: ${x(t)}`).join("; ") : String(e);
268
268
  }
269
- function S({ manifest: e, moreInfo: i }) {
270
- let o = e.title, s = e.claimGenerator ?? e.claimGeneratorInfo?.[0]?.name ?? "Unknown", c = s.split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", l = e.assertions?.["cawg.identity"], u = l?.signer_payload?.role ?? [], d = l?.verifiedIdentities ?? [], f = l?.signer_payload?.sig_type, p = l?.issuer, S = e.assertions?.["cawg.training-mining"]?.entries ?? {}, C = e.assertions?.["cawg.metadata"], w = C ? Object.entries(C).filter(([e]) => !e.startsWith("@")) : [];
269
+ function S({ className: e, manifest: i, moreInfo: o }) {
270
+ let s = i.title, c = i.claimGenerator ?? i.claimGeneratorInfo?.[0]?.name ?? "Unknown", l = c.split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", u = i.assertions?.["cawg.identity"], d = u?.signer_payload?.role ?? [], f = u?.verifiedIdentities ?? [], p = u?.signer_payload?.sig_type, S = u?.issuer, C = i.assertions?.["cawg.training-mining"]?.entries ?? {}, w = i.assertions?.["cawg.metadata"], T = w ? Object.entries(w).filter(([e]) => !e.startsWith("@")) : [];
271
271
  return /* @__PURE__ */ r("div", {
272
- className: "cawg-card",
272
+ className: `cawg-card ${e ?? ""}`,
273
273
  children: [
274
274
  /* @__PURE__ */ n(a, {}),
275
275
  /* @__PURE__ */ r("div", {
276
276
  className: "cawg-container",
277
- children: [e.thumbnail ? /* @__PURE__ */ n("img", {
278
- src: e.thumbnail,
277
+ children: [i.thumbnail ? /* @__PURE__ */ n("img", {
278
+ src: i.thumbnail,
279
279
  alt: "Thumbnail",
280
280
  className: "cawg-thumbnail"
281
281
  }) : /* @__PURE__ */ n("div", {
282
282
  className: "cawg-square",
283
283
  children: /* @__PURE__ */ n("span", {
284
284
  className: "cawg-logo-text",
285
- children: c
285
+ children: l
286
286
  })
287
287
  }), /* @__PURE__ */ r("div", {
288
288
  style: {
@@ -291,50 +291,50 @@ function S({ manifest: e, moreInfo: i }) {
291
291
  },
292
292
  children: [/* @__PURE__ */ n("span", {
293
293
  className: "cawg-media-title",
294
- children: o
294
+ children: s
295
295
  }), /* @__PURE__ */ n("span", {
296
296
  className: "cawg-claim-generator",
297
- children: s
297
+ children: c
298
298
  })]
299
299
  })]
300
300
  }),
301
- u.length > 0 && /* @__PURE__ */ n("div", {
301
+ d.length > 0 && /* @__PURE__ */ n("div", {
302
302
  className: "cawg-roles",
303
- children: u.map((e) => /* @__PURE__ */ n("span", {
303
+ children: d.map((e) => /* @__PURE__ */ n("span", {
304
304
  className: "cawg-role-badge",
305
305
  children: m[e] ?? e
306
306
  }, e))
307
307
  }),
308
- l && /* @__PURE__ */ r(t, { children: [
308
+ u && /* @__PURE__ */ r(t, { children: [
309
309
  /* @__PURE__ */ n("div", { className: "cawg-divider" }),
310
310
  /* @__PURE__ */ n("div", {
311
311
  className: "cawg-section-title",
312
312
  children: "Identity Assertion"
313
313
  }),
314
- f && /* @__PURE__ */ r("div", {
314
+ p && /* @__PURE__ */ r("div", {
315
315
  className: "cawg-key-value",
316
316
  children: [/* @__PURE__ */ n("div", {
317
317
  className: "cawg-key-value-label",
318
318
  children: "Credential Type"
319
319
  }), /* @__PURE__ */ n("div", {
320
320
  className: "cawg-key-value-value",
321
- children: y[f] ?? f
321
+ children: y[p] ?? p
322
322
  })]
323
323
  }),
324
- p && /* @__PURE__ */ r("div", {
324
+ S && /* @__PURE__ */ r("div", {
325
325
  className: "cawg-key-value",
326
326
  children: [/* @__PURE__ */ n("div", {
327
327
  className: "cawg-key-value-label",
328
328
  children: "Issuer"
329
329
  }), /* @__PURE__ */ n("div", {
330
330
  className: "cawg-key-value-value",
331
- children: p
331
+ children: S
332
332
  })]
333
333
  }),
334
- d.length > 0 && /* @__PURE__ */ n("div", {
334
+ f.length > 0 && /* @__PURE__ */ n("div", {
335
335
  className: "cawg-identity-list",
336
336
  style: { marginTop: 12 },
337
- children: d.map((e, t) => {
337
+ children: f.map((e, t) => {
338
338
  let i = e.type, a = e.name ?? e.username ?? e.address, o = e.provider, s = e.uri, c = e.verifiedAt;
339
339
  return /* @__PURE__ */ n("div", {
340
340
  className: "cawg-identity-item",
@@ -370,7 +370,7 @@ function S({ manifest: e, moreInfo: i }) {
370
370
  })
371
371
  })
372
372
  ] }),
373
- Object.keys(S).length > 0 && /* @__PURE__ */ r(t, { children: [
373
+ Object.keys(C).length > 0 && /* @__PURE__ */ r(t, { children: [
374
374
  /* @__PURE__ */ n("div", { className: "cawg-divider" }),
375
375
  /* @__PURE__ */ n("div", {
376
376
  className: "cawg-section-title",
@@ -378,7 +378,7 @@ function S({ manifest: e, moreInfo: i }) {
378
378
  }),
379
379
  /* @__PURE__ */ n("div", {
380
380
  className: "cawg-training-list",
381
- children: Object.entries(S).map(([e, t]) => /* @__PURE__ */ r("div", {
381
+ children: Object.entries(C).map(([e, t]) => /* @__PURE__ */ r("div", {
382
382
  className: "cawg-training-item",
383
383
  style: {
384
384
  flexDirection: "column",
@@ -404,13 +404,13 @@ function S({ manifest: e, moreInfo: i }) {
404
404
  }, e))
405
405
  })
406
406
  ] }),
407
- w.length > 0 && /* @__PURE__ */ r(t, { children: [
407
+ T.length > 0 && /* @__PURE__ */ r(t, { children: [
408
408
  /* @__PURE__ */ n("div", { className: "cawg-divider" }),
409
409
  /* @__PURE__ */ n("div", {
410
410
  className: "cawg-section-title",
411
411
  children: "Metadata"
412
412
  }),
413
- w.map(([e, t]) => {
413
+ T.map(([e, t]) => {
414
414
  let i = x(t);
415
415
  return i ? /* @__PURE__ */ r("div", {
416
416
  className: "cawg-key-value",
@@ -424,10 +424,10 @@ function S({ manifest: e, moreInfo: i }) {
424
424
  }, e) : null;
425
425
  })
426
426
  ] }),
427
- i && /* @__PURE__ */ n("div", {
427
+ o && /* @__PURE__ */ n("div", {
428
428
  style: { marginTop: 16 },
429
429
  children: /* @__PURE__ */ n("button", {
430
- onClick: i,
430
+ onClick: o,
431
431
  className: "cawg-button",
432
432
  children: "Small View"
433
433
  })
@@ -439,25 +439,25 @@ function S({ manifest: e, moreInfo: i }) {
439
439
  //#region src/components/Cawg/Cawg.tsx
440
440
  var C = ({ manifest: t, level: r, className: i }) => {
441
441
  let a = t.manifestStore?.activeManifest, o = t.manifests.find((e) => e.id === a || e.instanceId === a) ?? (a ? t.manifestStore.manifests[a] : void 0) ?? t.manifests[0];
442
- if (!o) return /* @__PURE__ */ n("div", {
443
- className: i,
444
- children: "No active manifest found."
445
- });
442
+ if (!o || !(o.assertions?.["cawg.identity"] != null || o.assertions?.["cawg.training-mining"] != null || o.assertions?.["cawg.metadata"] != null)) return null;
446
443
  let [c, l] = e.useState(r || 1);
447
444
  switch (c) {
448
445
  case 1: return /* @__PURE__ */ n(s, {
446
+ className: i,
449
447
  manifest: o,
450
448
  moreInfo: () => {
451
449
  l(2);
452
450
  }
453
451
  });
454
452
  case 2: return /* @__PURE__ */ n(p, {
453
+ className: i,
455
454
  manifest: o,
456
455
  moreInfo: () => {
457
456
  l(3);
458
457
  }
459
458
  });
460
459
  case 3: return /* @__PURE__ */ n(S, {
460
+ className: i,
461
461
  manifest: o,
462
462
  moreInfo: () => {
463
463
  l(1);
@@ -466,5 +466,22 @@ var C = ({ manifest: t, level: r, className: i }) => {
466
466
  }
467
467
  return /* @__PURE__ */ n("div", { children: "Level Of Detail Not Selected" });
468
468
  };
469
+ C.knownAssertions = [
470
+ "cawg.identity",
471
+ "cawg.training-mining",
472
+ "cawg.metadata",
473
+ "cawg.creator",
474
+ "cawg.contributor",
475
+ "cawg.editor",
476
+ "cawg.producer",
477
+ "cawg.publisher",
478
+ "cawg.sponsor",
479
+ "cawg.translator",
480
+ "cawg.document_verification",
481
+ "cawg.web_site",
482
+ "cawg.affiliation",
483
+ "cawg.social_media",
484
+ "cawg.crypto_wallet"
485
+ ];
469
486
  //#endregion
470
487
  export { C as CAWGManifest };
@@ -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={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`};function p({manifest:e,moreInfo:t}){let r=e.title,i=e.claimGenerator??e.claimGeneratorInfo?.[0]?.name??`Unknown`,a=i.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,o=(e.assertions?.[`cawg.identity`])?.signer_payload?.role??[];return(0,n.jsxs)(`div`,{className:`cawg-card`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[e.thumbnail?(0,n.jsx)(`img`,{src:e.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:r}),(0,n.jsx)(`span`,{className:`cawg-claim-generator`,children:i})]})]}),o.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:o.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:f[e]??e},e))}),t&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:t,className:`cawg-button`,children:`More Info`})})]})}var m={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},h={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},g={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},_={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},v={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`};function y({manifest:e,moreInfo:t}){let r=e.title,i=e.claimGenerator??e.claimGeneratorInfo?.[0]?.name??`Unknown`,a=i.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,o=e.assertions?.[`cawg.identity`],s=o?.signer_payload?.role??[],c=o?.verifiedIdentities??[],l=e.assertions?.[`cawg.training-mining`]?.entries??{};return(0,n.jsxs)(`div`,{className:`cawg-card`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[e.thumbnail?(0,n.jsx)(`img`,{src:e.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:r}),(0,n.jsx)(`span`,{className:`cawg-claim-generator`,children:i})]})]}),s.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:s.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:m[e]??e},e))}),c.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Identity`}),(0,n.jsx)(`div`,{className:`cawg-identity-list`,children:c.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:h[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(l).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(l).map(([e,t])=>(0,n.jsxs)(`div`,{className:`cawg-training-item`,children:[(0,n.jsx)(`span`,{className:`cawg-training-label`,children:g[e]??e}),(0,n.jsx)(`span`,{className:_[t.use]??`cawg-use-badge`,children:v[t.use]??t.use})]},e))})]}),t&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:t,className:`cawg-button`,children:`More Info`})})]})}var b={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},x={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},S={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},C={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},w={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`},T={"cawg.identity_claims_aggregation":`Identity Claims Aggregation`,"cawg.x509.cose":`X.509 Certificate`,"cawg.verifiable_credential_binding":`Verifiable Credential`};function E(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}function D(e){return e==null?``:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.map(e=>D(e)).filter(Boolean).join(`, `):typeof e==`object`?Object.entries(e).filter(([e])=>!e.startsWith(`@`)).map(([e,t])=>`${e}: ${D(t)}`).join(`; `):String(e)}function O({manifest:e,moreInfo:t}){let r=e.title,i=e.claimGenerator??e.claimGeneratorInfo?.[0]?.name??`Unknown`,a=i.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,o=e.assertions?.[`cawg.identity`],s=o?.signer_payload?.role??[],c=o?.verifiedIdentities??[],l=o?.signer_payload?.sig_type,u=o?.issuer,f=e.assertions?.[`cawg.training-mining`]?.entries??{},p=e.assertions?.[`cawg.metadata`],m=p?Object.entries(p).filter(([e])=>!e.startsWith(`@`)):[];return(0,n.jsxs)(`div`,{className:`cawg-card`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[e.thumbnail?(0,n.jsx)(`img`,{src:e.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:r}),(0,n.jsx)(`span`,{className:`cawg-claim-generator`,children:i})]})]}),s.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:s.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:b[e]??e},e))}),o&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Identity Assertion`}),l&&(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:T[l]??l})]}),u&&(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:u})]}),c.length>0&&(0,n.jsx)(`div`,{className:`cawg-identity-list`,style:{marginTop:12},children:c.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:x[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 `,E(s)]})]})},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`,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:S[e]??e}),(0,n.jsx)(`span`,{className:C[t.use]??`cawg-use-badge`,children:w[t.use]??t.use})]}),t.constraint_info&&(0,n.jsx)(`div`,{className:`cawg-constraint-info`,children:t.constraint_info})]},e))})]}),m.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`}),m.map(([e,t])=>{let r=D(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})]}),t&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:t,className:`cawg-button`,children:`Small View`})})]})}e.CAWGManifest=({manifest:e,level:r,className:i})=>{let a=e.manifestStore?.activeManifest,o=e.manifests.find(e=>e.id===a||e.instanceId===a)??(a?e.manifestStore.manifests[a]:void 0)??e.manifests[0];if(!o)return(0,n.jsx)(`div`,{className:i,children:`No active manifest found.`});let[s,c]=t.default.useState(r||1);switch(s){case 1:return(0,n.jsx)(p,{manifest:o,moreInfo:()=>{c(2)}});case 2:return(0,n.jsx)(y,{manifest:o,moreInfo:()=>{c(3)}});case 3:return(0,n.jsx)(O,{manifest:o,moreInfo:()=>{c(1)}})}return(0,n.jsx)(`div`,{children:`Level Of Detail Not Selected`})}});
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={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`};function p({className:e,manifest:t,moreInfo:r}){let i=t.title,a=t.claimGenerator??t.claimGeneratorInfo?.[0]?.name??`Unknown`,o=a.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,s=(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:o})}),(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-claim-generator`,children:a})]})]}),s.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:s.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:f[e]??e},e))}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`More Info`})})]})}var m={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},h={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},g={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},_={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},v={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`};function y({className:e,manifest:t,moreInfo:r}){let i=t.title,a=t.claimGenerator??t.claimGeneratorInfo?.[0]?.name??`Unknown`,o=a.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,s=t.assertions?.[`cawg.identity`],c=s?.signer_payload?.role??[],l=s?.verifiedIdentities??[],u=t.assertions?.[`cawg.training-mining`]?.entries??{};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:o})}),(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-claim-generator`,children:a})]})]}),c.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:c.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:m[e]??e},e))}),l.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Identity`}),(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:h[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(u).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(u).map(([e,t])=>(0,n.jsxs)(`div`,{className:`cawg-training-item`,children:[(0,n.jsx)(`span`,{className:`cawg-training-label`,children:g[e]??e}),(0,n.jsx)(`span`,{className:_[t.use]??`cawg-use-badge`,children:v[t.use]??t.use})]},e))})]}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`More Info`})})]})}var b={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},x={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},S={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},C={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},w={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`},T={"cawg.identity_claims_aggregation":`Identity Claims Aggregation`,"cawg.x509.cose":`X.509 Certificate`,"cawg.verifiable_credential_binding":`Verifiable Credential`};function E(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}function D(e){return e==null?``:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.map(e=>D(e)).filter(Boolean).join(`, `):typeof e==`object`?Object.entries(e).filter(([e])=>!e.startsWith(`@`)).map(([e,t])=>`${e}: ${D(t)}`).join(`; `):String(e)}function O({className:e,manifest:t,moreInfo:r}){let i=t.title,a=t.claimGenerator??t.claimGeneratorInfo?.[0]?.name??`Unknown`,o=a.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,s=t.assertions?.[`cawg.identity`],c=s?.signer_payload?.role??[],l=s?.verifiedIdentities??[],u=s?.signer_payload?.sig_type,f=s?.issuer,p=t.assertions?.[`cawg.training-mining`]?.entries??{},m=t.assertions?.[`cawg.metadata`],h=m?Object.entries(m).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:o})}),(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-claim-generator`,children:a})]})]}),c.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:c.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:b[e]??e},e))}),s&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Identity Assertion`}),u&&(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:T[u]??u})]}),f&&(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:f})]}),l.length>0&&(0,n.jsx)(`div`,{className:`cawg-identity-list`,style:{marginTop:12},children:l.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:x[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 `,E(s)]})]})},t)})})]}),Object.keys(p).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(p).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:S[e]??e}),(0,n.jsx)(`span`,{className:C[t.use]??`cawg-use-badge`,children:w[t.use]??t.use})]}),t.constraint_info&&(0,n.jsx)(`div`,{className:`cawg-constraint-info`,children:t.constraint_info})]},e))})]}),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:`Metadata`}),h.map(([e,t])=>{let r=D(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`})})]})}var k=({manifest:e,level:r,className:i})=>{let a=e.manifestStore?.activeManifest,o=e.manifests.find(e=>e.id===a||e.instanceId===a)??(a?e.manifestStore.manifests[a]:void 0)??e.manifests[0];if(!o||!(o.assertions?.[`cawg.identity`]!=null||o.assertions?.[`cawg.training-mining`]!=null||o.assertions?.[`cawg.metadata`]!=null))return null;let[s,c]=t.default.useState(r||1);switch(s){case 1:return(0,n.jsx)(p,{className:i,manifest:o,moreInfo:()=>{c(2)}});case 2:return(0,n.jsx)(y,{className:i,manifest:o,moreInfo:()=>{c(3)}});case 3:return(0,n.jsx)(O,{className:i,manifest:o,moreInfo:()=>{c(1)}})}return(0,n.jsx)(`div`,{children:`Level Of Detail Not Selected`})};k.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=k});
@@ -2,5 +2,6 @@ import { Manifest } from 'c2pa-react-component-types';
2
2
  export interface CAWGL1Props {
3
3
  manifest: Manifest;
4
4
  moreInfo?: () => void;
5
+ className?: string;
5
6
  }
6
- export declare function CAWGL1({ manifest, moreInfo }: CAWGL1Props): import("react/jsx-runtime").JSX.Element;
7
+ export declare function CAWGL1({ className, manifest, moreInfo }: CAWGL1Props): import("react/jsx-runtime").JSX.Element;
@@ -2,5 +2,6 @@ import { Manifest } from 'c2pa-react-component-types';
2
2
  export interface CAWGL2Props {
3
3
  manifest: Manifest;
4
4
  moreInfo?: () => void;
5
+ className?: string;
5
6
  }
6
- export default function CAWGL2({ manifest, moreInfo }: CAWGL2Props): import("react/jsx-runtime").JSX.Element;
7
+ export default function CAWGL2({ className, manifest, moreInfo }: CAWGL2Props): import("react/jsx-runtime").JSX.Element;
@@ -2,5 +2,6 @@ import { Manifest } from 'c2pa-react-component-types';
2
2
  export interface CAWGL3Props {
3
3
  manifest: Manifest;
4
4
  moreInfo?: () => void;
5
+ className?: string;
5
6
  }
6
- export default function CAWGL3({ manifest, moreInfo }: CAWGL3Props): import("react/jsx-runtime").JSX.Element;
7
+ export default function CAWGL3({ className, manifest, moreInfo }: CAWGL3Props): import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2pa-react-cawg-component",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
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",
@@ -79,6 +79,6 @@
79
79
  "vitest": "^4.1.5"
80
80
  },
81
81
  "dependencies": {
82
- "c2pa-react-component-types": "^0.1.0"
82
+ "c2pa-react-component-types": "^0.1.2"
83
83
  }
84
84
  }