kissyjpf_rtm-sync/main.js
creamhead dd3ed3f216 Rewrite md5.ts with proper TypeScript types
Replace eslint-disable blanket with fully typed implementation:
- Add return types to all functions
- Use number[] with fill(0) instead of sparse Array()
- Add xi() helper to safely index number[] under noUncheckedIndexedAccess
- Replace substr with slice

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-13 18:53:57 +09:00

26 lines
17 KiB
JavaScript

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var Q=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var ot=Object.getOwnPropertyNames;var ct=Object.prototype.hasOwnProperty;var lt=(C,g)=>{for(var s in g)Q(C,s,{get:g[s],enumerable:!0})},mt=(C,g,s,d)=>{if(g&&typeof g=="object"||typeof g=="function")for(let e of ot(g))!ct.call(C,e)&&e!==s&&Q(C,e,{get:()=>g[e],enumerable:!(d=at(g,e))||d.enumerable});return C};var dt=C=>mt(Q({},"__esModule",{value:!0}),C);var gt={};lt(gt,{default:()=>q});module.exports=dt(gt);var u=require("obsidian");function K(C){function g(t,k){return t<<k|t>>>32-k}function s(t,k){let b=t&1073741824,T=k&1073741824,S=t&2147483648,D=k&2147483648,F=(t&1073741823)+(k&1073741823);return b&T?F^2147483648^S^D:b|T?F&1073741824?F^3221225472^S^D:F^1073741824^S^D:F^S^D}function d(t,k,b){return t&k|~t&b}function e(t,k,b){return t&b|k&~b}function m(t,k,b){return t^k^b}function c(t,k,b){return k^(t|~b)}function h(t,k,b,T,S,D,F){return t=s(t,s(s(d(k,b,T),S),F)),s(g(t,D),k)}function f(t,k,b,T,S,D,F){return t=s(t,s(s(e(k,b,T),S),F)),s(g(t,D),k)}function w(t,k,b,T,S,D,F){return t=s(t,s(s(m(k,b,T),S),F)),s(g(t,D),k)}function p(t,k,b,T,S,D,F){return t=s(t,s(s(c(k,b,T),S),F)),s(g(t,D),k)}function y(t){var it,rt;let k,b=t.length,T=b+8,D=((T-T%64)/64+1)*16,F=new Array(D).fill(0),G=0,P=0;for(;P<b;)k=(P-P%4)/4,G=P%4*8,F[k]=((it=F[k])!=null?it:0)|t.charCodeAt(P)<<G,P++;return k=(P-P%4)/4,G=P%4*8,F[k]=((rt=F[k])!=null?rt:0)|128<<G,F[D-2]=b<<3,F[D-1]=b>>>29,F}function A(t){let k="",b="",T,S;for(S=0;S<=3;S++)T=t>>>S*8&255,b="0"+T.toString(16),k=k+b.slice(b.length-2);return k}function E(t){t=t.replace(/\r\n/g,`
`);let k="";for(let b=0;b<t.length;b++){let T=t.charCodeAt(b);T<128?k+=String.fromCharCode(T):T>127&&T<2048?(k+=String.fromCharCode(T>>6|192),k+=String.fromCharCode(T&63|128)):(k+=String.fromCharCode(T>>12|224),k+=String.fromCharCode(T>>6&63|128),k+=String.fromCharCode(T&63|128))}return k}function o(t,k){var b;return(b=t[k])!=null?b:0}let x=7,L=12,R=17,$=22,v=5,B=9,N=14,j=20,_=4,M=11,V=16,I=23,O=6,W=10,U=15,H=21;C=E(C);let l=y(C),tt,et,st,nt,n=1732584193,i=4023233417,r=2562383102,a=271733878;for(let t=0;t<l.length;t+=16)tt=n,et=i,st=r,nt=a,n=h(n,i,r,a,o(l,t+0),x,3614090360),a=h(a,n,i,r,o(l,t+1),L,3905402710),r=h(r,a,n,i,o(l,t+2),R,606105819),i=h(i,r,a,n,o(l,t+3),$,3250441966),n=h(n,i,r,a,o(l,t+4),x,4118548399),a=h(a,n,i,r,o(l,t+5),L,1200080426),r=h(r,a,n,i,o(l,t+6),R,2821735955),i=h(i,r,a,n,o(l,t+7),$,4249261313),n=h(n,i,r,a,o(l,t+8),x,1770035416),a=h(a,n,i,r,o(l,t+9),L,2336552879),r=h(r,a,n,i,o(l,t+10),R,4294925233),i=h(i,r,a,n,o(l,t+11),$,2304563134),n=h(n,i,r,a,o(l,t+12),x,1804603682),a=h(a,n,i,r,o(l,t+13),L,4254626195),r=h(r,a,n,i,o(l,t+14),R,2792965006),i=h(i,r,a,n,o(l,t+15),$,1236535329),n=f(n,i,r,a,o(l,t+1),v,4129170786),a=f(a,n,i,r,o(l,t+6),B,3225465664),r=f(r,a,n,i,o(l,t+11),N,643717713),i=f(i,r,a,n,o(l,t+0),j,3921069994),n=f(n,i,r,a,o(l,t+5),v,3593408605),a=f(a,n,i,r,o(l,t+10),B,38016083),r=f(r,a,n,i,o(l,t+15),N,3634488961),i=f(i,r,a,n,o(l,t+4),j,3889429448),n=f(n,i,r,a,o(l,t+9),v,568446438),a=f(a,n,i,r,o(l,t+14),B,3275163606),r=f(r,a,n,i,o(l,t+3),N,4107603335),i=f(i,r,a,n,o(l,t+8),j,1163531501),n=f(n,i,r,a,o(l,t+13),v,2850285829),a=f(a,n,i,r,o(l,t+2),B,4243563512),r=f(r,a,n,i,o(l,t+7),N,1735328473),i=f(i,r,a,n,o(l,t+12),j,2368359562),n=w(n,i,r,a,o(l,t+5),_,4294588738),a=w(a,n,i,r,o(l,t+8),M,2272392833),r=w(r,a,n,i,o(l,t+11),V,1839030562),i=w(i,r,a,n,o(l,t+14),I,4259657740),n=w(n,i,r,a,o(l,t+1),_,2763975236),a=w(a,n,i,r,o(l,t+4),M,1272893353),r=w(r,a,n,i,o(l,t+7),V,4139469664),i=w(i,r,a,n,o(l,t+10),I,3200236656),n=w(n,i,r,a,o(l,t+13),_,681279174),a=w(a,n,i,r,o(l,t+0),M,3936430074),r=w(r,a,n,i,o(l,t+3),V,3572445317),i=w(i,r,a,n,o(l,t+6),I,76029189),n=w(n,i,r,a,o(l,t+9),_,3654602809),a=w(a,n,i,r,o(l,t+12),M,3873151461),r=w(r,a,n,i,o(l,t+15),V,530742520),i=w(i,r,a,n,o(l,t+2),I,3299628645),n=p(n,i,r,a,o(l,t+0),O,4096336452),a=p(a,n,i,r,o(l,t+7),W,1126891415),r=p(r,a,n,i,o(l,t+14),U,2878612391),i=p(i,r,a,n,o(l,t+5),H,4237533241),n=p(n,i,r,a,o(l,t+12),O,1700485571),a=p(a,n,i,r,o(l,t+3),W,2399980690),r=p(r,a,n,i,o(l,t+10),U,4293915773),i=p(i,r,a,n,o(l,t+1),H,2240044497),n=p(n,i,r,a,o(l,t+8),O,1873313359),a=p(a,n,i,r,o(l,t+15),W,4264355552),r=p(r,a,n,i,o(l,t+6),U,2734768916),i=p(i,r,a,n,o(l,t+13),H,1309151649),n=p(n,i,r,a,o(l,t+4),O,4149444226),a=p(a,n,i,r,o(l,t+11),W,3174756917),r=p(r,a,n,i,o(l,t+2),U,718787259),i=p(i,r,a,n,o(l,t+9),H,3951481745),n=s(n,tt),i=s(i,et),r=s(r,st),a=s(a,nt);return(A(n)+A(i)+A(r)+A(a)).toLowerCase()}var ut="https://www.rememberthemilk.com/services/auth/",Z="https://api.rememberthemilk.com/services/rest/",ht={apiKey:"",sharedSecret:"",authToken:"",defaultDueForNewTask:"none",noteCreationFolder:"",importWithNotesAndLink:!1},q=class extends u.Plugin{constructor(){super(...arguments);this.timeline=null}async onload(){await this.loadSettings(),this.addSettingTab(new X(this.app,this)),this.addCommand({id:"import-rtm-tasks",name:"Download all incomplete tasks",editorCallback:async(s,d)=>{this.checkAuth()&&await this.fetchAndProcessTasks("status:incomplete",!1,e=>{this.insertTasksToEditor(s,e)})}}),this.addCommand({id:"select-rtm-tasks",name:"Select and import tasks",editorCallback:async(s,d)=>{this.checkAuth()&&await this.fetchAndProcessTasks("status:incomplete",!0,e=>{this.insertTasksToEditor(s,e)})}}),this.addCommand({id:"import-rtm-tasks-custom",name:"Download tasks (Custom Filter)",editorCallback:async(s,d)=>{this.checkAuth()&&new J(this.app,e=>{this.fetchAndProcessTasks(e,!0,m=>{this.insertTasksToEditor(s,m)})}).open()}}),this.addCommand({id:"create-note-from-rtm-task",name:"Create note from RTM task",callback:async()=>{this.checkAuth()&&await this.fetchAndProcessTasks("status:incomplete",!0,s=>{this.createNotesFromTasks(s)})}}),this.addCommand({id:"add-rtm-task",name:"Add cursor line to RTM",editorCallback:async(s,d)=>{this.checkAuth()&&await this.addTaskFromEditor(s,d)}}),this.addCommand({id:"complete-rtm-task",name:"Complete task at cursor",editorCallback:async(s,d)=>{this.checkAuth()&&await this.completeTaskInEditor(s)}})}checkAuth(){return!this.settings.apiKey||!this.settings.sharedSecret?(new u.Notice("Please set your API Key and Secret in settings."),!1):this.settings.authToken?!0:(new u.Notice("Please authenticate with RTM from settings."),!1)}async fetchListsMap(){var d;let s={};try{let e=await this.callRtmApi("rtm.lists.getList");if((d=e.rsp.lists)!=null&&d.list){let m=Array.isArray(e.rsp.lists.list)?e.rsp.lists.list:[e.rsp.lists.list];for(let c of m)c!=null&&c.id&&(c!=null&&c.name)&&(s[c.id]=c.name)}}catch(e){console.error("List fetch error:",e)}return s}async fetchAndProcessTasks(s,d,e){var m,c,h,f;new u.Notice("Fetching tasks...");try{let w=await this.fetchListsMap(),p=await this.callRtmApi("rtm.tasks.getList",{filter:s,notes:"1"});if(!((m=p.rsp.tasks)!=null&&m.list)){new u.Notice("No tasks found.");return}let y=[],A=Array.isArray(p.rsp.tasks.list)?p.rsp.tasks.list:[p.rsp.tasks.list];for(let E of A){if(!E.taskseries)continue;let o=Array.isArray(E.taskseries)?E.taskseries:[E.taskseries];for(let x of o){let L=x.name,R=Array.isArray(x.task)?x.task[0]:x.task,$=E.id;!$&&x.list_id&&($=x.list_id),$||($="MISSING");let v="";R.due&&R.due!==""&&(v=`\u{1F4C5} ${R.due.split("T")[0]}`);let B="";R.start&&R.start!==""&&(B=`\u{1F6EB} ${R.start.split("T")[0]}`);let N="";switch(R.priority){case"1":N="\u{1F53A}";break;case"2":N="\u{1F53C}";break;case"3":N="\u{1F53D}";break}let j=(c=w[$])!=null?c:"",_=[];(h=x.tags)!=null&&h.tag&&(Array.isArray(x.tags.tag)?x.tags.tag:[x.tags.tag]).forEach(I=>_.push(I));let M=[];(f=x.notes)!=null&&f.note&&(Array.isArray(x.notes.note)?x.notes.note:[x.notes.note]).forEach(I=>{var W;let O=(W=I.$t)!=null?W:String(I);O&&M.push(O)}),y.push({name:L,due:v,start:B,priority:N,listName:j,tags:_,notes:M,rtmId:{list:$,series:x.id,task:R.id},rawPriority:R.priority,rawDue:R.due})}}d?new z(this.app,y,E=>{e(E)}).open():e(y)}catch(w){console.error(w),new u.Notice("Fetch error.")}}insertTasksToEditor(s,d){if(d.length===0){new u.Notice("No tasks selected.");return}let e="";for(let m of d){let c="";m.listName&&(c=` #${m.listName.replace(/[\s,.]+/g,"_")}`);let h=m.tags.map(y=>` #${y}`).join(""),f=`[\u{1F42E}](rtm:${m.rtmId.list}:${m.rtmId.series}:${m.rtmId.task})`,w=m.priority?` ${m.priority}`:"",p=m.due?` ${m.due}`:"";if(e+=`- [ ] ${f} ${m.name}${w}${p}${c}${h}
`,this.settings.importWithNotesAndLink){let y=`https://www.rememberthemilk.com/app/#all/${m.rtmId.task}`;e+=` - RTM Link: ${y}
`,m.notes&&m.notes.length>0&&m.notes.forEach(A=>{A.split(`
`).forEach(o=>{o.trim()!==""&&(e+=` - Note: ${o}
`)})})}}s.replaceSelection(e),new u.Notice(`${d.length} tasks inserted.`)}async createNotesFromTasks(s){if(s.length===0){new u.Notice("No tasks selected.");return}let d=0;for(let e of s){let m=e.name.replace(/[\\/:*?"<>|]/g,"-"),c=this.settings.noteCreationFolder.trim();c.endsWith("/")&&(c=c.slice(0,-1)),c.startsWith("/")&&(c=c.slice(1)),c&&await this.ensureFolderExists(c);let h=c?`${c}/${m}.md`:`${m}.md`;this.app.vault.getAbstractFileByPath(h)&&(h=c?`${c}/${m}-${Date.now()}.md`:`${m}-${Date.now()}.md`);let f=e.tags.map(y=>`#${y}`).join(" "),w=e.listName?`#${e.listName.replace(/[\s,.]+/g,"_")}`:"",p=`# ${e.name}
`;p+=`- **RTM Link**: [\u{1F42E} Open Task](rtm:${e.rtmId.list}:${e.rtmId.series}:${e.rtmId.task})
`,e.due&&(p+=`- **Due**: ${e.due}
`),e.start&&(p+=`- **Start**: ${e.start}
`),e.priority&&(p+=`- **Priority**: ${e.priority}
`),(w||f)&&(p+=`- **Tags**: ${w} ${f}
`),p+=`
---
`,e.notes.length>0?(p+=`## Notes
`,e.notes.forEach(y=>{p+=`${y}
`})):p+=`(No notes in RTM)
`;try{await this.app.vault.create(h,p),d++}catch(y){console.error(`Failed to create file: ${h}`,y),new u.Notice(`Failed to create note for "${e.name}"`)}}new u.Notice(`${d} notes created.`)}async addTaskFromEditor(s,d){var f;let e=s.getCursor(),c=s.getLine(e.line).replace(/^[-*] \[[ x]\] /,"").replace(/^[-*] /,"").trim();if(!c){new u.Notice("Task name is empty.");return}new u.Notice(`Adding: ${c}`);let h=d.file?d.file.basename:"";try{let w=await this.getTimeline(),y=(f=(await this.callRtmApi("rtm.tasks.add",{timeline:w,name:c,parse:"1"})).rsp.tasks)==null?void 0:f.list,A=Array.isArray(y)?y[0]:y,E=A.id,o=A.taskseries,x=Array.isArray(o)?o[0]:o,L=x.id,$=(Array.isArray(x.task)?x.task[0]:x.task).id;if(this.settings.defaultDueForNewTask==="today")try{await this.callRtmApi("rtm.tasks.setDueDate",{timeline:w,list_id:E,taskseries_id:L,task_id:$,due:"today",parse:"1"})}catch(N){console.error("Failed to set due date",N)}if(h)try{await this.callRtmApi("rtm.tasks.notes.add",{timeline:w,list_id:E,taskseries_id:L,task_id:$,note_title:"Obsidian Link",note_text:`From Obsidian Note: [[${h}]]`})}catch(N){console.error("Failed to add note to RTM task",N)}let B=`- [ ] ${`[\u{1F42E}](rtm:${E}:${L}:${$})`} ${c}`;s.setLine(e.line,B),new u.Notice("Added to RTM!")}catch(w){console.error("Add Task Error:",w),new u.Notice("Add error.")}}async completeTaskInEditor(s){let d=s.getCursor(),e=s.getLine(d.line),m=/\(rtm:([\w\d]+):([\w\d]+):([\w\d]+)\)/,c=e.match(m);if(!c){new u.Notice("Error: No RTM Link found.");return}let h=c[1],f=c[2],w=c[3];if(!h||h==="MISSING"){new u.Notice("Error: List ID invalid.");return}new u.Notice("Completing task...");try{let p=await this.getTimeline();await this.callRtmApi("rtm.tasks.complete",{timeline:p,list_id:h,taskseries_id:f,task_id:w});let y=e.replace("- [ ]","- [x]");s.setLine(d.line,y),new u.Notice("Task completed!")}catch(p){console.error("Completion Error:",p),new u.Notice("Completion error.")}}async getTimeline(){var e;if(this.timeline)return this.timeline;let d=(e=(await this.callRtmApi("rtm.timelines.create")).rsp.timeline)!=null?e:"";return this.timeline=d,d}async callRtmApi(s,d={}){var A;let e=this.settings.apiKey,m=this.settings.sharedSecret;if(!e||!m)throw new Error("API Key/Secret missing");let c={...d,method:s,api_key:e,format:"json",auth_token:this.settings.authToken},h=Object.keys(c).sort(),f=m;for(let E of h)f+=E+c[E];c.api_sig=K(f);let w=`${Z}?${new URLSearchParams(c).toString()}`,y=(await(0,u.requestUrl)({url:w})).json;if(y.rsp.stat!=="ok")throw console.error("API Error:",y),new Error(`API Error: ${(A=y.rsp.err)==null?void 0:A.msg}`);return y}async ensureFolderExists(s){if(!s)return;let d=s.split("/"),e="";for(let m of d)if(m&&(e=e===""?m:`${e}/${m}`,!this.app.vault.getAbstractFileByPath(e)))try{await this.app.vault.adapter.mkdir(e)}catch(c){console.error(`Failed to create folder: ${e}`,c)}}async loadSettings(){this.settings=Object.assign({},ht,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}},z=class extends u.Modal{constructor(g,s,d){super(g),this.tasks=s,this.selected=new Array(s.length).fill(!1),this.onSubmit=d}onOpen(){let{contentEl:g}=this;new u.Setting(g).setName(`Select Tasks (${this.tasks.length})`).setHeading();let s=g.createDiv({cls:"rtm-task-list"});this.tasks.forEach((c,h)=>{var y;let f=s.createDiv({cls:"rtm-task-item"}),w=f.createEl("input",{type:"checkbox"});w.checked=(y=this.selected[h])!=null?y:!1,w.onchange=A=>{this.selected[h]=A.target.checked};let p=f.createSpan({cls:"rtm-task-label"});p.createEl("b",{text:c.name}),c.listName&&p.createEl("small",{text:` [${c.listName}]`,cls:"rtm-task-list-name"}),c.due&&p.createEl("small",{text:` ${c.due}`,cls:"rtm-task-due"}),c.notes&&c.notes.length>0&&p.createEl("small",{text:" \u{1F4DD}"})});let d=g.createDiv({cls:"rtm-btn-row"}),e=d.createEl("button",{text:"Select All"});e.onclick=()=>{let c=this.selected.every(Boolean);this.selected.fill(!c),s.querySelectorAll('input[type="checkbox"]').forEach(f=>f.checked=!c),e.textContent=c?"Select All":"Deselect All"};let m=d.createEl("button",{text:"Process Selected"});m.className="mod-cta",m.onclick=()=>{let c=this.tasks.filter((h,f)=>this.selected[f]);this.onSubmit(c),this.close()}}onClose(){this.contentEl.empty()}},J=class extends u.Modal{constructor(g,s){super(g),this.onSubmit=s}onOpen(){let{contentEl:g}=this;g.createEl("h3",{text:"Filter RTM Tasks"}),new u.Setting(g).setName("Search Query").setDesc("e.g. list:Inbox, due:today").addText(s=>s.setValue("status:incomplete").onChange(d=>{}).inputEl.addEventListener("keydown",d=>{d.key==="Enter"&&(this.onSubmit(s.getValue()),this.close())})),new u.Setting(g).addButton(s=>s.setButtonText("Search").setCta().onClick(()=>{let d=g.querySelector("input");d&&(this.onSubmit(d.value),this.close())}))}onClose(){this.contentEl.empty()}},X=class extends u.PluginSettingTab{constructor(g,s){super(g,s),this.plugin=s}display(){let{containerEl:g}=this;g.empty(),new u.Setting(g).setName("Connection").setHeading(),g.createEl("p",{text:`Version: ${this.plugin.manifest.version} (Build: 6/13/2026, 6:53:51 PM)`,cls:"setting-item-description rtm-version-info"}),new u.Setting(g).setName("API Key").addText(e=>e.setValue(this.plugin.settings.apiKey).onChange(async m=>{this.plugin.settings.apiKey=m,await this.plugin.saveSettings()})),new u.Setting(g).setName("Shared Secret").addText(e=>e.setValue(this.plugin.settings.sharedSecret).onChange(async m=>{this.plugin.settings.sharedSecret=m,await this.plugin.saveSettings()}));let d=new u.Setting(g).setName("Auth");this.plugin.settings.authToken&&d.setDesc("\u2705 Authorized"),d.addButton(e=>e.setButtonText("Start Auth").onClick(async()=>await this.startAuthProcess())),new u.Setting(g).setName("Default Due Date").setDesc("Setting for new tasks created from editor").addDropdown(e=>e.addOption("none","No Due Date").addOption("today","Today").setValue(this.plugin.settings.defaultDueForNewTask).onChange(async m=>{this.plugin.settings.defaultDueForNewTask=m,await this.plugin.saveSettings()})),new u.Setting(g).setName("Note Creation Folder").setDesc("Folder to create notes from RTM tasks.").addDropdown(e=>{e.addOption("","/ (Vault Root)"),this.app.vault.getAllLoadedFiles().filter(c=>c instanceof u.TFolder).forEach(c=>{c.path!=="/"&&e.addOption(c.path,c.path)}),e.setValue(this.plugin.settings.noteCreationFolder),e.onChange(async c=>{this.plugin.settings.noteCreationFolder=c,await this.plugin.saveSettings()})}),new u.Setting(g).setName("Import with Notes and RTM Link").setDesc("When inserting tasks to the editor, also include RTM task notes and links as sub-items.").addToggle(e=>e.setValue(this.plugin.settings.importWithNotesAndLink).onChange(async m=>{this.plugin.settings.importWithNotesAndLink=m,await this.plugin.saveSettings()}))}async startAuthProcess(){var y;let g=this.plugin,s=g.settings.apiKey,d=g.settings.sharedSecret;if(!s||!d){new u.Notice("Enter keys first");return}let e={method:"rtm.auth.getFrob",api_key:s,format:"json"},m=d;Object.keys(e).sort().forEach(A=>m+=A+e[A]),e.api_sig=K(m);let h=(y=(await(0,u.requestUrl)({url:`${Z}?${new URLSearchParams(e).toString()}`})).json.rsp.frob)!=null?y:"",f={api_key:s,perms:"delete",frob:h},w=d;Object.keys(f).sort().forEach(A=>w+=A+f[A]);let p=K(w);window.open(`${ut}?api_key=${s}&perms=delete&frob=${h}&api_sig=${p}`),new Y(this.app,h,g,()=>{this.display()}).open()}},Y=class extends u.Modal{constructor(g,s,d,e){super(g),this.frob=s,this.plugin=d,this.onSuccess=e}onOpen(){let{contentEl:g}=this;new u.Setting(g).addButton(s=>s.setButtonText("Finish Auth").setCta().onClick(async()=>{let d=this.plugin.settings.apiKey,e=this.plugin.settings.sharedSecret,m={method:"rtm.auth.getToken",api_key:d,format:"json",frob:this.frob},c=e;Object.keys(m).sort().forEach(h=>c+=h+m[h]),m.api_sig=K(c);try{let f=(await(0,u.requestUrl)({url:`${Z}?${new URLSearchParams(m).toString()}`})).json;f.rsp.auth?(this.plugin.settings.authToken=f.rsp.auth.token,await this.plugin.saveSettings(),new u.Notice("Success!"),this.onSuccess(),this.close()):new u.Notice("Failed.")}catch(h){new u.Notice("Error.")}}))}onClose(){this.contentEl.empty()}};