';i({title:this.t("plugins.generic.codecheck.codecheckers.addCodechecker"),message:n,actions:[{label:this.t("plugins.generic.codecheck.modal.cancel"),callback:o=>o()},{label:this.t("plugins.generic.codecheck.modal.add"),isPrimary:!0,callback:o=>{const t=document.getElementById("checker-name"),a=document.getElementById("checker-orcid"),s=(t==null?void 0:t.value)||"",d=(a==null?void 0:a.value)||"";s.trim()&&this.metadata.codecheckers.push({name:s.trim(),orcid:d.trim()}),o()}}]})},showFallbackCodecheckerModal(){const c=prompt(this.t("plugins.generic.codecheck.codecheckers.enterName"));if(c&&c.trim()){const i=prompt(this.t("plugins.generic.codecheck.codecheckers.enterOrcid"));this.metadata.codecheckers.push({name:c.trim(),orcid:i?i.trim():""})}},removeCodechecker(c){confirm(this.t("plugins.generic.codecheck.codecheckers.removeConfirm"))&&this.metadata.codecheckers.splice(c,1)},async saveMetadata(){if(this.validateForm()){this.saving=!0,this.saveMessage="";try{const c={version:this.metadata.version,publication_type:this.metadata.publicationType,manifest:this.metadata.manifest,repository:this.repositories.join(", "),source:this.metadata.source,codecheckers:this.metadata.codecheckers,certificate:this.metadata.certificate,check_time:this.metadata.check_time,summary:this.metadata.summary,report:this.metadata.report,additional_content:this.metadata.additionalContent};console.log("Saving CODECHECK data:",c);const i=this.submission.id;let n=pkp.context.apiBaseUrl;n+="codecheck",n=`${n}/metadata?submissionId=${i}`;const o=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-Csrf-Token":pkp.currentUser.csrfToken},body:JSON.stringify(c)}),t=await o.json();if(!o.ok||!t.success)throw new Error(`[HTTP ${o.status}] ${t.error}`);this.hasUnsavedChanges=!1,this.showMessage(this.t("plugins.generic.codecheck.savedSuccessfully"),"success")}catch(c){console.error("Save error:",c),this.showMessage(this.t("plugins.generic.codecheck.saveFailed")+": "+c.message,"error")}finally{this.saving=!1}}},async generateYamlContent(){try{const c=this.submission.id;let i=pkp.context.apiBaseUrl;i+="codecheck",i=`${i}/yaml?submissionId=${c}`;const n=await fetch(i,{method:"GET",headers:{"X-Csrf-Token":pkp.currentUser.csrfToken}});if(!n.ok)throw new Error("Failed to generate YAML");return(await n.json()).yaml}catch(c){throw console.error("Yaml generation error:",c),c}},async previewYaml(){try{const c=await this.generateYamlContent();if(!await this.validateGeneratedYamlFile(c))return;this.canUsePkpModal()?this.showYamlModal(c):this.showYamlFallback(c)}catch(c){console.error("Preview error:",c),this.showMessage(`${this.t("plugins.generic.codecheck.yamlPreviewFailed")}
-${c}`,"error")}},showYamlModal(c){const{useModal:i}=pkp.modules.useModal,{openDialog:n}=i(),o="downloadCodecheckYaml_"+Date.now();window[o]=function(){const a=new Blob([c],{type:"text/yaml"}),s=URL.createObjectURL(a),d=document.createElement("a");d.href=s,d.download="codecheck.yml",d.click(),URL.revokeObjectURL(s)};const t='