Pierrad / obsidian-github-copilot

A bridge between Obsidian and Github Copilot
Apache License 2.0
55 stars 5 forks source link

Sign in modal not showing up on Arch Linux #15

Closed gwerneckp closed 1 month ago

gwerneckp commented 1 month ago

Describe the bug Sign in modal not showing up.

To Reproduce

  1. Go to 'settings'
  2. Click on 'restart sign-in process'

Expected behaviour A modal is supposed to appear where I can sign in into my GitHub account.

Obsidian and environment (please complete the following information):

Additional context I fear this is more related to my OS than the plugin itself, however, often when this type of behaviour does not work on other applications, they provide a manual URL i can copy and paste into my browser. It'd be quite helpful if you could implement that for when the modal doesn't work. A simple "Modal not showing up? Access ..." after clicking on 'restart sign-in process'.

gwerneckp commented 1 month ago

Actually some extra information:

Upon inspecting it. When I attempt to sign in, I get this error:

plugin:github-copilot:27616 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'initiateSignIn')
    at eval (plugin:github-copilot:27616:45)
    at HTMLButtonElement.<anonymous> (app.js:1:1464673)
Pierrad commented 1 month ago

Hi @gwerneckp, can you tell me if copilot is disabled in the bottom status bar when you try to sign in using the button? Like the following on the right end:

image

gwerneckp commented 1 month ago

Copilot seems to be enabled.

Screenshot from 2024-05-26 11-10-05

gwerneckp commented 1 month ago

Although, when attempting to disable and renable it. I get another error. Screenshot from 2024-05-26 11-11-20

node:events:495 Uncaught Error: write EPIPE
    at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
    at __node_internal_errnoException (node:internal/errors:623:12)
    at afterWriteDispatched (node:internal/stream_base_commons:160:15)
    at writeGeneric (node:internal/stream_base_commons:151:3)
    at Socket._writeGeneric (node:net:962:11)
    at Socket._write (node:net:974:8)
    at writeOrBuffer (node:internal/streams/writable:392:12)
    at _write (node:internal/streams/writable:333:10)
    at Writable.write (node:internal/streams/writable:337:10)
    at JSONRPCEndpoint2.eval (plugin:github-copilot:2267:25)
    at Generator.next (<anonymous>)
    at eval (plugin:github-copilot:199:67)
    at new Promise (<anonymous>)
    at Object.__awaiter (plugin:github-copilot:181:10)
    at JSONRPCClient2.eval [as _send] (plugin:github-copilot:2263:84)
    at JSONRPCClient2.eval (plugin:github-copilot:1113:31)
    at step (plugin:github-copilot:969:23)
    at Object.eval [as next] (plugin:github-copilot:916:18)
    at eval (plugin:github-copilot:902:71)
    at new Promise (<anonymous>)
    at __awaiter2 (plugin:github-copilot:884:14)
    at JSONRPCClient2.send (plugin:github-copilot:1111:18)
    at JSONRPCClient2.requestAdvanced (plugin:github-copilot:1095:23)
    at JSONRPCClient2.eval (plugin:github-copilot:1056:35)
    at step (plugin:github-copilot:969:23)
    at Object.eval [as next] (plugin:github-copilot:916:18)
    at eval (plugin:github-copilot:902:71)
    at new Promise (<anonymous>)
    at __awaiter2 (plugin:github-copilot:884:14)
    at JSONRPCClient2.requestWithID (plugin:github-copilot:1050:18)
    at JSONRPCClient2.request (plugin:github-copilot:1047:23)
    at JSONRPCEndpoint2.send (plugin:github-copilot:2289:28)
    at LspClient2.initialize (plugin:github-copilot:598:30)
    at Client.initialize (plugin:github-copilot:27223:30)
    at Client.setup (plugin:github-copilot:27203:16)
    at CopilotAgent.configureClient (plugin:github-copilot:27332:23)
    at CopilotAgent.setup (plugin:github-copilot:27313:16)
    at CopilotAgent.updateSettings (plugin:github-copilot:27375:12)
    at CopilotPluginSettingTab.notifyObservers (plugin:github-copilot:27646:16)
    at CopilotPluginSettingTab.saveSettings (plugin:github-copilot:27659:12)
    at async HTMLDivElement.eval (plugin:github-copilot:27424:7)
Pierrad commented 1 month ago

@gwerneckp Did you try the "Test the path" button in the settings? What did it returns?

Pierrad commented 1 month ago

@gwerneckp Can you tell me which package manager you used to install Obsidian?

Another user has already had issues with Flatpak for example (see #6), maybe it's the same kind of problem (obsidian being sandboxed and cannot properly access Node)

gwerneckp commented 1 month ago

Just fixed the node path issue. When trying to debug the issue, I reinstalled the plugin and forgot to reconfigure the node path. The error I had when disabling and enabling copilot is gone now.

The sign in issue is still not working though.

I installed Obsidian from Arch's official repository with Pacman.

Pierrad commented 1 month ago

@gwerneckp I've published a new version v1.0.3. It allows you to enable debug mode in the settings, it will give you a lot more logs in the console, can you share them with me?

It seems that when you try to signIn, the client that is in charge of communicating with the copilot server is not available.

In the meantime, I'm setting up a VM to try to reproduce your issue.

gwerneckp commented 1 month ago

I actually get a new error message upon enabling debug mode. Not when clicking on "restart sign-in process"

stderr: file:///home/gwern/Projects/bac-philo/content/.obsidian/plugins/github-copilot/copilot-1.0.3/agent.js:1
"use strict";var Q6e=Object.create;var SS=Object.defineProperty;var X6e=Object.getOwnPropertyDescriptor;var Z6e=Object.getOwnPropertyNames;var eye=Object.getPrototypeOf,tye=Object.prototype.hasOwnProperty;var rye=(e,t,r)=>t in e?SS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var l=(e,t)=>SS(e,"name",{value:t,configurable:!0});var Jt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var nye=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Z6e(t))!tye.call(e,s)&&s!==r&&SS(e,s,{get:()=>t[s],enumerable:!(n=X6e(t,s))||n.enumerable});return e};var Mr=(e,t,r)=>(r=e!=null?Q6e(eye(e)):{},nye(t||!e||!e.__esModule?SS(r,"default",{value:e,enumerable:!0}):r,e));var nc=(e,t,r)=>(rye(e,typeof t!="symbol"?t+"":t,r),r),VO=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Ai=(e,t,r)=>(VO(e,t,"read from private field"),r?r.call(e):t.get(e)),H0=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},N0=(e,t,r,n)=>(VO(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);var Kf=(e,t,r)=>(VO(e,t,"access private method"),r);var wZ=Jt(GO=>{var EZ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");GO.encode=function(e){if(0<=e&&e<EZ.length)return EZ[e];throw new TypeError("Must be between 0 and 63: "+e)};GO.decode=function(e){var t=65,r=90,n=97,s=122,o=48,a=57,c=43,f=47,u=26,d=52;return t<=e&&e<=r?e-t:n<=e&&e<=s?e-n+u:o<=e&&e<=a?e-o+d:e==c?62:e==f?63:-1}});var YO=Jt(KO=>{var IZ=wZ(),zO=5,AZ=1<<zO,PZ=AZ-1,RZ=AZ;function iye(e){return e<0?(-e<<1)+1:(e<<1)+0}l(iye,"toVLQSigned");function sye(e){var t=(e&1)===1,r=e>>1;return t?-r:r}l(sye,"fromVLQSigned");KO.encode=l(function(t){var r="",n,s=iye(t);do n=s&PZ,s>>>=zO,s>0&&(n|=RZ),r+=IZ.encode(n);while(s>0);return r},"base64VLQ_encode");KO.decode=l(function(t,r,n){var s=t.length,o=0,a=0,c,f;do{if(r>=s)throw new Error("Expected more digits in base 64 VLQ value.");if(f=IZ.decode(t.charCodeAt(r++)),f===-1)throw new Error("Invalid base64 digit: "+t.charAt(r-1));c=!!(f&RZ),f&=PZ,o=o+(f<<a),a+=zO}while(c);n.value=sye(o),n.rest=r},"base64VLQ_decode")});var iy=Jt(Pf=>{function oye(e,t,r){if(t in e)return e[t];if(arguments.length===3)return r;throw new Error('"'+t+'" is a required argument.')}l(oye,"getArg");Pf.getArg=oye;var kZ=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,aye=/^data:.+\,.+$/;function ib(e){var t=e.match(kZ);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}l(ib,"urlParse");Pf.urlParse=ib;function ry(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}l(ry,"urlGenerate");Pf.urlGenerate=ry;function JO(e){var t=e,r=ib(e);if(r){if(!r.path)return e;t=r.path}for(var n=Pf.isAbsolute(t),s=t.split(/\/+/),o,a=0,c=s.length-1;c>=0;c--)o=s[c],o==="."?s.splice(c,1):o===".."?a++:a>0&&(o===""?(s.splice(c+1,a),a=0):(s.splice(c,2),a--));return t=s.join("/"),t===""&&(t=n?"/":"."),r?(r.path=t,ry(r)):t}l(JO,"normalize");Pf.normalize=JO;function DZ(e,t){e===""&&(e="."),t===""&&(t=".");var r=ib(t),n=ib(e);if(n&&(e=n.path||"/"),r&&!r.scheme)return n&&(r.scheme=n.scheme),ry(r);if(r||t.match(aye))return t;if(n&&!n.host&&!n.path)return n.host=t,ry(n);var s=t.charAt(0)==="/"?t:JO(e.replace(/\/+$/,"")+"/"+t);return n?(n.path=s,ry(n)):s}l(DZ,"join");Pf.join=DZ;Pf.isAbsolute=function(e){return e.charAt(0)==="/"||kZ.test(e)};function lye(e,t){e===""&&(e="."),e=e.replace(/\/$/,"");for(var r=0;t.indexOf(e+"/")!==0;){var n=e.lastIndexOf("/");if(n<0||(e=e.slice(0,n),e.match(/^([^\/]+:\/)?\/*$/)))return t;++r}return Array(r+1).join("../")+t.substr(e.length+1)}l(lye,"relative");Pf.relative=lye;var NZ=function(){var e=Object.create(null);return!("__proto__"in e)}();function OZ(e){return e}l(OZ,"identity");function cye(e){return LZ(e)?"$"+e:e}l(cye,"toSetString");Pf.toSetString=NZ?OZ:cye;function fye(e){return LZ(e)?e.slice(1):e}l(fye,"fromSetString");Pf.fromSetString=NZ?OZ:fye;function LZ(e){if(!e)return!1;var t=e.length;if(t<9||e.charCodeAt(t-1)!==95||e.charCodeAt(t-2)!==95||e.charCodeAt(t-3)!==111||e.charCodeAt(t-4)!==116||e.charCodeAt(t-5)!==111||e.charCodeAt(t-6)!==114||e.charCodeAt(t-7)!==112||e.charCodeAt(t-8)!==95||e.charCodeAt(t-9)!==95)return!1;for(var r=t-10;r>=0;r--)if(e.charCodeAt(r)!==36)return!1;return!0}l(LZ,"isProtoString");function uye(e,t,r){var n=ny(e.source,t.source);return n!==0||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0||r)||(n=e.generatedColumn-t.generatedColumn,n!==0)||(n=e.generatedLine-t.generatedLine,n!==0)?n:ny(e.name,t.name)}l(uye,"compareByOriginalPositions");Pf.compareByOriginalPositions=uye;function dye(e,t,r){var n=e.generatedLine-t.generatedLine;return n!==0||(n=e.generatedColumn-t.generatedColumn,n!==0||r)||(n=ny(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:ny(e.name,t.name)}l(dye,"compareByGeneratedPositionsDeflated");Pf.compareByGeneratedPositionsDeflated=dye;function ny(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}l(ny,"strcmp");function hye(e,t){var r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=ny(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:ny(e.name,t.name)}l(hye,"compareByGeneratedPositionsInflated");Pf.compareByGeneratedPositionsInflated=hye;function mye(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}l(mye,"parseSourceMapInput");Pf.parseSourceMapInput=mye;function pye(e,t,r){if(t=t||"",e&&(e[e.length-1]!=="/"&&t[0]!=="/"&&(e+="/"),t=e+t),r){var n=ib(r);if(!n)throw new Error("sourceMapURL could not be parsed");if(n.path){var s=n.path.lastIndexOf("/");s>=0&&(n.path=n.path.substring(0,s+1))}t=DZ(ry(n),t)}return JO(t)}l(pye,"computeSourceURL");Pf.computeSourceURL=pye});var ZO=Jt(FZ=>{var QO=iy(),XO=Object.prototype.hasOwnProperty,u4=typeof Map<"u";function Sp(){this._array=[],this._set=u4?new Map:Object.create(null)}l(Sp,"ArraySet");Sp.fromArray=l(function(t,r){for(var n=new Sp,s=0,o=t.length;s<o;s++)n.add(t[s],r);return n},"ArraySet_fromArray");Sp.prototype.size=l(function(){return u4?this._set.size:Object.getOwnPropertyNames(this._set).length},"ArraySet_size");Sp.prototype.add=l(function(t,r){var n=u4?t:QO.toSetString(t),s=u4?this.has(t):XO.call(this._set,n),o=this._array.length;(!s||r)&&this._array.push(t),s||(u4?this._set.set(t,o):this._set[n]=o)},"ArraySet_add");Sp.prototype.has=l(function(t){if(u4)return this._set.has(t);var r=QO.toSetString(t);return XO.call(this._set,r)},"ArraySet_has");Sp.prototype.indexOf=l(function(t){if(u4){var r=this._set.get(t);if(r>=0)return r}else{var n=QO.toSetString(t);if(XO.call(this._set,n))return this._set[n]}throw new Error('"'+t+'" is not in the set.')},"ArraySet_indexOf");Sp.prototype.at=l(function(t){if(t>=0&&t<this._array.length)return this._array[t];throw new Error("No element indexed by "+t)},"ArraySet_at");Sp.prototype.toArray=l(function(){return this._array.slice()},"ArraySet_toArray");FZ.ArraySet=Sp});var UZ=Jt(BZ=>{var MZ=iy();function gye(e,t){var r=e.generatedLine,n=t.generatedLine,s=e.generatedColumn,o=t.generatedColumn;return n>r||n==r&&o>=s||MZ.compareByGeneratedPositionsInflated(e,t)<=0}l(gye,"generatedPositionAfter");function ES(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}l(ES,"MappingList");ES.prototype.unsortedForEach=l(function(t,r){this._array.forEach(t,r)},"MappingList_forEach");ES.prototype.add=l(function(t){gye(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))},"MappingList_add");ES.prototype.toArray=l(function(){return this._sorted||(this._array.sort(MZ.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},"MappingList_toArray");BZ.MappingList=ES});var eL=Jt(qZ=>{var sb=YO(),ic=iy(),wS=ZO().ArraySet,yye=UZ().MappingList;function Pd(e){e||(e={}),this._file=ic.getArg(e,"file",null),this._sourceRoot=ic.getArg(e,"sourceRoot",null),this._skipValidation=ic.getArg(e,"skipValidation",!1),this._sources=new wS,this._names=new wS,this._mappings=new yye,this._sourcesContents=null}l(Pd,"SourceMapGenerator");Pd.prototype._version=3;Pd.fromSourceMap=l(function(t){var r=t.sourceRoot,n=new Pd({file:t.file,sourceRoot:r});return t.eachMapping(function(s){var o={generated:{line:s.generatedLine,column:s.generatedColumn}};s.source!=null&&(o.source=s.source,r!=null&&(o.source=ic.relative(r,o.source)),o.original={line:s.originalLine,column:s.originalColumn},s.name!=null&&(o.name=s.name)),n.addMapping(o)}),t.sources.forEach(function(s){var o=s;r!==null&&(o=ic.relative(r,s)),n._sources.has(o)||n._sources.add(o);var a=t.sourceContentFor(s);a!=null&&n.setSourceContent(s,a)}),n},"SourceMapGenerator_fromSourceMap");Pd.prototype.addMapping=l(function(t){var r=ic.getArg(t,"generated"),n=ic.getArg(t,"original",null),s=ic.getArg(t,"source",null),o=ic.getArg(t,"name",null);this._skipValidation||this._validateMapping(r,n,s,o),s!=null&&(s=String(s),this._sources.has(s)||this._sources.add(s)),o!=null&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:r.line,generatedColumn:r.column,originalLine:n!=null&&n.line,originalColumn:n!=null&&n.column,source:s,name:o})},"SourceMapGenerator_addMapping");Pd.prototype.setSourceContent=l(function(t,r){var n=t;this._sourceRoot!=null&&(n=ic.relative(this._sourceRoot,n)),r!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[ic.toSetString(n)]=r):this._sourcesContents&&(delete this._sourcesContents[ic.toSetString(n)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))},"SourceMapGenerator_setSourceContent");Pd.prototype.applySourceMap=l(function(t,r,n){var s=r;if(r==null){if(t.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);s=t.file}var o=this._sourceRoot;o!=null&&(s=ic.relative(o,s));var a=new wS,c=new wS;this._mappings.unsortedForEach(function(f){if(f.source===s&&f.originalLine!=null){var u=t.originalPositionFor({line:f.originalLine,column:f.originalColumn});u.source!=null&&(f.source=u.source,n!=null&&(f.source=ic.join(n,f.source)),o!=null&&(f.source=ic.relative(o,f.source)),f.originalLine=u.line,f.originalColumn=u.column,u.name!=null&&(f.name=u.name))}var d=f.source;d!=null&&!a.has(d)&&a.add(d);var h=f.name;h!=null&&!c.has(h)&&c.add(h)},this),this._sources=a,this._names=c,t.sources.forEach(function(f){var u=t.sourceContentFor(f);u!=null&&(n!=null&&(f=ic.join(n,f)),o!=null&&(f=ic.relative(o,f)),this.setSourceContent(f,u))},this)},"SourceMapGenerator_applySourceMap");Pd.prototype._validateMapping=l(function(t,r,n,s){if(r&&typeof r.line!="number"&&typeof r.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(t&&"line"in t&&"column"in t&&t.line>0&&t.column>=0&&!r&&!n&&!s)){if(t&&"line"in t&&"column"in t&&r&&"line"in r&&"column"in r&&t.line>0&&t.column>=0&&r.line>0&&r.column>=0&&n)return;throw new Error("Invalid mapping: "+JSON.stringify({generated:t,source:n,original:r,name:s}))}},"SourceMapGenerator_validateMapping");Pd.prototype._serializeMappings=l(function(){for(var t=0,r=1,n=0,s=0,o=0,a=0,c="",f,u,d,h,m=this._mappings.toArray(),p=0,g=m.length;p<g;p++){if(u=m[p],f="",u.generatedLine!==r)for(t=0;u.generatedLine!==r;)f+=";",r++;else if(p>0){if(!ic.compareByGeneratedPositionsInflated(u,m[p-1]))continue;f+=","}f+=sb.encode(u.generatedColumn-t),t=u.generatedColumn,u.source!=null&&(h=this._sources.indexOf(u.source),f+=sb.encode(h-a),a=h,f+=sb.encode(u.originalLine-1-s),s=u.originalLine-1,f+=sb.encode(u.originalColumn-n),n=u.originalColumn,u.name!=null&&(d=this._names.indexOf(u.name),f+=sb.encode(d-o),o=d)),c+=f}return c},"SourceMapGenerator_serializeMappings");Pd.prototype._generateSourcesContent=l(function(t,r){return t.map(function(n){if(!this._sourcesContents)return null;r!=null&&(n=ic.relative(r,n));var s=ic.toSetString(n);return Object.prototype.hasOwnProperty.call(this._sourcesContents,s)?this._sourcesContents[s]:null},this)},"SourceMapGenerator_generateSourcesContent");Pd.prototype.toJSON=l(function(){var t={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(t.file=this._file),this._sourceRoot!=null&&(t.sourceRoot=this._sourceRoot),this._sourcesContents&&(t.sourcesContent=this._generateSourcesContent(t.sources,t.sourceRoot)),t},"SourceMapGenerator_toJSON");Pd.prototype.toString=l(function(){return JSON.stringify(this.toJSON())},"SourceMapGenerator_toString");qZ.SourceMapGenerator=Pd});var jZ=Jt(d4=>{d4.GREATEST_LOWER_BOUND=1;d4.LEAST_UPPER_BOUND=2;function tL(e,t,r,n,s,o){var a=Math.floor((t-e)/2)+e,c=s(r,n[a],!0);return c===0?a:c>0?t-a>1?tL(a,t,r,n,s,o):o==d4.LEAST_UPPER_BOUND?t<n.length?t:-1:a:a-e>1?tL(e,a,r,n,s,o):o==d4.LEAST_UPPER_BOUND?a:e<0?-1:e}l(tL,"recursiveSearch");d4.search=l(function(t,r,n,s){if(r.length===0)return-1;var o=tL(-1,r.length,t,r,n,s||d4.GREATEST_LOWER_BOUND);if(o<0)return-1;for(;o-1>=0&&n(r[o],r[o-1],!0)===0;)--o;return o},"search")});var HZ=Jt($Z=>{function rL(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}l(rL,"swap");function vye(e,t){return Math.round(e+Math.random()*(t-e))}l(vye,"randomIntInRange");function nL(e,t,r,n){if(r<n){var s=vye(r,n),o=r-1;rL(e,s,n);for(var a=e[n],c=r;c<n;c++)t(e[c],a)<=0&&(o+=1,rL(e,o,c));rL(e,o+1,c);var f=o+1;nL(e,t,r,f-1),nL(e,t,f+1,n)}}l(nL,"doQuickSort");$Z.quickSort=function(e,t){nL(e,t,0,e.length-1)}});var VZ=Jt(IS=>{var a0=iy(),iL=jZ(),sy=ZO().ArraySet,xye=YO(),ob=HZ().quickSort;function ol(e,t){var r=e;return typeof e=="string"&&(r=a0.parseSourceMapInput(e)),r.sections!=null?new W1(r,t):new rf(r,t)}l(ol,"SourceMapConsumer");ol.fromSourceMap=function(e,t){return rf.fromSourceMap(e,t)};ol.prototype._version=3;ol.prototype.__generatedMappings=null;Object.defineProperty(ol.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}});ol.prototype.__originalMappings=null;Object.defineProperty(ol.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}});ol.prototype._charIsMappingSeparator=l(function(t,r){var n=t.charAt(r);return n===";"||n===","},"SourceMapConsumer_charIsMappingSeparator");ol.prototype._parseMappings=l(function(t,r){throw new Error("Subclasses must implement _parseMappings")},"SourceMapConsumer_parseMappings");ol.GENERATED_ORDER=1;ol.ORIGINAL_ORDER=2;ol.GREATEST_LOWER_BOUND=1;ol.LEAST_UPPER_BOUND=2;ol.prototype.eachMapping=l(function(t,r,n){var s=r||null,o=n||ol.GENERATED_ORDER,a;switch(o){case ol.GENERATED_ORDER:a=this._generatedMappings;break;case ol.ORIGINAL_ORDER:a=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var c=this.sourceRoot;a.map(function(f){var u=f.source===null?null:this._sources.at(f.source);return u=a0.computeSourceURL(c,u,this._sourceMapURL),{source:u,generatedLine:f.generatedLine,generatedColumn:f.generatedColumn,originalLine:f.originalLine,originalColumn:f.originalColumn,name:f.name===null?null:this._names.at(f.name)}},this).forEach(t,s)},"SourceMapConsumer_eachMapping");ol.prototype.allGeneratedPositionsFor=l(function(t){var r=a0.getArg(t,"line"),n={source:a0.getArg(t,"source"),originalLine:r,originalColumn:a0.getArg(t,"column",0)};if(n.source=this._findSourceIndex(n.source),n.source<0)return[];var s=[],o=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",a0.compareByOriginalPositions,iL.LEAST_UPPER_BOUND);if(o>=0){var a=this._originalMappings[o];if(t.column===void 0)for(var c=a.originalLine;a&&a.originalLine===c;)s.push({line:a0.getArg(a,"generatedLine",null),column:a0.getArg(a,"generatedColumn",null),lastColumn:a0.getArg(a,"lastGeneratedColumn",null)}),a=this._originalMappings[++o];else for(var f=a.originalColumn;a&&a.originalLine===r&&a.originalColumn==f;)s.push({line:a0.getArg(a,"generatedLine",null),column:a0.getArg(a,"generatedColumn",null),lastColumn:a0.getArg(a,"lastGeneratedColumn",null)}),a=this._originalMappings[++o]}return s},"SourceMapConsumer_allGeneratedPositionsFor");IS.SourceMapConsumer=ol;function rf(e,t){var r=e;typeof e=="string"&&(r=a0.parseSourceMapInput(e));var n=a0.getArg(r,"version"),s=a0.getArg(r,"sources"),o=a0.getArg(r,"names",[]),a=a0.getArg(r,"sourceRoot",null),c=a0.getArg(r,"sourcesContent",null),f=a0.getArg(r,"mappings"),u=a0.getArg(r,"file",null);if(n!=this._version)throw new Error("Unsupported version: "+n);a&&(a=a0.normalize(a)),s=s.map(String).map(a0.normalize).map(function(d){return a&&a0.isAbsolute(a)&&a0.isAbsolute(d)?a0.relative(a,d):d}),this._names=sy.fromArray(o.map(String),!0),this._sources=sy.fromArray(s,!0),this._absoluteSources=this._sources.toArray().map(function(d){return a0.computeSourceURL(a,d,t)}),this.sourceRoot=a,this.sourcesContent=c,this._mappings=f,this._sourceMapURL=t,this.file=u}l(rf,"BasicSourceMapConsumer");rf.prototype=Object.create(ol.prototype);rf.prototype.consumer=ol;rf.prototype._findSourceIndex=function(e){var t=e;if(this.sourceRoot!=null&&(t=a0.relative(this.sourceRoot,t)),this._sources.has(t))return this._sources.indexOf(t);var r;for(r=0;r<this._absoluteSources.length;++r)if(this._absoluteSources[r]==e)return r;return-1};rf.fromSourceMap=l(function(t,r){var n=Object.create(rf.prototype),s=n._names=sy.fromArray(t._names.toArray(),!0),o=n._sources=sy.fromArray(t._sources.toArray(),!0);n.sourceRoot=t._sourceRoot,n.sourcesContent=t._generateSourcesContent(n._sources.toArray(),n.sourceRoot),n.file=t._file,n._sourceMapURL=r,n._absoluteSources=n._sources.toArray().map(function(p){return a0.computeSourceURL(n.sourceRoot,p,r)});for(var a=t._mappings.toArray().slice(),c=n.__generatedMappings=[],f=n.__originalMappings=[],u=0,d=a.length;u<d;u++){var h=a[u],m=new WZ;m.generatedLine=h.generatedLine,m.generatedColumn=h.generatedColumn,h.source&&(m.source=o.indexOf(h.source),m.originalLine=h.originalLine,m.originalColumn=h.originalColumn,h.name&&(m.name=s.indexOf(h.name)),f.push(m)),c.push(m)}return ob(n.__originalMappings,a0.compareByOriginalPositions),n},"SourceMapConsumer_fromSourceMap");rf.prototype._version=3;Object.defineProperty(rf.prototype,"sources",{get:function(){return this._absoluteSources.slice()}});function WZ(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}l(WZ,"Mapping");rf.prototype._parseMappings=l(function(t,r){for(var n=1,s=0,o=0,a=0,c=0,f=0,u=t.length,d=0,h={},m={},p=[],g=[],y,x,_,S,I;d<u;)if(t.charAt(d)===";")n++,d++,s=0;else if(t.charAt(d)===",")d++;else{for(y=new WZ,y.generatedLine=n,S=d;S<u&&!this._charIsMappingSeparator(t,S);S++);if(x=t.slice(d,S),_=h[x],_)d+=x.length;else{for(_=[];d<S;)xye.decode(t,d,m),I=m.value,d=m.rest,_.push(I);if(_.length===2)throw new Error("Found a source, but no line and column");if(_.length===3)throw new Error("Found a source and line, but no column");h[x]=_}y.generatedColumn=s+_[0],s=y.generatedColumn,_.length>1&&(y.source=c+_[1],c+=_[1],y.originalLine=o+_[2],o=y.originalLine,y.originalLine+=1,y.originalColumn=a+_[3],a=y.originalColumn,_.length>4&&(y.name=f+_[4],f+=_[4])),g.push(y),typeof y.originalLine=="number"&&p.push(y)}ob(g,a0.compareByGeneratedPositionsDeflated),this.__generatedMappings=g,ob(p,a0.compareByOriginalPositions),this.__originalMappings=p},"SourceMapConsumer_parseMappings");rf.prototype._findMapping=l(function(t,r,n,s,o,a){if(t[n]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+t[n]);if(t[s]<0)throw new TypeError("Column must be greater than or equal to 0, got "+t[s]);return iL.search(t,r,o,a)},"SourceMapConsumer_findMapping");rf.prototype.computeColumnSpans=l(function(){for(var t=0;t<this._generatedMappings.length;++t){var r=this._generatedMappings[t];if(t+1<this._generatedMappings.length){var n=this._generatedMappings[t+1];if(r.generatedLine===n.generatedLine){r.lastGeneratedColumn=n.generatedColumn-1;continue}}r.lastGeneratedColumn=1/0}},"SourceMapConsumer_computeColumnSpans");rf.prototype.originalPositionFor=l(function(t){var r={generatedLine:a0.getArg(t,"line"),generatedColumn:a0.getArg(t,"column")},n=this._findMapping(r,this._generatedMappings,"generatedLine","generatedColumn",a0.compareByGeneratedPositionsDeflated,a0.getArg(t,"bias",ol.GREATEST_LOWER_BOUND));if(n>=0){var s=this._generatedMappings[n];if(s.generatedLine===r.generatedLine){var o=a0.getArg(s,"source",null);o!==null&&(o=this._sources.at(o),o=a0.computeSourceURL(this.sourceRoot,o,this._sourceMapURL));var a=a0.getArg(s,"name",null);return a!==null&&(a=this._names.at(a)),{source:o,line:a0.getArg(s,"originalLine",null),column:a0.getArg(s,"originalColumn",null),name:a}}}return{source:null,line:null,column:null,name:null}},"SourceMapConsumer_originalPositionFor");rf.prototype.hasContentsOfAllSources=l(function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(t){return t==null}):!1},"BasicSourceMapConsumer_hasContentsOfAllSources");rf.prototype.sourceContentFor=l(function(t,r){if(!this.sourcesContent)return null;var n=this._findSourceIndex(t);if(n>=0)return this.sourcesContent[n];var s=t;this.sourceRoot!=null&&(s=a0.relative(this.sourceRoot,s));var o;if(this.sourceRoot!=null&&(o=a0.urlParse(this.sourceRoot))){var a=s.replace(/^file:\/\//,"");if(o.scheme=="file"&&this._sources.has(a))return this.sourcesContent[this._sources.indexOf(a)];if((!o.path||o.path=="/")&&this._sources.has("/"+s))return this.sourcesContent[this._sources.indexOf("/"+s)]}if(r)return null;throw new Error('"'+s+'" is not in the SourceMap.')},"SourceMapConsumer_sourceContentFor");rf.prototype.generatedPositionFor=l(function(t){var r=a0.getArg(t,"source");if(r=this._findSourceIndex(r),r<0)return{line:null,column:null,lastColumn:null};var n={source:r,originalLine:a0.getArg(t,"line"),originalColumn:a0.getArg(t,"column")},s=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",a0.compareByOriginalPositions,a0.getArg(t,"bias",ol.GREATEST_LOWER_BOUND));if(s>=0){var o=this._originalMappings[s];if(o.source===n.source)return{line:a0.getArg(o,"generatedLine",null),column:a0.getArg(o,"generatedColumn",null),lastColumn:a0.getArg(o,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},"SourceMapConsumer_generatedPositionFor");IS.BasicSourceMapConsumer=rf;function W1(e,t){var r=e;typeof e=="string"&&(r=a0.parseSourceMapInput(e));var n=a0.getArg(r,"version"),s=a0.getArg(r,"sections");if(n!=this._version)throw new Error("Unsupported version: "+n);this._sources=new sy,this._names=new sy;var o={line:-1,column:0};this._sections=s.map(function(a){if(a.url)throw new Error("Support for url field in sections not implemented.");var c=a0.getArg(a,"offset"),f=a0.getArg(c,"line"),u=a0.getArg(c,"column");if(f<o.line||f===o.line&&u<o.column)throw new Error("Section offsets must be ordered and non-overlapping.");return o=c,{generatedOffset:{generatedLine:f+1,generatedColumn:u+1},consumer:new ol(a0.getArg(a,"map"),t)}})}l(W1,"IndexedSourceMapConsumer");W1.prototype=Object.create(ol.prototype);W1.prototype.constructor=ol;W1.prototype._version=3;Object.defineProperty(W1.prototype,"sources",{get:function(){for(var e=[],t=0;t<this._sections.length;t++)for(var r=0;r<this._sections[t].consumer.sources.length;r++)e.push(this._sections[t].consumer.sources[r]);return e}});W1.prototype.originalPositionFor=l(function(t){var r={generatedLine:a0.getArg(t,"line"),generatedColumn:a0.getArg(t,"column")},n=iL.search(r,this._sections,function(o,a){var c=o.generatedLine-a.generatedOffset.generatedLine;return c||o.generatedColumn-a.generatedOffset.generatedColumn}),s=this._sections[n];return s?s.consumer.originalPositionFor({line:r.generatedLine-(s.generatedOffset.generatedLine-1),column:r.generatedColumn-(s.generatedOffset.generatedLine===r.generatedLine?s.generatedOffset.generatedColumn-1:0),bias:t.bias}):{source:null,line:null,column:null,name:null}},"IndexedSourceMapConsumer_originalPositionFor");W1.prototype.hasContentsOfAllSources=l(function(){return this._sections.every(function(t){return t.consumer.hasContentsOfAllSources()})},"IndexedSourceMapConsumer_hasContentsOfAllSources");W1.prototype.sourceContentFor=l(function(t,r){for(var n=0;n<this._sections.length;n++){var s=this._sections[n],o=s.consumer.sourceContentFor(t,!0);if(o)return o}if(r)return null;throw new Error('"'+t+'" is not in the SourceMap.')},"IndexedSourceMapConsumer_sourceContentFor");W1.prototype.generatedPositionFor=l(function(t){for(var r=0;r<this._sections.length;r++){var n=this._sections[r];if(n.consumer._findSourceIndex(a0.getArg(t,"source"))!==-1){var s=n.consumer.generatedPositionFor(t);if(s){var o={line:s.line+(n.generatedOffset.generatedLine-1),column:s.column+(n.generatedOffset.generatedLine===s.line?n.generatedOffset.generatedColumn-1:0)};return o}}}return{line:null,column:null}},"IndexedSourceMapConsumer_generatedPositionFor");W1.prototype._parseMappings=l(function(t,r){this.__generatedMappings=[],this.__originalMappings=[];for(var n=0;n<this._sections.length;n++)for(var s=this._sections[n],o=s.consumer._generatedMappings,a=0;a<o.length;a++){var c=o[a],f=s.consumer._sources.at(c.source);f=a0.computeSourceURL(s.consumer.sourceRoot,f,this._sourceMapURL),this._sources.add(f),f=this._sources.indexOf(f);var u=null;c.name&&(u=s.consumer._names.at(c.name),this._names.add(u),u=this._names.indexOf(u));var d={source:f,generatedLine:c.generatedLine+(s.generatedOffset.generatedLine-1),generatedColumn:c.generatedColumn+(s.generatedOffset.generatedLine===c.generatedLine?s.generatedOffset.generatedColumn-1:0),originalLine:c.originalLine,originalColumn:c.originalColumn,name:u};this.__generatedMappings.push(d),typeof d.originalLine=="number"&&this.__originalMappings.push(d)}ob(this.__generatedMappings,a0.compareByGeneratedPositionsDeflated),ob(this.__originalMappings,a0.compareByOriginalPositions)},"IndexedSourceMapConsumer_parseMappings");IS.IndexedSourceMapConsumer=W1});var zZ=Jt(GZ=>{var bye=eL().SourceMapGenerator,AS=iy(),Cye=/(\r?\n)/,_ye=10,oy="$$$isSourceNode$$$";function Ju(e,t,r,n,s){this.children=[],this.sourceContents={},this.line=e==null?null:e,this.column=t==null?null:t,this.source=r==null?null:r,this.name=s==null?null:s,this[oy]=!0,n!=null&&this.add(n)}l(Ju,"SourceNode");Ju.fromStringWithSourceMap=l(function(t,r,n){var s=new Ju,o=t.split(Cye),a=0,c=l(function(){var m=g(),p=g()||"";return m+p;function g(){return a<o.length?o[a++]:void 0}},"shiftNextLine"),f=1,u=0,d=null;return r.eachMapping(function(m){if(d!==null)if(f<m.generatedLine)h(d,c()),f++,u=0;else{var p=o[a]||"",g=p.substr(0,m.generatedColumn-u);o[a]=p.substr(m.generatedColumn-u),u=m.generatedColumn,h(d,g),d=m;return}for(;f<m.generatedLine;)s.add(c()),f++;if(u<m.generatedColumn){var p=o[a]||"";s.add(p.substr(0,m.generatedColumn)),o[a]=p.substr(m.generatedColumn),u=m.generatedColumn}d=m},this),a<o.length&&(d&&h(d,c()),s.add(o.splice(a).join(""))),r.sources.forEach(function(m){var p=r.sourceContentFor(m);p!=null&&(n!=null&&(m=AS.join(n,m)),s.setSourceContent(m,p))}),s;function h(m,p){if(m===null||m.source===void 0)s.add(p);else{var g=n?AS.join(n,m.source):m.source;s.add(new Ju(m.originalLine,m.originalColumn,g,p,m.name))}}l(h,"addMappingWithCode")},"SourceNode_fromStringWithSourceMap");Ju.prototype.add=l(function(t){if(Array.isArray(t))t.forEach(function(r){this.add(r)},this);else if(t[oy]||typeof t=="string")t&&this.children.push(t);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);return this},"SourceNode_add");Ju.prototype.prepend=l(function(t){if(Array.isArray(t))for(var r=t.length-1;r>=0;r--)this.prepend(t[r]);else if(t[oy]||typeof t=="string")this.children.unshift(t);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);return this},"SourceNode_prepend");Ju.prototype.walk=l(function(t){for(var r,n=0,s=this.children.length;n<s;n++)r=this.children[n],r[oy]?r.walk(t):r!==""&&t(r,{source:this.source,line:this.line,column:this.column,name:this.name})},"SourceNode_walk");Ju.prototype.join=l(function(t){var r,n,s=this.children.length;if(s>0){for(r=[],n=0;n<s-1;n++)r.push(this.children[n]),r.push(t);r.push(this.children[n]),this.children=r}return this},"SourceNode_join");Ju.prototype.replaceRight=l(function(t,r){var n=this.children[this.children.length-1];return n[oy]?n.replaceRight(t,r):typeof n=="string"?this.children[this.children.length-1]=n.replace(t,r):this.children.push("".replace(t,r)),this},"SourceNode_replaceRight");Ju.prototype.setSourceContent=l(function(t,r){this.sourceContents[AS.toSetString(t)]=r},"SourceNode_setSourceContent");Ju.prototype.walkSourceContents=l(function(t){for(var r=0,n=this.children.length;r<n;r++)this.children[r][oy]&&this.children[r].walkSourceContents(t);for(var s=Object.keys(this.sourceContents),r=0,n=s.length;r<n;r++)t(AS.fromSetString(s[r]),this.sourceContents[s[r]])},"SourceNode_walkSourceContents");Ju.prototype.toString=l(function(){var t="";return this.walk(function(r){t+=r}),t},"SourceNode_toString");Ju.prototype.toStringWithSourceMap=l(function(t){var r={code:"",line:1,column:0},n=new bye(t),s=!1,o=null,a=null,c=null,f=null;return this.walk(function(u,d){r.code+=u,d.source!==null&&d.line!==null&&d.column!==null?((o!==d.source||a!==d.line||c!==d.column||f!==d.name)&&n.addMapping({source:d.source,original:{line:d.line,column:d.column},generated:{line:r.line,column:r.column},name:d.name}),o=d.source,a=d.line,c=d.column,f=d.name,s=!0):s&&(n.addMapping({generated:{line:r.line,column:r.column}}),o=null,s=!1);for(var h=0,m=u.length;h<m;h++)u.charCodeAt(h)===_ye?(r.line++,r.column=0,h+1===m?(o=null,s=!1):s&&n.addMapping({source:d.source,original:{line:d.line,column:d.column},generated:{line:r.line,column:r.column},name:d.name})):r.column++}),this.walkSourceContents(function(u,d){n.setSourceContent(u,d)}),{code:r.code,map:n}},"SourceNode_toStringWithSourceMap");GZ.SourceNode=Ju});var KZ=Jt(PS=>{PS.SourceMapGenerator=eL().SourceMapGenerator;PS.SourceMapConsumer=VZ().SourceMapConsumer;PS.SourceNode=zZ().SourceNode});var JZ=Jt((IWe,YZ)=>{var Tye=Object.prototype.toString,sL=typeof Buffer.alloc=="function"&&typeof Buffer.allocUnsafe=="function"&&typeof Buffer.from=="function";function Sye(e){return Tye.call(e).slice(8,-1)==="ArrayBuffer"}l(Sye,"isArrayBuffer");function Eye(e,t,r){t>>>=0;var n=e.byteLength-t;if(n<0)throw new RangeError("'offset' is out of bounds");if(r===void 0)r=n;else if(r>>>=0,r>n)throw new RangeError("'length' is out of bounds");return sL?Buffer.from(e.slice(t,t+r)):new Buffer(new Uint8Array(e.slice(t,t+r)))}l(Eye,"fromArrayBuffer");function wye(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!Buffer.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');return sL?Buffer.from(e,t):new Buffer(e,t)}l(wye,"fromString");function Iye(e,t,r){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return Sye(e)?Eye(e,t,r):typeof e=="string"?wye(e,t):sL?Buffer.from(e):new Buffer(e)}l(Iye,"bufferFrom");YZ.exports=Iye});var iee=Jt((m4,cL)=>{var Aye=KZ().SourceMapConsumer,oL=require("path"),em;try{em=require("fs"),(!em.existsSync||!em.readFileSync)&&(em=null)}catch{}var Pye=JZ();function QZ(e,t){return e.require(t)}l(QZ,"dynamicRequire");var XZ=!1,ZZ=!1,aL=!1,ab="auto",h4={},lb={},Rye=/^data:application\/json[^,]+base64,/,w5=[],I5=[];function fL(){return ab==="browser"?!0:ab==="node"?!1:typeof window<"u"&&typeof XMLHttpRequest=="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}l(fL,"isInBrowser");function kye(){return typeof process=="object"&&process!==null&&typeof process.on=="function"}l(kye,"hasGlobalProcessEventEmitter");function Dye(){return typeof process=="object"&&process!==null?process.version:""}l(Dye,"globalProcessVersion");function Nye(){if(typeof process=="object"&&process!==null)return process.stderr}l(Nye,"globalProcessStderr");function Oye(e){if(typeof process=="object"&&process!==null&&typeof process.exit=="function")return process.exit(e)}l(Oye,"globalProcessExit");function RS(e){return function(t){for(var r=0;r<e.length;r++){var n=e[r](t);if(n)return n}return null}}l(RS,"handlerExec");var uL=RS(w5);w5.push(function(e){if(e=e.trim(),/^file:/.test(e)&&(e=e.replace(/file:\/\/\/(\w:)?/,function(n,s){return s?"":"/"})),e in h4)return h4[e];var t="";try{if(em)em.existsSync(e)&&(t=em.readFileSync(e,"utf8"));else{var r=new XMLHttpRequest;r.open("GET",e,!1),r.send(null),r.readyState===4&&r.status===200&&(t=r.responseText)}}catch{}return h4[e]=t});function lL(e,t){if(!e)return t;var r=oL.dirname(e),n=/^\w+:\/\/[^\/]*/.exec(r),s=n?n[0]:"",o=r.slice(s.length);return s&&/^\/\w\:/.test(o)?(s+="/",s+oL.resolve(r.slice(s.length),t).replace(/\\/g,"/")):s+oL.resolve(r.slice(s.length),t)}l(lL,"supportRelativeURL");function Lye(e){var t;if(fL())try{var r=new XMLHttpRequest;r.open("GET",e,!1),r.send(null),t=r.readyState===4?r.responseText:null;var n=r.getResponseHeader("SourceMap")||r.getResponseHeader("X-SourceMap");if(n)return n}catch{}t=uL(e);for(var s=/(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg,o,a;a=s.exec(t);)o=a;return o?o[1]:null}l(Lye,"retrieveSourceMapURL");var dL=RS(I5);I5.push(function(e){var t=Lye(e);if(!t)return null;var r;if(Rye.test(t)){var n=t.slice(t.indexOf(",")+1);r=Pye(n,"base64").toString(),t=e}else t=lL(e,t),r=uL(t);return r?{url:t,map:r}:null});function hL(e){var t=lb[e.source];if(!t){var r=dL(e.source);r?(t=lb[e.source]={url:r.url,map:new Aye(r.map)},t.map.sourcesContent&&t.map.sources.forEach(function(s,o){var a=t.map.sourcesContent[o];if(a){var c=lL(t.url,s);h4[c]=a}})):t=lb[e.source]={url:null,map:null}}if(t&&t.map&&typeof t.map.originalPositionFor=="function"){var n=t.map.originalPositionFor(e);if(n.source!==null)return n.source=lL(t.url,n.source),n}return e}l(hL,"mapSourcePosition");function tee(e){var t=/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(e);if(t){var r=hL({source:t[2],line:+t[3],column:t[4]-1});return"eval at "+t[1]+" ("+r.source+":"+r.line+":"+(r.column+1)+")"}return t=/^eval at ([^(]+) \((.+)\)$/.exec(e),t?"eval at "+t[1]+" ("+tee(t[2])+")":e}l(tee,"mapEvalOrigin");function Fye(){var e,t="";if(this.isNative())t="native";else{e=this.getScriptNameOrSourceURL(),!e&&this.isEval()&&(t=this.getEvalOrigin(),t+=", "),e?t+=e:t+="<anonymous>";var r=this.getLineNumber();if(r!=null){t+=":"+r;var n=this.getColumnNumber();n&&(t+=":"+n)}}var s="",o=this.getFunctionName(),a=!0,c=this.isConstructor(),f=!(this.isToplevel()||c);if(f){var u=this.getTypeName();u==="[object Object]"&&(u="null");var d=this.getMethodName();o?(u&&o.indexOf(u)!=0&&(s+=u+"."),s+=o,d&&o.indexOf("."+d)!=o.length-d.length-1&&(s+=" [as "+d+"]")):s+=u+"."+(d||"<anonymous>")}else c?s+="new "+(o||"<anonymous>"):o?s+=o:(s+=t,a=!1);return a&&(s+=" ("+t+")"),s}l(Fye,"CallSiteToString");function eee(e){var t={};return Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(function(r){t[r]=/^(?:is|get)/.test(r)?function(){return e[r].call(e)}:e[r]}),t.toString=Fye,t}l(eee,"cloneCallSite");function ree(e,t){if(t===void 0&&(t={nextPosition:null,curPosition:null}),e.isNative())return t.curPosition=null,e;var r=e.getFileName()||e.getScriptNameOrSourceURL();if(r){var n=e.getLineNumber(),s=e.getColumnNumber()-1,o=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/,a=o.test(Dye())?0:62;n===1&&s>a&&!fL()&&!e.isEval()&&(s-=a);var c=hL({source:r,line:n,column:s});t.curPosition=c,e=eee(e);var f=e.getFunctionName;return e.getFunctionName=function(){return t.nextPosition==null?f():t.nextPosition.name||f()},e.getFileName=function(){return c.source},e.getLineNumber=function(){return c.line},e.getColumnNumber=function(){return c.column+1},e.getScriptNameOrSourceURL=function(){return c.source},e}var u=e.isEval()&&e.getEvalOrigin();return u&&(u=tee(u),e=eee(e),e.getEvalOrigin=function(){return u}),e}l(ree,"wrapCallSite");function Mye(e,t){aL&&(h4={},lb={});for(var r=e.name||"Error",n=e.message||"",s=r+": "+n,o={nextPosition:null,curPosition:null},a=[],c=t.length-1;c>=0;c--)a.push(`

ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and '/home/gwern/Projects/bac-philo/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
    at file:///home/gwern/Projects/bac-philo/content/.obsidian/plugins/github-copilot/copilot-1.0.3/agent.js:1:31667
    at file:///home/gwern/Projects/bac-philo/content/.obsidian/plugins/github-copilot/copilot-1.0.3/agent.js:1:371
    at file:///home/gwern/Projects/bac-philo/content/.obsidian/plugins/github-copilot/copilot-1.0.3/agent.js:4:1666
    at file:///home/gwern/Projects/bac-philo/content/.obsidian/plugins/github-copilot/copilot-1.0.3/agent.js:1:371
    at file:///home/gwern/Projects/bac-philo/content/.obsidian/plugins/github-copilot/copilot-1.0.3/agent.js:240:77606
    at ModuleJob.run (node:internal/modules/esm/module_job:262:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:475:24)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:109:5)

Node.js v22.2.0
gwerneckp commented 1 month ago

I thought it might be related to my Node version (22.2.0), so I changed it to version 18 with nvm (and added the correct nvm installation path), same result.

Pierrad commented 1 month ago

@gwerneckp this error shows up when you try to enable the debugging mode or when it start the copilot server in the background? (for example when you click on the copilot icon on the bottom status bar)

gwerneckp commented 1 month ago

Both actually.

Pierrad commented 1 month ago

@gwerneckp From the log, it seems that you have a package.json file in the tree structure.

This file is being treated as an ES module because it has a '.js' file extension and '/home/gwern/Projects/bac-philo/package.json' contains "type": "module".

Please can you try to move this file as a test and restart the plugin? Maybe it's what causing the js file to be treated as ESM and not CommonJS as it should be. If it's the issue I will try to fix it so that you can keep your file and use the plugin.

gwerneckp commented 1 month ago

Everything worked now, even the auto-completions. I.e: the entire functionality is working as intended.

Thank you! Been wanting this plugin for ages and never had the courage to do it myself haha.

stdout: Content-Length: 437

{"jsonrpc":"2.0","id":0,"result":{"capabilities":{"textDocumentSync":{"openClose":true,"change":2},"workspace":{"workspaceFolders":{"supported":false,"changeNotifications":false},"executeCommandProvider":{"commands":["github.copilot.didAcceptCompletionItem","github.copilot.didAcceptPanelCompletionItem"]}},"inlineCompletionProvider":{}},"serverInfo":{"name":"GitHub Copilot Language Server","version":"1.186.0","nodeVersion":"22.2.0"}}}
plugin:github-copilot:27018 stdout: Content-Length: 137

{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"[agent] GitHub Copilot Language Server 1.186.0 initialized"}}
plugin:github-copilot:27018 stdout: Content-Length: 98

{"jsonrpc":"2.0","method":"featureFlagsNotification","params":{"rt":false,"sn":false,"chat":true}}
plugin:github-copilot:27018 stdout: Content-Length: 68

{"jsonrpc":"2.0","id":1,"result":{"status":"OK","user":"gwerneckp"}}
plugin:github-copilot:27018 stdout: Content-Length: 38

plugin:github-copilot:27018 stdout: {"jsonrpc":"2.0","id":2,"result":"OK"}
plugin:github-copilot:27018 stdout: Content-Length: 81

{"jsonrpc":"2.0","id":3,"result":{"status":"AlreadySignedIn","user":"gwerneckp"}}
Pierrad commented 1 month ago

@gwerneckp Great! I will try to force the node process to be CommonJS and not rely on package.json.

Pierrad commented 1 month ago

@gwerneckp You can update the plugin to v1.0.4.

The copilot agent file that needs to be run is now a .cjs file so it is interpreted as CommonJS even if there is an ESM package.json in the file structure.

Please tell me if it's working as intended on your side.

gwerneckp commented 1 month ago

Working as intended.