UNPKG

cumalis-lisp

Version:

A Scheme implementation written in Typescript.

1 lines 128 kB
var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,r,t)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,__spreadValues=(e,r)=>{for(var t in r||(r={}))__hasOwnProp.call(r,t)&&__defNormalProp(e,t,r[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(r))__propIsEnum.call(r,t)&&__defNormalProp(e,t,r[t]);return e},__spreadProps=(e,r)=>__defProps(e,__getOwnPropDescs(r)),__require="undefined"!=typeof require?require:e=>{throw new Error('Dynamic require of "'+e+'" is not supported')},__publicField=(e,r,t)=>(__defNormalProp(e,"symbol"!=typeof r?r+"":r,t),t);!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).Scheme={})}(this,(function(e){"use strict";const r="cumalis-lisp",t="0.6.0",n={quote:"'",quasiquote:"`",unquote:",","unquote-splicing":",@"},a=/^(?:[A-Za-z0-9]|[^\x00-\x7f]|[!$%&*+\-./:<=>?@^_~])+$/,o={"":"\\a","\b":"\\b","\t":"\\t","\n":"\\n","\r":"\\r",'"':'\\"',"\\":"\\\\","|":"\\|"},i=e=>{let r="",t="";for(const a of e){const e=a.length>2&&0===a.indexOf('""')?a.replace(/^""/,"").replace(/""$/,""):a;r=r+(""===r||"("===t.slice(-1)||")"===a||Object.values(n).indexOf(t)>=0||/^#\d+=$/.test(t)&&"("===a?"":" ")+e,t=a}return r},l=e=>{const r=e=>{const t=[];for(const a of e)if("string"==typeof a)t.push(a);else if(a instanceof Array)if("string"==typeof a[0]&&Object.values(n).includes(a[0]))t.push(...r(a));else if("#"===a[0]||"#u8"===a[0]){if(2!==a.length||!(a[1]instanceof Array))throw new Error("Illegal token tree: #/#u8 must have only one token array");t.push(`${a[0]}(`),t.push(...r(a[1])),t.push(")")}else if("string"==typeof a[0]&&/^#\d+=/.exec(a[0])){if(2!==a.length)throw new Error("Illegal token tree: datum label must have the content");t.push(a[0],...r(a.splice(1)))}else t.push("("),t.push(...r(a)),t.push(")");return t};return r(e)},s=(e,r)=>{const{extended:t=!1,style:i="write",labels:l="cyclic",maxdepth:s=1/0}=null!=r?r:{},c=new Set,u=new Set,d=(e,r,n)=>{if(I.Object(e),!t&&r>s)return;if(!t&&("cyclic"===l&&n.has(e)||"shared"===l&&c.has(e)))return void u.add(e);c.add(e);const a=new Set(n);a.add(e),P.Pair(e)?(d(e[1],r+1,a),d(e[2],r+1,a)):P.Vector(e)&&e[1].forEach((e=>d(e,r+1,a)))};d(e,0,new Set);const p=new Map,f=(e,r,l=!1)=>{var c;if(I.Object(e),!t&&r>s)return"...";if(!l&&!t&&u.has(e)){if(p.has(e))return`#${p.get(e)}#`;{const t=p.size+1;p.set(e,t);return[`#${t}=`,f(e,r,!0)]}}switch(e[0]){case"<symbol>":return t||a.test(e[1])?e[1]:"|"+e[1].replace(/[\x00-\x1f\x7f"|\\]/g,(e=>{var r,t;return null!=(t=o[e])?t:`\\x${null==(r=e.codePointAt(0))?void 0:r.toString(16)}`}))+"|";case"<null>":return t?null:[];case"<string>":return t?e[1]:"display"!==i?'"'+e[1].replace(/[\x00-\x1f\x7f]"|\\/g,(e=>{var r,t;return null!=(t=o[e])?t:`\\x${null==(r=e.codePointAt(0))?void 0:r.toString(16)}`}))+'"':'""'+e[1]+'""';case"<number>":return t?m(e):`${e[1]}`;case"<boolean>":return t?e[1]:e[1]?"#t":"#f";case"<character>":if(t)return e[1];if("display"!==i){const[r]=null!=(c=Object.entries(Z).find((([,r])=>r===e[1])))?c:[];return`#\\${null!=r?r:e[1]}`}return'""'+e[1]+'""';case"<vector>":return["#",[...e[1].map((e=>f(e,r+1)))]];case"<bytevector>":return["#u8",[...e[1].map((e=>`${e}`))]];case"<pair>":const[,l,s]=e;if("<null>"===s[0])return[f(l,r+1)];if("<pair>"!==s[0])return[f(l,r+1),".",f(s,r+1)];if("<symbol>"===l[0]&&n[l[1]]){const e=f(s,r+1);return e instanceof Array&&!P.Object(e)?[n[l[1]],...e]:[n[l[1]],e]}{const e=f(l,r+1),t=f(s,r+1);return t instanceof Array&&!P.Object(t)?[e,...t]:[e,".",t]}case"<js>":return t?["&",e[1]]:`#<$js[${null===e[1]?"null":typeof e[1]}]>`;case"<procedure>":return t?e:"built-in"===e[1]?`#<procedure[built-in/${e[2]}]>`:`#<procedure[${e[1]}]>`;default:return t?e:`#${e[0]}`}};return f(e,0)},c=(e,r={})=>{try{const t=s(e,__spreadProps(__spreadValues({maxdepth:8},r),{extended:!1})),n=l([t]);return i(n)}catch(t){return"<!!WRITE-ERROR!!>"}},u=(e,r={})=>{const t=s(e,__spreadProps(__spreadValues({},r),{extended:!1}));if(!(t instanceof Array&&"begin"===t[0]))throw new Error('fromASTToText error: The top of AST is must be a "begin" expression.');const n=l(t.slice(1));return i(n)},m=e=>"number"==typeof e[1]?e[1]:"+inf.0"===e[1]?1/0:"-inf.0"===e[1]?-1/0:NaN,d=e=>j.Number(Number.isFinite(e)?Number.isNaN(e)?"+nan.0":e:e<0?"-inf.0":"+inf.0"),p=e=>e[2],f=e=>e[1],b=e=>e[2],y=e=>{const r=[];for(let t=e;t;t=b(t))r.push(t);return r},h=e=>e[1],g=e=>["#CALL-STACK#",{depth:0,env:{static:j.StaticNS({},null),dynamic:j.DynamicNS({},null)},expr:e,want:null,oper:null,args:null,before:null,after:null,handler:null,info:P.Pair(e)&&e[4]||null},null],v=(e,r,t={})=>{var n,a,o;const{env:i,handler:l,depth:s,info:c}=h(e);return["#CALL-STACK#",{depth:s+1,env:null!=(n=t.env)?n:i,expr:r,want:null,oper:null,args:null,before:null!=(a=t.before)?a:null,after:null!=(o=t.after)?o:null,handler:l,info:P.Pair(r)&&r[4]||c},e]},S=(e,r,t={})=>{var n,a,o;const{env:i,handler:l,depth:s,info:c,before:u,after:m}=h(e);return["#CALL-STACK#",{depth:s,env:null!=(n=t.env)?n:i,expr:r,want:null!=(a=t.want)?a:null,oper:null!=(o=t.oper)?o:null,args:null,before:void 0===t.before?u:t.before,after:void 0===t.after?m:t.after,handler:void 0!==t.handler?t.handler:l,info:P.Pair(r)&&r[4]||c},b(e)]},w=e=>[e[0],{},e],j={Symbol:(...e)=>["<symbol>",...e],String:(...e)=>["<string>",...e],Number:(...e)=>["<number>",...e],Boolean:(...e)=>["<boolean>",...e],Character:(...e)=>["<character>",...e],Pair:(e,r,t=!1,n)=>n?["<pair>",e,r,t,n]:["<pair>",e,r,t],Null:()=>["<null>"],Vector:(...e)=>["<vector>",...e],ByteVector:(...e)=>["<bytevector>",...e],EndOfFile:(...e)=>["<end-of-file>",...e],Procedure:(...e)=>["<procedure>",...e],Port:(...e)=>["<port>",...e],RecordType:(...e)=>["<record-type>",...e],Record:(...e)=>["<record>",...e],SyntaxRules:(...e)=>["<syntax-rules>",...e],Parameter:(...e)=>["<parameter>",...e],MultiValue:(...e)=>["<multi-value>",...e],Exception:(...e)=>["<exception>",...e],Undefined:(...e)=>["<undefined>",...e],Promise:(...e)=>["<promise>",...e],Error:(e,r,t=[])=>["<error>",e,r,t],Continuation:(...e)=>["<continuation>",...e],EnvironmentSpec:(...e)=>["<environment-spec>",...e],Library:(...e)=>["<library>",...e],JS:(...e)=>["<js>",...e],List:(...e)=>e.reverse().reduce(((e,r)=>["<pair>",r,e,!1]),["<null>"]),Suspend:(...e)=>["#SUSPEND#",...e],JSPromiseContinuation:(...e)=>["#JS-PROMISE-CONTINUATION#",...e],Exit:(...e)=>["#EXIT#",...e],StaticNS:(...e)=>["#STATIC-NS-STACK#",...e],DynamicNS:(...e)=>["#DYNAMIC-NS-STACK#",...e],HandlerStack:(...e)=>["#HANDLER-STACK#",...e]},x={Call:(e,...r)=>j.List(e,...r),CallBuiltIn:(e,...r)=>j.List(j.Procedure("built-in",e),...r),Lambda:(...e)=>P.List(e[0])?x.CallBuiltIn("lambda",...e):x.CallBuiltIn("lambda",M(e[0],e[1]),...e.slice(2)),CallThunk:(...e)=>x.Call(x.CallBuiltIn("lambda",["<null>"],...e)),Begin:(...e)=>x.CallBuiltIn("begin",...e),Quote:e=>x.CallBuiltIn("quote",e),Set:(e,r)=>x.CallBuiltIn("set!",e,r),Raise:e=>x.CallBuiltIn("raise",e),RaiseContinuable:e=>x.CallBuiltIn("raise-continuable",e),Let:(e,...r)=>x.CallBuiltIn("let",j.List(...e.map((e=>j.List(...e)))),...r),If:(e,r,t)=>t?x.CallBuiltIn("if",e,r,t):x.CallBuiltIn("if",e,r),And:(...e)=>x.CallBuiltIn("and",...e),Or:(...e)=>x.CallBuiltIn("or",...e),Cond:(e,...r)=>x.CallBuiltIn("cond",e,...r),Case:(e,r)=>x.CallBuiltIn("case",e,j.List(...r.map((e=>j.List(...e))))),Define:(...e)=>x.CallBuiltIn("define",...e),DefineValues:(e,r)=>x.CallBuiltIn("define-values",P.List(e)?e:j.List(...e),r),Append:(...e)=>x.CallBuiltIn("append",...e),Cons:(...e)=>x.CallBuiltIn("cons",...e),Values:(...e)=>x.CallBuiltIn("values",...e),BeginIfMultiple:(...e)=>0===e.length?["<undefined>"]:1===e.length?e[0]:x.Begin(...e)},P={Symbol:e=>e instanceof Array&&"<symbol>"===e[0],String:e=>e instanceof Array&&"<string>"===e[0],Number:e=>e instanceof Array&&"<number>"===e[0],Boolean:e=>e instanceof Array&&"<boolean>"===e[0],Character:e=>e instanceof Array&&"<character>"===e[0],Pair:e=>e instanceof Array&&"<pair>"===e[0],Null:e=>e instanceof Array&&"<null>"===e[0],Vector:e=>e instanceof Array&&"<vector>"===e[0],ByteVector:e=>e instanceof Array&&"<bytevector>"===e[0],EndOfFile:e=>e instanceof Array&&"<end-of-file>"===e[0],Port:e=>e instanceof Array&&"<port>"===e[0],RecordType:e=>e instanceof Array&&"<record-type>"===e[0],Record:e=>e instanceof Array&&"<record>"===e[0],MultiValue:e=>e instanceof Array&&"<multi-value>"===e[0],SyntaxRules:e=>e instanceof Array&&"<syntax-rules>"===e[0],SyntaxRulePattern:e=>e instanceof Array&&"<syntax-rule-pattern>"===e[0],Parameter:e=>e instanceof Array&&"<parameter>"===e[0],EnvironmentSpec:e=>e instanceof Array&&"<environment-spec>"===e[0],Exception:e=>e instanceof Array&&"<exception>"===e[0],Undefined:e=>e instanceof Array&&"<undefined>"===e[0],Promise:e=>e instanceof Array&&"<promise>"===e[0],Error:e=>e instanceof Array&&"<error>"===e[0],Continuation:e=>e instanceof Array&&"<continuation>"===e[0],Library:e=>e instanceof Array&&"<library>"===e[0],JS:e=>e instanceof Array&&"<js>"===e[0],List:e=>P.Pair(e)||P.Null(e),Procedure:e=>e instanceof Array&&("<procedure>"===e[0]||"<continuation>"===e[0]||"<parameter>"===e[0]),Object:e=>e instanceof Array&&"string"==typeof e[0]&&/^<.*>/.test(e[0]),Evaluatable:e=>P.List(e)||P.Symbol(e),False:e=>P.Boolean(e)&&!1===e[1],RealNumber:e=>P.Number(e)&&"number"==typeof e[1],IntegerNumber:e=>P.Number(e)&&"number"==typeof e[1]&&Number.isInteger(e[1]),Objects:e=>e instanceof Array&&e.every((e=>P.Object(e))),Suspend:e=>e instanceof Array&&"#SUSPEND#"===e[0],JSPromiseContinuation:e=>e instanceof Array&&"#JS-PROMISE-CONTINUATION#"===e[0],Exit:e=>e instanceof Array&&"#EXIT#"===e[0],CallStack:e=>e instanceof Array&&"#CALL-STACK#"===e[0],SpecialObject:e=>e instanceof Array&&"string"==typeof e[0]&&/^#.+#$/.test(e[0]),Dictionary:e=>"object"==typeof e&&!!e&&e.constructor===Object,Stack:e=>e instanceof Array&&3===e.length&&"string"==typeof e[0]&&/^#.*-STACK#$/.test(e[0])},E=(e,r)=>(t,n)=>{if(!e(t))throw j.Error("domain-error",null!=n?n:r)},N=(e,r)=>(t,n)=>{if(!(t instanceof Array))throw j.Error("domain-error",null!=n?n:r);for(const a of t)if(!e(a))throw j.Error("domain-error",null!=n?n:r)},I={List:E(P.List,"A <pair> or <null> is expected."),Pair:E(P.Pair,"A <pair> is expected."),Symbol:E(P.Symbol,"A <symbol> is expected."),Number:E(P.Number,"A <number> is expected."),Boolean:E(P.Boolean,"A <boolean> is expected."),Object:E(P.Object,"A Scheme object is expected."),String:E(P.String,"A <string> is expected."),Vector:E(P.Vector,"A <vector> is expected."),ByteVector:E(P.ByteVector,"A <bytevector> is expected."),Character:E(P.Character,"A <character> is expected."),Promise:E(P.Promise,"A <promise> is expected."),Error:E(P.Error,"A <error> is expected."),Procedure:E(P.Procedure,"A <procedure> is expected."),SyntaxRules:E(P.SyntaxRules,"A <syntax-rules> is expected."),Parameter:E(P.Parameter,"A <parameter> is expected."),EnvironmentSpec:E(P.EnvironmentSpec,"A <environment-spec> is expected."),RecordType:E(P.RecordType,"A <record-type> is expected."),Record:E(P.Record,"A <record> is expected."),MultiValue:E(P.MultiValue,"A <multi-value> is expected."),Port:E(P.Port,"A <port> is expected."),Library:E(P.Library,"A <library> is expected."),Lists:N(P.List,"An array of <pair>/<null> is expected."),Pairs:N(P.Pair,"An array of <pair> is expected."),Symbols:N(P.Symbol,"An array of <symbol> is expected."),Numbers:N(P.Number,"An array of <number> is expected."),Booleans:N(P.Boolean,"An array of <boolean> is expected."),Objects:N(P.Object,"An array of Scheme object is expected."),Strings:N(P.String,"An array of <string> is expected."),Vectors:N(P.Vector,"An array of <vector> is expected."),ByteVectors:N(P.ByteVector,"An array of <bytevector> is expected."),Characters:N(P.Character,"An array of <character> is expected."),RealNumber:E(P.RealNumber,"A real <number> (not infinite, not NaN) is expected."),IntegerNumber:E(P.IntegerNumber,"A integer <number> is expected."),RealNumbers:N(P.RealNumber,"An array of real <number> is expected."),IntegerNumbers:N(P.IntegerNumber,"An array of integer <number> is expected.")},B=(e,r)=>{if(null==e)throw j.Error("program-error",null!=r?r:"Required object.")},O=e=>"object"==typeof e&&null!==e&&"Object"===e.constructor.name,C=e=>!!e&&"object"==typeof e&&e.language===r&&!!e.version&&(P.Object(e.content)||P.SpecialObject(e.content)),A=e=>C(e)&&P.Suspend(e.content),$=e=>C(e)&&P.JSPromiseContinuation(e.content),L=$,k=Object.prototype.hasOwnProperty,V=e=>{const r=new Set,t=e=>{if(P.Pair(e)){const[,n,a]=e;if(r.has(a))throw new Error("Circular list detected.");return r.add(a),[n,...t(P.List(a)?a:["<null>"])]}return[]};return t(e)},z=e=>{const r=new Set;return(e=>{const[,t,n]=e;if(P.Pair(n)){if(r.has(n))throw new Error("Circular list detected.");r.add(n);const[e,a]=z(n);return[[t,...e],a]}return[[t],n]})(e)},M=(e,r,t=!1,n)=>e.reverse().reduce(((r,a,o)=>n&&o===e.length-1?j.Pair(a,r,t,n):j.Pair(a,r,t)),r||["<null>"]),_=(()=>{let e=0,r=0,t=0;return()=>"::"+"T-S-XXXXXXX".replace(/[TSX]/g,(n=>(r=Date.now(),"T"===n?`0000000000000${r.toString(16)}`.slice(-14):"S"===n?`000${(e===r?(e=r,t=0):t++).toString(16)}`.slice(-4):`000${(65536*Math.random()|0).toString(16)}`.slice(-4))))})(),q=(e,r,t,n=!1,a=!1)=>{if(r.filter((e=>"variadic"===e.type)).length>1)throw new Error("Only one variadic parameter is allowed.");return{name:e,parameters:r,body:t,isMacro:n,hidden:a}},T=(e,r)=>__spreadProps(__spreadValues({},r),{name:e}),D=(e,r)=>e.length===r.length&&e.every(((e,t)=>e===r[t])),R=e=>{var r,t;if(P.List(e)){if(P.Null(e))return[[],null];{const[t,n]=z(e);return I.Symbols(t),P.Null(n)||I.Symbol(n),[t.map((e=>{var r;return{name:null!=(r=e[3])?r:e[1]}})),P.Null(n)?null:{name:null!=(r=n[3])?r:n[1],type:"variadic"}]}}return I.Symbol(e),[[],{name:null!=(t=e[3])?t:e[1],type:"variadic"}]},Q={"µ":"μ","ͅ":"ι","ς":"σ","ϐ":"β","ϑ":"θ","ϕ":"φ","ϖ":"π","ϰ":"κ","ϱ":"ρ","ϵ":"ε","ᏸ":"Ᏸ","ᏹ":"Ᏹ","ᏺ":"Ᏺ","ᏻ":"Ᏻ","ᏼ":"Ᏼ","ᏽ":"Ᏽ","ᲀ":"в","ᲁ":"д","ᲂ":"о","ᲃ":"с","ᲄ":"т","ᲅ":"т","ᲆ":"ъ","ᲇ":"ѣ","ᲈ":"ꙋ","ẛ":"ṡ","ι":"ι","ꭰ":"Ꭰ","ꭱ":"Ꭱ","ꭲ":"Ꭲ","ꭳ":"Ꭳ","ꭴ":"Ꭴ","ꭵ":"Ꭵ","ꭶ":"Ꭶ","ꭷ":"Ꭷ","ꭸ":"Ꭸ","ꭹ":"Ꭹ","ꭺ":"Ꭺ","ꭻ":"Ꭻ","ꭼ":"Ꭼ","ꭽ":"Ꭽ","ꭾ":"Ꭾ","ꮀ":"Ꮀ","ꮁ":"Ꮁ","ꮂ":"Ꮂ","ꮃ":"Ꮃ","ꮄ":"Ꮄ","ꮅ":"Ꮅ","ꮆ":"Ꮆ","ꮇ":"Ꮇ","ꮈ":"Ꮈ","ꮉ":"Ꮉ","ꮊ":"Ꮊ","ꮋ":"Ꮋ","ꮌ":"Ꮌ","ꮍ":"Ꮍ","ꮎ":"Ꮎ","ꮐ":"Ꮐ","ꮑ":"Ꮑ","ꮒ":"Ꮒ","ꮓ":"Ꮓ","ꮔ":"Ꮔ","ꮕ":"Ꮕ","ꮖ":"Ꮖ","ꮗ":"Ꮗ","ꮘ":"Ꮘ","ꮙ":"Ꮙ","ꮚ":"Ꮚ","ꮛ":"Ꮛ","ꮜ":"Ꮜ","ꮝ":"Ꮝ","ꮞ":"Ꮞ","ꮠ":"Ꮠ","ꮡ":"Ꮡ","ꮢ":"Ꮢ","ꮣ":"Ꮣ","ꮤ":"Ꮤ","ꮥ":"Ꮥ","ꮦ":"Ꮦ","ꮧ":"Ꮧ","ꮨ":"Ꮨ","ꮩ":"Ꮩ","ꮪ":"Ꮪ","ꮫ":"Ꮫ","ꮬ":"Ꮬ","ꮭ":"Ꮭ","ꮮ":"Ꮮ","ꮰ":"Ꮰ","ꮱ":"Ꮱ","ꮲ":"Ꮲ","ꮳ":"Ꮳ","ꮴ":"Ꮴ","ꮵ":"Ꮵ","ꮶ":"Ꮶ","ꮷ":"Ꮷ","ꮸ":"Ꮸ","ꮹ":"Ꮹ","ꮺ":"Ꮺ","ꮻ":"Ꮻ","ꮼ":"Ꮼ","ꮽ":"Ꮽ","ꮾ":"Ꮾ"},U=new RegExp("["+Object.keys(Q).join("")+"]","gu"),F=e=>e.replace(U,(e=>Q[e])).toLowerCase(),J=new RegExp("(?:"+[/\s+/.source,/;[^\n]*(?:\n|$)/.source,/(?:[A-Za-z0-9]|[^\x00-\x7f]|[!$%&*+\-./:<=>?@^_~])+/.source,/\|(?:[^|\\]|\n|\\(?:.|\n))+\|/.source,/#!(?:[A-Za-z0-9]|[^\x00-\x7f]|[!$%&*+\-./:<=>?@^_~])+/.source,/"(?:[^"\\]|\n|\\(?:.|\n))*"/.source,/(?:[()[\]{}'`]|,(?!@)|,@)/.source,/#(?:t(?:rue)?|f(?:alse)?|\(|u8\(|\d+[#=]|;)/.source,/#[dDbBoOxXeEiI](?:[A-Za-z0-9]|[^\x00-\x7f]|[!$%&*+\-./:<=>?@^_~])+/.source,/#\\(?:(?:[^A-Za-z]|\n)|[A-Za-z](?:[A-Za-z0-9]|[^\x00-\x7f]|[!$%&*+\-./:<=>?@^_~])*)/.source,Array(16).fill(/#\|(?:[^|#]|\|[^#]|#[^|]|\n|(?:NEST))*\|#/.source).reduce(((e,r)=>e.replace("NEST",r)))].join("|")+")","y"),X={a:"",b:"\b",t:"\t",n:"\n",r:"\r"},Z={alarm:"",backspace:"\b",delete:"",escape:"",newline:"\n",null:"\0",return:"\r",space:" ",tab:"\t"},K=(e,r)=>{var t;const n=(e=>{const r=[0],t=/\n/g;for(let n;n=t.exec(e);)r.push(n.index+1);return t=>{var n;const a=r.filter((e=>e<=t)).slice(-1)[0],o=e.slice(a,t);return[r.indexOf(a)+1,o.length+(null!=(n=o.match(/[^\x01-\x7E\xA1-\xDF]/g))?n:[]).length+1]}})(e),a=[];J.lastIndex=0;let o=!1;for(;J.lastIndex<e.length;){const i=J.lastIndex,[l,s]=n(i),c=r?{filename:r,line:l,column:s}:{line:l,column:s};let[u]=null!=(t=J.exec(e))?t:[];if(null==u){const r=e.slice(i).split(/(\s|\n)+/,2)[0]||e[i],t=r.length>10?r.slice(0,10)+"...":r;throw new Error(`Tokenize failed. Unexpected token is: "${t}": ${JSON.stringify(c)}`)}"#!fold-case"!==u&&"#!no-fold-case"!==u?(o&&(u.match(/^(?:[A-Za-z0-9]|[^\x00-\x7f]|[!$%&*+\-./:<=>?@^_~])+$/)||u.match(/#\\(?:(?:[^A-Za-z]|\n)|[A-Za-z](?:[A-Za-z0-9]|[^\x00-\x7f]|[!$%&*+\-./:<=>?@^_~])*)/))&&(u=F(u)),a.push([u,c])):o=!u.includes("#!no-")}return a},W=e=>{const r=e.filter((e=>!e[0].match(/^(\s|;|#\||#!(no-)?fold-case)/))),t=()=>{const e=[];for(let n=r.shift();n;n=r.shift()){const[r,a]=n;if(!r.match(/^(\s|;|#\|)/))if("("===r)e.push(t().concat(a));else if(["#(","#u8("].includes(r))e.push([r.slice(0,-1),t(),a]);else{if(["'","`",",",",@","#;"].includes(r)||r.match(/^#\d+=$/)){const n=t(),o=n.shift();if(null==o)throw`Unexpected end of source after quoting/datum label "${r}": ${JSON.stringify(a)}`;return"#;"!==r&&e.push([r,o]),e.push(...n),e}if(")"===r)return e;e.push(r)}}return e};return[t(),r]},G=(e,r=null,t,n=new Map)=>{var a;if("string"==typeof e){let t;if(t=/^([+-])(nan|inf)\.0$/i.exec(e))return j.Number(t[0].toLowerCase());if(t=/^(?:#d)?[-+]?\d+(?:\.\d*)?(?:e[-+]?\d+)?$/i.exec(e))return d(Number(e.replace(/^(#d)?0*/i,"")));if(t=/^(?:#b[-+]?[01]+|#o[-+]?[0-7]+|#x[-+]?[0-9A-Fa-f]+)/i.exec(e))return d(Number(e.replace(/^#([xob])([+-]?)/i,"0$1"))*(e.includes("-")?-1:1));if(/^#[dboxei]/i.exec(e))throw new Error(`Unsupported type of number literal: ${e}: ${JSON.stringify(r)}`);if(t=/^"((?:.|\n)*)"$/.exec(e)){const e=t[1].replace(/\\(x[0-9a-fA-F]+;|[ \t]*\n[ \t]*|[^x \t\n])/g,(e=>{var r;return"x"===e[1]?String.fromCodePoint(Number(`0x${e.replace(/;$/,"").slice(2)}`)):/\s|\n/.test(e[1])?"":null!=(r=X[e[1]])?r:e[1]}));return j.String(e,!0)}if(t=/^#([tf])/.exec(e))return j.Boolean("t"===t[1]);if(t=/^#\\((.|\n)*)$/.exec(e)){const e=1===t[1].length?t[1]:t[1].match(/^x[0-9A-Fa-f]+$/)?String.fromCodePoint(Number(`0x${t[1].slice(1)}`)):Z[t[1]];if(!e)throw new Error(`Illegal character literal: ${e}: ${JSON.stringify(r)}`);return j.Character(e)}if("."!==e&&(t=/^(([A-Za-z0-9]|[^\x00-\x7f]|[!$%&*+\-./:<=>?@^_~])+)$/.exec(e)))return j.Symbol(t[1]);if("."!==e&&(t=/^\|(([^\\]|\n|\\(.|\n))+)\|$/.exec(e))){const e=t[1].replace(/\\(x[0-9a-fA-F]+;|\s*\n\s*|[^x\s\n])/g,(e=>{var r;return"x"===e[1]?String.fromCodePoint(Number(`0x${e.replace(/;$/,"").slice(2)}`)):/\s|\n/.test(e[1])?"":null!=(r=X[e[1]])?r:e[1]}));return j.Symbol(e)}if(t=/^#(\d+)#$/.exec(e)){const a=t[1];if(!n.has(a))throw new Error(`Invalid datum reference (${e}): ${JSON.stringify(r)}`);return n.get(a)}throw new Error(`Parse error: unexpected token: "${e}": ${JSON.stringify(r)}`)}if(e instanceof Array&&"&"!==e[0]){r=null!=(a=e.find((e=>O(e))))?a:r;const o=e.filter((e=>!O(e)));if(0===o.length)return j.Null();if(2===o.length&&"."===o[0])return G(o[1],r,t,n);if("#"===o[0]){if(2!==o.length)throw new Error(`Illegal vector literal. No datum: ${JSON.stringify(r)}`);if(!(o[1]instanceof Array))throw new Error(`Illegal vector literal. Datum is not an array: ${JSON.stringify(r)}`);return j.Vector(o[1].map((e=>G(e,r,t,n))),!0)}if("#u8"===o[0]){if(2!==o.length)throw new Error(`Illegal byte vector literal. No datum: ${JSON.stringify(r)}`);if(!(o[1]instanceof Array))throw new Error(`Illegal byte vector literal. Byte vector must have an array: ${JSON.stringify(r)}`);const e=o[1].map((e=>G(e,r,t,n)));if(!e.every((e=>P.RealNumber(e)&&Number.isInteger(e[1])&&e[1]>=0&&e[1]<=255)))throw new Error(`Illegal byte vector literal. All the contents of a byte vector must be 0-255.: ${JSON.stringify(r)}`);return j.ByteVector(e.map(m),!0)}if("string"==typeof o[0]&&["'","`",",",",@"].includes(o[0])){if(2!==o.length)throw new Error(`Illegal quote "${o[0]}". Quoted item must be a datum: ${JSON.stringify(r)}`);const e={"'":"quote","`":"quasiquote",",":"unquote",",@":"unquote-splicing"}[o[0]];return j.Pair(j.Symbol(e),j.Pair(G(o[1],r,t,n),j.Null(),!0),!0,(null==t?void 0:t.removeLineInfo)?null:r)}if("string"==typeof o[0]&&/^#(\d+)=$/.exec(o[0])){const[,e]=/^#(\d+)=$/.exec(o[0]);if(2!==o.length)throw new Error(`Illegal datum label. No next datum: ${JSON.stringify(r)}`);const a=j.Symbol(o[0]);n.set(e,a);const i=G(o[1],r,t,n);return a.splice(0,a.length,...i),a}if((null==t?void 0:t.extended)&&P.Object(e))return e;if((null==t?void 0:t.extended)&&"&"===e[0]){if(2!=e.length)throw new Error(`Parse error: JS Node must be like ["&", <object>]: ${typeof e} value: ${e}`);return j.JS("inline",e[1])}return j.Pair(G(o[0],r,t,n),G(o.slice(1),r,t,n),!0,(null==t?void 0:t.removeLineInfo)?null:r)}if((null==t?void 0:t.extended)&&null===e)return j.Null();if((null==t?void 0:t.extended)&&"number"==typeof e)return d(e);if((null==t?void 0:t.extended)&&"boolean"==typeof e)return j.Boolean(e);throw new Error(`Parse error: unexpected node type: ${typeof e} value: ${e}`)},H=(e,r=null,t)=>G(e,r,__spreadProps(__spreadValues({},null!=t?t:{}),{extended:!0})),Y=(e,r)=>{const t=K(e,null==r?void 0:r.filename),[n,a]=W(t);if(a.length>0)throw new Error(`Parse error: extra tokens. (missing right curly?), ${JSON.stringify(a[0][1])}`);return G(["begin",...n],null,r)},ee=q("not",[{name:"obj"}],(({obj:e})=>(I.Object(e),j.Boolean(P.False(e))))),re=q("boolean?",[{name:"obj"}],(({obj:e})=>(I.Object(e),j.Boolean(P.Boolean(e))))),te=q("boolean=?",[{name:"boolean1"},{name:"boolean2"},{name:"booleans",type:"variadic"}],(({boolean1:e,boolean2:r,booleans:t})=>(I.Boolean(e),I.Boolean(r),I.Booleans(t),j.Boolean([r,...t].every((r=>r[1]===e[1])))))),ne={not:ee,booleanQ:re,booleanEQ:te},ae=q("bytevector?",[{name:"obj"}],(({obj:e})=>(I.Object(e),j.Boolean(P.ByteVector(e))))),oe=q("make-bytevector",[{name:"k"},{name:"byte",type:"optional"}],(({k:e,byte:r})=>(I.IntegerNumber(e),r&&I.IntegerNumber(r),j.ByteVector(Array(e[1]).fill(r?r[1]:0),!1)))),ie=q("bytevector",[{name:"bytes",type:"variadic"}],(({bytes:e})=>(I.IntegerNumbers(e),j.ByteVector(e.map((e=>e[1])),!1)))),le=q("bytevector-length",[{name:"bvec"}],(({bvec:e})=>(I.ByteVector(e),j.Number(e[1].length)))),se=q("bytevector-u8-ref",[{name:"bvec"},{name:"k"}],(({bvec:e,k:r})=>{if(I.ByteVector(e),I.IntegerNumber(r),!(r[1]in e[1]))throw j.Error("out-of-range","Index is out of range.");return j.Number(e[1][r[1]])})),ce=q("bytevector-u8-set!",[{name:"bvec"},{name:"k"},{name:"byte"}],(({bvec:e,k:r,byte:t})=>{if(I.ByteVector(e),I.IntegerNumber(r),I.IntegerNumber(t),!(r[1]in e[1]))throw j.Error("out-of-range","Index is out of range.");return e[1][r[1]]=t[1],["<undefined>"]})),ue=q("bytevector-copy",[{name:"bvec"},{name:"start",type:"optional"},{name:"end",type:"optional"}],(({bvec:e,start:r,end:t})=>{I.ByteVector(e);const n=e[1];if(0===n.length)return j.ByteVector([],!1);const a=P.Number(r)?r[1]:0,o=P.Number(t)?t[1]:n.length;if("number"!=typeof a||!Number.isInteger(a)||"number"!=typeof o||!Number.isInteger(o))throw j.Error("domain-error","Index must be integer.");return j.ByteVector(n.slice(a,o),!1)})),me=q("bytevector-copy!",[{name:"to"},{name:"at"},{name:"from"},{name:"start",type:"optional"},{name:"end",type:"optional"}],(({to:e,at:r,from:t,start:n,end:a})=>{I.ByteVector(e),I.IntegerNumber(r),I.ByteVector(t);const o=P.Number(n)?n[1]:0,i=P.Number(a)?a[1]:t[1].length;if("number"!=typeof o||!Number.isInteger(o)||"number"!=typeof i||!Number.isInteger(i))throw j.Error("domain-error","Index must be integer.");if(!(r[1]in e[1]))throw j.Error("out-of-range","Index is out of range.");if(e[1].length-r[1]<i-o)throw j.Error("out-of-range","Index is out of range.");const l=t[1].slice(o,i);return e[1].splice(r[1],l.length,...l),["<undefined>"]})),de=q("bytevector-append",[{name:"vecs",type:"variadic"}],(({vecs:e})=>(I.ByteVectors(e),j.ByteVector(e.map((e=>e[1])).flat(),!1)))),pe=q("utf8->string",[{name:"bvec"},{name:"start",type:"optional"},{name:"end",type:"optional"}],(({bvec:e,start:r,end:t})=>{I.ByteVector(e);const n=e[1],a=P.Number(r)?r[1]:0,o=P.Number(t)?t[1]:n.length;if("number"!=typeof a||!Number.isInteger(a)||"number"!=typeof o||!Number.isInteger(o))throw j.Error("domain-error","Index must be integer.");const i=new Uint8Array(n.slice(a,o));return j.String((new TextDecoder).decode(i),!1)})),fe=q("string->utf8",[{name:"str"},{name:"start",type:"optional"},{name:"end",type:"optional"}],(({str:e,start:r,end:t})=>{I.String(e);const n=Array.from(e[1]),a=P.Number(r)?r[1]:0,o=P.Number(t)?t[1]:n.length;if("number"!=typeof a||!Number.isInteger(a)||"number"!=typeof o||!Number.isInteger(o))throw j.Error("domain-error","Index must be integer.");const i=(new TextEncoder).encode(n.slice(a,o).join(""));return j.ByteVector(Array.from(i),!1)})),be={bytevectorQ:ae,makeBytevector:oe,bytevector:ie,bytevectorLength:le,bytevectorU8Ref:se,bytevectorU8SetD:ce,bytevectorCopy:ue,bytevectorCopyD:me,bytevectorAppend:de,utf8ToString:pe,stringToUtf8:fe},ye=q("char?",[{name:"obj"}],(({obj:e})=>(I.Object(e),j.Boolean(P.Character(e))))),he=q("char=?",[{name:"char1"},{name:"char2"},{name:"chars",type:"variadic"}],(({char1:e,char2:r,chars:t})=>(I.Character(e),I.Character(r),I.Characters(t),j.Boolean([r,...t].every((r=>r[1]===e[1])))))),ge=q("char<?",[{name:"char1"},{name:"char2"},{name:"chars",type:"variadic"}],(({char1:e,char2:r,chars:t})=>{I.Character(e),I.Character(r),I.Characters(t);const n=[e,r,...t].map((e=>e[1]));return j.Boolean(n.every(((e,r)=>0===r||n[r-1]<e)))})),ve=q("char>?",[{name:"char1"},{name:"char2"},{name:"chars",type:"variadic"}],(({char1:e,char2:r,chars:t})=>{I.Character(e),I.Character(r),I.Characters(t);const n=[e,r,...t].map((e=>e[1]));return j.Boolean(n.every(((e,r)=>0===r||n[r-1]>e)))})),Se=q("char<=?",[{name:"char1"},{name:"char2"},{name:"chars",type:"variadic"}],(({char1:e,char2:r,chars:t})=>{I.Character(e),I.Character(r),I.Characters(t);const n=[e,r,...t].map((e=>e[1]));return j.Boolean(n.every(((e,r)=>0===r||n[r-1]<=e)))})),we=q("char>=?",[{name:"char1"},{name:"char2"},{name:"chars",type:"variadic"}],(({char1:e,char2:r,chars:t})=>{I.Character(e),I.Character(r),I.Characters(t);const n=[e,r,...t].map((e=>e[1]));return j.Boolean(n.every(((e,r)=>0===r||n[r-1]>=e)))})),je=q("char->integer",[{name:"char"}],(({char:e})=>{I.Character(e);const r=e[1].codePointAt(0);if(void 0===r)throw j.Error("out-of-range","Can't convert character to codepoint.");return j.Number(r)})),xe=q("integer->char",[{name:"n"}],(({n:e})=>(I.IntegerNumber(e),j.Character(String.fromCodePoint(e[1]))))),Pe={charQ:ye,charEQ:he,charLtQ:ge,charGtQ:ve,charLeQ:Se,charGeQ:we,charToInteger:je,integerToChar:xe},Ee=q("procedure?",[{name:"obj"}],(({obj:e})=>(I.Object(e),j.Boolean(P.Procedure(e)))),!0),Ne=q("apply",[{name:"proc"},{name:"args",type:"variadic"}],(({proc:e,args:r},t,n)=>{let a;if(I.Procedure(e),I.Objects(r),B(t),B(n),0===r.length)a=[];else{const[e,t]=[r.slice(0,r.length-1),r[r.length-1]];I.List(t),a=[...e,...V(t)]}return x.Call(e,j.MultiValue(a))}),!0),Ie=q("map",[{name:"proc"},{name:"list1"},{name:"lists",type:"variadic"}],(({proc:e,list1:r,lists:t})=>{I.Procedure(e),I.List(r),I.Lists(t);const n=[r,...t];return n.every((e=>P.Pair(e)))?x.Cons(x.Call(e,j.MultiValue(n.map((e=>e[1])))),x.CallBuiltIn("map",j.MultiValue([e,...n.map((e=>e[2]))]))):x.Quote(["<null>"])}),!0),Be=q("string-map",[{name:"proc"},{name:"str1"},{name:"strs",type:"variadic"}],(({proc:e,str1:r,strs:t})=>{I.Procedure(e),I.String(r),I.Strings(t);const n=[Array.from(r[1]),...t.map((e=>Array.from(e[1])))];return n.every((e=>e.length>1))?x.CallBuiltIn("string-append",x.CallBuiltIn("string",x.Call(e,...n.map((e=>j.Character(e[0]))))),x.CallBuiltIn("string-map",e,...n.map((e=>j.String(e.slice(1).join(""),!1))))):n.every((e=>e.length>=1))?x.CallBuiltIn("string",x.Call(e,...n.map((e=>j.Character(e[0]))))):j.String("",!1)}),!0),Oe=q("vector-map",[{name:"proc"},{name:"vector1"},{name:"vectors",type:"variadic"}],(({proc:e,vector1:r,vectors:t})=>{I.Procedure(e),I.Vector(r),I.Vectors(t);const n=[r,...t];return n.every((e=>e[1].length>1))?x.CallBuiltIn("vector-append",x.CallBuiltIn("vector",x.Call(e,j.MultiValue(n.map((e=>e[1][0]))))),x.CallBuiltIn("vector-map",e,...n.map((e=>j.Vector(e[1].slice(1),!1))))):n.every((e=>e[1].length>=1))?x.CallBuiltIn("vector",x.Call(e,j.MultiValue(n.map((e=>e[1][0]))))):j.Vector([],!1)}),!0),Ce=q("for-each",[{name:"proc"},{name:"list1"},{name:"lists",type:"variadic"}],(({proc:e,list1:r,lists:t})=>{I.Procedure(e),I.List(r),I.Lists(t);const n=[r,...t];return n.every((e=>P.Pair(e)))?x.Begin(x.Call(e,j.MultiValue(n.map((e=>e[1])))),x.CallBuiltIn("for-each",j.MultiValue([e,...n.map((e=>e[2]))]))):["<undefined>"]}),!0),Ae=q("string-for-each",[{name:"proc"},{name:"str1"},{name:"strs",type:"variadic"}],(({proc:e,str1:r,strs:t})=>{I.Procedure(e),I.String(r),I.Strings(t);const n=[Array.from(r[1]),...t.map((e=>Array.from(e[1])))];return n.every((e=>e.length>1))?x.Begin(x.Call(e,...n.map((e=>j.Character(e[0])))),x.CallBuiltIn("string-for-each",e,...n.map((e=>j.String(e.slice(1).join(""),!1))))):n.every((e=>e.length>=1))?x.Call(e,...n.map((e=>j.Character(e[0])))):["<undefined>"]}),!0),$e=q("vector-for-each",[{name:"proc"},{name:"vector1"},{name:"vectors",type:"variadic"}],(({proc:e,vector1:r,vectors:t})=>{I.Procedure(e),I.Vector(r),I.Vectors(t);const n=[r,...t];return n.every((e=>e[1].length>1))?x.Begin(x.Call(e,j.MultiValue(n.map((e=>e[1][0])))),x.CallBuiltIn("vector-for-each",e,...n.map((e=>j.Vector(e[1].slice(1),!1))))):n.every((e=>e[1].length>=1))?x.Call(e,j.MultiValue(n.map((e=>e[1][0])))):x.Quote(["<null>"])}),!0),Le=q("call-with-current-continuation",[{name:"proc"}],(({proc:e},r,t)=>(I.Procedure(e),B(t),x.Call(e,j.Continuation(b(t))))),!0),ke=T("call/cc",Le),Ve=q("values",[{name:"objs",type:"variadic"}],(({objs:e})=>(I.Objects(e),1===e.length?e[0]:j.MultiValue(e)))),ze=q("call-with-values",[{name:"producer"},{name:"consumer"}],(({producer:e,consumer:r},t,n)=>{I.Procedure(e),I.Procedure(r),B(n);const a=S(n,j.List(r),{want:"args",oper:r});return v(a,j.List(e))})),Me=q("dynamic-wind",[{name:"before"},{name:"thunk"},{name:"after"}],(({before:e,thunk:r,after:t},n,a)=>{I.Procedure(e),I.Procedure(r),I.Procedure(t),B(a);const o=j.Continuation(b(a));return v(a,x.Begin(x.Call(e),x.Call(o,x.Call(r))),{before:e,after:t})})),_e={procedureQ:Ee,apply:Ne,map:Ie,stringMap:Be,vectorMap:Oe,forEach:Ce,stringForEach:Ae,vectorForEach:$e,callWithCurrentContinuation:Le,callCC:ke,values:Ve,callWithValues:ze,dynamicWind:Me},qe=q("eqv?",[{name:"obj1"},{name:"obj2"}],(({obj1:e,obj2:r})=>{I.Object(e),I.Object(r);const t=e=>P.String(e)||P.ByteVector(e)||P.Vector(e)?e.slice(0,e.length-1):P.Pair(e)?e.slice(0,3):P.Symbol(e)?e.slice(0,2):e;return j.Boolean(e===r||D(t(e),t(r)))})),Te=T("eq?",qe),De=q("equal?",[{name:"obj1"},{name:"obj2"}],(({obj1:e,obj2:r})=>{I.Object(e),I.Object(r);const t=(e,r)=>e===r||(P.Pair(e)&&P.Pair(r)?t(e[1],r[1])&&t(e[2],r[2]):P.Vector(e)&&P.Vector(r)?e[1]===r[1]||e[1].length===r[1].length&&e[1].every(((e,n)=>t(e,r[1][n]))):P.ByteVector(e)&&P.ByteVector(r)?D(e[1],r[1]):qe.body({obj1:e,obj2:r})[1]);return j.Boolean(t(e,r))})),Re={eqvQ:qe,eqQ:Te,equalQ:De},Qe=q("with-exception-handler",[{name:"handler"},{name:"thunk"}],(({handler:e,thunk:r},t,n)=>(I.Procedure(e),I.Procedure(r),B(n),S(n,x.Call(r),{handler:j.HandlerStack(e,h(n).handler)})))),Ue=q("raise",[{name:"obj"}],(({obj:e},r,t)=>{throw I.Object(e),B(t),j.Exception(t,e,!1)})),Fe=q("raise-continuable",[{name:"obj"}],(({obj:e},r,t)=>{throw I.Object(e),B(t),j.Exception(t,e,!0)})),Je=q("error",[{name:"message"},{name:"objs",type:"variadic"}],(({message:e,objs:r},t,n)=>{throw I.String(e),I.Objects(r),B(n),j.Exception(n,j.Error("error",e[1],r),!0)})),Xe=q("error-object?",[{name:"obj"}],(({obj:e})=>(I.Object(e),j.Boolean(P.Error(e))))),Ze=q("error-object-message",[{name:"err"}],(({err:e})=>{var r;return I.Error(e),j.String(null!=(r=e[2])?r:e[1],!1)})),Ke=q("error-object-irritants",[{name:"err"}],(({err:e})=>(I.Error(e),j.List(...e[3])))),We=q("read-error?",[{name:"obj"}],(({obj:e})=>(I.Object(e),j.Boolean(P.Error(e)&&"read-error"===e[1])))),Ge=q("file-error?",[{name:"obj"}],(({obj:e})=>(I.Object(e),j.Boolean(P.Error(e)&&"file-error"===e[1])))),He={withExceptionHandler:Qe,raise:Ue,raiseContinuable:Fe,error:Je,errorObjectQ:Xe,errorObjectMessage:Ze,errorObjectIrritants:Ke,readErrorQ:We,fileErrorQ:Ge},Ye=q("suspend",[{name:"obj",type:"optional"}],(({obj:e},r,t)=>{throw B(t),e&&I.Object(e),j.Suspend(j.Continuation(b(t)),null!=e?e:j.Undefined())})),er=q("read-file",[{name:"filename"},{name:"cli",type:"optional"}],(({filename:e,cli:r},t)=>{if(B(t),I.String(e),r&&I.Boolean(r),!(null==t?void 0:t.fs))throw j.Error("program-error",'No interpreter object or No Node.js "fs" object set on Interpreter.');let n,a;try{n=t.fs.readFileSync(e[1]).toString()}catch{throw j.Error("read-error",`Can't read file from ${e[1]}.`)}try{a=Y(r&&r[1]?"#!fold-case "+n:n,{filename:e[1]})}catch(o){throw o instanceof Error?j.Error("read-error",o.message):j.Error("read-error","Error occured while reading.")}return a}),!1,!0),rr={suspend:Ye,readFile:er},tr=q("features",[],(()=>j.List(j.Symbol("r7rs"),j.Symbol(r),j.Symbol(r+"-"+t)))),nr={features:tr},ar=q("quote",[{name:"value",evaluate:!1}],(({value:e})=>(I.Object(e),e))),or=q("lambda",[{name:"formals",evaluate:!1},{name:"body",type:"variadic",evaluate:!1}],(({formals:e,body:r},t,n)=>{I.Object(e),I.Objects(r),B(n);const[a,o]=R(e);return j.Procedure("lambda",o?[...a,o]:a,x.BeginIfMultiple(...r),!1,h(n).env)})),ir=q("if",[{name:"test"},{name:"consequent",evaluate:!1},{name:"alternate",type:"optional",evaluate:!1}],(({test:e,consequent:r,alternate:t})=>(I.Object(e),I.Object(r),P.False(e)?t?(I.Object(t),t):["<undefined>"]:r)),!0),lr=q("set!",[{name:"variable",evaluate:!1},{name:"expr"}],(({variable:e,expr:r},t,n)=>{if(B(t),B(n),I.Symbol(e),I.Object(r),P.Undefined(r))throw j.Error("undefined-variable",`Attempt to set undefined value to a variable "${e[1]}"`);if(!t.setStatic(h(n).env.static,e,r))throw j.Error("unbound-variable",`Attempt to set value to an unbound variable "${e[1]}"`);return["<undefined>"]})),sr=q("include",[{name:"str1"},{name:"strs",type:"variadic"}],(({str1:e,strs:r},t,n)=>{B(t),B(n),I.String(e),I.Strings(r);const a=[e,...r].map((e=>er.body({filename:e},t)));return 1===a.length?a[0]:x.Begin(...a)}),!0),cr=q("include-cli",[{name:"str1"},{name:"strs",type:"variadic"}],(({str1:e,strs:r},t,n)=>{B(t),B(n),I.String(e),I.Strings(r);const a=[e,...r].map((e=>er.body({filename:e,cli:j.Boolean(!0)},t)));return 1===a.length?a[0]:x.Begin(...a)}),!0),ur=q("cond",[{name:"clause",evaluate:!1},{name:"clauses",type:"variadic",evaluate:!1}],(({clause:e,clauses:r})=>{I.Pair(e),I.Pairs(r);const t=0===r.length?["<undefined>"]:x.Cond(r[0],...r.splice(1)),[n,a,...o]=V(e);if(P.Symbol(n)&&"else"===n[1])return x.BeginIfMultiple(a,...o);if(a){if(P.Symbol(a)&&"=>"===a[1]){if(1!==o.length)throw j.Error("syntax-error","Illegal cond syntax (test => expression).");const e=j.Symbol(_());return x.Let([[e,n]],x.If(e,x.Call(o[0],e),t))}return x.If(n,x.BeginIfMultiple(a,...o),t)}return x.Or(n,t)}),!0),mr=q("case",[{name:"key"},{name:"clauses",type:"variadic",evaluate:!1}],(({key:e,clauses:r})=>{I.Object(e),I.Pairs(r);const t=r.find(((t,n)=>{if(P.Symbol(t[1])&&"else"===t[1][1]){if(n!==r.length-1)throw j.Error("syntax-error","Illegal case syntax (else placement).");return!0}return I.Pair(t[1]),V(t[1]).some((r=>qe.body({obj1:r,obj2:e})[1]))}));if(t){const[,r,...n]=V(t);if(r){if(P.Symbol(r)&&"=>"===r[1]){if(1!==n.length)throw j.Error("syntax-error","Illegal cond syntax (test => expression).");return x.Call(n[0],j.MultiValue([e]))}return x.BeginIfMultiple(r,...n)}throw j.Error("syntax-error","Illegal cond syntax (short clause).")}return["<undefined>"]}),!0),dr=q("and",[{name:"first",type:"optional"},{name:"rest",type:"variadic",evaluate:!1}],(({first:e,rest:r})=>e?(I.Object(e),I.Objects(r),0===r.length||P.False(e)?x.Quote(e):x.And(...r)):j.Boolean(!0)),!0),pr=q("or",[{name:"first",type:"optional"},{name:"rest",type:"variadic",evaluate:!1}],(({first:e,rest:r})=>e?(I.Object(e),I.Objects(r),0!==r.length&&P.False(e)?x.Or(...r):x.Quote(e)):j.Boolean(!1)),!0),fr=q("when",[{name:"test"},{name:"expr",evaluate:!1},{name:"exprs",type:"variadic",evaluate:!1}],(({test:e,expr:r,exprs:t})=>(I.Object(e),I.Object(r),I.Objects(t),P.False(e)?["<undefined>"]:x.BeginIfMultiple(r,...t))),!0),br=q("unless",[{name:"test"},{name:"expr",evaluate:!1},{name:"exprs",type:"variadic",evaluate:!1}],(({test:e,expr:r,exprs:t})=>(I.Object(e),I.Object(r),I.Objects(t),P.False(e)?x.BeginIfMultiple(r,...t):["<undefined>"])),!0),yr=q("cond-expand",[{name:"clause1",evaluate:!1},{name:"clauses",type:"variadic",evaluate:!1}],(({clause1:e,clauses:r},t,n)=>{I.Pair(e),I.Pairs(r),B(t),B(n);const a=[e,...r],o=V(tr.body()),i=e=>{if(P.Symbol(e))return o.some((r=>P.Symbol(r)&&r[1]===e[1]));if(P.Pair(e)){const[,r,a]=e;if(P.Symbol(r)&&P.List(a)){if("and"===r[1])return V(a).every((e=>i(e)));if("or"===r[1])return V(a).some((e=>i(e)));if("not"===r[1]){if(P.Pair(a))return!i(a[1])}else if("library"===r[1]&&P.Pair(a)){const e=c(a[1]);if(t.getBuiltInLibrary(e))return!0;{const r=t.getStatic(h(n).env.static,j.Symbol(e));return P.Library(r)}}}}return!1},l=a.find((e=>i(e[1])));return l?j.Pair(j.Procedure("built-in","begin"),l[2]):j.Undefined()}),!0),hr=q("let",[{name:"args",type:"variadic",evaluate:!1}],(({args:e},r,t)=>{I.Objects(e);const[n,a,...o]=P.Symbol(e[0])?e:[null,...e];I.List(a),I.Objects(o),B(t);const i=V(a).map((e=>{I.Pair(e),I.Symbol(e[1]),I.Pair(e[2]);const[,r,[,t]]=e;return[r,t]})),l=i.map((([e])=>e)),s=i.map((([,e])=>e)),c=x.Lambda(l,null,...o);return n?(I.Symbol(n),x.CallThunk(x.Define(n,c),x.Call(n,...s))):x.Call(c,...s)}),!0),gr=q("let*",[{name:"bindings",evaluate:!1},{name:"body",type:"variadic",evaluate:!1}],(({bindings:e,body:r},t,n)=>{if(I.List(e),I.Objects(r),B(n),P.Pair(e)){I.Pair(e[1]),I.Pair(e[1][2]);const[,[,t,[,n]],a]=e;return I.Symbol(t),x.Call(x.Lambda([t],null,x.CallBuiltIn("let*",a,...r)),n)}return x.BeginIfMultiple(...r)}),!0),vr=q("letrec",[{name:"bindings",evaluate:!1},{name:"body",type:"variadic",evaluate:!1}],(({bindings:e,body:r},t,n)=>{I.List(e),I.Objects(r),B(t),B(n);const a=V(e).map((e=>{I.Pair(e),I.Symbol(e[1]),I.Pair(e[2]);const[,r,[,t]]=e;return[r,t]})),{static:o,dynamic:i}=h(n).env,l=w(o);return a.forEach((([e])=>t.defineStatic(l,e,["<undefined>"]))),x.Call(j.Procedure("lambda",[],x.Begin(x.DefineValues(a.map((([e])=>e)),x.Values(...a.map((([,e])=>e)))),...r),!1,{static:l,dynamic:i}))}),!0),Sr=q("letrec*",[{name:"bindings",evaluate:!1},{name:"body",type:"variadic",evaluate:!1}],(({bindings:e,body:r},t,n)=>{I.List(e),I.Objects(r),B(t),B(n);const a=V(e).map((e=>{I.Pair(e),I.Symbol(e[1]),I.Pair(e[2]);const[,r,[,t]]=e;return[r,t]})),{static:o,dynamic:i}=h(n).env,l=w(o);return a.forEach((([e])=>t.defineStatic(l,e,["<undefined>"]))),x.Call(j.Procedure("lambda",[],x.Begin(...a.map((([e,r])=>x.Set(e,r))),...r),!1,{static:l,dynamic:i}))}),!0),wr=q("let-values",[{name:"bindings",evaluate:!1},{name:"body",type:"variadic",evaluate:!1}],(({bindings:e,body:r},t,n)=>(I.List(e),I.Objects(r),B(n),x.CallThunk(...V(e).map((e=>{I.Pair(e),I.Pair(e[2]);const[,r,[,t]]=e,a=j.Procedure("lambda",[],t,!1,h(n).env);return x.CallBuiltIn("define-values",r,x.Call(a))})),...r))),!0),jr=q("let*-values",[{name:"bindings",evaluate:!1},{name:"body",type:"variadic",evaluate:!1}],(({bindings:e,body:r},t,n)=>{if(I.List(e),I.Objects(r),B(n),P.Pair(e)){I.Pair(e[1]),I.Pair(e[1][2]);const[,[,t,[,n]],a]=e;return x.CallThunk(x.CallBuiltIn("define-values",t,n),x.CallBuiltIn("let*-values",a,...r))}return x.BeginIfMultiple(...r)}),!0),xr=q("begin",[{name:"exprs",type:"variadic",evaluate:!0},{name:"last",type:"tail",evaluate:!1}],(({exprs:e,last:r},t,n)=>(((e,r)=>{if(!(e instanceof Array))throw j.Error("program-error",null!=r?r:"An array is expected.")})(e),I.Object(r),B(n),0===h(n).depth?v(n,r):r)),!0),Pr=q("do",[{name:"specs",evaluate:!1},{name:"clause",evaluate:!1},{name:"commands",type:"variadic",evaluate:!1}],(({specs:e,clause:r,commands:t})=>{I.List(e),I.List(r),I.Objects(t);const n=V(e).map((e=>{I.Pair(e),I.Pair(e[2]),I.Symbol(e[1]);const[,r,[,t,n]]=e;return[r,t,P.Pair(n)?n[1]:null]})),[,a,o]=r;return I.Object(a),I.List(o),x.Let(n.map((([e,r])=>[e,r])),x.If(a,P.Null(o)?j.Undefined():x.Begin(...V(o)),x.Begin(...t,x.CallBuiltIn("do",j.List(...n.map((([e,,r])=>j.List(e,null!=r?r:e,null!=r?r:e)))),r,...t))))}),!0),Er=q("make-parameter",[{name:"init"},{name:"converter",type:"optional"}],(({init:e,converter:r},t,n)=>{I.Object(e),B(t),B(n);let a=_();for(;a in h(n).env.dynamic[1];)a=_();return r&&I.Procedure(r),t.defineDynamic(h(n).env.dynamic,a,e),j.Parameter(a,null!=r?r:null)})),Nr=q("parameterize",[{name:"assocs",evaluate:!1},{name:"body",type:"variadic",evaluate:!1}],(({assocs:e,body:r},t,n)=>{I.Pair(e),I.Pairs(r),B(t),B(n);const{env:a}=h(n),o=V(e).map((e=>{I.Pair(e),I.Pair(e[2]);const[,r,[,t]]=e;return[r,t]})),i={static:a.static,dynamic:j.DynamicNS({},a.dynamic)},l=x.BeginIfMultiple(...o.map((([e,r])=>x.CallBuiltIn("define-parameter",e,r))),...r);return S(n,l,{env:i})})),Ir=q("define-parameter",[{name:"param"},{name:"value",evaluate:!1}],(({param:e,value:r},t,n)=>{I.Parameter(e),I.Object(r),B(t),B(n);const[,,a]=e;return x.CallBuiltIn("define-parameter-1",e,a?x.Call(a,r):r)}),!0,!0),Br=q("define-parameter-1",[{name:"param"},{name:"value"}],(({param:e,value:r},t,n)=>{var a;if(I.Parameter(e),I.Object(r),B(t),B(n),!P.Undefined(null!=(a=f(h(n).env.dynamic)[e[1]])?a:["<undefined>"]))throw j.Error("redefine-variable",null);return t.defineDynamic(h(n).env.dynamic,e[1],r),["<undefined>"]}),!1,!0),Or=q("guard",[{name:"arg1",evaluate:!1},{name:"body",type:"variadic",evaluate:!1}],(({arg1:e,body:r},t,n)=>{I.Pair(e),I.Objects(r),I.Symbol(e[1]),I.Pair(e[2]),B(n);const[,a,o]=e,i=j.Continuation(b(n)),l=j.Procedure("lambda",[{name:a[1]}],x.Call(i,x.CallBuiltIn("cond",...V(o),j.List(j.Symbol("else"),x.RaiseContinuable(a)))),!1,h(n).env);return x.CallBuiltIn("with-exception-handler",l,x.Lambda([],null,...r))}),!0),Cr=q("quasiquote",[{name:"template",evaluate:!1}],(({template:e})=>{I.Object(e);const r=[],t=[],n=(e,a)=>{if(P.Pair(e)){const[,o,i]=e;if(P.Symbol(o)&&"quasiquote"===o[1])return j.Pair(o,n(i,a+1));if(P.Symbol(o)&&"unquote"===o[1]||"unquote-splicing"===o[1]){if(0!==a)return j.Pair(o,n(i,a-1));{const e=j.Symbol("unquote-splicing"===o[1]?"@"+_():_());return I.Pair(i),r.push(e),t.push(i[1]),e}}return j.Pair(n(o,a),n(i,a))}return P.Vector(e)?j.Vector(e[1].map((e=>n(e,a))),!1):e},a=n(e,0);return x.CallBuiltIn("quasiquote-1",a,j.List(...r),...t)}),!0),Ar=q("quasiquote-1",[{name:"template",evaluate:!1},{name:"marks",evaluate:!1},{name:"exprs",type:"variadic"}],(({template:e,marks:r,exprs:t})=>{I.Object(e),I.List(r),I.Objects(t);const n=V(r);I.Symbols(n);const a=new Map;if(n.length!==t.length)throw j.Error("arity-error","quasiquote-1: marks and exprs unmatch.");n.forEach(((e,r)=>a.set(e[1],t[r])));const o=e=>{if(P.Pair(e)){const[,r,t]=e;if(P.Symbol(r)&&"@"===r[1][0]&&a.has(r[1])){const e=a.get(r[1]);if(P.List(e))return P.Null(e)?o(t):M(V(e),o(t));throw j.Error("error","unquote-splicing evaluated as non-list object.")}return j.Pair(o(r),o(t))}return P.Vector(e)?j.Vector(e[1].map((e=>{if(P.Symbol(e)&&"@"===e[1][0]&&a.has(e[1])){const r=a.get(e[1]);if(P.List(r))return P.Null(r)?[]:V(r);throw j.Error("error","unquote-splicing evaluated as non-list object.")}return[o(e)]})).flat(),!1):P.Symbol(e)&&a.has(e[1])&&"@"!==e[1][0]?a.get(e[1]):e};return o(e)}),!1,!0),$r=q("let-syntax",[{name:"bindings",evaluate:!1},{name:"body",type:"variadic",evaluate:!1}],(({bindings:e,body:r},t,n)=>{I.List(e,"aa"),I.Objects(r),B(n);const a=V(e).map((e=>{I.Pair(e),I.Pair(e[2]),I.Symbol(e[1]);const[,r,[,t]]=e;return[r,j.Procedure("lambda",[],t,!1,h(n).env)]}));return x.CallThunk(...a.map((([e,r])=>x.CallBuiltIn("define-syntax",e,x.Call(r)))),...r)}),!0),Lr=q("letrec-syntax",[{name:"bindings",evaluate:!1},{name:"body",type:"variadic",evaluate:!1}],(({bindings:e,body:r},t,n)=>{I.List(e),I.Objects(r),B(t),B(n);const a=V(e).map((e=>{I.Pair(e),I.Pair(e[2]),I.Symbol(e[1]);const[,r,[,t]]=e;return[r,t]})),{static:o,dynamic:i}=h(n).env,l=w(o);return a.forEach((([e])=>t.defineStatic(l,e,["<undefined>"]))),x.Call(j.Procedure("lambda",[],x.Begin(...a.map((([e,r])=>x.CallBuiltIn("define-syntax",e,r))),...r),!1,{static:l,dynamic:i}))}),!0),kr=(e,r,t=!0)=>{var n;const[a,o]=z(e),i=a.findIndex((e=>P.Symbol(e)&&e[1]===r)),l=t?i<0?a.slice(1):a.slice(1,i-1):i<0?a:a.slice(0,i-1),s=i<0?[]:a.slice(i+1),c=i<0?null:null!=(n=a[i-1])?n:null;return["<syntax-rule-pattern>",l.map((e=>P.Pair(e)?kr(e,r,!1):e)),c?P.Pair(c)?kr(c,r,!1):c:null,s.map((e=>P.Pair(e)?kr(e,r,!1):e)),P.Null(o)?null:o]},Vr=q("syntax-rules",[{name:"arg1",evaluate:!1},{name:"arg2",evaluate:!1},{name:"args",type:"variadic",evaluate:!1}],(({arg1:e,arg2:r,args:t},n,a)=>{I.Object(e),I.Object(r),I.Objects(t),B(n),B(a);const[o,i,l]=P.Symbol(e)?[e[1],r,t]:["...",e,[r,...t]];I.List(i);const s=V(i).map((e=>(I.Symbol(e),e[1]))),c=(e,r=new Map)=>{var t;if(P.Pair(e))return j.Pair(c(e[1],r),c(e[2],r));if(P.Symbol(e)){if(n.getStatic(h(a).env.static,e))return j.Symbol(e[1],h(a).env.static,null!=(t=e[3])?t:null);if(s.includes(e[1])||o===e[1]||"_"===e[1])return e;if(r.has(e[1]))return r.get(e[1]);{const t=j.Symbol(e[1],null,_());return r.set(e[1],t),t}}return e};I.Pairs(l);const u=[];for(const m of l){const e=c(m);I.Pair(e),I.Pair(e[2]);const[,r,[,t]]=e;I.Pair(r);const[n,a]=z(r);if(!P.Null(a)&&n.some((e=>P.Symbol(e)&&e[1]===o)))throw j.Error("syntax-error","The root of a syntax-rules pattern with ellipsis must be a proper list.");u.push([kr(r,o),t])}return j.SyntaxRules(o,s,u)})),zr=(e,r)=>{if(P.SyntaxRulePattern(e)){const[,t,n,a,o]=e;return[...t,...n?[n]:[],...a,...o?[o]:[]].map((e=>zr(e,r))).flat()}return P.Symbol(e)&&!r.includes(e[1])?"_"===e[1]?[]:[e[1]]:[]},Mr=(e,r,t,n,a,o)=>{if(P.SyntaxRulePattern(e)){if(!P.List(r))return null;const[,i,l,s,c]=e;if(P.Null(r))return 0!==i.length||l||0!==s.length||c?null:new Map;const[u,m]=z(r);if(l||c){if(u.length<i.length+s.length)return null}else if(u.length!==i.length+s.length)return null;let d;if(l){const e=u.length-i.length-s.length;d=[...i,...Array(e).fill(l),...s],c&&(d.push(c),u.push(m))}else d=[...i],c&&(d.push(c),u.push(M(u.slice(i.length),m)));const p=new Map;l&&zr(l,o).forEach((e=>p.set(e,[])));for(let e=0;e<d.length;e++){const[r,i]=[d[e],u[e]],s=Mr(r,i,t,n,a,o);if(!s)return null;if(r===l)for(const[e,t]of s.entries()){const r=p.get(e);if(!r||P.Object(r))throw j.Error("syntax-error",`Internal error: illegal behavior of syntax-rules. No array prepared for variadic variable "${e}".`);P.Object(t)?p.set(e,[...r,t]):p.set(e,[...r,...t])}else for(const[e,t]of s.entries()){if(p.has(e))throw j.Error("syntax-error","The same pattern variable appeared more than once in a pattern.");p.set(e,t)}}return p}if(P.Symbol(e)&&o.includes(e[1])){if(!P.Symbol(r))return null;const o=t.getStatic(a,e),i=t.getStatic(n,e);return e[1]===r[1]&&o===i?new Map:null}return P.Symbol(e)?"_"===e[1]?new Map:new Map([[e[1],r]]):De.body({obj1:e,obj2:r})[1]?new Map:null},_r=q("use-syntax-rules",[{name:"spec"},{name:"args"}],(({spec:e,args:r},t,n)=>{I.SyntaxRules(e),I.List(r),B(t),B(n);const[,a,o,i]=e,l=h(b(n)).env.static,s=h(n).env.static;let c,u;{let e,n;for(const a of i)if(e=Mr(a[0],r,t,l,s,o)){n=a[1];break}if(!e||!n)throw j.Error("syntax-error","No rules match arguments.");[c,u]=[e,n]}const m=e=>{if(P.Pair(e)){const[,r,t]=e;if(P.Symbol(r)&&c.has(r[1])&&P.Symbol(t[1])&&t[1][1]===a){const e=c.get(r[1]);if(!e||P.Object(e))throw j.Error("syntax-error",`Pattern variable "${r[1]} is not variadic." `);return M(e,m(t[2]))}return P.Pair(r)&&P.Symbol(r[1])&&r[1][1]===a&&P.Pair(r[2])?j.Pair(m(r[2][1]),m(t)):j.Pair(m(r),m(t))}if(P.Symbol(e)&&c.has(e[1])){const r=c.get(e[1]);if(!P.Object(r))throw j.Error("syntax-error",`Pattern variable "${e[1]}" must be variadic. (add "${a}" after the symbol)" `);return r}return e};return m(u)}),!1,!0),qr=q("syntax-error",[{name:"message"},{name:"args",type:"variadic"}],(({message:e,args:r})=>{throw I.String(e),I.Objects(r),j.Error("syntax-error",e[1],r)})),Tr={quote:ar,lambda:or,If:ir,setD:lr,include:sr,includeCli:cr,cond:ur,Case:mr,and:dr,or:pr,when:fr,unless:br,condExpand:yr,Let:hr,LetStar:gr,letrecStar:Sr,letrec:vr,letValues:wr,letStarValues:jr,begin:xr,Do:Pr,makeParameter:Er,parameterize:Nr,defineParameter:Ir,defineParameter1:Br,guard:Or,quasiquote:Cr,quasiquote1:Ar,letSyntax:$r,letrecSyntax:Lr,syntaxRules:Vr,applySyntaxRules:_r,syntaxError:qr},Dr=q("pair?",[{name:"obj"}],(({obj:e})=>(I.Object(e),j.Boolean(P.Pair(e))))),Rr=q("cons",[{name:"obj1"},{name:"obj2"}],(({obj1:e,obj2:r})=>(I.Object(e),I.Object(r),j.Pair(e,r)))),Qr=q("car",[{name:"pair"}],(({pair:e})=>(I.Pair(e),e[1]))),Ur=q("cdr",[{name:"pair"}],(({pair:e})=>(I.Pair(e),e[2]))),Fr=q("set-car!",[{name:"pair"},{name:"obj"}],(({pair:e,obj:r})=>{if(I.Pair(e),I.Object(r),e[3])throw j.Error("immutable-object","Specified list is immutable");return e[1]=r,e})),Jr=q("set-cdr!",[{name:"pair"},{name:"obj"}],(({pair:e,obj:r})=>{if(I.Pair(e),I.Object(r),e[3])throw j.Error("immutable-object","Specified list is immutable");return e[2]=r,e})),Xr=q("caar",[{name:"pair"}],(({pair:e})=>(I.Pair(e),I.Pair(e[1]),e[1][1]))),Zr=q("cadr",[{name:"pair"}],(({pair:e})=>(I.Pair(e),I.Pair(e[2]),e[2][1]))),Kr=q("cdar",[{name:"pair"}],(({pair:e})=>(I.Pair(e),I.Pair(e[1]),e[1][2]))),Wr=q("cddr",[{name:"pair"}],(({pair:e})=>(I.Pair(e),I.Pair(e[2]),e[2][2]))),Gr=q("null?",[{name:"obj"}],(({obj:e})=>(I.Object(e),j.Boolean(P.Null(e))))),Hr=q("list?",[{name:"obj"}],(({obj:e})=>{if(I.Object(e),!P.List(e))return j.Boolean(!1);if(P.Null(e))return j.Boolean(!0);try{const[,r]=z(e);return j.Boolean(P.Null(r))}catch(r){return j.Boolean(!1)}})),Yr=q("make-list",[{name:"k"},{name:"fill",type:"optional"}],(({k:e,fill:r})=>(I.IntegerNumber(e),r?(I.Object(r),j.List(...Array.from({length:e[1]},(()=>r)))):j.List(...Array.from({length:e[1]},(()=>["<undefined>"