8 lines
172 KiB
JavaScript
Raw Normal View History

"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["asciinema-player"],{"./node_modules/asciinema-player/dist/index.js":function(GB,TA,WA){WA.r(TA),WA.d(TA,{create:function(){return wQ}});const EA={};function hB(A){EA.context=A}const fB=(A,g)=>A===g,eA=Symbol("solid-proxy"),ZA=Symbol("solid-track"),jA={equals:fB};let mg=Og;const wA=1,PA=2,pg={owned:null,cleanups:null,context:null,owner:null};var z=null;let uA=null,H=null,X=null,nA=null,cg=0;function yA(A,g){const B=H,I=z,Q=A.length===0,C=Q?pg:{owned:null,cleanups:null,context:null,owner:g===void 0?I:g},e=Q?A:()=>A(()=>VA(()=>gg(C)));z=C,H=null;try{return FA(e,!0)}finally{H=B,z=I}}function BA(A,g){g=g?Object.assign({},jA,g):jA;const B={value:A,observers:null,observerSlots:null,comparator:g.equals||void 0},I=Q=>(typeof Q=="function"&&(Q=Q(B.value)),bg(B,Q));return[Kg.bind(B),I]}function IA(A,g,B){const I=lg(A,g,!1,wA);UA(I)}function uB(A,g,B){mg=NB;const I=lg(A,g,!1,wA);I.user=!0,nA?nA.push(I):UA(I)}function _(A,g,B){B=B?Object.assign({},jA,B):jA;const I=lg(A,g,!0,0);return I.observers=null,I.observerSlots=null,I.comparator=B.equals||void 0,UA(I),Kg.bind(I)}function iA(A){return FA(A,!1)}function VA(A){if(H===null)return A();const g=H;H=null;try{return A()}finally{H=g}}function dB(A){uB(()=>VA(A))}function $A(A){return z===null||(z.cleanups===null?z.cleanups=[A]:z.cleanups.push(A)),A}function Hg(){return H}function yB(A){const g=_(A),B=_(()=>Dg(g()));return B.toArray=()=>{const I=B();return Array.isArray(I)?I:I!=null?[I]:[]},B}function Kg(){const A=uA;if(this.sources&&(this.state||A))if(this.state===wA||A)UA(this);else{const g=X;X=null,FA(()=>Ag(this),!1),X=g}if(H){const g=this.observers?this.observers.length:0;H.sources?(H.sources.push(this),H.sourceSlots.push(g)):(H.sources=[this],H.sourceSlots=[g]),this.observers?(this.observers.push(H),this.observerSlots.push(H.sources.length-1)):(this.observers=[H],this.observerSlots=[H.sources.length-1])}return this.value}function bg(A,g,B){let I=A.value;return(!A.comparator||!A.comparator(I,g))&&(A.value=g,A.observers&&A.observers.length&&FA(()=>{for(let Q=0;Q<A.observers.length;Q+=1){const C=A.observers[Q],e=uA&&uA.running;e&&uA.disposed.has(C),(e&&!C.tState||!e&&!C.state)&&(C.pure?X.push(C):nA.push(C),C.observers&&xg(C)),e||(C.state=wA)}if(X.length>1e6)throw X=[],new Error},!1)),g}function UA(A){if(!A.fn)return;gg(A);const g=z,B=H,I=cg;H=z=A,FB(A,A.value,I),H=B,z=g}function FB(A,g,B){let I;try{I=A.fn(g)}catch(Q){A.pure&&(A.state=wA,A.owned&&A.owned.forEach(gg),A.owned=null),zg(Q)}(!A.updatedAt||A.updatedAt<=B)&&(A.updatedAt!=null&&"observers"in A?bg(A,I):A.value=I,A.updatedAt=B)}function lg(A,g,B,I=wA,Q){const C={fn:A,state:I,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:g,owner:z,context:null,pure:B};return z===null||z!==pg&&(z.owned?z.owned.push(C):z.owned=[C]),C}function _A(A){const g=uA;if(A.state===0||g)return;if(A.state===PA||g)return Ag(A);if(A.suspense&&VA(A.suspense.inFallback))return A.suspense.effects.push(A);const B=[A];for(;(A=A.owner)&&(!A.updatedAt||A.updatedAt<cg);)(A.state||g)&&B.push(A);for(let I=B.length-1;I>=0;I--)if(A=B[I],A.state===wA||g)UA(A);else if(A.state===PA||g){const Q=X;X=null,FA(()=>Ag(A,B[0]),!1),X=Q}}function FA(A,g){if(X)return A();let B=!1;g||(X=[]),nA?B=!0:nA=[],cg++;try{const I=A();return YB(B),I}catch(I){B||(nA=null),X=null,zg(I)}}function YB(A){if(X&&(Og(X),X=null),A)return;const g=nA;nA=null,g.length&&FA(()=>mg(g),!1)}function Og(A){for(let g=0;g<A.length;g++)_A(A[g])}function NB(A){let g,B=0;for(g=0;g<A.length;g++){const I=A[g];I.user?A[B++]=I:_A(I)}for(EA.context&&hB(),g=0;g<B;g++)_A(A[g])}function Ag(A,g){const B=uA;A.state=0;for(let I=0;I<A.sources.length;I+=1){const Q=A.sources[I];Q.sources&&(Q.state===wA||B?Q!==g&&_A(Q):(Q.state===PA||B)&&Ag(Q,g))}}function xg(A){const g=uA;for(let B=0;B<A.observers.length;B+=1){const I=A.observers[B];(!I.state||g)&&(I.state=PA,I.pure?X.push(I):nA.push(I),I.observers&&xg(I))}}function gg(A){let g;if(A.sources)for(;A.sources.length;){const B=A.sources.pop(),I=A.sourceSlots.pop(),Q=B.observers;if(Q&&Q.length){con
${A.stack}`:I}let ig=0;const tg=new TextEncoder("utf-8"),HB=typeof tg.encodeInto=="function"?function(A,g){return tg.encodeInto(A,g)}:function(A,g){const B=tg.encode(A);return g.set(B),{read:A.length,written:B.length}};function $g(A,g,B){if(B===void 0){const E=tg.encode(A),i=g(E.length);return Eg().subarray(i,i+E.length).set(E),ig=E.length,i}let I=A.length,Q=g(I);const C=Eg();let e=0;for(;e<I;e++){const E=A.charCodeAt(e);if(E>127)break;C[Q+e]=E}if(e!==I){e!==0&&(A=A.slice(e)),Q=B(Q,I,I=e+A.length*3);const E=Eg().subarray(Q+e,Q+I),i=HB(A,E);e+=i.written}return ig=e,Q}let pA=null;function kA(){return(pA===null||pA.byteLength===0)&&(pA=new Int32Array(S.memory.buffer)),pA}function KB(A,g,B,I){const Q=S.create(A,g,B,I);return sg.__wrap(Q)}let HA=null;function bB(){return(HA===null||HA.byteLength===0)&&(HA=new Uint32Array(S.memory.buffer)),HA}function OB(A,g){return bB().subarray(A/4,A/4+g)}class sg{static __wrap(g){const B=Object.create(sg.prototype);return B.ptr=g,B}__destroy_into_raw(){const g=this.ptr;return this.ptr=0,g}free(){const g=this.__destroy_into_raw();S.__wbg_vtwrapper_free(g)}feed(g){const B=$g(g,S.__wbindgen_malloc,S.__wbindgen_realloc),I=ig,Q=S.vtwrapper_feed(this.ptr,B,I);return dA(Q)}inspect(){try{const I=S.__wbindgen_add_to_stack_pointer(-16);S.vtwrapper_inspect(I,this.ptr);var g=kA()[I/4+0],B=kA()[I/4+1];return eg(g,B)}finally{S.__wbindgen_add_to_stack_pointer(16),S.__wbindgen_free(g,B)}}get_size(){try{const Q=S.__wbindgen_add_to_stack_pointer(-16);S.vtwrapper_get_size(Q,this.ptr);var g=kA()[Q/4+0],B=kA()[Q/4+1],I=OB(g,B).slice();return S.__wbindgen_free(g,B*4),I}finally{S.__wbindgen_add_to_stack_pointer(16)}}get_line(g){const B=S.vtwrapper_get_line(this.ptr,g);return dA(B)}get_cursor(){const g=S.vtwrapper_get_cursor(this.ptr);return dA(g)}}async function xB(A,g){if(typeof Response=="function"&&A instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(A,g)}catch(I){if(A.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",I);else throw I}const B=await A.arrayBuffer();return await WebAssembly.instantiate(B,g)}else{const B=await WebAssembly.instantiate(A,g);return B instanceof WebAssembly.Instance?{instance:B,module:A}:B}}function _g(){const A={};return A.wbg={},A.wbg.__wbindgen_object_drop_ref=function(g){dA(g)},A.wbg.__wbindgen_error_new=function(g,B){const I=new Error(eg(g,B));return cA(I)},A.wbg.__wbindgen_object_clone_ref=function(g){const B=aA(g);return cA(B)},A.wbg.__wbindgen_number_new=function(g){return cA(g)},A.wbg.__wbindgen_bigint_from_u64=function(g){const B=BigInt.asUintN(64,g);return cA(B)},A.wbg.__wbindgen_string_new=function(g,B){const I=eg(g,B);return cA(I)},A.wbg.__wbg_set_20cbc34131e76824=function(g,B,I){aA(g)[dA(B)]=dA(I)},A.wbg.__wbg_new_b525de17f44a8943=function(){const g=new Array;return cA(g)},A.wbg.__wbg_new_f841cc6f2098f4b5=function(){return cA(new Map)},A.wbg.__wbg_new_f9876326328f45ed=function(){const g=new Object;return cA(g)},A.wbg.__wbindgen_is_string=function(g){return typeof aA(g)=="string"},A.wbg.__wbg_set_17224bc548dd1d7b=function(g,B,I){aA(g)[B>>>0]=dA(I)},A.wbg.__wbg_set_388c4c6422704173=function(g,B,I){const Q=aA(g).set(aA(B),aA(I));return cA(Q)},A.wbg.__wbindgen_debug_string=function(g,B){const I=dg(aA(B)),Q=$g(I,S.__wbindgen_malloc,S.__wbindgen_realloc),C=ig;kA()[g/4+1]=C,kA()[g/4+0]=Q},A.wbg.__wbindgen_throw=function(g,B){throw new Error(eg(g,B))},A}function AB(A,g){return S=A.exports,yg.__wbindgen_wasm_module=g,pA=null,HA=null,mA=null,S}function zB(A){const g=_g();A instanceof WebAssembly.Module||(A=new WebAssembly.Module(A));const B=new WebAssembly.Instance(A,g);return AB(B,A)}async function yg(A){const g=_g();(typeof A=="string"||typeof Request=="function"&&A instanceof Request||typeof URL=="function"&&A instanceof URL)&&(A=fetch(A));const{instance:B,module:I}=await xB(await A,g);return AB(B,I)
`);let B;try{B=JSON.parse(g[0])}catch{return}const I=new QA(g).drop(1).filter(Q=>Q[0]==="[").map(JSON.parse).toArray();return{header:B,events:I}}function XI(A){let g=0;const B=new QA(A.stdout).map(I=>(g+=I[0],[g,"o",I[1]]));return{cols:A.width,rows:A.height,events:B}}function vI(A,g){return{cols:A.width,rows:A.height,theme:TI(A.theme),events:g,idleTimeLimit:A.idle_time_limit}}function TI(A){const g=/^#[0-9A-Fa-f]{6}$/,B=/^(#[0-9A-Fa-f]{6}:){7,}#[0-9A-Fa-f]{6}$/,I=A?.fg,Q=A?.bg,C=A?.palette;if(g.test(I)&&g.test(Q)&&B.test(C))return{foreground:I,background:Q,palette:C.split(":")}}function WI(A){const g=JSON.stringify({version:2,width:A.cols,height:A.rows}),B=A.events.map(JSON.stringify).join(`
`);return`${g}
${B}
`}function ZI(A,g,B){let{feed:I,onInput:Q,onMarker:C,now:e,setTimeout:E,setState:i,logger:t}=g,{idleTimeLimit:s,startAt:n,loop:o,posterTime:V,markers:c,pauseOnMarkers:G,cols:D,rows:u}=B,r,F,N,R,b,W,O,L=0,Z=0,P,m,tA=0;async function p(){const{parser:l,minFrameTime:d,inputOffset:f,dumpFilename:J,encoding:x="utf-8"}=A,fA=PI(await l(await h(A),{encoding:x}),t,{idleTimeLimit:s,startAt:n,minFrameTime:d,inputOffset:f,markers_:c});if({cols:r,rows:F,events:N,duration:b,effectiveStartAt:W}=fA,D=D??r,u=u??F,N.length===0)throw"recording is missing events";J!==void 0&&gQ(fA,J);const Lg=V!==void 0?Jg(V):void 0;return R=N.filter(vA=>vA[1]==="m").map(vA=>[vA[0],vA[2].label]),{cols:r,rows:F,duration:b,theme:fA.theme,poster:Lg,markers:R}}function h(l){let{url:d,data:f,fetchOpts:J={}}=l;if(typeof d=="string")return w(d,J);if(Array.isArray(d))return Promise.all(d.map(x=>w(x,J)));if(f!==void 0)return typeof f=="function"&&(f=f()),f instanceof Promise||(f=Promise.resolve(f)),f.then(x=>typeof x=="string"||x instanceof ArrayBuffer?new Response(x):x);throw"failed fetching recording file: url/data missing in src"}async function w(l,d){const f=await fetch(l,d);if(!f.ok)throw`failed fetching recording from ${l}: ${f.status} ${f.statusText}`;return f}function Y(l){let d=l*1e3-(e()-P);return d<0&&(d=0),d}function U(){const l=N[L];l?O=E(k,Y(l[0])):sA()}function k(){let l=N[L],d;do{if(Z=l[0],L++,gA(l))return;l=N[L],d=e()-P}while(l&&d>l[0]*1e3);U()}function $(){clearTimeout(O),O=null}function gA(l){const[d,f,J]=l;if(f==="o")I(J);else if(f==="i")Q(J);else if(f==="m"&&(C(J),G))return CA(),m=d*1e3,i("stopped",{reason:"paused"}),!0;return!1}function sA(){$(),tA++,o===!0||typeof o=="number"&&tA<o?(L=0,P=e(),I("\x1Bc"),XA(),U()):(m=b*1e3,W=null,i("stopped",{reason:"ended"}))}function xA(){return O||(N[L]===void 0&&(W=0),W!==null&&hA(W),DA()),!0}function CA(){return O&&($(),m=e()-P),!0}function DA(){P=e()-m,m=null,U()}function hA(l){const d=!!O;CA();const f=(m??0)/1e3;if(typeof l=="string")l==="<<"?l=f-5:l===">>"?l=f+5:l==="<<<"?l=f-.1*b:l===">>>"?l=f+.1*b:l[l.length-1]==="%"&&(l=parseFloat(l.substring(0,l.length-1))/100*b);else if(typeof l=="object"){if(l.marker==="prev")l=zA(f)??0,d&&f-l<1&&(l=zA(l)??0);else if(l.marker==="next")l=rg(f)??b;else if(typeof l.marker=="number"){const fA=R[l.marker];if(fA===void 0)throw`invalid marker index: ${l.marker}`;l=fA[0]}}const J=Math.min(Math.max(l,0),b);J<Z&&(I("\x1Bc"),XA(),L=0,Z=0);let x=N[L];for(;x&&x[0]<=J;)x[1]==="o"&&gA(x),Z=x[0],x=N[++L];return m=J*1e3,W=null,d&&DA(),!0}function zA(l){if(R.length==0)return;let d=0,f=R[d],J;for(;f&&f[0]<l;)J=f[0],f=R[++d];return J}function rg(l){if(R.length==0)return;let d=R.length-1,f=R[d],J;for(;f&&f[0]>l;)J=f[0],f=R[--d];return J}function Ug(){let l=N[L++];for(;l!==void 0&&l[1]!=="o";)l=N[L++];if(l===void 0)return;I(l[2]);const d=l[0];Z=d,m=d*1e3,W=null}function Jg(l){return N.filter(d=>d[0]<l&&d[1]==="o").map(d=>d[2])}function Sg(){return O?(e()-P)/1e3:(m??0)/1e3}function XA(){I(`\x1B[8;${u};${D};t`)}return{init:p,play:xA,pause:CA,seek:hA,step:Ug,stop:CA,getCurrentTime:Sg}}function jI(A){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:.016666666666666666,B;return I=>{let Q=0,C=0;return{step:e=>{if(Q++,B===void 0){B=e;return}e[1]===B[1]&&e[0]-B[0]<g?e[1]==="m"&&e[2]!==""?B[2]=e[2]:B[2]+=e[2]:(I(B),B=e,C++)},flush:()=>{B!==void 0&&(I(B),C++),A.debug(`batched ${Q} frames to ${C} frames`)}}}}function PI(A,g,B){let{startAt:I=0,idleTimeLimit:Q,minFrameTime:C,inputOffset:e,markers_:E}=B,{events:i}=A;i===void 0&&(i=$I(A)),i instanceof QA||(i=new QA(i)),Q=Q??A.idleTimeLimit??1/0;const t={offset:0};i=i.map(_I).transform(jI(g,C)).map(AQ(Q,I,t)).map(rB()),E!==void 0&&(E=new QA(E).map(VB),i=i.filter(o=>o[1]!=="m").multiplex(E,(o,V)=>o[0]<V[0]).map(rB())),i=i.toArray(),e!==void 0&&(i=i.map(o=>o[1]==="i"?[o[0]+e,o[1],o[2]]:o),i.sort((o,V)=>o[0]-V[0]));const s=i[i.length-1][0],n=I-t.offset;return{...A,events:i,duration:s,effectiveStartAt:n}}function $I(A){let{output:g=[],input:B=[],markers:I=[]}=A;const Q=new QA(g).map(E=>[E[0],"o",E[1]]),C=new QA(B).map(E=>[E[0],"i",E[1]]),e=ne
`).filter(D=>D.length>0).map(D=>D.split(" "));e[0].length<3&&(e=e.map(D=>["O",D[0],D[1]]));const E=await A[1].arrayBuffer(),i=new Uint8Array(E),t=i.findIndex(D=>D==10)+1,n=I.decode(i.subarray(0,t)).match(/COLUMNS="(\d+)" LINES="(\d+)"/);n!==null&&(Q=parseInt(n[1],10),C=parseInt(n[2],10));const o={array:i,cursor:t};let V=o;if(A[2]!==void 0){const D=await A[2].arrayBuffer();V={array:new Uint8Array(D),cursor:t}}const c=[];let G=0;for(const D of e)if(G+=parseFloat(D[1]),D[0]==="O"){const u=parseInt(D[2],10),r=o.array.subarray(o.cursor,o.cursor+u),F=I.decode(r);c.push([G,"o",F]),o.cursor+=u}else if(D[0]==="I"){const u=parseInt(D[2],10),r=V.array.subarray(V.cursor,V.cursor+u),F=I.decode(r);c.push([G,"i",F]),V.cursor+=u}else if(D[0]==="S"&&D[2]==="SIGWINCH"){const u=parseInt(D[4].slice(5),10),r=parseInt(D[3].slice(5),10);c.push([G,"r",`${u}x${r}`])}else D[0]==="H"&&D[2]==="COLUMNS"?Q=parseInt(D[3],10):D[0]==="H"&&D[2]==="LINES"&&(C=parseInt(D[3],10));return Q=Q??80,C=C??24,{cols:Q,rows:C,events:c}}async function lQ(A,g){let{encoding:B}=g;const I=new TextDecoder(B),Q=await A.arrayBuffer(),C=new Uint8Array(Q),e=qg(C),E=e.time,t=I.decode(e.data).match(/\x1b\[8;(\d+);(\d+)t/),s=[];let n=80,o=24;t!==null&&(n=parseInt(t[2],10),o=parseInt(t[1],10));let V=0,c=qg(C);for(;c!==void 0;){const G=c.time-E,D=I.decode(c.data);s.push([G,"o",D]),V+=c.len,c=qg(C.subarray(V))}return{cols:n,rows:o,events:s}}function qg(A){if(A.length<13)return;const g=DQ(A.subarray(0,8)),B=Mg(A.subarray(8,12)),I=A.subarray(12,12+B);return{time:g,data:I,len:B+12}}function Mg(A){return A[0]+A[1]*256+A[2]*256*256+A[3]*256*256*256}function DQ(A){const g=Mg(A.subarray(0,4)),B=Mg(A.subarray(4,8));return g+B/1e6}const DB=new Map([["benchmark",QQ],["clock",BQ],["eventsource",aQ],["random",IQ],["recording",ZI],["websocket",rQ]]),wB=new Map([["asciicast",nB],["typescript",cQ],["ttyrec",lQ]]);function wQ(A,g){let B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const I=B.logger??new LI,Q=new CI(GQ(A),{logger:I,cols:B.cols,rows:B.rows,loop:B.loop,speed:B.speed,preload:B.preload,startAt:B.startAt,poster:B.poster,markers:B.markers,pauseOnMarkers:B.pauseOnMarkers,idleTimeLimit:B.idleTimeLimit}),C=hQ(B.terminalFontFamily,B.terminalLineHeight),e={logger:I,core:Q,cols:B.cols,rows:B.rows,fit:B.fit,controls:B.controls??"auto",autoPlay:B.autoPlay??B.autoplay,terminalFontSize:B.terminalFontSize,terminalFontFamily:B.terminalFontFamily,terminalLineHeight:B.terminalLineHeight,theme:B.theme,...C};let E;const i=Wg(()=>(E=M(SI,e),E),g),t={el:E,dispose:i,getCurrentTime:()=>Q.getCurrentTime(),getDuration:()=>Q.getDuration(),play:()=>Q.play(),pause:()=>Q.pause(),seek:s=>Q.seek(s)};return t.addEventListener=(s,n)=>Q.addEventListener(s,n.bind(t)),t}function GQ(A){if(typeof A=="function")return A;if(typeof A=="string"&&(A.substring(0,5)=="ws://"||A.substring(0,6)=="wss://"?A={driver:"websocket",url:A}:A.substring(0,6)=="clock:"?A={driver:"clock"}:A.substring(0,7)=="random:"?A={driver:"random"}:A.substring(0,10)=="benchmark:"?A={driver:"benchmark",url:A.substring(10)}:A={driver:"recording",url:A}),A.driver===void 0&&(A.driver="recording"),A.driver=="recording"&&(A.parser===void 0&&(A.parser="asciicast"),typeof A.parser=="string"))if(wB.has(A.parser))A.parser=wB.get(A.parser);else throw`unknown parser: ${A.parser}`;if(DB.has(A.driver)){const g=DB.get(A.driver);return(B,I)=>g(A,B,I)}else throw`unsupported driver: ${JSON.stringify(A)}`}function hQ(A,g){const Q=document.createElement("div");Q.style.height="0px",Q.style.overflow="hidden",Q.style.fontSize="15px",document.body.appendChild(Q);let C;const e=Wg(()=>(C=M(tB,{cols:80,rows:24,lineHeight:g,fontFamily:A,lines:[]}),C),Q),E={charW:C.clientWidth/80,charH:C.clientHeight/24,bordersW:C.offsetWidth-C.clientWidth,bordersH:C.offsetHeight-C.clientHeight};return e(),document.body.removeChild(Q),E}},"./node_modules/asciinema-player/dist/bundle/asciinema-player.css":function(GB,TA,WA){WA.r(TA)}}]);