ScrapBindings
しようと思ったけど壊れてるやつ無くない...?wogikaze.icon
code:config.ts
import {
caret, getCharDOM, getLineDOM, press, insertText,
goHeadLine, goLastLine,
scrollUp, scrollDown,
useStatusBar,
} from "/api/code/takker/scrapbox-userscript-std/dom.ts";
import { setDebugMode } from "/api/code/takker/takker99%2FScrapBindings/mod.ts";
const pd = (e: Event) => e.preventDefault();
const sp = (e: Event) => e.stopPropagation();
import { popupMenu } from "/api/code/takker/scrapbox-userscript-std/dom.ts";
const clickPopup = (e: KeyboardEvent, buttonName: string | RegExp): void => {
const buttons = popupMenu()?.getElementsByClassName?.("button");
if (!buttons) return;
(button) => buttonName instanceof RegExp ?
buttonName.test(button.textContent ?? "") :
button.textContent === buttonName
);
if (!(button instanceof HTMLDivElement)) return;
if (e.target !== document.activeElement) return;
pd(e);sp(e);
button.click();
};
const popup = {
// link形式
".": (e: KeyboardEvent) => clickPopup(e, "link"),
"u": (e: KeyboardEvent) => clickPopup(e, "URL"),
"<Space>": (e: KeyboardEvent) => clickPopup(e, "Link"), "<C-space>": (e: KeyboardEvent) => clickPopup(e, "Link"), "<C-n>": (e: KeyboardEvent) => clickPopup(e, "\\n"),
"<C-m>": (e: KeyboardEvent) => clickPopup(e, "✨"), };
const navigation = {
// リンクを踏む
"<C-]>": (e: KeyboardEvent) => {
const { position: { line, char } } = caret();
const a = getCharDOM(line, char)?.closest("a.page-link")
// なかったらその行の中で一番先頭のリンクを踏む
?? getLineDOM(line)?.querySelector?.("a.page-link");
if (!(a instanceof HTMLAnchorElement)) return;
pd(e);sp(e);
a.click();
},
"<C-o>": (e: KeyboardEvent) => { pd(e);sp(e);history.back(); },
};
const motion = {
"<C-home>": (e: KeyboardEvent) => { pd(e);sp(e);goHeadLine(); },
"<C-end>": (e: KeyboardEvent) => { pd(e);sp(e);goLastLine(); },
};
import {
outdentLines, downLines, upLines, indentLines,
outdentBlocks, downBlocks, upBlocks, indentBlocks,
press, insertText, takeCursor, textInput
} from "/api/code/takker/scrapbox-userscript-std/dom.ts";
import { Scrapbox } from "/api/code/takker/scrapbox-jp%2Ftypes/userscript.ts";
declare const scrapbox: Scrapbox;
const edit = {
"<C-h>": (e: KeyboardEvent) => { pd(e);sp(e);outdentLines(); },
"<C-j>": (e: KeyboardEvent) => { pd(e);sp(e);downLines(); },
"<C-k>": (e: KeyboardEvent) => { pd(e);sp(e);upLines(); },
"<C-l>": (e: KeyboardEvent) => { pd(e);sp(e);indentLines(); },
"<A-h>": (e: KeyboardEvent) => { pd(e);sp(e);outdentBlocks(); },
"<A-j>": (e: KeyboardEvent) => { pd(e);sp(e);downBlocks(); },
"<A-k>": (e: KeyboardEvent) => { pd(e);sp(e);upBlocks(); },
"<A-l>": (e: KeyboardEvent) => { pd(e);sp(e);indentBlocks(); },
"<S-BS>": (e: KeyboardEvent) => { pd(e);sp(e);press("ArrowLeft", {ctrlKey: true,shiftKey: true}); },
"<A-Enter>": (e: KeyboardEvent) => { pd(e);sp(e);press("End");press("Enter") },
"<C-Enter>": async (e: KeyboardEvent) => { pd(e);sp(e);
if (scrapbox.Layout !== "page") return;
const cursor = takeCursor()
const line = cursor.getPosition().line;
const cursorLine = scrapbox.Page.linesline; if (!("codeBlock" in cursorLine) || cursorLine.codeBlock.start || cursorLine.codeBlock.end) {
press("End");
press("Enter");
press("ArrowUp",{ctrlKey: true});
return
}
press("End");
press("Enter");
cursor.setPosition({ line: cursor.getPosition().line, char: cursorLine.codeBlock.indent - 1 });
press("End", { shiftKey: true });
await insertText(code:${cursorLine.codeBlock.filename ?? ""});
press("Home");
press("Enter");
press("ArrowUp");
},
};
export const config = {
...popup,
...navigation,
...motion,
...edit,
};
code:main.ts
import { Mousetrap } from "/api/code/takker/takker99%2FScrapBindings/mod.ts";
import {
useStatusBar,
addTextInputEventListener,
removeTextInputEventListener,
} from "/api/code/takker/scrapbox-userscript-std/dom.ts";
import { config } from "/api/code/yuyasurarin/ScrapBindings/config.ts";
import { Scrapbox } from "/api/code/takker/scrapbox-jp%2Ftypes/userscript.ts";
declare const scrapbox: Scrapbox;
const { render } = useStatusBar();
let animationId: number| undefined;
const onSequenceUpdate = (text: string) => {
if(animationId !== undefined) cancelAnimationFrame(animationId);
animationId = requestAnimationFrame(() => render(
{ type: "text", text, }
));
};
const scrapBindings = new Mousetrap(
{
addEventListener: addTextInputEventListener,
removeEventListener: removeTextInputEventListener,
},
{
onSequenceUpdate,
},
);
const errors = scrapBindings.bind({
...config,
});
if(errors.size > 0) {
messages.map((message) => - ${message}).join("\n")
}`
).join("\n"));
}
code:minify.js
var v=(e,t)=>Object.hasOwn(e,t),_={left:"ArrowLeft",right:"ArrowRight",up:"ArrowUp",down:"ArrowDown",bs:"Backspace",menu:"ContextMenu",apps:"ContextMenu",del:"Delete",return:"Enter",cr:"Enter",esc:"Escape",pgup:"PageUp",pgdn:"PageDown",lt:"<",less:"<",lesser:"<",gt:">",greater:">"},Y=e=>{let t=e.toLowerCase();return v(_,t)?_t:e},q={Backquote:["","~"],Digit1:["1","!"],Digit2:["2","@"],Digit3:["3","#"],Digit4:["4","$"],Digit5:["5","%"],Digit6:["6","^"],Digit7:["7","&"],Digit8:["8","*"],Digit9:["9","("],Digit0:["0",")"],Minus:["-","_"],Equal:["=","+"],Backslash:["\\","|"],BracketLeft:["[","{"],BracketRight:["]","}"],Semicolon:[";",":"],Quote:["'",'"'],Comma:[",","<"],Period:[".",">"],Slash:["/","?"]},Te=(e,t)=>{if(e.startsWith("Key")){let n=e.slice(3);return t||(n=n.toLowerCase()),n}return v(q,e)?q[e][t?1:0]:e},F={"<":"lt",">":"gt"},Me=/^($|Unidentified$|Process$|Dead$|Alt|Control|Hyper|Meta|Shift|Super|OS)/,H=e=>{let t=e.shiftKey,n=e.key||"Unidentified";if(n==="Unidentified"?n=Te(e.code||"",t):(n=Y(n),n===" "&&(n="Space")),Me.test(n))return"";n.length===1?t=!1:n=n.toLowerCase();let r="";return e.altKey&&(r+="a-"),e.ctrlKey&&(r+="c-"),e.metaKey&&(r+="m-"),t&&(r+="s-"),v(F,n)&&(n=F[n]),r||n.length>1?<${r}${n}>:n},j={a:"altKey",c:"ctrlKey",m:"metaKey",s:"shiftKey"},ke=e=>{if(e.length===1)return/\s/.test(e)?{ok:!1,value:{name:"InvalidKeyError",key:e,message:Invalid key: ${e}}}:{ok:!0,value:{key:e}};let t=e.match(/^<((?:[a-z]-)*)([a-z\d]+|[^<>\s])>$/i);if(!t)return{ok:!1,value:{name:"InvalidKeyError",key:e,message:Invalid key: ${e}}};let[,n,r]=t,o={key:Y(r)};for(let i of n.split("-").slice(0,-1)){let a=i.toLowerCase();if(!v(j,a))return{ok:!1,value:{name:"UnknownModifierError",modifier:i,context:e,message:${e}: Unknown modifier: ${i}}};let c=j[a];if(o[c]!==void 0)return{ok:!1,value:{name:"DuplicateModifierError",modifier:i,context:e,message:${e}: Duplicate modifier: ${i}}};if(o[c]=!0,o.key.length===1&&o.shiftKey)return{ok:!1,value:{name:"DisallowedModifierError",modifier:i,context:e,message:${e}: Unusable modifier with single-character keys: ${i}}}}return{ok:!0,value:o}},z=e=>{let t=ke(e);return t.ok?{ok:!0,value:H(t.value)}:t},X=e=>e.match(/<[^<>\s]+>|[\s\S]|^$/g);var m=!1;var W=e=>Object.fromEntries([...Object.entries(console)].map(([t,n])=>{if(typeof n!="function")return[t,n];switch(t){case"warn":case"error":return[t,(...r)=>n(%c${e},"color: gray",...r)];case"log":case"info":case"debug":return[t,(...r)=>{m!==!0&&(!m||!m.has(e))||n(%c${e},"color: gray",...r)}];case"assert":return[t,(r,...o)=>{m!==!0&&(!m||!m.has(e))||n(r,%c${e},"color: gray",...o)}];case"time":case"timeEnd":return[t,r=>{m!==!0&&(!m||!m.has(e))||n(${e} ${r})}];default:return[t,(...r)=>{if(!(m!==!0&&(!m||!m.has(e))))return n(...r)}]}}));var h=W("ScrapBindings:mod.ts"),L=class{constructor(t,n){this.target=t;this.onSequenceUpdate=n?.onSequenceUpdate,this.flushInterval=n?.flushInterval??1e3}bind(t,n){let r=new Map,o=[];for(let[i,a]of t instanceof Map?t.entries():typeof t=="string"?[[t,n]]:Object.entries(t)){let c=V(i);if(!c.ok){for(let f of c.value)h.error(${i}: ${f.message});r.set(i,c.value);continue}let p=c.value;this.bindings.set(p,a),p.startsWith(this.currentSequence)&&this.filtered.add(p),o.push(p)}return h.debug("Binded the following commands:",o),this.emitChange(),r}unbind(...t){for(let n of t){let r=V(n);if(!r.ok)continue;let o=r.value;this.bindings.delete(o),this.filtered.delete(o)}this.emitChange()}reset(){this.bindings.clear(),this.emitChange()}bindings=new Map;onSequenceUpdate;flushInterval;_sequence="";set currentSequence(t){let n=this._sequence!==t;this._sequence=t,n&&this.onSequenceUpdate?.(t)}get currentSequence(){return this._sequence}prevBestMatchCommand;filtered=new Set;timer;backToInitial=()=>{clearTimeout(this.timer),this.currentSequence="",this.prevBestMatchCommand=void 0,this.filtered=new Set(this.bindings.keys()),h.debug("reset the sequence")};handleKeydown=t=>{if(!t.isTrusted)return;let n=H(t);if(!n)return;if(clearTimeout(this.timer),t.isComposing){this.backToInitial();return}this.currentSequence+=n,h.debug("sequence",this.currentSequence);let r;for(let i of this.filtered){if(i.startsWith(this.currentSequence)||this.filtered.delete(i),this.currentSequence!==i)continue;let a=this.bindings.get(i);if(!a){this.filtered.delete(i);continue}r=()=>{h.debug(run ${i});try{a(t)}catch(c){h.error(c)}finally{this.backToInitial()}}}let o=this.filtered.size;if(h.debug(${o} candidates: ${...this.filtered.keys().join(", ")}),o>0&&(this.prevBestMatchCommand=r),this.prevBestMatchCommand&&o<2){if(this.prevBestMatchCommand(),o===0){this.handleKeydown(t);return}return}if(o===0){this.backToInitial();return}t.preventDefault(),t.stopPropagation(),this.timer=setTimeout(this.prevBestMatchCommand??this.backToInitial,this.flushInterval)};emitChange=()=>{if(this.bindings.size===0){this.backToInitial(),this.target.removeEventListener("keydown",this.handleKeydown);return}this.target.addEventListener("keydown",this.handleKeydown)}},Ce={name:"InvalidSequenceError",message:"cannot parse the sequence"},V=e=>{let t=X(e);if(!t)return{ok:!1,value:[Ce]};let n="",r=[];for(let o of t){let i=z(o);if(!i.ok){r.push(i.value);continue}n+=i.value}return r.length>0?{ok:!1,value:r}:{ok:!0,value:n}};function w(e){return typeof e=="number"}function T(e){return typeof e=="string"}function E(e){return typeof e>"u"}var Q=!1;scrapbox.addListener("lines:changed",()=>Q=!1);scrapbox.addListener("layout:changed",()=>Q=!1);var G=(e,t)=>{if(!(e instanceof HTMLDivElement))throw new TypeError("${t}" must be HTMLDivElememt but actual is "${e}")};var J=(e,t)=>{if(!(e instanceof HTMLTextAreaElement))throw new TypeError("${t}" must be HTMLTextAreaElement but actual is "${e}")};var y=()=>D(document.getElementsByClassName("lines").item(0),"div.lines");var l=()=>{let e=document.getElementById("text-input");if(e)return J(e,"textarea#text-input"),e};var Z=()=>D(document.getElementsByClassName("popup-menu")?.[0],"div.popup-menu");var ee=()=>D(document.getElementsByClassName("status-bar")?.[0],"div.status-bar"),D=(e,t)=>{if(e)return G(e,t),e};var B=()=>{let e=y();if(!e)throw Error("div.lines is not found.");let t=Object.keys(e).find(n=>n.startsWith("__reactFiber"));if(!t)throw Error('div.lines must has the property whose name starts with "__reactFiber"');return e[t].return.stateNode.props.lines};var te=e=>{if(E(e))return;if(w(e))return De(e)?.id;if(T(e))return e.startsWith("L")?e.slice(1):e;if(e.classList.contains("line"))return e.id.slice(1);let t=e.closest(".line");if(t)return t.id.slice(1)};var De=e=>{if(E(e))return;if(w(e))return B()[e];let t=te(e);return t?B().find(n=>n.id===t):void 0},M=e=>{if(Be(e))return e;let t=te(e);if(E(t))return t;let n=document.getElementById(L${t});if(!E(n))return n},Be=e=>e instanceof HTMLDivElement&&e.classList.contains("line");var ne=()=>{let e=y()?.firstElementChild;if(!E(e))return e},re=()=>{let e=y()?.lastElementChild;if(!E(e))return e};var oe=e=>e instanceof HTMLSpanElement&&e.classList.contains("char-index");var ie=e=>{let t=e?.getElementsByClassName?.("c-0")?.[0];return oe(t)?t:void 0};var I=(e,t)=>{let n=M(e)?.getElementsByClassName?.(c-${t})?.[0];return oe(n)?n:void 0};var s=(e,t)=>{let{noModifiedKeys:n=!1,...r}=t??{},o={bubbles:!0,cancelable:!0,keyCode:Ie[e],...n?{}:{...r}},i=l();if(!i)throw Error("#text-input must exist.");i.dispatchEvent(new KeyboardEvent("keydown",o)),i.dispatchEvent(new KeyboardEvent("keyup",o))},Ie={Backspace:8,Tab:9,Enter:13,Delete:46,Escape:27," ":32,PageUp:33,PageDown:34,End:35,Home:36,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,a:65,A:65,b:66,B:66,c:67,C:67,d:68,D:68,e:69,E:69,f:70,F:70,g:71,G:71,h:72,H:72,i:73,I:73,j:74,J:74,k:75,K:75,l:76,L:76,m:77,M:77,n:78,N:78,o:79,O:79,p:80,P:80,q:81,Q:81,r:82,R:82,s:83,S:83,t:84,T:84,u:85,U:85,v:86,V:86,w:87,W:87,x:88,X:88,y:89,Y:89,z:90,Z:90,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,F1:113,F2:114,F3:115,F4:116,F5:117,F6:118,F7:119,F8:120,F9:121,F10:122,F11:123,F12:124,":":186,"*":186,";":187,"+":187,"-":189,"=":189,".":190,">":190,"/":191,"?":191,"@":192,"":192,"":219,"{":219,"\\":220,"|":220,"":221,"}":221,"^":222,"~":222,_:226};function k(e,t={}){let{signal:n,persistent:r=!0}=t;return n?.aborted?Promise.reject(n.reason):new Promise((o,i)=>{let a=()=>{clearTimeout(p),i(n?.reason)},p=setTimeout(()=>{n?.removeEventListener("abort",a),o()},e);if(n?.addEventListener("abort",a,{once:!0}),r===!1)try{Deno.unrefTimer(p)}catch(f){if(!(f instanceof ReferenceError))throw f;console.error("persistent option is only available in Deno")}})}var S=async(e,t)=>{let n={button:t.button??0,clientX:t.X,clientY:t.Y,bubbles:!0,cancelable:!0,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,view:window};e.dispatchEvent(new MouseEvent("mousedown",n)),e.dispatchEvent(new MouseEvent("mouseup",n)),e.dispatchEvent(new MouseEvent("click",n)),await k(10)};var A=()=>{let e=l();if(!e)throw Error("#text-input is not found.");let t=Object.keys(e).find(n=>n.startsWith("__reactFiber"));if(!t)throw Error('div.cursor must has the property whose name starts with "__reactFiber"');return et.return.return.stateNode.props};var P=e=>{let{top:t,bottom:n}=e.getBoundingClientRect();return t>=0&&n<=globalThis.innerHeight};function*g(e,t){for(let n=e;n<t;n++)yield n}var se=async()=>{let e=ne();if(!e)throw Error(".line:first-of-type can't be found.");P(e)||e.scrollIntoView({block:"center"});let t=ie(e);if(!t)throw Error(".line:first-of-type .c-0 can't be found.");let{left:n,top:r}=t.getBoundingClientRect();await S(e,{X:n,Y:r})},ae=async()=>{await Ae(re())};var Ae=async e=>{if(!e)throw Error("The target line DOM is failed to find.");P(e)||e.scrollIntoView({block:"center"});let{right:t,top:n,height:r}=e.getElementsByClassName("text")0.getBoundingClientRect();await S(e,{X:t+1,Y:n+r/2})};var ce=(e=1)=>{for(let t of g(0,e))s("ArrowRight",{ctrlKey:!0})},de=(e=1)=>{for(let t of g(0,e))s("ArrowLeft",{ctrlKey:!0})};var ue=(e=1)=>{for(let t of g(0,e))s("ArrowUp",{ctrlKey:!0})},le=(e=1)=>{for(let t of g(0,e))s("ArrowDown",{ctrlKey:!0})},pe=(e=1)=>{for(let t of g(0,e))s("ArrowRight",{altKey:!0})},me=(e=1)=>{for(let t of g(0,e))s("ArrowLeft",{altKey:!0})};var fe=(e=1)=>{for(let t of g(0,e))s("ArrowUp",{altKey:!0})},ge=(e=1)=>{for(let t of g(0,e))s("ArrowDown",{altKey:!0})},$=async e=>{let t=l();if(!t)throw Error("#text-input is not ditected.");t.focus(),t.value=e;let n=new InputEvent("input",{bubbles:!0});t.dispatchEvent(n),await k(1)};var he=()=>{let e=ee();if(!e)throw new Error("div.status-bar can't be found");let t=document.createElement("div");return e.append(t),{render:(...n)=>{t.textContent="";let r=Ee(...n);r&&t.append(r)},dispose:()=>t.remove()}},Ee=(...e)=>{let t=e.flatMap(r=>{switch(r.type){case"spinner":returnPe();case"check-circle":return$e();case"exclamation-triangle":returnOe();case"text":returnC(r.text);case"group":{let o=Ee(...r.items);return o?o:[]}}});if(t.length===0)return;if(t.length===1)return t0;let n=document.createElement("span");return n.classList.add("item-group"),n.append(...t),n},C=e=>{let t=document.createElement("span");return t.classList.add("item"),t.append(e),t},Pe=()=>{let e=document.createElement("i");return e.classList.add("fa","fa-spinner"),C(e)},$e=()=>{let e=document.createElement("i");return e.classList.add("kamon","kamon-check-circle"),C(e)},Oe=()=>{let e=document.createElement("i");return e.classList.add("fas","fa-exclamation-triangle"),C(e)};var O=()=>{let e=l();if(!e)throw Error("#text-input is not found.");let t=Object.keys(e).find(i=>i.startsWith("__reactFiber"));if(!t)throw Error('#text-input must has the property whose name starts with "__reactFiber"');let n=et.return.return.stateNode._stores,r=n.find(i=>i.constructor.name==="Cursor");if(!r)throw Error('#text-input must has a "Cursor" store.');let o=n.find(i=>i.constructor.name==="Selection");if(!o)throw Error('#text-input must has a "Selection" store.');return{cursor:r,selection:o}};var xe=()=>O().cursor;var b=e=>e===void 0?0:typeof e=="boolean"?Number(e):(e.capture?1:0)|(e.once?2:0)|(e.passive?4:0),ye=e=>{if(e===0)return;let t={};return e&1&&(t.capture=!0),e&2&&(t.once=!0),e&4&&(t.passive=!0),t};var K=new Map,U=new Map,be=(e,t,n)=>{let r=K.get(e)??new Map,o=r.get(t)??new Set;if(o.has(b(n)))return;if(o.add(b(n)),r.set(t,o),K.set(e,r),typeof n=="object"&&n?.once){let a=U.get(t)??new Map,c=b(n),p=function(we){return R(e,t,n),a.delete(c),t.call(this,we)};a.set(c,p),U.set(t,a);let f=l();if(!f)return;f.addEventListener(e,p,n)}let i=l();i&&i.addEventListener(e,t,n)};scrapbox.on("layout:changed",()=>{let e=l();if(e)for(lett,nof K)for(letr,oof n)for(let i of o)e.addEventListener(t,r,ye(i))});var R=(e,t,n)=>{let r=K.get(e);if(!r)return;let o=r.get(t);if(!o)return;let i=b(n);if(o.delete(i),typeof n=="object"&&n?.once){let c=U.get(t);if(!c)return;let p=c.get(i);if(!p)return;let f=l();if(!f)return;f.removeEventListener(e,p,n),c.delete(i);return}let a=l();a&&a.removeEventListener(e,t,n)};var d=e=>e.preventDefault(),u=e=>e.stopPropagation(),x=(e,t)=>{let n=Z()?.getElementsByClassName?.("button");if(!n)return;let r=...n.find(o=>t instanceof RegExp?t.test(o.textContent??""):o.textContent===t);r instanceof HTMLDivElement&&e.target===document.activeElement&&(d(e),u(e),r.click())},Ue={".":e=>x(e,"link"),u:e=>x(e,"URL"),"<Space>":e=>x(e,"Link"),"<C-space>":e=>x(e,"Link"),"<C-n>":e=>x(e,"\\n"),"<C-m>":e=>x(e,"✨")},Re={"<C-]>":e=>{let{position:{line:t,char:n}}=A(),r=I(t,n)?.closest("a.page-link")??M(t)?.querySelector?.("a.page-link");r instanceof HTMLAnchorElement&&(d(e),u(e),r.click())},"<C-o>":e=>{d(e),u(e),history.back()}},Ne={"<C-home>":e=>{d(e),u(e),se()},"<C-end>":e=>{d(e),u(e),ae()}},_e={"<C-h>":e=>{d(e),u(e),de()},"<C-j>":e=>{d(e),u(e),le()},"<C-k>":e=>{d(e),u(e),ue()},"<C-l>":e=>{d(e),u(e),ce()},"<A-h>":e=>{d(e),u(e),me()},"<A-j>":e=>{d(e),u(e),ge()},"<A-k>":e=>{d(e),u(e),fe()},"<A-l>":e=>{d(e),u(e),pe()},"<S-BS>":e=>{d(e),u(e),s("ArrowLeft",{ctrlKey:!0,shiftKey:!0})},"<A-Enter>":e=>{d(e),u(e),s("End"),s("Enter")},"<C-Enter>":async e=>{if(d(e),u(e),scrapbox.Layout!=="page")return;let t=xe(),n=t.getPosition().line,r=scrapbox.Page.linesn;if(!("codeBlock"in r)||r.codeBlock.start||r.codeBlock.end){s("End"),s("Enter"),s("ArrowUp",{ctrlKey:!0});return}s("End"),s("Enter"),t.setPosition({line:t.getPosition().line,char:r.codeBlock.indent-1}),s("End",{shiftKey:!0}),await $(code:${r.codeBlock.filename??""}),s("Home"),s("Enter"),s("ArrowUp")}},ve={...Ue,...Re,...Ne,..._e};var{render:qe}=he(),N,Fe=e=>{N!==void 0&&cancelAnimationFrame(N),N=requestAnimationFrame(()=>qe({type:"text",text:e}))},je=new L({addEventListener:be,removeEventListener:R},{onSequenceUpdate:Fe}),Le=je.bind({...ve});Le.size>0&&alert(...Le.entries().map((e,t)=>`${e}: ${t.map(n=>- ${n}).join(`
)}).join(`
`));