|
|
|
@@ -1,21 +1,21 @@
|
|
|
|
|
import{a as xu,b as wu,c as A$,d as rb,e as ib,f as nb,g as Rl,h as Mr,j as Cl,k as Al,l as Ss,m as E$}from"./chunk-CZNGOAGP.js";import{a as C$}from"./chunk-T6VURU5O.js";import{a as _l}from"./chunk-A7SWO6EA.js";import{a as tb,b as sb,c as Z$}from"./chunk-VJW2RRBI.js";import{D as gu,K as bu,t as Jg,u as eb}from"./chunk-ELRBFCEX.js";import{A as zr,E as xr,F as Ou,G as xs,I as ws,J as Tl,K as pu,T as mu,V as Kg,a as ni,b as Ro,ba as Xl,d as ft,e as Co,f as Pt,g as be,h as uu,i as Bg,k as Ng,m as Pl,n as $l,o as kl,p as Pn,q as Gg,t as bs,w as Hg,x as fu,y as Ao,z as $t}from"./chunk-TYDI7JZQ.js";import{a as tt,b as Qn,c as _o,d as Fg,e as hu}from"./chunk-VSC4MAII.js";var yu=Fg((ob,Su)=>{(function(r){if(typeof ob=="object"&&typeof Su!="undefined")Su.exports=r();else if(typeof define=="function"&&define.amd)define([],r);else{var e;typeof window!="undefined"?e=window:typeof global!="undefined"?e=global:typeof self!="undefined"?e=self:e=this,e.localforage=r()}})(function(){var r,e,t;return(function i(n,s,o){function a(d,h){if(!s[d]){if(!n[d]){var u=typeof _o=="function"&&_o;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 p=s[d]={exports:{}};n[d][0].call(p.exports,function(m){var S=n[d][1][m];return a(S||m)},p,p.exports,i,n,s,o)}return s[d].exports}for(var l=typeof _o=="function"&&_o,c=0;c<o.length;c++)a(o[c]);return a})({1:[function(i,n,s){(function(o){"use strict";var a=o.MutationObserver||o.WebKitMutationObserver,l;if(a){var c=0,d=new a(m),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=m,l=function(){u.port2.postMessage(0)}}else"document"in o&&"onreadystatechange"in o.document.createElement("script")?l=function(){var v=o.document.createElement("script");v.onreadystatechange=function(){m(),v.onreadystatechange=null,v.parentNode.removeChild(v),v=null},o.document.documentElement.appendChild(v)}:l=function(){setTimeout(m,0)};var f,p=[];function m(){f=!0;for(var v,A,R=p.length;R;){for(A=p,p=[],v=-1;++v<R;)A[v]();R=p.length}f=!1}n.exports=S;function S(v){p.push(v)===1&&!f&&l()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(i,n,s){"use strict";var o=i(1);function a(){}var l={},c=["REJECTED"],d=["FULFILLED"],h=["PENDING"];n.exports=u;function u(P){if(typeof P!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,P!==a&&S(this,P)}u.prototype.catch=function(P){return this.then(null,P)},u.prototype.then=function(P,C){if(typeof P!="function"&&this.state===d||typeof C!="function"&&this.state===c)return this;var z=new this.constructor(a);if(this.state!==h){var q=this.state===d?P:C;p(z,q,this.outcome)}else this.queue.push(new f(z,P,C));return z};function f(P,C,z){this.promise=P,typeof C=="function"&&(this.onFulfilled=C,this.callFulfilled=this.otherCallFulfilled),typeof z=="function"&&(this.onRejected=z,this.callRejected=this.otherCallRejected)}f.prototype.callFulfilled=function(P){l.resolve(this.promise,P)},f.prototype.otherCallFulfilled=function(P){p(this.promise,this.onFulfilled,P)},f.prototype.callRejected=function(P){l.reject(this.promise,P)},f.prototype.otherCallRejected=function(P){p(this.promise,this.onRejected,P)};function p(P,C,z){o(function(){var q;try{q=C(z)}catch(ne){return l.reject(P,ne)}q===P?l.reject(P,new TypeError("Cannot resolve promise with itself")):l.resolve(P,q)})}l.resolve=function(P,C){var z=v(m,C);if(z.status==="error")return l.reject(P,z.value);var q=z.value;if(q)S(P,q);else{P.state=d,P.outcome=C;for(var ne=-1,se=P.queue.length;++ne<se;)P.queue[ne].callFulfilled(C)}return P},l.reject=function(P,C){P.state=c,P.outcome=C;for(var z=-1,q=P.queue.length;++z<q;)P.queue[z].callRejected(C);return P};function m(P){var C=P&&P.then;if(P&&(typeof P=="object"||typeof P=="function")&&typeof C=="function")return function(){C.apply(P,arguments)}}function S(P,C){var z=!1;function q(fe){z||(z=!0,l.reject(P,fe))}function ne(fe){z||(z=!0,l.resolve(P,fe))}function se(){C(ne,q)}var te=v(se);te.status==="error"&&q(te.value)}function v(P,C){var z={};try{z.value=P(C),z.status="success"}catch(q){z.status="error",z.value=q}return z}u.resolve=A;function A(P){return P instanceof this?P:l.resolve(new this(a),P)}u.reject=R;function R(P){var C=new this(a);return l.reject(C,P)}u.all=U;function U(P){var C=this;if(Object.prototype.toString.call(P)!=="[object Array]")return this.reject(new TypeError("must be an array"));var z=P.length,q=!1;if(!z)return this.resolve([]);for(var ne=new Array(z),se=0,te=-1,fe=new this(a);++te<z;)Oe(P[te],te);return fe;function Oe(ve,M){C.resolve(ve).then(oe,function(G){q||(q=!0,l.reject(fe,G))});function oe(G){ne[M]=G,++se===z&&!q&&(q=!0,l.resolve(fe,ne))}}}u.race=T;function T(P){var C=this;if(Object.prototype.toString.call(P)!=="[object
Line truncated
|
|
|
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function o5(r,e){return i5(r)||n5(r,e)||a5(r,e)||s5()}function a5(r,e){if(r){if(typeof r=="string")return QP(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?QP(r,e):void 0}}var LP=Object.entries,PP=Object.setPrototypeOf,l5=Object.isFrozen,c5=Object.getPrototypeOf,d5=Object.getOwnPropertyDescriptor,mt=Object.freeze,gt=Object.seal,uo=Object.create,YP=typeof Reflect!="undefined"&&Reflect,Tg=YP.apply,Xg=YP.construct;mt||(mt=function(e){return e});gt||(gt=function(e){return e});Tg||(Tg=function(e,t){for(var i=arguments.length,n=new Array(i>2?i-2:0),s=2;s<i;s++)n[s-2]=arguments[s];return e.apply(t,n)});Xg||(Xg=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return new e(...i)});var ns=ut(Array.prototype.forEach),h5=ut(Array.prototype.lastIndexOf),$P=ut(Array.prototype.pop),Ha=ut(Array.prototype.push),u5=ut(Array.prototype.splice),fo=Array.isArray,el=ut(String.prototype.toLowerCase),yg=ut(String.prototype.toString),kP=ut(String.prototype.match),Ka=ut(String.prototype.replace),TP=ut(String.prototype.indexOf),f5=ut(String.prototype.trim),O5=ut(Number.prototype.toString),p5=ut(Boolean.prototype.toString),XP=typeof BigInt=="undefined"?null:ut(BigInt.prototype.toString),_P=typeof Symbol=="undefined"?null:ut(Symbol.prototype.toString),ir=ut(Object.prototype.hasOwnProperty),Ja=ut(Object.prototype.toString),Ct=ut(RegExp.prototype.test),is=m5(TypeError);function ut(r){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return Tg(r,e,i)}}function m5(r){return function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return Xg(r,t)}}function Ae(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:el;if(PP&&PP(r,null),!fo(e))return r;let i=e.length;for(;i--;){let n=e[i];if(typeof n=="string"){let s=t(n);s!==n&&(l5(e)||(e[i]=s),n=s)}r[n]=!0}return r}function g5(r){for(let e=0;e<r.length;e++)ir(r,e)||(r[e]=null);return r}function fr(r){let e=uo(null);for(let i of LP(r)){var t=o5(i,2);let n=t[0],s=t[1];ir(r,n)&&(fo(s)?e[n]=g5(s):s&&typeof s=="object"&&s.constructor===Object?e[n]=fr(s):e[n]=s)}return e}function b5(r){switch(typeof r){case"string":return r;case"number":return O5(r);case"boolean":return p5(r);case"bigint":return XP?XP(r):"0";case"symbol":return _P?_P(r):"Symbol()";case"undefined":return Ja(r);case"function":case"object":{if(r===null)return Ja(r);let e=r,t=Ar(e,"toString");if(typeof t=="function"){let i=t(e);return typeof i=="string"?i:Ja(i)}return Ja(r)}default:return Ja(r)}}function Ar(r,e){for(;r!==null;){let i=d5(r,e);if(i){if(i.get)return ut(i.get);if(typeof i.value=="function")return ut(i.value)}r=c5(r)}function t(){return null}return t}function x5(r){try{return Ct(r,""),!0}catch(e){return!1}}var RP=mt(["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"]),vg=mt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Qg=mt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),w5=mt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-gly
Line truncated
|
|
|
|
|
`+et),Ur&&(et=x(et)),ne&&us?M(et):et},e.setConfig=function(){let I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Xo(I),ds=!0,gn=Ve,bn=je},e.clearConfig=function(){Mi=null,ds=!1,gn=null,bn=null,ne=te,se=""},e.isValidAttribute=function(I,b,_){Mi||Xo({});let Y=Je(I),ie=Je(b);return Ee(Y,ie,_)},e.addHook=function(I,b){typeof b=="function"&&ir(Re,I)&&Ha(Re[I],b)},e.removeHook=function(I,b){if(ir(Re,I)){if(b!==void 0){let _=h5(Re[I],b);return _===-1?void 0:u5(Re[I],_,1)[0]}return $P(Re[I])}},e.removeHooks=function(I){ir(Re,I)&&(Re[I]=[])},e.removeAllHooks=function(){Re=MP()},e}var z5=VP();jP.exports=z5});var Mg=hu(yu());var Me=[/^\s*[.#%]?(include|incbin|embed)\s+"(.+?)"/gmi,/^\s*([;']|[/][/])#(resource)\s+"(.+?)"/gm],Ie=[/^\s*([;]|[/][/])#link\s+"(.+?)"/gm],Eo=[/^\s*(`include|[.]include)\s+"(.+?)"/gmi,/^\s*\$(include|\$dofile|\$write_image_in_table)\('(.+?)'/gmi,{re:/^\s*([.]arch)\s+(\w+)/gmi,suffix:".json"},/\$readmem[bh]\("(.+?)"/gmi],U$=[{re:/^\s*[.#%]?\s*include\s+<(.+?)>/gmi,system:!0}];function cb(r){let e=r&&Nt(r);return e&&e.includeDirs&&e.includeDirs.length?U$:[]}var ab=[/^\s+(USE|ASM)\s+(\S+[.]\S+)/gm],z$=[/^[!]src\s+"(.+?)"/gmi],M$=[{re:/^\s*import\s*"(.+?)";/gmi,suffix:".wiz"},/^\s*embed\s*"(.+?)";/gmi],L$=[/^\s*(import)\s*"(.+?)"/gmi],Y$=[/^\s*%%\s*#include\s+"(.+?)"/gm],lb={apple2:{preloadFS:"65-apple2"},c64:{preloadFS:"65-c64"},vic20:{preloadFS:"65-vic20"},nes:{preloadFS:"65-nes"},atari8:{preloadFS:"65-atari8"},vector:{preloadFS:"65-none"},atari7800:{preloadFS:"65-none"},devel:{preloadFS:"65-none"},vcs:{preloadFS:"65-atari2600"},pce:{preloadFS:"65-pce"},exidy:{preloadFS:"65-none"}},ys={dasm:{id:"dasm",name:"DASM",kind:"assembler",arch:"6502",extensions:[".dasm"],editorStyle:"6502",helpURL:"https://raw.githubusercontent.com/dasm-assembler/dasm/refs/tags/v2.20.17/docs/dasm.txt",wasmModule:"dasm-wasisdk",version:"2.20.17",includePatterns:Me,linkPatterns:Ie},acme:{id:"acme",name:"ACME",kind:"assembler",arch:"6502",extensions:[".acme"],editorStyle:"6502",helpURL:"https://raw.githubusercontent.com/sehugg/acme/main/docs/QuickRef.txt",wasmModule:"acme",version:"0.97.1",includePatterns:[...Me,...z$],linkPatterns:Ie},xa:{id:"xa",name:"XA",kind:"assembler",arch:"6502",extensions:[".xa"],editorStyle:"6502",helpURL:"https://www.floodgap.com/retrotech/xa/",wasmModule:"xa",version:"2.4.1",includePatterns:Me,linkPatterns:Ie},nesasm:{id:"nesasm",name:"NESASM",kind:"assembler",arch:"6502",extensions:[".nesasm"],editorStyle:"6502",helpURL:"https://github.com/camsaul/nesasm",wasmModule:"nesasm",version:"3.1",includePatterns:Me,linkPatterns:Ie},merlin32:{id:"merlin32",name:"Merlin 32",kind:"assembler",arch:"6502",extensions:[".lnk"],editorStyle:"6502",helpURL:"https://github.com/apple2accumulator/merlin32",wasmModule:"merlin32",version:"1.1.10",includePatterns:[...Me,...ab],linkPatterns:Ie},cc65:{id:"cc65",name:"cc65",kind:"compiler",arch:"6502",extensions:[".c",".h"],includeDirs:["/include","/asminc"],editorStyle:"text/x-csrc",helpURL:"https://cc65.github.io/doc/cc65.html",wasmModule:"cc65",version:"2.19",defineFlag:"-D",defineInline:!0,platforms:lb,includePatterns:Me,linkPatterns:Ie},ca65:{id:"ca65",name:"ca65",kind:"assembler",arch:"6502",extensions:[".s",".ca65",".inc"],includeDirs:["/include","/asminc"],editorStyle:"6502",helpURL:"https://cc65.github.io/doc/ca65.html",wasmModule:"ca65",version:"2.19",defineFlag:"-D",defineInline:!1,platforms:lb,includePatterns:Me,linkPatterns:Ie},ld65:{id:"ld65",name:"ld65",kind:"linker",arch:"6502",extensions:[],wasmModule:"ld65",version:"2.19",linkSymbolFlag:"-D",linkSymbolInline:!1},sdcc:{id:"sdcc",name:"SDCC",kind:"compiler",arch:"z80",extensions:[".c",".h"],includeDirs:["/include"],editorStyle:"text/x-csrc",helpURL:"http://sdcc.sourceforge.net/doc/sdccman.pdf",wasmModule:"sdcc",version:"3.6.5",defineFlag:"-D",defineInline:!0,platforms:{default:{preloadFS:"sdcc"}},includePatterns:Me,linkPatterns:Ie},sdasz80:{id:"sdasz80",name:"sdasz80",kind:"assembler",arch:"z80",extensions:[".s"],includeDirs:["/include"],editorStyle:"z80",wasmModule:"sdasz80",version:"02.00",platforms:{default:{preloadFS:"sdcc"}},includePatterns:Me,linkPatterns:Ie},sdasgb:{id:"sdasgb",name:"sdasgb",kind:"assembler",arch:"gbz80",extensions:[".sgb"],includeDirs:["/include"],editorStyle:"z80",wasmModule:"sdasgb",platforms:{default:{preloadFS:"sdcc"}},includePatterns:Me,linkPatterns:Ie},sdldz80:{id:"sdldz80",name:"sdldz80",kind:"linker",arch:"z80",extensions:[],wasmModule:"sdldz80",version:"03.00",linkSymbolFlag:"-g",linkSymbolInline:!1},sccz80:{id:"sccz80",name:"sccz80",kind:"compiler",arch:"z80",extensions:[".scc"],platforms:{default:{preloadFS:"sccz80"}},noWorkerBuild:!0},naken:{id:"naken",name:"Naken",kind:"assembler",extensions:[".ns"],helpURL:"https://github.com/mikeakohn/naken_asm",noWorkerBuild:!0},zmac:{id:"zmac",name:"zmac",kind:"assembler",arch:"z80",extensions:[".z"],editorStyle:"z80",helpURL:"https://raw.githubusercontent.com/sehugg/zmac/master/doc.txt",wasmModule:"zmac",version:"28jul2Line truncated
|
|
|
|
|
import{a as xu,b as wu,c as E$,d as ib,e as nb,f as sb,g as Rl,h as Mr,j as Cl,k as Al,l as Ss,m as Z$}from"./chunk-CZNGOAGP.js";import{a as A$}from"./chunk-T6VURU5O.js";import{a as _l}from"./chunk-A7SWO6EA.js";import{a as rb,b as ob,c as U$}from"./chunk-LHLRVY5A.js";import{D as gu,K as bu,t as eb,u as tb}from"./chunk-ELRBFCEX.js";import{A as zr,E as xr,F as Ou,G as xs,I as ws,J as Tl,K as pu,T as mu,V as Jg,a as ni,b as Ro,ba as Xl,d as ft,e as Co,f as Pt,g as be,h as uu,i as Ng,k as Gg,m as Pl,n as $l,o as kl,p as Pn,q as Hg,t as bs,w as Kg,x as fu,y as Ao,z as $t}from"./chunk-TYDI7JZQ.js";import{a as tt,b as Qn,c as _o,d as Bg,e as hu}from"./chunk-VSC4MAII.js";var yu=Bg((ab,Su)=>{(function(r){if(typeof ab=="object"&&typeof Su!="undefined")Su.exports=r();else if(typeof define=="function"&&define.amd)define([],r);else{var e;typeof window!="undefined"?e=window:typeof global!="undefined"?e=global:typeof self!="undefined"?e=self:e=this,e.localforage=r()}})(function(){var r,e,t;return(function i(n,s,o){function a(d,h){if(!s[d]){if(!n[d]){var u=typeof _o=="function"&&_o;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 p=s[d]={exports:{}};n[d][0].call(p.exports,function(m){var w=n[d][1][m];return a(w||m)},p,p.exports,i,n,s,o)}return s[d].exports}for(var l=typeof _o=="function"&&_o,c=0;c<o.length;c++)a(o[c]);return a})({1:[function(i,n,s){(function(o){"use strict";var a=o.MutationObserver||o.WebKitMutationObserver,l;if(a){var c=0,d=new a(m),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=m,l=function(){u.port2.postMessage(0)}}else"document"in o&&"onreadystatechange"in o.document.createElement("script")?l=function(){var v=o.document.createElement("script");v.onreadystatechange=function(){m(),v.onreadystatechange=null,v.parentNode.removeChild(v),v=null},o.document.documentElement.appendChild(v)}:l=function(){setTimeout(m,0)};var f,p=[];function m(){f=!0;for(var v,A,R=p.length;R;){for(A=p,p=[],v=-1;++v<R;)A[v]();R=p.length}f=!1}n.exports=w;function w(v){p.push(v)===1&&!f&&l()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(i,n,s){"use strict";var o=i(1);function a(){}var l={},c=["REJECTED"],d=["FULFILLED"],h=["PENDING"];n.exports=u;function u(P){if(typeof P!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,P!==a&&w(this,P)}u.prototype.catch=function(P){return this.then(null,P)},u.prototype.then=function(P,C){if(typeof P!="function"&&this.state===d||typeof C!="function"&&this.state===c)return this;var z=new this.constructor(a);if(this.state!==h){var q=this.state===d?P:C;p(z,q,this.outcome)}else this.queue.push(new f(z,P,C));return z};function f(P,C,z){this.promise=P,typeof C=="function"&&(this.onFulfilled=C,this.callFulfilled=this.otherCallFulfilled),typeof z=="function"&&(this.onRejected=z,this.callRejected=this.otherCallRejected)}f.prototype.callFulfilled=function(P){l.resolve(this.promise,P)},f.prototype.otherCallFulfilled=function(P){p(this.promise,this.onFulfilled,P)},f.prototype.callRejected=function(P){l.reject(this.promise,P)},f.prototype.otherCallRejected=function(P){p(this.promise,this.onRejected,P)};function p(P,C,z){o(function(){var q;try{q=C(z)}catch(ne){return l.reject(P,ne)}q===P?l.reject(P,new TypeError("Cannot resolve promise with itself")):l.resolve(P,q)})}l.resolve=function(P,C){var z=v(m,C);if(z.status==="error")return l.reject(P,z.value);var q=z.value;if(q)w(P,q);else{P.state=d,P.outcome=C;for(var ne=-1,se=P.queue.length;++ne<se;)P.queue[ne].callFulfilled(C)}return P},l.reject=function(P,C){P.state=c,P.outcome=C;for(var z=-1,q=P.queue.length;++z<q;)P.queue[z].callRejected(C);return P};function m(P){var C=P&&P.then;if(P&&(typeof P=="object"||typeof P=="function")&&typeof C=="function")return function(){C.apply(P,arguments)}}function w(P,C){var z=!1;function q(fe){z||(z=!0,l.reject(P,fe))}function ne(fe){z||(z=!0,l.resolve(P,fe))}function se(){C(ne,q)}var te=v(se);te.status==="error"&&q(te.value)}function v(P,C){var z={};try{z.value=P(C),z.status="success"}catch(q){z.status="error",z.value=q}return z}u.resolve=A;function A(P){return P instanceof this?P:l.resolve(new this(a),P)}u.reject=R;function R(P){var C=new this(a);return l.reject(C,P)}u.all=U;function U(P){var C=this;if(Object.prototype.toString.call(P)!=="[object Array]")return this.reject(new TypeError("must be an array"));var z=P.length,q=!1;if(!z)return this.resolve([]);for(var ne=new Array(z),se=0,te=-1,fe=new this(a);++te<z;)Oe(P[te],te);return fe;function Oe(ve,M){C.resolve(ve).then(oe,function(G){q||(q=!0,l.reject(fe,G))});function oe(G){ne[M]=G,++se===z&&!q&&(q=!0,l.resolve(fe,ne))}}}u.race=T;function T(P){var C=this;if(Object.prototype.toString.call(P)!=="[object
Line truncated
|
|
|
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function l5(r,e){return s5(r)||o5(r,e)||c5(r,e)||a5()}function c5(r,e){if(r){if(typeof r=="string")return PP(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?PP(r,e):void 0}}var YP=Object.entries,$P=Object.setPrototypeOf,d5=Object.isFrozen,h5=Object.getPrototypeOf,u5=Object.getOwnPropertyDescriptor,mt=Object.freeze,gt=Object.seal,uo=Object.create,WP=typeof Reflect!="undefined"&&Reflect,Xg=WP.apply,_g=WP.construct;mt||(mt=function(e){return e});gt||(gt=function(e){return e});Xg||(Xg=function(e,t){for(var i=arguments.length,n=new Array(i>2?i-2:0),s=2;s<i;s++)n[s-2]=arguments[s];return e.apply(t,n)});_g||(_g=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return new e(...i)});var ns=ut(Array.prototype.forEach),f5=ut(Array.prototype.lastIndexOf),kP=ut(Array.prototype.pop),Ha=ut(Array.prototype.push),O5=ut(Array.prototype.splice),fo=Array.isArray,el=ut(String.prototype.toLowerCase),vg=ut(String.prototype.toString),TP=ut(String.prototype.match),Ka=ut(String.prototype.replace),XP=ut(String.prototype.indexOf),p5=ut(String.prototype.trim),m5=ut(Number.prototype.toString),g5=ut(Boolean.prototype.toString),_P=typeof BigInt=="undefined"?null:ut(BigInt.prototype.toString),RP=typeof Symbol=="undefined"?null:ut(Symbol.prototype.toString),ir=ut(Object.prototype.hasOwnProperty),Ja=ut(Object.prototype.toString),Ct=ut(RegExp.prototype.test),is=b5(TypeError);function ut(r){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return Xg(r,e,i)}}function b5(r){return function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return _g(r,t)}}function Ae(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:el;if($P&&$P(r,null),!fo(e))return r;let i=e.length;for(;i--;){let n=e[i];if(typeof n=="string"){let s=t(n);s!==n&&(d5(e)||(e[i]=s),n=s)}r[n]=!0}return r}function x5(r){for(let e=0;e<r.length;e++)ir(r,e)||(r[e]=null);return r}function fr(r){let e=uo(null);for(let i of YP(r)){var t=l5(i,2);let n=t[0],s=t[1];ir(r,n)&&(fo(s)?e[n]=x5(s):s&&typeof s=="object"&&s.constructor===Object?e[n]=fr(s):e[n]=s)}return e}function w5(r){switch(typeof r){case"string":return r;case"number":return m5(r);case"boolean":return g5(r);case"bigint":return _P?_P(r):"0";case"symbol":return RP?RP(r):"Symbol()";case"undefined":return Ja(r);case"function":case"object":{if(r===null)return Ja(r);let e=r,t=Ar(e,"toString");if(typeof t=="function"){let i=t(e);return typeof i=="string"?i:Ja(i)}return Ja(r)}default:return Ja(r)}}function Ar(r,e){for(;r!==null;){let i=u5(r,e);if(i){if(i.get)return ut(i.get);if(typeof i.value=="function")return ut(i.value)}r=h5(r)}function t(){return null}return t}function S5(r){try{return Ct(r,""),!0}catch(e){return!1}}var CP=mt(["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"]),Qg=mt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Pg=mt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),y5=mt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-gly
Line truncated
|
|
|
|
|
`+et),Ur&&(et=x(et)),ne&&us?M(et):et},e.setConfig=function(){let I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Xo(I),ds=!0,gn=Ve,bn=je},e.clearConfig=function(){Mi=null,ds=!1,gn=null,bn=null,ne=te,se=""},e.isValidAttribute=function(I,b,_){Mi||Xo({});let Y=Je(I),ie=Je(b);return Ee(Y,ie,_)},e.addHook=function(I,b){typeof b=="function"&&ir(Re,I)&&Ha(Re[I],b)},e.removeHook=function(I,b){if(ir(Re,I)){if(b!==void 0){let _=f5(Re[I],b);return _===-1?void 0:O5(Re[I],_,1)[0]}return kP(Re[I])}},e.removeHooks=function(I){ir(Re,I)&&(Re[I]=[])},e.removeAllHooks=function(){Re=LP()},e}var L5=jP();DP.exports=L5});var Lg=hu(yu());var Me=[/^\s*[.#%]?(include|incbin|embed)\s+"(.+?)"/gmi,/^\s*([;']|[/][/])#(resource)\s+"(.+?)"/gm],Ie=[/^\s*([;]|[/][/])#link\s+"(.+?)"/gm],Eo=[/^\s*(`include|[.]include)\s+"(.+?)"/gmi,/^\s*\$(include|\$dofile|\$write_image_in_table)\('(.+?)'/gmi,{re:/^\s*([.]arch)\s+(\w+)/gmi,suffix:".json"},/\$readmem[bh]\("(.+?)"/gmi],z$=[{re:/^\s*[.#%]?\s*include\s+<(.+?)>/gmi,system:!0}];function db(r){let e=r&&Nt(r);return e&&e.includeDirs&&e.includeDirs.length?z$:[]}var lb=[/^\s+(USE|ASM)\s+(\S+[.]\S+)/gm],M$=[/^[!]src\s+"(.+?)"/gmi],L$=[{re:/^\s*import\s*"(.+?)";/gmi,suffix:".wiz"},/^\s*embed\s*"(.+?)";/gmi],Y$=[/^\s*(import)\s*"(.+?)"/gmi],W$=[/^\s*%%\s*#include\s+"(.+?)"/gm],cb={apple2:{preloadFS:"65-apple2"},c64:{preloadFS:"65-c64"},vic20:{preloadFS:"65-vic20"},nes:{preloadFS:"65-nes"},atari8:{preloadFS:"65-atari8"},vector:{preloadFS:"65-none"},atari7800:{preloadFS:"65-none"},devel:{preloadFS:"65-none"},vcs:{preloadFS:"65-atari2600"},pce:{preloadFS:"65-pce"},exidy:{preloadFS:"65-none"}},ys={dasm:{id:"dasm",name:"DASM",kind:"assembler",arch:"6502",extensions:[".dasm"],editorStyle:"6502",helpURL:"https://raw.githubusercontent.com/dasm-assembler/dasm/refs/tags/v2.20.17/docs/dasm.txt",wasmModule:"dasm-wasisdk",version:"2.20.17",includePatterns:Me,linkPatterns:Ie},acme:{id:"acme",name:"ACME",kind:"assembler",arch:"6502",extensions:[".acme"],editorStyle:"6502",helpURL:"https://raw.githubusercontent.com/sehugg/acme/main/docs/QuickRef.txt",wasmModule:"acme",version:"0.97.1",includePatterns:[...Me,...M$],linkPatterns:Ie},xa:{id:"xa",name:"XA",kind:"assembler",arch:"6502",extensions:[".xa"],editorStyle:"6502",helpURL:"https://www.floodgap.com/retrotech/xa/",wasmModule:"xa",version:"2.4.1",includePatterns:Me,linkPatterns:Ie},nesasm:{id:"nesasm",name:"NESASM",kind:"assembler",arch:"6502",extensions:[".nesasm"],editorStyle:"6502",helpURL:"https://github.com/camsaul/nesasm",wasmModule:"nesasm",version:"3.1",includePatterns:Me,linkPatterns:Ie},merlin32:{id:"merlin32",name:"Merlin 32",kind:"assembler",arch:"6502",extensions:[".lnk"],editorStyle:"6502",helpURL:"https://github.com/apple2accumulator/merlin32",wasmModule:"merlin32",version:"1.1.10",includePatterns:[...Me,...lb],linkPatterns:Ie},cc65:{id:"cc65",name:"cc65",kind:"compiler",arch:"6502",extensions:[".c",".h"],includeDirs:["/include","/asminc"],editorStyle:"text/x-csrc",helpURL:"https://cc65.github.io/doc/cc65.html",wasmModule:"cc65",version:"2.19",defineFlag:"-D",defineInline:!0,platforms:cb,includePatterns:Me,linkPatterns:Ie},ca65:{id:"ca65",name:"ca65",kind:"assembler",arch:"6502",extensions:[".s",".ca65",".inc"],includeDirs:["/include","/asminc"],editorStyle:"6502",helpURL:"https://cc65.github.io/doc/ca65.html",wasmModule:"ca65",version:"2.19",defineFlag:"-D",defineInline:!1,platforms:cb,includePatterns:Me,linkPatterns:Ie},ld65:{id:"ld65",name:"ld65",kind:"linker",arch:"6502",extensions:[],wasmModule:"ld65",version:"2.19",linkSymbolFlag:"-D",linkSymbolInline:!1},sdcc:{id:"sdcc",name:"SDCC",kind:"compiler",arch:"z80",extensions:[".c",".h"],includeDirs:["/include"],editorStyle:"text/x-csrc",helpURL:"http://sdcc.sourceforge.net/doc/sdccman.pdf",wasmModule:"sdcc",version:"3.6.5",defineFlag:"-D",defineInline:!0,platforms:{default:{preloadFS:"sdcc"}},includePatterns:Me,linkPatterns:Ie},sdasz80:{id:"sdasz80",name:"sdasz80",kind:"assembler",arch:"z80",extensions:[".s"],includeDirs:["/include"],editorStyle:"z80",wasmModule:"sdasz80",version:"02.00",platforms:{default:{preloadFS:"sdcc"}},includePatterns:Me,linkPatterns:Ie},sdasgb:{id:"sdasgb",name:"sdasgb",kind:"assembler",arch:"gbz80",extensions:[".sgb"],includeDirs:["/include"],editorStyle:"z80",wasmModule:"sdasgb",platforms:{default:{preloadFS:"sdcc"}},includePatterns:Me,linkPatterns:Ie},sdldz80:{id:"sdldz80",name:"sdldz80",kind:"linker",arch:"z80",extensions:[],wasmModule:"sdldz80",version:"03.00",linkSymbolFlag:"-g",linkSymbolInline:!1},sccz80:{id:"sccz80",name:"sccz80",kind:"compiler",arch:"z80",extensions:[".scc"],platforms:{default:{preloadFS:"sccz80"}},noWorkerBuild:!0},naken:{id:"naken",name:"Naken",kind:"assembler",extensions:[".ns"],helpURL:"https://github.com/mikeakohn/naken_asm",noWorkerBuild:!0},zmac:{id:"zmac",name:"zmac",kind:"assembler",arch:"z80",extensions:[".z"],editorStyle:"z80",helpURL:"https://raw.githubusercontent.com/sehugg/zmac/master/doc.txt",wasmModule:"zmac",version:"28jul2Line truncated
|
|
|
|
|
`){[e,t]=$s(this,e,t);let n="";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&&(n+=i),e<l&&t>s&&(n+=a.slice(Math.max(0,e-s),t-s)),s=l+1}return n}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],n=-1;for(let s of e)i.push(s),n+=s.length+1,i.length==32&&(t.push(new r(i,n)),i=[],n=-1);return n>-1&&t.push(new r(i,n)),t}},vs=class r extends Pe{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,n){for(let s=0;;s++){let o=this.children[s],a=n+o.length,l=i+o.lines-1;if((t?l:a)>=e)return o.lineInner(e,t,i,n);n=a+1,i=l+1}}decompose(e,t,i,n){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=n&((o<=e?1:0)|(l>=t?2:0));o>=e&&l<=t&&!c?i.push(a):a.decompose(e-o,t-o,i,c)}o=l+1}}replace(e,t,i){if([e,t]=$s(this,e,t),i.lines<this.lines)for(let n=0,s=0;n<this.children.length;n++){let o=this.children[n],a=s+o.length;if(e>=s&&t<=a){let l=o.replace(e-s,t-s,i),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let d=this.children.slice();return d[n]=l,new r(d,this.length-(t-e)+i.length)}return super.replace(s,a,l)}s=a+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
|
|
|
|
|
`){[e,t]=$s(this,e,t);let n="";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&&(n+=i),e<l&&t>o&&(n+=a.sliceString(e-o,t-o,i)),o=l+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof r))return 0;let i=0,[n,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=t,s+=t){if(n==o||s==a)return i;let l=this.children[n],c=e.children[s];if(l!=c)return i+l.scanIdentical(c,t);i+=l.length+1}}static from(e,t=e.reduce((i,n)=>i+n.length+1,-1)){let i=0;for(let f of e)i+=f.lines;if(i<32){let f=[];for(let p of e)p.flatten(f);return new nr(f,t)}let n=Math.max(32,i>>5),s=n<<1,o=n>>1,a=[],l=0,c=-1,d=[];function h(f){let p;if(f.lines>s&&f instanceof r)for(let m of f.children)h(m);else f.lines>o&&(l>o||!l)?(u(),a.push(f)):f instanceof nr&&l&&(p=d[d.length-1])instanceof nr&&f.lines+p.lines<=32?(l+=f.lines,c+=f.length+1,d[d.length-1]=new nr(p.text.concat(f.text),p.length+1+f.length)):(l+f.lines>n&&u(),l+=f.lines,c+=f.length+1,d.push(f))}function u(){l!=0&&(a.push(d.length==1?d[0]:r.from(d,c)),c=-1,l=d.length=0)}for(let f of e)h(f);return u(),a.length==1?a[0]:new r(a,t)}};Pe.empty=new nr([""],0);function F$(r){let e=-1;for(let t of r)e+=t.length+1;return e}function Wl(r,e,t=0,i=1e9){for(let n=0,s=0,o=!0;s<r.length&&n<=i;s++){let a=r[s],l=n+a.length;l>=t&&(l>i&&(a=a.slice(0,i-n)),n<t&&(a=a.slice(t-n)),o?(e[e.length-1]+=a,o=!1):e.push(a)),n=l+1}return e}function Pb(r,e,t){return Wl(r,[""],e,t)}var Xn=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 nr?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],s=this.offsets[i],o=s>>1,a=n instanceof nr?n.text.length:n.children.length;if(o==(t>0?a:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
|
|
|
`,this;e--}else if(n instanceof nr){let l=n.text[o+(t<0?-1:0)];if(this.offsets[i]+=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=n.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof nr?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)}},Vl=class{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Xn(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}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 i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:n}=this.cursor.next(e);return this.pos+=(n.length+e)*t,this.value=n.length<=i?n:t<0?n.slice(n.length-i):n.slice(0,i),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!=""}},jl=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:n}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol!="undefined"&&(Pe.prototype[Symbol.iterator]=function(){return this.iter()},Xn.prototype[Symbol.iterator]=Vl.prototype[Symbol.iterator]=jl.prototype[Symbol.iterator]=function(){return this});var Tu=class{constructor(e,t,i,n){this.from=e,this.to=t,this.number=i,this.text=n}get length(){return this.to-this.from}};function $s(r,e,t){return e=Math.max(0,Math.min(r.length,e)),[e,Math.max(e,Math.min(r.length,t))]}function st(r,e,t=!0,i=!0){return Sb(r,e,t,i)}function B$(r){return r>=56320&&r<57344}function N$(r){return r>=55296&&r<56320}function Vr(r,e){let t=r.charCodeAt(e);if(!N$(t)||e+1==r.length)return t;let i=r.charCodeAt(e+1);return B$(i)?(t-55296<<10)+(i-56320)+65536:t}function Bl(r){return r<=65535?String.fromCharCode(r):(r-=65536,String.fromCharCode((r>>10)+55296,(r&1023)+56320))}function Di(r){return r<65536?1:2}var Xu=/\r\n?|\n/,Ot=(function(r){return r[r.Simple=0]="Simple",r[r.TrackDel=1]="TrackDel",r[r.TrackBefore=2]="TrackBefore",r[r.TrackAfter=3]="TrackAfter",r})(Ot||(Ot={})),gi=class r{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 i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,n=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(i,n,s),n+=s):n+=o,i+=s}}iterChangedRanges(e,t=!1){_u(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],n=this.sections[t++];n<0?e.push(i,n):e.push(n,i)}return new r(e)}composeDesc(e){return this.empty?e:e.empty?this:_b(this,e)}mapDesc(e,t=!1){return e.empty?this:Ru(this,e,t)}mapPos(e,t=-1,i=Ot.Simple){let n=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=n+a;if(l<0){if(c>e)return s+(e-n);s+=a}else{if(i!=Ot.Simple&&c>=e&&(i==Ot.TrackDel&&n<e&&c>e||i==Ot.TrackBefore&&n<e||i==Ot.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!a)return e==n||t<0?s:s+l;s+=l}n=c}if(e>n)throw new RangeError(`Position ${e} is out of range for changeset of length ${n}`);return s}touchesRange(e,t=e){for(let i=0,n=0;i<this.sections.length&&n<=t;){let s=this.sections[i++],o=this.sections[i++],a=n+s;if(o>=0&&n<=t&&a>=e)return n<e&&a>t?"cover":!0;n=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],n=this.sections[t++];e+=(e?" ":"")+i+(n>=0?":"+n:"")}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 r(e)}static create(e){return new r(e)}},Ut=class r extends gi{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 _u(this,(t,i,n,s,o)=>e=e.replace(n,n+(i-t),o),!1),e}mapDesc(e,t=!1){return Ru(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let n=0,s=0;n<t.length;n+=2){let o=t[n],a=t[n+1];if(a>=0){t[n]=a,t[n+1]=o;let l=n>>1;for(;i.length<l;)i.push(Pe.empty);i.push(o?e.slice(s,s+o):Pe.empty)}s+=o}return new r(t,i)}compose(e){return this.empty?e:e.empty?this:_b(this,e,!0)}map(e,t=!1){return e.empty?this:Ru(this,e,t,!0)}iterChanges(e,t=!1){_u(this,e,t)}get desc
Line truncated
|
|
|
|
|
`}get readOnly(){return this.facet(zb)}phrase(e,...t){for(let i of this.facet(r.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,n)=>{if(n=="$")return"$";let s=+(n||1);return!s||s>t.length?i:t[s-1]})),e}languageDataAt(e,t,i=-1){let n=[];for(let s of this.facet(Cb))for(let o of s(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&n.push(o[e]);return n}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return nk(t.length?t[0]:"")}wordAt(e){let{text:t,from:i,length:n}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-i,a=e-i;for(;o>0;){let l=st(t,o,!1);if(s(t.slice(l,o))!=ze.Word)break;o=l}for(;a<n;){let l=st(t,a);if(s(t.slice(a,l))!=ze.Word)break;a=l}return o==a?null:E.range(o+i,a+i)}};Qe.allowMultipleSelections=Au;Qe.tabSize=J.define({combine:r=>r.length?r[0]:4});Qe.lineSeparator=Ab;Qe.readOnly=zb;Qe.phrases=J.define({compare(r,e){let t=Object.keys(r),i=Object.keys(e);return t.length==i.length&&t.every(n=>r[n]==e[n])}});Qe.languageData=Cb;Qe.changeFilter=Eb;Qe.transactionFilter=Zb;Qe.transactionExtender=Ub;xt.reconfigure=ce.define();function sr(r,e,t={}){let i={};for(let n of r)for(let s of Object.keys(n)){let o=n[s],a=i[s];if(a===void 0)i[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,s))i[s]=t[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let n in e)i[n]===void 0&&(i[n]=e[n]);return i}var wr=class{eq(e){return this==e}range(e,t=e){return Mo.create(e,t,this)}};wr.prototype.startSide=wr.prototype.endSide=0;wr.prototype.point=!1;wr.prototype.mapMode=Ot.TrackDel;function ju(r,e){return r==e||r.constructor==e.constructor&&r.eq(e)}var Mo=class r{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new r(e,t,i)}};function Mu(r,e){return r.from-e.from||r.value.startSide-e.value.startSide}var Lu=class r{constructor(e,t,i,n){this.from=e,this.to=t,this.value=i,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,n=0){let s=i?this.to:this.from;for(let o=n,a=s.length;;){if(o==a)return o;let l=o+a>>1,c=s[l]-e||(i?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,i,n){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,s);s<o;s++)if(n(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let i=[],n=[],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 p=t.mapPos(d,c.startSide,c.mapMode);if(p==null||(u=f=p,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)),i.push(c),n.push(u-o),s.push(f-o))}return{mapped:i.length?new r(n,s,i,a):null,pos:o}}},me=class r{constructor(e,t,i,n){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=n}static create(e,t,i,n){return new r(e,t,i,n)}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:i=!1,filterFrom:n=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(Mu)),this.isEmpty)return t.length?r.of(t):this;let a=new Fl(this,null,-1).goto(0),l=0,c=[],d=new Wr;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||n>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&d.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||n>a.to||s<a.from||o(a.from,a.to,a.value))&&(d.addInner(a.from,a.to,a.value)||c.push(Mo.create(a.from,a.to,a.value))),a.next());return d.finishInner(this.nextLayer.isEmpty&&!c.length?r.empty:this.nextLayer.update({add:c,filter:o,filterFrom:n,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],n=-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)n=Math.max(n,l.maxPoint),t.push(l),i.push(e.mapPos(a));else if(c===!0){let{mapped:d,pos:h}=l.map(a,e);d&&(n=Math.max(n,d.maxPoint),t.push(d),i.push(h))}}let s=this.nextLayer.map(e);return t.length==0?s:new r(i,t,s||r.empty,n)}between(e,t,i){if(!this.isEmpty){for(let n=0;n<this.chunk.length;n++){let s=this.chunkPos[n],o=this.chunk[n];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Lo.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Lo.from(e).goto(t)}static compare(e,t,i,n,s=-1){let o=e.filter(h=>h.maxPoint>0||!h.isEm
Line truncated
|
|
|
|
|
`)}static newName(){let e=Wb[Yb]||1;return Wb[Yb]=e+1,"\u037C"+e.toString(36)}static mount(e,t,i){let n=e[Du],s=i&&i.nonce;n?s&&n.setNonce(s):n=new Iu(e,s),n.mount(Array.isArray(t)?t:[t],e)}},Vb=new Map,Iu=class{constructor(e,t){let i=e.ownerDocument||e,n=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let s=Vb.get(i);if(s)return e[Du]=s;this.sheet=new n.CSSStyleSheet,Vb.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Du]=this}mount(e,t){let i=this.sheet,n=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),i)for(let c=0;c<a.rules.length;c++)i.insertRule(a.rules[c],n++)}else{for(;s<l;)n+=this.modules[s++].rules.length;n+=a.rules.length,s++}}if(i)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 bi={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:"'"},ks={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ok=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),ak=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(ct=0;ct<10;ct++)bi[48+ct]=bi[96+ct]=String(ct);var ct;for(ct=1;ct<=24;ct++)bi[ct+111]="F"+ct;var ct;for(ct=65;ct<=90;ct++)bi[ct]=String.fromCharCode(ct+32),ks[ct]=String.fromCharCode(ct);var ct;for(Gl in bi)ks.hasOwnProperty(Gl)||(ks[Gl]=bi[Gl]);var Gl;function jb(r){var e=ok&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||ak&&r.shiftKey&&r.key&&r.key.length==1||r.key=="Unidentified",t=!e&&r.key||(r.shiftKey?ks:bi)[r.keyCode]||r.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 ot(){var r=arguments[0];typeof r=="string"&&(r=document.createElement(r));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var n=t[i];typeof n=="string"?r.setAttribute(i,n):n!=null&&(r[i]=n)}e++}for(;e<arguments.length;e++)Db(r,arguments[e]);return r}function Db(r,e){if(typeof e=="string")r.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)r.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)Db(r,e[t]);else throw new RangeError("Unsupported child node: "+e)}var Mt=typeof navigator!="undefined"?navigator:{userAgent:"",vendor:"",platform:""},tf=typeof document!="undefined"?document:{documentElement:{style:{}}},rf=/Edge\/(\d+)/.exec(Mt.userAgent),X0=/MSIE \d/.test(Mt.userAgent),nf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Mt.userAgent),Xc=!!(X0||nf||rf),Ib=!Xc&&/gecko\/(\d+)/i.test(Mt.userAgent),qu=!Xc&&/Chrome\/(\d+)/.exec(Mt.userAgent),qb="webkitFontSmoothing"in tf.documentElement.style,sf=!Xc&&/Apple Computer/.test(Mt.vendor),Fb=sf&&(/Mobile\/\w+/.test(Mt.userAgent)||Mt.maxTouchPoints>2),ee={mac:Fb||/Mac/.test(Mt.platform),windows:/Win/.test(Mt.platform),linux:/Linux|X11/.test(Mt.platform),ie:Xc,ie_version:X0?tf.documentMode||6:nf?+nf[1]:rf?+rf[1]:0,gecko:Ib,gecko_version:Ib?+(/Firefox\/(\d+)/.exec(Mt.userAgent)||[0,0])[1]:0,chrome:!!qu,chrome_version:qu?+qu[1]:0,ios:Fb,android:/Android\b/.test(Mt.userAgent),webkit:qb,webkit_version:qb?+(/\bAppleWebKit\/(\d+)/.exec(Mt.userAgent)||[0,0])[1]:0,safari:sf,safari_version:sf?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Mt.userAgent)||[0,0])[1]:0,tabSize:tf.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Gf(r,e){for(let t in r)t=="class"&&e.class?e.class+=" "+r.class:t=="style"&&e.style?e.style+=";"+r.style:e[t]=r[t];return e}var hc=Object.create(null);function Hf(r,e,t){if(r==e)return!0;r||(r=hc),e||(e=hc);let i=Object.keys(r),n=Object.keys(e);if(i.length-(t&&i.indexOf(t)>-1?1:0)!=n.length-(t&&n.indexOf(t)>-1?1:0))return!1;for(let s of i)if(s!=t&&(n.indexOf(s)==-1||r[s]!==e[s]))return!1;return!0}function lk(r,e){for(let t=r.attributes.length-1;t>=0;t--){let i=r.attributes[t].name;e[i]==null&&r.removeAttribute(i)}for(let t in e){let i=e[t];t=="style"?r.style.cssText=i:r.getAttribute(t)!=i&&r.setAttribute(t,i)}}function Bb(r,e,t){let i=!1;if(e)for(let n in e)t&&n in t||(i=!0,n=="style"?r.style.cssText="":r.removeAttribute(n));if(t)for(let n in t)e&&e[n]==t[n]||(i=!0,n=="style"?r.style.cssText=t[n]:r.setAttribute(n,t[n]));return i}function ck(r){let e=Object.create(null);for(let t=0;t<r.attributes.length;t++){let i=r.attributes[t];e[i.name]=i.value}return e}var dt=class{eq(e){return!1}updateDOM(e,t,i){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,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},wt=(function(r){return r[r.Text=0]="Text",r[r.WidgetBefore=1]="WidgetBefore",r[r.WidgetAfter=2]="WidgetAfter",r[r.WidgetRange=3]="WidgetRange",r})(wt||(wt={})),F=class extends wr{constructor(e,t,i,n){super(),this.startSide=e,this.endLine truncated
|
|
|
|
|
`,n=r.state.doc.line(n.number+(t?1:-1)),s=r.bidiSpans(n),c=r.visualLineSide(n,!t)}if(l){if(!l(d))return a}else{if(!i)return c;l=i(d)}a=c}}function Vk(r,e,t){let i=r.state.charCategorizer(e),n=i(t);return s=>{let o=i(s);return n==ze.Space&&(n=o),n==o}}function jk(r,e,t,i){let n=e.head,s=t?1:-1;if(n==(t?r.state.doc.length:0))return E.cursor(n,e.assoc);let o=e.goalColumn,a,l=r.contentDOM.getBoundingClientRect(),c=r.coordsAtPos(n,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),d=r.documentTop;if(c)o==null&&(o=c.left-l.left),a=s<0?c.top:c.bottom;else{let p=r.viewState.lineBlockAt(n);o==null&&(o=Math.min(l.right-l.left,r.defaultCharacterWidth*(n-p.from))),a=(s<0?p.top:p.bottom)+d}let h=l.left+o,u=r.viewState.heightOracle.textHeight>>1,f=i!=null?i:u;for(let p=0;;p+=u){let m=a+(f+p)*s,S=Sf(r,{x:h,y:m},!1,s);if(t?m>l.bottom:m<l.top)return E.cursor(S.pos,S.assoc);let v=r.coordsAtPos(S.pos,S.assoc),A=v?(v.top+v.bottom)/2:0;if(!v||(t?A>a:A<a))return E.cursor(S.pos,S.assoc,void 0,o)}}function Bo(r,e,t){for(;;){let i=0;for(let n of r)n.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=i||t||(e-s<o-e?-1:1);e=l<0?s:o,i=l}});if(!i)return e}}function ox(r,e){let t=null;for(let i=0;i<e.ranges.length;i++){let n=e.ranges[i],s=null;if(n.empty){let o=Bo(r,n.from,0);o!=n.from&&(s=E.cursor(o,-1))}else{let o=Bo(r,n.from,-1),a=Bo(r,n.to,1);(o!=n.from||a!=n.to)&&(n.undirectional?s=E.undirectionalRange(n.from,n.to):s=E.range(n.from==n.anchor?o:a,n.from==n.head?o:a))}s&&(t||(t=e.ranges.slice()),t[i]=s)}return t?E.create(t,e.mainIndex):e}function Nu(r,e,t){let i=Bo(r.state.facet(na).map(n=>n(r)),t.from,e.head>t.from?-1:1);return i==t.from?t:E.cursor(i,i<t.from?1:-1)}var Qr=class{constructor(e,t){this.pos=e,this.assoc=t}};function Sf(r,e,t,i){let n=r.contentDOM.getBoundingClientRect(),s=n.top+r.viewState.paddingTop,{x:o,y:a}=e,l=a-s,c;for(;;){if(l<0)return new Qr(0,1);if(l>r.viewState.docHeight)return new Qr(r.state.doc.length,-1);if(c=r.elementAtHeight(l),i==null)break;if(c.type==wt.Text){if(i<0?c.to<r.viewport.from:c.from>r.viewport.to)break;let u=r.docView.coordsAt(i<0?c.from:c.to,i>0?-1:1);if(u&&(i<0?u.top<=l+s:u.bottom>=l+s))break}let h=r.viewState.heightOracle.textHeight/2;l=i>0?c.bottom+h:c.top-h}if(r.viewport.from>=c.to||r.viewport.to<=c.from){if(t)return null;if(c.type==wt.Text){let h=Yk(r,n,c,o,a);return new Qr(h,h==c.from?1:-1)}}if(c.type!=wt.Text)return l<(c.top+c.bottom)/2?new Qr(c.from,1):new Qr(c.to,-1);let d=r.docView.lineAt(c.from,2);return(!d||d.length!=c.length)&&(d=r.docView.lineAt(c.from,-2)),new yf(r,o,a,r.textDirectionAt(c.from)).scanTile(d,c.from)}var yf=class{constructor(e,t,i,n){this.view=e,this.x=t,this.y=i,this.baseDir=n,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:i,spans:n}=this.bidiSpansAt(e);return n[Pr.find(n,e-i.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:i,spans:n}=this.bidiSpansAt(e);return n[Pr.find(n,e-i.from,-1,t)].dir}bidiIn(e,t){let{spans:i,line:n}=this.bidiSpansAt(e);return i.length>1||i.length&&(i[0].level!=this.baseDir||i[0].to+n.from<t)}scan(e,t,i=!1){let n=0,s=e.length-1,o=new Set,a=this.bidiIn(e[0],e[s]),l,c,d=-1,h=1e9,u;e:for(;n<s;){let p=s-n,m=n+s>>1;t:if(o.has(m)){for(let A=1;A<p;A++){let R=m+A;if(R>=s&&(R-=p),!o.has(R)){m=R;break t}}break e}o.add(m);let S=t(m),v=0;if(S)for(let A=0;A<S.length;A++){let R=S[A];if(!(R.width==0&&S.length>1))if(R.bottom<this.y)(!l||l.bottom<R.bottom)&&(l=R),v=1;else if(R.top>this.y)(!c||c.top>R.top)&&(c=R),v=-1;else{let U=R.left>this.x?this.x-R.left:R.right<this.x?this.x-R.right:0,T=Math.abs(U);T<h&&(d=m,h=T,u=R),U&&(v=U<0==(this.baseDir==Ue.LTR)?-1:1)}}v==-1&&(!a||this.baseDirAt(e[m],1))?s=m:v==1&&(!a||this.baseDirAt(e[m+1],-1))&&(n=m+1)}if(!u){if(!c&&!l)return{i:0,after:!1};let p=l&&(!c||this.y-l.bottom<c.top-this.y)?l:c;return this.y=(p.top+p.bottom)/2,this.scan(e,t,!0)}if(h&&!i){let{top:p,bottom:m}=u;if(l&&l.bottom>(p+p+m)/3)return this.y=l.bottom-1,this.scan(e,t,!0);if(c&&c.top<(p+m+m)/3)return this.y=c.top+1,this.scan(e,t,!0)}let f=(a?this.dirAt(e[d],1):this.baseDir)==Ue.LTR;return{i:d,after:this.x>(u.left+u.right)/2==f}}scanText(e,t){let i=[];for(let s=0;s<e.length;s=st(e.text,s))i.push(t+s);i.push(t+e.length);let n=this.scan(i,s=>{let o=i[s]-t,a=i[s+1]-t;return ta(e.dom,o,a).getClientRects()});return n.after?new Qr(i[n.i+1],-1):new Qr(i[n.i],1)}scanTile(e,t){if(!e.length)return new Qr(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 i=[t];for(let a=0,l=t;a<e.children.length;a++)i.push(l+=e.children[a].length);let n=this.scan(i,a=>{let l=e.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:ta(l.dom,0,l.length)).getClientRects()}),s=e.children[n.i],o=i[n.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):n.after?new Qr(i[n.i+1],-1):new Qr(o,1)}},Ts="\uFFFF",vf=class{con
Line truncated
|
|
|
|
|
`&&r.lineWrapping&&(i&&(i=E.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:Pe.of([" "])}),t)return nO(r,t,i,o);if(i&&!xc(i,s)){let a=!1,l="select";return r.inputState.lastSelectionTime>Date.now()-50&&(r.inputState.lastSelectionOrigin=="select"&&(a=!0),l=r.inputState.lastSelectionOrigin,l=="select.pointer"&&(i=ox(n.facet(na).map(c=>c(r)),i))),r.dispatch({selection:i,scrollIntoView:a,userEvent:l}),!0}else return!1}function nO(r,e,t,i=-1){if(ee.ios&&r.inputState.flushIOSKey(e))return!0;let n=r.state.selection.main;if(ee.android&&(e.to==n.to&&(e.from==n.from||e.from==n.from-1&&r.state.sliceDoc(e.from,n.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Es(r.contentDOM,"Enter",13)||(e.from==n.from-1&&e.to==n.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>n.head)&&Es(r.contentDOM,"Backspace",8)||e.from==n.from&&e.to==n.to+1&&e.insert.length==0&&Es(r.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();r.inputState.composing>=0&&r.inputState.composing++;let o,a=()=>o||(o=qk(r,e,t));return r.state.facet(B0).some(l=>l(r,e.from,e.to,s,a))||r.dispatch(a()),!0}function qk(r,e,t){let i,n=r.state,s=n.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=Bo(n.facet(na).map(h=>h(r)),c,l);e.from==d&&(o=d)}if(o>-1)i={changes:e,selection:E.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)&&r.inputState.composing<0){let l=s.from<e.from?n.sliceDoc(s.from,e.from):"",c=s.to>e.to?n.sliceDoc(e.to,s.to):"";i=n.replaceSelection(r.state.toText(l+e.insert.sliceString(0,void 0,r.state.lineBreak)+c))}else{let l=n.changes(e),c=t&&t.main.to<=l.newLength?t.main:void 0;if(n.selection.ranges.length>1&&(r.inputState.composing>=0||r.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let d=r.state.sliceDoc(e.from,e.to),h,u=t&&sx(r,t.main.head);if(u){let p=e.insert.length-(e.to-e.from);h={from:u.from,to:u.to-p}}else h=r.state.doc.lineAt(s.head);let f=s.to-e.to;i=n.changeByRange(p=>{if(p.from==s.from&&p.to==s.to)return{changes:l,range:c||p.map(l)};let m=p.to-f,S=m-d.length;if(r.state.sliceDoc(S,m)!=d||m>=h.from&&S<=h.to)return{range:p};let v=n.changes({from:S,to:m,insert:e.insert}),A=p.to-s.to;return{changes:v,range:c?E.range(Math.max(0,c.anchor+A),Math.max(0,c.head+A)):p.map(v)}})}else i={changes:l,selection:c&&n.selection.replaceRange(c)}}let a="input.type";return(r.composing||r.inputState.compositionPendingChange&&r.inputState.compositionEndedAt>Date.now()-50)&&(r.inputState.compositionPendingChange=!1,a+=".compose",r.inputState.compositionFirstChange&&(a+=".start",r.inputState.compositionFirstChange=!1)),n.update(i,{userEvent:a,scrollIntoView:!0})}function cx(r,e,t,i){let n=Math.min(r.length,e.length),s=0;for(;s<n&&r.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==n&&r.length==e.length)return null;let o=r.length,a=e.length;for(;o>0&&a>0&&r.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(i=="end"){let l=Math.max(0,s-Math.min(o,a));t-=o+l-s}if(o<s&&r.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 Fk(r){let e=[];if(r.root.activeElement!=r.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:n,focusOffset:s}=r.observer.selectionRange;return t&&(e.push(new bc(t,i)),(n!=t||s!=i)&&e.push(new bc(n,s))),e}function Bk(r,e){if(r.length==0)return null;let t=r[0].pos,i=r.length==2?r[1].pos:t;return t>-1&&i>-1?E.single(t+e,i+e):null}function xc(r,e){return e.head==r.main.head&&e.anchor==r.main.anchor}var Pf=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,ee.safari&&e.contentDOM.addEventListener("input",()=>null),ee.gecko&&cT(e.contentDOM.ownerDocument)}handleEvent(e){!rT(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 i=this.handlers[e];if(i){for(let n of i.observers)n(this.view,t);for(let n of i.handlers){if(t.defaultPrevented)break;if(n(this.view,t)){t.preventDefault();break}}}}ensureHandl
Line truncated
|
|
|
|
|
`))};if((ee.mac||ee.android)&&h.from==o-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:a,to:l,insert:Pe.of([i.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let u=this.to-this.from+(h.to-h.from+h.insert.length);nO(e,h,E.single(this.toEditorPos(i.selectionStart,u),this.toEditorPos(i.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,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let n=[],s=null;for(let o=this.toEditorPos(i.rangeStart),a=this.toEditorPos(i.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,n.push(s)}t.updateCharacterBounds(i.rangeStart,n)},this.handlers.textformatupdate=i=>{let n=[];for(let s of i.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`;n.push(F.mark({attributes:{style:d}}).range(l,c))}}}e.dispatch({effects:J0.of(F.set(n))})},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:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{let n=ea(i.root);n&&n.rangeCount&&this.editContext.updateSelectionBounds(n.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,n=this.pendingContextChange;return e.changes.iterChanges((s,o,a,l,c)=>{if(i)return;let d=c.length-(o-s);if(n&&o>=n.to)if(n.from==s&&n.to==o&&n.insert.eq(c)){n=this.pendingContextChange=null,t+=d,this.to+=d;return}else n=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){i=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),c.toString()),this.to+=d}t+=d}),n&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(n=>!n.isUserEvent("input.type")&&n.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,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),n=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=n)&&this.editContext.updateSelection(i,n)}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 i=this.composing;return i&&i.drifted?i.editorBase+(e-i.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])}},W=class r{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]`,Vf),UT={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"},Hu=null;function zT(){var r;if(Hu==null&&typeof document!="undefined"&&document.body){let e=document.body.style;Hu=((r=e.tabSize)!==null&&r!==void 0?r:e.MozTabSize)!=null}return Hu||!1}var cc=J.define({combine(r){let e=sr(r,{render:null,specialChars:ZT,addSpecialChars:null});return(e.replaceTabs=!zT())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Vf)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Vf)),e}});function Xx(r={}){return[cc.of(r),MT()]}var S0=null;function MT(){return S0||(S0=We.fromClass(class{constructor(r){this.view=r,this.decorations=F.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(r.state.facet(cc)),this.decorations=this.decorator.createDeco(r)}makeDecorator(r){return new ra({regexp:r.specialChars,decoration:(e,t,i)=>{let{doc:n}=t.state,s=Vr(e[0],0);if(s==9){let o=n.lineAt(i),a=t.state.tabSize,l=zt(o.text,a,i-o.from);return F.replace({widget:new Df((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=F.replace({widget:new jf(r,s)}))},boundary:r.replaceTabs?void 0:/[^]/})}update(r){let e=r.state.facet(cc);r.startState.facet(cc)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(r.view)):this.decorations=this.decorator.updateDeco(r,this.decorations)}},{decorations:r=>r.decorations}))}var LT="\u2022";function YT(r){return r>=32?LT:r==10?"\u2424":String.fromCharCode(9216+r)}var jf=class extends dt{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=YT(this.code),i=e.state.phrase("Control character")+" "+(UT[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,t);if(n)return n;let s=document.createElement("span");return s.textContent=t,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}},Df=class extends dt{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 Ac(){return VT}var WT=F.line({class:"cm-activeLine"}),VT=We.fromClass(class{constructor(r){this.decorations=this.getDeco(r)}update(r){(r.docChanged||r.selectionSet)&&(this.decorations=this.getDeco(r.view))}getDeco(r){let e=-1,t=[];for(let i of r.state.selection.ranges){let n=r.lineBlockAt(i.head);n.from>e&&(t.push(WT.range(n.from)),e=n.from)}return F.set(t)}},{decorations:r=>r.decorations});var If=2e3;function jT(r,e,t){let i=Math.min(e.line,t.line),n=Math.max(e.line,t.line),s=[];if(e.off>If||t.off>If||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let l=i;l<=n;l++){let c=r.doc.line(l);c.length<=a&&s.push(E.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=i;l<=n;l++){let c=r.doc.line(l),d=Nl(c.text,o,r.tabSize,!0);if(d<0)s.push(E.cursor(c.to));else{let h=Nl(c.text,a,r.tabSize);s.push(E.range(c.from+d,c.from+h))}}}return s}function DT(r,e){let t=r.coordsAtPos(r.viewport.from);return t?Math.round(Math.abs((t.left-e)/r.defaultCharacterWidth)):-1}function y0(r,e){let t=r.posAtCoords({x:e.clientX,y:e.clientY},!1),i=r.state.doc.lineAt(t),n=t-i.from,s=n>If?-1:n==i.length?DT(r,e.clientX):zt(i.text,r.state.tabSize,t-i.from);return{line:i.number,col:s,off:n}}function IT(r,e){let t=y0(r,e),i=r.state.selection;return t?{update(n){if(n.docChanged){let s=n.changes.mapPos(n.startState.doc.line(t.line).from),o=n.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(n.changes)}},get(n,s,o){let a=y0(r,n);if(!a)return i;let l=jT(r.state,t,a);return l.length?o?E.create(l.concat(i.ranges)):E.create(l):i}}:null}function Ec(r){let e=(r==null?void 0:r.eventFilter)||(t=>t.altKey&&t.button==0);return W.mouseSelectionStyle.of((t,i)=>e(i)?IT(t,i):null)}var qT={Alt:[18,r=>!!r.altKey],Control:[17,r=>!!r.ctrlKey],Shift:[16,r=>!!r.shiftKey],Meta:[91,r=>!!r.metaKey]},FT={style:"cursor: crosshair"};function Zc(r={}){let[e,t]=qT[r.key||"Alt"],i=We.fromClass(class{constructor(n){this.view=n,this.isDown=!1}set(n){this.isDown!=n&&(this.isDown=n,this.view.update([]))}},{eventObservers:{keydown(n){this.set(n.keyCode==e||t(n))},keyup(n){(n.keyCode==e||!t(n))&&this.set(!1)},mousemove(n){this.set(t(n))}}});retur
Line truncated
|
|
|
|
|
`){[e,t]=$s(this,e,t);let n="";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&&(n+=i),e<l&&t>o&&(n+=a.sliceString(e-o,t-o,i)),o=l+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof r))return 0;let i=0,[n,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=t,s+=t){if(n==o||s==a)return i;let l=this.children[n],c=e.children[s];if(l!=c)return i+l.scanIdentical(c,t);i+=l.length+1}}static from(e,t=e.reduce((i,n)=>i+n.length+1,-1)){let i=0;for(let f of e)i+=f.lines;if(i<32){let f=[];for(let p of e)p.flatten(f);return new nr(f,t)}let n=Math.max(32,i>>5),s=n<<1,o=n>>1,a=[],l=0,c=-1,d=[];function h(f){let p;if(f.lines>s&&f instanceof r)for(let m of f.children)h(m);else f.lines>o&&(l>o||!l)?(u(),a.push(f)):f instanceof nr&&l&&(p=d[d.length-1])instanceof nr&&f.lines+p.lines<=32?(l+=f.lines,c+=f.length+1,d[d.length-1]=new nr(p.text.concat(f.text),p.length+1+f.length)):(l+f.lines>n&&u(),l+=f.lines,c+=f.length+1,d.push(f))}function u(){l!=0&&(a.push(d.length==1?d[0]:r.from(d,c)),c=-1,l=d.length=0)}for(let f of e)h(f);return u(),a.length==1?a[0]:new r(a,t)}};Pe.empty=new nr([""],0);function B$(r){let e=-1;for(let t of r)e+=t.length+1;return e}function Wl(r,e,t=0,i=1e9){for(let n=0,s=0,o=!0;s<r.length&&n<=i;s++){let a=r[s],l=n+a.length;l>=t&&(l>i&&(a=a.slice(0,i-n)),n<t&&(a=a.slice(t-n)),o?(e[e.length-1]+=a,o=!1):e.push(a)),n=l+1}return e}function $b(r,e,t){return Wl(r,[""],e,t)}var Xn=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 nr?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],s=this.offsets[i],o=s>>1,a=n instanceof nr?n.text.length:n.children.length;if(o==(t>0?a:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
|
|
|
`,this;e--}else if(n instanceof nr){let l=n.text[o+(t<0?-1:0)];if(this.offsets[i]+=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=n.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof nr?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)}},Vl=class{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Xn(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}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 i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:n}=this.cursor.next(e);return this.pos+=(n.length+e)*t,this.value=n.length<=i?n:t<0?n.slice(n.length-i):n.slice(0,i),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!=""}},jl=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:n}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol!="undefined"&&(Pe.prototype[Symbol.iterator]=function(){return this.iter()},Xn.prototype[Symbol.iterator]=Vl.prototype[Symbol.iterator]=jl.prototype[Symbol.iterator]=function(){return this});var Tu=class{constructor(e,t,i,n){this.from=e,this.to=t,this.number=i,this.text=n}get length(){return this.to-this.from}};function $s(r,e,t){return e=Math.max(0,Math.min(r.length,e)),[e,Math.max(e,Math.min(r.length,t))]}function st(r,e,t=!0,i=!0){return yb(r,e,t,i)}function N$(r){return r>=56320&&r<57344}function G$(r){return r>=55296&&r<56320}function Vr(r,e){let t=r.charCodeAt(e);if(!G$(t)||e+1==r.length)return t;let i=r.charCodeAt(e+1);return N$(i)?(t-55296<<10)+(i-56320)+65536:t}function Bl(r){return r<=65535?String.fromCharCode(r):(r-=65536,String.fromCharCode((r>>10)+55296,(r&1023)+56320))}function Di(r){return r<65536?1:2}var Xu=/\r\n?|\n/,Ot=(function(r){return r[r.Simple=0]="Simple",r[r.TrackDel=1]="TrackDel",r[r.TrackBefore=2]="TrackBefore",r[r.TrackAfter=3]="TrackAfter",r})(Ot||(Ot={})),gi=class r{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 i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,n=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(i,n,s),n+=s):n+=o,i+=s}}iterChangedRanges(e,t=!1){_u(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],n=this.sections[t++];n<0?e.push(i,n):e.push(n,i)}return new r(e)}composeDesc(e){return this.empty?e:e.empty?this:Rb(this,e)}mapDesc(e,t=!1){return e.empty?this:Ru(this,e,t)}mapPos(e,t=-1,i=Ot.Simple){let n=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=n+a;if(l<0){if(c>e)return s+(e-n);s+=a}else{if(i!=Ot.Simple&&c>=e&&(i==Ot.TrackDel&&n<e&&c>e||i==Ot.TrackBefore&&n<e||i==Ot.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!a)return e==n||t<0?s:s+l;s+=l}n=c}if(e>n)throw new RangeError(`Position ${e} is out of range for changeset of length ${n}`);return s}touchesRange(e,t=e){for(let i=0,n=0;i<this.sections.length&&n<=t;){let s=this.sections[i++],o=this.sections[i++],a=n+s;if(o>=0&&n<=t&&a>=e)return n<e&&a>t?"cover":!0;n=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],n=this.sections[t++];e+=(e?" ":"")+i+(n>=0?":"+n:"")}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 r(e)}static create(e){return new r(e)}},Ut=class r extends gi{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 _u(this,(t,i,n,s,o)=>e=e.replace(n,n+(i-t),o),!1),e}mapDesc(e,t=!1){return Ru(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let n=0,s=0;n<t.length;n+=2){let o=t[n],a=t[n+1];if(a>=0){t[n]=a,t[n+1]=o;let l=n>>1;for(;i.length<l;)i.push(Pe.empty);i.push(o?e.slice(s,s+o):Pe.empty)}s+=o}return new r(t,i)}compose(e){return this.empty?e:e.empty?this:Rb(this,e,!0)}map(e,t=!1){return e.empty?this:Ru(this,e,t,!0)}iterChanges(e,t=!1){_u(this,e,t)}get desc
Line truncated
|
|
|
|
|
`}get readOnly(){return this.facet(Mb)}phrase(e,...t){for(let i of this.facet(r.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,n)=>{if(n=="$")return"$";let s=+(n||1);return!s||s>t.length?i:t[s-1]})),e}languageDataAt(e,t,i=-1){let n=[];for(let s of this.facet(Ab))for(let o of s(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&n.push(o[e]);return n}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return sk(t.length?t[0]:"")}wordAt(e){let{text:t,from:i,length:n}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-i,a=e-i;for(;o>0;){let l=st(t,o,!1);if(s(t.slice(l,o))!=ze.Word)break;o=l}for(;a<n;){let l=st(t,a);if(s(t.slice(a,l))!=ze.Word)break;a=l}return o==a?null:E.range(o+i,a+i)}};Qe.allowMultipleSelections=Au;Qe.tabSize=J.define({combine:r=>r.length?r[0]:4});Qe.lineSeparator=Eb;Qe.readOnly=Mb;Qe.phrases=J.define({compare(r,e){let t=Object.keys(r),i=Object.keys(e);return t.length==i.length&&t.every(n=>r[n]==e[n])}});Qe.languageData=Ab;Qe.changeFilter=Zb;Qe.transactionFilter=Ub;Qe.transactionExtender=zb;xt.reconfigure=ce.define();function sr(r,e,t={}){let i={};for(let n of r)for(let s of Object.keys(n)){let o=n[s],a=i[s];if(a===void 0)i[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,s))i[s]=t[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let n in e)i[n]===void 0&&(i[n]=e[n]);return i}var wr=class{eq(e){return this==e}range(e,t=e){return Mo.create(e,t,this)}};wr.prototype.startSide=wr.prototype.endSide=0;wr.prototype.point=!1;wr.prototype.mapMode=Ot.TrackDel;function ju(r,e){return r==e||r.constructor==e.constructor&&r.eq(e)}var Mo=class r{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new r(e,t,i)}};function Mu(r,e){return r.from-e.from||r.value.startSide-e.value.startSide}var Lu=class r{constructor(e,t,i,n){this.from=e,this.to=t,this.value=i,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,n=0){let s=i?this.to:this.from;for(let o=n,a=s.length;;){if(o==a)return o;let l=o+a>>1,c=s[l]-e||(i?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,i,n){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,s);s<o;s++)if(n(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let i=[],n=[],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 p=t.mapPos(d,c.startSide,c.mapMode);if(p==null||(u=f=p,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)),i.push(c),n.push(u-o),s.push(f-o))}return{mapped:i.length?new r(n,s,i,a):null,pos:o}}},me=class r{constructor(e,t,i,n){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=n}static create(e,t,i,n){return new r(e,t,i,n)}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:i=!1,filterFrom:n=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(Mu)),this.isEmpty)return t.length?r.of(t):this;let a=new Fl(this,null,-1).goto(0),l=0,c=[],d=new Wr;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||n>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&d.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||n>a.to||s<a.from||o(a.from,a.to,a.value))&&(d.addInner(a.from,a.to,a.value)||c.push(Mo.create(a.from,a.to,a.value))),a.next());return d.finishInner(this.nextLayer.isEmpty&&!c.length?r.empty:this.nextLayer.update({add:c,filter:o,filterFrom:n,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],n=-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)n=Math.max(n,l.maxPoint),t.push(l),i.push(e.mapPos(a));else if(c===!0){let{mapped:d,pos:h}=l.map(a,e);d&&(n=Math.max(n,d.maxPoint),t.push(d),i.push(h))}}let s=this.nextLayer.map(e);return t.length==0?s:new r(i,t,s||r.empty,n)}between(e,t,i){if(!this.isEmpty){for(let n=0;n<this.chunk.length;n++){let s=this.chunkPos[n],o=this.chunk[n];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Lo.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Lo.from(e).goto(t)}static compare(e,t,i,n,s=-1){let o=e.filter(h=>h.maxPoint>0||!h.isEm
Line truncated
|
|
|
|
|
`)}static newName(){let e=Vb[Wb]||1;return Vb[Wb]=e+1,"\u037C"+e.toString(36)}static mount(e,t,i){let n=e[Du],s=i&&i.nonce;n?s&&n.setNonce(s):n=new Iu(e,s),n.mount(Array.isArray(t)?t:[t],e)}},jb=new Map,Iu=class{constructor(e,t){let i=e.ownerDocument||e,n=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let s=jb.get(i);if(s)return e[Du]=s;this.sheet=new n.CSSStyleSheet,jb.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Du]=this}mount(e,t){let i=this.sheet,n=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),i)for(let c=0;c<a.rules.length;c++)i.insertRule(a.rules[c],n++)}else{for(;s<l;)n+=this.modules[s++].rules.length;n+=a.rules.length,s++}}if(i)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 bi={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:"'"},ks={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ak=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),lk=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(ct=0;ct<10;ct++)bi[48+ct]=bi[96+ct]=String(ct);var ct;for(ct=1;ct<=24;ct++)bi[ct+111]="F"+ct;var ct;for(ct=65;ct<=90;ct++)bi[ct]=String.fromCharCode(ct+32),ks[ct]=String.fromCharCode(ct);var ct;for(Gl in bi)ks.hasOwnProperty(Gl)||(ks[Gl]=bi[Gl]);var Gl;function Db(r){var e=ak&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||lk&&r.shiftKey&&r.key&&r.key.length==1||r.key=="Unidentified",t=!e&&r.key||(r.shiftKey?ks:bi)[r.keyCode]||r.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 ot(){var r=arguments[0];typeof r=="string"&&(r=document.createElement(r));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var n=t[i];typeof n=="string"?r.setAttribute(i,n):n!=null&&(r[i]=n)}e++}for(;e<arguments.length;e++)Ib(r,arguments[e]);return r}function Ib(r,e){if(typeof e=="string")r.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)r.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)Ib(r,e[t]);else throw new RangeError("Unsupported child node: "+e)}var Mt=typeof navigator!="undefined"?navigator:{userAgent:"",vendor:"",platform:""},tf=typeof document!="undefined"?document:{documentElement:{style:{}}},rf=/Edge\/(\d+)/.exec(Mt.userAgent),_0=/MSIE \d/.test(Mt.userAgent),nf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Mt.userAgent),Xc=!!(_0||nf||rf),qb=!Xc&&/gecko\/(\d+)/i.test(Mt.userAgent),qu=!Xc&&/Chrome\/(\d+)/.exec(Mt.userAgent),Fb="webkitFontSmoothing"in tf.documentElement.style,sf=!Xc&&/Apple Computer/.test(Mt.vendor),Bb=sf&&(/Mobile\/\w+/.test(Mt.userAgent)||Mt.maxTouchPoints>2),ee={mac:Bb||/Mac/.test(Mt.platform),windows:/Win/.test(Mt.platform),linux:/Linux|X11/.test(Mt.platform),ie:Xc,ie_version:_0?tf.documentMode||6:nf?+nf[1]:rf?+rf[1]:0,gecko:qb,gecko_version:qb?+(/Firefox\/(\d+)/.exec(Mt.userAgent)||[0,0])[1]:0,chrome:!!qu,chrome_version:qu?+qu[1]:0,ios:Bb,android:/Android\b/.test(Mt.userAgent),webkit:Fb,webkit_version:Fb?+(/\bAppleWebKit\/(\d+)/.exec(Mt.userAgent)||[0,0])[1]:0,safari:sf,safari_version:sf?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Mt.userAgent)||[0,0])[1]:0,tabSize:tf.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Gf(r,e){for(let t in r)t=="class"&&e.class?e.class+=" "+r.class:t=="style"&&e.style?e.style+=";"+r.style:e[t]=r[t];return e}var hc=Object.create(null);function Hf(r,e,t){if(r==e)return!0;r||(r=hc),e||(e=hc);let i=Object.keys(r),n=Object.keys(e);if(i.length-(t&&i.indexOf(t)>-1?1:0)!=n.length-(t&&n.indexOf(t)>-1?1:0))return!1;for(let s of i)if(s!=t&&(n.indexOf(s)==-1||r[s]!==e[s]))return!1;return!0}function ck(r,e){for(let t=r.attributes.length-1;t>=0;t--){let i=r.attributes[t].name;e[i]==null&&r.removeAttribute(i)}for(let t in e){let i=e[t];t=="style"?r.style.cssText=i:r.getAttribute(t)!=i&&r.setAttribute(t,i)}}function Nb(r,e,t){let i=!1;if(e)for(let n in e)t&&n in t||(i=!0,n=="style"?r.style.cssText="":r.removeAttribute(n));if(t)for(let n in t)e&&e[n]==t[n]||(i=!0,n=="style"?r.style.cssText=t[n]:r.setAttribute(n,t[n]));return i}function dk(r){let e=Object.create(null);for(let t=0;t<r.attributes.length;t++){let i=r.attributes[t];e[i.name]=i.value}return e}var dt=class{eq(e){return!1}updateDOM(e,t,i){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,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},wt=(function(r){return r[r.Text=0]="Text",r[r.WidgetBefore=1]="WidgetBefore",r[r.WidgetAfter=2]="WidgetAfter",r[r.WidgetRange=3]="WidgetRange",r})(wt||(wt={})),F=class extends wr{constructor(e,t,i,n){super(),this.startSide=e,this.endLine truncated
|
|
|
|
|
`,n=r.state.doc.line(n.number+(t?1:-1)),s=r.bidiSpans(n),c=r.visualLineSide(n,!t)}if(l){if(!l(d))return a}else{if(!i)return c;l=i(d)}a=c}}function jk(r,e,t){let i=r.state.charCategorizer(e),n=i(t);return s=>{let o=i(s);return n==ze.Space&&(n=o),n==o}}function Dk(r,e,t,i){let n=e.head,s=t?1:-1;if(n==(t?r.state.doc.length:0))return E.cursor(n,e.assoc);let o=e.goalColumn,a,l=r.contentDOM.getBoundingClientRect(),c=r.coordsAtPos(n,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),d=r.documentTop;if(c)o==null&&(o=c.left-l.left),a=s<0?c.top:c.bottom;else{let p=r.viewState.lineBlockAt(n);o==null&&(o=Math.min(l.right-l.left,r.defaultCharacterWidth*(n-p.from))),a=(s<0?p.top:p.bottom)+d}let h=l.left+o,u=r.viewState.heightOracle.textHeight>>1,f=i!=null?i:u;for(let p=0;;p+=u){let m=a+(f+p)*s,w=Sf(r,{x:h,y:m},!1,s);if(t?m>l.bottom:m<l.top)return E.cursor(w.pos,w.assoc);let v=r.coordsAtPos(w.pos,w.assoc),A=v?(v.top+v.bottom)/2:0;if(!v||(t?A>a:A<a))return E.cursor(w.pos,w.assoc,void 0,o)}}function Bo(r,e,t){for(;;){let i=0;for(let n of r)n.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=i||t||(e-s<o-e?-1:1);e=l<0?s:o,i=l}});if(!i)return e}}function ax(r,e){let t=null;for(let i=0;i<e.ranges.length;i++){let n=e.ranges[i],s=null;if(n.empty){let o=Bo(r,n.from,0);o!=n.from&&(s=E.cursor(o,-1))}else{let o=Bo(r,n.from,-1),a=Bo(r,n.to,1);(o!=n.from||a!=n.to)&&(n.undirectional?s=E.undirectionalRange(n.from,n.to):s=E.range(n.from==n.anchor?o:a,n.from==n.head?o:a))}s&&(t||(t=e.ranges.slice()),t[i]=s)}return t?E.create(t,e.mainIndex):e}function Nu(r,e,t){let i=Bo(r.state.facet(na).map(n=>n(r)),t.from,e.head>t.from?-1:1);return i==t.from?t:E.cursor(i,i<t.from?1:-1)}var Qr=class{constructor(e,t){this.pos=e,this.assoc=t}};function Sf(r,e,t,i){let n=r.contentDOM.getBoundingClientRect(),s=n.top+r.viewState.paddingTop,{x:o,y:a}=e,l=a-s,c;for(;;){if(l<0)return new Qr(0,1);if(l>r.viewState.docHeight)return new Qr(r.state.doc.length,-1);if(c=r.elementAtHeight(l),i==null)break;if(c.type==wt.Text){if(i<0?c.to<r.viewport.from:c.from>r.viewport.to)break;let u=r.docView.coordsAt(i<0?c.from:c.to,i>0?-1:1);if(u&&(i<0?u.top<=l+s:u.bottom>=l+s))break}let h=r.viewState.heightOracle.textHeight/2;l=i>0?c.bottom+h:c.top-h}if(r.viewport.from>=c.to||r.viewport.to<=c.from){if(t)return null;if(c.type==wt.Text){let h=Wk(r,n,c,o,a);return new Qr(h,h==c.from?1:-1)}}if(c.type!=wt.Text)return l<(c.top+c.bottom)/2?new Qr(c.from,1):new Qr(c.to,-1);let d=r.docView.lineAt(c.from,2);return(!d||d.length!=c.length)&&(d=r.docView.lineAt(c.from,-2)),new yf(r,o,a,r.textDirectionAt(c.from)).scanTile(d,c.from)}var yf=class{constructor(e,t,i,n){this.view=e,this.x=t,this.y=i,this.baseDir=n,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:i,spans:n}=this.bidiSpansAt(e);return n[Pr.find(n,e-i.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:i,spans:n}=this.bidiSpansAt(e);return n[Pr.find(n,e-i.from,-1,t)].dir}bidiIn(e,t){let{spans:i,line:n}=this.bidiSpansAt(e);return i.length>1||i.length&&(i[0].level!=this.baseDir||i[0].to+n.from<t)}scan(e,t,i=!1){let n=0,s=e.length-1,o=new Set,a=this.bidiIn(e[0],e[s]),l,c,d=-1,h=1e9,u;e:for(;n<s;){let p=s-n,m=n+s>>1;t:if(o.has(m)){for(let A=1;A<p;A++){let R=m+A;if(R>=s&&(R-=p),!o.has(R)){m=R;break t}}break e}o.add(m);let w=t(m),v=0;if(w)for(let A=0;A<w.length;A++){let R=w[A];if(!(R.width==0&&w.length>1))if(R.bottom<this.y)(!l||l.bottom<R.bottom)&&(l=R),v=1;else if(R.top>this.y)(!c||c.top>R.top)&&(c=R),v=-1;else{let U=R.left>this.x?this.x-R.left:R.right<this.x?this.x-R.right:0,T=Math.abs(U);T<h&&(d=m,h=T,u=R),U&&(v=U<0==(this.baseDir==Ue.LTR)?-1:1)}}v==-1&&(!a||this.baseDirAt(e[m],1))?s=m:v==1&&(!a||this.baseDirAt(e[m+1],-1))&&(n=m+1)}if(!u){if(!c&&!l)return{i:0,after:!1};let p=l&&(!c||this.y-l.bottom<c.top-this.y)?l:c;return this.y=(p.top+p.bottom)/2,this.scan(e,t,!0)}if(h&&!i){let{top:p,bottom:m}=u;if(l&&l.bottom>(p+p+m)/3)return this.y=l.bottom-1,this.scan(e,t,!0);if(c&&c.top<(p+m+m)/3)return this.y=c.top+1,this.scan(e,t,!0)}let f=(a?this.dirAt(e[d],1):this.baseDir)==Ue.LTR;return{i:d,after:this.x>(u.left+u.right)/2==f}}scanText(e,t){let i=[];for(let s=0;s<e.length;s=st(e.text,s))i.push(t+s);i.push(t+e.length);let n=this.scan(i,s=>{let o=i[s]-t,a=i[s+1]-t;return ta(e.dom,o,a).getClientRects()});return n.after?new Qr(i[n.i+1],-1):new Qr(i[n.i],1)}scanTile(e,t){if(!e.length)return new Qr(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 i=[t];for(let a=0,l=t;a<e.children.length;a++)i.push(l+=e.children[a].length);let n=this.scan(i,a=>{let l=e.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:ta(l.dom,0,l.length)).getClientRects()}),s=e.children[n.i],o=i[n.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):n.after?new Qr(i[n.i+1],-1):new Qr(o,1)}},Ts="\uFFFF",vf=class{con
Line truncated
|
|
|
|
|
`&&r.lineWrapping&&(i&&(i=E.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:Pe.of([" "])}),t)return nO(r,t,i,o);if(i&&!xc(i,s)){let a=!1,l="select";return r.inputState.lastSelectionTime>Date.now()-50&&(r.inputState.lastSelectionOrigin=="select"&&(a=!0),l=r.inputState.lastSelectionOrigin,l=="select.pointer"&&(i=ax(n.facet(na).map(c=>c(r)),i))),r.dispatch({selection:i,scrollIntoView:a,userEvent:l}),!0}else return!1}function nO(r,e,t,i=-1){if(ee.ios&&r.inputState.flushIOSKey(e))return!0;let n=r.state.selection.main;if(ee.android&&(e.to==n.to&&(e.from==n.from||e.from==n.from-1&&r.state.sliceDoc(e.from,n.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Es(r.contentDOM,"Enter",13)||(e.from==n.from-1&&e.to==n.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>n.head)&&Es(r.contentDOM,"Backspace",8)||e.from==n.from&&e.to==n.to+1&&e.insert.length==0&&Es(r.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();r.inputState.composing>=0&&r.inputState.composing++;let o,a=()=>o||(o=Fk(r,e,t));return r.state.facet(N0).some(l=>l(r,e.from,e.to,s,a))||r.dispatch(a()),!0}function Fk(r,e,t){let i,n=r.state,s=n.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=Bo(n.facet(na).map(h=>h(r)),c,l);e.from==d&&(o=d)}if(o>-1)i={changes:e,selection:E.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)&&r.inputState.composing<0){let l=s.from<e.from?n.sliceDoc(s.from,e.from):"",c=s.to>e.to?n.sliceDoc(e.to,s.to):"";i=n.replaceSelection(r.state.toText(l+e.insert.sliceString(0,void 0,r.state.lineBreak)+c))}else{let l=n.changes(e),c=t&&t.main.to<=l.newLength?t.main:void 0;if(n.selection.ranges.length>1&&(r.inputState.composing>=0||r.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let d=r.state.sliceDoc(e.from,e.to),h,u=t&&ox(r,t.main.head);if(u){let p=e.insert.length-(e.to-e.from);h={from:u.from,to:u.to-p}}else h=r.state.doc.lineAt(s.head);let f=s.to-e.to;i=n.changeByRange(p=>{if(p.from==s.from&&p.to==s.to)return{changes:l,range:c||p.map(l)};let m=p.to-f,w=m-d.length;if(r.state.sliceDoc(w,m)!=d||m>=h.from&&w<=h.to)return{range:p};let v=n.changes({from:w,to:m,insert:e.insert}),A=p.to-s.to;return{changes:v,range:c?E.range(Math.max(0,c.anchor+A),Math.max(0,c.head+A)):p.map(v)}})}else i={changes:l,selection:c&&n.selection.replaceRange(c)}}let a="input.type";return(r.composing||r.inputState.compositionPendingChange&&r.inputState.compositionEndedAt>Date.now()-50)&&(r.inputState.compositionPendingChange=!1,a+=".compose",r.inputState.compositionFirstChange&&(a+=".start",r.inputState.compositionFirstChange=!1)),n.update(i,{userEvent:a,scrollIntoView:!0})}function dx(r,e,t,i){let n=Math.min(r.length,e.length),s=0;for(;s<n&&r.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==n&&r.length==e.length)return null;let o=r.length,a=e.length;for(;o>0&&a>0&&r.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(i=="end"){let l=Math.max(0,s-Math.min(o,a));t-=o+l-s}if(o<s&&r.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 Bk(r){let e=[];if(r.root.activeElement!=r.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:n,focusOffset:s}=r.observer.selectionRange;return t&&(e.push(new bc(t,i)),(n!=t||s!=i)&&e.push(new bc(n,s))),e}function Nk(r,e){if(r.length==0)return null;let t=r[0].pos,i=r.length==2?r[1].pos:t;return t>-1&&i>-1?E.single(t+e,i+e):null}function xc(r,e){return e.head==r.main.head&&e.anchor==r.main.anchor}var Pf=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,ee.safari&&e.contentDOM.addEventListener("input",()=>null),ee.gecko&&dT(e.contentDOM.ownerDocument)}handleEvent(e){!iT(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 i=this.handlers[e];if(i){for(let n of i.observers)n(this.view,t);for(let n of i.handlers){if(t.defaultPrevented)break;if(n(this.view,t)){t.preventDefault();break}}}}ensureHandl
Line truncated
|
|
|
|
|
`))};if((ee.mac||ee.android)&&h.from==o-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:a,to:l,insert:Pe.of([i.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let u=this.to-this.from+(h.to-h.from+h.insert.length);nO(e,h,E.single(this.toEditorPos(i.selectionStart,u),this.toEditorPos(i.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,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let n=[],s=null;for(let o=this.toEditorPos(i.rangeStart),a=this.toEditorPos(i.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,n.push(s)}t.updateCharacterBounds(i.rangeStart,n)},this.handlers.textformatupdate=i=>{let n=[];for(let s of i.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`;n.push(F.mark({attributes:{style:d}}).range(l,c))}}}e.dispatch({effects:ex.of(F.set(n))})},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:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{let n=ea(i.root);n&&n.rangeCount&&this.editContext.updateSelectionBounds(n.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,n=this.pendingContextChange;return e.changes.iterChanges((s,o,a,l,c)=>{if(i)return;let d=c.length-(o-s);if(n&&o>=n.to)if(n.from==s&&n.to==o&&n.insert.eq(c)){n=this.pendingContextChange=null,t+=d,this.to+=d;return}else n=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){i=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),c.toString()),this.to+=d}t+=d}),n&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(n=>!n.isUserEvent("input.type")&&n.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,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),n=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=n)&&this.editContext.updateSelection(i,n)}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 i=this.composing;return i&&i.drifted?i.editorBase+(e-i.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])}},V=class r{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]`,Vf),zT={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"},Hu=null;function MT(){var r;if(Hu==null&&typeof document!="undefined"&&document.body){let e=document.body.style;Hu=((r=e.tabSize)!==null&&r!==void 0?r:e.MozTabSize)!=null}return Hu||!1}var cc=J.define({combine(r){let e=sr(r,{render:null,specialChars:UT,addSpecialChars:null});return(e.replaceTabs=!MT())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Vf)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Vf)),e}});function _x(r={}){return[cc.of(r),LT()]}var y0=null;function LT(){return y0||(y0=We.fromClass(class{constructor(r){this.view=r,this.decorations=F.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(r.state.facet(cc)),this.decorations=this.decorator.createDeco(r)}makeDecorator(r){return new ra({regexp:r.specialChars,decoration:(e,t,i)=>{let{doc:n}=t.state,s=Vr(e[0],0);if(s==9){let o=n.lineAt(i),a=t.state.tabSize,l=zt(o.text,a,i-o.from);return F.replace({widget:new Df((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=F.replace({widget:new jf(r,s)}))},boundary:r.replaceTabs?void 0:/[^]/})}update(r){let e=r.state.facet(cc);r.startState.facet(cc)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(r.view)):this.decorations=this.decorator.updateDeco(r,this.decorations)}},{decorations:r=>r.decorations}))}var YT="\u2022";function WT(r){return r>=32?YT:r==10?"\u2424":String.fromCharCode(9216+r)}var jf=class extends dt{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=WT(this.code),i=e.state.phrase("Control character")+" "+(zT[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,t);if(n)return n;let s=document.createElement("span");return s.textContent=t,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}},Df=class extends dt{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 Ac(){return jT}var VT=F.line({class:"cm-activeLine"}),jT=We.fromClass(class{constructor(r){this.decorations=this.getDeco(r)}update(r){(r.docChanged||r.selectionSet)&&(this.decorations=this.getDeco(r.view))}getDeco(r){let e=-1,t=[];for(let i of r.state.selection.ranges){let n=r.lineBlockAt(i.head);n.from>e&&(t.push(VT.range(n.from)),e=n.from)}return F.set(t)}},{decorations:r=>r.decorations});var If=2e3;function DT(r,e,t){let i=Math.min(e.line,t.line),n=Math.max(e.line,t.line),s=[];if(e.off>If||t.off>If||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let l=i;l<=n;l++){let c=r.doc.line(l);c.length<=a&&s.push(E.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=i;l<=n;l++){let c=r.doc.line(l),d=Nl(c.text,o,r.tabSize,!0);if(d<0)s.push(E.cursor(c.to));else{let h=Nl(c.text,a,r.tabSize);s.push(E.range(c.from+d,c.from+h))}}}return s}function IT(r,e){let t=r.coordsAtPos(r.viewport.from);return t?Math.round(Math.abs((t.left-e)/r.defaultCharacterWidth)):-1}function v0(r,e){let t=r.posAtCoords({x:e.clientX,y:e.clientY},!1),i=r.state.doc.lineAt(t),n=t-i.from,s=n>If?-1:n==i.length?IT(r,e.clientX):zt(i.text,r.state.tabSize,t-i.from);return{line:i.number,col:s,off:n}}function qT(r,e){let t=v0(r,e),i=r.state.selection;return t?{update(n){if(n.docChanged){let s=n.changes.mapPos(n.startState.doc.line(t.line).from),o=n.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(n.changes)}},get(n,s,o){let a=v0(r,n);if(!a)return i;let l=DT(r.state,t,a);return l.length?o?E.create(l.concat(i.ranges)):E.create(l):i}}:null}function Ec(r){let e=(r==null?void 0:r.eventFilter)||(t=>t.altKey&&t.button==0);return V.mouseSelectionStyle.of((t,i)=>e(i)?qT(t,i):null)}var FT={Alt:[18,r=>!!r.altKey],Control:[17,r=>!!r.ctrlKey],Shift:[16,r=>!!r.shiftKey],Meta:[91,r=>!!r.metaKey]},BT={style:"cursor: crosshair"};function Zc(r={}){let[e,t]=FT[r.key||"Alt"],i=We.fromClass(class{constructor(n){this.view=n,this.isDown=!1}set(n){this.isDown!=n&&(this.isDown=n,this.view.update([]))}},{eventObservers:{keydown(n){this.set(n.keyCode==e||t(n))},keyup(n){(n.keyCode==e||!t(n))&&this.set(!1)},mousemove(n){this.set(t(n))}}});retur
Line truncated
|
|
|
|
|
`&&(t="");else{let i=t.indexOf(`
|
|
|
|
|
`);i>-1&&(t=t.slice(0,i))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),i=e+t.length;for(let n=this.rangeIndex;;){let s=this.ranges[n].to;if(s>=i||(t=t.slice(0,s-(i-t.length)),n++,n==this.ranges.length))break;let o=this.ranges[n].from,a=this.lineAfter(o);t+=a,i=o+a.length}return{line:t,end:i}}skipGapsTo(e,t,i){for(;;){let n=this.ranges[this.rangeIndex].to,s=e+t;if(i>0?n>s:n>=s)break;let o=this.ranges[++this.rangeIndex].from;t+=o-n}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,i,n){let s=4;if(this.ranges.length>1){n=this.skipGapsTo(t,n,1),t+=n;let a=this.chunk.length;n=this.skipGapsTo(i,n,-1),i+=n,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]=i:this.chunk.push(e,t,i,s),n}parseLine(e){let{line:t,end:i}=this.nextLine(),n=0,{streamParser:s}=this.lang,o=new Bc(t,e?e.state.tabSize:4,e?en(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let a=Qw(s.token,o,this.state);if(a&&(n=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,n)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=we.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:t_,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new we(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 we(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function Qw(r,e,t){e.start=e.pos;for(let i=0;i<10;i++){let n=r(e,t);if(e.pos>e.start)return n}throw new Error("Stream parser failed to advance stream.")}var VO=Object.create(null),ha=[rt.none],t_=new yi(ha),lw=[],cw=Object.create(null),Pw=Object.create(null);for(let[r,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"]])Pw[r]=$w(VO,e);var Nc=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Pw)}resolve(e){return e?this.table[e]||(this.table[e]=$w(this.extra,e)):0}},r_=new Nc(VO);function $O(r,e){lw.indexOf(r)>-1||(lw.push(r),console.warn(e))}function $w(r,e){let t=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let d=r[c]||O[c];d?typeof d=="function"?l.length?l=l.map(d):$O(c,`Modifier ${c} used at start of tag`):l.length?$O(c,`Tag ${c} used as modifier`):l=Array.isArray(d)?d:[d]:$O(c,`Unknown highlighting tag ${c}`)}for(let c of l)t.push(c)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),n=i+" "+t.map(a=>a.id),s=cw[n];if(s)return s.id;let o=cw[n]=rt.define({id:ha.length,name:i,props:[St({[i]:t})]});return ha.push(o),o.id}function i_(r,e){let t=rt.define({id:ha.length,name:"Document",props:[Pi.add(()=>r),kr.add(()=>i=>e.getIndent(i))],top:!0});return ha.push(t),t}var qM={rtl:F.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:Ue.RTL}),ltr:F.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:Ue.LTR}),auto:F.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};var td=class{constructor(e,t,i,n){this.state=e,this.pos=t,this.explicit=i,this.view=n,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=Te(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),i=Math.max(t.from,this.pos-250),n=t.text.slice(i-t.from,this.pos-t.from),s=n.search(s_(e,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}};function kw(r){let e=Object.keys(r).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function n_(r){let e=Object.create(null),t=Object.create(null);for(let{label:n}of r){e[n[0]]=!0;for(let s=1;s<n.length;s++)t[n[s]]=!0}let i=kw(e)+kw(t)+"*$";return[new RegExp("^"+i),new RegExp(i)]}function Rw(r){let e=r.map(n=>typeof n=="string"?{label:n}:n),[t,i]=e.every(n=>/^\w+$/.test(n.label))?[/\w*$/,/\w+$/]:n_(e);return n=>{let s=n.matchBefore(i);return s||n.explicit?{from:s?s.from:n.pos,options:e,validFor:t}:null}}function Cw(r,e){return t=>{for(let i=Te(t.state).resolve
Line truncated
|
|
|
|
|
`);i>-1&&(t=t.slice(0,i))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),i=e+t.length;for(let n=this.rangeIndex;;){let s=this.ranges[n].to;if(s>=i||(t=t.slice(0,s-(i-t.length)),n++,n==this.ranges.length))break;let o=this.ranges[n].from,a=this.lineAfter(o);t+=a,i=o+a.length}return{line:t,end:i}}skipGapsTo(e,t,i){for(;;){let n=this.ranges[this.rangeIndex].to,s=e+t;if(i>0?n>s:n>=s)break;let o=this.ranges[++this.rangeIndex].from;t+=o-n}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,i,n){let s=4;if(this.ranges.length>1){n=this.skipGapsTo(t,n,1),t+=n;let a=this.chunk.length;n=this.skipGapsTo(i,n,-1),i+=n,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]=i:this.chunk.push(e,t,i,s),n}parseLine(e){let{line:t,end:i}=this.nextLine(),n=0,{streamParser:s}=this.lang,o=new Bc(t,e?e.state.tabSize:4,e?en(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let a=Pw(s.token,o,this.state);if(a&&(n=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,n)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=we.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:r_,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new we(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 we(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function Pw(r,e,t){e.start=e.pos;for(let i=0;i<10;i++){let n=r(e,t);if(e.pos>e.start)return n}throw new Error("Stream parser failed to advance stream.")}var VO=Object.create(null),ha=[rt.none],r_=new yi(ha),cw=[],dw=Object.create(null),$w=Object.create(null);for(let[r,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"]])$w[r]=kw(VO,e);var Nc=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),$w)}resolve(e){return e?this.table[e]||(this.table[e]=kw(this.extra,e)):0}},i_=new Nc(VO);function $O(r,e){cw.indexOf(r)>-1||(cw.push(r),console.warn(e))}function kw(r,e){let t=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let d=r[c]||O[c];d?typeof d=="function"?l.length?l=l.map(d):$O(c,`Modifier ${c} used at start of tag`):l.length?$O(c,`Tag ${c} used as modifier`):l=Array.isArray(d)?d:[d]:$O(c,`Unknown highlighting tag ${c}`)}for(let c of l)t.push(c)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),n=i+" "+t.map(a=>a.id),s=dw[n];if(s)return s.id;let o=dw[n]=rt.define({id:ha.length,name:i,props:[St({[i]:t})]});return ha.push(o),o.id}function n_(r,e){let t=rt.define({id:ha.length,name:"Document",props:[Pi.add(()=>r),kr.add(()=>i=>e.getIndent(i))],top:!0});return ha.push(t),t}var BM={rtl:F.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:Ue.RTL}),ltr:F.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:Ue.LTR}),auto:F.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};var td=class{constructor(e,t,i,n){this.state=e,this.pos=t,this.explicit=i,this.view=n,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=Te(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),i=Math.max(t.from,this.pos-250),n=t.text.slice(i-t.from,this.pos-t.from),s=n.search(o_(e,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}};function Tw(r){let e=Object.keys(r).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function s_(r){let e=Object.create(null),t=Object.create(null);for(let{label:n}of r){e[n[0]]=!0;for(let s=1;s<n.length;s++)t[n[s]]=!0}let i=Tw(e)+Tw(t)+"*$";return[new RegExp("^"+i),new RegExp(i)]}function Cw(r){let e=r.map(n=>typeof n=="string"?{label:n}:n),[t,i]=e.every(n=>/^\w+$/.test(n.label))?[/\w*$/,/\w+$/]:s_(e);return n=>{let s=n.matchBefore(i);return s||n.explicit?{from:s?s.from:n.pos,options:e,validFor:t}:null}}function Aw(r,e){return t=>{for(let i=Te(t.state).resolve
Line truncated
|
|
|
|
|
`;let o=r.state.facet(di),a=o instanceof yt?"Lezer LRLanguage":o instanceof pt?"StreamLanguage":"Unknown",l=o instanceof yt?"AST ":o instanceof pt?"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}: ${i.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 $_=r=>{let{state:e}=r,t=e.doc.lineAt(e.selection.main.from),i=ep(r.state,t.from);return i.line?k_(r):i.block?X_(r):!1};function JO(r,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let n=r(e,t);return n?(i(t.update(n)),!0):!1}}var k_=JO(C_,0);var T_=JO(Nw,0);var X_=JO((r,e)=>Nw(r,e,R_(e)),0);function ep(r,e){let t=r.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}var pa=50;function __(r,{open:e,close:t},i,n){let s=r.sliceDoc(i-pa,i),o=r.sliceDoc(n,n+pa),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:i-a,margin:a&&1},close:{pos:n+l,margin:l&&1}};let d,h;n-i<=2*pa?d=h=r.sliceDoc(i,n):(d=r.sliceDoc(i,i+pa),h=r.sliceDoc(n-pa,n));let u=/^\s*/.exec(d)[0].length,f=/\s*$/.exec(h)[0].length,p=h.length-f-t.length;return d.slice(u,u+e.length)==e&&h.slice(p,p+t.length)==t?{open:{pos:i+u+e.length,margin:/\s/.test(d.charAt(u+e.length))?1:0},close:{pos:n-f-t.length,margin:/\s/.test(h.charAt(p-1))?1:0}}:null}function R_(r){let e=[];for(let t of r.selection.ranges){let i=r.doc.lineAt(t.from),n=t.to<=i.to?i:r.doc.lineAt(t.to);n.from>i.from&&n.from==t.to&&(n=t.to==i.to+1?i:r.doc.lineAt(t.to-1));let s=e.length-1;s>=0&&e[s].to>i.from?e[s].to=n.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:n.to})}return e}function Nw(r,e,t=e.selection.ranges){let i=t.map(s=>ep(e,s.from).block);if(!i.every(s=>s))return null;let n=t.map((s,o)=>__(e,i[o],s.from,s.to));if(r!=2&&!n.every(s=>s))return{changes:e.changes(t.map((s,o)=>n[o]?[]:[{from:s.from,insert:i[o].open+" "},{from:s.to,insert:" "+i[o].close}]))};if(r!=1&&n.some(s=>s)){let s=[];for(let o=0,a;o<n.length;o++)if(a=n[o]){let l=i[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 C_(r,e,t=e.selection.ranges){let i=[],n=-1;e:for(let{from:s,to:o}of t){let a=i.length,l=1e9,c;for(let d=s;d<=o;){let h=e.doc.lineAt(d);if(c==null&&(c=ep(e,h.from).line,!c))continue e;if(h.from>n&&(s==o||o>h.from)){n=h.from;let u=/^\s*/.exec(h.text)[0].length,f=u==h.length,p=h.text.slice(u,u+c.length)==c?u:-1;u<h.text.length&&u<l&&(l=u),i.push({line:h,comment:p,token:c,indent:u,empty:f,single:!1})}d=h.to+1}if(l<1e9)for(let d=a;d<i.length;d++)i[d].indent<i[d].line.text.length&&(i[d].indent=l);i.length==a+1&&(i[a].single=!0)}if(r!=2&&i.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:l,indent:c,empty:d,single:h}of i)(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(r!=1&&i.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:l}of i)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 GO=Gt.define(),sd=Gt.define(),A_=J.define(),Gw=J.define({combine(r){return sr(r,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,n)=>e(i,n)||t(i,n)})}}),Hw=ke.define({create(){return jn.empty},update(r,e){let t=e.state.facet(Gw),i=e.annotation(GO);if(i){let l=Fr.fromTransaction(e,i.selection),c=i.side,d=c==0?r.undone:r.done;return l?d=nd(d,d.length,t.minDepth,l):d=eS(d,e.startState.selection),new jn(c==0?i.rest:d,c==0?d:i.rest)}let n=e.annotation(sd);if((n=="full"||n=="before")&&(r=r.isolate()),e.annotation(Be.addToHistory)===!1)return e.changes.empty?r:r.addMapping(e.changes.desc);let s=Fr.fromTransaction(e),o=e.annotation(Be.time),a=e.annotation(Be.userEvent);return s?r=r.addChanges(s,o,a,t,e):e.selection&&(r=r.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(n=="full"||n=="after")&&(r=r.isolate()),r},toJSON(r){return{done:r.done.map(e=>e.toJSON()),undone:r.undone.map(e=>e.toJSON())}},fromJSON(r){return new jn(r.done.map(Fr.fromJSON),r.undone.map(Fr.fromJSON))}});function Kw(r={}){return[Hw,Gw.of(r),W.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?ma:e.inputType=="historyRedo"?qs:null;return i?(e.preventDefault(),i(t)):!1}})]}function od(r,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let n=t.field(Hw,!1);if(!n)return!1;let s=n.pop(r,t,e);return s?(i(s),!0):!1}}var ma=od(0,!1),qs=od(1,!1),E_=od(0,!0),Z_=od(1,!0);var Fr=class r{constructor(e,t,i,n,s){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=n,this.selectionsAfter=s}setSelAfter(e){return new r(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.m
Line truncated
|
|
|
|
|
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 k_=r=>{let{state:e}=r,t=e.doc.lineAt(e.selection.main.from),i=ep(r.state,t.from);return i.line?T_(r):i.block?__(r):!1};function JO(r,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let n=r(e,t);return n?(i(t.update(n)),!0):!1}}var T_=JO(A_,0);var X_=JO(Gw,0);var __=JO((r,e)=>Gw(r,e,C_(e)),0);function ep(r,e){let t=r.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}var pa=50;function R_(r,{open:e,close:t},i,n){let s=r.sliceDoc(i-pa,i),o=r.sliceDoc(n,n+pa),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:i-a,margin:a&&1},close:{pos:n+l,margin:l&&1}};let d,h;n-i<=2*pa?d=h=r.sliceDoc(i,n):(d=r.sliceDoc(i,i+pa),h=r.sliceDoc(n-pa,n));let u=/^\s*/.exec(d)[0].length,f=/\s*$/.exec(h)[0].length,p=h.length-f-t.length;return d.slice(u,u+e.length)==e&&h.slice(p,p+t.length)==t?{open:{pos:i+u+e.length,margin:/\s/.test(d.charAt(u+e.length))?1:0},close:{pos:n-f-t.length,margin:/\s/.test(h.charAt(p-1))?1:0}}:null}function C_(r){let e=[];for(let t of r.selection.ranges){let i=r.doc.lineAt(t.from),n=t.to<=i.to?i:r.doc.lineAt(t.to);n.from>i.from&&n.from==t.to&&(n=t.to==i.to+1?i:r.doc.lineAt(t.to-1));let s=e.length-1;s>=0&&e[s].to>i.from?e[s].to=n.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:n.to})}return e}function Gw(r,e,t=e.selection.ranges){let i=t.map(s=>ep(e,s.from).block);if(!i.every(s=>s))return null;let n=t.map((s,o)=>R_(e,i[o],s.from,s.to));if(r!=2&&!n.every(s=>s))return{changes:e.changes(t.map((s,o)=>n[o]?[]:[{from:s.from,insert:i[o].open+" "},{from:s.to,insert:" "+i[o].close}]))};if(r!=1&&n.some(s=>s)){let s=[];for(let o=0,a;o<n.length;o++)if(a=n[o]){let l=i[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 A_(r,e,t=e.selection.ranges){let i=[],n=-1;e:for(let{from:s,to:o}of t){let a=i.length,l=1e9,c;for(let d=s;d<=o;){let h=e.doc.lineAt(d);if(c==null&&(c=ep(e,h.from).line,!c))continue e;if(h.from>n&&(s==o||o>h.from)){n=h.from;let u=/^\s*/.exec(h.text)[0].length,f=u==h.length,p=h.text.slice(u,u+c.length)==c?u:-1;u<h.text.length&&u<l&&(l=u),i.push({line:h,comment:p,token:c,indent:u,empty:f,single:!1})}d=h.to+1}if(l<1e9)for(let d=a;d<i.length;d++)i[d].indent<i[d].line.text.length&&(i[d].indent=l);i.length==a+1&&(i[a].single=!0)}if(r!=2&&i.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:l,indent:c,empty:d,single:h}of i)(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(r!=1&&i.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:l}of i)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 GO=Gt.define(),sd=Gt.define(),E_=J.define(),Hw=J.define({combine(r){return sr(r,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,n)=>e(i,n)||t(i,n)})}}),Kw=ke.define({create(){return jn.empty},update(r,e){let t=e.state.facet(Hw),i=e.annotation(GO);if(i){let l=Fr.fromTransaction(e,i.selection),c=i.side,d=c==0?r.undone:r.done;return l?d=nd(d,d.length,t.minDepth,l):d=tS(d,e.startState.selection),new jn(c==0?i.rest:d,c==0?d:i.rest)}let n=e.annotation(sd);if((n=="full"||n=="before")&&(r=r.isolate()),e.annotation(Be.addToHistory)===!1)return e.changes.empty?r:r.addMapping(e.changes.desc);let s=Fr.fromTransaction(e),o=e.annotation(Be.time),a=e.annotation(Be.userEvent);return s?r=r.addChanges(s,o,a,t,e):e.selection&&(r=r.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(n=="full"||n=="after")&&(r=r.isolate()),r},toJSON(r){return{done:r.done.map(e=>e.toJSON()),undone:r.undone.map(e=>e.toJSON())}},fromJSON(r){return new jn(r.done.map(Fr.fromJSON),r.undone.map(Fr.fromJSON))}});function Jw(r={}){return[Kw,Hw.of(r),V.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?ma:e.inputType=="historyRedo"?qs:null;return i?(e.preventDefault(),i(t)):!1}})]}function od(r,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let n=t.field(Kw,!1);if(!n)return!1;let s=n.pop(r,t,e);return s?(i(s),!0):!1}}var ma=od(0,!1),qs=od(1,!1),Z_=od(0,!0),U_=od(1,!0);var Fr=class r{constructor(e,t,i,n,s){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=n,this.selectionsAfter=s}setSelAfter(e){return new r(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.m
Line truncated
|
|
|
|
|
<div class="form-group"><label>Tab size: <input type="number" id="setting_tabSize" min="1" max="40" value="${r.tabSize}" style="width:4em"></label></div>
|
|
|
|
|
<div class="checkbox"><label><input type="checkbox" id="setting_tabsToSpaces" ${r.tabsToSpaces?"checked":""}> Insert spaces when pressing TAB</label></div>
|
|
|
|
|
<div class="checkbox"><label><input type="checkbox" id="setting_highlightSpecialChars" ${r.highlightSpecialChars?"checked":""}> Highlight special characters</label></div>
|
|
|
|
@@ -29,23 +29,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" ${r.debugHighlightTags?"checked":""}> Debug editor syntax highlighting tags</label></div>
|
|
|
|
|
`:""}
|
|
|
|
|
</form>`,buttons:{cancel:{label:"Cancel",className:"btn-default"},ok:{label:"Save",className:"btn-primary",callback:()=>{r.tabSize=parseInt($("#setting_tabSize").val())||8,r.tabsToSpaces=$("#setting_tabsToSpaces").is(":checked"),r.highlightSpecialChars=$("#setting_highlightSpecialChars").is(":checked"),r.highlightWhitespace=$("#setting_highlightWhitespace").is(":checked"),r.highlightTrailingWhitespace=$("#setting_highlightTrailingWhitespace").is(":checked"),r.closeBrackets=$("#setting_closeBrackets").is(":checked"),r.showLineNumbers=$("#setting_showLineNumbers").is(":checked"),e&&(r.debugHighlightTags=$("#setting_debugHighlightTags").is(":checked")),r.showStatusBar=$("#setting_showStatusBar").is(":checked"),GR(r),HR(r),Rl(r.showStatusBar)}}}})}function fd(){return typeof navigator!="undefined"?navigator.storage:null}function KR(r){var e=r!==void 0?r:fd();return!!(e&&typeof e.persist=="function")}async function JR(r){var e=r!==void 0?r:fd();try{if(e&&typeof e.estimate=="function"){var t=await e.estimate();return{usage:t&&t.usage,quota:t&&t.quota}}}catch(i){console.log("storage.estimate() failed",i)}return{}}async function e2(r){var e=r!==void 0?r:fd(),t={supported:KR(e),persisted:!1};try{e&&typeof e.persisted=="function"&&(t.persisted=await e.persisted())}catch(n){console.log("storage.persisted() failed",n)}var i=await JR(e);return t.usage=i.usage,t.quota=i.quota,t}async function sp(r){var e=r!==void 0?r:fd(),t=await e2(e);if(!t.supported||t.persisted)return t.granted=!1,t;try{t.persisted=await e.persist(),t.granted=t.persisted}catch(i){console.log("storage.persist() failed",i),t.granted=!1}return t}function t2(r){return r==null&&(r=typeof navigator!="undefined"?navigator.userAgent:""),r?/Edg\/|OPR\/|Chrome\/|Chromium\//.test(r)?"chromium":/Firefox\/|FxiOS\//.test(r)?"firefox":/Safari\//.test(r)?"safari":"other":"other"}function VS(r){if(typeof r!="number"||!isFinite(r))return"?";for(var e=["bytes","KB","MB","GB","TB"],t=0;r>=1024&&t<e.length-1;)r/=1024,t++;return(t==0?r.toFixed(0):r.toFixed(1))+" "+e[t]}function jS(r){return r.usage==null&&r.quota==null?"":"This site is using "+VS(r.usage)+" of the "+VS(r.quota)+" your browser allows."}var np="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 DS(r){switch(r||t2()){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 r2(){return"This browser doesn't support persistent storage, so it may discard your local file edits when it needs disk space. "+np}function IS(r,e){var t=jS(r),i;return r.supported?r.persisted?i=(r.granted?"Your browser just granted persistent storage. ":"Your browser is already persisting your local file edits. ")+np:i="Your browser has not granted persistent storage, so it may discard your local file edits when it needs disk space.<br><br>"+DS()+"<br><br>"+np:i=r2(),t?i+"<br><br>"+t:i}function qS(r){return"Your browser ran out of space for this site, so your last edit may not have been saved.<br><br>"+jS(r)+" Delete unused projects, or use <b>File > Download All Changes as ZIP</b> to back up your work before it is lost."+(r.supported&&!r.persisted?"<br><br>"+DS():"")}var NS=hu(yu());var xa=class{constructor(e,t){e=e||[],this.lines=e,this.text=t,this.offset2loc=new Map,this.line2offset=new Map;for(var i of e)i.offset>=0&&(this.offset2loc.has(i.offset)||this.offset2loc.set(i.offset,i),this.line2offset.has(i.line)||this.line2offset.set(i.line,i.offset));this.sortedOffsets=Array.from(this.offset2loc.keys()).sort((n,s)=>n-s)}findLineForOffset(e,t){let i=this.sortedOffsets;for(var n=0,s=i.length-1,o=-1;n<=s;){var a=n+s>>1;i[a]<=e?(o=a,n=a+1):s=a-1}if(o<0)return null;var l=i[o];return e-l>t?null:this.offset2loc.get(l)}lineCount(){return this.lines.length}};function FS(r){return"errors"in r}function BS(r){return"output"in r}var Od=class{constructor(e){this.preset_id=$t(e)}async getRemoteFile(e){return new Promise((t,i)=>Ao(e,t,Pn(e)?"arraybuffer":"text"))}async getFileData(e){var t="presets/"+this.preset_id+"/"+e,i=await this.getRemoteFile(t);return i&&console.log("read",t,i.length,"bytes"),i}async setFileData(e,t){}onFileSystemUpdate(e){}};var Hs=class{constructor(e,t){this.basefs=eLine truncated
|
|
|
|
|
</form>`,buttons:{cancel:{label:"Cancel",className:"btn-default"},ok:{label:"Save",className:"btn-primary",callback:()=>{r.tabSize=parseInt($("#setting_tabSize").val())||8,r.tabsToSpaces=$("#setting_tabsToSpaces").is(":checked"),r.highlightSpecialChars=$("#setting_highlightSpecialChars").is(":checked"),r.highlightWhitespace=$("#setting_highlightWhitespace").is(":checked"),r.highlightTrailingWhitespace=$("#setting_highlightTrailingWhitespace").is(":checked"),r.closeBrackets=$("#setting_closeBrackets").is(":checked"),r.showLineNumbers=$("#setting_showLineNumbers").is(":checked"),e&&(r.debugHighlightTags=$("#setting_debugHighlightTags").is(":checked")),r.showStatusBar=$("#setting_showStatusBar").is(":checked"),HR(r),KR(r),Rl(r.showStatusBar)}}}})}function fd(){return typeof navigator!="undefined"?navigator.storage:null}function JR(r){var e=r!==void 0?r:fd();return!!(e&&typeof e.persist=="function")}async function e2(r){var e=r!==void 0?r:fd();try{if(e&&typeof e.estimate=="function"){var t=await e.estimate();return{usage:t&&t.usage,quota:t&&t.quota}}}catch(i){console.log("storage.estimate() failed",i)}return{}}async function t2(r){var e=r!==void 0?r:fd(),t={supported:JR(e),persisted:!1};try{e&&typeof e.persisted=="function"&&(t.persisted=await e.persisted())}catch(n){console.log("storage.persisted() failed",n)}var i=await e2(e);return t.usage=i.usage,t.quota=i.quota,t}async function sp(r){var e=r!==void 0?r:fd(),t=await t2(e);if(!t.supported||t.persisted)return t.granted=!1,t;try{t.persisted=await e.persist(),t.granted=t.persisted}catch(i){console.log("storage.persist() failed",i),t.granted=!1}return t}function r2(r){return r==null&&(r=typeof navigator!="undefined"?navigator.userAgent:""),r?/Edg\/|OPR\/|Chrome\/|Chromium\//.test(r)?"chromium":/Firefox\/|FxiOS\//.test(r)?"firefox":/Safari\//.test(r)?"safari":"other":"other"}function jS(r){if(typeof r!="number"||!isFinite(r))return"?";for(var e=["bytes","KB","MB","GB","TB"],t=0;r>=1024&&t<e.length-1;)r/=1024,t++;return(t==0?r.toFixed(0):r.toFixed(1))+" "+e[t]}function DS(r){return r.usage==null&&r.quota==null?"":"This site is using "+jS(r.usage)+" of the "+jS(r.quota)+" your browser allows."}var np="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 IS(r){switch(r||r2()){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 i2(){return"This browser doesn't support persistent storage, so it may discard your local file edits when it needs disk space. "+np}function qS(r,e){var t=DS(r),i;return r.supported?r.persisted?i=(r.granted?"Your browser just granted persistent storage. ":"Your browser is already persisting your local file edits. ")+np:i="Your browser has not granted persistent storage, so it may discard your local file edits when it needs disk space.<br><br>"+IS()+"<br><br>"+np:i=i2(),t?i+"<br><br>"+t:i}function FS(r){return"Your browser ran out of space for this site, so your last edit may not have been saved.<br><br>"+DS(r)+" Delete unused projects, or use <b>File > Download All Changes as ZIP</b> to back up your work before it is lost."+(r.supported&&!r.persisted?"<br><br>"+IS():"")}var GS=hu(yu());var xa=class{constructor(e,t){e=e||[],this.lines=e,this.text=t,this.offset2loc=new Map,this.line2offset=new Map;for(var i of e)i.offset>=0&&(this.offset2loc.has(i.offset)||this.offset2loc.set(i.offset,i),this.line2offset.has(i.line)||this.line2offset.set(i.line,i.offset));this.sortedOffsets=Array.from(this.offset2loc.keys()).sort((n,s)=>n-s)}findLineForOffset(e,t){let i=this.sortedOffsets;for(var n=0,s=i.length-1,o=-1;n<=s;){var a=n+s>>1;i[a]<=e?(o=a,n=a+1):s=a-1}if(o<0)return null;var l=i[o];return e-l>t?null:this.offset2loc.get(l)}lineCount(){return this.lines.length}};function BS(r){return"errors"in r}function NS(r){return"output"in r}var Od=class{constructor(e){this.preset_id=$t(e)}async getRemoteFile(e){return new Promise((t,i)=>Ao(e,t,Pn(e)?"arraybuffer":"text"))}async getFileData(e){var t="presets/"+this.preset_id+"/"+e,i=await this.getRemoteFile(t);return i&&console.log("read",t,i.length,"bytes"),i}async setFileData(e,t){}onFileSystemUpdate(e){}};var Hs=class{constructor(e,t){this.basefs=eLine truncated
|
|
|
|
|
=====
|
|
|
|
|
|
|
|
|
|
[Open this project in 8bitworkshop](http://8bitworkshop.com/redir.html?platform=$PLATFORM&githubURL=$GITHUBURL&file=$MAINFILE).
|
|
|
|
|
`;function Dn(){for(var r={},e=0;e<localStorage.length;e++){var t=localStorage.key(e);if(t.startsWith("__repo__")){var i=JSON.parse(localStorage.getItem(t)),n=t.substring(8);r[n]=i}}return r}function wa(r){var e=r.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 bd=class{constructor(e,t,i,n){this.githubCons=e,this.githubToken=t,this.store=i,this.project=n,this.recreateGithub()}recreateGithub(){this.github=new this.githubCons({token:this.githubToken})}login(){if(this.githubToken&&this.githubToken.length)return new Promise((t,i)=>{t()});var e=new firebase.auth.GithubAuthProvider;return e.addScope("repo"),firebase.auth().signInWithPopup(e).then(t=>{this.githubToken=t.credential.accessToken;var i=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=wa(e);if(!t)throw new Error("Please enter a valid GitHub URL.");var i=Dn()[t.repopath],n=t.branch||i&&i.branch,s=this.github.repos(t.user,t.repo);try{n=(await s.fetch()).defaultBranch||"master"}catch(a){console.log("could not fetch default branch: "+a),n="main"}console.log("branch =",n);var o={url:e,user:t.user,reponame:t.repo,repopath:t.repopath,branch:n,subtreepath:t.subtreepath,prefix:"",repo:s,platform_id:this.project?this.project.platform_id:i?i.platform_id:null};return o}getGithubHEADTree(e){var t;return this.getGithubSession(e).then(i=>(t=i,t.repo.git.refs.heads(t.branch).fetch())).then(i=>(t.head=i,t.sha=i.object.sha,t.repo.git.trees(t.sha).fetch())).then(i=>{if(t.subtreepath){for(let n of i.tree)if(n.type=="tree"&&n.path==t.subtreepath&&n.sha)return t.repo.git.trees(n.sha).fetch();throw Error("Cannot find subtree '"+t.subtreepath+"' in tree "+i.sha)}return i}).then(i=>(t.tree=i,t))}bind(e,t){var i="__repo__"+e.repopath;if(t){var n={url:e.url,branch:e.branch,platform_id:e.platform_id,mainPath:e.mainPath,sha:e.sha};console.log("storing",n),localStorage.setItem(i,JSON.stringify(n))}else localStorage.removeItem(i)}import(e){var t;return this.getGithubSession(e).then(i=>(t=i,t.repo.contents("README.md").read())).catch(i=>(console.log(i),console.log("no README.md found"),t.repo.fetch().then(n=>""))).then(i=>{var n;if(n=/8bitworkshop.com[^)]+file=([^)&]+)/.exec(i),n&&n[1]&&(console.log("main path: '"+n[1]+"'"),t.mainPath=n[1]),n=/8bitworkshop.com[^)]+platform=([A-Za-z0-9._\-]+)/.exec(i),n){if(console.log("platform id: '"+n[1]+"'"),t.platform_id&&!t.platform_id.startsWith(n[1]))throw Error("Platform mismatch: Repository is '"+n[1]+"', you have '"+t.platform_id+"' selected.");t.platform_id=n[1]}return this.bind(t,!0),t})}pull(e,t){var i;return this.getGithubHEADTree(e).then(n=>{i=n;let s=[];return i.paths=[],i.tree.tree.forEach(o=>{if(console.log(o.path,o.type,o.size),i.paths.push(o.path),o.type=="blob"&&!this.isFileIgnored(o.path)){var a=i.repo.git.blobs(o.sha).fetch().then(l=>{var c=i.prefix+o.path,d=o.size,h=l.encoding,u=l.content;if(l.encoding=="base64"){var f=Pl(atob(u)),p=Pn(o.path,f);u=p?f:kl(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(n=>i)}importAndPull(e){return this.import(e).then(t=>this.pull(e))}publish(e,t,i,n){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:n,auto_init:!1,license_template:i}).then(l=>{s=l;var c=i2;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,i){var n;return t||(t="updated from 8bitworkshop.com"),this.getGithubHEADTree(e).then(s=>{if(n=s,n.subtreepath)throw Error("Sorry, right now you can only commit files to the root directory of a repository.");return Promise.all(i.map(o=>typeof o.data=="string"?n.repo.git.blobs.create({content:o.data,encoding:"utf-8"}):n.repo.git.blobs.create({content:btoa($l(o.data)),encoding:"base64"})))}).then(s=>n.repo.git.trees.create({tree:i.map((o,a)=>({path:o.path,mode:"100644",type:"blob",sha:s[a].sha})),base_tree:n.tree.sha})).then(s=>n.repo.git.commits.create({message:t,tree:s.sha,parents:[n.head.object.sha]})).then(s=>n.repo.commits(s.sha).fetch()).then(s=>(n.commit=s,n))}push(e){return e.head.update({sha:e.com
Line truncated
|
|
|
|
|
`},s=window.c2t({noInitialRun:!0,print:n,printErr:n}),o=s.FS,a=lt()+".bin",l=lt()+".wav";o.writeFile(a,Wt(),{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,ui.saveAs)(h,l),i+="Then connect your audio output to the cassette input, turn up the volume, and play the audio file.",kt(i)}})}function a2(r){xr("lib/makewav.js").then(()=>{let e="",t=function(a){e+=a+`
|
|
|
|
|
`;function Dn(){for(var r={},e=0;e<localStorage.length;e++){var t=localStorage.key(e);if(t.startsWith("__repo__")){var i=JSON.parse(localStorage.getItem(t)),n=t.substring(8);r[n]=i}}return r}function wa(r){var e=r.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 bd=class{constructor(e,t,i,n){this.githubCons=e,this.githubToken=t,this.store=i,this.project=n,this.recreateGithub()}recreateGithub(){this.github=new this.githubCons({token:this.githubToken})}login(){if(this.githubToken&&this.githubToken.length)return new Promise((t,i)=>{t()});var e=new firebase.auth.GithubAuthProvider;return e.addScope("repo"),firebase.auth().signInWithPopup(e).then(t=>{this.githubToken=t.credential.accessToken;var i=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=wa(e);if(!t)throw new Error("Please enter a valid GitHub URL.");var i=Dn()[t.repopath],n=t.branch||i&&i.branch,s=this.github.repos(t.user,t.repo);try{n=(await s.fetch()).defaultBranch||"master"}catch(a){console.log("could not fetch default branch: "+a),n="main"}console.log("branch =",n);var o={url:e,user:t.user,reponame:t.repo,repopath:t.repopath,branch:n,subtreepath:t.subtreepath,prefix:"",repo:s,platform_id:this.project?this.project.platform_id:i?i.platform_id:null};return o}getGithubHEADTree(e){var t;return this.getGithubSession(e).then(i=>(t=i,t.repo.git.refs.heads(t.branch).fetch())).then(i=>(t.head=i,t.sha=i.object.sha,t.repo.git.trees(t.sha).fetch())).then(i=>{if(t.subtreepath){for(let n of i.tree)if(n.type=="tree"&&n.path==t.subtreepath&&n.sha)return t.repo.git.trees(n.sha).fetch();throw Error("Cannot find subtree '"+t.subtreepath+"' in tree "+i.sha)}return i}).then(i=>(t.tree=i,t))}bind(e,t){var i="__repo__"+e.repopath;if(t){var n={url:e.url,branch:e.branch,platform_id:e.platform_id,mainPath:e.mainPath,sha:e.sha};console.log("storing",n),localStorage.setItem(i,JSON.stringify(n))}else localStorage.removeItem(i)}import(e){var t;return this.getGithubSession(e).then(i=>(t=i,t.repo.contents("README.md").read())).catch(i=>(console.log(i),console.log("no README.md found"),t.repo.fetch().then(n=>""))).then(i=>{var n;if(n=/8bitworkshop.com[^)]+file=([^)&]+)/.exec(i),n&&n[1]&&(console.log("main path: '"+n[1]+"'"),t.mainPath=n[1]),n=/8bitworkshop.com[^)]+platform=([A-Za-z0-9._\-]+)/.exec(i),n){if(console.log("platform id: '"+n[1]+"'"),t.platform_id&&!t.platform_id.startsWith(n[1]))throw Error("Platform mismatch: Repository is '"+n[1]+"', you have '"+t.platform_id+"' selected.");t.platform_id=n[1]}return this.bind(t,!0),t})}pull(e,t){var i;return this.getGithubHEADTree(e).then(n=>{i=n;let s=[];return i.paths=[],i.tree.tree.forEach(o=>{if(console.log(o.path,o.type,o.size),i.paths.push(o.path),o.type=="blob"&&!this.isFileIgnored(o.path)){var a=i.repo.git.blobs(o.sha).fetch().then(l=>{var c=i.prefix+o.path,d=o.size,h=l.encoding,u=l.content;if(l.encoding=="base64"){var f=Pl(atob(u)),p=Pn(o.path,f);u=p?f:kl(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(n=>i)}importAndPull(e){return this.import(e).then(t=>this.pull(e))}publish(e,t,i,n){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:n,auto_init:!1,license_template:i}).then(l=>{s=l;var c=n2;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,i){var n;return t||(t="updated from 8bitworkshop.com"),this.getGithubHEADTree(e).then(s=>{if(n=s,n.subtreepath)throw Error("Sorry, right now you can only commit files to the root directory of a repository.");return Promise.all(i.map(o=>typeof o.data=="string"?n.repo.git.blobs.create({content:o.data,encoding:"utf-8"}):n.repo.git.blobs.create({content:btoa($l(o.data)),encoding:"base64"})))}).then(s=>n.repo.git.trees.create({tree:i.map((o,a)=>({path:o.path,mode:"100644",type:"blob",sha:s[a].sha})),base_tree:n.tree.sha})).then(s=>n.repo.git.commits.create({message:t,tree:s.sha,parents:[n.head.object.sha]})).then(s=>n.repo.commits(s.sha).fetch()).then(s=>(n.commit=s,n))}push(e){return e.head.update({sha:e.com
Line truncated
|
|
|
|
|
`},s=window.c2t({noInitialRun:!0,print:n,printErr:n}),o=s.FS,a=lt()+".bin",l=lt()+".wav";o.writeFile(a,Wt(),{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,ui.saveAs)(h,l),i+="Then connect your audio output to the cassette input, turn up the volume, and play the audio file.",kt(i)}})}function l2(r){xr("lib/makewav.js").then(()=>{let e="",t=function(a){e+=a+`
|
|
|
|
|
`};var i=Pt(lt());let n=i+".bin",s=i+".wav";window.makewav({noInitialRun:!1,print:t,printErr:t,arguments:["-ts","-f0","-v10",n],preRun:a=>{a.FS.writeFile(n,Wt(),{encoding:"binary"})}}).ready.then(a=>{let l=[n];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,ui.saveAs)(h,s),e+=`
|
|
|
|
|
Connect your audio output to the SuperCharger input, turn up the volume, and play the audio file.`,kt(e)}})})}function l2(r){var e=Pt(lt());let t=e+".tap",i=new In(e),n=new xd({sine_wave:!0}),s=Wt(),o=s[0]+s[1]*256;s=s.slice(2),i.setContent({data:s,startAddress:o,type:In.FILE_TYPE_NON_RELOCATABLE}),i.generateSound(n);let a=n.getTAPData();if(a){let l=new Blob([a],{type:"application/octet-stream"});(0,ui.saveAs)(l,t)}}function ap(){switch($t(ae)){case"vcs":return a2;case"apple2":return o2;case"c64":return l2}}function HS(r){if(Wt()==null)return ye("Please fix errors before exporting."),!0;var e=ap();if(e===void 0)return ye("Cassette export is not supported on this platform."),!0;e(r)}function KS(r){if(Wt()==null)return ye("Please finish compiling with no errors before downloading ROM."),!0;var e=Pt(lt());if(w.getDownloadFile){var t=w.getDownloadFile(),e=Pt(lt());(0,ui.saveAs)(t.blob,e+t.extension)}else if(Wt()instanceof Uint8Array){var i=new Blob([Wt()],{type:"application/octet-stream"}),n=w.getROMExtension&&w.getROMExtension(Wt())||"-"+$t(ae)+".bin";(0,ui.saveAs)(i,e+n)}else ye(`The "${ae}" platform doesn't have downloadable ROMs.`)}function JS(r){var e=V.getCurrentText();if(!e)return!1;var t=new Blob([e],{type:"text/plain;charset=utf-8"});(0,ui.saveAs)(t,sy(),{autoBom:!1})}async function ey(){let r=(await import("./jszip.min-EENSZHRN.js")).default;return new r}async function ty(r){var e=await ey();$i().iterateFiles((t,i)=>{i&&e.file(ft(t),i)}),e.generateAsync({type:"blob"}).then(t=>{(0,ui.saveAs)(t,lt()+"-"+$t(ae)+".zip")})}function ry(r){let e=w.getDebugSymbolFile&&w.getDebugSymbolFile();if(!e){ye("This project does not have debug information.");return}var t=Pt(lt());(0,ui.saveAs)(e.blob,t+e.extension,{autoBom:!1})}async function iy(r){var e=await ey(),t=await nn().keys();Le(!0);try{var i=0;await Promise.all(t.map(s=>nn().getItem(s).then(o=>{Yr(i++/(t.length+1)),o&&e.file(s,o)})));var n=await e.generateAsync({type:"blob"});(0,ui.saveAs)(n,$t(ae)+"-all.zip")}finally{Le(!1)}}var op=!1;function ny(){op||xr("lib/gif.js").then(()=>{var r=$("#emulator").find("canvas")[0];if(!r){ye("Could not find canvas element to record video!");return}var e=0;r.style&&r.style.transform&&(r.style.transform.indexOf("rotate(-90deg)")>=0?e=-1:r.style.transform.indexOf("rotate(90deg)")>=0&&(e=1));var t=new GIF({workerScript:"lib/gif.worker.js",workers:4,quality:10,rotate:e}),i=$("#videoPreviewImage");t.on("progress",l=>{Yr(l)}),t.on("finished",l=>{i.attr("src",URL.createObjectURL(l)),Le(!1),w.resume(),$("#videoPreviewModal").modal("show")});var n=20,s=300,o=0;console.log("Recording video",r),$("#emulator").css("backgroundColor","#cc3333");var a=()=>{o++>s?(console.log("Rendering video"),$("#emulator").css("backgroundColor","inherit"),Le(!0),w.pause(),t.render(),op=!1):(t.addFrame(r,{delay:n,copy:!0}),setTimeout(a,n),op=!0)};a()})}var lp;async function qn(){if(!lp){await xr("lib/octokat.js"),await xr("https://www.gstatic.com/firebasejs/8.8.1/firebase-app.js"),await xr("https://www.gstatic.com/firebasejs/8.8.1/firebase-auth.js"),await xr("https://8bitworkshop.com/config.js");var r=Tl("__github_key");lp=new bd(Octokat,r,nn(),$i()),console.log("loaded github service")}return lp}function ya(){var r=(ht||"").split("/");return r.length!=2?(ye("You are not in a GitHub repository. Choose one from the pulldown, or Import or Publish one."),null):"https://github.com/"+r[0]+"/"+r[1]}async function va(r,e){var t,i=wa(r);if(!i){ye("Could not parse GitHub URL.");return}var n=Dn()[i.repopath];if(!(n&&!confirm("You've already imported "+i.repopath+" -- do you want to replace all local files?"))){Le(!0);var s=gd(i.repopath);Yr(.25);var o=await qn();return o.import(r).then(a=>(t=a,Yr(.75),o.pull(r,s))).then(a=>{Le(!1),Fn(e,{repo:i.repopath})}).catch(a=>{Le(!1),console.log(a),ye("Could not import "+r+". "+a)})}}async function oy(r){var e=await qn();e.login().then(()=>{kt("You are signed in to GitHub.")}).catch(t=>{ye("Could not sign in."+t)})}async function ay(r){var e=await qn();e.logout().then(()=>{kt("You are logged out of GitHub.")})}function ly(r){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",i=>{i.key==="Enter"&&(i.preventDefault(),t.trigger("click"))}),t.off("click").on("click",()=>{var i=$("#importGithubURL").val()+"";e.modal("hide"),va(i,!1)})}function cy(r){if(!(ht&&!confirm("This project ("+$i().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(Pt(ft($i().mainPath))),e.modal("show"),t.off("click").on("click",async()=>{var i=$("#githubRepoName").val()+"",n=$("#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&&n.push({id:`${e}:${l}:${c[1]}`,name:c[1],kind:"func",source:i,file:e,line:l});let d=a.match(/(?:var|let|const|global)\s+(\w+)/i);d&&n.push({id:`${e}:${l}:${d[1]}`,name:d[1],kind:"var",source:i,file:e,line:l});let h=a.match(/(?:struct|class|interface|type)\s+(\w+)/i);h&&n.push({id:`${e}:${l}:${h[1]}`,name:h[1],kind:"type",source:i,file:e,line:l});let u=a.match(/^\s*(\w+)\s*:/);u&&!a.trim().startsWith("//")&&n.push({id:`${e}:${l}:${u[1]}`,name:u[1],kind:"label",source:i,file:e,line:l});let f=a.match(/#define\s+(\w+)/i);f&&n.push({id:`${e}:${l}:${f[1]}`,name:f[1],kind:"macro",source:i,file:e,line:l});let p=a.match(/^\s*(\w+)\s*(?:=|equ)\s+/i);p&&n.push({id:`${e}:${l}:${p[1]}`,name:p[1],kind:"equate",source:i,file:e,line:l})}return n}var my=()=>null;function gy(r){my=r}function Bn(){return my()}var wd=class{constructor(){this.id="project";this.kind="project";this.rebuilt=!1;this.index=new Ks([])}async ready(){await this.index.init(),this.rebuilt||(this.rebuilt=!0,await this.rebuild())}query(e,t){let i=this.index.query(e,t),n=this.fulltextQuery(e,t),s=i.concat(n);return s.sort((o,a)=>a.score-o.score),s.slice(0,t)}fulltextQuery(e,t){if(e.length<2)return[];let i=e.toLowerCase(),n=[],s=Math.max(t,10),o=Bn();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],p=u.toLowerCase().indexOf(i);if(p>=0){let m=u.trim();if(!m)continue;if(n.push({record:{id:`text:${a}:${h+1}`,name:m.length>80?m.slice(0,80)+"\u2026":m,kind:"text",source:"project",file:a,line:h+1},score:200+Math.max(0,100-p*2),ranges:[p,p+e.length]}),++d>=s)break}}}),n):[]}async onFileChanged(e,t){let i=this.extractSymbolsFromFile(e,t,"project");this.index.pushRecords(i)}extractSymbolsFromFile(e,t,i){if(typeof t!="string")return[];let n=this.detectEditorStyle(e);return dp(t,e,n,i)}detectEditorStyle(e){var i;switch((i=e.split(".").pop())==null?void 0:i.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=Bn();if(!e)return;let t=[];e.iterateFiles((i,n)=>{if(typeof n!="string")return;let s=this.detectEditorStyle(i),o=dp(n,i,s,"project");t.push(...o)}),this.index.pushRecords(t)}};var f2=new Set(["h","hh","hpp","inc","asm","a65","s","mac","defs","def","equ","i","m","c","bas","txt"]),O2=20,Sd=class{constructor(){this.id="toolchain";this.kind="toolchain";this.fsName=null;this.files=[];this.loaded=new Map;this.readyDone=!1;this.loadIdx=0;this.batchSize=O2}async ready(){if(this.readyDone)return;this.readyDone=!0;let e=Bn();if(!e)return;let t;try{t=e.getToolForFilename?e.getToolForFilename(e.mainPath):""}catch(o){t=""}let i=zl(t,e.platform_id),n=Ul(t,e.platform_id);if(!i||!n.length)return;this.fsName=i;let s=new Set;for(let o of n){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()}isValid(){return this.fsName!=null&&this.files.length>0}async listFiles(e){let t=Bn();if(!t||!this.fsName||!t.queryWorker)return[];try{let i={preload_fs:this.fsName,listshared:e,updates:[],buildsteps:[]},n=await t.queryWorker(i),s=n&&n.output;return Array.isArray(s)?s:[]}catch(i){return console.debug("Toolchain list error:",i),[]}}async readFile(e){let t=Bn();if(!t||!this.fsName||!t.queryWorker)return null;try{let i={preload_fs:this.fsName,readshared:e,updates:[],buildsteps:[]},n=await t.queryWorker(i),s=n&&n.output;return s instanceof Uint8Array&&s.length>0?new TextDecoder().decode(s):null}catch(i){return console.debug("Toolchain read error:",i),null}}isSearchable(e){let t=e.split("/").pop()||e,i=t.lastIndexOf(".");return i<0?!0:f2.has(t.substring(i+1).toLowerCase())}async ensureBatch(){let e=Bn();if(!(!e||!e.queryWorker))for(;this.loadIdx<this.files.length;){let t=this.files.slice(this.loadIdx,this.loadIdx+this.batchSize);this.loadIdx+=t.length;let i=await Promise.all(t.map(async n=>{let s=await this.readFile(n);return[n,s]}));for(let[n,s]of i)s!=null&&this.loaded.set(n,s);if(this.loaded.size>0||this.loadIdx>=this.files.length)break}}async query(e,t){return await this.ready(),!this.isValid()||e.length<2?[]:(await this.ensureBatch(),this.textQuery(e,t))}textQuery(e,t){if(e.length<2)return[];let i=e.toLowerCase(),n=[],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(i);if(f>=0){let p=h.trim();if(!p)continue;if(n.push({record:{id:`toolchain:${o}:${d+1}`,name:p.length>80?p.slice(0,80)+"\u2026":p,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 n.sort((o,a)=>a.score-o.score),n.slice(0,t)}invalidate(){this.fsName=null,this.files=[],this.loaded.clear(),this.readyDone=!1,this.loadIdx=0}};var by=()=>[];function xy(r){by=r}var p2=/<h([1-3])\b[^>]*>([\s\S]*?)<\/h\1>/gi;function m2(r){return r.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 hp(r){return m2(r.replace(/<[^>]+>/g," ")).replace(/\s+/g," ").trim()}function g2(r,e=180){let t=r.trim();if(!t)return;let n=t.slice(0,e).match(/^([\s\S]*?[.!?])(?:\s|$)/);return n?n[1]:t.length<=e?t:t.slice(0,e-1)+"\u2026"}function b2(r){let e=[],t="#help/"+r.id,i=r.title||r.id,n=r.html||"",s=[],o=new RegExp(p2.source,"gi"),a;for(;a=o.exec(n);)s.push({name:hp(a[2]),start:a.index,end:o.lastIndex});let l=(u,f,p)=>{if(!f)return;let m=g2(p),S=m&&p.startsWith(m)?p.slice(m.length).trim():p;e.push({id:`${r.id}:${u}`,name:f,kind:"doc",brief:m,detail:S||void 0,source:"docs",file:i,url:t})},c=s.length?s[0].start:n.length,d=hp(n.slice(0,c)),h=s.length&&s[0].start===0?s[0].name||r.title:r.title||r.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:n.length;l(u+1,s[u].name,hp(n.slice(s[u].end,f)))}return e}var yd=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=by()||[];if(e.length===0)return;let t=[];for(let n of e)t.push(...b2(n));if(t.length===0)return;let i=new Ks(t);await i.init(),this.index=i}async query(e,t){return await this.ready(),this.index?this.index.query(e,t):[]}};var x2=50,up=class r{constructor(){this.sources=new Map;this.projectSource=new wd,this.toolchainSource=new Sd,this.docsSource=new yd,this.sources.set("project",this.projectSource),this.sources.set("toolchain",this.toolchainSource),this.sources.set("docs",this.docsSource)}static getInstance(){return r.instance||(r.instance=new r),r.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=x2){let{needle:i,filter:n}=this.parseQuery(e);if(!i)return[];let s=[],o=[];n==="docs"?o.push(this.docsSource):n==="files"?o.push(this.projectSource):n==="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(i,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)}},wy=up.getInstance();var pp=class r{constructor(e,t,i,n,s,o,a,l,c,d=0,h){this.p=e,this.stack=t,this.state=i,this.reducePos=n,this.pos=s,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=d,this.parent=h}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let n=e.parser.context;return new r(e,[],t,i,i,0,[],0,n?new vd(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,n=e&65535,{parser:s}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=s.dynamicPrecedence(n);if(a&&(this.score+=a),i==0){n<s.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n<s.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(n,this.reducePos);return}let l=this.stack.length-(i-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from;n<s.minRepeatTerm&&c==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let d=this.reducePos-c;d>=2e3&&!(!((t=this.p.parser.nodeSet.types[n])===null||t===void 0)&&t.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=d):this.p.lastBigReductionSize<d&&(this.p.bigReductionCount=1,this.p.lastBigReductionStar
Line truncated
|
|
|
|
|
`:i=="r"?"\r":i=="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 $p(this):new Pp(this)}getCursor(e,t=0,i){let n=e.doc?e:Qe.create({doc:e});return i==null&&(i=n.doc.length),this.regexp?ro(this,n,t,i):to(this,n,t,i)}},Rd=class{constructor(e){this.spec=e}};function eC(r,e,t){return(i,n,s,o)=>{if(t&&!t(i,n,s,o))return!1;let a=i>=o&&n<=o+s.length?s.slice(i-o,n-o):e.doc.sliceString(i,n);return r(a,e,i,n)}}function to(r,e,t,i){let n;return r.wholeWord&&(n=tC(e.doc,e.charCategorizer(e.selection.main.head))),r.test&&(n=eC(r.test,e,n)),new an(e.doc,r.unquoted,t,i,r.caseSensitive?void 0:s=>s.toLowerCase(),n)}function tC(r,e){return(t,i,n,s)=>((s>t||s+n.length<i)&&(s=Math.max(0,t-2),n=r.sliceString(s,Math.min(r.length,i+2))),(e(Cd(n,t-s))!=ze.Word||e(Ad(n,t-s))!=ze.Word)&&(e(Ad(n,i-s))!=ze.Word||e(Cd(n,i-s))!=ze.Word))}var Pp=class extends Rd{constructor(e){super(e)}nextMatch(e,t,i){let n=to(this.spec,e,i,e.doc.length).nextOverlapping();if(n.done){let s=Math.min(e.doc.length,t+this.spec.unquoted.length);n=to(this.spec,e,0,s).nextOverlapping()}return n.done||n.value.from==t&&n.value.to==i?null:n.value}prevMatchInRange(e,t,i){for(let n=i;;){let s=Math.max(t,n-1e4-this.spec.unquoted.length),o=to(this.spec,e,s,n),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==t)return null;n-=1e4}}prevMatch(e,t,i){let n=this.prevMatchInRange(e,0,t);return n||(n=this.prevMatchInRange(e,Math.max(0,i-this.spec.unquoted.length),e.doc.length)),n&&(n.from!=t||n.to!=i)?n:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let i=to(this.spec,e,0,e.doc.length),n=[];for(;!i.next().done;){if(n.length>=t)return null;n.push(i.value)}return n}highlight(e,t,i,n){let s=to(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}};function rC(r,e,t){return(i,n,s)=>(!t||t(i,n,s))&&r(s[0],e,i,n)}function ro(r,e,t,i){let n;return r.wholeWord&&(n=iC(e.charCategorizer(e.selection.main.head))),r.test&&(n=rC(r.test,e,n)),new $d(e.doc,r.search,{ignoreCase:!r.caseSensitive,test:n},t,i)}function Cd(r,e){return r.slice(st(r,e,!1),e)}function Ad(r,e){return r.slice(e,st(r,e))}function iC(r){return(e,t,i)=>!i[0].length||(r(Cd(i.input,i.index))!=ze.Word||r(Ad(i.input,i.index))!=ze.Word)&&(r(Ad(i.input,i.index+i[0].length))!=ze.Word||r(Cd(i.input,i.index+i[0].length))!=ze.Word)}var $p=class extends Rd{nextMatch(e,t,i){let n=ro(this.spec,e,i,e.doc.length).next();return n.done&&(n=ro(this.spec,e,0,t).next()),n.done?null:n.value}prevMatchInRange(e,t,i){for(let n=1;;n++){let s=Math.max(t,i-n*1e4),o=ro(this.spec,e,s,i),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,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let n=i.length;n>0;n--){let s=+i.slice(0,n);if(s>0&&s<e.match.length)return e.match[s]+i.slice(n)}return t})}matchAll(e,t){let i=ro(this.spec,e,0,e.doc.length),n=[];for(;!i.next().done;){if(n.length>=t)return null;n.push(i.value)}return n}highlight(e,t,i,n){let s=ro(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}},ka=ce.define(),Ap=ce.define(),on=ke.define({create(r){return new $a(kp(r).create(),null)},update(r,e){for(let t of e.effects)t.is(ka)?r=new $a(t.value.create(),r.panel):t.is(Ap)&&(r=new $a(r.query,t.value?Ep:null));return r},provide:r=>ia.from(r,e=>e.panel)});var $a=class{constructor(e,t){this.query=e,this.panel=t}},nC=F.mark({class:"cm-searchMatch"}),sC=F.mark({class:"cm-searchMatch cm-searchMatch-selected"}),oC=We.fromClass(class{constructor(r){this.view=r,this.decorations=this.highlight(r.state.field(on))}update(r){let e=r.state.field(on);(e!=r.startState.field(on)||r.docChanged||r.selectionSet||r.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:r,panel:e}){if(!e||!r.spec.valid)return F.none;let{view:t}=this,i=new Wr;for(let n=0,s=t.visibleRanges,o=s.length;n<o;n++){let{from:a,to:l}=s[n];for(;n<o-1&&l>s[n+1].from-500;)l=s[++n].to;r.highlight(t.state,a,l,(c,d)=>{let h=t.state.selection.ranges.some(u=>u.from==c&&u.to==d);i.add(c,d,h?sC:nC)})}return i.finish()}},{decorations:r=>r.decorations});function Ta(r){return e=>{let t=e.state.field(on,!1);return t&&t.query.spec.valid?r(e,t):Ud(e)}}var io=Ta((r,{query:e})=>{let{to:t}=r.state.selection.main,i=e.nextMatch(r.state,t,t);if(!i)return!1;let n=E.single(i.from,i.to),s=r.state.facet(Nn);return r.dispatch({selection:n,effects:[Zp(r,i),s.scrollToMatch(n.main,r)],userEvent:"select.search"}),My(r),!0}),Ed=Ta((r,{query:e})=>{let{state:t}=r,{from:i}=t.selection.main,n=e.prevMatch(t,i,i);if(!n)
Line truncated
|
|
|
|
|
`+t.scrub(),s=this.advance(n);return s>-1&&s<n.length?this.complete(e,i,s):!1}finish(e,t){return(this.stage==2||this.stage==3)&&_a(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,i){return e.addLeafElement(t,_e(B.LinkReference,this.start,this.start+i,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(Cv(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(_e(B.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(_v(e,_a(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=_a(e,this.pos),i=0;if(t>this.pos){let n=Rv(e,t,this.start);if(n){let s=om(e,n.to-this.start);s>0&&(this.nextStage(n),i=s)}}return i||(i=om(e,this.pos)),i>0&&i<e.length?i:-1}else return om(e,this.pos)}}};function om(r,e){for(;e<r.length;e++){let t=r.charCodeAt(e);if(t==10)break;if(!Rr(t))return-1}return e}var fm=class{nextLine(e,t,i){let n=t.depth<e.stack.length?-1:Sv(t),s=t.next;if(n<0)return!1;let o=_e(B.HeaderMark,e.lineStart+t.pos,e.lineStart+n);return e.nextLine(),e.addLeafElement(i,_e(s==61?B.SetextHeading1:B.SetextHeading2,i.start,e.prevLineEnd(),[...e.parser.parseInline(i.content,i.start),o])),!0}finish(){return!1}},Pv={LinkReference(r,e){return e.content.charCodeAt(0)==91?new um(e):null},SetextHeading(){return new fm}},mA=[(r,e)=>wv(e)>=0,(r,e)=>gv(e)>=0,(r,e)=>bv(e)>=0,(r,e)=>wm(e,r,!0)>=0,(r,e)=>Sm(e,r,!0)>=0,(r,e)=>xm(e,r,!0)>=0,(r,e)=>Qv(e,r,!0)>=0],gA={text:"",end:0},Om=class{constructor(e,t,i,n){this.parser=e,this.input=t,this.ranges=n,this.line=new cm,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=n[n.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=n[0].from,this.block=Ld.create(B.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=i.length?new gm(i,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 i=0;;){let n=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;i<e.markers.length&&(!n||e.markers[i].from<n.end);){let s=e.markers[i++];this.addNode(s.type,s.from,s.to)}if(!n)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 i of this.parser.blockParsers)if(i){let n=i(this,e);if(n!=!1){if(n==!0)return null;e.forward();continue e}}break}if(e.pos==e.text.length)return this.nextLine()?null:this.finish();let t=new lm(this.lineStart+e.pos,e.text.slice(e.pos));for(let i of this.parser.leafBlockParsers)if(i){let n=i(this,t);n&&t.parsers.push(n)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let i of this.parser.endLeafBlock)if(i(this,e,t))break e}for(let i of t.parsers)if(i.nextLine(this,e,t))return null;t.content+=`
|
|
|
|
|
`+e.scrub();for(let i of e.markers)t.marks.push(i)}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=Av(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=gA;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 i=this.absoluteLineStart,n=this.rangeI;for(;this.ranges[n].to<t.end;){n++;let s=this.ranges[n].from,o=this.lineChunkAt(s);t.end=s+o.length,t.text=t.text.slice(0,this.ranges[n-1].to-i)+o,i=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:i}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=i,e.reset(t);e.depth<this.stack.length;e.depth++){let n=this.stack[e.depth],s=this.parser.skipContextMarkup[n.type];if(!s)throw new Error("Unhandled block context "+B[n.type]);let o=this.line.markers.length;if(!s(n,this,e)){this.line.markers.length>o&&(n.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),i;if(this.input.lineChunks)i=t==`
|
|
|
|
|
Connect your audio output to the SuperCharger input, turn up the volume, and play the audio file.`,kt(e)}})})}function c2(r){var e=Pt(lt());let t=e+".tap",i=new In(e),n=new xd({sine_wave:!0}),s=Wt(),o=s[0]+s[1]*256;s=s.slice(2),i.setContent({data:s,startAddress:o,type:In.FILE_TYPE_NON_RELOCATABLE}),i.generateSound(n);let a=n.getTAPData();if(a){let l=new Blob([a],{type:"application/octet-stream"});(0,ui.saveAs)(l,t)}}function ap(){switch($t(ae)){case"vcs":return l2;case"apple2":return a2;case"c64":return c2}}function KS(r){if(Wt()==null)return ye("Please fix errors before exporting."),!0;var e=ap();if(e===void 0)return ye("Cassette export is not supported on this platform."),!0;e(r)}function JS(r){if(Wt()==null)return ye("Please finish compiling with no errors before downloading ROM."),!0;var e=Pt(lt());if(S.getDownloadFile){var t=S.getDownloadFile(),e=Pt(lt());(0,ui.saveAs)(t.blob,e+t.extension)}else if(Wt()instanceof Uint8Array){var i=new Blob([Wt()],{type:"application/octet-stream"}),n=S.getROMExtension&&S.getROMExtension(Wt())||"-"+$t(ae)+".bin";(0,ui.saveAs)(i,e+n)}else ye(`The "${ae}" platform doesn't have downloadable ROMs.`)}function ey(r){var e=W.getCurrentText();if(!e)return!1;var t=new Blob([e],{type:"text/plain;charset=utf-8"});(0,ui.saveAs)(t,oy(),{autoBom:!1})}async function ty(){let r=(await import("./jszip.min-EENSZHRN.js")).default;return new r}async function ry(r){var e=await ty();$i().iterateFiles((t,i)=>{i&&e.file(ft(t),i)}),e.generateAsync({type:"blob"}).then(t=>{(0,ui.saveAs)(t,lt()+"-"+$t(ae)+".zip")})}function iy(r){let e=S.getDebugSymbolFile&&S.getDebugSymbolFile();if(!e){ye("This project does not have debug information.");return}var t=Pt(lt());(0,ui.saveAs)(e.blob,t+e.extension,{autoBom:!1})}async function ny(r){var e=await ty(),t=await nn().keys();Le(!0);try{var i=0;await Promise.all(t.map(s=>nn().getItem(s).then(o=>{Yr(i++/(t.length+1)),o&&e.file(s,o)})));var n=await e.generateAsync({type:"blob"});(0,ui.saveAs)(n,$t(ae)+"-all.zip")}finally{Le(!1)}}var op=!1;function sy(){op||xr("lib/gif.js").then(()=>{var r=$("#emulator").find("canvas")[0];if(!r){ye("Could not find canvas element to record video!");return}var e=0;r.style&&r.style.transform&&(r.style.transform.indexOf("rotate(-90deg)")>=0?e=-1:r.style.transform.indexOf("rotate(90deg)")>=0&&(e=1));var t=new GIF({workerScript:"lib/gif.worker.js",workers:4,quality:10,rotate:e}),i=$("#videoPreviewImage");t.on("progress",l=>{Yr(l)}),t.on("finished",l=>{i.attr("src",URL.createObjectURL(l)),Le(!1),S.resume(),$("#videoPreviewModal").modal("show")});var n=20,s=300,o=0;console.log("Recording video",r),$("#emulator").css("backgroundColor","#cc3333");var a=()=>{o++>s?(console.log("Rendering video"),$("#emulator").css("backgroundColor","inherit"),Le(!0),S.pause(),t.render(),op=!1):(t.addFrame(r,{delay:n,copy:!0}),setTimeout(a,n),op=!0)};a()})}var lp;async function qn(){if(!lp){await xr("lib/octokat.js"),await xr("https://www.gstatic.com/firebasejs/8.8.1/firebase-app.js"),await xr("https://www.gstatic.com/firebasejs/8.8.1/firebase-auth.js"),await xr("https://8bitworkshop.com/config.js");var r=Tl("__github_key");lp=new bd(Octokat,r,nn(),$i()),console.log("loaded github service")}return lp}function ya(){var r=(ht||"").split("/");return r.length!=2?(ye("You are not in a GitHub repository. Choose one from the pulldown, or Import or Publish one."),null):"https://github.com/"+r[0]+"/"+r[1]}async function va(r,e){var t,i=wa(r);if(!i){ye("Could not parse GitHub URL.");return}var n=Dn()[i.repopath];if(!(n&&!confirm("You've already imported "+i.repopath+" -- do you want to replace all local files?"))){Le(!0);var s=gd(i.repopath);Yr(.25);var o=await qn();return o.import(r).then(a=>(t=a,Yr(.75),o.pull(r,s))).then(a=>{Le(!1),Fn(e,{repo:i.repopath})}).catch(a=>{Le(!1),console.log(a),ye("Could not import "+r+". "+a)})}}async function ay(r){var e=await qn();e.login().then(()=>{kt("You are signed in to GitHub.")}).catch(t=>{ye("Could not sign in."+t)})}async function ly(r){var e=await qn();e.logout().then(()=>{kt("You are logged out of GitHub.")})}function cy(r){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",i=>{i.key==="Enter"&&(i.preventDefault(),t.trigger("click"))}),t.off("click").on("click",()=>{var i=$("#importGithubURL").val()+"";e.modal("hide"),va(i,!1)})}function dy(r){if(!(ht&&!confirm("This project ("+$i().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(Pt(ft($i().mainPath))),e.modal("show"),t.off("click").on("click",async()=>{var i=$("#githubRepoName").val()+"",n=$("#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&&n.push({id:`${e}:${l}:${c[1]}`,name:c[1],kind:"func",source:i,file:e,line:l});let d=a.match(/(?:var|let|const|global)\s+(\w+)/i);d&&n.push({id:`${e}:${l}:${d[1]}`,name:d[1],kind:"var",source:i,file:e,line:l});let h=a.match(/(?:struct|class|interface|type)\s+(\w+)/i);h&&n.push({id:`${e}:${l}:${h[1]}`,name:h[1],kind:"type",source:i,file:e,line:l});let u=a.match(/^\s*(\w+)\s*:/);u&&!a.trim().startsWith("//")&&n.push({id:`${e}:${l}:${u[1]}`,name:u[1],kind:"label",source:i,file:e,line:l});let f=a.match(/#define\s+(\w+)/i);f&&n.push({id:`${e}:${l}:${f[1]}`,name:f[1],kind:"macro",source:i,file:e,line:l});let p=a.match(/^\s*(\w+)\s*(?:=|equ)\s+/i);p&&n.push({id:`${e}:${l}:${p[1]}`,name:p[1],kind:"equate",source:i,file:e,line:l})}return n}var gy=()=>null;function by(r){gy=r}function Bn(){return gy()}var wd=class{constructor(){this.id="project";this.kind="project";this.rebuilt=!1;this.index=new Ks([])}async ready(){await this.index.init(),this.rebuilt||(this.rebuilt=!0,await this.rebuild())}query(e,t){let i=this.index.query(e,t),n=this.fulltextQuery(e,t),s=i.concat(n);return s.sort((o,a)=>a.score-o.score),s.slice(0,t)}fulltextQuery(e,t){if(e.length<2)return[];let i=e.toLowerCase(),n=[],s=Math.max(t,10),o=Bn();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],p=u.toLowerCase().indexOf(i);if(p>=0){let m=u.trim();if(!m)continue;if(n.push({record:{id:`text:${a}:${h+1}`,name:m.length>80?m.slice(0,80)+"\u2026":m,kind:"text",source:"project",file:a,line:h+1},score:200+Math.max(0,100-p*2),ranges:[p,p+e.length]}),++d>=s)break}}}),n):[]}async onFileChanged(e,t){let i=this.extractSymbolsFromFile(e,t,"project");this.index.pushRecords(i)}extractSymbolsFromFile(e,t,i){if(typeof t!="string")return[];let n=this.detectEditorStyle(e);return dp(t,e,n,i)}detectEditorStyle(e){var i;switch((i=e.split(".").pop())==null?void 0:i.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=Bn();if(!e)return;let t=[];e.iterateFiles((i,n)=>{if(typeof n!="string")return;let s=this.detectEditorStyle(i),o=dp(n,i,s,"project");t.push(...o)}),this.index.pushRecords(t)}};var O2=new Set(["h","hh","hpp","inc","asm","a65","s","mac","defs","def","equ","i","m","c","bas","txt"]),p2=20,Sd=class{constructor(){this.id="toolchain";this.kind="toolchain";this.fsName=null;this.files=[];this.loaded=new Map;this.readyDone=!1;this.loadIdx=0;this.batchSize=p2}async ready(){if(this.readyDone)return;this.readyDone=!0;let e=Bn();if(!e)return;let t;try{t=e.getToolForFilename?e.getToolForFilename(e.mainPath):""}catch(o){t=""}let i=zl(t,e.platform_id),n=Ul(t,e.platform_id);if(!i||!n.length)return;this.fsName=i;let s=new Set;for(let o of n){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()}isValid(){return this.fsName!=null&&this.files.length>0}async listFiles(e){let t=Bn();if(!t||!this.fsName||!t.queryWorker)return[];try{let i={preload_fs:this.fsName,listshared:e,updates:[],buildsteps:[]},n=await t.queryWorker(i),s=n&&n.output;return Array.isArray(s)?s:[]}catch(i){return console.debug("Toolchain list error:",i),[]}}async readFile(e){let t=Bn();if(!t||!this.fsName||!t.queryWorker)return null;try{let i={preload_fs:this.fsName,readshared:e,updates:[],buildsteps:[]},n=await t.queryWorker(i),s=n&&n.output;return s instanceof Uint8Array&&s.length>0?new TextDecoder().decode(s):null}catch(i){return console.debug("Toolchain read error:",i),null}}isSearchable(e){let t=e.split("/").pop()||e,i=t.lastIndexOf(".");return i<0?!0:O2.has(t.substring(i+1).toLowerCase())}async ensureBatch(){let e=Bn();if(!(!e||!e.queryWorker))for(;this.loadIdx<this.files.length;){let t=this.files.slice(this.loadIdx,this.loadIdx+this.batchSize);this.loadIdx+=t.length;let i=await Promise.all(t.map(async n=>{let s=await this.readFile(n);return[n,s]}));for(let[n,s]of i)s!=null&&this.loaded.set(n,s);if(this.loaded.size>0||this.loadIdx>=this.files.length)break}}async query(e,t){return await this.ready(),!this.isValid()||e.length<2?[]:(await this.ensureBatch(),this.textQuery(e,t))}textQuery(e,t){if(e.length<2)return[];let i=e.toLowerCase(),n=[],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(i);if(f>=0){let p=h.trim();if(!p)continue;if(n.push({record:{id:`toolchain:${o}:${d+1}`,name:p.length>80?p.slice(0,80)+"\u2026":p,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 n.sort((o,a)=>a.score-o.score),n.slice(0,t)}invalidate(){this.fsName=null,this.files=[],this.loaded.clear(),this.readyDone=!1,this.loadIdx=0}};var xy=()=>[];function wy(r){xy=r}var m2=/<h([1-3])\b[^>]*>([\s\S]*?)<\/h\1>/gi;function g2(r){return r.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 hp(r){return g2(r.replace(/<[^>]+>/g," ")).replace(/\s+/g," ").trim()}function b2(r,e=180){let t=r.trim();if(!t)return;let n=t.slice(0,e).match(/^([\s\S]*?[.!?])(?:\s|$)/);return n?n[1]:t.length<=e?t:t.slice(0,e-1)+"\u2026"}function x2(r){let e=[],t="#help/"+r.id,i=r.title||r.id,n=r.html||"",s=[],o=new RegExp(m2.source,"gi"),a;for(;a=o.exec(n);)s.push({name:hp(a[2]),start:a.index,end:o.lastIndex});let l=(u,f,p)=>{if(!f)return;let m=b2(p),w=m&&p.startsWith(m)?p.slice(m.length).trim():p;e.push({id:`${r.id}:${u}`,name:f,kind:"doc",brief:m,detail:w||void 0,source:"docs",file:i,url:t})},c=s.length?s[0].start:n.length,d=hp(n.slice(0,c)),h=s.length&&s[0].start===0?s[0].name||r.title:r.title||r.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:n.length;l(u+1,s[u].name,hp(n.slice(s[u].end,f)))}return e}var yd=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=xy()||[];if(e.length===0)return;let t=[];for(let n of e)t.push(...x2(n));if(t.length===0)return;let i=new Ks(t);await i.init(),this.index=i}async query(e,t){return await this.ready(),this.index?this.index.query(e,t):[]}};var w2=50,up=class r{constructor(){this.sources=new Map;this.projectSource=new wd,this.toolchainSource=new Sd,this.docsSource=new yd,this.sources.set("project",this.projectSource),this.sources.set("toolchain",this.toolchainSource),this.sources.set("docs",this.docsSource)}static getInstance(){return r.instance||(r.instance=new r),r.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=w2){let{needle:i,filter:n}=this.parseQuery(e);if(!i)return[];let s=[],o=[];n==="docs"?o.push(this.docsSource):n==="files"?o.push(this.projectSource):n==="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(i,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)}},Sy=up.getInstance();var pp=class r{constructor(e,t,i,n,s,o,a,l,c,d=0,h){this.p=e,this.stack=t,this.state=i,this.reducePos=n,this.pos=s,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=d,this.parent=h}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let n=e.parser.context;return new r(e,[],t,i,i,0,[],0,n?new vd(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,n=e&65535,{parser:s}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=s.dynamicPrecedence(n);if(a&&(this.score+=a),i==0){n<s.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n<s.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(n,this.reducePos);return}let l=this.stack.length-(i-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from;n<s.minRepeatTerm&&c==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let d=this.reducePos-c;d>=2e3&&!(!((t=this.p.parser.nodeSet.types[n])===null||t===void 0)&&t.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=d):this.p.lastBigReductionSize<d&&(this.p.bigReductionCount=1,this.p.lastBigReductionStar
Line truncated
|
|
|
|
|
`:i=="r"?"\r":i=="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 $p(this):new Pp(this)}getCursor(e,t=0,i){let n=e.doc?e:Qe.create({doc:e});return i==null&&(i=n.doc.length),this.regexp?ro(this,n,t,i):to(this,n,t,i)}},Rd=class{constructor(e){this.spec=e}};function tC(r,e,t){return(i,n,s,o)=>{if(t&&!t(i,n,s,o))return!1;let a=i>=o&&n<=o+s.length?s.slice(i-o,n-o):e.doc.sliceString(i,n);return r(a,e,i,n)}}function to(r,e,t,i){let n;return r.wholeWord&&(n=rC(e.doc,e.charCategorizer(e.selection.main.head))),r.test&&(n=tC(r.test,e,n)),new an(e.doc,r.unquoted,t,i,r.caseSensitive?void 0:s=>s.toLowerCase(),n)}function rC(r,e){return(t,i,n,s)=>((s>t||s+n.length<i)&&(s=Math.max(0,t-2),n=r.sliceString(s,Math.min(r.length,i+2))),(e(Cd(n,t-s))!=ze.Word||e(Ad(n,t-s))!=ze.Word)&&(e(Ad(n,i-s))!=ze.Word||e(Cd(n,i-s))!=ze.Word))}var Pp=class extends Rd{constructor(e){super(e)}nextMatch(e,t,i){let n=to(this.spec,e,i,e.doc.length).nextOverlapping();if(n.done){let s=Math.min(e.doc.length,t+this.spec.unquoted.length);n=to(this.spec,e,0,s).nextOverlapping()}return n.done||n.value.from==t&&n.value.to==i?null:n.value}prevMatchInRange(e,t,i){for(let n=i;;){let s=Math.max(t,n-1e4-this.spec.unquoted.length),o=to(this.spec,e,s,n),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==t)return null;n-=1e4}}prevMatch(e,t,i){let n=this.prevMatchInRange(e,0,t);return n||(n=this.prevMatchInRange(e,Math.max(0,i-this.spec.unquoted.length),e.doc.length)),n&&(n.from!=t||n.to!=i)?n:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let i=to(this.spec,e,0,e.doc.length),n=[];for(;!i.next().done;){if(n.length>=t)return null;n.push(i.value)}return n}highlight(e,t,i,n){let s=to(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}};function iC(r,e,t){return(i,n,s)=>(!t||t(i,n,s))&&r(s[0],e,i,n)}function ro(r,e,t,i){let n;return r.wholeWord&&(n=nC(e.charCategorizer(e.selection.main.head))),r.test&&(n=iC(r.test,e,n)),new $d(e.doc,r.search,{ignoreCase:!r.caseSensitive,test:n},t,i)}function Cd(r,e){return r.slice(st(r,e,!1),e)}function Ad(r,e){return r.slice(e,st(r,e))}function nC(r){return(e,t,i)=>!i[0].length||(r(Cd(i.input,i.index))!=ze.Word||r(Ad(i.input,i.index))!=ze.Word)&&(r(Ad(i.input,i.index+i[0].length))!=ze.Word||r(Cd(i.input,i.index+i[0].length))!=ze.Word)}var $p=class extends Rd{nextMatch(e,t,i){let n=ro(this.spec,e,i,e.doc.length).next();return n.done&&(n=ro(this.spec,e,0,t).next()),n.done?null:n.value}prevMatchInRange(e,t,i){for(let n=1;;n++){let s=Math.max(t,i-n*1e4),o=ro(this.spec,e,s,i),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,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let n=i.length;n>0;n--){let s=+i.slice(0,n);if(s>0&&s<e.match.length)return e.match[s]+i.slice(n)}return t})}matchAll(e,t){let i=ro(this.spec,e,0,e.doc.length),n=[];for(;!i.next().done;){if(n.length>=t)return null;n.push(i.value)}return n}highlight(e,t,i,n){let s=ro(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}},ka=ce.define(),Ap=ce.define(),on=ke.define({create(r){return new $a(kp(r).create(),null)},update(r,e){for(let t of e.effects)t.is(ka)?r=new $a(t.value.create(),r.panel):t.is(Ap)&&(r=new $a(r.query,t.value?Ep:null));return r},provide:r=>ia.from(r,e=>e.panel)});var $a=class{constructor(e,t){this.query=e,this.panel=t}},sC=F.mark({class:"cm-searchMatch"}),oC=F.mark({class:"cm-searchMatch cm-searchMatch-selected"}),aC=We.fromClass(class{constructor(r){this.view=r,this.decorations=this.highlight(r.state.field(on))}update(r){let e=r.state.field(on);(e!=r.startState.field(on)||r.docChanged||r.selectionSet||r.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:r,panel:e}){if(!e||!r.spec.valid)return F.none;let{view:t}=this,i=new Wr;for(let n=0,s=t.visibleRanges,o=s.length;n<o;n++){let{from:a,to:l}=s[n];for(;n<o-1&&l>s[n+1].from-500;)l=s[++n].to;r.highlight(t.state,a,l,(c,d)=>{let h=t.state.selection.ranges.some(u=>u.from==c&&u.to==d);i.add(c,d,h?oC:sC)})}return i.finish()}},{decorations:r=>r.decorations});function Ta(r){return e=>{let t=e.state.field(on,!1);return t&&t.query.spec.valid?r(e,t):Ud(e)}}var io=Ta((r,{query:e})=>{let{to:t}=r.state.selection.main,i=e.nextMatch(r.state,t,t);if(!i)return!1;let n=E.single(i.from,i.to),s=r.state.facet(Nn);return r.dispatch({selection:n,effects:[Zp(r,i),s.scrollToMatch(n.main,r)],userEvent:"select.search"}),Ly(r),!0}),Ed=Ta((r,{query:e})=>{let{state:t}=r,{from:i}=t.selection.main,n=e.prevMatch(t,i,i);if(!n)
Line truncated
|
|
|
|
|
`+t.scrub(),s=this.advance(n);return s>-1&&s<n.length?this.complete(e,i,s):!1}finish(e,t){return(this.stage==2||this.stage==3)&&_a(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,i){return e.addLeafElement(t,_e(B.LinkReference,this.start,this.start+i,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(Av(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(_e(B.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(Rv(e,_a(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=_a(e,this.pos),i=0;if(t>this.pos){let n=Cv(e,t,this.start);if(n){let s=om(e,n.to-this.start);s>0&&(this.nextStage(n),i=s)}}return i||(i=om(e,this.pos)),i>0&&i<e.length?i:-1}else return om(e,this.pos)}}};function om(r,e){for(;e<r.length;e++){let t=r.charCodeAt(e);if(t==10)break;if(!Rr(t))return-1}return e}var fm=class{nextLine(e,t,i){let n=t.depth<e.stack.length?-1:yv(t),s=t.next;if(n<0)return!1;let o=_e(B.HeaderMark,e.lineStart+t.pos,e.lineStart+n);return e.nextLine(),e.addLeafElement(i,_e(s==61?B.SetextHeading1:B.SetextHeading2,i.start,e.prevLineEnd(),[...e.parser.parseInline(i.content,i.start),o])),!0}finish(){return!1}},$v={LinkReference(r,e){return e.content.charCodeAt(0)==91?new um(e):null},SetextHeading(){return new fm}},gA=[(r,e)=>Sv(e)>=0,(r,e)=>bv(e)>=0,(r,e)=>xv(e)>=0,(r,e)=>wm(e,r,!0)>=0,(r,e)=>Sm(e,r,!0)>=0,(r,e)=>xm(e,r,!0)>=0,(r,e)=>Pv(e,r,!0)>=0],bA={text:"",end:0},Om=class{constructor(e,t,i,n){this.parser=e,this.input=t,this.ranges=n,this.line=new cm,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=n[n.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=n[0].from,this.block=Ld.create(B.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=i.length?new gm(i,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 i=0;;){let n=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;i<e.markers.length&&(!n||e.markers[i].from<n.end);){let s=e.markers[i++];this.addNode(s.type,s.from,s.to)}if(!n)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 i of this.parser.blockParsers)if(i){let n=i(this,e);if(n!=!1){if(n==!0)return null;e.forward();continue e}}break}if(e.pos==e.text.length)return this.nextLine()?null:this.finish();let t=new lm(this.lineStart+e.pos,e.text.slice(e.pos));for(let i of this.parser.leafBlockParsers)if(i){let n=i(this,t);n&&t.parsers.push(n)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let i of this.parser.endLeafBlock)if(i(this,e,t))break e}for(let i of t.parsers)if(i.nextLine(this,e,t))return null;t.content+=`
|
|
|
|
|
`+e.scrub();for(let i of e.markers)t.marks.push(i)}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=Ev(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=bA;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 i=this.absoluteLineStart,n=this.rangeI;for(;this.ranges[n].to<t.end;){n++;let s=this.ranges[n].from,o=this.lineChunkAt(s);t.end=s+o.length,t.text=t.text.slice(0,this.ranges[n-1].to-i)+o,i=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:i}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=i,e.reset(t);e.depth<this.stack.length;e.depth++){let n=this.stack[e.depth],s=this.parser.skipContextMarkup[n.type];if(!s)throw new Error("Unhandled block context "+B[n.type]);let o=this.line.markers.length;if(!s(n,this,e)){this.line.markers.length>o&&(n.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),i;if(this.input.lineChunks)i=t==`
|
|
|
|
|
`?"":t;else{let n=t.indexOf(`
|
|
|
|
|
`);i=n<0?t:t.slice(0,n)}return e+i.length>this.to?i.slice(0,this.to-e):i}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,i=0){this.block=Ld.create(e,i,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,i=0){this.startContext(this.parser.getNodeType(e),t,i)}addNode(e,t,i){typeof e=="number"&&(e=new we(this.parser.nodeSet.types[e],no,no,(i!=null?i: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(mm(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?$v(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let i of e.parsers)if(i.finish(this,e))return;let t=mm(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(B.Paragraph,e.content.length),e.start)}elt(e,t,i,n){return typeof e=="string"?_e(this.parser.getNodeType(e),t,i,n):new Wd(e,t)}get buffer(){return new Yd(this.parser.nodeSet)}};function $v(r,e,t,i,n){let s=r[e].to,o=[],a=[],l=t.from+i;function c(d,h){for(;h?d>=s:d>s;){let u=r[e+1].from-s;i+=u,d+=u,e++,s=r[e].to}}for(let d=t.firstChild;d;d=d.nextSibling){c(d.from+i,!0);let h=d.from+i,u,f=n.get(d.tree);f?u=f:d.to+i>s?(u=$v(r,e,d,i,n),c(d.to+i,!1)):u=d.toTree(),o.push(u),a.push(h-l)}return c(t.to+i,!1),new we(t.type,o,a,t.to+i-l,t.tree?t.tree.propValues:void 0)}var Ca=class r extends Qi{constructor(e,t,i,n,s,o,a,l,c){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=i,this.blockNames=n,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,i){let n=new Om(this,e,t,i);for(let s of this.wrappers)n=s(n,e,t,i);return n}configure(e){let t=pm(e);if(!t)return this;let{nodeSet:i,skipContextMarkup:n}=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(Xa(t.defineNodes)){n=Object.assign({},n);let u=i.types.slice(),f;for(let p of t.defineNodes){let{name:m,block:S,composite:v,style:A}=typeof p=="string"?{name:p}:p;if(u.some(T=>T.name==m))continue;v&&(n[u.length]=(T,P,C)=>v(P,C,T.value));let R=u.length,U=v?["Block","BlockContext"]:S?R>=B.ATXHeading1&&R<=B.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;u.push(rt.define({id:R,name:m,props:U&&[[ue.group,U]]})),A&&(f||(f={}),Array.isArray(A)||A instanceof lr?f[m]=A:Object.assign(f,A))}i=new yi(u),f&&(i=i.extend(St(f)))}if(Xa(t.props)&&(i=i.extend(...t.props)),Xa(t.remove))for(let u of t.remove){let f=this.blockNames.indexOf(u),p=this.inlineNames.indexOf(u);f>-1&&(s[f]=o[f]=void 0),p>-1&&(l[p]=void 0)}if(Xa(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 p=u.before?Md(a,u.before):u.after?Md(a,u.after)+1:a.length-1;s.splice(p,0,u.parse),o.splice(p,0,u.leaf),a.splice(p,0,u.name)}u.endLeaf&&d.push(u.endLeaf)}if(Xa(t.parseInline))for(let u of t.parseInline){let f=c.indexOf(u.name);if(f>-1)l[f]=u.parse;else{let p=u.before?Md(c,u.before):u.after?Md(c,u.after)+1:c.length-1;l.splice(p,0,u.parse),c.splice(p,0,u.name)}}return t.wrap&&(h=h.concat(t.wrap)),new r(i,s,o,a,d,n,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 i=new Ea(this,e,t);e:for(let n=t;n<i.end;){let s=i.char(n);for(let o of this.inlineParsers)if(o){let a=o(i,s,n);if(a>=0){n=a;continue e}}n++}return i.resolveMarkers(0)}};function Xa(r){return r!=null&&r.length>0}function pm(r){if(!Array.isArray(r))return r;if(r.length==0)return null;let e=pm(r[0]);if(r.length==1)return e;let t=pm(r.slice(1));if(!t||!e)return e||t;let i=(o,a)=>(o||no).concat(a||no),n=e.wrap,s=t.wrap;return{props:i(e.props,t.props),defineNodes:i(e.defineNodes,t.defineNodes),parseBlock:i(e.parseBlock,t.parseBlock),parseInline:i(e.parseInline,t.parseInline),remove:i(e.remove,t.remove),wrap:n?s?(o,a,l,c)=>n(s(o,a,l,c),a,l,c):n:s}}function Md(r,e){let t=r.indexOf(e);if(t<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return t}var kv=[rt.none];for(let r=1,e;e=B[r];r++)kv[r]=rt.define({id:r,name:e,props:r>=B.Escape?[]:[[ue.group,r in mv?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});var no=[],Yd=class{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,t,i,
Line truncated
|
|
|
|
|
`;)s--;this.fragmentEnd=s?s-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let n=e+this.fragment.offset;for(;i.to<=n;)if(!i.parent())return!1;for(;;){if(i.from>=n)return this.fragment.from<=t;if(!i.childAfter(n))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(ue.contextHash)==e}takeNodes(e){let t=this.cursor,i=this.fragment.offset,n=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-i>n){if(t.type.isAnonymous&&t.firstChild())continue;break}let d=Av(t.from-i,e.ranges);if(t.to-i<=e.ranges[e.rangeI].to)e.addNode(t.tree,d);else{let h=new we(e.parser.nodeSet.types[B.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(h,t.tree),e.addNode(h,d)}if(t.type.is("Block")&&(xA.indexOf(t.type.id)<0?(o=t.to-i,a=e.block.children.length):(o=l,a=c),l=t.to-i,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 Av(r,e){let t=r;for(let i=1;i<e.length;i++){let n=e[i-1].to,s=e[i].from;n<r&&(t-=s-n)}return t}var wA=St({"Blockquote/...":O.quote,HorizontalRule:O.contentSeparator,"ATXHeading1/... SetextHeading1/...":O.heading1,"ATXHeading2/... SetextHeading2/...":O.heading2,"ATXHeading3/...":O.heading3,"ATXHeading4/...":O.heading4,"ATXHeading5/...":O.heading5,"ATXHeading6/...":O.heading6,"Comment CommentBlock":O.comment,Escape:O.escape,Entity:O.character,"Emphasis/...":O.emphasis,"StrongEmphasis/...":O.strong,"Link/... Image/...":O.link,"OrderedList/... BulletList/...":O.list,"BlockQuote/...":O.quote,"InlineCode CodeText":O.monospace,"URL Autolink":O.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":O.processingInstruction,"CodeInfo LinkLabel":O.labelName,LinkTitle:O.string,Paragraph:O.content}),Ev=new Ca(new yi(kv).extend(wA),Object.keys(zd).map(r=>zd[r]),Object.keys(zd).map(r=>Pv[r]),Object.keys(zd),mA,mv,Object.keys(am).map(r=>am[r]),Object.keys(am),[]);function SA(r,e,t){let i=[];for(let n=r.firstChild,s=e;;n=n.nextSibling){let o=n?n.from:t;if(o>s&&i.push({from:s,to:o}),!n)break;s=n.to}return i}function Zv(r){let{codeParser:e,htmlParser:t}=r;return{wrap:Vc((n,s)=>{let o=n.type.id;if(e&&(o==B.CodeBlock||o==B.FencedCode)){let a="";if(o==B.FencedCode){let c=n.node.getChild(B.CodeInfo);c&&(a=s.read(c.from,c.to))}let l=e(a);if(l)return{parser:l,overlay:c=>c.type.id==B.CodeText,bracketed:o==B.FencedCode}}else if(t&&(o==B.HTMLBlock||o==B.HTMLTag||o==B.CommentBlock))return{parser:t,overlay:SA(n.node,n.from,n.to)};return null})}}var yA={resolve:"Strikethrough",mark:"StrikethroughMark"},vA={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":O.strikethrough}},{name:"StrikethroughMark",style:O.processingInstruction}],parseInline:[{name:"Strikethrough",parse(r,e,t){if(e!=126||r.char(t+1)!=126||r.char(t+2)==126)return-1;let i=r.slice(t-1,t),n=r.slice(t+2,t+3),s=/\s|^$/.test(i),o=/\s|^$/.test(n),a=Aa.test(i),l=Aa.test(n);return r.addDelimiter(yA,t,t+2,!o&&(!l||s||a),!s&&(!a||o||l))},after:"Emphasis"}]};function Ra(r,e,t=0,i,n=0){let s=0,o=!0,a=-1,l=-1,c=!1,d=()=>{i.push(r.elt("TableCell",n+a,n+l,r.parser.parseInline(e.slice(a,l),n+a)))};for(let h=t;h<e.length;h++){let u=e.charCodeAt(h);u==124&&!c?((!o||a>-1)&&s++,o=!1,i&&(a>-1&&d(),i.push(r.elt("TableDelimiter",h+n,h+n+1))),a=l=-1):(c||u!=32&&u!=9)&&(a<0&&(a=h),l=h+1),c=!c&&u==92}return a>-1&&(s++,i&&d()),s}function cv(r,e){for(let t=e;t<r.length;t++){let i=r.charCodeAt(t);if(i==124)return!0;i==92&&t++}return!1}var Uv=/^[>\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,jd=class{constructor(){this.rows=null}nextLine(e,t,i){if(this.rows==null){this.rows=!1;let n;if((t.next==45||t.next==58||t.next==124)&&Uv.test(n=t.text.slice(t.pos))){let s=[];Ra(e,i.content,0,s,i.start)==Ra(e,n,0)&&(this.rows=[e.elt("TableHeader",i.start,i.start+i.content.length,s),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let n=[];Ra(e,t.text,t.pos,n,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+t.pos,e.lineStart+t.text.length,n))}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}},QA={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":O.heading}},"TableRow",{name:"TableCell",style:O.content},{name:"TableDelimiter",style:O.processingInstruction}],parseBlock:[{name:"Table",leaf(r,e){return cv(e.content,0)?new jd:null},endLeaf(r,e,t){if(t.parsers.some(n=>n instanceof jd)||!cv(e.text,e.basePos))return!1;let i=r.peekLine();return Uv.test(i)&&Ra(r,e.text,e.basePos)==Ra(r,i,e.basePos)},before:"SetextHeading"}]},bm=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}},PA={defineNodes:[{name:"Task",block:!0,style:O.list},{name:"TaskMarker",style:O.atom}],parseBlock:[
Line truncated
|
|
|
|
|
`);i=n<0?t:t.slice(0,n)}return e+i.length>this.to?i.slice(0,this.to-e):i}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,i=0){this.block=Ld.create(e,i,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,i=0){this.startContext(this.parser.getNodeType(e),t,i)}addNode(e,t,i){typeof e=="number"&&(e=new we(this.parser.nodeSet.types[e],no,no,(i!=null?i: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(mm(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?kv(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let i of e.parsers)if(i.finish(this,e))return;let t=mm(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(B.Paragraph,e.content.length),e.start)}elt(e,t,i,n){return typeof e=="string"?_e(this.parser.getNodeType(e),t,i,n):new Wd(e,t)}get buffer(){return new Yd(this.parser.nodeSet)}};function kv(r,e,t,i,n){let s=r[e].to,o=[],a=[],l=t.from+i;function c(d,h){for(;h?d>=s:d>s;){let u=r[e+1].from-s;i+=u,d+=u,e++,s=r[e].to}}for(let d=t.firstChild;d;d=d.nextSibling){c(d.from+i,!0);let h=d.from+i,u,f=n.get(d.tree);f?u=f:d.to+i>s?(u=kv(r,e,d,i,n),c(d.to+i,!1)):u=d.toTree(),o.push(u),a.push(h-l)}return c(t.to+i,!1),new we(t.type,o,a,t.to+i-l,t.tree?t.tree.propValues:void 0)}var Ca=class r extends Qi{constructor(e,t,i,n,s,o,a,l,c){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=i,this.blockNames=n,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,i){let n=new Om(this,e,t,i);for(let s of this.wrappers)n=s(n,e,t,i);return n}configure(e){let t=pm(e);if(!t)return this;let{nodeSet:i,skipContextMarkup:n}=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(Xa(t.defineNodes)){n=Object.assign({},n);let u=i.types.slice(),f;for(let p of t.defineNodes){let{name:m,block:w,composite:v,style:A}=typeof p=="string"?{name:p}:p;if(u.some(T=>T.name==m))continue;v&&(n[u.length]=(T,P,C)=>v(P,C,T.value));let R=u.length,U=v?["Block","BlockContext"]:w?R>=B.ATXHeading1&&R<=B.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;u.push(rt.define({id:R,name:m,props:U&&[[ue.group,U]]})),A&&(f||(f={}),Array.isArray(A)||A instanceof lr?f[m]=A:Object.assign(f,A))}i=new yi(u),f&&(i=i.extend(St(f)))}if(Xa(t.props)&&(i=i.extend(...t.props)),Xa(t.remove))for(let u of t.remove){let f=this.blockNames.indexOf(u),p=this.inlineNames.indexOf(u);f>-1&&(s[f]=o[f]=void 0),p>-1&&(l[p]=void 0)}if(Xa(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 p=u.before?Md(a,u.before):u.after?Md(a,u.after)+1:a.length-1;s.splice(p,0,u.parse),o.splice(p,0,u.leaf),a.splice(p,0,u.name)}u.endLeaf&&d.push(u.endLeaf)}if(Xa(t.parseInline))for(let u of t.parseInline){let f=c.indexOf(u.name);if(f>-1)l[f]=u.parse;else{let p=u.before?Md(c,u.before):u.after?Md(c,u.after)+1:c.length-1;l.splice(p,0,u.parse),c.splice(p,0,u.name)}}return t.wrap&&(h=h.concat(t.wrap)),new r(i,s,o,a,d,n,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 i=new Ea(this,e,t);e:for(let n=t;n<i.end;){let s=i.char(n);for(let o of this.inlineParsers)if(o){let a=o(i,s,n);if(a>=0){n=a;continue e}}n++}return i.resolveMarkers(0)}};function Xa(r){return r!=null&&r.length>0}function pm(r){if(!Array.isArray(r))return r;if(r.length==0)return null;let e=pm(r[0]);if(r.length==1)return e;let t=pm(r.slice(1));if(!t||!e)return e||t;let i=(o,a)=>(o||no).concat(a||no),n=e.wrap,s=t.wrap;return{props:i(e.props,t.props),defineNodes:i(e.defineNodes,t.defineNodes),parseBlock:i(e.parseBlock,t.parseBlock),parseInline:i(e.parseInline,t.parseInline),remove:i(e.remove,t.remove),wrap:n?s?(o,a,l,c)=>n(s(o,a,l,c),a,l,c):n:s}}function Md(r,e){let t=r.indexOf(e);if(t<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return t}var Tv=[rt.none];for(let r=1,e;e=B[r];r++)Tv[r]=rt.define({id:r,name:e,props:r>=B.Escape?[]:[[ue.group,r in gv?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});var no=[],Yd=class{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,t,i,
Line truncated
|
|
|
|
|
`;)s--;this.fragmentEnd=s?s-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let n=e+this.fragment.offset;for(;i.to<=n;)if(!i.parent())return!1;for(;;){if(i.from>=n)return this.fragment.from<=t;if(!i.childAfter(n))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(ue.contextHash)==e}takeNodes(e){let t=this.cursor,i=this.fragment.offset,n=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-i>n){if(t.type.isAnonymous&&t.firstChild())continue;break}let d=Ev(t.from-i,e.ranges);if(t.to-i<=e.ranges[e.rangeI].to)e.addNode(t.tree,d);else{let h=new we(e.parser.nodeSet.types[B.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(h,t.tree),e.addNode(h,d)}if(t.type.is("Block")&&(wA.indexOf(t.type.id)<0?(o=t.to-i,a=e.block.children.length):(o=l,a=c),l=t.to-i,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 Ev(r,e){let t=r;for(let i=1;i<e.length;i++){let n=e[i-1].to,s=e[i].from;n<r&&(t-=s-n)}return t}var SA=St({"Blockquote/...":O.quote,HorizontalRule:O.contentSeparator,"ATXHeading1/... SetextHeading1/...":O.heading1,"ATXHeading2/... SetextHeading2/...":O.heading2,"ATXHeading3/...":O.heading3,"ATXHeading4/...":O.heading4,"ATXHeading5/...":O.heading5,"ATXHeading6/...":O.heading6,"Comment CommentBlock":O.comment,Escape:O.escape,Entity:O.character,"Emphasis/...":O.emphasis,"StrongEmphasis/...":O.strong,"Link/... Image/...":O.link,"OrderedList/... BulletList/...":O.list,"BlockQuote/...":O.quote,"InlineCode CodeText":O.monospace,"URL Autolink":O.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":O.processingInstruction,"CodeInfo LinkLabel":O.labelName,LinkTitle:O.string,Paragraph:O.content}),Zv=new Ca(new yi(Tv).extend(SA),Object.keys(zd).map(r=>zd[r]),Object.keys(zd).map(r=>$v[r]),Object.keys(zd),gA,gv,Object.keys(am).map(r=>am[r]),Object.keys(am),[]);function yA(r,e,t){let i=[];for(let n=r.firstChild,s=e;;n=n.nextSibling){let o=n?n.from:t;if(o>s&&i.push({from:s,to:o}),!n)break;s=n.to}return i}function Uv(r){let{codeParser:e,htmlParser:t}=r;return{wrap:Vc((n,s)=>{let o=n.type.id;if(e&&(o==B.CodeBlock||o==B.FencedCode)){let a="";if(o==B.FencedCode){let c=n.node.getChild(B.CodeInfo);c&&(a=s.read(c.from,c.to))}let l=e(a);if(l)return{parser:l,overlay:c=>c.type.id==B.CodeText,bracketed:o==B.FencedCode}}else if(t&&(o==B.HTMLBlock||o==B.HTMLTag||o==B.CommentBlock))return{parser:t,overlay:yA(n.node,n.from,n.to)};return null})}}var vA={resolve:"Strikethrough",mark:"StrikethroughMark"},QA={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":O.strikethrough}},{name:"StrikethroughMark",style:O.processingInstruction}],parseInline:[{name:"Strikethrough",parse(r,e,t){if(e!=126||r.char(t+1)!=126||r.char(t+2)==126)return-1;let i=r.slice(t-1,t),n=r.slice(t+2,t+3),s=/\s|^$/.test(i),o=/\s|^$/.test(n),a=Aa.test(i),l=Aa.test(n);return r.addDelimiter(vA,t,t+2,!o&&(!l||s||a),!s&&(!a||o||l))},after:"Emphasis"}]};function Ra(r,e,t=0,i,n=0){let s=0,o=!0,a=-1,l=-1,c=!1,d=()=>{i.push(r.elt("TableCell",n+a,n+l,r.parser.parseInline(e.slice(a,l),n+a)))};for(let h=t;h<e.length;h++){let u=e.charCodeAt(h);u==124&&!c?((!o||a>-1)&&s++,o=!1,i&&(a>-1&&d(),i.push(r.elt("TableDelimiter",h+n,h+n+1))),a=l=-1):(c||u!=32&&u!=9)&&(a<0&&(a=h),l=h+1),c=!c&&u==92}return a>-1&&(s++,i&&d()),s}function dv(r,e){for(let t=e;t<r.length;t++){let i=r.charCodeAt(t);if(i==124)return!0;i==92&&t++}return!1}var zv=/^[>\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,jd=class{constructor(){this.rows=null}nextLine(e,t,i){if(this.rows==null){this.rows=!1;let n;if((t.next==45||t.next==58||t.next==124)&&zv.test(n=t.text.slice(t.pos))){let s=[];Ra(e,i.content,0,s,i.start)==Ra(e,n,0)&&(this.rows=[e.elt("TableHeader",i.start,i.start+i.content.length,s),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let n=[];Ra(e,t.text,t.pos,n,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+t.pos,e.lineStart+t.text.length,n))}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}},PA={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":O.heading}},"TableRow",{name:"TableCell",style:O.content},{name:"TableDelimiter",style:O.processingInstruction}],parseBlock:[{name:"Table",leaf(r,e){return dv(e.content,0)?new jd:null},endLeaf(r,e,t){if(t.parsers.some(n=>n instanceof jd)||!dv(e.text,e.basePos))return!1;let i=r.peekLine();return zv.test(i)&&Ra(r,e.text,e.basePos)==Ra(r,i,e.basePos)},before:"SetextHeading"}]},bm=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}},$A={defineNodes:[{name:"Task",block:!0,style:O.list},{name:"TaskMarker",style:O.atom}],parseBlock:[
Line truncated
|
|
|
|
|
\${}
|
|
|
|
|
} catch (\${error}) {
|
|
|
|
|
\${}
|
|
|
|
@@ -57,35 +57,36 @@ Connect your audio output to the SuperCharger input, turn up the volume, and pla
|
|
|
|
|
constructor(\${params}) {
|
|
|
|
|
\${}
|
|
|
|
|
}
|
|
|
|
|
}`,{label:"class",detail:"definition",type:"keyword"}),Yt('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Yt('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],yZ=QQ.concat([Yt("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Yt("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Yt("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),SQ=new Vs,PQ=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function za(r){return(e,t)=>{let i=e.node.getChild("VariableDefinition");return i&&t(i,r),!0}}var vZ=["FunctionDeclaration"],QZ={FunctionDeclaration:za("function"),ClassDeclaration:za("class"),ClassExpression:()=>!0,EnumDeclaration:za("constant"),TypeAliasDeclaration:za("type"),NamespaceDeclaration:za("namespace"),VariableDefinition(r,e){r.matchContext(vZ)||e(r,"variable")},TypeDefinition(r,e){e(r,"type")},__proto__:null};function $Q(r,e){let t=SQ.get(e);if(t)return t;let i=[],n=!0;function s(o,a){let l=r.sliceString(o.from,o.to);i.push({label:l,type:a})}return e.cursor(Xe.IncludeAnonymous).iterate(o=>{if(n)n=!1;else if(o.name){let a=QZ[o.name];if(a&&a(o,s)||PQ.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of $Q(r,o.node))i.push(a);return!1}}),SQ.set(e,i),i}var yQ=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,kQ=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function PZ(r){let e=Te(r.state).resolveInner(r.pos,-1);if(kQ.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&yQ.test(r.state.sliceDoc(e.from,e.to));if(!t&&!r.explicit)return null;let i=[];for(let n=e;n;n=n.parent)PQ.has(n.name)&&(i=i.concat($Q(r.state.doc,n)));return{options:i,from:t?e.from:r.pos,validFor:yQ}}var Gr=yt.define({name:"javascript",parser:wQ.configure({props:[kr.add({IfStatement:hi({except:/^\s*({|else\b)/}),TryStatement:hi({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Jc,SwitchBody:r=>{let e=r.textAfter,t=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return r.baseIndent+(t?0:i?1:2)*r.unit},Block:Kc({closing:"}"}),ArrowFunction:r=>r.baseIndent+r.unit,"TemplateString BlockComment":()=>null,"Statement Property":hi({except:/^\s*{/}),JSXElement(r){let e=/^\s*<\//.test(r.textAfter);return r.lineIndent(r.node.from)+(e?0:r.unit)},JSXEscape(r){let e=/\s*\}/.test(r.textAfter);return r.lineIndent(r.node.from)+(e?0:r.unit)},"JSXOpenTag JSXSelfClosingTag"(r){return r.column(r.node.from)+r.unit}}),_t.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Tr,BlockComment(r){return{from:r.from+2,to:r.to-2}},JSXElement(r){let e=r.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let t=r.lastChild;return{from:e.to,to:t.type.isError?r.to:t.from}},"JSXSelfClosingTag JSXOpenTag"(r){var e;let t=(e=r.firstChild)===null||e===void 0?void 0:e.nextSibling,i=r.lastChild;return!t||t.type.isError?null:{from:t.to,to:i.type.isError?r.to:i.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),TQ={test:r=>/^JSX/.test(r.name),facet:js({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Um=Gr.configure({dialect:"ts"},"typescript"),zm=Gr.configure({dialect:"jsx",props:[Gc.add(r=>r.isTop?[TQ]:void 0)]}),Mm=Gr.configure({dialect:"jsx ts",props:[Gc.add(r=>r.isTop?[TQ]:void 0)]},"typescript"),XQ=r=>({label:r,type:"keyword"}),_Q="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(XQ),$Z=_Q.concat(["declare","implements","private","protected","public"].map(XQ));function RQ(r={}){let e=r.jsx?r.typescript?Mm:zm:r.typescript?Um:Gr,t=r.typescript?yZ.concat($Z):QQ.concat(_Q);return new Ze(e,[Gr.data.of({autocomplete:Cw(kQ,Rw(t))}),Gr.data.of({autocomplete:PZ}),r.jsx?XZ:[]])}function kZ(r){for(;;){if(r.name=="JSXOpenTag"||r.name=="JSXSelfClosingTag"||r.name=="JSXFragmentTag")return r;if(r.name=="JSXEscape"||!r.parent)return null;r=r.parent}}function vQ(r,e,t=r.length){for(let i=e==null?void 0:e.firstChild;i;i=i.nextSibling)if(i.name=="JSXIdentifier"||i.name=="JSXBuiltin"||i.name=="JSXNamespacedName"||i.name=="JSXMemberExpression")return r.sliceString(i.from,Math.min(i.to,t));return""}var TZ=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),XZ=W.inputHandler.of((r,e,t,i,n)=>{if((TZ?r.composing:r.compositionStarted)||r.state.readOnly||e!=t||i!=">"&&i!="/"||!Gr.isActiveAt(r.state,e,-1))return!1;let s=n(),{state:o}=s,a=o.changeByRange(l=>{var c;let{head:d}=l,h=Te(o).resol
Line truncated
|
|
|
|
|
`);for(let l of a){s1.lastIndex=0;let c=s1.exec(l);if(c){let d=o+c.index+c[0].length;t.push(F.widget({widget:new Jm(c[0],e),side:-1}).range(d))}o+=l.length+1}}return F.set(t,!0)}function a1(r){let e;function t(i){let n=e.posAtDOM(i);r(e.state.doc.lineAt(n).number)}return We.fromClass(class{constructor(i){e=i,this.decorations=o1(i,t)}update(i){e=i.view,(i.docChanged||i.viewportChanged)&&(this.decorations=o1(i.view,t))}},{decorations:i=>i.decorations})}var eg=class extends dt{constructor(t,i,n){super();this.filename=t;this.system=i;this.handleClick=n}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",i=>{i.preventDefault(),i.stopPropagation(),this.handleClick(this.filename,this.system)}),t}eq(t){return this.filename===t.filename&&this.system===t.system}ignoreEvent(){return!1}};function cU(r,e,t){let i=[],n=r.state.doc,s=new Set;for(let{from:o,to:a}of r.visibleRanges){let l=r.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,p=Math.min(o+h.index+h[0].length,n.length),m=n.lineAt(p),S=m.number+":"+f;s.has(S)||(s.add(S),i.push(F.widget({widget:new eg(f,!!d.system,t),side:1}).range(m.to)))}}}return F.set(i,!0)}function l1(r,e){function t(i){let n=r();return!n||!n.length?F.none:cU(i,n,e)}return We.fromClass(class{constructor(i){this.decorations=t(i)}update(i){(i.docChanged||i.viewportChanged)&&(this.decorations=t(i.view))}},{decorations:i=>i.decorations})}var oo=window.matchMedia&&window.matchMedia("only screen and (max-width: 760px)").matches;function Cr(r,e){var t=$(document.createElement("div"));return r&&t.appendTo(r),e&&t.addClass(e),t}function dU(r){return Qe.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input")||!r.input)return e;let t=[],i=!1;if(e.changes.iterChanges((o,a,l,c,d)=>{let h=d.toString(),u=r.input(h);t.push({from:o,to:a,insert:u}),u!==h&&(i=!0)}),!i)return e;let n=e.annotation(Be.userEvent),s=e.annotation(Be.addToHistory);return{changes:t,selection:e.selection,effects:e.effects,scrollIntoView:e.scrollIntoView,annotations:[...n!=null?[Be.userEvent.of(n)]:[],...s!=null?[Be.addToHistory.of(s)]:[]]}})}var tg=new xt;function c1(r){return tg.reconfigure(dU(r))}var d1=ce.define(),h1=ce.define(),u1=ce.define(),f1=ce.define(),O1=ce.define(),p1=ce.define(),m1=ce.define(),ig=ce.define(),g1=ce.define(),b1=ke.define({create(){return me.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(d1)){let i=t.value,n=[];for(let[s,o]of i.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;n.push(new Hd(be(o,4)).range(a))}r=me.of(n,!0)}return r}}),x1=ke.define({create(){return me.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(h1)){let i=t.value,n=[];for(let[s,o]of i.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;n.push(new Kd(o).range(a))}r=me.of(n,!0)}return r}}),w1=ke.define({create(){return me.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(u1)){let i=t.value,n=[];for(let[s,o]of i.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;n.push(new Jd(o).range(a))}r=me.of(n,!0)}return r}}),S1=ke.define({create(){return me.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(O1)){let i=[],n=t.value.filter(s=>s.line>=1&&s.line<=e.state.doc.lines).sort((s,o)=>s.line-o.line);for(let s of n){let o=e.state.doc.line(s.line).from;i.push((s.enabled?uU:fU).range(o))}r=me.of(i,!0)}return r}}),rg=ke.define({create(){return me.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(p1)){let i=t.value,n=[];for(let[s,o]of i.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;n.push(new th(s,o).range(a))}r=me.of(n,!0)}return r}}),y1=ke.define({create(){return me.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(m1))if(t.value===null)r=me.empty;else{let i=t.value;if(i>=1&&i<=e.state.doc.lines){let n=e.state.doc.line(i).from;r=me.of(v1.range(n))}}return r}}),Hd=class extends at{constructor(t){super();this.hex=t}toDOM(){let t=document.createElement("span");return t.textContent=this.hex,t.style.cursor="pointer",t.title="Click to run to here",t.addEventListener("mouseenter",()=>{t.style.textDecoration="underline"}),t.addEventListener("mouseleave",()=>{t.style.textDecoration="none"}),t}eq(t){return this.hex==t.hex}},Kd=class extends at{constructor(t){super();this.bytes=t}toDOM(){return document.createTextNode(this.bytes)}eq(t){return this.bytes==t.bytes}},Jd=class extends at{constructor(t){super();this.clock=t}toDOM(){return document.createTextNode(this.clock)}eq(t){return this.clock==t.clock}},hU=new class extends at{toDOM(){let r=document.createElement("span");return r.textContent="\u25CF",r.style.color="transparent",r.style.cursor="pointer",r.addE
Line truncated
|
|
|
|
|
}`,{label:"class",detail:"definition",type:"keyword"}),Yt('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Yt('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],vZ=PQ.concat([Yt("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Yt("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Yt("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),yQ=new Vs,$Q=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function za(r){return(e,t)=>{let i=e.node.getChild("VariableDefinition");return i&&t(i,r),!0}}var QZ=["FunctionDeclaration"],PZ={FunctionDeclaration:za("function"),ClassDeclaration:za("class"),ClassExpression:()=>!0,EnumDeclaration:za("constant"),TypeAliasDeclaration:za("type"),NamespaceDeclaration:za("namespace"),VariableDefinition(r,e){r.matchContext(QZ)||e(r,"variable")},TypeDefinition(r,e){e(r,"type")},__proto__:null};function kQ(r,e){let t=yQ.get(e);if(t)return t;let i=[],n=!0;function s(o,a){let l=r.sliceString(o.from,o.to);i.push({label:l,type:a})}return e.cursor(Xe.IncludeAnonymous).iterate(o=>{if(n)n=!1;else if(o.name){let a=PZ[o.name];if(a&&a(o,s)||$Q.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of kQ(r,o.node))i.push(a);return!1}}),yQ.set(e,i),i}var vQ=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,TQ=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function $Z(r){let e=Te(r.state).resolveInner(r.pos,-1);if(TQ.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&vQ.test(r.state.sliceDoc(e.from,e.to));if(!t&&!r.explicit)return null;let i=[];for(let n=e;n;n=n.parent)$Q.has(n.name)&&(i=i.concat(kQ(r.state.doc,n)));return{options:i,from:t?e.from:r.pos,validFor:vQ}}var Gr=yt.define({name:"javascript",parser:SQ.configure({props:[kr.add({IfStatement:hi({except:/^\s*({|else\b)/}),TryStatement:hi({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Jc,SwitchBody:r=>{let e=r.textAfter,t=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return r.baseIndent+(t?0:i?1:2)*r.unit},Block:Kc({closing:"}"}),ArrowFunction:r=>r.baseIndent+r.unit,"TemplateString BlockComment":()=>null,"Statement Property":hi({except:/^\s*{/}),JSXElement(r){let e=/^\s*<\//.test(r.textAfter);return r.lineIndent(r.node.from)+(e?0:r.unit)},JSXEscape(r){let e=/\s*\}/.test(r.textAfter);return r.lineIndent(r.node.from)+(e?0:r.unit)},"JSXOpenTag JSXSelfClosingTag"(r){return r.column(r.node.from)+r.unit}}),_t.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Tr,BlockComment(r){return{from:r.from+2,to:r.to-2}},JSXElement(r){let e=r.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let t=r.lastChild;return{from:e.to,to:t.type.isError?r.to:t.from}},"JSXSelfClosingTag JSXOpenTag"(r){var e;let t=(e=r.firstChild)===null||e===void 0?void 0:e.nextSibling,i=r.lastChild;return!t||t.type.isError?null:{from:t.to,to:i.type.isError?r.to:i.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),XQ={test:r=>/^JSX/.test(r.name),facet:js({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Um=Gr.configure({dialect:"ts"},"typescript"),zm=Gr.configure({dialect:"jsx",props:[Gc.add(r=>r.isTop?[XQ]:void 0)]}),Mm=Gr.configure({dialect:"jsx ts",props:[Gc.add(r=>r.isTop?[XQ]:void 0)]},"typescript"),_Q=r=>({label:r,type:"keyword"}),RQ="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(_Q),kZ=RQ.concat(["declare","implements","private","protected","public"].map(_Q));function CQ(r={}){let e=r.jsx?r.typescript?Mm:zm:r.typescript?Um:Gr,t=r.typescript?vZ.concat(kZ):PQ.concat(RQ);return new Ze(e,[Gr.data.of({autocomplete:Aw(TQ,Cw(t))}),Gr.data.of({autocomplete:$Z}),r.jsx?_Z:[]])}function TZ(r){for(;;){if(r.name=="JSXOpenTag"||r.name=="JSXSelfClosingTag"||r.name=="JSXFragmentTag")return r;if(r.name=="JSXEscape"||!r.parent)return null;r=r.parent}}function QQ(r,e,t=r.length){for(let i=e==null?void 0:e.firstChild;i;i=i.nextSibling)if(i.name=="JSXIdentifier"||i.name=="JSXBuiltin"||i.name=="JSXNamespacedName"||i.name=="JSXMemberExpression")return r.sliceString(i.from,Math.min(i.to,t));return""}var XZ=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),_Z=V.inputHandler.of((r,e,t,i,n)=>{if((XZ?r.composing:r.compositionStarted)||r.state.readOnly||e!=t||i!=">"&&i!="/"||!Gr.isActiveAt(r.state,e,-1))return!1;let s=n(),{state:o}=s,a=o.changeByRange(l=>{var c;let{head:d}=l,h=Te(o).resol
Line truncated
|
|
|
|
|
`);for(let l of a){o1.lastIndex=0;let c=o1.exec(l);if(c){let d=o+c.index+c[0].length;t.push(F.widget({widget:new Jm(c[0],e),side:-1}).range(d))}o+=l.length+1}}return F.set(t,!0)}function l1(r){let e;function t(i){let n=e.posAtDOM(i);r(e.state.doc.lineAt(n).number)}return We.fromClass(class{constructor(i){e=i,this.decorations=a1(i,t)}update(i){e=i.view,(i.docChanged||i.viewportChanged)&&(this.decorations=a1(i.view,t))}},{decorations:i=>i.decorations})}var eg=class extends dt{constructor(t,i,n){super();this.filename=t;this.system=i;this.handleClick=n}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",i=>{i.preventDefault(),i.stopPropagation(),this.handleClick(this.filename,this.system)}),t}eq(t){return this.filename===t.filename&&this.system===t.system}ignoreEvent(){return!1}};function dU(r,e,t){let i=[],n=r.state.doc,s=new Set;for(let{from:o,to:a}of r.visibleRanges){let l=r.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,p=Math.min(o+h.index+h[0].length,n.length),m=n.lineAt(p),w=m.number+":"+f;s.has(w)||(s.add(w),i.push(F.widget({widget:new eg(f,!!d.system,t),side:1}).range(m.to)))}}}return F.set(i,!0)}function c1(r,e){function t(i){let n=r();return!n||!n.length?F.none:dU(i,n,e)}return We.fromClass(class{constructor(i){this.decorations=t(i)}update(i){(i.docChanged||i.viewportChanged)&&(this.decorations=t(i.view))}},{decorations:i=>i.decorations})}var oo=window.matchMedia&&window.matchMedia("only screen and (max-width: 760px)").matches;function Cr(r,e){var t=$(document.createElement("div"));return r&&t.appendTo(r),e&&t.addClass(e),t}function hU(r){return Qe.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input")||!r.input)return e;let t=[],i=!1;if(e.changes.iterChanges((o,a,l,c,d)=>{let h=d.toString(),u=r.input(h);t.push({from:o,to:a,insert:u}),u!==h&&(i=!0)}),!i)return e;let n=e.annotation(Be.userEvent),s=e.annotation(Be.addToHistory);return{changes:t,selection:e.selection,effects:e.effects,scrollIntoView:e.scrollIntoView,annotations:[...n!=null?[Be.userEvent.of(n)]:[],...s!=null?[Be.addToHistory.of(s)]:[]]}})}var tg=new xt;function d1(r){return tg.reconfigure(hU(r))}var h1=ce.define(),u1=ce.define(),f1=ce.define(),O1=ce.define(),p1=ce.define(),m1=ce.define(),g1=ce.define(),ig=ce.define(),b1=ce.define(),x1=ke.define({create(){return me.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(h1)){let i=t.value,n=[];for(let[s,o]of i.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;n.push(new Hd(be(o,4)).range(a))}r=me.of(n,!0)}return r}}),w1=ke.define({create(){return me.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(u1)){let i=t.value,n=[];for(let[s,o]of i.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;n.push(new Kd(o).range(a))}r=me.of(n,!0)}return r}}),S1=ke.define({create(){return me.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(f1)){let i=t.value,n=[];for(let[s,o]of i.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;n.push(new Jd(o).range(a))}r=me.of(n,!0)}return r}}),y1=ke.define({create(){return me.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(p1)){let i=[],n=t.value.filter(s=>s.line>=1&&s.line<=e.state.doc.lines).sort((s,o)=>s.line-o.line);for(let s of n){let o=e.state.doc.line(s.line).from;i.push((s.enabled?fU:OU).range(o))}r=me.of(i,!0)}return r}}),rg=ke.define({create(){return me.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(m1)){let i=t.value,n=[];for(let[s,o]of i.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;n.push(new th(s,o).range(a))}r=me.of(n,!0)}return r}}),v1=ke.define({create(){return me.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(g1))if(t.value===null)r=me.empty;else{let i=t.value;if(i>=1&&i<=e.state.doc.lines){let n=e.state.doc.line(i).from;r=me.of(Q1.range(n))}}return r}}),Hd=class extends at{constructor(t){super();this.hex=t}toDOM(){let t=document.createElement("span");return t.textContent=this.hex,t.style.cursor="pointer",t.title="Click to run to here",t.addEventListener("mouseenter",()=>{t.style.textDecoration="underline"}),t.addEventListener("mouseleave",()=>{t.style.textDecoration="none"}),t}eq(t){return this.hex==t.hex}},Kd=class extends at{constructor(t){super();this.bytes=t}toDOM(){return document.createTextNode(this.bytes)}eq(t){return this.bytes==t.bytes}},Jd=class extends at{constructor(t){super();this.clock=t}toDOM(){return document.createTextNode(this.clock)}eq(t){return this.clock==t.clock}},uU=new class extends at{toDOM(){let r=document.createElement("span");return r.textContent="\u25CF",r.style.color="transparent",r.style.cursor="pointer",r.addE
Line truncated
|
|
|
|
|
color: #ff6666;
|
|
|
|
|
background-color: #330000;
|
|
|
|
|
padding: 4px 8px;
|
|
|
|
|
margin: 2px 0;
|
|
|
|
|
border-left: 3px solid #ff0000;
|
|
|
|
|
font-family: monospace;
|
|
|
|
|
`,t}},SU=ke.define({create(){return F.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(es.showMessage)){if(t.value===null||!t.value)return F.none;if(t.value.toggle){let i=[],n=new Map;return r.between(0,e.state.doc.length,(a,l,c)=>{try{let d=e.state.doc.lineAt(l).number;c.spec.widget instanceof Va&&n.set(d,c.spec.widget.message)}catch(d){}}),n.has(t.value.line)?n.delete(t.value.line):n.set(t.value.line,t.value.msg),Array.from(n.keys()).sort((a,l)=>a-l).forEach(a=>{try{let l=e.state.doc.line(a);i.push(F.widget({widget:new Va(n.get(a)),block:!0,side:1}).range(l.to))}catch(l){}}),F.set(i,!0)}}return r},provide:r=>W.decorations.from(r)}),ng=class extends dt{constructor(t){super();this.value=t}toDOM(){let t=document.createElement("div");return t.textContent=`${this.value}`,t.style.cssText=`
|
|
|
|
|
`,t}},yU=ke.define({create(){return F.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(es.showMessage)){if(t.value===null||!t.value)return F.none;if(t.value.toggle){let i=[],n=new Map;return r.between(0,e.state.doc.length,(a,l,c)=>{try{let d=e.state.doc.lineAt(l).number;c.spec.widget instanceof Va&&n.set(d,c.spec.widget.message)}catch(d){}}),n.has(t.value.line)?n.delete(t.value.line):n.set(t.value.line,t.value.msg),Array.from(n.keys()).sort((a,l)=>a-l).forEach(a=>{try{let l=e.state.doc.line(a);i.push(F.widget({widget:new Va(n.get(a)),block:!0,side:1}).range(l.to))}catch(l){}}),F.set(i,!0)}}return r},provide:r=>V.decorations.from(r)}),ng=class extends dt{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}},k1=ce.define(),yU=ke.define({create(){return F.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(k1)){if(t.value===null||!t.value)return F.none;let i=e.state.doc.lineAt(t.value.range.to);return F.set([F.widget({widget:new ng(t.value.val),block:!0,side:1}).range(i.to)])}return r},provide:r=>W.decorations.from(r)}),T1=ce.define(),vU=F.mark({attributes:{class:"cm-error-span"}}),QU=ke.define({create(){return F.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(T1)){if(t.value===null)return F.none;let i=[];for(let n of t.value)try{let s=e.state.doc.line(n.line),o=s.from+n.start,a=s.from+n.end;o>=s.from&&a<=s.to&&o<a&&i.push(vU.range(o,a))}catch(s){}return F.set(i,!0)}return r},provide:r=>W.decorations.from(r)}),X1=ce.define(),PU=F.line({attributes:{class:"highlight-lines"}}),$U=ke.define({create(){return F.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(X1)){if(t.value===null)return F.none;let{start:i,end:n}=t.value,s=[];for(let o=i;o<=n;o++)try{let a=e.state.doc.line(o);s.push(PU.range(a.from))}catch(a){}return F.set(s)}return r!==F.none&&(e.docChanged||e.selection)?F.none:r},provide:r=>W.decorations.from(r)}),_1={field:SU,widget:Va},ja={effect:P1,decoration:$1,field:wU},sh={effect:k1,field:yU},oh={effect:T1,field:QU},ah={effect:X1,field:$U},R1=ce.define(),kU=F.line({attributes:{class:"cm-traced-line"}}),TU=ke.define({create(){return F.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(R1)){let i=[];for(let n of t.value)try{let s=e.state.doc.line(n);i.push(kU.range(s.from))}catch(s){}return F.set(i,!0)}return r},provide:r=>W.decorations.from(r)}),lh={effect:R1,field:TU};var XU=[...wu(TS,xu),{key:"Mod-Shift-Backspace",run:tp}],E1=wu(Yy,xu),lo=64,Z1=ce.define(),U1=ce.define(),sg=ke.define({create(){return new Map},update(r,e){let t=r;for(let i of e.effects)if(i.is(U1))t=new Map;else if(i.is(Z1)){t===r&&(t=new Map(r));for(let n of i.value)t.set(n.id,{from:n.from,to:n.to})}if(!e.changes.empty){let i=new Map;for(let[n,s]of t)i.set(n,{from:e.changes.mapPos(s.from,-1),to:e.changes.mapPos(s.to,1)});return i}return t}}),_U=200,og={default:{theme:Nd},6502:{isAsm:!0},z80:{isAsm:!0},jsasm:{isAsm:!0},gas:{isAsm:!0},vasm:{isAsm:!0},inform6:{theme:Bd},dialog:{theme:Bd,lineWrap:!0},markdown:{lineWrap:!0},fastbasic:{noGutters:!0},basic:{noGutters:!0},ecs:{theme:Nd}},z1={input:null};function M1(r){z1.input=r?e=>e.toUpperCase():null}var Da=class Da{constructor(e,t){this.updateTimer=null;this.dirtylisting=!0;this.refreshDelayMsec=300;this.probe=null;this.path=e,this.mode=t}createDiv(e){var t=document.createElement("div");t.setAttribute("class","editor"),e.appendChild(t);var i=K.getFile(this.path),n=i&&this.mode=="verilog"&&/__asm\b([\s\S]+?)\b__endasm\b/.test(i);return this.newEditor(t,i,n),this.editor.dispatch({effects:c1(z1)}),this.syncBreakpoints(),K.getToolForFilename(this.path).startsWith("remote:")&&(this.refreshDelayMsec=1e3),t}setVisible(e){e?(this.editor.focus(),Da.tracingEnabled&&this.startTracing()):this.stopTracing()}getShortcuts(){if(!this.editor)return[];var e=this.editor,t=(i,n,s)=>({key:i,label:n,fn:()=>{s(e),e.focus()}});return[t("mod+f","Find",Ud),t("mod+g","Find Next",io),t("mod+d","Next Occurrence",Rp),t("mod+z","Undo",ma),t("mod+shift+z","Redo",qs)]}startTracing(){!this.probe&&w.startProbing&&(this.probe=w.startProbing(),this.probe.singleFrame=!1,this.probe.clear())}stopTracing(){this.probe&&(w.stopProbing(),this.probe=null),this.editor.dispatch({effects:lh.effect.of([])})}setTracingEnabled(e){Da.tracingEnabled=e,e?this.startTracing():this.stopTracing()}newEditor(e,t,i){var n=og[this.mode]||og.default,s=i||n.isAsm,o=!!n.lineWrap,a=n.theme||og.default.theme,l=n.useLineNumbers&&!oo;re.embed&&(l=!1,s=!1);let c=n.noGutters||oo;var d;let h=Bm[this.mode];h?d=h.language:(console.warn("Unknown mode: "+this.mode),d=null),this.editor=new W({parent:e,doc:t,extensions:[s?[]:$r.of(" "),s?UO.of((u,f)=>{let p=u.state.doc.lineAt(f).number;if(p>=0){let m=u.state.doc.line(p);if(m.text.trim())return u.lineIndent(m.from)}return 0}):[],...s?[Kt.of(ES(()=>Gs().tabsToSpaces))]:[],...MS(Gs()),Kt.of(XU),l?Uc():[],Kw(),Kt.of(tS),gw(),Tx(),Qe.allowMultipleSelections.of(!0),Cc(),fw(),yw(),Ec(),Zc(),Ac(),zx(),Zd(),Cp({top:!0}),Kt.of(E1),d||[],a,Nm,o?W.lineWrapping:[],ja.field,c?[]:[rh.field,rh.gutter],s&&!c?[Wa.field,Wa.gutter,ih.field,ih.gutter]:[],nh.field,Q1.gutter,W.updateListener.of(u=>{for(let f of u.transactions.flatMap(p=>p.effects))if(f.is(nh.requestToggle)&&vt.toggleSourceLine(this.path,f.value),f.is(ao.runToLine)){let p=f.value;if(this.sourcefile&&this.sourcefile.line2offset){let m=this.sourcefile.line2offset.get(p);m>=0&&qa([m])}}}),es.field,_1.field,oh.field,ao.field,ao.gutter,ah.field,lh.field,sg,a1(u=>{window.location.hash="asseteditor/"+encodeURIComponent(this.path)+"/"+u}),re.embed?[]:l1(()=>{var u=K&&K.getToolForFilename(this.path),f=K&&K.platform_id;return[...El(u,f),...Zl(u,f),...cb(u)]},(u,f)=>{if(!f){var p=L1(u);
Line truncated
|
|
|
|
|
`).length-1;this.editor.dispatch({changes:{from:n,insert:e}}),this.highlightLines(i-1,i+s-2)}highlightLines(e,t){let i=this.editor.state.doc.line(e+1);this.editor.dispatch({effects:[ah.effect.of({start:e+1,end:t+1}),W.scrollIntoView(i.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:[ah.effect.of({start:e,end:e}),W.scrollIntoView(t.from,{y:"center"})]}),this.editor.focus()}getValue(){return this.editor.state.doc.toString()}getPath(){return this.path}markErrors(e){this.clearErrors(),e=e.slice(0,_U);let t=new Map,i=[];for(var n of e)if(!n.path||this.path.endsWith(n.path)){var s=this.editor.state.doc.lines,o=n.line;(isNaN(o)||o<1||o>s)&&(o=1),t.set(o,n.msg),n.start!=null&&n.end!=null&&n.end>n.start&&i.push({line:o,start:n.start,end:n.end})}this.editor.dispatch({effects:[es.set.of(t),oh.effect.of(i.length>0?i:null)]})}clearErrors(){this.dirtylisting=!0,this.editor.dispatch({effects:[es.set.of(new Map),es.showMessage.of(null),oh.effect.of(null)]})}getSourceFile(){return this.sourcefile}updateListing(){this.clearErrors();var e=this.sourcefile.lines||[];let t=new Map,i=new Map,n=new Map;for(var s of e)if(s.offset>=0&&t.set(s.line,be(s.offset&65535,4)),s.insns){var o=s.insns.length>9?"...":s.insns;if(i.set(s.line,o),s.iscode){if(s.cycles)n.set(s.line,s.cycles+"");else if(w.getOpcodeMetadata){var a=parseInt(s.insns.split(" ")[0],16),l=w.getOpcodeMetadata(a,s.offset);if(l&&l.minCycles){var c=l.minCycles+"";n.set(s.line,c)}}}}this.editor.dispatch({effects:[rh.set.of(t),Wa.set.of(i),ih.set.of(n)]})}setTimingResult(e){if(this.sourcefile!=null){var t=new Map;for(let[o,a]of this.sourcefile.line2offset){let l=e.pc2clockrange[a];var i=l&&l.minclocks,n=l&&l.maxclocks;if(i>=0&&n>=0){var s;n==i?s=i+"":s=i+"-"+n,n==e.MAX_CLOCKS&&(s+="+"),t.set(o,s)}}this.editor.dispatch({effects:[Wa.set.of(t)]})}}setCurrentLine(e,t){var i=n=>{this.editor.dispatch({effects:[ao.set.of(n.line),ja.effect.of(n.line),...t?[W.scrollIntoView(this.editor.state.doc.line(n.line).from,{y:"center"})]:[]]})};if(this.clearCurrentLine(t),e){if(e.line<1||e.line>this.editor.state.doc.lines)return;if(i(e),t){let s=this.editor.state.doc.line(e.line).from+(e.start||0);this.editor.dispatch({selection:{anchor:s,head:s},effects:W.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:[ao.set.of(null),ja.effect.of(null)]})}getActiveLine(){if(this.sourcefile){var e=Qt&&Qt.c;if(!e&&w.getCPUState&&!w.isRunning()&&(e=w.getCPUState()),e){var t=e&&(e.EPC||e.PC),i=this.sourcefile.findLineForOffset(t,lo);return i}}}refreshDebugState(e){var t=this.getActiveLine();!e&&(t===this.currentDebugLine||!t&&!this.currentDebugLine)||this.setCurrentLine(t,e)}refreshListing(){var e=K.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 i=0;i<e.idx;i++){let n=e.buf[i];if((n&4278190080)===16777216){let s=this.sourcefile.findLineForOffset(n&65535,lo);s&&t.add(s.line)}}e.clear(),this.editor.dispatch({effects:lh.effect.of(Array.from(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(){ma(this.editor)}redoStep(){qs(this.editor)}syncBreakpoints(){let e=vt.getSourceBreakpointsForFile(this.path).map(t=>({line:t.line,enabled:t.enabled}));this.editor.dispatch({effects:nh.setAll.of(e)})}};Da.tracingEnabled=!1;var jt=Da,ag=1024,Xi=class{createDiv(e){var t=document.createElement("div");return t.setAttribute("class","editor"),e.appendChild(t),this.newEditor(t),t}newEditor(e){this.disasmview=new W({parent:e,extensions:[Ec(),Zc(),Qe.allowMultipleSelections.of(!0),Cc(),Ac(),Zd(),t1,Bd,ja.field,Qe.tabSize.of(8),Qe.readOnly.of(!0)]})}refresh(e,t){let i=Qt||w.saveState(),n=t!==void 0?t:i.c?i.c.PC:0,s=0,o=0,a=w.debugSymbols&&w.debugSymbols.addr2symbol||{},l=(h,u)=>{let f="",p=0;for(;p<u;){let m=h+p|0,S=w.disassemble(m,w.readAddress.bind(w)),v="",A="";for(let T=0;T<S.nbytes;T++)v+=be(w.readAddress(m+T));for(;v.length<14;)v+=" ";let R=S.line;if(a&&S.isaddr&&(R=R.replace(/([^#])[$]([0-9A-F]+)/,(T,...P)=>{let C=parseInt(P[1],16),z=a[C];return z?P[0]+z:(z=a[C-1],z?P[0]+z+"+1":T)})),a){let T=a[m];T&&(A="; "+T)}let U=be(m,4)+" "+Ro(v,14)+" "+Ro(R
Line truncated
|
|
|
|
|
`;f+=U,m==n&&(o=s),s++,p+=S.nbytes||1}return f};var c=n<0?n-ag:Math.max(0,n-ag);let d=l(c,n-c)+l(n,ag);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:W.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=be(e,4),i=this.disasmview.state.doc;for(let n=1;n<=i.lines;n++){let s=i.line(n);if(s.text.startsWith(t+" "))return this.disasmview.dispatch({selection:{anchor:s.from,head:s.from+t.length},effects:W.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 n=this.disasmview.state.doc.line(t).text.trim().split(/\s+/);if(n&&n.length>=1){let s=parseInt(n[0],16);if(console.log("getCursorPC",s),s>=0)return s}}return-1}},ch=class extends Xi{constructor(e){super(),this.path=e}refreshListing(){var e=K.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}}),!!w.saveState){var i=Qt||w.saveState(),n=i.c?i.c.EPC||i.c.PC:0;if(n>=0&&this.assemblyfile){var s=this.assemblyfile.findLineForOffset(n,lo);if(s&&e){let o=this.disasmview.state.doc.line(s.line);this.disasmview.dispatch({selection:{anchor:o.from,head:o.from},effects:W.scrollIntoView(o.from,{y:"center"})})}}}}}goToAddress(e){this.refreshListing();let t=this.assemblyfile&&this.assemblyfile.findLineForOffset(e,lo);if(t){let i=this.disasmview.state.doc.line(t.line);this.disasmview.dispatch({selection:{anchor:i.from,head:i.from},effects:W.scrollIntoView(i.from,{y:"center"})})}this.disasmview.focus()}};function L1(r){let e=[r];try{var t=Co(K.mainPath);t.length>0&&t!="local"&&e.push(t+"/"+r)}catch(s){}for(var i of e){var n=K&&K.getFile(i);if(typeof n=="string")return i}return null}function C1(r){for(var e of db(r))if(e.editorStyle){var t=e1(e.editorStyle);if(t)return t}return null}var lg=new Map;function RU(r){let e=K.getToolForFilename(K.mainPath),t=zl(e,K.platform_id),i=Ul(e,K.platform_id);if(!t||!i.length)return Promise.resolve(null);let n=t+":"+r;return lg.has(n)||lg.set(n,(async()=>{var s=[...i.map(d=>d+"/"+r),r];for(var o of s){var a={preload_fs:t,readshared:o,updates:[],buildsteps:[]},l=await K.queryWorker(a),c=l&&l.output;if(c instanceof Uint8Array&&c.length>0)return new TextDecoder().decode(c)}return null})()),lg.get(n)}var dn=class{constructor(e){this.fn=e;this.languageCompartment=new xt}createDiv(e){var t=document.createElement("div");t.setAttribute("class","editor"),e.appendChild(t);var i=C1(this.fn||this.currentPath||"")||Pa();return this.view=new W({parent:t,extensions:[Ec(),Zc(),Qe.allowMultipleSelections.of(!0),Cc(),Ac(),Zd(),Cp({top:!0}),Kt.of(E1),this.languageCompartment.of(i),Nd,Nm,Qe.readOnly.of(!0)]}),this.refresh(!1),t}setVisible(e){e&&this.refresh(!1)}setHeaderText(e){var t=C1(this.currentPath||this.fn||"")||Pa();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 i=window.location.hash;if(!i||!i.startsWith("#headerview/"))return;t=this.fn=decodeURIComponent(i.substring(12))}this.loadIncludeFile(t)}async loadIncludeFile(e){this.requestedFn=e;var t=L1(e);if(t){this.currentPath=t,this.setHeaderText(K.getFile(t));return}var i=await RU(e);if(this.requestedFn===e){if(i!=null){this.currentPath=e,this.setHeaderText(i);return}this.currentPath=e,this.setHeaderText("// "+e+` was not found.
|
|
|
|
|
`,t.className="cm-line",t}},T1=ce.define(),vU=ke.define({create(){return F.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(T1)){if(t.value===null||!t.value)return F.none;let i=e.state.doc.lineAt(t.value.range.to);return F.set([F.widget({widget:new ng(t.value.val),block:!0,side:1}).range(i.to)])}return r},provide:r=>V.decorations.from(r)}),X1=ce.define(),QU=F.mark({attributes:{class:"cm-error-span"}}),PU=ke.define({create(){return F.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(X1)){if(t.value===null)return F.none;let i=[];for(let n of t.value)try{let s=e.state.doc.line(n.line),o=s.from+n.start,a=s.from+n.end;o>=s.from&&a<=s.to&&o<a&&i.push(QU.range(o,a))}catch(s){}return F.set(i,!0)}return r},provide:r=>V.decorations.from(r)}),_1=ce.define(),$U=F.line({attributes:{class:"highlight-lines"}}),kU=ke.define({create(){return F.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(_1)){if(t.value===null)return F.none;let{start:i,end:n}=t.value,s=[];for(let o=i;o<=n;o++)try{let a=e.state.doc.line(o);s.push($U.range(a.from))}catch(a){}return F.set(s)}return r!==F.none&&(e.docChanged||e.selection)?F.none:r},provide:r=>V.decorations.from(r)}),R1={field:yU,widget:Va},ja={effect:$1,decoration:k1,field:SU},sh={effect:T1,field:vU},oh={effect:X1,field:PU},ah={effect:_1,field:kU},C1=ce.define(),TU=F.line({attributes:{class:"cm-traced-line"}}),XU=ke.define({create(){return F.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(C1)){let i=[];for(let n of t.value)try{let s=e.state.doc.line(n);i.push(TU.range(s.from))}catch(s){}return F.set(i,!0)}return r},provide:r=>V.decorations.from(r)}),lh={effect:C1,field:XU};var _U=[...wu(XS,xu),{key:"Mod-Shift-Backspace",run:tp}],Z1=wu(Wy,xu),lo=64,U1=ce.define(),z1=ce.define(),sg=ke.define({create(){return new Map},update(r,e){let t=r;for(let i of e.effects)if(i.is(z1))t=new Map;else if(i.is(U1)){t===r&&(t=new Map(r));for(let n of i.value)t.set(n.id,{from:n.from,to:n.to})}if(!e.changes.empty){let i=new Map;for(let[n,s]of t)i.set(n,{from:e.changes.mapPos(s.from,-1),to:e.changes.mapPos(s.to,1)});return i}return t}}),RU=200,og={default:{theme:Nd},6502:{isAsm:!0},z80:{isAsm:!0},jsasm:{isAsm:!0},gas:{isAsm:!0},vasm:{isAsm:!0},inform6:{theme:Bd},dialog:{theme:Bd,lineWrap:!0},markdown:{lineWrap:!0},fastbasic:{noGutters:!0},basic:{noGutters:!0},ecs:{theme:Nd}},M1={input:null};function L1(r){M1.input=r?e=>e.toUpperCase():null}function cg(r){if(!r)return"";let e=r.state.selection.main;return e.empty?"":r.state.sliceDoc(e.from,e.to)}var Da=class Da{constructor(e,t){this.updateTimer=null;this.dirtylisting=!0;this.refreshDelayMsec=300;this.probe=null;this.path=e,this.mode=t}createDiv(e){var t=document.createElement("div");t.setAttribute("class","editor"),e.appendChild(t);var i=K.getFile(this.path),n=i&&this.mode=="verilog"&&/__asm\b([\s\S]+?)\b__endasm\b/.test(i);return this.newEditor(t,i,n),this.editor.dispatch({effects:d1(M1)}),this.syncBreakpoints(),K.getToolForFilename(this.path).startsWith("remote:")&&(this.refreshDelayMsec=1e3),t}setVisible(e){e?(this.editor.focus(),Da.tracingEnabled&&this.startTracing()):this.stopTracing()}getShortcuts(){if(!this.editor)return[];var e=this.editor,t=(i,n,s)=>({key:i,label:n,fn:()=>{s(e),e.focus()}});return[t("mod+f","Find",Ud),t("mod+g","Find Next",io),t("mod+d","Next Occurrence",Rp),t("mod+z","Undo",ma),t("mod+shift+z","Redo",qs)]}startTracing(){!this.probe&&S.startProbing&&(this.probe=S.startProbing(),this.probe.singleFrame=!1,this.probe.clear())}stopTracing(){this.probe&&(S.stopProbing(),this.probe=null),this.editor.dispatch({effects:lh.effect.of([])})}setTracingEnabled(e){Da.tracingEnabled=e,e?this.startTracing():this.stopTracing()}newEditor(e,t,i){var n=og[this.mode]||og.default,s=i||n.isAsm,o=!!n.lineWrap,a=n.theme||og.default.theme,l=n.useLineNumbers&&!oo;re.embed&&(l=!1,s=!1);let c=n.noGutters||oo;var d;let h=Bm[this.mode];h?d=h.language:(console.warn("Unknown mode: "+this.mode),d=null),this.editor=new V({parent:e,doc:t,extensions:[s?[]:$r.of(" "),s?UO.of((u,f)=>{let p=u.state.doc.lineAt(f).number;if(p>=0){let m=u.state.doc.line(p);if(m.text.trim())return u.lineIndent(m.from)}return 0}):[],...s?[Kt.of(ZS(()=>Gs().tabsToSpaces))]:[],...LS(Gs()),Kt.of(_U),l?Uc():[],Jw(),Kt.of(rS),bw(),Xx(),Qe.allowMultipleSelections.of(!0),Cc(),Ow(),vw(),Ec(),Zc(),Ac(),Mx(),Zd(),Cp({top:!0}),Kt.of(Z1),d||[],a,Nm,o?V.lineWrapping:[],ja.field,c?[]:[rh.field,rh.gutter],s&&!c?[Wa.field,Wa.gutter,ih.field,ih.gutter]:[],nh.field,P1.gutter,V.updateListener.of(u=>{for(let f of u.transactions.flatMap(p=>p.effects))if(f.is(nh.requestToggle)&&vt.toggleSourceLine(this.path,f.value),f.is(ao.runToLine)){let p=f.value;if(this.sourcefile&&this.sourcefile.line2offset){let m=this.sourcefile.line2offset.get(p);m>=0&&qa([m])}}}),es.field,R1.field,oh.field,ao.field,ao.gutter,ah.field,lh.field,sg,l1(u=>{window.location.hash="asseteditor/"+encodeURIComponent(this.path)+"/"+u}),re.embed?[]:c1(()=>{var u=K&&K.getToolFo
Line truncated
|
|
|
|
|
`).length-1;this.editor.dispatch({changes:{from:n,insert:e}}),this.highlightLines(i-1,i+s-2)}highlightLines(e,t){let i=this.editor.state.doc.line(e+1);this.editor.dispatch({effects:[ah.effect.of({start:e+1,end:t+1}),V.scrollIntoView(i.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:[ah.effect.of({start:e,end:e}),V.scrollIntoView(t.from,{y:"center"})]}),this.editor.focus()}getValue(){return this.editor.state.doc.toString()}getSelectionText(){return cg(this.editor)}getPath(){return this.path}markErrors(e){this.clearErrors(),e=e.slice(0,RU);let t=new Map,i=[];for(var n of e)if(!n.path||this.path.endsWith(n.path)){var s=this.editor.state.doc.lines,o=n.line;(isNaN(o)||o<1||o>s)&&(o=1),t.set(o,n.msg),n.start!=null&&n.end!=null&&n.end>n.start&&i.push({line:o,start:n.start,end:n.end})}this.editor.dispatch({effects:[es.set.of(t),oh.effect.of(i.length>0?i:null)]})}clearErrors(){this.dirtylisting=!0,this.editor.dispatch({effects:[es.set.of(new Map),es.showMessage.of(null),oh.effect.of(null)]})}getSourceFile(){return this.sourcefile}updateListing(){this.clearErrors();var e=this.sourcefile.lines||[];let t=new Map,i=new Map,n=new Map;for(var s of e)if(s.offset>=0&&t.set(s.line,be(s.offset&65535,4)),s.insns){var o=s.insns.length>9?"...":s.insns;if(i.set(s.line,o),s.iscode){if(s.cycles)n.set(s.line,s.cycles+"");else if(S.getOpcodeMetadata){var a=parseInt(s.insns.split(" ")[0],16),l=S.getOpcodeMetadata(a,s.offset);if(l&&l.minCycles){var c=l.minCycles+"";n.set(s.line,c)}}}}this.editor.dispatch({effects:[rh.set.of(t),Wa.set.of(i),ih.set.of(n)]})}setTimingResult(e){if(this.sourcefile!=null){var t=new Map;for(let[o,a]of this.sourcefile.line2offset){let l=e.pc2clockrange[a];var i=l&&l.minclocks,n=l&&l.maxclocks;if(i>=0&&n>=0){var s;n==i?s=i+"":s=i+"-"+n,n==e.MAX_CLOCKS&&(s+="+"),t.set(o,s)}}this.editor.dispatch({effects:[Wa.set.of(t)]})}}setCurrentLine(e,t){var i=n=>{this.editor.dispatch({effects:[ao.set.of(n.line),ja.effect.of(n.line),...t?[V.scrollIntoView(this.editor.state.doc.line(n.line).from,{y:"center"})]:[]]})};if(this.clearCurrentLine(t),e){if(e.line<1||e.line>this.editor.state.doc.lines)return;if(i(e),t){let s=this.editor.state.doc.line(e.line).from+(e.start||0);this.editor.dispatch({selection:{anchor:s,head:s},effects:V.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:[ao.set.of(null),ja.effect.of(null)]})}getActiveLine(){if(this.sourcefile){var e=Qt&&Qt.c;if(!e&&S.getCPUState&&!S.isRunning()&&(e=S.getCPUState()),e){var t=e&&(e.EPC||e.PC),i=this.sourcefile.findLineForOffset(t,lo);return i}}}refreshDebugState(e){var t=this.getActiveLine();!e&&(t===this.currentDebugLine||!t&&!this.currentDebugLine)||this.setCurrentLine(t,e)}refreshListing(){var e=K.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 i=0;i<e.idx;i++){let n=e.buf[i];if((n&4278190080)===16777216){let s=this.sourcefile.findLineForOffset(n&65535,lo);s&&t.add(s.line)}}e.clear(),this.editor.dispatch({effects:lh.effect.of(Array.from(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(){ma(this.editor)}redoStep(){qs(this.editor)}syncBreakpoints(){let e=vt.getSourceBreakpointsForFile(this.path).map(t=>({line:t.line,enabled:t.enabled}));this.editor.dispatch({effects:nh.setAll.of(e)})}};Da.tracingEnabled=!1;var jt=Da,ag=1024,Xi=class{getSelectionText(){return cg(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 V({parent:e,extensions:[Ec(),Zc(),Qe.allowMultipleSelections.of(!0),Cc(),Ac(),Zd(),r1,Bd,ja.field,Qe.tabSize.of(8),Qe.readOnly.of(!0)]})}refresh(e,t){let i=Qt||S.saveState(),n=t!==void 0?t:i.c?i.c.PC:0,s=0,o=0,a=S.debugSymbols&&S.debugSymbols.addr2symbol||{},l=(h,u)=>{let f="",p=0;for(;p<u;){let m=h+p|0,w=S.disassemble(m,S.readAddress.bind(S)),v="",A="";for(let T=0;T<w.nbytes;T++)v+=be(S.readAddress(m+T));for(;v.length<14;)v+=" ";let R=w.line;if(a&&w.isaddr&&(R=R.replace(/([^#])[$]([0-9A-F]+)/,(T,...P)=>{let C=parseInt(P[1],16),z=a[C];return z?P[0]+z:(z=a[
Line truncated
|
|
|
|
|
`;f+=U,m==n&&(o=s),s++,p+=w.nbytes||1}return f};var c=n<0?n-ag:Math.max(0,n-ag);let d=l(c,n-c)+l(n,ag);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:V.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=be(e,4),i=this.disasmview.state.doc;for(let n=1;n<=i.lines;n++){let s=i.line(n);if(s.text.startsWith(t+" "))return this.disasmview.dispatch({selection:{anchor:s.from,head:s.from+t.length},effects:V.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 n=this.disasmview.state.doc.line(t).text.trim().split(/\s+/);if(n&&n.length>=1){let s=parseInt(n[0],16);if(console.log("getCursorPC",s),s>=0)return s}}return-1}},ch=class extends Xi{constructor(e){super(),this.path=e}refreshListing(){var e=K.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}}),!!S.saveState){var i=Qt||S.saveState(),n=i.c?i.c.EPC||i.c.PC:0;if(n>=0&&this.assemblyfile){var s=this.assemblyfile.findLineForOffset(n,lo);if(s&&e){let o=this.disasmview.state.doc.line(s.line);this.disasmview.dispatch({selection:{anchor:o.from,head:o.from},effects:V.scrollIntoView(o.from,{y:"center"})})}}}}}goToAddress(e){this.refreshListing();let t=this.assemblyfile&&this.assemblyfile.findLineForOffset(e,lo);if(t){let i=this.disasmview.state.doc.line(t.line);this.disasmview.dispatch({selection:{anchor:i.from,head:i.from},effects:V.scrollIntoView(i.from,{y:"center"})})}this.disasmview.focus()}};function Y1(r){let e=[r];try{var t=Co(K.mainPath);t.length>0&&t!="local"&&e.push(t+"/"+r)}catch(s){}for(var i of e){var n=K&&K.getFile(i);if(typeof n=="string")return i}return null}function A1(r){for(var e of hb(r))if(e.editorStyle){var t=t1(e.editorStyle);if(t)return t}return null}var lg=new Map;function CU(r){let e=K.getToolForFilename(K.mainPath),t=zl(e,K.platform_id),i=Ul(e,K.platform_id);if(!t||!i.length)return Promise.resolve(null);let n=t+":"+r;return lg.has(n)||lg.set(n,(async()=>{var s=[...i.map(d=>d+"/"+r),r];for(var o of s){var a={preload_fs:t,readshared:o,updates:[],buildsteps:[]},l=await K.queryWorker(a),c=l&&l.output;if(c instanceof Uint8Array&&c.length>0)return new TextDecoder().decode(c)}return null})()),lg.get(n)}var dn=class{constructor(e){this.fn=e;this.languageCompartment=new xt}getSelectionText(){return cg(this.view)}createDiv(e){var t=document.createElement("div");t.setAttribute("class","editor"),e.appendChild(t);var i=A1(this.fn||this.currentPath||"")||Pa();return this.view=new V({parent:t,extensions:[Ec(),Zc(),Qe.allowMultipleSelections.of(!0),Cc(),Ac(),Zd(),Cp({top:!0}),Kt.of(Z1),this.languageCompartment.of(i),Nd,Nm,Qe.readOnly.of(!0)]}),this.refresh(!1),t}setVisible(e){e&&this.refresh(!1)}setHeaderText(e){var t=A1(this.currentPath||this.fn||"")||Pa();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 i=window.location.hash;if(!i||!i.startsWith("#headerview/"))return;t=this.fn=decodeURIComponent(i.substring(12))}this.loadIncludeFile(t)}async loadIncludeFile(e){this.requestedFn=e;var t=Y1(e);if(t){this.currentPath=t,this.setHeaderText(K.getFile(t));return}var i=await CU(e);if(this.requestedFn===e){if(i!=null){this.currentPath=e,this.setHeaderText(i);return}this.currentPath=e,this.setHeaderText("// "+e+` was not found.
|
|
|
|
|
// Project include files are loaded during a build -- try building first.
|
|
|
|
|
// Toolchain headers are only available when the tool has a bundled filesystem.`)}}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:[W.scrollIntoView(t.from,{y:"center"})]}),this.view.focus()}}};var ts=class{constructor(e){var t=document.createElement("div");t.setAttribute("class","memdump"),e.appendChild(t),this.maindiv=t}create(e,t,i){this.getLineAt=i,this.memorylist=new Al({w:$(e).width(),h:$(e).height(),itemHeight:cg(),totalRows:t,generatorFn:n=>{var s=i(n),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)}refresh(){this.memorylist&&$(this.maindiv).find("[data-index]").each((e,t)=>{var i=t,n=parseInt(i.getAttribute("data-index")),s=i.innerText,o=this.getLineAt(n),a=o.text;if(s!=a&&(i.innerText=a,o.clas!=null&&!i.classList.contains(o.clas))){var l=Array.from(i.classList);l.forEach(c=>i.classList.remove(c)),i.classList.add("vrow"),i.classList.add(o.clas)}})}};function cg(){return $("#booksMenuButton").first().height()}function Y1(r){return r.endsWith("_SIZE__")||r.endsWith("_LAST__")||r.endsWith("STACKSIZE__")||r.endsWith("FILEOFFS__")||r.startsWith("l__")||r.startsWith("s__")||r.startsWith(".__.")}var hn=class{constructor(){this.recreateOnResize=!0;this.hibits=0;this.totalRows=5120;this.gotoRow=-1}createDiv(e){var t=document.createElement("div");return t.setAttribute("class","memdump"),e.appendChild(t),this.showMemoryWindow(e,t),this.maindiv=t}showMemoryWindow(e,t){this.memorylist=new Al({w:$(e).width(),h:$(e).height(),itemHeight:cg(),totalRows:this.totalRows,generatorFn:n=>{var s=this.getMemoryLineAt(n),o=document.createElement("div");if(this.dumplines){var a=this.dumplines[n];a&&o.classList.add("seg_"+this.getMemorySegment(this.dumplines[n].a|this.hibits))}return n==this.gotoRow&&o.classList.add("goto_line"),o.appendChild(document.createTextNode(s)),o}}),$(t).append(this.memorylist.container),this.tick();let i=Sa();i&&this.dumplines&&this.scrollToAddress(i.data_start)}scrollToAddress(e){this.dumplines&&(this.hibits=e&4294901760,this.memorylist.scrollToItem(this.findMemoryWindowLine(e&65535)))}goToAddress(e){this.hibits=e&4294901760;var t=this.getDumpLines(),i;if(t&&t.length?i=this.findMemoryWindowLine(e&65535):i=(e&65535)>>4,i!==void 0){if(this.gotoRow=i,this.memorylist){var n=this.memorylist.container,s=i*this.memorylist.itemHeight-(n.clientHeight-this.memorylist.itemHeight)/2;n.scrollTop=Math.max(0,s)}this.tick()}}refresh(){this.dumplines=null,this.tick()}tick(){this.memorylist&&$(this.maindiv).find("[data-index]").each((e,t)=>{var i=$(t),n=parseInt(i.attr("data-index")),s=i.text(),o=this.getMemoryLineAt(n);s!=o&&i.text(o),i.toggleClass("goto_line",n==this.gotoRow)})}getMemoryLineAt(e){var t=e*16,i=0,n=16,s;if(this.getDumpLines()){var o=this.dumplines[e];if(o)t=o.a&65520,i=o.a-t,n=i+o.l,s=o.s;else return"."}for(var a=be(t+i,4)+" ",l=0;l<i;l++)a+=" ";i>8&&(a+=" ");for(var l=i;l<n;l++){var c=this.readAddress(t+l|this.hibits);l==8&&(a+=" "),a+=" "+(typeof c=="number"?be(c,2):"??")}for(var l=n;l<16;l++)a+=" ";return s&&(a+=" "+s),a}readAddress(e){return w.readAddress(e)}getDumpLineAt(e){var t=this.dumplines[e];if(t)return t.a+" "+t.s}getDumpLines(){var e=w.debugSymbols&&w.debugSymbols.addr2symbol||{};if(this.dumplines==null){this.dumplines=[];var t=0,i;for(let a of Object.keys(e)){var n=parseInt(a),s=e[n|this.hibits];if(i)for(Y1(i)&&(i="");t<n&&this.dumplines.length<65536;){var o=t+16&1048560;o>n&&(o=n),this.dumplines.push({a:t,l:o-t,s:i}),t=o}i=s}}return this.dumplines}getMemorySegment(e){let t=Sa();if(t){if(e>=t.data_start&&e<t.data_start+t.data_size)return w.getSP&&e>=w.getSP()-15?"stack":"data";if(e>=t.code_start&&e<t.code_start+(t.code_size||t.rom_size))return"code"}var i=K.segments;if(i){for(var n of i)if(e>=n.start&&e<n.start+n.size){if(n.type=="rom")return"code";if(n.type=="ram")return"data";if(n.type=="io")return"io"}}return"unknown"}findMemoryWindowLine(e){for(var t=0;t<this.dumplines.length;t++)if(this.dumplines[t].a>=e)return t}},dh=class extends hn{constructor(){super(...arguments);this.totalRows=2048}readAddress(t){return w.readVRAMAddress(t)}getMemorySegment(t){return"video"}getDumpLines(){return null}},Fa=class{constructor(e,t){this.recreateOnResize=!0;this.path=e,this.data=t}populateVlist(){$(this.vlist.maindiv).empty(),this.vlist.create(this.parent,this.data.length+15>>4,this.getMemoryLineAt.bind(this))}createDiv(e){return this.parent=e,this.vlist=new ts(this.parent),this.populateVlist(),this.vlist.maindiv}setData(e){this.data=e,this.populateVlist()}getMemoryLineAt(e){for(var t=e*16,i=0,n=16,s=be(t+i,4)+" ",o=0;o<i;o++)s+=" ";i>8&&(s+=" ");for(var o=i;o<n;o++){var a=this.data[t+o];o==8&&(s+=" "),s+=" "+(a>=0?be(a,2):" ")}return{text:s}}refresh(){this.vlist.refresh()}getPath(){return this.path}},hh=class{createDiv(e){return this.maindiv=Cr(e,"vert
Line truncated
|
|
|
|
|
// Toolchain headers are only available when the tool has a bundled filesystem.`)}}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:[V.scrollIntoView(t.from,{y:"center"})]}),this.view.focus()}}};var ts=class{constructor(e){var t=document.createElement("div");t.setAttribute("class","memdump"),e.appendChild(t),this.maindiv=t}create(e,t,i){this.getLineAt=i,this.memorylist=new Al({w:$(e).width(),h:$(e).height(),itemHeight:dg(),totalRows:t,generatorFn:n=>{var s=i(n),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)}refresh(){this.memorylist&&$(this.maindiv).find("[data-index]").each((e,t)=>{var i=t,n=parseInt(i.getAttribute("data-index")),s=i.innerText,o=this.getLineAt(n),a=o.text;if(s!=a&&(i.innerText=a,o.clas!=null&&!i.classList.contains(o.clas))){var l=Array.from(i.classList);l.forEach(c=>i.classList.remove(c)),i.classList.add("vrow"),i.classList.add(o.clas)}})}};function dg(){return $("#booksMenuButton").first().height()}function W1(r){return r.endsWith("_SIZE__")||r.endsWith("_LAST__")||r.endsWith("STACKSIZE__")||r.endsWith("FILEOFFS__")||r.startsWith("l__")||r.startsWith("s__")||r.startsWith(".__.")}var hn=class{constructor(){this.recreateOnResize=!0;this.hibits=0;this.totalRows=5120;this.gotoRow=-1}createDiv(e){var t=document.createElement("div");return t.setAttribute("class","memdump"),e.appendChild(t),this.showMemoryWindow(e,t),this.maindiv=t}showMemoryWindow(e,t){this.memorylist=new Al({w:$(e).width(),h:$(e).height(),itemHeight:dg(),totalRows:this.totalRows,generatorFn:n=>{var s=this.getMemoryLineAt(n),o=document.createElement("div");if(this.dumplines){var a=this.dumplines[n];a&&o.classList.add("seg_"+this.getMemorySegment(this.dumplines[n].a|this.hibits))}return n==this.gotoRow&&o.classList.add("goto_line"),o.appendChild(document.createTextNode(s)),o}}),$(t).append(this.memorylist.container),this.tick();let i=Sa();i&&this.dumplines&&this.scrollToAddress(i.data_start)}scrollToAddress(e){this.dumplines&&(this.hibits=e&4294901760,this.memorylist.scrollToItem(this.findMemoryWindowLine(e&65535)))}goToAddress(e){this.hibits=e&4294901760;var t=this.getDumpLines(),i;if(t&&t.length?i=this.findMemoryWindowLine(e&65535):i=(e&65535)>>4,i!==void 0){if(this.gotoRow=i,this.memorylist){var n=this.memorylist.container,s=i*this.memorylist.itemHeight-(n.clientHeight-this.memorylist.itemHeight)/2;n.scrollTop=Math.max(0,s)}this.tick()}}refresh(){this.dumplines=null,this.tick()}tick(){this.memorylist&&$(this.maindiv).find("[data-index]").each((e,t)=>{var i=$(t),n=parseInt(i.attr("data-index")),s=i.text(),o=this.getMemoryLineAt(n);s!=o&&i.text(o),i.toggleClass("goto_line",n==this.gotoRow)})}getMemoryLineAt(e){var t=e*16,i=0,n=16,s;if(this.getDumpLines()){var o=this.dumplines[e];if(o)t=o.a&65520,i=o.a-t,n=i+o.l,s=o.s;else return"."}for(var a=be(t+i,4)+" ",l=0;l<i;l++)a+=" ";i>8&&(a+=" ");for(var l=i;l<n;l++){var c=this.readAddress(t+l|this.hibits);l==8&&(a+=" "),a+=" "+(typeof c=="number"?be(c,2):"??")}for(var l=n;l<16;l++)a+=" ";return s&&(a+=" "+s),a}readAddress(e){return S.readAddress(e)}getDumpLineAt(e){var t=this.dumplines[e];if(t)return t.a+" "+t.s}getDumpLines(){var e=S.debugSymbols&&S.debugSymbols.addr2symbol||{};if(this.dumplines==null){this.dumplines=[];var t=0,i;for(let a of Object.keys(e)){var n=parseInt(a),s=e[n|this.hibits];if(i)for(W1(i)&&(i="");t<n&&this.dumplines.length<65536;){var o=t+16&1048560;o>n&&(o=n),this.dumplines.push({a:t,l:o-t,s:i}),t=o}i=s}}return this.dumplines}getMemorySegment(e){let t=Sa();if(t){if(e>=t.data_start&&e<t.data_start+t.data_size)return S.getSP&&e>=S.getSP()-15?"stack":"data";if(e>=t.code_start&&e<t.code_start+(t.code_size||t.rom_size))return"code"}var i=K.segments;if(i){for(var n of i)if(e>=n.start&&e<n.start+n.size){if(n.type=="rom")return"code";if(n.type=="ram")return"data";if(n.type=="io")return"io"}}return"unknown"}findMemoryWindowLine(e){for(var t=0;t<this.dumplines.length;t++)if(this.dumplines[t].a>=e)return t}},dh=class extends hn{constructor(){super(...arguments);this.totalRows=2048}readAddress(t){return S.readVRAMAddress(t)}getMemorySegment(t){return"video"}getDumpLines(){return null}},Fa=class{constructor(e,t){this.recreateOnResize=!0;this.path=e,this.data=t}populateVlist(){$(this.vlist.maindiv).empty(),this.vlist.create(this.parent,this.data.length+15>>4,this.getMemoryLineAt.bind(this))}createDiv(e){return this.parent=e,this.vlist=new ts(this.parent),this.populateVlist(),this.vlist.maindiv}setData(e){this.data=e,this.populateVlist()}getMemoryLineAt(e){for(var t=e*16,i=0,n=16,s=be(t+i,4)+" ",o=0;o<i;o++)s+=" ";i>8&&(s+=" ");for(var o=i;o<n;o++){var a=this.data[t+o];o==8&&(s+=" "),s+=" "+(a>=0?be(a,2):" ")}return{text:s}}refresh(){this.vlist.refresh()}getPath(){return this.path}},hh=class{createDiv(e){return this.maindiv=Cr(e,"vert
Line truncated
|
|
|
|
|
`+s),n+=`
|
|
|
|
|
`+this.opToString(l,c,f))}),"X: "+t+" Y: "+i+" "+n}refresh(){this.tick(),this.datau32.fill(Hr)}tick(){super.tick(),this.drawImage()}drawImage(){this.ctx.putImageData(this.imageData,0,0)}clear(){this.datau32.fill(Hr)}},fh=class extends uh{createDiv(e){return this.createCanvas(e,256,256)}initCanvas(){super.initCanvas(),this.canvas.onclick=e=>{var t=Xl(this.canvas,e),i=Math.floor(t.x)+Math.floor(t.y)*256,n=-1,s=-1;this.redraw((o,a)=>{s<0&&n>=0&&a==i&&(s=n),o==16777216&&(n=a)}),s>=0&&qa([s])}}clear(){for(var e=0;e<=65535;e++){var t=w.readAddress(e),i=t>>2|t&31;i|=i<<8|i<<16,this.datau32[e]=i|Hr}}drawEvent(e,t,i,n){var s=this.getOpRGB(e,t);if(s){var o=t&255,a=t>>8&255,l=this.datau32[t&65535];l=l|s|Hr,this.datau32[t&65535]=l}}getTooltipText(e,t){var i=(e&255)+(t<<8),n="",s=-1,o={},a=null,l=[];return this.redraw((c,d,h,u,f,p)=>{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 m=c|s;d==i&&!o[m]&&(n==""&&a&&(n+=`
|
|
|
|
|
`+this.opToString(l,c,f))}),"X: "+t+" Y: "+i+" "+n}refresh(){this.tick(),this.datau32.fill(Hr)}tick(){super.tick(),this.drawImage()}drawImage(){this.ctx.putImageData(this.imageData,0,0)}clear(){this.datau32.fill(Hr)}},fh=class extends uh{createDiv(e){return this.createCanvas(e,256,256)}initCanvas(){super.initCanvas(),this.canvas.onclick=e=>{var t=Xl(this.canvas,e),i=Math.floor(t.x)+Math.floor(t.y)*256,n=-1,s=-1;this.redraw((o,a)=>{s<0&&n>=0&&a==i&&(s=n),o==16777216&&(n=a)}),s>=0&&qa([s])}}clear(){for(var e=0;e<=65535;e++){var t=S.readAddress(e),i=t>>2|t&31;i|=i<<8|i<<16,this.datau32[e]=i|Hr}}drawEvent(e,t,i,n){var s=this.getOpRGB(e,t);if(s){var o=t&255,a=t>>8&255,l=this.datau32[t&65535];l=l|s|Hr,this.datau32[t&65535]=l}}getTooltipText(e,t){var i=(e&255)+(t<<8),n="",s=-1,o={},a=null,l=[];return this.redraw((c,d,h,u,f,p)=>{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 m=c|s;d==i&&!o[m]&&(n==""&&a&&(n+=`
|
|
|
|
|
`+a),n+=`
|
|
|
|
|
PC `+this.addr2str(s)+" "+this.opToString(c,null,p),o[m]=1)}),this.addr2str(i)+n}},hg=class extends uh{initCanvas(){super.initCanvas(),this.canvas.onclick=e=>{var t=Xl(this.canvas,e),i=Math.floor(t.x),n=Math.floor(t.y),s=this.getOpAtPos(t.x,t.y,16777216);s&&(Kr("toline"),w.runEval(()=>{let o=w.getRasterScanline&&w.getRasterScanline()>=n;return o&&w.getRasterLineClock?o&&w.getRasterLineClock()>i:o}))}}drawEvent(e,t,i,n){var s=this.getOpRGB(e,t);if(s){var o=i+n*this.canvas.width,a=s|Hr;this.datau32[o]|=a}}drawImage(){let e=Hr;for(let t=0;t<this.datau32.length;t++)this.datau32[t]==Hr?this.datau32[t]=e:e=this.datau32[t];super.drawImage()}},Oh=class extends hg{constructor(){super(...arguments);this.interrupt=0;this.rgb=0;this.lastpc=0}drawEvent(t,i,n,s){var o=n+s*this.canvas.width;if(t==134217728&&(this.interrupt=1),this.interrupt==1&&t==167772160&&(this.interrupt=i),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)-i>16&&(l+=1),Math.abs(this.lastpc)-i>256&&(l+=1),a=this.rgb=526344*l+2105376,this.lastpc=i}this.interrupt&&(a|=8388672),this.datau32[o]==Hr&&(this.datau32[o]=a|Hr)}}},ph=class extends un{constructor(){super(...arguments);this.recreateOnResize=!0}createDiv(t){return this.vlist=new ts(t),this.vlist.create(t,this.cyclesPerLine*this.totalScanlines,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){var i="",n="seg_data",s=this.dumplines&&this.dumplines[t];if(s!=null){var o=s.info.join(", ");i="("+ni(s.row,4)+", "+ni(s.col,4)+") "+Ro(s.asm||"",20)+o,o.indexOf("Write ")>=0&&(n="seg_io")}return{text:i,clas:n}}refresh(){this.tick()}tick(){let t=w instanceof bu||w instanceof gu;this.dumplines={},this.redraw((i,n,s,o,a,l)=>{t&&(a>>=2);var c=this.dumplines[a];switch(c==null&&(c={op:i,addr:n,row:o,col:s,asm:null,info:[]},this.dumplines[a]=c),i){case 16777216:if(w.disassemble){var d=w.disassemble(n,w.readAddress.bind(w));c.asm=d&&d.line}break;default:var h=this.opToString(i,n,l);h!=""&&c.info.push(h);break}}),this.vlist.refresh()}},mh=class extends un{constructor(){super(...arguments);this.recreateOnResize=!0}createDiv(t){return this.vlist=new ts(t),this.vlist.create(t,this.totalScanlines,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){for(var i=ni(t+"",3)+" ",n="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&Hr;if(d==16777216)i+=",";else{var h=be(c);i+=h,a+=h.length-1}}else i+=a==o?"|":"."}return s[-1]&&(i+=" "+s[-1]),{text:i,clas:n}}refresh(){this.tick()}tick(){let t=w instanceof bu||w instanceof gu;this.dumplines={},this.redraw((i,n,s,o,a,l)=>{var c=this.dumplines[o];switch(c==null&&(this.dumplines[o]=c=[]),i){case 16777216:var d=w.debugSymbols.addr2symbol[n];d&&(c[-1]=d);break;case 335544320:case 352321536:case 369098752:case 385875968:c[s]=i|n;break}}),this.vlist.refresh()}},gh=class extends un{constructor(){super(...arguments);this.recreateOnResize=!0;this.cumulativeData=!0}createDiv(t){return w.debugSymbols&&w.debugSymbols.symbolmap?this.keys=Array.from(Object.keys(w.debugSymbols.symbolmap).filter(i=>!Y1(i))):this.keys=["no symbols defined"],this.vlist=new ts(t),this.vlist.create(t,this.keys.length+1,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){if(t==0)return{text:ni("Symbol",35)+ni("Reads",8)+ni("Writes",8)};var i=this.keys[t-1],n=this.dumplines&&this.dumplines[i];function s(l){var c=n[l]|0;return ni(c?c.toString():"",8)}var o,a;return n!=null?(o=ni(i,35)+s(301989888)+s(318767104),n[16777216]?a="seg_code":n[335544320]||n[352321536]?a="seg_io":a="seg_data"):(o=ni(i,35),a="seg_unknown"),{text:o,clas:a}}refresh(){this.tick()}tick(){this.dumplines={},this.redraw((t,i,n,s,o,a)=>{var l=w.debugSymbols.addr2symbol[i];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()}},bh=class{constructor(){this.editingId=null}createDiv(e){return this.maindiv=Cr(e,"vertical-scroll bp-view"),this.render(),this.maindiv[0]}refresh(e){this.render()}render(){let e=this.maindiv.empty(),t=Gd(),i=this.editingId!=null?t.find(d=>d.bp.id==this.editingId):null,n=$('<div class="bp-form"/>'),s=$('<input type="text" class="bp-input" spellcheck="false"/>').attr("placeholder","address or symbol (e.g. $8000, mainloop)").val(i&&i.bp.type=="address"?i.bp.target:""),o=$('<input type="text" class="bp-input" spellcheck="false"/>').attr("placeholder","condition (e.g. A == $20 && X < 4)").val(i&&i.bp.condition||""),a=$('<button class="btn btn-default btn-xs bp-submit"/>').text(i?"Save":"Add"),l=$('<button class="btn btn-default btn-xs bp-submit"/>').text("Cancel");l.toggle(i!=
Line truncated
|
|
|
|
|
PC `+this.addr2str(s)+" "+this.opToString(c,null,p),o[m]=1)}),this.addr2str(i)+n}},ug=class extends uh{initCanvas(){super.initCanvas(),this.canvas.onclick=e=>{var t=Xl(this.canvas,e),i=Math.floor(t.x),n=Math.floor(t.y),s=this.getOpAtPos(t.x,t.y,16777216);s&&(Kr("toline"),S.runEval(()=>{let o=S.getRasterScanline&&S.getRasterScanline()>=n;return o&&S.getRasterLineClock?o&&S.getRasterLineClock()>i:o}))}}drawEvent(e,t,i,n){var s=this.getOpRGB(e,t);if(s){var o=i+n*this.canvas.width,a=s|Hr;this.datau32[o]|=a}}drawImage(){let e=Hr;for(let t=0;t<this.datau32.length;t++)this.datau32[t]==Hr?this.datau32[t]=e:e=this.datau32[t];super.drawImage()}},Oh=class extends ug{constructor(){super(...arguments);this.interrupt=0;this.rgb=0;this.lastpc=0}drawEvent(t,i,n,s){var o=n+s*this.canvas.width;if(t==134217728&&(this.interrupt=1),this.interrupt==1&&t==167772160&&(this.interrupt=i),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)-i>16&&(l+=1),Math.abs(this.lastpc)-i>256&&(l+=1),a=this.rgb=526344*l+2105376,this.lastpc=i}this.interrupt&&(a|=8388672),this.datau32[o]==Hr&&(this.datau32[o]=a|Hr)}}},ph=class extends un{constructor(){super(...arguments);this.recreateOnResize=!0}createDiv(t){return this.vlist=new ts(t),this.vlist.create(t,this.cyclesPerLine*this.totalScanlines,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){var i="",n="seg_data",s=this.dumplines&&this.dumplines[t];if(s!=null){var o=s.info.join(", ");i="("+ni(s.row,4)+", "+ni(s.col,4)+") "+Ro(s.asm||"",20)+o,o.indexOf("Write ")>=0&&(n="seg_io")}return{text:i,clas:n}}refresh(){this.tick()}tick(){let t=S instanceof bu||S instanceof gu;this.dumplines={},this.redraw((i,n,s,o,a,l)=>{t&&(a>>=2);var c=this.dumplines[a];switch(c==null&&(c={op:i,addr:n,row:o,col:s,asm:null,info:[]},this.dumplines[a]=c),i){case 16777216:if(S.disassemble){var d=S.disassemble(n,S.readAddress.bind(S));c.asm=d&&d.line}break;default:var h=this.opToString(i,n,l);h!=""&&c.info.push(h);break}}),this.vlist.refresh()}},mh=class extends un{constructor(){super(...arguments);this.recreateOnResize=!0}createDiv(t){return this.vlist=new ts(t),this.vlist.create(t,this.totalScanlines,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){for(var i=ni(t+"",3)+" ",n="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&Hr;if(d==16777216)i+=",";else{var h=be(c);i+=h,a+=h.length-1}}else i+=a==o?"|":"."}return s[-1]&&(i+=" "+s[-1]),{text:i,clas:n}}refresh(){this.tick()}tick(){let t=S instanceof bu||S instanceof gu;this.dumplines={},this.redraw((i,n,s,o,a,l)=>{var c=this.dumplines[o];switch(c==null&&(this.dumplines[o]=c=[]),i){case 16777216:var d=S.debugSymbols.addr2symbol[n];d&&(c[-1]=d);break;case 335544320:case 352321536:case 369098752:case 385875968:c[s]=i|n;break}}),this.vlist.refresh()}},gh=class extends un{constructor(){super(...arguments);this.recreateOnResize=!0;this.cumulativeData=!0}createDiv(t){return S.debugSymbols&&S.debugSymbols.symbolmap?this.keys=Array.from(Object.keys(S.debugSymbols.symbolmap).filter(i=>!W1(i))):this.keys=["no symbols defined"],this.vlist=new ts(t),this.vlist.create(t,this.keys.length+1,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){if(t==0)return{text:ni("Symbol",35)+ni("Reads",8)+ni("Writes",8)};var i=this.keys[t-1],n=this.dumplines&&this.dumplines[i];function s(l){var c=n[l]|0;return ni(c?c.toString():"",8)}var o,a;return n!=null?(o=ni(i,35)+s(301989888)+s(318767104),n[16777216]?a="seg_code":n[335544320]||n[352321536]?a="seg_io":a="seg_data"):(o=ni(i,35),a="seg_unknown"),{text:o,clas:a}}refresh(){this.tick()}tick(){this.dumplines={},this.redraw((t,i,n,s,o,a)=>{var l=S.debugSymbols.addr2symbol[i];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()}},bh=class{constructor(){this.editingId=null}createDiv(e){return this.maindiv=Cr(e,"vertical-scroll bp-view"),this.render(),this.maindiv[0]}refresh(e){this.render()}render(){let e=this.maindiv.empty(),t=Gd(),i=this.editingId!=null?t.find(d=>d.bp.id==this.editingId):null,n=$('<div class="bp-form"/>'),s=$('<input type="text" class="bp-input" spellcheck="false"/>').attr("placeholder","address or symbol (e.g. $8000, mainloop)").val(i&&i.bp.type=="address"?i.bp.target:""),o=$('<input type="text" class="bp-input" spellcheck="false"/>').attr("placeholder","condition (e.g. A == $20 && X < 4)").val(i&&i.bp.condition||""),a=$('<button class="btn btn-default btn-xs bp-submit"/>').text(i?"Save":"Add"),l=$('<button class="btn btn-default btn-xs bp-submit"/>').text("Cancel");l.toggle(i!=
Line truncated
|
|
|
|
|
`)<0&&e.indexOf("\r")<0)return e.trim()}return""}function zU(r){var t;let e=r.record;if(e.source==="project"){let i=e.file;if(!i||!W.isWindow(i))return;let n=W.createOrShow(i);n instanceof jt&&e.line&&n.navigateToLine(e.line)}else if(e.source==="toolchain"){let i=e.file;if(!i)return;Ia(i);let n=W.createOrShow("#headerview/"+i);n instanceof dn&&e.line&&n.navigateToLine(e.line)}else if(e.source==="debugger"){let i=(t=e.addr)!=null?t:-1;if(i<0)return;if(e.kind==="label"&&W.isWindow("#disasm")){let n=W.createOrShow("#disasm");n instanceof Xi&&n.goToAddress(i)}else{let n=W.createOrShow("#memory");n instanceof hn&&n.goToAddress(i)}}else if(e.source==="docs"){let i=e.url||"";i.startsWith("#help/")?W.createOrShow(i):i&&window.open(i,"_blank")}}function fg(){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"),i=[],n=-1,s=c=>{if(n=Math.max(-1,Math.min(c,i.length-1)),t.find("li.search-hit").each((d,h)=>{$(h).toggleClass("active",d===n)}),n>=0){let d=t[0],h=t.find("li.search-hit").eq(n);if(h.length){let u=h[0],f=d.getBoundingClientRect(),p=u.getBoundingClientRect(),m=p.top-f.top;m<0?d.scrollTop+=m:m+p.height>f.height&&(d.scrollTop+=m+p.height-f.height)}}},o=(c=n)=>{let d=i[c];d&&(ZU(d),bootbox.hideAll())},a=c=>{if(i=c||[],i.length===0){n=-1,t.html('<div class="text-muted" style="padding:8px">No matches.</div>');return}let d=$('<ul class="list-group" style="margin-bottom:0"></ul>');for(let h of i){let u=h.record,f=u.source,p=u.kind==="func"?"\u0192":u.kind==="macro"?"#":u.kind==="label"?":":u.kind==="struct"?"S":u.kind==="enum"?"E":u.kind==="text"?"\u2261":"\u2022",m=u.source==="debugger"?be(u.addr,4):u.file&&u.line?`${u.file}:${u.line}`:u.file||"",S=u.kind!=="text",v=$('<li class="list-group-item search-hit" style="cursor:pointer;padding:6px 10px;display:flex;align-items:center;overflow:hidden"></li>');v.html(`<span class="search-kind" style="margin-right:6px;font-weight:bold;flex:0 0 auto">${p}</span><span class="search-name" style="flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">`+(S?`<strong>${wh(u.name)}</strong>`:`<span class="search-dumb">${wh(u.name)}</span>`)+(u.brief?` <span class="text-muted">- ${wh(u.brief)}</span>`:"")+`</span><span class="search-loc" style="flex:0 0 auto;margin-left:8px;font-style:italic;font-size:small;white-space:nowrap">${m?wh(m):""}</span>`),v.click(()=>{o(i.indexOf(h))}),d.append(v)}t.empty().append(d),s(0)},l=AU(async()=>{let c=e.val();if(!c){i=[],n=-1,t.empty();return}try{let d=await wy.query(c,EU),h=xh(c,w&&w.debugSymbols&&w.debugSymbols.symbolmap);h&&j1(h,d.length>0)&&d.push(V1(c,h,K&&K.segments)),a(d)}catch(d){t.html('<div class="text-danger" style="padding:8px">Search failed.</div>')}},150);e.on("input",l),e.on("keydown",c=>{c.key==="ArrowDown"?(c.preventDefault(),s(n+1)):c.key==="ArrowUp"?(c.preventDefault(),s(n-1)):c.key==="Enter"?(c.preventDefault(),n>=0?o():l()):c.key==="Home"?(c.preventDefault(),s(0)):c.key==="End"&&(c.preventDefault(),s(i.length-1))})}var UU=800,zU=1e3,MU=16;function D1(r){return r.art?r.brev?0:7:null}var Sh=/([0#]?)([x$%]|\d'h)([0-9a-f]+)(?:[;].*)?|(\d'b|0b)([01]+)/gim;function bg(r){return r.replace(/(\shex\s+)([0-9a-f]+)/ig,function(e,t,i){for(var n=t,s=0;s<i.length;s+=2)n+="0x"+i.substr(s,2)+",";return n})}function B1(r){for(var e=[],t;t=Sh.exec(r);){var i;t[4]?i=parseInt(t[5],2):t[2].startsWith("%")?i=parseInt(t[3],2):t[2].startsWith("x")||t[2].startsWith("$")||t[2].endsWith("h")?i=parseInt(t[3],16):i=parseInt(t[3]),e.push(i)}return e}function LU(r,e,t){r=bg(r);for(var i="",n,s=0,o=0,a=Math.ceil(t/4);n=Sh.exec(r);)i+=r.slice(s,Sh.lastIndex-n[0].length),s=Sh.lastIndex,n[4]?i+=n[4]+uu(e[o++],parseInt(n[4])):n[2].startsWith("%")?i+=n[1]+n[2]+uu(e[o++],t):n[2].endsWith("h")?i+=n[1]+n[2]+be(e[o++],parseInt(n[2])):n[2].startsWith("x")?i+=n[1]+"x"+be(e[o++],a):n[2].startsWith("$")?i+=n[1]+"$"+be(e[o++],a):i+=n[1]+e[o++].toString();return i+=r.slice(s),i=i.replace(/(\shex\s+)([,x0-9a-f]+)/ig,(l,c,d)=>{var h=c+d;return h=h.replace(/0x/ig,"").replace(/,/ig,""),h}),i}function xg(r,e){if(!e)return r;for(var t=0,i=0;i<e.length;i++){var n=e[i];n<0&&(n=-n-1,t^=1<<n),r&1<<i&&(t^=1<<n)}return t}function wg(r,e){var t=e[r%e.length];return[t>>3,t&7]}var YU=[[0,0,4],[8,0,0]],WU=[[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 VU(r,e,t,i,n,s){for(var o=0;o<8;o++)for(var a=r[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[n*s+i+c]=d}}function jU(r,e,t,i,n,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[n*s+i+c]||0)&3;d&1&&(a|=1<<l),d&2&&(a|=1<<l+4)}r[e+o]=a}}function Sg(r){return r.w===16&&r.h===16?WU:YU}function N1(r){return Sg(r).length*8}function DU(r,e){for(var t=e.w,i=e.h,n=e.count||1,s=e.wpimg||N1(e),o=Sg(e),a=[],l=0;l<n;l++){for(var c=new Array(t*i).fill(0),d=l*s,h=0;h<o.length;h++){var[u,f,p]=o[h];VU(r,d+u,c,f,p,t)}a.push(new Uint8Array(c))}return a}function IU(r,e){for(var t=e.w,i=e.h,n=e.count||r.length,s=e.wpimg||N1(e),o=Sg(e),a=new Array(s*n).fill(0),l=0;l<n;l++)for(var c=r[l]||new Uint8Array(t*i),d=l*s,h=0;h<o.length;h++){var[u,f,p]=o[h];jU(a,d+u,c,f,p,t)}return a}function qU(r,e){if(e.pacstrip)return DU(r,e);var t=e.w,i=e.h,n=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*i*n,h=e.skip||0,u=e.wpimg||l*i,f=l;e.il&&(u=l,f=l*n);for(var p=[],m=0;m<n;m++){for(var S=[],v=0;v<i;v++)for(var A=e.flip?i-1-v:v,R=u*m+A*f,U=0,T=0;T<t;T++){var P=0,C=xg(R,e.remap);e.reindex&&([C,U]=wg(T,e.reindex),C+=R);for(var z=0;z<o;z++){var q=r[C+z*d+h];P|=((e.brev?q>>a-U-s:q>>U)&c)<<z*s}S.push(P),U+=s,U>=a&&!e.reindex&&(R+=1,U=0)}p.push(new Uint8ALine truncated
|
|
|
|
|
`&&t++;return t}function J1(r,e){for(var t=/[/;][*;]([{].+[}])[*;][/;]/g,i=[],n;n=t.exec(r);){var s=n.index+n[0].length,o;e?o=r.indexOf("end",s):n[0].startsWith(";;")?(o=r.indexOf(";;",s),o==r.indexOf(";;{",s)&&(o=-1)):o=r.indexOf(";",s);var a=I1(r,n.index),l=n[0],c=o>=0?I1(r,o):"???";if(o<0){var d=e?'"end"':n[0].startsWith(";;")?'";;"':'";"';i.push({header:l,startline:a,endline:c,error:`No closing ${d} found after asset header`})}else if(o<=s)i.push({header:l,startline:a,endline:c,error:"Empty data block after asset header"});else try{var h=n[1].replace(/([A-Za-z]+):/g,'"$1":'),u=JSON.parse(h),f=/#embed\s+"(.+?)"/.exec(r.substring(s,o)),p=f?f[1]:void 0;i.push({header:l,startline:a,endline:c,fmt:u,start:s,end:o,embedFile:p})}catch(m){i.push({header:l,startline:a,endline:c,error:`Invalid asset format: ${m.message}`})}}return i}function eP(r,e,t){if(t(e))return e;var i=r.lastIndexOf("/");if(i>=0){var n=r.substring(0,i+1)+e;if(t(n))return n}return null}function FU(r,e){if(e.destfmt&&(e=e.destfmt),e.pacstrip)return IU(r,e);var t=e.w,i=e.h,n=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*i*n,h=e.skip||0,u=e.wpimg||l*i,f=l;e.il&&(u=l,f=l*n);var p=e.il?f*i:u*n,m;o>0&&e.sl?m=new Uint8Array(p):a<=8?m=new Uint8Array(p*o):m=new Uint32Array(p*o);for(var S=0;S<n;S++)for(var v=r[S],A=0,R=0;R<i;R++)for(var U=e.flip?i-1-R:R,T=S*u+U*f,P=0,C=0;C<t;C++){var z=v[A++],q=xg(T,e.remap);e.reindex&&([q,P]=wg(C,e.reindex),q+=T);for(var ne=0;ne<o;ne++){var se=z>>ne*s&c;m[q+ne*d+h]|=e.brev?se<<a-P-s:se<<P}P+=s,P>=a&&!e.reindex&&(T+=1,P=0)}return m}function q1(r,e,t,i,n,s,o){for(var a=[],l=0;l<r.length;l++){var c=r[l],d=4278190080;d|=(c>>e&(1<<t)-1)<<8-t,d|=(c>>i&(1<<n)-1)<<16-n,d|=(c>>s&(1<<o)-1)<<24-o,a.push(d)}return a}function BU(r){var e=(r>>0&1)*33+(r>>1&1)*71+(r>>2&1)*151,t=(r>>3&1)*33+(r>>4&1)*71+(r>>5&1)*151,i=(r>>6&1)*81+(r>>7&1)*174;return 4278190080|i<<16|t<<8|e}function NU(r){var e=r.pal;if(typeof e=="number"){var t=Math.floor(Math.abs(e/100)%10),i=Math.floor(Math.abs(e/10)%10),n=Math.floor(Math.abs(e)%10);return 1<<t+i+n}else{if(e==="pacman")return 256;var s=tP[e];if(s)return s.length;throw new Error("No palette named "+e)}}function fg(r,e){var t=e.pal,i;if(typeof t=="number"){var n=Math.floor(Math.abs(t/100)%10),s=Math.floor(Math.abs(t/10)%10),o=Math.floor(Math.abs(t)%10);t>=0?i=q1(r,0,n,n,s,n+s,o):i=q1(r,n+s,o,n,s,0,n)}else if(t==="pacman"){i=[];for(var a=0;a<r.length;a++)i.push(BU(r[a]))}else{var l=tP[t];if(l)i=new Uint32Array(r).map(c=>l[c&l.length-1]|4278190080);else throw new Error("No palette named "+t)}return i}function Na(r){var e=r.pal;if(typeof e!="number"||!isFinite(e))return null;var t=Math.floor(Math.abs(e/100)%10),i=Math.floor(Math.abs(e/10)%10),n=Math.floor(Math.abs(e)%10);return t+i+n<=0?null:e>=0?{r:t,g:i,b:n,rshift:0,gshift:t,bshift:t+i}:{r:n,g:i,b:t,rshift:t+i,gshift:t,bshift:0}}function F1(r,e,t,i){var n=Na(r);return n?(e&(1<<n.r)-1)<<n.rshift|(t&(1<<n.g)-1)<<n.gshift|(i&(1<<n.b)-1)<<n.bshift:0}function GU(r,e){var t=Na(r);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 tP={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,13404264,1
Line truncated
|
|
|
|
|
`,buttons:{close:{label:"Close",className:"btn-default"}}}).one("shown.bs.modal",()=>{$("#searchboxInput").trigger("focus")});let e=$("#searchboxInput"),t=$("#searchboxResults"),i=[],n=-1,s=d=>{if(n=Math.max(-1,Math.min(d,i.length-1)),t.find("li.search-hit").each((h,u)=>{$(u).toggleClass("active",h===n)}),n>=0){let h=t[0],u=t.find("li.search-hit").eq(n);if(u.length){let f=u[0],p=h.getBoundingClientRect(),m=f.getBoundingClientRect(),w=m.top-p.top;w<0?h.scrollTop+=w:w+m.height>p.height&&(h.scrollTop+=w+m.height-p.height)}}},o=(d=n)=>{let h=i[d];h&&(zU(h),bootbox.hideAll())},a=d=>{if(i=d||[],i.length===0){n=-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 i){let f=u.record,p=f.source,m=f.kind==="func"?"\u0192":f.kind==="macro"?"#":f.kind==="label"?":":f.kind==="struct"?"S":f.kind==="enum"?"E":f.kind==="text"?"\u2261":"\u2022",w=f.source==="debugger"?be(f.addr,4):f.file&&f.line?`${f.file}:${f.line}`:f.file||"",v=f.kind!=="text",A=$('<li class="list-group-item search-hit" style="cursor:pointer;padding:6px 10px;display:flex;align-items:center;overflow:hidden"></li>');A.html(`<span class="search-kind" style="margin-right:6px;font-weight:bold;flex:0 0 auto">${m}</span><span class="search-name" style="flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">`+(v?`<strong>${wh(f.name)}</strong>`:`<span class="search-dumb">${wh(f.name)}</span>`)+(f.brief?` <span class="text-muted">- ${wh(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">${w?wh(w):""}</span>`),A.click(()=>{o(i.indexOf(u))}),h.append(A)}t.empty().append(h),s(0)},l=EU(async()=>{let d=e.val();if(!d){i=[],n=-1,t.empty();return}try{let h=await Sy.query(d,ZU),u=xh(d,S&&S.debugSymbols&&S.debugSymbols.symbolmap);u&&D1(u,h.length>0)&&h.push(j1(d,u,K&&K.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(n+1)):d.key==="ArrowUp"?(d.preventDefault(),s(n-1)):d.key==="Enter"?(d.preventDefault(),n>=0?o():l()):d.key==="Home"?(d.preventDefault(),s(0)):d.key==="End"&&(d.preventDefault(),s(i.length-1))});let c=UU();c&&(e.val(c),l())}var MU=800,LU=1e3,YU=16;function I1(r){return r.art?r.brev?0:7:null}var Sh=/([0#]?)([x$%]|\d'h)([0-9a-f]+)(?:[;].*)?|(\d'b|0b)([01]+)/gim;function xg(r){return r.replace(/(\shex\s+)([0-9a-f]+)/ig,function(e,t,i){for(var n=t,s=0;s<i.length;s+=2)n+="0x"+i.substr(s,2)+",";return n})}function N1(r){for(var e=[],t;t=Sh.exec(r);){var i;t[4]?i=parseInt(t[5],2):t[2].startsWith("%")?i=parseInt(t[3],2):t[2].startsWith("x")||t[2].startsWith("$")||t[2].endsWith("h")?i=parseInt(t[3],16):i=parseInt(t[3]),e.push(i)}return e}function WU(r,e,t){r=xg(r);for(var i="",n,s=0,o=0,a=Math.ceil(t/4);n=Sh.exec(r);)i+=r.slice(s,Sh.lastIndex-n[0].length),s=Sh.lastIndex,n[4]?i+=n[4]+uu(e[o++],parseInt(n[4])):n[2].startsWith("%")?i+=n[1]+n[2]+uu(e[o++],t):n[2].endsWith("h")?i+=n[1]+n[2]+be(e[o++],parseInt(n[2])):n[2].startsWith("x")?i+=n[1]+"x"+be(e[o++],a):n[2].startsWith("$")?i+=n[1]+"$"+be(e[o++],a):i+=n[1]+e[o++].toString();return i+=r.slice(s),i=i.replace(/(\shex\s+)([,x0-9a-f]+)/ig,(l,c,d)=>{var h=c+d;return h=h.replace(/0x/ig,"").replace(/,/ig,""),h}),i}function wg(r,e){if(!e)return r;for(var t=0,i=0;i<e.length;i++){var n=e[i];n<0&&(n=-n-1,t^=1<<n),r&1<<i&&(t^=1<<n)}return t}function Sg(r,e){var t=e[r%e.length];return[t>>3,t&7]}var VU=[[0,0,4],[8,0,0]],jU=[[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 DU(r,e,t,i,n,s){for(var o=0;o<8;o++)for(var a=r[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[n*s+i+c]=d}}function IU(r,e,t,i,n,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[n*s+i+c]||0)&3;d&1&&(a|=1<<l),d&2&&(a|=1<<l+4)}r[e+o]=a}}function yg(r){return r.w===16&&r.h===16?jU:VU}function G1(r){return yg(r).length*8}function qU(r,e){for(var t=e.w,i=e.h,n=e.count||1,s=e.wpimg||G1(e),o=yg(e),a=[],l=0;l<n;l++){for(var c=new Array(t*i).fill(0),d=l*s,h=0;h<o.length;h++){var[u,f,p]=o[h];DU(r,d+u,c,f,p,t)}a.push(new Uint8Array(c))}return a}function FU(r,e){for(var t=e.w,i=e.h,n=e.count||r.length,s=e.wpimg||G1(e),o=yg(e),a=new Array(s*n).fill(0),l=0;l<n;l++)for(var c=r[l]||new Uint8Array(t*i),d=l*s,h=0;h<o.length;h++){var[u,f,p]=o[h];IU(a,d+u,c,f,p,t)}return a}function BU(r,e){if(e.pacstrip)return qU(r,e);var t=e.w,i=e.h,n=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*i*n,h=e.skip||0,u=e.wpimg||l*i,f=l;e.il&&(u=l,f=l*n);for(var p=[],m=0;m<n;m++){for(var w=[],v=0;v<i;v++)for(var A=e.flip?i-1-v:v,R=u*m+A*f,U=0,T=0;T<t;T++){var P=0,C=wg(R,e.remap);e.reindex&&([C,U]=Sg(T,e.reindex),C+=R);for(var z=0;z<o;z++){var q=r[C+z*d+h];P|=((e.brev?q>>a-U-s:q>>U)&c)<<z*s}w.push(P),U+=s,U>=a&&!e.reindex&Line truncated
|
|
|
|
|
`&&t++;return t}function eP(r,e){for(var t=/[/;][*;]([{].+[}])[*;][/;]/g,i=[],n;n=t.exec(r);){var s=n.index+n[0].length,o;e?o=r.indexOf("end",s):n[0].startsWith(";;")?(o=r.indexOf(";;",s),o==r.indexOf(";;{",s)&&(o=-1)):o=r.indexOf(";",s);var a=q1(r,n.index),l=n[0],c=o>=0?q1(r,o):"???";if(o<0){var d=e?'"end"':n[0].startsWith(";;")?'";;"':'";"';i.push({header:l,startline:a,endline:c,error:`No closing ${d} found after asset header`})}else if(o<=s)i.push({header:l,startline:a,endline:c,error:"Empty data block after asset header"});else try{var h=n[1].replace(/([A-Za-z]+):/g,'"$1":'),u=JSON.parse(h),f=/#embed\s+"(.+?)"/.exec(r.substring(s,o)),p=f?f[1]:void 0;i.push({header:l,startline:a,endline:c,fmt:u,start:s,end:o,embedFile:p})}catch(m){i.push({header:l,startline:a,endline:c,error:`Invalid asset format: ${m.message}`})}}return i}function tP(r,e,t){if(t(e))return e;var i=r.lastIndexOf("/");if(i>=0){var n=r.substring(0,i+1)+e;if(t(n))return n}return null}function NU(r,e){if(e.destfmt&&(e=e.destfmt),e.pacstrip)return FU(r,e);var t=e.w,i=e.h,n=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*i*n,h=e.skip||0,u=e.wpimg||l*i,f=l;e.il&&(u=l,f=l*n);var p=e.il?f*i:u*n,m;o>0&&e.sl?m=new Uint8Array(p):a<=8?m=new Uint8Array(p*o):m=new Uint32Array(p*o);for(var w=0;w<n;w++)for(var v=r[w],A=0,R=0;R<i;R++)for(var U=e.flip?i-1-R:R,T=w*u+U*f,P=0,C=0;C<t;C++){var z=v[A++],q=wg(T,e.remap);e.reindex&&([q,P]=Sg(C,e.reindex),q+=T);for(var ne=0;ne<o;ne++){var se=z>>ne*s&c;m[q+ne*d+h]|=e.brev?se<<a-P-s:se<<P}P+=s,P>=a&&!e.reindex&&(T+=1,P=0)}return m}function F1(r,e,t,i,n,s,o){for(var a=[],l=0;l<r.length;l++){var c=r[l],d=4278190080;d|=(c>>e&(1<<t)-1)<<8-t,d|=(c>>i&(1<<n)-1)<<16-n,d|=(c>>s&(1<<o)-1)<<24-o,a.push(d)}return a}function GU(r){var e=(r>>0&1)*33+(r>>1&1)*71+(r>>2&1)*151,t=(r>>3&1)*33+(r>>4&1)*71+(r>>5&1)*151,i=(r>>6&1)*81+(r>>7&1)*174;return 4278190080|i<<16|t<<8|e}function HU(r){var e=r.pal;if(typeof e=="number"){var t=Math.floor(Math.abs(e/100)%10),i=Math.floor(Math.abs(e/10)%10),n=Math.floor(Math.abs(e)%10);return 1<<t+i+n}else{if(e==="pacman")return 256;var s=rP[e];if(s)return s.length;throw new Error("No palette named "+e)}}function Og(r,e){var t=e.pal,i;if(typeof t=="number"){var n=Math.floor(Math.abs(t/100)%10),s=Math.floor(Math.abs(t/10)%10),o=Math.floor(Math.abs(t)%10);t>=0?i=F1(r,0,n,n,s,n+s,o):i=F1(r,n+s,o,n,s,0,n)}else if(t==="pacman"){i=[];for(var a=0;a<r.length;a++)i.push(GU(r[a]))}else{var l=rP[t];if(l)i=new Uint32Array(r).map(c=>l[c&l.length-1]|4278190080);else throw new Error("No palette named "+t)}return i}function Na(r){var e=r.pal;if(typeof e!="number"||!isFinite(e))return null;var t=Math.floor(Math.abs(e/100)%10),i=Math.floor(Math.abs(e/10)%10),n=Math.floor(Math.abs(e)%10);return t+i+n<=0?null:e>=0?{r:t,g:i,b:n,rshift:0,gshift:t,bshift:t+i}:{r:n,g:i,b:t,rshift:t+i,gshift:t,bshift:0}}function B1(r,e,t,i){var n=Na(r);return n?(e&(1<<n.r)-1)<<n.rshift|(t&(1<<n.g)-1)<<n.gshift|(i&(1<<n.b)-1)<<n.bshift:0}function KU(r,e){var t=Na(r);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 rP={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,13404264,1
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
|
|
|
|
@@ -293,7 +294,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 sP=`<h1>Editor</h1>
|
|
|
|
|
`;var oP=`<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,
|
|
|
|
@@ -370,7 +371,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 oP=`<h1>Disassembly</h1>
|
|
|
|
|
`;var aP=`<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>
|
|
|
|
@@ -419,7 +420,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 aP=`<h1>Memory Browser</h1>
|
|
|
|
|
`;var lP=`<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>
|
|
|
|
@@ -438,7 +439,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 lP=`<h1>Memory Map</h1>
|
|
|
|
|
`;var cP=`<h1>Memory Map</h1>
|
|
|
|
|
<p>The Memory Map draws the memory image produced by the linker: each
|
|
|
|
|
segment is a bar whose position is its start address, whose height is
|
|
|
|
|
proportional to its size, and whose color reflects its type.</p>
|
|
|
|
@@ -459,7 +460,7 @@ scroll it to that segment\u2019s start address.</p>
|
|
|
|
|
<li>Overlapping segments (for example ROM and a load segment) currently
|
|
|
|
|
share the same row; the map does not yet stack them.</li>
|
|
|
|
|
</ul>
|
|
|
|
|
`;var cP=`<h1>VRAM Browser</h1>
|
|
|
|
|
`;var dP=`<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
|
|
|
|
@@ -467,7 +468,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 dP=`<h1>Memory Probe</h1>
|
|
|
|
|
`;var hP=`<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>
|
|
|
|
@@ -533,7 +534,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 hP=`<h1>CRT Probe</h1>
|
|
|
|
|
`;var uP=`<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
|
|
|
|
@@ -586,7 +587,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 uP=`<h1>Probe Log</h1>
|
|
|
|
|
`;var fP=`<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 one clock tick:</p>
|
|
|
|
@@ -602,7 +603,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 fP=`<h1>Scanline I/O</h1>
|
|
|
|
|
`;var OP=`<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>
|
|
|
|
@@ -617,7 +618,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 OP=`<h1>Symbol Profiler</h1>
|
|
|
|
|
`;var pP=`<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>
|
|
|
|
@@ -653,7 +654,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 pP=`<h1>Call Stack</h1>
|
|
|
|
|
`;var mP=`<h1>Call Stack</h1>
|
|
|
|
|
<p>The Call Stack window reconstructs the program\u2019s call graph from runtime
|
|
|
|
|
stack activity. It is available on platforms that implement
|
|
|
|
|
<code>startProbing</code>.</p>
|
|
|
|
@@ -667,7 +668,7 @@ probe buffer is cleared on each refresh, and the graph resets 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 and calls are going.</p>
|
|
|
|
|
`;var mP=`<h1>Debug Tree</h1>
|
|
|
|
|
`;var gP=`<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
|
|
|
|
@@ -687,7 +688,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 gP=`<h1>Breakpoints</h1>
|
|
|
|
|
`;var bP=`<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>
|
|
|
|
@@ -778,8 +779,8 @@ the disassembly, at the breakpoint\u2019s address.</li>
|
|
|
|
|
<p>The breakpoint that the CPU is currently stopped at is highlighted.</p>
|
|
|
|
|
<p>Breakpoints are persisted in browser local storage, scoped to the
|
|
|
|
|
current platform and project file, so they survive a reload.</p>
|
|
|
|
|
`;var bP=`<h1>Asset Editor</h1>
|
|
|
|
|
<p>The Asset Editor finds <a href="asset-headers.md">Asset Headers</a> in your source \u2014 small JSON
|
|
|
|
|
`;var xP=`<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
|
|
|
|
|
into the source text, preserving the original number base and formatting
|
|
|
|
@@ -829,7 +830,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 xP=`<h1>Managing Files</h1>
|
|
|
|
|
`;var wP=`<h1>Managing Files</h1>
|
|
|
|
|
<h2>Importing and exporting files</h2>
|
|
|
|
|
<p>To save your files outside of the browser:</p>
|
|
|
|
|
<ol>
|
|
|
|
@@ -942,7 +943,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 wP=`<h1>Build Directives</h1>
|
|
|
|
|
`;var SP=`<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>
|
|
|
|
@@ -1216,7 +1217,7 @@ cases:</p>
|
|
|
|
|
</table>
|
|
|
|
|
<p>See <a href="toolchains.md">Toolchains & Platforms</a> for the full
|
|
|
|
|
platform \xD7 extension \u2192 tool table.</p>
|
|
|
|
|
`;var SP=`<!-- generated by \`npm run doctools\`; do not edit by hand -->
|
|
|
|
|
`;var yP=`<!-- 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>
|
|
|
|
@@ -2848,17 +2849,16 @@ not accepted on that platform.</p>
|
|
|
|
|
</tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
`;var yP=`<h1>Asset Header</h1>
|
|
|
|
|
`;var vP=`<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>
|
|
|
|
|
<pre><code class="language-c">/*{w:8,h:8,bpp:1,count:2,brev:1}*/
|
|
|
|
|
const byte tiles[] = { ... };
|
|
|
|
|
</code></pre>
|
|
|
|
|
<p>From that short comment the editor knows the data is two 8\xD78, 1-bit
|
|
|
|
|
images, most significant bit on the left. You write the header by hand
|
|
|
|
|
once, and from then on the Asset Editor can draw and edit the data for
|
|
|
|
|
you.</p>
|
|
|
|
|
<p>The Asset Editor scans that comment and reads the JSON inside.
|
|
|
|
|
It then knows how to convert the bytes inside the array to and from an image.</p>
|
|
|
|
|
<p>For example, the above comment represents two images, 8x8 pixels, 1 bit per pixel, most significant bit on the left.</p>
|
|
|
|
|
<h2>Header syntax</h2>
|
|
|
|
|
<p>A header is a comment containing a single JSON object, immediately
|
|
|
|
|
followed by a data block. The block ends at the next closing delimiter,
|
|
|
|
@@ -2889,13 +2889,13 @@ which depends on the language:</p>
|
|
|
|
|
</tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
<p><strong>Each number needs a radix prefix so the editor can read it.</strong> It
|
|
|
|
|
recognizes <code>0xNN</code>, <code>$NN</code>, <code>#$NN</code>, <code>%0101</code>, <code>0b0101</code>, <code>8'hNN</code>, <code>8'b0101</code>,
|
|
|
|
|
and assembler <code>hex 1f20\u2026</code> statements. It also remembers the notation you
|
|
|
|
|
used and writes edits back the same way, so a file of <code>$</code>-prefixed bytes
|
|
|
|
|
stays <code>$</code>-prefixed. The one thing it will <em>not</em> read is <strong>plain
|
|
|
|
|
decimal</strong> \u2014 a block of <code>{24,60,126,\u2026}</code> parses as zero values and reports
|
|
|
|
|
<em>\u201CExpected 8 value(s), found 0\u201D</em>.</p>
|
|
|
|
|
<p><strong>Each number needs a radix prefix.</strong>
|
|
|
|
|
It recognizes <code>0xNN</code>, <code>$NN</code>, <code>#$NN</code>, <code>%0101</code>, <code>0b0101</code>, <code>8'hNN</code>, <code>8'b0101</code>,
|
|
|
|
|
and assembler <code>hex aabbcc\u2026</code> statements.
|
|
|
|
|
It remembers the notation you used and writes each number back the same way.
|
|
|
|
|
It does <em>not</em> recognize <strong>plain decimal</strong> numbers
|
|
|
|
|
\u2014 a block of <code>{24,60,126,\u2026}</code> parses as zero values and reports an error.</p>
|
|
|
|
|
<p>Examples:</p>
|
|
|
|
|
<pre><code class="language-c">/*{w:8,h:8,bpp:1,count:2,brev:1}*/
|
|
|
|
|
const byte tiles[] = {
|
|
|
|
|
0xff,0x81,0x81,0x81,0x81,0x81,0x81,0xff,
|
|
|
|
@@ -2904,13 +2904,13 @@ const byte tiles[] = {
|
|
|
|
|
</code></pre>
|
|
|
|
|
<pre><code class="language-asm">;;{w:8,h:8,count:1,brev:1,flip:1};;
|
|
|
|
|
PlayerGfx:
|
|
|
|
|
.byte $18,$3c,$7e,$ff,$ff,$7e,$3c,$18
|
|
|
|
|
.byte $18,$3c,$7e,$ff
|
|
|
|
|
hex ff7e3c18
|
|
|
|
|
;;
|
|
|
|
|
</code></pre>
|
|
|
|
|
<h3>Writing JSON loosely</h3>
|
|
|
|
|
<p>You don\u2019t have to quote the keys. The scanner rewrites <code>([A-Za-z]+):</code> to
|
|
|
|
|
<code>"$1":</code> before parsing, so <code>w:8</code> and <code>"w":8</code> mean the same thing. String
|
|
|
|
|
<em>values</em> still need their quotes, though: <code>pal:"nes"</code>, <code>comp:"rletag"</code>.</p>
|
|
|
|
|
<p>The JSON parser isn\u2019t strict, so you don\u2019t have to \u201Cquote\u201D keys \u2013
|
|
|
|
|
<code>w:8</code> and <code>"w":8</code> mean the same thing.
|
|
|
|
|
String <em>values</em> still need their quotes, though: <code>pal:"nes"</code>, <code>comp:"rletag"</code>.</p>
|
|
|
|
|
<h3>Things to watch out for</h3>
|
|
|
|
|
<ul>
|
|
|
|
|
<li><strong>The first <code>;</code> wins.</strong> In C the block ends at the very next semicolon,
|
|
|
|
@@ -2928,10 +2928,6 @@ const char sprite[] = {
|
|
|
|
|
#embed "sprite.bin"
|
|
|
|
|
};
|
|
|
|
|
</code></pre>
|
|
|
|
|
<p>The path is resolved first exactly as written, then relative to the
|
|
|
|
|
directory of the file containing the header (<code>sub/main.c</code> + <code>data.bin</code> \u2192
|
|
|
|
|
<code>sub/data.bin</code>). The file\u2019s byte length is validated against the format
|
|
|
|
|
the same way inline data is.</p>
|
|
|
|
|
<h3>Overlapping arrays</h3>
|
|
|
|
|
<p>The scanner decides where a data block ends from how the header starts,
|
|
|
|
|
not from the language of the file. A <code>/*{\u2026}*/</code> header always ends at the
|
|
|
|
@@ -2980,7 +2976,7 @@ everything else falls back to a sensible default.</p>
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>np</code></td>
|
|
|
|
|
<td><code>1</code></td>
|
|
|
|
|
<td>Number of bitplanes (colors = 2<sup>bpp\xD7np</sup>)</td>
|
|
|
|
|
<td>Number of bitplanes (colors = 2<sup>bpp\u02D9np</sup>)</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>bpw</code></td>
|
|
|
|
@@ -2995,7 +2991,7 @@ everything else falls back to a sensible default.</p>
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>wpimg</code></td>
|
|
|
|
|
<td><code>sl*h</code></td>
|
|
|
|
|
<td>Words per image \u2014 use when hardware pads images</td>
|
|
|
|
|
<td>Words per image (for padding)</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>pofs</code></td>
|
|
|
|
@@ -3103,10 +3099,9 @@ The picker\u2019s color space is <code>1 << (sum of digits)</code> entries
|
|
|
|
|
block holds.</li>
|
|
|
|
|
<li><strong>A name</strong>: <code>"nes"</code>, <code>"vcs"</code>, <code>"c64"</code>, <code>"gb"</code>, <code>"ap2lores"</code>,
|
|
|
|
|
<code>"astrocade"</code>, or <code>"pacman"</code>.
|
|
|
|
|
These are the only recognized names \u2014 an
|
|
|
|
|
unknown one reports <code>No palette named X</code>.</li>
|
|
|
|
|
An unknown name reports an error.</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<p>Bitmaps pick up their colors from palette blocks <strong>anywhere in the open
|
|
|
|
|
<p>Bitmaps pick up their colors from palette blocks <strong>anywhere in the current
|
|
|
|
|
project</strong>, matched by entry count \u2014 a 4-color bitmap offers every 4-entry
|
|
|
|
|
palette (and every 4-entry slice named by a <code>layout</code>) in a dropdown.
|
|
|
|
|
Projects fall back to a default palette when no palette block matches.</p>
|
|
|
|
@@ -3477,7 +3472,7 @@ bytes).</li>
|
|
|
|
|
</tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
`;var vP=`<h2>Embedding the IDE in a web page</h2>
|
|
|
|
|
`;var QP=`<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>
|
|
|
|
|
</code></pre>
|
|
|
|
@@ -3520,26 +3515,26 @@ containing embeds is effectively sandboxed from the others.</p>
|
|
|
|
|
src="https://8bitworkshop.com/redir.html?embed=1&platform=nes&highlight=&file0_name=testembed.dasm&file0_data=..."></iframe>
|
|
|
|
|
</div>
|
|
|
|
|
</code></pre>
|
|
|
|
|
`;var M5=_g(),Zh=[{id:"index",title:"IDE Help",html:nP},{id:"editor",title:"Editor",html:sP},{id:"disasm",title:"Disassembly",html:oP},{id:"memory",title:"Memory Browser",html:aP},{id:"memmap",title:"Memory Map",html:lP},{id:"vram",title:"VRAM Browser",html:cP},{id:"memprobe",title:"Memory Probe",html:dP},{id:"crtprobe",title:"CRT Probe",html:hP},{id:"probelog",title:"Probe Log",html:uP},{id:"scanlineio",title:"Scanline I/O",html:fP},{id:"symbols",title:"Symbol Profiler",html:OP},{id:"callstack",title:"Call Stack",html:pP},{id:"debugtree",title:"Debug Tree",html:mP},{id:"breakpoints",title:"Breakpoints",html:gP},{id:"asseteditor",title:"Asset Editor",html:bP},{id:"managing-files",title:"Managing Files",html:xP},{id:"build-directives",title:"Build Directives",html:wP},{id:"toolchains",title:"Toolchains & Platforms",html:SP},{id:"asset-headers",title:"Asset Headers",html:yP},{id:"embedding-ide",title:"Embedding the IDE",html:vP}],Rg={};for(let r of Zh)Rg[r.id]=r;xy(()=>Zh);function Cg(r){let e=r||"";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(/^\.\//,""),Rg[e]?e:"index"}function L5(r){return Rg[Cg(r)]}var Y5={"#disasm":"disasm","#memory":"memory","#memmap":"memmap","#vram":"vram","#memprobe":"memprobe","#crtprobe":"crtprobe","#probelog":"probelog","#scanlineio":"scanlineio","#symbols":"symbols","#callstack":"callstack","#debugtree":"debugtree","#breakpoints":"breakpoints","#asseteditor":"asseteditor"};function DP(r,e){return e?"editor":r&&Y5[r]||"index"}function W5(r){r.querySelectorAll("a[href]").forEach(t=>{let i=t.getAttribute("href");if(!i)return;if(/^[a-z][a-z0-9+.-]*:/i.test(i)){t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer");return}if(i.startsWith("/")||i.startsWith("#"))return;let n=i.indexOf("#"),s=n>=0?i.substring(0,n):i;s.endsWith(".md")&&(t.setAttribute("href","#help/"+Cg(s)),t.removeAttribute("target"))})}function V5(r,e){let t=L5(e);r.innerHTML=M5.sanitize(t.html),W5(r)}var tl=class{constructor(e){this.id=Cg(e||"index")}getPath(){return"#help/"+this.id}createDiv(e){return this.maindiv=Cr(e,"vertical-scroll help-view"),V5(this.maindiv[0],this.id),this.maindiv[0]}refresh(e){}};var rl=256,IP=100,qP=!1,Uh=class r{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.createElement("div"),this._header.classList.add("tree-header"),this._header.classList.add("tree-level-"+this.level),this._header.append(this.name),this._inline=document.createElement("span"),this._inline.classList.add("tree-value"),this._header.append(this._inline),this._div.append(this._header),this.parent._content.append(this._div),this._header.onclick=e=>{this.toggleExpanded()}),this.expanded&&this._content==null?(this._content=document.createElement("div"),this._div.append(this._content)):!this.expanded&&this._content!=null&&(this._content.remove(),this._content=null,this.children.clear()),this._div}toggleExpanded(){this.expanded=!this.expanded,this.view.tick()}remove(){this._div.remove(),this._div=null}update(e){this.getDiv();var t="";if(e&&e.$$&&typeof e.$$=="function"&&this._content!=null&&(e=e.$$()),e==null)t=e+"";else if(typeof e=="number")e!=(e|0)?t=e.toString():t=e+" ($"+be(e)+")";else if(typeof e=="boolean")t=e.toString();else if(typeof e=="string")e.length<IP?t=e:t=e.substring(0,IP)+"...";else if(e.buffer&&e.length<=rl)t=Kg(e,0,e.length);else if(typeof e=="object"||typeof e=="function")if(this._content!=null){if(e.slice&&e.length>rl){let l={},c=e;for(var i=rl;e.length/i>rl;)i*=2;for(let d=0;d<c.length;d+=i)l["$"+be(d)]={$$:()=>c.slice(d,d+i)};e=l}if(e instanceof Map){let l={};for(let[c,d]of e.entries())l[c]=d;e=l}let o=e instanceof Array?Array.from(e.keys()):Object.getOwnPropertyNames(e);if(o.length>rl){let l={},c=e;for(var i=100;o.length/i>100;)i*=2;for(let h=0;h<o.length;h+=i){for(var n={},s=h;s<h+i;s++)n[o[s]]=c[o[s]];l["["+h+"...]"]=n}e=l,o=Object.getOwnPropertyNames(e)}let a=new Set(this.children.keys());o.forEach(l=>{var c=!qP&&typeof l=="string"&&l.startsWith("$$");if(!c){let d=this.children.get(l);d==null&&(d=new r(this,l),this.children.set(l,d)),d.update(e[l])}a.delete(l)}),a.forEach(l=>{this.children.get(l).remove(),this.children.delete(l)}),this._header.classList.add("tree-expanded"),this._header.classList.remove("tree-collapsed")}else this._header.classList.add("tree-collapsed"),this._header.classList.remove("tree-expanded");else t=typeof e;this._inline.innerText!=t&&(this._inline.innerText=t)}};function FP(r,e){var t=new Uh(null,null);t.view=e,t._content=r;var i=new Uh(t,"/");return i.expanded=!0,i.getDiv(),i._div.style.padding="0px",i}var Ag=class{createDiv(e){return this.root=FP(e,this),th
Line truncated
|
|
|
|
|
`,await GP(r),re.newfile?!i&&!t?ye('No build tool for "'+r+'" on this platform; project will not build.'):i?r$(!0,!0):kt("No skeleton file for "+t+" on this platform; using blank file."):kt('Could not find file "'+r+'"<br><br>Creating new '+(i?t:"blank")+" file."),delete re.newfile,Kh()}}function Yg(r){if(r=="/")re={repo:"/"};else if(r.indexOf("://")>=0){var e=wa(r);e&&(re={repo:e.repopath})}else re.platform=ae,re.file=r;Fn()}async function K5(r){var e=vu(w.getToolForFilename(r));try{return await $.get("presets/"+$t(ae)+"/skeleton."+e,"text")}catch(t){return console.log(t+""),null}}function Wg(r){return r.indexOf(" ")>=0?(ye("No spaces in filenames, please."),!1):!0}async function J5(r){var e=$t(ae),t={},i=[];for(var n of r){var s=w.getToolForFilename("test"+n);t[s]||(t[s]=[],i.push(s)),t[s].push(n)}var o=i.map(d=>$.ajax({url:"presets/"+e+"/skeleton."+vu(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 ez(r){var e=await J5(w.getDefaultExtensions()),t,i;return e.length===0?(t=w.getDefaultExtensions(),i=t.join(" ")):(t=e.reduce((n,s)=>n.concat(s.extensions),[]),i=e.map(n=>n.extensions.join(" ")).join("<br>")),bootbox.prompt({title:"Enter the name of your new main source file.<br><br><span class='dialog-help'>"+i+"</span>",placeholder:"newfile"+t[0],callback:n=>{if(n&&n.trim().length>0){if(!Wg(n))return;n.indexOf(".")<0&&(n+=t[0]);var s=n;re.newfile="1",Yg(s)}}}),!0}function tz(r){let e=$('<input type="file" multiple accept="*" style="display:none">'),t=e[0];e.change(i=>{rz(t.files)}),e.click()}function rz(r){console.log(r);var e=0;function t(){var i=r[e++];if(!i)console.log("Done uploading",e),e>2?(kt("Files uploaded."),setTimeout(al,1e3)):(re.file=r[0].name,bootbox.confirm({message:"Open '"+pn.sanitize(re.file)+"' as main project file?",buttons:{confirm:{label:"Open As New Project"},cancel:{label:"Include/Link With Project Later"}},callback:o=>{o?Fn():setTimeout(al,1e3)}}));else{var n=i.name,s=new FileReader;s.onload=function(o){var a=o.target.result,l=new Uint8Array(a);Pn(n,l)||(l=kl(l).replace(`\r
|
|
|
|
|
`;var Y5=Rg(),Zh=[{id:"index",title:"IDE Help",html:sP},{id:"editor",title:"Editor",html:oP},{id:"disasm",title:"Disassembly",html:aP},{id:"memory",title:"Memory Browser",html:lP},{id:"memmap",title:"Memory Map",html:cP},{id:"vram",title:"VRAM Browser",html:dP},{id:"memprobe",title:"Memory Probe",html:hP},{id:"crtprobe",title:"CRT Probe",html:uP},{id:"probelog",title:"Probe Log",html:fP},{id:"scanlineio",title:"Scanline I/O",html:OP},{id:"symbols",title:"Symbol Profiler",html:pP},{id:"callstack",title:"Call Stack",html:mP},{id:"debugtree",title:"Debug Tree",html:gP},{id:"breakpoints",title:"Breakpoints",html:bP},{id:"asseteditor",title:"Asset Editor",html:xP},{id:"managing-files",title:"Managing Files",html:wP},{id:"build-directives",title:"Build Directives",html:SP},{id:"toolchains",title:"Toolchains & Platforms",html:yP},{id:"asset-headers",title:"Asset Headers",html:vP},{id:"embedding-ide",title:"Embedding the IDE",html:QP}],Cg={};for(let r of Zh)Cg[r.id]=r;wy(()=>Zh);function Ag(r){let e=r||"";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(/^\.\//,""),Cg[e]?e:"index"}function W5(r){return Cg[Ag(r)]}var V5={"#disasm":"disasm","#memory":"memory","#memmap":"memmap","#vram":"vram","#memprobe":"memprobe","#crtprobe":"crtprobe","#probelog":"probelog","#scanlineio":"scanlineio","#symbols":"symbols","#callstack":"callstack","#debugtree":"debugtree","#breakpoints":"breakpoints","#asseteditor":"asseteditor"};function IP(r,e){return e?"editor":r&&V5[r]||"index"}function j5(r){r.querySelectorAll("a[href]").forEach(t=>{let i=t.getAttribute("href");if(!i)return;if(/^[a-z][a-z0-9+.-]*:/i.test(i)){t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer");return}if(i.startsWith("/")||i.startsWith("#"))return;let n=i.indexOf("#"),s=n>=0?i.substring(0,n):i;s.endsWith(".md")&&(t.setAttribute("href","#help/"+Ag(s)),t.removeAttribute("target"))})}function D5(r,e){let t=W5(e);r.innerHTML=Y5.sanitize(t.html),j5(r)}var tl=class{constructor(e){this.id=Ag(e||"index")}getPath(){return"#help/"+this.id}createDiv(e){return this.maindiv=Cr(e,"vertical-scroll help-view"),D5(this.maindiv[0],this.id),this.maindiv[0]}refresh(e){}};var rl=256,qP=100,FP=!1,Uh=class r{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.createElement("div"),this._header.classList.add("tree-header"),this._header.classList.add("tree-level-"+this.level),this._header.append(this.name),this._inline=document.createElement("span"),this._inline.classList.add("tree-value"),this._header.append(this._inline),this._div.append(this._header),this.parent._content.append(this._div),this._header.onclick=e=>{this.toggleExpanded()}),this.expanded&&this._content==null?(this._content=document.createElement("div"),this._div.append(this._content)):!this.expanded&&this._content!=null&&(this._content.remove(),this._content=null,this.children.clear()),this._div}toggleExpanded(){this.expanded=!this.expanded,this.view.tick()}remove(){this._div.remove(),this._div=null}update(e){this.getDiv();var t="";if(e&&e.$$&&typeof e.$$=="function"&&this._content!=null&&(e=e.$$()),e==null)t=e+"";else if(typeof e=="number")e!=(e|0)?t=e.toString():t=e+" ($"+be(e)+")";else if(typeof e=="boolean")t=e.toString();else if(typeof e=="string")e.length<qP?t=e:t=e.substring(0,qP)+"...";else if(e.buffer&&e.length<=rl)t=Jg(e,0,e.length);else if(typeof e=="object"||typeof e=="function")if(this._content!=null){if(e.slice&&e.length>rl){let l={},c=e;for(var i=rl;e.length/i>rl;)i*=2;for(let d=0;d<c.length;d+=i)l["$"+be(d)]={$$:()=>c.slice(d,d+i)};e=l}if(e instanceof Map){let l={};for(let[c,d]of e.entries())l[c]=d;e=l}let o=e instanceof Array?Array.from(e.keys()):Object.getOwnPropertyNames(e);if(o.length>rl){let l={},c=e;for(var i=100;o.length/i>100;)i*=2;for(let h=0;h<o.length;h+=i){for(var n={},s=h;s<h+i;s++)n[o[s]]=c[o[s]];l["["+h+"...]"]=n}e=l,o=Object.getOwnPropertyNames(e)}let a=new Set(this.children.keys());o.forEach(l=>{var c=!FP&&typeof l=="string"&&l.startsWith("$$");if(!c){let d=this.children.get(l);d==null&&(d=new r(this,l),this.children.set(l,d)),d.update(e[l])}a.delete(l)}),a.forEach(l=>{this.children.get(l).remove(),this.children.delete(l)}),this._header.classList.add("tree-expanded"),this._header.classList.remove("tree-collapsed")}else this._header.classList.add("tree-collapsed"),this._header.classList.remove("tree-expanded");else t=typeof e;this._inline.innerText!=t&&(this._inline.innerText=t)}};function BP(r,e){var t=new Uh(null,null);t.view=e,t._content=r;var i=new Uh(t,"/");return i.expanded=!0,i.getDiv(),i._div.style.padding="0px",i}var Eg=class{createDiv(e){return this.root=BP(e,this),th
Line truncated
|
|
|
|
|
`,await HP(r),re.newfile?!i&&!t?ye('No build tool for "'+r+'" on this platform; project will not build.'):i?i$(!0,!0):kt("No skeleton file for "+t+" on this platform; using blank file."):kt('Could not find file "'+r+'"<br><br>Creating new '+(i?t:"blank")+" file."),delete re.newfile,Kh()}}function Wg(r){if(r=="/")re={repo:"/"};else if(r.indexOf("://")>=0){var e=wa(r);e&&(re={repo:e.repopath})}else re.platform=ae,re.file=r;Fn()}async function ez(r){var e=vu(S.getToolForFilename(r));try{return await $.get("presets/"+$t(ae)+"/skeleton."+e,"text")}catch(t){return console.log(t+""),null}}function Vg(r){return r.indexOf(" ")>=0?(ye("No spaces in filenames, please."),!1):!0}async function tz(r){var e=$t(ae),t={},i=[];for(var n of r){var s=S.getToolForFilename("test"+n);t[s]||(t[s]=[],i.push(s)),t[s].push(n)}var o=i.map(d=>$.ajax({url:"presets/"+e+"/skeleton."+vu(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 rz(r){var e=await tz(S.getDefaultExtensions()),t,i;return e.length===0?(t=S.getDefaultExtensions(),i=t.join(" ")):(t=e.reduce((n,s)=>n.concat(s.extensions),[]),i=e.map(n=>n.extensions.join(" ")).join("<br>")),bootbox.prompt({title:"Enter the name of your new main source file.<br><br><span class='dialog-help'>"+i+"</span>",placeholder:"newfile"+t[0],callback:n=>{if(n&&n.trim().length>0){if(!Vg(n))return;n.indexOf(".")<0&&(n+=t[0]);var s=n;re.newfile="1",Wg(s)}}}),!0}function iz(r){let e=$('<input type="file" multiple accept="*" style="display:none">'),t=e[0];e.change(i=>{nz(t.files)}),e.click()}function nz(r){console.log(r);var e=0;function t(){var i=r[e++];if(!i)console.log("Done uploading",e),e>2?(kt("Files uploaded."),setTimeout(al,1e3)):(re.file=r[0].name,bootbox.confirm({message:"Open '"+pn.sanitize(re.file)+"' as main project file?",buttons:{confirm:{label:"Open As New Project"},cancel:{label:"Include/Link With Project Later"}},callback:o=>{o?Fn():setTimeout(al,1e3)}}));else{var n=i.name,s=new FileReader;s.onload=function(o){var a=o.target.result,l=new Uint8Array(a);Pn(n,l)||(l=kl(l).replace(`\r
|
|
|
|
|
`,`
|
|
|
|
|
`)),V.updateFile(n,l),console.log("Uploaded "+n+" "+l.length+" bytes"),t()},s.readAsArrayBuffer(i)}}r&&t()}async function iz(r){var e=window.showDirectoryPicker;e||ye("This browser can't open local files on your computer, yet. Try Chrome.");var t=await e(),i=t.name,n="__localfs__"+i,s={handle:t},o=Mg.createInstance({name:n,version:2});await o.setItem(n,s),re={localfs:i},Fn(!0)}async function nz(r){return new Promise((e,t)=>{bootbox.prompt(pn.sanitize(r),i=>{e(i)})})}async function sz(r){let e={mode:"readwrite"};var t="__localfs__"+r,i=Mg.createInstance({name:t,version:2}),n=await i.getItem(t),s=n.handle;console.log(n,s);var o=await s.queryPermission(e);if(console.log(o),o!=="granted"&&(await nz("Request permissions to access filesystem?"),o=await s.requestPermission(e)),o!=="granted"){ye("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(),h=await(Pn(l)?d.arrayBuffer():d.text());return h instanceof ArrayBuffer?new Uint8Array(h):h},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 lt(){return ft(K.mainPath)}function sy(){return ft(V.getActiveID())}function oz(r){var e=V.getActive(),t=V.getActiveID(),i=e&&e.setData&&!e.setText;if(e&&(e.setText||e.setData)){var n="presets/"+$t(ae)+"/"+t;Ao(n,s=>{if(s==null){ht?ye("Can only revert built-in examples. If you want to revert all files, You can pull from the repository."):ye("Can only revert built-in examples.");return}bootbox.confirm("Reset '"+pn.sanitize(t)+"' to default?",o=>{o&&(i?(e.setData(s),K.updateFile(t,s)):e.setText(s))})},i?"arraybuffer":"text")}else ye("Cannot revert the active window. Please choose a text file.")}function az(r){var e=V.getActive();if(e&&e.getPath){var t=V.getActiveID();bootbox.confirm("Delete '"+pn.sanitize(t)+"'?",i=>{i&&Er.removeItem(t).then(()=>{re.file==t?(Ri.unsetLastPreset(),Fn()):(al(),kt("Deleted "+t))})})}else ye("Cannot delete the active window.")}function lz(r){var e=V.getActive();if(e&&e.getPath&&K.getFile(e.getPath())){var t=V.getActiveID();bootbox.prompt({title:"Rename '"+pn.sanitize(t)+"' to?",value:t,callback:i=>{var n=K.getFile(e.getPath());if(i&&i!=t&&n){if(!Wg(i))return;Er.removeItem(t).then(()=>Er.setItem(i,n)).then(()=>{al(),alert("Renamed "+t+" to "+i),t==K.mainPath&&Yg(i)})}}})}else ye("Cannot rename the active window.")}function cz(r){let e={},t,i=w.getPresets?w.getPresets():[];for(var n=0;n<i.length;n++){var s=i[n],o=s.chapter?s.chapter+". "+s.name:s.name,a=s.id==K.mainPath;s.category?t=$("<optgroup />").attr("label","Examples: "+s.category).appendTo(r):t||(t=$("<optgroup />").attr("label","Examples").appendTo(r)),t.append($("<option />").val(s.id).text(o).attr("selected",a?"selected":null)),a&&(Wh=s),e[s.id]=o}return e}function dz(r){if(It&&!go){var e=0,t=Dn();if(t){let n=$("<optgroup />").attr("label","Repositories").appendTo(r);for(let s in t){var i=t[s];i.platform_id&&$t(i.platform_id)==$t(ae)&&n.append($("<option />").val(i.url).text(i.url.substring(i.url.indexOf("/"))))}}}}async function HP(r,e,t,i){let n=await Er.keys();n||(n=[]);let s;for(var o=0;o<n.length;o++){let a=n[o];if(a.startsWith(t)&&!i[a]){s||(s=$("<optgroup />").attr("label",e).appendTo(r));let l=a.substring(t.length);s.append($("<option />").val(a).text(l).attr("selected",a==K.mainPath?"selected":null))}}}function KP(r){r.css("visibility","visible");var e=K.mainPath;r.val()!=e&&r.append($("<option />").val(e).text(e).attr("selected","selected"))}async function al(){var r=$("#preset_select").empty();if(ht)r.append($("<option />").val("/").text("Leave Repository")),$("#repo_name").text(ft(ht)+"/").show(),await HP(r,ht,"",{}),KP(r);else{dz(r);var e=cz(r);await HP(r,"Local Files","",e),KP(r)}r.off("change").change(function(t){Yg($(this).val().toString())})}function hz(r){var e=$("<p/>");if(r.path!=null){var t=r.line?r.label?`(${r.path} @ ${r.label})`:`(${r.path}:${r.line})`:`(${r.path})`,i=$("<a/>").text(t),n=r.path;n==lt()&&(n=K.mainPath),V.isWindow(n)&&i.click(s=>{var o=V.createOrShow(n);o instanceof jt&&o.navigateToLine(r.line)}),e.append(i),e.append(" ")}return e.append($("<span/>").text(r.msg)),e}function i$(){$("#error_alert").hide(),Lg=!1}function Vg(r,e){var t=$("#error_alert_msg").empty();for(var i of r.slice(0,10))t.append(hz(i));$("#error_alert").show(),Lg=e;var n=r.find(o=>o.path!=null),s;n&&V.isWindow(n.path==lt()?K.mainPath:n.path)&&(s=()=>{Oz(n)})}function n$(r,e){if(e!=null){var t={msg:e,line:0};r instanceof mu&&r.$loc&&(t=Object.create(r.$loc),t.msg=e,console.log(t)),Vg([t],!0)}}async function uz(r){if("uppercaseOnly"in r&&M1(r.uppercaseOnly),"erro
Line truncated
|
|
|
|
|
`)),W.updateFile(n,l),console.log("Uploaded "+n+" "+l.length+" bytes"),t()},s.readAsArrayBuffer(i)}}r&&t()}async function sz(r){var e=window.showDirectoryPicker;e||ye("This browser can't open local files on your computer, yet. Try Chrome.");var t=await e(),i=t.name,n="__localfs__"+i,s={handle:t},o=Lg.createInstance({name:n,version:2});await o.setItem(n,s),re={localfs:i},Fn(!0)}async function oz(r){return new Promise((e,t)=>{bootbox.prompt(pn.sanitize(r),i=>{e(i)})})}async function az(r){let e={mode:"readwrite"};var t="__localfs__"+r,i=Lg.createInstance({name:t,version:2}),n=await i.getItem(t),s=n.handle;console.log(n,s);var o=await s.queryPermission(e);if(console.log(o),o!=="granted"&&(await oz("Request permissions to access filesystem?"),o=await s.requestPermission(e)),o!=="granted"){ye("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(),h=await(Pn(l)?d.arrayBuffer():d.text());return h instanceof ArrayBuffer?new Uint8Array(h):h},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 lt(){return ft(K.mainPath)}function oy(){return ft(W.getActiveID())}function lz(r){var e=W.getActive(),t=W.getActiveID(),i=e&&e.setData&&!e.setText;if(e&&(e.setText||e.setData)){var n="presets/"+$t(ae)+"/"+t;Ao(n,s=>{if(s==null){ht?ye("Can only revert built-in examples. If you want to revert all files, You can pull from the repository."):ye("Can only revert built-in examples.");return}bootbox.confirm("Reset '"+pn.sanitize(t)+"' to default?",o=>{o&&(i?(e.setData(s),K.updateFile(t,s)):e.setText(s))})},i?"arraybuffer":"text")}else ye("Cannot revert the active window. Please choose a text file.")}function cz(r){var e=W.getActive();if(e&&e.getPath){var t=W.getActiveID();bootbox.confirm("Delete '"+pn.sanitize(t)+"'?",i=>{i&&Er.removeItem(t).then(()=>{re.file==t?(Ri.unsetLastPreset(),Fn()):(al(),kt("Deleted "+t))})})}else ye("Cannot delete the active window.")}function dz(r){var e=W.getActive();if(e&&e.getPath&&K.getFile(e.getPath())){var t=W.getActiveID();bootbox.prompt({title:"Rename '"+pn.sanitize(t)+"' to?",value:t,callback:i=>{var n=K.getFile(e.getPath());if(i&&i!=t&&n){if(!Vg(i))return;Er.removeItem(t).then(()=>Er.setItem(i,n)).then(()=>{al(),alert("Renamed "+t+" to "+i),t==K.mainPath&&Wg(i)})}}})}else ye("Cannot rename the active window.")}function hz(r){let e={},t,i=S.getPresets?S.getPresets():[];for(var n=0;n<i.length;n++){var s=i[n],o=s.chapter?s.chapter+". "+s.name:s.name,a=s.id==K.mainPath;s.category?t=$("<optgroup />").attr("label","Examples: "+s.category).appendTo(r):t||(t=$("<optgroup />").attr("label","Examples").appendTo(r)),t.append($("<option />").val(s.id).text(o).attr("selected",a?"selected":null)),a&&(Wh=s),e[s.id]=o}return e}function uz(r){if(It&&!go){var e=0,t=Dn();if(t){let n=$("<optgroup />").attr("label","Repositories").appendTo(r);for(let s in t){var i=t[s];i.platform_id&&$t(i.platform_id)==$t(ae)&&n.append($("<option />").val(i.url).text(i.url.substring(i.url.indexOf("/"))))}}}}async function KP(r,e,t,i){let n=await Er.keys();n||(n=[]);let s;for(var o=0;o<n.length;o++){let a=n[o];if(a.startsWith(t)&&!i[a]){s||(s=$("<optgroup />").attr("label",e).appendTo(r));let l=a.substring(t.length);s.append($("<option />").val(a).text(l).attr("selected",a==K.mainPath?"selected":null))}}}function JP(r){r.css("visibility","visible");var e=K.mainPath;r.val()!=e&&r.append($("<option />").val(e).text(e).attr("selected","selected"))}async function al(){var r=$("#preset_select").empty();if(ht)r.append($("<option />").val("/").text("Leave Repository")),$("#repo_name").text(ft(ht)+"/").show(),await KP(r,ht,"",{}),JP(r);else{uz(r);var e=hz(r);await KP(r,"Local Files","",e),JP(r)}r.off("change").change(function(t){Wg($(this).val().toString())})}function fz(r){var e=$("<p/>");if(r.path!=null){var t=r.line?r.label?`(${r.path} @ ${r.label})`:`(${r.path}:${r.line})`:`(${r.path})`,i=$("<a/>").text(t),n=r.path;n==lt()&&(n=K.mainPath),W.isWindow(n)&&i.click(s=>{var o=W.createOrShow(n);o instanceof jt&&o.navigateToLine(r.line)}),e.append(i),e.append(" ")}return e.append($("<span/>").text(r.msg)),e}function n$(){$("#error_alert").hide(),Yg=!1}function jg(r,e){var t=$("#error_alert_msg").empty();for(var i of r.slice(0,10))t.append(fz(i));$("#error_alert").show(),Yg=e;var n=r.find(o=>o.path!=null),s;n&&W.isWindow(n.path==lt()?K.mainPath:n.path)&&(s=()=>{mz(n)})}function s$(r,e){if(e!=null){var t={msg:e,line:0};r instanceof mu&&r.$loc&&(t=Object.create(r.$loc),t.msg=e,console.log(t)),jg([t],!0)}}async function Oz(r){if("uppercaseOnly"in r&&L1(r.uppercaseOnly),"erro
Line truncated
|
|
|
|
|
`),e.SP&&(t+="c.SP < 0x"+be(e.SP)+`
|
|
|
|
|
`),e.HL&&(t+=`c.HL == 0x4000
|
|
|
|
|
`),w.readAddress&&(t+=`this.readAddress(0x1234) == 0x0
|
|
|
|
|
`),w.readVRAMAddress&&(t+=`this.readVRAMAddress(0x1234) != 0x80
|
|
|
|
|
`),w.getRasterScanline&&(t+=`this.getRasterScanline() > 222
|
|
|
|
|
`),t}function Qz(r){var e=new Function("c","return ("+r+");").bind(w);Kr(),w.runEval(e),t$=r}function S$(){w.isRunning()?(V.tick(),Vh=!1):Vh||(V.tick(),Vh=!0),setTimeout(S$,100)}function Hh(r){w.setFrameRate(r),r>.01?$("#fps_label").text(r.toFixed(2)):$("#fps_label").text("1/"+Math.round(1/r))}function Pz(){var r=w.getFrameRate();r=r/2,r>1e-5&&Hh(r)}function $z(){var r=w.getFrameRate();r=Math.min(60,r*2),Hh(r)}function kz(){Hh(60/65536)}function Tz(){Ci(),Hh(60)}function Xz(){V.refresh(!1);var r=V.getActive();if(r.getSourceFile&&r.setTimingResult){var e=w.newCodeAnalyzer();e.showLoopTimingForPC(0),r.setTimingResult(e)}}function Dg(){po&&(w.setRecorder(null),$("#dbg_record").removeClass("btn_recording"),$("#replaydiv").hide(),Nh(),po=!1)}function y$(){po&&Dt.reset()}function v$(){Dt.reset(),w.setRecorder(Dt),$("#dbg_record").addClass("btn_recording"),$("#replaydiv").show(),po=!0}function _z(){po?Dg():v$(),Mr()}function Rz(){var r=!jt.tracingEnabled;$("#dbg_tracelines").toggleClass("btn_active",r);var e=V.getActive();e instanceof jt?e.setTracingEnabled(r):jt.tracingEnabled=r}function ei(r,e,t){var i=V.getActive();i&&i.insertLinesBefore?bootbox.prompt({title:"Add "+pn.sanitize(r)+" File to Project",value:"filename"+pn.sanitize(e),callback:n=>{if(n&&n.trim().length>0){if(!Wg(n))return;var s=n,o=`
|
|
|
|
|
`),S.readAddress&&(t+=`this.readAddress(0x1234) == 0x0
|
|
|
|
|
`),S.readVRAMAddress&&(t+=`this.readVRAMAddress(0x1234) != 0x80
|
|
|
|
|
`),S.getRasterScanline&&(t+=`this.getRasterScanline() > 222
|
|
|
|
|
`),t}function $z(r){var e=new Function("c","return ("+r+");").bind(S);Kr(),S.runEval(e),r$=r}function y$(){S.isRunning()?(W.tick(),Vh=!1):Vh||(W.tick(),Vh=!0),setTimeout(y$,100)}function Hh(r){S.setFrameRate(r),r>.01?$("#fps_label").text(r.toFixed(2)):$("#fps_label").text("1/"+Math.round(1/r))}function kz(){var r=S.getFrameRate();r=r/2,r>1e-5&&Hh(r)}function Tz(){var r=S.getFrameRate();r=Math.min(60,r*2),Hh(r)}function Xz(){Hh(60/65536)}function _z(){Ci(),Hh(60)}function Rz(){W.refresh(!1);var r=W.getActive();if(r.getSourceFile&&r.setTimingResult){var e=S.newCodeAnalyzer();e.showLoopTimingForPC(0),r.setTimingResult(e)}}function Ig(){po&&(S.setRecorder(null),$("#dbg_record").removeClass("btn_recording"),$("#replaydiv").hide(),Nh(),po=!1)}function v$(){po&&Dt.reset()}function Q$(){Dt.reset(),S.setRecorder(Dt),$("#dbg_record").addClass("btn_recording"),$("#replaydiv").show(),po=!0}function Cz(){po?Ig():Q$(),Mr()}function Az(){var r=!jt.tracingEnabled;$("#dbg_tracelines").toggleClass("btn_active",r);var e=W.getActive();e instanceof jt?e.setTracingEnabled(r):jt.tracingEnabled=r}function ei(r,e,t){var i=W.getActive();i&&i.insertLinesBefore?bootbox.prompt({title:"Add "+pn.sanitize(r)+" File to Project",value:"filename"+pn.sanitize(e),callback:n=>{if(n&&n.trim().length>0){if(!Vg(n))return;var s=n,o=`
|
|
|
|
|
`+t(n)+`
|
|
|
|
|
`;K.loadFiles([s]).then(a=>{a&&a.length?ye(n+" already exists; including anyway"):K.updateFile(s,`
|
|
|
|
|
`),i.insertLinesBefore(o),Oo()})}}}):ye("Can't insert text in this window -- switch back to main file")}function Cz(){var r=lt(),e=w.getToolForFilename(r);r.endsWith(".c")||e=="sdcc"||e=="cc65"||e=="cmoc"||e=="smlrc"?ei("Header",".h",t=>'#include "'+t+'"'):e=="dasm"||e=="zmac"?ei("Include",".inc",t=>' include "'+t+'"'):e=="ca65"||e=="sdasz80"||e=="vasm"||e=="armips"?ei("Include",".inc",t=>' .include "'+t+'"'):e=="verilator"?ei("Verilog",".v",t=>'`include "'+t+'"'):e=="wiz"?ei("Include",".wiz",t=>'import "'+t+'";'):e=="ecs"?ei("Include",".ecs",t=>'import "'+t+'"'):e=="acme"?ei("Include",".acme",t=>'!src "'+t+'"'):e=="xa"?ei("Include",".xa",t=>'#include "'+t+'"'):e=="dialog"?ei("Include",".dg",t=>'%% #include "'+t+'"'):ye("Can't add include file to this project type ("+e+")")}function Az(){var r=lt(),e=w.getToolForFilename(r);r.endsWith(".c")||e=="sdcc"||e=="cc65"||e=="cmoc"||e=="smlrc"?ei("Linked C (or .s)",".c",t=>'//#link "'+t+'"'):r.endsWith("asm")||r.endsWith(".s")||e=="ca65"||e=="lwasm"?ei("Linked ASM",".inc",t=>';#link "'+t+'"'):ye("Can't add linked file to this project type ("+e+")")}function Ez(){if(Ke=new Cl($("#toolbar")[0],null),Ke.grp.prop("id","run_bar"),Ke.add("mod+shift+r","Reset","glyphicon-refresh",x$).prop("id","dbg_reset"),Ke.add("mod+shift+h","Pause","glyphicon-pause",c$).prop("id","dbg_pause"),Ke.add("mod+shift+g","Go To Address","",i=>{o$()||Fh()}),Ke.add("mod+shift+g","Resume","glyphicon-play",Fh).prop("id","dbg_go"),Ke.add("F8","Pause/Resume","",d$),Ke.add("F1","Help","",Q$),w.restartAtPC&&Ke.add("mod+shift+a","Restart at Cursor","glyphicon-play-circle",p$).prop("id","dbg_restartatline"),Ke.newGroup(),Ke.grp.prop("id","debug_bar"),w.runEval&&Ke.add("mod+shift+d","Reset and Debug","glyphicon-fast-backward",w$).prop("id","dbg_restart"),w.stepBack&&Ke.add("mod+shift+j","Step Backwards","glyphicon-step-backward",b$).prop("id","dbg_stepback"),w.step&&Ke.add("mod+shift+l","Single Step","glyphicon-step-forward",h$).prop("id","dbg_step"),w.stepOver&&Ke.add("mod+shift+k","Step Over","glyphicon-hand-right",u$).prop("id","dbg_stepover"),w.runUntilReturn&&Ke.add("mod+shift+i","Step Out of Subroutine","glyphicon-hand-up",g$).prop("id","dbg_stepout"),w.runToVsync&&Ke.add("mod+shift+x","Next Frame/Interrupt","glyphicon-forward",f$).prop("id","dbg_tovsync"),(w.runEval||w.runToPC)&&!ae.startsWith("verilog")&&Ke.add("mod+shift+y","Run To Line","glyphicon-save",m$).prop("id","dbg_toline"),Ke.newGroup(),Ke.grp.prop("id","xtra_bar"),Ke.add("mod+shift+f","Search","glyphicon-search",ug).prop("id","dbg_search"),$(".dropdown-menu").collapse({toggle:!1}),$("#item_new_file").click(ez),$("#item_upload_file").click(tz),$("#item_open_directory").click(iz),$("#item_github_login").click(oy),$("#item_github_logout").click(ay),$("#item_github_import").click(ly),$("#item_github_publish").click(cy),$("#item_github_push").click(dy),$("#item_github_pull").click(hy),$("#item_repo_delete").click(fy),$("#item_share_file").click(GS),$("#item_reset_file").click(oz),$("#item_rename_file").click(lz),$("#item_delete_file").click(az),w.runEval?$("#item_debug_expr").click(yz).show():$("#item_debug_expr").hide(),$("#item_download_rom").click(KS),$("#item_download_file").click(JS),$("#item_download_zip").click(ty),w.getDebugSymbolFile?$("#item_download_sym").click(ry):$("#item_download_sym").hide(),$("#item_download_allzip").click(iy),$("#item_record_video").click(ny),ap()?$("#item_export_cassette").click(HS):$("#item_export_cassette").hide(),w.setFrameRate&&w.getFrameRate&&($("#dbg_slower").click(Pz),$("#dbg_faster").click($z),$("#dbg_slowest").click(kz),$("#dbg_fastest").click(Tz)),$("#item_addfile_include").click(Cz),$("#item_addfile_link").click(Az),$("#item_request_persist").click(()=>r$(!0,!1)),$("#item_settings").click(WS),S$(),w.newCodeAnalyzer&&Ke.add(null,"Analyze CPU Timing","glyphicon-time",Xz),w.startProbing&&Ke.add(null,"Highlight Executed Lines","glyphicon-fire",Rz).prop("id","dbg_tracelines"),w.setRecorder&&w.advance&&Uz(),w.showHelp){let{li:i,a:n}=jh("help__"+ae,Ih+" Help");$("#help_menu").append(i),$(n).click(s=>{s.preventDefault(),window.open(w.showHelp(),"_8bws_help")})}let r=w.getToolForFilename(lt()),e=r&&Nt(r),t=e==null?void 0:e.helpURL;if(t){let i=r+" Help";e.version&&(i+=" ("+e.version+")");let{li:n,a:s}=jh("help__"+r,i);$("#help_menu").append(n),$(s).click(o=>{o.preventDefault(),window.open(t,"_8bws_help")})}{let{li:i}=jh("#help","IDE Help");$("#help_menu").prepend(i)}$("#item_tool_versions").click(Zz)}function Q$(){if(V){var r=V.getActive()instanceof jt,e=DP(V.getActiveID(),r),t="#help/"+e;window.location.hash===t?V.createOrShow(t):window.location.hash=t}}function Zz(){let r=u=>String(u==null?"":u).replace(/[&<>"]/g,f=>({"&":"&","<":"<",">":">",'"':"""})[f]),e=(u,f)=>"$"+be(u,4).toUpperCase()+(f!=null?"+$"+be(f,4).toUpperCase():""),t=Lr[ae]||Lr[$t(ae)]||Lr[zr(ae)],i=t&&t.arch||"\u2014",n=[];t&&(t.rom_start!=null&&n.push("rom "+e(t.rom_start,t.rom_size)),t.code_start!=null&&n.push("code "+e(tLine truncated
|
|
|
|
|
`),i.insertLinesBefore(o),Oo()})}}}):ye("Can't insert text in this window -- switch back to main file")}function Ez(){var r=lt(),e=S.getToolForFilename(r);r.endsWith(".c")||e=="sdcc"||e=="cc65"||e=="cmoc"||e=="smlrc"?ei("Header",".h",t=>'#include "'+t+'"'):e=="dasm"||e=="zmac"?ei("Include",".inc",t=>' include "'+t+'"'):e=="ca65"||e=="sdasz80"||e=="vasm"||e=="armips"?ei("Include",".inc",t=>' .include "'+t+'"'):e=="verilator"?ei("Verilog",".v",t=>'`include "'+t+'"'):e=="wiz"?ei("Include",".wiz",t=>'import "'+t+'";'):e=="ecs"?ei("Include",".ecs",t=>'import "'+t+'"'):e=="acme"?ei("Include",".acme",t=>'!src "'+t+'"'):e=="xa"?ei("Include",".xa",t=>'#include "'+t+'"'):e=="dialog"?ei("Include",".dg",t=>'%% #include "'+t+'"'):ye("Can't add include file to this project type ("+e+")")}function Zz(){var r=lt(),e=S.getToolForFilename(r);r.endsWith(".c")||e=="sdcc"||e=="cc65"||e=="cmoc"||e=="smlrc"?ei("Linked C (or .s)",".c",t=>'//#link "'+t+'"'):r.endsWith("asm")||r.endsWith(".s")||e=="ca65"||e=="lwasm"?ei("Linked ASM",".inc",t=>';#link "'+t+'"'):ye("Can't add linked file to this project type ("+e+")")}function Uz(){if(Ke=new Cl($("#toolbar")[0],null),Ke.grp.prop("id","run_bar"),Ke.add("mod+shift+r","Reset","glyphicon-refresh",w$).prop("id","dbg_reset"),Ke.add("mod+shift+h","Pause","glyphicon-pause",d$).prop("id","dbg_pause"),Ke.add("mod+shift+g","Go To Address","",i=>{a$()||Fh()}),Ke.add("mod+shift+g","Resume","glyphicon-play",Fh).prop("id","dbg_go"),Ke.add("F8","Pause/Resume","",h$),Ke.add("F1","Help","",P$),S.restartAtPC&&Ke.add("mod+shift+a","Restart at Cursor","glyphicon-play-circle",m$).prop("id","dbg_restartatline"),Ke.newGroup(),Ke.grp.prop("id","debug_bar"),S.runEval&&Ke.add("mod+shift+d","Reset and Debug","glyphicon-fast-backward",S$).prop("id","dbg_restart"),S.stepBack&&Ke.add("mod+shift+j","Step Backwards","glyphicon-step-backward",x$).prop("id","dbg_stepback"),S.step&&Ke.add("mod+shift+l","Single Step","glyphicon-step-forward",u$).prop("id","dbg_step"),S.stepOver&&Ke.add("mod+shift+k","Step Over","glyphicon-hand-right",f$).prop("id","dbg_stepover"),S.runUntilReturn&&Ke.add("mod+shift+i","Step Out of Subroutine","glyphicon-hand-up",b$).prop("id","dbg_stepout"),S.runToVsync&&Ke.add("mod+shift+x","Next Frame/Interrupt","glyphicon-forward",O$).prop("id","dbg_tovsync"),(S.runEval||S.runToPC)&&!ae.startsWith("verilog")&&Ke.add("mod+shift+y","Run To Line","glyphicon-save",g$).prop("id","dbg_toline"),Ke.newGroup(),Ke.grp.prop("id","xtra_bar"),Ke.add("mod+shift+f","Search","glyphicon-search",fg).prop("id","dbg_search"),$(".dropdown-menu").collapse({toggle:!1}),$("#item_new_file").click(rz),$("#item_upload_file").click(iz),$("#item_open_directory").click(sz),$("#item_github_login").click(ay),$("#item_github_logout").click(ly),$("#item_github_import").click(cy),$("#item_github_publish").click(dy),$("#item_github_push").click(hy),$("#item_github_pull").click(uy),$("#item_repo_delete").click(Oy),$("#item_share_file").click(HS),$("#item_reset_file").click(lz),$("#item_rename_file").click(dz),$("#item_delete_file").click(cz),S.runEval?$("#item_debug_expr").click(Qz).show():$("#item_debug_expr").hide(),$("#item_download_rom").click(JS),$("#item_download_file").click(ey),$("#item_download_zip").click(ry),S.getDebugSymbolFile?$("#item_download_sym").click(iy):$("#item_download_sym").hide(),$("#item_download_allzip").click(ny),$("#item_record_video").click(sy),ap()?$("#item_export_cassette").click(KS):$("#item_export_cassette").hide(),S.setFrameRate&&S.getFrameRate&&($("#dbg_slower").click(kz),$("#dbg_faster").click(Tz),$("#dbg_slowest").click(Xz),$("#dbg_fastest").click(_z)),$("#item_addfile_include").click(Ez),$("#item_addfile_link").click(Zz),$("#item_request_persist").click(()=>i$(!0,!1)),$("#item_settings").click(VS),y$(),S.newCodeAnalyzer&&Ke.add(null,"Analyze CPU Timing","glyphicon-time",Rz),S.startProbing&&Ke.add(null,"Highlight Executed Lines","glyphicon-fire",Az).prop("id","dbg_tracelines"),S.setRecorder&&S.advance&&Mz(),S.showHelp){let{li:i,a:n}=jh("help__"+ae,Ih+" Help");$("#help_menu").append(i),$(n).click(s=>{s.preventDefault(),window.open(S.showHelp(),"_8bws_help")})}let r=S.getToolForFilename(lt()),e=r&&Nt(r),t=e==null?void 0:e.helpURL;if(t){let i=r+" Help";e.version&&(i+=" ("+e.version+")");let{li:n,a:s}=jh("help__"+r,i);$("#help_menu").append(n),$(s).click(o=>{o.preventDefault(),window.open(t,"_8bws_help")})}{let{li:i}=jh("#help","IDE Help");$("#help_menu").prepend(i)}$("#item_tool_versions").click(zz)}function P$(){if(W){var r=W.getActive()instanceof jt,e=IP(W.getActiveID(),r),t="#help/"+e;window.location.hash===t?W.createOrShow(t):window.location.hash=t}}function zz(){let r=u=>String(u==null?"":u).replace(/[&<>"]/g,f=>({"&":"&","<":"<",">":">",'"':"""})[f]),e=(u,f)=>"$"+be(u,4).toUpperCase()+(f!=null?"+$"+be(f,4).toUpperCase():""),t=Lr[ae]||Lr[$t(ae)]||Lr[zr(ae)],i=t&&t.arch||"\u2014",n=[];t&&(t.rom_start!=null&&n.push("rom "+e(t.rom_start,t.rom_size)),t.code_start!=null&&n.push("code "+e(tLine truncated
|
|
|
|
|
<table class="help">
|
|
|
|
|
<tr><th>Architecture</th><td>${r(i)}</td></tr>
|
|
|
|
|
<tr><th>Memory</th><td>${n.length?n.join(" \xB7 "):"\u2014"}</td></tr>
|
|
|
|
|
${t&&t.cfgfile?`<tr><th>Linker config</th><td>${r(t.cfgfile)}</td></tr>`:""}
|
|
|
|
|
${t&&t.libargs&&t.libargs.length?`<tr><th>Link libraries</th><td>${r(t.libargs.join(" "))}</td></tr>`:""}
|
|
|
|
|
${t&&t.define&&t.define.length?`<tr><th>Defines</th><td>${r(t.define.join(" "))}</td></tr>`:""}
|
|
|
|
|
</table>`,h=a.map(u=>{let f=Nt(u),p=f&&f.version||"\u2014",m=f&&f.kind||"\u2014",S=o[u].length?o[u].map(A=>`<code>${r(A)}</code>`).join(" "):"\u2014",v=f&&f.name||u;return`<tr><td>${r(v)}</td><td>${r(m)}</td><td>${r(p)}</td><td>${S}</td></tr>`}).join(`
|
|
|
|
|
</table>`,h=a.map(u=>{let f=Nt(u),p=f&&f.version||"\u2014",m=f&&f.kind||"\u2014",w=o[u].length?o[u].map(A=>`<code>${r(A)}</code>`).join(" "):"\u2014",v=f&&f.name||u;return`<tr><td>${r(v)}</td><td>${r(m)}</td><td>${r(p)}</td><td>${w}</td></tr>`}).join(`
|
|
|
|
|
`);bootbox.dialog({title:"Toolchain Info",onEscape:!0,buttons:{docs:{label:"Full reference",className:"btn-link",callback:()=>{window.location.hash="#help/toolchains"}},ok:{label:"Close",className:"btn-primary"}},message:`
|
|
|
|
|
<div class="dialog-scroll">
|
|
|
|
|
<h5 class="dialog-title">${r(Ih)} <small>${r(ae)}</small></h5>
|
|
|
|
@@ -3549,7 +3544,7 @@ containing embeds is effectively sandboxed from the others.</p>
|
|
|
|
|
<tr><th>Tool</th><th>Kind</th><th>Version</th><th>Extensions</th></tr>
|
|
|
|
|
${h}
|
|
|
|
|
</table>
|
|
|
|
|
</div>`})}function Uz(){var r=$("#replayslider"),e=$("#clockslider"),t=$("#replay_frame"),i=$("#replay_clock");w.advanceFrameClock||$("#clockdiv").hide();var n=()=>{t.text(Dt.lastSeekFrame+""),i.text(Dt.lastSeekStep+"")},s=l=>{On();var c=parseInt(r.val().toString()),d=parseInt(e.val().toString());Dt.loadFrame(c,d)>=0&&(e.attr("min",0),e.attr("max",Dt.lastStepCount),n(),Dh(w.saveState()))},o=l=>{On(),Dt.loadFrame(l)>=0&&(r.val(l),n(),Dh(w.saveState()))},a=l=>{On();var c=parseInt(r.val().toString());Dt.loadFrame(c,l)>=0&&(e.val(l),n(),Dh(w.saveState()))};Dt.callbackStateChanged=()=>{r.attr("min",0),r.attr("max",Dt.numFrames()),r.val(Dt.currentFrame()),e.val(Dt.currentStep()),n(),ll(w.saveState())},r.on("input",s),e.on("input",s),$("#replay_min").click(()=>{o(1)}),$("#replay_max").click(()=>{o(Dt.numFrames())}),$("#replay_back").click(()=>{o(parseInt(r.val().toString())-1)}),$("#replay_fwd").click(()=>{o(parseInt(r.val().toString())+1)}),$("#clock_back").click(()=>{a(parseInt(e.val().toString())-1)}),$("#clock_fwd").click(()=>{a(parseInt(e.val().toString())+1)}),$("#replay_bar").show(),Ke.add("mod+shift+e","Start/Stop Replay Recording","glyphicon-record",_z).prop("id","dbg_record")}function zz(){try{var r=window.screen.orientation||window.screen.msOrientation||window.screen.mozOrientation||null;if(r){if(r.type.indexOf("landscape")!==-1)return!0;if(r.type.indexOf("portrait")!==-1)return!1}if("orientation"in window){var e=window.orientation;if(e===0||e===180)return!1;if(e===90||e===270)return!0}}catch(t){}return window.innerWidth>window.innerHeight}async function Mz(){if(Ri.shouldCompleteTour()){await xr("lib/bootstrap-tourist.js");var r=ae.startsWith("vcs"),e=[{element:"#platformsMenuButton",placement:"right",title:"Platform Selector",content:`You're currently on the "<b>`+ae+'</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:r?"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."}];zz()||e.unshift({element:"#controls_top",placement:"bottom",title:"Portrait mode detected",content:"This site works best on desktop browsers. For best results, rotate your device to landscape orientation."}),ws()&&(e.unshift({element:"#dropdownMenuButton",placement:"right",title:"Cookie Consent",content:'Before we start, we should tell you that this website stores cookies and other data in your browser. You can 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!"})),go&&(e.unshift({element:"#dropdownMenuButton",placement:"right",title:"Developer Analytics",content:"BTW, we send stack traces to sentry.io 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:()=>{Ri.completedTour()}});setTimeout(()=>{t.start()},2500)}}function Bh(r){var e=(r.message||r.error||r)+"";if(e.indexOf("QuotaExceededError")>=0)I5();else{var t=r.error||r.reason;t!=null&&t instanceof mu?Lz(t):ws()&&pb(e,t,{platform:ae,window:V?V.getActiveID():"",errors:V.lasterrors||[]})}}function Lz(r){console.log("haltEmulation"),On(),tM(r)}function Yz(){window.addEventListener("error",Bh),window.addEventListener("unhandledrejection",Bh)}function P$(){window.removeEventListener("error",Bh),window.removeEventListener("unhandledrejection",Bh)}function Fn(r,e){e&&(re=e),P$(),r?window.location.replace("?"+$.param(re)):window.location.href="?"+$.param(re)}function Kh(){ae&&(re.platform=ae),delete re[""],history.replaceState({},"","?"+$.param(re)+window.location.hash)}function $$(r){if(!r||r==="#")return null;var e=decodeURIComponent(r.substring(1));return e.startsWith("asseteditor/")?"#asseteditorLine truncated
|
|
|
|
|
</div>`})}function Mz(){var r=$("#replayslider"),e=$("#clockslider"),t=$("#replay_frame"),i=$("#replay_clock");S.advanceFrameClock||$("#clockdiv").hide();var n=()=>{t.text(Dt.lastSeekFrame+""),i.text(Dt.lastSeekStep+"")},s=l=>{On();var c=parseInt(r.val().toString()),d=parseInt(e.val().toString());Dt.loadFrame(c,d)>=0&&(e.attr("min",0),e.attr("max",Dt.lastStepCount),n(),Dh(S.saveState()))},o=l=>{On(),Dt.loadFrame(l)>=0&&(r.val(l),n(),Dh(S.saveState()))},a=l=>{On();var c=parseInt(r.val().toString());Dt.loadFrame(c,l)>=0&&(e.val(l),n(),Dh(S.saveState()))};Dt.callbackStateChanged=()=>{r.attr("min",0),r.attr("max",Dt.numFrames()),r.val(Dt.currentFrame()),e.val(Dt.currentStep()),n(),ll(S.saveState())},r.on("input",s),e.on("input",s),$("#replay_min").click(()=>{o(1)}),$("#replay_max").click(()=>{o(Dt.numFrames())}),$("#replay_back").click(()=>{o(parseInt(r.val().toString())-1)}),$("#replay_fwd").click(()=>{o(parseInt(r.val().toString())+1)}),$("#clock_back").click(()=>{a(parseInt(e.val().toString())-1)}),$("#clock_fwd").click(()=>{a(parseInt(e.val().toString())+1)}),$("#replay_bar").show(),Ke.add("mod+shift+e","Start/Stop Replay Recording","glyphicon-record",Cz).prop("id","dbg_record")}function Lz(){try{var r=window.screen.orientation||window.screen.msOrientation||window.screen.mozOrientation||null;if(r){if(r.type.indexOf("landscape")!==-1)return!0;if(r.type.indexOf("portrait")!==-1)return!1}if("orientation"in window){var e=window.orientation;if(e===0||e===180)return!1;if(e===90||e===270)return!0}}catch(t){}return window.innerWidth>window.innerHeight}async function Yz(){if(Ri.shouldCompleteTour()){await xr("lib/bootstrap-tourist.js");var r=ae.startsWith("vcs"),e=[{element:"#platformsMenuButton",placement:"right",title:"Platform Selector",content:`You're currently on the "<b>`+ae+'</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:r?"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."}];Lz()||e.unshift({element:"#controls_top",placement:"bottom",title:"Portrait mode detected",content:"This site works best on desktop browsers. For best results, rotate your device to landscape orientation."}),ws()&&(e.unshift({element:"#dropdownMenuButton",placement:"right",title:"Cookie Consent",content:'Before we start, we should tell you that this website stores cookies and other data in your browser. You can 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!"})),go&&(e.unshift({element:"#dropdownMenuButton",placement:"right",title:"Developer Analytics",content:"BTW, we send stack traces to sentry.io 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:()=>{Ri.completedTour()}});setTimeout(()=>{t.start()},2500)}}function Bh(r){var e=(r.message||r.error||r)+"";if(e.indexOf("QuotaExceededError")>=0)F5();else{var t=r.error||r.reason;t!=null&&t instanceof mu?Wz(t):ws()&&mb(e,t,{platform:ae,window:W?W.getActiveID():"",errors:W.lasterrors||[]})}}function Wz(r){console.log("haltEmulation"),On(),iM(r)}function Vz(){window.addEventListener("error",Bh),window.addEventListener("unhandledrejection",Bh)}function $$(){window.removeEventListener("error",Bh),window.removeEventListener("unhandledrejection",Bh)}function Fn(r,e){e&&(re=e),$$(),r?window.location.replace("?"+$.param(re)):window.location.href="?"+$.param(re)}function Kh(){ae&&(re.platform=ae),delete re[""],history.replaceState({},"","?"+$.param(re)+window.location.hash)}function k$(r){if(!r||r==="#")return null;var e=decodeURIComponent(r.substring(1));return e.startsWith("asseteditor/")?"#asseteditorLine truncated
|
|
|
|
|
/*! Bundled license information:
|
|
|
|
|
|
|
|
|
|
localforage/dist/localforage.js:
|
|
|
|
@@ -3563,4 +3558,4 @@ localforage/dist/localforage.js:
|
|
|
|
|
dompurify/dist/purify.cjs.js:
|
|
|
|
|
(*! @license DOMPurify 3.4.15 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.15/LICENSE *)
|
|
|
|
|
*/
|
|
|
|
|
//# sourceMappingURL=chunk-UPXOK7NH.js.map
|
|
|
|
|
//# sourceMappingURL=chunk-L4IYBNZK.js.map
|