wicked-studio 0.14.1 → 0.16.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 (34) hide show
  1. package/README.md +68 -6
  2. package/dist/apps-standalone/fixture.html +12 -0
  3. package/dist/apps-standalone/fixture.js +10 -0
  4. package/dist/apps-standalone/runtime.css +139 -0
  5. package/dist/apps-standalone/runtime.js +1 -0
  6. package/dist/assets/KnowledgeGraph-AtkRlS3c.js +1 -0
  7. package/dist/assets/WickedSansA-Regular-CGPJLyb8.woff2 +0 -0
  8. package/dist/assets/WickedSansA-SemiBold-Bk9KXUaV.woff2 +0 -0
  9. package/dist/assets/favicon-BJA6hF2f.svg +1 -0
  10. package/dist/assets/index-CdbCAs7s.css +32 -0
  11. package/dist/assets/index-DU_8o4uq.js +1104 -0
  12. package/dist/assets/wicked-studio-lettering-small-CBwSGqop.svg +2 -0
  13. package/dist/assets/wicked-studio-wordmark-small-gF5xn6IC.svg +2 -0
  14. package/dist/editors/wicked-apps/editor.json +45 -0
  15. package/dist/editors/wicked-apps/icon.svg +1 -0
  16. package/dist/editors/wicked-apps/index.html +151 -0
  17. package/dist/editors/wicked-deck/editor.json +1 -1
  18. package/dist/editors/wicked-deck/index.html +25 -8
  19. package/dist/editors/wicked-doc/editor.json +1 -1
  20. package/dist/editors/wicked-doc/index.html +12 -8
  21. package/dist/editors/wicked-insights/editor.json +1 -1
  22. package/dist/editors/wicked-insights/index.html +1 -1
  23. package/dist/editors/wicked-page/editor.json +10 -1
  24. package/dist/editors/wicked-page/index.html +12 -8
  25. package/dist/editors/wicked-video/editor.json +7 -2
  26. package/dist/editors/wicked-video/index.html +14 -11
  27. package/dist/fonts/LICENSE-WickedSans.txt +97 -0
  28. package/dist/index.html +3 -2
  29. package/dist/testid-inventory.json +12685 -6708
  30. package/package.json +9 -3
  31. package/dist/assets/WickedSans-Regular-fb698rcD.woff2 +0 -0
  32. package/dist/assets/WickedSans-SemiBold-CD53n1AC.woff2 +0 -0
  33. package/dist/assets/index-BUZ_-Syk.css +0 -32
  34. package/dist/assets/index-u4O_7N-b.js +0 -986
@@ -1,7 +1,7 @@
1
1
  <!doctype html>
2
2
  <html lang="en"><head><meta charset="utf-8">
3
3
  <meta name="wicked-editor" content="wicked-video">
4
- <meta name="wicked-editor-version" content="0.14.1">
4
+ <meta name="wicked-editor-version" content="0.16.0">
5
5
  <title>Video</title>
6
6
  <style>
7
7
  :root{--surface-base:#fff;--surface-card:#f6f7f9;--surface-raised:#fff;--ink-high:#0d1117;--ink-body:#2b333d;--ink-muted:#5b6673;--border:#d5dae1;--accent:#224a5e;--font-sans:system-ui,sans-serif}
@@ -12,17 +12,20 @@ button,input,select,textarea{font:inherit;color:inherit}button{border:1px solid
12
12
  .transport{display:flex;align-items:center;gap:12px}.chips{display:flex;gap:6px;overflow-x:auto;flex:none}.chip{border-radius:999px;white-space:nowrap;padding:5px 9px}.timeline{display:flex;gap:4px;min-height:52px;flex:none}.segment-box{position:relative;min-width:32px}.segment{width:100%;height:52px;text-align:left;overflow:hidden;white-space:nowrap;background:var(--surface-card);border-top:3px solid var(--video-accent,var(--accent))}.trim-handle{position:absolute;top:2px;bottom:2px;width:10px;cursor:ew-resize;padding:0;background:var(--accent);touch-action:none;border:0}.trim-handle[data-edge=in]{left:0}.trim-handle[data-edge=out]{right:0}.editor-fields{display:grid;gap:10px;margin-top:16px}.buttons{display:flex;gap:6px;flex-wrap:wrap}label{display:grid;gap:5px;color:var(--ink-muted)}input,select,textarea{width:100%;padding:7px;border:1px solid var(--border);border-radius:5px;background:var(--surface-raised);color:var(--ink-high)}.trim-fields{display:grid;grid-template-columns:1fr 1fr;gap:8px}.hint,.status{font-size:12px;color:var(--ink-muted);line-height:1.5;margin:8px 0}.inspectors{padding:16px;border-left:1px solid var(--border);overflow:auto;background:var(--surface-card)}.inspectors textarea{resize:vertical;min-height:100px}.summary{line-height:1.6;white-space:pre-line}.video-editor[data-mode=advanced][data-surface=full]{grid-template-columns:240px minmax(0,1fr) 280px}
13
13
  .video-editor[data-surface=card]{grid-template-columns:1fr}.video-editor[data-surface=card] .work{padding:0;gap:6px}.video-editor[data-surface=card] .player{border-radius:0;max-height:calc(100vh - 70px);flex:1;min-height:0}.video-editor[data-surface=card] .transport{padding:0 8px}.video-editor[data-surface=options]{grid-template-columns:1fr}.video-editor[data-surface=options] .chapters{border:0}
14
14
  .timeline{position:relative}.timeline[data-proof=true]{padding-bottom:24px}.check-track{position:absolute;bottom:0;left:10px;right:10px;height:20px}.check-mark{position:absolute;transform:translateX(-50%);padding:0 3px;height:20px;min-width:12px;border:0;border-radius:2px;border-left:2px solid currentColor;background:var(--surface-raised);color:var(--ink-muted)}.check-mark[data-state=FAIL],.chapter-verdict[data-verdict=FAIL],#check-list [data-state=FAIL]{color:var(--status-fail)}.check-mark[data-state=PASS],.chapter-verdict[data-verdict=PASS]{color:var(--status-ok)}#proof{margin-bottom:20px}#check-list{font-size:12px;line-height:1.5;overflow-wrap:anywhere}textarea:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
15
+ .review-tab{padding:16px;overflow:auto;min-width:0}.review-tab .findings{list-style:decimal;padding-left:18px;gap:6px;font-size:12px;line-height:1.5;overflow-wrap:anywhere;margin-bottom:12px}.review-tab .findings [data-state=FAIL]{color:var(--status-fail)}.sheets{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px}.sheet{margin:0;display:grid;gap:6px}.sheet img{width:100%;display:block;border:1px solid var(--border);border-radius:6px;background:var(--surface-card)}.sheet figcaption{font-size:12px;color:var(--ink-muted)}
15
16
  @media(max-width:850px){.video-editor[data-mode=advanced][data-surface=full]{grid-template-columns:200px minmax(0,1fr)}.inspectors{grid-column:2;border-left:0}.video-editor[data-surface=full]{grid-template-columns:200px minmax(0,1fr)}}
16
- </style></head><body><script>var wickedEditor=(function(Z){"use strict";var Ut=Object.defineProperty;var Dt=(Z,G,re)=>G in Z?Ut(Z,G,{enumerable:!0,configurable:!0,writable:!0,value:re}):Z[G]=re;var ut=(Z,G,re)=>Dt(Z,typeof G!="symbol"?G+"":G,re);const G={"Alt+J":{verb:"navigate",what:"next card or row"},"Alt+K":{verb:"navigate",what:"previous card or row"},"Alt+/":{verb:"navigate",what:"the keyboard shortcuts overlay"},"Alt+P":{verb:"navigate",what:"peek at the top item that needs you"},"Alt+G":{verb:"navigate",what:"jump to the top item that needs you"},"Alt+B":{verb:"navigate",what:"back to where you were"},"Alt+T":{verb:"navigate",what:"the run’s evidence timeline"},"Alt+U":{verb:"navigate",what:"the run’s unit list"},"Alt+A":{verb:"approve",what:"approve the open gate"},"Alt+R":{verb:"decide",what:"reject the open gate"},"Alt+X":{verb:"decide",what:"select a gate for batch resolution"},"Alt+N":{verb:"compose",what:"compose a steer note"}},re=new Set(["Escape","Mod+K","Tab","Shift+Tab"]);function pt(t){if(re.has(t))return!0;const n=G[ft(t)];return n!==void 0&&n.verb==="navigate"}function ft(t){const n=/^alt\+(.)$/i.exec(t);return n===null?t:`Alt+${n[1].toUpperCase()}`}const K="wicked.editor",q=1,He=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),ht=["card","options","full"];function Xe(t){return t==="inline"?"card":t==="pane"?"options":"full"}function mt(t){const n=He(t)?t:{},l=n.size==="inline"||n.size==="full"?n.size:"pane",c=n.protocol===2?2:1,a=c===2&&typeof n.tab=="string"?n.tab:null,v=c===2&&ht.includes(n.surface)?n.surface:Xe(l),b=v==="options"&&a===null?"full":v,y=c===2&&(n.mode==="simple"||n.mode==="advanced")?n.mode:null;return{protocol:c,surface:b,tab:a,mode:y,size:l}}function bt(t,n,l){return{editor:t,version:n,protocol:[1,2],surfaces:l}}function vt(t,n){const l=document.querySelector('meta[name="wicked-editor-version"]')?.getAttribute("content")??"0.0.0";parent.postMessage({p:K,v:q,type:"plugin.ready",payload:bt(t,l,n)},"*")}function yt(t,n,l){const c=t.metaKey||t.ctrlKey;let a=null;if(t.key==="Escape")a="Escape";else if(c&&!t.altKey&&t.key.toLowerCase()==="k")a="Mod+K";else if(t.altKey&&!c&&/^Key[A-Z]$/.test(t.code)&&pt(`Alt+${t.code.slice(3)}`))a=`Alt+${t.code.slice(3)}`;else if(t.key==="Tab"){const v=Array.from(n.querySelectorAll("button, input, select, textarea, [tabindex]")).filter(y=>y.tabIndex>=0&&!y.matches(":disabled")&&y.closest("[hidden]")===null),b=v.indexOf(t.target);(t.shiftKey?b<=0:b===-1||b===v.length-1)&&(a=t.shiftKey?"Shift+Tab":"Tab")}return a===null?!1:(t.preventDefault(),t.stopPropagation(),l(a),!0)}class gt{constructor(n,l){ut(this,"revs",new Map);this.port=n,this.h=l}reply(n,l){this.port.postMessage({p:K,v:q,re:n,ok:!0,payload:l})}refuse(n,l,c){this.port.postMessage({p:K,v:q,re:n,ok:!1,error:{code:l,message:c}})}bump(n){const l=(this.revs.get(n)??0)+1;return this.revs.set(n,l),l}values(n,l){this.port.postMessage({p:K,v:q,type:"options.values",payload:{tab:n,rev:this.bump(n),values:l}})}height(n){this.port.postMessage({p:K,v:q,type:"ui.height",payload:{px:Math.round(n)}})}dispatch(n){const l=He(n.payload)?n.payload:{},c=typeof n.id=="string"?n.id:null;switch(n.type){case"host.surface":{const a=l.surface;return(a==="card"||a==="options"||a==="full")&&this.h.surface?.(a,l.mode==="simple"||l.mode==="advanced"?l.mode:null),!0}case"host.mode":{if(c===null)return!0;const a=l.mode;return a!=="simple"&&a!=="advanced"?(this.refuse(c,"bad_request","mode is simple or advanced"),!0):(this.reply(c,{mode:this.h.mode?.(a)??a}),!0)}case"host.action":{if(c===null)return!0;const a=l.id;return typeof a!="string"||this.h.action===void 0?(this.reply(c,{handled:!1}),!0):(Promise.resolve(this.h.action(a)).then(v=>this.reply(c,{handled:v.handled===!0,...typeof v.status=="string"?{status:v.status.slice(0,120)}:{}}),()=>this.reply(c,{handled:!1})),!0)}case"host.tab":return typeof l.tab=="string"&&this.h.tab?.(l.tab),!0;case"host.selection":return Array.isArray(l.anchors)&&this.h.selection?.(l.anchors),!0;case"options.changed":{if(c===null)return!0;const a=l.tab,v=l.id;return typeof a!="string"||typeof v!="string"||this.h.optionsChanged===void 0?(this.refuse(c,"unsupported","no controls here"),!0):(Promise.resolve(this.h.optionsChanged(a,v,l.value)).then(b=>this.reply(c,{applied:b.applied,rev:this.bump(a),values:b.values,...b.reason!==void 0?{reason:b.reason.slice(0,120)}:{}}),b=>this.refuse(c,"unavailable",b instanceof Error?b.message.slice(0,120):"failed")),!0)}default:return!1}}}const Ze={card:{interactive:!0,aspect:"16:9",actions:[{id:"prev",label:"Previous chapter",verb:"plugin"},{id:"next",label:"Next chapter",verb:"plugin",primary:!0},{id:"ask",label:"Ask about this",verb:"host:ask"},{id:"export",label:"Export",verb:"host:export"}]},options:{tabs:[{id:"chapters",label:"Chapters",render:"plugin"},{id:"captions",label:"Captions",render:"controls",controls:[{id:"on",label:"Captions",type:"toggle"},{id:"burn",label:"Burn into video",type:"toggle"},{id:"position",label:"Position",type:"segmented",options:[{id:"bottom",label:"Bottom"},{id:"top",label:"Top"}]},{id:"size",label:"Text size",type:"range",min:18,max:72,step:2},{id:"lines",label:"Max lines",type:"range",min:1,max:3,step:1},{id:"wrap",label:"Line length",type:"range",min:20,max:80,step:1},{id:"look",label:"Look",type:"segmented",options:[{id:"bar",label:"Bar"},{id:"outline",label:"Outline"},{id:"plain",label:"Plain"}]}]},{id:"theme",label:"Theme",render:"controls",controls:[{id:"palette",label:"Colours",type:"select",options:[{id:"studio",label:"Studio skin · default"},{id:"corporate",label:"Corporate Light"},{id:"midnight",label:"Midnight Purple"},{id:"warm",label:"Warm Dark"},{id:"custom",label:"Custom"}]},{id:"title",label:"Title card",type:"toggle"},{id:"titletext",label:"Title",type:"text",maxChars:80},{id:"end",label:"End card",type:"toggle"},{id:"endtext",label:"End card text",type:"text",maxChars:80},{id:"background",label:"Background",type:"color"},{id:"foreground",label:"Text colour",type:"color"},{id:"accent",label:"Accent",type:"color"},{id:"font",label:"Font",type:"select",options:[{id:"inter",label:"Inter"},{id:"roboto",label:"Roboto"},{id:"source-sans",label:"Source Sans 3"},{id:"plex",label:"IBM Plex Sans"},{id:"system",label:"System"},{id:"archivo",label:"Archivo"}]}]}]},full:{modes:["simple","advanced"],default:"simple"}},Ge={corporate:{background:"#FFFFFF",foreground:"#1E293B",accent:"#0891B2"},midnight:{background:"#0A0A0F",foreground:"#FFFFFF",accent:"#A100FF"},warm:{background:"#1A1A2E",foreground:"#F8F8F2",accent:"#FFD93D"}},kt=(t,n)=>["background","foreground","accent"].every(l=>t[l].toLowerCase()===n[l].toLowerCase());function be(t){if(t.palette===void 0||t.palette==="skin")return"studio";for(const[n,l]of Object.entries(Ge))if(kt(t,l))return n;return"custom"}function Re(t,n,l){const c=be(t)==="studio"?l??n??t:t;return{background:c.background,foreground:c.foreground,accent:c.accent}}const Pe={inter:"Inter",roboto:"Roboto","source-sans":"Source Sans 3",plex:"IBM Plex Sans",system:"system-ui",archivo:"Archivo"};function le(t,n,l=null,c){const a=t.captions,v=t.theme;if(n==="captions")return{on:a.on,burn:a.burnIn,position:a.position,size:a.size,lines:a.maxLines,wrap:a.wrapChars,look:a.style};if(n==="theme"){const b=Re(v,l,c),y=be(v)==="studio"?c?.font??v.font:v.font;return{palette:be(v),title:v.titleCard.on,titletext:v.titleCard.title,end:v.endCard.on,endtext:v.endCard.title,background:b.background,foreground:b.foreground,accent:b.accent,font:Object.keys(Pe).find(k=>Pe[k]===y)??"system"}}return{}}function St(t,n,l,c){const a=JSON.parse(JSON.stringify(t));if(n==="captions"){const v={on:"on",burn:"burnIn",position:"position",size:"size",lines:"maxLines",wrap:"wrapChars",look:"style"};Object.assign(a.captions,{[v[l]]:c})}else if(n==="theme")switch(l){case"title":a.theme.titleCard.on=c;break;case"titletext":a.theme.titleCard.title=c;break;case"end":a.theme.endCard.on=c;break;case"endtext":a.theme.endCard.title=c;break;case"font":a.theme.font=Pe[c],a.theme.palette="custom";break;case"palette":a.theme.palette=c==="studio"?"skin":"custom",(c==="corporate"||c==="midnight"||c==="warm")&&Object.assign(a.theme,Ge[c]);break;default:Object.assign(a.theme,{[l]:c,palette:"custom"})}return a}const R={actions:4,tabs:5,controls:12,options:8,labelChars:24,maxChars:200},Te=/^[a-z][a-z0-9-]{0,31}$/u,xt=/^[A-Za-z0-9 ·'-]{1,24}$/u,At=["approve","accept","deliver","merge","send","launch","delete","remove","stop","deny","allow","grant","install"],$t={а:"a",е:"e",о:"o",р:"p",с:"c",у:"y",х:"x",і:"i",ј:"j",ѕ:"s","ԁ":"d","ӏ":"l",α:"a",ε:"e",ο:"o",ρ:"p",ν:"v",τ:"t",κ:"k",ι:"i",μ:"m",0:"o",1:"l",3:"e",4:"a",5:"s",7:"t"};function Ct(t){const n=t.normalize("NFKD").replace(/\p{M}+/gu,"").toLowerCase();let l="";for(const c of n)l+=$t[c]??c;return l.split(/[^a-z]+/u).filter(c=>c!=="")}function wt(t){return Ct(t).some(n=>At.some(l=>n.startsWith(l)))}const ee=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),Le=t=>typeof t=="number"&&Number.isFinite(t),m=t=>({ok:!1,reason:t}),Et=/(?:[A-Za-z][0-9]|[0-9][A-Za-z])/u;function Fe(t,n){return typeof t!="string"||!xt.test(t)?`${n}: a label is 1 to ${R.labelChars} plain characters`:Et.test(t)?`${n}: a word in a label is letters or digits, not both`:wt(t)?`${n}: "${t}" uses a word only the host's own controls may use`:null}function Me(t,n){const l=new Set;for(const c of t){if(l.has(c.id))return`${n}: the id "${c.id}" is used twice`;l.add(c.id)}return null}const te=(t,n,l)=>{for(const c of Object.keys(t))if(!n.includes(c))return`${l}: unknown field "${c}"`;return null};function Tt(t,n){if(!ee(t))return m(`${n}: not an object`);const l=te(t,["id","label","type","options","min","max","step","maxChars"],n);if(l!==null)return m(l);if(typeof t.id!="string"||!Te.test(t.id))return m(`${n}: a bad id`);const c=Fe(t.label,n);if(c!==null)return m(c);const a=t.type;if(a!=="toggle"&&a!=="segmented"&&a!=="select"&&a!=="color"&&a!=="text"&&a!=="range")return m(`${n}: an unknown control type`);const v={id:t.id,label:t.label,type:a};if(a==="segmented"||a==="select"){const b=t.options;if(!Array.isArray(b)||b.length<2||b.length>R.options)return m(`${n}: ${a} needs 2 to ${R.options} options`);const y=[];for(const[V,g]of b.entries()){if(!ee(g)||typeof g.id!="string"||!Te.test(g.id))return m(`${n}.options[${V}]: a bad id`);const A=Fe(g.label,`${n}.options[${V}]`);if(A!==null)return m(A);const C=te(g,["id","label"],`${n}.options[${V}]`);if(C!==null)return m(C);y.push({id:g.id,label:g.label})}const k=Me(y,`${n}.options`);if(k!==null)return m(k);v.options=y}else if(t.options!==void 0)return m(`${n}: only select and segmented take options`);if(a==="range"){const{min:b,max:y,step:k}=t;if(!Le(b)||!Le(y)||!Le(k))return m(`${n}: range needs finite min, max and step`);if(!(b<y)||!(k>0)||k>y-b)return m(`${n}: range needs min < max and 0 < step ≤ max - min`);if(Math.abs(b)>1e9||Math.abs(y)>1e9||k<1e-6||(y-b)/k>1e6)return m(`${n}: range bounds are within ±1e9, step ≥ 1e-6, at most 1e6 steps`);if(k<Math.max(Math.abs(b),Math.abs(y))*1e-12)return m(`${n}: range step is too fine for its bounds`);v.min=b,v.max=y,v.step=k}else if(t.min!==void 0||t.max!==void 0||t.step!==void 0)return m(`${n}: only range takes min, max and step`);if(a==="text"){const b=t.maxChars===void 0?R.maxChars:t.maxChars;if(!Number.isInteger(b)||b<1||b>R.maxChars)return m(`${n}: maxChars is 1 to ${R.maxChars}`);v.maxChars=b}else if(t.maxChars!==void 0)return m(`${n}: only text takes maxChars`);return{ok:!0,value:v}}function Lt(t){if(!ee(t))return m("surfaces: not an object");const n=te(t,["card","options","full"],"surfaces");if(n!==null)return m(n);const l=t.card;if(!ee(l))return m("surfaces.card is required");const c=te(l,["interactive","aspect","actions"],"surfaces.card");if(c!==null)return m(c);const a=l.interactive===void 0?!1:l.interactive;if(typeof a!="boolean")return m("surfaces.card.interactive: a boolean");const v=l.aspect===void 0?"16:9":l.aspect;if(v!=="16:9"&&v!=="4:3"&&v!=="auto")return m("surfaces.card.aspect: 16:9, 4:3 or auto");const b=l.actions===void 0?[]:l.actions;if(!Array.isArray(b)||b.length>R.actions)return m(`surfaces.card.actions: at most ${R.actions}`);const y=[];for(const[A,C]of b.entries()){const T=`surfaces.card.actions[${A}]`;if(!ee(C))return m(`${T}: not an object`);const M=te(C,["id","label","primary","verb"],T);if(M!==null)return m(M);if(typeof C.id!="string"||!Te.test(C.id))return m(`${T}: a bad id`);const i=Fe(C.label,T);if(i!==null)return m(i);const $=C.verb;if($!=="plugin"&&$!=="host:export"&&$!=="host:ask")return m(`${T}: verb is plugin, host:export or host:ask`);const I=C.primary===void 0?!1:C.primary;if(typeof I!="boolean")return m(`${T}: primary is a boolean`);y.push({id:C.id,label:C.label,primary:I,verb:$})}const k=Me(y,"surfaces.card.actions");if(k!==null)return m(k);let V=null;if(t.options!==void 0){const A=t.options;if(!ee(A))return m("surfaces.options: not an object");const C=te(A,["tabs"],"surfaces.options");if(C!==null)return m(C);const T=A.tabs;if(!Array.isArray(T)||T.length<1||T.length>R.tabs)return m(`surfaces.options.tabs: 1 to ${R.tabs}`);const M=[];for(const[$,I]of T.entries()){const O=`surfaces.options.tabs[${$}]`;if(!ee(I))return m(`${O}: not an object`);const _=te(I,["id","label","render","controls"],O);if(_!==null)return m(_);if(typeof I.id!="string"||!Te.test(I.id))return m(`${O}: a bad id`);const W=Fe(I.label,O);if(W!==null)return m(W);const j=I.render;if(j!=="plugin"&&j!=="controls")return m(`${O}: render is plugin or controls`);const ie={id:I.id,label:I.label,render:j};if(j==="controls"){const ae=I.controls;if(!Array.isArray(ae)||ae.length<1||ae.length>R.controls)return m(`${O}.controls: 1 to ${R.controls}`);const D=[];for(const[ve,N]of ae.entries()){const H=Tt(N,`${O}.controls[${ve}]`);if(!H.ok)return H;D.push(H.value)}const ne=Me(D,`${O}.controls`);if(ne!==null)return m(ne);ie.controls=D}else if(I.controls!==void 0)return m(`${O}: a plugin-rendered tab has no controls`);M.push(ie)}const i=Me(M,"surfaces.options.tabs");if(i!==null)return m(i);V={tabs:M}}let g=null;if(t.full!==void 0){const A=t.full;if(!ee(A))return m("surfaces.full: not an object");const C=te(A,["modes","default"],"surfaces.full");if(C!==null)return m(C);let T=null;if(A.modes!==void 0){const i=A.modes;if(!Array.isArray(i)||i.length!==2||i[0]!=="simple"||i[1]!=="advanced")return m('surfaces.full.modes: exactly ["simple","advanced"]');T=["simple","advanced"]}const M=A.default===void 0?"simple":A.default;if(M!=="simple"&&M!=="advanced")return m("surfaces.full.default: simple or advanced");if(T===null&&A.default!==void 0)return m("surfaces.full.default needs modes");g={modes:T,default:M}}return{ok:!0,value:{card:{interactive:a,aspect:v,actions:y},options:V,full:g}}}const Je=String.raw`(?:\d{1,3}(?:\.\d+)?%?|\.\d+%?)`,Ft=new RegExp(String.raw`^(?:#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})|(?:rgba?|hsla?)\(\s*${Je}(?:\s*,\s*${Je}){2,3}\s*\))$`,"iu");function Mt(t,n){switch(t.type){case"toggle":return typeof n=="boolean";case"segmented":case"select":return typeof n=="string"&&(t.options??[]).some(l=>l.id===n);case"color":return typeof n=="string"&&n.length<=64&&Ft.test(n);case"text":return typeof n=="string"&&n.length<=(t.maxChars??R.maxChars)&&!/[\r\n]/u.test(n);case"range":{if(!Le(n)||t.min===void 0||t.max===void 0||t.step===void 0||n<t.min||n>t.max)return!1;const l=Math.round((n-t.min)/t.step);return Math.abs(n-(t.min+l*t.step))<=t.step*.001}}}const je=Lt(Ze);if(!je.ok)throw new Error(je.reason);const Ot=je.value;function Ye(){document.body.insertAdjacentHTML("afterbegin",`<main id="video-editor" class="video-editor" data-testid="video-editor" tabindex="0">
17
- <aside id="chapters" class="chapters"><h2>Chapters</h2><ol id="chapter-list"></ol><div id="editor-fields" class="editor-fields"></div><p id="hint" class="hint"></p></aside>
17
+ @media(max-width:600px){.video-editor[data-surface=full],.video-editor[data-mode=advanced][data-surface=full]{grid-template-columns:minmax(0,1fr);grid-template-rows:auto;align-content:start;height:auto;min-height:100%}.video-editor[data-surface=full] .segment-box{flex:1 1 100%!important}.video-editor[data-surface=full] .segment{height:40px}.video-editor[data-surface=full] .work{order:-1;padding:8px;overflow:visible}.video-editor[data-surface=full] .chapters{border-right:0;border-top:1px solid var(--border)}.video-editor[data-surface=full] .inspectors{grid-column:auto;border-left:0;border-top:1px solid var(--border)}.video-editor[data-surface=full] .player{max-height:none}.timeline{flex-wrap:wrap}.chips{flex-wrap:wrap;overflow-x:visible}.sheets{grid-template-columns:1fr}}
18
+ </style></head><body><script>var wickedEditor=(function(G){"use strict";var Vt=Object.defineProperty;var _t=(G,Z,re)=>Z in G?Vt(G,Z,{enumerable:!0,configurable:!0,writable:!0,value:re}):G[Z]=re;var ht=(G,Z,re)=>_t(G,typeof Z!="symbol"?Z+"":Z,re);const Z={"Alt+J":{verb:"navigate",what:"next card or row"},"Alt+K":{verb:"navigate",what:"previous card or row"},"Alt+/":{verb:"navigate",what:"the keyboard shortcuts overlay"},"Alt+P":{verb:"navigate",what:"peek at the top item that needs you"},"Alt+G":{verb:"navigate",what:"jump to the top item that needs you"},"Alt+B":{verb:"navigate",what:"back to where you were"},"Alt+T":{verb:"navigate",what:"the run’s evidence timeline"},"Alt+U":{verb:"navigate",what:"the run’s unit list"},"Alt+A":{verb:"approve",what:"approve the open gate"},"Alt+R":{verb:"decide",what:"reject the open gate"},"Alt+X":{verb:"decide",what:"select a gate for batch resolution"},"Alt+N":{verb:"compose",what:"compose a steer note"}},re=new Set(["Escape","Mod+K","Tab","Shift+Tab"]);function mt(t){if(re.has(t))return!0;const n=Z[bt(t)];return n!==void 0&&n.verb==="navigate"}function bt(t){const n=/^alt\+(.)$/i.exec(t);return n===null?t:`Alt+${n[1].toUpperCase()}`}const V="wicked.editor",_=1,Ge=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),vt=["card","options","full"];function Ze(t){return t==="inline"?"card":t==="pane"?"options":"full"}function yt(t){const n=Ge(t)?t:{},l=n.size==="inline"||n.size==="full"?n.size:"pane",u=n.protocol===2?2:1,s=u===2&&typeof n.tab=="string"?n.tab:null,v=u===2&&vt.includes(n.surface)?n.surface:Ze(l),b=v==="options"&&s===null?"full":v,y=u===2&&(n.mode==="simple"||n.mode==="advanced")?n.mode:null;return{protocol:u,surface:b,tab:s,mode:y,size:l}}function gt(t,n,l){return{editor:t,version:n,protocol:[1,2],surfaces:l}}function kt(t,n){const l=document.querySelector('meta[name="wicked-editor-version"]')?.getAttribute("content")??"0.0.0";parent.postMessage({p:V,v:_,type:"plugin.ready",payload:gt(t,l,n)},"*")}function St(t,n,l){const u=t.metaKey||t.ctrlKey;let s=null;if(t.key==="Escape")s="Escape";else if(u&&!t.altKey&&t.key.toLowerCase()==="k")s="Mod+K";else if(t.altKey&&!u&&/^Key[A-Z]$/.test(t.code)&&mt(`Alt+${t.code.slice(3)}`))s=`Alt+${t.code.slice(3)}`;else if(t.key==="Tab"){const v=Array.from(n.querySelectorAll("button, input, select, textarea, [tabindex]")).filter(y=>y.tabIndex>=0&&!y.matches(":disabled")&&y.closest("[hidden]")===null),b=v.indexOf(t.target);(t.shiftKey?b<=0:b===-1||b===v.length-1)&&(s=t.shiftKey?"Shift+Tab":"Tab")}return s===null?!1:(t.preventDefault(),t.stopPropagation(),l(s),!0)}class xt{constructor(n,l){ht(this,"revs",new Map);this.port=n,this.h=l}reply(n,l){this.port.postMessage({p:V,v:_,re:n,ok:!0,payload:l})}refuse(n,l,u){this.port.postMessage({p:V,v:_,re:n,ok:!1,error:{code:l,message:u}})}bump(n){const l=(this.revs.get(n)??0)+1;return this.revs.set(n,l),l}values(n,l){this.port.postMessage({p:V,v:_,type:"options.values",payload:{tab:n,rev:this.bump(n),values:l}})}height(n){this.port.postMessage({p:V,v:_,type:"ui.height",payload:{px:Math.round(n)}})}dispatch(n){const l=Ge(n.payload)?n.payload:{},u=typeof n.id=="string"?n.id:null;switch(n.type){case"host.surface":{const s=l.surface;return(s==="card"||s==="options"||s==="full")&&this.h.surface?.(s,l.mode==="simple"||l.mode==="advanced"?l.mode:null),!0}case"host.mode":{if(u===null)return!0;const s=l.mode;return s!=="simple"&&s!=="advanced"?(this.refuse(u,"bad_request","mode is simple or advanced"),!0):(this.reply(u,{mode:this.h.mode?.(s)??s}),!0)}case"host.action":{if(u===null)return!0;const s=l.id;return typeof s!="string"||this.h.action===void 0?(this.reply(u,{handled:!1}),!0):(Promise.resolve(this.h.action(s)).then(v=>this.reply(u,{handled:v.handled===!0,...typeof v.status=="string"?{status:v.status.slice(0,120)}:{}}),()=>this.reply(u,{handled:!1})),!0)}case"host.tab":return typeof l.tab=="string"&&this.h.tab?.(l.tab),!0;case"host.selection":return Array.isArray(l.anchors)&&this.h.selection?.(l.anchors),!0;case"options.changed":{if(u===null)return!0;const s=l.tab,v=l.id;return typeof s!="string"||typeof v!="string"||this.h.optionsChanged===void 0?(this.refuse(u,"unsupported","no controls here"),!0):(Promise.resolve(this.h.optionsChanged(s,v,l.value)).then(b=>this.reply(u,{applied:b.applied,rev:this.bump(s),values:b.values,...b.reason!==void 0?{reason:b.reason.slice(0,120)}:{}}),b=>this.refuse(u,"unavailable",b instanceof Error?b.message.slice(0,120):"failed")),!0)}default:return!1}}}const Je={card:{interactive:!0,aspect:"16:9",actions:[{id:"prev",label:"Previous chapter",verb:"plugin"},{id:"next",label:"Next chapter",verb:"plugin",primary:!0},{id:"ask",label:"Ask about this",verb:"host:ask"},{id:"export",label:"Export",verb:"host:export"}]},options:{tabs:[{id:"chapters",label:"Chapters",render:"plugin"},{id:"sheets",label:"Review",render:"plugin"},{id:"captions",label:"Captions",render:"controls",controls:[{id:"on",label:"Captions",type:"toggle"},{id:"burn",label:"Burn into video",type:"toggle"},{id:"position",label:"Position",type:"segmented",options:[{id:"bottom",label:"Bottom"},{id:"top",label:"Top"}]},{id:"size",label:"Text size",type:"range",min:18,max:72,step:2},{id:"lines",label:"Max lines",type:"range",min:1,max:3,step:1},{id:"wrap",label:"Line length",type:"range",min:20,max:80,step:1},{id:"look",label:"Look",type:"segmented",options:[{id:"bar",label:"Bar"},{id:"outline",label:"Outline"},{id:"plain",label:"Plain"}]}]},{id:"theme",label:"Theme",render:"controls",controls:[{id:"palette",label:"Colours",type:"select",options:[{id:"studio",label:"Studio skin · default"},{id:"corporate",label:"Corporate Light"},{id:"midnight",label:"Midnight Purple"},{id:"warm",label:"Warm Dark"},{id:"custom",label:"Custom"}]},{id:"title",label:"Title card",type:"toggle"},{id:"titletext",label:"Title",type:"text",maxChars:80},{id:"end",label:"End card",type:"toggle"},{id:"endtext",label:"End card text",type:"text",maxChars:80},{id:"background",label:"Background",type:"color"},{id:"foreground",label:"Text colour",type:"color"},{id:"accent",label:"Accent",type:"color"},{id:"font",label:"Font",type:"select",options:[{id:"inter",label:"Inter"},{id:"roboto",label:"Roboto"},{id:"source-sans",label:"Source Sans 3"},{id:"plex",label:"IBM Plex Sans"},{id:"system",label:"System"},{id:"archivo",label:"Archivo"}]}]}]},full:{modes:["simple","advanced"],default:"simple"}},Ye={corporate:{background:"#FFFFFF",foreground:"#1E293B",accent:"#0891B2"},midnight:{background:"#0A0A0F",foreground:"#FFFFFF",accent:"#A100FF"},warm:{background:"#1A1A2E",foreground:"#F8F8F2",accent:"#FFD93D"}},wt=(t,n)=>["background","foreground","accent"].every(l=>t[l].toLowerCase()===n[l].toLowerCase());function ve(t){if(t.palette===void 0||t.palette==="skin")return"studio";for(const[n,l]of Object.entries(Ye))if(wt(t,l))return n;return"custom"}function Ie(t,n,l){const u=ve(t)==="studio"?l??n??t:t;return{background:u.background,foreground:u.foreground,accent:u.accent}}const Pe={inter:"Inter",roboto:"Roboto","source-sans":"Source Sans 3",plex:"IBM Plex Sans",system:"system-ui",archivo:"Archivo"};function le(t,n,l=null,u){const s=t.captions,v=t.theme;if(n==="captions")return{on:s.on,burn:s.burnIn,position:s.position,size:s.size,lines:s.maxLines,wrap:s.wrapChars,look:s.style};if(n==="theme"){const b=Ie(v,l,u),y=ve(v)==="studio"?u?.font??v.font:v.font;return{palette:ve(v),title:v.titleCard.on,titletext:v.titleCard.title,end:v.endCard.on,endtext:v.endCard.title,background:b.background,foreground:b.foreground,accent:b.accent,font:Object.keys(Pe).find(x=>Pe[x]===y)??"system"}}return{}}function At(t,n,l,u){const s=JSON.parse(JSON.stringify(t));if(n==="captions"){const v={on:"on",burn:"burnIn",position:"position",size:"size",lines:"maxLines",wrap:"wrapChars",look:"style"};Object.assign(s.captions,{[v[l]]:u})}else if(n==="theme")switch(l){case"title":s.theme.titleCard.on=u;break;case"titletext":s.theme.titleCard.title=u;break;case"end":s.theme.endCard.on=u;break;case"endtext":s.theme.endCard.title=u;break;case"font":s.theme.font=Pe[u],s.theme.palette="custom";break;case"palette":s.theme.palette=u==="studio"?"skin":"custom",(u==="corporate"||u==="midnight"||u==="warm")&&Object.assign(s.theme,Ye[u]);break;default:Object.assign(s.theme,{[l]:u,palette:"custom"})}return s}const I={actions:4,tabs:5,controls:12,options:8,labelChars:24,maxChars:200},Te=/^[a-z][a-z0-9-]{0,31}$/u,$t=/^[A-Za-z0-9 ·'-]{1,24}$/u,Ct=["approve","accept","deliver","merge","send","launch","delete","remove","stop","deny","allow","grant","install"],Et={а:"a",е:"e",о:"o",р:"p",с:"c",у:"y",х:"x",і:"i",ј:"j",ѕ:"s","ԁ":"d","ӏ":"l",α:"a",ε:"e",ο:"o",ρ:"p",ν:"v",τ:"t",κ:"k",ι:"i",μ:"m",0:"o",1:"l",3:"e",4:"a",5:"s",7:"t"};function Lt(t){const n=t.normalize("NFKD").replace(/\p{M}+/gu,"").toLowerCase();let l="";for(const u of n)l+=Et[u]??u;return l.split(/[^a-z]+/u).filter(u=>u!=="")}function Tt(t){return Lt(t).some(n=>Ct.some(l=>n.startsWith(l)))}const ee=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),Fe=t=>typeof t=="number"&&Number.isFinite(t),m=t=>({ok:!1,reason:t}),Ft=/(?:[A-Za-z][0-9]|[0-9][A-Za-z])/u;function Me(t,n){return typeof t!="string"||!$t.test(t)?`${n}: a label is 1 to ${I.labelChars} plain characters`:Ft.test(t)?`${n}: a word in a label is letters or digits, not both`:Tt(t)?`${n}: "${t}" uses a word only the host's own controls may use`:null}function Oe(t,n){const l=new Set;for(const u of t){if(l.has(u.id))return`${n}: the id "${u.id}" is used twice`;l.add(u.id)}return null}const te=(t,n,l)=>{for(const u of Object.keys(t))if(!n.includes(u))return`${l}: unknown field "${u}"`;return null};function Mt(t,n){if(!ee(t))return m(`${n}: not an object`);const l=te(t,["id","label","type","options","min","max","step","maxChars"],n);if(l!==null)return m(l);if(typeof t.id!="string"||!Te.test(t.id))return m(`${n}: a bad id`);const u=Me(t.label,n);if(u!==null)return m(u);const s=t.type;if(s!=="toggle"&&s!=="segmented"&&s!=="select"&&s!=="color"&&s!=="text"&&s!=="range")return m(`${n}: an unknown control type`);const v={id:t.id,label:t.label,type:s};if(s==="segmented"||s==="select"){const b=t.options;if(!Array.isArray(b)||b.length<2||b.length>I.options)return m(`${n}: ${s} needs 2 to ${I.options} options`);const y=[];for(const[W,k]of b.entries()){if(!ee(k)||typeof k.id!="string"||!Te.test(k.id))return m(`${n}.options[${W}]: a bad id`);const w=Me(k.label,`${n}.options[${W}]`);if(w!==null)return m(w);const $=te(k,["id","label"],`${n}.options[${W}]`);if($!==null)return m($);y.push({id:k.id,label:k.label})}const x=Oe(y,`${n}.options`);if(x!==null)return m(x);v.options=y}else if(t.options!==void 0)return m(`${n}: only select and segmented take options`);if(s==="range"){const{min:b,max:y,step:x}=t;if(!Fe(b)||!Fe(y)||!Fe(x))return m(`${n}: range needs finite min, max and step`);if(!(b<y)||!(x>0)||x>y-b)return m(`${n}: range needs min < max and 0 < step ≤ max - min`);if(Math.abs(b)>1e9||Math.abs(y)>1e9||x<1e-6||(y-b)/x>1e6)return m(`${n}: range bounds are within ±1e9, step ≥ 1e-6, at most 1e6 steps`);if(x<Math.max(Math.abs(b),Math.abs(y))*1e-12)return m(`${n}: range step is too fine for its bounds`);v.min=b,v.max=y,v.step=x}else if(t.min!==void 0||t.max!==void 0||t.step!==void 0)return m(`${n}: only range takes min, max and step`);if(s==="text"){const b=t.maxChars===void 0?I.maxChars:t.maxChars;if(!Number.isInteger(b)||b<1||b>I.maxChars)return m(`${n}: maxChars is 1 to ${I.maxChars}`);v.maxChars=b}else if(t.maxChars!==void 0)return m(`${n}: only text takes maxChars`);return{ok:!0,value:v}}function Ot(t){if(!ee(t))return m("surfaces: not an object");const n=te(t,["card","options","full"],"surfaces");if(n!==null)return m(n);const l=t.card;if(!ee(l))return m("surfaces.card is required");const u=te(l,["interactive","aspect","actions"],"surfaces.card");if(u!==null)return m(u);const s=l.interactive===void 0?!1:l.interactive;if(typeof s!="boolean")return m("surfaces.card.interactive: a boolean");const v=l.aspect===void 0?"16:9":l.aspect;if(v!=="16:9"&&v!=="4:3"&&v!=="auto")return m("surfaces.card.aspect: 16:9, 4:3 or auto");const b=l.actions===void 0?[]:l.actions;if(!Array.isArray(b)||b.length>I.actions)return m(`surfaces.card.actions: at most ${I.actions}`);const y=[];for(const[w,$]of b.entries()){const L=`surfaces.card.actions[${w}]`;if(!ee($))return m(`${L}: not an object`);const F=te($,["id","label","primary","verb"],L);if(F!==null)return m(F);if(typeof $.id!="string"||!Te.test($.id))return m(`${L}: a bad id`);const o=Me($.label,L);if(o!==null)return m(o);const A=$.verb;if(A!=="plugin"&&A!=="host:export"&&A!=="host:ask")return m(`${L}: verb is plugin, host:export or host:ask`);const N=$.primary===void 0?!1:$.primary;if(typeof N!="boolean")return m(`${L}: primary is a boolean`);y.push({id:$.id,label:$.label,primary:N,verb:A})}const x=Oe(y,"surfaces.card.actions");if(x!==null)return m(x);let W=null;if(t.options!==void 0){const w=t.options;if(!ee(w))return m("surfaces.options: not an object");const $=te(w,["tabs"],"surfaces.options");if($!==null)return m($);const L=w.tabs;if(!Array.isArray(L)||L.length<1||L.length>I.tabs)return m(`surfaces.options.tabs: 1 to ${I.tabs}`);const F=[];for(const[A,N]of L.entries()){const O=`surfaces.options.tabs[${A}]`;if(!ee(N))return m(`${O}: not an object`);const B=te(N,["id","label","render","controls"],O);if(B!==null)return m(B);if(typeof N.id!="string"||!Te.test(N.id))return m(`${O}: a bad id`);const H=Me(N.label,O);if(H!==null)return m(H);const U=N.render;if(U!=="plugin"&&U!=="controls")return m(`${O}: render is plugin or controls`);const oe={id:N.id,label:N.label,render:U};if(U==="controls"){const ae=N.controls;if(!Array.isArray(ae)||ae.length<1||ae.length>I.controls)return m(`${O}.controls: 1 to ${I.controls}`);const K=[];for(const[ye,R]of ae.entries()){const X=Mt(R,`${O}.controls[${ye}]`);if(!X.ok)return X;K.push(X.value)}const ne=Oe(K,`${O}.controls`);if(ne!==null)return m(ne);oe.controls=K}else if(N.controls!==void 0)return m(`${O}: a plugin-rendered tab has no controls`);F.push(oe)}const o=Oe(F,"surfaces.options.tabs");if(o!==null)return m(o);W={tabs:F}}let k=null;if(t.full!==void 0){const w=t.full;if(!ee(w))return m("surfaces.full: not an object");const $=te(w,["modes","default"],"surfaces.full");if($!==null)return m($);let L=null;if(w.modes!==void 0){const o=w.modes;if(!Array.isArray(o)||o.length!==2||o[0]!=="simple"||o[1]!=="advanced")return m('surfaces.full.modes: exactly ["simple","advanced"]');L=["simple","advanced"]}const F=w.default===void 0?"simple":w.default;if(F!=="simple"&&F!=="advanced")return m("surfaces.full.default: simple or advanced");if(L===null&&w.default!==void 0)return m("surfaces.full.default needs modes");k={modes:L,default:F}}return{ok:!0,value:{card:{interactive:s,aspect:v,actions:y},options:W,full:k}}}const Qe=String.raw`(?:\d{1,3}(?:\.\d+)?%?|\.\d+%?)`,Rt=new RegExp(String.raw`^(?:#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})|(?:rgba?|hsla?)\(\s*${Qe}(?:\s*,\s*${Qe}){2,3}\s*\))$`,"iu");function Nt(t,n){switch(t.type){case"toggle":return typeof n=="boolean";case"segmented":case"select":return typeof n=="string"&&(t.options??[]).some(l=>l.id===n);case"color":return typeof n=="string"&&n.length<=64&&Rt.test(n);case"text":return typeof n=="string"&&n.length<=(t.maxChars??I.maxChars)&&!/[\r\n]/u.test(n);case"range":{if(!Fe(n)||t.min===void 0||t.max===void 0||t.step===void 0||n<t.min||n>t.max)return!1;const l=Math.round((n-t.min)/t.step);return Math.abs(n-(t.min+l*t.step))<=t.step*.001}}}const Ue=Ot(Je);if(!Ue.ok)throw new Error(Ue.reason);const jt=Ue.value;function et(){document.body.insertAdjacentHTML("afterbegin",`<main id="video-editor" class="video-editor" data-testid="video-editor" tabindex="0">
19
+ <aside id="chapters" class="chapters"><h2>Chapters</h2><ol id="chapter-list"></ol><div id="editor-fields" class="editor-fields"></div></aside>
18
20
  <section id="work" class="work"><div class="player"><video id="player" data-testid="video-player" playsinline preload="metadata" aria-label="Video"></video><div id="unavailable" class="unavailable">The video isn't available here</div><img id="poster" data-testid="video-poster" class="poster" alt="" hidden><div id="caption" class="caption"></div></div>
19
21
  <div class="transport"><button id="play" data-testid="video-play" type="button">Play</button><span id="count"></span></div><div id="chips" class="chips" aria-label="Chapter chips"></div><div id="timeline" class="timeline" aria-label="Chapter timeline"></div><p id="status" class="status" role="status"></p></section>
20
- <aside id="inspectors" class="inspectors"><section id="proof"><h2>Checks</h2><p id="proof-summary" class="summary"></p><ol id="check-list" aria-label="Checks"></ol></section><h2>Text</h2><textarea id="say" aria-label="Chapter caption text" readonly></textarea><h2>Theme</h2><p id="theme-summary" class="summary"></p></aside></main>`);const t=e=>document.getElementById(e),n=t("video-editor"),l=t("chapter-list"),c=t("editor-fields"),a=t("player"),v=t("chips"),b=t("timeline"),y=t("caption");let k=null,V=null,g="card",A="simple",C="chapters",T=1,M=[],i=null,$=null,I=0,O=!1,_=!1,W=null,j=null,ie="",ae=0,D=null,ne=0,ve=0,N=!1,H=null,ye=!1;const ce=new Map,Oe=(e,o)=>k?.postMessage({p:K,v:q,type:e,payload:o}),ge=(e,o)=>new Promise(r=>{if(k===null||_){r({ok:!1,error:{code:"unavailable",message:"No host here."}});return}const d=`wv-${++I}`,u=setTimeout(()=>{ce.delete(d),r({ok:!1,error:{code:"timeout",message:"The host has not answered; check Versions."}})},1e4);ce.set(d,{resolve:r,timer:u}),k.postMessage({p:K,v:q,type:e,id:d,payload:o})}),ke=()=>i?.chapters.find(e=>e.id===$),ze=e=>i?.chapters.find(o=>o.startSec>=0&&e>=o.startSec&&(o.durationSec<0||e<o.startSec+o.durationSec)),Qe=e=>e!==void 0&&e.startSec>=0&&i!==null&&i.style.captions.on&&(N||!(i.style.captions.burnIn&&i.ffmpeg?.burnIn)),z=()=>M.includes("artifact.write")&&!O&&!_,de=()=>g==="options"||A==="advanced",Ne=e=>{t("status").textContent=e,Oe("ui.status",{line:e.replace(/[\r\n]/g," ").slice(0,120)})},Ue=()=>{if(T===2&&i!==null)for(const e of["captions","theme"])V?.values(e,le(i.style,e,J,i.resolvedTheme))};let J=null;const De=e=>{if(typeof e!="string"||e===""||e.length>200||/url\(/i.test(e))return null;const o=document.createElement("span");o.style.color=e,document.body.append(o);const r=getComputedStyle(o).color;return o.remove(),/^rgba?\(\s*\d/.test(r)?r.replace(/\s+/g," "):null},et=e=>{if(typeof e!="object"||e===null)return;const o=e,r=De(o["--surface-raised"]??o["--surface-base"]),d=De(o["--ink-high"]),u=De(o["--accent"]);r!==null&&d!==null&&u!==null&&(J={background:r,foreground:d,accent:u});for(const[s,f]of Object.entries(e))typeof f=="string"&&/^--[a-z0-9-]+$/.test(s)&&f.length<=200&&!/url\(/i.test(f)&&document.documentElement.style.setProperty(s,f)},Be=()=>{D!==null&&URL.revokeObjectURL(D),D=null,a.removeAttribute("src")};let B=null;async function Nt(e){const o=await ge("artifact.media",{ref:"poster"});if(_||e!==ne)return;const r=o.payload?.blob,d=o.payload?.type,u=t("poster");if(B!==null&&(URL.revokeObjectURL(B),B=null),!o.ok||!(r instanceof Blob)||typeof d!="string"||!d.startsWith("image/")||typeof URL.createObjectURL!="function"){u.hidden=!0;return}B=URL.createObjectURL(r),u.src=B,u.alt=i?.proof?.verdict==="FAIL"?"The moment the walkthrough failed":"The recording's still",u.hidden=!1,t("unavailable").textContent=i?.proof?.verdict==="FAIL"?"No video: this is the moment it failed":"The video isn't available here"}async function oe(e="video",o){const r=++ne;if(ye=!0,!M.includes("media.read")){ye=!1,Be(),t("unavailable").hidden=!1;return}const d=await ge("artifact.media",{ref:e});if(_||r!==ne)return;Be();const u=d.payload?.blob,s=d.payload?.type;if(!d.ok||!(u instanceof Blob)||typeof s!="string"||!s.startsWith("video/")||typeof URL.createObjectURL!="function"){ye=!1,t("unavailable").hidden=!1,Nt(r);return}t("poster").hidden=!0,B!==null&&(URL.revokeObjectURL(B),B=null,t("poster").removeAttribute("src")),D=URL.createObjectURL(u),a.src=D,t("unavailable").hidden=!0,qe(),a.onloadedmetadata=()=>{if(!(_||r!==ne)){if(ye=!1,!N&&i!==null&&Number.isFinite(a.duration)){for(const[f,h]of i.chapters.entries())if(h.startSec>=0&&h.durationSec<0){const S=i.chapters.slice(f+1).find(x=>x.startSec>=0)?.startSec??a.duration;h.durationSec=Math.max(0,S-h.startSec),h.outSec=h.inSec+h.durationSec}w()}if(a.currentTime=H??o??(N?ke()?.inSec??0:Math.max(0,ke()?.startSec??0)),H!==null){H=null;const f=ze(a.currentTime);f!==void 0&&($=f.id),w()}}}}const Y=(e,o,r)=>{const d=document.createElement("button");return d.type="button",d.textContent=e,d.onclick=o,r!==void 0&&(d.dataset.testid=r),d};function ue(e,o=!0){i?.chapters.some(r=>r.id===e&&r.startSec>=0)&&(H=null,$=e,N&&(N=!1,oe()),a.currentTime=ke()?.startSec??0,w(),o&&M.includes("selection.chip")&&Oe("selection.set",{anchors:[{kind:"chapter",id:e}]}))}function It(e){if(!Number.isFinite(e)||e<0||(H=e,i===null))return;const o=ze(e);o!==void 0&&($=o.id),N?(N=!1,oe()):!ye&&D!==null&&a.readyState>=1&&(a.currentTime=e,H=null),w()}function Ke(e,o){const r=i?.chapters??[],d=r.findIndex(f=>f.id===e),u=d+o;if(u<0||u>=r.length)return;const s=r.filter(f=>f.id!==e);se({op:"chapter-move",chapter:e,after:u===0?null:s[u-1].id})}async function pe(){const e=++ve,o=await ge("artifact.read",{});if(_||e!==ve)return!1;const r=o.payload?.content;if(!o.ok||r?.type!=="demo-cut"||!Array.isArray(r.chapters))return Ne(o.error?.message??"No cut is available here."),!1;if(i!==null&&r.version<i.version)return!1;const d=i?.version;return i=r,d!==i.version&&(N=!1),i.chapters.some(u=>u.id===$&&u.startSec>=0)||($=i.chapters.find(u=>u.startSec>=0)?.id??null),w(),Ue(),g!=="options"&&d!==i.version&&oe(),!0}async function se(e,o=i?.version){if(!(!z()||i===null||o===void 0)){O=!0,w();try{const r=await ge("version.write",{base:o,ops:[e],summary:`chapter ${i.chapters.findIndex(d=>d.id===e.chapter)+1}`});r.ok?(await pe(),e.op==="chapter-take"&&g!=="options"&&(N=!0,oe({chapter:e.chapter}))):(Ne(r.error?.message??"The chapter could not be saved."),r.error?.code==="head_moved"&&await pe())}finally{O=!1,w()}}}function tt(e){if(!z()||i===null||j!==null)return;j=e.id,ie=e.title,ae=i.version,w();const o=c.querySelector('[data-testid="video-rename-input"]');o?.focus(),o?.select()}function Rt(){const e=i?.chapters.find(r=>r.id===j);if(e===void 0)return j=null,null;const o=document.createElement("input");return o.value=ie,o.maxLength=80,o.setAttribute("aria-label","Chapter title"),o.dataset.testid="video-rename-input",o.oninput=()=>{ie=o.value},o.onkeydown=r=>{r.key==="Escape"?(r.preventDefault(),r.stopPropagation(),j=null,w()):r.key==="Enter"&&(r.preventDefault(),r.stopPropagation(),j=null,o.value.trim()&&!/[\r\n]/.test(o.value)&&o.value!==e.title?se({op:"chapter-rename",chapter:e.id,title:o.value},ae):w())},o}function qe(){if(i===null)return;const e=i.style,o=ke();y.hidden=!Qe(o),y.dataset.position=e.captions.position,y.dataset.look=e.captions.style;const r=[];let d="";for(const f of(o?.say??"").split(/\s+/))d&&(d+" "+f).length>e.captions.wrapChars?(r.push(d),d=f):d+=(d?" ":"")+f;d&&r.push(d),y.textContent=r.slice(0,e.captions.maxLines).join(`
21
- `),y.style.fontSize=`max(9px, ${e.captions.size/19.2}cqw)`,y.style.maxHeight=`${e.captions.maxLines*1.3+.8}em`;const u=Re(e.theme,J,i.resolvedTheme),s={background:u.background,foreground:u.foreground,accent:u.accent,font:be(e.theme)==="studio"?i.resolvedTheme?.font??e.theme.font:e.theme.font};for(const[f,h]of Object.entries(s))n.style.setProperty(`--video-${f}`,h)}function nt(e,o){const r=Y("",()=>{},`video-trim-${o}`);r.className="trim-handle",r.dataset.edge=o,r.setAttribute("role","slider"),r.setAttribute("aria-label",`${o==="in"?"In":"Out"} trim`);const d=i?.takes[e.id]?.find(s=>s.file===e.take)?.durationSec??e.outSec;r.setAttribute("aria-valuemin","0"),r.setAttribute("aria-valuemax",String(d)),r.setAttribute("aria-valuenow",String(o==="in"?e.inSec:e.outSec));const u=e.durationSec<=0||e.outSec-e.inSec<=0;return r.disabled=!z()||u,r.onpointerdown=s=>{if(!z()||i===null||u)return;s.preventDefault(),s.stopPropagation();const f=i.version,h=s.clientX,S=r.parentElement.getBoundingClientRect().width||1;let x=e.inSec,X=e.outSec;const fe=Q=>{const Ce=(Q-h)/S*e.durationSec;o==="in"?x=Math.max(0,Math.min(e.outSec-.5,e.inSec+Ce)):X=Math.max(e.inSec+.5,Math.min(d,e.outSec+Ce)),r.setAttribute("aria-valuenow",(o==="in"?x:X).toFixed(2));const we=c.querySelector(`[data-testid="video-${o}"]`);we&&(we.value=(o==="in"?x:X).toFixed(2))},Se=Q=>fe(Q.clientX),xe=Q=>{fe(Q.clientX),Ae(),(x!==e.inSec||X!==e.outSec)&&se({op:"chapter-trim",chapter:e.id,inSec:x,outSec:X},f)},Ae=()=>{window.removeEventListener("pointermove",Se),window.removeEventListener("pointerup",xe),window.removeEventListener("pointercancel",$e)},$e=()=>{Ae(),w()};window.addEventListener("pointermove",Se),window.addEventListener("pointerup",xe),window.addEventListener("pointercancel",$e,{once:!0})},r.onkeydown=s=>{if(!z()||u||!["ArrowLeft","ArrowRight"].includes(s.key))return;s.preventDefault(),s.stopPropagation();const f=s.key==="ArrowLeft"?-.1:.1,h=o==="in"?Math.max(0,Math.min(e.outSec-.5,e.inSec+f)):e.inSec,S=o==="out"?Math.max(e.inSec+.5,Math.min(d,e.outSec+f)):e.outSec;(h!==e.inSec||S!==e.outSec)&&se({op:"chapter-trim",chapter:e.id,inSec:h,outSec:S})},r}function Pt(){const e=i?.proof,o=t("check-list");if(o.replaceChildren(),t("proof").hidden=e===void 0,e===void 0||i===null)return;t("proof-summary").textContent=`${e.verdict??"Pending"}${e.failedAtSec===null?"":` · Failed at ${e.failedAtSec.toFixed(1)}s`}`;const r=!N&&Number.isFinite(a.duration)&&a.duration>0?a.duration:Math.max(1,...i.chapters.filter(s=>s.startSec>=0).map(s=>s.startSec+Math.max(0,s.durationSec)),...e.checks.map(s=>s.atSec??0),e.failedAtSec??0),d=document.createElement("div");d.className="check-track",d.setAttribute("aria-label","Check timeline");const u=(s,f,h,S)=>{if(s<0||!Number.isFinite(s)||r<=0)return;const x=Y(f==="FAIL"?"✗":f==="PASS"?"✓":"·",()=>{N&&(N=!1,oe("video",s)),a.currentTime=s,a.dispatchEvent(new Event("timeupdate"))},S);x.className="check-mark",x.dataset.state=f,x.dataset.sec=String(s),x.style.left=`${Math.min(100,s/r*100)}%`,x.title=`${s.toFixed(1)}s · ${h}`,x.setAttribute("aria-label",x.title),d.append(x)};for(const s of e.checks){const f=i.chapters.find(x=>x.id===s.chapter)?.title??s.chapter,h=`${s.state} · ${f} · ${s.text}`,S=document.createElement("li");S.dataset.testid="video-check",S.dataset.state=s.state,S.textContent=`${h}${s.atSec===null?"":` · ${s.atSec.toFixed(1)}s`}`,o.append(S),s.atSec!==null&&u(s.atSec,s.state,h,"video-check-mark")}e.failedAtSec!==null&&!e.checks.some(s=>s.state==="FAIL"&&s.atSec===e.failedAtSec)&&u(e.failedAtSec,"FAIL","Failed","video-failure-mark"),b.dataset.proof=String(d.childElementCount>0),b.append(d)}function w(){const e=document.activeElement,o=c.querySelector('[data-testid="video-rename-input"]');o!==null&&(ie=o.value);const r=e===o,d=o?.selectionStart,u=o?.selectionEnd,s=e?.dataset.chapter,f=e?.dataset.testid;if(n.dataset.surface=g,n.dataset.mode=A,n.dataset.head=String(i?.version??0),n.dataset.current=$??"",t("chapters").hidden=g==="card"||g==="options"&&C!=="chapters",t("work").hidden=g==="options",t("inspectors").hidden=g!=="full"||A!=="advanced",b.hidden=g!=="full",v.hidden=g!=="card",l.replaceChildren(),v.replaceChildren(),b.replaceChildren(),c.replaceChildren(),b.dataset.proof="false",i===null)return;if(j!==null){const p=Rt();p!==null&&(c.prepend(p),r&&(p.focus(),p.setSelectionRange(d??null,u??null)))}i.chapters.forEach((p,E)=>{const P=document.createElement("li"),F=Y("",()=>ue(p.id),"video-chapter");F.className="chapter",F.dataset.chapter=p.id,F.disabled=p.startSec<0,F.disabled&&(F.title="Not in this recording");const L=document.createElement("span");L.className="number",L.textContent=String(E+1);const Ie=document.createElement("span");Ie.textContent=p.title;const _e=document.createElement("span");if(_e.className="duration",_e.textContent=p.durationSec<0?"—":`${p.durationSec.toFixed(1)}s`,F.append(L,Ie,_e),F.setAttribute("aria-current",String(p.id===$)),F.setAttribute("aria-label",`Chapter ${E+1}: ${p.title}`),p.verdict==="PASS"||p.verdict==="FAIL"){const U=document.createElement("span");U.className="chapter-verdict",U.dataset.verdict=p.verdict,U.textContent=p.verdict==="PASS"?"✓":"✗",U.setAttribute("aria-label",p.verdict),F.append(U)}F.ondblclick=()=>{de()&&tt(p)},P.draggable=de()&&z(),P.ondragstart=U=>{W=p.id,U.dataTransfer?.setData("text/plain",p.id)},P.ondragover=U=>{de()&&z()&&U.preventDefault()},P.ondrop=U=>{if(U.preventDefault(),W===null||W===p.id||!de())return;const lt=i.chapters.filter(We=>We.id!==W),ct=lt.findIndex(We=>We.id===p.id),dt=P.getBoundingClientRect(),zt=U.clientY>=dt.top+dt.height/2?p.id:ct===0?null:lt[ct-1].id;se({op:"chapter-move",chapter:W,after:zt}),W=null},P.ondragend=()=>{W=null},P.append(F),l.append(P);const he=Y(`${E+1} · ${p.title}`,()=>ue(p.id),"video-chip");he.className="chip",he.setAttribute("aria-current",String(p.id===$)),v.append(he),he.disabled=p.startSec<0,he.disabled&&(he.title="Not in this recording");const Ee=document.createElement("div");Ee.className="segment-box",Ee.style.flex=String(p.durationSec<0?1:p.durationSec);const me=Y(`${E+1} · ${p.title}`,()=>ue(p.id),"video-segment");me.className="segment",me.setAttribute("aria-current",String(p.id===$)),Ee.append(me),me.disabled=p.startSec<0,me.disabled&&(me.title="Not in this recording"),A==="advanced"&&p.id===$&&Ee.append(nt(p,"in"),nt(p,"out")),b.append(Ee)}),Pt();const h=ke();t("hint").textContent=h===void 0?"":"Re-record this chapter: the host's button",t("count").textContent=h===void 0?"No chapters":`${i.chapters.findIndex(p=>p.id===h.id)+1} of ${i.chapters.length}`,t("say").value=h?.say??"";const S=i.style.theme,x=Re(S,J,i.resolvedTheme),X=be(S);if(t("theme-summary").textContent=`${X==="studio"?"Studio skin (default)":X==="custom"?"Custom colours":"Preset: "+X}
22
- ${X==="studio"?i.resolvedTheme?.font??S.font:S.font}
23
- Background ${x.background}
24
- Text ${x.foreground}
25
- Accent ${x.accent}
26
- Title card: ${S.titleCard.on?S.titleCard.title:"Off"}
27
- End card: ${S.endCard.on?S.endCard.title:"Off"}`,qe(),s!==void 0&&Array.from(l.querySelectorAll("[data-chapter]")).find(p=>p.dataset.chapter===s)?.focus(),!de()||g==="card"||h===void 0)return;const fe=document.createElement("div");fe.className="buttons";const Se=Y("Rename",()=>tt(h),"video-rename"),xe=Y("Move up",()=>Ke(h.id,-1),"video-move-up"),Ae=Y("Move down",()=>Ke(h.id,1),"video-move-down");Se.disabled=!z(),xe.disabled=!z()||i.chapters[0]?.id===h.id,Ae.disabled=!z()||i.chapters.at(-1)?.id===h.id,fe.append(Se,xe,Ae),c.append(fe);const $e=i.version,Q=document.createElement("div");Q.className="trim-fields";const Ce=(p,E,P)=>{const F=document.createElement("label");F.textContent=p;const L=document.createElement("input");return L.type="number",L.step="0.1",L.min="0",L.value=String(E),L.dataset.testid=P,L.setAttribute("aria-label",p),L.disabled=!z(),L.max=String(i.takes[h.id]?.find(Ie=>Ie.file===h.take)?.durationSec??h.outSec),F.append(L),Q.append(F),L},we=Ce("In (seconds)",h.inSec,"video-in"),Ve=Ce("Out (seconds)",h.outSec,"video-out"),st=()=>{const p=we.valueAsNumber,E=Ve.valueAsNumber;if(!(p===h.inSec&&E===h.outSec)){if(!Number.isFinite(p)||!Number.isFinite(E)||p<0||E-p<.5||E>Number(Ve.max)){Ne("Keep at least 0.5 seconds within this take.");return}se({op:"chapter-trim",chapter:h.id,inSec:p,outSec:E},$e)}};we.onchange=st,Ve.onchange=st,c.append(Q);const rt=i.takes[h.id]??[];if(rt.length>1){const p=document.createElement("label");p.textContent="Take";const E=document.createElement("select");E.setAttribute("aria-label","Take"),E.dataset.testid="video-take",E.disabled=!z(),rt.forEach((P,F)=>{const L=document.createElement("option");L.value=P.file,L.textContent=`Take ${F+1} · ${P.durationSec.toFixed(1)}s`,E.append(L)}),E.value=h.take,E.onchange=()=>{E.value!==h.take&&se({op:"chapter-take",chapter:h.id,take:E.value},$e)},p.append(E),c.append(p),g!=="options"&&c.append(Y("Preview take",()=>{N=!0,oe({chapter:h.id})},"video-preview-take"))}if(f!==void 0&&!f.includes("rename-input")){const p=n.querySelector(`[data-testid="${f}"]`);p&&!p.disabled&&!p.closest("[hidden]")&&p.focus()}}async function jt(e,o,r){const d=Ot.options?.tabs.find(u=>u.id===e)?.controls?.find(u=>u.id===o);if(i===null||d===void 0||!Mt(d,r)||!M.includes("artifact.theme")||typeof r=="string"&&/[\r\n]/.test(r))return{applied:!1,values:i===null?{}:le(i.style,e,J,i.resolvedTheme),reason:"That style change is not available."};if(O)return{applied:!1,values:le(i.style,e,J,i.resolvedTheme),reason:"A cut is being saved."};O=!0,w();try{for(let u=0;u<2;u++){const s=St(i.style,e,o,r),f=await ge("theme.set",{base:i.version,tokens:{kind:"video-style",style:s}});if(f.ok){const h=await pe();return{applied:h,values:le(i.style,e,J,i.resolvedTheme),...h?{}:{reason:"The saved style could not be read."}}}if(!(f.error?.code==="head_moved"&&u===0&&await pe()))return Ue(),{applied:!1,values:le(i.style,e,J,i.resolvedTheme),reason:f.error?.message??"Style was not changed."}}return{applied:!1,values:le(i.style,e,J,i.resolvedTheme)}}finally{O=!1,w()}}const ot=()=>{t("play").textContent=a.paused?"Play":"Pause"};a.onplay=ot,a.onpause=ot,t("play").onclick=()=>{D!==null&&(a.paused?a.play().catch(()=>Ne("The video isn't available here")):a.pause())},a.onerror=()=>{t("unavailable").hidden=!1},a.ontimeupdate=()=>{if(i===null||N)return;const e=ze(a.currentTime);e!==void 0&&e.id!==$&&($=e.id,w()),y.hidden=!Qe(e)},n.onkeydown=e=>{const o=e.target,r=e.metaKey||e.ctrlKey;if(!yt(e,n,d=>Oe("ui.key",{key:d}))&&!o.closest("input,textarea,select")&&e.key!=="Tab"){if(e.altKey&&!r&&["ArrowUp","ArrowDown"].includes(e.key)&&de()&&$!==null){e.preventDefault(),Ke($,e.key==="ArrowUp"?-1:1);return}if(!(r||e.altKey)){if(["ArrowLeft","ArrowRight","Home","End"].includes(e.key)&&i!==null){e.preventDefault();const d=i.chapters.filter(h=>h.startSec>=0),u=d.findIndex(h=>h.id===$),s=e.key==="Home"?0:e.key==="End"?d.length-1:Math.max(0,Math.min(d.length-1,u+(e.key==="ArrowRight"?1:-1))),f=d[s];f&&ue(f.id);return}o.closest("button")&&[" ","Enter"].includes(e.key)||e.key.length===1&&(e.preventDefault(),Oe("ui.typed",{grapheme:e.key}))}}};function it(){_=!0,++ne,++ve,Be(),B!==null&&(URL.revokeObjectURL(B),B=null);for(const{timer:e,resolve:o}of ce.values())clearTimeout(e),o({ok:!1,error:{code:"unavailable",message:"Editor closed."}});ce.clear(),k?.close(),window.removeEventListener("message",at)}function at(e){const o=e.data;if(k!==null||o?.p!==K||o.v!==q||o.type!=="host.hello"||!e.ports[0])return;const r=mt(o.payload),d=o.payload;g=r.surface,A=r.mode??"simple",C=r.tab??"chapters",T=r.protocol,M=Array.isArray(d.grants)?d.grants.filter(u=>typeof u=="string"):[],et(d.theme),k=e.ports[0],V=new gt(k,{surface(u,s){const f=g;g=u,s!==null&&(A=s),w(),f==="options"&&u!=="options"&&oe()},mode(u){return A=u,w(),A},action(u){const s=i?.chapters.filter(x=>x.startSec>=0)??[];if(!["next","prev"].includes(u)||i===null||s.length===0)return{handled:!1};const f=s.findIndex(x=>x.id===$),h=Math.max(0,Math.min(s.length-1,f+(u==="next"?1:-1))),S=s[h];return ue(S.id),{handled:!0,status:`Chapter ${i.chapters.indexOf(S)+1} of ${i.chapters.length} · ${S.title}`}},tab(u){C=u,w()},selection(u){const s=u.find(f=>typeof f=="object"&&f!==null&&["chapter","time"].includes(f.kind));s?.kind==="time"&&typeof s.atSec=="number"?It(s.atSec):typeof s?.id=="string"&&ue(s.id,!1)},optionsChanged:jt}),k.onmessage=u=>{const s=u.data;if(s?.p!==K||s.v!==q)return;if(typeof s.re=="string"){const h=ce.get(s.re);if(h===void 0)return;clearTimeout(h.timer),ce.delete(s.re),h.resolve({ok:s.ok===!0,...s.payload!==void 0?{payload:s.payload}:{},...s.error===void 0?{}:{error:s.error}});return}if(T===2&&V?.dispatch(s))return;const f=s.payload??{};switch(s.type){case"host.ping":s.id&&k?.postMessage({p:K,v:q,re:s.id,ok:!0,payload:{}});break;case"host.size":if(f.size==="inline"||f.size==="pane"||f.size==="full"){const h=g;g=T===1&&f.size==="pane"?"full":Xe(f.size),w(),h==="options"&&g!=="options"&&oe()}break;case"host.theme":et(f.theme),Ue(),qe(),w();break;case"artifact.changed":(typeof f.head!="number"||i===null||f.head>i.version)&&pe();break;case"host.teardown":it();break;case"selection.cleared":$=null,w();break}},k.start(),w(),pe()}window.addEventListener("message",at),window.addEventListener("pagehide",it,{once:!0}),w(),vt("wicked-video",Ze)}return Ye(),Z.start=Ye,Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"}),Z})({});
22
+ <section id="review-tab" class="review-tab" data-testid="video-review" hidden><h2>Review</h2><p id="review-line" class="summary" data-testid="video-review-line"></p><ol id="review-findings" class="findings" aria-label="Findings"></ol><div id="review-sheets" class="sheets" aria-label="Contact sheets"></div></section>
23
+ <aside id="inspectors" class="inspectors"><section id="proof"><h2>Checks</h2><p id="proof-summary" class="summary"></p><ol id="check-list" aria-label="Checks"></ol></section><h2>Text</h2><textarea id="say" aria-label="Chapter caption text" readonly></textarea><h2>Theme</h2><p id="theme-summary" class="summary"></p></aside></main>`);const t=e=>document.getElementById(e),n=t("video-editor"),l=t("chapter-list"),u=t("editor-fields"),s=t("player"),v=t("chips"),b=t("timeline"),y=t("caption");let x=null,W=null,k="card",w="simple",$="chapters",L=1,F=[],o=null,A=null,N=0,O=!1,B=!1,H=null,U=null,oe="",ae=0,K=null,ne=0,ye=0,R=!1,X=null,ge=!1,tt=null,ke=[],ze=0;const ce=new Map,Re=(e,i)=>x?.postMessage({p:V,v:_,type:e,payload:i}),de=(e,i)=>new Promise(r=>{if(x===null||B){r({ok:!1,error:{code:"unavailable",message:"No host here."}});return}const c=`wv-${++N}`,d=setTimeout(()=>{ce.delete(c),r({ok:!1,error:{code:"timeout",message:"The host has not answered; check Versions."}})},1e4);ce.set(c,{resolve:r,timer:d}),x.postMessage({p:V,v:_,type:e,id:c,payload:i})}),Se=()=>o?.chapters.find(e=>e.id===A),De=e=>o?.chapters.find(i=>i.startSec>=0&&e>=i.startSec&&(i.durationSec<0||e<i.startSec+i.durationSec)),nt=e=>e!==void 0&&e.startSec>=0&&o!==null&&o.style.captions.on&&(R||!(o.style.captions.burnIn&&o.ffmpeg?.burnIn)),z=()=>F.includes("artifact.write")&&!O&&!B,ue=()=>k==="options"||w==="advanced",Ne=e=>{t("status").textContent=e,Re("ui.status",{line:e.replace(/[\r\n]/g," ").slice(0,120)})},Be=()=>{if(L===2&&o!==null)for(const e of["captions","theme"])W?.values(e,le(o.style,e,J,o.resolvedTheme))};let J=null;const Ke=e=>{if(typeof e!="string"||e===""||e.length>200||/url\(/i.test(e))return null;const i=document.createElement("span");i.style.color=e,document.body.append(i);const r=getComputedStyle(i).color;return i.remove(),/^rgba?\(\s*\d/.test(r)?r.replace(/\s+/g," "):null},it=e=>{if(typeof e!="object"||e===null)return;const i=e,r=Ke(i["--surface-raised"]??i["--surface-base"]),c=Ke(i["--ink-high"]),d=Ke(i["--accent"]);r!==null&&c!==null&&d!==null&&(J={background:r,foreground:c,accent:d});for(const[a,p]of Object.entries(e))typeof p=="string"&&/^--[a-z0-9-]+$/.test(a)&&p.length<=200&&!/url\(/i.test(p)&&document.documentElement.style.setProperty(a,p)},qe=()=>{K!==null&&URL.revokeObjectURL(K),K=null,s.removeAttribute("src")};let q=null;async function It(e){const i=await de("artifact.media",{ref:"poster"});if(B||e!==ne)return;const r=i.payload?.blob,c=i.payload?.type,d=t("poster");if(q!==null&&(URL.revokeObjectURL(q),q=null),!i.ok||!(r instanceof Blob)||typeof c!="string"||!c.startsWith("image/")||typeof URL.createObjectURL!="function"){d.hidden=!0;return}q=URL.createObjectURL(r),d.src=q,d.alt=o?.proof?.verdict==="FAIL"?"The moment the walkthrough failed":"The recording's still",d.hidden=!1,t("unavailable").textContent=o?.proof?.verdict==="FAIL"?"No video: this is the moment it failed":"The video isn't available here"}async function ie(e="video",i){const r=++ne;if(ge=!0,!F.includes("media.read")){ge=!1,qe(),t("unavailable").hidden=!1;return}const c=await de("artifact.media",{ref:e});if(B||r!==ne)return;qe();const d=c.payload?.blob,a=c.payload?.type;if(!c.ok||!(d instanceof Blob)||typeof a!="string"||!a.startsWith("video/")||typeof URL.createObjectURL!="function"){ge=!1,t("unavailable").hidden=!1,It(r);return}t("poster").hidden=!0,q!==null&&(URL.revokeObjectURL(q),q=null,t("poster").removeAttribute("src")),K=URL.createObjectURL(d),s.src=K,t("unavailable").hidden=!0,_e(),s.onloadedmetadata=()=>{if(!(B||r!==ne)){if(ge=!1,!R&&o!==null&&Number.isFinite(s.duration)){for(const[p,f]of o.chapters.entries())if(f.startSec>=0&&f.durationSec<0){const g=o.chapters.slice(p+1).find(S=>S.startSec>=0)?.startSec??s.duration;f.durationSec=Math.max(0,g-f.startSec),f.outSec=f.inSec+f.durationSec}C()}if(s.currentTime=X??i??(R?Se()?.inSec??0:Math.max(0,Se()?.startSec??0)),X!==null){X=null;const p=De(s.currentTime);p!==void 0&&(A=p.id),C()}}}}const Y=(e,i,r)=>{const c=document.createElement("button");return c.type="button",c.textContent=e,c.onclick=i,r!==void 0&&(c.dataset.testid=r),c};function pe(e,i=!0){o?.chapters.some(r=>r.id===e&&r.startSec>=0)&&(X=null,A=e,R&&(R=!1,ie()),s.currentTime=Se()?.startSec??0,C(),i&&F.includes("selection.chip")&&Re("selection.set",{anchors:[{kind:"chapter",id:e}]}))}function Pt(e){if(!Number.isFinite(e)||e<0||(X=e,o===null))return;const i=De(e);i!==void 0&&(A=i.id),R?(R=!1,ie()):!ge&&K!==null&&s.readyState>=1&&(s.currentTime=e,X=null),C()}function Ve(e,i){const r=o?.chapters??[],c=r.findIndex(p=>p.id===e),d=c+i;if(d<0||d>=r.length)return;const a=r.filter(p=>p.id!==e);se({op:"chapter-move",chapter:e,after:d===0?null:a[d-1].id})}async function fe(){const e=++ye,i=await de("artifact.read",{});if(B||e!==ye)return!1;const r=i.payload?.content;if(!i.ok||r?.type!=="demo-cut"||!Array.isArray(r.chapters))return Ne(i.error?.message??"No cut is available here."),!1;if(o!==null&&r.version<o.version)return!1;const c=o?.version;return o=r,c!==o.version&&(R=!1),o.chapters.some(d=>d.id===A&&d.startSec>=0)||(A=o.chapters.find(d=>d.startSec>=0)?.id??null),C(),Be(),k!=="options"&&c!==o.version&&ie(),!0}async function se(e,i=o?.version){if(!(!z()||o===null||i===void 0)){O=!0,C();try{const r=await de("version.write",{base:i,ops:[e],summary:`chapter ${o.chapters.findIndex(c=>c.id===e.chapter)+1}`});r.ok?(await fe(),e.op==="chapter-take"&&k!=="options"&&(R=!0,ie({chapter:e.chapter}))):(Ne(r.error?.message??"The chapter could not be saved."),r.error?.code==="head_moved"&&await fe())}finally{O=!1,C()}}}function ot(e){if(!z()||o===null||U!==null)return;U=e.id,oe=e.title,ae=o.version,C();const i=u.querySelector('[data-testid="video-rename-input"]');i?.focus(),i?.select()}function Ut(){const e=o?.chapters.find(r=>r.id===U);if(e===void 0)return U=null,null;const i=document.createElement("input");return i.value=oe,i.maxLength=80,i.setAttribute("aria-label","Chapter title"),i.dataset.testid="video-rename-input",i.oninput=()=>{oe=i.value},i.onkeydown=r=>{r.key==="Escape"?(r.preventDefault(),r.stopPropagation(),U=null,C()):r.key==="Enter"&&(r.preventDefault(),r.stopPropagation(),U=null,i.value.trim()&&!/[\r\n]/.test(i.value)&&i.value!==e.title?se({op:"chapter-rename",chapter:e.id,title:i.value},ae):C())},i}function _e(){if(o===null)return;const e=o.style,i=Se();y.hidden=!nt(i),y.dataset.position=e.captions.position,y.dataset.look=e.captions.style;const r=[];let c="";for(const p of(i?.say??"").split(/\s+/))c&&(c+" "+p).length>e.captions.wrapChars?(r.push(c),c=p):c+=(c?" ":"")+p;c&&r.push(c),y.textContent=r.slice(0,e.captions.maxLines).join(`
24
+ `),y.style.fontSize=`max(9px, ${e.captions.size/19.2}cqw)`,y.style.maxHeight=`${e.captions.maxLines*1.3+.8}em`;const d=Ie(e.theme,J,o.resolvedTheme),a={background:d.background,foreground:d.foreground,accent:d.accent,font:ve(e.theme)==="studio"?o.resolvedTheme?.font??e.theme.font:e.theme.font};for(const[p,f]of Object.entries(a))n.style.setProperty(`--video-${p}`,f)}function at(e,i){const r=Y("",()=>{},`video-trim-${i}`);r.className="trim-handle",r.dataset.edge=i,r.setAttribute("role","slider"),r.setAttribute("aria-label",`${i==="in"?"In":"Out"} trim`);const c=o?.takes[e.id]?.find(a=>a.file===e.take)?.durationSec??e.outSec;r.setAttribute("aria-valuemin","0"),r.setAttribute("aria-valuemax",String(c)),r.setAttribute("aria-valuenow",String(i==="in"?e.inSec:e.outSec));const d=e.durationSec<=0||e.outSec-e.inSec<=0;return r.disabled=!z()||d,r.onpointerdown=a=>{if(!z()||o===null||d)return;a.preventDefault(),a.stopPropagation();const p=o.version,f=a.clientX,g=r.parentElement.getBoundingClientRect().width||1;let S=e.inSec,j=e.outSec;const he=Q=>{const Ce=(Q-f)/g*e.durationSec;i==="in"?S=Math.max(0,Math.min(e.outSec-.5,e.inSec+Ce)):j=Math.max(e.inSec+.5,Math.min(c,e.outSec+Ce)),r.setAttribute("aria-valuenow",(i==="in"?S:j).toFixed(2));const Ee=u.querySelector(`[data-testid="video-${i}"]`);Ee&&(Ee.value=(i==="in"?S:j).toFixed(2))},xe=Q=>he(Q.clientX),we=Q=>{he(Q.clientX),Ae(),(S!==e.inSec||j!==e.outSec)&&se({op:"chapter-trim",chapter:e.id,inSec:S,outSec:j},p)},Ae=()=>{window.removeEventListener("pointermove",xe),window.removeEventListener("pointerup",we),window.removeEventListener("pointercancel",$e)},$e=()=>{Ae(),C()};window.addEventListener("pointermove",xe),window.addEventListener("pointerup",we),window.addEventListener("pointercancel",$e,{once:!0})},r.onkeydown=a=>{if(!z()||d||!["ArrowLeft","ArrowRight"].includes(a.key))return;a.preventDefault(),a.stopPropagation();const p=a.key==="ArrowLeft"?-.1:.1,f=i==="in"?Math.max(0,Math.min(e.outSec-.5,e.inSec+p)):e.inSec,g=i==="out"?Math.max(e.inSec+.5,Math.min(c,e.outSec+p)):e.outSec;(f!==e.inSec||g!==e.outSec)&&se({op:"chapter-trim",chapter:e.id,inSec:f,outSec:g})},r}function zt(){const e=o?.proof,i=t("check-list");if(i.replaceChildren(),t("proof").hidden=e===void 0,e===void 0||o===null)return;t("proof-summary").textContent=`${e.verdict??"Pending"}${e.failedAtSec===null?"":` · Failed at ${e.failedAtSec.toFixed(1)}s`}`;const r=!R&&Number.isFinite(s.duration)&&s.duration>0?s.duration:Math.max(1,...o.chapters.filter(a=>a.startSec>=0).map(a=>a.startSec+Math.max(0,a.durationSec)),...e.checks.map(a=>a.atSec??0),e.failedAtSec??0),c=document.createElement("div");c.className="check-track",c.setAttribute("aria-label","Check timeline");const d=(a,p,f,g)=>{if(a<0||!Number.isFinite(a)||r<=0)return;const S=Y(p==="FAIL"?"✗":p==="PASS"?"✓":"·",()=>{R&&(R=!1,ie("video",a)),s.currentTime=a,s.dispatchEvent(new Event("timeupdate"))},g);S.className="check-mark",S.dataset.state=p,S.dataset.sec=String(a),S.style.left=`${Math.min(100,a/r*100)}%`,S.title=`${a.toFixed(1)}s · ${f}`,S.setAttribute("aria-label",S.title),c.append(S)};for(const a of e.checks){const p=o.chapters.find(S=>S.id===a.chapter)?.title??a.chapter,f=`${a.state} · ${p} · ${a.text}`,g=document.createElement("li");g.dataset.testid="video-check",g.dataset.state=a.state,g.textContent=`${f}${a.atSec===null?"":` · ${a.atSec.toFixed(1)}s`}`,i.append(g),a.atSec!==null&&d(a.atSec,a.state,f,"video-check-mark")}e.failedAtSec!==null&&!e.checks.some(a=>a.state==="FAIL"&&a.atSec===e.failedAtSec)&&d(e.failedAtSec,"FAIL","Failed","video-failure-mark"),b.dataset.proof=String(c.childElementCount>0),b.append(c)}function Dt(){const e=t("review-tab");if(e.hidden=k!=="options"||$!=="sheets",e.hidden||o===null)return;const i=o.review;t("review-line").textContent=i?.line??"This is an edited cut. The take’s own review is on its run.";const r=t("review-findings");r.replaceChildren();for(const d of o.proof?.checks??[]){const a=document.createElement("li");a.dataset.testid="video-finding",a.dataset.state=d.state;const p=o.chapters.find(g=>g.id===d.chapter)?.title,f=d.atSec===null?null:Math.max(0,Math.round(d.atSec));a.textContent=`${f===null?"":`${Math.floor(f/60)}:${String(f%60).padStart(2,"0")} · `}${p===void 0?"":`${p} · `}${d.text}`,r.append(a)}const c=`${o.version}|${(i?.sheets??[]).map(d=>d.name).join(",")}`;tt!==c&&(tt=c,Bt(i?.sheets??[]))}async function Bt(e){const i=++ze,r=t("review-sheets");for(const c of ke)URL.revokeObjectURL(c);if(ke=[],r.replaceChildren(),e.length===0){const c=document.createElement("p");c.className="hint",c.textContent="No contact sheets yet.",r.append(c);return}if(F.includes("media.read"))for(const c of e){const d=document.createElement("figure");d.className="sheet",d.dataset.testid="video-sheet",d.dataset.sheet=c.name;const a=document.createElement("figcaption");a.textContent=c.label,d.append(a),r.append(d);const p=await de("artifact.media",{ref:{sheet:c.name}});if(B||i!==ze)return;const f=p.payload?.blob,g=p.payload?.type;if(!p.ok||!(f instanceof Blob)||typeof g!="string"||!g.startsWith("image/")||typeof URL.createObjectURL!="function"){a.textContent=`${c.label} · not available`;continue}const S=URL.createObjectURL(f);ke.push(S);const j=document.createElement("img");j.src=S,j.alt=c.label,d.prepend(j)}}function C(){const e=document.activeElement,i=u.querySelector('[data-testid="video-rename-input"]');i!==null&&(oe=i.value);const r=e===i,c=i?.selectionStart,d=i?.selectionEnd,a=e?.dataset.chapter,p=e?.dataset.testid;if(n.dataset.surface=k,n.dataset.mode=w,n.dataset.head=String(o?.version??0),n.dataset.current=A??"",t("chapters").hidden=k==="card"||k==="options"&&$!=="chapters",t("work").hidden=k==="options",t("inspectors").hidden=k!=="full"||w!=="advanced",Dt(),b.hidden=k!=="full",v.hidden=k!=="card",l.replaceChildren(),v.replaceChildren(),b.replaceChildren(),u.replaceChildren(),b.dataset.proof="false",o===null)return;if(U!==null){const h=Ut();h!==null&&(u.prepend(h),r&&(h.focus(),h.setSelectionRange(c??null,d??null)))}o.chapters.forEach((h,E)=>{const P=document.createElement("li"),M=Y("",()=>pe(h.id),"video-chapter");M.className="chapter",M.dataset.chapter=h.id,M.disabled=h.startSec<0,M.disabled&&(M.title="Not in this recording");const T=document.createElement("span");T.className="number",T.textContent=String(E+1);const je=document.createElement("span");je.textContent=h.title;const He=document.createElement("span");if(He.className="duration",He.textContent=h.durationSec<0?"—":`${h.durationSec.toFixed(1)}s`,M.append(T,je,He),M.setAttribute("aria-current",String(h.id===A)),M.setAttribute("aria-label",`Chapter ${E+1}: ${h.title}`),h.verdict==="PASS"||h.verdict==="FAIL"){const D=document.createElement("span");D.className="chapter-verdict",D.dataset.verdict=h.verdict,D.textContent=h.verdict==="PASS"?"✓":"✗",D.setAttribute("aria-label",h.verdict),M.append(D)}M.ondblclick=()=>{ue()&&ot(h)},P.draggable=ue()&&z(),P.ondragstart=D=>{H=h.id,D.dataTransfer?.setData("text/plain",h.id)},P.ondragover=D=>{ue()&&z()&&D.preventDefault()},P.ondrop=D=>{if(D.preventDefault(),H===null||H===h.id||!ue())return;const ut=o.chapters.filter(Xe=>Xe.id!==H),pt=ut.findIndex(Xe=>Xe.id===h.id),ft=P.getBoundingClientRect(),qt=D.clientY>=ft.top+ft.height/2?h.id:pt===0?null:ut[pt-1].id;se({op:"chapter-move",chapter:H,after:qt}),H=null},P.ondragend=()=>{H=null},P.append(M),l.append(P);const me=Y(`${E+1} · ${h.title}`,()=>pe(h.id),"video-chip");me.className="chip",me.setAttribute("aria-current",String(h.id===A)),v.append(me),me.disabled=h.startSec<0,me.disabled&&(me.title="Not in this recording");const Le=document.createElement("div");Le.className="segment-box",Le.style.flex=String(h.durationSec<0?1:h.durationSec);const be=Y(`${E+1} · ${h.title}`,()=>pe(h.id),"video-segment");be.className="segment",be.setAttribute("aria-current",String(h.id===A)),Le.append(be),be.disabled=h.startSec<0,be.disabled&&(be.title="Not in this recording"),w==="advanced"&&h.id===A&&Le.append(at(h,"in"),at(h,"out")),b.append(Le)}),zt();const f=Se();t("count").textContent=f===void 0?"No chapters":`${o.chapters.findIndex(h=>h.id===f.id)+1} of ${o.chapters.length}`,t("say").value=f?.say??"";const g=o.style.theme,S=Ie(g,J,o.resolvedTheme),j=ve(g);if(t("theme-summary").textContent=`${j==="studio"?"Studio skin (default)":j==="custom"?"Custom colours":"Preset: "+j}
25
+ ${j==="studio"?o.resolvedTheme?.font??g.font:g.font}
26
+ Background ${S.background}
27
+ Text ${S.foreground}
28
+ Accent ${S.accent}
29
+ Title card: ${g.titleCard.on?g.titleCard.title:"Off"}
30
+ End card: ${g.endCard.on?g.endCard.title:"Off"}`,_e(),a!==void 0&&Array.from(l.querySelectorAll("[data-chapter]")).find(h=>h.dataset.chapter===a)?.focus(),!ue()||k==="card"||f===void 0)return;const he=document.createElement("div");he.className="buttons";const xe=Y("Rename",()=>ot(f),"video-rename"),we=Y("Move up",()=>Ve(f.id,-1),"video-move-up"),Ae=Y("Move down",()=>Ve(f.id,1),"video-move-down");xe.disabled=!z(),we.disabled=!z()||o.chapters[0]?.id===f.id,Ae.disabled=!z()||o.chapters.at(-1)?.id===f.id,he.append(xe,we,Ae),u.append(he);const $e=o.version,Q=document.createElement("div");Q.className="trim-fields";const Ce=(h,E,P)=>{const M=document.createElement("label");M.textContent=h;const T=document.createElement("input");return T.type="number",T.step="0.1",T.min="0",T.value=String(E),T.dataset.testid=P,T.setAttribute("aria-label",h),T.disabled=!z(),T.max=String(o.takes[f.id]?.find(je=>je.file===f.take)?.durationSec??f.outSec),M.append(T),Q.append(M),T},Ee=Ce("In (seconds)",f.inSec,"video-in"),We=Ce("Out (seconds)",f.outSec,"video-out"),ct=()=>{const h=Ee.valueAsNumber,E=We.valueAsNumber;if(!(h===f.inSec&&E===f.outSec)){if(!Number.isFinite(h)||!Number.isFinite(E)||h<0||E-h<.5||E>Number(We.max)){Ne("Keep at least 0.5 seconds within this take.");return}se({op:"chapter-trim",chapter:f.id,inSec:h,outSec:E},$e)}};Ee.onchange=ct,We.onchange=ct,u.append(Q);const dt=o.takes[f.id]??[];if(dt.length>1){const h=document.createElement("label");h.textContent="Take";const E=document.createElement("select");E.setAttribute("aria-label","Take"),E.dataset.testid="video-take",E.disabled=!z(),dt.forEach((P,M)=>{const T=document.createElement("option");T.value=P.file,T.textContent=`Take ${M+1} · ${P.durationSec.toFixed(1)}s`,E.append(T)}),E.value=f.take,E.onchange=()=>{E.value!==f.take&&se({op:"chapter-take",chapter:f.id,take:E.value},$e)},h.append(E),u.append(h),k!=="options"&&u.append(Y("Preview take",()=>{R=!0,ie({chapter:f.id})},"video-preview-take"))}if(p!==void 0&&!p.includes("rename-input")){const h=n.querySelector(`[data-testid="${p}"]`);h&&!h.disabled&&!h.closest("[hidden]")&&h.focus()}}async function Kt(e,i,r){const c=jt.options?.tabs.find(d=>d.id===e)?.controls?.find(d=>d.id===i);if(o===null||c===void 0||!Nt(c,r)||!F.includes("artifact.theme")||typeof r=="string"&&/[\r\n]/.test(r))return{applied:!1,values:o===null?{}:le(o.style,e,J,o.resolvedTheme),reason:"That style change is not available."};if(O)return{applied:!1,values:le(o.style,e,J,o.resolvedTheme),reason:"A cut is being saved."};O=!0,C();try{for(let d=0;d<2;d++){const a=At(o.style,e,i,r),p=await de("theme.set",{base:o.version,tokens:{kind:"video-style",style:a}});if(p.ok){const f=await fe();return{applied:f,values:le(o.style,e,J,o.resolvedTheme),...f?{}:{reason:"The saved style could not be read."}}}if(!(p.error?.code==="head_moved"&&d===0&&await fe()))return Be(),{applied:!1,values:le(o.style,e,J,o.resolvedTheme),reason:p.error?.message??"Style was not changed."}}return{applied:!1,values:le(o.style,e,J,o.resolvedTheme)}}finally{O=!1,C()}}const st=()=>{t("play").textContent=s.paused?"Play":"Pause"};s.onplay=st,s.onpause=st,t("play").onclick=()=>{K!==null&&(s.paused?s.play().catch(()=>Ne("The video isn't available here")):s.pause())},s.onerror=()=>{t("unavailable").hidden=!1},s.ontimeupdate=()=>{if(o===null||R)return;const e=De(s.currentTime);e!==void 0&&e.id!==A&&(A=e.id,C()),y.hidden=!nt(e)},n.onkeydown=e=>{const i=e.target,r=e.metaKey||e.ctrlKey;if(!St(e,n,c=>Re("ui.key",{key:c}))&&!i.closest("input,textarea,select")&&e.key!=="Tab"){if(e.altKey&&!r&&["ArrowUp","ArrowDown"].includes(e.key)&&ue()&&A!==null){e.preventDefault(),Ve(A,e.key==="ArrowUp"?-1:1);return}if(!(r||e.altKey)){if(["ArrowLeft","ArrowRight","Home","End"].includes(e.key)&&o!==null){e.preventDefault();const c=o.chapters.filter(f=>f.startSec>=0),d=c.findIndex(f=>f.id===A),a=e.key==="Home"?0:e.key==="End"?c.length-1:Math.max(0,Math.min(c.length-1,d+(e.key==="ArrowRight"?1:-1))),p=c[a];p&&pe(p.id);return}i.closest("button")&&[" ","Enter"].includes(e.key)||e.key.length===1&&(e.preventDefault(),Re("ui.typed",{grapheme:e.key}))}}};function rt(){B=!0,++ne,++ye,++ze,qe(),q!==null&&(URL.revokeObjectURL(q),q=null);for(const e of ke)URL.revokeObjectURL(e);ke=[];for(const{timer:e,resolve:i}of ce.values())clearTimeout(e),i({ok:!1,error:{code:"unavailable",message:"Editor closed."}});ce.clear(),x?.close(),window.removeEventListener("message",lt)}function lt(e){const i=e.data;if(x!==null||i?.p!==V||i.v!==_||i.type!=="host.hello"||!e.ports[0])return;const r=yt(i.payload),c=i.payload;k=r.surface,w=r.mode??"simple",$=r.tab??"chapters",L=r.protocol,F=Array.isArray(c.grants)?c.grants.filter(d=>typeof d=="string"):[],it(c.theme),x=e.ports[0],W=new xt(x,{surface(d,a){const p=k;k=d,a!==null&&(w=a),C(),p==="options"&&d!=="options"&&ie()},mode(d){return w=d,C(),w},action(d){const a=o?.chapters.filter(S=>S.startSec>=0)??[];if(!["next","prev"].includes(d)||o===null||a.length===0)return{handled:!1};const p=a.findIndex(S=>S.id===A),f=Math.max(0,Math.min(a.length-1,p+(d==="next"?1:-1))),g=a[f];return pe(g.id),{handled:!0,status:`Chapter ${o.chapters.indexOf(g)+1} of ${o.chapters.length} · ${g.title}`}},tab(d){$=d,C()},selection(d){const a=d.find(p=>typeof p=="object"&&p!==null&&["chapter","time"].includes(p.kind));a?.kind==="time"&&typeof a.atSec=="number"?Pt(a.atSec):typeof a?.id=="string"&&pe(a.id,!1)},optionsChanged:Kt}),x.onmessage=d=>{const a=d.data;if(a?.p!==V||a.v!==_)return;if(typeof a.re=="string"){const f=ce.get(a.re);if(f===void 0)return;clearTimeout(f.timer),ce.delete(a.re),f.resolve({ok:a.ok===!0,...a.payload!==void 0?{payload:a.payload}:{},...a.error===void 0?{}:{error:a.error}});return}if(L===2&&W?.dispatch(a))return;const p=a.payload??{};switch(a.type){case"host.ping":a.id&&x?.postMessage({p:V,v:_,re:a.id,ok:!0,payload:{}});break;case"host.size":if(p.size==="inline"||p.size==="pane"||p.size==="full"){const f=k;k=L===1&&p.size==="pane"?"full":Ze(p.size),C(),f==="options"&&k!=="options"&&ie()}break;case"host.theme":it(p.theme),Be(),_e(),C();break;case"artifact.changed":(typeof p.head!="number"||o===null||p.head>o.version)&&fe();break;case"host.teardown":rt();break;case"selection.cleared":A=null,C();break}},x.start(),C(),fe()}window.addEventListener("message",lt),window.addEventListener("pagehide",rt,{once:!0}),C(),kt("wicked-video",Je)}return et(),G.start=et,Object.defineProperty(G,Symbol.toStringTag,{value:"Module"}),G})({});
28
31
  </script></body></html>
@@ -0,0 +1,97 @@
1
+ Copyright 2020 The Inter Project Authors (https://github.com/rsms/inter)
2
+ Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter)
3
+ Wicked Sans A modifications Copyright 2026 The Wicked Agile Project Authors.
4
+
5
+ Wicked Sans A is a Modified Version of the Font Software above, derived from Inter 4.1 (rsms/inter): renamed; alternates frozen; tabular figures by default on the digits; a close mark (U+2715) added; subset. The original declares no Reserved Font Name.
6
+
7
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
8
+ This license is copied below, and is also available with a FAQ at:
9
+ https://scripts.sil.org/OFL
10
+
11
+
12
+ -----------------------------------------------------------
13
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
14
+ -----------------------------------------------------------
15
+
16
+ PREAMBLE
17
+ The goals of the Open Font License (OFL) are to stimulate worldwide
18
+ development of collaborative font projects, to support the font creation
19
+ efforts of academic and linguistic communities, and to provide a free and
20
+ open framework in which fonts may be shared and improved in partnership
21
+ with others.
22
+
23
+ The OFL allows the licensed fonts to be used, studied, modified and
24
+ redistributed freely as long as they are not sold by themselves. The
25
+ fonts, including any derivative works, can be bundled, embedded,
26
+ redistributed and/or sold with any software provided that any reserved
27
+ names are not used by derivative works. The fonts and derivatives,
28
+ however, cannot be released under any other type of license. The
29
+ requirement for fonts to remain under this license does not apply
30
+ to any document created using the fonts or their derivatives.
31
+
32
+ DEFINITIONS
33
+ "Font Software" refers to the set of files released by the Copyright
34
+ Holder(s) under this license and clearly marked as such. This may
35
+ include source files, build scripts and documentation.
36
+
37
+ "Reserved Font Name" refers to any names specified as such after the
38
+ copyright statement(s).
39
+
40
+ "Original Version" refers to the collection of Font Software components as
41
+ distributed by the Copyright Holder(s).
42
+
43
+ "Modified Version" refers to any derivative made by adding to, deleting,
44
+ or substituting -- in part or in whole -- any of the components of the
45
+ Original Version, by changing formats or by porting the Font Software to a
46
+ new environment.
47
+
48
+ "Author" refers to any designer, engineer, programmer, technical
49
+ writer or other person who contributed to the Font Software.
50
+
51
+ PERMISSION & CONDITIONS
52
+ Permission is hereby granted, free of charge, to any person obtaining
53
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
54
+ redistribute, and sell modified and unmodified copies of the Font
55
+ Software, subject to the following conditions:
56
+
57
+ 1) Neither the Font Software nor any of its individual components,
58
+ in Original or Modified Versions, may be sold by itself.
59
+
60
+ 2) Original or Modified Versions of the Font Software may be bundled,
61
+ redistributed and/or sold with any software, provided that each copy
62
+ contains the above copyright notice and this license. These can be
63
+ included either as stand-alone text files, human-readable headers or
64
+ in the appropriate machine-readable metadata fields within text or
65
+ binary files as long as those fields can be easily viewed by the user.
66
+
67
+ 3) No Modified Version of the Font Software may use the Reserved Font
68
+ Name(s) unless explicit written permission is granted by the corresponding
69
+ Copyright Holder. This restriction only applies to the primary font name as
70
+ presented to the users.
71
+
72
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
73
+ Software shall not be used to promote, endorse or advertise any
74
+ Modified Version, except to acknowledge the contribution(s) of the
75
+ Copyright Holder(s) and the Author(s) or with their explicit written
76
+ permission.
77
+
78
+ 5) The Font Software, modified or unmodified, in part or in whole,
79
+ must be distributed entirely under this license, and must not be
80
+ distributed under any other license. The requirement for fonts to
81
+ remain under this license does not apply to any document created
82
+ using the Font Software.
83
+
84
+ TERMINATION
85
+ This license becomes null and void if any of the above conditions are
86
+ not met.
87
+
88
+ DISCLAIMER
89
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
90
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
91
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
92
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
93
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
94
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
95
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
96
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
97
+ OTHER DEALINGS IN THE FONT SOFTWARE.
package/dist/index.html CHANGED
@@ -4,8 +4,9 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>wicked-studio</title>
7
- <script type="module" crossorigin src="/assets/index-u4O_7N-b.js"></script>
8
- <link rel="stylesheet" crossorigin href="/assets/index-BUZ_-Syk.css">
7
+ <link rel="icon" type="image/svg+xml" href="/assets/favicon-BJA6hF2f.svg" />
8
+ <script type="module" crossorigin src="/assets/index-DU_8o4uq.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-CdbCAs7s.css">
9
10
  </head>
10
11
  <body>
11
12
  <div id="root"></div>