wicked-studio 0.16.13 → 0.16.15

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.
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta name="wicked-editor" content="wicked-deck">
6
- <meta name="wicked-editor-version" content="0.16.13">
6
+ <meta name="wicked-editor-version" content="0.16.15">
7
7
  <title>Slides</title>
8
8
  <style>
9
9
  /* The editor's own chrome takes the host's tokens (`host.hello.theme` / `host.theme`), with plain
@@ -97,14 +97,14 @@
97
97
  </style>
98
98
  </head>
99
99
  <body data-size="pane">
100
- <script>var wickedEditor=(function(H){"use strict";var eo=Object.defineProperty;var to=(H,te,Te)=>te in H?eo(H,te,{enumerable:!0,configurable:!0,writable:!0,value:Te}):H[te]=Te;var Ht=(H,te,Te)=>to(H,typeof te!="symbol"?te+"":te,Te);const Jt={card:{interactive:!0,aspect:"16:9",actions:[{id:"prev",label:"Previous slide",verb:"plugin"},{id:"next",label:"Next slide",verb:"plugin",primary:!0},{id:"ask",label:"Ask about this",verb:"host:ask"},{id:"export",label:"Export",verb:"host:export"}]},options:{tabs:[{id:"style",label:"Style",render:"plugin"},{id:"notes",label:"Speaker notes",render:"plugin"}]},full:{}},Vt={"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"}},Gt=new Set(["Escape","Mod+K","Tab","Shift+Tab"]);function pt(t){if(Gt.has(t))return!0;const o=Vt[Zt(t)];return o!==void 0&&o.verb==="navigate"}function Zt(t){const o=/^alt\+(.)$/i.exec(t);return o===null?t:`Alt+${o[1].toUpperCase()}`}const $e="wicked.editor",Le=1,ht=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),Qt=["card","options","full"];function en(t){return t==="inline"?"card":t==="pane"?"options":"full"}function yt(t){return t==="card"?"inline":t==="options"?"pane":"full"}function tn(t){const o=ht(t)?t:{},i=o.size==="inline"||o.size==="full"?o.size:"pane",s=o.protocol===2?2:1,a=s===2&&typeof o.tab=="string"?o.tab:null,l=s===2&&Qt.includes(o.surface)?o.surface:en(i),f=l==="options"&&a===null?"full":l,p=s===2&&(o.mode==="simple"||o.mode==="advanced")?o.mode:null;return{protocol:s,surface:f,tab:a,mode:p,size:i}}function nn(t,o,i){return{editor:t,version:o,protocol:[1,2],surfaces:i}}function on(t,o){const i=document.querySelector('meta[name="wicked-editor-version"]')?.getAttribute("content")??"0.0.0";parent.postMessage({p:$e,v:Le,type:"plugin.ready",payload:nn(t,i,o)},"*")}function mt(t,o,i){const s=t.metaKey||t.ctrlKey;let a=null;if(t.key==="Escape")a="Escape";else if(s&&!t.altKey&&t.key.toLowerCase()==="k")a="Mod+K";else if(t.altKey&&!s&&/^Key[A-Z]$/.test(t.code)&&pt(`Alt+${t.code.slice(3)}`))a=`Alt+${t.code.slice(3)}`;else if(t.key==="Tab"){const l=Array.from(o.querySelectorAll("button, input, select, textarea, [tabindex]")).filter(p=>p.tabIndex>=0&&!p.matches(":disabled")&&p.closest("[hidden]")===null),f=l.indexOf(t.target);(t.shiftKey?f<=0:f===-1||f===l.length-1)&&(a=t.shiftKey?"Shift+Tab":"Tab")}return a===null?!1:(t.preventDefault(),t.stopPropagation(),i(a),!0)}class rn{constructor(o,i){Ht(this,"revs",new Map);this.port=o,this.h=i}reply(o,i){this.port.postMessage({p:$e,v:Le,re:o,ok:!0,payload:i})}refuse(o,i,s){this.port.postMessage({p:$e,v:Le,re:o,ok:!1,error:{code:i,message:s}})}bump(o){const i=(this.revs.get(o)??0)+1;return this.revs.set(o,i),i}values(o,i){this.port.postMessage({p:$e,v:Le,type:"options.values",payload:{tab:o,rev:this.bump(o),values:i}})}height(o){this.port.postMessage({p:$e,v:Le,type:"ui.height",payload:{px:Math.round(o)}})}dispatch(o){const i=ht(o.payload)?o.payload:{},s=typeof o.id=="string"?o.id:null;switch(o.type){case"host.surface":{const a=i.surface;return(a==="card"||a==="options"||a==="full")&&this.h.surface?.(a,i.mode==="simple"||i.mode==="advanced"?i.mode:null),!0}case"host.mode":{if(s===null)return!0;const a=i.mode;return a!=="simple"&&a!=="advanced"?(this.refuse(s,"bad_request","mode is simple or advanced"),!0):(this.reply(s,{mode:this.h.mode?.(a)??a}),!0)}case"host.action":{if(s===null)return!0;const a=i.id;return typeof a!="string"||this.h.action===void 0?(this.reply(s,{handled:!1}),!0):(Promise.resolve(this.h.action(a)).then(l=>this.reply(s,{handled:l.handled===!0,...typeof l.status=="string"?{status:l.status.slice(0,120)}:{}}),()=>this.reply(s,{handled:!1})),!0)}case"host.tab":return typeof i.tab=="string"&&this.h.tab?.(i.tab),!0;case"host.selection":return Array.isArray(i.anchors)&&this.h.selection?.(i.anchors),!0;case"options.changed":{if(s===null)return!0;const a=i.tab,l=i.id;return typeof a!="string"||typeof l!="string"||this.h.optionsChanged===void 0?(this.refuse(s,"unsupported","no controls here"),!0):(Promise.resolve(this.h.optionsChanged(a,l,i.value)).then(f=>this.reply(s,{applied:f.applied,rev:this.bump(a),values:f.values,...f.reason!==void 0?{reason:f.reason.slice(0,120)}:{}}),f=>this.refuse(s,"unavailable",f instanceof Error?f.message.slice(0,120):"failed")),!0)}default:return!1}}}const Be=[{name:"corporate-light",display_name:"Corporate Light",colors:{background:"#FFFFFF",surface:"#F8FAFC",primary:"#1E3A5F",secondary:"#2563EB",accent:"#0891B2",text_primary:"#1E293B",text_secondary:"#64748B",text_muted:"#94A3B8",border:"#E2E8F0"},fonts:{heading:"Calibri",body:"Calibri",mono:"Consolas"}},{name:"midnight-purple",display_name:"Midnight Purple",colors:{background:"#0A0A0F",surface:"#13091D",primary:"#A100FF",secondary:"#6B2FA0",accent:"#F59E0B",text_primary:"#FFFFFF",text_secondary:"#A0A0B0",text_muted:"#6B6B80",border:"#2A2A3D"},fonts:{heading:"Calibri",body:"Calibri",mono:"Consolas"}},{name:"warm-dark",display_name:"Warm Dark",colors:{background:"#1A1A2E",surface:"#16213E",primary:"#FF6B6B",secondary:"#C44569",accent:"#FFD93D",text_primary:"#F8F8F2",text_secondary:"#B0B0C0",text_muted:"#6B6B80",border:"#2D2D44"},fonts:{heading:"Calibri",body:"Calibri",mono:"Consolas"}}],vt=["Inter","Roboto","Source Sans 3","IBM Plex Sans","Calibri","Georgia","system-ui"],sn=[["background","Background"],["surface","Surface"],["primary","Primary"],["accent","Accent"],["text_primary","Text"]],Fe=t=>({name:t.name,colors:{...t.colors},fonts:{...t.fonts}});function ln(t,o){t.replaceChildren(),t.classList.add("plugin-style"),t.onkeydown=h=>{o.key!==void 0&&mt(h,t,o.key)};const i=document.createElement("style");i.textContent=`.plugin-style{padding:16px;box-sizing:border-box;color:var(--ink-high);background:var(--surface-base);font:13px var(--font-sans,system-ui)}
100
+ <script>var wickedEditor=(function(H){"use strict";var oo=Object.defineProperty;var ro=(H,te,Te)=>te in H?oo(H,te,{enumerable:!0,configurable:!0,writable:!0,value:Te}):H[te]=Te;var Jt=(H,te,Te)=>ro(H,typeof te!="symbol"?te+"":te,Te);const Gt={card:{interactive:!0,aspect:"16:9",actions:[{id:"prev",label:"Previous slide",verb:"plugin"},{id:"next",label:"Next slide",verb:"plugin",primary:!0},{id:"ask",label:"Ask about this",verb:"host:ask"},{id:"export",label:"Export",verb:"host:export"}]},options:{tabs:[{id:"style",label:"Style",render:"plugin"},{id:"notes",label:"Speaker notes",render:"plugin"}]},full:{}},Vt={"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"}},Zt=new Set(["Escape","Mod+K","Tab","Shift+Tab"]);function Xe(t){if(Zt.has(t))return!0;const o=Vt[Qt(t)];return o!==void 0&&o.verb==="navigate"}function Qt(t){const o=/^alt\+(.)$/i.exec(t);return o===null?t:`Alt+${o[1].toUpperCase()}`}function en(t){if(t===""||/[\u0000-\u001f\u007f]/.test(t))return!1;const o=Intl.Segmenter;return o!==void 0?Array.from(new o(void 0,{granularity:"grapheme"}).segment(t)).length===1:Array.from(t).length===1}const $e="wicked.editor",Le=1,ht=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),tn=["card","options","full"];function nn(t){return t==="inline"?"card":t==="pane"?"options":"full"}function yt(t){return t==="card"?"inline":t==="options"?"pane":"full"}function on(t){const o=ht(t)?t:{},r=o.size==="inline"||o.size==="full"?o.size:"pane",s=o.protocol===2?2:1,a=s===2&&typeof o.tab=="string"?o.tab:null,l=s===2&&tn.includes(o.surface)?o.surface:nn(r),f=l==="options"&&a===null?"full":l,y=s===2&&(o.mode==="simple"||o.mode==="advanced")?o.mode:null;return{protocol:s,surface:f,tab:a,mode:y,size:r}}function rn(t,o,r){return{editor:t,version:o,protocol:[1,2],surfaces:r}}function sn(t,o){const r=document.querySelector('meta[name="wicked-editor-version"]')?.getAttribute("content")??"0.0.0";parent.postMessage({p:$e,v:Le,type:"plugin.ready",payload:rn(t,r,o)},"*")}function mt(t){return Array.from(t.querySelectorAll("button, a[href], input, select, textarea, summary, [tabindex]")).filter(o=>o.tabIndex>=0&&!o.matches(":disabled")&&o.closest("[hidden]")===null)}function gt(t,o,r){const s=t.metaKey||t.ctrlKey;let a=null;if(t.key==="Escape")a="Escape";else if(s&&!t.altKey&&t.key.toLowerCase()==="k")a="Mod+K";else if(t.altKey&&!s&&/^Key[A-Z]$/.test(t.code)&&Xe(`Alt+${t.code.slice(3)}`))a=`Alt+${t.code.slice(3)}`;else if(t.key==="Tab"){const l=mt(o),f=l.indexOf(t.target);(t.shiftKey?f<=0:f===-1||f===l.length-1)&&(a=t.shiftKey?"Shift+Tab":"Tab")}return a===null?!1:(t.preventDefault(),t.stopPropagation(),r(a),!0)}function ln(t,o,r){if(t.defaultPrevented)return!1;const s=t.target;if(t.key==="Tab"&&!(s instanceof HTMLElement&&mt(o).includes(s)))return!1;if(gt(t,o,l=>r("ui.key",{key:l})))return!0;if(t.metaKey||t.ctrlKey||t.altKey||!en(t.key))return!1;const a=s?.closest("[contenteditable]");return s?.closest("input,textarea,select")||a&&a.getAttribute("contenteditable")!=="false"||t.key===" "&&s?.closest('button,summary,a[href],[role="button"],[tabindex]:not([tabindex="-1"])')?!1:(t.preventDefault(),t.stopPropagation(),r("ui.typed",{grapheme:t.key}),!0)}class an{constructor(o,r){Jt(this,"revs",new Map);this.port=o,this.h=r}reply(o,r){this.port.postMessage({p:$e,v:Le,re:o,ok:!0,payload:r})}refuse(o,r,s){this.port.postMessage({p:$e,v:Le,re:o,ok:!1,error:{code:r,message:s}})}bump(o){const r=(this.revs.get(o)??0)+1;return this.revs.set(o,r),r}values(o,r){this.port.postMessage({p:$e,v:Le,type:"options.values",payload:{tab:o,rev:this.bump(o),values:r}})}height(o){this.port.postMessage({p:$e,v:Le,type:"ui.height",payload:{px:Math.round(o)}})}dispatch(o){const r=ht(o.payload)?o.payload:{},s=typeof o.id=="string"?o.id:null;switch(o.type){case"host.surface":{const a=r.surface;return(a==="card"||a==="options"||a==="full")&&this.h.surface?.(a,r.mode==="simple"||r.mode==="advanced"?r.mode:null),!0}case"host.mode":{if(s===null)return!0;const a=r.mode;return a!=="simple"&&a!=="advanced"?(this.refuse(s,"bad_request","mode is simple or advanced"),!0):(this.reply(s,{mode:this.h.mode?.(a)??a}),!0)}case"host.action":{if(s===null)return!0;const a=r.id;return typeof a!="string"||this.h.action===void 0?(this.reply(s,{handled:!1}),!0):(Promise.resolve(this.h.action(a)).then(l=>this.reply(s,{handled:l.handled===!0,...typeof l.status=="string"?{status:l.status.slice(0,120)}:{}}),()=>this.reply(s,{handled:!1})),!0)}case"host.tab":return typeof r.tab=="string"&&this.h.tab?.(r.tab),!0;case"host.selection":return Array.isArray(r.anchors)&&this.h.selection?.(r.anchors),!0;case"options.changed":{if(s===null)return!0;const a=r.tab,l=r.id;return typeof a!="string"||typeof l!="string"||this.h.optionsChanged===void 0?(this.refuse(s,"unsupported","no controls here"),!0):(Promise.resolve(this.h.optionsChanged(a,l,r.value)).then(f=>this.reply(s,{applied:f.applied,rev:this.bump(a),values:f.values,...f.reason!==void 0?{reason:f.reason.slice(0,120)}:{}}),f=>this.refuse(s,"unavailable",f instanceof Error?f.message.slice(0,120):"failed")),!0)}default:return!1}}}const Be=[{name:"corporate-light",display_name:"Corporate Light",colors:{background:"#FFFFFF",surface:"#F8FAFC",primary:"#1E3A5F",secondary:"#2563EB",accent:"#0891B2",text_primary:"#1E293B",text_secondary:"#64748B",text_muted:"#94A3B8",border:"#E2E8F0"},fonts:{heading:"Calibri",body:"Calibri",mono:"Consolas"}},{name:"midnight-purple",display_name:"Midnight Purple",colors:{background:"#0A0A0F",surface:"#13091D",primary:"#A100FF",secondary:"#6B2FA0",accent:"#F59E0B",text_primary:"#FFFFFF",text_secondary:"#A0A0B0",text_muted:"#6B6B80",border:"#2A2A3D"},fonts:{heading:"Calibri",body:"Calibri",mono:"Consolas"}},{name:"warm-dark",display_name:"Warm Dark",colors:{background:"#1A1A2E",surface:"#16213E",primary:"#FF6B6B",secondary:"#C44569",accent:"#FFD93D",text_primary:"#F8F8F2",text_secondary:"#B0B0C0",text_muted:"#6B6B80",border:"#2D2D44"},fonts:{heading:"Calibri",body:"Calibri",mono:"Consolas"}}],bt=["Inter","Roboto","Source Sans 3","IBM Plex Sans","Calibri","Georgia","system-ui"],cn=[["background","Background"],["surface","Surface"],["primary","Primary"],["accent","Accent"],["text_primary","Text"]],Fe=t=>({name:t.name,colors:{...t.colors},fonts:{...t.fonts}});function dn(t,o){t.replaceChildren(),t.classList.add("plugin-style"),t.tabIndex=-1,t.onkeydown=p=>{ln(p,t,(h,A)=>{"key"in A?o.key?.(A.key):o.typed?.(A.grapheme)})};const r=document.createElement("style");r.textContent=`.plugin-style{padding:16px;box-sizing:border-box;color:var(--ink-high);background:var(--surface-base);font:13px var(--font-sans,system-ui)}
101
101
  .plugin-style h2{font-size:16px;margin:0 0 12px}.plugin-style .theme-cards{display:grid;gap:8px;margin-bottom:18px}
102
102
  .plugin-style button,.plugin-style input,.plugin-style select{font:inherit;color:var(--ink-high);background:var(--surface-card);border:1px solid var(--border);border-radius:4px}
103
103
  .plugin-style button{padding:8px;text-align:left;cursor:pointer}.plugin-style button:focus-visible,.plugin-style input:focus-visible,.plugin-style select:focus-visible{outline:2px solid var(--accent)}
104
104
  .plugin-style .ps-swatches{display:flex;width:100%;height:16px;margin-bottom:6px;border:1px solid var(--border)}.plugin-style .ps-swatches span{flex:1}
105
105
  .plugin-style label{display:flex;align-items:center;gap:8px;margin:10px 0}.plugin-style label>span:first-child{flex:1}.plugin-style input[type=color]{width:36px;height:30px;padding:2px}.plugin-style input[type=text]{width:80px;padding:5px}.plugin-style select{max-width:170px;padding:5px}
106
- .plugin-style p{line-height:1.5;color:var(--ink-body)}.plugin-style [role=status]{min-height:1.5em}.plugin-style :disabled{opacity:.6;cursor:default}`,t.append(i);const s=document.createElement("h2");s.textContent="Style",t.append(s);const a=document.createElement("div");a.className="theme-cards",t.append(a);const l=document.createElement("p");l.setAttribute("role","status"),l.setAttribute("aria-live","polite");let f=!1;const p=[],x=()=>Fe(o.tokens()??Be[0]),$=[],b=[],L=()=>{const h=x();for(const{key:y,picker:A,hex:D}of $)D.value=h.colors[y],A.value=/^#[0-9a-f]{6}$/i.test(h.colors[y])?h.colors[y]:"";for(const{key:y,select:A}of b)A.value=vt.includes(h.fonts[y])?h.fonts[y]:"system-ui";for(const y of Array.from(a.querySelectorAll("button")))y.setAttribute("aria-pressed",String(y.dataset.theme===h.name))},B=async h=>{if(!f){f=!0,p.forEach(y=>{y.disabled=!0}),l.textContent="Applying theme…";try{const y=await o.apply(h);l.textContent=y.ok?"Theme applied.":`Theme was not applied: ${y.reason}`}catch(y){l.textContent=`Theme was not applied: ${y instanceof Error?y.message:"unavailable"}`}finally{f=!1,p.forEach(y=>{y.disabled=!1}),L()}}};for(const h of Be){const y=document.createElement("button");y.type="button",y.dataset.theme=h.name;const A=document.createElement("span");A.className="ps-swatches",A.setAttribute("aria-hidden","true");for(const m of["background","surface","primary","secondary","accent"]){const S=document.createElement("span");S.style.backgroundColor=h.colors[m],A.append(S)}const D=document.createElement("span");D.textContent=h.display_name,y.append(A,D),y.addEventListener("click",()=>{B(Fe(h))}),a.append(y),p.push(y)}for(const[h,y]of sn){const A=document.createElement("label"),D=document.createElement("span");D.textContent=y;const m=document.createElement("input");m.type="color",m.setAttribute("aria-label",y);const S=document.createElement("input");S.type="text",S.maxLength=7,S.setAttribute("aria-label",`${y} hex`);const Z=ge=>{if(!/^#[0-9a-f]{6}$/i.test(ge)){l.textContent="Enter a six-digit hex colour: a # and six digits or letters a to f.",L();return}const de=x();de.name="custom",de.colors[h]=ge,B(de)};m.addEventListener("change",()=>Z(m.value)),S.addEventListener("change",()=>Z(S.value)),A.append(D,m,S),t.append(A),p.push(m,S),$.push({key:h,picker:m,hex:S})}for(const h of["heading","body"]){const y=document.createElement("label"),A=document.createElement("span");A.textContent=h==="heading"?"Heading font":"Body font";const D=document.createElement("select");D.setAttribute("aria-label",A.textContent);for(const m of vt){const S=document.createElement("option");S.value=m,S.textContent=m,D.append(S)}D.addEventListener("change",()=>{const m=x();m.name="custom",m.fonts[h]=D.value,B(m)}),y.append(A,D),t.append(y),p.push(D),b.push({key:h,select:D})}const P=document.createElement("p");return P.textContent="Match a website or a PDF: the host's Match button under this tab",t.append(P,l),L(),{refresh:L}}function an(t){const o=new DOMParser().parseFromString(t,"text/html"),i=Array.from(o.querySelectorAll("style")).map(p=>p.textContent??"").join(`
107
- `),s=new Map;for(const p of i.matchAll(/(--wi-[a-z-]+)\s*:\s*([^;}{]+)/gi))s.set(p[1].toLowerCase(),p[2].trim());if(s.size===0)return null;const a=Fe(Be[0]),l={background:"--wi-bg",surface:"--wi-surface",primary:"--wi-primary",secondary:"--wi-secondary",accent:"--wi-accent",text_primary:"--wi-text",text_secondary:"--wi-text-secondary",text_muted:"--wi-muted",border:"--wi-border"};for(const p of Object.keys(l)){const x=s.get(l[p]);x!==void 0&&/^(#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})|(?:rgb|hsl)a?\([0-9.,%\s]+\))$/i.test(x)&&(a.colors[p]=x)}for(const p of["heading","body","mono"]){const x=s.get(`--wi-font-${p}`);x!==void 0&&(a.fonts[p]=x.split(",")[0].trim().replace(/^['"]|['"]$/g,""))}const f=Be.find(p=>JSON.stringify(p.colors)===JSON.stringify(a.colors)&&JSON.stringify(p.fonts)===JSON.stringify(a.fonts));return a.name=f?.name??"custom",a}const Xe="section, [data-slide], .slide",cn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]),qe="aside[data-notes-for]",bt=80,gt=t=>{const o=t.tagName.toLowerCase();return!cn.has(o)&&!(o==="aside"&&t.hasAttribute("data-notes-for"))};function wt(t){return Array.from(t.querySelectorAll(Xe)).filter(o=>{if(!gt(o)||o.closest(qe)!==null)return!1;for(let i=o.parentElement;i!==null;i=i.parentElement)if(i.matches(Xe)&&gt(i))return!1;return!0})}const Ye=t=>t.replace(/\s+/g," ").trim(),dn=t=>t.length>bt?`${t.slice(0,bt-1).trimEnd()}…`:t;function un(t){const o=Array.from(t.querySelectorAll(qe)).find(i=>i.parentElement?.closest(Xe)===t);return o===void 0?"":(o.textContent??"").trim()}function fn(t){const o=t.cloneNode(!0);for(const i of Array.from(o.querySelectorAll(qe)))i.remove();for(const i of Array.from(o.querySelectorAll("h1,h2,h3,h4,h5,h6,p,li,td,th,div,section,figcaption,blockquote,br")))i.append(" ");return Ye(o.textContent??"")}function pn(t){const o=new DOMParser().parseFromString(t,"text/html");return wt(o).map((i,s)=>{const a=Array.from(i.querySelectorAll("h1,h2,h3,h4,h5,h6")).find(f=>f.closest(qe)===null&&Ye(f.textContent??"")!==""),l=fn(i);return{id:i.getAttribute("data-slide-id"),wid:i.getAttribute("data-wid"),n:s+1,title:dn(a!==void 0?Ye(a.textContent??""):l),notes:un(i),text:l}})}function hn(t,o,i){return{left:t.left-(i.scrollX-o.scrollX),top:t.top-(i.scrollY-o.scrollY),width:t.width,height:t.height}}const yn=/^[A-Za-z0-9_.:-]{1,100}$/;function K(t){return typeof t=="number"&&isFinite(t)}function mn(t){if(typeof t!="object"||t===null)return!1;const o=t;return o.section!==void 0&&(typeof o.section!="string"||!yn.test(o.section))?!1:typeof o.text=="string"&&typeof o.composite=="boolean"}function vn(t){if(typeof t!="object"||t===null)return!1;const o=t;return K(o.x)&&K(o.y)&&K(o.width)&&K(o.height)&&K(o.top)&&K(o.left)&&K(o.right)&&K(o.bottom)}function bn(t){if(typeof t!="object"||t===null)return null;const o=t;if(o.v!==1)return null;const i=o.type;if(i==="wid-inventory"){const s=o.widMap,a=o.scrollX,l=o.scrollY;if(typeof s!="object"||s===null||!K(a)||!K(l))return null;const f={};for(const[$,b]of Object.entries(s)){if(!vn(b))return null;f[$]=b}const p=o.blocks;if(p===void 0)return{v:1,type:"wid-inventory",widMap:f,scrollX:a,scrollY:l};if(typeof p!="object"||p===null)return null;const x={};for(const[$,b]of Object.entries(p)){if(!mn(b))return null;x[$]={text:b.text,composite:b.composite,...b.cut===!0?{cut:!0}:{},...b.section!==void 0?{section:b.section}:{}}}return{v:1,type:"wid-inventory",widMap:f,scrollX:a,scrollY:l,blocks:x}}if(i==="scroll-state"){const s=o.scrollX,a=o.scrollY;return!K(s)||!K(a)?null:{v:1,type:"scroll-state",scrollX:s,scrollY:a}}if(i==="scroll-ack"){const s=o.wid;if(typeof s!="string"||s==="")return null;const a=o.scrollX,l=o.scrollY,f=o.seq;return{v:1,type:"scroll-ack",wid:s,...K(a)&&K(l)?{scrollX:a,scrollY:l}:{},...typeof f=="number"&&Number.isInteger(f)&&f>0?{seq:f}:{}}}if(i==="wid-click"){const s=o.wid;return typeof s!="string"||s===""?null:{v:1,type:"wid-click",wid:s}}if(i==="wid-hover"){const s=o.wid;return s!==null&&(typeof s!="string"||s==="")?null:{v:1,type:"wid-hover",wid:s}}return null}const gn=Object.freeze({v:1,type:"request-inventory"}),wn="request-inventory";function kn(t){return t.includes(wn)}const xn=`
106
+ .plugin-style p{line-height:1.5;color:var(--ink-body)}.plugin-style [role=status]{min-height:1.5em}.plugin-style :disabled{opacity:.6;cursor:default}`,t.append(r);const s=document.createElement("h2");s.textContent="Style",t.append(s);const a=document.createElement("div");a.className="theme-cards",t.append(a);const l=document.createElement("p");l.setAttribute("role","status"),l.setAttribute("aria-live","polite");let f=!1;const y=[],x=()=>Fe(o.tokens()??Be[0]),$=[],b=[],L=()=>{const p=x();for(const{key:h,picker:A,hex:D}of $)D.value=p.colors[h],A.value=/^#[0-9a-f]{6}$/i.test(p.colors[h])?p.colors[h]:"";for(const{key:h,select:A}of b)A.value=bt.includes(p.fonts[h])?p.fonts[h]:"system-ui";for(const h of Array.from(a.querySelectorAll("button")))h.setAttribute("aria-pressed",String(h.dataset.theme===p.name))},B=async p=>{if(!f){f=!0,y.forEach(h=>{h.disabled=!0}),l.textContent="Applying theme…";try{const h=await o.apply(p);l.textContent=h.ok?"Theme applied.":`Theme was not applied: ${h.reason}`}catch(h){l.textContent=`Theme was not applied: ${h instanceof Error?h.message:"unavailable"}`}finally{f=!1,y.forEach(h=>{h.disabled=!1}),L()}}};for(const p of Be){const h=document.createElement("button");h.type="button",h.dataset.theme=p.name;const A=document.createElement("span");A.className="ps-swatches",A.setAttribute("aria-hidden","true");for(const m of["background","surface","primary","secondary","accent"]){const S=document.createElement("span");S.style.backgroundColor=p.colors[m],A.append(S)}const D=document.createElement("span");D.textContent=p.display_name,h.append(A,D),h.addEventListener("click",()=>{B(Fe(p))}),a.append(h),y.push(h)}for(const[p,h]of cn){const A=document.createElement("label"),D=document.createElement("span");D.textContent=h;const m=document.createElement("input");m.type="color",m.setAttribute("aria-label",h);const S=document.createElement("input");S.type="text",S.maxLength=7,S.setAttribute("aria-label",`${h} hex`);const Z=ve=>{if(!/^#[0-9a-f]{6}$/i.test(ve)){l.textContent="Enter a six-digit hex colour: a # and six digits or letters a to f.",L();return}const de=x();de.name="custom",de.colors[p]=ve,B(de)};m.addEventListener("change",()=>Z(m.value)),S.addEventListener("change",()=>Z(S.value)),A.append(D,m,S),t.append(A),y.push(m,S),$.push({key:p,picker:m,hex:S})}for(const p of["heading","body"]){const h=document.createElement("label"),A=document.createElement("span");A.textContent=p==="heading"?"Heading font":"Body font";const D=document.createElement("select");D.setAttribute("aria-label",A.textContent);for(const m of bt){const S=document.createElement("option");S.value=m,S.textContent=m,D.append(S)}D.addEventListener("change",()=>{const m=x();m.name="custom",m.fonts[p]=D.value,B(m)}),h.append(A,D),t.append(h),y.push(D),b.push({key:p,select:D})}const q=document.createElement("p");return q.textContent="Match a website or a PDF: the host's Match button under this tab",t.append(q,l),L(),{refresh:L}}function un(t){const o=new DOMParser().parseFromString(t,"text/html"),r=Array.from(o.querySelectorAll("style")).map(y=>y.textContent??"").join(`
107
+ `),s=new Map;for(const y of r.matchAll(/(--wi-[a-z-]+)\s*:\s*([^;}{]+)/gi))s.set(y[1].toLowerCase(),y[2].trim());if(s.size===0)return null;const a=Fe(Be[0]),l={background:"--wi-bg",surface:"--wi-surface",primary:"--wi-primary",secondary:"--wi-secondary",accent:"--wi-accent",text_primary:"--wi-text",text_secondary:"--wi-text-secondary",text_muted:"--wi-muted",border:"--wi-border"};for(const y of Object.keys(l)){const x=s.get(l[y]);x!==void 0&&/^(#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})|(?:rgb|hsl)a?\([0-9.,%\s]+\))$/i.test(x)&&(a.colors[y]=x)}for(const y of["heading","body","mono"]){const x=s.get(`--wi-font-${y}`);x!==void 0&&(a.fonts[y]=x.split(",")[0].trim().replace(/^['"]|['"]$/g,""))}const f=Be.find(y=>JSON.stringify(y.colors)===JSON.stringify(a.colors)&&JSON.stringify(y.fonts)===JSON.stringify(a.fonts));return a.name=f?.name??"custom",a}const Ye="section, [data-slide], .slide",fn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]),Ke="aside[data-notes-for]",vt=80,wt=t=>{const o=t.tagName.toLowerCase();return!fn.has(o)&&!(o==="aside"&&t.hasAttribute("data-notes-for"))};function kt(t){return Array.from(t.querySelectorAll(Ye)).filter(o=>{if(!wt(o)||o.closest(Ke)!==null)return!1;for(let r=o.parentElement;r!==null;r=r.parentElement)if(r.matches(Ye)&&wt(r))return!1;return!0})}const We=t=>t.replace(/\s+/g," ").trim(),pn=t=>t.length>vt?`${t.slice(0,vt-1).trimEnd()}…`:t;function hn(t){const o=Array.from(t.querySelectorAll(Ke)).find(r=>r.parentElement?.closest(Ye)===t);return o===void 0?"":(o.textContent??"").trim()}function yn(t){const o=t.cloneNode(!0);for(const r of Array.from(o.querySelectorAll(Ke)))r.remove();for(const r of Array.from(o.querySelectorAll("h1,h2,h3,h4,h5,h6,p,li,td,th,div,section,figcaption,blockquote,br")))r.append(" ");return We(o.textContent??"")}function mn(t){const o=new DOMParser().parseFromString(t,"text/html");return kt(o).map((r,s)=>{const a=Array.from(r.querySelectorAll("h1,h2,h3,h4,h5,h6")).find(f=>f.closest(Ke)===null&&We(f.textContent??"")!==""),l=yn(r);return{id:r.getAttribute("data-slide-id"),wid:r.getAttribute("data-wid"),n:s+1,title:pn(a!==void 0?We(a.textContent??""):l),notes:hn(r),text:l}})}function gn(t,o,r){return{left:t.left-(r.scrollX-o.scrollX),top:t.top-(r.scrollY-o.scrollY),width:t.width,height:t.height}}const bn=/^[A-Za-z0-9_.:-]{1,100}$/;function I(t){return typeof t=="number"&&isFinite(t)}function vn(t){if(typeof t!="object"||t===null)return!1;const o=t;return o.section!==void 0&&(typeof o.section!="string"||!bn.test(o.section))?!1:typeof o.text=="string"&&typeof o.composite=="boolean"}function wn(t){if(typeof t!="object"||t===null)return!1;const o=t;return I(o.x)&&I(o.y)&&I(o.width)&&I(o.height)&&I(o.top)&&I(o.left)&&I(o.right)&&I(o.bottom)}function kn(t){if(typeof t!="object"||t===null)return null;const o=t;if(o.v!==1)return null;const r=o.type;if(r==="wid-inventory"){const s=o.widMap,a=o.scrollX,l=o.scrollY;if(typeof s!="object"||s===null||!I(a)||!I(l))return null;const f={};for(const[$,b]of Object.entries(s)){if(!wn(b))return null;f[$]=b}const y=o.blocks;if(y===void 0)return{v:1,type:"wid-inventory",widMap:f,scrollX:a,scrollY:l};if(typeof y!="object"||y===null)return null;const x={};for(const[$,b]of Object.entries(y)){if(!vn(b))return null;x[$]={text:b.text,composite:b.composite,...b.cut===!0?{cut:!0}:{},...b.section!==void 0?{section:b.section}:{}}}return{v:1,type:"wid-inventory",widMap:f,scrollX:a,scrollY:l,blocks:x}}if(r==="scroll-state"){const s=o.scrollX,a=o.scrollY;return!I(s)||!I(a)?null:{v:1,type:"scroll-state",scrollX:s,scrollY:a}}if(r==="scroll-ack"){const s=o.wid;if(typeof s!="string"||s==="")return null;const a=o.scrollX,l=o.scrollY,f=o.seq;return{v:1,type:"scroll-ack",wid:s,...I(a)&&I(l)?{scrollX:a,scrollY:l}:{},...typeof f=="number"&&Number.isInteger(f)&&f>0?{seq:f}:{}}}if(r==="wid-click"){const s=o.wid;return typeof s!="string"||s===""?null:{v:1,type:"wid-click",wid:s}}if(r==="wid-hover"){const s=o.wid;return s!==null&&(typeof s!="string"||s==="")?null:{v:1,type:"wid-hover",wid:s}}return null}const xn=Object.freeze({v:1,type:"request-inventory"}),An="request-inventory";function En(t){return t.includes(An)}const Sn=`
108
108
  (function () {
109
109
  if (window.__wickedInstrumentBridge) return;
110
110
  window.__wickedInstrumentBridge = 1;
@@ -182,11 +182,11 @@
182
182
  post(inventory());
183
183
  }
184
184
  })();
185
- `;function En(t){const o=`<script>${xn}<\/script>`;return/<\/body>/i.test(t)?t.replace(/<\/body>/i,()=>`${o}</body>`):`${t}${o}`}const An=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),J=(t,o)=>t>>>o|t<<32-o;function kt(t){const o=new TextEncoder().encode(t),i=o.length*8,s=new Uint8Array(Math.ceil((o.length+9)/64)*64);s.set(o),s[o.length]=128;const a=new DataView(s.buffer);a.setUint32(s.length-8,Math.floor(i/4294967296)),a.setUint32(s.length-4,i>>>0);const l=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),f=new Uint32Array(64);for(let $=0;$<s.length;$+=64){for(let m=0;m<16;m++)f[m]=a.getUint32($+m*4);for(let m=16;m<64;m++){const S=J(f[m-15],7)^J(f[m-15],18)^f[m-15]>>>3,Z=J(f[m-2],17)^J(f[m-2],19)^f[m-2]>>>10;f[m]=f[m-16]+S+f[m-7]+Z>>>0}let[b,L,B,P,h,y,A,D]=[l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7]];for(let m=0;m<64;m++){const S=D+(J(h,6)^J(h,11)^J(h,25))+(h&y^~h&A)+An[m]+f[m]>>>0,Z=(J(b,2)^J(b,13)^J(b,22))+(b&L^b&B^L&B)>>>0;D=A,A=y,y=h,h=P+S>>>0,P=B,B=L,L=b,b=S+Z>>>0}l[0]=l[0]+b>>>0,l[1]=l[1]+L>>>0,l[2]=l[2]+B>>>0,l[3]=l[3]+P>>>0,l[4]=l[4]+h>>>0,l[5]=l[5]+y>>>0,l[6]=l[6]+A>>>0,l[7]=l[7]+D>>>0}const p=new DataView(new ArrayBuffer(32));l.forEach(($,b)=>p.setUint32(b*4,$));let x="";for(let $=0;$<32;$++)x+=String.fromCharCode(p.getUint8($));return btoa(x)}const xt="WebRTC is not available in an editor frame",Sn=["RTCPeerConnection","webkitRTCPeerConnection","mozRTCPeerConnection","RTCDataChannel","RTCIceTransport","RTCDtlsTransport","RTCSctpTransport","RTCRtpSender","RTCRtpReceiver","RTCRtpTransceiver","RTCIceCandidate","RTCSessionDescription","RTCCertificate"],We='(function(w,o){if(typeof w!=="object"||w===null||w.window!==w)throw '+JSON.stringify(xt)+";var n="+JSON.stringify(Sn)+",k=o.getOwnPropertyNames(w),i,d;for(i=0;i!==k.length;i++)if(/^(webkit|moz)?RTC/.test(k[i])&&(d=o.getOwnPropertyDescriptor(w,k[i]))&&d.configurable)n.push(k[i]);for(i=0;i!==n.length;i++){o.defineProperty(w,n[i],{value:void 0,writable:false,configurable:false});if(w[n[i]]!==void 0)throw "+JSON.stringify(xt)+`}})(window,({}).constructor);
186
- `,De=/[\n\r\u2028\u2029]/,Et=/\s/,At=/[\w$\\\u0080-\uFFFF]/;function Cn(t,o){if(o>=t.length)return!0;const i=t[o];if(i==='"'||i==="'"||i==="{"||i==="~"||/[0-9]/.test(i))return!0;if(i==="!")return t[o+1]!=="=";if(i===".")return/[0-9]/.test(t[o+1]??"");if(i==="\\")return!0;if(i==="+"||i==="-")return t[o+1]===i;if(!At.test(i))return!1;let s=o;for(;s<t.length&&At.test(t[s])&&!Et.test(t[s]);)s++;const a=t.slice(o,s);return a!=="in"&&a!=="instanceof"}function Tn(t){const o=t.length;let i=0,s=0,a=!1,l=!1;if(t.startsWith("#!")){for(;i<o&&!De.test(t[i]);)i++;s=i,a=!0}let f=!1,p=!0,x=!0;const $=()=>{for(;;){for(;i<o&&Et.test(t[i]);)De.test(t[i])&&(f=!0,p=!0),i++;if(x&&p&&t.startsWith("-->",i)){for(;i<o&&!De.test(t[i]);)i++;continue}if(t.startsWith("/*",i)){const b=t.indexOf("*/",i+2);if(b<0)return!1;De.test(t.slice(i,b))&&(f=!0,p=!0),i=b+2}else if(t.startsWith("//",i)||x&&t.startsWith("<!--",i))for(;i<o&&!De.test(t[i]);)i++;else return!0}};for(;$();){const b=t[i];if(b!=='"'&&b!=="'")break;x=!1;let L=i+1,B=!1;for(;L<o;){const h=t[L];if(h==="\\"){L+=2;continue}if(h===b){B=!0,L+=1;break}if(h===`
187
- `||h==="\r")break;L+=1}if(!B)break;p=!1;const P=L;if(i=L,f=!1,!$())break;if(t[i]===";")i+=1,p=!1,s=i,l=!1;else if(t.startsWith("<!--",i)){s=P,l=!0,a=!1;break}else if((f||i>=o)&&Cn(t,i))s=P,l=!0;else break;a=!1}return{at:s,afterHashbang:a,semicolon:l}}function $n(t){const{at:o,afterHashbang:i,semicolon:s}=Tn(t);return t.slice(0,o)+(s?";":"")+(i?`
188
- `:"")+We+t.slice(o)}const Ln=new Set(["application/ecmascript","application/javascript","application/x-ecmascript","application/x-javascript","text/ecmascript","text/javascript","text/javascript1.0","text/javascript1.1","text/javascript1.2","text/javascript1.3","text/javascript1.4","text/javascript1.5","text/jscript","text/livescript","text/x-ecmascript","text/x-javascript"]),St="http://www.w3.org/2000/svg",Ct="http://www.w3.org/1999/xhtml";function Dn(t){if(t.namespaceURI===St?t.hasAttribute("href")||t.hasAttribute("xlink:href"):t.hasAttribute("src"))return!1;const o=t.namespaceURI===St?null:t.getAttribute("language"),i=t.hasAttribute("type")?t.getAttribute("type"):o!==null&&o!==""?`text/${o}`:"";return i===""||i.toLowerCase()==="module"?!0:Ln.has(i.replace(/^[\t\n\f\r ]+|[\t\n\f\r ]+$/g,"").toLowerCase())}function Tt(t){const o=Array.from(t.querySelectorAll("script"));for(const i of Array.from(t.querySelectorAll("template")))i.namespaceURI===Ct&&o.push(...Tt(i.content));return o}function $t(t){const o=Array.from(t.querySelectorAll("meta[http-equiv]")).filter(i=>i.getAttribute("http-equiv").trim().toLowerCase()==="content-security-policy");for(const i of Array.from(t.querySelectorAll("template")))i.namespaceURI===Ct&&o.push(...$t(i.content));return o}function Mn(t){return t.doctype===null?"":new XMLSerializer().serializeToString(t.doctype)}function On(t){const o=new DOMParser().parseFromString(t,"text/html"),i=new Set([kt(We)]);for(const f of Tt(o)){if(!Dn(f))continue;const p=$n((f.textContent??"").replace(/\r\n?/g,`
189
- `));f.textContent=p,i.add(kt(p))}for(const f of $t(o)){const p=(f.getAttribute("content")??"").split(";").map(x=>x.trim()).filter(x=>x!==""&&!/^script-src(-elem|-attr)?(\s|$)/i.test(x));f.setAttribute("content",[...p,"script-src 'unsafe-inline'"].join("; "))}const s=o.createElement("meta");s.setAttribute("http-equiv","Content-Security-Policy"),s.setAttribute("content",`script-src ${[...i].map(f=>`'sha256-${f}'`).join(" ")}; frame-src 'none'; child-src 'none'; worker-src 'none'; object-src 'none'`);const a=o.createElement("meta");a.setAttribute("http-equiv","Content-Security-Policy"),a.setAttribute("content","script-src 'unsafe-inline'");const l=o.createElement("script");return l.textContent=We,o.head.prepend(s,a,l),`${Mn(o)}${o.documentElement.outerHTML}`}const Me="wicked.editor",Ne=1,Rn="wicked-deck",ne=1280,oe=720,Bn=[0,250,750,1500],Fn=1500,qn=`
185
+ `;function Cn(t){const o=`<script>${Sn}<\/script>`;return/<\/body>/i.test(t)?t.replace(/<\/body>/i,()=>`${o}</body>`):`${t}${o}`}const Tn=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),J=(t,o)=>t>>>o|t<<32-o;function xt(t){const o=new TextEncoder().encode(t),r=o.length*8,s=new Uint8Array(Math.ceil((o.length+9)/64)*64);s.set(o),s[o.length]=128;const a=new DataView(s.buffer);a.setUint32(s.length-8,Math.floor(r/4294967296)),a.setUint32(s.length-4,r>>>0);const l=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),f=new Uint32Array(64);for(let $=0;$<s.length;$+=64){for(let m=0;m<16;m++)f[m]=a.getUint32($+m*4);for(let m=16;m<64;m++){const S=J(f[m-15],7)^J(f[m-15],18)^f[m-15]>>>3,Z=J(f[m-2],17)^J(f[m-2],19)^f[m-2]>>>10;f[m]=f[m-16]+S+f[m-7]+Z>>>0}let[b,L,B,q,p,h,A,D]=[l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7]];for(let m=0;m<64;m++){const S=D+(J(p,6)^J(p,11)^J(p,25))+(p&h^~p&A)+Tn[m]+f[m]>>>0,Z=(J(b,2)^J(b,13)^J(b,22))+(b&L^b&B^L&B)>>>0;D=A,A=h,h=p,p=q+S>>>0,q=B,B=L,L=b,b=S+Z>>>0}l[0]=l[0]+b>>>0,l[1]=l[1]+L>>>0,l[2]=l[2]+B>>>0,l[3]=l[3]+q>>>0,l[4]=l[4]+p>>>0,l[5]=l[5]+h>>>0,l[6]=l[6]+A>>>0,l[7]=l[7]+D>>>0}const y=new DataView(new ArrayBuffer(32));l.forEach(($,b)=>y.setUint32(b*4,$));let x="";for(let $=0;$<32;$++)x+=String.fromCharCode(y.getUint8($));return btoa(x)}const At="WebRTC is not available in an editor frame",$n=["RTCPeerConnection","webkitRTCPeerConnection","mozRTCPeerConnection","RTCDataChannel","RTCIceTransport","RTCDtlsTransport","RTCSctpTransport","RTCRtpSender","RTCRtpReceiver","RTCRtpTransceiver","RTCIceCandidate","RTCSessionDescription","RTCCertificate"],He='(function(w,o){if(typeof w!=="object"||w===null||w.window!==w)throw '+JSON.stringify(At)+";var n="+JSON.stringify($n)+",k=o.getOwnPropertyNames(w),i,d;for(i=0;i!==k.length;i++)if(/^(webkit|moz)?RTC/.test(k[i])&&(d=o.getOwnPropertyDescriptor(w,k[i]))&&d.configurable)n.push(k[i]);for(i=0;i!==n.length;i++){o.defineProperty(w,n[i],{value:void 0,writable:false,configurable:false});if(w[n[i]]!==void 0)throw "+JSON.stringify(At)+`}})(window,({}).constructor);
186
+ `,De=/[\n\r\u2028\u2029]/,Et=/\s/,St=/[\w$\\\u0080-\uFFFF]/;function Ln(t,o){if(o>=t.length)return!0;const r=t[o];if(r==='"'||r==="'"||r==="{"||r==="~"||/[0-9]/.test(r))return!0;if(r==="!")return t[o+1]!=="=";if(r===".")return/[0-9]/.test(t[o+1]??"");if(r==="\\")return!0;if(r==="+"||r==="-")return t[o+1]===r;if(!St.test(r))return!1;let s=o;for(;s<t.length&&St.test(t[s])&&!Et.test(t[s]);)s++;const a=t.slice(o,s);return a!=="in"&&a!=="instanceof"}function Dn(t){const o=t.length;let r=0,s=0,a=!1,l=!1;if(t.startsWith("#!")){for(;r<o&&!De.test(t[r]);)r++;s=r,a=!0}let f=!1,y=!0,x=!0;const $=()=>{for(;;){for(;r<o&&Et.test(t[r]);)De.test(t[r])&&(f=!0,y=!0),r++;if(x&&y&&t.startsWith("-->",r)){for(;r<o&&!De.test(t[r]);)r++;continue}if(t.startsWith("/*",r)){const b=t.indexOf("*/",r+2);if(b<0)return!1;De.test(t.slice(r,b))&&(f=!0,y=!0),r=b+2}else if(t.startsWith("//",r)||x&&t.startsWith("<!--",r))for(;r<o&&!De.test(t[r]);)r++;else return!0}};for(;$();){const b=t[r];if(b!=='"'&&b!=="'")break;x=!1;let L=r+1,B=!1;for(;L<o;){const p=t[L];if(p==="\\"){L+=2;continue}if(p===b){B=!0,L+=1;break}if(p===`
187
+ `||p==="\r")break;L+=1}if(!B)break;y=!1;const q=L;if(r=L,f=!1,!$())break;if(t[r]===";")r+=1,y=!1,s=r,l=!1;else if(t.startsWith("<!--",r)){s=q,l=!0,a=!1;break}else if((f||r>=o)&&Ln(t,r))s=q,l=!0;else break;a=!1}return{at:s,afterHashbang:a,semicolon:l}}function Mn(t){const{at:o,afterHashbang:r,semicolon:s}=Dn(t);return t.slice(0,o)+(s?";":"")+(r?`
188
+ `:"")+He+t.slice(o)}const On=new Set(["application/ecmascript","application/javascript","application/x-ecmascript","application/x-javascript","text/ecmascript","text/javascript","text/javascript1.0","text/javascript1.1","text/javascript1.2","text/javascript1.3","text/javascript1.4","text/javascript1.5","text/jscript","text/livescript","text/x-ecmascript","text/x-javascript"]),Ct="http://www.w3.org/2000/svg",Tt="http://www.w3.org/1999/xhtml";function Rn(t){if(t.namespaceURI===Ct?t.hasAttribute("href")||t.hasAttribute("xlink:href"):t.hasAttribute("src"))return!1;const o=t.namespaceURI===Ct?null:t.getAttribute("language"),r=t.hasAttribute("type")?t.getAttribute("type"):o!==null&&o!==""?`text/${o}`:"";return r===""||r.toLowerCase()==="module"?!0:On.has(r.replace(/^[\t\n\f\r ]+|[\t\n\f\r ]+$/g,"").toLowerCase())}function $t(t){const o=Array.from(t.querySelectorAll("script"));for(const r of Array.from(t.querySelectorAll("template")))r.namespaceURI===Tt&&o.push(...$t(r.content));return o}function Lt(t){const o=Array.from(t.querySelectorAll("meta[http-equiv]")).filter(r=>r.getAttribute("http-equiv").trim().toLowerCase()==="content-security-policy");for(const r of Array.from(t.querySelectorAll("template")))r.namespaceURI===Tt&&o.push(...Lt(r.content));return o}function Bn(t){return t.doctype===null?"":new XMLSerializer().serializeToString(t.doctype)}function Fn(t){const o=new DOMParser().parseFromString(t,"text/html"),r=new Set([xt(He)]);for(const f of $t(o)){if(!Rn(f))continue;const y=Mn((f.textContent??"").replace(/\r\n?/g,`
189
+ `));f.textContent=y,r.add(xt(y))}for(const f of Lt(o)){const y=(f.getAttribute("content")??"").split(";").map(x=>x.trim()).filter(x=>x!==""&&!/^script-src(-elem|-attr)?(\s|$)/i.test(x));f.setAttribute("content",[...y,"script-src 'unsafe-inline'"].join("; "))}const s=o.createElement("meta");s.setAttribute("http-equiv","Content-Security-Policy"),s.setAttribute("content",`script-src ${[...r].map(f=>`'sha256-${f}'`).join(" ")}; frame-src 'none'; child-src 'none'; worker-src 'none'; object-src 'none'`);const a=o.createElement("meta");a.setAttribute("http-equiv","Content-Security-Policy"),a.setAttribute("content","script-src 'unsafe-inline'");const l=o.createElement("script");return l.textContent=He,o.head.prepend(s,a,l),`${Bn(o)}${o.documentElement.outerHTML}`}const Me="wicked.editor",Pe=1,Kn="wicked-deck",ne=1280,oe=720,Pn=[0,250,750,1500],qn=1500,Nn=`
190
190
  <div data-testid="deck-editor" id="deck" class="deck" data-kind="deck" data-head="" data-current="" data-count="0" data-size="pane" data-present="false" data-selected="" tabindex="0" role="application" aria-label="The deck">
191
191
  <nav id="strip" class="strip" aria-label="Slides" data-testid="deck-strip"><ol id="thumbs"></ol></nav>
192
192
  <div class="main">
@@ -221,11 +221,11 @@
221
221
  <p data-testid="deck-note" id="note" class="note" hidden></p>
222
222
  <div id="notes-box" data-testid="deck-notes-tab" class="notes">
223
223
  <label for="notes" id="notes-label" data-testid="deck-notes-label">Speaker notes</label>
224
- <textarea id="notes" data-testid="deck-notes" placeholder="What to say on this slide. Saved when you leave the field; Undo puts the old notes back."></textarea>
224
+ <textarea id="notes" data-testid="deck-notes" data-wicked-save placeholder="What to say on this slide. Saved when you leave the field; Undo puts the old notes back."></textarea>
225
225
  </div>
226
226
  </div>
227
227
  <div data-testid="deck-handle" id="handle" class="handle" tabindex="-1"></div>
228
- </div>`;function w(t){const o=document.getElementById(t);if(o===null)throw new Error(`wicked-deck: no #${t}`);return o}const T=t=>t.id??`#${t.n}`;function He(t,o,i){const s=new DOMParser().parseFromString(t,"text/html");wt(s).forEach((l,f)=>{f!==o?l.setAttribute("data-wi-deck-off",""):l.setAttribute("data-wi-deck-current","")});const a=s.createElement("style");if(a.textContent="[data-wi-deck-off]{display:none!important}html,body{margin:0!important;padding:0!important;width:1280px!important;height:720px!important;overflow:hidden!important}[data-wi-deck-current]{position:absolute!important;left:0!important;top:0!important;width:1280px!important;height:720px!important;min-height:0!important;max-width:none!important;margin:0!important;box-sizing:border-box!important;overflow:hidden!important}",s.head.append(a),i.thumbnail)for(const l of Array.from(s.querySelectorAll("script")))l.remove();else{const l=s.createElement("script");l.textContent=`(function(){
228
+ </div>`;function w(t){const o=document.getElementById(t);if(o===null)throw new Error(`wicked-deck: no #${t}`);return o}const T=t=>t.id??`#${t.n}`;function Je(t,o,r){const s=new DOMParser().parseFromString(t,"text/html");kt(s).forEach((l,f)=>{f!==o?l.setAttribute("data-wi-deck-off",""):l.setAttribute("data-wi-deck-current","")});const a=s.createElement("style");if(a.textContent="[data-wi-deck-off]{display:none!important}html,body{margin:0!important;padding:0!important;width:1280px!important;height:720px!important;overflow:hidden!important}[data-wi-deck-current]{position:absolute!important;left:0!important;top:0!important;width:1280px!important;height:720px!important;min-height:0!important;max-width:none!important;margin:0!important;box-sizing:border-box!important;overflow:hidden!important}",s.head.append(a),r.thumbnail)for(const l of Array.from(s.querySelectorAll("script")))l.remove();else{const l=s.createElement("script");l.textContent=`(function(){
229
229
  function report(){
230
230
  var slide=document.querySelector('[data-wi-deck-current]');
231
231
  if(!slide)return;
@@ -240,8 +240,8 @@
240
240
  if(slide&&typeof MutationObserver==='function')new MutationObserver(report).observe(slide,{childList:true,subtree:true,characterData:true,attributes:true});
241
241
  if(document.fonts)document.fonts.ready.then(report);
242
242
  });
243
- })();`,s.body.append(l)}return`<!doctype html>${s.documentElement.outerHTML}`}function Lt(){document.body.insertAdjacentHTML("afterbegin",qn);const t=w("deck"),o=w("strip"),i=w("thumbs"),s=w("count"),a=w("tools"),l=w("add"),f=w("dup"),p=w("up"),x=w("down"),$=w("del"),b=w("present"),L=w("notes-toggle");let B=!1;const P=w("menu"),h=w("stage"),y=w("slide-box"),A=w("cutoff-bottom"),D=w("cutoff-right"),m=w("fit"),S=w("zoom-100"),Z=w("fullscreen"),ge=w("style-panel"),de=w("notes-box"),Nn=w("hover"),Dt=w("selected"),z=w("input"),Mt=w("badge"),Ot=w("present-bar"),we=w("hint"),Je=w("note"),_=w("notes"),Pn=w("notes-label"),re=w("handle");let ie=null,ue=[],C="pane",F=1,q="options",Oe="style",Rt=null,Pe="fit",_e=null,ke=null,_n=0;const Ve=new Map,I=(e,n)=>{ie?.postMessage({p:Me,v:Ne,type:e,payload:n})},xe=(e,n)=>new Promise(r=>{if(ie===null){r({ok:!1,error:{code:"unavailable",message:"no host yet"}});return}const c=`wd-${++_n}`;Ve.set(c,r),ie.postMessage({p:Me,v:Ne,type:e,id:c,payload:n})}),fe=e=>I("ui.status",{line:e.slice(0,120)}),Ge=()=>ue.includes("artifact.write");let N=null,se="",v=[],U=null,pe=null,k=!1,he=!1,Ze=!1,Ee=null,Q=!1,ye="",Qe=null,me=null,X=null,et=0,Bt=-1,tt=[],j=null,je=null,Ae={scrollX:0,scrollY:0},Ke=null,R=null,V=null;const Y=()=>{const e=v.findIndex(n=>T(n)===U);return e<0?0:e},W=()=>v[Y()]??null,nt=()=>{const e=h.clientWidth,n=h.clientHeight;if(e===0||n===0)return{x:0,y:0,s:1};const r=Pe==="100"&&C!=="inline"&&!k?1:Math.min(e/ne,n/oe);return{x:Math.max(0,(e-ne*r)/2),y:Math.max(0,(n-oe*r)/2),s:r}},G=()=>{const e=Pe==="fit"||C==="inline"||k;if(h.dataset.zoom=e?"fit":"100",m.setAttribute("aria-pressed",String(e)),S.setAttribute("aria-pressed",String(!e)),e&&(h.scrollLeft=0,h.scrollTop=0),X===null)return;const n=nt();y.style.cssText=`left:${n.x}px;top:${n.y}px;width:${ne*n.s}px;height:${oe*n.s}px`,X.style.cssText=`width:${ne}px;height:${oe}px;transform:scale(${n.s})`,Ft()},Ft=()=>{const e=Object.values(j?.widMap??{}).filter(u=>u.width>0&&u.height>0),n=e.reduce((u,g)=>Math.max(u,g.bottom+(j?.measured.scrollY??0)),Math.max(oe+Ae.scrollY,je?.height??0)),r=e.reduce((u,g)=>Math.max(u,g.right+(j?.measured.scrollX??0)),Math.max(ne+Ae.scrollX,je?.width??0)),c=nt(),d=F===2&&q==="full"&&!k;A.hidden=!d||n<=oe,D.hidden=!d||r<=ne,A.style.cssText=`left:${c.x}px;top:${c.y+oe*c.s-1}px;width:${ne*c.s}px`,D.style.cssText=`left:${c.x+ne*c.s-1}px;top:${c.y}px;height:${oe*c.s}px`},ot=e=>{if(e===null||j===null)return null;const n=j.widMap[e];if(n===void 0||n.width===0&&n.height===0)return null;const r=hn(n,j.measured,Ae),c=nt();return{left:c.x+r.left*c.s,top:c.y+r.top*c.s,width:r.width*c.s,height:r.height*c.s}},rt=(e,n,r=0,c=0)=>{if(n===null){e.hidden=!0;return}e.hidden=!1,e.style.left=`${n.left}px`,e.style.top=`${n.top}px`,e.style.width=`${Math.max(n.width,r)}px`,e.style.height=`${Math.max(n.height,c)}px`},qt=e=>{const n=j?.blocks[e];return j===null||n===void 0||j.widMap[e]===void 0?"unmeasured":n.composite?"container":n.cut===!0?"cut":"yes"},E=()=>{const e=W(),n=v.length;t.dataset.head=N===null?"":String(N),t.dataset.current=e?.id??"",t.dataset.currentN=e===null?"":String(e.n),t.dataset.count=String(n),t.dataset.size=C,t.dataset.surface=q,t.dataset.tab=Oe;const r=F===2&&q==="options";o.hidden=C==="inline"||k||r,h.hidden=r,ge.hidden=!r||Oe!=="style";const c=F===2&&q==="full"&&!B&&!k;de.hidden=C==="inline"||k||r&&Oe!=="notes"||c,L.hidden=!(F===2&&q==="full"),L.setAttribute("aria-pressed",String(B)),Ft(),t.dataset.present=String(k),t.dataset.selected=R??"",document.body.dataset.present=String(k),s.textContent=n===0?"No slides yet":`${e?.n??1} of ${n}`,s.title=n===0?"":`Slide ${e?.n??1} of ${n}`;const d=Ge()&&!he&&e!==null;for(const M of[l,f,$])M.disabled=!d||e?.id===null;p.disabled=!d||Y()===0||e?.id===null,x.disabled=!d||Y()>=n-1||e?.id===null,b.disabled=n===0,l.setAttribute("aria-expanded",String(Q)),P.hidden=!Q||C==="inline",Mt.hidden=F===2||C!=="inline"||n===0,Mt.textContent=`${n} slide${n===1?"":"s"}`,Ot.hidden=!k,Ot.textContent=`${e?.n??0} / ${n} · ← → · Esc leaves`;for(const M of Array.from(i.children)){const ee=M.querySelector("button");ee!==null&&ee.setAttribute("aria-current",String(ee.dataset.key===U))}Pn.textContent=e===null?"Speaker notes":`Speaker notes · slide ${e.n}`,document.activeElement!==_&&(_.value=le!==null&&le.key===U?le.text:e?.notes??""),_.readOnly=!d;const u=C!=="inline"&&!k&&j!==null;if(rt(Nn,u&&Ke!==R&&V===null?ot(Ke):null),Dt.dataset.wid=R??"",rt(Dt,u&&V===null?ot(R):null),V!==null?rt(z,ot(V.wid),160,30):z.hidden=!0,a.hidden=C==="inline"||k||r,Z.hidden=!ue.includes("ui.fullscreen"),C==="inline"||k||r||V!==null||F===2&&q==="full"){we.hidden=!0;return}if(we.hidden=!1,R===null){we.removeAttribute("data-editable"),we.textContent=n===0?"":"← → to move between slides · click a line to point at it · type on it to change it";return}const g=qt(R);we.dataset.editable=String(g==="yes"),we.textContent=g==="yes"?"Type to change it · Enter to edit its text · Esc to let go":g==="container"?"This part holds other parts: click a line inside it to change the words · Esc to let go":"This can’t be changed by typing: say what to change in the message box · Esc to let go"},ze=new Map,jn=()=>{const e=new Set,n=[];v.forEach((r,c)=>{const d=T(r);e.add(d);const u=He(se,c,{thumbnail:!0});let g=ze.get(d);if(g===void 0){const ee=document.createElement("li"),O=document.createElement("button");O.type="button",O.className="thumb";for(const[ce,be]of Object.entries({"data-testid":"deck-thumb"}))O.setAttribute(ce,be);O.innerHTML='<span class="n"></span><span class="mini"><iframe sandbox="" tabindex="-1" aria-hidden="true"></iframe></span><span class="t"></span>',O.addEventListener("click",()=>{Se(O.dataset.key??null,!1),st(),re.focus()}),O.draggable=!0,O.addEventListener("dragstart",ce=>{me=O.dataset.key??null,ce.dataTransfer?.setData("text/plain",me??"")}),O.addEventListener("dragover",ce=>{if(me===null||me===O.dataset.key)return;ce.preventDefault();const be=O.getBoundingClientRect();O.dataset.drop=ce.clientY<be.top+be.height/2?"before":"after"}),O.addEventListener("dragleave",()=>{delete O.dataset.drop}),O.addEventListener("drop",ce=>{ce.preventDefault();const be=O.dataset.drop;delete O.dataset.drop;const Xt=me;if(me=null,Xt===null||be===void 0)return;const Yt=v.findIndex(Qn=>T(Qn)===O.dataset.key),Wt=v[Yt];if(Wt?.id==null)return;const Zn=be==="after"?Wt.id:v[Yt-1]?.id??null;lt(Xt,Zn)}),O.addEventListener("dragend",()=>{me=null}),ee.appendChild(O),g={li:ee,srcdoc:""},ze.set(d,g)}const M=g.li.querySelector("button");M.dataset.key=d,M.dataset.slideId=r.id??"",M.dataset.n=String(r.n),M.setAttribute("aria-label",r.title===""?`Slide ${r.n}`:`Slide ${r.n}: ${r.title}`),M.querySelector(".n").textContent=String(r.n),M.querySelector(".t").textContent=r.title===""?`Slide ${r.n}`:r.title,g.srcdoc!==u&&(g.srcdoc=u,M.querySelector("iframe").srcdoc=u),n.push(g.li)});for(const[r,c]of ze)e.has(r)||(c.li.remove(),ze.delete(r));i.replaceChildren(...n)},Kn=e=>{if(e===X){Bt=et;for(const n of tt)clearTimeout(n);tt=Bn.map(n=>setTimeout(()=>X?.contentWindow?.postMessage(gn,"*"),n))}},it=()=>{et+=1,j=null,je=null,Ae={scrollX:0,scrollY:0},Ke=null,R=null,ae();const e=F===1&&C==="inline"?0:Y();if(v.length===0){y.replaceChildren(),X=null,G(),E();return}const n=He(se,e,{thumbnail:!1}),r=document.createElement("iframe");for(const[d,u]of Object.entries({"data-testid":"deck-frame",sandbox:"allow-scripts",title:`Slide ${e+1}`}))r.setAttribute(d,u);X=r;const c=()=>{for(const d of Array.from(y.querySelectorAll("iframe")))d!==X&&d.remove()};r.addEventListener("load",()=>{Kn(r),X===r&&c()}),r.srcdoc=On(kn(se)?n:En(n)),y.prepend(r),G(),setTimeout(()=>{X===r&&c()},2e3),E()},Se=(e,n=!0)=>{if(e===null||e===U||!v.some(r=>T(r)===e)){E();return}dt(),U=e,it(),n&&F===2&&q!=="options"&&st()},Re=e=>{const n=Math.max(0,Math.min(v.length-1,Y()+e)),r=v[n];r!==void 0&&Se(T(r))},st=()=>{const e=W()?.wid;e!=null&&ue.includes("selection.chip")&&I("selection.set",{anchors:[{kind:"element",id:e}]})},zn=(e,n)=>e.version===void 0||n.version===void 0?{}:e.version>=n.version?e:n,Nt=e=>{const n=e.version;if(typeof n=="number"&&N!==null&&n<N)return;Je.hidden=!0;const r=e.content;if(se=typeof r?.html=="string"?r.html:"",N=typeof n=="number"?n:N,In(se),_t.refresh(),v=pn(se),pe!==null){const d=v[Math.max(0,Math.min(v.length-1,pe))];U=d===void 0?null:T(d),pe=null}else v.some(d=>T(d)===U)||(U=v[0]===void 0?null:T(v[0]));const c=ke===null?void 0:v.find(d=>d.id===ke||d.wid===ke)??Pt(ke);q==="options"&&c!==void 0&&(ke=T(c),U=T(c)),jn(),it()},Ce=async e=>{if(!(e!==void 0&&N!==null&&e<=N)){if(Ze){const n=e===void 0?{}:{version:e};Ee=Ee===null?n:zn(Ee,n);return}Ze=!0;try{const n=await xe("artifact.read",e===void 0?{}:{version:e});if(!n.ok){Je.hidden=!1,Je.textContent=n.error.code==="not_granted"?"This editor may not read the deck here.":`The deck could not be read (${n.error.code}).`;return}Nt(n.payload)}finally{if(Ze=!1,Ee!==null){const n=Ee;Ee=null,(n.version===void 0||N===null||n.version>N)&&Ce(n.version)}}}},Pt=e=>{if(se===""||!/^[A-Za-z0-9_.:-]{1,100}$/.test(e))return;const c=new DOMParser().parseFromString(se,"text/html").querySelector(`[data-wid="${e}"]`)?.closest("[data-slide-id]")?.getAttribute("data-slide-id")??null;return c===null?void 0:v.find(d=>d.id===c)},In=e=>{_e=an(e)??_e},_t=ln(ge,{tokens:()=>_e,key:e=>I("ui.key",{key:e}),apply:async e=>{if(F!==2||!ue.includes("artifact.theme"))return{ok:!1,reason:"Theme changes are not granted here."};if(N===null)return{ok:!1,reason:"The deck has not loaded yet."};for(let n=0;n<2;n+=1){const r=await xe("theme.set",{base:N,tokens:e});if(r.ok)return _e=Fe(e),await Ce(typeof r.payload.version=="number"?r.payload.version:void 0),{ok:!0};if(r.error.code!=="head_moved")return{ok:!1,reason:r.error.message||r.error.code};const c=await xe("artifact.read",{});if(!c.ok)return{ok:!1,reason:c.error.message||c.error.code};const d=c.payload.version;if(typeof d!="number"||N!==null&&d<N)return{ok:!1,reason:"The current deck version could not be read."};if(Nt(c.payload),n===1)return{ok:!1,reason:r.error.message||r.error.code}}return{ok:!1,reason:"The deck changed meanwhile."}}});window.addEventListener("message",e=>{if(X===null||X.contentWindow===null||e.source!==X.contentWindow||Bt!==et)return;const n=e.data;if(n!==null&&typeof n=="object"&&n.v===1&&n.type==="deck-extents"){typeof n.width=="number"&&Number.isFinite(n.width)&&n.width>=0&&typeof n.height=="number"&&Number.isFinite(n.height)&&n.height>=0&&(je={width:n.width,height:n.height},E());return}const r=bn(e.data);if(r!==null){if(r.type==="wid-inventory"){for(const c of tt)clearTimeout(c);j={widMap:r.widMap,blocks:r.blocks??{},measured:{scrollX:r.scrollX,scrollY:r.scrollY}},Ae={scrollX:r.scrollX,scrollY:r.scrollY},E()}else if(r.type==="scroll-state"||r.type==="scroll-ack")r.scrollX!==void 0&&r.scrollY!==void 0&&(Ae={scrollX:r.scrollX,scrollY:r.scrollY},E());else if(r.type==="wid-hover")Ke=r.wid,E();else if(r.type==="wid-click"){if(C==="inline"){F===2&&Ie(r.wid);return}if(k){Re(1);return}Ie(r.wid===W()?.wid?null:r.wid),r.wid===W()?.wid&&st()}}});const Ie=e=>{R=e,ae(),E(),e!==null&&(ue.includes("selection.chip")&&I("selection.set",{anchors:[{kind:"element",id:e}]}),re.focus())},ve=async(e,n,r,c=N,d)=>{if(c===null||he||!Ge())return!1;he=!0,Q=!1,E(),fe(r);try{const u=await xe("version.write",{base:c,ops:e,summary:n});if(u.ok)return await Ce(typeof u.payload.version=="number"?u.payload.version:void 0),!0;if(pe=null,u.error.code==="stale"||u.error.code==="head_moved"){d!==void 0?d():fe(u.error.code==="stale"&&u.error.message?u.error.message:"Not changed: the deck changed meanwhile");const g=u.payload?.head;typeof g=="number"&&g!==N&&await Ce(g)}else u.error.code==="timeout"||fe(u.error.message?u.error.code==="refused"||u.error.message.startsWith("Not changed")?u.error.message:`Not changed: ${u.error.message}`:"Nothing changed");return!1}finally{he=!1,E()}},lt=async(e,n)=>{if(C==="inline"||k)return;const r=v.find(u=>T(u)===e);if(r?.id==null)return;const c=v.indexOf(r),d=n===null?-1:v.findIndex(u=>u.id===n);n===r.id||d===c-1||(U=T(r),await ve([{op:"slide-move",slide:r.id,after:n}],`slide ${r.n}`,`Moving slide ${r.n}…`))},at=e=>{const n=Y(),r=v[n];r?.id!=null&&(e===-1&&n>0&&lt(T(r),v[n-2]?.id??null),e===1&&n<v.length-1&&lt(T(r),v[n+1]?.id??null))},jt=()=>{if(C==="inline"||k)return;const e=W();e?.id!=null&&(pe=Y()+1,ve([{op:"slide-duplicate",slide:e.id}],`slide ${e.n}`,`Duplicating slide ${e.n}…`))},Kt=e=>{if(C==="inline"||k)return;const n=W();e.id===null||n?.id==null||(pe=Y()+1,ve([{op:"slide-insert",slide:e.id,after:n.id}],`a slide after slide ${n.n}`,`Adding a slide after slide ${n.n}…`))},zt=()=>{if(C==="inline"||k)return;const e=W();e?.wid==null||v.length===0||(pe=Math.max(0,Y()-(Y()===v.length-1?1:0)),ve([{op:"remove",anchor:e.wid}],`slide ${e.n}`,`Deleting slide ${e.n}…`))},Un=e=>{C==="inline"||k||j?.widMap[e]!==void 0&&ve([{op:"remove",anchor:e}],"part of the slide","Removing it…")};let Ue=null,ct=null,le=null;const dt=()=>{const e=v.find(g=>T(g)===Ue),n=ct;if(Ue=null,ct=null,e?.id==null||_.readOnly)return;const r=_.value.replace(/\r\n/g,`
244
- `),c=e.notes,d=T(e),u=()=>{le?.key===d&&(le=null)};if(r.trim()===c.trim()){u();return}ve([{op:"notes-set",slide:e.id,text:r}],`slide ${e.n}’s notes`,`Saving slide ${e.n}’s notes…`,n,()=>{le={key:d,text:r},fe(`Not saved: the deck changed while you typed slide ${e.n}’s notes. They are still in the field; leave it again to save them over the change.`),E()}).then(g=>{g&&u()})};_.addEventListener("focus",()=>{Ue=U,ct=N}),_.addEventListener("blur",()=>dt()),_.addEventListener("keydown",e=>{if(e.stopPropagation(),!(F===2&&q==="options"&&mt(e,de,n=>{(n==="Tab"||n==="Shift+Tab")&&_.blur(),I("ui.key",{key:n})}))){if(e.altKey&&!e.metaKey&&!e.ctrlKey&&/^Key[A-Z]$/.test(e.code)&&pt(`Alt+${e.code.slice(3)}`)){e.preventDefault(),I("ui.key",{key:`Alt+${e.code.slice(3)}`});return}if(e.key==="Escape"){e.preventDefault(),le?.key===U&&(le=null),_.value=W()?.notes??"",Ue=null,re.focus();return}if(e.key==="Enter"&&(e.metaKey||e.ctrlKey)){e.preventDefault(),F===2&&q==="options"?_.blur():re.focus();return}if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="k"){e.preventDefault(),I("ui.key",{key:"Mod+K"});return}if(e.key==="Tab"&&!e.shiftKey){e.preventDefault(),_.blur(),I("ui.key",{key:"Tab"});return}e.key==="Tab"&&e.shiftKey&&(e.preventDefault(),re.focus())}});const ae=()=>{V!==null&&(V=null,z.hidden=!0,z.value="",E())},It=(e,n)=>{if(C==="inline"||k||he||!Ge()||j===null||qt(e)!=="yes")return;const r=j.blocks[e]?.text??"";V={wid:e,before:r},z.value=n??r,E(),z.focus(),n===null?z.select():z.setSelectionRange(z.value.length,z.value.length)},Xn=async()=>{if(V===null)return;const{wid:e,before:n}=V,r=z.value.replace(/\s*\n\s*/g," ");ae(),re.focus(),r!==n&&await ve([{op:"text",anchor:e,value:r,before:n}],`slide ${W()?.n??""}`,"Changing the text…")};z.addEventListener("keydown",e=>{if(e.stopPropagation(),(e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="k"){e.preventDefault(),ae(),I("ui.key",{key:"Mod+K"});return}e.key==="Enter"?(e.preventDefault(),Xn()):e.key==="Escape"&&(e.preventDefault(),ae(),re.focus())}),z.addEventListener("blur",()=>ae());const Yn=()=>{P.replaceChildren();const e=document.createElement("span");e.className="word",e.textContent="A blank slide laid out like",P.appendChild(e);for(const n of v){if(n.id===null)continue;const r=document.createElement("button");r.type="button";for(const[c,d]of Object.entries({role:"menuitem","data-testid":"deck-add-like"}))r.setAttribute(c,d);r.dataset.slideId=n.id,r.textContent=n.title===""?`Slide ${n.n}`:`Slide ${n.n} — ${n.title}`,r.addEventListener("click",()=>Kt(n)),P.appendChild(r)}Q=!0,E(),P.querySelector("button")?.focus()},ut=()=>{Q&&(Q=!1,E(),l.focus())};P.addEventListener("keydown",e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),ut();return}if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;e.preventDefault(),e.stopPropagation();const n=Array.from(P.querySelectorAll("button")),r=n.indexOf(document.activeElement);n[(r+(e.key==="ArrowDown"?1:n.length-1)+n.length)%n.length]?.focus()}),l.addEventListener("click",()=>Q?ut():Yn()),f.addEventListener("click",()=>jt()),p.addEventListener("click",()=>at(-1)),x.addEventListener("click",()=>at(1)),$.addEventListener("click",()=>zt()),b.addEventListener("click",()=>void Wn()),L.addEventListener("click",()=>{B=!B,E(),G(),B&&_.focus()}),Z.addEventListener("click",()=>{xe("ui.fullscreen",{}).then(e=>{e.ok||fe(e.error.message)})}),m.addEventListener("click",()=>{Pe="fit",G(),E()}),S.addEventListener("click",()=>{Pe="100",G(),E()});const Wn=async()=>{v.length!==0&&(dt(),k=!0,Ie(null),ue.includes("ui.fullscreen")&&await xe("ui.fullscreen",{}),E(),G(),t.focus())},Hn=()=>{k=!1,E(),G(),t.focus()};window.addEventListener("resize",()=>{G(),E()}),typeof ResizeObserver=="function"&&new ResizeObserver(()=>{G(),E()}).observe(h);const Jn=()=>[...Array.from(i.querySelectorAll("button")).filter(()=>C!=="inline"&&!k),...Array.from(a.querySelectorAll("button")).filter(e=>!a.hidden&&!e.hidden&&!e.disabled),re,...C==="inline"||k||de.hidden?[]:[_]],Vn=e=>{ye=`${ye}${e}`.slice(-3),Qe!==null&&clearTimeout(Qe),Qe=setTimeout(()=>{ye=""},Fn),fe(`Go to slide ${ye} — Enter`)};t.addEventListener("keydown",e=>{if(e.target===z||e.target===_||ge.contains(e.target)||F===2&&q==="options")return;const n=e.target?.tagName==="BUTTON",r=e.target?.dataset?.testid==="deck-thumb",c=e.key==="Enter"&&r&&ye!=="";if(n&&!c&&(e.key==="Enter"||e.key===" "))return;const d=e.metaKey||e.ctrlKey;if(e.key==="Escape"){if(e.preventDefault(),Q){ut();return}if(k){Hn();return}if(R!==null){Ie(null);return}I("ui.key",{key:"Escape"});return}if(d&&!e.altKey&&e.key.toLowerCase()==="k"){e.preventDefault(),I("ui.key",{key:"Mod+K"});return}if(d&&e.shiftKey&&!e.altKey&&e.key.toLowerCase()==="n"){e.preventDefault();const u=W();u!==null&&Kt(u);return}if(d&&!e.shiftKey&&!e.altKey&&e.key.toLowerCase()==="d"){e.preventDefault(),jt();return}if(d&&!e.altKey&&(e.key==="Backspace"||e.key==="Delete")){e.preventDefault(),R!==null&&R!==W()?.wid?Un(R):zt();return}if(e.altKey&&!d&&(e.key==="ArrowUp"||e.key==="ArrowDown")){e.preventDefault(),at(e.key==="ArrowUp"?-1:1);return}if(e.altKey&&!d&&/^Key[A-Z]$/.test(e.code)){e.preventDefault(),I("ui.key",{key:`Alt+${e.code.slice(3)}`});return}if(e.key==="Tab"){e.preventDefault();const u=Jn(),g=u.indexOf(document.activeElement),M=g===-1&&document.activeElement===t&&!e.shiftKey?0:g+(e.shiftKey?-1:1);if(g===-1&&M!==0||M<0||M>=u.length){I("ui.key",{key:e.shiftKey?"Shift+Tab":"Tab"});return}u[M].focus();return}if(!(d||e.altKey)){if(e.key==="ArrowRight"||e.key==="PageDown"||e.key==="ArrowDown"&&!n){e.preventDefault(),Re(1);return}if(e.key==="ArrowLeft"||e.key==="PageUp"||e.key==="ArrowUp"&&!n){e.preventDefault(),Re(-1);return}if(e.key==="Home"){e.preventDefault();const u=v[0];u!==void 0&&Se(T(u));return}if(e.key==="End"){e.preventDefault();const u=v[v.length-1];u!==void 0&&Se(T(u));return}if(k&&e.key===" "){e.preventDefault(),Re(1);return}if(c){e.preventDefault();const u=v[Number(ye)-1];ye="",u!==void 0&&(Se(T(u)),i.querySelector(`[data-key="${CSS.escape(T(u))}"]`)?.focus()),fe(u===void 0?"There is no such slide":`Slide ${u.n}`);return}if(!(n&&e.key.length!==1)){if(e.key==="Enter"){R!==null&&!he&&(e.preventDefault(),It(R,null));return}if(e.key.length===1){if(e.preventDefault(),C!=="inline"&&!k&&R!==null&&!he){It(R,e.key);return}if(/^[0-9]$/.test(e.key)&&r){Vn(e.key);return}I("ui.typed",{grapheme:e.key})}}}});const ft=e=>{const n=C;C=e,document.body.dataset.size=e,e==="inline"&&(k=!1,ae(),R=null,Q=!1,document.activeElement?.blur?.()),e!=="full"&&k&&(k=!1),F===1&&n==="inline"!=(e==="inline")&&v.length>0&&it(),G(),E()},Ut=e=>{if(!(typeof e!="object"||e===null))for(const[n,r]of Object.entries(e))/^--[a-z0-9-]+$/.test(n)&&typeof r=="string"&&r.length<=200&&!/url\(/i.test(r)&&document.documentElement.style.setProperty(n,r)},Gn=e=>{const n=e.data;try{if(n===null||typeof n!="object"||n.p!==Me||n.v!==Ne)return;if(typeof n.re=="string"){const c=Ve.get(n.re);if(c===void 0)return;Ve.delete(n.re);const d=typeof n.payload=="object"&&n.payload!==null?n.payload:{};n.ok===!0?c({ok:!0,payload:d}):c({ok:!1,error:n.error??{code:"unavailable",message:"no answer"},payload:d});return}if(F===2&&Rt?.dispatch(n))return;const r=typeof n.payload=="object"&&n.payload!==null?n.payload:{};switch(n.type){case"host.ping":typeof n.id=="string"&&ie?.postMessage({p:Me,v:Ne,re:n.id,ok:!0,payload:{}});return;case"host.size":(r.size==="inline"||r.size==="pane"||r.size==="full")&&ft(r.size);return;case"host.theme":Ut(r.theme);return;case"artifact.changed":{const c=r.version;typeof c=="number"&&c!==N&&Ce(c);return}case"selection.cleared":R!==null&&(R=null,ae(),E());return;default:return}}catch{}};window.addEventListener("message",e=>{const n=e.data;if(ie!==null||n===null||typeof n!="object"||n.p!==Me||n.type!=="host.hello"||e.ports[0]===void 0)return;ie=e.ports[0],ie.onmessage=Gn;const r=typeof n.payload=="object"&&n.payload!==null?n.payload:{};ue=Array.isArray(r.grants)?r.grants.filter(d=>typeof d=="string"):[];const c=tn(r);F=c.protocol,q=c.surface,Oe=c.tab??"style",document.body.dataset.protocol=String(F),document.body.dataset.surface=q,Rt=new rn(ie,{surface:d=>{d!=="options"&&(q=d,document.body.dataset.surface=d,ft(yt(d)))},action:d=>{if(q==="options"||d!=="prev"&&d!=="next")return{handled:!1};const u=Y()+(d==="next"?1:-1);return u<0||u>=v.length?{handled:!1}:(Re(d==="next"?1:-1),{handled:!0,status:`Slide ${Y()+1} of ${v.length}`})},tab:d=>{q!=="options"||d!=="style"&&d!=="notes"||(_.blur(),Oe=d,_t.refresh(),E())},selection:d=>{if(q==="options")for(const u of d){if(typeof u!="object"||u===null)continue;const g=u;if(g.kind!=="element"||typeof g.id!="string")continue;const M=v.find(ee=>ee.id===g.id||ee.wid===g.id)??Pt(g.id);if((v.length===0||M!==void 0)&&(ke=M===void 0?g.id:T(M)),M!==void 0){_.blur(),Se(T(M),!1);break}}}}),Ut(r.theme),ft(F===2?yt(q):c.size),Ce()}),on(Rn,Jt)}return Lt(),H.oneSlideHtml=He,H.start=Lt,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"}),H})({});
243
+ })();`,s.body.append(l)}return`<!doctype html>${s.documentElement.outerHTML}`}function Dt(){document.body.insertAdjacentHTML("afterbegin",Nn);const t=w("deck"),o=w("strip"),r=w("thumbs"),s=w("count"),a=w("tools"),l=w("add"),f=w("dup"),y=w("up"),x=w("down"),$=w("del"),b=w("present"),L=w("notes-toggle");let B=!1;const q=w("menu"),p=w("stage"),h=w("slide-box"),A=w("cutoff-bottom"),D=w("cutoff-right"),m=w("fit"),S=w("zoom-100"),Z=w("fullscreen"),ve=w("style-panel"),de=w("notes-box"),_n=w("hover"),Mt=w("selected"),z=w("input"),Ot=w("badge"),Rt=w("present-bar"),we=w("hint"),Ge=w("note"),N=w("notes"),jn=w("notes-label"),re=w("handle");let ie=null,ue=[],C="pane",F=1,K="options",Oe="style",Bt=null,qe="fit",Ne=null,ke=null,In=0;const Ve=new Map,_=(e,n)=>{ie?.postMessage({p:Me,v:Pe,type:e,payload:n})},xe=(e,n)=>new Promise(i=>{if(ie===null){i({ok:!1,error:{code:"unavailable",message:"no host yet"}});return}const c=`wd-${++In}`;Ve.set(c,i),ie.postMessage({p:Me,v:Pe,type:e,id:c,payload:n})}),fe=e=>_("ui.status",{line:e.slice(0,120)}),Ze=()=>ue.includes("artifact.write");let P=null,se="",g=[],U=null,pe=null,k=!1,he=!1,Qe=!1,Ae=null,Q=!1,ye="",et=null,me=null,X=null,tt=0,Ft=-1,nt=[],j=null,_e=null,Ee={scrollX:0,scrollY:0},je=null,R=null,G=null;const Y=()=>{const e=g.findIndex(n=>T(n)===U);return e<0?0:e},W=()=>g[Y()]??null,ot=()=>{const e=p.clientWidth,n=p.clientHeight;if(e===0||n===0)return{x:0,y:0,s:1};const i=qe==="100"&&C!=="inline"&&!k?1:Math.min(e/ne,n/oe);return{x:Math.max(0,(e-ne*i)/2),y:Math.max(0,(n-oe*i)/2),s:i}},V=()=>{const e=qe==="fit"||C==="inline"||k;if(p.dataset.zoom=e?"fit":"100",m.setAttribute("aria-pressed",String(e)),S.setAttribute("aria-pressed",String(!e)),e&&(p.scrollLeft=0,p.scrollTop=0),X===null)return;const n=ot();h.style.cssText=`left:${n.x}px;top:${n.y}px;width:${ne*n.s}px;height:${oe*n.s}px`,X.style.cssText=`width:${ne}px;height:${oe}px;transform:scale(${n.s})`,Kt()},Kt=()=>{const e=Object.values(j?.widMap??{}).filter(u=>u.width>0&&u.height>0),n=e.reduce((u,v)=>Math.max(u,v.bottom+(j?.measured.scrollY??0)),Math.max(oe+Ee.scrollY,_e?.height??0)),i=e.reduce((u,v)=>Math.max(u,v.right+(j?.measured.scrollX??0)),Math.max(ne+Ee.scrollX,_e?.width??0)),c=ot(),d=F===2&&K==="full"&&!k;A.hidden=!d||n<=oe,D.hidden=!d||i<=ne,A.style.cssText=`left:${c.x}px;top:${c.y+oe*c.s-1}px;width:${ne*c.s}px`,D.style.cssText=`left:${c.x+ne*c.s-1}px;top:${c.y}px;height:${oe*c.s}px`},rt=e=>{if(e===null||j===null)return null;const n=j.widMap[e];if(n===void 0||n.width===0&&n.height===0)return null;const i=gn(n,j.measured,Ee),c=ot();return{left:c.x+i.left*c.s,top:c.y+i.top*c.s,width:i.width*c.s,height:i.height*c.s}},it=(e,n,i=0,c=0)=>{if(n===null){e.hidden=!0;return}e.hidden=!1,e.style.left=`${n.left}px`,e.style.top=`${n.top}px`,e.style.width=`${Math.max(n.width,i)}px`,e.style.height=`${Math.max(n.height,c)}px`},Pt=e=>{const n=j?.blocks[e];return j===null||n===void 0||j.widMap[e]===void 0?"unmeasured":n.composite?"container":n.cut===!0?"cut":"yes"},E=()=>{const e=W(),n=g.length;t.dataset.head=P===null?"":String(P),t.dataset.current=e?.id??"",t.dataset.currentN=e===null?"":String(e.n),t.dataset.count=String(n),t.dataset.size=C,t.dataset.surface=K,t.dataset.tab=Oe;const i=F===2&&K==="options";o.hidden=C==="inline"||k||i,p.hidden=i,ve.hidden=!i||Oe!=="style";const c=F===2&&K==="full"&&!B&&!k;de.hidden=C==="inline"||k||i&&Oe!=="notes"||c,L.hidden=!(F===2&&K==="full"),L.setAttribute("aria-pressed",String(B)),Kt(),t.dataset.present=String(k),t.dataset.selected=R??"",document.body.dataset.present=String(k),s.textContent=n===0?"No slides yet":`${e?.n??1} of ${n}`,s.title=n===0?"":`Slide ${e?.n??1} of ${n}`;const d=Ze()&&!he&&e!==null;for(const M of[l,f,$])M.disabled=!d||e?.id===null;y.disabled=!d||Y()===0||e?.id===null,x.disabled=!d||Y()>=n-1||e?.id===null,b.disabled=n===0,l.setAttribute("aria-expanded",String(Q)),q.hidden=!Q||C==="inline",Ot.hidden=F===2||C!=="inline"||n===0,Ot.textContent=`${n} slide${n===1?"":"s"}`,Rt.hidden=!k,Rt.textContent=`${e?.n??0} / ${n} · ← → · Esc leaves`;for(const M of Array.from(r.children)){const ee=M.querySelector("button");ee!==null&&ee.setAttribute("aria-current",String(ee.dataset.key===U))}jn.textContent=e===null?"Speaker notes":`Speaker notes · slide ${e.n}`,document.activeElement!==N&&(N.value=le!==null&&le.key===U?le.text:e?.notes??""),N.readOnly=!d;const u=C!=="inline"&&!k&&j!==null;if(it(_n,u&&je!==R&&G===null?rt(je):null),Mt.dataset.wid=R??"",it(Mt,u&&G===null?rt(R):null),G!==null?it(z,rt(G.wid),160,30):z.hidden=!0,a.hidden=C==="inline"||k||i,Z.hidden=!ue.includes("ui.fullscreen"),C==="inline"||k||i||G!==null||F===2&&K==="full"){we.hidden=!0;return}if(we.hidden=!1,R===null){we.removeAttribute("data-editable"),we.textContent=n===0?"":"← → to move between slides · click a line to point at it · type on it to change it";return}const v=Pt(R);we.dataset.editable=String(v==="yes"),we.textContent=v==="yes"?"Type to change it · Enter to edit its text · Esc to let go":v==="container"?"This part holds other parts: click a line inside it to change the words · Esc to let go":"This can’t be changed by typing: say what to change in the message box · Esc to let go"},Ie=new Map,zn=()=>{const e=new Set,n=[];g.forEach((i,c)=>{const d=T(i);e.add(d);const u=Je(se,c,{thumbnail:!0});let v=Ie.get(d);if(v===void 0){const ee=document.createElement("li"),O=document.createElement("button");O.type="button",O.className="thumb";for(const[ce,be]of Object.entries({"data-testid":"deck-thumb"}))O.setAttribute(ce,be);O.innerHTML='<span class="n"></span><span class="mini"><iframe sandbox="" tabindex="-1" aria-hidden="true"></iframe></span><span class="t"></span>',O.addEventListener("click",()=>{Se(O.dataset.key??null,!1),lt(),re.focus()}),O.draggable=!0,O.addEventListener("dragstart",ce=>{me=O.dataset.key??null,ce.dataTransfer?.setData("text/plain",me??"")}),O.addEventListener("dragover",ce=>{if(me===null||me===O.dataset.key)return;ce.preventDefault();const be=O.getBoundingClientRect();O.dataset.drop=ce.clientY<be.top+be.height/2?"before":"after"}),O.addEventListener("dragleave",()=>{delete O.dataset.drop}),O.addEventListener("drop",ce=>{ce.preventDefault();const be=O.dataset.drop;delete O.dataset.drop;const Yt=me;if(me=null,Yt===null||be===void 0)return;const Wt=g.findIndex(no=>T(no)===O.dataset.key),Ht=g[Wt];if(Ht?.id==null)return;const to=be==="after"?Ht.id:g[Wt-1]?.id??null;at(Yt,to)}),O.addEventListener("dragend",()=>{me=null}),ee.appendChild(O),v={li:ee,srcdoc:""},Ie.set(d,v)}const M=v.li.querySelector("button");M.dataset.key=d,M.dataset.slideId=i.id??"",M.dataset.n=String(i.n),M.setAttribute("aria-label",i.title===""?`Slide ${i.n}`:`Slide ${i.n}: ${i.title}`),M.querySelector(".n").textContent=String(i.n),M.querySelector(".t").textContent=i.title===""?`Slide ${i.n}`:i.title,v.srcdoc!==u&&(v.srcdoc=u,M.querySelector("iframe").srcdoc=u),n.push(v.li)});for(const[i,c]of Ie)e.has(i)||(c.li.remove(),Ie.delete(i));r.replaceChildren(...n)},Un=e=>{if(e===X){Ft=tt;for(const n of nt)clearTimeout(n);nt=Pn.map(n=>setTimeout(()=>X?.contentWindow?.postMessage(xn,"*"),n))}},st=()=>{tt+=1,j=null,_e=null,Ee={scrollX:0,scrollY:0},je=null,R=null,ae();const e=F===1&&C==="inline"?0:Y();if(g.length===0){h.replaceChildren(),X=null,V(),E();return}const n=Je(se,e,{thumbnail:!1}),i=document.createElement("iframe");for(const[d,u]of Object.entries({"data-testid":"deck-frame",sandbox:"allow-scripts",title:`Slide ${e+1}`}))i.setAttribute(d,u);X=i;const c=()=>{for(const d of Array.from(h.querySelectorAll("iframe")))d!==X&&d.remove()};i.addEventListener("load",()=>{Un(i),X===i&&c()}),i.srcdoc=Fn(En(se)?n:Cn(n)),h.prepend(i),V(),setTimeout(()=>{X===i&&c()},2e3),E()},Se=(e,n=!0)=>{if(e===null||e===U||!g.some(i=>T(i)===e)){E();return}ut(),U=e,st(),n&&F===2&&K!=="options"&&lt()},Re=e=>{const n=Math.max(0,Math.min(g.length-1,Y()+e)),i=g[n];i!==void 0&&Se(T(i))},lt=()=>{const e=W()?.wid;e!=null&&ue.includes("selection.chip")&&_("selection.set",{anchors:[{kind:"element",id:e}]})},Xn=(e,n)=>e.version===void 0||n.version===void 0?{}:e.version>=n.version?e:n,qt=e=>{const n=e.version;if(typeof n=="number"&&P!==null&&n<P)return;Ge.hidden=!0;const i=e.content;if(se=typeof i?.html=="string"?i.html:"",P=typeof n=="number"?n:P,Yn(se),_t.refresh(),g=mn(se),pe!==null){const d=g[Math.max(0,Math.min(g.length-1,pe))];U=d===void 0?null:T(d),pe=null}else g.some(d=>T(d)===U)||(U=g[0]===void 0?null:T(g[0]));const c=ke===null?void 0:g.find(d=>d.id===ke||d.wid===ke)??Nt(ke);K==="options"&&c!==void 0&&(ke=T(c),U=T(c)),zn(),st()},Ce=async e=>{if(!(e!==void 0&&P!==null&&e<=P)){if(Qe){const n=e===void 0?{}:{version:e};Ae=Ae===null?n:Xn(Ae,n);return}Qe=!0;try{const n=await xe("artifact.read",e===void 0?{}:{version:e});if(!n.ok){Ge.hidden=!1,Ge.textContent=n.error.code==="not_granted"?"This editor may not read the deck here.":`The deck could not be read (${n.error.code}).`;return}qt(n.payload)}finally{if(Qe=!1,Ae!==null){const n=Ae;Ae=null,(n.version===void 0||P===null||n.version>P)&&Ce(n.version)}}}},Nt=e=>{if(se===""||!/^[A-Za-z0-9_.:-]{1,100}$/.test(e))return;const c=new DOMParser().parseFromString(se,"text/html").querySelector(`[data-wid="${e}"]`)?.closest("[data-slide-id]")?.getAttribute("data-slide-id")??null;return c===null?void 0:g.find(d=>d.id===c)},Yn=e=>{Ne=un(e)??Ne},_t=dn(ve,{tokens:()=>Ne,key:e=>_("ui.key",{key:e}),typed:e=>_("ui.typed",{grapheme:e}),apply:async e=>{if(F!==2||!ue.includes("artifact.theme"))return{ok:!1,reason:"Theme changes are not granted here."};if(P===null)return{ok:!1,reason:"The deck has not loaded yet."};for(let n=0;n<2;n+=1){const i=await xe("theme.set",{base:P,tokens:e});if(i.ok)return Ne=Fe(e),await Ce(typeof i.payload.version=="number"?i.payload.version:void 0),{ok:!0};if(i.error.code!=="head_moved")return{ok:!1,reason:i.error.message||i.error.code};const c=await xe("artifact.read",{});if(!c.ok)return{ok:!1,reason:c.error.message||c.error.code};const d=c.payload.version;if(typeof d!="number"||P!==null&&d<P)return{ok:!1,reason:"The current deck version could not be read."};if(qt(c.payload),n===1)return{ok:!1,reason:i.error.message||i.error.code}}return{ok:!1,reason:"The deck changed meanwhile."}}});window.addEventListener("message",e=>{if(X===null||X.contentWindow===null||e.source!==X.contentWindow||Ft!==tt)return;const n=e.data;if(n!==null&&typeof n=="object"&&n.v===1&&n.type==="deck-extents"){typeof n.width=="number"&&Number.isFinite(n.width)&&n.width>=0&&typeof n.height=="number"&&Number.isFinite(n.height)&&n.height>=0&&(_e={width:n.width,height:n.height},E());return}const i=kn(e.data);if(i!==null){if(i.type==="wid-inventory"){for(const c of nt)clearTimeout(c);j={widMap:i.widMap,blocks:i.blocks??{},measured:{scrollX:i.scrollX,scrollY:i.scrollY}},Ee={scrollX:i.scrollX,scrollY:i.scrollY},E()}else if(i.type==="scroll-state"||i.type==="scroll-ack")i.scrollX!==void 0&&i.scrollY!==void 0&&(Ee={scrollX:i.scrollX,scrollY:i.scrollY},E());else if(i.type==="wid-hover")je=i.wid,E();else if(i.type==="wid-click"){if(C==="inline"){F===2&&ze(i.wid);return}if(k){Re(1);return}ze(i.wid===W()?.wid?null:i.wid),i.wid===W()?.wid&&lt()}}});const ze=e=>{R=e,ae(),E(),e!==null&&(ue.includes("selection.chip")&&_("selection.set",{anchors:[{kind:"element",id:e}]}),re.focus())},ge=async(e,n,i,c=P,d)=>{if(c===null||he||!Ze())return!1;he=!0,Q=!1,E(),fe(i);try{const u=await xe("version.write",{base:c,ops:e,summary:n});if(u.ok)return await Ce(typeof u.payload.version=="number"?u.payload.version:void 0),!0;if(pe=null,u.error.code==="stale"||u.error.code==="head_moved"){d!==void 0?d():fe(u.error.code==="stale"&&u.error.message?u.error.message:"Not changed: the deck changed meanwhile");const v=u.payload?.head;typeof v=="number"&&v!==P&&await Ce(v)}else u.error.code==="timeout"||fe(u.error.message?u.error.code==="refused"||u.error.message.startsWith("Not changed")?u.error.message:`Not changed: ${u.error.message}`:"Nothing changed");return!1}finally{he=!1,E()}},at=async(e,n)=>{if(C==="inline"||k)return;const i=g.find(u=>T(u)===e);if(i?.id==null)return;const c=g.indexOf(i),d=n===null?-1:g.findIndex(u=>u.id===n);n===i.id||d===c-1||(U=T(i),await ge([{op:"slide-move",slide:i.id,after:n}],`slide ${i.n}`,`Moving slide ${i.n}…`))},ct=e=>{const n=Y(),i=g[n];i?.id!=null&&(e===-1&&n>0&&at(T(i),g[n-2]?.id??null),e===1&&n<g.length-1&&at(T(i),g[n+1]?.id??null))},jt=()=>{if(C==="inline"||k)return;const e=W();e?.id!=null&&(pe=Y()+1,ge([{op:"slide-duplicate",slide:e.id}],`slide ${e.n}`,`Duplicating slide ${e.n}…`))},It=e=>{if(C==="inline"||k)return;const n=W();e.id===null||n?.id==null||(pe=Y()+1,ge([{op:"slide-insert",slide:e.id,after:n.id}],`a slide after slide ${n.n}`,`Adding a slide after slide ${n.n}…`))},zt=()=>{if(C==="inline"||k)return;const e=W();e?.wid==null||g.length===0||(pe=Math.max(0,Y()-(Y()===g.length-1?1:0)),ge([{op:"remove",anchor:e.wid}],`slide ${e.n}`,`Deleting slide ${e.n}…`))},Wn=e=>{C==="inline"||k||j?.widMap[e]!==void 0&&ge([{op:"remove",anchor:e}],"part of the slide","Removing it…")};let Ue=null,dt=null,le=null;const ut=()=>{const e=g.find(v=>T(v)===Ue),n=dt;if(Ue=null,dt=null,e?.id==null||N.readOnly)return;const i=N.value.replace(/\r\n/g,`
244
+ `),c=e.notes,d=T(e),u=()=>{le?.key===d&&(le=null)};if(i.trim()===c.trim()){u();return}ge([{op:"notes-set",slide:e.id,text:i}],`slide ${e.n}’s notes`,`Saving slide ${e.n}’s notes…`,n,()=>{le={key:d,text:i},fe(`Not saved: the deck changed while you typed slide ${e.n}’s notes. They are still in the field; leave it again to save them over the change.`),E()}).then(v=>{v&&u()})};N.addEventListener("focus",()=>{Ue=U,dt=P}),N.addEventListener("blur",()=>ut()),N.addEventListener("keydown",e=>{if(e.stopPropagation(),!(F===2&&K==="options"&&gt(e,de,n=>{(n==="Tab"||n==="Shift+Tab")&&N.blur(),_("ui.key",{key:n})}))){if(e.altKey&&!e.metaKey&&!e.ctrlKey&&/^Key[A-Z]$/.test(e.code)&&Xe(`Alt+${e.code.slice(3)}`)){e.preventDefault(),_("ui.key",{key:`Alt+${e.code.slice(3)}`});return}if(e.key==="Escape"){e.preventDefault(),le?.key===U&&(le=null),N.value=W()?.notes??"",Ue=null,re.focus();return}if(e.key==="Enter"&&(e.metaKey||e.ctrlKey)){e.preventDefault(),F===2&&K==="options"?N.blur():re.focus();return}if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="k"){e.preventDefault(),_("ui.key",{key:"Mod+K"});return}if(e.key==="Tab"&&!e.shiftKey){e.preventDefault(),N.blur(),_("ui.key",{key:"Tab"});return}e.key==="Tab"&&e.shiftKey&&(e.preventDefault(),re.focus())}});const ae=()=>{G!==null&&(G=null,z.hidden=!0,z.value="",E())},Ut=(e,n)=>{if(C==="inline"||k||he||!Ze()||j===null||Pt(e)!=="yes")return;const i=j.blocks[e]?.text??"";G={wid:e,before:i},z.value=n??i,E(),z.focus(),n===null?z.select():z.setSelectionRange(z.value.length,z.value.length)},Hn=async()=>{if(G===null)return;const{wid:e,before:n}=G,i=z.value.replace(/\s*\n\s*/g," ");ae(),re.focus(),i!==n&&await ge([{op:"text",anchor:e,value:i,before:n}],`slide ${W()?.n??""}`,"Changing the text…")};z.addEventListener("keydown",e=>{if(e.stopPropagation(),(e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="k"){e.preventDefault(),ae(),_("ui.key",{key:"Mod+K"});return}e.key==="Enter"?(e.preventDefault(),Hn()):e.key==="Escape"&&(e.preventDefault(),ae(),re.focus())}),z.addEventListener("blur",()=>ae());const Jn=()=>{q.replaceChildren();const e=document.createElement("span");e.className="word",e.textContent="A blank slide laid out like",q.appendChild(e);for(const n of g){if(n.id===null)continue;const i=document.createElement("button");i.type="button";for(const[c,d]of Object.entries({role:"menuitem","data-testid":"deck-add-like"}))i.setAttribute(c,d);i.dataset.slideId=n.id,i.textContent=n.title===""?`Slide ${n.n}`:`Slide ${n.n} — ${n.title}`,i.addEventListener("click",()=>It(n)),q.appendChild(i)}Q=!0,E(),q.querySelector("button")?.focus()},ft=()=>{Q&&(Q=!1,E(),l.focus())};q.addEventListener("keydown",e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),ft();return}if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;e.preventDefault(),e.stopPropagation();const n=Array.from(q.querySelectorAll("button")),i=n.indexOf(document.activeElement);n[(i+(e.key==="ArrowDown"?1:n.length-1)+n.length)%n.length]?.focus()}),l.addEventListener("click",()=>Q?ft():Jn()),f.addEventListener("click",()=>jt()),y.addEventListener("click",()=>ct(-1)),x.addEventListener("click",()=>ct(1)),$.addEventListener("click",()=>zt()),b.addEventListener("click",()=>void Gn()),L.addEventListener("click",()=>{B=!B,E(),V(),B&&N.focus()}),Z.addEventListener("click",()=>{xe("ui.fullscreen",{}).then(e=>{e.ok||fe(e.error.message)})}),m.addEventListener("click",()=>{qe="fit",V(),E()}),S.addEventListener("click",()=>{qe="100",V(),E()});const Gn=async()=>{g.length!==0&&(ut(),k=!0,ze(null),ue.includes("ui.fullscreen")&&await xe("ui.fullscreen",{}),E(),V(),t.focus())},Vn=()=>{k=!1,E(),V(),t.focus()};window.addEventListener("resize",()=>{V(),E()}),typeof ResizeObserver=="function"&&new ResizeObserver(()=>{V(),E()}).observe(p);const Zn=()=>[...Array.from(r.querySelectorAll("button")).filter(()=>C!=="inline"&&!k),...Array.from(a.querySelectorAll("button")).filter(e=>!a.hidden&&!e.hidden&&!e.disabled),re,...C==="inline"||k||de.hidden?[]:[N]],Qn=e=>{ye=`${ye}${e}`.slice(-3),et!==null&&clearTimeout(et),et=setTimeout(()=>{ye=""},qn),fe(`Go to slide ${ye} — Enter`)};t.addEventListener("keydown",e=>{if(e.target===z||e.target===N||ve.contains(e.target)||F===2&&K==="options")return;const n=e.target?.tagName==="BUTTON",i=e.target?.dataset?.testid==="deck-thumb",c=e.key==="Enter"&&i&&ye!=="";if(n&&!c&&(e.key==="Enter"||e.key===" "))return;const d=e.metaKey||e.ctrlKey;if(e.key==="Escape"){if(e.preventDefault(),Q){ft();return}if(k){Vn();return}if(R!==null){ze(null);return}_("ui.key",{key:"Escape"});return}if(d&&!e.altKey&&e.key.toLowerCase()==="k"){e.preventDefault(),_("ui.key",{key:"Mod+K"});return}if(d&&e.shiftKey&&!e.altKey&&e.key.toLowerCase()==="n"){e.preventDefault();const u=W();u!==null&&It(u);return}if(d&&!e.shiftKey&&!e.altKey&&e.key.toLowerCase()==="d"){e.preventDefault(),jt();return}if(d&&!e.altKey&&(e.key==="Backspace"||e.key==="Delete")){e.preventDefault(),R!==null&&R!==W()?.wid?Wn(R):zt();return}if(e.altKey&&!d&&(e.key==="ArrowUp"||e.key==="ArrowDown")){e.preventDefault(),ct(e.key==="ArrowUp"?-1:1);return}if(e.altKey&&!d&&/^Key[A-Z]$/.test(e.code)&&Xe(`Alt+${e.code.slice(3)}`)){e.preventDefault(),_("ui.key",{key:`Alt+${e.code.slice(3)}`});return}if(e.key==="Tab"){e.preventDefault();const u=Zn(),v=u.indexOf(document.activeElement),M=v===-1&&document.activeElement===t&&!e.shiftKey?0:v+(e.shiftKey?-1:1);if(v===-1&&M!==0||M<0||M>=u.length){_("ui.key",{key:e.shiftKey?"Shift+Tab":"Tab"});return}u[M].focus();return}if(!(d||e.altKey)){if(e.key==="ArrowRight"||e.key==="PageDown"||e.key==="ArrowDown"&&!n){e.preventDefault(),Re(1);return}if(e.key==="ArrowLeft"||e.key==="PageUp"||e.key==="ArrowUp"&&!n){e.preventDefault(),Re(-1);return}if(e.key==="Home"){e.preventDefault();const u=g[0];u!==void 0&&Se(T(u));return}if(e.key==="End"){e.preventDefault();const u=g[g.length-1];u!==void 0&&Se(T(u));return}if(k&&e.key===" "){e.preventDefault(),Re(1);return}if(c){e.preventDefault();const u=g[Number(ye)-1];ye="",u!==void 0&&(Se(T(u)),r.querySelector(`[data-key="${CSS.escape(T(u))}"]`)?.focus()),fe(u===void 0?"There is no such slide":`Slide ${u.n}`);return}if(!(n&&e.key.length!==1)){if(e.key==="Enter"){R!==null&&!he&&(e.preventDefault(),Ut(R,null));return}if(e.key.length===1){if(e.preventDefault(),C!=="inline"&&!k&&R!==null&&!he){Ut(R,e.key);return}if(R===null){if(/^[0-9]$/.test(e.key)&&i){Qn(e.key);return}_("ui.typed",{grapheme:e.key})}}}}});const pt=e=>{const n=C;C=e,document.body.dataset.size=e,e==="inline"&&(k=!1,ae(),R=null,Q=!1,document.activeElement?.blur?.()),e!=="full"&&k&&(k=!1),F===1&&n==="inline"!=(e==="inline")&&g.length>0&&st(),V(),E()},Xt=e=>{if(!(typeof e!="object"||e===null))for(const[n,i]of Object.entries(e))/^--[a-z0-9-]+$/.test(n)&&typeof i=="string"&&i.length<=200&&!/url\(/i.test(i)&&document.documentElement.style.setProperty(n,i)},eo=e=>{const n=e.data;try{if(n===null||typeof n!="object"||n.p!==Me||n.v!==Pe)return;if(typeof n.re=="string"){const c=Ve.get(n.re);if(c===void 0)return;Ve.delete(n.re);const d=typeof n.payload=="object"&&n.payload!==null?n.payload:{};n.ok===!0?c({ok:!0,payload:d}):c({ok:!1,error:n.error??{code:"unavailable",message:"no answer"},payload:d});return}if(F===2&&Bt?.dispatch(n))return;const i=typeof n.payload=="object"&&n.payload!==null?n.payload:{};switch(n.type){case"host.ping":typeof n.id=="string"&&ie?.postMessage({p:Me,v:Pe,re:n.id,ok:!0,payload:{}});return;case"host.size":(i.size==="inline"||i.size==="pane"||i.size==="full")&&pt(i.size);return;case"host.theme":Xt(i.theme);return;case"artifact.changed":{const c=i.version;typeof c=="number"&&c!==P&&Ce(c);return}case"selection.cleared":R!==null&&(R=null,ae(),E());return;default:return}}catch{}};window.addEventListener("message",e=>{const n=e.data;if(ie!==null||n===null||typeof n!="object"||n.p!==Me||n.type!=="host.hello"||e.ports[0]===void 0)return;ie=e.ports[0],ie.onmessage=eo;const i=typeof n.payload=="object"&&n.payload!==null?n.payload:{};ue=Array.isArray(i.grants)?i.grants.filter(d=>typeof d=="string"):[];const c=on(i);F=c.protocol,K=c.surface,Oe=c.tab??"style",document.body.dataset.protocol=String(F),document.body.dataset.surface=K,Bt=new an(ie,{surface:d=>{d!=="options"&&(K=d,document.body.dataset.surface=d,pt(yt(d)))},action:d=>{if(K==="options"||d!=="prev"&&d!=="next")return{handled:!1};const u=Y()+(d==="next"?1:-1);return u<0||u>=g.length?{handled:!1}:(Re(d==="next"?1:-1),{handled:!0,status:`Slide ${Y()+1} of ${g.length}`})},tab:d=>{K!=="options"||d!=="style"&&d!=="notes"||(N.blur(),Oe=d,_t.refresh(),E())},selection:d=>{if(K==="options")for(const u of d){if(typeof u!="object"||u===null)continue;const v=u;if(v.kind!=="element"||typeof v.id!="string")continue;const M=g.find(ee=>ee.id===v.id||ee.wid===v.id)??Nt(v.id);if((g.length===0||M!==void 0)&&(ke=M===void 0?v.id:T(M)),M!==void 0){N.blur(),Se(T(M),!1);break}}}}),Xt(i.theme),pt(F===2?yt(K):c.size),Ce()}),sn(Kn,Gt)}return Dt(),H.oneSlideHtml=Je,H.start=Dt,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"}),H})({});
245
245
  </script>
246
246
  </body>
247
247
  </html>
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "wicked-doc",
3
3
  "title": "Document",
4
- "version": "0.16.13",
4
+ "version": "0.16.15",
5
5
  "protocol": [
6
6
  1,
7
7
  2