import{C as $}from"./constants-DBKRisMo.js";import{d as j,c as m,f as T,a as g,F as _,e as y,l as A,v as I,h as M,t as D}from"./filter-oGW6vHZL.js";const w={"unknown-parent":{severity:"error",title:e=>"Unknown parent",message:e=>`The parent <code>${e.parent.label}</code> of <code>${(e.term??e.relation).label}</code>
              (<code>${(e.term??e.relation).id||"no id"}</code>) is not known.`},"missing-parent":{severity:"error",title:e=>"Missing parent",message:e=>`The parent <code>${e.parent.label}</code> (<code>${e.parent.id}</code>) of
              <code>${e.term.label}</code>
              (<code>${e.term.id||"no id"}</code>) is neither defined in the Excel files or imported.
              If it is an external term, add the missing import the entry with
              <code>${e.parent.label} [${e.parent.id}]</code>.`},"no-parent":{severity:"error",title:e=>"Term has no parent",message:e=>`The term <code>${e.term.label}</code> (<code>${e.term.id??"no id"}</code>) has no parent!`},"ignored-parent":{severity:"error",title:e=>`${e.status} parent`,message:e=>`The parent <code>${e.parent.label}</code> of <code>${e.term.label}</code>
              (<code>${e.term.id??"no id"}</code>) is ${e.status.toLowerCase()}.<br>`},"missing-label":{severity:"error",title:e=>"Missing label",message:e=>`The term <code>${e.term.id}</code> has no label.`},"missing-id":{severity:"error",title:e=>"Term has no ID",message:e=>`              The term <code>${e.term.label}</code> has no ID but is also not obsolete or pre-proposed. <br>`},"unknown-disjoint":{severity:"error",title:e=>"Unknown disjoint class",message:e=>`The class <code>${e.term.label}</code> (<code>${e.term.id??"no id"}</code>) is
              specified to
              be disjoint with <code>${e.disjoint_class.label}</code> but it is not known.<br>`},"missing-disjoint":{severity:"error",title:e=>"Missing disjoint class",message:e=>`The disjoint class <code>${e.disjoint_class.label}</code> (<code>${e.disjoint_class.id}</code>) of 
              <code>${e.term.label}</code>
              (<code>${e.term.id||"no id"}</code>) is neither defined in the Excel files or imported.
              If it is an external term, add the missing import the entry with
              <code>${e.disjoint_class.label} [${e.disjoint_class.id}]</code>.`},"ignored-disjoint":{severity:"error",title:e=>`${e.status} disjoint class`,message:e=>`The disjoint class <code>${e.disjoint_class.label}</code> of <code>${e.term.label}</code>
              (<code>${e.term.id??"no id"}</code>) is ${e.status.toLowerCase()}.<br>`},"unknown-relation-value":{severity:"error",title:e=>`Unknown value for relation <code>${e.relation.label}</code>`,message:e=>`Related term <code>${e.value.label}</code> of <code>${e.term.label}</code>
              (<code>${e.term.id||"no id"}
            </code>) for <code>${e.relation.label}</code> is not known.`},"missing-relation-value":{severity:"error",title:e=>`Unknown value for relation <code>${e.relation.label}</code>`,message:e=>`Related term <code>${e.value.label}</code> of 
              <code>${e.term.label}</code>
              (<code>${e.term.id||"no id"}</code>) is neither defined in the Excel files or imported.
              If it is an external term, add the missing import the entry with
              <code>${e.value.label} [${e.value.id}]</code>.`},"ignored-relation-value":{severity:"error",title:e=>`${e.status} value for relation <code>${e.relation.label}</code>`,message:e=>`Related term <code>${e.value.label}</code> of <code>${e.term.label}</code>
              (<code>${e.term.id??"no id"}</code>) is ${e.status.toLowerCase()}.`},"unknown-range":{severity:"error",title:e=>"Unknown range",message:e=>`The range <code>${e.relation.range.label}</code> of
              <code>${e.relation.label}</code>
              (<code>${e.relation.id||"no id"}
            </code>) is not known. `},"missing-range":{severity:"error",title:e=>"Missing range",message:e=>`The range <code>${e.relation.range.label}</code> of 
              <code>${e.relation.label}</code>
              (<code>${e.relation.id||"no id"}</code>) is neither defined in the Excel files or imported.
              If it is an external term, add the missing import the entry with
              <code>${e.range.label} [${e.range.id}]</code>.`},"ignored-range":{severity:"error",title:e=>`${e.status} range`,message:e=>`The range <code>${e.range.label}</code> of <code>${e.relation.label}</code>
              (<code>${e.relation.id??"no id"}</code>) is ${e.status.toLowerCase()}.<br>`},"unknown-domain":{severity:"error",title:e=>"Unknown domain",message:e=>`The domain <code>${e.relation.domain.label}</code> of
              <code>${e.relation.label}</code>
              (<code>${e.relation.id||"no id"} </code>) is not known.`},"missing-domain":{severity:"error",title:e=>"Missing domain",message:e=>`The domain <code>${e.relation.domain.label}</code> of 
              <code>${e.relation.label}</code>
              (<code>${e.relation.id||"no id"}</code>) is neither defined in the Excel files or imported.
              If it is an external term, add the missing import the entry with
              <code>${e.domain.label} [${e.domain.id}]</code>.`},"ignored-domain":{severity:"error",title:e=>`${e.status} domain`,message:e=>`The domain <code>${e.domain.label}</code> of <code>${e.relation.label}</code>
              (<code>${e.relation.id??"no id"}</code>) is ${e.status.toLowerCase()}.<br>`},"unknown-relation":{severity:"error",title:e=>"Unknown relation",message:e=>`The relation ${e.relation.label?`<code>${e.relation.label}</code>`+(e.relation.id?"("+e.relation.id+")":""):e.relation.id} is not known`},duplicate:{severity:"error",title:e=>"Conflicting entries (duplicates)",message:e=>`There are multiple terms for the ${e.duplicate_field} <code>${e.duplicate_value}</code>:`},"incomplete-term":{severity:"warning",title:e=>"Incomplete term",message:e=>`There is an incomplete term with no an ID, a label, or a parent defined. Is there an empty line in the
              spreadsheet? The line is ignored`},"unknown-column":{severity:"warning",title:e=>"Unmapped column",message:e=>`The column <code>${e.column}</code> of <code>${e.sheet}</code> is not mapped
              to any OWL property or internal field.`},"missing-import":{severity:"warning",title:e=>"Missing import",message:e=>`The term <code>${e.term.label}</code> (<code>${e.term.id??"no id"}</code>) has the curation
              status
              "External" but is not included in the externally imported terms.`+(e.term.id?` Does the term still exist in
                ${e.term.id.split(":")[0]}?`:"")},"inconsistent-import":{severity:"warning",title:e=>"Inconsistent import",message:e=>`The term <code>${e.term.label}</code> (<code>${e.term.id??"no id"}</code>) has the curation
              status "External" but its `+(e.term.id!==e.imported_term.id?`ID (<code>${e.imported_term.id}</code>)`:`label (<code>${e.imported_term.label}</code>)`)+" differs."}};function P(e,s=100){let r;return(...t)=>(clearTimeout(r),new Promise(o=>{r=setTimeout(()=>{const n=e.apply(void 0,t);n instanceof Promise?n.then(o):o(n)},s)}))}function V(e){return e&&e.type==="navigateToSheet"&&typeof e.repo=="string"&&typeof e.sheet=="string"&&typeof e.filter=="object"}function W(e){return e&&e.type==="navigateToTerm"&&typeof e.repo=="string"&&typeof e.sheet=="string"&&(typeof e.termId=="string"||typeof e.termLabel=="string")}function q(e){return e&&e.type==="focusEditor"}function G(e){return e&&e.type==="scrollToRow"&&typeof e.position=="number"}function k(e,s=30){const r=(e??"").replace(/\n/g," ").trim();return r.length<=s?r:r.substring(0,s)+"..."}function v(e,s,r){const t=r(e)??s??{},o=t[$.LABEL]||null,n=t[$.ID]||null;return o&&n?`${o} (${n})`:o||n||`Row ${e}`}function u(e,s,r){const t=r(e)??s??{};return t[$.LABEL]||t[$.ID]||`Row ${e}`}function h(e){const s={};for(const[r,t]of Object.entries(e))r!=="id"&&(s[r]=t??"");return s}function x(e){const s=new Map;for(const t of e){const o=t.row,n=s.get(o);if(t.type==="add"){const i=h(t.newFields);n&&n.firstAction==="delete"?(n.lastAction="add",n.currentFields={...i}):s.set(o,{rowId:o,firstAction:"add",lastAction:"add",originalFields:{},currentFields:{...i},addedFields:{...i}})}else if(t.type==="delete"){const i=h(t.oldFields);n?(n.lastAction="delete",n.deletedFields={...i}):s.set(o,{rowId:o,firstAction:"delete",lastAction:"delete",originalFields:{...i},currentFields:{},deletedFields:{...i}})}else if(t.type==="change"){const i=h(t.oldFields),c=h(t.newFields);if(n){for(const[l,a]of Object.entries(i))!(l in n.originalFields)&&n.firstAction!=="add"&&(n.originalFields[l]=a??"");for(const[l,a]of Object.entries(c))n.currentFields[l]=a??"";n.lastAction="change"}else{const l={};for(const[f,d]of Object.entries(i))l[f]=d??"";const a={};for(const[f,d]of Object.entries(c))a[f]=d??"";s.set(o,{rowId:o,firstAction:"change",lastAction:"change",originalFields:l,currentFields:a})}}}const r=[];for(const t of s.values()){if(t.firstAction==="add"&&t.lastAction==="delete")continue;if(t.firstAction==="add"&&t.lastAction!=="delete"){r.push({type:"add",row:t.rowId,newFields:t.currentFields,position:0});continue}if(t.lastAction==="delete"&&t.firstAction!=="add"){const i=t.deletedFields??t.originalFields;r.push({type:"delete",row:t.rowId,oldFields:i,position:0});continue}const o={},n={};for(const i of Object.keys(t.originalFields)){const c=t.originalFields[i]??"",l=t.currentFields[i]??c;c!==l&&(o[i]=c,n[i]=l)}for(const i of Object.keys(t.currentFields))i in t.originalFields||(o[i]="",n[i]=t.currentFields[i]??"");Object.keys(o).length!==0&&r.push({type:"change",row:t.rowId,oldFields:o,newFields:n})}return r}function N(e,s,r){const t=x(s);if(t.length===0)return{title:`Update ${e}`,description:""};const o=t.filter(a=>a.type==="change"),n=t.filter(a=>a.type==="add"),i=t.filter(a=>a.type==="delete"),c=C(e,t,o,n,i,r),l=U(o,n,i,r);return{title:c,description:l}}function C(e,s,r,t,o,n){const i=r.length>0,c=t.length>0,l=o.length>0;if((i?1:0)+(c?1:0)+(l?1:0)===1){const d=s[0];if(!d)return`Updating ${e}`;if(i&&r.length===1&&d.type==="change"){const b=Object.keys(d.newFields);if(b.length===1&&b[0]){const F=`Update ${b[0]} of ${u(d.row,d.newFields,n)} in ${e}`;if(F.length<=72)return F}return`Update ${u(d.row,d.newFields,n)} in ${e}`}if(i)return`Update ${r.length} terms in ${e}`;if(c&&t.length===1&&d.type==="add")return`Add ${u(d.row,d.newFields,n)} to ${e}`;if(c)return`Add ${t.length} terms to ${e}`;if(l&&o.length===1&&d.type==="delete")return`Delete ${u(d.row,d.oldFields,n)} from ${e}`;if(l)return`Delete ${o.length} terms from ${e}`}const f=[];return i&&f.push(`update ${r.length}`),c&&f.push(`add ${t.length}`),l&&f.push(`delete ${o.length}`),`Edit ${e}: ${f.join(", ")}`}const p=50;function U(e,s,r,t){const o=[];if(e.length>0){o.push("Updated terms:");for(const i of e){if(o.length>=p)break;const c=v(i.row,i.newFields,t),l=Object.keys(i.oldFields).map(a=>`${a}: "${k(i.oldFields[a]??"")}" -> "${k(i.newFields[a]??"")}"`);o.push(`- ${c}: ${l.join(", ")}`)}o.push("")}if(s.length>0){o.push("Added terms:");for(const i of s){if(o.length>=p)break;o.push(`- ${v(i.row,i.newFields,t)}`)}o.push("")}if(r.length>0){o.push("Deleted terms:");for(const i of r){if(o.length>=p)break;o.push(`- ${v(i.row,i.oldFields,t)}`)}o.push("")}const n=e.length+s.length+r.length;for(o.length>=p&&o.push(`... and more changes (${n} total)`);o.length>0&&o[o.length-1]==="";)o.pop();return o.join(`
`)}const E=["innerHTML"],L=["innerHTML"],O={key:0},S={key:1},R=["innerHTML"],X=j({__name:"Diagnostic",props:{diagnostic:{},severity:{default:null},format:{default:"long"}},setup(e){const s=e,r=A(()=>({severity:w[s.diagnostic.type].severity,title:w[s.diagnostic.type].title(s.diagnostic),message:w[s.diagnostic.type].message(s.diagnostic)}));return(t,o)=>e.format==="long"?(g(),m(_,{key:0},[y("h5",{innerHTML:r.value.title},null,8,E),y("p",{innerHTML:r.value.message},null,8,L),t.$slots.default?(g(),m("p",O,[I(t.$slots,"default")])):T("",!0)],64)):e.format==="inline"?(g(),m("p",S,[y("span",{innerHTML:r.value.message},null,8,R)])):e.format==="text"?(g(),m(_,{key:2},[M(D(r.value.message.replace(/(<([^>]+)>)/ig,"")),1)],64)):T("",!0)}});export{w as D,X as _,q as a,W as b,V as c,P as d,N as g,G as i,x as s};
