@rr0/ufoathome 0.123.1 → 0.124.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/dist-embed-interview/rr0-interview.mjs +10 -10
  2. package/dist-embed-scene/rr0-scene.mjs +3 -3
  3. package/dist-embed-sighting/rr0-sighting.mjs +4 -4
  4. package/dist-embed-sighting-editor/{AdsbLolArchiveProvider-CDtWnd9O.js → AdsbLolArchiveProvider-CFgVABcu.js} +1 -1
  5. package/dist-embed-sighting-editor/{BodyEditor-ChwDW_Ws.js → BodyEditor-Dg97ZrRa.js} +1 -1
  6. package/dist-embed-sighting-editor/{ContrailSystem-C1ugmbHe.js → ContrailSystem-DSdLswxr.js} +1 -1
  7. package/dist-embed-sighting-editor/{CoverageAssessor-CmEo7iZm.js → CoverageAssessor-8zrC-ZY0.js} +1 -1
  8. package/dist-embed-sighting-editor/{GLTFLoader-C8s-rYg8.js → GLTFLoader-RPFGUAaO.js} +1 -1
  9. package/dist-embed-sighting-editor/{HeadlightSystem-NhpS6K9T.js → HeadlightSystem-DbRok2GO.js} +1 -1
  10. package/dist-embed-sighting-editor/{HynekAssessor-BzyMfAGm.js → HynekAssessor-9gYrshkH.js} +1 -1
  11. package/dist-embed-sighting-editor/{InterviewEditorElement-Dl2fhE44.js → InterviewEditorElement-DRjEJwEk.js} +11 -12
  12. package/dist-embed-sighting-editor/{LaunchEditor-BCbplrLt.js → LaunchEditor-byu9U1W7.js} +1 -1
  13. package/dist-embed-sighting-editor/{ModelSource-C3dP1aBw.js → ModelSource-f1GhdDou.js} +1 -1
  14. package/dist-embed-sighting-editor/{ModelThumbnails-B2MXsKrk.js → ModelThumbnails-hmPAkRbd.js} +1 -1
  15. package/dist-embed-sighting-editor/{ModelViewer-BltV6g37.js → ModelViewer-Mvug9CHB.js} +1 -1
  16. package/dist-embed-sighting-editor/{RoadMarkings-B3u94pIv.js → RoadMarkings-BKfyWjdC.js} +1 -1
  17. package/dist-embed-sighting-editor/{SightingEditorMessages_es-DkPZhcr_.js → SightingEditorMessages_es-DvIK6dPp.js} +1 -1
  18. package/dist-embed-sighting-editor/{SightingEditorMessages_fr-Dhw6ob5Y.js → SightingEditorMessages_fr-Ds1GsY_1.js} +1 -1
  19. package/dist-embed-sighting-editor/{SightingEditorMessages_it-7r9D-wed.js → SightingEditorMessages_it-Y2D8aYCY.js} +1 -1
  20. package/dist-embed-sighting-editor/{TraceSystem-CZFR0soj.js → TraceSystem-BMYhHoF0.js} +2 -2
  21. package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +298 -297
  22. package/dist-embed-sighting-editor/{surroundingsSources-CvhFXPJx.js → surroundingsSources-BtDVuj-U.js} +1 -1
  23. package/dist-embed-sighting-editor/{trafficRuntime-XVgt3vom.js → trafficRuntime-BtljEizX.js} +2 -2
  24. package/package.json +1 -1
@@ -1,24 +1,24 @@
1
- class w{constructor(e){this.preferences=e}read(e){if(e===void 0||typeof e=="string")return e===""?void 0:e;for(const t of this.preferences){const s=e[t]??e[w.base(t)];if(s)return s}const r=new Set(this.preferences.map(t=>w.base(t)));for(const[t,s]of Object.entries(e))if(s&&r.has(w.base(t)))return s;return Object.values(e).find(t=>t)??void 0}write(e,r,t){const s=r?.trim()?r.trim():void 0;if(e===void 0||typeof e=="string")return s;const n={...e},a=Object.keys(n).find(o=>o===t)??Object.keys(n).find(o=>w.base(o)===w.base(t))??t;return s===void 0?delete n[a]:n[a]=s,Object.keys(n).length===0?void 0:n}static base(e){return e.toLowerCase().split("-")[0]}}class b extends Error{constructor(e,r,t){super(`${e}: ${r}${t===void 0?"":` (HTTP ${t})`}`),this.kind=e,this.url=r,this.status=t,this.name="SightingFetchError"}}class x{static async json(e){const r=new URL(e,location.href);if(location.protocol==="https:"&&r.protocol==="http:")throw new b("mixed-content",e);let t;try{t=await fetch(e)}catch{throw await this.diagnose(e,r)}if(!t.ok)throw new b("status",e,t.status);try{return await t.json()}catch{throw new b("malformed",e)}}static async diagnose(e,r){if(r.origin===location.origin)return new b("unreachable",e);try{return await fetch(e,{mode:"no-cors"}),new b("cors",e)}catch{return new b("unreachable",e)}}}function A(u,e){for(const r of u){const t=r.toLowerCase().split("-")[0];if(e.includes(t))return t}return"en"}class ${static preferencesFor(e){const r=navigator.languages??[],t=this.declaredFor(e);return t?[t,...r]:r}static declaredFor(e){for(let r=e;r;){const t=r.closest("[lang]")?.getAttribute("lang")?.trim();if(t)return t;const s=r.getRootNode();r=s instanceof ShadowRoot?s.host:void 0}}}const M="modulepreload",O=function(u,e){return new URL(u,e).href},L={},y=function(e,r,t){let s=Promise.resolve();if(r&&r.length>0){let a=function(c){return Promise.all(c.map(f=>Promise.resolve(f).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};const o=document.getElementsByTagName("link"),h=document.querySelector("meta[property=csp-nonce]"),i=h?.nonce||h?.getAttribute("nonce");s=a(r.map(c=>{if(c=O(c,t),c in L)return;L[c]=!0;const f=c.endsWith(".css"),d=f?'[rel="stylesheet"]':"";if(!!t)for(let l=o.length-1;l>=0;l--){const g=o[l];if(g.href===c&&(!f||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${c}"]${d}`))return;const m=document.createElement("link");if(m.rel=f?"stylesheet":M,f||(m.as="script"),m.crossOrigin="",m.href=c,i&&m.setAttribute("nonce",i),document.head.appendChild(m),f)return new Promise((l,g)=>{m.addEventListener("load",l),m.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}function n(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return s.then(a=>{for(const o of a||[])o.status==="rejected"&&n(o.reason);return e().catch(n)})},R=["en","fr","es","it"],j={en:()=>y(()=>Promise.resolve().then(()=>P),void 0,import.meta.url).then(u=>u.interviewMessages_en),fr:()=>y(()=>import("./InterviewMessages_fr-CmScqfza.js"),[],import.meta.url).then(u=>u.interviewMessages_fr),es:()=>y(()=>import("./InterviewMessages_es-D5d2JVA3.js"),[],import.meta.url).then(u=>u.interviewMessages_es),it:()=>y(()=>import("./InterviewMessages_it-2SNw5xMp.js"),[],import.meta.url).then(u=>u.interviewMessages_it)};function C(u){return j[u]()}const E={title:"Title",time:"When",by:"Interviewer",medium:"Medium",witness:"Witness",witnessNone:"—",summary:"Description",transcript:"Transcript",transcriptHint:"Address of the anonymised transcript file (optional)",summaryTab:"Summary",fileTab:"File",importFile:"Load a file (JSON, text, WebVTT, SRT)",importUrl:"Or load from URL",importButton:"Load",saveButton:"Save",loading:"Loading the transcript…",invalid:"This text is not valid JSON yet: the interview keeps the last transcript it understood.",notATranscript:"That file is not an interview transcript (it has no segments).",loadFailed:"That transcript could not be read.",editorLabel:"Interview transcript as JSON",byHint:"RR0 people ids, separated by commas",exchangesTab:"Exchanges",exchangesEmpty:"Nothing was said yet.",redacted:"Passage removed",proofreadAll:"Proofread by everyone.",proofreadPending:"Not proofread yet by: {names}",roles:{interviewer:"Interviewer",interviewee:"Interviewee",witness:"Witness"}},P=Object.freeze(Object.defineProperty({__proto__:null,interviewMessages_en:E},Symbol.toStringTag,{value:"Module"})),_="interviewseek";class p{static isProofread(e){const r=Object.keys(e.speakers);return r.length>0&&r.every(t=>{const s=e.proofreading?.[t]?.status;return s==="approved"||s==="covered"})}static said(e){return e.parts?e.parts.map(r=>"redacted"in r?"…":p.plain(r.text)).join(" "):e.redacted?void 0:p.plain(e.text??"")}static ENTITIES={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "};static plain(e){return/[<&]/.test(e)?e.replace(/<br\s*\/?>/gi,`
2
- `).replace(/<\/?[a-z][^>]*>/gi,"").replace(/&#x([0-9a-f]+);/gi,(r,t)=>String.fromCodePoint(parseInt(t,16))).replace(/&#(\d+);/g,(r,t)=>String.fromCodePoint(Number(t))).replace(/&(\w+);/g,(r,t)=>p.ENTITIES[t.toLowerCase()]??r):e}static sightingsOf(e){return[e.interviewOf].flat().filter(r=>typeof r=="string")}static passagesAbout(e,r){const t=p.sightingsOf(e),s=[];return e.segments.forEach((n,a)=>{for(const o of n.refs??[]){if(o.sighting===void 0?!t.includes(r):o.sighting!==r)continue;const h=p.said(n);s.push({index:a,speaker:n.speaker,at:o.at,...h!==void 0?{text:h}:{},...o.range?{range:o.range}:{}})}}),s.sort((n,a)=>n.at-a.at||n.index-a.index)}static clock(e,r=!1){const t=Math.round(e*10),s=Math.floor(t/10),n=h=>String(h).padStart(2,"0"),a=Math.floor(s/3600),o=`${a>0||r?n(Math.floor(s/60)%60):Math.floor(s/60)}:${n(s%60)}`;return`${a>0?`${a}:`:""}${o}${r||t%10!==0?`.${t%10}`:""}`}static speakerName(e,r){const t=e.speakers[r];if(!t)return r;const s=typeof t.title=="string"?t.title:t.title?Object.values(t.title)[0]:void 0;return s||t.by&&p.agentName(t.by)||t.role}static agentName(e){if("people"in e){const[r,...t]=e.people.replace(/([a-z])([A-Z])/g,"$1 $2").split(" ");return[...t,r].join(" ")}return"org"in e?e.org:e.title??""}static stamp(e){const r=Math.round(e*1e3),t=(s,n=2)=>String(s).padStart(n,"0");return`${t(Math.floor(r/36e5))}:${t(Math.floor(r/6e4)%60)}:${t(Math.floor(r/1e3)%60)}.${t(r%1e3,3)}`}static toVtt(e){const r=n=>n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),t=e.segments.filter(n=>n.start!==void 0);return`WEBVTT
1
+ class w{constructor(e){this.preferences=e}read(e){if(e===void 0||typeof e=="string")return e===""?void 0:e;for(const t of this.preferences){const s=e[t]??e[w.base(t)];if(s)return s}const r=new Set(this.preferences.map(t=>w.base(t)));for(const[t,s]of Object.entries(e))if(s&&r.has(w.base(t)))return s;return Object.values(e).find(t=>t)??void 0}write(e,r,t){const s=r?.trim()?r.trim():void 0;if(e===void 0||typeof e=="string")return s;const n={...e},a=Object.keys(n).find(o=>o===t)??Object.keys(n).find(o=>w.base(o)===w.base(t))??t;return s===void 0?delete n[a]:n[a]=s,Object.keys(n).length===0?void 0:n}static base(e){return e.toLowerCase().split("-")[0]}}class k extends Error{constructor(e,r,t){super(`${e}: ${r}${t===void 0?"":` (HTTP ${t})`}`),this.kind=e,this.url=r,this.status=t,this.name="SightingFetchError"}}class ${static async json(e){const r=new URL(e,location.href);if(location.protocol==="https:"&&r.protocol==="http:")throw new k("mixed-content",e);let t;try{t=await fetch(e)}catch{throw await this.diagnose(e,r)}if(!t.ok)throw new k("status",e,t.status);try{return await t.json()}catch{throw new k("malformed",e)}}static async diagnose(e,r){if(r.origin===location.origin)return new k("unreachable",e);try{return await fetch(e,{mode:"no-cors"}),new k("cors",e)}catch{return new k("unreachable",e)}}}function M(l,e){for(const r of l){const t=r.toLowerCase().split("-")[0];if(e.includes(t))return t}return"en"}class O{static preferencesFor(e){const r=navigator.languages??[],t=this.declaredFor(e);return t?[t,...r]:r}static declaredFor(e){for(let r=e;r;){const t=r.closest("[lang]")?.getAttribute("lang")?.trim();if(t)return t;const s=r.getRootNode();r=s instanceof ShadowRoot?s.host:void 0}}}const R="modulepreload",j=function(l,e){return new URL(l,e).href},A={},N=function(e,r,t){let s=Promise.resolve();if(r&&r.length>0){let a=function(d){return Promise.all(d.map(i=>Promise.resolve(i).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};const o=document.getElementsByTagName("link"),u=document.querySelector("meta[property=csp-nonce]"),g=u?.nonce||u?.getAttribute("nonce");s=a(r.map(d=>{if(d=j(d,t),d in A)return;A[d]=!0;const i=d.endsWith(".css"),h=i?'[rel="stylesheet"]':"";if(!!t)for(let v=o.length-1;v>=0;v--){const b=o[v];if(b.href===d&&(!i||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${h}`))return;const c=document.createElement("link");if(c.rel=i?"stylesheet":R,i||(c.as="script"),c.crossOrigin="",c.href=d,g&&c.setAttribute("nonce",g),document.head.appendChild(c),i)return new Promise((v,b)=>{c.addEventListener("load",v),c.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${d}`)))})}))}function n(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return s.then(a=>{for(const o of a||[])o.status==="rejected"&&n(o.reason);return e().catch(n)})},C=["en","fr","es","it"],P={en:()=>N(()=>Promise.resolve().then(()=>I),void 0,import.meta.url).then(l=>l.interviewMessages_en),fr:()=>N(()=>import("./InterviewMessages_fr-CmScqfza.js"),[],import.meta.url).then(l=>l.interviewMessages_fr),es:()=>N(()=>import("./InterviewMessages_es-D5d2JVA3.js"),[],import.meta.url).then(l=>l.interviewMessages_es),it:()=>N(()=>import("./InterviewMessages_it-2SNw5xMp.js"),[],import.meta.url).then(l=>l.interviewMessages_it)};function _(l){return P[l]()}const T={title:"Title",time:"When",by:"Interviewer",medium:"Medium",witness:"Witness",witnessNone:"—",summary:"Description",transcript:"Transcript",transcriptHint:"Address of the anonymised transcript file (optional)",summaryTab:"Summary",fileTab:"File",importFile:"Load a file (JSON, text, WebVTT, SRT)",importUrl:"Or load from URL",importButton:"Load",saveButton:"Save",loading:"Loading the transcript…",invalid:"This text is not valid JSON yet: the interview keeps the last transcript it understood.",notATranscript:"That file is not an interview transcript (it has no segments).",loadFailed:"That transcript could not be read.",editorLabel:"Interview transcript as JSON",byHint:"RR0 people ids, separated by commas",exchangesTab:"Exchanges",exchangesEmpty:"Nothing was said yet.",redacted:"Passage removed",proofreadAll:"Proofread by everyone.",proofreadPending:"Not proofread yet by: {names}",roles:{interviewer:"Interviewer",interviewee:"Interviewee",witness:"Witness"}},I=Object.freeze(Object.defineProperty({__proto__:null,interviewMessages_en:T},Symbol.toStringTag,{value:"Module"})),V="interviewseek";class p{static isProofread(e){const r=Object.keys(e.speakers);return r.length>0&&r.every(t=>{const s=e.proofreading?.[t]?.status;return s==="approved"||s==="covered"})}static said(e){return e.parts?e.parts.map(r=>"redacted"in r?"…":p.plain(r.text)).join(" "):e.redacted?void 0:p.plain(e.text??"")}static ENTITIES={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "};static plain(e){return/[<&]/.test(e)?e.replace(/<br\s*\/?>/gi,`
2
+ `).replace(/<\/?[a-z][^>]*>/gi,"").replace(/&#x([0-9a-f]+);/gi,(r,t)=>String.fromCodePoint(parseInt(t,16))).replace(/&#(\d+);/g,(r,t)=>String.fromCodePoint(Number(t))).replace(/&(\w+);/g,(r,t)=>p.ENTITIES[t.toLowerCase()]??r):e}static sightingsOf(e){return[e.interviewOf].flat().filter(r=>typeof r=="string")}static passagesAbout(e,r){const t=p.sightingsOf(e),s=[];return e.segments.forEach((n,a)=>{for(const o of n.refs??[]){if(o.sighting===void 0?!t.includes(r):o.sighting!==r)continue;const u=p.said(n);s.push({index:a,speaker:n.speaker,at:o.at,...u!==void 0?{text:u}:{},...o.range?{range:o.range}:{}})}}),s.sort((n,a)=>n.at-a.at||n.index-a.index)}static clock(e,r=!1){const t=Math.round(e*10),s=Math.floor(t/10),n=u=>String(u).padStart(2,"0"),a=Math.floor(s/3600),o=`${a>0||r?n(Math.floor(s/60)%60):Math.floor(s/60)}:${n(s%60)}`;return`${a>0?`${a}:`:""}${o}${r||t%10!==0?`.${t%10}`:""}`}static speakerName(e,r){const t=e.speakers[r];if(!t)return r;const s=typeof t.title=="string"?t.title:t.title?Object.values(t.title)[0]:void 0;return s||t.by&&p.agentName(t.by)||t.role}static agentName(e){if("people"in e){const[r,...t]=e.people.replace(/([a-z])([A-Z])/g,"$1 $2").split(" ");return[...t,r].join(" ")}return"org"in e?e.org:e.title??""}static stamp(e){const r=Math.round(e*1e3),t=(s,n=2)=>String(s).padStart(n,"0");return`${t(Math.floor(r/36e5))}:${t(Math.floor(r/6e4)%60)}:${t(Math.floor(r/1e3)%60)}.${t(r%1e3,3)}`}static toVtt(e){const r=n=>n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),t=e.segments.filter(n=>n.start!==void 0);return`WEBVTT
3
3
 
4
- ${t.map((n,a)=>{const o=t[a+1],h=n.end??o?.start??n.start+5,i=o&&o.start<h?Math.max(n.start,o.start):h;return`${p.stamp(n.start)} --> ${p.stamp(i)}
4
+ ${t.map((n,a)=>{const o=t[a+1],u=n.end??o?.start??n.start+5,g=o&&o.start<u?Math.max(n.start,o.start):u;return`${p.stamp(n.start)} --> ${p.stamp(g)}
5
5
  <v ${r(p.speakerName(e,n.speaker))}>${r(p.said(n)??"[…]")}`}).join(`
6
6
 
7
7
  `)}
8
- `}}const S="rr0-interview",I=`
8
+ `}}const x="rr0-interview",U=`
9
9
  rr0-interview { display: block; --rr0-interview-line: color-mix(in srgb, currentColor 35%, transparent); }
10
10
  rr0-interview [hidden] { display: none !important; }
11
11
  rr0-interview .rr0-interview-status { font-size: .85em; opacity: .85; margin: 0 0 .5em; }
12
12
  /* Scrolling only where a height is asked for: a box that scrolls keeps clear of the page's floated figures for all its height. */
13
13
  rr0-interview .rr0-interview-turns { max-height: var(--rr0-interview-max-height, none); overflow-y: var(--rr0-interview-overflow, visible); }
14
- rr0-interview .turn { position: relative; padding: .2em .5em; margin: 0 0 .4em; border-left: 3px solid var(--speaker); --speaker: hsl(var(--speaker-hue, 0) 55% 38%); }
15
- @media (prefers-color-scheme: dark) { rr0-interview .turn { --speaker: hsl(var(--speaker-hue, 0) 65% 70%); } }
16
- rr0-interview .turn { transition: background-color .15s; }
17
- rr0-interview .turn:hover { background: color-mix(in srgb, var(--speaker) 7%, transparent); }
14
+ /* An intervention: what one speaker says before another speaks, one turn or several; pointed at as a whole. */
15
+ rr0-interview .intervention { margin: 0 0 .4em; border-left: 3px solid var(--speaker); --speaker: hsl(var(--speaker-hue, 0) 55% 38%); transition: background-color .15s; }
16
+ @media (prefers-color-scheme: dark) { rr0-interview .intervention { --speaker: hsl(var(--speaker-hue, 0) 65% 70%); } }
17
+ rr0-interview .intervention:hover { background: color-mix(in srgb, var(--speaker) 7%, transparent); }
18
+ rr0-interview .turn { position: relative; padding: .2em .5em; }
18
19
  rr0-interview .turn.flash { background: color-mix(in srgb, #fc3 28%, transparent); }
19
20
  rr0-interview .turn .who { font-size: .85em; font-weight: 600; color: var(--speaker); overflow-wrap: anywhere; }
20
21
  rr0-interview .turn.is-redacted .who, rr0-interview .turn.goes-on .who { display: none; }
21
- rr0-interview .turn.goes-on { margin-top: -.4em; padding-top: .6em; }
22
22
  rr0-interview .turn .said, rr0-interview .turn .redacted { margin: 0; padding: 0; text-indent: 0; white-space: pre-wrap; }
23
23
  rr0-interview .turn .said::before, rr0-interview .turn .said::after { content: none; }
24
24
  /* Tooltips drawn here rather than left to the browser's own, which some hosts (an embedded pane) never show. */
@@ -31,4 +31,4 @@ rr0-interview .bar:hover::after, rr0-interview .bar:focus::after { display: bloc
31
31
  rr0-interview .turn .refs { display: flex; flex-wrap: wrap; gap: .25em; }
32
32
  rr0-interview .turn .ref { font: inherit; font-size: .8em; cursor: pointer; border: 1px solid var(--rr0-interview-line); border-radius: 999px; background: transparent; color: inherit;
33
33
  padding: 0 .35em; font-variant-numeric: tabular-nums; white-space: nowrap; }
34
- `;class N extends HTMLElement{messages=E;said=new w(["en"]);localeToken=0;loadToken=0;json;loading;base;status=document.createElement("p");turns=document.createElement("div");blocks=new Map;constructor(){super(),this.status.className="rr0-interview-status",this.status.setAttribute("role","status"),this.turns.className="rr0-interview-turns"}static get observedAttributes(){return["src"]}attributeChangedCallback(e,r,t){e==="src"&&t!==r&&this.isConnected&&this.load()}connectedCallback(){N.styleRoot(this.getRootNode()),this.contains(this.turns)||this.replaceChildren(this.status,this.turns),this.loadLocale(),this.hasAttribute("src")&&this.json===void 0&&this.loading!==this.getAttribute("src")&&this.load()}get interview(){return this.json}set interview(e){this.loadToken++,this.json=e,this.draw()}set documentUrl(e){this.base=e}static styleRoot(e){const r=e instanceof ShadowRoot?e:document.head;if(r.querySelector("style[data-rr0-interview]"))return;const t=document.createElement("style");t.dataset.rr0Interview="",t.textContent=I,r.append(t)}async load(){const e=this.getAttribute("src"),r=++this.loadToken;if(this.loading=e??void 0,!e)return;const t=new URL(e,location.href).href;let s;try{s=await x.json(t)}catch{s=void 0}r===this.loadToken&&(this.base=t,this.json=s,this.draw())}async loadLocale(){const e=++this.localeToken,r=$.preferencesFor(this),t=A(r,R),s=t==="en"?E:await C(t);e===this.localeToken&&(this.said=new w(r),this.messages=s,this.draw())}speakerName(e,r){const t=p.speakerName(e,r),s=e.speakers?.[r]?.role;return t===s&&s in this.messages.roles?this.messages.roles[s]:t}seek(e){const r=this.json,t={sighting:e.sighting??p.sightingsOf(r)[0],at:e.at};this.dispatchEvent(new CustomEvent(_,{bubbles:!0,composed:!0,detail:t}));const s=this.getAttribute("player");if(!s)return;const a=this.getRootNode().getElementById?.(s);typeof a?.seekTo=="function"&&(a.scrollIntoView?.({block:"center",behavior:"smooth"}),a.seekTo(t.at,t.sighting))}gap(e,r){const t=document.createElement(r),s=document.createElement("span");s.className="bar";const n=`${this.messages.redacted} : ${this.said.read(e)??""}`;return s.dataset.tip=n,s.tabIndex=0,s.setAttribute("role","img"),s.setAttribute("aria-label",n),t.append(s),t}saidNodes(e){if(!/[<&]/.test(e))return[document.createTextNode(e)];const r=document.createElement("template");r.innerHTML=e;for(const t of r.content.querySelectorAll("*")){if(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED"].includes(t.tagName)){t.remove();continue}for(const s of[...t.attributes])if(/^on/i.test(s.name)||/^\s*javascript:/i.test(s.value))t.removeAttribute(s.name);else if(["href","src"].includes(s.name))try{s.value=new URL(s.value,this.base??location.href).href}catch{}}return[...r.content.childNodes]}draw(){const e=this.messages,r=this.json;this.blocks.clear();const t=Array.isArray(r?.segments)?r.segments:[];if(!r||t.length===0){this.status.hidden=!0;const i=document.createElement("p");i.textContent=e.exchangesEmpty,this.turns.replaceChildren(i);return}const s=r.speakers??{},n=Object.keys(s);if(r.proofreading){const i=n.filter(c=>!["approved","covered"].includes(r.proofreading?.[c]?.status??""));this.status.textContent=i.length===0?e.proofreadAll:e.proofreadPending.replace("{names}",i.map(c=>this.speakerName(r,c)).join(", ")),this.status.hidden=!1}else this.status.hidden=!0;const a=[];let o,h;t.forEach((i,c)=>{const f=i.redacted?JSON.stringify(i.redacted.reason):void 0;if(f!==void 0&&o?.reason===f){this.blocks.set(c,o.block);return}const d=document.createElement("div");d.className="turn",d.dataset.segment=String(c),d.style.setProperty("--speaker-hue",String((Math.max(0,n.indexOf(i.speaker))*67+210)%360));const k=document.createElement("div");k.className="who";const m=document.createElement("span");if(m.textContent=i.redacted?"":this.speakerName(r,i.speaker),i.start!==void 0&&(d.dataset.time=p.clock(i.start,!0)),!i.redacted&&h===i.speaker&&d.classList.add("goes-on"),h=i.redacted?void 0:i.speaker,k.append(m),i.redacted){d.classList.add("is-redacted");const l=this.gap(i.redacted.reason,"p");l.className="redacted",o={block:d,reason:f},d.append(k,l)}else{const l=document.createElement("p");if(l.className="said",i.parts){let g="";for(const v of i.parts){const T="redacted"in v?"▮":p.plain(v.text);/[\p{L}\p{N}.,;:!?)»”…▮]$/u.test(g)&&/^[\p{L}\p{N}(«“▮]/u.test(T)&&l.append(" "),"redacted"in v?l.append(this.gap(v.redacted.reason,"span")):l.append(...this.saidNodes(v.text)),g=T}}else l.append(...this.saidNodes(i.text??""));o=void 0,d.append(k,l)}if(i.refs?.length){const l=document.createElement("div");l.className="refs";for(const g of i.refs){const v=document.createElement("button");v.type="button",v.className="ref",v.textContent=`↗ ${p.clock(g.at,!0)}`,v.addEventListener("click",()=>this.seek(g)),l.append(v)}d.append(l)}this.blocks.set(c,d),a.push(d)}),this.turns.replaceChildren(...a)}revealSegment(e){const r=this.blocks.get(e);r&&(r.scrollIntoView?.({block:"center"}),r.classList.add("flash"),window.setTimeout(()=>r.classList.remove("flash"),1600))}}function V(){customElements.get(S)||customElements.define(S,N)}V();
34
+ `;class L extends HTMLElement{messages=T;said=new w(["en"]);localeToken=0;loadToken=0;json;loading;base;status=document.createElement("p");turns=document.createElement("div");blocks=new Map;constructor(){super(),this.status.className="rr0-interview-status",this.status.setAttribute("role","status"),this.turns.className="rr0-interview-turns"}static get observedAttributes(){return["src"]}attributeChangedCallback(e,r,t){e==="src"&&t!==r&&this.isConnected&&this.load()}connectedCallback(){L.styleRoot(this.getRootNode()),this.contains(this.turns)||this.replaceChildren(this.status,this.turns),this.loadLocale(),this.hasAttribute("src")&&this.json===void 0&&this.loading!==this.getAttribute("src")&&this.load()}get interview(){return this.json}set interview(e){this.loadToken++,this.json=e,this.draw()}set documentUrl(e){this.base=e}static styleRoot(e){const r=e instanceof ShadowRoot?e:document.head;if(r.querySelector("style[data-rr0-interview]"))return;const t=document.createElement("style");t.dataset.rr0Interview="",t.textContent=U,r.append(t)}async load(){const e=this.getAttribute("src"),r=++this.loadToken;if(this.loading=e??void 0,!e)return;const t=new URL(e,location.href).href;let s;try{s=await $.json(t)}catch{s=void 0}r===this.loadToken&&(this.base=t,this.json=s,this.draw())}async loadLocale(){const e=++this.localeToken,r=O.preferencesFor(this),t=M(r,C),s=t==="en"?T:await _(t);e===this.localeToken&&(this.said=new w(r),this.messages=s,this.draw())}speakerName(e,r){const t=p.speakerName(e,r),s=e.speakers?.[r]?.role;return t===s&&s in this.messages.roles?this.messages.roles[s]:t}seek(e){const r=this.json,t={sighting:e.sighting??p.sightingsOf(r)[0],at:e.at};this.dispatchEvent(new CustomEvent(V,{bubbles:!0,composed:!0,detail:t}));const s=this.getAttribute("player");if(!s)return;const a=this.getRootNode().getElementById?.(s);typeof a?.seekTo=="function"&&(a.scrollIntoView?.({block:"center",behavior:"smooth"}),a.seekTo(t.at,t.sighting))}gap(e,r){const t=document.createElement(r),s=document.createElement("span");s.className="bar";const n=`${this.messages.redacted} : ${this.said.read(e)??""}`;return s.dataset.tip=n,s.tabIndex=0,s.setAttribute("role","img"),s.setAttribute("aria-label",n),t.append(s),t}saidNodes(e){if(!/[<&]/.test(e))return[document.createTextNode(e)];const r=document.createElement("template");r.innerHTML=e;for(const t of r.content.querySelectorAll("*")){if(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED"].includes(t.tagName)){t.remove();continue}for(const s of[...t.attributes])if(/^on/i.test(s.name)||/^\s*javascript:/i.test(s.value))t.removeAttribute(s.name);else if(["href","src"].includes(s.name))try{s.value=new URL(s.value,this.base??location.href).href}catch{}}return[...r.content.childNodes]}draw(){const e=this.messages,r=this.json;this.blocks.clear();const t=Array.isArray(r?.segments)?r.segments:[];if(!r||t.length===0){this.status.hidden=!0;const i=document.createElement("p");i.textContent=e.exchangesEmpty,this.turns.replaceChildren(i);return}const s=r.speakers??{},n=Object.keys(s);if(r.proofreading){const i=n.filter(h=>!["approved","covered"].includes(r.proofreading?.[h]?.status??""));this.status.textContent=i.length===0?e.proofreadAll:e.proofreadPending.replace("{names}",i.map(h=>this.speakerName(r,h)).join(", ")),this.status.hidden=!1}else this.status.hidden=!0;const a=[];let o,u=!1,g,d;t.forEach((i,h)=>{const E=i.redacted?JSON.stringify(i.redacted.reason):void 0;if(E!==void 0&&g?.reason===E){this.blocks.set(h,g.block),i.speaker!==d&&(d=void 0);return}const c=document.createElement("div");c.className="turn",c.dataset.segment=String(h);const v=document.createElement("div");v.className="who";const b=document.createElement("span");if(b.textContent=i.redacted?"":this.speakerName(r,i.speaker),i.start!==void 0&&(c.dataset.time=p.clock(i.start,!0)),d!==i.speaker&&(o=document.createElement("div"),o.className="intervention",o.style.setProperty("--speaker-hue",String((Math.max(0,n.indexOf(i.speaker))*67+210)%360)),a.push(o),u=!1),i.redacted||(u&&c.classList.add("goes-on"),u=!0),o.append(c),d=i.speaker,v.append(b),i.redacted){c.classList.add("is-redacted");const f=this.gap(i.redacted.reason,"p");f.className="redacted",g={block:c,reason:E},c.append(v,f)}else{const f=document.createElement("p");if(f.className="said",i.parts){let y="";for(const m of i.parts){const S="redacted"in m?"▮":p.plain(m.text);/[\p{L}\p{N}.,;:!?)»”…▮]$/u.test(y)&&/^[\p{L}\p{N}(«“▮]/u.test(S)&&f.append(" "),"redacted"in m?f.append(this.gap(m.redacted.reason,"span")):f.append(...this.saidNodes(m.text)),y=S}}else f.append(...this.saidNodes(i.text??""));g=void 0,c.append(v,f)}if(i.refs?.length){const f=document.createElement("div");f.className="refs";for(const y of i.refs){const m=document.createElement("button");m.type="button",m.className="ref",m.textContent=`↗ ${p.clock(y.at,!0)}`,m.addEventListener("click",()=>this.seek(y)),f.append(m)}c.append(f)}this.blocks.set(h,c)}),this.turns.replaceChildren(...a)}revealSegment(e){const r=this.blocks.get(e);r&&(r.scrollIntoView?.({block:"center"}),r.classList.add("flash"),window.setTimeout(()=>r.classList.remove("flash"),1600))}}function z(){customElements.get(x)||customElements.define(x,L)}z();