|
|
|
@@ -1,30 +1,30 @@
|
|
|
|
|
import{a as X0}from"./chunk-NTFEI2OH.js";import{a as z0}from"./chunk-SRBQMLE7.js";import"./chunk-JRMUDXWR.js";import{a as kc}from"./chunk-G3VBABUZ.js";import{a as W0,b as N0,c as IA}from"./chunk-3H6WIH6E.js";import{G as Pc,L as kf,j as L0,k as D0,q as Z0,x as I0,y as Pf}from"./chunk-4YTESWOC.js";import"./chunk-UXRCACYH.js";import{A as Nt,B as Mr,E as wc,G as hr,H as _0,J as vf,K as vo,M as wo,N as wf,O as E0,P as xf,Y as xo,Z as R0,a as Hr,aa as M0,b as La,d as yt,e as Da,f as Zt,g as _e,h as bf,i as k0,ia as xc,k as $0,m as yc,n as Q0,o as Sc,p as vc,q as T0,t as So,w as A0,x as yf,y as C0,z as Sf}from"./chunk-VZWSP3EG.js";import{a as Ue,b as zi,c as Ma,e as gf,g as Of}from"./chunk-N7W4C4V2.js";var Qf=gf((B0,$f)=>{(function(n){if(typeof B0=="object"&&typeof $f!="undefined")$f.exports=n();else if(typeof define=="function"&&define.amd)define([],n);else{var e;typeof window!="undefined"?e=window:typeof global!="undefined"?e=global:typeof self!="undefined"?e=self:e=this,e.localforage=n()}})(function(){var n,e,t;return(function r(i,s,o){function a(d,h){if(!s[d]){if(!i[d]){var u=typeof Ma=="function"&&Ma;if(!h&&u)return u(d,!0);if(l)return l(d,!0);var f=new Error("Cannot find module '"+d+"'");throw f.code="MODULE_NOT_FOUND",f}var m=s[d]={exports:{}};i[d][0].call(m.exports,function(O){var S=i[d][1][O];return a(S||O)},m,m.exports,r,i,s,o)}return s[d].exports}for(var l=typeof Ma=="function"&&Ma,c=0;c<o.length;c++)a(o[c]);return a})({1:[function(r,i,s){(function(o){"use strict";var a=o.MutationObserver||o.WebKitMutationObserver,l;if(a){var c=0,d=new a(O),h=o.document.createTextNode("");d.observe(h,{characterData:!0}),l=function(){h.data=c=++c%2}}else if(!o.setImmediate&&typeof o.MessageChannel!="undefined"){var u=new o.MessageChannel;u.port1.onmessage=O,l=function(){u.port2.postMessage(0)}}else"document"in o&&"onreadystatechange"in o.document.createElement("script")?l=function(){var x=o.document.createElement("script");x.onreadystatechange=function(){O(),x.onreadystatechange=null,x.parentNode.removeChild(x),x=null},o.document.documentElement.appendChild(x)}:l=function(){setTimeout(O,0)};var f,m=[];function O(){f=!0;for(var x,D,M=m.length;M;){for(D=m,m=[],x=-1;++x<M;)D[x]();M=m.length}f=!1}i.exports=S;function S(x){m.push(x)===1&&!f&&l()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(r,i,s){"use strict";var o=r(1);function a(){}var l={},c=["REJECTED"],d=["FULFILLED"],h=["PENDING"];i.exports=u;function u(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,w!==a&&S(this,w)}u.prototype.catch=function(w){return this.then(null,w)},u.prototype.then=function(w,R){if(typeof w!="function"&&this.state===d||typeof R!="function"&&this.state===c)return this;var X=new this.constructor(a);if(this.state!==h){var W=this.state===d?w:R;m(X,W,this.outcome)}else this.queue.push(new f(X,w,R));return X};function f(w,R,X){this.promise=w,typeof R=="function"&&(this.onFulfilled=R,this.callFulfilled=this.otherCallFulfilled),typeof X=="function"&&(this.onRejected=X,this.callRejected=this.otherCallRejected)}f.prototype.callFulfilled=function(w){l.resolve(this.promise,w)},f.prototype.otherCallFulfilled=function(w){m(this.promise,this.onFulfilled,w)},f.prototype.callRejected=function(w){l.reject(this.promise,w)},f.prototype.otherCallRejected=function(w){m(this.promise,this.onRejected,w)};function m(w,R,X){o(function(){var W;try{W=R(X)}catch(ne){return l.reject(w,ne)}W===w?l.reject(w,new TypeError("Cannot resolve promise with itself")):l.resolve(w,W)})}l.resolve=function(w,R){var X=x(O,R);if(X.status==="error")return l.reject(w,X.value);var W=X.value;if(W)S(w,W);else{w.state=d,w.outcome=R;for(var ne=-1,de=w.queue.length;++ne<de;)w.queue[ne].callFulfilled(R)}return w},l.reject=function(w,R){w.state=c,w.outcome=R;for(var X=-1,W=w.queue.length;++X<W;)w.queue[X].callRejected(R);return w};function O(w){var R=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof R=="function")return function(){R.apply(w,arguments)}}function S(w,R){var X=!1;function W(pe){X||(X=!0,l.reject(w,pe))}function ne(pe){X||(X=!0,l.resolve(w,pe))}function de(){R(ne,W)}var q=x(de);q.status==="error"&&W(q.value)}function x(w,R){var X={};try{X.value=w(R),X.status="success"}catch(W){X.status="error",X.value=W}return X}u.resolve=D;function D(w){return w instanceof this?w:l.resolve(new this(a),w)}u.reject=M;function M(w){var R=new this(a);return l.reject(R,w)}u.all=Z;function Z(w){var R=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var X=w.length,W=!1;if(!X)return this.resolve([]);for(var ne=new Array(X),de=0,q=-1,pe=new this(a);++q<X;)ve(w[q],q);return pe;function ve(we,B){R.resolve(we).then(ue,function(G){W||(W=!0,l.reject(pe,G))});function ue(G){ne[B]=G,++de===X&&!W&&(W=!0,l.resolve(pe,ne))}}}u.race=k;function k(w){var R=this;if(Object.prototype.toLine truncated
|
|
|
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pz(n,e){return hz(n)||uz(n,e)||mz(n,e)||fz()}function mz(n,e){if(n){if(typeof n=="string")return $T(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?$T(n,e):void 0}}function Vu(n){var e,t;function r(s,o){try{var a=n[s](o),l=a.value,c=l instanceof dz;Promise.resolve(c?l.v:l).then(function(d){if(c){var h=s==="return"&&l.k?s:"next";if(!l.k||d.done)return r(h,d);d=n[h](d).value}i(!!a.done,d)},function(d){r("throw",d)})}catch(d){i(2,d)}}function i(s,o){s===2?e.reject(o):e.resolve({value:o,done:s}),(e=e.next)?r(e.key,e.arg):t=null}this._invoke=function(s,o){return new Promise(function(a,l){var c={key:s,arg:o,resolve:a,reject:l,next:null};t?t=t.next=c:(e=t=c,r(s,o))})},typeof n.return!="function"&&(this.return=void 0)}Vu.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},Vu.prototype.next=function(n){return this._invoke("next",n)},Vu.prototype.throw=function(n){return this._invoke("throw",n)},Vu.prototype.return=function(n){return this._invoke("return",n)};var WT=Object.entries,QT=Object.setPrototypeOf,gz=Object.isFrozen,Oz=Object.getPrototypeOf,bz=Object.getOwnPropertyDescriptor,Wt=Object.freeze,jt=Object.seal,ya=Object.create,NT=typeof Reflect!="undefined"&&Reflect,i0=NT.apply,s0=NT.construct;Wt||(Wt=function(e){return e});jt||(jt=function(e){return e});i0||(i0=function(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];return e.apply(t,i)});s0||(s0=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return new e(...r)});var fo=Mt(Array.prototype.forEach);Array.prototype.indexOf;var yz=Mt(Array.prototype.lastIndexOf),TT=Mt(Array.prototype.pop),ic=Mt(Array.prototype.push);Array.prototype.slice;var Sz=Mt(Array.prototype.splice),Sa=Array.isArray,ac=Mt(String.prototype.toLowerCase),Kb=Mt(String.prototype.toString),AT=Mt(String.prototype.match),sc=Mt(String.prototype.replace),CT=Mt(String.prototype.indexOf),vz=Mt(String.prototype.trim),wz=Mt(Number.prototype.toString),xz=Mt(Boolean.prototype.toString),_T=typeof BigInt=="undefined"?null:Mt(BigInt.prototype.toString),ET=typeof Symbol=="undefined"?null:Mt(Symbol.prototype.toString),Ln=Mt(Object.prototype.hasOwnProperty),oc=Mt(Object.prototype.toString),fn=Mt(RegExp.prototype.test),ps=Pz(TypeError);function Mt(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return i0(n,e,r)}}function Pz(n){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return s0(n,t)}}function Fe(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ac;if(QT&&QT(n,null),!Sa(e))return n;let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){let s=t(i);s!==i&&(gz(e)||(e[r]=s),i=s)}n[i]=!0}return n}function kz(n){for(let e=0;e<n.length;e++)Ln(n,e)||(n[e]=null);return n}function tr(n){let e=ya(null);for(let r of WT(n)){var t=pz(r,2);let i=t[0],s=t[1];Ln(n,i)&&(Sa(s)?e[i]=kz(s):s&&typeof s=="object"&&s.constructor===Object?e[i]=tr(s):e[i]=s)}return e}function $z(n){switch(typeof n){case"string":return n;case"number":return wz(n);case"boolean":return xz(n);case"bigint":return _T?_T(n):"0";case"symbol":return ET?ET(n):"Symbol()";case"undefined":return oc(n);case"function":case"object":{if(n===null)return oc(n);let e=n,t=kr(e,"toString");if(typeof t=="function"){let r=t(e);return typeof r=="string"?r:oc(r)}return oc(n)}default:return oc(n)}}function kr(n,e){for(;n!==null;){let r=bz(n,e);if(r){if(r.get)return Mt(r.get);if(typeof r.value=="function")return Mt(r.value)}n=Oz(n)}function t(){return null}return t}function Qz(n){try{return fn(n,""),!0}catch(e){return!1}}var RT=Wt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Jb=Wt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse
Line truncated
|
|
|
|
|
`+Ae),vt&&(Ae=Q(Ae)),W&&xt?we(Ae):Ae},e.setConfig=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Oi(_),Y=!0,te=ke,ge=be},e.clearConfig=function(){gn=null,Y=!1,te=null,ge=null,W=de,ne=""},e.isValidAttribute=function(_,p,b){gn||Oi({});let T=Te(_),L=Te(p);return Ie(T,L,b)},e.addHook=function(_,p){typeof p=="function"&&Ln(me,_)&&ic(me[_],p)},e.removeHook=function(_,p){if(Ln(me,_)){if(p!==void 0){let b=yz(me[_],p);return b===-1?void 0:Sz(me[_],b,1)[0]}return TT(me[_])}},e.removeHooks=function(_){Ln(me,_)&&(me[_]=[])},e.removeAllHooks=function(){me=zT()},e}var Fz=VT();FT.exports=Fz});var y0=Of(Qf());var $c=[{id:"vcs",title:"Making Games For The Atari 2600",url:"https://www.amazon.com/dp/1541021304",image:"book_a2600.png",platforms:["vcs"]},{id:"arcade",title:"Making 8-bit Arcade Games in C",url:"https://www.amazon.com/dp/1545484759",image:"book_arcade.png",platforms:["mw8080bw","vicdual","galaxian","galaxian-scramble","vector-z80color","williams-z80"]},{id:"verilog",title:"Designing Video Game Hardware in Verilog",url:"https://www.amazon.com/dp/1728619440",image:"book_verilog.png",platforms:["verilog"]},{id:"nes",title:"Making Games for the NES",url:"https://www.amazon.com/dp/1075952727",image:"book_nes.png",platforms:["nes"]},{id:"c64",title:"Making Games for the C-64",url:"https://www.amazon.com/dp/B0DMKH8NGL",image:"book_c64.png",platforms:["c64"]}];function V0(n){var e=Nt(n),t=Mr(n);return $c.find(r=>r.platforms.includes(e))||$c.find(r=>r.platforms.includes(t))}var _s="\u2190\u2191\u2193\u2192";var Tc=[{keys:[_s],action:"Joypad"},{keys:["Space"],action:"Button A"},{keys:["Shift"],action:"Button B"}],Tf=[{keys:[_s],action:"Joystick"},{keys:["Space"],action:"Button 1"},{keys:["Shift"],action:"Button 2"},{keys:["\\"],action:"Coin"},{keys:["Enter"],action:"Start"}],Qc=[...Tc,{keys:["\\"],action:"Select"},{keys:["Enter"],action:"Start"}],F0=[{keys:[_s],action:"Joystick"},{keys:["Space"],action:"Button"}],Y0={vcs:F0,c64:F0,apple2:[{keys:["Mouse"],action:"Paddles/Joystick"},{keys:["Click"],action:"Button 1"},{keys:["SHIFT-Click"],action:"Button 2"},{keys:["ALT-Click"],action:"Button 3"}],nes:Qc,atari7800:Qc,pce:Qc,gb:Qc,msx:Tc,coleco:Tc,sms:[...Tc,{keys:["Enter"],action:"Start"}],vicdual:Tf,galaxian:Tf,vector:Tf,mw8080bw:[{keys:["\u2190\xA0\u2192"],action:"Joystick"},{keys:["Space"],action:"Fire"}],williams:[{keys:["A W S D"],action:"Move"},{keys:[_s],action:"Fire"},{keys:["\\"],action:"Coin"},{keys:["Enter"],action:"Start"},{keys:["6 7 8 9"],action:"Extra"}],astrocade:[{keys:[_s],action:"Joystick"},{keys:["Space"],action:"Trigger"},{keys:["Mouse X"],action:"Knob"},{keys:[`U I O P
|
|
|
|
|
import{a as X0}from"./chunk-NTFEI2OH.js";import{a as z0}from"./chunk-SRBQMLE7.js";import"./chunk-JRMUDXWR.js";import{a as kc}from"./chunk-G3VBABUZ.js";import{a as W0,b as N0,c as zA}from"./chunk-3H6WIH6E.js";import{G as Pc,L as kf,j as L0,k as D0,q as Z0,x as I0,y as Pf}from"./chunk-4YTESWOC.js";import"./chunk-UXRCACYH.js";import{A as Nt,B as Mr,E as wc,G as hr,H as _0,J as vf,K as vo,M as wo,N as wf,O as E0,P as xf,Y as xo,Z as R0,a as Hr,aa as M0,b as La,d as yt,e as Da,f as Zt,g as _e,h as bf,i as k0,ia as xc,k as $0,m as yc,n as Q0,o as Sc,p as vc,q as T0,t as So,w as A0,x as yf,y as C0,z as Sf}from"./chunk-VZWSP3EG.js";import{a as Ue,b as zi,c as Ma,e as gf,g as Of}from"./chunk-N7W4C4V2.js";var Qf=gf((B0,$f)=>{(function(n){if(typeof B0=="object"&&typeof $f!="undefined")$f.exports=n();else if(typeof define=="function"&&define.amd)define([],n);else{var e;typeof window!="undefined"?e=window:typeof global!="undefined"?e=global:typeof self!="undefined"?e=self:e=this,e.localforage=n()}})(function(){var n,e,t;return(function r(i,s,o){function a(d,h){if(!s[d]){if(!i[d]){var u=typeof Ma=="function"&&Ma;if(!h&&u)return u(d,!0);if(l)return l(d,!0);var f=new Error("Cannot find module '"+d+"'");throw f.code="MODULE_NOT_FOUND",f}var m=s[d]={exports:{}};i[d][0].call(m.exports,function(O){var S=i[d][1][O];return a(S||O)},m,m.exports,r,i,s,o)}return s[d].exports}for(var l=typeof Ma=="function"&&Ma,c=0;c<o.length;c++)a(o[c]);return a})({1:[function(r,i,s){(function(o){"use strict";var a=o.MutationObserver||o.WebKitMutationObserver,l;if(a){var c=0,d=new a(O),h=o.document.createTextNode("");d.observe(h,{characterData:!0}),l=function(){h.data=c=++c%2}}else if(!o.setImmediate&&typeof o.MessageChannel!="undefined"){var u=new o.MessageChannel;u.port1.onmessage=O,l=function(){u.port2.postMessage(0)}}else"document"in o&&"onreadystatechange"in o.document.createElement("script")?l=function(){var x=o.document.createElement("script");x.onreadystatechange=function(){O(),x.onreadystatechange=null,x.parentNode.removeChild(x),x=null},o.document.documentElement.appendChild(x)}:l=function(){setTimeout(O,0)};var f,m=[];function O(){f=!0;for(var x,D,M=m.length;M;){for(D=m,m=[],x=-1;++x<M;)D[x]();M=m.length}f=!1}i.exports=S;function S(x){m.push(x)===1&&!f&&l()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(r,i,s){"use strict";var o=r(1);function a(){}var l={},c=["REJECTED"],d=["FULFILLED"],h=["PENDING"];i.exports=u;function u(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,w!==a&&S(this,w)}u.prototype.catch=function(w){return this.then(null,w)},u.prototype.then=function(w,R){if(typeof w!="function"&&this.state===d||typeof R!="function"&&this.state===c)return this;var X=new this.constructor(a);if(this.state!==h){var W=this.state===d?w:R;m(X,W,this.outcome)}else this.queue.push(new f(X,w,R));return X};function f(w,R,X){this.promise=w,typeof R=="function"&&(this.onFulfilled=R,this.callFulfilled=this.otherCallFulfilled),typeof X=="function"&&(this.onRejected=X,this.callRejected=this.otherCallRejected)}f.prototype.callFulfilled=function(w){l.resolve(this.promise,w)},f.prototype.otherCallFulfilled=function(w){m(this.promise,this.onFulfilled,w)},f.prototype.callRejected=function(w){l.reject(this.promise,w)},f.prototype.otherCallRejected=function(w){m(this.promise,this.onRejected,w)};function m(w,R,X){o(function(){var W;try{W=R(X)}catch(ne){return l.reject(w,ne)}W===w?l.reject(w,new TypeError("Cannot resolve promise with itself")):l.resolve(w,W)})}l.resolve=function(w,R){var X=x(O,R);if(X.status==="error")return l.reject(w,X.value);var W=X.value;if(W)S(w,W);else{w.state=d,w.outcome=R;for(var ne=-1,de=w.queue.length;++ne<de;)w.queue[ne].callFulfilled(R)}return w},l.reject=function(w,R){w.state=c,w.outcome=R;for(var X=-1,W=w.queue.length;++X<W;)w.queue[X].callRejected(R);return w};function O(w){var R=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof R=="function")return function(){R.apply(w,arguments)}}function S(w,R){var X=!1;function W(pe){X||(X=!0,l.reject(w,pe))}function ne(pe){X||(X=!0,l.resolve(w,pe))}function de(){R(ne,W)}var q=x(de);q.status==="error"&&W(q.value)}function x(w,R){var X={};try{X.value=w(R),X.status="success"}catch(W){X.status="error",X.value=W}return X}u.resolve=D;function D(w){return w instanceof this?w:l.resolve(new this(a),w)}u.reject=M;function M(w){var R=new this(a);return l.reject(R,w)}u.all=Z;function Z(w){var R=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var X=w.length,W=!1;if(!X)return this.resolve([]);for(var ne=new Array(X),de=0,q=-1,pe=new this(a);++q<X;)ve(w[q],q);return pe;function ve(we,B){R.resolve(we).then(ue,function(G){W||(W=!0,l.reject(pe,G))});function ue(G){ne[B]=G,++de===X&&!W&&(W=!0,l.resolve(pe,ne))}}}u.race=k;function k(w){var R=this;if(Object.prototype.toLine truncated
|
|
|
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gz(n,e){return fz(n)||pz(n,e)||Oz(n,e)||mz()}function Oz(n,e){if(n){if(typeof n=="string")return TT(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?TT(n,e):void 0}}function Vu(n){var e,t;function r(s,o){try{var a=n[s](o),l=a.value,c=l instanceof uz;Promise.resolve(c?l.v:l).then(function(d){if(c){var h=s==="return"&&l.k?s:"next";if(!l.k||d.done)return r(h,d);d=n[h](d).value}i(!!a.done,d)},function(d){r("throw",d)})}catch(d){i(2,d)}}function i(s,o){s===2?e.reject(o):e.resolve({value:o,done:s}),(e=e.next)?r(e.key,e.arg):t=null}this._invoke=function(s,o){return new Promise(function(a,l){var c={key:s,arg:o,resolve:a,reject:l,next:null};t?t=t.next=c:(e=t=c,r(s,o))})},typeof n.return!="function"&&(this.return=void 0)}Vu.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},Vu.prototype.next=function(n){return this._invoke("next",n)},Vu.prototype.throw=function(n){return this._invoke("throw",n)},Vu.prototype.return=function(n){return this._invoke("return",n)};var BT=Object.entries,AT=Object.setPrototypeOf,bz=Object.isFrozen,yz=Object.getPrototypeOf,Sz=Object.getOwnPropertyDescriptor,Wt=Object.freeze,jt=Object.seal,ya=Object.create,VT=typeof Reflect!="undefined"&&Reflect,i0=VT.apply,s0=VT.construct;Wt||(Wt=function(e){return e});jt||(jt=function(e){return e});i0||(i0=function(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];return e.apply(t,i)});s0||(s0=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return new e(...r)});var fo=Mt(Array.prototype.forEach);Array.prototype.indexOf;var vz=Mt(Array.prototype.lastIndexOf),CT=Mt(Array.prototype.pop),ic=Mt(Array.prototype.push);Array.prototype.slice;var wz=Mt(Array.prototype.splice),Sa=Array.isArray,ac=Mt(String.prototype.toLowerCase),Kb=Mt(String.prototype.toString),_T=Mt(String.prototype.match),sc=Mt(String.prototype.replace),ET=Mt(String.prototype.indexOf),xz=Mt(String.prototype.trim),Pz=Mt(Number.prototype.toString),kz=Mt(Boolean.prototype.toString),RT=typeof BigInt=="undefined"?null:Mt(BigInt.prototype.toString),MT=typeof Symbol=="undefined"?null:Mt(Symbol.prototype.toString),Ln=Mt(Object.prototype.hasOwnProperty),oc=Mt(Object.prototype.toString),fn=Mt(RegExp.prototype.test),ps=$z(TypeError);function Mt(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return i0(n,e,r)}}function $z(n){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return s0(n,t)}}function Fe(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ac;if(AT&&AT(n,null),!Sa(e))return n;let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){let s=t(i);s!==i&&(bz(e)||(e[r]=s),i=s)}n[i]=!0}return n}function Qz(n){for(let e=0;e<n.length;e++)Ln(n,e)||(n[e]=null);return n}function tr(n){let e=ya(null);for(let r of BT(n)){var t=gz(r,2);let i=t[0],s=t[1];Ln(n,i)&&(Sa(s)?e[i]=Qz(s):s&&typeof s=="object"&&s.constructor===Object?e[i]=tr(s):e[i]=s)}return e}function Tz(n){switch(typeof n){case"string":return n;case"number":return Pz(n);case"boolean":return kz(n);case"bigint":return RT?RT(n):"0";case"symbol":return MT?MT(n):"Symbol()";case"undefined":return oc(n);case"function":case"object":{if(n===null)return oc(n);let e=n,t=kr(e,"toString");if(typeof t=="function"){let r=t(e);return typeof r=="string"?r:oc(r)}return oc(n)}default:return oc(n)}}function kr(n,e){for(;n!==null;){let r=Sz(n,e);if(r){if(r.get)return Mt(r.get);if(typeof r.value=="function")return Mt(r.value)}n=yz(n)}function t(){return null}return t}function Az(n){try{return fn(n,""),!0}catch(e){return!1}}var LT=Wt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Jb=Wt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse
Line truncated
|
|
|
|
|
`+Ae),vt&&(Ae=Q(Ae)),W&&xt?we(Ae):Ae},e.setConfig=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Oi(_),Y=!0,te=ke,ge=be},e.clearConfig=function(){gn=null,Y=!1,te=null,ge=null,W=de,ne=""},e.isValidAttribute=function(_,p,b){gn||Oi({});let T=Te(_),L=Te(p);return Ie(T,L,b)},e.addHook=function(_,p){typeof p=="function"&&Ln(me,_)&&ic(me[_],p)},e.removeHook=function(_,p){if(Ln(me,_)){if(p!==void 0){let b=vz(me[_],p);return b===-1?void 0:wz(me[_],b,1)[0]}return CT(me[_])}},e.removeHooks=function(_){Ln(me,_)&&(me[_]=[])},e.removeAllHooks=function(){me=NT()},e}var jz=YT();jT.exports=jz});var y0=Of(Qf());var $c=[{id:"vcs",title:"Making Games For The Atari 2600",url:"https://www.amazon.com/dp/1541021304",image:"book_a2600.png",platforms:["vcs"]},{id:"arcade",title:"Making 8-bit Arcade Games in C",url:"https://www.amazon.com/dp/1545484759",image:"book_arcade.png",platforms:["mw8080bw","vicdual","galaxian","galaxian-scramble","vector-z80color","williams-z80"]},{id:"verilog",title:"Designing Video Game Hardware in Verilog",url:"https://www.amazon.com/dp/1728619440",image:"book_verilog.png",platforms:["verilog"]},{id:"nes",title:"Making Games for the NES",url:"https://www.amazon.com/dp/1075952727",image:"book_nes.png",platforms:["nes"]},{id:"c64",title:"Making Games for the C-64",url:"https://www.amazon.com/dp/B0DMKH8NGL",image:"book_c64.png",platforms:["c64"]}];function V0(n){var e=Nt(n),t=Mr(n);return $c.find(r=>r.platforms.includes(e))||$c.find(r=>r.platforms.includes(t))}var _s="\u2190\u2191\u2193\u2192";var Tc=[{keys:[_s],action:"Joypad"},{keys:["Space"],action:"Button A"},{keys:["Shift"],action:"Button B"}],Tf=[{keys:[_s],action:"Joystick"},{keys:["Space"],action:"Button 1"},{keys:["Shift"],action:"Button 2"},{keys:["\\"],action:"Coin"},{keys:["Enter"],action:"Start"}],Qc=[...Tc,{keys:["\\"],action:"Select"},{keys:["Enter"],action:"Start"}],F0=[{keys:[_s],action:"Joystick"},{keys:["Space"],action:"Button"}],Y0={vcs:F0,c64:F0,apple2:[{keys:["Mouse"],action:"Paddles/Joystick"},{keys:["Click"],action:"Button 1"},{keys:["SHIFT-Click"],action:"Button 2"},{keys:["ALT-Click"],action:"Button 3"}],nes:Qc,atari7800:Qc,pce:Qc,gb:Qc,msx:Tc,coleco:Tc,sms:[...Tc,{keys:["Enter"],action:"Start"}],vicdual:Tf,galaxian:Tf,vector:Tf,mw8080bw:[{keys:["\u2190\xA0\u2192"],action:"Joystick"},{keys:["Space"],action:"Fire"}],williams:[{keys:["A W S D"],action:"Move"},{keys:[_s],action:"Fire"},{keys:["\\"],action:"Coin"},{keys:["Enter"],action:"Start"},{keys:["6 7 8 9"],action:"Extra"}],astrocade:[{keys:[_s],action:"Joystick"},{keys:["Space"],action:"Trigger"},{keys:["Mouse X"],action:"Knob"},{keys:[`U I O P
|
|
|
|
|
J K L /
|
|
|
|
|
7 8 9 X
|
|
|
|
|
4 5 6 -
|
|
|
|
|
1 2 3 ,
|
|
|
|
|
\\ 0 . =`],action:"Keypad"}],vectrex:[{keys:[_s],action:"Joystick"},{keys:["Z X C V"],action:"Buttons"}],atari8:[{keys:[_s],action:"Joystick"},{keys:["Shift"],action:"Button"},{keys:["F1"],action:"Start"},{keys:["F2"],action:"Select"},{keys:["F3"],action:"Option"}],pacman:[{keys:["\u2190\xA0\u2192"],action:"Joystick"},{keys:["Space"],action:"Fire"},{keys:["5","6"],action:"Coin"},{keys:["Enter","2"],action:"Start"}]};var XA={left:"arrowleft",right:"arrowright",up:"arrowup",down:"arrowdown"},Af=null;function Po(){if(Af===null){var n=typeof navigator!="undefined"?navigator:null;Af=!!n&&/mac|iphone|ipad|ipod/i.test(n.platform||n.userAgent||"")}return Af}function _f(n){var e=n.toLowerCase().split("+"),t=e.pop(),r={mod:!1,shift:!1,key:""};for(var i of e)if(i=="mod"||i=="ctrl"||i=="meta"||i=="cmd")r.mod=!0;else if(i=="shift")r.shift=!0;else return console.warn('Keyboard shortcut "'+n+'": unsupported modifier "'+i+'" (alt is layout-dependent), skipping'),null;t=XA[t]||t;var s=/^[a-z]$/.test(t),o=/^f([1-9]|1[0-2])$/.test(t);return!s&&!o&&!/^[0-9]$/.test(t)&&!/^arrow/.test(t)?(console.warn('Keyboard shortcut "'+n+'": key "'+t+'" is layout-dependent (use a-z, 0-9, f1-f12), skipping'),null):r.shift&&!s&&!/^arrow/.test(t)?(console.warn('Keyboard shortcut "'+n+'": shift is only allowed with letters and arrows, skipping'),null):(r.key=t,r)}function zA(n,e){if(e.altKey)return!1;var t=Po(),r=t?e.metaKey:e.ctrlKey,i=t?e.ctrlKey:e.metaKey;return n.mod!==r||i||n.shift!==e.shiftKey?!1:(e.key||"").toLowerCase()===n.key}var Ac=class{constructor(){this.bindings=[];this.handler=e=>{if(!e.defaultPrevented)for(var t=0;t<this.bindings.length;t++){var r=this.bindings[t];if(zA(r.binding,e)){e.preventDefault(),e.stopPropagation(),r.fn(e);return}}}}bind(e,t){var r=_f(e);r&&this.bindings.push({binding:r,fn:t})}unbindAll(){this.bindings=[]}attach(){window.addEventListener("keydown",this.handler)}detach(){window.removeEventListener("keydown",this.handler)}},WA={mod:"Mod",cmd:"Mod",meta:"Mod",ctrl:"Ctrl",control:"Ctrl",shift:"Shift",alt:"Alt",option:"Alt"},Cf=null;function NA(){if(Cf===null){var n=typeof navigator!="undefined"?navigator:null;Cf=!!n&&/win/i.test(n.platform||n.userAgent||"")}return Cf}function j0(n){var e=n.split("-"),t=e.pop();t===""&&(t="-");var r=[];for(var i of e)if(i!==""){var s=WA[i.toLowerCase()]||i;s=="Ctrl"&&!Po()&&(s="Mod"),r.indexOf(s)<0&&r.push(s)}return r.sort(),r.concat([t.toLowerCase()]).join("-")}function BA(n){var e=Po()?n.mac:NA()?n.win:n.linux;return e||n.key}var Ef=["Mod-Shift-a","Mod-Shift-d","Mod-Shift-e","Mod-Shift-f","Mod-Shift-g","Mod-Shift-h","Mod-Shift-i","Mod-Shift-j","Mod-Shift-k","Mod-Shift-l","Mod-Shift-r","Mod-Shift-x","Mod-Shift-y"];function Rf(n,e){var t=e.map(j0);return n.filter(function(r){var i=BA(r);return!i||t.indexOf(j0(i))<0})}var VA={shift:"\u21E7",ctrl:"\u2303",alt:"\u2325",meta:"\u2318",mod:"\u2318",cmd:"\u2318"},FA={shift:"Shift",ctrl:"Ctrl",alt:"Alt",meta:"Win",mod:"Ctrl",cmd:"Cmd"},YA={arrowleft:"\u2190",arrowright:"\u2192",arrowup:"\u2191",arrowdown:"\u2193",backspace:"\u232B",enter:"\u21A9",tab:"\u21E5",escape:"\u238B",space:"\u2423"};function Lf(n){var e=n.toLowerCase().split("+"),t=e.pop(),r=Po(),i=r?["shift","ctrl","alt","meta","mod","cmd"]:["mod","ctrl","shift","alt","meta","cmd"],s=i.filter(c=>e.indexOf(c)>=0);for(var o of e)s.indexOf(o)<0&&s.push(o);var a=s.map(c=>r?VA[c]||c:FA[c]||c).join(r?"":"+"),l=/^[a-z][0-9]?$/.test(t)?t.toUpperCase():YA[t]||(r?t:t.charAt(0).toUpperCase()+t.slice(1));return(a?a+(r?"":"+"):"")+l}var Mf=class{constructor(e){this.shortcutsSig="";this.status={};this.visible=!0;this.pendingShortcuts=!1;this.pendingStatus=!1;this.div=e,this.shortcutsZone=$(document.createElement("span")).addClass("shortcuts_zone"),this.statusZone=$(document.createElement("span")).addClass("status_zone"),$(e).append(this.shortcutsZone).append(this.statusZone)}setShortcuts(e){if(this.visible){var t=e.map(s=>s.key+""+s.label).join("");if(t!==this.shortcutsSig){if(Za){this.pendingShortcuts=!0;return}this.shortcutsSig=t,this.shortcutsZone.empty();for(var r of e){var i=$(document.createElement("span")).addClass("shortcut");i.append($(document.createElement("kbd")).text(Lf(r.key))),i.append(document.createTextNode(" "+r.label)),r.fn&&U0(i,r.fn),this.shortcutsZone.append(i)}}}}setStatus(e,t){t?this.status[e]=t:delete this.status[e],this.renderStatus()}renderStatus(){if(this.visible){if(Za){this.pendingStatus=!0;return}this.statusZone.empty();for(var e of Object.keys(this.status)){var t=this.status[e],r=$(document.createElement("span")).addClass("status_item");t.cls&&r.addClass(t.cls),t.title&&r.prop("title",t.title),r.text(t.text),t.fn&&U0(r,t.fn),this.statusZone.append(r)}}}};function U0(n,e){n.addClass("clickable"),n.mousedown(t=>t.preventDefault()),n.click(e)}var Za=!1;function q0(){zn&&(zn.pendingShortcuts&&(zn.pendingShortcuts=!1,Wn()),zn.pendingStatus&&(zn.pendingStatus=!1,zn.renderStatus()))}function jA(){$(document).on("mousedown.shortcutbar",()=>{Za=!0}),$(document).on(
Line truncated
|
|
|
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nC(n,e){return JA(n)||eC(n,e)||rC(n,e)||tC()}function rC(n,e){if(n){if(typeof n=="string")return oy(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?oy(n,e):void 0}}function Ec(n){var e,t;function r(s,o){try{var a=n[s](o),l=a.value,c=l instanceof KA;Promise.resolve(c?l.v:l).then(function(d){if(c){var h=s==="return"&&l.k?s:"next";if(!l.k||d.done)return r(h,d);d=n[h](d).value}i(!!a.done,d)},function(d){r("throw",d)})}catch(d){i(2,d)}}function i(s,o){s===2?e.reject(o):e.resolve({value:o,done:s}),(e=e.next)?r(e.key,e.arg):t=null}this._invoke=function(s,o){return new Promise(function(a,l){var c={key:s,arg:o,resolve:a,reject:l,next:null};t?t=t.next=c:(e=t=c,r(s,o))})},typeof n.return!="function"&&(this.return=void 0)}Ec.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},Ec.prototype.next=function(n){return this._invoke("next",n)},Ec.prototype.throw=function(n){return this._invoke("throw",n)},Ec.prototype.return=function(n){return this._invoke("return",n)};var vy=Object.entries,ay=Object.setPrototypeOf,iC=Object.isFrozen,sC=Object.getPrototypeOf,oC=Object.getOwnPropertyDescriptor,It=Object.freeze,Bt=Object.seal,ko=Object.create,wy=typeof Reflect!="undefined"&&Reflect,Nf=wy.apply,Bf=wy.construct;It||(It=function(e){return e});Bt||(Bt=function(e){return e});Nf||(Nf=function(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];return e.apply(t,i)});Bf||(Bf=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return new e(...r)});var Es=Tt(Array.prototype.forEach);Array.prototype.indexOf;var aC=Tt(Array.prototype.lastIndexOf),ly=Tt(Array.prototype.pop),Ia=Tt(Array.prototype.push);Array.prototype.slice;var lC=Tt(Array.prototype.splice),$o=Array.isArray,Wa=Tt(String.prototype.toLowerCase),Df=Tt(String.prototype.toString),cy=Tt(String.prototype.match),Xa=Tt(String.prototype.replace),dy=Tt(String.prototype.indexOf),cC=Tt(String.prototype.trim),dC=Tt(Number.prototype.toString),hC=Tt(Boolean.prototype.toString),hy=typeof BigInt=="undefined"?null:Tt(BigInt.prototype.toString),uy=typeof Symbol=="undefined"?null:Tt(Symbol.prototype.toString),Qn=Tt(Object.prototype.hasOwnProperty),za=Tt(Object.prototype.toString),on=Tt(RegExp.prototype.test),Ni=uC(TypeError);function Tt(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return Nf(n,e,r)}}function uC(n){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Bf(n,t)}}function Ve(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Wa;if(ay&&ay(n,null),!$o(e))return n;let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){let s=t(i);s!==i&&(iC(e)||(e[r]=s),i=s)}n[i]=!0}return n}function fC(n){for(let e=0;e<n.length;e++)Qn(n,e)||(n[e]=null);return n}function Vn(n){let e=ko(null);for(let r of vy(n)){var t=nC(r,2);let i=t[0],s=t[1];Qn(n,i)&&($o(s)?e[i]=fC(s):s&&typeof s=="object"&&s.constructor===Object?e[i]=Vn(s):e[i]=s)}return e}function pC(n){switch(typeof n){case"string":return n;case"number":return dC(n);case"boolean":return hC(n);case"bigint":return hy?hy(n):"0";case"symbol":return uy?uy(n):"Symbol()";case"undefined":return za(n);case"function":case"object":{if(n===null)return za(n);let e=n,t=ur(e,"toString");if(typeof t=="function"){let r=t(e);return typeof r=="string"?r:za(r)}return za(n)}default:return za(n)}}function ur(n,e){for(;n!==null;){let r=oC(n,e);if(r){if(r.get)return Tt(r.get);if(typeof r.value=="function")return Tt(r.value)}n=sC(n)}function t(){return null}return t}function mC(n){try{return on(n,""),!0}catch(e){return!1}}var fy=It(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Zf=It(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse
Line truncated
|
|
|
|
|
`+Ae),vt&&(Ae=Q(Ae)),W&&xt?we(Ae):Ae},e.setConfig=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Oi(_),Y=!0,te=ke,ge=be},e.clearConfig=function(){gn=null,Y=!1,te=null,ge=null,W=de,ne=""},e.isValidAttribute=function(_,p,b){gn||Oi({});let T=Te(_),L=Te(p);return Ie(T,L,b)},e.addHook=function(_,p){typeof p=="function"&&Qn(me,_)&&Ia(me[_],p)},e.removeHook=function(_,p){if(Qn(me,_)){if(p!==void 0){let b=aC(me[_],p);return b===-1?void 0:lC(me[_],b,1)[0]}return ly(me[_])}},e.removeHooks=function(_){Qn(me,_)&&(me[_]=[])},e.removeAllHooks=function(){me=Sy()},e}var Vi=Py();var RC=Yf(),jf=class extends _c{constructor(t,r){super(r);this.scrollbarWidth=12;this.parent=t,this.parent.setAttribute("tabindex","-1"),this.parent.addEventListener("mousedown",i=>{i.preventDefault(),this.parent.focus()}),ny(this.parent,()=>this.getShortcuts()),iy(this.parent,"verilog-waveform"),this.recreate()}getShortcuts(){return this.getActions()}recreate(){clearTimeout(this.wtimer),this.wtimer=setTimeout(()=>{this.destroy(),this._recreate()},0)}destroy(){this.wavelist&&($(this.wavelist.container).remove(),this.wavelist=null),this.toolbar&&(this.toolbar.destroy(),this.toolbar=null),this.clklabel&&(this.clklabel.remove(),this.clklabel=null)}_recreate(){if(this.meta=this.wfp.getSignalMetadata(),!!this.meta){var t=$(this.parent).width();this.pageWidth=t-this.scrollbarWidth;var r=40;this.setClocksPerPage(),this.clockMax=0,this.wavelist=new Nn({w:t,h:$(this.parent).height(),itemHeight:r,totalRows:this.meta.length+1,generatorFn:a=>{var l=this.meta[a];let c=document.createElement("div"),d=document.createElement("canvas");return d.width=t-12,d.height=r,c.appendChild(d),c.classList.add("waverow"),this.lines[a]=d,this.refreshRow(a),this.isEditable(l)&&(c.onmousedown=h=>{var u=this.meta[a];u&&u.input&&this.changeInputValue(a)},c.classList.add("editable"),c.style.cursor="grab"),c}});var i=this.wavelist.container;i.tabIndex=-1,this.toolbar=new Wi(this.parent,this.parent),this.toolbar.span.css("display","inline-block"),this.clklabel=document.createElement("span"),this.clklabel.innerText="-",$(this.parent).append(this.clklabel),$(this.parent).append(i);var s=!1,o=a=>{this.setSelTime(a.offsetX/this.zoom+this.t0-.5)};$(i).mousedown(a=>{s=!0,o(a)}),$(i).mousemove(a=>{s&&o(a)}),$(i).mouseup(a=>{s=!1}),$(i).on("wheel",a=>{if(Math.abs(a.originalEvent.deltaX)>Math.abs(a.originalEvent.deltaY)){var l=Math.max(-1e3,Math.min(1e3,a.originalEvent.deltaX));l&&this.setOrgTime(this.t0+l)}});for(let a of this.getActions())this.toolbar.add(a.key,a.label,a.icon,a.fn);this.toolbar.add("+","Zoom In",null,()=>this.setZoom(this.zoom*2)),$(window).resize(()=>{this.recreate()})}}selectionChanged(){this.clklabel.innerText=" clk "+this.tsel}promptValue(t,r,i,s){return new Promise(o=>{bootbox.prompt({value:r+"",inputType:"number",title:`Enter new value for "${Vi.sanitize(t.label)}" (${i} to ${s}):`,callback:a=>o(a!=null?parseInt(a):null)})})}},Mc=class{constructor(e,t){this.provider=t;var r=$("#emuoverlay").show();this.topdiv=$('<div class="emuspacer">').appendTo(r)[0],this.topdiv.appendChild(e),this.wavediv=$('<div class="emuscope">').appendTo(r)[0],this.split=RC([this.topdiv,this.wavediv],{minSize:[0,0],sizes:[99,1],direction:"vertical",gutterSize:16,onDrag:()=>this.resize()})}isVisible(){return this.split.getSizes()[1]>2}show(){this.split.setSizes([0,100])}setCurrentTime(e){this.waveview&&this.waveview.setCurrentTime(e)}update(){this.isVisible()&&(this.waveview?this.waveview.refresh():this.waveview=new jf(this.wavediv,this.provider))}resize(){this.waveview&&this.waveview.recreate()}};function ky(){X0({createScope:(n,e)=>new Mc(n,e),showVideoControls(n){$("#speed_bar, #run_bar, #dbg_record").toggle(n)},showSettleCount(n){n==null?$("#verilog_bar").hide():($("#verilog_bar").show(),$("#settle_label").text(n+""))}})}var nt=[/^\s*[.#%]?(include|incbin|embed)\s+"(.+?)"/gmi,/^\s*([;']|[/][/])#(resource)\s+"(.+?)"/gm],MC=[...nt,/^\s*[.]?(include|incbin)\s+([^\s;"]+)/gmi],LC=[...nt,/^\s*#pragma\s+compile\s*\(\s*"([^"]+)"\s*\)/gmi],lt=[/^\s*([;]|[/][/])#link\s+"(.+?)"/gm],Na=[/^\s*(`include|[.]include)\s+"(.+?)"/gmi,/^\s*\$(include|\$dofile|\$write_image_in_table)\('(.+?)'/gmi,{re:/^\s*([.]arch)\s+(\w+)/gmi,suffix:".json"},/\$readmem[bh]\("(.+?)"/gmi],DC=[{re:/^\s*[.#%]?\s*include\s+<(.+?)>/gmi,system:!0}];function Ty(n){let e=n&&qt(n);return e&&e.includeDirs&&e.includeDirs.length?DC:[]}var $y=[/^\s+(USE|ASM)\s+(\S+[.]\S+)/gm],ZC=[/^[!]src\s+"(.+?)"/gmi],IC=[{re:/^\s*import\s*"(.+?)";/gmi,suffix:".wiz"},/^\s*embed\s*"(.+?)";/gmi],XC=[/^\s*(import)\s*"(.+?)"/gmi],zC=[/^\s*%%\s*#include\s+"(.+?)"/gm],WC={cc65:{apple2:"https://cc65.github.io/doc/apple2.html",atari8:"https://cc65.github.io/doc/atari.html",c64:"https://cc65.github.io/doc/c64.html",nes:"https://cc65.github.io/doc/nes.html",pce:"https://cc65.github.io/doc/pce.html",vic20:"https://cc65.github.io/doc/vic20.html",lynx:"https://cc65.github.io/doc/lynx.html"}},qf=3,Uf={default:qf===3?{preloadFS:"sdcc",wasiFSZipLine truncated
|
|
|
|
|
`);for(let i of e||[]){let s=i instanceof RegExp?{re:i}:i;for(let o of r){let a;for(s.re.lastIndex=0;a=s.re.exec(o);){let l=a[s.group!=null?s.group:a.length-1];l&&t.push(s.suffix?l+s.suffix:l)}}}return t}var Lr={vcs:{arch:"6502",code_start:4096,code_size:61440,data_start:128,data_size:128,wiz_rom_ext:".a26",wiz_inc_dir:"2600",cfgfile:"atari2600.cfg",libargs:["crt0.o","atari2600.lib"],extra_link_files:["crt0.o","atari2600.cfg"],asm_cfgfile:"atari2600-asm.cfg",asm_libargs:[],asm_extra_link_files:["atari2600-asm.cfg"],extra_compile_files:["vcs.h","macro.h"],define:["__ATARI2600__"]},mw8080bw:{arch:"z80",code_start:0,rom_size:8192,data_start:8192,data_size:1024,stack_end:9216},vicdual:{arch:"z80",code_start:0,rom_size:16416,data_start:58368,data_size:1024,stack_end:59392},galaxian:{arch:"z80",code_start:0,rom_size:16384,data_start:16384,data_size:1024,stack_end:18432},"galaxian-scramble":{arch:"z80",code_start:0,rom_size:20512,data_start:16384,data_size:1024,stack_end:18432},pacman:{arch:"z80",code_start:0,codeseg_start:202,rom_size:32768,data_start:19456,data_size:652,stack_end:20416},williams:{arch:"6809",code_start:0,rom_size:49152,data_start:38912,data_size:10240,stack_end:49152,set_stack_end:49152,extra_link_files:["williams.scr","libcmoc-crt-vec.a","libcmoc-std-vec.a"],extra_link_args:["-swilliams.scr","-lcmoc-crt-vec","-lcmoc-std-vec"],extra_compile_files:["assert.h","cmoc.h","stdarg.h","stdlib.h"]},"williams-defender":{arch:"6809",code_start:0,rom_size:49152,data_start:38912,data_size:10240,stack_end:49152},"williams-z80":{arch:"z80",code_start:0,rom_size:38912,data_start:38912,data_size:10240,stack_end:49152},"vector-z80color":{arch:"z80",code_start:0,rom_size:32768,data_start:57344,data_size:8192,stack_end:0},"vector-ataricolor":{arch:"6502",define:["__VECTOR__"],cfgfile:"vector-color.cfg",libargs:["crt0.o","none.lib"],extra_link_files:["crt0.o","vector-color.cfg"]},"sound_williams-z80":{arch:"z80",code_start:0,rom_size:16384,data_start:16384,data_size:1024,stack_end:32768},base_z80:{arch:"z80",code_start:0,rom_size:32768,data_start:32768,data_size:32768,stack_end:0},coleco:{arch:"z80",rom_start:32768,code_start:33024,rom_size:32768,data_start:28672,data_size:1024,stack_end:32768,extra_preproc_args:["-I","/share/include/coleco","-D","CV_CV"],extra_link_args:["-k","/share/lib/coleco","-l","libcv","-l","libcvu","crt0.rel"]},msx:{arch:"z80",rom_start:16384,code_start:16384,rom_size:32768,data_start:49152,data_size:12288,stack_end:65535,extra_link_args:["crt0-msx.rel"],extra_link_files:["crt0-msx.rel","crt0-msx.lst"],wiz_sys_type:"z80",wiz_inc_dir:"msx"},"msx-libcv":{arch:"z80",rom_start:16384,code_start:16384,rom_size:32768,data_start:49152,data_size:12288,stack_end:65535,extra_preproc_args:["-I",".","-D","CV_MSX"],extra_link_args:["-k",".","-l","libcv-msx","-l","libcvu-msx","crt0-msx.rel"],extra_link_files:["libcv-msx.lib","libcvu-msx.lib","crt0-msx.rel","crt0-msx.lst"],extra_compile_files:["cv.h","cv_graphics.h","cv_input.h","cv_sound.h","cv_support.h","cvu.h","cvu_c.h","cvu_compression.h","cvu_f.h","cvu_graphics.h","cvu_input.h","cvu_sound.h"]},"sms-sg1000-libcv":{arch:"z80",rom_start:0,code_start:256,rom_size:49152,data_start:49152,data_size:1024,stack_end:57344,extra_preproc_args:["-I",".","-D","CV_SMS"],extra_link_args:["-k",".","-l","libcv-sms","-l","libcvu-sms","crt0-sms.rel"],extra_link_files:["libcv-sms.lib","libcvu-sms.lib","crt0-sms.rel","crt0-sms.lst"],extra_compile_files:["cv.h","cv_graphics.h","cv_input.h","cv_sound.h","cv_support.h","cvu.h","cvu_c.h","cvu_compression.h","cvu_f.h","cvu_graphics.h","cvu_input.h","cvu_sound.h"]},nes:{arch:"6502",define:["__NES__"],cfgfile:"neslib2.cfg",libargs:["crt0.o","nes.lib","neslib2.lib","-D","NES_MAPPER=0","-D","NES_PRG_BANKS=2","-D","NES_CHR_BANKS=1","-D","NES_MIRRORING=0"],extra_link_files:["crt0.o","neslib2.lib","neslib2.cfg","nesbanked.cfg"],extra_compile_files:["neslib.h"],symbolConfigs:{NES_MAPPER:{4:"nesbanked.cfg"}},ignore_segments:["HEADER","CHARS"],wiz_rom_ext:".nes"},apple2:{arch:"6502",define:["__APPLE2__"],cfgfile:"apple2.cfg",libargs:["--lib-path","/share/target/apple2/drv","apple2.lib"],__CODE_RUN__:16384,code_start:2051,rom_size:35837,data_start:37888,zp_start:96,load_header:"dos33",acmeargs:["-f","apple"]},"apple2-e":{arch:"6502",define:["__APPLE2__"],cfgfile:"apple2.cfg",libargs:["apple2.lib"],acmeargs:["-f","apple"]},"atari8-800xl.disk":{arch:"6502",define:["__ATARI__"],cfgfile:"atari.cfg",libargs:["atari.lib"],fastbasic_cfgfile:"fastbasic-cart.cfg",ignore_segments:["EXEHDR","SYSCHKHDR","SYSCHKTRL","MAINHDR","AUTOSTRT"]},"atari8-800xl":{arch:"6502",define:["__ATARI__"],cfgfile:"atari-cart.cfg",libargs:["atari.lib","-D","__CARTFLAGS__=4"],fastbasic_cfgfile:"fastbasic-cart.cfg"},"atari8-800":{arch:"6502",define:["__ATARI__"],cfgfile:"atari-cart.cfg",libargs:["atari.lib","-D","__CARTFLAGS__=4"],fastbasic_cfgfile:"fastbasic-cart.cfg"},"atari8-5200":{arch:"6502",define:["__ATARI5200__"],cfgfile:"atari5200.cfg",libargs:["atari5200.lib","
Line truncated
|
|
|
|
|
\\ 0 . =`],action:"Keypad"}],vectrex:[{keys:[_s],action:"Joystick"},{keys:["Z X C V"],action:"Buttons"}],atari8:[{keys:[_s],action:"Joystick"},{keys:["Shift"],action:"Button"},{keys:["F1"],action:"Start"},{keys:["F2"],action:"Select"},{keys:["F3"],action:"Option"}],pacman:[{keys:["\u2190\xA0\u2192"],action:"Joystick"},{keys:["Space"],action:"Fire"},{keys:["5","6"],action:"Coin"},{keys:["Enter","2"],action:"Start"}]};var WA={left:"arrowleft",right:"arrowright",up:"arrowup",down:"arrowdown"},Af=null;function Po(){if(Af===null){var n=typeof navigator!="undefined"?navigator:null;Af=!!n&&/mac|iphone|ipad|ipod/i.test(n.platform||n.userAgent||"")}return Af}function _f(n){var e=n.toLowerCase().split("+"),t=e.pop(),r={mod:!1,shift:!1,key:""};for(var i of e)if(i=="mod"||i=="ctrl"||i=="meta"||i=="cmd")r.mod=!0;else if(i=="shift")r.shift=!0;else return console.warn('Keyboard shortcut "'+n+'": unsupported modifier "'+i+'" (alt is layout-dependent), skipping'),null;t=WA[t]||t;var s=/^[a-z]$/.test(t),o=/^f([1-9]|1[0-2])$/.test(t);return!s&&!o&&!/^[0-9]$/.test(t)&&!/^arrow/.test(t)?(console.warn('Keyboard shortcut "'+n+'": key "'+t+'" is layout-dependent (use a-z, 0-9, f1-f12), skipping'),null):r.shift&&!s&&!/^arrow/.test(t)?(console.warn('Keyboard shortcut "'+n+'": shift is only allowed with letters and arrows, skipping'),null):(r.key=t,r)}function NA(n,e){if(e.altKey)return!1;var t=Po(),r=t?e.metaKey:e.ctrlKey,i=t?e.ctrlKey:e.metaKey;return n.mod!==r||i||n.shift!==e.shiftKey?!1:(e.key||"").toLowerCase()===n.key}var Ac=class{constructor(){this.bindings=[];this.handler=e=>{if(!e.defaultPrevented)for(var t=0;t<this.bindings.length;t++){var r=this.bindings[t];if(NA(r.binding,e)){e.preventDefault(),e.stopPropagation(),r.fn(e);return}}}}bind(e,t){var r=_f(e);r&&this.bindings.push({binding:r,fn:t})}unbindAll(){this.bindings=[]}attach(){window.addEventListener("keydown",this.handler)}detach(){window.removeEventListener("keydown",this.handler)}},BA={mod:"Mod",cmd:"Mod",meta:"Mod",ctrl:"Ctrl",control:"Ctrl",shift:"Shift",alt:"Alt",option:"Alt"},Cf=null;function VA(){if(Cf===null){var n=typeof navigator!="undefined"?navigator:null;Cf=!!n&&/win/i.test(n.platform||n.userAgent||"")}return Cf}function j0(n){var e=n.split("-"),t=e.pop();t===""&&(t="-");var r=[];for(var i of e)if(i!==""){var s=BA[i.toLowerCase()]||i;s=="Ctrl"&&!Po()&&(s="Mod"),r.indexOf(s)<0&&r.push(s)}return r.sort(),r.concat([t.toLowerCase()]).join("-")}function FA(n){var e=Po()?n.mac:VA()?n.win:n.linux;return e||n.key}var Ef=["Mod-Shift-a","Mod-Shift-d","Mod-Shift-e","Mod-Shift-f","Mod-Shift-g","Mod-Shift-h","Mod-Shift-i","Mod-Shift-j","Mod-Shift-k","Mod-Shift-l","Mod-Shift-r","Mod-Shift-x","Mod-Shift-y"];function Rf(n,e){var t=e.map(j0);return n.filter(function(r){var i=FA(r);return!i||t.indexOf(j0(i))<0})}var YA={shift:"\u21E7",ctrl:"\u2303",alt:"\u2325",meta:"\u2318",mod:"\u2318",cmd:"\u2318"},jA={shift:"Shift",ctrl:"Ctrl",alt:"Alt",meta:"Win",mod:"Ctrl",cmd:"Cmd"},UA={arrowleft:"\u2190",arrowright:"\u2192",arrowup:"\u2191",arrowdown:"\u2193",backspace:"\u232B",enter:"\u21A9",tab:"\u21E5",escape:"\u238B",space:"\u2423"};function Lf(n){var e=n.toLowerCase().split("+"),t=e.pop(),r=Po(),i=r?["shift","ctrl","alt","meta","mod","cmd"]:["mod","ctrl","shift","alt","meta","cmd"],s=i.filter(c=>e.indexOf(c)>=0);for(var o of e)s.indexOf(o)<0&&s.push(o);var a=s.map(c=>r?YA[c]||c:jA[c]||c).join(r?"":"+"),l=/^[a-z][0-9]?$/.test(t)?t.toUpperCase():UA[t]||(r?t:t.charAt(0).toUpperCase()+t.slice(1));return(a?a+(r?"":"+"):"")+l}var Mf=class{constructor(e){this.shortcutsSig="";this.status={};this.visible=!0;this.pendingShortcuts=!1;this.pendingStatus=!1;this.div=e,this.shortcutsZone=$(document.createElement("span")).addClass("shortcuts_zone"),this.statusZone=$(document.createElement("span")).addClass("status_zone"),$(e).append(this.shortcutsZone).append(this.statusZone)}setShortcuts(e){if(this.visible){var t=e.map(s=>s.key+""+s.label).join("");if(t!==this.shortcutsSig){if(Za){this.pendingShortcuts=!0;return}this.shortcutsSig=t,this.shortcutsZone.empty();for(var r of e){var i=$(document.createElement("span")).addClass("shortcut");i.append($(document.createElement("kbd")).text(Lf(r.key))),i.append(document.createTextNode(" "+r.label)),r.fn&&U0(i,r.fn),this.shortcutsZone.append(i)}}}}setStatus(e,t){t?this.status[e]=t:delete this.status[e],this.renderStatus()}renderStatus(){if(this.visible){if(Za){this.pendingStatus=!0;return}this.statusZone.empty();for(var e of Object.keys(this.status)){var t=this.status[e],r=$(document.createElement("span")).addClass("status_item");t.cls&&r.addClass(t.cls),t.title&&r.prop("title",t.title),r.text(t.text),t.fn&&U0(r,t.fn),this.statusZone.append(r)}}}};function U0(n,e){n.addClass("clickable"),n.mousedown(t=>t.preventDefault()),n.click(e)}var Za=!1;function q0(){zn&&(zn.pendingShortcuts&&(zn.pendingShortcuts=!1,Wn()),zn.pendingStatus&&(zn.pendingStatus=!1,zn.renderStatus()))}function qA(){$(document).on("mousedown.shortcutbar",()=>{Za=!0}),$(document).on(
Line truncated
|
|
|
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iC(n,e){return tC(n)||nC(n,e)||sC(n,e)||rC()}function sC(n,e){if(n){if(typeof n=="string")return oy(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?oy(n,e):void 0}}function Ec(n){var e,t;function r(s,o){try{var a=n[s](o),l=a.value,c=l instanceof eC;Promise.resolve(c?l.v:l).then(function(d){if(c){var h=s==="return"&&l.k?s:"next";if(!l.k||d.done)return r(h,d);d=n[h](d).value}i(!!a.done,d)},function(d){r("throw",d)})}catch(d){i(2,d)}}function i(s,o){s===2?e.reject(o):e.resolve({value:o,done:s}),(e=e.next)?r(e.key,e.arg):t=null}this._invoke=function(s,o){return new Promise(function(a,l){var c={key:s,arg:o,resolve:a,reject:l,next:null};t?t=t.next=c:(e=t=c,r(s,o))})},typeof n.return!="function"&&(this.return=void 0)}Ec.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},Ec.prototype.next=function(n){return this._invoke("next",n)},Ec.prototype.throw=function(n){return this._invoke("throw",n)},Ec.prototype.return=function(n){return this._invoke("return",n)};var vy=Object.entries,ay=Object.setPrototypeOf,oC=Object.isFrozen,aC=Object.getPrototypeOf,lC=Object.getOwnPropertyDescriptor,It=Object.freeze,Bt=Object.seal,ko=Object.create,wy=typeof Reflect!="undefined"&&Reflect,Nf=wy.apply,Bf=wy.construct;It||(It=function(e){return e});Bt||(Bt=function(e){return e});Nf||(Nf=function(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];return e.apply(t,i)});Bf||(Bf=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return new e(...r)});var Es=Tt(Array.prototype.forEach);Array.prototype.indexOf;var cC=Tt(Array.prototype.lastIndexOf),ly=Tt(Array.prototype.pop),Ia=Tt(Array.prototype.push);Array.prototype.slice;var dC=Tt(Array.prototype.splice),$o=Array.isArray,Wa=Tt(String.prototype.toLowerCase),Df=Tt(String.prototype.toString),cy=Tt(String.prototype.match),Xa=Tt(String.prototype.replace),dy=Tt(String.prototype.indexOf),hC=Tt(String.prototype.trim),uC=Tt(Number.prototype.toString),fC=Tt(Boolean.prototype.toString),hy=typeof BigInt=="undefined"?null:Tt(BigInt.prototype.toString),uy=typeof Symbol=="undefined"?null:Tt(Symbol.prototype.toString),Qn=Tt(Object.prototype.hasOwnProperty),za=Tt(Object.prototype.toString),on=Tt(RegExp.prototype.test),Ni=pC(TypeError);function Tt(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return Nf(n,e,r)}}function pC(n){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Bf(n,t)}}function Ve(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Wa;if(ay&&ay(n,null),!$o(e))return n;let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){let s=t(i);s!==i&&(oC(e)||(e[r]=s),i=s)}n[i]=!0}return n}function mC(n){for(let e=0;e<n.length;e++)Qn(n,e)||(n[e]=null);return n}function Vn(n){let e=ko(null);for(let r of vy(n)){var t=iC(r,2);let i=t[0],s=t[1];Qn(n,i)&&($o(s)?e[i]=mC(s):s&&typeof s=="object"&&s.constructor===Object?e[i]=Vn(s):e[i]=s)}return e}function gC(n){switch(typeof n){case"string":return n;case"number":return uC(n);case"boolean":return fC(n);case"bigint":return hy?hy(n):"0";case"symbol":return uy?uy(n):"Symbol()";case"undefined":return za(n);case"function":case"object":{if(n===null)return za(n);let e=n,t=ur(e,"toString");if(typeof t=="function"){let r=t(e);return typeof r=="string"?r:za(r)}return za(n)}default:return za(n)}}function ur(n,e){for(;n!==null;){let r=lC(n,e);if(r){if(r.get)return Tt(r.get);if(typeof r.value=="function")return Tt(r.value)}n=aC(n)}function t(){return null}return t}function OC(n){try{return on(n,""),!0}catch(e){return!1}}var fy=It(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Zf=It(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse
Line truncated
|
|
|
|
|
`+Ae),vt&&(Ae=Q(Ae)),W&&xt?we(Ae):Ae},e.setConfig=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Oi(_),Y=!0,te=ke,ge=be},e.clearConfig=function(){gn=null,Y=!1,te=null,ge=null,W=de,ne=""},e.isValidAttribute=function(_,p,b){gn||Oi({});let T=Te(_),L=Te(p);return Ie(T,L,b)},e.addHook=function(_,p){typeof p=="function"&&Qn(me,_)&&Ia(me[_],p)},e.removeHook=function(_,p){if(Qn(me,_)){if(p!==void 0){let b=cC(me[_],p);return b===-1?void 0:dC(me[_],b,1)[0]}return ly(me[_])}},e.removeHooks=function(_){Qn(me,_)&&(me[_]=[])},e.removeAllHooks=function(){me=Sy()},e}var Vi=Py();var LC=Yf(),jf=class extends _c{constructor(t,r){super(r);this.scrollbarWidth=12;this.parent=t,this.parent.setAttribute("tabindex","-1"),this.parent.addEventListener("mousedown",i=>{i.preventDefault(),this.parent.focus()}),ny(this.parent,()=>this.getShortcuts()),iy(this.parent,"verilog-waveform"),this.recreate()}getShortcuts(){return this.getActions()}recreate(){clearTimeout(this.wtimer),this.wtimer=setTimeout(()=>{this.destroy(),this._recreate()},0)}destroy(){this.wavelist&&($(this.wavelist.container).remove(),this.wavelist=null),this.toolbar&&(this.toolbar.destroy(),this.toolbar=null),this.clklabel&&(this.clklabel.remove(),this.clklabel=null)}_recreate(){if(this.meta=this.wfp.getSignalMetadata(),!!this.meta){var t=$(this.parent).width();this.pageWidth=t-this.scrollbarWidth;var r=40;this.setClocksPerPage(),this.clockMax=0,this.wavelist=new Nn({w:t,h:$(this.parent).height(),itemHeight:r,totalRows:this.meta.length+1,generatorFn:a=>{var l=this.meta[a];let c=document.createElement("div"),d=document.createElement("canvas");return d.width=t-12,d.height=r,c.appendChild(d),c.classList.add("waverow"),this.lines[a]=d,this.refreshRow(a),this.isEditable(l)&&(c.onmousedown=h=>{var u=this.meta[a];u&&u.input&&this.changeInputValue(a)},c.classList.add("editable"),c.style.cursor="grab"),c}});var i=this.wavelist.container;i.tabIndex=-1,this.toolbar=new Wi(this.parent,this.parent),this.toolbar.span.css("display","inline-block"),this.clklabel=document.createElement("span"),this.clklabel.innerText="-",$(this.parent).append(this.clklabel),$(this.parent).append(i);var s=!1,o=a=>{this.setSelTime(a.offsetX/this.zoom+this.t0-.5)};$(i).mousedown(a=>{s=!0,o(a)}),$(i).mousemove(a=>{s&&o(a)}),$(i).mouseup(a=>{s=!1}),$(i).on("wheel",a=>{if(Math.abs(a.originalEvent.deltaX)>Math.abs(a.originalEvent.deltaY)){var l=Math.max(-1e3,Math.min(1e3,a.originalEvent.deltaX));l&&this.setOrgTime(this.t0+l)}});for(let a of this.getActions())this.toolbar.add(a.key,a.label,a.icon,a.fn);this.toolbar.add("+","Zoom In",null,()=>this.setZoom(this.zoom*2)),$(window).resize(()=>{this.recreate()})}}selectionChanged(){this.clklabel.innerText=" clk "+this.tsel}promptValue(t,r,i,s){return new Promise(o=>{bootbox.prompt({value:r+"",inputType:"number",title:`Enter new value for "${Vi.sanitize(t.label)}" (${i} to ${s}):`,callback:a=>o(a!=null?parseInt(a):null)})})}},Mc=class{constructor(e,t){this.provider=t;var r=$("#emuoverlay").show();this.topdiv=$('<div class="emuspacer">').appendTo(r)[0],this.topdiv.appendChild(e),this.wavediv=$('<div class="emuscope">').appendTo(r)[0],this.split=LC([this.topdiv,this.wavediv],{minSize:[0,0],sizes:[99,1],direction:"vertical",gutterSize:16,onDrag:()=>this.resize()})}isVisible(){return this.split.getSizes()[1]>2}show(){this.split.setSizes([0,100])}setCurrentTime(e){this.waveview&&this.waveview.setCurrentTime(e)}update(){this.isVisible()&&(this.waveview?this.waveview.refresh():this.waveview=new jf(this.wavediv,this.provider))}resize(){this.waveview&&this.waveview.recreate()}};function ky(){X0({createScope:(n,e)=>new Mc(n,e),showVideoControls(n){$("#speed_bar, #run_bar, #dbg_record").toggle(n)},showSettleCount(n){n==null?$("#verilog_bar").hide():($("#verilog_bar").show(),$("#settle_label").text(n+""))}})}var nt=[/^\s*[.#%]?(include|incbin|embed)\s+"(.+?)"/gmi,/^\s*([;']|[/][/])#(resource)\s+"(.+?)"/gm],DC=[...nt,/^\s*[.]?(include|incbin)\s+([^\s;"]+)/gmi],ZC=[...nt,/^\s*#pragma\s+compile\s*\(\s*"([^"]+)"\s*\)/gmi],lt=[/^\s*([;]|[/][/])#link\s+"(.+?)"/gm],Na=[/^\s*(`include|[.]include)\s+"(.+?)"/gmi,/^\s*\$(include|\$dofile|\$write_image_in_table)\('(.+?)'/gmi,{re:/^\s*([.]arch)\s+(\w+)/gmi,suffix:".json"},/\$readmem[bh]\("(.+?)"/gmi],IC=[{re:/^\s*[.#%]?\s*include\s+<(.+?)>/gmi,system:!0}];function Ty(n){let e=n&&qt(n);return e&&e.includeDirs&&e.includeDirs.length?IC:[]}var $y=[/^\s+(USE|ASM)\s+(\S+[.]\S+)/gm],XC=[/^[!]src\s+"(.+?)"/gmi],zC=[{re:/^\s*import\s*"(.+?)";/gmi,suffix:".wiz"},/^\s*embed\s*"(.+?)";/gmi],WC=[/^\s*(import)\s*"(.+?)"/gmi],NC=[/^\s*%%\s*#include\s+"(.+?)"/gm],BC={cc65:{apple2:"https://cc65.github.io/doc/apple2.html",atari8:"https://cc65.github.io/doc/atari.html",c64:"https://cc65.github.io/doc/c64.html",nes:"https://cc65.github.io/doc/nes.html",pce:"https://cc65.github.io/doc/pce.html",vic20:"https://cc65.github.io/doc/vic20.html",lynx:"https://cc65.github.io/doc/lynx.html"}},qf=3,Uf={default:qf===3?{preloadFS:"sdcc",wasiFSZipLine truncated
|
|
|
|
|
`);for(let i of e||[]){let s=i instanceof RegExp?{re:i}:i;for(let o of r){let a;for(s.re.lastIndex=0;a=s.re.exec(o);){let l=a[s.group!=null?s.group:a.length-1];l&&t.push(s.suffix?l+s.suffix:l)}}}return t}var Lr={vcs:{arch:"6502",code_start:4096,code_size:61440,data_start:128,data_size:128,wiz_rom_ext:".a26",wiz_inc_dir:"2600",cfgfile:"atari2600.cfg",libargs:["crt0.o","atari2600.lib"],extra_link_files:["crt0.o","atari2600.cfg"],asm_cfgfile:"atari2600-asm.cfg",asm_libargs:[],asm_extra_link_files:["atari2600-asm.cfg"],extra_compile_files:["vcs.h","macro.h"],define:["__ATARI2600__"]},mw8080bw:{arch:"z80",code_start:0,rom_size:8192,data_start:8192,data_size:1024,stack_end:9216},vicdual:{arch:"z80",code_start:0,rom_size:16416,data_start:58368,data_size:1024,stack_end:59392},galaxian:{arch:"z80",code_start:0,rom_size:16384,data_start:16384,data_size:1024,stack_end:18432},"galaxian-scramble":{arch:"z80",code_start:0,rom_size:20512,data_start:16384,data_size:1024,stack_end:18432},pacman:{arch:"z80",code_start:0,codeseg_start:202,rom_size:32768,data_start:19456,data_size:652,stack_end:20416},williams:{arch:"6809",code_start:0,rom_size:49152,data_start:38912,data_size:10240,stack_end:49152,set_stack_end:49152,extra_link_files:["williams.scr","libcmoc-crt-vec.a","libcmoc-std-vec.a"],extra_link_args:["-swilliams.scr","-lcmoc-crt-vec","-lcmoc-std-vec"],extra_compile_files:["assert.h","cmoc.h","stdarg.h","stdlib.h"]},"williams-defender":{arch:"6809",code_start:0,rom_size:49152,data_start:38912,data_size:10240,stack_end:49152},"williams-z80":{arch:"z80",code_start:0,rom_size:38912,data_start:38912,data_size:10240,stack_end:49152},"vector-z80color":{arch:"z80",code_start:0,rom_size:32768,data_start:57344,data_size:8192,stack_end:0},"vector-ataricolor":{arch:"6502",define:["__VECTOR__"],cfgfile:"vector-color.cfg",libargs:["crt0.o","none.lib"],extra_link_files:["crt0.o","vector-color.cfg"]},"sound_williams-z80":{arch:"z80",code_start:0,rom_size:16384,data_start:16384,data_size:1024,stack_end:32768},base_z80:{arch:"z80",code_start:0,rom_size:32768,data_start:32768,data_size:32768,stack_end:0},coleco:{arch:"z80",rom_start:32768,code_start:33024,rom_size:32768,data_start:28672,data_size:1024,stack_end:32768,extra_preproc_args:["-I","/share/include/coleco","-D","CV_CV"],extra_link_args:["-k","/share/lib/coleco","-l","libcv","-l","libcvu","crt0.rel"]},msx:{arch:"z80",rom_start:16384,code_start:16384,rom_size:32768,data_start:49152,data_size:12288,stack_end:65535,extra_link_args:["crt0-msx.rel"],extra_link_files:["crt0-msx.rel","crt0-msx.lst"],wiz_sys_type:"z80",wiz_inc_dir:"msx"},"msx-libcv":{arch:"z80",rom_start:16384,code_start:16384,rom_size:32768,data_start:49152,data_size:12288,stack_end:65535,extra_preproc_args:["-I",".","-D","CV_MSX"],extra_link_args:["-k",".","-l","libcv-msx","-l","libcvu-msx","crt0-msx.rel"],extra_link_files:["libcv-msx.lib","libcvu-msx.lib","crt0-msx.rel","crt0-msx.lst"],extra_compile_files:["cv.h","cv_graphics.h","cv_input.h","cv_sound.h","cv_support.h","cvu.h","cvu_c.h","cvu_compression.h","cvu_f.h","cvu_graphics.h","cvu_input.h","cvu_sound.h"]},"sms-sg1000-libcv":{arch:"z80",rom_start:0,code_start:256,rom_size:49152,data_start:49152,data_size:1024,stack_end:57344,extra_preproc_args:["-I",".","-D","CV_SMS"],extra_link_args:["-k",".","-l","libcv-sms","-l","libcvu-sms","crt0-sms.rel"],extra_link_files:["libcv-sms.lib","libcvu-sms.lib","crt0-sms.rel","crt0-sms.lst"],extra_compile_files:["cv.h","cv_graphics.h","cv_input.h","cv_sound.h","cv_support.h","cvu.h","cvu_c.h","cvu_compression.h","cvu_f.h","cvu_graphics.h","cvu_input.h","cvu_sound.h"]},nes:{arch:"6502",define:["__NES__"],cfgfile:"neslib2.cfg",libargs:["crt0.o","nes.lib","neslib2.lib","-D","NES_MAPPER=0","-D","NES_PRG_BANKS=2","-D","NES_CHR_BANKS=1","-D","NES_MIRRORING=0"],extra_link_files:["crt0.o","neslib2.lib","neslib2.cfg","nesbanked.cfg"],extra_compile_files:["neslib.h"],symbolConfigs:{NES_MAPPER:{4:"nesbanked.cfg"}},ignore_segments:["HEADER","CHARS"],wiz_rom_ext:".nes"},apple2:{arch:"6502",define:["__APPLE2__"],cfgfile:"apple2.cfg",libargs:["--lib-path","/share/target/apple2/drv","apple2.lib"],__CODE_RUN__:16384,code_start:2051,rom_size:35837,data_start:37888,zp_start:96,load_header:"dos33",acmeargs:["-f","apple"]},"apple2-e":{arch:"6502",define:["__APPLE2__"],cfgfile:"apple2.cfg",libargs:["apple2.lib"],acmeargs:["-f","apple"]},"atari8-800xl.disk":{arch:"6502",define:["__ATARI__"],cfgfile:"atari.cfg",libargs:["atari.lib"],fastbasic_cfgfile:"fastbasic-cart.cfg",ignore_segments:["EXEHDR","SYSCHKHDR","SYSCHKTRL","MAINHDR","AUTOSTRT"]},"atari8-800xl":{arch:"6502",define:["__ATARI__"],cfgfile:"atari-cart.cfg",libargs:["atari.lib","-D","__CARTFLAGS__=4"],fastbasic_cfgfile:"fastbasic-cart.cfg"},"atari8-800":{arch:"6502",define:["__ATARI__"],cfgfile:"atari-cart.cfg",libargs:["atari.lib","-D","__CARTFLAGS__=4"],fastbasic_cfgfile:"fastbasic-cart.cfg"},"atari8-5200":{arch:"6502",define:["__ATARI5200__"],cfgfile:"atari5200.cfg",libargs:["atari5200.lib","
Line truncated
|
|
|
|
|
`){[e,t]=_o(this,e,t);let i="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let a=this.text[o],l=s+a.length;s>e&&o&&(i+=r),e<l&&t>s&&(i+=a.slice(Math.max(0,e-s),t-s)),s=l+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(t.push(new n(r,i)),r=[],i=-1);return i>-1&&t.push(new n(r,i)),t}},To=class n extends De{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,t,r,i){for(let s=0;;s++){let o=this.children[s],a=i+o.length,l=r+o.lines-1;if((t?l:a)>=e)return o.lineInner(e,t,r,i);i=a+1,r=l+1}}decompose(e,t,r,i){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let a=this.children[s],l=o+a.length;if(e<=l&&t>=o){let c=i&((o<=e?1:0)|(l>=t?2:0));o>=e&&l<=t&&!c?r.push(a):a.decompose(e-o,t-o,r,c)}o=l+1}}replace(e,t,r){if([e,t]=_o(this,e,t),r.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let o=this.children[i],a=s+o.length;if(e>=s&&t<=a){let l=o.replace(e-s,t-s,r),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let d=this.children.slice();return d[i]=l,new n(d,this.length-(t-e)+r.length)}return super.replace(s,a,l)}s=a+1}return super.replace(e,t,r)}sliceString(e,t=this.length,r=`
|
|
|
|
|
`){[e,t]=_o(this,e,t);let i="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let a=this.children[s],l=o+a.length;o>e&&s&&(i+=r),e<l&&t>o&&(i+=a.sliceString(e-o,t-o,r)),o=l+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof n))return 0;let r=0,[i,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,s+=t){if(i==o||s==a)return r;let l=this.children[i],c=e.children[s];if(l!=c)return r+l.scanIdentical(c,t);r+=l.length+1}}static from(e,t=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let f of e)r+=f.lines;if(r<32){let f=[];for(let m of e)m.flatten(f);return new Fn(f,t)}let i=Math.max(32,r>>5),s=i<<1,o=i>>1,a=[],l=0,c=-1,d=[];function h(f){let m;if(f.lines>s&&f instanceof n)for(let O of f.children)h(O);else f.lines>o&&(l>o||!l)?(u(),a.push(f)):f instanceof Fn&&l&&(m=d[d.length-1])instanceof Fn&&f.lines+m.lines<=32?(l+=f.lines,c+=f.length+1,d[d.length-1]=new Fn(m.text.concat(f.text),m.length+1+f.length)):(l+f.lines>i&&u(),l+=f.lines,c+=f.length+1,d.push(f))}function u(){l!=0&&(a.push(d.length==1?d[0]:n.from(d,c)),c=-1,l=d.length=0)}for(let f of e)h(f);return u(),a.length==1?a[0]:new n(a,t)}};De.empty=new Fn([""],0);function HC(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Vc(n,e,t=0,r=1e9){for(let i=0,s=0,o=!0;s<n.length&&i<=r;s++){let a=n[s],l=i+a.length;l>=t&&(l>r&&(a=a.slice(0,r-i)),i<t&&(a=a.slice(t-i)),o?(e[e.length-1]+=a,o=!1):e.push(a)),i=l+1}return e}function Gy(n,e,t){return Vc(n,[""],e,t)}var Zs=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Fn?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],o=s>>1,a=i instanceof Fn?i.text.length:i.children.length;if(o==(t>0?a:0)){if(r==0)return this.done=!0,this.value="",this;t>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[r]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
|
|
|
`,this;e--}else if(i instanceof Fn){let l=i.text[o+(t<0?-1:0)];if(this.offsets[r]+=t,l.length>Math.max(0,e))return this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=t):(t<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof Fn?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},Fc=class{constructor(e,t,r){this.value="",this.done=!1,this.cursor=new Zs(e,t>r?-1:1),this.pos=t>r?e.length:0,this.from=Math.min(t,r),this.to=Math.max(t,r)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let r=t<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=r?i:t<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},Yc=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:r,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol!="undefined"&&(De.prototype[Symbol.iterator]=function(){return this.iter()},Zs.prototype[Symbol.iterator]=Fc.prototype[Symbol.iterator]=Yc.prototype[Symbol.iterator]=function(){return this});var tp=class{constructor(e,t,r,i){this.from=e,this.to=t,this.number=r,this.text=i}get length(){return this.to-this.from}};function _o(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function Pt(n,e,t=!0,r=!0){return Yy(n,e,t,r)}function KC(n){return n>=56320&&n<57344}function JC(n){return n>=55296&&n<56320}function Ir(n,e){let t=n.charCodeAt(e);if(!JC(t)||e+1==n.length)return t;let r=n.charCodeAt(e+1);return KC(r)?(t-55296<<10)+(r-56320)+65536:t}function Hc(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Yi(n){return n<65536?1:2}var np=/\r\n?|\n/,Xt=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(Xt||(Xt={})),vi=class n{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t+1];e+=r<0?this.sections[t]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,r=0,i=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(r,i,s),i+=s):i+=o,r+=s}}iterChangedRanges(e,t=!1){rp(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let r=this.sections[t++],i=this.sections[t++];i<0?e.push(r,i):e.push(i,r)}return new n(e)}composeDesc(e){return this.empty?e:e.empty?this:tS(this,e)}mapDesc(e,t=!1){return e.empty?this:ip(this,e,t)}mapPos(e,t=-1,r=Xt.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=i+a;if(l<0){if(c>e)return s+(e-i);s+=a}else{if(r!=Xt.Simple&&c>=e&&(r==Xt.TrackDel&&i<e&&c>e||r==Xt.TrackBefore&&i<e||r==Xt.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!a)return e==i||t<0?s:s+l;s+=l}i=c}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,t=e){for(let r=0,i=0;r<this.sections.length&&i<=t;){let s=this.sections[r++],o=this.sections[r++],a=i+s;if(o>=0&&i<=t&&a>=e)return i<e&&a>t?"cover":!0;i=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let r=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new n(e)}static create(e){return new n(e)}},On=class n extends vi{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return rp(this,(t,r,i,s,o)=>e=e.replace(i,i+(r-t),o),!1),e}mapDesc(e,t=!1){return ip(this,e,t,!0)}invert(e){let t=this.sections.slice(),r=[];for(let i=0,s=0;i<t.length;i+=2){let o=t[i],a=t[i+1];if(a>=0){t[i]=a,t[i+1]=o;let l=i>>1;for(;r.length<l;)r.push(De.empty);r.push(o?e.slice(s,s+o):De.empty)}s+=o}return new n(t,r)}compose(e){return this.empty?e:e.empty?this:tS(this,e,!0)}map(e,t=!1){return e.empty?this:ip(this,e,t,!0)}iterChanges(e,t=!1){rp(this,e,t)}get desc
Line truncated
|
|
|
|
|
`}get readOnly(){return this.facet(lS)}phrase(e,...t){for(let r of this.facet(n.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>t.length?r:t[s-1]})),e}languageDataAt(e,t,r=-1){let i=[];for(let s of this.facet(rS))for(let o of s(this,t,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return l_(t.length?t[0]:"")}wordAt(e){let{text:t,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let l=Pt(t,o,!1);if(s(t.slice(l,o))!=et.Word)break;o=l}for(;a<i;){let l=Pt(t,a);if(s(t.slice(a,l))!=et.Word)break;a=l}return o==a?null:z.range(o+r,a+r)}};Me.allowMultipleSelections=op;Me.tabSize=oe.define({combine:n=>n.length?n[0]:4});Me.lineSeparator=iS;Me.readOnly=lS;Me.phrases=oe.define({compare(n,e){let t=Object.keys(n),r=Object.keys(e);return t.length==r.length&&t.every(i=>n[i]==e[i])}});Me.languageData=rS;Me.changeFilter=sS;Me.transactionFilter=oS;Me.transactionExtender=aS;Vt.reconfigure=ye.define();function Yn(n,e,t={}){let r={};for(let i of n)for(let s of Object.keys(i)){let o=i[s],a=r[s];if(a===void 0)r[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,s))r[s]=t[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)r[i]===void 0&&(r[i]=e[i]);return r}var fr=class{eq(e){return this==e}range(e,t=e){return Ya.create(e,t,this)}};fr.prototype.startSide=fr.prototype.endSide=0;fr.prototype.point=!1;fr.prototype.mapMode=Xt.TrackDel;function gp(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}var Ya=class n{constructor(e,t,r){this.from=e,this.to=t,this.value=r}static create(e,t,r){return new n(e,t,r)}};function hp(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}var up=class n{constructor(e,t,r,i){this.from=e,this.to=t,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,r,i=0){let s=r?this.to:this.from;for(let o=i,a=s.length;;){if(o==a)return o;let l=o+a>>1,c=s[l]-e||(r?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(e,t,r,i){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(r,1e9,!1,s);s<o;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let r=[],i=[],s=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],d=this.from[l]+e,h=this.to[l]+e,u,f;if(d==h){let m=t.mapPos(d,c.startSide,c.mapMode);if(m==null||(u=f=m,c.startSide!=c.endSide&&(f=t.mapPos(d,c.endSide),f<u)))continue}else if(u=t.mapPos(d,c.startSide),f=t.mapPos(h,c.endSide),u>f||u==f&&c.startSide>0&&c.endSide<=0)continue;(f-u||c.endSide-c.startSide)<0||(o<0&&(o=u),c.point&&(a=Math.max(a,f-u)),r.push(c),i.push(u-o),s.push(f-o))}return{mapped:r.length?new n(i,s,r,a):null,pos:o}}},$e=class n{constructor(e,t,r,i){this.chunkPos=e,this.chunk=t,this.nextLayer=r,this.maxPoint=i}static create(e,t,r,i){return new n(e,t,r,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(r&&(t=t.slice().sort(hp)),this.isEmpty)return t.length?n.of(t):this;let a=new Gc(this,null,-1).goto(0),l=0,c=[],d=new Zr;for(;a.value||l<t.length;)if(l<t.length&&(a.from-t[l].from||a.startSide-t[l].value.startSide)>=0){let h=t[l++];d.addInner(h.from,h.to,h.value)||c.push(h)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(a.chunkIndex)<t[l].from)&&(!o||i>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&d.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||i>a.to||s<a.from||o(a.from,a.to,a.value))&&(d.addInner(a.from,a.to,a.value)||c.push(Ya.create(a.from,a.to,a.value))),a.next());return d.finishInner(this.nextLayer.isEmpty&&!c.length?n.empty:this.nextLayer.update({add:c,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],r=[],i=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],c=e.touchesRange(a,a+l.length);if(c===!1)i=Math.max(i,l.maxPoint),t.push(l),r.push(e.mapPos(a));else if(c===!0){let{mapped:d,pos:h}=l.map(a,e);d&&(i=Math.max(i,d.maxPoint),t.push(d),r.push(h))}}let s=this.nextLayer.map(e);return t.length==0?s:new n(r,t,s||n.empty,i)}between(e,t,r){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,r)===!1)return}this.nextLayer.between(e,t,r)}}iter(e=0){return ja.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return ja.from(e).goto(t)}static compare(e,t,r,i,s=-1){let o=e.filter(h=>h.maxPoint>0||!h.is
Line truncated
|
|
|
|
|
`){[e,t]=_o(this,e,t);let i="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let a=this.children[s],l=o+a.length;o>e&&s&&(i+=r),e<l&&t>o&&(i+=a.sliceString(e-o,t-o,r)),o=l+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof n))return 0;let r=0,[i,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,s+=t){if(i==o||s==a)return r;let l=this.children[i],c=e.children[s];if(l!=c)return r+l.scanIdentical(c,t);r+=l.length+1}}static from(e,t=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let f of e)r+=f.lines;if(r<32){let f=[];for(let m of e)m.flatten(f);return new Fn(f,t)}let i=Math.max(32,r>>5),s=i<<1,o=i>>1,a=[],l=0,c=-1,d=[];function h(f){let m;if(f.lines>s&&f instanceof n)for(let O of f.children)h(O);else f.lines>o&&(l>o||!l)?(u(),a.push(f)):f instanceof Fn&&l&&(m=d[d.length-1])instanceof Fn&&f.lines+m.lines<=32?(l+=f.lines,c+=f.length+1,d[d.length-1]=new Fn(m.text.concat(f.text),m.length+1+f.length)):(l+f.lines>i&&u(),l+=f.lines,c+=f.length+1,d.push(f))}function u(){l!=0&&(a.push(d.length==1?d[0]:n.from(d,c)),c=-1,l=d.length=0)}for(let f of e)h(f);return u(),a.length==1?a[0]:new n(a,t)}};De.empty=new Fn([""],0);function JC(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Vc(n,e,t=0,r=1e9){for(let i=0,s=0,o=!0;s<n.length&&i<=r;s++){let a=n[s],l=i+a.length;l>=t&&(l>r&&(a=a.slice(0,r-i)),i<t&&(a=a.slice(t-i)),o?(e[e.length-1]+=a,o=!1):e.push(a)),i=l+1}return e}function Gy(n,e,t){return Vc(n,[""],e,t)}var Zs=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Fn?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],o=s>>1,a=i instanceof Fn?i.text.length:i.children.length;if(o==(t>0?a:0)){if(r==0)return this.done=!0,this.value="",this;t>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[r]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
|
|
|
`,this;e--}else if(i instanceof Fn){let l=i.text[o+(t<0?-1:0)];if(this.offsets[r]+=t,l.length>Math.max(0,e))return this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=t):(t<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof Fn?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},Fc=class{constructor(e,t,r){this.value="",this.done=!1,this.cursor=new Zs(e,t>r?-1:1),this.pos=t>r?e.length:0,this.from=Math.min(t,r),this.to=Math.max(t,r)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let r=t<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=r?i:t<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},Yc=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:r,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol!="undefined"&&(De.prototype[Symbol.iterator]=function(){return this.iter()},Zs.prototype[Symbol.iterator]=Fc.prototype[Symbol.iterator]=Yc.prototype[Symbol.iterator]=function(){return this});var tp=class{constructor(e,t,r,i){this.from=e,this.to=t,this.number=r,this.text=i}get length(){return this.to-this.from}};function _o(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function Pt(n,e,t=!0,r=!0){return Yy(n,e,t,r)}function e_(n){return n>=56320&&n<57344}function t_(n){return n>=55296&&n<56320}function Ir(n,e){let t=n.charCodeAt(e);if(!t_(t)||e+1==n.length)return t;let r=n.charCodeAt(e+1);return e_(r)?(t-55296<<10)+(r-56320)+65536:t}function Hc(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Yi(n){return n<65536?1:2}var np=/\r\n?|\n/,Xt=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(Xt||(Xt={})),vi=class n{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t+1];e+=r<0?this.sections[t]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,r=0,i=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(r,i,s),i+=s):i+=o,r+=s}}iterChangedRanges(e,t=!1){rp(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let r=this.sections[t++],i=this.sections[t++];i<0?e.push(r,i):e.push(i,r)}return new n(e)}composeDesc(e){return this.empty?e:e.empty?this:tS(this,e)}mapDesc(e,t=!1){return e.empty?this:ip(this,e,t)}mapPos(e,t=-1,r=Xt.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=i+a;if(l<0){if(c>e)return s+(e-i);s+=a}else{if(r!=Xt.Simple&&c>=e&&(r==Xt.TrackDel&&i<e&&c>e||r==Xt.TrackBefore&&i<e||r==Xt.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!a)return e==i||t<0?s:s+l;s+=l}i=c}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,t=e){for(let r=0,i=0;r<this.sections.length&&i<=t;){let s=this.sections[r++],o=this.sections[r++],a=i+s;if(o>=0&&i<=t&&a>=e)return i<e&&a>t?"cover":!0;i=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let r=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new n(e)}static create(e){return new n(e)}},On=class n extends vi{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return rp(this,(t,r,i,s,o)=>e=e.replace(i,i+(r-t),o),!1),e}mapDesc(e,t=!1){return ip(this,e,t,!0)}invert(e){let t=this.sections.slice(),r=[];for(let i=0,s=0;i<t.length;i+=2){let o=t[i],a=t[i+1];if(a>=0){t[i]=a,t[i+1]=o;let l=i>>1;for(;r.length<l;)r.push(De.empty);r.push(o?e.slice(s,s+o):De.empty)}s+=o}return new n(t,r)}compose(e){return this.empty?e:e.empty?this:tS(this,e,!0)}map(e,t=!1){return e.empty?this:ip(this,e,t,!0)}iterChanges(e,t=!1){rp(this,e,t)}get desc
Line truncated
|
|
|
|
|
`}get readOnly(){return this.facet(lS)}phrase(e,...t){for(let r of this.facet(n.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>t.length?r:t[s-1]})),e}languageDataAt(e,t,r=-1){let i=[];for(let s of this.facet(rS))for(let o of s(this,t,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return d_(t.length?t[0]:"")}wordAt(e){let{text:t,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let l=Pt(t,o,!1);if(s(t.slice(l,o))!=et.Word)break;o=l}for(;a<i;){let l=Pt(t,a);if(s(t.slice(a,l))!=et.Word)break;a=l}return o==a?null:z.range(o+r,a+r)}};Me.allowMultipleSelections=op;Me.tabSize=oe.define({combine:n=>n.length?n[0]:4});Me.lineSeparator=iS;Me.readOnly=lS;Me.phrases=oe.define({compare(n,e){let t=Object.keys(n),r=Object.keys(e);return t.length==r.length&&t.every(i=>n[i]==e[i])}});Me.languageData=rS;Me.changeFilter=sS;Me.transactionFilter=oS;Me.transactionExtender=aS;Vt.reconfigure=ye.define();function Yn(n,e,t={}){let r={};for(let i of n)for(let s of Object.keys(i)){let o=i[s],a=r[s];if(a===void 0)r[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,s))r[s]=t[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)r[i]===void 0&&(r[i]=e[i]);return r}var fr=class{eq(e){return this==e}range(e,t=e){return Ya.create(e,t,this)}};fr.prototype.startSide=fr.prototype.endSide=0;fr.prototype.point=!1;fr.prototype.mapMode=Xt.TrackDel;function gp(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}var Ya=class n{constructor(e,t,r){this.from=e,this.to=t,this.value=r}static create(e,t,r){return new n(e,t,r)}};function hp(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}var up=class n{constructor(e,t,r,i){this.from=e,this.to=t,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,r,i=0){let s=r?this.to:this.from;for(let o=i,a=s.length;;){if(o==a)return o;let l=o+a>>1,c=s[l]-e||(r?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(e,t,r,i){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(r,1e9,!1,s);s<o;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let r=[],i=[],s=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],d=this.from[l]+e,h=this.to[l]+e,u,f;if(d==h){let m=t.mapPos(d,c.startSide,c.mapMode);if(m==null||(u=f=m,c.startSide!=c.endSide&&(f=t.mapPos(d,c.endSide),f<u)))continue}else if(u=t.mapPos(d,c.startSide),f=t.mapPos(h,c.endSide),u>f||u==f&&c.startSide>0&&c.endSide<=0)continue;(f-u||c.endSide-c.startSide)<0||(o<0&&(o=u),c.point&&(a=Math.max(a,f-u)),r.push(c),i.push(u-o),s.push(f-o))}return{mapped:r.length?new n(i,s,r,a):null,pos:o}}},$e=class n{constructor(e,t,r,i){this.chunkPos=e,this.chunk=t,this.nextLayer=r,this.maxPoint=i}static create(e,t,r,i){return new n(e,t,r,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(r&&(t=t.slice().sort(hp)),this.isEmpty)return t.length?n.of(t):this;let a=new Gc(this,null,-1).goto(0),l=0,c=[],d=new Zr;for(;a.value||l<t.length;)if(l<t.length&&(a.from-t[l].from||a.startSide-t[l].value.startSide)>=0){let h=t[l++];d.addInner(h.from,h.to,h.value)||c.push(h)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(a.chunkIndex)<t[l].from)&&(!o||i>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&d.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||i>a.to||s<a.from||o(a.from,a.to,a.value))&&(d.addInner(a.from,a.to,a.value)||c.push(Ya.create(a.from,a.to,a.value))),a.next());return d.finishInner(this.nextLayer.isEmpty&&!c.length?n.empty:this.nextLayer.update({add:c,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],r=[],i=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],c=e.touchesRange(a,a+l.length);if(c===!1)i=Math.max(i,l.maxPoint),t.push(l),r.push(e.mapPos(a));else if(c===!0){let{mapped:d,pos:h}=l.map(a,e);d&&(i=Math.max(i,d.maxPoint),t.push(d),r.push(h))}}let s=this.nextLayer.map(e);return t.length==0?s:new n(r,t,s||n.empty,i)}between(e,t,r){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,r)===!1)return}this.nextLayer.between(e,t,r)}}iter(e=0){return ja.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return ja.from(e).goto(t)}static compare(e,t,r,i,s=-1){let o=e.filter(h=>h.maxPoint>0||!h.is
Line truncated
|
|
|
|
|
`)}static newName(){let e=uS[hS]||1;return uS[hS]=e+1,"\u037C"+e.toString(36)}static mount(e,t,r){let i=e[Op],s=r&&r.nonce;i?s&&i.setNonce(s):i=new bp(e,s),i.mount(Array.isArray(t)?t:[t],e)}},fS=new Map,bp=class{constructor(e,t){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=fS.get(r);if(s)return e[Op]=s;this.sheet=new i.CSSStyleSheet,fS.set(r,this)}else this.styleTag=r.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Op]=this}mount(e,t){let r=this.sheet,i=0,s=0;for(let o=0;o<e.length;o++){let a=e[o],l=this.modules.indexOf(a);if(l<s&&l>-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,a),r)for(let c=0;c<a.rules.length;c++)r.insertRule(a.rules[c],i++)}else{for(;s<l;)i+=this.modules[s++].rules.length;i+=a.rules.length,s++}}if(r)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
|
|
|
|
|
`;this.styleTag.textContent=o;let a=t.head||t;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var wi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Eo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},d_=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),h_=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(At=0;At<10;At++)wi[48+At]=wi[96+At]=String(At);var At;for(At=1;At<=24;At++)wi[At+111]="F"+At;var At;for(At=65;At<=90;At++)wi[At]=String.fromCharCode(At+32),Eo[At]=String.fromCharCode(At);var At;for(Jc in wi)Eo.hasOwnProperty(Jc)||(Eo[Jc]=wi[Jc]);var Jc;function pS(n){var e=d_&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||h_&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Eo:wi)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function kt(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var i=t[r];typeof i=="string"?n.setAttribute(r,i):i!=null&&(n[r]=i)}e++}for(;e<arguments.length;e++)mS(n,arguments[e]);return n}function mS(n,e){if(typeof e=="string")n.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)n.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)mS(n,e[t]);else throw new RangeError("Unsupported child node: "+e)}var bn=typeof navigator!="undefined"?navigator:{userAgent:"",vendor:"",platform:""},Tp=typeof document!="undefined"?document:{documentElement:{style:{}}},Ap=/Edge\/(\d+)/.exec(bn.userAgent),ev=/MSIE \d/.test(bn.userAgent),Cp=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(bn.userAgent),Ed=!!(ev||Cp||Ap),gS=!Ed&&/gecko\/(\d+)/i.test(bn.userAgent),yp=!Ed&&/Chrome\/(\d+)/.exec(bn.userAgent),OS="webkitFontSmoothing"in Tp.documentElement.style,_p=!Ed&&/Apple Computer/.test(bn.vendor),bS=_p&&(/Mobile\/\w+/.test(bn.userAgent)||bn.maxTouchPoints>2),ae={mac:bS||/Mac/.test(bn.platform),windows:/Win/.test(bn.platform),linux:/Linux|X11/.test(bn.platform),ie:Ed,ie_version:ev?Tp.documentMode||6:Cp?+Cp[1]:Ap?+Ap[1]:0,gecko:gS,gecko_version:gS?+(/Firefox\/(\d+)/.exec(bn.userAgent)||[0,0])[1]:0,chrome:!!yp,chrome_version:yp?+yp[1]:0,ios:bS,android:/Android\b/.test(bn.userAgent),webkit:OS,webkit_version:OS?+(/\bAppleWebKit\/(\d+)/.exec(bn.userAgent)||[0,0])[1]:0,safari:_p,safari_version:_p?+(/\bVersion\/(\d+(\.\d+)?)/.exec(bn.userAgent)||[0,0])[1]:0,tabSize:Tp.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function wm(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}var pd=Object.create(null);function xm(n,e,t){if(n==e)return!0;n||(n=pd),e||(e=pd);let r=Object.keys(n),i=Object.keys(e);if(r.length-(t&&r.indexOf(t)>-1?1:0)!=i.length-(t&&i.indexOf(t)>-1?1:0))return!1;for(let s of r)if(s!=t&&(i.indexOf(s)==-1||n[s]!==e[s]))return!1;return!0}function u_(n,e){for(let t=n.attributes.length-1;t>=0;t--){let r=n.attributes[t].name;e[r]==null&&n.removeAttribute(r)}for(let t in e){let r=e[t];t=="style"?n.style.cssText=r:n.getAttribute(t)!=r&&n.setAttribute(t,r)}}function yS(n,e,t){let r=!1;if(e)for(let i in e)t&&i in t||(r=!0,i=="style"?n.style.cssText="":n.removeAttribute(i));if(t)for(let i in t)e&&e[i]==t[i]||(r=!0,i=="style"?n.style.cssText=t[i]:n.setAttribute(i,t[i]));return r}function f_(n){let e=Object.create(null);for(let t=0;t<n.attributes.length;t++){let r=n.attributes[t];e[r.name]=r.value}return e}var Ct=class{eq(e){return!1}updateDOM(e,t,r){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},Ht=(function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n})(Ht||(Ht={})),K=class extends fr{constructor(e,t,r,i){super(),this.startSide=e,this.endLine truncated
|
|
|
|
|
`,i=n.state.doc.line(i.number+(t?1:-1)),s=n.bidiSpans(i),c=n.visualLineSide(i,!t)}if(l){if(!l(d))return a}else{if(!r)return c;l=r(d)}a=c}}function Y_(n,e,t){let r=n.state.charCategorizer(e),i=r(t);return s=>{let o=r(s);return i==et.Space&&(i=o),i==o}}function j_(n,e,t,r){let i=e.head,s=t?1:-1;if(i==(t?n.state.doc.length:0))return z.cursor(i,e.assoc);let o=e.goalColumn,a,l=n.contentDOM.getBoundingClientRect(),c=n.coordsAtPos(i,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),d=n.documentTop;if(c)o==null&&(o=c.left-l.left),a=s<0?c.top:c.bottom;else{let m=n.viewState.lineBlockAt(i);o==null&&(o=Math.min(l.right-l.left,n.defaultCharacterWidth*(i-m.from))),a=(s<0?m.top:m.bottom)+d}let h=l.left+o,u=n.viewState.heightOracle.textHeight>>1,f=r!=null?r:u;for(let m=0;;m+=u){let O=a+(f+m)*s,S=jp(n,{x:h,y:O},!1,s);if(t?O>l.bottom:O<l.top)return z.cursor(S.pos,S.assoc);let x=n.coordsAtPos(S.pos,S.assoc),D=x?(x.top+x.bottom)/2:0;if(!x||(t?D>a:D<a))return z.cursor(S.pos,S.assoc,void 0,o)}}function nl(n,e,t){for(;;){let r=0;for(let i of n)i.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=r||t||(e-s<o-e?-1:1);e=l<0?s:o,r=l}});if(!r)return e}}function _v(n,e){let t=null;for(let r=0;r<e.ranges.length;r++){let i=e.ranges[r],s=null;if(i.empty){let o=nl(n,i.from,0);o!=i.from&&(s=z.cursor(o,-1))}else{let o=nl(n,i.from,-1),a=nl(n,i.to,1);(o!=i.from||a!=i.to)&&(i.undirectional?s=z.undirectionalRange(i.from,i.to):s=z.range(i.from==i.anchor?o:a,i.from==i.head?o:a))}s&&(t||(t=e.ranges.slice()),t[r]=s)}return t?z.create(t,e.mainIndex):e}function wp(n,e,t){let r=nl(n.state.facet(ul).map(i=>i(n)),t.from,e.head>t.from?-1:1);return r==t.from?t:z.cursor(r,r<t.from?1:-1)}var Or=class{constructor(e,t){this.pos=e,this.assoc=t}};function jp(n,e,t,r){let i=n.contentDOM.getBoundingClientRect(),s=i.top+n.viewState.paddingTop,{x:o,y:a}=e,l=a-s,c;for(;;){if(l<0)return new Or(0,1);if(l>n.viewState.docHeight)return new Or(n.state.doc.length,-1);if(c=n.elementAtHeight(l),r==null)break;if(c.type==Ht.Text){if(r<0?c.to<n.viewport.from:c.from>n.viewport.to)break;let u=n.docView.coordsAt(r<0?c.from:c.to,r>0?-1:1);if(u&&(r<0?u.top<=l+s:u.bottom>=l+s))break}let h=n.viewState.heightOracle.textHeight/2;l=r>0?c.bottom+h:c.top-h}if(n.viewport.from>=c.to||n.viewport.to<=c.from){if(t)return null;if(c.type==Ht.Text){let h=V_(n,i,c,o,a);return new Or(h,h==c.from?1:-1)}}if(c.type!=Ht.Text)return l<(c.top+c.bottom)/2?new Or(c.from,1):new Or(c.to,-1);let d=n.docView.lineAt(c.from,2);return(!d||d.length!=c.length)&&(d=n.docView.lineAt(c.from,-2)),new Up(n,o,a,n.textDirectionAt(c.from)).scanTile(d,c.from)}var Up=class{constructor(e,t,r,i){this.view=e,this.x=t,this.y=r,this.baseDir=i,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:r,spans:i}=this.bidiSpansAt(e);return i[br.find(i,e-r.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:r,spans:i}=this.bidiSpansAt(e);return i[br.find(i,e-r.from,-1,t)].dir}bidiIn(e,t){let{spans:r,line:i}=this.bidiSpansAt(e);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+i.from<t)}scan(e,t,r=!1){let i=0,s=e.length-1,o=new Set,a=this.bidiIn(e[0],e[s]),l,c,d=-1,h=1e9,u;e:for(;i<s;){let m=s-i,O=i+s>>1;t:if(o.has(O)){for(let D=1;D<m;D++){let M=O+D;if(M>=s&&(M-=m),!o.has(M)){O=M;break t}}break e}o.add(O);let S=t(O),x=0;if(S)for(let D=0;D<S.length;D++){let M=S[D];if(!(M.width==0&&S.length>1))if(M.bottom<this.y)(!l||l.bottom<M.bottom)&&(l=M),x=1;else if(M.top>this.y)(!c||c.top>M.top)&&(c=M),x=-1;else{let Z=M.left>this.x?this.x-M.left:M.right<this.x?this.x-M.right:0,k=Math.abs(Z);k<h&&(d=O,h=k,u=M),Z&&(x=Z<0==(this.baseDir==qe.LTR)?-1:1)}}x==-1&&(!a||this.baseDirAt(e[O],1))?s=O:x==1&&(!a||this.baseDirAt(e[O+1],-1))&&(i=O+1)}if(!u){if(!c&&!l)return{i:0,after:!1};let m=l&&(!c||this.y-l.bottom<c.top-this.y)?l:c;return this.y=(m.top+m.bottom)/2,this.scan(e,t,!0)}if(h&&!r){let{top:m,bottom:O}=u;if(l&&l.bottom>(m+m+O)/3)return this.y=l.bottom-1,this.scan(e,t,!0);if(c&&c.top<(m+O+O)/3)return this.y=c.top+1,this.scan(e,t,!0)}let f=(a?this.dirAt(e[d],1):this.baseDir)==qe.LTR;return{i:d,after:this.x>(u.left+u.right)/2==f}}scanText(e,t){let r=[];for(let s=0;s<e.length;s=Pt(e.text,s))r.push(t+s);r.push(t+e.length);let i=this.scan(r,s=>{let o=r[s]-t,a=r[s+1]-t;return cl(e.dom,o,a).getClientRects()});return i.after?new Or(r[i.i+1],-1):new Or(r[i.i],1)}scanTile(e,t){if(!e.length)return new Or(t,1);if(e.children.length==1){let a=e.children[0];if(a.isText())return this.scanText(a,t);if(a.isComposite())return this.scanTile(a,t)}let r=[t];for(let a=0,l=t;a<e.children.length;a++)r.push(l+=e.children[a].length);let i=this.scan(r,a=>{let l=e.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:cl(l.dom,0,l.length)).getClientRects()}),s=e.children[i.i],o=r[i.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):i.after?new Or(r[i.i+1],-1):new Or(o,1)}},Ro="\uFFFF",qp=class{con
Line truncated
|
|
|
|
|
`&&n.lineWrapping&&(r&&(r=z.single(r.main.anchor-1,r.main.head-1)),t={from:s.from,to:s.to,insert:De.of([" "])}),t)return Cm(n,t,r,o);if(r&&!wd(r,s)){let a=!1,l="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(a=!0),l=n.inputState.lastSelectionOrigin,l=="select.pointer"&&(r=_v(i.facet(ul).map(c=>c(n)),r))),n.dispatch({selection:r,scrollIntoView:a,userEvent:l}),!0}else return!1}function Cm(n,e,t,r=-1){if(ae.ios&&n.inputState.flushIOSKey(e))return!0;let i=n.state.selection.main;if(ae.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&n.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Xo(n.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>i.head)&&Xo(n.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&Xo(n.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,a=()=>o||(o=G_(n,e,t));return n.state.facet(yv).some(l=>l(n,e.from,e.to,s,a))||n.dispatch(a()),!0}function G_(n,e,t){let r,i=n.state,s=i.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let l=e.from<s.from?-1:1,c=l<0?s.from:s.to,d=nl(i.facet(ul).map(h=>h(n)),c,l);e.from==d&&(o=d)}if(o>-1)r={changes:e,selection:z.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let l=s.from<e.from?i.sliceDoc(s.from,e.from):"",c=s.to>e.to?i.sliceDoc(e.to,s.to):"";r=i.replaceSelection(n.state.toText(l+e.insert.sliceString(0,void 0,n.state.lineBreak)+c))}else{let l=i.changes(e),c=t&&t.main.to<=l.newLength?t.main:void 0;if(i.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let d=n.state.sliceDoc(e.from,e.to),h,u=t&&Cv(n,t.main.head);if(u){let m=e.insert.length-(e.to-e.from);h={from:u.from,to:u.to-m}}else h=n.state.doc.lineAt(s.head);let f=s.to-e.to;r=i.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:l,range:c||m.map(l)};let O=m.to-f,S=O-d.length;if(n.state.sliceDoc(S,O)!=d||O>=h.from&&S<=h.to)return{range:m};let x=i.changes({from:S,to:O,insert:e.insert}),D=m.to-s.to;return{changes:x,range:c?z.range(Math.max(0,c.anchor+D),Math.max(0,c.head+D)):m.map(x)}})}else r={changes:l,selection:c&&i.selection.replaceRange(c)}}let a="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,a+=".compose",n.inputState.compositionFirstChange&&(a+=".start",n.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:a,scrollIntoView:!0})}function Mv(n,e,t,r){let i=Math.min(n.length,e.length),s=0;for(;s<i&&n.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&n.length==e.length)return null;let o=n.length,a=e.length;for(;o>0&&a>0&&n.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,s-Math.min(o,a));t-=o+l-s}if(o<s&&n.length<e.length){let l=t<=s&&t>=o?s-t:0;s-=l,a=s+(a-o),o=s}else if(a<s){let l=t<=s&&t>=a?s-t:0;s-=l,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function H_(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}=n.observer.selectionRange;return t&&(e.push(new vd(t,r)),(i!=t||s!=r)&&e.push(new vd(i,s))),e}function K_(n,e){if(n.length==0)return null;let t=n[0].pos,r=n.length==2?n[1].pos:t;return t>-1&&r>-1?z.single(t+e,r+e):null}function wd(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}var Hp=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,ae.safari&&e.contentDOM.addEventListener("input",()=>null),ae.gecko&&f2(e.contentDOM.ownerDocument)}handleEvent(e){!o2(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,t);for(let i of r.handlers){if(t.defaultPrevented)break;if(i(this.view,t)){t.preventDefault();break}}}}ensureHandl
Line truncated
|
|
|
|
|
`))};if((ae.mac||ae.android)&&h.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:a,to:l,insert:De.of([r.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let u=this.to-this.from+(h.to-h.from+h.insert.length);Cm(e,h,z.single(this.toEditorPos(r.selectionStart,u),this.toEditorPos(r.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),h.from<h.to&&!h.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(t.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let i=[],s=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let l=e.coordsForChar(o);s=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||s||new DOMRect,i.push(s)}t.updateCharacterBounds(r.rangeStart,i)},this.handlers.textformatupdate=r=>{let i=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,a=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(s.rangeStart),c=this.toEditorPos(s.rangeEnd);if(l<c){let d=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;i.push(K.mark({attributes:{style:d}}).range(l,c))}}}e.dispatch({effects:Pv.of(K.set(i))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)t.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{let i=ll(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,r=!1,i=this.pendingContextChange;return e.changes.iterChanges((s,o,a,l,c)=>{if(r)return;let d=c.length-(o-s);if(i&&o>=i.to)if(i.from==s&&i.to==o&&i.insert.eq(c)){i=this.pendingContextChange=null,t+=d,this.to+=d;return}else i=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=d,this.to+=d;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),c.toString()),this.to+=d}t+=d}),i&&!r&&this.revertPending(e.state),!r}update(e){let t=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},F=class n{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=d
Line truncated
|
|
|
|
|
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,pm),z2={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},Pp=null;function W2(){var n;if(Pp==null&&typeof document!="undefined"&&document.body){let e=document.body.style;Pp=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return Pp||!1}var ud=oe.define({combine(n){let e=Yn(n,{render:null,specialChars:X2,addSpecialChars:null});return(e.replaceTabs=!W2())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,pm)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,pm)),e}});function ew(n={}){return[ud.of(n),N2()]}var YS=null;function N2(){return YS||(YS=it.fromClass(class{constructor(n){this.view=n,this.decorations=K.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(ud)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new dl({regexp:n.specialChars,decoration:(e,t,r)=>{let{doc:i}=t.state,s=Ir(e[0],0);if(s==9){let o=i.lineAt(r),a=t.state.tabSize,l=Gt(o.text,a,r-o.from);return K.replace({widget:new gm((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=K.replace({widget:new mm(n,s)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(ud);n.startState.facet(ud)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}var B2="\u2022";function V2(n){return n>=32?B2:n==10?"\u2424":String.fromCharCode(9216+n)}var mm=class extends Ct{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=V2(this.code),r=e.state.phrase("Control character")+" "+(z2[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,t);if(i)return i;let s=document.createElement("span");return s.textContent=t,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}},gm=class extends Ct{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}};function Dd(){return Y2}var F2=K.line({class:"cm-activeLine"}),Y2=it.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let r of n.state.selection.ranges){let i=n.lineBlockAt(r.head);i.from>e&&(t.push(F2.range(i.from)),e=i.from)}return K.set(t)}},{decorations:n=>n.decorations});var Om=2e3;function j2(n,e,t){let r=Math.min(e.line,t.line),i=Math.max(e.line,t.line),s=[];if(e.off>Om||t.off>Om||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let l=r;l<=i;l++){let c=n.doc.line(l);c.length<=a&&s.push(z.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let l=r;l<=i;l++){let c=n.doc.line(l),d=Kc(c.text,o,n.tabSize,!0);if(d<0)s.push(z.cursor(c.to));else{let h=Kc(c.text,a,n.tabSize);s.push(z.range(c.from+d,c.from+h))}}}return s}function U2(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function jS(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),r=n.state.doc.lineAt(t),i=t-r.from,s=i>Om?-1:i==r.length?U2(n,e.clientX):Gt(r.text,n.state.tabSize,t-r.from);return{line:r.number,col:s,off:i}}function q2(n,e){let t=jS(n,e),r=n.state.selection;return t?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(t.line).from),o=i.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},r=r.map(i.changes)}},get(i,s,o){let a=jS(n,i);if(!a)return r;let l=j2(n.state,t,a);return l.length?o?z.create(l.concat(r.ranges)):z.create(l):r}}:null}function Zd(n){let e=(n==null?void 0:n.eventFilter)||(t=>t.altKey&&t.button==0);return F.mouseSelectionStyle.of((t,r)=>e(r)?q2(t,r):null)}var G2={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},H2={style:"cursor: crosshair"};function Id(n={}){let[e,t]=G2[n.key||"Alt"],r=it.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||t(i))},keyup(i){(i.keyCode==e||!t(i))&&this.set(!1)},mousemove(i){this.set(t(i))}}});retu
Line truncated
|
|
|
|
|
`;this.styleTag.textContent=o;let a=t.head||t;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var wi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Eo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},u_=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),f_=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(At=0;At<10;At++)wi[48+At]=wi[96+At]=String(At);var At;for(At=1;At<=24;At++)wi[At+111]="F"+At;var At;for(At=65;At<=90;At++)wi[At]=String.fromCharCode(At+32),Eo[At]=String.fromCharCode(At);var At;for(Jc in wi)Eo.hasOwnProperty(Jc)||(Eo[Jc]=wi[Jc]);var Jc;function pS(n){var e=u_&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||f_&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Eo:wi)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function kt(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var i=t[r];typeof i=="string"?n.setAttribute(r,i):i!=null&&(n[r]=i)}e++}for(;e<arguments.length;e++)mS(n,arguments[e]);return n}function mS(n,e){if(typeof e=="string")n.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)n.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)mS(n,e[t]);else throw new RangeError("Unsupported child node: "+e)}var bn=typeof navigator!="undefined"?navigator:{userAgent:"",vendor:"",platform:""},Tp=typeof document!="undefined"?document:{documentElement:{style:{}}},Ap=/Edge\/(\d+)/.exec(bn.userAgent),ev=/MSIE \d/.test(bn.userAgent),Cp=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(bn.userAgent),Ed=!!(ev||Cp||Ap),gS=!Ed&&/gecko\/(\d+)/i.test(bn.userAgent),yp=!Ed&&/Chrome\/(\d+)/.exec(bn.userAgent),OS="webkitFontSmoothing"in Tp.documentElement.style,_p=!Ed&&/Apple Computer/.test(bn.vendor),bS=_p&&(/Mobile\/\w+/.test(bn.userAgent)||bn.maxTouchPoints>2),ae={mac:bS||/Mac/.test(bn.platform),windows:/Win/.test(bn.platform),linux:/Linux|X11/.test(bn.platform),ie:Ed,ie_version:ev?Tp.documentMode||6:Cp?+Cp[1]:Ap?+Ap[1]:0,gecko:gS,gecko_version:gS?+(/Firefox\/(\d+)/.exec(bn.userAgent)||[0,0])[1]:0,chrome:!!yp,chrome_version:yp?+yp[1]:0,ios:bS,android:/Android\b/.test(bn.userAgent),webkit:OS,webkit_version:OS?+(/\bAppleWebKit\/(\d+)/.exec(bn.userAgent)||[0,0])[1]:0,safari:_p,safari_version:_p?+(/\bVersion\/(\d+(\.\d+)?)/.exec(bn.userAgent)||[0,0])[1]:0,tabSize:Tp.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function wm(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}var pd=Object.create(null);function xm(n,e,t){if(n==e)return!0;n||(n=pd),e||(e=pd);let r=Object.keys(n),i=Object.keys(e);if(r.length-(t&&r.indexOf(t)>-1?1:0)!=i.length-(t&&i.indexOf(t)>-1?1:0))return!1;for(let s of r)if(s!=t&&(i.indexOf(s)==-1||n[s]!==e[s]))return!1;return!0}function p_(n,e){for(let t=n.attributes.length-1;t>=0;t--){let r=n.attributes[t].name;e[r]==null&&n.removeAttribute(r)}for(let t in e){let r=e[t];t=="style"?n.style.cssText=r:n.getAttribute(t)!=r&&n.setAttribute(t,r)}}function yS(n,e,t){let r=!1;if(e)for(let i in e)t&&i in t||(r=!0,i=="style"?n.style.cssText="":n.removeAttribute(i));if(t)for(let i in t)e&&e[i]==t[i]||(r=!0,i=="style"?n.style.cssText=t[i]:n.setAttribute(i,t[i]));return r}function m_(n){let e=Object.create(null);for(let t=0;t<n.attributes.length;t++){let r=n.attributes[t];e[r.name]=r.value}return e}var Ct=class{eq(e){return!1}updateDOM(e,t,r){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},Ht=(function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n})(Ht||(Ht={})),K=class extends fr{constructor(e,t,r,i){super(),this.startSide=e,this.endLine truncated
|
|
|
|
|
`,i=n.state.doc.line(i.number+(t?1:-1)),s=n.bidiSpans(i),c=n.visualLineSide(i,!t)}if(l){if(!l(d))return a}else{if(!r)return c;l=r(d)}a=c}}function U_(n,e,t){let r=n.state.charCategorizer(e),i=r(t);return s=>{let o=r(s);return i==et.Space&&(i=o),i==o}}function q_(n,e,t,r){let i=e.head,s=t?1:-1;if(i==(t?n.state.doc.length:0))return z.cursor(i,e.assoc);let o=e.goalColumn,a,l=n.contentDOM.getBoundingClientRect(),c=n.coordsAtPos(i,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),d=n.documentTop;if(c)o==null&&(o=c.left-l.left),a=s<0?c.top:c.bottom;else{let m=n.viewState.lineBlockAt(i);o==null&&(o=Math.min(l.right-l.left,n.defaultCharacterWidth*(i-m.from))),a=(s<0?m.top:m.bottom)+d}let h=l.left+o,u=n.viewState.heightOracle.textHeight>>1,f=r!=null?r:u;for(let m=0;;m+=u){let O=a+(f+m)*s,S=jp(n,{x:h,y:O},!1,s);if(t?O>l.bottom:O<l.top)return z.cursor(S.pos,S.assoc);let x=n.coordsAtPos(S.pos,S.assoc),D=x?(x.top+x.bottom)/2:0;if(!x||(t?D>a:D<a))return z.cursor(S.pos,S.assoc,void 0,o)}}function nl(n,e,t){for(;;){let r=0;for(let i of n)i.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=r||t||(e-s<o-e?-1:1);e=l<0?s:o,r=l}});if(!r)return e}}function _v(n,e){let t=null;for(let r=0;r<e.ranges.length;r++){let i=e.ranges[r],s=null;if(i.empty){let o=nl(n,i.from,0);o!=i.from&&(s=z.cursor(o,-1))}else{let o=nl(n,i.from,-1),a=nl(n,i.to,1);(o!=i.from||a!=i.to)&&(i.undirectional?s=z.undirectionalRange(i.from,i.to):s=z.range(i.from==i.anchor?o:a,i.from==i.head?o:a))}s&&(t||(t=e.ranges.slice()),t[r]=s)}return t?z.create(t,e.mainIndex):e}function wp(n,e,t){let r=nl(n.state.facet(ul).map(i=>i(n)),t.from,e.head>t.from?-1:1);return r==t.from?t:z.cursor(r,r<t.from?1:-1)}var Or=class{constructor(e,t){this.pos=e,this.assoc=t}};function jp(n,e,t,r){let i=n.contentDOM.getBoundingClientRect(),s=i.top+n.viewState.paddingTop,{x:o,y:a}=e,l=a-s,c;for(;;){if(l<0)return new Or(0,1);if(l>n.viewState.docHeight)return new Or(n.state.doc.length,-1);if(c=n.elementAtHeight(l),r==null)break;if(c.type==Ht.Text){if(r<0?c.to<n.viewport.from:c.from>n.viewport.to)break;let u=n.docView.coordsAt(r<0?c.from:c.to,r>0?-1:1);if(u&&(r<0?u.top<=l+s:u.bottom>=l+s))break}let h=n.viewState.heightOracle.textHeight/2;l=r>0?c.bottom+h:c.top-h}if(n.viewport.from>=c.to||n.viewport.to<=c.from){if(t)return null;if(c.type==Ht.Text){let h=Y_(n,i,c,o,a);return new Or(h,h==c.from?1:-1)}}if(c.type!=Ht.Text)return l<(c.top+c.bottom)/2?new Or(c.from,1):new Or(c.to,-1);let d=n.docView.lineAt(c.from,2);return(!d||d.length!=c.length)&&(d=n.docView.lineAt(c.from,-2)),new Up(n,o,a,n.textDirectionAt(c.from)).scanTile(d,c.from)}var Up=class{constructor(e,t,r,i){this.view=e,this.x=t,this.y=r,this.baseDir=i,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:r,spans:i}=this.bidiSpansAt(e);return i[br.find(i,e-r.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:r,spans:i}=this.bidiSpansAt(e);return i[br.find(i,e-r.from,-1,t)].dir}bidiIn(e,t){let{spans:r,line:i}=this.bidiSpansAt(e);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+i.from<t)}scan(e,t,r=!1){let i=0,s=e.length-1,o=new Set,a=this.bidiIn(e[0],e[s]),l,c,d=-1,h=1e9,u;e:for(;i<s;){let m=s-i,O=i+s>>1;t:if(o.has(O)){for(let D=1;D<m;D++){let M=O+D;if(M>=s&&(M-=m),!o.has(M)){O=M;break t}}break e}o.add(O);let S=t(O),x=0;if(S)for(let D=0;D<S.length;D++){let M=S[D];if(!(M.width==0&&S.length>1))if(M.bottom<this.y)(!l||l.bottom<M.bottom)&&(l=M),x=1;else if(M.top>this.y)(!c||c.top>M.top)&&(c=M),x=-1;else{let Z=M.left>this.x?this.x-M.left:M.right<this.x?this.x-M.right:0,k=Math.abs(Z);k<h&&(d=O,h=k,u=M),Z&&(x=Z<0==(this.baseDir==qe.LTR)?-1:1)}}x==-1&&(!a||this.baseDirAt(e[O],1))?s=O:x==1&&(!a||this.baseDirAt(e[O+1],-1))&&(i=O+1)}if(!u){if(!c&&!l)return{i:0,after:!1};let m=l&&(!c||this.y-l.bottom<c.top-this.y)?l:c;return this.y=(m.top+m.bottom)/2,this.scan(e,t,!0)}if(h&&!r){let{top:m,bottom:O}=u;if(l&&l.bottom>(m+m+O)/3)return this.y=l.bottom-1,this.scan(e,t,!0);if(c&&c.top<(m+O+O)/3)return this.y=c.top+1,this.scan(e,t,!0)}let f=(a?this.dirAt(e[d],1):this.baseDir)==qe.LTR;return{i:d,after:this.x>(u.left+u.right)/2==f}}scanText(e,t){let r=[];for(let s=0;s<e.length;s=Pt(e.text,s))r.push(t+s);r.push(t+e.length);let i=this.scan(r,s=>{let o=r[s]-t,a=r[s+1]-t;return cl(e.dom,o,a).getClientRects()});return i.after?new Or(r[i.i+1],-1):new Or(r[i.i],1)}scanTile(e,t){if(!e.length)return new Or(t,1);if(e.children.length==1){let a=e.children[0];if(a.isText())return this.scanText(a,t);if(a.isComposite())return this.scanTile(a,t)}let r=[t];for(let a=0,l=t;a<e.children.length;a++)r.push(l+=e.children[a].length);let i=this.scan(r,a=>{let l=e.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:cl(l.dom,0,l.length)).getClientRects()}),s=e.children[i.i],o=r[i.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):i.after?new Or(r[i.i+1],-1):new Or(o,1)}},Ro="\uFFFF",qp=class{con
Line truncated
|
|
|
|
|
`&&n.lineWrapping&&(r&&(r=z.single(r.main.anchor-1,r.main.head-1)),t={from:s.from,to:s.to,insert:De.of([" "])}),t)return Cm(n,t,r,o);if(r&&!wd(r,s)){let a=!1,l="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(a=!0),l=n.inputState.lastSelectionOrigin,l=="select.pointer"&&(r=_v(i.facet(ul).map(c=>c(n)),r))),n.dispatch({selection:r,scrollIntoView:a,userEvent:l}),!0}else return!1}function Cm(n,e,t,r=-1){if(ae.ios&&n.inputState.flushIOSKey(e))return!0;let i=n.state.selection.main;if(ae.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&n.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Xo(n.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>i.head)&&Xo(n.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&Xo(n.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,a=()=>o||(o=K_(n,e,t));return n.state.facet(yv).some(l=>l(n,e.from,e.to,s,a))||n.dispatch(a()),!0}function K_(n,e,t){let r,i=n.state,s=i.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let l=e.from<s.from?-1:1,c=l<0?s.from:s.to,d=nl(i.facet(ul).map(h=>h(n)),c,l);e.from==d&&(o=d)}if(o>-1)r={changes:e,selection:z.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let l=s.from<e.from?i.sliceDoc(s.from,e.from):"",c=s.to>e.to?i.sliceDoc(e.to,s.to):"";r=i.replaceSelection(n.state.toText(l+e.insert.sliceString(0,void 0,n.state.lineBreak)+c))}else{let l=i.changes(e),c=t&&t.main.to<=l.newLength?t.main:void 0;if(i.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let d=n.state.sliceDoc(e.from,e.to),h,u=t&&Cv(n,t.main.head);if(u){let m=e.insert.length-(e.to-e.from);h={from:u.from,to:u.to-m}}else h=n.state.doc.lineAt(s.head);let f=s.to-e.to;r=i.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:l,range:c||m.map(l)};let O=m.to-f,S=O-d.length;if(n.state.sliceDoc(S,O)!=d||O>=h.from&&S<=h.to)return{range:m};let x=i.changes({from:S,to:O,insert:e.insert}),D=m.to-s.to;return{changes:x,range:c?z.range(Math.max(0,c.anchor+D),Math.max(0,c.head+D)):m.map(x)}})}else r={changes:l,selection:c&&i.selection.replaceRange(c)}}let a="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,a+=".compose",n.inputState.compositionFirstChange&&(a+=".start",n.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:a,scrollIntoView:!0})}function Mv(n,e,t,r){let i=Math.min(n.length,e.length),s=0;for(;s<i&&n.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&n.length==e.length)return null;let o=n.length,a=e.length;for(;o>0&&a>0&&n.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,s-Math.min(o,a));t-=o+l-s}if(o<s&&n.length<e.length){let l=t<=s&&t>=o?s-t:0;s-=l,a=s+(a-o),o=s}else if(a<s){let l=t<=s&&t>=a?s-t:0;s-=l,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function J_(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}=n.observer.selectionRange;return t&&(e.push(new vd(t,r)),(i!=t||s!=r)&&e.push(new vd(i,s))),e}function e2(n,e){if(n.length==0)return null;let t=n[0].pos,r=n.length==2?n[1].pos:t;return t>-1&&r>-1?z.single(t+e,r+e):null}function wd(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}var Hp=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,ae.safari&&e.contentDOM.addEventListener("input",()=>null),ae.gecko&&m2(e.contentDOM.ownerDocument)}handleEvent(e){!l2(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,t);for(let i of r.handlers){if(t.defaultPrevented)break;if(i(this.view,t)){t.preventDefault();break}}}}ensureHandl
Line truncated
|
|
|
|
|
`))};if((ae.mac||ae.android)&&h.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:a,to:l,insert:De.of([r.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let u=this.to-this.from+(h.to-h.from+h.insert.length);Cm(e,h,z.single(this.toEditorPos(r.selectionStart,u),this.toEditorPos(r.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),h.from<h.to&&!h.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(t.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let i=[],s=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let l=e.coordsForChar(o);s=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||s||new DOMRect,i.push(s)}t.updateCharacterBounds(r.rangeStart,i)},this.handlers.textformatupdate=r=>{let i=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,a=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(s.rangeStart),c=this.toEditorPos(s.rangeEnd);if(l<c){let d=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;i.push(K.mark({attributes:{style:d}}).range(l,c))}}}e.dispatch({effects:Pv.of(K.set(i))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)t.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{let i=ll(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,r=!1,i=this.pendingContextChange;return e.changes.iterChanges((s,o,a,l,c)=>{if(r)return;let d=c.length-(o-s);if(i&&o>=i.to)if(i.from==s&&i.to==o&&i.insert.eq(c)){i=this.pendingContextChange=null,t+=d,this.to+=d;return}else i=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=d,this.to+=d;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),c.toString()),this.to+=d}t+=d}),i&&!r&&this.revertPending(e.state),!r}update(e){let t=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},F=class n{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=d
Line truncated
|
|
|
|
|
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,pm),N2={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},Pp=null;function B2(){var n;if(Pp==null&&typeof document!="undefined"&&document.body){let e=document.body.style;Pp=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return Pp||!1}var ud=oe.define({combine(n){let e=Yn(n,{render:null,specialChars:W2,addSpecialChars:null});return(e.replaceTabs=!B2())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,pm)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,pm)),e}});function ew(n={}){return[ud.of(n),V2()]}var YS=null;function V2(){return YS||(YS=it.fromClass(class{constructor(n){this.view=n,this.decorations=K.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(ud)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new dl({regexp:n.specialChars,decoration:(e,t,r)=>{let{doc:i}=t.state,s=Ir(e[0],0);if(s==9){let o=i.lineAt(r),a=t.state.tabSize,l=Gt(o.text,a,r-o.from);return K.replace({widget:new gm((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=K.replace({widget:new mm(n,s)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(ud);n.startState.facet(ud)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}var F2="\u2022";function Y2(n){return n>=32?F2:n==10?"\u2424":String.fromCharCode(9216+n)}var mm=class extends Ct{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=Y2(this.code),r=e.state.phrase("Control character")+" "+(N2[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,t);if(i)return i;let s=document.createElement("span");return s.textContent=t,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}},gm=class extends Ct{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}};function Dd(){return U2}var j2=K.line({class:"cm-activeLine"}),U2=it.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let r of n.state.selection.ranges){let i=n.lineBlockAt(r.head);i.from>e&&(t.push(j2.range(i.from)),e=i.from)}return K.set(t)}},{decorations:n=>n.decorations});var Om=2e3;function q2(n,e,t){let r=Math.min(e.line,t.line),i=Math.max(e.line,t.line),s=[];if(e.off>Om||t.off>Om||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let l=r;l<=i;l++){let c=n.doc.line(l);c.length<=a&&s.push(z.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let l=r;l<=i;l++){let c=n.doc.line(l),d=Kc(c.text,o,n.tabSize,!0);if(d<0)s.push(z.cursor(c.to));else{let h=Kc(c.text,a,n.tabSize);s.push(z.range(c.from+d,c.from+h))}}}return s}function G2(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function jS(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),r=n.state.doc.lineAt(t),i=t-r.from,s=i>Om?-1:i==r.length?G2(n,e.clientX):Gt(r.text,n.state.tabSize,t-r.from);return{line:r.number,col:s,off:i}}function H2(n,e){let t=jS(n,e),r=n.state.selection;return t?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(t.line).from),o=i.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},r=r.map(i.changes)}},get(i,s,o){let a=jS(n,i);if(!a)return r;let l=q2(n.state,t,a);return l.length?o?z.create(l.concat(r.ranges)):z.create(l):r}}:null}function Zd(n){let e=(n==null?void 0:n.eventFilter)||(t=>t.altKey&&t.button==0);return F.mouseSelectionStyle.of((t,r)=>e(r)?H2(t,r):null)}var K2={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},J2={style:"cursor: crosshair"};function Id(n={}){let[e,t]=K2[n.key||"Alt"],r=it.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||t(i))},keyup(i){(i.keyCode==e||!t(i))&&this.set(!1)},mousemove(i){this.set(t(i))}}});retu
Line truncated
|
|
|
|
|
`&&(t="");else{let r=t.indexOf(`
|
|
|
|
|
`);r>-1&&(t=t.slice(0,r))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),r=e+t.length;for(let i=this.rangeIndex;;){let s=this.ranges[i].to;if(s>=r||(t=t.slice(0,s-(r-t.length)),i++,i==this.ranges.length))break;let o=this.ranges[i].from,a=this.lineAfter(o);t+=a,r=o+a.length}return{line:t,end:r}}skipGapsTo(e,t,r){for(;;){let i=this.ranges[this.rangeIndex].to,s=e+t;if(r>0?i>s:i>=s)break;let o=this.ranges[++this.rangeIndex].from;t+=o-i}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,r,i){let s=4;if(this.ranges.length>1){i=this.skipGapsTo(t,i,1),t+=i;let a=this.chunk.length;i=this.skipGapsTo(r,i,-1),r+=i,s+=this.chunk.length-a}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=r:this.chunk.push(e,t,r,s),i}parseLine(e){let{line:t,end:r}=this.nextLine(),i=0,{streamParser:s}=this.lang,o=new Hd(t,e?e.state.tabSize:4,e?ii(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let a=Gw(s.token,o,this.state);if(a&&(i=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,i)),o.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=Ee.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:sR,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new Ee(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new Ee(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function Gw(n,e,t){e.start=e.pos;for(let r=0;r<10;r++){let i=n(e,t);if(e.pos>e.start)return i}throw new Error("Stream parser failed to advance stream.")}var pg=Object.create(null),yl=[St.none],sR=new $i(yl),Rw=[],Mw=Object.create(null),Hw=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Hw[n]=Kw(pg,e);var Kd=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Hw)}resolve(e){return e?this.table[e]||(this.table[e]=Kw(this.extra,e)):0}},oR=new Kd(pg);function Km(n,e){Rw.indexOf(n)>-1||(Rw.push(n),console.warn(e))}function Kw(n,e){let t=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let d=n[c]||g[c];d?typeof d=="function"?l.length?l=l.map(d):Km(c,`Modifier ${c} used at start of tag`):l.length?Km(c,`Tag ${c} used as modifier`):l=Array.isArray(d)?d:[d]:Km(c,`Unknown highlighting tag ${c}`)}for(let c of l)t.push(c)}if(!t.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+t.map(a=>a.id),s=Mw[i];if(s)return s.id;let o=Mw[i]=St.define({id:yl.length,name:r,props:[Kt({[r]:t})]});return yl.push(o),o.id}function aR(n,e){let t=St.define({id:yl.length,name:"Document",props:[Ai.add(()=>n),En.add(()=>r=>e.getIndent(r))],top:!0});return yl.push(t),t}var MN={rtl:K.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:qe.RTL}),ltr:K.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:qe.LTR}),auto:K.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};var nh=class{constructor(e,t,r,i){this.state=e,this.pos=t,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=ze(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),r=Math.max(t.from,this.pos-250),i=t.text.slice(r-t.from,this.pos-t.from),s=i.search(cR(e,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),r&&r.onDocChange&&(this.abortOnDocChange=!0))}};function Jw(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function lR(n){let e=Object.create(null),t=Object.create(null);for(let{label:i}of n){e[i[0]]=!0;for(let s=1;s<i.length;s++)t[i[s]]=!0}let r=Jw(e)+Jw(t)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function rx(n){let e=n.map(i=>typeof i=="string"?{label:i}:i),[t,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:lR(e);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:t}:null}}function ix(n,e){return t=>{for(let r=ze(t.state).resolve
Line truncated
|
|
|
|
|
`);r>-1&&(t=t.slice(0,r))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),r=e+t.length;for(let i=this.rangeIndex;;){let s=this.ranges[i].to;if(s>=r||(t=t.slice(0,s-(r-t.length)),i++,i==this.ranges.length))break;let o=this.ranges[i].from,a=this.lineAfter(o);t+=a,r=o+a.length}return{line:t,end:r}}skipGapsTo(e,t,r){for(;;){let i=this.ranges[this.rangeIndex].to,s=e+t;if(r>0?i>s:i>=s)break;let o=this.ranges[++this.rangeIndex].from;t+=o-i}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,r,i){let s=4;if(this.ranges.length>1){i=this.skipGapsTo(t,i,1),t+=i;let a=this.chunk.length;i=this.skipGapsTo(r,i,-1),r+=i,s+=this.chunk.length-a}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=r:this.chunk.push(e,t,r,s),i}parseLine(e){let{line:t,end:r}=this.nextLine(),i=0,{streamParser:s}=this.lang,o=new Hd(t,e?e.state.tabSize:4,e?ii(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let a=Gw(s.token,o,this.state);if(a&&(i=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,i)),o.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=Ee.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:aR,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new Ee(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new Ee(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function Gw(n,e,t){e.start=e.pos;for(let r=0;r<10;r++){let i=n(e,t);if(e.pos>e.start)return i}throw new Error("Stream parser failed to advance stream.")}var pg=Object.create(null),yl=[St.none],aR=new $i(yl),Rw=[],Mw=Object.create(null),Hw=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Hw[n]=Kw(pg,e);var Kd=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Hw)}resolve(e){return e?this.table[e]||(this.table[e]=Kw(this.extra,e)):0}},lR=new Kd(pg);function Km(n,e){Rw.indexOf(n)>-1||(Rw.push(n),console.warn(e))}function Kw(n,e){let t=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let d=n[c]||g[c];d?typeof d=="function"?l.length?l=l.map(d):Km(c,`Modifier ${c} used at start of tag`):l.length?Km(c,`Tag ${c} used as modifier`):l=Array.isArray(d)?d:[d]:Km(c,`Unknown highlighting tag ${c}`)}for(let c of l)t.push(c)}if(!t.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+t.map(a=>a.id),s=Mw[i];if(s)return s.id;let o=Mw[i]=St.define({id:yl.length,name:r,props:[Kt({[r]:t})]});return yl.push(o),o.id}function cR(n,e){let t=St.define({id:yl.length,name:"Document",props:[Ai.add(()=>n),En.add(()=>r=>e.getIndent(r))],top:!0});return yl.push(t),t}var DN={rtl:K.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:qe.RTL}),ltr:K.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:qe.LTR}),auto:K.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};var nh=class{constructor(e,t,r,i){this.state=e,this.pos=t,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=ze(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),r=Math.max(t.from,this.pos-250),i=t.text.slice(r-t.from,this.pos-t.from),s=i.search(hR(e,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),r&&r.onDocChange&&(this.abortOnDocChange=!0))}};function Jw(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function dR(n){let e=Object.create(null),t=Object.create(null);for(let{label:i}of n){e[i[0]]=!0;for(let s=1;s<i.length;s++)t[i[s]]=!0}let r=Jw(e)+Jw(t)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function rx(n){let e=n.map(i=>typeof i=="string"?{label:i}:i),[t,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:dR(e);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:t}:null}}function ix(n,e){return t=>{for(let r=ze(t.state).resolve
Line truncated
|
|
|
|
|
`;let o=n.state.facet(ri),a=o instanceof Jt?"Lezer LRLanguage":o instanceof zt?"StreamLanguage":"Unknown",l=o instanceof Jt?"AST ":o instanceof zt?"Token ":"Name ";return{pos:e,above:!0,arrow:!0,create(c){let d=document.createElement("div");d.style.overflow="visible",d.style.height="0",d.style.width="0";let h=document.createElement("div");return h.className="cm-debug-tooltip",h.textContent=`Parser: ${a}
|
|
|
|
|
${l}: ${r.name}
|
|
|
|
|
Tags : ${s}`,h.style.whiteSpace="pre-wrap",h.style.fontFamily="monospace",h.style.background="#333",h.style.color="white",h.style.padding="2px 8px",h.style.borderRadius="4px",h.style.fontSize="12px",h.style.border="1px solid #555",h.style.pointerEvents="none",h.style.position="absolute",h.style.bottom="0",h.style.width="max-content",d.appendChild(h),{dom:d}}}},{hoverTime:10,hideOnChange:!0});var CR=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),r=$g(n.state,t.from);return r.line?_R(n):r.block?RR(n):!1};function kg(n,e){return({state:t,dispatch:r})=>{if(t.readOnly)return!1;let i=n(e,t);return i?(r(t.update(i)),!0):!1}}var _R=kg(DR,0);var ER=kg(vx,0);var RR=kg((n,e)=>vx(n,e,LR(e)),0);function $g(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}var xl=50;function MR(n,{open:e,close:t},r,i){let s=n.sliceDoc(r-xl,r),o=n.sliceDoc(i,i+xl),a=/\s*$/.exec(s)[0].length,l=/^\s*/.exec(o)[0].length,c=s.length-a;if(s.slice(c-e.length,c)==e&&o.slice(l,l+t.length)==t)return{open:{pos:r-a,margin:a&&1},close:{pos:i+l,margin:l&&1}};let d,h;i-r<=2*xl?d=h=n.sliceDoc(r,i):(d=n.sliceDoc(r,r+xl),h=n.sliceDoc(i-xl,i));let u=/^\s*/.exec(d)[0].length,f=/\s*$/.exec(h)[0].length,m=h.length-f-t.length;return d.slice(u,u+e.length)==e&&h.slice(m,m+t.length)==t?{open:{pos:r+u+e.length,margin:/\s/.test(d.charAt(u+e.length))?1:0},close:{pos:i-f-t.length,margin:/\s/.test(h.charAt(m-1))?1:0}}:null}function LR(n){let e=[];for(let t of n.selection.ranges){let r=n.doc.lineAt(t.from),i=t.to<=r.to?r:n.doc.lineAt(t.to);i.from>r.from&&i.from==t.to&&(i=t.to==r.to+1?r:n.doc.lineAt(t.to-1));let s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function vx(n,e,t=e.selection.ranges){let r=t.map(s=>$g(e,s.from).block);if(!r.every(s=>s))return null;let i=t.map((s,o)=>MR(e,r[o],s.from,s.to));if(n!=2&&!i.every(s=>s))return{changes:e.changes(t.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(n!=1&&i.some(s=>s)){let s=[];for(let o=0,a;o<i.length;o++)if(a=i[o]){let l=r[o],{open:c,close:d}=a;s.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:d.pos-d.margin,to:d.pos+l.close.length})}return{changes:s}}return null}function DR(n,e,t=e.selection.ranges){let r=[],i=-1;e:for(let{from:s,to:o}of t){let a=r.length,l=1e9,c;for(let d=s;d<=o;){let h=e.doc.lineAt(d);if(c==null&&(c=$g(e,h.from).line,!c))continue e;if(h.from>i&&(s==o||o>h.from)){i=h.from;let u=/^\s*/.exec(h.text)[0].length,f=u==h.length,m=h.text.slice(u,u+c.length)==c?u:-1;u<h.text.length&&u<l&&(l=u),r.push({line:h,comment:m,token:c,indent:u,empty:f,single:!1})}d=h.to+1}if(l<1e9)for(let d=a;d<r.length;d++)r[d].indent<r[d].line.text.length&&(r[d].indent=l);r.length==a+1&&(r[a].single=!0)}if(n!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:l,indent:c,empty:d,single:h}of r)(h||!d)&&s.push({from:a.from+c,insert:l+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let c=o.from+a,d=c+l.length;o.text[d-o.from]==" "&&d++,s.push({from:c,to:d})}return{changes:s}}return null}var wg=Tn.define(),oh=Tn.define(),ZR=oe.define(),wx=oe.define({combine(n){return Yn(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(r,i)=>e(r,i)||t(r,i)})}}),xx=Xe.define({create(){return Hs.empty},update(n,e){let t=e.state.facet(wx),r=e.annotation(wg);if(r){let l=Br.fromTransaction(e,r.selection),c=r.side,d=c==0?n.undone:n.done;return l?d=sh(d,d.length,t.minDepth,l):d=$x(d,e.startState.selection),new Hs(c==0?r.rest:d,c==0?d:r.rest)}let i=e.annotation(oh);if((i=="full"||i=="before")&&(n=n.isolate()),e.annotation(ut.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let s=Br.fromTransaction(e),o=e.annotation(ut.time),a=e.annotation(ut.userEvent);return s?n=n.addChanges(s,o,a,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(i=="full"||i=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new Hs(n.done.map(Br.fromJSON),n.undone.map(Br.fromJSON))}});function Px(n={}){return[xx,wx.of(n),F.domEventHandlers({beforeinput(e,t){let r=e.inputType=="historyUndo"?Pl:e.inputType=="historyRedo"?Ko:null;return r?(e.preventDefault(),r(t)):!1}})]}function ah(n,e){return function({state:t,dispatch:r}){if(!e&&t.readOnly)return!1;let i=t.field(xx,!1);if(!i)return!1;let s=i.pop(n,t,e);return s?(r(s),!0):!1}}var Pl=ah(0,!1),Ko=ah(1,!1),IR=ah(0,!0),XR=ah(1,!0);var Br=class n{constructor(e,t,r,i,s){this.changes=e,this.effects=t,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new n(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this
Line truncated
|
|
|
|
|
`,2e3)){if(!a.trim())continue;if(a[0]==" "){t++;continue}let l=a.length-a.trimStart().length;l>0&&r++;let c=l-i;c>=2&&c<=8&&e.set(c,(e.get(c)||0)+1),i=l}if(t>r)return" ";let s=2,o=0;for(let[a,l]of e)(l>o||l==o&&a<s)&&(s=a,o=l);return" ".repeat(s)}function IM(n){let e=n.state;return e.selection.ranges.some(t=>!t.empty)?hh(n):(n.dispatch(e.changeByRange(t=>{let r=ZM(e,t.head);return{changes:{from:t.head,insert:r},range:z.cursor(t.head+r.length)}}),{scrollIntoView:!0,userEvent:"input"}),!0)}function XM(n){for(let e=1;e<=n.doc.lines;e++)if(/^\d\d/.test(n.doc.line(e).text))return!0;return!1}var r1=[{key:"Enter",run:n=>XM(n.state)&&Kx(n)}],i1=[{key:"Tab",run:IM},{key:"Shift-Tab",run:uh}],s1=[{key:"Tab",run:e1},{key:"Shift-Tab",run:uh}],$l=50,fh=8,zM=!0;function ea(n){zM&&console.log("[asm-tab] "+n)}function ta(n,e){let t=0;for(let r=0;r<e;r++)t=n.charCodeAt(r)==9?(Math.floor(t/fh)+1)*fh:t+1;return t}function Ag(n,e){n>0&&e.set(n,(e.get(n)||0)+1)}function WM(n,e){let t=[],r=/\S+/g,i;for(;(i=r.exec(n))!==null&&n[i.index]!=";";)t.push(ta(n,i.index));let s=/(^|\s);/.exec(n);s&&Ag(ta(n,s.index+s[1].length),e);let o=t.length&&t[0]==0?t.slice(1):t;o.length>=1&&Ag(o[0],e),o.length>=2&&Ag(o[1],e)}var NM=3;function o1(n,e){let t=n.doc.lineAt(e),r=n.doc.lines,i=(a,l,c,d)=>{let h=0;for(let u=a;u!=l&&h<$l;u+=c){let f=n.doc.line(u);f.text.trim()&&(WM(f.text,d),h++)}return h},s=new Map;return i(t.number+1,Math.min(r,t.number+$l)+1,1,s)<NM&&i(t.number-1,Math.max(1,t.number-$l)-1,-1,s),s}function BM(n,e,t){let r=-1,i=0;for(let[s,o]of n)s>e&&(o>i||o==i&&s<r)&&(r=s,i=o);return r>=0?r:(Math.floor(e/t)+1)*t}function VM(n,e,t){let r=-1,i=0;for(let[s,o]of n)s<e&&(o>i||o==i&&s>r)&&(r=s,i=o);return r>=0?r:Math.max(0,Math.min(Math.floor((e-1)/t)*t,e-1))}function a1(n,e){let t=n.doc.lineAt(e),r=Math.max(1,t.number-$l),i=Math.min(n.doc.lines,t.number+$l);for(let s=r;s<=i;s++)if(n.doc.line(s).text.includes(" "))return!0;return!1}function l1(n){return"["+[...n.entries()].sort((e,t)=>e[0]-t[0]).map(([e,t])=>`${e}:${t}`).join(" ")+"]"}function FM(n,e){let t=n.doc.lineAt(e),r=ta(t.text,e-t.from),i=a1(n,e),s=i?fh:n.tabSize,o=o1(n,e),a=BM(o,r,s);return ea(`Tab @ line ${t.number} col ${r}: stops(col:freq)=${l1(o)} ${i?"grid=8 (file has tabs)":`grid=${n.tabSize}`} -> target=${a} | line=${JSON.stringify(t.text.slice(0,r))}+CURSOR`),a<=r?null:{from:e,insert:" ".repeat(a-r)}}function YM(n,e){let t=n.doc.lineAt(e),r=e-t.from;if(r==0)return ea(`Backspace @ line ${t.number} col 0: start of line, using default`),null;if(t.text[r-1]==" ")return ea(`Backspace @ line ${t.number} col ${ta(t.text,r)}: deleting one tab char`),{from:e-1,to:e};if(!/^[ \t]+$/.test(t.text.slice(0,r)))return ea(`Backspace @ line ${t.number} col ${ta(t.text,r)}: cursor not in leading whitespace, using default`),null;let i=a1(n,e),s=i?fh:n.tabSize,o=ta(t.text,r),a=o1(n,e),l=VM(a,o,s);if(l>=o)return ea(`Backspace @ line ${t.number} col ${o}: no stop before cursor, using default`),null;let c=e-(o-l);return ea(`Backspace @ line ${t.number} col ${o}: stops(col:freq)=${l1(a)} ${i?"grid=8 (file has tabs)":`grid=${n.tabSize}`} -> deleting cols ${l}..${o} | line=${JSON.stringify(t.text.slice(0,r))}+CURSOR`),{from:c,to:e}}function jM(n){let e=n.state;if(e.selection.ranges.some(r=>!r.empty))return!1;let t=e.changeByRange(r=>{let i=FM(e,r.head);return i?{changes:i,range:z.cursor(r.head+i.insert.length)}:{range:r}});return n.dispatch(t),!0}function UM(n){let e=n.state,t=e.selection.main;if(!t.empty)return!1;let r=YM(e,t.head);return r?(n.dispatch(e.update({changes:r,selection:z.cursor(r.from)})),!0):!1}function c1(n){return[{key:"Tab",run:e=>n()&&jM(e)},{key:"Backspace",run:e=>n()&&UM(e)}]}var qM=new Vt,GM=new Vt,HM=new Vt,KM=new Vt,JM=new Vt,eL=new Vt,tL=new Vt,nL=new Vt,h1="8bitworkshop/editorSettings",d1={tabSize:8,tabsToSpaces:!0,highlightSpecialChars:!1,highlightWhitespace:!1,highlightTrailingWhitespace:!1,closeBrackets:!1,debugHighlightTags:!1,showLineNumbers:!1,showStatusBar:!0};function na(){try{var n=localStorage.getItem(h1);if(n)return Ue(Ue({},d1),JSON.parse(n))}catch(e){}return Ue({},d1)}function rL(n){localStorage.setItem(h1,JSON.stringify(n))}var u1=[[KM,n=>[Me.tabSize.of(n.tabSize),yr.of(" ".repeat(n.tabSize))]],[eL,n=>Sn.of(n.tabsToSpaces?i1:s1)],[qM,n=>n.highlightSpecialChars?ew():[]],[GM,n=>n.highlightWhitespace?dw():[]],[HM,n=>n.highlightTrailingWhitespace?hw():[]],[JM,n=>n.closeBrackets?[ax(),Sn.of([{key:"Backspace",run:dx}])]:[]],[tL,n=>n.debugHighlightTags?ux:[]],[nL,n=>n.showLineNumbers?Xd():[]]];function f1(n){return u1.map(([e,t])=>e.of(t(n)))}var p1=new Set;function m1(n){p1.add(n)}function iL(n){var e=u1.map(([r,i])=>r.reconfigure(i(n)));for(var t of p1)t.dispatch({effects:e})}function g1(){var n=na(),e=!wo();bootbox.dialog({onEscape:!0,title:"Settings",message:`<form id="settingsForm" onsubmit="return false">
|
|
|
|
|
Tags : ${s}`,h.style.whiteSpace="pre-wrap",h.style.fontFamily="monospace",h.style.background="#333",h.style.color="white",h.style.padding="2px 8px",h.style.borderRadius="4px",h.style.fontSize="12px",h.style.border="1px solid #555",h.style.pointerEvents="none",h.style.position="absolute",h.style.bottom="0",h.style.width="max-content",d.appendChild(h),{dom:d}}}},{hoverTime:10,hideOnChange:!0});var ER=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),r=$g(n.state,t.from);return r.line?RR(n):r.block?LR(n):!1};function kg(n,e){return({state:t,dispatch:r})=>{if(t.readOnly)return!1;let i=n(e,t);return i?(r(t.update(i)),!0):!1}}var RR=kg(IR,0);var MR=kg(vx,0);var LR=kg((n,e)=>vx(n,e,ZR(e)),0);function $g(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}var xl=50;function DR(n,{open:e,close:t},r,i){let s=n.sliceDoc(r-xl,r),o=n.sliceDoc(i,i+xl),a=/\s*$/.exec(s)[0].length,l=/^\s*/.exec(o)[0].length,c=s.length-a;if(s.slice(c-e.length,c)==e&&o.slice(l,l+t.length)==t)return{open:{pos:r-a,margin:a&&1},close:{pos:i+l,margin:l&&1}};let d,h;i-r<=2*xl?d=h=n.sliceDoc(r,i):(d=n.sliceDoc(r,r+xl),h=n.sliceDoc(i-xl,i));let u=/^\s*/.exec(d)[0].length,f=/\s*$/.exec(h)[0].length,m=h.length-f-t.length;return d.slice(u,u+e.length)==e&&h.slice(m,m+t.length)==t?{open:{pos:r+u+e.length,margin:/\s/.test(d.charAt(u+e.length))?1:0},close:{pos:i-f-t.length,margin:/\s/.test(h.charAt(m-1))?1:0}}:null}function ZR(n){let e=[];for(let t of n.selection.ranges){let r=n.doc.lineAt(t.from),i=t.to<=r.to?r:n.doc.lineAt(t.to);i.from>r.from&&i.from==t.to&&(i=t.to==r.to+1?r:n.doc.lineAt(t.to-1));let s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function vx(n,e,t=e.selection.ranges){let r=t.map(s=>$g(e,s.from).block);if(!r.every(s=>s))return null;let i=t.map((s,o)=>DR(e,r[o],s.from,s.to));if(n!=2&&!i.every(s=>s))return{changes:e.changes(t.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(n!=1&&i.some(s=>s)){let s=[];for(let o=0,a;o<i.length;o++)if(a=i[o]){let l=r[o],{open:c,close:d}=a;s.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:d.pos-d.margin,to:d.pos+l.close.length})}return{changes:s}}return null}function IR(n,e,t=e.selection.ranges){let r=[],i=-1;e:for(let{from:s,to:o}of t){let a=r.length,l=1e9,c;for(let d=s;d<=o;){let h=e.doc.lineAt(d);if(c==null&&(c=$g(e,h.from).line,!c))continue e;if(h.from>i&&(s==o||o>h.from)){i=h.from;let u=/^\s*/.exec(h.text)[0].length,f=u==h.length,m=h.text.slice(u,u+c.length)==c?u:-1;u<h.text.length&&u<l&&(l=u),r.push({line:h,comment:m,token:c,indent:u,empty:f,single:!1})}d=h.to+1}if(l<1e9)for(let d=a;d<r.length;d++)r[d].indent<r[d].line.text.length&&(r[d].indent=l);r.length==a+1&&(r[a].single=!0)}if(n!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:l,indent:c,empty:d,single:h}of r)(h||!d)&&s.push({from:a.from+c,insert:l+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let c=o.from+a,d=c+l.length;o.text[d-o.from]==" "&&d++,s.push({from:c,to:d})}return{changes:s}}return null}var wg=Tn.define(),oh=Tn.define(),XR=oe.define(),wx=oe.define({combine(n){return Yn(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(r,i)=>e(r,i)||t(r,i)})}}),xx=Xe.define({create(){return Hs.empty},update(n,e){let t=e.state.facet(wx),r=e.annotation(wg);if(r){let l=Br.fromTransaction(e,r.selection),c=r.side,d=c==0?n.undone:n.done;return l?d=sh(d,d.length,t.minDepth,l):d=$x(d,e.startState.selection),new Hs(c==0?r.rest:d,c==0?d:r.rest)}let i=e.annotation(oh);if((i=="full"||i=="before")&&(n=n.isolate()),e.annotation(ut.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let s=Br.fromTransaction(e),o=e.annotation(ut.time),a=e.annotation(ut.userEvent);return s?n=n.addChanges(s,o,a,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(i=="full"||i=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new Hs(n.done.map(Br.fromJSON),n.undone.map(Br.fromJSON))}});function Px(n={}){return[xx,wx.of(n),F.domEventHandlers({beforeinput(e,t){let r=e.inputType=="historyUndo"?Pl:e.inputType=="historyRedo"?Ko:null;return r?(e.preventDefault(),r(t)):!1}})]}function ah(n,e){return function({state:t,dispatch:r}){if(!e&&t.readOnly)return!1;let i=t.field(xx,!1);if(!i)return!1;let s=i.pop(n,t,e);return s?(r(s),!0):!1}}var Pl=ah(0,!1),Ko=ah(1,!1),zR=ah(0,!0),WR=ah(1,!0);var Br=class n{constructor(e,t,r,i,s){this.changes=e,this.effects=t,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new n(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this
Line truncated
|
|
|
|
|
`,2e3)){if(!a.trim())continue;if(a[0]==" "){t++;continue}let l=a.length-a.trimStart().length;l>0&&r++;let c=l-i;c>=2&&c<=8&&e.set(c,(e.get(c)||0)+1),i=l}if(t>r)return" ";let s=2,o=0;for(let[a,l]of e)(l>o||l==o&&a<s)&&(s=a,o=l);return" ".repeat(s)}function zM(n){let e=n.state;return e.selection.ranges.some(t=>!t.empty)?hh(n):(n.dispatch(e.changeByRange(t=>{let r=XM(e,t.head);return{changes:{from:t.head,insert:r},range:z.cursor(t.head+r.length)}}),{scrollIntoView:!0,userEvent:"input"}),!0)}function WM(n){for(let e=1;e<=n.doc.lines;e++)if(/^\d\d/.test(n.doc.line(e).text))return!0;return!1}var r1=[{key:"Enter",run:n=>WM(n.state)&&Kx(n)}],i1=[{key:"Tab",run:zM},{key:"Shift-Tab",run:uh}],s1=[{key:"Tab",run:e1},{key:"Shift-Tab",run:uh}],$l=50,fh=8,NM=!0;function ea(n){NM&&console.log("[asm-tab] "+n)}function ta(n,e){let t=0;for(let r=0;r<e;r++)t=n.charCodeAt(r)==9?(Math.floor(t/fh)+1)*fh:t+1;return t}function Ag(n,e){n>0&&e.set(n,(e.get(n)||0)+1)}function BM(n,e){let t=[],r=/\S+/g,i;for(;(i=r.exec(n))!==null&&n[i.index]!=";";)t.push(ta(n,i.index));let s=/(^|\s);/.exec(n);s&&Ag(ta(n,s.index+s[1].length),e);let o=t.length&&t[0]==0?t.slice(1):t;o.length>=1&&Ag(o[0],e),o.length>=2&&Ag(o[1],e)}var VM=3;function o1(n,e){let t=n.doc.lineAt(e),r=n.doc.lines,i=(a,l,c,d)=>{let h=0;for(let u=a;u!=l&&h<$l;u+=c){let f=n.doc.line(u);f.text.trim()&&(BM(f.text,d),h++)}return h},s=new Map;return i(t.number+1,Math.min(r,t.number+$l)+1,1,s)<VM&&i(t.number-1,Math.max(1,t.number-$l)-1,-1,s),s}function FM(n,e,t){let r=-1,i=0;for(let[s,o]of n)s>e&&(o>i||o==i&&s<r)&&(r=s,i=o);return r>=0?r:(Math.floor(e/t)+1)*t}function YM(n,e,t){let r=-1,i=0;for(let[s,o]of n)s<e&&(o>i||o==i&&s>r)&&(r=s,i=o);return r>=0?r:Math.max(0,Math.min(Math.floor((e-1)/t)*t,e-1))}function a1(n,e){let t=n.doc.lineAt(e),r=Math.max(1,t.number-$l),i=Math.min(n.doc.lines,t.number+$l);for(let s=r;s<=i;s++)if(n.doc.line(s).text.includes(" "))return!0;return!1}function l1(n){return"["+[...n.entries()].sort((e,t)=>e[0]-t[0]).map(([e,t])=>`${e}:${t}`).join(" ")+"]"}function jM(n,e){let t=n.doc.lineAt(e),r=ta(t.text,e-t.from),i=a1(n,e),s=i?fh:n.tabSize,o=o1(n,e),a=FM(o,r,s);return ea(`Tab @ line ${t.number} col ${r}: stops(col:freq)=${l1(o)} ${i?"grid=8 (file has tabs)":`grid=${n.tabSize}`} -> target=${a} | line=${JSON.stringify(t.text.slice(0,r))}+CURSOR`),a<=r?null:{from:e,insert:" ".repeat(a-r)}}function UM(n,e){let t=n.doc.lineAt(e),r=e-t.from;if(r==0)return ea(`Backspace @ line ${t.number} col 0: start of line, using default`),null;if(t.text[r-1]==" ")return ea(`Backspace @ line ${t.number} col ${ta(t.text,r)}: deleting one tab char`),{from:e-1,to:e};if(!/^[ \t]+$/.test(t.text.slice(0,r)))return ea(`Backspace @ line ${t.number} col ${ta(t.text,r)}: cursor not in leading whitespace, using default`),null;let i=a1(n,e),s=i?fh:n.tabSize,o=ta(t.text,r),a=o1(n,e),l=YM(a,o,s);if(l>=o)return ea(`Backspace @ line ${t.number} col ${o}: no stop before cursor, using default`),null;let c=e-(o-l);return ea(`Backspace @ line ${t.number} col ${o}: stops(col:freq)=${l1(a)} ${i?"grid=8 (file has tabs)":`grid=${n.tabSize}`} -> deleting cols ${l}..${o} | line=${JSON.stringify(t.text.slice(0,r))}+CURSOR`),{from:c,to:e}}function qM(n){let e=n.state;if(e.selection.ranges.some(r=>!r.empty))return!1;let t=e.changeByRange(r=>{let i=jM(e,r.head);return i?{changes:i,range:z.cursor(r.head+i.insert.length)}:{range:r}});return n.dispatch(t),!0}function GM(n){let e=n.state,t=e.selection.main;if(!t.empty)return!1;let r=UM(e,t.head);return r?(n.dispatch(e.update({changes:r,selection:z.cursor(r.from)})),!0):!1}function c1(n){return[{key:"Tab",run:e=>n()&&qM(e)},{key:"Backspace",run:e=>n()&&GM(e)}]}var HM=new Vt,KM=new Vt,JM=new Vt,eL=new Vt,tL=new Vt,nL=new Vt,rL=new Vt,iL=new Vt,h1="8bitworkshop/editorSettings",d1={tabSize:8,tabsToSpaces:!0,highlightSpecialChars:!1,highlightWhitespace:!1,highlightTrailingWhitespace:!1,closeBrackets:!1,debugHighlightTags:!1,showLineNumbers:!1,showStatusBar:!0};function na(){try{var n=localStorage.getItem(h1);if(n)return Ue(Ue({},d1),JSON.parse(n))}catch(e){}return Ue({},d1)}function sL(n){localStorage.setItem(h1,JSON.stringify(n))}var u1=[[eL,n=>[Me.tabSize.of(n.tabSize),yr.of(" ".repeat(n.tabSize))]],[nL,n=>Sn.of(n.tabsToSpaces?i1:s1)],[HM,n=>n.highlightSpecialChars?ew():[]],[KM,n=>n.highlightWhitespace?dw():[]],[JM,n=>n.highlightTrailingWhitespace?hw():[]],[tL,n=>n.closeBrackets?[ax(),Sn.of([{key:"Backspace",run:dx}])]:[]],[rL,n=>n.debugHighlightTags?ux:[]],[iL,n=>n.showLineNumbers?Xd():[]]];function f1(n){return u1.map(([e,t])=>e.of(t(n)))}var p1=new Set;function m1(n){p1.add(n)}function oL(n){var e=u1.map(([r,i])=>r.reconfigure(i(n)));for(var t of p1)t.dispatch({effects:e})}function g1(){var n=na(),e=!wo();bootbox.dialog({onEscape:!0,title:"Settings",message:`<form id="settingsForm" onsubmit="return false">
|
|
|
|
|
<div class="form-group"><label>Tab size: <input type="number" id="setting_tabSize" min="1" max="40" value="${n.tabSize}" style="width:4em"></label></div>
|
|
|
|
|
<div class="checkbox"><label><input type="checkbox" id="setting_tabsToSpaces" ${n.tabsToSpaces?"checked":""}> Insert spaces when pressing TAB</label></div>
|
|
|
|
|
<div class="checkbox"><label><input type="checkbox" id="setting_highlightSpecialChars" ${n.highlightSpecialChars?"checked":""}> Highlight special characters</label></div>
|
|
|
|
@@ -38,23 +38,23 @@ Tags : ${s}`,h.style.whiteSpace="pre-wrap",h.style.fontFamily="monospace",h.sty
|
|
|
|
|
<h5>Internal</h5>
|
|
|
|
|
<div class="checkbox"><label><input type="checkbox" id="setting_debugHighlightTags" ${n.debugHighlightTags?"checked":""}> Debug editor syntax highlighting tags</label></div>
|
|
|
|
|
`:""}
|
|
|
|
|
</form>`,buttons:{cancel:{label:"Cancel",className:"btn-default"},ok:{label:"Save",className:"btn-primary",callback:()=>{n.tabSize=parseInt($("#setting_tabSize").val())||8,n.tabsToSpaces=$("#setting_tabsToSpaces").is(":checked"),n.highlightSpecialChars=$("#setting_highlightSpecialChars").is(":checked"),n.highlightWhitespace=$("#setting_highlightWhitespace").is(":checked"),n.highlightTrailingWhitespace=$("#setting_highlightTrailingWhitespace").is(":checked"),n.closeBrackets=$("#setting_closeBrackets").is(":checked"),n.showLineNumbers=$("#setting_showLineNumbers").is(":checked"),e&&(n.debugHighlightTags=$("#setting_debugHighlightTags").is(":checked")),n.showStatusBar=$("#setting_showStatusBar").is(":checked"),rL(n),iL(n),Cc(n.showStatusBar)}}}})}function ph(){return typeof navigator!="undefined"?navigator.storage:null}function sL(n){var e=n!==void 0?n:ph();return!!(e&&typeof e.persist=="function")}async function oL(n){var e=n!==void 0?n:ph();try{if(e&&typeof e.estimate=="function"){var t=await e.estimate();return{usage:t&&t.usage,quota:t&&t.quota}}}catch(r){console.log("storage.estimate() failed",r)}return{}}async function aL(n){var e=n!==void 0?n:ph(),t={supported:sL(e),persisted:!1};try{e&&typeof e.persisted=="function"&&(t.persisted=await e.persisted())}catch(i){console.log("storage.persisted() failed",i)}var r=await oL(e);return t.usage=r.usage,t.quota=r.quota,t}async function _g(n){var e=n!==void 0?n:ph(),t=await aL(e);if(!t.supported||t.persisted)return t.granted=!1,t;try{t.persisted=await e.persist(),t.granted=t.persisted}catch(r){console.log("storage.persist() failed",r),t.granted=!1}return t}function lL(n){return n==null&&(n=typeof navigator!="undefined"?navigator.userAgent:""),n?/Edg\/|OPR\/|Chrome\/|Chromium\//.test(n)?"chromium":/Firefox\/|FxiOS\//.test(n)?"firefox":/Safari\//.test(n)?"safari":"other":"other"}function O1(n){if(typeof n!="number"||!isFinite(n))return"?";for(var e=["bytes","KB","MB","GB","TB"],t=0;n>=1024&&t<e.length-1;)n/=1024,t++;return(t==0?n.toFixed(0):n.toFixed(1))+" "+e[t]}function b1(n){return n.usage==null&&n.quota==null?"":"This site is using "+O1(n.usage)+" of the "+O1(n.quota)+" your browser allows."}var Cg="Your edits are still saved in this browser either way — persistence only protects them if the browser needs to reclaim disk space. Use <b>File > Download All Changes as ZIP</b> (or push to GitHub) to keep a backup.";function y1(n){switch(n||lL()){case"chromium":return"Chrome and Edge never ask — they grant persistent storage on their own to sites you use regularly. Bookmarking this page, or installing it as an app, usually qualifies it; then try <b>Request Local Storage Permissions</b> again.";case"firefox":return"Firefox asks for permission the first time. If you dismissed or blocked that prompt, clear it from the padlock icon in the address bar and try <b>Request Local Storage Permissions</b> again.";case"safari":return"Safari decides on its own, and may delete site data after several days without a visit. Adding this page to your Favorites or Home Screen makes eviction less likely.";default:return"This browser decides on its own whether to keep site data."}}function cL(){return"This browser doesn't support persistent storage, so it may discard your local file edits when it needs disk space. "+Cg}function S1(n,e){var t=b1(n),r;return n.supported?n.persisted?r=(n.granted?"Your browser just granted persistent storage. ":"Your browser is already persisting your local file edits. ")+Cg:r="Your browser has not granted persistent storage, so it may discard your local file edits when it needs disk space.<br><br>"+y1()+"<br><br>"+Cg:r=cL(),t?r+"<br><br>"+t:r}function v1(n){return"Your browser ran out of space for this site, so your last edit may not have been saved.<br><br>"+b1(n)+" Delete unused projects, or use <b>File > Download All Changes as ZIP</b> to back up your work before it is lost."+(n.supported&&!n.persisted?"<br><br>"+y1():"")}var Q1=Of(Qf());function Ks(n,e){if(e){var t=Da(e);t!=""&&n.startsWith(t+"/")&&(n=n.substring(t.length+1))}return n}function dL(n,e){var t=Da(e);return t.length>0&&t!="local"?[t+"/"+n,n]:[n]}function hL(n,e,t,r){var i=s=>Ry(n,s).map(o=>dL(o,e));return{includes:i(Lc(t,r)),links:i(Dc(t,r))}}async function x1(n,e,t,r,i){for(var s=[],o=new Set([Ks(e,e)]),a=[{path:e,text:t,tool:i(e)}];a.length;){var{path:l,text:c,tool:d}=a.shift(),h=hL(c,l,d,r),u=h.includes.map(D=>({candidates:D,link:!1})).concat(h.links.map(D=>({candidates:D,link:!0})));for(var{candidates:f,link:m}of u)for(var O of f){var S=Ks(O,e);if(o.has(S))break;var x=await n.readFile(O);if(x!=null){o.add(S),s.push({path:O,filename:S,link:m,data:x}),typeof x=="string"&&a.push({path:O,text:x,tool:m?i(O):d});break}}}return s}function P1(n,e){var t={updates:[],buildsteps:[]},r={},i=[],s=O=>{O&&i.indexOf(O)<0&&i.push(O)},o=Ks(n.mainPath,n.mainPath);t.updates.push({path:o,data:n.mainData}),r[o]=n.mainPath;var a=n.getToolForFilename(n.mainPath);s(a);var l=a.startsWith(Line truncated
|
|
|
|
|
</form>`,buttons:{cancel:{label:"Cancel",className:"btn-default"},ok:{label:"Save",className:"btn-primary",callback:()=>{n.tabSize=parseInt($("#setting_tabSize").val())||8,n.tabsToSpaces=$("#setting_tabsToSpaces").is(":checked"),n.highlightSpecialChars=$("#setting_highlightSpecialChars").is(":checked"),n.highlightWhitespace=$("#setting_highlightWhitespace").is(":checked"),n.highlightTrailingWhitespace=$("#setting_highlightTrailingWhitespace").is(":checked"),n.closeBrackets=$("#setting_closeBrackets").is(":checked"),n.showLineNumbers=$("#setting_showLineNumbers").is(":checked"),e&&(n.debugHighlightTags=$("#setting_debugHighlightTags").is(":checked")),n.showStatusBar=$("#setting_showStatusBar").is(":checked"),sL(n),oL(n),Cc(n.showStatusBar)}}}})}function ph(){return typeof navigator!="undefined"?navigator.storage:null}function aL(n){var e=n!==void 0?n:ph();return!!(e&&typeof e.persist=="function")}async function lL(n){var e=n!==void 0?n:ph();try{if(e&&typeof e.estimate=="function"){var t=await e.estimate();return{usage:t&&t.usage,quota:t&&t.quota}}}catch(r){console.log("storage.estimate() failed",r)}return{}}async function cL(n){var e=n!==void 0?n:ph(),t={supported:aL(e),persisted:!1};try{e&&typeof e.persisted=="function"&&(t.persisted=await e.persisted())}catch(i){console.log("storage.persisted() failed",i)}var r=await lL(e);return t.usage=r.usage,t.quota=r.quota,t}async function _g(n){var e=n!==void 0?n:ph(),t=await cL(e);if(!t.supported||t.persisted)return t.granted=!1,t;try{t.persisted=await e.persist(),t.granted=t.persisted}catch(r){console.log("storage.persist() failed",r),t.granted=!1}return t}function dL(n){return n==null&&(n=typeof navigator!="undefined"?navigator.userAgent:""),n?/Edg\/|OPR\/|Chrome\/|Chromium\//.test(n)?"chromium":/Firefox\/|FxiOS\//.test(n)?"firefox":/Safari\//.test(n)?"safari":"other":"other"}function O1(n){if(typeof n!="number"||!isFinite(n))return"?";for(var e=["bytes","KB","MB","GB","TB"],t=0;n>=1024&&t<e.length-1;)n/=1024,t++;return(t==0?n.toFixed(0):n.toFixed(1))+" "+e[t]}function b1(n){return n.usage==null&&n.quota==null?"":"This site is using "+O1(n.usage)+" of the "+O1(n.quota)+" your browser allows."}var Cg="Your edits are still saved in this browser either way — persistence only protects them if the browser needs to reclaim disk space. Use <b>File > Download All Changes as ZIP</b> (or push to GitHub) to keep a backup.";function y1(n){switch(n||dL()){case"chromium":return"Chrome and Edge never ask — they grant persistent storage on their own to sites you use regularly. Bookmarking this page, or installing it as an app, usually qualifies it; then try <b>Request Local Storage Permissions</b> again.";case"firefox":return"Firefox asks for permission the first time. If you dismissed or blocked that prompt, clear it from the padlock icon in the address bar and try <b>Request Local Storage Permissions</b> again.";case"safari":return"Safari decides on its own, and may delete site data after several days without a visit. Adding this page to your Favorites or Home Screen makes eviction less likely.";default:return"This browser decides on its own whether to keep site data."}}function hL(){return"This browser doesn't support persistent storage, so it may discard your local file edits when it needs disk space. "+Cg}function S1(n,e){var t=b1(n),r;return n.supported?n.persisted?r=(n.granted?"Your browser just granted persistent storage. ":"Your browser is already persisting your local file edits. ")+Cg:r="Your browser has not granted persistent storage, so it may discard your local file edits when it needs disk space.<br><br>"+y1()+"<br><br>"+Cg:r=hL(),t?r+"<br><br>"+t:r}function v1(n){return"Your browser ran out of space for this site, so your last edit may not have been saved.<br><br>"+b1(n)+" Delete unused projects, or use <b>File > Download All Changes as ZIP</b> to back up your work before it is lost."+(n.supported&&!n.persisted?"<br><br>"+y1():"")}var Q1=Of(Qf());function Ks(n,e){if(e){var t=Da(e);t!=""&&n.startsWith(t+"/")&&(n=n.substring(t.length+1))}return n}function uL(n,e){var t=Da(e);return t.length>0&&t!="local"?[t+"/"+n,n]:[n]}function fL(n,e,t,r){var i=s=>Ry(n,s).map(o=>uL(o,e));return{includes:i(Lc(t,r)),links:i(Dc(t,r))}}async function x1(n,e,t,r,i){for(var s=[],o=new Set([Ks(e,e)]),a=[{path:e,text:t,tool:i(e)}];a.length;){var{path:l,text:c,tool:d}=a.shift(),h=fL(c,l,d,r),u=h.includes.map(D=>({candidates:D,link:!1})).concat(h.links.map(D=>({candidates:D,link:!0})));for(var{candidates:f,link:m}of u)for(var O of f){var S=Ks(O,e);if(o.has(S))break;var x=await n.readFile(O);if(x!=null){o.add(S),s.push({path:O,filename:S,link:m,data:x}),typeof x=="string"&&a.push({path:O,text:x,tool:m?i(O):d});break}}}return s}function P1(n,e){var t={updates:[],buildsteps:[]},r={},i=[],s=O=>{O&&i.indexOf(O)<0&&i.push(O)},o=Ks(n.mainPath,n.mainPath);t.updates.push({path:o,data:n.mainData}),r[o]=n.mainPath;var a=n.getToolForFilename(n.mainPath);s(a);var l=a.startsWith(Line truncated
|
|
|
|
|
=====
|
|
|
|
|
|
|
|
|
|
[Open this project in 8bitworkshop](https://8bitworkshop.com/redir.html?platform=$PLATFORM&githubURL=$GITHUBURL&file=$MAINFILE).
|
|
|
|
|
`;function Js(){for(var n={},e=0;e<localStorage.length;e++){var t=localStorage.key(e);if(t.startsWith("__repo__")){var r=JSON.parse(localStorage.getItem(t)),i=t.substring(8);n[i]=r}}return n}function Ql(n){var e=n.split("/",8);return e.length<5||e[0]!="https:"||e[2]!="github.com"||e[5]&&e[5]!="tree"?null:{user:e[3],repo:e[4],repopath:e[3]+"/"+e[4],branch:e[6],subtreepath:e[7]}}var yh=class{constructor(e,t,r,i){this.githubCons=e,this.githubToken=t,this.store=r,this.project=i,this.recreateGithub()}recreateGithub(){this.github=new this.githubCons({token:this.githubToken})}login(){if(this.githubToken&&this.githubToken.length)return new Promise((t,r)=>{t()});var e=new firebase.auth.GithubAuthProvider;return e.addScope("repo"),firebase.auth().signInWithPopup(e).then(t=>{this.githubToken=t.credential.accessToken;var r=t.user;this.recreateGithub(),document.cookie="__github_key="+this.githubToken+";path=/;max-age=31536000",console.log("Stored GitHub OAUTH key")})}logout(){return this.githubToken&&this.githubToken.length?firebase.auth().signOut().then(()=>{document.cookie="__github_key=;path=/;max-age=0",this.githubToken=null,this.recreateGithub()}):new Promise((e,t)=>{e()})}isFileIgnored(e){return e=e.toUpperCase(),!!(e.startsWith("LICENSE")||e.startsWith("README")||e.startsWith("."))}async getGithubSession(e){var t=Ql(e);if(!t)throw new Error("Please enter a valid GitHub URL.");var r=Js()[t.repopath],i=t.branch||r&&r.branch,s=this.github.repos(t.user,t.repo);try{i=(await s.fetch()).defaultBranch||"master"}catch(a){console.log("could not fetch default branch: "+a),i="main"}console.log("branch =",i);var o={url:e,user:t.user,reponame:t.repo,repopath:t.repopath,branch:i,subtreepath:t.subtreepath,prefix:"",repo:s,platform_id:this.project?this.project.platform_id:r?r.platform_id:null};return o}getGithubHEADTree(e){var t;return this.getGithubSession(e).then(r=>(t=r,t.repo.git.refs.heads(t.branch).fetch())).then(r=>(t.head=r,t.sha=r.object.sha,t.repo.git.trees(t.sha).fetch())).then(r=>{if(t.subtreepath){for(let i of r.tree)if(i.type=="tree"&&i.path==t.subtreepath&&i.sha)return t.repo.git.trees(i.sha).fetch();throw Error("Cannot find subtree '"+t.subtreepath+"' in tree "+r.sha)}return r}).then(r=>(t.tree=r,t))}bind(e,t){var r="__repo__"+e.repopath;if(t){var i={url:e.url,branch:e.branch,platform_id:e.platform_id,mainPath:e.mainPath,sha:e.sha};console.log("storing",i),localStorage.setItem(r,JSON.stringify(i))}else localStorage.removeItem(r)}import(e){var t;return this.getGithubSession(e).then(r=>(t=r,t.repo.contents("README.md").read())).catch(r=>(console.log(r),console.log("no README.md found"),t.repo.fetch().then(i=>""))).then(r=>{var i;if(i=/8bitworkshop.com[^)]+file=([^)&]+)/.exec(r),i&&i[1]&&(console.log("main path: '"+i[1]+"'"),t.mainPath=i[1]),i=/8bitworkshop.com[^)]+platform=([A-Za-z0-9._\-]+)/.exec(r),i){if(console.log("platform id: '"+i[1]+"'"),t.platform_id&&!t.platform_id.startsWith(i[1]))throw Error("Platform mismatch: Repository is '"+i[1]+"', you have '"+t.platform_id+"' selected.");t.platform_id=i[1]}return this.bind(t,!0),t})}pull(e,t){var r;return this.getGithubHEADTree(e).then(i=>{r=i;let s=[];return r.paths=[],r.tree.tree.forEach(o=>{if(console.log(o.path,o.type,o.size),r.paths.push(o.path),o.type=="blob"&&!this.isFileIgnored(o.path)){var a=r.repo.git.blobs(o.sha).fetch().then(l=>{var c=r.prefix+o.path,d=o.size,h=l.encoding,u=l.content;if(l.encoding=="base64"){var f=yc(atob(u)),m=vc(o.path,f);u=m?f:Sc(f)}return l.size!=u.length&&(u=u.slice(0,l.size)),(t||this.store).setItem(c,u)});s.push(a)}else console.log("ignoring "+o.path)}),Promise.all(s)}).then(i=>r)}importAndPull(e){return this.import(e).then(t=>this.pull(e))}publish(e,t,r,i){var s,o=this.project.platform_id,a=this.project.stripLocalPath(this.project.mainPath);return this.github.user.repos.create({name:e,description:t,private:i,auto_init:!1,license_template:r}).then(l=>{s=l;var c=uL;c=c.replace(/\$NAME/g,encodeURIComponent(e)),c=c.replace(/\$PLATFORM/g,encodeURIComponent(o)),c=c.replace(/\$GITHUBURL/g,encodeURIComponent(s.htmlUrl)),c=c.replace(/\$MAINFILE/g,encodeURIComponent(a));var d={message:"8bitworkshop: updated metadata in README.md",content:btoa(c)};return s.contents("README.md").add(d)}).then(()=>this.getGithubSession(s.htmlUrl))}commit(e,t,r){var i;return t||(t="updated from 8bitworkshop.com"),this.getGithubHEADTree(e).then(s=>{if(i=s,i.subtreepath)throw Error("Sorry, right now you can only commit files to the root directory of a repository.");return Promise.all(r.map(o=>typeof o.data=="string"?i.repo.git.blobs.create({content:o.data,encoding:"utf-8"}):i.repo.git.blobs.create({content:btoa(Q0(o.data)),encoding:"base64"})))}).then(s=>i.repo.git.trees.create({tree:r.map((o,a)=>({path:o.path,mode:"100644",type:"blob",sha:s[a].sha})),base_tree:i.tree.sha})).then(s=>i.repo.git.commits.create({message:t,tree:s.sha,parents:[i.head.object.sha]})).then(s=>i.repo.commits(s.sha).fetch()).then(s=>(i.commit=s,i))}push(e){return e.head.update({sha:e.com
Line truncated
|
|
|
|
|
`},s=window.c2t({noInitialRun:!0,print:i,printErr:i}),o=s.FS,a=_t()+".bin",l=_t()+".wav";o.writeFile(a,wn(),{encoding:"binary"});var c=["-2bc",a+","+e.toString(16),l];s.callMain(c);var d=o.readFile(l,{encoding:"binary"});if(d){var h=new Blob([d],{type:"audio/wav"});(0,si.saveAs)(h,l),r+="Then connect your audio output to the cassette input, turn up the volume, and play the audio file.",an(r)}})}function gL(n){hr("lib/makewav.js").then(()=>{let e="",t=function(a){e+=a+`
|
|
|
|
|
[Open this project in 8bitworkshop](${i}).
|
|
|
|
|
`}function Js(){for(var n={},e=0;e<localStorage.length;e++){var t=localStorage.key(e);if(t.startsWith("__repo__")){var r=JSON.parse(localStorage.getItem(t)),i=t.substring(8);n[i]=r}}return n}function Ql(n){var e=n.split("/",8);return e.length<5||e[0]!="https:"||e[2]!="github.com"||e[5]&&e[5]!="tree"?null:{user:e[3],repo:e[4],repopath:e[3]+"/"+e[4],branch:e[6],subtreepath:e[7]}}var yh=class{constructor(e,t,r,i){this.githubCons=e,this.githubToken=t,this.store=r,this.project=i,this.recreateGithub()}recreateGithub(){this.github=new this.githubCons({token:this.githubToken})}login(){if(this.githubToken&&this.githubToken.length)return new Promise((t,r)=>{t()});var e=new firebase.auth.GithubAuthProvider;return e.addScope("repo"),firebase.auth().signInWithPopup(e).then(t=>{this.githubToken=t.credential.accessToken;var r=t.user;this.recreateGithub(),document.cookie="__github_key="+this.githubToken+";path=/;max-age=31536000",console.log("Stored GitHub OAUTH key")})}logout(){return this.githubToken&&this.githubToken.length?firebase.auth().signOut().then(()=>{document.cookie="__github_key=;path=/;max-age=0",this.githubToken=null,this.recreateGithub()}):new Promise((e,t)=>{e()})}isFileIgnored(e){return e=e.toUpperCase(),!!(e.startsWith("LICENSE")||e.startsWith("README")||e.startsWith("."))}async getGithubSession(e){var t=Ql(e);if(!t)throw new Error("Please enter a valid GitHub URL.");var r=Js()[t.repopath],i=t.branch||r&&r.branch,s=this.github.repos(t.user,t.repo);try{i=(await s.fetch()).defaultBranch||"master"}catch(a){console.log("could not fetch default branch: "+a),i="main"}console.log("branch =",i);var o={url:e,user:t.user,reponame:t.repo,repopath:t.repopath,branch:i,subtreepath:t.subtreepath,prefix:"",repo:s,platform_id:this.project?this.project.platform_id:r?r.platform_id:null};return o}getGithubHEADTree(e){var t;return this.getGithubSession(e).then(r=>(t=r,t.repo.git.refs.heads(t.branch).fetch())).then(r=>(t.head=r,t.sha=r.object.sha,t.repo.git.trees(t.sha).fetch())).then(r=>{if(t.subtreepath){for(let i of r.tree)if(i.type=="tree"&&i.path==t.subtreepath&&i.sha)return t.repo.git.trees(i.sha).fetch();throw Error("Cannot find subtree '"+t.subtreepath+"' in tree "+r.sha)}return r}).then(r=>(t.tree=r,t))}bind(e,t){var r="__repo__"+e.repopath;if(t){var i={url:e.url,branch:e.branch,platform_id:e.platform_id,mainPath:e.mainPath,sha:e.sha};console.log("storing",i),localStorage.setItem(r,JSON.stringify(i))}else localStorage.removeItem(r)}import(e){var t;return this.getGithubSession(e).then(r=>(t=r,t.repo.contents("README.md").read())).catch(r=>(console.log(r),console.log("no README.md found"),t.repo.fetch().then(i=>""))).then(r=>{var i;if(i=/8bitworkshop.com[^)]+file=([^)&]+)/.exec(r),i&&i[1]&&(console.log("main path: '"+i[1]+"'"),t.mainPath=i[1]),i=/8bitworkshop.com[^)]+platform=([A-Za-z0-9._\-]+)/.exec(r),i){if(console.log("platform id: '"+i[1]+"'"),t.platform_id&&!t.platform_id.startsWith(i[1]))throw Error("Platform mismatch: Repository is '"+i[1]+"', you have '"+t.platform_id+"' selected.");t.platform_id=i[1]}return this.bind(t,!0),t})}pull(e,t){var r;return this.getGithubHEADTree(e).then(i=>{r=i;let s=[];return r.paths=[],r.tree.tree.forEach(o=>{if(console.log(o.path,o.type,o.size),r.paths.push(o.path),o.type=="blob"&&!this.isFileIgnored(o.path)){var a=r.repo.git.blobs(o.sha).fetch().then(l=>{var c=r.prefix+o.path,d=o.size,h=l.encoding,u=l.content;if(l.encoding=="base64"){var f=yc(atob(u)),m=vc(o.path,f);u=m?f:Sc(f)}return l.size!=u.length&&(u=u.slice(0,l.size)),(t||this.store).setItem(c,u)});s.push(a)}else console.log("ignoring "+o.path)}),Promise.all(s)}).then(i=>r)}importAndPull(e){return this.import(e).then(t=>this.pull(e))}publish(e,t,r,i){var s,o=this.project.platform_id,a=this.project.stripLocalPath(this.project.mainPath);return this.github.user.repos.create({name:e,description:t,private:i,auto_init:!1,license_template:r}).then(l=>{s=l;var c=A1(e,o,s.htmlUrl,a),d={message:"8bitworkshop: updated metadata in README.md",content:btoa(c)};return s.contents("README.md").add(d)}).then(()=>this.getGithubSession(s.htmlUrl))}commit(e,t,r){var i;return t||(t="updated from 8bitworkshop.com"),this.getGithubHEADTree(e).then(s=>{if(i=s,i.subtreepath)throw Error("Sorry, right now you can only commit files to the root directory of a repository.");return Promise.all(r.map(o=>typeof o.data=="string"?i.repo.git.blobs.create({content:o.data,encoding:"utf-8"}):i.repo.git.blobs.create({content:btoa(Q0(o.data)),encoding:"base64"})))}).then(s=>i.repo.git.trees.create({tree:r.map((o,a)=>({path:o.path,mode:"100644",type:"blob",sha:s[a].sha})),base_tree:i.tree.sha})).then(s=>i.repo.git.commits.create({message:t,tree:s.sha,parents:[i.head.object.sha]})).then(s=>i.repo.commits(s.sha).fetch()).then(s=>(i.commit=s,i))}push(e){return e.head.update({sha:e.commit.sha}).then(t=>e)}deleteRepository(e){return this.getGithubSession(e).then(t=>t.repo.remove())}};var Sh=class{constructor(e){this.options=e,this.sampleRate=44100,this.soundData=[],this.
Line truncated
|
|
|
|
|
`},s=window.c2t({noInitialRun:!0,print:i,printErr:i}),o=s.FS,a=_t()+".bin",l=_t()+".wav";o.writeFile(a,wn(),{encoding:"binary"});var c=["-2bc",a+","+e.toString(16),l];s.callMain(c);var d=o.readFile(l,{encoding:"binary"});if(d){var h=new Blob([d],{type:"audio/wav"});(0,si.saveAs)(h,l),r+="Then connect your audio output to the cassette input, turn up the volume, and play the audio file.",an(r)}})}function bL(n){hr("lib/makewav.js").then(()=>{let e="",t=function(a){e+=a+`
|
|
|
|
|
`};var r=Zt(_t());let i=r+".bin",s=r+".wav";window.makewav({noInitialRun:!1,print:t,printErr:t,arguments:["-ts","-f0","-v10",i],preRun:a=>{a.FS.writeFile(i,wn(),{encoding:"binary"})}}).ready.then(a=>{let l=[i];a.run(l),console.log(e);let d=a.FS.readFile(s,{encoding:"binary"});if(d){let h=new Blob([d],{type:"audio/wav"});(0,si.saveAs)(h,s),e+=`
|
|
|
|
|
Connect your audio output to the SuperCharger input, turn up the volume, and play the audio file.`,an(e)}})})}function OL(n){var e=Zt(_t());let t=e+".tap",r=new eo(e),i=new Sh({sine_wave:!0}),s=wn(),o=s[0]+s[1]*256;s=s.slice(2),r.setContent({data:s,startAddress:o,type:eo.FILE_TYPE_NON_RELOCATABLE}),r.generateSound(i);let a=i.getTAPData();if(a){let l=new Blob([a],{type:"application/octet-stream"});(0,si.saveAs)(l,t)}}function Lg(){switch(Nt(Oe)){case"vcs":return gL;case"apple2":return mL;case"c64":return OL}}function A1(n){if(wn()==null)return Re("Please fix errors before exporting."),!0;var e=Lg();if(e===void 0)return Re("Cassette export is not supported on this platform."),!0;e(n)}function C1(n){if(wn()==null)return Re("Please finish compiling with no errors before downloading ROM."),!0;var e=Zt(_t());if(P.getDownloadFile){var t=P.getDownloadFile(),e=Zt(_t());(0,si.saveAs)(t.blob,e+t.extension)}else if(wn()instanceof Uint8Array){var r=new Blob([wn()],{type:"application/octet-stream"}),i=P.getROMExtension&&P.getROMExtension(wn())||"-"+Nt(Oe)+".bin";(0,si.saveAs)(r,e+i)}else Re(`The "${Oe}" platform doesn't have downloadable ROMs.`)}function _1(n){var e=N.getCurrentText();if(!e)return!1;var t=new Blob([e],{type:"text/plain;charset=utf-8"});(0,si.saveAs)(t,Z1(),{autoBom:!1})}async function E1(){let n=(await import("./jszip.min-QUGS7P6D.js")).default;return new n}async function R1(n){var e=await E1();Ci().iterateFiles((t,r)=>{r&&e.file(yt(t),r)}),e.generateAsync({type:"blob"}).then(t=>{(0,si.saveAs)(t,_t()+"-"+Nt(Oe)+".zip")})}function M1(n){let e=P.getDebugSymbolFile&&P.getDebugSymbolFile();if(!e){Re("This project does not have debug information.");return}var t=Zt(_t());(0,si.saveAs)(e.blob,t+e.extension,{autoBom:!1})}async function L1(n){var e=await E1(),t=await is().keys();Je(!0);try{var r=0;await Promise.all(t.map(s=>is().getItem(s).then(o=>{Dr(r++/(t.length+1)),o&&e.file(s,o)})));var i=await e.generateAsync({type:"blob"});(0,si.saveAs)(i,Nt(Oe)+"-all.zip")}finally{Je(!1)}}var Mg=!1;function D1(){Mg||hr("lib/gif.js").then(()=>{var n=$("#emulator").find("canvas")[0];if(!n){Re("Could not find canvas element to record video!");return}var e=0;n.style&&n.style.transform&&(n.style.transform.indexOf("rotate(-90deg)")>=0?e=-1:n.style.transform.indexOf("rotate(90deg)")>=0&&(e=1));var t=new GIF({workerScript:"lib/gif.worker.js",workers:4,quality:10,rotate:e}),r=$("#videoPreviewImage");t.on("progress",l=>{Dr(l)}),t.on("finished",l=>{r.attr("src",URL.createObjectURL(l)),Je(!1),P.resume(),$("#videoPreviewModal").modal("show")});var i=20,s=300,o=0;console.log("Recording video",n),$("#emulator").css("backgroundColor","#cc3333");var a=()=>{o++>s?(console.log("Rendering video"),$("#emulator").css("backgroundColor","inherit"),Je(!0),P.pause(),t.render(),Mg=!1):(t.addFrame(n,{delay:i,copy:!0}),setTimeout(a,i),Mg=!0)};a()})}var Dg;async function to(){if(!Dg){await hr("lib/octokat.js"),await hr("https://www.gstatic.com/firebasejs/8.8.1/firebase-app.js"),await hr("https://www.gstatic.com/firebasejs/8.8.1/firebase-auth.js"),await hr("https://8bitworkshop.com/config.js");var n=E0("__github_key");Dg=new yh(Octokat,n,is(),Ci()),console.log("loaded github service")}return Dg}function Al(){var n=(Et||"").split("/");return n.length!=2?(Re("You are not in a GitHub repository. Choose one from the pulldown, or Import or Publish one."),null):"https://github.com/"+n[0]+"/"+n[1]}async function Cl(n,e){var t,r=Ql(n);if(!r){Re("Could not parse GitHub URL.");return}var i=Js()[r.repopath];if(!(i&&!confirm("You've already imported "+r.repopath+" -- do you want to replace all local files?"))){Je(!0);var s=bh(r.repopath);Dr(.25);var o=await to();return o.import(n).then(a=>(t=a,Dr(.75),o.pull(n,s))).then(a=>{Je(!1),no(e,{repo:r.repopath})}).catch(a=>{Je(!1),console.log(a),Re("Could not import "+n+". "+a)})}}async function I1(n){var e=await to();e.login().then(()=>{an("You are signed in to GitHub.")}).catch(t=>{Re("Could not sign in."+t)})}async function X1(n){var e=await to();e.logout().then(()=>{an("You are logged out of GitHub.")})}function z1(n){var e=$("#importGithubModal"),t=$("#importGithubButton");e.modal("show"),e.off("shown.bs.modal").on("shown.bs.modal",()=>$("#importGithubURL").trigger("focus")),$("#importGithubURL").off("keydown").on("keydown",r=>{r.key==="Enter"&&(r.preventDefault(),t.trigger("click"))}),t.off("click").on("click",()=>{var r=$("#importGithubURL").val()+"";e.modal("hide"),Cl(r,!1)})}function W1(n){if(!(Et&&!confirm("This project ("+Ci().mainPath+") is already bound to a GitHub repository. Do you want to re-publish to a new repository? (You can instead choose 'Push Changes' to update files in the existing repository.)"))){var e=$("#publishGithubModal"),t=$("#publishGithubButton");$("#githubRepoName").val(Zt(yt(Ci().mainPath))),e.modal("show"),t.off("click").on("click",async()=>{var r=$("#githubRepoName").val()+"",i=$("#githubRepoDesc").val()+"",s=$("#githubRepoPrivate").val()=="private",o=$("#githubRepoLicense").val()+""Line truncated
|
|
|
|
|
`);for(let o=0;o<s.length;o++){let a=s[o],l=o+1,c=a.match(/(?:function|func|def|proc)\s+(\w+)/i);c&&i.push({id:`${e}:${l}:${c[1]}`,name:c[1],kind:"func",source:r,file:e,line:l});let d=a.match(/(?:var|let|const|global)\s+(\w+)/i);d&&i.push({id:`${e}:${l}:${d[1]}`,name:d[1],kind:"var",source:r,file:e,line:l});let h=a.match(/(?:struct|class|interface|type)\s+(\w+)/i);h&&i.push({id:`${e}:${l}:${h[1]}`,name:h[1],kind:"type",source:r,file:e,line:l});let u=a.match(/^\s*(\w+)\s*:/);u&&!a.trim().startsWith("//")&&i.push({id:`${e}:${l}:${u[1]}`,name:u[1],kind:"label",source:r,file:e,line:l});let f=a.match(/#define\s+(\w+)/i);f&&i.push({id:`${e}:${l}:${f[1]}`,name:f[1],kind:"macro",source:r,file:e,line:l});let m=a.match(/^\s*(\w+)\s*(?:=|equ)\s+/i);m&&i.push({id:`${e}:${l}:${m[1]}`,name:m[1],kind:"equate",source:r,file:e,line:l})}return i}var U1=()=>null;function q1(n){U1=n}function sa(){return U1()}var vh=class{constructor(){this.id="project";this.kind="project";this.rebuilt=!1;this.index=new ia([])}async ready(){await this.index.init(),this.rebuilt||(this.rebuilt=!0,await this.rebuild())}query(e,t){let r=this.index.query(e,t),i=this.fulltextQuery(e,t),s=r.concat(i);return s.sort((o,a)=>a.score-o.score),s.slice(0,t)}fulltextQuery(e,t){if(e.length<2)return[];let r=e.toLowerCase(),i=[],s=Math.max(t,10),o=sa();return o?(o.iterateFiles((a,l)=>{if(typeof l!="string")return;let c=l.split(`
|
|
|
|
|
`),d=0;for(let h=0;h<c.length;h++){let u=c[h],m=u.toLowerCase().indexOf(r);if(m>=0){let O=u.trim();if(!O)continue;if(i.push({record:{id:`text:${a}:${h+1}`,name:O.length>80?O.slice(0,80)+"\u2026":O,kind:"text",source:"project",file:a,line:h+1},score:200+Math.max(0,100-m*2),ranges:[m,m+e.length]}),++d>=s)break}}}),i):[]}async onFileChanged(e,t){let r=this.extractSymbolsFromFile(e,t,"project");this.index.pushRecords(r)}extractSymbolsFromFile(e,t,r){if(typeof t!="string")return[];let i=this.detectEditorStyle(e);return Ig(t,e,i,r)}detectEditorStyle(e){var r;switch((r=e.split(".").pop())==null?void 0:r.toLowerCase()){case"c":case"h":return"text/x-csrc";case"asm":case"a65":case"inc":return"6502";case"v":return"verilog";case"wiz":return"text/x-wiz";case"bas":case"basic":return"basic";case"fb":case"fastbasic":return"fastbasic";case"bac":case"bataribasic":return"bataribasic";case"i":return"inform6";case"d":return"dialog";default:return"text/x-csrc"}}async rebuild(){this.index.clear(),await this.index.init();let e=sa();if(!e)return;let t=[];e.iterateFiles((r,i)=>{if(typeof i!="string")return;let s=this.detectEditorStyle(r),o=Ig(i,r,s,"project");t.push(...o)}),this.index.pushRecords(t)}};var wL=new Set(["h","hh","hpp","inc","asm","a65","s","mac","defs","def","equ","i","m","c","bas","txt"]),xL=20,wh=class{constructor(){this.id="toolchain";this.kind="toolchain";this.fsName=null;this.files=[];this.loaded=new Map;this.readyPromise=null;this.batchSize=xL}async ready(){return this.readyPromise||(this.readyPromise=this.load()),this.readyPromise}async load(){let e=sa();if(!e)return;let t;try{t=e.getToolForFilename?e.getToolForFilename(e.mainPath):""}catch(o){t=""}let r=Ic(t,e.platform_id),i=Zc(t,e.platform_id);if(!r||!i.length)return;this.fsName=r;let s=new Set;for(let o of i){let a=await this.listFiles(o);for(let l of a)this.isSearchable(l)&&!s.has(l)&&(s.add(l),this.files.push(l))}this.files.sort();for(let o=0;o<this.files.length;o+=this.batchSize){let a=this.files.slice(o,o+this.batchSize),l=await Promise.all(a.map(async c=>{let d=await this.readFile(c);return[c,d]}));for(let[c,d]of l)d!=null&&this.loaded.set(c,d)}}isValid(){return this.fsName!=null&&this.files.length>0}async listFiles(e){let t=sa();if(!t||!this.fsName||!t.queryWorker)return[];try{let r={preload_fs:this.fsName,listshared:e,updates:[],buildsteps:[]},i=await t.queryWorker(r),s=i&&i.output;return Array.isArray(s)?s:[]}catch(r){return console.debug("Toolchain list error:",r),[]}}async readFile(e){let t=sa();if(!t||!this.fsName||!t.queryWorker)return null;try{let r={preload_fs:this.fsName,readshared:e,updates:[],buildsteps:[]},i=await t.queryWorker(r),s=i&&i.output;return s instanceof Uint8Array&&s.length>0?new TextDecoder().decode(s):null}catch(r){return console.debug("Toolchain read error:",r),null}}isSearchable(e){let t=e.split("/").pop()||e,r=t.lastIndexOf(".");return r<0?!0:wL.has(t.substring(r+1).toLowerCase())}async query(e,t){return await this.ready(),!this.isValid()||e.length<2?[]:this.textQuery(e,t)}textQuery(e,t){if(e.length<2)return[];let r=e.toLowerCase(),i=[],s=Math.max(t,5);for(let[o,a]of this.loaded){let l=a.split(`
|
|
|
|
|
`),c=0;for(let d=0;d<l.length;d++){let h=l[d],f=h.toLowerCase().indexOf(r);if(f>=0){let m=h.trim();if(!m)continue;if(i.push({record:{id:`toolchain:${o}:${d+1}`,name:m.length>80?m.slice(0,80)+"\u2026":m,kind:"text",source:"toolchain",file:o,line:d+1},score:200+Math.max(0,100-f*2),ranges:[f,f+e.length]}),++c>=s)break}}}return i.sort((o,a)=>a.score-o.score),i.slice(0,t)}invalidate(){this.fsName=null,this.files=[],this.loaded.clear(),this.readyPromise=null}};var G1=()=>[];function H1(n){G1=n}var PL=/<h([1-3])\b[^>]*>([\s\S]*?)<\/h\1>/gi;function kL(n){return n.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&#(?:0*39|x27);/gi,"'").replace(/ /g," ").replace(/…/g,"\u2026").replace(/—/g,"\u2014").replace(/–/g,"\u2013").replace(/’|‘/g,"'").replace(/”|“/g,'"').replace(/»/g,"\xBB").replace(/«/g,"\xAB").replace(/&/g,"&")}function _l(n){return kL(n.replace(/<[^>]+>/g," ")).replace(/\s+/g," ").trim()}function Xg(n,e=180){let t=n.trim();if(!t)return;let i=t.slice(0,e).match(/^([\s\S]*?[.!?])(?:\s|$)/);return i?i[1]:t.length<=e?t:t.slice(0,e-1)+"\u2026"}function $L(n){let e=[],t="#help/"+n.id,r=n.title||n.id,i=n.html||"",s=[],o=new RegExp(PL.source,"gi"),a;for(;a=o.exec(i);)s.push({name:_l(a[2]),start:a.index,end:o.lastIndex});let l=(u,f,m)=>{if(!f)return;let O=Xg(m),S=O&&m.startsWith(O)?m.slice(O.length).trim():m;e.push({id:`${n.id}:${u}`,name:f,kind:"doc",brief:O,detail:S||void 0,source:"docs",file:r,url:t})},c=s.length?s[0].start:i.length,d=_l(i.slice(0,c)),h=s.length&&s[0].start===0?s[0].name||n.title:n.title||n.id;l(0,h,d);for(let u=0;u<s.length;u++){if(u===0&&s[0].start===0)continue;let f=u+1<s.length?s[u+1].start:i.length;l(u+1,s[u].name,_l(i.slice(s[u].end,f)))}return e}var xh=class{constructor(){this.id="docs";this.kind="docs";this.index=null;this.readyPromise=null}async ready(){return this.readyPromise?this.readyPromise:(this.readyPromise=this.load(),this.readyPromise)}async load(){let e=G1()||[];if(e.length===0)return;let t=[];for(let i of e)t.push(...$L(i));if(t.length===0)return;let r=new ia(t);await r.init(),this.index=r}async query(e,t){return await this.ready(),this.index?this.index.query(e,t):[]}};var QL=50,zg=class n{constructor(){this.sources=new Map;this.projectSource=new vh,this.toolchainSource=new wh,this.docsSource=new xh,this.sources.set("project",this.projectSource),this.sources.set("toolchain",this.toolchainSource),this.sources.set("docs",this.docsSource)}static getInstance(){return n.instance||(n.instance=new n),n.instance}parseQuery(e){return e.startsWith("#")?{needle:e.slice(1).trim(),filter:"symbols"}:e.startsWith(">")?{needle:e.slice(1).trim(),filter:"files"}:e.startsWith("?")?{needle:e.slice(1).trim(),filter:"docs"}:{needle:e,filter:"all"}}async query(e,t=QL){let{needle:r,filter:i}=this.parseQuery(e);if(!r)return[];let s=[],o=[];i==="docs"?o.push(this.docsSource):i==="files"?o.push(this.projectSource):i==="symbols"?(o.push(this.projectSource),o.push(this.toolchainSource)):(o.push(this.projectSource),o.push(this.toolchainSource),o.push(this.docsSource));for(let d of o)try{await d.ready();let h=await d.query(r,t-s.length);s.push(...h)}catch(h){console.debug("Search source error:",h)}s.sort((d,h)=>h.score-d.score);let a={project:1.3,toolchain:1,docs:.7};for(let d of s){let h=a[d.record.source]||1;d.score*=h}s.sort((d,h)=>h.score-d.score);let l=new Set;return s.filter(d=>l.has(d.record.id)?!1:(l.add(d.record.id),!0)).slice(0,t)}},K1=zg.getInstance();var J1=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n,os=class{constructor(e,t,r=0,i=e.length,s,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,i),this.bufferStart=r,this.normalize=s?a=>s(J1(a)):J1,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ir(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Hc(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Yi(e);let i=this.normalize(t);if(i.length)for(let s=0,o=r,a=!0;;s++){let l=i.charCodeAt(s),c=this.match(l,o,a,this.bufferPos+this.bufferStart,s==i.length-1);if(c)return this.value=c,this;if(s==i.length-1)break;a&&s<t.length&&t.charCodeAt(s)==l?o++:a=!1}}}match(e,t,r,i,s){let o=null;for(let a=0;a<this.matches.length;){let l=this.matches[a],c=!1;this.query.charCodeAt(l.index)==e&&(l.index==this.query.length-1?o={from:l.from,to:i,precise:s&&l.precise}:(l.index++,c=!0)),c?a++:this.matches.splice(a,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?o={from:t,to:i,precise:r&&s}:this.matches.push({from:t,index:1,precise:r})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null)
Line truncated
|
|
|
|
|
`:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Bg(this):new Ng(this)}getCursor(e,t=0,r){let i=e.doc?e:Me.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?aa(this,i,t,r):oa(this,i,t,r)}},_h=class{constructor(e){this.spec=e}};function IL(n,e,t){return(r,i,s,o)=>{if(t&&!t(r,i,s,o))return!1;let a=r>=o&&i<=o+s.length?s.slice(r-o,i-o):e.doc.sliceString(r,i);return n(a,e,r,i)}}function oa(n,e,t,r){let i;return n.wholeWord&&(i=XL(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(i=IL(n.test,e,i)),new os(e.doc,n.unquoted,t,r,n.caseSensitive?void 0:s=>s.toLowerCase(),i)}function XL(n,e){return(t,r,i,s)=>((s>t||s+i.length<r)&&(s=Math.max(0,t-2),i=n.sliceString(s,Math.min(n.length,r+2))),(e(Eh(i,t-s))!=et.Word||e(Rh(i,t-s))!=et.Word)&&(e(Rh(i,r-s))!=et.Word||e(Eh(i,r-s))!=et.Word))}var Ng=class extends _h{constructor(e){super(e)}nextMatch(e,t,r){let i=oa(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let s=Math.min(e.doc.length,t+this.spec.unquoted.length);i=oa(this.spec,e,0,s).nextOverlapping()}return i.done||i.value.from==t&&i.value.to==r?null:i.value}prevMatchInRange(e,t,r){for(let i=r;;){let s=Math.max(t,i-1e4-this.spec.unquoted.length),o=oa(this.spec,e,s,i),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==t)return null;i-=1e4}}prevMatch(e,t,r){let i=this.prevMatchInRange(e,0,t);return i||(i=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=t||i.to!=r)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let r=oa(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let s=oa(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}};function zL(n,e,t){return(r,i,s)=>(!t||t(r,i,s))&&n(s[0],e,r,i)}function aa(n,e,t,r){let i;return n.wholeWord&&(i=WL(e.charCategorizer(e.selection.main.head))),n.test&&(i=zL(n.test,e,i)),new $h(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:i},t,r)}function Eh(n,e){return n.slice(Pt(n,e,!1),e)}function Rh(n,e){return n.slice(e,Pt(n,e))}function WL(n){return(e,t,r)=>!r[0].length||(n(Eh(r.input,r.index))!=et.Word||n(Rh(r.input,r.index))!=et.Word)&&(n(Rh(r.input,r.index+r[0].length))!=et.Word||n(Eh(r.input,r.index+r[0].length))!=et.Word)}var Bg=class extends _h{nextMatch(e,t,r){let i=aa(this.spec,e,r,e.doc.length).next();return i.done&&(i=aa(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,r){for(let i=1;;i++){let s=Math.max(t,r-i*1e4),o=aa(this.spec,e,s,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(s==t||a.from>s+10))return a;if(s==t)return null}}prevMatch(e,t,r){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let i=r.length;i>0;i--){let s=+r.slice(0,i);if(s>0&&s<e.match.length)return e.match[s]+r.slice(i)}return t})}matchAll(e,t){let r=aa(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let s=aa(this.spec,e,Math.max(0,t-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}},Rl=ye.define(),Gg=ye.define(),ss=Xe.define({create(n){return new El(Vg(n).create(),null)},update(n,e){for(let t of e.effects)t.is(Rl)?n=new El(t.value.create(),n.panel):t.is(Gg)&&(n=new El(n.query,t.value?Hg:null));return n},provide:n=>hl.from(n,e=>e.panel)});var El=class{constructor(e,t){this.query=e,this.panel=t}},NL=K.mark({class:"cm-searchMatch"}),BL=K.mark({class:"cm-searchMatch cm-searchMatch-selected"}),VL=it.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(ss))}update(n){let e=n.state.field(ss);(e!=n.startState.field(ss)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return K.none;let{view:t}=this,r=new Zr;for(let i=0,s=t.visibleRanges,o=s.length;i<o;i++){let{from:a,to:l}=s[i];for(;i<o-1&&l>s[i+1].from-500;)l=s[++i].to;n.highlight(t.state,a,l,(c,d)=>{let h=t.state.selection.ranges.some(u=>u.from==c&&u.to==d);r.add(c,d,h?BL:NL)})}return r.finish()}},{decorations:n=>n.decorations});function Ml(n){return e=>{let t=e.state.field(ss,!1);return t&&t.query.spec.valid?n(e,t):Dh(e)}}var la=Ml((n,{query:e})=>{let{to:t}=n.state.selection.main,r=e.nextMatch(n.state,t,t);if(!r)return!1;let i=z.single(r.from,r.to),s=n.state.facet(ro);return n.dispatch({selection:i,effects:[Kg(n,r),s.scrollToMatch(i.main,n)],userEvent:"select.search"}),sP(n),!0}),Mh=Ml((n,{query:e})=>{let{state:t}=n,{from:r}=t.selection.main,i=e.prevMatch(t,r,r);if(!i)
Line truncated
|
|
|
|
|
`+t.scrub(),s=this.advance(i);return s>-1&&s<i.length?this.complete(e,r,s):!1}finish(e,t){return(this.stage==2||this.stage==3)&&Zl(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,r){return e.addLeafElement(t,Ne(ee.LinkReference,this.start,this.start+r,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(bk(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(Ne(ee.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(gk(e,Zl(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=Zl(e,this.pos),r=0;if(t>this.pos){let i=Ok(e,t,this.start);if(i){let s=MO(e,i.to-this.start);s>0&&(this.nextStage(i),r=s)}}return r||(r=MO(e,this.pos)),r>0&&r<e.length?r:-1}else return MO(e,this.pos)}}};function MO(n,e){for(;e<n.length;e++){let t=n.charCodeAt(e);if(t==10)break;if(!wr(t))return-1}return e}var WO=class{nextLine(e,t,r){let i=t.depth<e.stack.length?-1:ak(t),s=t.next;if(i<0)return!1;let o=Ne(ee.HeaderMark,e.lineStart+t.pos,e.lineStart+i);return e.nextLine(),e.addLeafElement(r,Ne(s==61?ee.SetextHeading1:ee.SetextHeading2,r.start,e.prevLineEnd(),[...e.parser.parseInline(r.content,r.start),o])),!0}finish(){return!1}},hk={LinkReference(n,e){return e.content.charCodeAt(0)==91?new zO(e):null},SetextHeading(){return new WO}},dZ=[(n,e)=>ok(e)>=0,(n,e)=>rk(e)>=0,(n,e)=>ik(e)>=0,(n,e)=>UO(e,n,!0)>=0,(n,e)=>qO(e,n,!0)>=0,(n,e)=>jO(e,n,!0)>=0,(n,e)=>dk(e,n,!0)>=0],hZ={text:"",end:0},NO=class{constructor(e,t,r,i){this.parser=e,this.input=t,this.ranges=i,this.line=new ZO,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=i[i.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=i[0].from,this.block=Nh.create(ee.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=r.length?new FO(r,t):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let r=0;;){let i=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;r<e.markers.length&&(!i||e.markers[r].from<i.end);){let s=e.markers[r++];this.addNode(s.type,s.from,s.to)}if(!i)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let r of this.parser.blockParsers)if(r){let i=r(this,e);if(i!=!1){if(i==!0)return null;e.forward();continue e}}break}if(e.pos==e.text.length)return this.nextLine()?null:this.finish();let t=new DO(this.lineStart+e.pos,e.text.slice(e.pos));for(let r of this.parser.leafBlockParsers)if(r){let i=r(this,t);i&&t.parsers.push(i)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let r of this.parser.endLeafBlock)if(r(this,e,t))break e}for(let r of t.parsers)if(r.nextLine(this,e,t))return null;t.content+=`
|
|
|
|
|
`+e.scrub();for(let r of e.markers)t.marks.push(r)}return this.finishLeaf(t),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return t?(this.absoluteLineStart+=t,this.lineStart=yk(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=hZ;if(t.end=e,e>=this.to)t.text="";else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let r=this.absoluteLineStart,i=this.rangeI;for(;this.ranges[i].to<t.end;){i++;let s=this.ranges[i].from,o=this.lineChunkAt(s);t.end=s+o.length,t.text=t.text.slice(0,this.ranges[i-1].to-r)+o,r=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:r}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=r,e.reset(t);e.depth<this.stack.length;e.depth++){let i=this.stack[e.depth],s=this.parser.skipContextMarkup[i.type];if(!s)throw new Error("Unhandled block context "+ee[i.type]);let o=this.line.markers.length;if(!s(i,this,e)){this.line.markers.length>o&&(i.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),r;if(this.input.lineChunks)r=t==`
|
|
|
|
|
Connect your audio output to the SuperCharger input, turn up the volume, and play the audio file.`,an(e)}})})}function yL(n){var e=Zt(_t());let t=e+".tap",r=new eo(e),i=new Sh({sine_wave:!0}),s=wn(),o=s[0]+s[1]*256;s=s.slice(2),r.setContent({data:s,startAddress:o,type:eo.FILE_TYPE_NON_RELOCATABLE}),r.generateSound(i);let a=i.getTAPData();if(a){let l=new Blob([a],{type:"application/octet-stream"});(0,si.saveAs)(l,t)}}function Lg(){switch(Nt(Oe)){case"vcs":return bL;case"apple2":return OL;case"c64":return yL}}function _1(n){if(wn()==null)return Re("Please fix errors before exporting."),!0;var e=Lg();if(e===void 0)return Re("Cassette export is not supported on this platform."),!0;e(n)}function E1(n){if(wn()==null)return Re("Please finish compiling with no errors before downloading ROM."),!0;var e=Zt(_t());if(P.getDownloadFile){var t=P.getDownloadFile(),e=Zt(_t());(0,si.saveAs)(t.blob,e+t.extension)}else if(wn()instanceof Uint8Array){var r=new Blob([wn()],{type:"application/octet-stream"}),i=P.getROMExtension&&P.getROMExtension(wn())||"-"+Nt(Oe)+".bin";(0,si.saveAs)(r,e+i)}else Re(`The "${Oe}" platform doesn't have downloadable ROMs.`)}function R1(n){var e=N.getCurrentText();if(!e)return!1;var t=new Blob([e],{type:"text/plain;charset=utf-8"});(0,si.saveAs)(t,X1(),{autoBom:!1})}async function M1(){let n=(await import("./jszip.min-QUGS7P6D.js")).default;return new n}async function L1(n){var e=await M1();Ci().iterateFiles((t,r)=>{r&&e.file(yt(t),r)}),e.generateAsync({type:"blob"}).then(t=>{(0,si.saveAs)(t,_t()+"-"+Nt(Oe)+".zip")})}function D1(n){let e=P.getDebugSymbolFile&&P.getDebugSymbolFile();if(!e){Re("This project does not have debug information.");return}var t=Zt(_t());(0,si.saveAs)(e.blob,t+e.extension,{autoBom:!1})}async function Z1(n){var e=await M1(),t=await is().keys();Je(!0);try{var r=0;await Promise.all(t.map(s=>is().getItem(s).then(o=>{Dr(r++/(t.length+1)),o&&e.file(s,o)})));var i=await e.generateAsync({type:"blob"});(0,si.saveAs)(i,Nt(Oe)+"-all.zip")}finally{Je(!1)}}var Mg=!1;function I1(){Mg||hr("lib/gif.js").then(()=>{var n=$("#emulator").find("canvas")[0];if(!n){Re("Could not find canvas element to record video!");return}var e=0;n.style&&n.style.transform&&(n.style.transform.indexOf("rotate(-90deg)")>=0?e=-1:n.style.transform.indexOf("rotate(90deg)")>=0&&(e=1));var t=new GIF({workerScript:"lib/gif.worker.js",workers:4,quality:10,rotate:e}),r=$("#videoPreviewImage");t.on("progress",l=>{Dr(l)}),t.on("finished",l=>{r.attr("src",URL.createObjectURL(l)),Je(!1),P.resume(),$("#videoPreviewModal").modal("show")});var i=20,s=300,o=0;console.log("Recording video",n),$("#emulator").css("backgroundColor","#cc3333");var a=()=>{o++>s?(console.log("Rendering video"),$("#emulator").css("backgroundColor","inherit"),Je(!0),P.pause(),t.render(),Mg=!1):(t.addFrame(n,{delay:i,copy:!0}),setTimeout(a,i),Mg=!0)};a()})}var Dg;async function to(){if(!Dg){await hr("lib/octokat.js"),await hr("https://www.gstatic.com/firebasejs/8.8.1/firebase-app.js"),await hr("https://www.gstatic.com/firebasejs/8.8.1/firebase-auth.js"),await hr("https://8bitworkshop.com/config.js");var n=E0("__github_key");Dg=new yh(Octokat,n,is(),Ci()),console.log("loaded github service")}return Dg}function Al(){var n=(Et||"").split("/");return n.length!=2?(Re("You are not in a GitHub repository. Choose one from the pulldown, or Import or Publish one."),null):"https://github.com/"+n[0]+"/"+n[1]}async function Cl(n,e){var t,r=Ql(n);if(!r){Re("Could not parse GitHub URL.");return}var i=Js()[r.repopath];if(!(i&&!confirm("You've already imported "+r.repopath+" -- do you want to replace all local files?"))){Je(!0);var s=bh(r.repopath);Dr(.25);var o=await to();return o.import(n).then(a=>(t=a,Dr(.75),o.pull(n,s))).then(a=>{Je(!1),no(e,{repo:r.repopath})}).catch(a=>{Je(!1),console.log(a),Re("Could not import "+n+". "+a)})}}async function z1(n){var e=await to();e.login().then(()=>{an("You are signed in to GitHub.")}).catch(t=>{Re("Could not sign in."+t)})}async function W1(n){var e=await to();e.logout().then(()=>{an("You are logged out of GitHub.")})}function N1(n){var e=$("#importGithubModal"),t=$("#importGithubButton");e.modal("show"),e.off("shown.bs.modal").on("shown.bs.modal",()=>$("#importGithubURL").trigger("focus")),$("#importGithubURL").off("keydown").on("keydown",r=>{r.key==="Enter"&&(r.preventDefault(),t.trigger("click"))}),t.off("click").on("click",()=>{var r=$("#importGithubURL").val()+"";e.modal("hide"),Cl(r,!1)})}function B1(n){if(!(Et&&!confirm("This project ("+Ci().mainPath+") is already bound to a GitHub repository. Do you want to re-publish to a new repository? (You can instead choose 'Push Changes' to update files in the existing repository.)"))){var e=$("#publishGithubModal"),t=$("#publishGithubButton");$("#githubRepoName").val(Zt(yt(Ci().mainPath))),e.modal("show"),t.off("click").on("click",async()=>{var r=$("#githubRepoName").val()+"",i=$("#githubRepoDesc").val()+"",s=$("#githubRepoPrivate").val()=="private",o=$("#githubRepoLicense").val()+""Line truncated
|
|
|
|
|
`);for(let o=0;o<s.length;o++){let a=s[o],l=o+1,c=a.match(/(?:function|func|def|proc)\s+(\w+)/i);c&&i.push({id:`${e}:${l}:${c[1]}`,name:c[1],kind:"func",source:r,file:e,line:l});let d=a.match(/(?:var|let|const|global)\s+(\w+)/i);d&&i.push({id:`${e}:${l}:${d[1]}`,name:d[1],kind:"var",source:r,file:e,line:l});let h=a.match(/(?:struct|class|interface|type)\s+(\w+)/i);h&&i.push({id:`${e}:${l}:${h[1]}`,name:h[1],kind:"type",source:r,file:e,line:l});let u=a.match(/^\s*(\w+)\s*:/);u&&!a.trim().startsWith("//")&&i.push({id:`${e}:${l}:${u[1]}`,name:u[1],kind:"label",source:r,file:e,line:l});let f=a.match(/#define\s+(\w+)/i);f&&i.push({id:`${e}:${l}:${f[1]}`,name:f[1],kind:"macro",source:r,file:e,line:l});let m=a.match(/^\s*(\w+)\s*(?:=|equ)\s+/i);m&&i.push({id:`${e}:${l}:${m[1]}`,name:m[1],kind:"equate",source:r,file:e,line:l})}return i}var G1=()=>null;function H1(n){G1=n}function sa(){return G1()}var vh=class{constructor(){this.id="project";this.kind="project";this.rebuilt=!1;this.index=new ia([])}async ready(){await this.index.init(),this.rebuilt||(this.rebuilt=!0,await this.rebuild())}query(e,t){let r=this.index.query(e,t),i=this.fulltextQuery(e,t),s=r.concat(i);return s.sort((o,a)=>a.score-o.score),s.slice(0,t)}fulltextQuery(e,t){if(e.length<2)return[];let r=e.toLowerCase(),i=[],s=Math.max(t,10),o=sa();return o?(o.iterateFiles((a,l)=>{if(typeof l!="string")return;let c=l.split(`
|
|
|
|
|
`),d=0;for(let h=0;h<c.length;h++){let u=c[h],m=u.toLowerCase().indexOf(r);if(m>=0){let O=u.trim();if(!O)continue;if(i.push({record:{id:`text:${a}:${h+1}`,name:O.length>80?O.slice(0,80)+"\u2026":O,kind:"text",source:"project",file:a,line:h+1},score:200+Math.max(0,100-m*2),ranges:[m,m+e.length]}),++d>=s)break}}}),i):[]}async onFileChanged(e,t){let r=this.extractSymbolsFromFile(e,t,"project");this.index.pushRecords(r)}extractSymbolsFromFile(e,t,r){if(typeof t!="string")return[];let i=this.detectEditorStyle(e);return Ig(t,e,i,r)}detectEditorStyle(e){var r;switch((r=e.split(".").pop())==null?void 0:r.toLowerCase()){case"c":case"h":return"text/x-csrc";case"asm":case"a65":case"inc":return"6502";case"v":return"verilog";case"wiz":return"text/x-wiz";case"bas":case"basic":return"basic";case"fb":case"fastbasic":return"fastbasic";case"bac":case"bataribasic":return"bataribasic";case"i":return"inform6";case"d":return"dialog";default:return"text/x-csrc"}}async rebuild(){this.index.clear(),await this.index.init();let e=sa();if(!e)return;let t=[];e.iterateFiles((r,i)=>{if(typeof i!="string")return;let s=this.detectEditorStyle(r),o=Ig(i,r,s,"project");t.push(...o)}),this.index.pushRecords(t)}};var PL=new Set(["h","hh","hpp","inc","asm","a65","s","mac","defs","def","equ","i","m","c","bas","txt"]),kL=20,wh=class{constructor(){this.id="toolchain";this.kind="toolchain";this.fsName=null;this.files=[];this.loaded=new Map;this.readyPromise=null;this.batchSize=kL}async ready(){return this.readyPromise||(this.readyPromise=this.load()),this.readyPromise}async load(){let e=sa();if(!e)return;let t;try{t=e.getToolForFilename?e.getToolForFilename(e.mainPath):""}catch(o){t=""}let r=Ic(t,e.platform_id),i=Zc(t,e.platform_id);if(!r||!i.length)return;this.fsName=r;let s=new Set;for(let o of i){let a=await this.listFiles(o);for(let l of a)this.isSearchable(l)&&!s.has(l)&&(s.add(l),this.files.push(l))}this.files.sort();for(let o=0;o<this.files.length;o+=this.batchSize){let a=this.files.slice(o,o+this.batchSize),l=await Promise.all(a.map(async c=>{let d=await this.readFile(c);return[c,d]}));for(let[c,d]of l)d!=null&&this.loaded.set(c,d)}}isValid(){return this.fsName!=null&&this.files.length>0}async listFiles(e){let t=sa();if(!t||!this.fsName||!t.queryWorker)return[];try{let r={preload_fs:this.fsName,listshared:e,updates:[],buildsteps:[]},i=await t.queryWorker(r),s=i&&i.output;return Array.isArray(s)?s:[]}catch(r){return console.debug("Toolchain list error:",r),[]}}async readFile(e){let t=sa();if(!t||!this.fsName||!t.queryWorker)return null;try{let r={preload_fs:this.fsName,readshared:e,updates:[],buildsteps:[]},i=await t.queryWorker(r),s=i&&i.output;return s instanceof Uint8Array&&s.length>0?new TextDecoder().decode(s):null}catch(r){return console.debug("Toolchain read error:",r),null}}isSearchable(e){let t=e.split("/").pop()||e,r=t.lastIndexOf(".");return r<0?!0:PL.has(t.substring(r+1).toLowerCase())}async query(e,t){return await this.ready(),!this.isValid()||e.length<2?[]:this.textQuery(e,t)}textQuery(e,t){if(e.length<2)return[];let r=e.toLowerCase(),i=[],s=Math.max(t,5);for(let[o,a]of this.loaded){let l=a.split(`
|
|
|
|
|
`),c=0;for(let d=0;d<l.length;d++){let h=l[d],f=h.toLowerCase().indexOf(r);if(f>=0){let m=h.trim();if(!m)continue;if(i.push({record:{id:`toolchain:${o}:${d+1}`,name:m.length>80?m.slice(0,80)+"\u2026":m,kind:"text",source:"toolchain",file:o,line:d+1},score:200+Math.max(0,100-f*2),ranges:[f,f+e.length]}),++c>=s)break}}}return i.sort((o,a)=>a.score-o.score),i.slice(0,t)}invalidate(){this.fsName=null,this.files=[],this.loaded.clear(),this.readyPromise=null}};var K1=()=>[];function J1(n){K1=n}var $L=/<h([1-3])\b[^>]*>([\s\S]*?)<\/h\1>/gi;function QL(n){return n.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&#(?:0*39|x27);/gi,"'").replace(/ /g," ").replace(/…/g,"\u2026").replace(/—/g,"\u2014").replace(/–/g,"\u2013").replace(/’|‘/g,"'").replace(/”|“/g,'"').replace(/»/g,"\xBB").replace(/«/g,"\xAB").replace(/&/g,"&")}function _l(n){return QL(n.replace(/<[^>]+>/g," ")).replace(/\s+/g," ").trim()}function Xg(n,e=180){let t=n.trim();if(!t)return;let i=t.slice(0,e).match(/^([\s\S]*?[.!?])(?:\s|$)/);return i?i[1]:t.length<=e?t:t.slice(0,e-1)+"\u2026"}function TL(n){let e=[],t="#help/"+n.id,r=n.title||n.id,i=n.html||"",s=[],o=new RegExp($L.source,"gi"),a;for(;a=o.exec(i);)s.push({name:_l(a[2]),start:a.index,end:o.lastIndex});let l=(u,f,m)=>{if(!f)return;let O=Xg(m),S=O&&m.startsWith(O)?m.slice(O.length).trim():m;e.push({id:`${n.id}:${u}`,name:f,kind:"doc",brief:O,detail:S||void 0,source:"docs",file:r,url:t})},c=s.length?s[0].start:i.length,d=_l(i.slice(0,c)),h=s.length&&s[0].start===0?s[0].name||n.title:n.title||n.id;l(0,h,d);for(let u=0;u<s.length;u++){if(u===0&&s[0].start===0)continue;let f=u+1<s.length?s[u+1].start:i.length;l(u+1,s[u].name,_l(i.slice(s[u].end,f)))}return e}var xh=class{constructor(){this.id="docs";this.kind="docs";this.index=null;this.readyPromise=null}async ready(){return this.readyPromise?this.readyPromise:(this.readyPromise=this.load(),this.readyPromise)}async load(){let e=K1()||[];if(e.length===0)return;let t=[];for(let i of e)t.push(...TL(i));if(t.length===0)return;let r=new ia(t);await r.init(),this.index=r}async query(e,t){return await this.ready(),this.index?this.index.query(e,t):[]}};var AL=50,zg=class n{constructor(){this.sources=new Map;this.projectSource=new vh,this.toolchainSource=new wh,this.docsSource=new xh,this.sources.set("project",this.projectSource),this.sources.set("toolchain",this.toolchainSource),this.sources.set("docs",this.docsSource)}static getInstance(){return n.instance||(n.instance=new n),n.instance}parseQuery(e){return e.startsWith("#")?{needle:e.slice(1).trim(),filter:"symbols"}:e.startsWith(">")?{needle:e.slice(1).trim(),filter:"files"}:e.startsWith("?")?{needle:e.slice(1).trim(),filter:"docs"}:{needle:e,filter:"all"}}async query(e,t=AL){let{needle:r,filter:i}=this.parseQuery(e);if(!r)return[];let s=[],o=[];i==="docs"?o.push(this.docsSource):i==="files"?o.push(this.projectSource):i==="symbols"?(o.push(this.projectSource),o.push(this.toolchainSource)):(o.push(this.projectSource),o.push(this.toolchainSource),o.push(this.docsSource));for(let d of o)try{await d.ready();let h=await d.query(r,t-s.length);s.push(...h)}catch(h){console.debug("Search source error:",h)}s.sort((d,h)=>h.score-d.score);let a={project:1.3,toolchain:1,docs:.7};for(let d of s){let h=a[d.record.source]||1;d.score*=h}s.sort((d,h)=>h.score-d.score);let l=new Set;return s.filter(d=>l.has(d.record.id)?!1:(l.add(d.record.id),!0)).slice(0,t)}},eP=zg.getInstance();var tP=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n,os=class{constructor(e,t,r=0,i=e.length,s,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,i),this.bufferStart=r,this.normalize=s?a=>s(tP(a)):tP,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ir(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Hc(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Yi(e);let i=this.normalize(t);if(i.length)for(let s=0,o=r,a=!0;;s++){let l=i.charCodeAt(s),c=this.match(l,o,a,this.bufferPos+this.bufferStart,s==i.length-1);if(c)return this.value=c,this;if(s==i.length-1)break;a&&s<t.length&&t.charCodeAt(s)==l?o++:a=!1}}}match(e,t,r,i,s){let o=null;for(let a=0;a<this.matches.length;){let l=this.matches[a],c=!1;this.query.charCodeAt(l.index)==e&&(l.index==this.query.length-1?o={from:l.from,to:i,precise:s&&l.precise}:(l.index++,c=!0)),c?a++:this.matches.splice(a,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?o={from:t,to:i,precise:r&&s}:this.matches.push({from:t,index:1,precise:r})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null)
Line truncated
|
|
|
|
|
`:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Bg(this):new Ng(this)}getCursor(e,t=0,r){let i=e.doc?e:Me.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?aa(this,i,t,r):oa(this,i,t,r)}},_h=class{constructor(e){this.spec=e}};function zL(n,e,t){return(r,i,s,o)=>{if(t&&!t(r,i,s,o))return!1;let a=r>=o&&i<=o+s.length?s.slice(r-o,i-o):e.doc.sliceString(r,i);return n(a,e,r,i)}}function oa(n,e,t,r){let i;return n.wholeWord&&(i=WL(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(i=zL(n.test,e,i)),new os(e.doc,n.unquoted,t,r,n.caseSensitive?void 0:s=>s.toLowerCase(),i)}function WL(n,e){return(t,r,i,s)=>((s>t||s+i.length<r)&&(s=Math.max(0,t-2),i=n.sliceString(s,Math.min(n.length,r+2))),(e(Eh(i,t-s))!=et.Word||e(Rh(i,t-s))!=et.Word)&&(e(Rh(i,r-s))!=et.Word||e(Eh(i,r-s))!=et.Word))}var Ng=class extends _h{constructor(e){super(e)}nextMatch(e,t,r){let i=oa(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let s=Math.min(e.doc.length,t+this.spec.unquoted.length);i=oa(this.spec,e,0,s).nextOverlapping()}return i.done||i.value.from==t&&i.value.to==r?null:i.value}prevMatchInRange(e,t,r){for(let i=r;;){let s=Math.max(t,i-1e4-this.spec.unquoted.length),o=oa(this.spec,e,s,i),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==t)return null;i-=1e4}}prevMatch(e,t,r){let i=this.prevMatchInRange(e,0,t);return i||(i=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=t||i.to!=r)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let r=oa(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let s=oa(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}};function NL(n,e,t){return(r,i,s)=>(!t||t(r,i,s))&&n(s[0],e,r,i)}function aa(n,e,t,r){let i;return n.wholeWord&&(i=BL(e.charCategorizer(e.selection.main.head))),n.test&&(i=NL(n.test,e,i)),new $h(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:i},t,r)}function Eh(n,e){return n.slice(Pt(n,e,!1),e)}function Rh(n,e){return n.slice(e,Pt(n,e))}function BL(n){return(e,t,r)=>!r[0].length||(n(Eh(r.input,r.index))!=et.Word||n(Rh(r.input,r.index))!=et.Word)&&(n(Rh(r.input,r.index+r[0].length))!=et.Word||n(Eh(r.input,r.index+r[0].length))!=et.Word)}var Bg=class extends _h{nextMatch(e,t,r){let i=aa(this.spec,e,r,e.doc.length).next();return i.done&&(i=aa(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,r){for(let i=1;;i++){let s=Math.max(t,r-i*1e4),o=aa(this.spec,e,s,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(s==t||a.from>s+10))return a;if(s==t)return null}}prevMatch(e,t,r){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let i=r.length;i>0;i--){let s=+r.slice(0,i);if(s>0&&s<e.match.length)return e.match[s]+r.slice(i)}return t})}matchAll(e,t){let r=aa(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let s=aa(this.spec,e,Math.max(0,t-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}},Rl=ye.define(),Gg=ye.define(),ss=Xe.define({create(n){return new El(Vg(n).create(),null)},update(n,e){for(let t of e.effects)t.is(Rl)?n=new El(t.value.create(),n.panel):t.is(Gg)&&(n=new El(n.query,t.value?Hg:null));return n},provide:n=>hl.from(n,e=>e.panel)});var El=class{constructor(e,t){this.query=e,this.panel=t}},VL=K.mark({class:"cm-searchMatch"}),FL=K.mark({class:"cm-searchMatch cm-searchMatch-selected"}),YL=it.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(ss))}update(n){let e=n.state.field(ss);(e!=n.startState.field(ss)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return K.none;let{view:t}=this,r=new Zr;for(let i=0,s=t.visibleRanges,o=s.length;i<o;i++){let{from:a,to:l}=s[i];for(;i<o-1&&l>s[i+1].from-500;)l=s[++i].to;n.highlight(t.state,a,l,(c,d)=>{let h=t.state.selection.ranges.some(u=>u.from==c&&u.to==d);r.add(c,d,h?FL:VL)})}return r.finish()}},{decorations:n=>n.decorations});function Ml(n){return e=>{let t=e.state.field(ss,!1);return t&&t.query.spec.valid?n(e,t):Dh(e)}}var la=Ml((n,{query:e})=>{let{to:t}=n.state.selection.main,r=e.nextMatch(n.state,t,t);if(!r)return!1;let i=z.single(r.from,r.to),s=n.state.facet(ro);return n.dispatch({selection:i,effects:[Kg(n,r),s.scrollToMatch(i.main,n)],userEvent:"select.search"}),aP(n),!0}),Mh=Ml((n,{query:e})=>{let{state:t}=n,{from:r}=t.selection.main,i=e.prevMatch(t,r,r);if(!i)
Line truncated
|
|
|
|
|
`+t.scrub(),s=this.advance(i);return s>-1&&s<i.length?this.complete(e,r,s):!1}finish(e,t){return(this.stage==2||this.stage==3)&&Zl(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,r){return e.addLeafElement(t,Ne(ee.LinkReference,this.start,this.start+r,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(Sk(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(Ne(ee.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(bk(e,Zl(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=Zl(e,this.pos),r=0;if(t>this.pos){let i=yk(e,t,this.start);if(i){let s=MO(e,i.to-this.start);s>0&&(this.nextStage(i),r=s)}}return r||(r=MO(e,this.pos)),r>0&&r<e.length?r:-1}else return MO(e,this.pos)}}};function MO(n,e){for(;e<n.length;e++){let t=n.charCodeAt(e);if(t==10)break;if(!wr(t))return-1}return e}var WO=class{nextLine(e,t,r){let i=t.depth<e.stack.length?-1:ck(t),s=t.next;if(i<0)return!1;let o=Ne(ee.HeaderMark,e.lineStart+t.pos,e.lineStart+i);return e.nextLine(),e.addLeafElement(r,Ne(s==61?ee.SetextHeading1:ee.SetextHeading2,r.start,e.prevLineEnd(),[...e.parser.parseInline(r.content,r.start),o])),!0}finish(){return!1}},fk={LinkReference(n,e){return e.content.charCodeAt(0)==91?new zO(e):null},SetextHeading(){return new WO}},uZ=[(n,e)=>lk(e)>=0,(n,e)=>sk(e)>=0,(n,e)=>ok(e)>=0,(n,e)=>UO(e,n,!0)>=0,(n,e)=>qO(e,n,!0)>=0,(n,e)=>jO(e,n,!0)>=0,(n,e)=>uk(e,n,!0)>=0],fZ={text:"",end:0},NO=class{constructor(e,t,r,i){this.parser=e,this.input=t,this.ranges=i,this.line=new ZO,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=i[i.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=i[0].from,this.block=Nh.create(ee.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=r.length?new FO(r,t):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let r=0;;){let i=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;r<e.markers.length&&(!i||e.markers[r].from<i.end);){let s=e.markers[r++];this.addNode(s.type,s.from,s.to)}if(!i)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let r of this.parser.blockParsers)if(r){let i=r(this,e);if(i!=!1){if(i==!0)return null;e.forward();continue e}}break}if(e.pos==e.text.length)return this.nextLine()?null:this.finish();let t=new DO(this.lineStart+e.pos,e.text.slice(e.pos));for(let r of this.parser.leafBlockParsers)if(r){let i=r(this,t);i&&t.parsers.push(i)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let r of this.parser.endLeafBlock)if(r(this,e,t))break e}for(let r of t.parsers)if(r.nextLine(this,e,t))return null;t.content+=`
|
|
|
|
|
`+e.scrub();for(let r of e.markers)t.marks.push(r)}return this.finishLeaf(t),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return t?(this.absoluteLineStart+=t,this.lineStart=vk(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=fZ;if(t.end=e,e>=this.to)t.text="";else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let r=this.absoluteLineStart,i=this.rangeI;for(;this.ranges[i].to<t.end;){i++;let s=this.ranges[i].from,o=this.lineChunkAt(s);t.end=s+o.length,t.text=t.text.slice(0,this.ranges[i-1].to-r)+o,r=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:r}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=r,e.reset(t);e.depth<this.stack.length;e.depth++){let i=this.stack[e.depth],s=this.parser.skipContextMarkup[i.type];if(!s)throw new Error("Unhandled block context "+ee[i.type]);let o=this.line.markers.length;if(!s(i,this,e)){this.line.markers.length>o&&(i.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),r;if(this.input.lineChunks)r=t==`
|
|
|
|
|
`?"":t;else{let i=t.indexOf(`
|
|
|
|
|
`);r=i<0?t:t.slice(0,i)}return e+r.length>this.to?r.slice(0,this.to-e):r}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,r=0){this.block=Nh.create(e,r,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,r=0){this.startContext(this.parser.getNodeType(e),t,r)}addNode(e,t,r){typeof e=="number"&&(e=new Ee(this.parser.nodeSet.types[e],ha,ha,(r!=null?r:this.prevLineEnd())-t)),this.block.addChild(e,t-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,t){this.addNode(this.buffer.writeElements(VO(t.children,e.marks),-t.from).finish(t.type,t.to-t.from),t.from)}finishContext(){let e=this.stack.pop(),t=this.stack[this.stack.length-1];t.addChild(e.toTree(this.parser.nodeSet),e.from-t.from),this.block=t}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?uk(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let r of e.parsers)if(r.finish(this,e))return;let t=VO(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(ee.Paragraph,e.content.length),e.start)}elt(e,t,r,i){return typeof e=="string"?Ne(this.parser.getNodeType(e),t,r,i):new Vh(e,t)}get buffer(){return new Bh(this.parser.nodeSet)}};function uk(n,e,t,r,i){let s=n[e].to,o=[],a=[],l=t.from+r;function c(d,h){for(;h?d>=s:d>s;){let u=n[e+1].from-s;r+=u,d+=u,e++,s=n[e].to}}for(let d=t.firstChild;d;d=d.nextSibling){c(d.from+r,!0);let h=d.from+r,u,f=i.get(d.tree);f?u=f:d.to+r>s?(u=uk(n,e,d,r,i),c(d.to+r,!1)):u=d.toTree(),o.push(u),a.push(h-l)}return c(t.to+r,!1),new Ee(t.type,o,a,t.to+r-l,t.tree?t.tree.propValues:void 0)}var Xl=class n extends Ti{constructor(e,t,r,i,s,o,a,l,c){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=r,this.blockNames=i,this.endLeafBlock=s,this.skipContextMarkup=o,this.inlineParsers=a,this.inlineNames=l,this.wrappers=c,this.nodeTypes=Object.create(null);for(let d of e.types)this.nodeTypes[d.name]=d.id}createParse(e,t,r){let i=new NO(this,e,t,r);for(let s of this.wrappers)i=s(i,e,t,r);return i}configure(e){let t=BO(e);if(!t)return this;let{nodeSet:r,skipContextMarkup:i}=this,s=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),a=this.blockNames.slice(),l=this.inlineParsers.slice(),c=this.inlineNames.slice(),d=this.endLeafBlock.slice(),h=this.wrappers;if(Dl(t.defineNodes)){i=Object.assign({},i);let u=r.types.slice(),f;for(let m of t.defineNodes){let{name:O,block:S,composite:x,style:D}=typeof m=="string"?{name:m}:m;if(u.some(k=>k.name==O))continue;x&&(i[u.length]=(k,w,R)=>x(w,R,k.value));let M=u.length,Z=x?["Block","BlockContext"]:S?M>=ee.ATXHeading1&&M<=ee.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;u.push(St.define({id:M,name:O,props:Z&&[[xe.group,Z]]})),D&&(f||(f={}),Array.isArray(D)||D instanceof qn?f[O]=D:Object.assign(f,D))}r=new $i(u),f&&(r=r.extend(Kt(f)))}if(Dl(t.props)&&(r=r.extend(...t.props)),Dl(t.remove))for(let u of t.remove){let f=this.blockNames.indexOf(u),m=this.inlineNames.indexOf(u);f>-1&&(s[f]=o[f]=void 0),m>-1&&(l[m]=void 0)}if(Dl(t.parseBlock))for(let u of t.parseBlock){let f=a.indexOf(u.name);if(f>-1)s[f]=u.parse,o[f]=u.leaf;else{let m=u.before?Wh(a,u.before):u.after?Wh(a,u.after)+1:a.length-1;s.splice(m,0,u.parse),o.splice(m,0,u.leaf),a.splice(m,0,u.name)}u.endLeaf&&d.push(u.endLeaf)}if(Dl(t.parseInline))for(let u of t.parseInline){let f=c.indexOf(u.name);if(f>-1)l[f]=u.parse;else{let m=u.before?Wh(c,u.before):u.after?Wh(c,u.after)+1:c.length-1;l.splice(m,0,u.parse),c.splice(m,0,u.name)}}return t.wrap&&(h=h.concat(t.wrap)),new n(r,s,o,a,d,i,l,c,h)}getNodeType(e){let t=this.nodeTypes[e];if(t==null)throw new RangeError(`Unknown node type '${e}'`);return t}parseInline(e,t){let r=new Wl(this,e,t);e:for(let i=t;i<r.end;){let s=r.char(i);for(let o of this.inlineParsers)if(o){let a=o(r,s,i);if(a>=0){i=a;continue e}}i++}return r.resolveMarkers(0)}};function Dl(n){return n!=null&&n.length>0}function BO(n){if(!Array.isArray(n))return n;if(n.length==0)return null;let e=BO(n[0]);if(n.length==1)return e;let t=BO(n.slice(1));if(!t||!e)return e||t;let r=(o,a)=>(o||ha).concat(a||ha),i=e.wrap,s=t.wrap;return{props:r(e.props,t.props),defineNodes:r(e.defineNodes,t.defineNodes),parseBlock:r(e.parseBlock,t.parseBlock),parseInline:r(e.parseInline,t.parseInline),remove:r(e.remove,t.remove),wrap:i?s?(o,a,l,c)=>i(s(o,a,l,c),a,l,c):i:s}}function Wh(n,e){let t=n.indexOf(e);if(t<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return t}var fk=[St.none];for(let n=1,e;e=ee[n];n++)fk[n]=St.define({id:n,name:e,props:n>=ee.Escape?[]:[[xe.group,n in nk?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});var ha=[],Bh=class{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e
Line truncated
|
|
|
|
|
`;)s--;this.fragmentEnd=s?s-1:0}let r=this.cursor;r||(r=this.cursor=this.fragment.tree.cursor(),r.firstChild());let i=e+this.fragment.offset;for(;r.to<=i;)if(!r.parent())return!1;for(;;){if(r.from>=i)return this.fragment.from<=t;if(!r.childAfter(i))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(xe.contextHash)==e}takeNodes(e){let t=this.cursor,r=this.fragment.offset,i=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,o=s,a=e.block.children.length,l=o,c=a;for(;;){if(t.to-r>i){if(t.type.isAnonymous&&t.firstChild())continue;break}let d=yk(t.from-r,e.ranges);if(t.to-r<=e.ranges[e.rangeI].to)e.addNode(t.tree,d);else{let h=new Ee(e.parser.nodeSet.types[ee.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(h,t.tree),e.addNode(h,d)}if(t.type.is("Block")&&(fZ.indexOf(t.type.id)<0?(o=t.to-r,a=e.block.children.length):(o=l,a=c),l=t.to-r,c=e.block.children.length),!t.nextSibling())break}for(;e.block.children.length>a;)e.block.children.pop(),e.block.positions.pop();return o-s}};function yk(n,e){let t=n;for(let r=1;r<e.length;r++){let i=e[r-1].to,s=e[r].from;i<n&&(t-=s-i)}return t}var pZ=Kt({"Blockquote/...":g.quote,HorizontalRule:g.contentSeparator,"ATXHeading1/... SetextHeading1/...":g.heading1,"ATXHeading2/... SetextHeading2/...":g.heading2,"ATXHeading3/...":g.heading3,"ATXHeading4/...":g.heading4,"ATXHeading5/...":g.heading5,"ATXHeading6/...":g.heading6,"Comment CommentBlock":g.comment,Escape:g.escape,Entity:g.character,"Emphasis/...":g.emphasis,"StrongEmphasis/...":g.strong,"Link/... Image/...":g.link,"OrderedList/... BulletList/...":g.list,"BlockQuote/...":g.quote,"InlineCode CodeText":g.monospace,"URL Autolink":g.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":g.processingInstruction,"CodeInfo LinkLabel":g.labelName,LinkTitle:g.string,Paragraph:g.content}),Sk=new Xl(new $i(fk).extend(pZ),Object.keys(zh).map(n=>zh[n]),Object.keys(zh).map(n=>hk[n]),Object.keys(zh),dZ,nk,Object.keys(LO).map(n=>LO[n]),Object.keys(LO),[]);function mZ(n,e,t){let r=[];for(let i=n.firstChild,s=e;;i=i.nextSibling){let o=i?i.from:t;if(o>s&&r.push({from:s,to:o}),!i)break;s=i.to}return r}function vk(n){let{codeParser:e,htmlParser:t}=n;return{wrap:Fd((i,s)=>{let o=i.type.id;if(e&&(o==ee.CodeBlock||o==ee.FencedCode)){let a="";if(o==ee.FencedCode){let c=i.node.getChild(ee.CodeInfo);c&&(a=s.read(c.from,c.to))}let l=e(a);if(l)return{parser:l,overlay:c=>c.type.id==ee.CodeText,bracketed:o==ee.FencedCode}}else if(t&&(o==ee.HTMLBlock||o==ee.HTMLTag||o==ee.CommentBlock))return{parser:t,overlay:mZ(i.node,i.from,i.to)};return null})}}var gZ={resolve:"Strikethrough",mark:"StrikethroughMark"},OZ={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":g.strikethrough}},{name:"StrikethroughMark",style:g.processingInstruction}],parseInline:[{name:"Strikethrough",parse(n,e,t){if(e!=126||n.char(t+1)!=126||n.char(t+2)==126)return-1;let r=n.slice(t-1,t),i=n.slice(t+2,t+3),s=/\s|^$/.test(r),o=/\s|^$/.test(i),a=zl.test(r),l=zl.test(i);return n.addDelimiter(gZ,t,t+2,!o&&(!l||s||a),!s&&(!a||o||l))},after:"Emphasis"}]};function Il(n,e,t=0,r,i=0){let s=0,o=!0,a=-1,l=-1,c=!1,d=()=>{r.push(n.elt("TableCell",i+a,i+l,n.parser.parseInline(e.slice(a,l),i+a)))};for(let h=t;h<e.length;h++){let u=e.charCodeAt(h);u==124&&!c?((!o||a>-1)&&s++,o=!1,r&&(a>-1&&d(),r.push(n.elt("TableDelimiter",h+i,h+i+1))),a=l=-1):(c||u!=32&&u!=9)&&(a<0&&(a=h),l=h+1),c=!c&&u==92}return a>-1&&(s++,r&&d()),s}function qP(n,e){for(let t=e;t<n.length;t++){let r=n.charCodeAt(t);if(r==124)return!0;r==92&&t++}return!1}var wk=/^[>\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,Yh=class{constructor(){this.rows=null}nextLine(e,t,r){if(this.rows==null){this.rows=!1;let i;if((t.next==45||t.next==58||t.next==124)&&wk.test(i=t.text.slice(t.pos))){let s=[];Il(e,r.content,0,s,r.start)==Il(e,i,0)&&(this.rows=[e.elt("TableHeader",r.start,r.start+r.content.length,s),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let i=[];Il(e,t.text,t.pos,i,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+t.pos,e.lineStart+t.text.length,i))}return!1}finish(e,t){return this.rows?(e.addLeafElement(t,e.elt("Table",t.start,t.start+t.content.length,this.rows)),!0):!1}},bZ={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":g.heading}},"TableRow",{name:"TableCell",style:g.content},{name:"TableDelimiter",style:g.processingInstruction}],parseBlock:[{name:"Table",leaf(n,e){return qP(e.content,0)?new Yh:null},endLeaf(n,e,t){if(t.parsers.some(i=>i instanceof Yh)||!qP(e.text,e.basePos))return!1;let r=n.peekLine();return wk.test(r)&&Il(n,e.text,e.basePos)==Il(n,r,e.basePos)},before:"SetextHeading"}]},YO=class{nextLine(){return!1}finish(e,t){return e.addLeafElement(t,e.elt("Task",t.start,t.start+t.content.length,[e.elt("TaskMarker",t.start,t.start+3),...e.parser.parseInline(t.content.slice(3),t.start+3)])),!0}},yZ={defineNodes:[{name:"Task",block:!0,style:g.list},{name:"TaskMarker",style:g.atom}],pa
Line truncated
|
|
|
|
|
`);r=i<0?t:t.slice(0,i)}return e+r.length>this.to?r.slice(0,this.to-e):r}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,r=0){this.block=Nh.create(e,r,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,r=0){this.startContext(this.parser.getNodeType(e),t,r)}addNode(e,t,r){typeof e=="number"&&(e=new Ee(this.parser.nodeSet.types[e],ha,ha,(r!=null?r:this.prevLineEnd())-t)),this.block.addChild(e,t-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,t){this.addNode(this.buffer.writeElements(VO(t.children,e.marks),-t.from).finish(t.type,t.to-t.from),t.from)}finishContext(){let e=this.stack.pop(),t=this.stack[this.stack.length-1];t.addChild(e.toTree(this.parser.nodeSet),e.from-t.from),this.block=t}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?pk(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let r of e.parsers)if(r.finish(this,e))return;let t=VO(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(ee.Paragraph,e.content.length),e.start)}elt(e,t,r,i){return typeof e=="string"?Ne(this.parser.getNodeType(e),t,r,i):new Vh(e,t)}get buffer(){return new Bh(this.parser.nodeSet)}};function pk(n,e,t,r,i){let s=n[e].to,o=[],a=[],l=t.from+r;function c(d,h){for(;h?d>=s:d>s;){let u=n[e+1].from-s;r+=u,d+=u,e++,s=n[e].to}}for(let d=t.firstChild;d;d=d.nextSibling){c(d.from+r,!0);let h=d.from+r,u,f=i.get(d.tree);f?u=f:d.to+r>s?(u=pk(n,e,d,r,i),c(d.to+r,!1)):u=d.toTree(),o.push(u),a.push(h-l)}return c(t.to+r,!1),new Ee(t.type,o,a,t.to+r-l,t.tree?t.tree.propValues:void 0)}var Xl=class n extends Ti{constructor(e,t,r,i,s,o,a,l,c){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=r,this.blockNames=i,this.endLeafBlock=s,this.skipContextMarkup=o,this.inlineParsers=a,this.inlineNames=l,this.wrappers=c,this.nodeTypes=Object.create(null);for(let d of e.types)this.nodeTypes[d.name]=d.id}createParse(e,t,r){let i=new NO(this,e,t,r);for(let s of this.wrappers)i=s(i,e,t,r);return i}configure(e){let t=BO(e);if(!t)return this;let{nodeSet:r,skipContextMarkup:i}=this,s=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),a=this.blockNames.slice(),l=this.inlineParsers.slice(),c=this.inlineNames.slice(),d=this.endLeafBlock.slice(),h=this.wrappers;if(Dl(t.defineNodes)){i=Object.assign({},i);let u=r.types.slice(),f;for(let m of t.defineNodes){let{name:O,block:S,composite:x,style:D}=typeof m=="string"?{name:m}:m;if(u.some(k=>k.name==O))continue;x&&(i[u.length]=(k,w,R)=>x(w,R,k.value));let M=u.length,Z=x?["Block","BlockContext"]:S?M>=ee.ATXHeading1&&M<=ee.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;u.push(St.define({id:M,name:O,props:Z&&[[xe.group,Z]]})),D&&(f||(f={}),Array.isArray(D)||D instanceof qn?f[O]=D:Object.assign(f,D))}r=new $i(u),f&&(r=r.extend(Kt(f)))}if(Dl(t.props)&&(r=r.extend(...t.props)),Dl(t.remove))for(let u of t.remove){let f=this.blockNames.indexOf(u),m=this.inlineNames.indexOf(u);f>-1&&(s[f]=o[f]=void 0),m>-1&&(l[m]=void 0)}if(Dl(t.parseBlock))for(let u of t.parseBlock){let f=a.indexOf(u.name);if(f>-1)s[f]=u.parse,o[f]=u.leaf;else{let m=u.before?Wh(a,u.before):u.after?Wh(a,u.after)+1:a.length-1;s.splice(m,0,u.parse),o.splice(m,0,u.leaf),a.splice(m,0,u.name)}u.endLeaf&&d.push(u.endLeaf)}if(Dl(t.parseInline))for(let u of t.parseInline){let f=c.indexOf(u.name);if(f>-1)l[f]=u.parse;else{let m=u.before?Wh(c,u.before):u.after?Wh(c,u.after)+1:c.length-1;l.splice(m,0,u.parse),c.splice(m,0,u.name)}}return t.wrap&&(h=h.concat(t.wrap)),new n(r,s,o,a,d,i,l,c,h)}getNodeType(e){let t=this.nodeTypes[e];if(t==null)throw new RangeError(`Unknown node type '${e}'`);return t}parseInline(e,t){let r=new Wl(this,e,t);e:for(let i=t;i<r.end;){let s=r.char(i);for(let o of this.inlineParsers)if(o){let a=o(r,s,i);if(a>=0){i=a;continue e}}i++}return r.resolveMarkers(0)}};function Dl(n){return n!=null&&n.length>0}function BO(n){if(!Array.isArray(n))return n;if(n.length==0)return null;let e=BO(n[0]);if(n.length==1)return e;let t=BO(n.slice(1));if(!t||!e)return e||t;let r=(o,a)=>(o||ha).concat(a||ha),i=e.wrap,s=t.wrap;return{props:r(e.props,t.props),defineNodes:r(e.defineNodes,t.defineNodes),parseBlock:r(e.parseBlock,t.parseBlock),parseInline:r(e.parseInline,t.parseInline),remove:r(e.remove,t.remove),wrap:i?s?(o,a,l,c)=>i(s(o,a,l,c),a,l,c):i:s}}function Wh(n,e){let t=n.indexOf(e);if(t<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return t}var mk=[St.none];for(let n=1,e;e=ee[n];n++)mk[n]=St.define({id:n,name:e,props:n>=ee.Escape?[]:[[xe.group,n in ik?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});var ha=[],Bh=class{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e
Line truncated
|
|
|
|
|
`;)s--;this.fragmentEnd=s?s-1:0}let r=this.cursor;r||(r=this.cursor=this.fragment.tree.cursor(),r.firstChild());let i=e+this.fragment.offset;for(;r.to<=i;)if(!r.parent())return!1;for(;;){if(r.from>=i)return this.fragment.from<=t;if(!r.childAfter(i))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(xe.contextHash)==e}takeNodes(e){let t=this.cursor,r=this.fragment.offset,i=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,o=s,a=e.block.children.length,l=o,c=a;for(;;){if(t.to-r>i){if(t.type.isAnonymous&&t.firstChild())continue;break}let d=vk(t.from-r,e.ranges);if(t.to-r<=e.ranges[e.rangeI].to)e.addNode(t.tree,d);else{let h=new Ee(e.parser.nodeSet.types[ee.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(h,t.tree),e.addNode(h,d)}if(t.type.is("Block")&&(mZ.indexOf(t.type.id)<0?(o=t.to-r,a=e.block.children.length):(o=l,a=c),l=t.to-r,c=e.block.children.length),!t.nextSibling())break}for(;e.block.children.length>a;)e.block.children.pop(),e.block.positions.pop();return o-s}};function vk(n,e){let t=n;for(let r=1;r<e.length;r++){let i=e[r-1].to,s=e[r].from;i<n&&(t-=s-i)}return t}var gZ=Kt({"Blockquote/...":g.quote,HorizontalRule:g.contentSeparator,"ATXHeading1/... SetextHeading1/...":g.heading1,"ATXHeading2/... SetextHeading2/...":g.heading2,"ATXHeading3/...":g.heading3,"ATXHeading4/...":g.heading4,"ATXHeading5/...":g.heading5,"ATXHeading6/...":g.heading6,"Comment CommentBlock":g.comment,Escape:g.escape,Entity:g.character,"Emphasis/...":g.emphasis,"StrongEmphasis/...":g.strong,"Link/... Image/...":g.link,"OrderedList/... BulletList/...":g.list,"BlockQuote/...":g.quote,"InlineCode CodeText":g.monospace,"URL Autolink":g.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":g.processingInstruction,"CodeInfo LinkLabel":g.labelName,LinkTitle:g.string,Paragraph:g.content}),wk=new Xl(new $i(mk).extend(gZ),Object.keys(zh).map(n=>zh[n]),Object.keys(zh).map(n=>fk[n]),Object.keys(zh),uZ,ik,Object.keys(LO).map(n=>LO[n]),Object.keys(LO),[]);function OZ(n,e,t){let r=[];for(let i=n.firstChild,s=e;;i=i.nextSibling){let o=i?i.from:t;if(o>s&&r.push({from:s,to:o}),!i)break;s=i.to}return r}function xk(n){let{codeParser:e,htmlParser:t}=n;return{wrap:Fd((i,s)=>{let o=i.type.id;if(e&&(o==ee.CodeBlock||o==ee.FencedCode)){let a="";if(o==ee.FencedCode){let c=i.node.getChild(ee.CodeInfo);c&&(a=s.read(c.from,c.to))}let l=e(a);if(l)return{parser:l,overlay:c=>c.type.id==ee.CodeText,bracketed:o==ee.FencedCode}}else if(t&&(o==ee.HTMLBlock||o==ee.HTMLTag||o==ee.CommentBlock))return{parser:t,overlay:OZ(i.node,i.from,i.to)};return null})}}var bZ={resolve:"Strikethrough",mark:"StrikethroughMark"},yZ={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":g.strikethrough}},{name:"StrikethroughMark",style:g.processingInstruction}],parseInline:[{name:"Strikethrough",parse(n,e,t){if(e!=126||n.char(t+1)!=126||n.char(t+2)==126)return-1;let r=n.slice(t-1,t),i=n.slice(t+2,t+3),s=/\s|^$/.test(r),o=/\s|^$/.test(i),a=zl.test(r),l=zl.test(i);return n.addDelimiter(bZ,t,t+2,!o&&(!l||s||a),!s&&(!a||o||l))},after:"Emphasis"}]};function Il(n,e,t=0,r,i=0){let s=0,o=!0,a=-1,l=-1,c=!1,d=()=>{r.push(n.elt("TableCell",i+a,i+l,n.parser.parseInline(e.slice(a,l),i+a)))};for(let h=t;h<e.length;h++){let u=e.charCodeAt(h);u==124&&!c?((!o||a>-1)&&s++,o=!1,r&&(a>-1&&d(),r.push(n.elt("TableDelimiter",h+i,h+i+1))),a=l=-1):(c||u!=32&&u!=9)&&(a<0&&(a=h),l=h+1),c=!c&&u==92}return a>-1&&(s++,r&&d()),s}function HP(n,e){for(let t=e;t<n.length;t++){let r=n.charCodeAt(t);if(r==124)return!0;r==92&&t++}return!1}var Pk=/^[>\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,Yh=class{constructor(){this.rows=null}nextLine(e,t,r){if(this.rows==null){this.rows=!1;let i;if((t.next==45||t.next==58||t.next==124)&&Pk.test(i=t.text.slice(t.pos))){let s=[];Il(e,r.content,0,s,r.start)==Il(e,i,0)&&(this.rows=[e.elt("TableHeader",r.start,r.start+r.content.length,s),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let i=[];Il(e,t.text,t.pos,i,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+t.pos,e.lineStart+t.text.length,i))}return!1}finish(e,t){return this.rows?(e.addLeafElement(t,e.elt("Table",t.start,t.start+t.content.length,this.rows)),!0):!1}},SZ={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":g.heading}},"TableRow",{name:"TableCell",style:g.content},{name:"TableDelimiter",style:g.processingInstruction}],parseBlock:[{name:"Table",leaf(n,e){return HP(e.content,0)?new Yh:null},endLeaf(n,e,t){if(t.parsers.some(i=>i instanceof Yh)||!HP(e.text,e.basePos))return!1;let r=n.peekLine();return Pk.test(r)&&Il(n,e.text,e.basePos)==Il(n,r,e.basePos)},before:"SetextHeading"}]},YO=class{nextLine(){return!1}finish(e,t){return e.addLeafElement(t,e.elt("Task",t.start,t.start+t.content.length,[e.elt("TaskMarker",t.start,t.start+3),...e.parser.parseInline(t.content.slice(3),t.start+3)])),!0}},vZ={defineNodes:[{name:"Task",block:!0,style:g.list},{name:"TaskMarker",style:g.atom}],pa
Line truncated
|
|
|
|
|
\${}
|
|
|
|
|
} catch (\${error}) {
|
|
|
|
|
\${}
|
|
|
|
@@ -66,8 +66,8 @@ Connect your audio output to the SuperCharger input, turn up the volume, and pla
|
|
|
|
|
constructor(\${params}) {
|
|
|
|
|
\${}
|
|
|
|
|
}
|
|
|
|
|
}`,{label:"class",detail:"definition",type:"keyword"}),vn('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),vn('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],g5=d$.concat([vn("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),vn("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),vn("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),a$=new jo,h$=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Vl(n){return(e,t)=>{let r=e.node.getChild("VariableDefinition");return r&&t(r,n),!0}}var O5=["FunctionDeclaration"],b5={FunctionDeclaration:Vl("function"),ClassDeclaration:Vl("class"),ClassExpression:()=>!0,EnumDeclaration:Vl("constant"),TypeAliasDeclaration:Vl("type"),NamespaceDeclaration:Vl("namespace"),VariableDefinition(n,e){n.matchContext(O5)||e(n,"variable")},TypeDefinition(n,e){e(n,"type")},__proto__:null};function u$(n,e){let t=a$.get(e);if(t)return t;let r=[],i=!0;function s(o,a){let l=n.sliceString(o.from,o.to);r.push({label:l,type:a})}return e.cursor(We.IncludeAnonymous).iterate(o=>{if(i)i=!1;else if(o.name){let a=b5[o.name];if(a&&a(o,s)||h$.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of u$(n,o.node))r.push(a);return!1}}),a$.set(e,r),r}var l$=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,f$=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function y5(n){let e=ze(n.state).resolveInner(n.pos,-1);if(f$.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&l$.test(n.state.sliceDoc(e.from,e.to));if(!t&&!n.explicit)return null;let r=[];for(let i=e;i;i=i.parent)h$.has(i.name)&&(r=r.concat(u$(n.state.doc,i)));return{options:r,from:t?e.from:n.pos,validFor:l$}}var Yr=Jt.define({name:"javascript",parser:o$.configure({props:[En.add({IfStatement:Gn({except:/^\s*({|else\b)/}),TryStatement:Gn({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Iw,SwitchBody:n=>{let e=n.textAfter,t=/^\s*\}/.test(e),r=/^\s*(case|default)\b/.test(e);return n.baseIndent+(t?0:r?1:2)*n.unit},Block:Go({closing:"}"}),ArrowFunction:n=>n.baseIndent+n.unit,"TemplateString BlockComment":()=>null,"Statement Property":Gn({except:/^\s*{/}),JSXElement(n){let e=/^\s*<\//.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},JSXEscape(n){let e=/\s*\}/.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},"JSXOpenTag JSXSelfClosingTag"(n){return n.column(n.node.from)+n.unit}}),dn.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Ft,BlockComment(n){return{from:n.from+2,to:n.to-2}},JSXElement(n){let e=n.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let t=n.lastChild;return{from:e.to,to:t.type.isError?n.to:t.from}},"JSXSelfClosingTag JSXOpenTag"(n){var e;let t=(e=n.firstChild)===null||e===void 0?void 0:e.nextSibling,r=n.lastChild;return!t||t.type.isError?null:{from:t.to,to:r.type.isError?n.to:r.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),p$={test:n=>/^JSX/.test(n.name),facet:Uo({commentTokens:{block:{open:"{/*",close:"*/}"}}})},db=Yr.configure({dialect:"ts"},"typescript"),hb=Yr.configure({dialect:"jsx",props:[Jd.add(n=>n.isTop?[p$]:void 0)]}),ub=Yr.configure({dialect:"jsx ts",props:[Jd.add(n=>n.isTop?[p$]:void 0)]},"typescript"),m$=n=>({label:n,type:"keyword"}),g$="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(m$),S5=g$.concat(["declare","implements","private","protected","public"].map(m$));function O$(n={}){let e=n.jsx?n.typescript?ub:hb:n.typescript?db:Yr,t=n.typescript?g5.concat(S5):d$.concat(g$);return new Ye(e,[Yr.data.of({autocomplete:ix(f$,rx(t))}),Yr.data.of({autocomplete:y5}),n.jsx?x5:[]])}function v5(n){for(;;){if(n.name=="JSXOpenTag"||n.name=="JSXSelfClosingTag"||n.name=="JSXFragmentTag")return n;if(n.name=="JSXEscape"||!n.parent)return null;n=n.parent}}function c$(n,e,t=n.length){for(let r=e==null?void 0:e.firstChild;r;r=r.nextSibling)if(r.name=="JSXIdentifier"||r.name=="JSXBuiltin"||r.name=="JSXNamespacedName"||r.name=="JSXMemberExpression")return n.sliceString(r.from,Math.min(r.to,t));return""}var w5=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),x5=F.inputHandler.of((n,e,t,r,i)=>{if((w5?n.composing:n.compositionStarted)||n.state.readOnly||e!=t||r!=">"&&r!="/"||!Yr.isActiveAt(n.state,e,-1))return!1;let s=i(),{state:o}=s,a=o.changeByRange(l=>{var c;let{head:d}=l,h=ze(o).resol
Line truncated
|
|
|
|
|
`);for(let l of a){F$.lastIndex=0;let c=F$.exec(l);if(c){let d=o+c.index+c[0].length;t.push(K.widget({widget:new Cb(c[0],e),side:-1}).range(d))}o+=l.length+1}}return K.set(t,!0)}function j$(n){let e;function t(r){let i=e.posAtDOM(r);n(e.state.doc.lineAt(i).number)}return it.fromClass(class{constructor(r){e=r,this.decorations=Y$(r,t)}update(r){e=r.view,(r.docChanged||r.viewportChanged)&&(this.decorations=Y$(r.view,t))}},{decorations:r=>r.decorations})}var _b=class extends Ct{constructor(t,r,i){super();this.filename=t;this.system=r;this.handleClick=i}toDOM(){let t=document.createElement("span");return t.className="include-link-badge",t.textContent="\u2192",t.title=(this.system?"System header: ":"View ")+this.filename,t.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation(),this.handleClick(this.filename,this.system)}),t}eq(t){return this.filename===t.filename&&this.system===t.system}ignoreEvent(){return!1}};function sX(n,e,t){let r=[],i=n.state.doc,s=new Set;for(let{from:o,to:a}of n.visibleRanges){let l=n.state.sliceDoc(o,a);for(let c of e){let d=c instanceof RegExp?{re:c}:c;d.re.lastIndex=0;let h;for(;h=d.re.exec(l);){let u=h[d.group!=null?d.group:h.length-1];if(!u)continue;let f=d.suffix?u+d.suffix:u,m=Math.min(o+h.index+h[0].length,i.length),O=i.lineAt(m),S=O.number+":"+f;s.has(S)||(s.add(S),r.push(K.widget({widget:new _b(f,!!d.system,t),side:1}).range(O.to)))}}}return K.set(r,!0)}function U$(n,e){function t(r){let i=n();return!i||!i.length?K.none:sX(r,i,e)}return it.fromClass(class{constructor(r){this.decorations=t(r)}update(r){(r.docChanged||r.viewportChanged)&&(this.decorations=t(r.view))}},{decorations:r=>r.decorations})}var ds=window.matchMedia&&window.matchMedia("only screen and (max-width: 760px)").matches;function xr(n,e){var t=$(document.createElement("div"));return n&&t.appendTo(n),e&&t.addClass(e),t}function oX(n){return Me.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input")||!n.input)return e;let t=[],r=!1;if(e.changes.iterChanges((o,a,l,c,d)=>{let h=d.toString(),u=n.input(h);t.push({from:o,to:a,insert:u}),u!==h&&(r=!0)}),!r)return e;let i=e.annotation(ut.userEvent),s=e.annotation(ut.addToHistory);return{changes:t,selection:e.selection,effects:e.effects,scrollIntoView:e.scrollIntoView,annotations:[...i!=null?[ut.userEvent.of(i)]:[],...s!=null?[ut.addToHistory.of(s)]:[]]}})}var Eb=new Vt;function q$(n){return Eb.reconfigure(oX(n))}var G$=ye.define(),H$=ye.define(),K$=ye.define(),J$=ye.define(),eQ=ye.define(),tQ=ye.define(),nQ=ye.define(),Mb=ye.define(),rQ=ye.define(),iQ=Xe.define({create(){return $e.empty},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(G$)){let r=t.value,i=[];for(let[s,o]of r.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;i.push(new eu(_e(o,4)).range(a))}n=$e.of(i,!0)}return n}}),sQ=Xe.define({create(){return $e.empty},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(H$)){let r=t.value,i=[];for(let[s,o]of r.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;i.push(new tu(o).range(a))}n=$e.of(i,!0)}return n}}),oQ=Xe.define({create(){return $e.empty},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(K$)){let r=t.value,i=[];for(let[s,o]of r.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;i.push(new nu(o).range(a))}n=$e.of(i,!0)}return n}}),aQ=Xe.define({create(){return $e.empty},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(eQ)){let r=[],i=t.value.filter(s=>s.line>=1&&s.line<=e.state.doc.lines).sort((s,o)=>s.line-o.line);for(let s of i){let o=e.state.doc.line(s.line).from;r.push((s.enabled?lX:cX).range(o))}n=$e.of(r,!0)}return n}}),Rb=Xe.define({create(){return $e.empty},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(tQ)){let r=t.value,i=[];for(let[s,o]of r.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;i.push(new iu(s,o.msg,o.warning).range(a))}n=$e.of(i,!0)}return n}}),lQ=Xe.define({create(){return $e.empty},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(nQ))if(t.value===null)n=$e.empty;else{let r=t.value;if(r>=1&&r<=e.state.doc.lines){let i=e.state.doc.line(r).from;n=$e.of(cQ.range(i))}}return n}}),eu=class extends $t{constructor(t){super();this.hex=t}toDOM(){let t=document.createElement("span");return t.className="gutter-offset-marker",t.textContent=this.hex,t.title="Click to run to here",t}eq(t){return this.hex==t.hex}},tu=class extends $t{constructor(t){super();this.bytes=t}toDOM(){return document.createTextNode(this.bytes)}eq(t){return this.bytes==t.bytes}},nu=class extends $t{constructor(t){super();this.clock=t}toDOM(){return document.createTextNode(this.clock)}eq(t){return this.clock==t.clock}},aX=new class extends $t{toDOM(){let n=document.createElement("span");return n.className="gutter-breakpoint-placeholder",n.textContent="\u25CF",n}},ru=class extends $t{constructor(t){super();this.enabled=t}toDOM(){let t=document.createElement("span");return t.className="gutter-
Line truncated
|
|
|
|
|
}`,{label:"class",detail:"definition",type:"keyword"}),vn('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),vn('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],b5=u$.concat([vn("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),vn("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),vn("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),c$=new jo,f$=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Vl(n){return(e,t)=>{let r=e.node.getChild("VariableDefinition");return r&&t(r,n),!0}}var y5=["FunctionDeclaration"],S5={FunctionDeclaration:Vl("function"),ClassDeclaration:Vl("class"),ClassExpression:()=>!0,EnumDeclaration:Vl("constant"),TypeAliasDeclaration:Vl("type"),NamespaceDeclaration:Vl("namespace"),VariableDefinition(n,e){n.matchContext(y5)||e(n,"variable")},TypeDefinition(n,e){e(n,"type")},__proto__:null};function p$(n,e){let t=c$.get(e);if(t)return t;let r=[],i=!0;function s(o,a){let l=n.sliceString(o.from,o.to);r.push({label:l,type:a})}return e.cursor(We.IncludeAnonymous).iterate(o=>{if(i)i=!1;else if(o.name){let a=S5[o.name];if(a&&a(o,s)||f$.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of p$(n,o.node))r.push(a);return!1}}),c$.set(e,r),r}var d$=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,m$=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function v5(n){let e=ze(n.state).resolveInner(n.pos,-1);if(m$.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&d$.test(n.state.sliceDoc(e.from,e.to));if(!t&&!n.explicit)return null;let r=[];for(let i=e;i;i=i.parent)f$.has(i.name)&&(r=r.concat(p$(n.state.doc,i)));return{options:r,from:t?e.from:n.pos,validFor:d$}}var Yr=Jt.define({name:"javascript",parser:l$.configure({props:[En.add({IfStatement:Gn({except:/^\s*({|else\b)/}),TryStatement:Gn({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Iw,SwitchBody:n=>{let e=n.textAfter,t=/^\s*\}/.test(e),r=/^\s*(case|default)\b/.test(e);return n.baseIndent+(t?0:r?1:2)*n.unit},Block:Go({closing:"}"}),ArrowFunction:n=>n.baseIndent+n.unit,"TemplateString BlockComment":()=>null,"Statement Property":Gn({except:/^\s*{/}),JSXElement(n){let e=/^\s*<\//.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},JSXEscape(n){let e=/\s*\}/.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},"JSXOpenTag JSXSelfClosingTag"(n){return n.column(n.node.from)+n.unit}}),dn.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Ft,BlockComment(n){return{from:n.from+2,to:n.to-2}},JSXElement(n){let e=n.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let t=n.lastChild;return{from:e.to,to:t.type.isError?n.to:t.from}},"JSXSelfClosingTag JSXOpenTag"(n){var e;let t=(e=n.firstChild)===null||e===void 0?void 0:e.nextSibling,r=n.lastChild;return!t||t.type.isError?null:{from:t.to,to:r.type.isError?n.to:r.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),g$={test:n=>/^JSX/.test(n.name),facet:Uo({commentTokens:{block:{open:"{/*",close:"*/}"}}})},db=Yr.configure({dialect:"ts"},"typescript"),hb=Yr.configure({dialect:"jsx",props:[Jd.add(n=>n.isTop?[g$]:void 0)]}),ub=Yr.configure({dialect:"jsx ts",props:[Jd.add(n=>n.isTop?[g$]:void 0)]},"typescript"),O$=n=>({label:n,type:"keyword"}),b$="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(O$),w5=b$.concat(["declare","implements","private","protected","public"].map(O$));function y$(n={}){let e=n.jsx?n.typescript?ub:hb:n.typescript?db:Yr,t=n.typescript?b5.concat(w5):u$.concat(b$);return new Ye(e,[Yr.data.of({autocomplete:ix(m$,rx(t))}),Yr.data.of({autocomplete:v5}),n.jsx?k5:[]])}function x5(n){for(;;){if(n.name=="JSXOpenTag"||n.name=="JSXSelfClosingTag"||n.name=="JSXFragmentTag")return n;if(n.name=="JSXEscape"||!n.parent)return null;n=n.parent}}function h$(n,e,t=n.length){for(let r=e==null?void 0:e.firstChild;r;r=r.nextSibling)if(r.name=="JSXIdentifier"||r.name=="JSXBuiltin"||r.name=="JSXNamespacedName"||r.name=="JSXMemberExpression")return n.sliceString(r.from,Math.min(r.to,t));return""}var P5=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),k5=F.inputHandler.of((n,e,t,r,i)=>{if((P5?n.composing:n.compositionStarted)||n.state.readOnly||e!=t||r!=">"&&r!="/"||!Yr.isActiveAt(n.state,e,-1))return!1;let s=i(),{state:o}=s,a=o.changeByRange(l=>{var c;let{head:d}=l,h=ze(o).resol
Line truncated
|
|
|
|
|
`);for(let l of a){j$.lastIndex=0;let c=j$.exec(l);if(c){let d=o+c.index+c[0].length;t.push(K.widget({widget:new Cb(c[0],e),side:-1}).range(d))}o+=l.length+1}}return K.set(t,!0)}function q$(n){let e;function t(r){let i=e.posAtDOM(r);n(e.state.doc.lineAt(i).number)}return it.fromClass(class{constructor(r){e=r,this.decorations=U$(r,t)}update(r){e=r.view,(r.docChanged||r.viewportChanged)&&(this.decorations=U$(r.view,t))}},{decorations:r=>r.decorations})}var _b=class extends Ct{constructor(t,r,i){super();this.filename=t;this.system=r;this.handleClick=i}toDOM(){let t=document.createElement("span");return t.className="include-link-badge",t.textContent="\u2192",t.title=(this.system?"System header: ":"View ")+this.filename,t.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation(),this.handleClick(this.filename,this.system)}),t}eq(t){return this.filename===t.filename&&this.system===t.system}ignoreEvent(){return!1}};function aX(n,e,t){let r=[],i=n.state.doc,s=new Set;for(let{from:o,to:a}of n.visibleRanges){let l=n.state.sliceDoc(o,a);for(let c of e){let d=c instanceof RegExp?{re:c}:c;d.re.lastIndex=0;let h;for(;h=d.re.exec(l);){let u=h[d.group!=null?d.group:h.length-1];if(!u)continue;let f=d.suffix?u+d.suffix:u,m=Math.min(o+h.index+h[0].length,i.length),O=i.lineAt(m),S=O.number+":"+f;s.has(S)||(s.add(S),r.push(K.widget({widget:new _b(f,!!d.system,t),side:1}).range(O.to)))}}}return K.set(r,!0)}function G$(n,e){function t(r){let i=n();return!i||!i.length?K.none:aX(r,i,e)}return it.fromClass(class{constructor(r){this.decorations=t(r)}update(r){(r.docChanged||r.viewportChanged)&&(this.decorations=t(r.view))}},{decorations:r=>r.decorations})}var ds=window.matchMedia&&window.matchMedia("only screen and (max-width: 760px)").matches;function xr(n,e){var t=$(document.createElement("div"));return n&&t.appendTo(n),e&&t.addClass(e),t}function lX(n){return Me.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input")||!n.input)return e;let t=[],r=!1;if(e.changes.iterChanges((o,a,l,c,d)=>{let h=d.toString(),u=n.input(h);t.push({from:o,to:a,insert:u}),u!==h&&(r=!0)}),!r)return e;let i=e.annotation(ut.userEvent),s=e.annotation(ut.addToHistory);return{changes:t,selection:e.selection,effects:e.effects,scrollIntoView:e.scrollIntoView,annotations:[...i!=null?[ut.userEvent.of(i)]:[],...s!=null?[ut.addToHistory.of(s)]:[]]}})}var Eb=new Vt;function H$(n){return Eb.reconfigure(lX(n))}var K$=ye.define(),J$=ye.define(),eQ=ye.define(),tQ=ye.define(),nQ=ye.define(),rQ=ye.define(),iQ=ye.define(),Mb=ye.define(),sQ=ye.define(),oQ=Xe.define({create(){return $e.empty},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(K$)){let r=t.value,i=[];for(let[s,o]of r.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;i.push(new eu(_e(o,4)).range(a))}n=$e.of(i,!0)}return n}}),aQ=Xe.define({create(){return $e.empty},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(J$)){let r=t.value,i=[];for(let[s,o]of r.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;i.push(new tu(o).range(a))}n=$e.of(i,!0)}return n}}),lQ=Xe.define({create(){return $e.empty},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(eQ)){let r=t.value,i=[];for(let[s,o]of r.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;i.push(new nu(o).range(a))}n=$e.of(i,!0)}return n}}),cQ=Xe.define({create(){return $e.empty},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(nQ)){let r=[],i=t.value.filter(s=>s.line>=1&&s.line<=e.state.doc.lines).sort((s,o)=>s.line-o.line);for(let s of i){let o=e.state.doc.line(s.line).from;r.push((s.enabled?dX:hX).range(o))}n=$e.of(r,!0)}return n}}),Rb=Xe.define({create(){return $e.empty},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(rQ)){let r=t.value,i=[];for(let[s,o]of r.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;i.push(new iu(s,o.msg,o.warning).range(a))}n=$e.of(i,!0)}return n}}),dQ=Xe.define({create(){return $e.empty},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(iQ))if(t.value===null)n=$e.empty;else{let r=t.value;if(r>=1&&r<=e.state.doc.lines){let i=e.state.doc.line(r).from;n=$e.of(hQ.range(i))}}return n}}),eu=class extends $t{constructor(t){super();this.hex=t}toDOM(){let t=document.createElement("span");return t.className="gutter-offset-marker",t.textContent=this.hex,t.title="Click to run to here",t}eq(t){return this.hex==t.hex}},tu=class extends $t{constructor(t){super();this.bytes=t}toDOM(){return document.createTextNode(this.bytes)}eq(t){return this.bytes==t.bytes}},nu=class extends $t{constructor(t){super();this.clock=t}toDOM(){return document.createTextNode(this.clock)}eq(t){return this.clock==t.clock}},cX=new class extends $t{toDOM(){let n=document.createElement("span");return n.className="gutter-breakpoint-placeholder",n.textContent="\u25CF",n}},ru=class extends $t{constructor(t){super();this.enabled=t}toDOM(){let t=document.createElement("span");return t.className="gutter-
Line truncated
|
|
|
|
|
color: #ffcc44;
|
|
|
|
|
background-color: #332900;
|
|
|
|
|
padding: 4px 8px;
|
|
|
|
@@ -81,29 +81,29 @@ Connect your audio output to the SuperCharger input, turn up the volume, and pla
|
|
|
|
|
margin: 2px 0;
|
|
|
|
|
border-left: 3px solid #ff0000;
|
|
|
|
|
font-family: monospace;
|
|
|
|
|
`,t}},bX=Xe.define({create(){return K.none},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(lo.showMessage)){if(t.value===null||!t.value)return K.none;if(t.value.toggle){let r=[],i=new Map;return n.between(0,e.state.doc.length,(a,l,c)=>{try{let d=e.state.doc.lineAt(l).number;if(c.spec.widget instanceof ql){let h=c.spec.widget;i.set(d,{msg:h.message,warning:h.warning})}}catch(d){}}),i.has(t.value.line)?i.delete(t.value.line):i.set(t.value.line,{msg:t.value.msg,warning:t.value.warning}),Array.from(i.keys()).sort((a,l)=>a-l).forEach(a=>{try{let l=e.state.doc.line(a),c=i.get(a);r.push(K.widget({widget:new ql(c.msg,c.warning),block:!0,side:1}).range(l.to))}catch(l){}}),K.set(r,!0)}}return n},provide:n=>F.decorations.from(n)}),Lb=class extends Ct{constructor(t){super();this.value=t}toDOM(){let t=document.createElement("div");return t.textContent=`${this.value}`,t.style.cssText=`
|
|
|
|
|
`,t}},SX=Xe.define({create(){return K.none},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(lo.showMessage)){if(t.value===null||!t.value)return K.none;if(t.value.toggle){let r=[],i=new Map;return n.between(0,e.state.doc.length,(a,l,c)=>{try{let d=e.state.doc.lineAt(l).number;if(c.spec.widget instanceof ql){let h=c.spec.widget;i.set(d,{msg:h.message,warning:h.warning})}}catch(d){}}),i.has(t.value.line)?i.delete(t.value.line):i.set(t.value.line,{msg:t.value.msg,warning:t.value.warning}),Array.from(i.keys()).sort((a,l)=>a-l).forEach(a=>{try{let l=e.state.doc.line(a),c=i.get(a);r.push(K.widget({widget:new ql(c.msg,c.warning),block:!0,side:1}).range(l.to))}catch(l){}}),K.set(r,!0)}}return n},provide:n=>F.decorations.from(n)}),Lb=class extends Ct{constructor(t){super();this.value=t}toDOM(){let t=document.createElement("div");return t.textContent=`${this.value}`,t.style.cssText=`
|
|
|
|
|
color: #ccccff;
|
|
|
|
|
background-color: #000066;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
`,t.className="cm-line",t}},mQ=ye.define(),yX=Xe.define({create(){return K.none},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(mQ)){if(t.value===null||!t.value)return K.none;let r=e.state.doc.lineAt(t.value.range.to);return K.set([K.widget({widget:new Lb(t.value.val),block:!0,side:1}).range(r.to)])}return n},provide:n=>F.decorations.from(n)}),gQ=ye.define(),SX=K.mark({attributes:{class:"cm-error-span"}}),vX=K.mark({attributes:{class:"cm-warning-span"}}),wX=Xe.define({create(){return K.none},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(gQ)){if(t.value===null)return K.none;let r=[];for(let i of t.value)try{let s=e.state.doc.line(i.line),o=s.from+i.start,a=s.from+i.end;o>=s.from&&a<=s.to&&o<a&&r.push((i.warning?vX:SX).range(o,a))}catch(s){}return K.set(r,!0)}return n},provide:n=>F.decorations.from(n)}),OQ=ye.define(),xX=K.line({attributes:{class:"highlight-lines"}}),PX=Xe.define({create(){return K.none},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(OQ)){if(t.value===null)return K.none;let{start:r,end:i}=t.value,s=[];for(let o=r;o<=i;o++)try{let a=e.state.doc.line(o);s.push(xX.range(a.from))}catch(a){}return K.set(s)}return n!==K.none&&(e.docChanged||e.selection)?K.none:n},provide:n=>F.decorations.from(n)}),bQ={field:bX,widget:ql},Gl={effect:fQ,decoration:pQ,field:OX},lu={effect:mQ,field:yX},cu={effect:gQ,field:wX},du={effect:OQ,field:PX},yQ=ye.define(),SQ=[];for(let n=0;n<4;n++)SQ.push(K.line({attributes:{class:`cm-traced-line cm-traced-line-h${n}`}}));var kX=Xe.define({create(){return K.none},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(yQ)){let r=[];for(let{line:i,level:s}of t.value)try{let o=e.state.doc.line(i),a=SQ[Math.max(0,Math.min(3,s|0))];r.push(a.range(o.from))}catch(o){}return K.set(r,!0)}return n},provide:n=>F.decorations.from(n)}),hu={effect:yQ,field:kX};var $X=[...Rf(t1,Ef),{key:"Mod-Shift-Backspace",run:Qg}],wQ=Rf(aP,Ef),ga=64,xQ=ye.define(),PQ=ye.define(),Db=Xe.define({create(){return new Map},update(n,e){let t=n;for(let r of e.effects)if(r.is(PQ))t=new Map;else if(r.is(xQ)){t===n&&(t=new Map(n));for(let i of r.value)t.set(i.id,{from:i.from,to:i.to})}if(!e.changes.empty){let r=new Map;for(let[i,s]of t)r.set(i,{from:e.changes.mapPos(s.from,-1),to:e.changes.mapPos(s.to,1)});return r}return t}}),QX=200,Zb={default:{theme:Kh},6502:{isAsm:!0},z80:{isAsm:!0},jsasm:{isAsm:!0},gas:{isAsm:!0},vasm:{isAsm:!0},inform6:{theme:Hh},dialog:{theme:Hh,lineWrap:!0},markdown:{lineWrap:!0},fastbasic:{noGutters:!0},basic:{noGutters:!0,lineBased:!0},ecs:{theme:Kh}},kQ={input:null};function $Q(n){kQ.input=n?e=>e.toUpperCase():null}function zb(n){if(!n)return"";let e=n.state.selection.main;return e.empty?"":n.state.sliceDoc(e.from,e.to)}var Hl=class Hl{constructor(e,t){this.updateTimer=null;this.indentUnitCompartment=new Vt;this.isAsm=!1;this.dirtylisting=!0;this.refreshDelayMsec=300;this.probe=null;this.tracedLineCounts=new Map;this.path=e,this.mode=t}createDiv(e){var t=document.createElement("div");t.setAttribute("class","editor"),e.appendChild(t);var r=re.getFile(this.path),i=r&&this.mode=="verilog"&&/__asm\b([\s\S]+?)\b__endasm\b/.test(r);return this.newEditor(t,r,i),this.editor.dispatch({effects:q$(kQ)}),this.syncBreakpoints(),re.getToolForFilename(this.path).startsWith("remote:")&&(this.refreshDelayMsec=1e3),t}setVisible(e){e?(this.editor.focus(),Hl.tracingEnabled&&this.startTracing()):this.stopTracing()}getShortcuts(){if(!this.editor)return[];var e=this.editor,t=(r,i,s)=>({key:r,label:i,fn:()=>{s(e),e.focus()}});return[t("mod+f","Find",Dh),t("mod+g","Find Next",la),t("mod+d","Next Occurrence",Ug),t("mod+z","Undo",Pl),t("mod+shift+z","Redo",Ko)]}startTracing(){!this.probe&&P.startProbing&&(this.probe=P.startProbing(),this.probe.singleFrame=!1,this.probe.clear(),this.tracedLineCounts.clear())}stopTracing(){this.probe&&(P.stopProbing(),this.probe=null),this.tracedLineCounts.clear(),this.editor.dispatch({effects:hu.effect.of([])})}setTracingEnabled(e){Hl.tracingEnabled=e,e?this.startTracing():this.stopTracing()}newEditor(e,t,r){var i=Zb[this.mode]||Zb.default,s=r||i.isAsm,o=!!i.lineWrap,a=i.theme||Zb.default.theme,l=i.useLineNumbers&&!ds;he.embed&&(l=!1,s=!1),this.isAsm=s;let c=i.noGutters||ds;var d;let h=wb[this.mode];h?d=h.language:(console.warn("Unknown mode: "+this.mode),d=null),this.editor=new F({parent:e,doc:t,extensions:[this.indentUnitCompartment.of(this.indentUnitFor(t)),s?lg.of((u,f)=>{let m=u.state.doc.lineAt(f).number;if(m>=0){let O=u.state.doc.line(m);if(O.text.trim())return u.lineIndent(O.from)}return 0}):[],...s?[Sn.of(c1(()=>na().tabsToSpaces))]:[],i.lineBased?Sn.of(r1):[],...f1(na()),Sn.of($X),l?Xd():[],Px(),Sn.of(Qx),Bw(),Jv(),Me.allowMultipleSelections.of(!0),Ld(),Xw(),Uw(),Zd(),Id(),Dd(),lw(),Lh(),qg({top:!0}),Sn.of(wQ),d||[],a,Pb,o?F.lineWrapping:[],Gl.field,c?[]:[su.field,su.gutter],s&&!c?[Ul.field,Ul.gutter,ou.field,ou.gutter]:[],au.field,dQ.gutter,F.updateListener.of(u=>{for(let f of u.transactions.flatMap(m=>m.effects))i
Line truncated
|
|
|
|
|
`).length-1;this.editor.dispatch({changes:{from:i,insert:e}}),this.highlightLines(r-1,r+s-2)}highlightLines(e,t){let r=this.editor.state.doc.line(e+1);this.editor.dispatch({effects:[du.effect.of({start:e+1,end:t+1}),F.scrollIntoView(r.from,{y:"start",yMargin:100})]})}navigateToLine(e){if(e<1||e>this.editor.state.doc.lines)return;let t=this.editor.state.doc.line(e);this.editor.dispatch({selection:{anchor:t.from},effects:[du.effect.of({start:e,end:e}),F.scrollIntoView(t.from,{y:"center"})]}),this.editor.focus()}getValue(){return this.editor.state.doc.toString()}getSelectionText(){return zb(this.editor)}getPath(){return this.path}markErrors(e){this.clearErrors(),e=e.slice(0,QX);let t=new Map,r=[];for(var i of e)if(!i.path||this.path.endsWith(i.path)){var s=this.editor.state.doc.lines,o=i.line;(isNaN(o)||o<1||o>s)&&(o=1),i.severity==="warning"&&t.has(o)||t.set(o,{msg:i.msg,warning:i.severity==="warning"}),i.start!=null&&i.end!=null&&i.end>i.start&&r.push({line:o,start:i.start,end:i.end,warning:i.severity==="warning"})}this.editor.dispatch({effects:[lo.set.of(t),cu.effect.of(r.length>0?r:null)]})}clearErrors(){this.dirtylisting=!0,this.editor.dispatch({effects:[lo.set.of(new Map),lo.showMessage.of(null),cu.effect.of(null)]})}getSourceFile(){return this.sourcefile}updateListing(){this.clearErrors();var e=this.sourcefile.lines||[];let t=new Map,r=new Map,i=new Map;for(var s of e)if(s.offset>=0&&t.set(s.line,_e(s.offset&65535,4)),s.insns){var o=s.insns.length>9?"...":s.insns;if(r.set(s.line,o),s.iscode){if(s.cycles)i.set(s.line,s.cycles+"");else if(P.getOpcodeMetadata){var a=parseInt(s.insns.split(" ")[0],16),l=P.getOpcodeMetadata(a,s.offset);if(l&&l.minCycles){var c=l.minCycles+"";i.set(s.line,c)}}}}this.editor.dispatch({effects:[su.set.of(t),Ul.set.of(r),ou.set.of(i)]})}setTimingResult(e){if(this.sourcefile!=null){var t=new Map;for(let[o,a]of this.sourcefile.line2offset){let l=e.pc2clockrange[a];var r=l&&l.minclocks,i=l&&l.maxclocks;if(r>=0&&i>=0){var s;i==r?s=r+"":s=r+"-"+i,i==e.MAX_CLOCKS&&(s+="+"),t.set(o,s)}}this.editor.dispatch({effects:[Ul.set.of(t)]})}}setCurrentLine(e,t){var r=i=>{this.editor.dispatch({effects:[pa.set.of(i.line),Gl.effect.of(t?i.line:null),...t?[F.scrollIntoView(this.editor.state.doc.line(i.line).from,{y:"center"})]:[]]})};if(this.clearCurrentLine(t),e){if(e.line<1||e.line>this.editor.state.doc.lines)return;if(r(e),t){let s=this.editor.state.doc.line(e.line).from+(e.start||0);this.editor.dispatch({selection:{anchor:s,head:s},effects:F.scrollIntoView(s,{y:"center"})})}this.currentDebugLine=e}}clearCurrentLine(e){if(this.currentDebugLine){if(e){let t=this.editor.state.selection.main.head;this.editor.dispatch({selection:{anchor:t,head:t}})}this.currentDebugLine=null}this.editor.dispatch({effects:[pa.set.of(null),Gl.effect.of(null)]})}getActiveLine(){if(this.sourcefile){var e=en&&en.c;if(!e&&P.getCPUState&&!P.isRunning()&&(e=P.getCPUState()),e){var t=e&&(e.EPC||e.PC),r=this.sourcefile.findLineForOffset(t,ga);return r}}}refreshDebugState(e){var t=this.getActiveLine();!e&&(t===this.currentDebugLine||!t&&!this.currentDebugLine)||this.setCurrentLine(t,e)}refreshListing(){var e=re.getListingForFile(this.path);e&&e.sourcefile&&e.sourcefile!==this.sourcefile&&(this.sourcefile=e.sourcefile,this.dirtylisting=!0),!(!this.sourcefile||!this.dirtylisting)&&(this.updateListing(),this.dirtylisting=!1)}refresh(e){this.refreshListing(),this.refreshDebugState(e)}tick(){this.refreshDebugState(!1),this.updateTracedLines()}updateTracedLines(){let e=this.probe;if(!e||!e.idx||!this.sourcefile)return;let t=new Set;for(let r=0;r<e.idx;r++){let i=e.buf[r];if((i&4278190080)===16777216){let s=this.sourcefile.findLineForOffset(i&65535,ga);s&&(this.tracedLineCounts.set(s.line,(this.tracedLineCounts.get(s.line)||0)+1),t.add(s.line))}}e.clear(),this.editor.dispatch({effects:hu.effect.of(hQ(this.tracedLineCounts,t))})}getLine(e){return this.editor.state.doc.line(e).text}getCurrentLine(){let e=this.editor.state.selection.main.head;return this.editor.state.doc.lineAt(e).number}getCursorPC(){for(var e=this.getCurrentLine();this.sourcefile&&e>=0;){var t=this.sourcefile.line2offset.get(e);if(t>=0)return t;e--}return-1}undoStep(){Pl(this.editor)}redoStep(){Ko(this.editor)}syncBreakpoints(){let e=Yt.getSourceBreakpointsForFile(this.path).map(t=>({line:t.line,enabled:t.enabled}));this.editor.dispatch({effects:au.setAll.of(e)})}};Hl.tracingEnabled=!1;var un=Hl,Ib=1024,Ri=class{getSelectionText(){return zb(this.disasmview)}createDiv(e){var t=document.createElement("div");return t.setAttribute("class","editor"),e.appendChild(t),this.newEditor(t),t}newEditor(e){this.disasmview=new F({parent:e,extensions:[Zd(),Id(),Me.allowMultipleSelections.of(!0),Ld(),Dd(),Lh(),W$,Hh,Gl.field,Me.tabSize.of(8),Me.readOnly.of(!0)]})}refresh(e,t){let r=en||P.saveState(),i=t!==void 0?t:r.c?r.c.PC:0,s=0,o=0,a=P.debugSymbols&&P.debugSymbols.addr2symbol||{},l=(h,u)=>{let f="",m=0;for(;m<u;){let O=h+m|0,S=P.disassemble(O,P.readAddress.bind(P)),x="",D="";for(l
Line truncated
|
|
|
|
|
`;f+=Z,O==i&&(o=s),s++,m+=S.nbytes||1}return f};var c=i<0?i-Ib:Math.max(0,i-Ib);let d=l(c,i-c)+l(i,Ib);if(this.disasmview.dispatch({changes:{from:0,to:this.disasmview.state.doc.length,insert:d}}),e){let h=this.disasmview.state.doc.line(o+1);this.disasmview.dispatch({selection:{anchor:h.from,head:h.from},effects:F.scrollIntoView(h.from,{y:"center"})})}}goToAddress(e){e|=0,this.findAndSelectAddress(e)||(this.refresh(!1,e),this.findAndSelectAddress(e)),this.disasmview.focus()}findAndSelectAddress(e){let t=_e(e,4),r=this.disasmview.state.doc;for(let i=1;i<=r.lines;i++){let s=r.line(i);if(s.text.startsWith(t+" "))return this.disasmview.dispatch({selection:{anchor:s.from,head:s.from+t.length},effects:F.scrollIntoView(s.from,{y:"center"})}),!0}return!1}getCursorPC(){let e=this.disasmview.state.selection.main.head,t=this.disasmview.state.doc.lineAt(e).number;if(t>=0){let i=this.disasmview.state.doc.line(t).text.trim().split(/\s+/);if(i&&i.length>=1){let s=parseInt(i[0],16);if(console.log("getCursorPC",s),s>=0)return s}}return-1}},uu=class extends Ri{constructor(e){super(),this.path=e}refreshListing(){var e=re.getListingForFile(this.path);this.assemblyfile=e&&(e.assemblyfile||e.sourcefile)}refresh(e){if(this.refreshListing(),!!this.assemblyfile){var t=this.assemblyfile.text;if(this.disasmview.dispatch({changes:{from:0,to:this.disasmview.state.doc.length,insert:t}}),!!P.saveState){var r=en||P.saveState(),i=r.c?r.c.EPC||r.c.PC:0;if(i>=0&&this.assemblyfile){var s=this.assemblyfile.findLineForOffset(i,ga);if(s&&e){let o=this.disasmview.state.doc.line(s.line);this.disasmview.dispatch({selection:{anchor:o.from,head:o.from},effects:F.scrollIntoView(o.from,{y:"center"})})}}}}}goToAddress(e){this.refreshListing();let t=this.assemblyfile&&this.assemblyfile.findLineForOffset(e,ga);if(t){let r=this.disasmview.state.doc.line(t.line);this.disasmview.dispatch({selection:{anchor:r.from,head:r.from},effects:F.scrollIntoView(r.from,{y:"center"})})}this.disasmview.focus()}};function QQ(n){let e=[n];try{var t=Da(re.mainPath);t.length>0&&t!="local"&&e.push(t+"/"+n)}catch(s){}for(var r of e){var i=re&&re.getFile(r);if(typeof i=="string")return r}return null}function vQ(n){for(var e of Cy(n))if(e.editorStyle){var t=z$(e.editorStyle);if(t)return t}return null}var ma=new Map;async function TQ(n){var e=await re.queryWorker(n),t=e&&e.output;return t instanceof Uint8Array&&t.length>0?new TextDecoder().decode(t):null}function TX(n){let e=re.platform_id,t="lib:"+e+":"+n;return ma.has(t)||ma.set(t,TQ({platform:e,readlib:n,updates:[],buildsteps:[]})),ma.get(t)}function AX(n){let e=re.getToolForFilename(re.mainPath),t=Ic(e,re.platform_id),r=Zc(e,re.platform_id);if(!t||!r.length)return Promise.resolve(null);let i=t+":"+n;return ma.has(i)||ma.set(i,(async()=>{var s=[...r.map(l=>l+"/"+n),n];for(var o of s){var a=await TQ({preload_fs:t,readshared:o,updates:[],buildsteps:[]});if(a!=null)return a}return null})()),ma.get(i)}async function CX(n){var e;return(e=await TX(n))!=null?e:AX(n)}var hs=class{constructor(e){this.fn=e;this.languageCompartment=new Vt}getSelectionText(){return zb(this.view)}createDiv(e){var t=document.createElement("div");t.setAttribute("class","editor"),e.appendChild(t);var r=vQ(this.fn||this.currentPath||"")||xb();return this.view=new F({parent:t,extensions:[Zd(),Id(),Me.allowMultipleSelections.of(!0),Ld(),Dd(),Lh(),qg({top:!0}),Sn.of(wQ),this.languageCompartment.of(r),Kh,Pb,Me.readOnly.of(!0)]}),this.refresh(!1),t}setVisible(e){e&&this.refresh(!1)}setHeaderText(e){var t=vQ(this.currentPath||this.fn||"")||xb();this.view.dispatch({effects:this.languageCompartment.reconfigure(t),changes:{from:0,to:this.view.state.doc.length,insert:e}})}refresh(e){var t=this.fn;if(!t){var r=window.location.hash;if(!r||!r.startsWith("#headerview/"))return;t=this.fn=decodeURIComponent(r.substring(12))}this.loadIncludeFile(t)}async loadIncludeFile(e){this.requestedFn=e;var t=QQ(e);if(t){this.currentPath=t,this.setHeaderText(re.getFile(t));return}var r=await CX(e);if(this.requestedFn===e){if(r!=null){this.currentPath=e,this.setHeaderText(r);return}this.currentPath=e,this.setHeaderText("// "+e+` was not found.
|
|
|
|
|
`,t.className="cm-line",t}},OQ=ye.define(),vX=Xe.define({create(){return K.none},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(OQ)){if(t.value===null||!t.value)return K.none;let r=e.state.doc.lineAt(t.value.range.to);return K.set([K.widget({widget:new Lb(t.value.val),block:!0,side:1}).range(r.to)])}return n},provide:n=>F.decorations.from(n)}),bQ=ye.define(),wX=K.mark({attributes:{class:"cm-error-span"}}),xX=K.mark({attributes:{class:"cm-warning-span"}}),PX=Xe.define({create(){return K.none},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(bQ)){if(t.value===null)return K.none;let r=[];for(let i of t.value)try{let s=e.state.doc.line(i.line),o=s.from+i.start,a=s.from+i.end;o>=s.from&&a<=s.to&&o<a&&r.push((i.warning?xX:wX).range(o,a))}catch(s){}return K.set(r,!0)}return n},provide:n=>F.decorations.from(n)}),yQ=ye.define(),kX=K.line({attributes:{class:"highlight-lines"}}),$X=Xe.define({create(){return K.none},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(yQ)){if(t.value===null)return K.none;let{start:r,end:i}=t.value,s=[];for(let o=r;o<=i;o++)try{let a=e.state.doc.line(o);s.push(kX.range(a.from))}catch(a){}return K.set(s)}return n!==K.none&&(e.docChanged||e.selection)?K.none:n},provide:n=>F.decorations.from(n)}),SQ={field:SX,widget:ql},Gl={effect:mQ,decoration:gQ,field:yX},lu={effect:OQ,field:vX},cu={effect:bQ,field:PX},du={effect:yQ,field:$X},vQ=ye.define(),wQ=[];for(let n=0;n<4;n++)wQ.push(K.line({attributes:{class:`cm-traced-line cm-traced-line-h${n}`}}));var QX=Xe.define({create(){return K.none},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(vQ)){let r=[];for(let{line:i,level:s}of t.value)try{let o=e.state.doc.line(i),a=wQ[Math.max(0,Math.min(3,s|0))];r.push(a.range(o.from))}catch(o){}return K.set(r,!0)}return n},provide:n=>F.decorations.from(n)}),hu={effect:vQ,field:QX};var TX=[...Rf(t1,Ef),{key:"Mod-Shift-Backspace",run:Qg}],PQ=Rf(cP,Ef),ga=64,kQ=ye.define(),$Q=ye.define(),Db=Xe.define({create(){return new Map},update(n,e){let t=n;for(let r of e.effects)if(r.is($Q))t=new Map;else if(r.is(kQ)){t===n&&(t=new Map(n));for(let i of r.value)t.set(i.id,{from:i.from,to:i.to})}if(!e.changes.empty){let r=new Map;for(let[i,s]of t)r.set(i,{from:e.changes.mapPos(s.from,-1),to:e.changes.mapPos(s.to,1)});return r}return t}}),AX=200,Zb={default:{theme:Kh},6502:{isAsm:!0},z80:{isAsm:!0},jsasm:{isAsm:!0},gas:{isAsm:!0},vasm:{isAsm:!0},inform6:{theme:Hh},dialog:{theme:Hh,lineWrap:!0},markdown:{lineWrap:!0},fastbasic:{noGutters:!0},basic:{noGutters:!0,lineBased:!0},ecs:{theme:Kh}},QQ={input:null};function TQ(n){QQ.input=n?e=>e.toUpperCase():null}function zb(n){if(!n)return"";let e=n.state.selection.main;return e.empty?"":n.state.sliceDoc(e.from,e.to)}var Hl=class Hl{constructor(e,t){this.updateTimer=null;this.indentUnitCompartment=new Vt;this.isAsm=!1;this.dirtylisting=!0;this.refreshDelayMsec=300;this.probe=null;this.tracedLineCounts=new Map;this.path=e,this.mode=t}createDiv(e){var t=document.createElement("div");t.setAttribute("class","editor"),e.appendChild(t);var r=re.getFile(this.path),i=r&&this.mode=="verilog"&&/__asm\b([\s\S]+?)\b__endasm\b/.test(r);return this.newEditor(t,r,i),this.editor.dispatch({effects:H$(QQ)}),this.syncBreakpoints(),re.getToolForFilename(this.path).startsWith("remote:")&&(this.refreshDelayMsec=1e3),t}setVisible(e){e?(this.editor.focus(),Hl.tracingEnabled&&this.startTracing()):this.stopTracing()}getShortcuts(){if(!this.editor)return[];var e=this.editor,t=(r,i,s)=>({key:r,label:i,fn:()=>{s(e),e.focus()}});return[t("mod+f","Find",Dh),t("mod+g","Find Next",la),t("mod+d","Next Occurrence",Ug),t("mod+z","Undo",Pl),t("mod+shift+z","Redo",Ko)]}startTracing(){!this.probe&&P.startProbing&&(this.probe=P.startProbing(),this.probe.singleFrame=!1,this.probe.clear(),this.tracedLineCounts.clear())}stopTracing(){this.probe&&(P.stopProbing(),this.probe=null),this.tracedLineCounts.clear(),this.editor.dispatch({effects:hu.effect.of([])})}setTracingEnabled(e){Hl.tracingEnabled=e,e?this.startTracing():this.stopTracing()}newEditor(e,t,r){var i=Zb[this.mode]||Zb.default,s=r||i.isAsm,o=!!i.lineWrap,a=i.theme||Zb.default.theme,l=i.useLineNumbers&&!ds;he.embed&&(l=!1,s=!1),this.isAsm=s;let c=i.noGutters||ds;var d;let h=wb[this.mode];h?d=h.language:(console.warn("Unknown mode: "+this.mode),d=null),this.editor=new F({parent:e,doc:t,extensions:[this.indentUnitCompartment.of(this.indentUnitFor(t)),s?lg.of((u,f)=>{let m=u.state.doc.lineAt(f).number;if(m>=0){let O=u.state.doc.line(m);if(O.text.trim())return u.lineIndent(O.from)}return 0}):[],...s?[Sn.of(c1(()=>na().tabsToSpaces))]:[],i.lineBased?Sn.of(r1):[],...f1(na()),Sn.of(TX),l?Xd():[],Px(),Sn.of(Qx),Bw(),Jv(),Me.allowMultipleSelections.of(!0),Ld(),Xw(),Uw(),Zd(),Id(),Dd(),lw(),Lh(),qg({top:!0}),Sn.of(PQ),d||[],a,Pb,o?F.lineWrapping:[],Gl.field,c?[]:[su.field,su.gutter],s&&!c?[Ul.field,Ul.gutter,ou.field,ou.gutter]:[],au.field,uQ.gutter,F.updateListener.of(u=>{for(let f of u.transactions.flatMap(m=>m.effects))i
Line truncated
|
|
|
|
|
`).length-1;this.editor.dispatch({changes:{from:i,insert:e}}),this.highlightLines(r-1,r+s-2)}highlightLines(e,t){let r=this.editor.state.doc.line(e+1);this.editor.dispatch({effects:[du.effect.of({start:e+1,end:t+1}),F.scrollIntoView(r.from,{y:"start",yMargin:100})]})}navigateToLine(e){if(e<1||e>this.editor.state.doc.lines)return;let t=this.editor.state.doc.line(e);this.editor.dispatch({selection:{anchor:t.from},effects:[du.effect.of({start:e,end:e}),F.scrollIntoView(t.from,{y:"center"})]}),this.editor.focus()}getValue(){return this.editor.state.doc.toString()}getSelectionText(){return zb(this.editor)}getPath(){return this.path}markErrors(e){this.clearErrors(),e=e.slice(0,AX);let t=new Map,r=[];for(var i of e)if(!i.path||this.path.endsWith(i.path)){var s=this.editor.state.doc.lines,o=i.line;(isNaN(o)||o<1||o>s)&&(o=1),i.severity==="warning"&&t.has(o)||t.set(o,{msg:i.msg,warning:i.severity==="warning"}),i.start!=null&&i.end!=null&&i.end>i.start&&r.push({line:o,start:i.start,end:i.end,warning:i.severity==="warning"})}this.editor.dispatch({effects:[lo.set.of(t),cu.effect.of(r.length>0?r:null)]})}clearErrors(){this.dirtylisting=!0,this.editor.dispatch({effects:[lo.set.of(new Map),lo.showMessage.of(null),cu.effect.of(null)]})}getSourceFile(){return this.sourcefile}updateListing(){this.clearErrors();var e=this.sourcefile.lines||[];let t=new Map,r=new Map,i=new Map;for(var s of e)if(s.offset>=0&&t.set(s.line,_e(s.offset&65535,4)),s.insns){var o=s.insns.length>9?"...":s.insns;if(r.set(s.line,o),s.iscode){if(s.cycles)i.set(s.line,s.cycles+"");else if(P.getOpcodeMetadata){var a=parseInt(s.insns.split(" ")[0],16),l=P.getOpcodeMetadata(a,s.offset);if(l&&l.minCycles){var c=l.minCycles+"";i.set(s.line,c)}}}}this.editor.dispatch({effects:[su.set.of(t),Ul.set.of(r),ou.set.of(i)]})}setTimingResult(e){if(this.sourcefile!=null){var t=new Map;for(let[o,a]of this.sourcefile.line2offset){let l=e.pc2clockrange[a];var r=l&&l.minclocks,i=l&&l.maxclocks;if(r>=0&&i>=0){var s;i==r?s=r+"":s=r+"-"+i,i==e.MAX_CLOCKS&&(s+="+"),t.set(o,s)}}this.editor.dispatch({effects:[Ul.set.of(t)]})}}setCurrentLine(e,t){var r=i=>{this.editor.dispatch({effects:[pa.set.of(i.line),Gl.effect.of(t?i.line:null),...t?[F.scrollIntoView(this.editor.state.doc.line(i.line).from,{y:"center"})]:[]]})};if(this.clearCurrentLine(t),e){if(e.line<1||e.line>this.editor.state.doc.lines)return;if(r(e),t){let s=this.editor.state.doc.line(e.line).from+(e.start||0);this.editor.dispatch({selection:{anchor:s,head:s},effects:F.scrollIntoView(s,{y:"center"})})}this.currentDebugLine=e}}clearCurrentLine(e){if(this.currentDebugLine){if(e){let t=this.editor.state.selection.main.head;this.editor.dispatch({selection:{anchor:t,head:t}})}this.currentDebugLine=null}this.editor.dispatch({effects:[pa.set.of(null),Gl.effect.of(null)]})}getActiveLine(){if(this.sourcefile){var e=en&&en.c;if(!e&&P.getCPUState&&!P.isRunning()&&(e=P.getCPUState()),e){var t=e&&(e.EPC||e.PC),r=this.sourcefile.findLineForOffset(t,ga);return r}}}refreshDebugState(e){var t=this.getActiveLine();!e&&(t===this.currentDebugLine||!t&&!this.currentDebugLine)||this.setCurrentLine(t,e)}refreshListing(){var e=re.getListingForFile(this.path);e&&e.sourcefile&&e.sourcefile!==this.sourcefile&&(this.sourcefile=e.sourcefile,this.dirtylisting=!0),!(!this.sourcefile||!this.dirtylisting)&&(this.updateListing(),this.dirtylisting=!1)}refresh(e){this.refreshListing(),this.refreshDebugState(e)}tick(){this.refreshDebugState(!1),this.updateTracedLines()}updateTracedLines(){let e=this.probe;if(!e||!e.idx||!this.sourcefile)return;let t=new Set;for(let r=0;r<e.idx;r++){let i=e.buf[r];if((i&4278190080)===16777216){let s=this.sourcefile.findLineForOffset(i&65535,ga);s&&(this.tracedLineCounts.set(s.line,(this.tracedLineCounts.get(s.line)||0)+1),t.add(s.line))}}e.clear(),this.editor.dispatch({effects:hu.effect.of(fQ(this.tracedLineCounts,t))})}getLine(e){return this.editor.state.doc.line(e).text}getCurrentLine(){let e=this.editor.state.selection.main.head;return this.editor.state.doc.lineAt(e).number}getCursorPC(){for(var e=this.getCurrentLine();this.sourcefile&&e>=0;){var t=this.sourcefile.line2offset.get(e);if(t>=0)return t;e--}return-1}undoStep(){Pl(this.editor)}redoStep(){Ko(this.editor)}syncBreakpoints(){let e=Yt.getSourceBreakpointsForFile(this.path).map(t=>({line:t.line,enabled:t.enabled}));this.editor.dispatch({effects:au.setAll.of(e)})}};Hl.tracingEnabled=!1;var un=Hl,Ib=1024,Ri=class{getSelectionText(){return zb(this.disasmview)}createDiv(e){var t=document.createElement("div");return t.setAttribute("class","editor"),e.appendChild(t),this.newEditor(t),t}newEditor(e){this.disasmview=new F({parent:e,extensions:[Zd(),Id(),Me.allowMultipleSelections.of(!0),Ld(),Dd(),Lh(),B$,Hh,Gl.field,Me.tabSize.of(8),Me.readOnly.of(!0)]})}refresh(e,t){let r=en||P.saveState(),i=t!==void 0?t:r.c?r.c.PC:0,s=0,o=0,a=P.debugSymbols&&P.debugSymbols.addr2symbol||{},l=(h,u)=>{let f="",m=0;for(;m<u;){let O=h+m|0,S=P.disassemble(O,P.readAddress.bind(P)),x="",D="";for(l
Line truncated
|
|
|
|
|
`;f+=Z,O==i&&(o=s),s++,m+=S.nbytes||1}return f};var c=i<0?i-Ib:Math.max(0,i-Ib);let d=l(c,i-c)+l(i,Ib);if(this.disasmview.dispatch({changes:{from:0,to:this.disasmview.state.doc.length,insert:d}}),e){let h=this.disasmview.state.doc.line(o+1);this.disasmview.dispatch({selection:{anchor:h.from,head:h.from},effects:F.scrollIntoView(h.from,{y:"center"})})}}goToAddress(e){e|=0,this.findAndSelectAddress(e)||(this.refresh(!1,e),this.findAndSelectAddress(e)),this.disasmview.focus()}findAndSelectAddress(e){let t=_e(e,4),r=this.disasmview.state.doc;for(let i=1;i<=r.lines;i++){let s=r.line(i);if(s.text.startsWith(t+" "))return this.disasmview.dispatch({selection:{anchor:s.from,head:s.from+t.length},effects:F.scrollIntoView(s.from,{y:"center"})}),!0}return!1}getCursorPC(){let e=this.disasmview.state.selection.main.head,t=this.disasmview.state.doc.lineAt(e).number;if(t>=0){let i=this.disasmview.state.doc.line(t).text.trim().split(/\s+/);if(i&&i.length>=1){let s=parseInt(i[0],16);if(console.log("getCursorPC",s),s>=0)return s}}return-1}},uu=class extends Ri{constructor(e){super(),this.path=e}refreshListing(){var e=re.getListingForFile(this.path);this.assemblyfile=e&&(e.assemblyfile||e.sourcefile)}refresh(e){if(this.refreshListing(),!!this.assemblyfile){var t=this.assemblyfile.text;if(this.disasmview.dispatch({changes:{from:0,to:this.disasmview.state.doc.length,insert:t}}),!!P.saveState){var r=en||P.saveState(),i=r.c?r.c.EPC||r.c.PC:0;if(i>=0&&this.assemblyfile){var s=this.assemblyfile.findLineForOffset(i,ga);if(s&&e){let o=this.disasmview.state.doc.line(s.line);this.disasmview.dispatch({selection:{anchor:o.from,head:o.from},effects:F.scrollIntoView(o.from,{y:"center"})})}}}}}goToAddress(e){this.refreshListing();let t=this.assemblyfile&&this.assemblyfile.findLineForOffset(e,ga);if(t){let r=this.disasmview.state.doc.line(t.line);this.disasmview.dispatch({selection:{anchor:r.from,head:r.from},effects:F.scrollIntoView(r.from,{y:"center"})})}this.disasmview.focus()}};function AQ(n){let e=[n];try{var t=Da(re.mainPath);t.length>0&&t!="local"&&e.push(t+"/"+n)}catch(s){}for(var r of e){var i=re&&re.getFile(r);if(typeof i=="string")return r}return null}function xQ(n){for(var e of Cy(n))if(e.editorStyle){var t=N$(e.editorStyle);if(t)return t}return null}var ma=new Map;async function CQ(n){var e=await re.queryWorker(n),t=e&&e.output;return t instanceof Uint8Array&&t.length>0?new TextDecoder().decode(t):null}function CX(n){let e=re.platform_id,t="lib:"+e+":"+n;return ma.has(t)||ma.set(t,CQ({platform:e,readlib:n,updates:[],buildsteps:[]})),ma.get(t)}function _X(n){let e=re.getToolForFilename(re.mainPath),t=Ic(e,re.platform_id),r=Zc(e,re.platform_id);if(!t||!r.length)return Promise.resolve(null);let i=t+":"+n;return ma.has(i)||ma.set(i,(async()=>{var s=[...r.map(l=>l+"/"+n),n];for(var o of s){var a=await CQ({preload_fs:t,readshared:o,updates:[],buildsteps:[]});if(a!=null)return a}return null})()),ma.get(i)}async function EX(n){var e;return(e=await CX(n))!=null?e:_X(n)}var hs=class{constructor(e){this.fn=e;this.languageCompartment=new Vt}getSelectionText(){return zb(this.view)}createDiv(e){var t=document.createElement("div");t.setAttribute("class","editor"),e.appendChild(t);var r=xQ(this.fn||this.currentPath||"")||xb();return this.view=new F({parent:t,extensions:[Zd(),Id(),Me.allowMultipleSelections.of(!0),Ld(),Dd(),Lh(),qg({top:!0}),Sn.of(PQ),this.languageCompartment.of(r),Kh,Pb,Me.readOnly.of(!0)]}),this.refresh(!1),t}setVisible(e){e&&this.refresh(!1)}setHeaderText(e){var t=xQ(this.currentPath||this.fn||"")||xb();this.view.dispatch({effects:this.languageCompartment.reconfigure(t),changes:{from:0,to:this.view.state.doc.length,insert:e}})}refresh(e){var t=this.fn;if(!t){var r=window.location.hash;if(!r||!r.startsWith("#headerview/"))return;t=this.fn=decodeURIComponent(r.substring(12))}this.loadIncludeFile(t)}async loadIncludeFile(e){this.requestedFn=e;var t=AQ(e);if(t){this.currentPath=t,this.setHeaderText(re.getFile(t));return}var r=await EX(e);if(this.requestedFn===e){if(r!=null){this.currentPath=e,this.setHeaderText(r);return}this.currentPath=e,this.setHeaderText("// "+e+` was not found.
|
|
|
|
|
// Project include files are loaded during a build -- try building first.
|
|
|
|
|
// Library and toolchain headers are only available when the platform or tool bundles them.`)}}navigateToLine(e){if(!(!this.view||e<1)&&e<=this.view.state.doc.lines){let t=this.view.state.doc.line(e);this.view.dispatch({selection:{anchor:t.from},effects:[F.scrollIntoView(t.from,{y:"center"})]}),this.view.focus()}}};var co=class{constructor(e){var t=document.createElement("div");t.setAttribute("class","memdump"),e.appendChild(t),this.maindiv=t}create(e,t,r){this.getLineAt=r,this.memorylist=new Nn({w:$(e).width(),h:$(e).height(),itemHeight:Wb(),totalRows:t,generatorFn:i=>{var s=r(i),o=document.createElement("div");return o.appendChild(document.createTextNode(s.text)),s.clas!=null&&(o.className=s.clas),o}}),$(this.maindiv).append(this.memorylist.container)}setRowCount(e){if(!(!this.memorylist||this.memorylist.totalRows===e)){this.memorylist.totalRows=e;var t=this.memorylist.container.firstChild;t&&(t.style.height=e*this.memorylist.itemHeight+"px")}}refresh(){this.memorylist&&$(this.maindiv).find("[data-index]").each((e,t)=>{var r=t,i=parseInt(r.getAttribute("data-index")),s=r.innerText,o=this.getLineAt(i),a=o.text;if(s!=a&&(r.innerText=a,o.clas!=null&&!r.classList.contains(o.clas))){var l=Array.from(r.classList);l.forEach(c=>r.classList.remove(c)),r.classList.add("vrow"),r.classList.add(o.clas)}})}};function Wb(){return $("#dropdownMenuButton").first().height()}function _X(n){return n.start+Math.max(1,n.size||0)}function EX(n,e){n.sort((s,o)=>s.start-o.start||o.end-s.end);let t=[],r=[],i=[];for(let s of n){let o=t.findIndex(a=>a<=s.start);if(o<0&&t.length<e&&(o=t.length),o<0){let a=r[e-1];(a.hidden=a.hidden||[]).push(s);continue}t[o]=s.end,r[o]=s,s.lane=o,i.push(s)}return i}function fu(n,e,t,r){t=EX(t,r);let i=Math.max(1,...t.map(s=>s.lane+1));return{id:n,title:e,lanes:i,blocks:t}}function AQ(n,e,t,r){let i=n.slice().sort((a,l)=>a.start-l.start),s=[],o=e;for(let a of i)a.start>o&&s.push({name:t,start:o,end:a.start,type:r,lane:0}),o=Math.max(o,a.end);return n.concat(s)}function CQ(n){return{name:n.name,start:n.start,end:_X(n),type:n.type,lane:0}}function RX(n){return n.startsWith("__")||/^[sl]__/.test(n)||n.startsWith(".")}function MX(n,e,t,r){var h,u;let i=(h=t==null?void 0:t.minVarSize)!=null?h:128,s=(u=t==null?void 0:t.maxVars)!=null?u:64,o=e.filter(f=>f.type=="ram"&&f.size>0);if(!n||!o.length)return[];let a=f=>r==null?void 0:r[f],l=new Map;for(let[f,m]of Object.entries(n)){if(typeof m!="number"||RX(f))continue;let O=l.get(m);(O==null||!a(O)&&a(f))&&l.set(m,f)}let c=Array.from(l.keys()).sort((f,m)=>f-m),d=[];for(let f=0;f<c.length;f++){let m=c[f],O=null;for(let k of o)m>=k.start&&m<k.start+k.size&&(!O||k.size<O.size)&&(O=k);if(!O)continue;let S=l.get(m),x=a(S);if(x!=null){x>=i&&d.push({name:S,start:m,end:m+x,type:"var",lane:0});continue}let D=O.start+O.size,M=f+1<c.length?c[f+1]:1/0;if(M>=D&&O.source!="linker")continue;let Z=Math.min(M,D);Z-m>=i&&d.push({name:S,start:m,end:Z,type:"var",lane:0,approx:!0})}return d.sort((f,m)=>m.end-m.start-(f.end-f.start)),d.slice(0,s)}function _Q(n,e=4096,t=1024){if(n.length<2)return null;let r=n[0],i=n[n.length-1];if((i-r)/e>t)return null;let s=n.slice();for(let c=Math.ceil(r/e)*e;c<i;c+=e){let d=0,h=s.length;for(;d<h;){let u=d+h>>1;s[u]<c?d=u+1:h=u}s[d]!==c&&s.splice(d,0,c)}let o=[],a=[],l=0;for(let c=0;c+1<s.length;c++){let d=s[c],h=s[c+1];for(;n[l+1]<=d;)l++;o.push((h-d)/(n[l+1]-n[l])),a.push(l)}return{bounds:s,weights:o,parents:a}}function EQ(n,e,t){let r=0;for(;r<e.length-1&&t>=e[r];)t-=e[r],r++;let i=e[r]>0?Math.max(0,Math.min(1,t/e[r])):0,s=n[r],o=n[r+1];return Math.min(Math.floor(s+(o-s)*i),o-1)}function RQ(n,e,t,r){var u;n=n||[];let i=(u=t==null?void 0:t.maxLanes)!=null?u:2,s=[],o=n.filter(f=>f.source=="native").map(CQ),a=n.filter(f=>f.source!="native").map(CQ);if(o.length&&s.push(fu("native","System",AQ(o,0,"","unmapped"),i)),a.length){let f=Math.min(...a.map(m=>m.start));s.push(fu("linker","Segments",AQ(a,f,"","free"),i))}let l=[];for(let f of n)(f.modules||[]).forEach((m,O)=>l.push({name:m.name,start:m.start,end:m.start+m.size,type:"module"+(O&1),lane:0}));l.length&&s.push(fu("modules","Modules",l,i));let c=l.length?[]:MX(e,n,t,r);c.length&&s.push(fu("vars","Objects",c,i));let d=new Set;for(let f of s)for(let m of f.blocks)d.add(m.start),d.add(m.end);return{bounds:Array.from(d).sort((f,m)=>f-m),columns:s}}function MQ(n,e,t,r,i=65536){let s=[],o=0,a,l=0,c=d=>{let h=1/0;for(let u of t||[])d>=u.start&&d<u.start+u.size&&(h=Math.min(h,u.start+u.size));return h};for(let d of Object.keys(n)){let h=parseInt(d),u=n[h];if(a){let f=r!=null&&r(a)?"":a,m=e==null?void 0:e[a],O=m!=null?l+m:c(l);for(O=Math.min(O,h);o<h&&s.length<i;){let S=o>=l&&o<O,x=o+16&1048560;S?x=Math.min(x,O):o<l&&(x=Math.min(x,l)),x>h&&(x=h),s.push({a:o,l:x-o,s:S?f:""}),o=x}}a=u,l=h}return s}function LQ(n){return n.endsWith("_SIZE__")||n.endsWith("_LAST__")||n.endsWith("STACKSIZE__")||n.endsWith("FILEOFFS__")||n.startsWith("l__")||n.startsWith("s__")||n.startsWith(".__.")}var us=class{constructor(){this.
Line truncated
|
|
|
|
|
`)),e.type&&s.addClass("segment-"+e.type);var l=t.lanes-e.lane;for(var c of t.blocks)c.lane>e.lane&&c.start<e.end&&c.end>e.start&&(l=Math.min(l,c.lane-e.lane));s.css("grid-row",`${i.indexOf(e.start)+2} / ${i.indexOf(e.end)+2}`),s.css("grid-column",`${r+e.lane} / span ${l}`),s.click(()=>{var d=N.createOrShow("#memory");d.scrollToAddress(e.start)}),this.maindiv.append(s)}refresh(){var D,M;this.maindiv.empty();var e=RQ(re.segments,(D=P.debugSymbols)==null?void 0:D.symbolmap,null,(M=P.debugSymbols)==null?void 0:M.symbolsizes),t=e.bounds;if(t.length){var r=_Q(t),i=r?r.bounds:t,s=["5em"],o=2,a=$('<div class="memmap-header" style="grid-row:1;grid-column:1"/>').text("Address");if(this.maindiv.append(a),r)for(var l=0;l+1<i.length;l++){var c=Math.floor(i[l]/4096)%2;$('<div class="memmap-stripe"/>').addClass(c?"memmap-stripe-odd":"memmap-stripe-even").css("grid-row",`${l+2}`).css("grid-column","1 / -1").appendTo(this.maindiv)}for(var d of e.columns){for(var l=0;l<d.lanes;l++)s.push("minmax(0,1fr)");$('<div class="memmap-header"/>').text(d.title).css("grid-row","1").css("grid-column",`${o} / span ${d.lanes}`).appendTo(this.maindiv);for(var h of d.blocks)this.addBlock(h,d,o,i);o+=d.lanes}for(var u=["auto"],f=[],l=0;l+1<i.length;l++){var m=i[l+1]-i[l],O=Math.max(3,Math.log(m+1))*.5;if(r){var S=r.parents[l],x=t[S+1]-t[S];O=Math.max(3,Math.log(x+1))*.5*r.weights[l]}u.push(O+"em"),f.push(O)}for(var l=0;l+1<t.length;l++)$('<div class="segment-offset"/>').text("$"+_e(t[l],4)).css("grid-row",`${i.indexOf(t[l])+2}`).css("grid-column","1").appendTo(this.maindiv);this.scrubRows={bounds:i,heights:f},this.scrubOverlay=$('<div class="memmap-scrub"/>').css("grid-row","2 / -1").css("grid-column","1").on("mousemove",Z=>this.scrubTo(Z)).on("mouseleave",()=>this.hideScrub()).appendTo(this.maindiv),this.maindiv.css("grid-template-columns",s.join(" ")),this.maindiv.css("grid-template-rows",u.join(" "))}}scrubTo(e){if(!(!this.scrubRows||!this.scrubOverlay)){var t=this.scrubOverlay[0].getBoundingClientRect(),r=this.scrubRows.bounds,i=this.scrubRows.heights,s=0;for(var o of i)s+=o;var a=(e.clientY-t.top)/t.height*s,l=EQ(r,i,a);this.scrubLabel||(this.scrubLabel=$('<div class="memmap-scrub-label"/>').appendTo(document.body)),this.scrubLabel.text("$"+_e(l,4)).css({left:e.clientX+12+"px",top:e.clientY+12+"px"}).show()}}hideScrub(){this.scrubLabel&&this.scrubLabel.hide()}},jr=4278190080,fs=class{constructor(){this.cumulativeData=!1;var e=160,t=262;try{e=Math.ceil(P.machine.cpuCyclesPerLine)||e,t=Math.ceil(P.machine.numTotalScanlines)||t}catch(r){}this.cyclesPerLine=e,this.totalScanlines=t}addr2symbol(e){var t=P.debugSymbols&&P.debugSymbols.addr2symbol||{};return t[e]}addr2str(e){var t=this.addr2symbol(e);return typeof t=="string"?"$"+_e(e)+" ("+t+")":"$"+_e(e)}showTooltip(e){e?(this.tooldiv||(this.tooldiv=document.createElement("div"),this.tooldiv.setAttribute("class","tooltiptrack"),document.body.appendChild(this.tooldiv)),$(this.tooldiv).text(e).show()):$(this.tooldiv).hide()}setVisible(e){e?(this.probe=P.startProbing(),this.probe.singleFrame=!this.cumulativeData,this.tick()):(this.probe&&(this.probe.singleFrame=!0),P.stopProbing(),this.probe=null)}redraw(e){var t=this.probe;if(!t||!t.idx)return 0;var r=0,i=0,s=0;this.sp=0;for(var o=0;o<t.idx;o++){var a=t.buf[o],l=a&65535,c=a>>16&255,d=a&jr;switch(d){case 2113929216:r++,i=0;break;case 2130706432:r=0,i=0;break;case 0:i+=l,s+=l;break;case 167772160:case 184549376:this.sp=l;default:e(d,l,i,r,s,c);break}}return s}opToString(e,t,r){var i="";switch(e){case 16777216:i="Exec";break;case 301989888:i="Read";break;case 318767104:i="Write";break;case 335544320:i="IO Read";break;case 352321536:i="IO Write";break;case 369098752:i="VRAM Read";break;case 385875968:i="VRAM Write";break;case 402653184:i="DMA Read";break;case 419430400:i="DMA Write";break;case 134217728:i="Interrupt";break;case 150994944:i="Error";break;case 520093696:i="Wait";break;case 167772160:i="Stack Push";break;case 184549376:i="Stack Pop";break;default:return""}return typeof t=="number"&&(i+=" "+this.addr2str(t)),e&268435456&&typeof r=="number"&&(i+=" = $"+_e(r,2)),i}getOpRGB(e,t){switch(e){case 16777216:return 98305;case 301989888:return 8388865;case 318767104:return 65920;case 335544320:return 98432;case 352321536:return 12583296;case 402653184:case 369098752:return 8421377;case 419430400:case 385875968:return 4227264;case 134217728:return 4177727;case 150994944:return 4145151;case 520093696:return 16727871;default:return 0}}},Nb=class extends fs{constructor(){super(...arguments);this.recreateOnResize=!0}createCanvas(t,r,i){var s=document.createElement("div"),o=document.createElement("canvas");return o.width=r,o.height=i,o.classList.add("pixelated"),o.style.width="100%",o.style.height="90vh",o.style.backgroundColor="black",o.style.cursor="crosshair",o.onmousemove=a=>{var l=xc(o,a);this.showTooltip(this.getTooltipText(l.x,l.y)),$(this.tooldiv).css("left",a.pageX+10).css("top",a.pageY-30)},o.onmouseout=a=>{$(this.tooldiv).hide()},t.append
Line truncated
|
|
|
|
|
// Library and toolchain headers are only available when the platform or tool bundles them.`)}}navigateToLine(e){if(!(!this.view||e<1)&&e<=this.view.state.doc.lines){let t=this.view.state.doc.line(e);this.view.dispatch({selection:{anchor:t.from},effects:[F.scrollIntoView(t.from,{y:"center"})]}),this.view.focus()}}};var co=class{constructor(e){var t=document.createElement("div");t.setAttribute("class","memdump"),e.appendChild(t),this.maindiv=t}create(e,t,r){this.getLineAt=r,this.memorylist=new Nn({w:$(e).width(),h:$(e).height(),itemHeight:Wb(),totalRows:t,generatorFn:i=>{var s=r(i),o=document.createElement("div");return o.appendChild(document.createTextNode(s.text)),s.clas!=null&&(o.className=s.clas),o}}),$(this.maindiv).append(this.memorylist.container)}setRowCount(e){if(!(!this.memorylist||this.memorylist.totalRows===e)){this.memorylist.totalRows=e;var t=this.memorylist.container.firstChild;t&&(t.style.height=e*this.memorylist.itemHeight+"px")}}refresh(){this.memorylist&&$(this.maindiv).find("[data-index]").each((e,t)=>{var r=t,i=parseInt(r.getAttribute("data-index")),s=r.innerText,o=this.getLineAt(i),a=o.text;if(s!=a&&(r.innerText=a,o.clas!=null&&!r.classList.contains(o.clas))){var l=Array.from(r.classList);l.forEach(c=>r.classList.remove(c)),r.classList.add("vrow"),r.classList.add(o.clas)}})}};function Wb(){return $("#dropdownMenuButton").first().height()}function RX(n){return n.start+Math.max(1,n.size||0)}function MX(n,e){n.sort((s,o)=>s.start-o.start||o.end-s.end);let t=[],r=[],i=[];for(let s of n){let o=t.findIndex(a=>a<=s.start);if(o<0&&t.length<e&&(o=t.length),o<0){let a=r[e-1];(a.hidden=a.hidden||[]).push(s);continue}t[o]=s.end,r[o]=s,s.lane=o,i.push(s)}return i}function fu(n,e,t,r){t=MX(t,r);let i=Math.max(1,...t.map(s=>s.lane+1));return{id:n,title:e,lanes:i,blocks:t}}function _Q(n,e,t,r){let i=n.slice().sort((a,l)=>a.start-l.start),s=[],o=e;for(let a of i)a.start>o&&s.push({name:t,start:o,end:a.start,type:r,lane:0}),o=Math.max(o,a.end);return n.concat(s)}function EQ(n){return{name:n.name,start:n.start,end:RX(n),type:n.type,lane:0}}function LX(n){return n.startsWith("__")||/^[sl]__/.test(n)||n.startsWith(".")}function DX(n,e,t,r){var h,u;let i=(h=t==null?void 0:t.minVarSize)!=null?h:128,s=(u=t==null?void 0:t.maxVars)!=null?u:64,o=e.filter(f=>f.type=="ram"&&f.size>0);if(!n||!o.length)return[];let a=f=>r==null?void 0:r[f],l=new Map;for(let[f,m]of Object.entries(n)){if(typeof m!="number"||LX(f))continue;let O=l.get(m);(O==null||!a(O)&&a(f))&&l.set(m,f)}let c=Array.from(l.keys()).sort((f,m)=>f-m),d=[];for(let f=0;f<c.length;f++){let m=c[f],O=null;for(let k of o)m>=k.start&&m<k.start+k.size&&(!O||k.size<O.size)&&(O=k);if(!O)continue;let S=l.get(m),x=a(S);if(x!=null){x>=i&&d.push({name:S,start:m,end:m+x,type:"var",lane:0});continue}let D=O.start+O.size,M=f+1<c.length?c[f+1]:1/0;if(M>=D&&O.source!="linker")continue;let Z=Math.min(M,D);Z-m>=i&&d.push({name:S,start:m,end:Z,type:"var",lane:0,approx:!0})}return d.sort((f,m)=>m.end-m.start-(f.end-f.start)),d.slice(0,s)}function RQ(n,e=4096,t=1024){if(n.length<2)return null;let r=n[0],i=n[n.length-1];if((i-r)/e>t)return null;let s=n.slice();for(let c=Math.ceil(r/e)*e;c<i;c+=e){let d=0,h=s.length;for(;d<h;){let u=d+h>>1;s[u]<c?d=u+1:h=u}s[d]!==c&&s.splice(d,0,c)}let o=[],a=[],l=0;for(let c=0;c+1<s.length;c++){let d=s[c],h=s[c+1];for(;n[l+1]<=d;)l++;o.push((h-d)/(n[l+1]-n[l])),a.push(l)}return{bounds:s,weights:o,parents:a}}function MQ(n,e,t){let r=0;for(;r<e.length-1&&t>=e[r];)t-=e[r],r++;let i=e[r]>0?Math.max(0,Math.min(1,t/e[r])):0,s=n[r],o=n[r+1];return Math.min(Math.floor(s+(o-s)*i),o-1)}function LQ(n,e,t,r){var u;n=n||[];let i=(u=t==null?void 0:t.maxLanes)!=null?u:2,s=[],o=n.filter(f=>f.source=="native").map(EQ),a=n.filter(f=>f.source!="native").map(EQ);if(o.length&&s.push(fu("native","System",_Q(o,0,"","unmapped"),i)),a.length){let f=Math.min(...a.map(m=>m.start));s.push(fu("linker","Segments",_Q(a,f,"","free"),i))}let l=[];for(let f of n)(f.modules||[]).forEach((m,O)=>l.push({name:m.name,start:m.start,end:m.start+m.size,type:"module"+(O&1),lane:0}));l.length&&s.push(fu("modules","Modules",l,i));let c=l.length?[]:DX(e,n,t,r);c.length&&s.push(fu("vars","Objects",c,i));let d=new Set;for(let f of s)for(let m of f.blocks)d.add(m.start),d.add(m.end);return{bounds:Array.from(d).sort((f,m)=>f-m),columns:s}}function DQ(n,e,t,r,i=65536){let s=[],o=0,a,l=0,c=d=>{let h=1/0;for(let u of t||[])d>=u.start&&d<u.start+u.size&&(h=Math.min(h,u.start+u.size));return h};for(let d of Object.keys(n)){let h=parseInt(d),u=n[h];if(a){let f=r!=null&&r(a)?"":a,m=e==null?void 0:e[a],O=m!=null?l+m:c(l);for(O=Math.min(O,h);o<h&&s.length<i;){let S=o>=l&&o<O,x=o+16&1048560;S?x=Math.min(x,O):o<l&&(x=Math.min(x,l)),x>h&&(x=h),s.push({a:o,l:x-o,s:S?f:""}),o=x}}a=u,l=h}return s}function ZQ(n){return n.endsWith("_SIZE__")||n.endsWith("_LAST__")||n.endsWith("STACKSIZE__")||n.endsWith("FILEOFFS__")||n.startsWith("l__")||n.startsWith("s__")||n.startsWith(".__.")}var us=class{constructor(){this.
Line truncated
|
|
|
|
|
`)),e.type&&s.addClass("segment-"+e.type);var l=t.lanes-e.lane;for(var c of t.blocks)c.lane>e.lane&&c.start<e.end&&c.end>e.start&&(l=Math.min(l,c.lane-e.lane));s.css("grid-row",`${i.indexOf(e.start)+2} / ${i.indexOf(e.end)+2}`),s.css("grid-column",`${r+e.lane} / span ${l}`),s.click(()=>{var d=N.createOrShow("#memory");d.scrollToAddress(e.start)}),this.maindiv.append(s)}refresh(){var D,M;this.maindiv.empty();var e=LQ(re.segments,(D=P.debugSymbols)==null?void 0:D.symbolmap,null,(M=P.debugSymbols)==null?void 0:M.symbolsizes),t=e.bounds;if(t.length){var r=RQ(t),i=r?r.bounds:t,s=["5em"],o=2,a=$('<div class="memmap-header" style="grid-row:1;grid-column:1"/>').text("Address");if(this.maindiv.append(a),r)for(var l=0;l+1<i.length;l++){var c=Math.floor(i[l]/4096)%2;$('<div class="memmap-stripe"/>').addClass(c?"memmap-stripe-odd":"memmap-stripe-even").css("grid-row",`${l+2}`).css("grid-column","1 / -1").appendTo(this.maindiv)}for(var d of e.columns){for(var l=0;l<d.lanes;l++)s.push("minmax(0,1fr)");$('<div class="memmap-header"/>').text(d.title).css("grid-row","1").css("grid-column",`${o} / span ${d.lanes}`).appendTo(this.maindiv);for(var h of d.blocks)this.addBlock(h,d,o,i);o+=d.lanes}for(var u=["auto"],f=[],l=0;l+1<i.length;l++){var m=i[l+1]-i[l],O=Math.max(3,Math.log(m+1))*.5;if(r){var S=r.parents[l],x=t[S+1]-t[S];O=Math.max(3,Math.log(x+1))*.5*r.weights[l]}u.push(O+"em"),f.push(O)}for(var l=0;l+1<t.length;l++)$('<div class="segment-offset"/>').text("$"+_e(t[l],4)).css("grid-row",`${i.indexOf(t[l])+2}`).css("grid-column","1").appendTo(this.maindiv);this.scrubRows={bounds:i,heights:f},this.scrubOverlay=$('<div class="memmap-scrub"/>').css("grid-row","2 / -1").css("grid-column","1").on("mousemove",Z=>this.scrubTo(Z)).on("mouseleave",()=>this.hideScrub()).appendTo(this.maindiv),this.maindiv.css("grid-template-columns",s.join(" ")),this.maindiv.css("grid-template-rows",u.join(" "))}}scrubTo(e){if(!(!this.scrubRows||!this.scrubOverlay)){var t=this.scrubOverlay[0].getBoundingClientRect(),r=this.scrubRows.bounds,i=this.scrubRows.heights,s=0;for(var o of i)s+=o;var a=(e.clientY-t.top)/t.height*s,l=MQ(r,i,a);this.scrubLabel||(this.scrubLabel=$('<div class="memmap-scrub-label"/>').appendTo(document.body)),this.scrubLabel.text("$"+_e(l,4)).css({left:e.clientX+12+"px",top:e.clientY+12+"px"}).show()}}hideScrub(){this.scrubLabel&&this.scrubLabel.hide()}},jr=4278190080,fs=class{constructor(){this.cumulativeData=!1;var e=160,t=262;try{e=Math.ceil(P.machine.cpuCyclesPerLine)||e,t=Math.ceil(P.machine.numTotalScanlines)||t}catch(r){}this.cyclesPerLine=e,this.totalScanlines=t}addr2symbol(e){var t=P.debugSymbols&&P.debugSymbols.addr2symbol||{};return t[e]}addr2str(e){var t=this.addr2symbol(e);return typeof t=="string"?"$"+_e(e)+" ("+t+")":"$"+_e(e)}showTooltip(e){e?(this.tooldiv||(this.tooldiv=document.createElement("div"),this.tooldiv.setAttribute("class","tooltiptrack"),document.body.appendChild(this.tooldiv)),$(this.tooldiv).text(e).show()):$(this.tooldiv).hide()}setVisible(e){e?(this.probe=P.startProbing(),this.probe.singleFrame=!this.cumulativeData,this.tick()):(this.probe&&(this.probe.singleFrame=!0),P.stopProbing(),this.probe=null)}redraw(e){var t=this.probe;if(!t||!t.idx)return 0;var r=0,i=0,s=0;this.sp=0;for(var o=0;o<t.idx;o++){var a=t.buf[o],l=a&65535,c=a>>16&255,d=a&jr;switch(d){case 2113929216:r++,i=0;break;case 2130706432:r=0,i=0;break;case 0:i+=l,s+=l;break;case 167772160:case 184549376:this.sp=l;default:e(d,l,i,r,s,c);break}}return s}opToString(e,t,r){var i="";switch(e){case 16777216:i="Exec";break;case 301989888:i="Read";break;case 318767104:i="Write";break;case 335544320:i="IO Read";break;case 352321536:i="IO Write";break;case 369098752:i="VRAM Read";break;case 385875968:i="VRAM Write";break;case 402653184:i="DMA Read";break;case 419430400:i="DMA Write";break;case 134217728:i="Interrupt";break;case 150994944:i="Error";break;case 520093696:i="Wait";break;case 167772160:i="Stack Push";break;case 184549376:i="Stack Pop";break;default:return""}return typeof t=="number"&&(i+=" "+this.addr2str(t)),e&268435456&&typeof r=="number"&&(i+=" = $"+_e(r,2)),i}getOpRGB(e,t){switch(e){case 16777216:return 98305;case 301989888:return 8388865;case 318767104:return 65920;case 335544320:return 98432;case 352321536:return 12583296;case 402653184:case 369098752:return 8421377;case 419430400:case 385875968:return 4227264;case 134217728:return 4177727;case 150994944:return 4145151;case 520093696:return 16727871;default:return 0}}},Nb=class extends fs{constructor(){super(...arguments);this.recreateOnResize=!0}createCanvas(t,r,i){var s=document.createElement("div"),o=document.createElement("canvas");return o.width=r,o.height=i,o.classList.add("pixelated"),o.style.width="100%",o.style.height="90vh",o.style.backgroundColor="black",o.style.cursor="crosshair",o.onmousemove=a=>{var l=xc(o,a);this.showTooltip(this.getTooltipText(l.x,l.y)),$(this.tooldiv).css("left",a.pageX+10).css("top",a.pageY-30)},o.onmouseout=a=>{$(this.tooldiv).hide()},t.append
Line truncated
|
|
|
|
|
`+s),i+=`
|
|
|
|
|
`+this.opToString(l,c,f))}),"X: "+t+" Y: "+r+" "+i}refresh(){this.tick(),this.datau32.fill(jr)}tick(){super.tick(),this.drawImage()}drawImage(){this.ctx.putImageData(this.imageData,0,0)}clear(){this.datau32.fill(jr)}},Ou=class extends gu{createDiv(e){return this.createCanvas(e,256,256)}initCanvas(){super.initCanvas(),this.canvas.onclick=e=>{var t=xc(this.canvas,e),r=Math.floor(t.x)+Math.floor(t.y)*256,i=-1,s=-1;this.redraw((o,a)=>{s<0&&i>=0&&a==r&&(s=i),o==16777216&&(i=a)}),s>=0&&Jl([s])}}clear(){for(var e=0;e<=65535;e++){var t=P.readAddress(e),r=t>>2|t&31;r|=r<<8|r<<16,this.datau32[e]=r|jr}}drawEvent(e,t,r,i){var s=this.getOpRGB(e,t);if(s){var o=t&255,a=t>>8&255,l=this.datau32[t&65535];l=l|s|jr,this.datau32[t&65535]=l}}getTooltipText(e,t){var r=(e&255)+(t<<8),i="",s=-1,o={},a=null,l=[];return this.redraw((c,d,h,u,f,m)=>{switch(c){case 16777216:s=d,a=this.addr2symbol(d)||a;break;case 167772160:l.push(a);break;case 184549376:a=l.pop();break}var O=c|s;d==r&&!o[O]&&(i==""&&a&&(i+=`
|
|
|
|
|
`+a),i+=`
|
|
|
|
|
PC `+this.addr2str(s)+" "+this.opToString(c,null,m),o[O]=1)}),this.addr2str(r)+i}},Bb=class extends gu{initCanvas(){super.initCanvas(),this.canvas.onclick=e=>{var t=xc(this.canvas,e),r=Math.floor(t.x),i=Math.floor(t.y),s=this.getOpAtPos(t.x,t.y,16777216);s&&(ai("toline"),P.runEval(()=>{let o=P.getRasterScanline&&P.getRasterScanline()>=i;return o&&P.getRasterLineClock?o&&P.getRasterLineClock()>r:o}))}}drawEvent(e,t,r,i){var s=this.getOpRGB(e,t);if(s){var o=r+i*this.canvas.width,a=s|jr;this.datau32[o]|=a}}drawImage(){let e=jr;for(let t=0;t<this.datau32.length;t++)this.datau32[t]==jr?this.datau32[t]=e:e=this.datau32[t];super.drawImage()}},bu=class extends Bb{constructor(){super(...arguments);this.interrupt=0;this.rgb=0;this.lastpc=0}drawEvent(t,r,i,s){var o=i+s*this.canvas.width;if(t==134217728&&(this.interrupt=1),this.interrupt==1&&t==167772160&&(this.interrupt=r),this.interrupt>1&&this.sp>this.interrupt&&(this.interrupt=0),t==318767104&&(this.rgb|=47),t==385875968&&(this.rgb|=16256),t==352321536&&(this.rgb|=2047872),t==335544320&&(this.rgb|=7936),t==520093696&&(this.rgb=32768),t==150994944||t==402653184)this.datau32[o]=4279176975;else{let a=this.rgb;if(t==16777216){let l=this.sp&15;l>=8&&(l=16-l),Math.abs(this.lastpc)-r>16&&(l+=1),Math.abs(this.lastpc)-r>256&&(l+=1),a=this.rgb=526344*l+2105376,this.lastpc=r}this.interrupt&&(a|=8388672),this.datau32[o]==jr&&(this.datau32[o]=a|jr)}}},yu=class extends fs{constructor(){super(...arguments);this.recreateOnResize=!0}createDiv(t){return this.vlist=new co(t),this.vlist.create(t,this.cyclesPerLine*this.totalScanlines,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){var r="",i="seg_data",s=this.lines&&this.lines[t];if(s!=null){var o=s.info.join(", ");r="("+Hr(s.row,4)+", "+Hr(s.col,4)+") "+La(s.asm||"",20)+o,o.indexOf("Write ")>=0&&(i="seg_io")}return{text:r,clas:i}}refresh(){this.tick()}tick(){let t=P instanceof kf||P instanceof Pc;this.dumplines={},this.redraw((r,i,s,o,a,l)=>{t&&(a>>=2);var c=this.dumplines[a];switch(c==null&&(c={op:r,addr:i,row:o,col:s,asm:null,info:[]},this.dumplines[a]=c),r){case 16777216:if(P.disassemble){var d=P.disassemble(i,P.readAddress.bind(P));c.asm=d&&d.line}break;default:var h=this.opToString(r,i,l);h!=""&&c.info.push(h);break}}),this.lines=Z0(this.dumplines),this.vlist.setRowCount(this.lines.length),this.vlist.refresh()}},Su=class extends fs{constructor(){super(...arguments);this.recreateOnResize=!0}createDiv(t){return this.vlist=new co(t),this.vlist.create(t,this.totalScanlines,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){for(var r=Hr(t+"",3)+" ",i="seg_code",s=this.dumplines&&this.dumplines[t]||[],o=Math.round(this.cyclesPerLine/3.3),a=0;a<this.cyclesPerLine;a++){var l=s[a];if(l!==void 0){var c=l&65535,d=d&jr;if(d==16777216)r+=",";else{var h=_e(c);r+=h,a+=h.length-1}}else r+=a==o?"|":"."}return s[-1]&&(r+=" "+s[-1]),{text:r,clas:i}}refresh(){this.tick()}tick(){let t=P instanceof kf||P instanceof Pc;this.dumplines={},this.redraw((r,i,s,o,a,l)=>{var c=this.dumplines[o];switch(c==null&&(this.dumplines[o]=c=[]),r){case 16777216:var d=P.debugSymbols.addr2symbol[i];d&&(c[-1]=d);break;case 335544320:case 352321536:case 369098752:case 385875968:c[s]=r|i;break}}),this.vlist.refresh()}},vu=class extends fs{constructor(){super(...arguments);this.recreateOnResize=!0;this.cumulativeData=!0}createDiv(t){return P.debugSymbols&&P.debugSymbols.symbolmap?this.keys=Array.from(Object.keys(P.debugSymbols.symbolmap).filter(r=>!LQ(r))):this.keys=["no symbols defined"],this.vlist=new co(t),this.vlist.create(t,this.keys.length+1,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){if(t==0)return{text:Hr("Symbol",35)+Hr("Reads",8)+Hr("Writes",8)};var r=this.keys[t-1],i=this.dumplines&&this.dumplines[r];function s(l){var c=i[l]|0;return Hr(c?c.toString():"",8)}var o,a;return i!=null?(o=Hr(r,35)+s(301989888)+s(318767104),i[16777216]?a="seg_code":i[335544320]||i[352321536]?a="seg_io":a="seg_data"):(o=Hr(r,35),a="seg_unknown"),{text:o,clas:a}}refresh(){this.tick()}tick(){this.dumplines={},this.redraw((t,r,i,s,o,a)=>{var l=P.debugSymbols.addr2symbol[r];if(l!=null){var c=this.dumplines[l];c==null&&(c={},this.dumplines[l]=c),c[t]=(c[t]|0)+1}}),this.vlist.refresh(),this.probe&&this.probe.clear()}},wu=class{constructor(){this.editingId=null}createDiv(e){return this.maindiv=xr(e,"vertical-scroll bp-view"),this.render(),this.maindiv[0]}refresh(e){this.render()}render(){let e=this.maindiv.empty(),t=jl(),r=this.editingId!=null?t.find(d=>d.bp.id==this.editingId):null,i=$('<div class="bp-form"/>'),s=$('<input type="text" class="bp-input" spellcheck="false"/>').attr("placeholder","address or symbol (e.g. $8000, mainloop)").val(r&&r.bp.type=="address"?r.bp.target:""),o=$('<input type="text" class="bp-input" spellcheck="false"/>').attr("placeholder","condition (e.g. A>=$20, #scanline==222)").val(r&&r.bp.condition||""),a=$('<button class="btn btn-default btn-xs bp-submit"/>').text(r?"Save":"Add"),l=$('<button cla
Line truncated
|
|
|
|
|
`)<0&&e.indexOf("\r")<0)return e.trim()}return""}function XX(n){var t;let e=n.record;if(e.source==="project"){let r=e.file;if(!r||!N.isWindow(r))return;let i=N.createOrShow(r);i instanceof un&&e.line&&i.navigateToLine(e.line)}else if(e.source==="toolchain"){let r=e.file;if(!r)return;Kl(r);let i=N.createOrShow("#headerview/"+r);i instanceof hs&&e.line&&i.navigateToLine(e.line)}else if(e.source==="debugger"){let r=(t=e.addr)!=null?t:-1;if(r<0)return;if(e.kind==="label"&&N.isWindow("#disasm")){let i=N.createOrShow("#disasm");i instanceof Ri&&i.goToAddress(r)}else{let i=N.createOrShow("#memory");i instanceof us&&i.goToAddress(r)}}else if(e.source==="docs"){let r=e.url||"";r.startsWith("#help/")?N.createOrShow(r):r&&window.open(r,"_blank")}}function Vb(){bootbox.dialog({title:"Search",onEscape:!0,message:`
|
|
|
|
|
PC `+this.addr2str(s)+" "+this.opToString(c,null,m),o[O]=1)}),this.addr2str(r)+i}},Bb=class extends gu{initCanvas(){super.initCanvas(),this.canvas.onclick=e=>{var t=xc(this.canvas,e),r=Math.floor(t.x),i=Math.floor(t.y),s=this.getOpAtPos(t.x,t.y,16777216);s&&(ai("toline"),P.runEval(()=>{let o=P.getRasterScanline&&P.getRasterScanline()>=i;return o&&P.getRasterLineClock?o&&P.getRasterLineClock()>r:o}))}}drawEvent(e,t,r,i){var s=this.getOpRGB(e,t);if(s){var o=r+i*this.canvas.width,a=s|jr;this.datau32[o]|=a}}drawImage(){let e=jr;for(let t=0;t<this.datau32.length;t++)this.datau32[t]==jr?this.datau32[t]=e:e=this.datau32[t];super.drawImage()}},bu=class extends Bb{constructor(){super(...arguments);this.interrupt=0;this.rgb=0;this.lastpc=0}drawEvent(t,r,i,s){var o=i+s*this.canvas.width;if(t==134217728&&(this.interrupt=1),this.interrupt==1&&t==167772160&&(this.interrupt=r),this.interrupt>1&&this.sp>this.interrupt&&(this.interrupt=0),t==318767104&&(this.rgb|=47),t==385875968&&(this.rgb|=16256),t==352321536&&(this.rgb|=2047872),t==335544320&&(this.rgb|=7936),t==520093696&&(this.rgb=32768),t==150994944||t==402653184)this.datau32[o]=4279176975;else{let a=this.rgb;if(t==16777216){let l=this.sp&15;l>=8&&(l=16-l),Math.abs(this.lastpc)-r>16&&(l+=1),Math.abs(this.lastpc)-r>256&&(l+=1),a=this.rgb=526344*l+2105376,this.lastpc=r}this.interrupt&&(a|=8388672),this.datau32[o]==jr&&(this.datau32[o]=a|jr)}}},yu=class extends fs{constructor(){super(...arguments);this.recreateOnResize=!0}createDiv(t){return this.vlist=new co(t),this.vlist.create(t,this.cyclesPerLine*this.totalScanlines,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){var r="",i="seg_data",s=this.lines&&this.lines[t];if(s!=null){var o=s.info.join(", ");r="("+Hr(s.row,4)+", "+Hr(s.col,4)+") "+La(s.asm||"",20)+o,o.indexOf("Write ")>=0&&(i="seg_io")}return{text:r,clas:i}}refresh(){this.tick()}tick(){let t=P instanceof kf||P instanceof Pc;this.dumplines={},this.redraw((r,i,s,o,a,l)=>{t&&(a>>=2);var c=this.dumplines[a];switch(c==null&&(c={op:r,addr:i,row:o,col:s,asm:null,info:[]},this.dumplines[a]=c),r){case 16777216:if(P.disassemble){var d=P.disassemble(i,P.readAddress.bind(P));c.asm=d&&d.line}break;default:var h=this.opToString(r,i,l);h!=""&&c.info.push(h);break}}),this.lines=Z0(this.dumplines),this.vlist.setRowCount(this.lines.length),this.vlist.refresh()}},Su=class extends fs{constructor(){super(...arguments);this.recreateOnResize=!0}createDiv(t){return this.vlist=new co(t),this.vlist.create(t,this.totalScanlines,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){for(var r=Hr(t+"",3)+" ",i="seg_code",s=this.dumplines&&this.dumplines[t]||[],o=Math.round(this.cyclesPerLine/3.3),a=0;a<this.cyclesPerLine;a++){var l=s[a];if(l!==void 0){var c=l&65535,d=d&jr;if(d==16777216)r+=",";else{var h=_e(c);r+=h,a+=h.length-1}}else r+=a==o?"|":"."}return s[-1]&&(r+=" "+s[-1]),{text:r,clas:i}}refresh(){this.tick()}tick(){let t=P instanceof kf||P instanceof Pc;this.dumplines={},this.redraw((r,i,s,o,a,l)=>{var c=this.dumplines[o];switch(c==null&&(this.dumplines[o]=c=[]),r){case 16777216:var d=P.debugSymbols.addr2symbol[i];d&&(c[-1]=d);break;case 335544320:case 352321536:case 369098752:case 385875968:c[s]=r|i;break}}),this.vlist.refresh()}},vu=class extends fs{constructor(){super(...arguments);this.recreateOnResize=!0;this.cumulativeData=!0}createDiv(t){return P.debugSymbols&&P.debugSymbols.symbolmap?this.keys=Array.from(Object.keys(P.debugSymbols.symbolmap).filter(r=>!ZQ(r))):this.keys=["no symbols defined"],this.vlist=new co(t),this.vlist.create(t,this.keys.length+1,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){if(t==0)return{text:Hr("Symbol",35)+Hr("Reads",8)+Hr("Writes",8)};var r=this.keys[t-1],i=this.dumplines&&this.dumplines[r];function s(l){var c=i[l]|0;return Hr(c?c.toString():"",8)}var o,a;return i!=null?(o=Hr(r,35)+s(301989888)+s(318767104),i[16777216]?a="seg_code":i[335544320]||i[352321536]?a="seg_io":a="seg_data"):(o=Hr(r,35),a="seg_unknown"),{text:o,clas:a}}refresh(){this.tick()}tick(){this.dumplines={},this.redraw((t,r,i,s,o,a)=>{var l=P.debugSymbols.addr2symbol[r];if(l!=null){var c=this.dumplines[l];c==null&&(c={},this.dumplines[l]=c),c[t]=(c[t]|0)+1}}),this.vlist.refresh(),this.probe&&this.probe.clear()}},wu=class{constructor(){this.editingId=null}createDiv(e){return this.maindiv=xr(e,"vertical-scroll bp-view"),this.render(),this.maindiv[0]}refresh(e){this.render()}render(){let e=this.maindiv.empty(),t=jl(),r=this.editingId!=null?t.find(d=>d.bp.id==this.editingId):null,i=$('<div class="bp-form"/>'),s=$('<input type="text" class="bp-input" spellcheck="false"/>').attr("placeholder","address or symbol (e.g. $8000, mainloop)").val(r&&r.bp.type=="address"?r.bp.target:""),o=$('<input type="text" class="bp-input" spellcheck="false"/>').attr("placeholder","condition (e.g. A>=$20, #scanline==222)").val(r&&r.bp.condition||""),a=$('<button class="btn btn-default btn-xs bp-submit"/>').text(r?"Save":"Add"),l=$('<button cla
Line truncated
|
|
|
|
|
`)<0&&e.indexOf("\r")<0)return e.trim()}return""}function WX(n){var t;let e=n.record;if(e.source==="project"){let r=e.file;if(!r||!N.isWindow(r))return;let i=N.createOrShow(r);i instanceof un&&e.line&&i.navigateToLine(e.line)}else if(e.source==="toolchain"){let r=e.file;if(!r)return;Kl(r);let i=N.createOrShow("#headerview/"+r);i instanceof hs&&e.line&&i.navigateToLine(e.line)}else if(e.source==="debugger"){let r=(t=e.addr)!=null?t:-1;if(r<0)return;if(e.kind==="label"&&N.isWindow("#disasm")){let i=N.createOrShow("#disasm");i instanceof Ri&&i.goToAddress(r)}else{let i=N.createOrShow("#memory");i instanceof us&&i.goToAddress(r)}}else if(e.source==="docs"){let r=e.url||"";r.startsWith("#help/")?N.createOrShow(r):r&&window.open(r,"_blank")}}function Vb(){bootbox.dialog({title:"Search",onEscape:!0,message:`
|
|
|
|
|
<div id="searchbox_form">
|
|
|
|
|
<input type="text" id="searchboxInput" class="form-control"
|
|
|
|
|
placeholder="Search symbols, files, docs"
|
|
|
|
|
autocomplete="off" style="margin-bottom:8px">
|
|
|
|
|
<div id="searchboxResults" style="max-height:340px;overflow-y:auto"></div>
|
|
|
|
|
</div>
|
|
|
|
|
`,buttons:{close:{label:"Close",className:"btn-default"}}}).one("shown.bs.modal",()=>{$("#searchboxInput").trigger("focus")});let e=$("#searchboxInput"),t=$("#searchboxResults"),r=[],i=-1,s=d=>{if(i=Math.max(-1,Math.min(d,r.length-1)),t.find("li.search-hit").each((h,u)=>{$(u).toggleClass("active",h===i)}),i>=0){let h=t[0],u=t.find("li.search-hit").eq(i);if(u.length){let f=u[0],m=h.getBoundingClientRect(),O=f.getBoundingClientRect(),S=O.top-m.top;S<0?h.scrollTop+=S:S+O.height>m.height&&(h.scrollTop+=S+O.height-m.height)}}},o=(d=i)=>{let h=r[d];h&&(XX(h),bootbox.hideAll())},a=d=>{if(r=d||[],r.length===0){i=-1,t.html('<div class="text-muted" style="padding:8px">No matches.</div>');return}let h=$('<ul class="list-group" style="margin-bottom:0"></ul>');for(let u of r){let f=u.record,m=f.source,O=f.kind==="func"?"\u0192":f.kind==="macro"?"#":f.kind==="label"?":":f.kind==="struct"?"S":f.kind==="enum"?"E":f.kind==="text"?"\u2261":"\u2022",S=f.source==="debugger"?_e(f.addr,4):f.file&&f.line?`${f.file}:${f.line}`:f.file||"",x=f.kind!=="text",D=$('<li class="list-group-item search-hit" style="cursor:pointer;padding:6px 10px;display:flex;align-items:center;overflow:hidden"></li>');D.html(`<span class="search-kind" style="margin-right:6px;font-weight:bold;flex:0 0 auto">${O}</span><span class="search-name" style="flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">`+(x?`<strong>${Pu(f.name)}</strong>`:`<span class="search-dumb">${Pu(f.name)}</span>`)+(f.brief?` <span class="text-muted">- ${Pu(f.brief)}</span>`:"")+`</span><span class="search-loc" style="flex:0 0 auto;margin-left:8px;font-style:italic;font-size:small;white-space:nowrap">${S?Pu(S):""}</span>`),D.click(()=>{o(r.indexOf(u))}),h.append(D)}t.empty().append(h),s(0)},l=DX(async()=>{let d=e.val();if(!d){r=[],i=-1,t.empty();return}try{let h=await K1.query(d,ZX),u=xu(d,P&&P.debugSymbols&&P.debugSymbols.symbolmap);u&&IQ(u,h.length>0)&&h.push(ZQ(d,u,re&&re.segments)),a(h)}catch(h){t.html('<div class="text-danger" style="padding:8px">Search failed.</div>')}},150);e.on("input",l),e.on("keydown",d=>{d.key==="ArrowDown"?(d.preventDefault(),s(i+1)):d.key==="ArrowUp"?(d.preventDefault(),s(i-1)):d.key==="Enter"?(d.preventDefault(),i>=0?o():l()):d.key==="Home"?(d.preventDefault(),s(0)):d.key==="End"&&(d.preventDefault(),s(r.length-1))});let c=IX();c&&(e.val(c),l())}var zX=800,WX=1e3,NX=16;function VQ(n){var e={};return n.forEach(t=>{e[t.name]=(e[t.name]||0)+1}),n.forEach(t=>{e[t.name]>1&&t.group&&(t.name=t.group+": "+t.name)}),n}function XQ(n){return n.art?n.brev?0:7:null}var ku=/([0#]?)([x$%]|\d'h)([0-9a-f]+)(?:[;].*)?|(\d'b|0b)([01]+)/gim;function tc(n){return n.replace(/(\shex\s+)([0-9a-f]+)/ig,function(e,t,r){for(var i=t,s=0;s<r.length;s+=2)i+="0x"+r.substr(s,2)+",";return i})}function $u(n){for(var e=[],t;t=ku.exec(n);){var r;t[4]?r=parseInt(t[5],2):t[2].startsWith("%")?r=parseInt(t[3],2):t[2].startsWith("x")||t[2].startsWith("$")||t[2].endsWith("h")?r=parseInt(t[3],16):r=parseInt(t[3]),e.push(r)}return e}function BX(n,e,t){n=tc(n);for(var r="",i,s=0,o=0,a=Math.ceil(t/4);i=ku.exec(n);)r+=n.slice(s,ku.lastIndex-i[0].length),s=ku.lastIndex,i[4]?r+=i[4]+bf(e[o++],parseInt(i[4])):i[2].startsWith("%")?r+=i[1]+i[2]+bf(e[o++],t):i[2].endsWith("h")?r+=i[1]+i[2]+_e(e[o++],parseInt(i[2])):i[2].startsWith("x")?r+=i[1]+"x"+_e(e[o++],a):i[2].startsWith("$")?r+=i[1]+"$"+_e(e[o++],a):r+=i[1]+e[o++].toString();return r+=n.slice(s),r=r.replace(/(\shex\s+)([,x0-9a-f]+)/ig,(l,c,d)=>{var h=c+d;return h=h.replace(/0x/ig,"").replace(/,/ig,""),h}),r}function Ub(n,e){if(!e)return n;for(var t=0,r=0;r<e.length;r++){var i=e[r];i<0&&(i=-i-1,t^=1<<i),n&1<<r&&(t^=1<<i)}return t}function qb(n,e){var t=e[n%e.length];return[t>>3,t&7]}var VX=[[0,0,4],[8,0,0]],FX=[[0,8,12],[8,8,0],[16,8,4],[24,8,8],[32,0,12],[40,0,0],[48,0,4],[56,0,8]];function YX(n,e,t,r,i,s){for(var o=0;o<8;o++)for(var a=n[e+o]||0,l=0;l<4;l++){var c=(3-l)*s+(7-o),d=a>>l&1|(a>>l+4&1)<<1;t[i*s+r+c]=d}}function jX(n,e,t,r,i,s){for(var o=0;o<8;o++){for(var a=0,l=0;l<4;l++){var c=(3-l)*s+(7-o),d=(t[i*s+r+c]||0)&3;d&1&&(a|=1<<l),d&2&&(a|=1<<l+4)}n[e+o]=a}}function Gb(n){return n.w===16&&n.h===16?FX:VX}function FQ(n){return Gb(n).length*8}function UX(n,e){for(var t=e.w,r=e.h,i=e.count||1,s=e.wpimg||FQ(e),o=Gb(e),a=[],l=0;l<i;l++){for(var c=new Array(t*r).fill(0),d=l*s,h=0;h<o.length;h++){var[u,f,m]=o[h];YX(n,d+u,c,f,m,t)}a.push(new Uint8Array(c))}return a}function qX(n,e){for(var t=e.w,r=e.h,i=e.count||n.length,s=e.wpimg||FQ(e),o=Gb(e),a=new Array(s*i).fill(0),l=0;l<i;l++)for(var c=n[l]||new Uint8Array(t*r),d=l*s,h=0;h<o.length;h++){var[u,f,m]=o[h];jX(a,d+u,c,f,m,t)}return a}function GX(n,e){if(e.pacstrip)return UX(n,e);var t=e.w,r=e.h,i=e.count||1,s=e.bpp||1,o=e.np||1,a=e.bpw||8,l=e.sl||Math.ceil(t*s/a),c=(1<<s)-1,d=e.pofs||l*r*i,h=e.skip||0,u=e.wpimg||l*r,f=l;e.il&&(u=l,f=l*i);for(var m=[],O=0;O<i;O++){for(var S=[],x=0;x<r;x++)for(var D=e.flip?r-1-x:x,M=u*O+D*f,Z=0,k=0;k<t;k++){var w=0,R=Ub(M,e.remap);Line truncated
|
|
|
|
|
`&&t++;return t}function GQ(n,e){for(var t=/[/;][*;]([{].+[}])[*;][/;]/g,r=[],i;i=t.exec(n);){var s=i.index+i[0].length,o;e?o=n.indexOf("end",s):i[0].startsWith(";;")?(o=n.indexOf(";;",s),o==n.indexOf(";;{",s)&&(o=-1)):o=n.indexOf(";",s);var a=zQ(n,i.index),l=i[0],c=o>=0?zQ(n,o):"???";if(o<0){var d=e?'"end"':i[0].startsWith(";;")?'";;"':'";"';r.push({header:l,startline:a,endline:c,error:`No closing ${d} found after asset header`})}else if(o<=s)r.push({header:l,startline:a,endline:c,error:"Empty data block after asset header"});else try{var h=i[1].replace(/([A-Za-z_]\w*):/g,'"$1":'),u=JSON.parse(h),f=/#embed\s+"(.+?)"/.exec(n.substring(s,o)),m=f?f[1]:void 0;r.push({header:l,startline:a,endline:c,fmt:u,start:s,end:o,embedFile:m})}catch(O){r.push({header:l,startline:a,endline:c,error:`Invalid asset format: ${O.message}`})}}return r}function HQ(n,e,t){if(t(e))return e;var r=n.lastIndexOf("/");if(r>=0){var i=n.substring(0,r+1)+e;if(t(i))return i}return null}function HX(n,e){if(e.destfmt&&(e=e.destfmt),e.pacstrip)return qX(n,e);var t=e.w,r=e.h,i=e.count||1,s=e.bpp||1,o=e.np||1,a=e.bpw||8,l=e.sl||Math.ceil(e.w*s/a),c=(1<<s)-1,d=e.pofs||l*r*i,h=e.skip||0,u=e.wpimg||l*r,f=l;e.il&&(u=l,f=l*i);var m=e.il?f*r:u*i,O;o>0&&e.sl?O=new Uint8Array(m):a<=8?O=new Uint8Array(m*o):O=new Uint32Array(m*o);for(var S=0;S<i;S++)for(var x=n[S],D=0,M=0;M<r;M++)for(var Z=e.flip?r-1-M:M,k=S*u+Z*f,w=0,R=0;R<t;R++){var X=x[D++],W=Ub(k,e.remap);e.reindex&&([W,w]=qb(R,e.reindex),W+=k);for(var ne=0;ne<o;ne++){var de=X>>ne*s&c;O[W+ne*d+h]|=e.brev?de<<a-w-s:de<<w}w+=s,w>=a&&!e.reindex&&(k+=1,w=0)}return O}function WQ(n,e,t,r,i,s,o){for(var a=[],l=0;l<n.length;l++){var c=n[l],d=4278190080;d|=(c>>e&(1<<t)-1)<<8-t,d|=(c>>r&(1<<i)-1)<<16-i,d|=(c>>s&(1<<o)-1)<<24-o,a.push(d)}return a}function KX(n){var e=(n>>0&1)*33+(n>>1&1)*71+(n>>2&1)*151,t=(n>>3&1)*33+(n>>4&1)*71+(n>>5&1)*151,r=(n>>6&1)*81+(n>>7&1)*174;return 4278190080|r<<16|t<<8|e}function JX(n){var e=n.pal;if(typeof e=="number"){var t=Math.floor(Math.abs(e/100)%10),r=Math.floor(Math.abs(e/10)%10),i=Math.floor(Math.abs(e)%10);return 1<<t+r+i}else{if(e==="pacman")return 256;var s=Tu[e];if(s)return s.length;throw new Error("No palette named "+e)}}function Qu(n,e){var t=e.pal,r;if(typeof t=="number"){var i=Math.floor(Math.abs(t/100)%10),s=Math.floor(Math.abs(t/10)%10),o=Math.floor(Math.abs(t)%10);t>=0?r=WQ(n,0,i,i,s,i+s,o):r=WQ(n,i+s,o,i,s,0,i)}else if(t==="pacman"){r=[];for(var a=0;a<n.length;a++)r.push(KX(n[a]))}else{var l=Tu[t];if(l)r=new Uint32Array(n).map(c=>l[c&l.length-1]|4278190080);else throw new Error("No palette named "+t)}return r}function rc(n){var e=n.pal;if(typeof e!="number"||!isFinite(e))return null;var t=Math.floor(Math.abs(e/100)%10),r=Math.floor(Math.abs(e/10)%10),i=Math.floor(Math.abs(e)%10);return t+r+i<=0?null:e>=0?{r:t,g:r,b:i,rshift:0,gshift:t,bshift:t+r}:{r:i,g:r,b:t,rshift:t+r,gshift:t,bshift:0}}function NQ(n,e,t,r){var i=rc(n);return i?(e&(1<<i.r)-1)<<i.rshift|(t&(1<<i.g)-1)<<i.gshift|(r&(1<<i.b)-1)<<i.bshift:0}function ez(n,e){var t=rc(n);return t?{r:e>>t.rshift&(1<<t.r)-1,g:e>>t.gshift&(1<<t.g)-1,b:e>>t.bshift&(1<<t.b)-1}:null}var Tu={gb:[13686916,8890444,5401396,2961698],nes:[5395026,11796480,10485760,11599933,7602281,91,95,6208,12048,543240,26368,1196544,7153664,0,0,0,12899815,16728064,14421538,16729963,14090399,6818519,6588,21681,27227,35843,43776,2918400,10777088,0,0,0,16316664,16755516,16742785,16735173,16730354,14633471,4681215,46327,57599,58229,259115,7911470,15065624,7895160,0,0,16777215,16773822,16300216,16300248,16758527,16761855,13095423,10148607,8973816,8650717,12122296,16119980,16777136,16308472,0,0],ap2lores:[0,16711935,127,8323199,32512,8355711,191,255,12549888,16760576,12566463,16744319,65280,16776960,49023,16777215],vcs:[0,0,4210752,4210752,7105644,7105644,9474192,9474192,11579568,11579568,13158600,13158600,14474460,14474460,16053492,16053492,17476,17476,1074276,1074276,2393220,2393220,3448992,3448992,4241592,4241592,5296336,5296336,6088936,6088936,6880508,6880508,10352,10352,1328260,1328260,2645144,2645144,3963052,3963052,5016764,5016764,6070476,6070476,6862044,6862044,7915756,7915756,6276,6276,1586328,1586328,3166380,3166380,4745408,4745408,6062288,6062288,7378144,7378144,8431852,8431852,9747708,9747708,136,136,2105500,2105500,3947696,3947696,5789888,5789888,7368912,7368912,8947936,8947936,10526956,10526956,11842812,11842812,6029432,6029432,7610508,7610508,8928416,8928416,10246320,10246320,11563200,11563200,12616912,12616912,13671644,13671644,14725356,14725356,7864392,7864392,9445472,9445472,10763384,10763384,12081292,12081292,13398176,13398176,14451892,14451892,15506628,15506628,16560340,16560340,8650772,8650772,9969712,9969712,11287628,11287628,12605544,12605544,13660284,13660284,14715028,14715028,15507624,15507624,16561340,16561340,8912896,8912896,10231836,10231836,11550776,11550776,12606544,12606544,13661288,13661288,14716028,14716028,15508624,15508624,16562340,16562340,8132608,8132608,9451548,9451548,11031608,11031608,12349520,12349520,1340426
Line truncated
|
|
|
|
|
`,buttons:{close:{label:"Close",className:"btn-default"}}}).one("shown.bs.modal",()=>{$("#searchboxInput").trigger("focus")});let e=$("#searchboxInput"),t=$("#searchboxResults"),r=[],i=-1,s=d=>{if(i=Math.max(-1,Math.min(d,r.length-1)),t.find("li.search-hit").each((h,u)=>{$(u).toggleClass("active",h===i)}),i>=0){let h=t[0],u=t.find("li.search-hit").eq(i);if(u.length){let f=u[0],m=h.getBoundingClientRect(),O=f.getBoundingClientRect(),S=O.top-m.top;S<0?h.scrollTop+=S:S+O.height>m.height&&(h.scrollTop+=S+O.height-m.height)}}},o=(d=i)=>{let h=r[d];h&&(WX(h),bootbox.hideAll())},a=d=>{if(r=d||[],r.length===0){i=-1,t.html('<div class="text-muted" style="padding:8px">No matches.</div>');return}let h=$('<ul class="list-group" style="margin-bottom:0"></ul>');for(let u of r){let f=u.record,m=f.source,O=f.kind==="func"?"\u0192":f.kind==="macro"?"#":f.kind==="label"?":":f.kind==="struct"?"S":f.kind==="enum"?"E":f.kind==="text"?"\u2261":"\u2022",S=f.source==="debugger"?_e(f.addr,4):f.file&&f.line?`${f.file}:${f.line}`:f.file||"",x=f.kind!=="text",D=$('<li class="list-group-item search-hit" style="cursor:pointer;padding:6px 10px;display:flex;align-items:center;overflow:hidden"></li>');D.html(`<span class="search-kind" style="margin-right:6px;font-weight:bold;flex:0 0 auto">${O}</span><span class="search-name" style="flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">`+(x?`<strong>${Pu(f.name)}</strong>`:`<span class="search-dumb">${Pu(f.name)}</span>`)+(f.brief?` <span class="text-muted">- ${Pu(f.brief)}</span>`:"")+`</span><span class="search-loc" style="flex:0 0 auto;margin-left:8px;font-style:italic;font-size:small;white-space:nowrap">${S?Pu(S):""}</span>`),D.click(()=>{o(r.indexOf(u))}),h.append(D)}t.empty().append(h),s(0)},l=IX(async()=>{let d=e.val();if(!d){r=[],i=-1,t.empty();return}try{let h=await eP.query(d,XX),u=xu(d,P&&P.debugSymbols&&P.debugSymbols.symbolmap);u&&zQ(u,h.length>0)&&h.push(XQ(d,u,re&&re.segments)),a(h)}catch(h){t.html('<div class="text-danger" style="padding:8px">Search failed.</div>')}},150);e.on("input",l),e.on("keydown",d=>{d.key==="ArrowDown"?(d.preventDefault(),s(i+1)):d.key==="ArrowUp"?(d.preventDefault(),s(i-1)):d.key==="Enter"?(d.preventDefault(),i>=0?o():l()):d.key==="Home"?(d.preventDefault(),s(0)):d.key==="End"&&(d.preventDefault(),s(r.length-1))});let c=zX();c&&(e.val(c),l())}var NX=800,BX=1e3,VX=16;function YQ(n){var e={};return n.forEach(t=>{e[t.name]=(e[t.name]||0)+1}),n.forEach(t=>{e[t.name]>1&&t.group&&(t.name=t.group+": "+t.name)}),n}function WQ(n){return n.art?n.brev?0:7:null}var ku=/([0#]?)([x$%]|\d'h)([0-9a-f]+)(?:[;].*)?|(\d'b|0b)([01]+)/gim;function tc(n){return n.replace(/(\shex\s+)([0-9a-f]+)/ig,function(e,t,r){for(var i=t,s=0;s<r.length;s+=2)i+="0x"+r.substr(s,2)+",";return i})}function $u(n){for(var e=[],t;t=ku.exec(n);){var r;t[4]?r=parseInt(t[5],2):t[2].startsWith("%")?r=parseInt(t[3],2):t[2].startsWith("x")||t[2].startsWith("$")||t[2].endsWith("h")?r=parseInt(t[3],16):r=parseInt(t[3]),e.push(r)}return e}function FX(n,e,t){n=tc(n);for(var r="",i,s=0,o=0,a=Math.ceil(t/4);i=ku.exec(n);)r+=n.slice(s,ku.lastIndex-i[0].length),s=ku.lastIndex,i[4]?r+=i[4]+bf(e[o++],parseInt(i[4])):i[2].startsWith("%")?r+=i[1]+i[2]+bf(e[o++],t):i[2].endsWith("h")?r+=i[1]+i[2]+_e(e[o++],parseInt(i[2])):i[2].startsWith("x")?r+=i[1]+"x"+_e(e[o++],a):i[2].startsWith("$")?r+=i[1]+"$"+_e(e[o++],a):r+=i[1]+e[o++].toString();return r+=n.slice(s),r=r.replace(/(\shex\s+)([,x0-9a-f]+)/ig,(l,c,d)=>{var h=c+d;return h=h.replace(/0x/ig,"").replace(/,/ig,""),h}),r}function Ub(n,e){if(!e)return n;for(var t=0,r=0;r<e.length;r++){var i=e[r];i<0&&(i=-i-1,t^=1<<i),n&1<<r&&(t^=1<<i)}return t}function qb(n,e){var t=e[n%e.length];return[t>>3,t&7]}var YX=[[0,0,4],[8,0,0]],jX=[[0,8,12],[8,8,0],[16,8,4],[24,8,8],[32,0,12],[40,0,0],[48,0,4],[56,0,8]];function UX(n,e,t,r,i,s){for(var o=0;o<8;o++)for(var a=n[e+o]||0,l=0;l<4;l++){var c=(3-l)*s+(7-o),d=a>>l&1|(a>>l+4&1)<<1;t[i*s+r+c]=d}}function qX(n,e,t,r,i,s){for(var o=0;o<8;o++){for(var a=0,l=0;l<4;l++){var c=(3-l)*s+(7-o),d=(t[i*s+r+c]||0)&3;d&1&&(a|=1<<l),d&2&&(a|=1<<l+4)}n[e+o]=a}}function Gb(n){return n.w===16&&n.h===16?jX:YX}function jQ(n){return Gb(n).length*8}function GX(n,e){for(var t=e.w,r=e.h,i=e.count||1,s=e.wpimg||jQ(e),o=Gb(e),a=[],l=0;l<i;l++){for(var c=new Array(t*r).fill(0),d=l*s,h=0;h<o.length;h++){var[u,f,m]=o[h];UX(n,d+u,c,f,m,t)}a.push(new Uint8Array(c))}return a}function HX(n,e){for(var t=e.w,r=e.h,i=e.count||n.length,s=e.wpimg||jQ(e),o=Gb(e),a=new Array(s*i).fill(0),l=0;l<i;l++)for(var c=n[l]||new Uint8Array(t*r),d=l*s,h=0;h<o.length;h++){var[u,f,m]=o[h];qX(a,d+u,c,f,m,t)}return a}function KX(n,e){if(e.pacstrip)return GX(n,e);var t=e.w,r=e.h,i=e.count||1,s=e.bpp||1,o=e.np||1,a=e.bpw||8,l=e.sl||Math.ceil(t*s/a),c=(1<<s)-1,d=e.pofs||l*r*i,h=e.skip||0,u=e.wpimg||l*r,f=l;e.il&&(u=l,f=l*i);for(var m=[],O=0;O<i;O++){for(var S=[],x=0;x<r;x++)for(var D=e.flip?r-1-x:x,M=u*O+D*f,Z=0,k=0;k<t;k++){var w=0,R=Ub(M,e.remap);Line truncated
|
|
|
|
|
`&&t++;return t}function KQ(n,e){for(var t=/[/;][*;]([{].+[}])[*;][/;]/g,r=[],i;i=t.exec(n);){var s=i.index+i[0].length,o;e?o=n.indexOf("end",s):i[0].startsWith(";;")?(o=n.indexOf(";;",s),o==n.indexOf(";;{",s)&&(o=-1)):o=n.indexOf(";",s);var a=NQ(n,i.index),l=i[0],c=o>=0?NQ(n,o):"???";if(o<0){var d=e?'"end"':i[0].startsWith(";;")?'";;"':'";"';r.push({header:l,startline:a,endline:c,error:`No closing ${d} found after asset header`})}else if(o<=s)r.push({header:l,startline:a,endline:c,error:"Empty data block after asset header"});else try{var h=i[1].replace(/([A-Za-z_]\w*):/g,'"$1":'),u=JSON.parse(h),f=/#embed\s+"(.+?)"/.exec(n.substring(s,o)),m=f?f[1]:void 0;r.push({header:l,startline:a,endline:c,fmt:u,start:s,end:o,embedFile:m})}catch(O){r.push({header:l,startline:a,endline:c,error:`Invalid asset format: ${O.message}`})}}return r}function JQ(n,e,t){if(t(e))return e;var r=n.lastIndexOf("/");if(r>=0){var i=n.substring(0,r+1)+e;if(t(i))return i}return null}function JX(n,e){if(e.destfmt&&(e=e.destfmt),e.pacstrip)return HX(n,e);var t=e.w,r=e.h,i=e.count||1,s=e.bpp||1,o=e.np||1,a=e.bpw||8,l=e.sl||Math.ceil(e.w*s/a),c=(1<<s)-1,d=e.pofs||l*r*i,h=e.skip||0,u=e.wpimg||l*r,f=l;e.il&&(u=l,f=l*i);var m=e.il?f*r:u*i,O;o>0&&e.sl?O=new Uint8Array(m):a<=8?O=new Uint8Array(m*o):O=new Uint32Array(m*o);for(var S=0;S<i;S++)for(var x=n[S],D=0,M=0;M<r;M++)for(var Z=e.flip?r-1-M:M,k=S*u+Z*f,w=0,R=0;R<t;R++){var X=x[D++],W=Ub(k,e.remap);e.reindex&&([W,w]=qb(R,e.reindex),W+=k);for(var ne=0;ne<o;ne++){var de=X>>ne*s&c;O[W+ne*d+h]|=e.brev?de<<a-w-s:de<<w}w+=s,w>=a&&!e.reindex&&(k+=1,w=0)}return O}function BQ(n,e,t,r,i,s,o){for(var a=[],l=0;l<n.length;l++){var c=n[l],d=4278190080;d|=(c>>e&(1<<t)-1)<<8-t,d|=(c>>r&(1<<i)-1)<<16-i,d|=(c>>s&(1<<o)-1)<<24-o,a.push(d)}return a}function ez(n){var e=(n>>0&1)*33+(n>>1&1)*71+(n>>2&1)*151,t=(n>>3&1)*33+(n>>4&1)*71+(n>>5&1)*151,r=(n>>6&1)*81+(n>>7&1)*174;return 4278190080|r<<16|t<<8|e}function tz(n){var e=n.pal;if(typeof e=="number"){var t=Math.floor(Math.abs(e/100)%10),r=Math.floor(Math.abs(e/10)%10),i=Math.floor(Math.abs(e)%10);return 1<<t+r+i}else{if(e==="pacman")return 256;var s=Tu[e];if(s)return s.length;throw new Error("No palette named "+e)}}function Qu(n,e){var t=e.pal,r;if(typeof t=="number"){var i=Math.floor(Math.abs(t/100)%10),s=Math.floor(Math.abs(t/10)%10),o=Math.floor(Math.abs(t)%10);t>=0?r=BQ(n,0,i,i,s,i+s,o):r=BQ(n,i+s,o,i,s,0,i)}else if(t==="pacman"){r=[];for(var a=0;a<n.length;a++)r.push(ez(n[a]))}else{var l=Tu[t];if(l)r=new Uint32Array(n).map(c=>l[c&l.length-1]|4278190080);else throw new Error("No palette named "+t)}return r}function rc(n){var e=n.pal;if(typeof e!="number"||!isFinite(e))return null;var t=Math.floor(Math.abs(e/100)%10),r=Math.floor(Math.abs(e/10)%10),i=Math.floor(Math.abs(e)%10);return t+r+i<=0?null:e>=0?{r:t,g:r,b:i,rshift:0,gshift:t,bshift:t+r}:{r:i,g:r,b:t,rshift:t+r,gshift:t,bshift:0}}function VQ(n,e,t,r){var i=rc(n);return i?(e&(1<<i.r)-1)<<i.rshift|(t&(1<<i.g)-1)<<i.gshift|(r&(1<<i.b)-1)<<i.bshift:0}function nz(n,e){var t=rc(n);return t?{r:e>>t.rshift&(1<<t.r)-1,g:e>>t.gshift&(1<<t.g)-1,b:e>>t.bshift&(1<<t.b)-1}:null}var Tu={gb:[13686916,8890444,5401396,2961698],nes:[5395026,11796480,10485760,11599933,7602281,91,95,6208,12048,543240,26368,1196544,7153664,0,0,0,12899815,16728064,14421538,16729963,14090399,6818519,6588,21681,27227,35843,43776,2918400,10777088,0,0,0,16316664,16755516,16742785,16735173,16730354,14633471,4681215,46327,57599,58229,259115,7911470,15065624,7895160,0,0,16777215,16773822,16300216,16300248,16758527,16761855,13095423,10148607,8973816,8650717,12122296,16119980,16777136,16308472,0,0],ap2lores:[0,16711935,127,8323199,32512,8355711,191,255,12549888,16760576,12566463,16744319,65280,16776960,49023,16777215],vcs:[0,0,4210752,4210752,7105644,7105644,9474192,9474192,11579568,11579568,13158600,13158600,14474460,14474460,16053492,16053492,17476,17476,1074276,1074276,2393220,2393220,3448992,3448992,4241592,4241592,5296336,5296336,6088936,6088936,6880508,6880508,10352,10352,1328260,1328260,2645144,2645144,3963052,3963052,5016764,5016764,6070476,6070476,6862044,6862044,7915756,7915756,6276,6276,1586328,1586328,3166380,3166380,4745408,4745408,6062288,6062288,7378144,7378144,8431852,8431852,9747708,9747708,136,136,2105500,2105500,3947696,3947696,5789888,5789888,7368912,7368912,8947936,8947936,10526956,10526956,11842812,11842812,6029432,6029432,7610508,7610508,8928416,8928416,10246320,10246320,11563200,11563200,12616912,12616912,13671644,13671644,14725356,14725356,7864392,7864392,9445472,9445472,10763384,10763384,12081292,12081292,13398176,13398176,14451892,14451892,15506628,15506628,16560340,16560340,8650772,8650772,9969712,9969712,11287628,11287628,12605544,12605544,13660284,13660284,14715028,14715028,15507624,15507624,16561340,16561340,8912896,8912896,10231836,10231836,11550776,11550776,12606544,12606544,13661288,13661288,14716028,14716028,15508624,15508624,16562340,16562340,8132608,8132608,9451548,9451548,11031608,11031608,12349520,12349520,1340426
Line truncated
|
|
|
|
|
<p>The 8bitworkshop IDE is a browser-based development environment for
|
|
|
|
|
micro computers and consoles.
|
|
|
|
|
The IDE compiles or assembles your source code
|
|
|
|
@@ -313,7 +313,7 @@ tools appear:</p>
|
|
|
|
|
status bar at the bottom of the window (toggle it under
|
|
|
|
|
<strong>Settings \xBB Show keyboard shortcuts / status bar</strong>).</p>
|
|
|
|
|
<p>See <a href="editor.md">Editor</a> for editor-specific shortcuts.</p>
|
|
|
|
|
`;var sT=`<h1>Editor</h1>
|
|
|
|
|
`;var aT=`<h1>Editor</h1>
|
|
|
|
|
<p>The source editor is based on <a href="https://codemirror.net/">CodeMirror 6</a>.
|
|
|
|
|
Syntax highlighting is chosen from the toolchain that handles the file\u2019s
|
|
|
|
|
extension, so a <code>.c</code> file opens as C, a <code>.ca65</code> file as 6502 assembly,
|
|
|
|
@@ -390,7 +390,7 @@ filesystem in a read-only viewer.</li>
|
|
|
|
|
<p>The editor also inherits the standard <a href="https://codemirror.net/">CodeMirror 6</a> keymap,
|
|
|
|
|
including cursor/word movement and selection with the arrow keys, and cut/
|
|
|
|
|
copy/paste (<code>mod+X</code>, <code>mod+C</code>, <code>mod+V</code>).</p>
|
|
|
|
|
`;var oT=`<h1>Disassembly</h1>
|
|
|
|
|
`;var lT=`<h1>Disassembly</h1>
|
|
|
|
|
<p>The Disassembly window disassembles machine code around the current
|
|
|
|
|
program counter. It is available on platforms that expose both a
|
|
|
|
|
disassembler and a savable CPU state.</p>
|
|
|
|
@@ -439,7 +439,7 @@ from the tool\u2019s own output; see <a href="editor.md">Editor</a>. The listing
|
|
|
|
|
the program counter using the line-to-address map from the assembler,
|
|
|
|
|
which is more accurate for source-level navigation than the live
|
|
|
|
|
disassembly.</p>
|
|
|
|
|
`;var aT=`<h1>Memory Browser</h1>
|
|
|
|
|
`;var cT=`<h1>Memory Browser</h1>
|
|
|
|
|
<p>The Memory Browser shows a hex dump of CPU memory. It is available on
|
|
|
|
|
platforms that implement <code>readAddress</code>.</p>
|
|
|
|
|
<p>The dump is laid out 16 bytes per row:</p>
|
|
|
|
@@ -460,7 +460,7 @@ row containing it.</li>
|
|
|
|
|
<li>Clicking a segment in the <a href="memmap.md">Memory Map</a> opens this
|
|
|
|
|
window and scrolls to that segment\u2019s start address.</li>
|
|
|
|
|
</ul>
|
|
|
|
|
`;var lT=`<h1>Memory Map</h1>
|
|
|
|
|
`;var dT=`<h1>Memory Map</h1>
|
|
|
|
|
<p>The Memory Map draws the program\u2019s memory layout as columns that share
|
|
|
|
|
one address axis. Each row starts at the address shown on the left, and
|
|
|
|
|
row height grows with the size of the range.</p>
|
|
|
|
@@ -488,7 +488,7 @@ Estimated sizes are marked with <code>~</code>.</li>
|
|
|
|
|
<h2>Navigating</h2>
|
|
|
|
|
<p>Click any bar to open the <a href="memory.md">Memory Browser</a> and
|
|
|
|
|
scroll it to that bar\u2019s start address.</p>
|
|
|
|
|
`;var cT=`<h1>VRAM Browser</h1>
|
|
|
|
|
`;var hT=`<h1>VRAM Browser</h1>
|
|
|
|
|
<p>The VRAM Browser is a hex dump of video memory. It is available on
|
|
|
|
|
systems with a separate video chip and a <code>readVRAMAddress</code> implementation.</p>
|
|
|
|
|
<p>It behaves like the <a href="memory.md">Memory Browser</a> \u2014 16 bytes per
|
|
|
|
@@ -496,7 +496,7 @@ row \u2014 but reads through the platform\u2019s video-memory accessor instead o
|
|
|
|
|
CPU memory, and its rows are all shown with the <code>video</code> segment color.</p>
|
|
|
|
|
<p>The dump does not scroll to a data segment on open, since VRAM has no
|
|
|
|
|
linker segments.</p>
|
|
|
|
|
`;var dT=`<h1>Memory Probe</h1>
|
|
|
|
|
`;var uT=`<h1>Memory Probe</h1>
|
|
|
|
|
<p>The Memory Probe is a heat map of memory activity. It is available on
|
|
|
|
|
platforms that implement <code>startProbing</code>.</p>
|
|
|
|
|
<p>The canvas is a 256\xD7256 grid of the 64K address space:</p>
|
|
|
|
@@ -562,7 +562,7 @@ contents, so the map is still readable before anything executes.</li>
|
|
|
|
|
<p>Hovering the map shows the routines and operations that touched that
|
|
|
|
|
address, including the program counter that performed each access and
|
|
|
|
|
any associated value.</p>
|
|
|
|
|
`;var hT=`<h1>CRT Probe</h1>
|
|
|
|
|
`;var fT=`<h1>CRT Probe</h1>
|
|
|
|
|
<p>The CRT Probe shows memory and I/O activity laid out by <em>raster
|
|
|
|
|
position</em> instead of by address, so you can see what the CPU touches at
|
|
|
|
|
each point of the display sweep. It is available on platforms that
|
|
|
|
@@ -615,7 +615,7 @@ implement <code>startProbing</code>.</p>
|
|
|
|
|
are filled with the previous color, so the display does not show false
|
|
|
|
|
black bands.</p>
|
|
|
|
|
<p>The view shows a complete frame, and might be incomplete during debugging.</p>
|
|
|
|
|
`;var uT=`<h1>Probe Log</h1>
|
|
|
|
|
`;var pT=`<h1>Probe Log</h1>
|
|
|
|
|
<p>The Probe Log is a chronological text view of CPU and memory activity
|
|
|
|
|
for a frame. It is available on platforms that implement <code>startProbing</code>.</p>
|
|
|
|
|
<p>Each line describes a recorded event (blank clock ticks between events are
|
|
|
|
@@ -632,7 +632,7 @@ addresses and, where relevant, values.</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<p>Write operations are colored differently from reads so they stand out.</p>
|
|
|
|
|
<p>The view shows a complete frame, and might be incomplete during debugging.</p>
|
|
|
|
|
`;var fT=`<h1>Scanline I/O</h1>
|
|
|
|
|
`;var mT=`<h1>Scanline I/O</h1>
|
|
|
|
|
<p>The Scanline I/O window shows the I/O and VRAM accesses made during each
|
|
|
|
|
scanline. It is available on platforms that implement <code>startProbing</code>.</p>
|
|
|
|
|
<p>Each row is one scanline:</p>
|
|
|
|
@@ -647,7 +647,7 @@ end, when known.</li>
|
|
|
|
|
<p>This makes it easy to see where per-scanline register writes (raster
|
|
|
|
|
effects) occur relative to the start of the visible line.</p>
|
|
|
|
|
<p>The view shows a complete frame, and might be incomplete during debugging.</p>
|
|
|
|
|
`;var pT=`<h1>Symbol Profiler</h1>
|
|
|
|
|
`;var gT=`<h1>Symbol Profiler</h1>
|
|
|
|
|
<p>The Symbol Profiler counts memory reads and writes per symbol over time.
|
|
|
|
|
It is available on platforms that implement <code>startProbing</code>.</p>
|
|
|
|
|
<p>Each row lists a symbol with two counters:</p>
|
|
|
|
@@ -683,7 +683,7 @@ It is available on platforms that implement <code>startProbing</code>.</p>
|
|
|
|
|
the numbers keep growing while you run and are reset when data is
|
|
|
|
|
collected again. Symbols from the debug map are listed even before they
|
|
|
|
|
are touched.</p>
|
|
|
|
|
`;var mT=`<h1>Call Graph</h1>
|
|
|
|
|
`;var OT=`<h1>Call Graph</h1>
|
|
|
|
|
<p>The Call Graph window reconstructs the program\u2019s call graph from runtime
|
|
|
|
|
stack activity, and shows where the clocks go. It is available on
|
|
|
|
|
platforms that implement <code>startProbing</code>.</p>
|
|
|
|
@@ -711,7 +711,7 @@ when the emulator is reset.</p>
|
|
|
|
|
<p>Expanding a node reveals its callees, so you can drill into a hot
|
|
|
|
|
routine and see where the time is going. The same call tree is available
|
|
|
|
|
from the command line with <code>8bws run ... -e "profile 60"</code>.</p>
|
|
|
|
|
`;var gT=`<h1>Debug Tree</h1>
|
|
|
|
|
`;var bT=`<h1>Debug Tree</h1>
|
|
|
|
|
<p>The Debug Tree shows a hierarchical view of platform debug information.
|
|
|
|
|
It is available on platforms that implement <code>getDebugTree</code>.</p>
|
|
|
|
|
<p>The tree\u2019s shape is defined by the platform. Where the
|
|
|
|
@@ -731,7 +731,7 @@ lazy are only called when the node is expanded.</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<p>Nodes collapse and expand on click. The tree refreshes with the emulator
|
|
|
|
|
while debugging.</p>
|
|
|
|
|
`;var OT=`<h1>Breakpoints</h1>
|
|
|
|
|
`;var yT=`<h1>Breakpoints</h1>
|
|
|
|
|
<p>The Breakpoints window lists every breakpoint in the project and lets you
|
|
|
|
|
add, edit, enable, or delete them. It is available on platforms that
|
|
|
|
|
implement <code>runEval</code> or <code>runToPC</code>.</p>
|
|
|
|
@@ -839,7 +839,7 @@ the disassembly, at the breakpoint\u2019s address.</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<p>Breakpoints are persisted in browser local storage, scoped to the
|
|
|
|
|
current platform and project file, so they survive a reload.</p>
|
|
|
|
|
`;var bT=`<h1>Asset Editor</h1>
|
|
|
|
|
`;var ST=`<h1>Asset Editor</h1>
|
|
|
|
|
<p>The Asset Editor finds <a href="asset-headers.md">asset headers</a> in your source \u2014 small JSON
|
|
|
|
|
descriptors inside comments \u2014 and turns the data block that follows into
|
|
|
|
|
an editable bitmap, tilemap, or palette. Edits are written straight back
|
|
|
|
@@ -888,7 +888,7 @@ from your project\u2019s graphics and palette, as a single preview.</p>
|
|
|
|
|
<p>Use <code>Ctrl/Cmd+Z</code> to undo and <code>Ctrl/Cmd+Shift+Z</code> to redo your edits. The
|
|
|
|
|
history starts fresh each time you open the Asset Editor, so undo only
|
|
|
|
|
affects the changes you\u2019ve made in this session.</p>
|
|
|
|
|
`;var yT=`<h1>Managing Files</h1>
|
|
|
|
|
`;var vT=`<h1>Managing Files</h1>
|
|
|
|
|
<h2>Importing and exporting files</h2>
|
|
|
|
|
<p>To save your files outside of the browser:</p>
|
|
|
|
|
<ol>
|
|
|
|
@@ -1001,7 +1001,7 @@ commit message, then <strong>Push Changes</strong>.</li>
|
|
|
|
|
<strong>OK</strong>. All local files are overwritten; there is no merge in the
|
|
|
|
|
browser.</li>
|
|
|
|
|
</ul>
|
|
|
|
|
`;var ST=`<h1>Build Directives</h1>
|
|
|
|
|
`;var wT=`<h1>Build Directives</h1>
|
|
|
|
|
<p>A project can contain multiple files. The build system decides how each
|
|
|
|
|
file is used based on directives in your source, and each file\u2019s
|
|
|
|
|
extension selects the tool that compiles or assembles it.</p>
|
|
|
|
@@ -1371,7 +1371,7 @@ cases:</p>
|
|
|
|
|
</table>
|
|
|
|
|
<p>See <a href="toolchains.md">Toolchains & Platforms</a> for the full
|
|
|
|
|
platform \xD7 extension \u2192 tool table.</p>
|
|
|
|
|
`;var vT=`<h1>cc65 Toolchain Upgrade</h1>
|
|
|
|
|
`;var xT=`<h1>cc65 Toolchain Upgrade</h1>
|
|
|
|
|
<p>The cc65 family (<code>cc65</code>, <code>ca65</code>, <code>ld65</code>) used by the 6502 platforms was upgraded
|
|
|
|
|
for 8bitworkshop 4.0.</p>
|
|
|
|
|
<table>
|
|
|
|
@@ -1428,7 +1428,7 @@ ignored so a clean build does not fail on style or version noise.</p>
|
|
|
|
|
<h2>Apple II graphics</h2>
|
|
|
|
|
<p>The stock lo-res driver (<code>a2.lo.s</code>) required a small upstream
|
|
|
|
|
patch (a stray branch in <code>INSTALL</code>).</p>
|
|
|
|
|
`;var wT=`<!-- generated by \`npm run doctools\`; do not edit by hand -->
|
|
|
|
|
`;var PT=`<!-- generated by \`npm run doctools\`; do not edit by hand -->
|
|
|
|
|
<h1>Toolchains & Platforms</h1>
|
|
|
|
|
<p>A source file\u2019s <strong>extension</strong> picks a tool, and the <strong>platform</strong>
|
|
|
|
|
disambiguates extensions several tools share (<code>.c</code>, <code>.s</code>, <code>.bas</code>).</p>
|
|
|
|
@@ -3148,7 +3148,7 @@ not accepted on that platform.</p>
|
|
|
|
|
</tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
`;var xT=`<h1>Asset Header</h1>
|
|
|
|
|
`;var kT=`<h1>Asset Header</h1>
|
|
|
|
|
<p>An <strong>asset header</strong> is a tiny note to the <a href="asseteditor.md">Asset Editor</a>
|
|
|
|
|
that tells it what a block of data means. It is just a JSON object inside
|
|
|
|
|
a comment, sitting right above the bytes:</p>
|
|
|
|
@@ -3824,9 +3824,9 @@ bytes).</li>
|
|
|
|
|
</tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
`;var PT=`<h2>Embedding the IDE in a web page</h2>
|
|
|
|
|
`;var $T=`<h2>Embedding the IDE in a web page</h2>
|
|
|
|
|
<p>You can embed the IDE using an IFRAME element:</p>
|
|
|
|
|
<pre><code class="language-html"><iframe src="https://8bitworkshop.com/redir.html?embed=1&..."></iframe>
|
|
|
|
|
<pre><code class="language-html"><iframe src="https://8bitworkshop.com/latest/?embed=1&..."></iframe>
|
|
|
|
|
</code></pre>
|
|
|
|
|
<p>Query-string parameters:</p>
|
|
|
|
|
<table>
|
|
|
|
@@ -3864,10 +3864,10 @@ containing embeds is effectively sandboxed from the others.</p>
|
|
|
|
|
<p>Example using Bootstrap\u2019s <code>embed-responsive</code> class:</p>
|
|
|
|
|
<pre><code class="language-html"><div class="embed-responsive embed-responsive-16by9">
|
|
|
|
|
<iframe class="embed-responsive-item" loading="lazy"
|
|
|
|
|
src="https://8bitworkshop.com/redir.html?embed=1&platform=nes&highlight=&file0_name=testembed.dasm&file0_data=..."></iframe>
|
|
|
|
|
src="https://8bitworkshop.com/latest/?embed=1&platform=nes&highlight=&file0_name=testembed.dasm&file0_data=..."></iframe>
|
|
|
|
|
</div>
|
|
|
|
|
</code></pre>
|
|
|
|
|
`;var kT=`<h1>Waveform Viewer</h1>
|
|
|
|
|
`;var QT=`<h1>Waveform Viewer</h1>
|
|
|
|
|
<p>The Verilog platform shows a waveform trace below the emulator screen,
|
|
|
|
|
with one row per exposed signal. <strong>Click</strong> to give the waveform viewer
|
|
|
|
|
keyboard focus.</p>
|
|
|
|
@@ -3892,13 +3892,13 @@ signals), <code>clk</code> and <code>reset</code></li>
|
|
|
|
|
<li>For input signals (other than <code>clk</code> or <code>reset</code>) <strong>click</strong> its row to change its
|
|
|
|
|
value at the current clock.</li>
|
|
|
|
|
</ul>
|
|
|
|
|
`;var Yz=o0(),Yu=[{id:"index",title:"IDE Help",html:iT},{id:"editor",title:"Editor",html:sT},{id:"disasm",title:"Disassembly",html:oT},{id:"memory",title:"Memory Browser",html:aT},{id:"memmap",title:"Memory Map",html:lT},{id:"vram",title:"VRAM Browser",html:cT},{id:"memprobe",title:"Memory Probe",html:dT},{id:"crtprobe",title:"CRT Probe",html:hT},{id:"probelog",title:"Probe Log",html:uT},{id:"scanlineio",title:"Scanline I/O",html:fT},{id:"symbols",title:"Symbol Profiler",html:pT},{id:"callgraph",title:"Call Graph",html:mT},{id:"debugtree",title:"Debug Tree",html:gT},{id:"breakpoints",title:"Breakpoints",html:OT},{id:"asseteditor",title:"Asset Editor",html:bT},{id:"managing-files",title:"Managing Files",html:yT},{id:"build-directives",title:"Build Directives",html:ST},{id:"cc65-upgrade",title:"CC65 Upgrade",html:vT},{id:"toolchains",title:"Toolchains & Platforms",html:wT},{id:"asset-headers",title:"Asset Headers",html:xT},{id:"embedding-ide",title:"Embedding the IDE",html:PT},{id:"verilog-waveform",title:"Waveform Viewer",html:kT}],ju={};for(let n of Yu)ju[n.id]=n;H1(()=>Yu);function l0(n){let e=n||"";return e.startsWith("#")&&(e=e.substring(1)),e.startsWith("help")&&(e=e.substring(4)),e.startsWith("/")&&(e=e.substring(1)),e.endsWith(".md")&&(e=e.substring(0,e.length-3)),e=e.replace(/^\.\//,""),ju[e]?e:"index"}function jz(n){return ju[l0(n)]}var a0={"#disasm":"disasm","#memory":"memory","#memmap":"memmap","#vram":"vram","#memprobe":"memprobe","#crtprobe":"crtprobe","#probelog":"probelog","#scanlineio":"scanlineio","#symbols":"symbols","#callgraph":"callgraph","#debugtree":"debugtree","#breakpoints":"breakpoints","#asseteditor":"asseteditor"};function YT(n,e){return e?"editor":n&&a0[n]||"index"}function jT(n){let e=n&&a0[n]&&ju[a0[n]];if(!e)return;let t=e.html.replace(/^\s*<h1\b[^>]*>[\s\S]*?<\/h1>/i," ");return Xg(_l(t))}function Uz(n){n.querySelectorAll("a[href]").forEach(t=>{let r=t.getAttribute("href");if(!r)return;if(/^[a-z][a-z0-9+.-]*:/i.test(r)){t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer");return}if(r.startsWith("/")||r.startsWith("#"))return;let i=r.indexOf("#"),s=i>=0?r.substring(0,i):r;s.endsWith(".md")&&(t.setAttribute("href","#help/"+l0(s)),t.removeAttribute("target"))})}function qz(n,e){let t=jz(e);n.innerHTML=Yz.sanitize(t.html),Uz(n)}var lc=class{constructor(e){this.id=l0(e||"index")}getPath(){return"#help/"+this.id}createDiv(e){return this.maindiv=xr(e,"vertical-scroll help-view"),qz(this.maindiv[0],this.id),this.maindiv[0]}refresh(e){}};var Uu=class{constructor(e,t){this.classify=e;this.name=t;this.graph=null;this.stack=[];this.lastsp=-1;this.lastpc=0;this.spAtLastExec=-1;this.interrupted=!1;this.jsr=!1;this.rts=!1}clear(){this.graph=null,this.reset()}reset(){this.stack=[],this.lastsp=-1,this.lastpc=0,this.spAtLastExec=-1,this.interrupted=!1,this.jsr=!1,this.rts=!1}newNode(e,t){return{$$SP:t,$$PC:e,count:0,self:0,total:0,startLine:null,endLine:null,calls:{}}}enter(e,t){let r=this.stack[this.stack.length-1],i=this.name(e),s=r.calls[i];s==null?s=r.calls[i]=this.newNode(e,this.lastsp):s.$$PC==null&&(s.$$PC=e),this.stack.push(s),s.count++,s.startLine=t}leave(e){if(this.stack.length>1)this.stack.pop().endLine=e;else{let t=this.stack[0];this.graph=this.newNode(null,this.lastsp),this.graph.total=t.total,this.graph.calls[this.name(this.lastpc)]=t,this.stack=[this.graph]}}clocks(e){let t=this.stack;if(t.length){t[t.length-1].self+=e;for(let r of t)r.total+=e}}event(e,t,r){var i;switch(e){case 0:this.clocks(t);break;case 134217728:this.interrupted=!0;break;case 184549376:case 167772160:if(this.stack.length){let s=this.stack[this.stack.length-1],o=this.lastsp-t;(o==2||o==3)&&t<s.$$SP&&(this.jsr=!0),(o==-2||o==-3)&&this.stack.length>1&&t>s.$$SP&&(this.rts=!0)}this.lastsp=t;break;case 16777216:{this.stack.length||((i=this.graph)!=null||(this.graph=this.newNode(null,this.lastsp)),this.stack=[this.graph]);let s=this.spAtLastExec>=0?this.classify(this.lastpc):"unknown";if(s==="unknown"&&!this.interrupted)this.guess(t,r);else{let o=this.lastsp<this.spAtLastExec,a=this.lastsp>this.spAtLastExec,l=s==="other"&&o&&Math.abs(t-this.lastpc)>=4;(s==="call"||this.interrupted||l)&&o?this.enter(t,r):s==="return"&&a&&this.leave(r),this.jsr=this.rts=!1}this.interrupted=!1,this.lastpc=t,this.spAtLastExec=this.lastsp;break}}}guess(e,t){Math.abs(e-this.lastpc)>=4&&(this.jsr&&this.enter(e,t),this.rts&&this.leave(t),this.jsr=this.rts=!1)}};var Oj=new DataView(new ArrayBuffer(8));var Kz=/^(JSR|JSL|CALL|BSR|LBSR|RST)\b/i,Jz=/^(RTS|RTL|RTI|RET|RETI|RETN)\b|^PUL[SU]\b.*\bPC\b/i;function UT(n){return Kz.test(n.trim())}function qT(n){return Jz.test(n.trim())}var cc=256,GT=100,eW=!1,qu=class n{constructor(e,t){this.expanded=!1;this.parent=e,this.name=t,this.children=new Map,this.level=e?e.level+1:-1,this.view=e?e.view:null}getDiv(){return this._div==null&&(this._div=document.createElement("div"),this._div.classList.add("vertical-scroll"),this._div.classList.add("tree-content"),this._header=document.
Line truncated
|
|
|
|
|
`,await sA(n),he.newfile?!r&&!t?Re('No build tool for "'+n+'" on this platform; project will not build.'):r?dA(!0,!0):an("No skeleton file for "+t+" on this platform; using blank file."):an('Could not find file "'+n+'"<br><br>Creating new '+(r?t:"blank")+" file."),delete he.newfile,mf()}}function v0(n){if(n=="/")he={repo:"/"};else if(n.indexOf("://")>=0){var e=Ql(n);e&&(he={repo:e.repopath})}else he.platform=Oe,he.file=n;no()}async function hW(n){var e=Gf(P.getToolForFilename(n));try{return await $.get("presets/"+Nt(Oe)+"/skeleton."+e,"text")}catch(t){return console.log(t+""),null}}function w0(n){return n.indexOf(" ")>=0?(Re("No spaces in filenames, please."),!1):!0}async function uW(n){var e=Nt(Oe),t={},r=[];for(var i of n){var s=P.getToolForFilename("test"+i);t[s]||(t[s]=[],r.push(s)),t[s].push(i)}var o=r.map(d=>$.ajax({url:"presets/"+e+"/skeleton."+Gf(d),type:"HEAD"}).then(()=>d,()=>null)),a=await Promise.all(o),l=[];for(var c of a)c!=null&&l.push({tool:c,extensions:t[c]});return l}async function fW(n){var e=await uW(P.getDefaultExtensions()),t,r;return e.length===0?(t=P.getDefaultExtensions(),r=t.join(" ")):(t=e.reduce((i,s)=>i.concat(s.extensions),[]),r=e.map(i=>i.extensions.join(" ")).join("<br>")),bootbox.prompt({title:"Enter the name of your new main source file.<br><br><span class='dialog-help'>"+r+"</span>",placeholder:"newfile"+t[0],callback:i=>{if(i&&i.trim().length>0){if(!w0(i))return;i.indexOf(".")<0&&(i+=t[0]);var s=i;he.newfile="1",v0(s)}}}),!0}function pW(n){let e=$('<input type="file" multiple accept="*" style="display:none">'),t=e[0];e.change(r=>{mW(t.files)}),e.click()}function mW(n){console.log(n);var e=0;function t(){var r=n[e++];if(!r)console.log("Done uploading",e),e>2?(an("Files uploaded."),setTimeout(Oc,1e3)):(he.file=n[0].name,bootbox.confirm({message:"Open '"+gs.sanitize(he.file)+"' as main project file?",buttons:{confirm:{label:"Open As New Project"},cancel:{label:"Include/Link With Project Later"}},callback:o=>{o?no():setTimeout(Oc,1e3)}}));else{var i=r.name,s=new FileReader;s.onload=function(o){var a=o.target.result,l=new Uint8Array(a);vc(i,l)||(l=Sc(l).replace(`\r
|
|
|
|
|
`;var Uz=o0(),Yu=[{id:"index",title:"IDE Help",html:oT},{id:"editor",title:"Editor",html:aT},{id:"disasm",title:"Disassembly",html:lT},{id:"memory",title:"Memory Browser",html:cT},{id:"memmap",title:"Memory Map",html:dT},{id:"vram",title:"VRAM Browser",html:hT},{id:"memprobe",title:"Memory Probe",html:uT},{id:"crtprobe",title:"CRT Probe",html:fT},{id:"probelog",title:"Probe Log",html:pT},{id:"scanlineio",title:"Scanline I/O",html:mT},{id:"symbols",title:"Symbol Profiler",html:gT},{id:"callgraph",title:"Call Graph",html:OT},{id:"debugtree",title:"Debug Tree",html:bT},{id:"breakpoints",title:"Breakpoints",html:yT},{id:"asseteditor",title:"Asset Editor",html:ST},{id:"managing-files",title:"Managing Files",html:vT},{id:"build-directives",title:"Build Directives",html:wT},{id:"cc65-upgrade",title:"CC65 Upgrade",html:xT},{id:"toolchains",title:"Toolchains & Platforms",html:PT},{id:"asset-headers",title:"Asset Headers",html:kT},{id:"embedding-ide",title:"Embedding the IDE",html:$T},{id:"verilog-waveform",title:"Waveform Viewer",html:QT}],ju={};for(let n of Yu)ju[n.id]=n;J1(()=>Yu);function l0(n){let e=n||"";return e.startsWith("#")&&(e=e.substring(1)),e.startsWith("help")&&(e=e.substring(4)),e.startsWith("/")&&(e=e.substring(1)),e.endsWith(".md")&&(e=e.substring(0,e.length-3)),e=e.replace(/^\.\//,""),ju[e]?e:"index"}function qz(n){return ju[l0(n)]}var a0={"#disasm":"disasm","#memory":"memory","#memmap":"memmap","#vram":"vram","#memprobe":"memprobe","#crtprobe":"crtprobe","#probelog":"probelog","#scanlineio":"scanlineio","#symbols":"symbols","#callgraph":"callgraph","#debugtree":"debugtree","#breakpoints":"breakpoints","#asseteditor":"asseteditor"};function UT(n,e){return e?"editor":n&&a0[n]||"index"}function qT(n){let e=n&&a0[n]&&ju[a0[n]];if(!e)return;let t=e.html.replace(/^\s*<h1\b[^>]*>[\s\S]*?<\/h1>/i," ");return Xg(_l(t))}function Gz(n){n.querySelectorAll("a[href]").forEach(t=>{let r=t.getAttribute("href");if(!r)return;if(/^[a-z][a-z0-9+.-]*:/i.test(r)){t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer");return}if(r.startsWith("/")||r.startsWith("#"))return;let i=r.indexOf("#"),s=i>=0?r.substring(0,i):r;s.endsWith(".md")&&(t.setAttribute("href","#help/"+l0(s)),t.removeAttribute("target"))})}function Hz(n,e){let t=qz(e);n.innerHTML=Uz.sanitize(t.html),Gz(n)}var lc=class{constructor(e){this.id=l0(e||"index")}getPath(){return"#help/"+this.id}createDiv(e){return this.maindiv=xr(e,"vertical-scroll help-view"),Hz(this.maindiv[0],this.id),this.maindiv[0]}refresh(e){}};var Uu=class{constructor(e,t){this.classify=e;this.name=t;this.graph=null;this.stack=[];this.lastsp=-1;this.lastpc=0;this.spAtLastExec=-1;this.interrupted=!1;this.jsr=!1;this.rts=!1}clear(){this.graph=null,this.reset()}reset(){this.stack=[],this.lastsp=-1,this.lastpc=0,this.spAtLastExec=-1,this.interrupted=!1,this.jsr=!1,this.rts=!1}newNode(e,t){return{$$SP:t,$$PC:e,count:0,self:0,total:0,startLine:null,endLine:null,calls:{}}}enter(e,t){let r=this.stack[this.stack.length-1],i=this.name(e),s=r.calls[i];s==null?s=r.calls[i]=this.newNode(e,this.lastsp):s.$$PC==null&&(s.$$PC=e),this.stack.push(s),s.count++,s.startLine=t}leave(e){if(this.stack.length>1)this.stack.pop().endLine=e;else{let t=this.stack[0];this.graph=this.newNode(null,this.lastsp),this.graph.total=t.total,this.graph.calls[this.name(this.lastpc)]=t,this.stack=[this.graph]}}clocks(e){let t=this.stack;if(t.length){t[t.length-1].self+=e;for(let r of t)r.total+=e}}event(e,t,r){var i;switch(e){case 0:this.clocks(t);break;case 134217728:this.interrupted=!0;break;case 184549376:case 167772160:if(this.stack.length){let s=this.stack[this.stack.length-1],o=this.lastsp-t;(o==2||o==3)&&t<s.$$SP&&(this.jsr=!0),(o==-2||o==-3)&&this.stack.length>1&&t>s.$$SP&&(this.rts=!0)}this.lastsp=t;break;case 16777216:{this.stack.length||((i=this.graph)!=null||(this.graph=this.newNode(null,this.lastsp)),this.stack=[this.graph]);let s=this.spAtLastExec>=0?this.classify(this.lastpc):"unknown";if(s==="unknown"&&!this.interrupted)this.guess(t,r);else{let o=this.lastsp<this.spAtLastExec,a=this.lastsp>this.spAtLastExec,l=s==="other"&&o&&Math.abs(t-this.lastpc)>=4;(s==="call"||this.interrupted||l)&&o?this.enter(t,r):s==="return"&&a&&this.leave(r),this.jsr=this.rts=!1}this.interrupted=!1,this.lastpc=t,this.spAtLastExec=this.lastsp;break}}}guess(e,t){Math.abs(e-this.lastpc)>=4&&(this.jsr&&this.enter(e,t),this.rts&&this.leave(t),this.jsr=this.rts=!1)}};var vj=new DataView(new ArrayBuffer(8));var eW=/^(JSR|JSL|CALL|BSR|LBSR|RST)\b/i,tW=/^(RTS|RTL|RTI|RET|RETI|RETN)\b|^PUL[SU]\b.*\bPC\b/i;function GT(n){return eW.test(n.trim())}function HT(n){return tW.test(n.trim())}var cc=256,KT=100,nW=!1,qu=class n{constructor(e,t){this.expanded=!1;this.parent=e,this.name=t,this.children=new Map,this.level=e?e.level+1:-1,this.view=e?e.view:null}getDiv(){return this._div==null&&(this._div=document.createElement("div"),this._div.classList.add("vertical-scroll"),this._div.classList.add("tree-content"),this._header=document.
Line truncated
|
|
|
|
|
`,await aA(n),he.newfile?!r&&!t?Re('No build tool for "'+n+'" on this platform; project will not build.'):r?uA(!0,!0):an("No skeleton file for "+t+" on this platform; using blank file."):an('Could not find file "'+n+'"<br><br>Creating new '+(r?t:"blank")+" file."),delete he.newfile,mf()}}function v0(n){if(n=="/")he={repo:"/"};else if(n.indexOf("://")>=0){var e=Ql(n);e&&(he={repo:e.repopath})}else he.platform=Oe,he.file=n;no()}async function fW(n){var e=Gf(P.getToolForFilename(n));try{return await $.get("presets/"+Nt(Oe)+"/skeleton."+e,"text")}catch(t){return console.log(t+""),null}}function w0(n){return n.indexOf(" ")>=0?(Re("No spaces in filenames, please."),!1):!0}async function pW(n){var e=Nt(Oe),t={},r=[];for(var i of n){var s=P.getToolForFilename("test"+i);t[s]||(t[s]=[],r.push(s)),t[s].push(i)}var o=r.map(d=>$.ajax({url:"presets/"+e+"/skeleton."+Gf(d),type:"HEAD"}).then(()=>d,()=>null)),a=await Promise.all(o),l=[];for(var c of a)c!=null&&l.push({tool:c,extensions:t[c]});return l}async function mW(n){var e=await pW(P.getDefaultExtensions()),t,r;return e.length===0?(t=P.getDefaultExtensions(),r=t.join(" ")):(t=e.reduce((i,s)=>i.concat(s.extensions),[]),r=e.map(i=>i.extensions.join(" ")).join("<br>")),bootbox.prompt({title:"Enter the name of your new main source file.<br><br><span class='dialog-help'>"+r+"</span>",placeholder:"newfile"+t[0],callback:i=>{if(i&&i.trim().length>0){if(!w0(i))return;i.indexOf(".")<0&&(i+=t[0]);var s=i;he.newfile="1",v0(s)}}}),!0}function gW(n){let e=$('<input type="file" multiple accept="*" style="display:none">'),t=e[0];e.change(r=>{OW(t.files)}),e.click()}function OW(n){console.log(n);var e=0;function t(){var r=n[e++];if(!r)console.log("Done uploading",e),e>2?(an("Files uploaded."),setTimeout(Oc,1e3)):(he.file=n[0].name,bootbox.confirm({message:"Open '"+gs.sanitize(he.file)+"' as main project file?",buttons:{confirm:{label:"Open As New Project"},cancel:{label:"Include/Link With Project Later"}},callback:o=>{o?no():setTimeout(Oc,1e3)}}));else{var i=r.name,s=new FileReader;s.onload=function(o){var a=o.target.result,l=new Uint8Array(a);vc(i,l)||(l=Sc(l).replace(`\r
|
|
|
|
|
`,`
|
|
|
|
|
`)),N.updateFile(i,l),console.log("Uploaded "+i+" "+l.length+" bytes"),t()},s.readAsArrayBuffer(r)}}n&&t()}async function gW(n){var e=window.showDirectoryPicker;e||Re("This browser can't open local files on your computer, yet. Try Chrome.");var t=await e(),r=t.name,i="__localfs__"+r,s={handle:t},o=y0.createInstance({name:i,version:2});await o.setItem(i,s),he={localfs:r},no(!0)}async function OW(n){return new Promise((e,t)=>{bootbox.prompt(gs.sanitize(n),r=>{e(r)})})}async function bW(n){let e={mode:"readwrite"};var t="__localfs__"+n,r=y0.createInstance({name:t,version:2}),i=await r.getItem(t),s=i.handle;console.log(i,s);var o=await s.queryPermission(e);if(console.log(o),o!=="granted"&&(await OW("Request permissions to access filesystem?"),o=await s.requestPermission(e)),o!=="granted"){Re("Could not get permission to access filesystem.");return}let a={};return{getFileData:async l=>{console.log("getFileData",l);let d=await(await s.getFileHandle(l,{create:!1})).getFile();return wc(l,new Uint8Array(await d.arrayBuffer()))},setFileData:async(l,c)=>{a[l]=Date.now();let h=await(await s.getFileHandle(l,{create:!0})).createWritable();await h.write(c),await h.close()},onFileSystemUpdate:l=>{if(typeof window.FileSystemObserver=="undefined")return;new window.FileSystemObserver((d,h)=>{for(let u of d)if(u.changedHandle){let f=u.changedHandle.name;if(Date.now()-(a[f]||0)<2e3)continue;l(f)}}).observe(s,{recursive:!0})}}}function _t(){return yt(re.mainPath)}function Z1(){return yt(N.getActiveID())}function yW(n){var e=N.getActive(),t=N.getActiveID(),r=e&&e.setData&&!e.setText;if(e&&(e.setText||e.setData)){var i="presets/"+Nt(Oe)+"/"+t;Sf(i,s=>{if(s==null){Et?Re("Can only revert built-in examples. If you want to revert all files, You can pull from the repository."):Re("Can only revert built-in examples.");return}bootbox.confirm("Reset '"+gs.sanitize(t)+"' to default?",o=>{o&&(r?(e.setData(s),re.updateFile(t,s)):e.setText(s))})},r?"arraybuffer":"text")}else Re("Cannot revert the active window. Please choose a text file.")}function SW(n){var e=N.getActive();if(e&&e.getPath){var t=N.getActiveID();bootbox.confirm("Delete '"+gs.sanitize(t)+"'?",r=>{r&&$r.removeItem(t).then(()=>{he.file==t?(Zi.unsetLastPreset(),no()):(Oc(),an("Deleted "+t))})})}else Re("Cannot delete the active window.")}function vW(n){var e=N.getActive();if(e&&e.getPath&&re.getFile(e.getPath())){var t=N.getActiveID();bootbox.prompt({title:"Rename '"+gs.sanitize(t)+"' to?",value:t,callback:r=>{var i=re.getFile(e.getPath());if(r&&r!=t&&i){if(!w0(r))return;$r.removeItem(t).then(()=>$r.setItem(r,i)).then(()=>{Oc(),alert("Renamed "+t+" to "+r),t==re.mainPath&&v0(r)})}}})}else Re("Cannot rename the active window.")}function wW(n){let e={},t,r=P.getPresets?P.getPresets():[];for(var i=0;i<r.length;i++){var s=r[i],o=s.chapter?s.chapter+". "+s.name:s.name,a=s.id==re.mainPath;s.category?t=$("<optgroup />").attr("label","Examples: "+s.category).appendTo(n):t||(t=$("<optgroup />").attr("label","Examples").appendTo(n)),t.append($("<option />").val(s.id).text(o).attr("selected",a?"selected":null)),a&&(nf=s),e[s.id]=o}return e}function xW(n){if(nr&&!xa){var e=0,t=Js();if(t){let i=$("<optgroup />").attr("label","Repositories").appendTo(n);for(let s in t){var r=t[s];r.platform_id&&Nt(r.platform_id)==Nt(Oe)&&i.append($("<option />").val(r.url).text(r.url.substring(r.url.indexOf("/"))))}}}}async function oA(n,e,t,r){let i=await $r.keys();i||(i=[]);let s;for(var o=0;o<i.length;o++){let a=i[o];if(a.startsWith(t)&&!r[a]){s||(s=$("<optgroup />").attr("label",e).appendTo(n));let l=a.substring(t.length);s.append($("<option />").val(a).text(l).attr("selected",a==re.mainPath?"selected":null))}}}function aA(n){n.css("visibility","visible");var e=re.mainPath;n.val()!=e&&n.append($("<option />").val(e).text(e).attr("selected","selected"))}async function Oc(){var n=$("#preset_select").empty();if(Et)n.append($("<option />").val("/").text("Leave Repository")),$("#repo_name").text(yt(Et)+"/").show(),await oA(n,Et,"",{}),aA(n);else{xW(n);var e=wW(n);await oA(n,"Local Files","",e),aA(n)}n.off("change").change(function(t){v0($(this).val().toString())})}function PW(n){var e=$("<p/>");if(n.path!=null){var t=n.line?n.label?`(${n.path} @ ${n.label})`:`(${n.path}:${n.line})`:`(${n.path})`,r=$("<a/>").text(t),i=n.path;i==_t()&&(i=re.mainPath),N.isWindow(i)&&r.click(s=>{var o=N.createOrShow(i);o instanceof un&&o.navigateToLine(n.line)}),e.append(r),e.append(" ")}return e.append($("<span/>").text(n.msg)),e}function hA(){$("#error_alert").hide(),S0=!1}function x0(n,e){var t=$("#error_alert_msg").empty();for(var r of n.slice(0,10))t.append(PW(r));$("#error_alert").show(),S0=e;var i=n.find(o=>o.path!=null),s;i&&N.isWindow(i.path==_t()?re.mainPath:i.path)&&(s=()=>{QW(i)})}function uA(n,e){if(e!=null){var t={msg:e,line:0};n instanceof xo&&n.$loc&&(t=Object.create(n.$loc),t.msg=e,console.log(t)),x0([t],!0)}}var uc=null;async function kW(n){if("uppercaseOnly"in n&&$Q(n.uppercaseOnly),"errors"in n&&n.errors.l
Line truncated
|
|
|
|
|
`)),N.updateFile(i,l),console.log("Uploaded "+i+" "+l.length+" bytes"),t()},s.readAsArrayBuffer(r)}}n&&t()}async function bW(n){var e=window.showDirectoryPicker;e||Re("This browser can't open local files on your computer, yet. Try Chrome.");var t=await e(),r=t.name,i="__localfs__"+r,s={handle:t},o=y0.createInstance({name:i,version:2});await o.setItem(i,s),he={localfs:r},no(!0)}async function yW(n){return new Promise((e,t)=>{bootbox.prompt(gs.sanitize(n),r=>{e(r)})})}async function SW(n){let e={mode:"readwrite"};var t="__localfs__"+n,r=y0.createInstance({name:t,version:2}),i=await r.getItem(t),s=i.handle;console.log(i,s);var o=await s.queryPermission(e);if(console.log(o),o!=="granted"&&(await yW("Request permissions to access filesystem?"),o=await s.requestPermission(e)),o!=="granted"){Re("Could not get permission to access filesystem.");return}let a={};return{getFileData:async l=>{console.log("getFileData",l);let d=await(await s.getFileHandle(l,{create:!1})).getFile();return wc(l,new Uint8Array(await d.arrayBuffer()))},setFileData:async(l,c)=>{a[l]=Date.now();let h=await(await s.getFileHandle(l,{create:!0})).createWritable();await h.write(c),await h.close()},onFileSystemUpdate:l=>{if(typeof window.FileSystemObserver=="undefined")return;new window.FileSystemObserver((d,h)=>{for(let u of d)if(u.changedHandle){let f=u.changedHandle.name;if(Date.now()-(a[f]||0)<2e3)continue;l(f)}}).observe(s,{recursive:!0})}}}function _t(){return yt(re.mainPath)}function X1(){return yt(N.getActiveID())}function vW(n){var e=N.getActive(),t=N.getActiveID(),r=e&&e.setData&&!e.setText;if(e&&(e.setText||e.setData)){var i="presets/"+Nt(Oe)+"/"+t;Sf(i,s=>{if(s==null){Et?Re("Can only revert built-in examples. If you want to revert all files, You can pull from the repository."):Re("Can only revert built-in examples.");return}bootbox.confirm("Reset '"+gs.sanitize(t)+"' to default?",o=>{o&&(r?(e.setData(s),re.updateFile(t,s)):e.setText(s))})},r?"arraybuffer":"text")}else Re("Cannot revert the active window. Please choose a text file.")}function wW(n){var e=N.getActive();if(e&&e.getPath){var t=N.getActiveID();bootbox.confirm("Delete '"+gs.sanitize(t)+"'?",r=>{r&&$r.removeItem(t).then(()=>{he.file==t?(Zi.unsetLastPreset(),no()):(Oc(),an("Deleted "+t))})})}else Re("Cannot delete the active window.")}function xW(n){var e=N.getActive();if(e&&e.getPath&&re.getFile(e.getPath())){var t=N.getActiveID();bootbox.prompt({title:"Rename '"+gs.sanitize(t)+"' to?",value:t,callback:r=>{var i=re.getFile(e.getPath());if(r&&r!=t&&i){if(!w0(r))return;$r.removeItem(t).then(()=>$r.setItem(r,i)).then(()=>{Oc(),alert("Renamed "+t+" to "+r),t==re.mainPath&&v0(r)})}}})}else Re("Cannot rename the active window.")}function PW(n){let e={},t,r=P.getPresets?P.getPresets():[];for(var i=0;i<r.length;i++){var s=r[i],o=s.chapter?s.chapter+". "+s.name:s.name,a=s.id==re.mainPath;s.category?t=$("<optgroup />").attr("label","Examples: "+s.category).appendTo(n):t||(t=$("<optgroup />").attr("label","Examples").appendTo(n)),t.append($("<option />").val(s.id).text(o).attr("selected",a?"selected":null)),a&&(nf=s),e[s.id]=o}return e}function kW(n){if(nr&&!xa){var e=0,t=Js();if(t){let i=$("<optgroup />").attr("label","Repositories").appendTo(n);for(let s in t){var r=t[s];r.platform_id&&Nt(r.platform_id)==Nt(Oe)&&i.append($("<option />").val(r.url).text(r.url.substring(r.url.indexOf("/"))))}}}}async function lA(n,e,t,r){let i=await $r.keys();i||(i=[]);let s;for(var o=0;o<i.length;o++){let a=i[o];if(a.startsWith(t)&&!r[a]){s||(s=$("<optgroup />").attr("label",e).appendTo(n));let l=a.substring(t.length);s.append($("<option />").val(a).text(l).attr("selected",a==re.mainPath?"selected":null))}}}function cA(n){n.css("visibility","visible");var e=re.mainPath;n.val()!=e&&n.append($("<option />").val(e).text(e).attr("selected","selected"))}async function Oc(){var n=$("#preset_select").empty();if(Et)n.append($("<option />").val("/").text("Leave Repository")),$("#repo_name").text(yt(Et)+"/").show(),await lA(n,Et,"",{}),cA(n);else{kW(n);var e=PW(n);await lA(n,"Local Files","",e),cA(n)}n.off("change").change(function(t){v0($(this).val().toString())})}function $W(n){var e=$("<p/>");if(n.path!=null){var t=n.line?n.label?`(${n.path} @ ${n.label})`:`(${n.path}:${n.line})`:`(${n.path})`,r=$("<a/>").text(t),i=n.path;i==_t()&&(i=re.mainPath),N.isWindow(i)&&r.click(s=>{var o=N.createOrShow(i);o instanceof un&&o.navigateToLine(n.line)}),e.append(r),e.append(" ")}return e.append($("<span/>").text(n.msg)),e}function fA(){$("#error_alert").hide(),S0=!1}function x0(n,e){var t=$("#error_alert_msg").empty();for(var r of n.slice(0,10))t.append($W(r));$("#error_alert").show(),S0=e;var i=n.find(o=>o.path!=null),s;i&&N.isWindow(i.path==_t()?re.mainPath:i.path)&&(s=()=>{AW(i)})}function pA(n,e){if(e!=null){var t={msg:e,line:0};n instanceof xo&&n.$loc&&(t=Object.create(n.$loc),t.msg=e,console.log(t)),x0([t],!0)}}var uc=null;async function QW(n){if("uppercaseOnly"in n&&TQ(n.uppercaseOnly),"errors"in n&&n.errors.l
Line truncated
|
|
|
|
|
`+t(i)+`
|
|
|
|
|
`;re.loadFiles([s]).then(a=>{a&&a.length?Re(i+" already exists; including anyway"):re.updateFile(s,`
|
|
|
|
|
`),r.insertLinesBefore(o),va()})}}}):Re("Can't insert text in this window -- switch back to main file")}function NW(){var n=_t(),e=P.getToolForFilename(n);n.endsWith(".c")||e=="sdcc"||e=="cc65"||e=="cmoc"||e=="smlrc"||e=="oscar64"?Ur("Header",".h",t=>'#include "'+t+'"'):e=="dasm"||e=="zmac"?Ur("Include",".inc",t=>' include "'+t+'"'):e=="ca65"||e=="sdasz80"||e=="vasm"||e=="armips"?Ur("Include",".inc",t=>' .include "'+t+'"'):e=="verilator"?Ur("Verilog",".v",t=>'`include "'+t+'"'):e=="wiz"?Ur("Include",".wiz",t=>'import "'+t+'";'):e=="ecs"?Ur("Include",".ecs",t=>'import "'+t+'"'):e=="acme"?Ur("Include",".acme",t=>'!src "'+t+'"'):e=="xa"?Ur("Include",".xa",t=>'#include "'+t+'"'):e=="dialog"?Ur("Include",".dg",t=>'%% #include "'+t+'"'):Re("Can't add include file to this project type ("+e+")")}function BW(){var n=_t(),e=P.getToolForFilename(n);n.endsWith(".c")||e=="sdcc"||e=="cc65"||e=="cmoc"||e=="smlrc"?Ur("Linked C (or .s)",".c",t=>'//#link "'+t+'"'):n.endsWith("asm")||n.endsWith(".s")||e=="ca65"||e=="lwasm"?Ur("Linked ASM",".inc",t=>';#link "'+t+'"'):Re("Can't add linked file to this project type ("+e+")")}function VW(){if(gt=new Wi($("#toolbar")[0],null),gt.grp.prop("id","run_bar"),gt.add("mod+shift+r","Reset","glyphicon-refresh",QA).prop("id","dbg_reset"),gt.add("mod+shift+h","Pause","glyphicon-pause",OA).prop("id","dbg_pause"),gt.add("mod+shift+g","Go To Address","",n=>{pA()||cf()}),gt.add("mod+shift+g","Resume","glyphicon-play",cf).prop("id","dbg_go"),gt.add("F8","Pause/Resume","",bA),gt.add("F1","Help","",EA),P.restartAtPC&>.add("mod+shift+a","Restart at Cursor","glyphicon-play-circle",xA).prop("id","dbg_restartatline"),gt.newGroup(),gt.grp.prop("id","debug_bar"),P.runEval&>.add("mod+shift+d","Reset and Debug","glyphicon-fast-backward",TA).prop("id","dbg_restart"),P.stepBack&>.add("mod+shift+j","Step Backwards","glyphicon-step-backward",$A).prop("id","dbg_stepback"),P.step&>.add("mod+shift+l","Single Step","glyphicon-step-forward",yA).prop("id","dbg_step"),P.stepOver&>.add("mod+shift+k","Step Over","glyphicon-hand-right",SA).prop("id","dbg_stepover"),P.runUntilReturn&>.add("mod+shift+i","Step Out of Subroutine","glyphicon-hand-up",kA).prop("id","dbg_stepout"),P.runToVsync&>.add("mod+shift+x","Next Frame/Interrupt","glyphicon-forward",vA).prop("id","dbg_tovsync"),(P.runEval||P.runToPC)&&!Oe.startsWith("verilog")&>.add("mod+shift+y","Run To Line","glyphicon-save",PA).prop("id","dbg_toline"),gt.newGroup(),gt.grp.prop("id","xtra_bar"),gt.add("mod+shift+f","Search","glyphicon-search",Vb).prop("id","dbg_search"),$(".dropdown-menu").collapse({toggle:!1}),$("#item_new_file").click(fW),$("#item_upload_file").click(pW),$("#item_open_directory").click(gW),$("#item_github_login").click(I1),$("#item_github_logout").click(X1),$("#item_github_import").click(z1),$("#item_github_publish").click(W1),$("#item_github_push").click(N1),$("#item_github_pull").click(B1),$("#item_repo_delete").click(F1),$("#item_share_file").click(T1),$("#item_reset_file").click(yW),$("#item_rename_file").click(vW),$("#item_delete_file").click(SW),$("#item_download_rom").click(C1),$("#item_download_file").click(_1),$("#item_download_zip").click(R1),P.getDebugSymbolFile?$("#item_download_sym").click(M1):$("#item_download_sym").hide(),$("#item_download_allzip").click(L1),$("#item_record_video").click(D1),Lg()?$("#item_export_cassette").click(A1):$("#item_export_cassette").hide(),P.setFrameRate&&P.getFrameRate&&($("#dbg_slower").click(LW),$("#dbg_faster").click(DW),$("#dbg_slowest").click(ZW),$("#dbg_fastest").click(IW)),$("#item_addfile_include").click(NW),$("#item_addfile_link").click(BW),$("#item_request_persist").click(()=>dA(!0,!1)),$("#item_settings").click(g1),AA(),P.newCodeAnalyzer&>.add(null,"Analyze CPU Timing","glyphicon-time",XW),P.startProbing&>.add(null,"Highlight Executed Lines","glyphicon-fire",WW).prop("id","dbg_tracelines"),P.setRecorder&&P.advance&&jW(),P.showHelp){let{li:n,a:e}=af("help__"+Oe,mc+" Info");$("#help_menu").append(n),$(e).click(t=>{t.preventDefault(),window.open(P.showHelp(),"_8bws_help")})}YW();{let{li:n}=af("#help","IDE Help");$("#help_menu").prepend(n)}$("#item_tool_versions").click(FW)}function EA(){if(N){var n=sy(),e=N.getActive()instanceof un,t=n||YT(N.getActiveID(),e),r="#help/"+t;window.location.hash===r?N.createOrShow(r):window.location.hash=r}}function FW(){let n=d=>String(d==null?"":d).replace(/[&<>"]/g,h=>({"&":"&","<":"<",">":">",'"':"""})[h]),e=Lr[Oe]||Lr[Nt(Oe)]||Lr[Mr(Oe)],t=e&&e.arch||"\u2014",r=new Set([".a"]);for(let d in Qo)for(let h of Qo[d].extensions||[])r.add(h);let i={},s=[],o=(d,h)=>{d&&(i[d]||(i[d]=[],s.push(d)),h&&i[d].indexOf(h)<0&&i[d].push(h))};if(P.getDefaultExtensions)for(let d of r){let h=P.getToolForFilename("test"+d),u=h&&qt(h);(u&&(u.extensions||[]).indexOf(d)>=0||d===".a"&&h==="dasm")&&o(h,d)}let a=_t();if(a){let d=P.getToolForFilename(a),h=a.lastIndexOf(".");o(d,h>=0?a.substring(h):"")}s.sort((d,h)=>{var u,f;return(((u=qt(d))==null?void 0:u.naLine truncated
|
|
|
|
|
`),r.insertLinesBefore(o),va()})}}}):Re("Can't insert text in this window -- switch back to main file")}function VW(){var n=_t(),e=P.getToolForFilename(n);n.endsWith(".c")||e=="sdcc"||e=="cc65"||e=="cmoc"||e=="smlrc"||e=="oscar64"?Ur("Header",".h",t=>'#include "'+t+'"'):e=="dasm"||e=="zmac"?Ur("Include",".inc",t=>' include "'+t+'"'):e=="ca65"||e=="sdasz80"||e=="vasm"||e=="armips"?Ur("Include",".inc",t=>' .include "'+t+'"'):e=="verilator"?Ur("Verilog",".v",t=>'`include "'+t+'"'):e=="wiz"?Ur("Include",".wiz",t=>'import "'+t+'";'):e=="ecs"?Ur("Include",".ecs",t=>'import "'+t+'"'):e=="acme"?Ur("Include",".acme",t=>'!src "'+t+'"'):e=="xa"?Ur("Include",".xa",t=>'#include "'+t+'"'):e=="dialog"?Ur("Include",".dg",t=>'%% #include "'+t+'"'):Re("Can't add include file to this project type ("+e+")")}function FW(){var n=_t(),e=P.getToolForFilename(n);n.endsWith(".c")||e=="sdcc"||e=="cc65"||e=="cmoc"||e=="smlrc"?Ur("Linked C (or .s)",".c",t=>'//#link "'+t+'"'):n.endsWith("asm")||n.endsWith(".s")||e=="ca65"||e=="lwasm"?Ur("Linked ASM",".inc",t=>';#link "'+t+'"'):Re("Can't add linked file to this project type ("+e+")")}function YW(){if(gt=new Wi($("#toolbar")[0],null),gt.grp.prop("id","run_bar"),gt.add("mod+shift+r","Reset","glyphicon-refresh",AA).prop("id","dbg_reset"),gt.add("mod+shift+h","Pause","glyphicon-pause",yA).prop("id","dbg_pause"),gt.add("mod+shift+g","Go To Address","",n=>{gA()||cf()}),gt.add("mod+shift+g","Resume","glyphicon-play",cf).prop("id","dbg_go"),gt.add("F8","Pause/Resume","",SA),gt.add("F1","Help","",MA),P.restartAtPC&>.add("mod+shift+a","Restart at Cursor","glyphicon-play-circle",kA).prop("id","dbg_restartatline"),gt.newGroup(),gt.grp.prop("id","debug_bar"),P.runEval&>.add("mod+shift+d","Reset and Debug","glyphicon-fast-backward",CA).prop("id","dbg_restart"),P.stepBack&>.add("mod+shift+j","Step Backwards","glyphicon-step-backward",TA).prop("id","dbg_stepback"),P.step&>.add("mod+shift+l","Single Step","glyphicon-step-forward",vA).prop("id","dbg_step"),P.stepOver&>.add("mod+shift+k","Step Over","glyphicon-hand-right",wA).prop("id","dbg_stepover"),P.runUntilReturn&>.add("mod+shift+i","Step Out of Subroutine","glyphicon-hand-up",QA).prop("id","dbg_stepout"),P.runToVsync&>.add("mod+shift+x","Next Frame/Interrupt","glyphicon-forward",xA).prop("id","dbg_tovsync"),(P.runEval||P.runToPC)&&!Oe.startsWith("verilog")&>.add("mod+shift+y","Run To Line","glyphicon-save",$A).prop("id","dbg_toline"),gt.newGroup(),gt.grp.prop("id","xtra_bar"),gt.add("mod+shift+f","Search","glyphicon-search",Vb).prop("id","dbg_search"),$(".dropdown-menu").collapse({toggle:!1}),$("#item_new_file").click(mW),$("#item_upload_file").click(gW),$("#item_open_directory").click(bW),$("#item_github_login").click(z1),$("#item_github_logout").click(W1),$("#item_github_import").click(N1),$("#item_github_publish").click(B1),$("#item_github_push").click(V1),$("#item_github_pull").click(F1),$("#item_repo_delete").click(j1),$("#item_share_file").click(C1),$("#item_reset_file").click(vW),$("#item_rename_file").click(xW),$("#item_delete_file").click(wW),$("#item_download_rom").click(E1),$("#item_download_file").click(R1),$("#item_download_zip").click(L1),P.getDebugSymbolFile?$("#item_download_sym").click(D1):$("#item_download_sym").hide(),$("#item_download_allzip").click(Z1),$("#item_record_video").click(I1),Lg()?$("#item_export_cassette").click(_1):$("#item_export_cassette").hide(),P.setFrameRate&&P.getFrameRate&&($("#dbg_slower").click(ZW),$("#dbg_faster").click(IW),$("#dbg_slowest").click(XW),$("#dbg_fastest").click(zW)),$("#item_addfile_include").click(VW),$("#item_addfile_link").click(FW),$("#item_request_persist").click(()=>uA(!0,!1)),$("#item_settings").click(g1),_A(),P.newCodeAnalyzer&>.add(null,"Analyze CPU Timing","glyphicon-time",WW),P.startProbing&>.add(null,"Highlight Executed Lines","glyphicon-fire",BW).prop("id","dbg_tracelines"),P.setRecorder&&P.advance&&qW(),P.showHelp){let{li:n,a:e}=af("help__"+Oe,mc+" Info");$("#help_menu").append(n),$(e).click(t=>{t.preventDefault(),window.open(P.showHelp(),"_8bws_help")})}UW();{let{li:n}=af("#help","IDE Help");$("#help_menu").prepend(n)}$("#item_tool_versions").click(jW)}function MA(){if(N){var n=sy(),e=N.getActive()instanceof un,t=n||UT(N.getActiveID(),e),r="#help/"+t;window.location.hash===r?N.createOrShow(r):window.location.hash=r}}function jW(){let n=d=>String(d==null?"":d).replace(/[&<>"]/g,h=>({"&":"&","<":"<",">":">",'"':"""})[h]),e=Lr[Oe]||Lr[Nt(Oe)]||Lr[Mr(Oe)],t=e&&e.arch||"\u2014",r=new Set([".a"]);for(let d in Qo)for(let h of Qo[d].extensions||[])r.add(h);let i={},s=[],o=(d,h)=>{d&&(i[d]||(i[d]=[],s.push(d)),h&&i[d].indexOf(h)<0&&i[d].push(h))};if(P.getDefaultExtensions)for(let d of r){let h=P.getToolForFilename("test"+d),u=h&&qt(h);(u&&(u.extensions||[]).indexOf(d)>=0||d===".a"&&h==="dasm")&&o(h,d)}let a=_t();if(a){let d=P.getToolForFilename(a),h=a.lastIndexOf(".");o(d,h>=0?a.substring(h):"")}s.sort((d,h)=>{var u,f;return(((u=qt(d))==null?void 0:u.naLine truncated
|
|
|
|
|
<table class="help">
|
|
|
|
|
<tr><th>Architecture</th><td>${n(t)}</td></tr>
|
|
|
|
|
${e&&e.cfgfile?`<tr><th>Default config</th><td>${n(e.cfgfile)}</td></tr>`:""}
|
|
|
|
@@ -3914,9 +3914,9 @@ value at the current clock.</li>
|
|
|
|
|
<tr><th>Tool</th><th>Kind</th><th>Version</th><th>Extensions</th></tr>
|
|
|
|
|
${c}
|
|
|
|
|
</table>
|
|
|
|
|
</div>`})}function YW(){let n=P.getToolForFilename(_t());if(!n)return;let e=qt(n);if(!e)return;let t=e.version?" ("+e.version+")":"",r=(s,o,a)=>{let{li:l,a:c}=af(s,o);$("#help_menu").append(l),$(c).click(d=>{d.preventDefault(),window.open(a,"_8bws_help")})};e.helpURL&&r("help__"+n,e.name+" Help"+t,e.helpURL);let i=Ay(n,Oe);i&&r("help__"+n+"__"+Oe,e.name+" Help for "+mc,i)}function jW(){var n=$("#replayslider"),e=$("#clockslider"),t=$("#replay_frame"),r=$("#replay_clock");P.advanceFrameClock||$("#clockdiv").hide();var i=()=>{t.text(Pn.lastSeekFrame+""),r.text(Pn.lastSeekStep+"")},s=l=>{Di();var c=parseInt(n.val().toString()),d=parseInt(e.val().toString());Pn.loadFrame(c,d)>=0&&(e.attr("min",0),e.attr("max",Pn.lastStepCount),i(),sf(P.saveState()))},o=l=>{Di(),Pn.loadFrame(l)>=0&&(n.val(l),i(),sf(P.saveState()))},a=l=>{Di();var c=parseInt(n.val().toString());Pn.loadFrame(c,l)>=0&&(e.val(l),i(),sf(P.saveState()))};Pn.callbackStateChanged=()=>{n.attr("min",0),n.attr("max",Pn.numFrames()),n.val(Pn.currentFrame()),e.val(Pn.currentStep()),i(),bc(P.saveState())},n.on("input",s),e.on("input",s),$("#replay_min").click(()=>{o(1)}),$("#replay_max").click(()=>{o(Pn.numFrames())}),$("#replay_back").click(()=>{o(parseInt(n.val().toString())-1)}),$("#replay_fwd").click(()=>{o(parseInt(n.val().toString())+1)}),$("#clock_back").click(()=>{a(parseInt(e.val().toString())-1)}),$("#clock_fwd").click(()=>{a(parseInt(e.val().toString())+1)}),$("#replay_bar").show(),gt.add("mod+shift+e","Start/Stop Replay Recording","glyphicon-record",zW).prop("id","dbg_record")}async function UW(){if(Zi.shouldCompleteTour()){await hr("lib/bootstrap-tourist.js");var n=Oe.startsWith("vcs"),e=[{element:"#platformsMenuButton",placement:"right",title:"Platform Selector",content:`You're currently on the "<b>`+Oe+'</b>" platform. You can choose a different one from the menu.'},{element:"#preset_select",title:"Project Selector",content:"You can choose different code examples, create your own files, or import projects from GitHub."},{element:"#workspace",title:"Code Editor",content:n?"Type your 6502 assembly code into the editor, and it'll be assembled in real-time.":"Type your source code into the editor, and it'll be compiled in real-time."},{element:"#emulator",placement:"left",title:"Emulator",content:"We'll load your compiled code into the emulator whenever you make changes."},{element:"#debug_bar",placement:"bottom",title:"Debug Tools",content:"Use these buttons to set breakpoints, single step through code, pause/resume, and use debugging tools."},{element:"#dropdownMenuButton",title:"Main Menu",content:"Click the menu to create new files, download your code, or share your work with others."},{element:"#sidebar",title:"Sidebar",content:"Pull right to expose the sidebar. It lets you switch between source files, view assembly listings, and use other tools like Disassembler, Memory Browser, and Asset Editor."}];wo()&&(e.unshift({element:"#dropdownMenuButton",placement:"right",title:"Cookie Consent",content:'Before we start, we should tell you that this website stores persistent data in your browser. Review our <a href="/privacy.html" target="_new">privacy policy</a>.'}),e.push({element:"#booksMenuButton",placement:"left",title:"Books",content:"Get some books that explain how to program all of this stuff, and write some games!"})),xa&&(e.unshift({element:"#dropdownMenuButton",placement:"right",title:"Developer Analytics",content:"BTW, we send stack traces to 8bitworkshop.com when exceptions are thrown. Hope that's ok."}),e.unshift({element:"#dropdownMenuButton",placement:"right",title:"Welcome to 8bitworkshop Desktop!",content:'The directory "~/8bitworkshop" contains all of your file edits and built ROM images. You can create new projects under the platform directories (e.g. "c64/myproject")'}));var t=new Tour({autoscroll:!1,steps:e,onEnd:()=>{Zi.completedTour()}});setTimeout(()=>{t.start()},2500)}}function df(n){var e=(n.message||n.error||n)+"";if(e.indexOf("QuotaExceededError")>=0)iW();else{var t=n.error||n.reason;t!=null&&t instanceof xo?RA(t):wo()&&Xy(e,t,{platform:Oe,window:N?N.getActiveID():"",errors:N.lasterrors||[]})}}function RA(n){console.log("haltEmulation"),Di(),d8(n)}function qW(){window.addEventListener("error",df),window.addEventListener("unhandledrejection",df)}function GW(){window.removeEventListener("error",df),window.removeEventListener("unhandledrejection",df)}function no(n,e){e&&(he=e),GW(),n?window.location.replace("?"+$.param(he)):window.location.href="?"+$.param(he)}function mf(){Oe&&(he.platform=Oe),delete he[""],history.replaceState({},"","?"+$.param(he)+window.location.hash)}function MA(n){if(!n||n==="#")return null;var e=decodeURIComponent(n.substring(1));return e.startsWith("asseteditor/")?"#asseteditor":e.startsWith("headerview/")?(Kl(e.substring(11)),"#"+e):N.isWindow("#"+e)?"#"+e:N.isWindow(e)?e:null}function HW(){function n(){let e=window.location.hash,t=e&&e!=="#"?MA(e):null;if(t)t!==N.getActiveID()&&N.createOrShow(tLine truncated
|
|
|
|
|
</div>`})}function UW(){let n=P.getToolForFilename(_t());if(!n)return;let e=qt(n);if(!e)return;let t=e.version?" ("+e.version+")":"",r=(s,o,a)=>{let{li:l,a:c}=af(s,o);$("#help_menu").append(l),$(c).click(d=>{d.preventDefault(),window.open(a,"_8bws_help")})};e.helpURL&&r("help__"+n,e.name+" Help"+t,e.helpURL);let i=Ay(n,Oe);i&&r("help__"+n+"__"+Oe,e.name+" Help for "+mc,i)}function qW(){var n=$("#replayslider"),e=$("#clockslider"),t=$("#replay_frame"),r=$("#replay_clock");P.advanceFrameClock||$("#clockdiv").hide();var i=()=>{t.text(Pn.lastSeekFrame+""),r.text(Pn.lastSeekStep+"")},s=l=>{Di();var c=parseInt(n.val().toString()),d=parseInt(e.val().toString());Pn.loadFrame(c,d)>=0&&(e.attr("min",0),e.attr("max",Pn.lastStepCount),i(),sf(P.saveState()))},o=l=>{Di(),Pn.loadFrame(l)>=0&&(n.val(l),i(),sf(P.saveState()))},a=l=>{Di();var c=parseInt(n.val().toString());Pn.loadFrame(c,l)>=0&&(e.val(l),i(),sf(P.saveState()))};Pn.callbackStateChanged=()=>{n.attr("min",0),n.attr("max",Pn.numFrames()),n.val(Pn.currentFrame()),e.val(Pn.currentStep()),i(),bc(P.saveState())},n.on("input",s),e.on("input",s),$("#replay_min").click(()=>{o(1)}),$("#replay_max").click(()=>{o(Pn.numFrames())}),$("#replay_back").click(()=>{o(parseInt(n.val().toString())-1)}),$("#replay_fwd").click(()=>{o(parseInt(n.val().toString())+1)}),$("#clock_back").click(()=>{a(parseInt(e.val().toString())-1)}),$("#clock_fwd").click(()=>{a(parseInt(e.val().toString())+1)}),$("#replay_bar").show(),gt.add("mod+shift+e","Start/Stop Replay Recording","glyphicon-record",NW).prop("id","dbg_record")}async function GW(){if(Zi.shouldCompleteTour()){await hr("lib/bootstrap-tourist.js");var n=Oe.startsWith("vcs"),e=[{element:"#platformsMenuButton",placement:"right",title:"Platform Selector",content:`You're currently on the "<b>`+Oe+'</b>" platform. You can choose a different one from the menu.'},{element:"#preset_select",title:"Project Selector",content:"You can choose different code examples, create your own files, or import projects from GitHub."},{element:"#workspace",title:"Code Editor",content:n?"Type your 6502 assembly code into the editor, and it'll be assembled in real-time.":"Type your source code into the editor, and it'll be compiled in real-time."},{element:"#emulator",placement:"left",title:"Emulator",content:"We'll load your compiled code into the emulator whenever you make changes."},{element:"#debug_bar",placement:"bottom",title:"Debug Tools",content:"Use these buttons to set breakpoints, single step through code, pause/resume, and use debugging tools."},{element:"#dropdownMenuButton",title:"Main Menu",content:"Click the menu to create new files, download your code, or share your work with others."},{element:"#sidebar",title:"Sidebar",content:"Pull right to expose the sidebar. It lets you switch between source files, view assembly listings, and use other tools like Disassembler, Memory Browser, and Asset Editor."}];wo()&&(e.unshift({element:"#dropdownMenuButton",placement:"right",title:"Cookie Consent",content:'Before we start, we should tell you that this website stores persistent data in your browser. Review our <a href="/privacy.html" target="_new">privacy policy</a>.'}),e.push({element:"#booksMenuButton",placement:"left",title:"Books",content:"Get some books that explain how to program all of this stuff, and write some games!"})),xa&&(e.unshift({element:"#dropdownMenuButton",placement:"right",title:"Developer Analytics",content:"BTW, we send stack traces to 8bitworkshop.com when exceptions are thrown. Hope that's ok."}),e.unshift({element:"#dropdownMenuButton",placement:"right",title:"Welcome to 8bitworkshop Desktop!",content:'The directory "~/8bitworkshop" contains all of your file edits and built ROM images. You can create new projects under the platform directories (e.g. "c64/myproject")'}));var t=new Tour({autoscroll:!1,steps:e,onEnd:()=>{Zi.completedTour()}});setTimeout(()=>{t.start()},2500)}}function df(n){var e=(n.message||n.error||n)+"";if(e.indexOf("QuotaExceededError")>=0)oW();else{var t=n.error||n.reason;t!=null&&t instanceof xo?LA(t):wo()&&Xy(e,t,{platform:Oe,window:N?N.getActiveID():"",errors:N.lasterrors||[]})}}function LA(n){console.log("haltEmulation"),Di(),u8(n)}function HW(){window.addEventListener("error",df),window.addEventListener("unhandledrejection",df)}function KW(){window.removeEventListener("error",df),window.removeEventListener("unhandledrejection",df)}function no(n,e){e&&(he=e),KW(),n?window.location.replace("?"+$.param(he)):window.location.href="?"+$.param(he)}function mf(){Oe&&(he.platform=Oe),delete he[""],history.replaceState({},"","?"+$.param(he)+window.location.hash)}function DA(n){if(!n||n==="#")return null;var e=decodeURIComponent(n.substring(1));return e.startsWith("asseteditor/")?"#asseteditor":e.startsWith("headerview/")?(Kl(e.substring(11)),"#"+e):N.isWindow("#"+e)?"#"+e:N.isWindow(e)?e:null}function JW(){function n(){let e=window.location.hash,t=e&&e!=="#"?DA(e):null;if(t)t!==N.getActiveID()&&N.createOrShow(tLine truncated
|
|
|
|
|
`)>=0?(i.css({display:"inline-block","font-family":"monospace"}),r.split(`
|
|
|
|
|
`).forEach((s,o)=>{o&&i.append("<br>"),i.append(document.createTextNode(s))})):i.text(r)}t.append(document.createTextNode(" "+e.action)),n.append(" ")}return n.children().length>0}function t8(){let n=$("#emuaudiohint");if(!n.length)return;let e=!1,t=()=>{L0()?(e=!0,n.show()):(n.hide(),e&&r())},r=D0(t);t()}function n8(){t8();var n=$("#emucontrols");if(e8(n)){Oe.endsWith(".mame")&&n.show();var e=$("#emulator").find("canvas");e&&(e.on("focus",()=>{P.isRunning()&&(n.fadeIn(200),P.resume())}),e.on("blur",()=>{n.fadeOut(200)}))}}async function r8(){if(!xf[Oe])throw Error("Invalid platform '"+Oe+"'.");let n=$("#emuscreen")[0],e=vf(he.options||"");P=new xf[Oe](n,e),l8(),Pn=new W0(P);let t=P.getPresets?P.getPresets():[];if(!he.file){var r=Zi.getLastPreset(),i=r||(Et?null:t[0]&&t[0].id);he.file=i||"DEFAULT",i||Re("There is no default main file for this project. Try selecting one from the pulldown.")}Oe=="vcs"&&he.file.startsWith("examples/")&&!he.file.endsWith(".a")&&(he.file+=".a");var s=window.location.hash;mf(),qW(),R0(RA),ky(),await P.start(),await $W(),await aW(),await dW(he.file),KW(s),HW(),P.sourceFileFetch=o=>re.filedata[o],VW(),!ds&&$("#shortcuts_bar").length&&(G0($("#shortcuts_bar")[0]),J0(AW),ey(()=>{var o=N.id2div[N.activeid],a=o&&document.activeElement&&o.contains(document.activeElement),l=N.getActive(),c=a&&l&&l.getShortcuts?l.getShortcuts():[];return[...CW(),...c]}),$(document).on("focusin focusout",()=>Wn()),Wn(),Cc(na().showStatusBar)),JW(),n8(),tn?i8():(Oc(),s8(),UW()),LA()}function i8(){$("#dropdownMenuButton").hide(),$("#platformsMenuButton").hide(),$("#booksMenuButton").hide()}function s8(){var n=V0(Oe);for(var e of $c){var t=$('<a class="dropdown-item dropdown-link">').attr({href:e.url,target:"_book_"+e.id}).toggleClass("book-active",e===n).append($("<img>").attr("src","images/"+e.image)).append(" ",$('<span class="book-title">').text(e.title));$("#booksMenuList").append($("<li>").append(t))}}function LA(){setTimeout(()=>{$("#controls_dynamic").css("visibility","inherit")},250)}function o8(n){let e=vo(he.ignore)||tn;Je(!0),Sf(n,async t=>{if(t){var r=yt(n);console.log("Importing "+t.length+" bytes as "+r);try{var i=await $r.getItem(r);Je(!1),i!=null&&e||(i==null||confirm("Replace existing file '"+r+"'?"))&&await $r.setItem(r,t),delete he.importURL,he.file=r,mf(),ZA()}finally{Je(!1)}}else Re("Could not load source code from URL: "+n),Je(!1)},"text")}async function a8(){var n=vo(he.ignore),e=vo(he.force);tn?n=!e:e=!1;for(var t=0;t<20;t++){let i=he["file"+t+"_name"],s=he["file"+t+"_data"];if(i==null||s==null)break;var r=await $r.getItem(i);if(!(n&&r)){let o=s;he["file"+t+"_type"]=="binary"&&(o=yc(atob(o))),(!r||e||confirm("Replace existing file '"+i+"'?"))&&await $r.setItem(i,o)}t==0&&(he.file=i),delete he["file"+t+"_name"],delete he["file"+t+"_data"],delete he["file"+t+"_type"]}delete he.ignore,delete he.force,mf()}function l8(){var n=P.getPlatformName&&P.getPlatformName(),e=$('a[href="?platform='+Oe+'"]');e.length&&(e.addClass("dropdown-item-checked"),n=n||e.text()||n),mc=n||Oe,$(".platform_name").text(mc)}function c8(){if(Oe=he.platform||Zi.getLastPlatformID(),Et=he.repo,!he.repo&&!he.file&&(Et=Zi.getLastRepoID(Oe)),nr&&Et&&Et!=="/"){var n=Js()[Et];n&&(console.log(Oe,he,n),he.repo=Et,n.platform_id&&!he.platform&&(he.platform=Oe=n.platform_id),n.mainPath&&!he.file&&(he.file=n.mainPath))}else Et="",delete he.repo;Oe||(tn&&Wy("The 'platform' must be specified when embed=1"),Oe=he.platform="vcs")}async function DA(){if(he.githubURL){Cl(he.githubURL,!0);return}if(nr&&he.repo&&!Js()[he.repo]&&he.repo!=="/"){if(confirm(`Repository '${he.repo}' was not found locally. Import it from GitHub?`)){Cl("https://github.com/"+he.repo,!0);return}delete he.repo}if(c8(),nA({getPlatformId:()=>Oe,isEmbed:tn,hasLocalStorage:nr,resizePlatform:()=>{P&&P.resize&&P.resize()},resizeWindows:()=>{N&&N.resize()},onTabChanged:n=>{Oo()&&(n!=="emulator"?P.isRunning()&&(Di(),m0=!0):m0&&(m0=!1,P.isRunning()||ci()))}}),go=Et||Nt(Oe),tn&&(go=(document.referrer||document.location.href)+go),$r=bh(go),he.importURL){o8(he.importURL);return}he.file0_name&&await a8(),ZA()}async function ZA(){try{var n=await N0(Mr(Oe));console.log("starting platform",Oe),await r8(),N.titlePrefix=document.title+" ["+Oe+"] - "+(Et?"["+Et+"] - ":""),N.updateTitle(N.getActiveID()||re.mainPath)}catch(e){console.log(e),Re('Platform "'+Oe+'" failed to load.')}finally{LA()}}function h7(n,e){P.writeFile(n,e)}function u7(n){return P.readFile(n)}function f7(){return P.saveState()}function d8(n){var e=n&&n.message||e;if(uA(n,e),N.refresh(!1),P.saveState){let t=P.saveState();bc(t)}}async function p7(n){var e=re.filedata[n];e!=null&&(N.updateFile(n,await alternateLocalFilesystem.getFileData(n)),console.log("updating file",n))}function h8(){if(xa&&Li instanceof Uint8Array){var n=Zt(_t()),e=P.getROMExtension&&P.getROMExtension(Li)||"-"+Nt(Oe)+".bin";alternateLocalFilesystem.setFileData(`bin/${n}${e}`,Li)}}function u8(){let n=!1;new IntersectionObserver((t,r)=>{
Line truncated
|
|
|
|
|
`).forEach((s,o)=>{o&&i.append("<br>"),i.append(document.createTextNode(s))})):i.text(r)}t.append(document.createTextNode(" "+e.action)),n.append(" ")}return n.children().length>0}function r8(){let n=$("#emuaudiohint");if(!n.length)return;let e=!1,t=()=>{L0()?(e=!0,n.show()):(n.hide(),e&&r())},r=D0(t);t()}function i8(){r8();var n=$("#emucontrols");if(n8(n)){Oe.endsWith(".mame")&&n.show();var e=$("#emulator").find("canvas");e&&(e.on("focus",()=>{P.isRunning()&&(n.fadeIn(200),P.resume())}),e.on("blur",()=>{n.fadeOut(200)}))}}async function s8(){if(!xf[Oe])throw Error("Invalid platform '"+Oe+"'.");let n=$("#emuscreen")[0],e=vf(he.options||"");P=new xf[Oe](n,e),d8(),Pn=new W0(P);let t=P.getPresets?P.getPresets():[];if(!he.file){var r=Zi.getLastPreset(),i=r||(Et?null:t[0]&&t[0].id);he.file=i||"DEFAULT",i||Re("There is no default main file for this project. Try selecting one from the pulldown.")}Oe=="vcs"&&he.file.startsWith("examples/")&&!he.file.endsWith(".a")&&(he.file+=".a");var s=window.location.hash;mf(),HW(),R0(LA),ky(),await P.start(),await TW(),await cW(),await uW(he.file),e8(s),JW(),P.sourceFileFetch=o=>re.filedata[o],YW(),!ds&&$("#shortcuts_bar").length&&(G0($("#shortcuts_bar")[0]),J0(_W),ey(()=>{var o=N.id2div[N.activeid],a=o&&document.activeElement&&o.contains(document.activeElement),l=N.getActive(),c=a&&l&&l.getShortcuts?l.getShortcuts():[];return[...EW(),...c]}),$(document).on("focusin focusout",()=>Wn()),Wn(),Cc(na().showStatusBar)),t8(),i8(),tn?o8():(Oc(),a8(),GW()),ZA()}function o8(){$("#dropdownMenuButton").hide(),$("#platformsMenuButton").hide(),$("#booksMenuButton").hide()}function a8(){var n=V0(Oe);for(var e of $c){var t=$('<a class="dropdown-item dropdown-link">').attr({href:e.url,target:"_book_"+e.id}).toggleClass("book-active",e===n).append($("<img>").attr("src","images/"+e.image)).append(" ",$('<span class="book-title">').text(e.title));$("#booksMenuList").append($("<li>").append(t))}}function ZA(){setTimeout(()=>{$("#controls_dynamic").css("visibility","inherit")},250)}function l8(n){let e=vo(he.ignore)||tn;Je(!0),Sf(n,async t=>{if(t){var r=yt(n);console.log("Importing "+t.length+" bytes as "+r);try{var i=await $r.getItem(r);Je(!1),i!=null&&e||(i==null||confirm("Replace existing file '"+r+"'?"))&&await $r.setItem(r,t),delete he.importURL,he.file=r,mf(),XA()}finally{Je(!1)}}else Re("Could not load source code from URL: "+n),Je(!1)},"text")}async function c8(){var n=vo(he.ignore),e=vo(he.force);tn?n=!e:e=!1;for(var t=0;t<20;t++){let i=he["file"+t+"_name"],s=he["file"+t+"_data"];if(i==null||s==null)break;var r=await $r.getItem(i);if(!(n&&r)){let o=s;he["file"+t+"_type"]=="binary"&&(o=yc(atob(o))),(!r||e||confirm("Replace existing file '"+i+"'?"))&&await $r.setItem(i,o)}t==0&&(he.file=i),delete he["file"+t+"_name"],delete he["file"+t+"_data"],delete he["file"+t+"_type"]}delete he.ignore,delete he.force,mf()}function d8(){var n=P.getPlatformName&&P.getPlatformName(),e=$('a[href="?platform='+Oe+'"]');e.length&&(e.addClass("dropdown-item-checked"),n=n||e.text()||n),mc=n||Oe,$(".platform_name").text(mc)}function h8(){if(Oe=he.platform||Zi.getLastPlatformID(),Et=he.repo,!he.repo&&!he.file&&(Et=Zi.getLastRepoID(Oe)),nr&&Et&&Et!=="/"){var n=Js()[Et];n&&(console.log(Oe,he,n),he.repo=Et,n.platform_id&&!he.platform&&(he.platform=Oe=n.platform_id),n.mainPath&&!he.file&&(he.file=n.mainPath))}else Et="",delete he.repo;Oe||(tn&&Wy("The 'platform' must be specified when embed=1"),Oe=he.platform="vcs")}async function IA(){if(he.githubURL){Cl(he.githubURL,!0);return}if(nr&&he.repo&&!Js()[he.repo]&&he.repo!=="/"){if(confirm(`Repository '${he.repo}' was not found locally. Import it from GitHub?`)){Cl("https://github.com/"+he.repo,!0);return}delete he.repo}if(h8(),iA({getPlatformId:()=>Oe,isEmbed:tn,hasLocalStorage:nr,resizePlatform:()=>{P&&P.resize&&P.resize()},resizeWindows:()=>{N&&N.resize()},onTabChanged:n=>{Oo()&&(n!=="emulator"?P.isRunning()&&(Di(),m0=!0):m0&&(m0=!1,P.isRunning()||ci()))}}),go=Et||Nt(Oe),tn&&(go=(document.referrer||document.location.href)+go),$r=bh(go),he.importURL){l8(he.importURL);return}he.file0_name&&await c8(),XA()}async function XA(){try{var n=await N0(Mr(Oe));console.log("starting platform",Oe),await s8(),N.titlePrefix=document.title+" ["+Oe+"] - "+(Et?"["+Et+"] - ":""),N.updateTitle(N.getActiveID()||re.mainPath)}catch(e){console.log(e),Re('Platform "'+Oe+'" failed to load.')}finally{ZA()}}function m7(n,e){P.writeFile(n,e)}function g7(n){return P.readFile(n)}function O7(){return P.saveState()}function u8(n){var e=n&&n.message||e;if(pA(n,e),N.refresh(!1),P.saveState){let t=P.saveState();bc(t)}}async function b7(n){var e=re.filedata[n];e!=null&&(N.updateFile(n,await alternateLocalFilesystem.getFileData(n)),console.log("updating file",n))}function f8(){if(xa&&Li instanceof Uint8Array){var n=Zt(_t()),e=P.getROMExtension&&P.getROMExtension(Li)||"-"+Nt(Oe)+".bin";alternateLocalFilesystem.setFileData(`bin/${n}${e}`,Li)}}function p8(){let n=!1;new IntersectionObserver((t,r)=>{
Line truncated
|
|
|
|
|
/*! Bundled license information:
|
|
|
|
|
|
|
|
|
|
localforage/dist/localforage.js:
|
|
|
|
|